@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/addon/resolve.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import
|
|
3
|
+
import host from "#host_cjs";
|
|
4
4
|
|
|
5
|
-
console.log(fileURLToPath(import.meta.resolve(
|
|
5
|
+
console.log(fileURLToPath(import.meta.resolve(`@isolated-vm/experimental-${host}`)));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
2
|
+
import backend = require("#backend_cjs");
|
|
3
|
+
|
|
4
|
+
// Exports must be enumerated because this imports from the native module which cannot declare ESM
|
|
5
|
+
// exports.
|
|
6
|
+
const { initialize, Agent, Module, NativeModule, Realm, Script } = backend;
|
|
7
|
+
module.exports = { initialize, Agent, Module, NativeModule, Realm, Script };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
type CapabilityMake = import("@isolated-vm/experimental/frontend/realm", { with: { "resolution-mode": "import" }}).Realm.CapabilityMake;
|
|
2
|
+
type _Agent = import("@isolated-vm/experimental/frontend/agent", { with: { "resolution-mode": "import" }}).Agent;
|
|
3
|
+
type _Module = import("@isolated-vm/experimental/frontend/module", { with: { "resolution-mode": "import" }}).Module;
|
|
4
|
+
type _Reference<T> = import("@isolated-vm/experimental/frontend/reference", { with: { "resolution-mode": "import" }}).Reference<T>;
|
|
5
|
+
type CompileModuleOptions = import("@isolated-vm/experimental/frontend/agent", { with: { "resolution-mode": "import" }}).Agent.CompileModuleOptions;
|
|
6
|
+
type CompileScriptOptions = import("@isolated-vm/experimental/frontend/agent", { with: { "resolution-mode": "import" }}).Agent.CompileScriptOptions;
|
|
7
|
+
type CreateAgentOptions = import("@isolated-vm/experimental/frontend/agent", { with: { "resolution-mode": "import" }}).Agent.CreateOptions;
|
|
8
|
+
type CreateCapabilityOptions = import("@isolated-vm/experimental/frontend/realm", { with: { "resolution-mode": "import" }}).Realm.CreateCapabilityOptions;
|
|
9
|
+
type CreateNativeModuleOptions = import("@isolated-vm/experimental/frontend/native_module", { with: { "resolution-mode": "import" }}).NativeModule.CreateOptions;
|
|
10
|
+
type MaybeCompletionOf<T> = import("@isolated-vm/experimental/utility/completion", { with: { "resolution-mode": "import" }}).MaybeCompletionOf<T>;
|
|
11
|
+
type ModuleLinkRecord = import("@isolated-vm/experimental/frontend/module", { with: { "resolution-mode": "import" }}).Module.LinkRecord;
|
|
12
|
+
type RunScriptOptions = import("@isolated-vm/experimental/frontend/script", { with: { "resolution-mode": "import" }}).Script.RunScriptOptions;
|
|
13
|
+
|
|
14
|
+
interface InheritedClasses {
|
|
15
|
+
Agent: object;
|
|
16
|
+
Module: object;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const initialize: (inherited: InheritedClasses) => void;
|
|
20
|
+
|
|
21
|
+
declare const Secret: unique symbol;
|
|
22
|
+
/** @internal */
|
|
23
|
+
export type Secret = typeof Secret;
|
|
24
|
+
|
|
25
|
+
export class Agent {
|
|
26
|
+
readonly #private;
|
|
27
|
+
protected constructor(secret: Secret, ...args: unknown[]);
|
|
28
|
+
disposeAsync(): Promise<void>;
|
|
29
|
+
compileModule(code: string, options?: CompileModuleOptions): Promise<MaybeCompletionOf<_Module>>;
|
|
30
|
+
compileScript(code: string, options?: CompileScriptOptions): Promise<MaybeCompletionOf<Script>>;
|
|
31
|
+
createRealm(): Promise<Realm>;
|
|
32
|
+
static create(options?: CreateAgentOptions): Promise<_Agent>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class Module {
|
|
36
|
+
readonly #private;
|
|
37
|
+
protected constructor(secret: Secret, ...args: unknown[]);
|
|
38
|
+
/** @internal */ _link(realm: Realm, linker: ModuleLinkRecord): Promise<void>;
|
|
39
|
+
evaluate(realm: Realm): Promise<MaybeCompletionOf<unknown>>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class NativeModule {
|
|
43
|
+
readonly #private;
|
|
44
|
+
protected constructor(secret: Secret, ...args: unknown[]);
|
|
45
|
+
instantiate(realm: Realm): Promise<Module>;
|
|
46
|
+
static create(filename: string, options: CreateNativeModuleOptions): Promise<NativeModule>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export class Realm {
|
|
50
|
+
readonly #private;
|
|
51
|
+
protected constructor(secret: Secret, ...args: unknown[]);
|
|
52
|
+
acquireGlobalObject(): Promise<_Reference<Record<string, unknown>>>;
|
|
53
|
+
createCapability(make: CapabilityMake, options: CreateCapabilityOptions): Promise<Module>;
|
|
54
|
+
instantiateRuntime(): Promise<Module>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class Reference {
|
|
58
|
+
readonly #private;
|
|
59
|
+
protected constructor(secret: Secret, ...args: unknown[]);
|
|
60
|
+
copy(): Promise<unknown>;
|
|
61
|
+
get(property: string): Promise<Reference>;
|
|
62
|
+
set(property: string, value: unknown): Promise<void>;
|
|
63
|
+
invoke(args: unknown[]): Promise<MaybeCompletionOf<unknown>>;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export class Script {
|
|
67
|
+
readonly #private;
|
|
68
|
+
protected constructor(secret: Secret, ...args: unknown[]);
|
|
69
|
+
run(realm: Realm, options?: RunScriptOptions): Promise<MaybeCompletionOf<unknown>>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export class SubscriberCapability {
|
|
73
|
+
readonly #private;
|
|
74
|
+
protected constructor(secret: Secret, ...args: unknown[]);
|
|
75
|
+
send(message: unknown): Promise<boolean>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** @internal */
|
|
79
|
+
declare const exports: {
|
|
80
|
+
initialize: typeof initialize;
|
|
81
|
+
Agent: typeof Agent;
|
|
82
|
+
Module: typeof Module;
|
|
83
|
+
NativeModule: typeof NativeModule;
|
|
84
|
+
Realm: typeof Realm;
|
|
85
|
+
Script: typeof Script;
|
|
86
|
+
};
|
|
87
|
+
export default exports;
|
package/backend/host.cts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
2
|
+
import fs = require("node:fs");
|
|
3
|
+
import process = require("node:process");
|
|
4
|
+
|
|
5
|
+
const arch = function() {
|
|
6
|
+
const { arch } = process;
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
8
|
+
switch (arch) {
|
|
9
|
+
case "arm64":
|
|
10
|
+
case "x64":
|
|
11
|
+
return arch;
|
|
12
|
+
default:
|
|
13
|
+
throw new Error(`Unsupported architecture: ${arch}`);
|
|
14
|
+
}
|
|
15
|
+
}();
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
const host = function() {
|
|
19
|
+
const { platform } = process;
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
21
|
+
switch (platform) {
|
|
22
|
+
case "linux": {
|
|
23
|
+
const libc = function() {
|
|
24
|
+
try {
|
|
25
|
+
if (fs.readFileSync("/usr/bin/ldd", "latin1").includes("ld-musl-")) {
|
|
26
|
+
return "musl" as const;
|
|
27
|
+
}
|
|
28
|
+
} catch {}
|
|
29
|
+
return "gnu" as const;
|
|
30
|
+
}();
|
|
31
|
+
return `linux-${arch}-${libc}` as const;
|
|
32
|
+
}
|
|
33
|
+
case "darwin":
|
|
34
|
+
case "win32":
|
|
35
|
+
return `${platform}-${arch}` as const;
|
|
36
|
+
default:
|
|
37
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
38
|
+
}
|
|
39
|
+
}();
|
|
40
|
+
|
|
41
|
+
export = host;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
2
|
+
import host = require("#host_cjs");
|
|
3
|
+
|
|
4
|
+
// All hosts enumerated to assist with bundlers. This file can be replaced with a condition.
|
|
5
|
+
module.exports = function(): unknown {
|
|
6
|
+
switch (host) {
|
|
7
|
+
case "darwin-arm64": return require("@isolated-vm/experimental-darwin-arm64");
|
|
8
|
+
case "darwin-x64": return require("@isolated-vm/experimental-darwin-x64");
|
|
9
|
+
case "linux-arm64-gnu": return require("@isolated-vm/experimental-linux-arm64-gnu");
|
|
10
|
+
case "linux-arm64-musl": return require("@isolated-vm/experimental-linux-arm64-musl");
|
|
11
|
+
case "linux-x64-musl": return require("@isolated-vm/experimental-linux-x64-musl");
|
|
12
|
+
case "linux-x64-gnu": return require("@isolated-vm/experimental-linux-x64-gnu");
|
|
13
|
+
case "win32-x64": return require("@isolated-vm/experimental-win32-x64");
|
|
14
|
+
case "win32-arm64":
|
|
15
|
+
default: throw new Error(`Unsupported platform: ${host}`);
|
|
16
|
+
}
|
|
17
|
+
}();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
4
|
+
const backend = require("#backend_cjs");
|
|
5
|
+
// Exports must be enumerated because this imports from the native module which cannot declare ESM
|
|
6
|
+
// exports.
|
|
7
|
+
const { initialize, Agent, Module, NativeModule, Realm, Script } = backend;
|
|
8
|
+
module.exports = { initialize, Agent, Module, NativeModule, Realm, Script };
|
|
9
|
+
//# sourceMappingURL=backend.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.cjs","sourceRoot":"","sources":["../../backend/backend.cts"],"names":[],"mappings":";;AAAA,0DAA0D;AAC1D,wCAAyC;AAEzC,kGAAkG;AAClG,WAAW;AACX,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;AAC3E,MAAM,CAAC,OAAO,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backend.d.cts","sourceRoot":"","sources":["../../backend/backend.cts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const process = require("node:process");
|
|
5
|
+
const arch = function () {
|
|
6
|
+
const { arch } = process;
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
8
|
+
switch (arch) {
|
|
9
|
+
case "arm64":
|
|
10
|
+
case "x64":
|
|
11
|
+
return arch;
|
|
12
|
+
default:
|
|
13
|
+
throw new Error(`Unsupported architecture: ${arch}`);
|
|
14
|
+
}
|
|
15
|
+
}();
|
|
16
|
+
/** @internal */
|
|
17
|
+
const host = function () {
|
|
18
|
+
const { platform } = process;
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
|
|
20
|
+
switch (platform) {
|
|
21
|
+
case "linux": {
|
|
22
|
+
const libc = function () {
|
|
23
|
+
try {
|
|
24
|
+
if (fs.readFileSync("/usr/bin/ldd", "latin1").includes("ld-musl-")) {
|
|
25
|
+
return "musl";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch { }
|
|
29
|
+
return "gnu";
|
|
30
|
+
}();
|
|
31
|
+
return `linux-${arch}-${libc}`;
|
|
32
|
+
}
|
|
33
|
+
case "darwin":
|
|
34
|
+
case "win32":
|
|
35
|
+
return `${platform}-${arch}`;
|
|
36
|
+
default:
|
|
37
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
38
|
+
}
|
|
39
|
+
}();
|
|
40
|
+
module.exports = host;
|
|
41
|
+
//# sourceMappingURL=host.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.cjs","sourceRoot":"","sources":["../../backend/host.cts"],"names":[],"mappings":";AAAA,0DAA0D;AAC1D,8BAA+B;AAC/B,wCAAyC;AAEzC,MAAM,IAAI,GAAG;IACZ,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,OAAO,CAAC;QACb,KAAK,KAAK;YACT,OAAO,IAAI,CAAC;QACb;YACC,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;AACF,CAAC,EAAE,CAAC;AAEJ,gBAAgB;AAChB,MAAM,IAAI,GAAG;IACZ,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC7B,0EAA0E;IAC1E,QAAQ,QAAQ,EAAE,CAAC;QAClB,KAAK,OAAO,CAAC,CAAC,CAAC;YACd,MAAM,IAAI,GAAG;gBACZ,IAAI,CAAC;oBACJ,IAAI,EAAE,CAAC,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;wBACpE,OAAO,MAAe,CAAC;oBACxB,CAAC;gBACF,CAAC;gBAAC,MAAM,CAAC,CAAA,CAAC;gBACV,OAAO,KAAc,CAAC;YACvB,CAAC,EAAE,CAAC;YACJ,OAAO,SAAS,IAAI,IAAI,IAAI,EAAW,CAAC;QACzC,CAAC;QACD,KAAK,QAAQ,CAAC;QACd,KAAK,OAAO;YACX,OAAO,GAAG,QAAQ,IAAI,IAAI,EAAW,CAAC;QACvC;YACC,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;IACvD,CAAC;AACF,CAAC,EAAE,CAAC;AAEJ,iBAAS,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.d.cts","sourceRoot":"","sources":["../../backend/host.cts"],"names":[],"mappings":"AAwCA,SAAS,IAAI,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
4
|
+
const host = require("#host_cjs");
|
|
5
|
+
// All hosts enumerated to assist with bundlers. This file can be replaced with a condition.
|
|
6
|
+
module.exports = function () {
|
|
7
|
+
switch (host) {
|
|
8
|
+
case "darwin-arm64": return require("@isolated-vm/experimental-darwin-arm64");
|
|
9
|
+
case "darwin-x64": return require("@isolated-vm/experimental-darwin-x64");
|
|
10
|
+
case "linux-arm64-gnu": return require("@isolated-vm/experimental-linux-arm64-gnu");
|
|
11
|
+
case "linux-arm64-musl": return require("@isolated-vm/experimental-linux-arm64-musl");
|
|
12
|
+
case "linux-x64-musl": return require("@isolated-vm/experimental-linux-x64-musl");
|
|
13
|
+
case "linux-x64-gnu": return require("@isolated-vm/experimental-linux-x64-gnu");
|
|
14
|
+
case "win32-x64": return require("@isolated-vm/experimental-win32-x64");
|
|
15
|
+
case "win32-arm64":
|
|
16
|
+
default: throw new Error(`Unsupported platform: ${host}`);
|
|
17
|
+
}
|
|
18
|
+
}();
|
|
19
|
+
//# sourceMappingURL=require.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require.cjs","sourceRoot":"","sources":["../../backend/require.cts"],"names":[],"mappings":";;AAAA,0DAA0D;AAC1D,kCAAmC;AAEnC,4FAA4F;AAC5F,MAAM,CAAC,OAAO,GAAG;IAChB,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,cAAc,CAAC,CAAC,OAAO,OAAO,CAAC,wCAAwC,CAAC,CAAC;QAC9E,KAAK,YAAY,CAAC,CAAC,OAAO,OAAO,CAAC,sCAAsC,CAAC,CAAC;QAC1E,KAAK,iBAAiB,CAAC,CAAC,OAAO,OAAO,CAAC,2CAA2C,CAAC,CAAC;QACpF,KAAK,kBAAkB,CAAC,CAAC,OAAO,OAAO,CAAC,4CAA4C,CAAC,CAAC;QACtF,KAAK,gBAAgB,CAAC,CAAC,OAAO,OAAO,CAAC,0CAA0C,CAAC,CAAC;QAClF,KAAK,eAAe,CAAC,CAAC,OAAO,OAAO,CAAC,yCAAyC,CAAC,CAAC;QAChF,KAAK,WAAW,CAAC,CAAC,OAAO,OAAO,CAAC,qCAAqC,CAAC,CAAC;QACxE,KAAK,aAAa,CAAC;QACnB,OAAO,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;AACF,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require.d.cts","sourceRoot":"","sources":["../../backend/require.cts"],"names":[],"mappings":""}
|
package/dist/frontend/agent.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../frontend/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../frontend/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAGpC,yBAAiB,KAAK,CAAC;IACtB,UAAiB,KAAK,CAAC;QACtB,UAAiB,aAAa;YAC7B,IAAI,EAAE,eAAe,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC;YACZ,QAAQ,EAAE,MAAM,CAAC;SACjB;QAED,UAAiB,SAAS;YACzB,IAAI,EAAE,WAAW,CAAC;YAClB,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;SACzB;QAED,UAAiB,QAAQ;YACxB,IAAI,EAAE,UAAU,CAAC;YACjB,KAAK,EAAE,IAAI,CAAC;SACZ;QAED,UAAiB,MAAM;YACtB,IAAI,EAAE,QAAQ,CAAC;SACf;KACD;IAED,UAAiB,aAAa,CAAC;QAC9B,KAAY,KAAK,GAAG,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC;KAE1F;IAED,UAAiB,aAAa;QAC7B,KAAK,CAAC,EAAE,aAAa,CAAC,KAAK,GAAG,SAAS,CAAC;QACxC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC;IAED,UAAiB,oBAAoB;QACpC,MAAM,CAAC,EAAE,YAAY,CAAC;KACtB;IAED,UAAiB,oBAAoB;QACpC,MAAM,CAAC,EAAE,YAAY,CAAC;KACtB;CACD;AAID,qBAAa,KAAM,SAAQ,OAAO,CAAC,KAAK;WACvB,MAAM,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC;IAQ/D,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAG5C"}
|
package/dist/frontend/agent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../frontend/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../frontend/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA4CrC,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,MAAM,OAAO,KAAM,SAAQ,OAAO,CAAC,KAAK;IACvC,MAAM,CAAU,MAAM,CAAC,OAA6B;QACnD,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,OAAO,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YACtC,aAAa,GAAG,IAAI,CAAC;QACtB,CAAC;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QAC1B,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;IAC3B,CAAC;CACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../frontend/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../frontend/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAEpC,eAAO,MAAM,cAAc,EAAE,OAAO,OAAO,CAAC,MAAuB,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;AAE5C,yBAAiB,MAAM,CAAC;IACvB,KAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEtD,KAAY,MAAM,GAAG;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,GAAG,SAAS;IAE5B;;OAEG;IACH,UAAU,CAAC,EAAE,gBAAgB,KACzB,cAAc,GAAG,SAAS,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IAEtE,mBAAmB;IACnB,UAAiB,UAAU;QAC1B,6CAA6C;QAC7C,OAAO,EAAE,cAAc,EAAE,CAAC;QAC1B,iCAAiC;QACjC,OAAO,EAAE,MAAM,EAAE,CAAC;KAClB;IAED,UAAiB,OAAO;QACvB;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB;;WAEG;QACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;KAC9B;CACD;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,cAAc;CAAG;AAEjD;;GAEG;AACH,qBAAa,MAAO,SAAQ,OAAO,CAAC,MAAM;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,CAAC,OAAO,EAAE,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE3B,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,SAAS,MAAM,CAAC,OAAO,EAAE;IAMhG,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAqCtE"}
|
package/dist/frontend/module.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../frontend/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../frontend/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAEpC,MAAM,CAAC,MAAM,cAAc,GAA0B,OAAO,CAAC,MAAM,CAAC;AA4CpE;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,cAAc;CAAG;AAEjD;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,OAAO,CAAC,MAAM;IAChC,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SAAS,EAAE,UAAU,CAAC,CAAC;oBACrE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;wBAC1B,IAAI,OAAO,GAAG,uBAAuB,SAAS,GAAG,CAAC;wBAClD,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;4BACpC,OAAO,IAAI,kBAAkB,MAAM,CAAC,SAAS,EAAE,CAAC;wBACjD,CAAC;wBACD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;4BAC9B,OAAO,IAAI,oBAAoB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;wBAC7D,CAAC;wBACD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;oBAC1B,CAAC;oBACD,OAAO,CAAC,YAAY,GAAG,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC;gBACjD,CAAC,CAAC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACP,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjB,CAAC;YACD,OAAO,QAAQ,CAAC;QACjB,CAAC,CAAC;QACF,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;CACD"}
|
package/dist/frontend/realm.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as backend from "#
|
|
2
|
-
export { Realm } from "#
|
|
1
|
+
import * as backend from "#backend";
|
|
2
|
+
export { Realm } from "#backend";
|
|
3
3
|
export declare namespace Realm {
|
|
4
4
|
type CapabilityInterface = Record<string, CapabilitySignature>;
|
|
5
5
|
type CapabilityMake = (subscriber: backend.SubscriberCapability) => CapabilityInterface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realm.d.ts","sourceRoot":"","sources":["../../frontend/realm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"realm.d.ts","sourceRoot":"","sources":["../../frontend/realm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,yBAAiB,KAAK,CAAC;IACtB,KAAY,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACtE,KAAY,cAAc,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,oBAAoB,KAAK,mBAAmB,CAAC;IAC/F,KAAY,mBAAmB,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAEhG,UAAiB,uBAAuB;QACvC,MAAM,EAAE,MAAM,CAAC;KACf;CACD"}
|
package/dist/frontend/realm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as backend from "#
|
|
2
|
-
export { Realm } from "#
|
|
1
|
+
import * as backend from "#backend";
|
|
2
|
+
export { Realm } from "#backend";
|
|
3
3
|
//# sourceMappingURL=realm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"realm.js","sourceRoot":"","sources":["../../frontend/realm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"realm.js","sourceRoot":"","sources":["../../frontend/realm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,UAAU,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as backend from "#
|
|
1
|
+
import type * as backend from "#backend";
|
|
2
2
|
import type { MaybeCompletionOf } from "@isolated-vm/experimental";
|
|
3
3
|
type InvokeArguments<Value> = Value extends (...args: infer Args) => unknown ? Args : never;
|
|
4
4
|
type InvokeResult<Value> = Value extends (...args: unknown[]) => infer Result ? Result : never;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../frontend/reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../frontend/reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,KAAK,eAAe,CAAC,KAAK,IAAI,KAAK,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,IAAI,KAAK,OAAO,GAAG,IAAI,GAAG,KAAK,CAAC;AAC5F,KAAK,YAAY,CAAC,KAAK,IAAI,KAAK,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,MAAM,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAE/F,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC,IAAI,GAAG,OAAO,CAAE,SAAQ,OAAO,CAAC,SAAS;IAC3E,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,EAAE,CAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACxF,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAGzD,GAAG,CAAC,GAAG,SAAS,MAAM,IAAI,EAAE,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAE1E,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../frontend/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../frontend/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,WAAW,QAAQ;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,yBAAiB,MAAM,CAAC;IACvB,UAAiB,gBAAgB;QAChC;;;WAGG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB;CACD"}
|
package/dist/frontend/script.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Script } from "#
|
|
1
|
+
export { Script } from "#backend";
|
|
2
2
|
//# sourceMappingURL=script.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../frontend/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../frontend/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/isolated-vm.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isolated-vm.d.ts","sourceRoot":"","sources":["../isolated-vm.ts"],"names":[],"mappings":"AAAA,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"isolated-vm.d.ts","sourceRoot":"","sources":["../isolated-vm.ts"],"names":[],"mappings":"AAAA,mBAAmB,yBAAyB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
|
package/dist/isolated-vm.js
CHANGED
package/dist/isolated-vm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isolated-vm.js","sourceRoot":"","sources":["../isolated-vm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"isolated-vm.js","sourceRoot":"","sources":["../isolated-vm.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
|
package/dist/test/00.transfer.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __addDisposableResource, __disposeResources } from "tslib";
|
|
2
2
|
import * as assert from "node:assert/strict";
|
|
3
3
|
import { describe, test } from "node:test";
|
|
4
|
-
import
|
|
4
|
+
import { Agent, Realm } from "@isolated-vm/experimental";
|
|
5
5
|
import { unsafeEvalAsStringInRealm } from "./fixtures.js";
|
|
6
|
+
const hostSupportsSharedArraySupport =
|
|
6
7
|
// @ts-expect-error
|
|
7
|
-
|
|
8
|
+
process.isBun === undefined && process.versions.deno === undefined;
|
|
8
9
|
async function check(agent, realm, fn) {
|
|
9
10
|
const result = await unsafeEvalAsStringInRealm(agent, realm, fn);
|
|
10
11
|
assert.deepStrictEqual(result, fn());
|
|
@@ -12,7 +13,7 @@ async function check(agent, realm, fn) {
|
|
|
12
13
|
await test("transfer types", async () => {
|
|
13
14
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
14
15
|
try {
|
|
15
|
-
const agent = __addDisposableResource(env_1, await
|
|
16
|
+
const agent = __addDisposableResource(env_1, await Agent.create(), true);
|
|
16
17
|
const realm = await agent.createRealm();
|
|
17
18
|
// null, undefined, bool
|
|
18
19
|
await check(agent, realm, () => null);
|
|
@@ -98,31 +99,32 @@ await test("transfer types", async () => {
|
|
|
98
99
|
// assert.deepStrictEqual(result, [ undefined, 1 ]);
|
|
99
100
|
// });
|
|
100
101
|
// });
|
|
102
|
+
// TODO: deno fails when this is in the `describe` (??)
|
|
103
|
+
await test("numeric references", async () => {
|
|
104
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
105
|
+
try {
|
|
106
|
+
const agent = __addDisposableResource(env_2, await Agent.create(), true);
|
|
107
|
+
const realm = await agent.createRealm();
|
|
108
|
+
const global = await realm.acquireGlobalObject();
|
|
109
|
+
// doubles are stored as references in `value_t`, because they are bigger than 32-bit. there was
|
|
110
|
+
// a failure with more than one of them in the same transfer operation.
|
|
111
|
+
await global.set("xx", { zero: 0.1, one: 0.2 });
|
|
112
|
+
}
|
|
113
|
+
catch (e_2) {
|
|
114
|
+
env_2.error = e_2;
|
|
115
|
+
env_2.hasError = true;
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
const result_2 = __disposeResources(env_2);
|
|
119
|
+
if (result_2)
|
|
120
|
+
await result_2;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
101
123
|
await describe("regressions", async () => {
|
|
102
|
-
await test("numeric references", async () => {
|
|
103
|
-
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
104
|
-
try {
|
|
105
|
-
const agent = __addDisposableResource(env_2, await ivm.Agent.create(), true);
|
|
106
|
-
const realm = await agent.createRealm();
|
|
107
|
-
const global = await realm.acquireGlobalObject();
|
|
108
|
-
// doubles are stored as references in `value_t`, because they are bigger than 32-bit. there was
|
|
109
|
-
// a failure with more than one of them in the same transfer operation.
|
|
110
|
-
await global.set("xx", { zero: 0.1, one: 0.2 });
|
|
111
|
-
}
|
|
112
|
-
catch (e_2) {
|
|
113
|
-
env_2.error = e_2;
|
|
114
|
-
env_2.hasError = true;
|
|
115
|
-
}
|
|
116
|
-
finally {
|
|
117
|
-
const result_2 = __disposeResources(env_2);
|
|
118
|
-
if (result_2)
|
|
119
|
-
await result_2;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
124
|
await test("numeric indices", async () => {
|
|
123
125
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
124
126
|
try {
|
|
125
|
-
const agent = __addDisposableResource(env_3, await
|
|
127
|
+
const agent = __addDisposableResource(env_3, await Agent.create(), true);
|
|
126
128
|
const realm = await agent.createRealm();
|
|
127
129
|
const global = await realm.acquireGlobalObject();
|
|
128
130
|
// numeric array indices broke as part of a double to int32_t change.
|
|
@@ -142,7 +144,7 @@ await describe("regressions", async () => {
|
|
|
142
144
|
await test("seen index type", async () => {
|
|
143
145
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
144
146
|
try {
|
|
145
|
-
const agent = __addDisposableResource(env_4, await
|
|
147
|
+
const agent = __addDisposableResource(env_4, await Agent.create(), true);
|
|
146
148
|
const realm = await agent.createRealm();
|
|
147
149
|
const global = await realm.acquireGlobalObject();
|
|
148
150
|
const payload = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"00.transfer.js","sourceRoot":"","sources":["../../test/00.transfer.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"00.transfer.js","sourceRoot":"","sources":["../../test/00.transfer.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,IAAI,E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IAAI,EAAE,CAAE,OAAO,CAAE,CAAC,CAAC;;;;;;;;;;;SACpC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC,CAAC,CAAC"}
|
|
@@ -217,28 +217,29 @@ await describe("shared array buffer", async () => {
|
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
});
|
|
220
|
+
// TODO: deno fails when this is in the `describe` (??)
|
|
221
|
+
await test("transfer out", async () => {
|
|
222
|
+
const env_9 = { stack: [], error: void 0, hasError: false };
|
|
223
|
+
try {
|
|
224
|
+
const agent = __addDisposableResource(env_9, await ivm.Agent.create(), true);
|
|
225
|
+
const [uint8, uint8_copy] = await unsafeEvalAsString(agent, () => {
|
|
226
|
+
const uint8 = new Uint8Array([1, 2, 3]);
|
|
227
|
+
return [uint8, new Uint8Array(uint8.buffer)];
|
|
228
|
+
});
|
|
229
|
+
assert.deepStrictEqual(uint8, new Uint8Array([1, 2, 3]));
|
|
230
|
+
assert.strictEqual(uint8.buffer, uint8_copy.buffer);
|
|
231
|
+
}
|
|
232
|
+
catch (e_9) {
|
|
233
|
+
env_9.error = e_9;
|
|
234
|
+
env_9.hasError = true;
|
|
235
|
+
}
|
|
236
|
+
finally {
|
|
237
|
+
const result_9 = __disposeResources(env_9);
|
|
238
|
+
if (result_9)
|
|
239
|
+
await result_9;
|
|
240
|
+
}
|
|
241
|
+
});
|
|
220
242
|
await describe("typed array", async () => {
|
|
221
|
-
await test("transfer out", async () => {
|
|
222
|
-
const env_9 = { stack: [], error: void 0, hasError: false };
|
|
223
|
-
try {
|
|
224
|
-
const agent = __addDisposableResource(env_9, await ivm.Agent.create(), true);
|
|
225
|
-
const [uint8, uint8_copy] = await unsafeEvalAsString(agent, () => {
|
|
226
|
-
const uint8 = new Uint8Array([1, 2, 3]);
|
|
227
|
-
return [uint8, new Uint8Array(uint8.buffer)];
|
|
228
|
-
});
|
|
229
|
-
assert.deepStrictEqual(uint8, new Uint8Array([1, 2, 3]));
|
|
230
|
-
assert.strictEqual(uint8.buffer, uint8_copy.buffer);
|
|
231
|
-
}
|
|
232
|
-
catch (e_9) {
|
|
233
|
-
env_9.error = e_9;
|
|
234
|
-
env_9.hasError = true;
|
|
235
|
-
}
|
|
236
|
-
finally {
|
|
237
|
-
const result_9 = __disposeResources(env_9);
|
|
238
|
-
if (result_9)
|
|
239
|
-
await result_9;
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
243
|
await test("transfer in", async () => {
|
|
243
244
|
const env_10 = { stack: [], error: void 0, hasError: false };
|
|
244
245
|
try {
|