Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-plugin-codefend

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-codefend - npm Package Compare versions

Comparing version 3.1.2 to 3.2.0-alpha.1

29

dist/index.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc