@ticatec/dyna-js 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/DynaJs.js ADDED
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("./utils");
4
+ class DynaJs {
5
+ constructor(config = {}) {
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
7
+ this.config = {
8
+ defaultTimeout: (_a = config.defaultTimeout) !== null && _a !== void 0 ? _a : 5000,
9
+ defaultStrict: (_b = config.defaultStrict) !== null && _b !== void 0 ? _b : true,
10
+ allowedGlobals: (_c = config.allowedGlobals) !== null && _c !== void 0 ? _c : [],
11
+ blockedGlobals: (_d = config.blockedGlobals) !== null && _d !== void 0 ? _d : [],
12
+ defaultImports: (_e = config.defaultImports) !== null && _e !== void 0 ? _e : {},
13
+ defaultInjectedKeys: (_f = config.defaultInjectedKeys) !== null && _f !== void 0 ? _f : [],
14
+ useProxyByDefault: (_g = config.useProxyByDefault) !== null && _g !== void 0 ? _g : true,
15
+ allowTimers: (_h = config.allowTimers) !== null && _h !== void 0 ? _h : false,
16
+ allowDynamicImports: (_j = config.allowDynamicImports) !== null && _j !== void 0 ? _j : false,
17
+ validateCode: (_k = config.validateCode) !== null && _k !== void 0 ? _k : true,
18
+ allowBrowserAPIs: (_l = config.allowBrowserAPIs) !== null && _l !== void 0 ? _l : false,
19
+ allowNodeAPIs: (_m = config.allowNodeAPIs) !== null && _m !== void 0 ? _m : false
20
+ };
21
+ }
22
+ async execute(code, options = {}) {
23
+ var _a, _b;
24
+ const startTime = performance.now();
25
+ try {
26
+ if (this.config.validateCode) {
27
+ (0, utils_1.validateCode)(code, {
28
+ allowTimers: this.config.allowTimers,
29
+ allowDynamicImports: this.config.allowDynamicImports
30
+ });
31
+ }
32
+ const context = this.prepareContext(options.context, options.imports);
33
+ const timeout = (_a = options.timeout) !== null && _a !== void 0 ? _a : this.config.defaultTimeout;
34
+ const strict = (_b = options.strict) !== null && _b !== void 0 ? _b : this.config.defaultStrict;
35
+ const result = await this.executeWithTimeout(code, context, timeout, strict);
36
+ const executionTime = performance.now() - startTime;
37
+ return {
38
+ result: result,
39
+ executionTime
40
+ };
41
+ }
42
+ catch (error) {
43
+ const executionTime = performance.now() - startTime;
44
+ throw new Error(`Script execution failed after ${executionTime.toFixed(2)}ms: ${error instanceof Error ? error.message : String(error)}`);
45
+ }
46
+ }
47
+ executeSync(code, options = {}) {
48
+ var _a;
49
+ const startTime = performance.now();
50
+ try {
51
+ if (this.config.validateCode) {
52
+ (0, utils_1.validateCode)(code, {
53
+ allowTimers: this.config.allowTimers,
54
+ allowDynamicImports: this.config.allowDynamicImports
55
+ });
56
+ }
57
+ const context = this.prepareContext(options.context, options.imports);
58
+ const strict = (_a = options.strict) !== null && _a !== void 0 ? _a : this.config.defaultStrict;
59
+ const result = this.executeCode(code, context, strict);
60
+ const executionTime = performance.now() - startTime;
61
+ return {
62
+ result: result,
63
+ executionTime
64
+ };
65
+ }
66
+ catch (error) {
67
+ const executionTime = performance.now() - startTime;
68
+ throw new Error(`Script execution failed after ${executionTime.toFixed(2)}ms: ${error instanceof Error ? error.message : String(error)}`);
69
+ }
70
+ }
71
+ async executeWithTimeout(code, context, timeout, strict) {
72
+ return new Promise((resolve, reject) => {
73
+ const timer = setTimeout(() => {
74
+ reject(new Error(`Script execution timed out after ${timeout}ms`));
75
+ }, timeout);
76
+ try {
77
+ const result = this.executeCode(code, context, strict);
78
+ clearTimeout(timer);
79
+ resolve(result);
80
+ }
81
+ catch (error) {
82
+ clearTimeout(timer);
83
+ reject(error);
84
+ }
85
+ });
86
+ }
87
+ executeCode(code, context, strict) {
88
+ const contextKeys = Object.keys(context);
89
+ const contextValues = Object.values(context);
90
+ const strictMode = strict ? '"use strict";' : '';
91
+ const wrappedCode = `${strictMode}\nreturn (function() {\n${code}\n})();`;
92
+ try {
93
+ const func = new Function(...contextKeys, wrappedCode);
94
+ return func.apply(null, contextValues);
95
+ }
96
+ catch (error) {
97
+ throw new Error(`Code execution error: ${error instanceof Error ? error.message : String(error)}`);
98
+ }
99
+ }
100
+ createFunction(code, paramNames = [], options = {}) {
101
+ var _a;
102
+ const context = this.prepareContext(options.context, options.imports);
103
+ const strict = (_a = options.strict) !== null && _a !== void 0 ? _a : this.config.defaultStrict;
104
+ const strictMode = strict ? '"use strict";' : '';
105
+ const wrappedCode = `${strictMode}\n${code}`;
106
+ try {
107
+ const contextKeys = Object.keys(context);
108
+ const contextValues = Object.values(context);
109
+ const allParams = [...contextKeys, ...paramNames];
110
+ const func = new Function(...allParams, wrappedCode);
111
+ return ((...args) => {
112
+ const allArgs = [...contextValues, ...args];
113
+ return func.apply(null, allArgs);
114
+ });
115
+ }
116
+ catch (error) {
117
+ throw new Error(`Function creation error: ${error instanceof Error ? error.message : String(error)}`);
118
+ }
119
+ }
120
+ executeWithImports(code, imports, options = {}) {
121
+ return this.executeSync(code, Object.assign(Object.assign({}, options), { imports: Object.assign(Object.assign({}, this.config.defaultImports), imports) }));
122
+ }
123
+ async executeWithImportsAsync(code, imports, options = {}) {
124
+ return this.execute(code, Object.assign(Object.assign({}, options), { imports: Object.assign(Object.assign({}, this.config.defaultImports), imports) }));
125
+ }
126
+ createFormClass(code, context = {}, injectedKeys = []) {
127
+ const useProxy = this.config.useProxyByDefault;
128
+ const mergedContext = Object.assign(Object.assign({}, context), this.config.defaultImports);
129
+ const mergedKeys = [...this.config.defaultInjectedKeys, ...injectedKeys];
130
+ if (useProxy) {
131
+ return this.executeWithProxy(code, mergedContext, mergedKeys);
132
+ }
133
+ else {
134
+ return this.executeSync(code, {
135
+ context: mergedContext,
136
+ imports: this.config.defaultImports
137
+ }).result;
138
+ }
139
+ }
140
+ executeWithProxy(code, context, injectedKeys) {
141
+ const injected = {};
142
+ for (const key of injectedKeys) {
143
+ if (context.window && key in context.window) {
144
+ injected[key] = context.window[key];
145
+ }
146
+ else if (key in context) {
147
+ injected[key] = context[key];
148
+ }
149
+ }
150
+ const sandboxContext = Object.assign(Object.assign({}, context), injected);
151
+ const sandbox = new Proxy(sandboxContext, {
152
+ has(target, key) {
153
+ if (key in target)
154
+ return true;
155
+ if (context.window && key in context.window)
156
+ return true;
157
+ return false;
158
+ },
159
+ get(target, key) {
160
+ if (key in target)
161
+ return target[key];
162
+ if (context.window && key in context.window)
163
+ return context.window[key];
164
+ console.warn(`DynaJs: ${String(key)} not found`);
165
+ return undefined;
166
+ }
167
+ });
168
+ const wrappedCode = `
169
+ with (sandbox) {
170
+ ${Object.keys(sandbox).map(k => `const ${k} = sandbox.${k};`).join('\n')}
171
+
172
+ ${code}
173
+ }
174
+ `;
175
+ const fn = new Function('sandbox', wrappedCode);
176
+ return fn(sandbox);
177
+ }
178
+ static initialize(config) {
179
+ if (DynaJs.instance == null) {
180
+ DynaJs.instance = new DynaJs(config);
181
+ }
182
+ return DynaJs.instance;
183
+ }
184
+ static getInstance() {
185
+ if (DynaJs.instance == null) {
186
+ throw new Error("DynaJs hasn't been initialized. Call DynaJs.initialize() first.");
187
+ }
188
+ return DynaJs.instance;
189
+ }
190
+ static reset() {
191
+ DynaJs.instance = null;
192
+ }
193
+ prepareContext(userContext = {}, imports = {}) {
194
+ let context = (0, utils_1.createSafeContext)(userContext, {
195
+ allowBrowserAPIs: this.config.allowBrowserAPIs,
196
+ allowNodeAPIs: this.config.allowNodeAPIs,
197
+ blockedKeys: this.config.blockedGlobals
198
+ });
199
+ context = Object.assign(Object.assign(Object.assign({}, context), this.config.defaultImports), imports);
200
+ if (this.config.allowedGlobals.length > 0) {
201
+ const allowedContext = {};
202
+ for (const key of this.config.allowedGlobals) {
203
+ if (key in context) {
204
+ allowedContext[key] = context[key];
205
+ }
206
+ }
207
+ context = allowedContext;
208
+ }
209
+ return context;
210
+ }
211
+ }
212
+ DynaJs.instance = null;
213
+ exports.default = DynaJs;
@@ -0,0 +1,9 @@
1
+ import DynaJs from './DynaJs';
2
+ export * from './types';
3
+ export * from './utils';
4
+ export declare function createDynaJs(config?: import('./types').DynaJsConfig): DynaJs;
5
+ export declare function initializeDynaJs(config: import('./types').DynaJsConfig): DynaJs;
6
+ export declare function getDynaJs(): DynaJs;
7
+ export { DynaJs };
8
+ export default DynaJs;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAO,UAAU,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AAExB,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,SAAS,EAAE,YAAY,UAEnE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,SAAS,EAAE,YAAY,UAEtE;AAED,wBAAgB,SAAS,WAExB;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,eAAe,MAAM,CAAC"}
@@ -0,0 +1,14 @@
1
+ import DynaJs from './DynaJs';
2
+ export * from './types';
3
+ export * from './utils';
4
+ export function createDynaJs(config) {
5
+ return new DynaJs(config);
6
+ }
7
+ export function initializeDynaJs(config) {
8
+ return DynaJs.initialize(config);
9
+ }
10
+ export function getDynaJs() {
11
+ return DynaJs.getInstance();
12
+ }
13
+ export { DynaJs };
14
+ export default DynaJs;
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.DynaJs = void 0;
21
+ exports.createDynaJs = createDynaJs;
22
+ exports.initializeDynaJs = initializeDynaJs;
23
+ exports.getDynaJs = getDynaJs;
24
+ const DynaJs_1 = __importDefault(require("./DynaJs"));
25
+ exports.DynaJs = DynaJs_1.default;
26
+ __exportStar(require("./types"), exports);
27
+ __exportStar(require("./utils"), exports);
28
+ function createDynaJs(config) {
29
+ return new DynaJs_1.default(config);
30
+ }
31
+ function initializeDynaJs(config) {
32
+ return DynaJs_1.default.initialize(config);
33
+ }
34
+ function getDynaJs() {
35
+ return DynaJs_1.default.getInstance();
36
+ }
37
+ exports.default = DynaJs_1.default;
@@ -0,0 +1,33 @@
1
+ export interface ExecutionContext {
2
+ [key: string]: any;
3
+ }
4
+ export interface ModuleImports {
5
+ [key: string]: any;
6
+ }
7
+ export interface ExecutionOptions {
8
+ context?: ExecutionContext;
9
+ timeout?: number;
10
+ strict?: boolean;
11
+ imports?: ModuleImports;
12
+ injectedKeys?: string[];
13
+ useProxy?: boolean;
14
+ }
15
+ export interface ExecutionResult<T = any> {
16
+ result: T;
17
+ executionTime: number;
18
+ }
19
+ export interface DynaJsConfig {
20
+ defaultTimeout?: number;
21
+ defaultStrict?: boolean;
22
+ allowedGlobals?: string[];
23
+ blockedGlobals?: string[];
24
+ defaultImports?: ModuleImports;
25
+ defaultInjectedKeys?: string[];
26
+ useProxyByDefault?: boolean;
27
+ allowTimers?: boolean;
28
+ allowDynamicImports?: boolean;
29
+ validateCode?: boolean;
30
+ allowBrowserAPIs?: boolean;
31
+ allowNodeAPIs?: boolean;
32
+ }
33
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,GAAG;IACtC,MAAM,EAAE,CAAC,CAAC;IACV,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
@@ -0,0 +1 @@
1
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ export declare function isNode(): boolean;
2
+ export declare function isBrowser(): boolean;
3
+ export declare function createSafeContext(context?: Record<string, any>, options?: {
4
+ allowBrowserAPIs?: boolean;
5
+ allowNodeAPIs?: boolean;
6
+ blockedKeys?: string[];
7
+ }): Record<string, any>;
8
+ export declare function validateCode(code: string, options?: {
9
+ allowTimers?: boolean;
10
+ allowDynamicImports?: boolean;
11
+ }): void;
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,IAAI,OAAO,CAIhC;AAED,wBAAgB,SAAS,IAAI,OAAO,CAGnC;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EACjC,OAAO,GAAE;IACP,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,GACL,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAgCrB;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC1B,GACL,IAAI,CAkCN"}
@@ -0,0 +1,61 @@
1
+ export function isNode() {
2
+ return typeof process !== 'undefined' &&
3
+ process.versions != null &&
4
+ process.versions.node != null;
5
+ }
6
+ export function isBrowser() {
7
+ return typeof window !== 'undefined' &&
8
+ typeof document !== 'undefined';
9
+ }
10
+ export function createSafeContext(context = {}, options = {}) {
11
+ const safeContext = { ...context };
12
+ if (isBrowser() && !options.allowBrowserAPIs) {
13
+ safeContext.window = undefined;
14
+ safeContext.document = undefined;
15
+ safeContext.localStorage = undefined;
16
+ safeContext.sessionStorage = undefined;
17
+ safeContext.fetch = undefined;
18
+ safeContext.XMLHttpRequest = undefined;
19
+ }
20
+ if (isNode() && !options.allowNodeAPIs) {
21
+ safeContext.process = undefined;
22
+ safeContext.require = undefined;
23
+ safeContext.global = undefined;
24
+ safeContext.__dirname = undefined;
25
+ safeContext.__filename = undefined;
26
+ }
27
+ // 始终阻止这些危险函数
28
+ safeContext.eval = undefined;
29
+ safeContext.Function = undefined;
30
+ // 阻止自定义的键
31
+ if (options.blockedKeys) {
32
+ for (const key of options.blockedKeys) {
33
+ safeContext[key] = undefined;
34
+ }
35
+ }
36
+ return safeContext;
37
+ }
38
+ export function validateCode(code, options = {}) {
39
+ if (typeof code !== 'string') {
40
+ throw new Error('Code must be a string');
41
+ }
42
+ if (code.trim().length === 0) {
43
+ throw new Error('Code cannot be empty');
44
+ }
45
+ const dangerousPatterns = [
46
+ /eval\s*\(/,
47
+ /Function\s*\(/,
48
+ /new\s+Function\s*\(/
49
+ ];
50
+ if (!options.allowTimers) {
51
+ dangerousPatterns.push(/setTimeout\s*\(/, /setInterval\s*\(/);
52
+ }
53
+ if (!options.allowDynamicImports) {
54
+ dangerousPatterns.push(/import\s*\(/, /require\s*\(/);
55
+ }
56
+ for (const pattern of dangerousPatterns) {
57
+ if (pattern.test(code)) {
58
+ throw new Error(`Potentially dangerous code pattern detected: ${pattern.source}`);
59
+ }
60
+ }
61
+ }
package/dist/utils.js ADDED
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNode = isNode;
4
+ exports.isBrowser = isBrowser;
5
+ exports.createSafeContext = createSafeContext;
6
+ exports.validateCode = validateCode;
7
+ function isNode() {
8
+ return typeof process !== 'undefined' &&
9
+ process.versions != null &&
10
+ process.versions.node != null;
11
+ }
12
+ function isBrowser() {
13
+ return typeof window !== 'undefined' &&
14
+ typeof document !== 'undefined';
15
+ }
16
+ function createSafeContext(context = {}, options = {}) {
17
+ const safeContext = Object.assign({}, context);
18
+ if (isBrowser() && !options.allowBrowserAPIs) {
19
+ safeContext.window = undefined;
20
+ safeContext.document = undefined;
21
+ safeContext.localStorage = undefined;
22
+ safeContext.sessionStorage = undefined;
23
+ safeContext.fetch = undefined;
24
+ safeContext.XMLHttpRequest = undefined;
25
+ }
26
+ if (isNode() && !options.allowNodeAPIs) {
27
+ safeContext.process = undefined;
28
+ safeContext.require = undefined;
29
+ safeContext.global = undefined;
30
+ safeContext.__dirname = undefined;
31
+ safeContext.__filename = undefined;
32
+ }
33
+ // 始终阻止这些危险函数
34
+ safeContext.eval = undefined;
35
+ safeContext.Function = undefined;
36
+ // 阻止自定义的键
37
+ if (options.blockedKeys) {
38
+ for (const key of options.blockedKeys) {
39
+ safeContext[key] = undefined;
40
+ }
41
+ }
42
+ return safeContext;
43
+ }
44
+ function validateCode(code, options = {}) {
45
+ if (typeof code !== 'string') {
46
+ throw new Error('Code must be a string');
47
+ }
48
+ if (code.trim().length === 0) {
49
+ throw new Error('Code cannot be empty');
50
+ }
51
+ const dangerousPatterns = [
52
+ /eval\s*\(/,
53
+ /Function\s*\(/,
54
+ /new\s+Function\s*\(/
55
+ ];
56
+ if (!options.allowTimers) {
57
+ dangerousPatterns.push(/setTimeout\s*\(/, /setInterval\s*\(/);
58
+ }
59
+ if (!options.allowDynamicImports) {
60
+ dangerousPatterns.push(/import\s*\(/, /require\s*\(/);
61
+ }
62
+ for (const pattern of dangerousPatterns) {
63
+ if (pattern.test(code)) {
64
+ throw new Error(`Potentially dangerous code pattern detected: ${pattern.source}`);
65
+ }
66
+ }
67
+ }
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@ticatec/dyna-js",
3
+ "version": "0.0.2",
4
+ "description": "A TypeScript library for dynamic code execution using new Function() that works in both Node.js and browser environments",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.esm.js",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "README_CN.md",
19
+ "LICENSE"
20
+ ],
21
+ "scripts": {
22
+ "build": "node build.js",
23
+ "clean": "rm -rf dist dist-esm",
24
+ "prebuild": "npm run clean",
25
+ "prepublishOnly": "npm run build",
26
+ "test": "echo \"Error: no test specified\" && exit 1",
27
+ "dev": "tsc -w",
28
+ "publish:public": "npm run build && npm publish --access public"
29
+ },
30
+ "keywords": [
31
+ "dynamic",
32
+ "script",
33
+ "loader",
34
+ "function",
35
+ "typescript",
36
+ "browser",
37
+ "nodejs",
38
+ "universal"
39
+ ],
40
+ "author": "Ticatec Auckland",
41
+ "license": "MIT",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/ticatec/DynaJS.git",
45
+ "directory": "dynamic-script-loader"
46
+ },
47
+ "bugs": {
48
+ "url": "https://github.com/ticatec/DynaJS/issues"
49
+ },
50
+ "homepage": "https://github.com/ticatec/DynaJS#readme",
51
+ "devDependencies": {
52
+ "@types/node": "^24.10.1",
53
+ "typescript": "^5.0.0"
54
+ },
55
+ "engines": {
56
+ "node": ">=14.0.0"
57
+ }
58
+ }