@isolated-vm/experimental 0.0.8 → 0.0.9
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/addon/resolve.js +2 -2
- package/backend/backend.cts +7 -0
- package/backend/backend.d.cts +87 -0
- package/backend/host.cts +41 -0
- package/backend/require.cts +17 -0
- package/dist/backend/backend.cjs +9 -0
- package/dist/backend/backend.cjs.map +1 -0
- package/dist/backend/backend.d.cts +2 -0
- package/dist/backend/backend.d.cts.map +1 -0
- package/dist/backend/host.cjs +41 -0
- package/dist/backend/host.cjs.map +1 -0
- package/dist/backend/host.d.cts +2 -0
- package/dist/backend/host.d.cts.map +1 -0
- package/dist/backend/require.cjs +19 -0
- package/dist/backend/require.cjs.map +1 -0
- package/dist/backend/require.d.cts +2 -0
- package/dist/backend/require.d.cts.map +1 -0
- package/dist/frontend/agent.d.ts +1 -1
- package/dist/frontend/agent.d.ts.map +1 -1
- package/dist/frontend/agent.js +1 -1
- package/dist/frontend/agent.js.map +1 -1
- package/dist/frontend/module.d.ts +1 -1
- package/dist/frontend/module.d.ts.map +1 -1
- package/dist/frontend/module.js +1 -1
- package/dist/frontend/module.js.map +1 -1
- package/dist/frontend/realm.d.ts +2 -2
- package/dist/frontend/realm.d.ts.map +1 -1
- package/dist/frontend/realm.js +2 -2
- package/dist/frontend/realm.js.map +1 -1
- package/dist/frontend/reference.d.ts +1 -1
- package/dist/frontend/reference.d.ts.map +1 -1
- package/dist/frontend/script.d.ts +1 -1
- package/dist/frontend/script.d.ts.map +1 -1
- package/dist/frontend/script.js +1 -1
- package/dist/frontend/script.js.map +1 -1
- package/dist/isolated-vm.d.ts +1 -1
- package/dist/isolated-vm.d.ts.map +1 -1
- package/dist/isolated-vm.js +1 -1
- package/dist/isolated-vm.js.map +1 -1
- package/dist/test/00.transfer.js +27 -25
- package/dist/test/00.transfer.js.map +1 -1
- package/dist/test/20.array_buffer.js +22 -21
- package/dist/test/20.array_buffer.js.map +1 -1
- package/dist/test/fixtures.js +0 -1
- package/dist/test/fixtures.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/frontend/agent.ts +2 -2
- package/frontend/module.ts +1 -1
- package/frontend/realm.ts +2 -2
- package/frontend/reference.ts +1 -1
- package/frontend/script.ts +1 -1
- package/isolated-vm.ts +1 -1
- package/package.json +25 -13
- package/test/00.random.ts +1 -1
- package/test/00.transfer.ts +18 -16
- package/test/20.array_buffer.ts +10 -9
- package/test/fixtures.ts +1 -1
- package/backend/backend_v8.d.ts +0 -89
- package/backend/backend_v8.js +0 -18
- package/backend/specifier.ts +0 -20
- package/dist/backend/specifier.d.ts +0 -3
- package/dist/backend/specifier.d.ts.map +0 -1
- package/dist/backend/specifier.js +0 -21
- package/dist/backend/specifier.js.map +0 -1
package/backend/backend_v8.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
declare module "#backend_v8" {
|
|
2
|
-
type CapabilityMake = import("@isolated-vm/experimental/frontend/realm").Realm.CapabilityMake;
|
|
3
|
-
type _Agent = import("@isolated-vm/experimental/frontend/agent").Agent;
|
|
4
|
-
type _Module = import("@isolated-vm/experimental/frontend/module").Module;
|
|
5
|
-
type _Reference<T> = import("@isolated-vm/experimental/frontend/reference").Reference<T>;
|
|
6
|
-
type CompileModuleOptions = import("@isolated-vm/experimental/frontend/agent").Agent.CompileModuleOptions;
|
|
7
|
-
type CompileScriptOptions = import("@isolated-vm/experimental/frontend/agent").Agent.CompileScriptOptions;
|
|
8
|
-
type CreateAgentOptions = import("@isolated-vm/experimental/frontend/agent").Agent.CreateOptions;
|
|
9
|
-
type CreateCapabilityOptions = import("@isolated-vm/experimental/frontend/realm").Realm.CreateCapabilityOptions;
|
|
10
|
-
type CreateNativeModuleOptions = import("@isolated-vm/experimental/frontend/native_module").NativeModule.CreateOptions;
|
|
11
|
-
type MaybeCompletionOf<T> = import("@isolated-vm/experimental/utility/completion").MaybeCompletionOf<T>;
|
|
12
|
-
type ModuleLinkRecord = import("@isolated-vm/experimental/frontend/module").Module.LinkRecord;
|
|
13
|
-
type RunScriptOptions = import("@isolated-vm/experimental/frontend/script").Script.RunScriptOptions;
|
|
14
|
-
|
|
15
|
-
interface InheritedClasses {
|
|
16
|
-
Agent: object;
|
|
17
|
-
Module: object;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const initialize: (inherited: InheritedClasses) => void;
|
|
21
|
-
|
|
22
|
-
const Secret: unique symbol;
|
|
23
|
-
/** @internal */
|
|
24
|
-
export type Secret = typeof Secret;
|
|
25
|
-
|
|
26
|
-
export class Agent {
|
|
27
|
-
readonly #private;
|
|
28
|
-
protected constructor(secret: Secret, ...args: unknown[]);
|
|
29
|
-
disposeAsync(): Promise<void>;
|
|
30
|
-
compileModule(code: string, options?: CompileModuleOptions | undefined): Promise<MaybeCompletionOf<_Module>>;
|
|
31
|
-
compileScript(code: string, options?: CompileScriptOptions | undefined): Promise<MaybeCompletionOf<Script>>;
|
|
32
|
-
createRealm(): Promise<Realm>;
|
|
33
|
-
static create(options?: CreateAgentOptions | undefined): Promise<_Agent>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export class Module {
|
|
37
|
-
readonly #private;
|
|
38
|
-
protected constructor(secret: Secret, ...args: unknown[]);
|
|
39
|
-
/** @internal */ _link(realm: Realm, linker: ModuleLinkRecord): Promise<void>;
|
|
40
|
-
evaluate(realm: Realm): Promise<MaybeCompletionOf<unknown>>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export class NativeModule {
|
|
44
|
-
readonly #private;
|
|
45
|
-
protected constructor(secret: Secret, ...args: unknown[]);
|
|
46
|
-
instantiate(realm: Realm): Promise<Module>;
|
|
47
|
-
static create(filename: string, options: CreateNativeModuleOptions): Promise<NativeModule>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export class Realm {
|
|
51
|
-
readonly #private;
|
|
52
|
-
protected constructor(secret: Secret, ...args: unknown[]);
|
|
53
|
-
acquireGlobalObject(): Promise<_Reference<Record<string, unknown>>>;
|
|
54
|
-
createCapability(make: CapabilityMake, options: CreateCapabilityOptions): Promise<Module>;
|
|
55
|
-
instantiateRuntime(): Promise<Module>;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export class Reference {
|
|
59
|
-
readonly #private;
|
|
60
|
-
protected constructor(secret: Secret, ...args: unknown[]);
|
|
61
|
-
copy(): Promise<unknown>;
|
|
62
|
-
get(property: string): Promise<Reference>;
|
|
63
|
-
set(property: string, value: unknown): Promise<void>;
|
|
64
|
-
invoke(args: unknown[]): Promise<MaybeCompletionOf<unknown>>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export class Script {
|
|
68
|
-
readonly #private;
|
|
69
|
-
protected constructor(secret: Secret, ...args: unknown[]);
|
|
70
|
-
run(realm: Realm, options?: RunScriptOptions | undefined): Promise<MaybeCompletionOf<unknown>>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export class SubscriberCapability {
|
|
74
|
-
readonly #private;
|
|
75
|
-
protected constructor(secret: Secret, ...args: unknown[]);
|
|
76
|
-
send(message: unknown): Promise<boolean>;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** @internal */
|
|
80
|
-
const exports: {
|
|
81
|
-
initialize: typeof initialize;
|
|
82
|
-
Agent: typeof Agent;
|
|
83
|
-
Module: typeof Module;
|
|
84
|
-
NativeModule: typeof NativeModule;
|
|
85
|
-
Realm: typeof Realm;
|
|
86
|
-
Script: typeof Script;
|
|
87
|
-
};
|
|
88
|
-
export default exports;
|
|
89
|
-
}
|
package/backend/backend_v8.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import path from "@isolated-vm/experimental/backend/specifier";
|
|
4
|
-
|
|
5
|
-
// Import compiled module
|
|
6
|
-
const require = createRequire(import.meta.url);
|
|
7
|
-
|
|
8
|
-
/** @type {typeof import("#backend_v8")} */
|
|
9
|
-
const cjs = require(path);
|
|
10
|
-
|
|
11
|
-
// Exports must be enumerated because this imports from the native module which cannot declare ESM
|
|
12
|
-
// exports.
|
|
13
|
-
export const initialize = cjs.initialize;
|
|
14
|
-
export const Agent = cjs.Agent;
|
|
15
|
-
export const Module = cjs.Module;
|
|
16
|
-
export const NativeModule = cjs.NativeModule;
|
|
17
|
-
export const Realm = cjs.Realm;
|
|
18
|
-
export const Script = cjs.Script;
|
package/backend/specifier.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import { arch, platform } from "node:process";
|
|
3
|
-
|
|
4
|
-
// Detect libc version
|
|
5
|
-
const backendPlatform = function() {
|
|
6
|
-
if (platform === "linux") {
|
|
7
|
-
try {
|
|
8
|
-
if (fs.readFileSync("/usr/bin/ldd", "latin1").includes("ld-musl-")) {
|
|
9
|
-
return `linux-${arch}-musl`;
|
|
10
|
-
}
|
|
11
|
-
} catch {}
|
|
12
|
-
return `linux-${arch}-gnu`;
|
|
13
|
-
} else {
|
|
14
|
-
return `${platform}-${arch}`;
|
|
15
|
-
}
|
|
16
|
-
}();
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
19
|
-
const path: string = `@isolated-vm/experimental-${backendPlatform}`;
|
|
20
|
-
export default path;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"specifier.d.ts","sourceRoot":"","sources":["../../backend/specifier.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,IAAI,EAAE,MAAuD,CAAC;AACpE,eAAe,IAAI,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import { arch, platform } from "node:process";
|
|
3
|
-
// Detect libc version
|
|
4
|
-
const backendPlatform = function () {
|
|
5
|
-
if (platform === "linux") {
|
|
6
|
-
try {
|
|
7
|
-
if (fs.readFileSync("/usr/bin/ldd", "latin1").includes("ld-musl-")) {
|
|
8
|
-
return `linux-${arch}-musl`;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
catch { }
|
|
12
|
-
return `linux-${arch}-gnu`;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
return `${platform}-${arch}`;
|
|
16
|
-
}
|
|
17
|
-
}();
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
19
|
-
const path = `@isolated-vm/experimental-${backendPlatform}`;
|
|
20
|
-
export default path;
|
|
21
|
-
//# sourceMappingURL=specifier.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"specifier.js","sourceRoot":"","sources":["../../backend/specifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE9C,sBAAsB;AACtB,MAAM,eAAe,GAAG;IACvB,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC;YACJ,IAAI,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBACpE,OAAO,SAAS,IAAI,OAAO,CAAC;YAC7B,CAAC;QACF,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QACV,OAAO,SAAS,IAAI,MAAM,CAAC;IAC5B,CAAC;SAAM,CAAC;QACP,OAAO,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;IAC9B,CAAC;AACF,CAAC,EAAE,CAAC;AAEJ,kEAAkE;AAClE,MAAM,IAAI,GAAW,6BAA6B,eAAe,EAAE,CAAC;AACpE,eAAe,IAAI,CAAC"}
|