@gjsify/vm 0.4.34 → 0.4.36
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/lib/esm/browser.js +1 -0
- package/lib/types/browser.d.ts +49 -0
- package/package.json +19 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";const e=Symbol(`vm.context`);function _enotsup(e){let t=Error(`@gjsify/vm: ${e} is not supported in the browser polyfill`);return t.code=`ENOTSUP`,t}function runInThisContext(e,t){return(0,eval)(e)}function runInNewContext(e,t,n){let r=t||{},i=Object.keys(r),a=i.map(e=>r[e]);return Function(...i,`return eval(${JSON.stringify(e)})`)(...a)}function runInContext(e,t,n){return runInNewContext(e,t)}function createContext(t){let n=t||{};return Object.defineProperty(n,e,{value:!0,enumerable:!1}),n}function isContext(t){if(typeof t!=`object`||!t)throw TypeError(`The "object" argument must be of type object. Received ${t===null?`null`:`type ${typeof t}`}`);return t[e]===!0}function compileFunction(e,t,n){return Function(...t||[],e)}var Script=class{_code;constructor(e,t){this._code=e}runInThisContext(e){return(0,eval)(this._code)}runInNewContext(e,t){return runInNewContext(this._code,e)}runInContext(e,t){return runInNewContext(this._code,e)}createCachedData(){return new Uint8Array}},Module=class{constructor(e,t){throw _enotsup(`vm.Module`)}},SourceTextModule=class{constructor(e,t){throw _enotsup(`vm.SourceTextModule`)}},SyntheticModule=class{constructor(e,t,n){throw _enotsup(`vm.SyntheticModule`)}};function measureMemory(e){return Promise.reject(_enotsup(`vm.measureMemory`))}const t={DONT_CONTEXTIFY:Symbol(`vm.constants.DONT_CONTEXTIFY`),USE_MAIN_CONTEXT_DEFAULT_LOADER:Symbol(`vm.constants.USE_MAIN_CONTEXT_DEFAULT_LOADER`)};var n={runInThisContext,runInNewContext,runInContext,createContext,isContext,compileFunction,Script,Module,SourceTextModule,SyntheticModule,measureMemory,constants:t};export{Module,Script,SourceTextModule,SyntheticModule,compileFunction,t as constants,createContext,n as default,isContext,measureMemory,runInContext,runInNewContext,runInThisContext};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare function runInThisContext(code: string, _options?: Record<string, unknown>): unknown;
|
|
2
|
+
export declare function runInNewContext(code: string, context?: Record<string, unknown>, _options?: Record<string, unknown>): unknown;
|
|
3
|
+
export declare function runInContext(code: string, context: Record<string, unknown>, _options?: Record<string, unknown>): unknown;
|
|
4
|
+
export declare function createContext(context?: Record<string, unknown>): Record<string, unknown>;
|
|
5
|
+
export declare function isContext(context: unknown): boolean;
|
|
6
|
+
export declare function compileFunction(code: string, params?: string[], _options?: {
|
|
7
|
+
parsingContext?: Record<string, unknown>;
|
|
8
|
+
contextExtensions?: object[];
|
|
9
|
+
}): Function;
|
|
10
|
+
export declare class Script {
|
|
11
|
+
private _code;
|
|
12
|
+
constructor(code: string, _options?: Record<string, unknown>);
|
|
13
|
+
runInThisContext(_options?: Record<string, unknown>): unknown;
|
|
14
|
+
runInNewContext(context?: Record<string, unknown>, _options?: Record<string, unknown>): unknown;
|
|
15
|
+
runInContext(context: Record<string, unknown>, _options?: Record<string, unknown>): unknown;
|
|
16
|
+
createCachedData(): Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
export declare class Module {
|
|
19
|
+
constructor(_code: string, _options?: Record<string, unknown>);
|
|
20
|
+
}
|
|
21
|
+
export declare class SourceTextModule {
|
|
22
|
+
constructor(_code: string, _options?: Record<string, unknown>);
|
|
23
|
+
}
|
|
24
|
+
export declare class SyntheticModule {
|
|
25
|
+
constructor(_exportNames: string[], _evaluateCallback: () => void, _options?: Record<string, unknown>);
|
|
26
|
+
}
|
|
27
|
+
export declare function measureMemory(_options?: Record<string, unknown>): Promise<unknown>;
|
|
28
|
+
export declare const constants: {
|
|
29
|
+
DONT_CONTEXTIFY: symbol;
|
|
30
|
+
USE_MAIN_CONTEXT_DEFAULT_LOADER: symbol;
|
|
31
|
+
};
|
|
32
|
+
declare const _default: {
|
|
33
|
+
runInThisContext: typeof runInThisContext;
|
|
34
|
+
runInNewContext: typeof runInNewContext;
|
|
35
|
+
runInContext: typeof runInContext;
|
|
36
|
+
createContext: typeof createContext;
|
|
37
|
+
isContext: typeof isContext;
|
|
38
|
+
compileFunction: typeof compileFunction;
|
|
39
|
+
Script: typeof Script;
|
|
40
|
+
Module: typeof Module;
|
|
41
|
+
SourceTextModule: typeof SourceTextModule;
|
|
42
|
+
SyntheticModule: typeof SyntheticModule;
|
|
43
|
+
measureMemory: typeof measureMemory;
|
|
44
|
+
constants: {
|
|
45
|
+
DONT_CONTEXTIFY: symbol;
|
|
46
|
+
USE_MAIN_CONTEXT_DEFAULT_LOADER: symbol;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/vm",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.36",
|
|
4
4
|
"description": "Node.js vm module for Gjs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"types": "./lib/types/index.d.ts",
|
|
11
11
|
"default": "./lib/esm/index.js"
|
|
12
12
|
},
|
|
13
|
+
"./browser": {
|
|
14
|
+
"types": "./lib/types/browser.d.ts",
|
|
15
|
+
"default": "./lib/esm/browser.js"
|
|
16
|
+
},
|
|
13
17
|
"./globals": "./globals.mjs"
|
|
14
18
|
},
|
|
15
19
|
"files": [
|
|
@@ -35,10 +39,10 @@
|
|
|
35
39
|
"vm"
|
|
36
40
|
],
|
|
37
41
|
"devDependencies": {
|
|
38
|
-
"@gjsify/cli": "^0.4.
|
|
39
|
-
"@gjsify/unit": "^0.4.
|
|
42
|
+
"@gjsify/cli": "^0.4.36",
|
|
43
|
+
"@gjsify/unit": "^0.4.36",
|
|
40
44
|
"@types/node": "^25.9.1",
|
|
41
|
-
"typescript": "^
|
|
45
|
+
"typescript": "^5.9.3"
|
|
42
46
|
},
|
|
43
47
|
"gjsify": {
|
|
44
48
|
"runtimes": {
|
|
@@ -46,5 +50,15 @@
|
|
|
46
50
|
"node": "native",
|
|
47
51
|
"browser": "polyfill"
|
|
48
52
|
}
|
|
49
|
-
}
|
|
53
|
+
},
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "git+https://github.com/gjsify/gjsify.git",
|
|
58
|
+
"directory": "packages/node/vm"
|
|
59
|
+
},
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/gjsify/gjsify/issues"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/node/vm#readme"
|
|
50
64
|
}
|