**New option**: sourceMapSourcesMode allows to control sources and sourcesContent fields of the source map

Fixed some cases with wrong source map file name generation when `sourceMapFileName` option is set
This commit is contained in:
sanex
2021-07-19 22:19:48 +03:00
parent fd5d3e6f59
commit b3fc8bc595
26 changed files with 1364 additions and 663 deletions
+10 -3
View File
@@ -17,6 +17,7 @@ import { ObfuscationTarget } from '../enums/ObfuscationTarget';
import { OptionsPreset } from '../enums/options/presets/OptionsPreset';
import { RenamePropertiesMode } from '../enums/node-transformers/rename-properties-transformers/RenamePropertiesMode';
import { SourceMapMode } from '../enums/source-map/SourceMapMode';
import { SourceMapSourcesMode } from '../enums/source-map/SourceMapSourcesMode';
import { StringArrayEncoding } from '../enums/node-transformers/string-array-transformers/StringArrayEncoding';
import { StringArrayIndexesType } from '../enums/node-transformers/string-array-transformers/StringArrayIndexesType';
import { StringArrayWrappersType } from '../enums/node-transformers/string-array-transformers/StringArrayWrappersType';
@@ -53,10 +54,10 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
public static readonly obfuscatedFilePrefix: string = '-obfuscated';
/**
* @type {commander.CommanderStatic}
* @type {commander.Command}
*/
@initializable()
private commands!: commander.CommanderStatic;
private commands!: commander.Command;
/**
* @type {IdentifierNamesCacheFileUtils}
@@ -144,7 +145,7 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
}
public initialize (): void {
this.commands = <commander.CommanderStatic>(new commander.Command());
this.commands = new commander.Command();
this.configureCommands();
this.configureHelp();
@@ -352,6 +353,12 @@ export class JavaScriptObfuscatorCLI implements IInitializable {
`Values: ${CLIUtils.stringifyOptionAvailableValues(SourceMapMode)}. ` +
`Default: ${SourceMapMode.Separate}`
)
.option(
'--source-map-sources-mode <string>',
'Specify source map sources mode. ' +
`Values: ${CLIUtils.stringifyOptionAvailableValues(SourceMapSourcesMode)}. ` +
`Default: ${SourceMapSourcesMode.SourcesContent}`
)
.option(
'--split-strings <boolean>',
'Splits literal strings into chunks with length of `splitStringsChunkLength` option value',