rollup-plugin-codefend
Advanced tools
Comparing version 3.1.2 to 3.2.0-alpha.1
@@ -1,2 +0,2 @@ | ||
import { IObfuscationOptions } from 'codefend/build/src/core/options'; | ||
import { ICodefendTransformationOptions, ICodefendDebugOptions, ICodefendParserOptions, ICodefendInternalTransformationOptions, ICodefendInternalDebugOptions, ICodefendInternalParserOptions } from 'codefend'; | ||
@@ -7,25 +7,14 @@ type IRollupCodefend = { | ||
generateBundle: () => void; | ||
___options: IObfuscationOptions; | ||
___options: IRollupCodefendInternalOptions; | ||
}; | ||
type IRollupCodefendOptions = { | ||
transformation?: { | ||
prefix?: string; | ||
static?: ICodefendTransformationStatic[]; | ||
ignore?: string[]; | ||
}; | ||
debug?: { | ||
stats?: boolean; | ||
}; | ||
parser?: { | ||
regexList?: ICodefendParserRegexListItem[]; | ||
}; | ||
transformation?: ICodefendTransformationOptions; | ||
debug?: ICodefendDebugOptions; | ||
parser?: ICodefendParserOptions; | ||
}; | ||
type ICodefendParserRegexListItem = { | ||
name: string; | ||
value: string; | ||
type IRollupCodefendInternalOptions = { | ||
transformation: ICodefendInternalTransformationOptions; | ||
debug: ICodefendInternalDebugOptions; | ||
parser: ICodefendInternalParserOptions; | ||
}; | ||
type ICodefendTransformationStatic = { | ||
from: string; | ||
to: string; | ||
}; | ||
@@ -32,0 +21,0 @@ declare const codefend: (options?: IRollupCodefendOptions) => IRollupCodefend; |
@@ -27,57 +27,12 @@ "use strict"; | ||
// src/options/OptionsBuilder.ts | ||
// src/options/OptionsAdapter.ts | ||
var import_codefend = require("codefend"); | ||
// src/data/Constants.ts | ||
var DEFAULT_TRANSFORMATION_PREFIX = "Ox"; | ||
var DEFAULT_PARSER_REGEX_LIST = [ | ||
{ | ||
flag: "g", | ||
name: "main", | ||
value: "([a-zA-Z]+(_[a-zA-Z0-9]+)+)" | ||
} | ||
]; | ||
// src/options/OptionsAdapter.ts | ||
var OptionsAdapter = class { | ||
transform(pluginOptions) { | ||
return { | ||
stats: this.stats(pluginOptions), | ||
prefix: this.prefix(pluginOptions), | ||
ignoredWords: this.ignoredWords(pluginOptions), | ||
predefinedWords: this.predefinedWords(pluginOptions), | ||
regexList: this.regexList(pluginOptions) | ||
parser: (0, import_codefend.buildParserOptions)({ name: "codeOnly" }).data, | ||
transformation: (0, import_codefend.buildTransformationOptions)(pluginOptions.transformation), | ||
debug: (0, import_codefend.buildDebugOptions)(pluginOptions.debug) | ||
}; | ||
} | ||
stats(pluginOptions) { | ||
var _a, _b; | ||
return (_b = (_a = pluginOptions == null ? void 0 : pluginOptions.debug) == null ? void 0 : _a.stats) != null ? _b : true; | ||
} | ||
prefix(pluginOptions) { | ||
var _a, _b; | ||
return (_b = (_a = pluginOptions == null ? void 0 : pluginOptions.transformation) == null ? void 0 : _a.prefix) != null ? _b : DEFAULT_TRANSFORMATION_PREFIX; | ||
} | ||
ignoredWords(pluginOptions) { | ||
var _a, _b; | ||
return (_b = (_a = pluginOptions == null ? void 0 : pluginOptions.transformation) == null ? void 0 : _a.ignore) != null ? _b : []; | ||
} | ||
predefinedWords(pluginOptions) { | ||
var _a, _b, _c; | ||
return (_c = (_b = (_a = pluginOptions == null ? void 0 : pluginOptions.transformation) == null ? void 0 : _a.static) == null ? void 0 : _b.map(({ from, to }) => { | ||
return { | ||
originalWord: from, | ||
targetWord: to | ||
}; | ||
})) != null ? _c : []; | ||
} | ||
regexList(pluginOptions) { | ||
var _a, _b, _c; | ||
return (_c = (_b = (_a = pluginOptions == null ? void 0 : pluginOptions.parser) == null ? void 0 : _a.regexList) == null ? void 0 : _b.map((e) => { | ||
return { | ||
flag: "g", | ||
name: e.name, | ||
value: e.value | ||
}; | ||
})) != null ? _c : DEFAULT_PARSER_REGEX_LIST; | ||
} | ||
}; | ||
@@ -135,22 +90,2 @@ var OptionsAdapter_default = new OptionsAdapter(); | ||
} | ||
}, | ||
parser: { | ||
type: "object", | ||
properties: { | ||
regexList: { | ||
type: "array", | ||
items: { | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string" | ||
}, | ||
value: { | ||
type: "string" | ||
} | ||
}, | ||
required: ["name", "value"] | ||
} | ||
} | ||
} | ||
} | ||
@@ -178,5 +113,3 @@ } | ||
this.pluginOptions = pluginOptions; | ||
this.libraryOptions = (0, import_codefend.buildObfuscationOptions)( | ||
OptionsAdapter_default.transform(pluginOptions) | ||
); | ||
this.libraryOptions = OptionsAdapter_default.transform(pluginOptions); | ||
return this; | ||
@@ -191,3 +124,4 @@ } | ||
this.additionalIgnoredWords.forEach((word) => { | ||
this.libraryOptions.ignoredWords.push(word); | ||
var _a; | ||
(_a = this.libraryOptions.transformation) == null ? void 0 : _a.ignore.push(word); | ||
}); | ||
@@ -207,6 +141,6 @@ return this.libraryOptions; | ||
transform(code) { | ||
return (0, import_codefend2.obfuscate)(code, ___options, runtimeOptions); | ||
return (0, import_codefend2.obfuscate)(code, ___options.transformation, ___options.parser, runtimeOptions); | ||
}, | ||
generateBundle: function write() { | ||
(0, import_codefend2.stats)({ stats: ___options.stats }, runtimeOptions); | ||
(0, import_codefend2.stats)({ stats: ___options.debug.stats }, runtimeOptions); | ||
}, | ||
@@ -213,0 +147,0 @@ ___options |
{ | ||
"name": "rollup-plugin-codefend", | ||
"version": "3.1.2", | ||
"version": "3.2.0-alpha.1", | ||
"description": "Rollup plugin for code obfuscation based on Codefend", | ||
@@ -49,12 +49,12 @@ "keywords": [ | ||
"@typescript-eslint/eslint-plugin": "^7.16.1", | ||
"@typescript-eslint/parser": "^7.16.0", | ||
"cspell": "^8.10.4", | ||
"@typescript-eslint/parser": "^7.18.0", | ||
"cspell": "^8.13.1", | ||
"eslint": "^8.56.0", | ||
"prettier": "^3.3.3", | ||
"tsup": "^8.1.0", | ||
"tsup": "^8.2.3", | ||
"typescript": "^5.5.2", | ||
"vitest": "^2.0.3" | ||
"vitest": "^2.0.5" | ||
}, | ||
"dependencies": { | ||
"codefend": "^2.1.0", | ||
"codefend": "^3.1.0-alpha.1", | ||
"schema-utils": "^4.0.0" | ||
@@ -61,0 +61,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27159
276
1
+ Added@colors/colors@1.5.0(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedcli-table3@0.6.5(transitive)
+ Addedcodefend@3.2.0(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
- Removedchalk@5.3.0(transitive)
- Removedcodefend@2.1.0(transitive)
- Removedcommander@10.0.1(transitive)
Updatedcodefend@^3.1.0-alpha.1