@endo/compartment-mapper 1.4.0 → 1.6.0
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/README.md +292 -111
- package/bundle.d.ts +1 -1
- package/bundle.js +4 -1
- package/functor-lite.d.ts +3 -0
- package/functor-lite.d.ts.map +1 -0
- package/functor-lite.js +4 -0
- package/functor.d.ts +3 -0
- package/functor.d.ts.map +1 -0
- package/functor.js +4 -0
- package/import-archive-all-parsers.d.ts +2 -0
- package/import-archive-all-parsers.d.ts.map +1 -0
- package/import-archive-all-parsers.js +1 -0
- package/index.d.ts +1 -1
- package/index.js +4 -1
- package/package.json +14 -5
- package/script-lite.d.ts +3 -0
- package/script-lite.d.ts.map +1 -0
- package/script-lite.js +4 -0
- package/script.d.ts +3 -0
- package/script.d.ts.map +1 -0
- package/script.js +4 -0
- package/src/archive-lite.d.ts +2 -4
- package/src/archive-lite.d.ts.map +1 -1
- package/src/archive-lite.js +16 -192
- package/src/archive.d.ts.map +1 -1
- package/src/archive.js +8 -0
- package/src/bundle-cjs.d.ts +1 -1
- package/src/bundle-cjs.d.ts.map +1 -1
- package/src/bundle-cjs.js +57 -28
- package/src/bundle-json.d.ts.map +1 -1
- package/src/bundle-json.js +2 -3
- package/src/bundle-lite.d.ts +91 -0
- package/src/bundle-lite.d.ts.map +1 -0
- package/src/bundle-lite.js +668 -0
- package/src/bundle-mjs.d.ts +2 -2
- package/src/bundle-mjs.d.ts.map +1 -1
- package/src/bundle-mjs.js +36 -19
- package/src/bundle.d.ts +48 -10
- package/src/bundle.d.ts.map +1 -1
- package/src/bundle.js +399 -127
- package/src/capture-lite.d.ts.map +1 -1
- package/src/capture-lite.js +10 -188
- package/src/digest.d.ts +5 -0
- package/src/digest.d.ts.map +1 -0
- package/src/digest.js +235 -0
- package/src/import-archive-all-parsers.d.ts +11 -0
- package/src/import-archive-all-parsers.d.ts.map +1 -0
- package/src/import-archive-all-parsers.js +29 -0
- package/src/import-archive-lite.d.ts.map +1 -1
- package/src/import-archive-lite.js +4 -0
- package/src/import-hook.d.ts +3 -16
- package/src/import-hook.d.ts.map +1 -1
- package/src/import-hook.js +11 -18
- package/src/import-lite.d.ts.map +1 -1
- package/src/import-lite.js +7 -2
- package/src/import.d.ts.map +1 -1
- package/src/import.js +2 -0
- package/src/link.d.ts.map +1 -1
- package/src/link.js +2 -0
- package/src/map-parser.d.ts.map +1 -1
- package/src/map-parser.js +4 -1
- package/src/node-modules.d.ts +4 -47
- package/src/node-modules.d.ts.map +1 -1
- package/src/node-modules.js +157 -131
- package/src/parse-archive-cjs.d.ts.map +1 -1
- package/src/parse-archive-cjs.js +8 -3
- package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
- package/src/parse-cjs-shared-export-wrapper.js +2 -10
- package/src/parse-cjs.js +1 -1
- package/src/parse-mjs.js +2 -2
- package/src/policy.d.ts.map +1 -1
- package/src/policy.js +4 -7
- package/src/search.d.ts +6 -12
- package/src/search.d.ts.map +1 -1
- package/src/search.js +29 -12
- package/src/types/compartment-map-schema.d.ts +5 -0
- package/src/types/compartment-map-schema.d.ts.map +1 -1
- package/src/types/compartment-map-schema.ts +5 -0
- package/src/types/external.d.ts +159 -12
- package/src/types/external.d.ts.map +1 -1
- package/src/types/external.ts +180 -12
- package/src/types/internal.d.ts +86 -13
- package/src/types/internal.d.ts.map +1 -1
- package/src/types/internal.ts +107 -13
- package/src/types/node-modules.d.ts +79 -0
- package/src/types/node-modules.d.ts.map +1 -0
- package/src/types/node-modules.ts +89 -0
- package/src/types/node-powers.d.ts +4 -4
- package/src/types/node-powers.d.ts.map +1 -1
- package/src/types/node-powers.ts +4 -4
- package/src/types/powers.d.ts +2 -2
- package/src/types/powers.d.ts.map +1 -1
- package/src/types/powers.ts +2 -2
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export function makeFunctorFromMap(readPowers: ReadFn | ReadPowers | MaybeReadPowers, compartmentMap: CompartmentMapDescriptor, options?: BundleOptions | undefined): Promise<string>;
|
|
2
|
+
export function makeScriptFromMap(readPowers: ReadFn | ReadPowers | MaybeReadPowers, compartmentMap: CompartmentMapDescriptor, options?: BundleOptions | undefined): Promise<string>;
|
|
3
|
+
/**
|
|
4
|
+
* The bundler kit defines a language-specific behavior for injecting a module
|
|
5
|
+
* into a bundle.
|
|
6
|
+
* Each module must allocate cells for its imports and exports, link those cells
|
|
7
|
+
* to the cells of dependencies, and provide both the linker and evaluation behavior
|
|
8
|
+
* for the module.
|
|
9
|
+
* The linker behavior gets injected in a lexical scope with the linker runtime
|
|
10
|
+
* and has access to the cells of all modules, whereas the evaluation behavior
|
|
11
|
+
* gets injected in the generated script's top level lexical scope, so has
|
|
12
|
+
* no accidental visibility into the linkage runtime.
|
|
13
|
+
*
|
|
14
|
+
* For example, JSON modules produce a single "default" cell ("getCells"):
|
|
15
|
+
*
|
|
16
|
+
* { default: cell('default') },
|
|
17
|
+
*
|
|
18
|
+
* Then, the JSON gets injected verbatim for the evaluation behavior ("getFunctor").
|
|
19
|
+
* The linker simply sets the cell to the value.
|
|
20
|
+
*
|
|
21
|
+
* functors[0]['default'].set(modules[0]);
|
|
22
|
+
*
|
|
23
|
+
* For an ECMAScript or CommonJS module, the evaluation behavior is a function
|
|
24
|
+
* that the linker runtime can call to inject it with the cells it needs by
|
|
25
|
+
* the names it sees for them.
|
|
26
|
+
*/
|
|
27
|
+
export type BundlerKit = {
|
|
28
|
+
/**
|
|
29
|
+
* Produces a JavaScript string consisting of
|
|
30
|
+
* a function expression followed by a comma delimiter that will be evaluated in
|
|
31
|
+
* a lexical scope with no free variables except the globals.
|
|
32
|
+
* In the generated bundle runtime, the function will receive an environment
|
|
33
|
+
* record: a record mapping every name of the corresponding module's internal
|
|
34
|
+
* namespace to a "cell" it can use to get, set, or observe the linked
|
|
35
|
+
* variable.
|
|
36
|
+
*/
|
|
37
|
+
getFunctor: () => string;
|
|
38
|
+
/**
|
|
39
|
+
* Produces a JavaScript string consisting of
|
|
40
|
+
* a JavaScript object and a trailing comma.
|
|
41
|
+
* The string is evaluated in the linker runtime's lexical context.
|
|
42
|
+
*/
|
|
43
|
+
getCells: () => string;
|
|
44
|
+
/**
|
|
45
|
+
* Produces a JavaScript string,
|
|
46
|
+
* a statement that effects the module's evaluation behavior using the cells
|
|
47
|
+
* it imports and exports and the evaluated "functor".
|
|
48
|
+
*/
|
|
49
|
+
getFunctorCall: () => string;
|
|
50
|
+
/**
|
|
51
|
+
* Produces a JavaScript string
|
|
52
|
+
* that may include statements that bind the cells reexported by this module.
|
|
53
|
+
*/
|
|
54
|
+
getReexportsWiring: () => string;
|
|
55
|
+
};
|
|
56
|
+
export type BundleModule<SpecificModuleSource extends unknown> = {
|
|
57
|
+
key: string;
|
|
58
|
+
exit: string;
|
|
59
|
+
compartmentName: string;
|
|
60
|
+
moduleSpecifier: string;
|
|
61
|
+
sourceDirname: string;
|
|
62
|
+
parser: string;
|
|
63
|
+
record: StaticModuleType & SpecificModuleSource;
|
|
64
|
+
resolvedImports: Record<string, string>;
|
|
65
|
+
indexedImports: Record<string, number>;
|
|
66
|
+
bytes: Uint8Array;
|
|
67
|
+
index: number;
|
|
68
|
+
bundlerKit: BundlerKit;
|
|
69
|
+
};
|
|
70
|
+
export type BundleExit = {
|
|
71
|
+
exit: string;
|
|
72
|
+
index: number;
|
|
73
|
+
bundlerKit: BundlerKit;
|
|
74
|
+
indexedImports: Record<string, number>;
|
|
75
|
+
resolvedImports: Record<string, string>;
|
|
76
|
+
};
|
|
77
|
+
export type GetBundlerKit<SpecificModuleSource extends unknown> = (module: BundleModule<SpecificModuleSource>, params: {
|
|
78
|
+
useEvaluate?: boolean | undefined;
|
|
79
|
+
sourceUrlPrefix?: string | undefined;
|
|
80
|
+
}) => BundlerKit;
|
|
81
|
+
export type BundlerSupport<SpecificModuleSource extends unknown> = {
|
|
82
|
+
runtime: string;
|
|
83
|
+
getBundlerKit: GetBundlerKit<SpecificModuleSource>;
|
|
84
|
+
};
|
|
85
|
+
import type { ReadFn } from './types.js';
|
|
86
|
+
import type { ReadPowers } from './types.js';
|
|
87
|
+
import type { MaybeReadPowers } from './types.js';
|
|
88
|
+
import type { CompartmentMapDescriptor } from './types.js';
|
|
89
|
+
import type { BundleOptions } from './types.js';
|
|
90
|
+
import type { StaticModuleType } from 'ses';
|
|
91
|
+
//# sourceMappingURL=bundle-lite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-lite.d.ts","sourceRoot":"","sources":["bundle-lite.js"],"names":[],"mappings":"AA4TO,+CALI,MAAM,GAAG,UAAU,GAAG,eAAe,kBACrC,wBAAwB,wCAEtB,OAAO,CAAC,MAAM,CAAC,CAgV3B;AAQM,8CALI,MAAM,GAAG,UAAU,GAAG,eAAe,kBACrC,wBAAwB,wCAEtB,OAAO,CAAC,MAAM,CAAC,CAW3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA/mBa,MAAM,MAAM;;;;;;cAOZ,MAAM,MAAM;;;;;;oBAGZ,MAAM,MAAM;;;;;wBAGZ,MAAM,MAAM;;yBAKH,oBAAoB,SAA9B,OAAS;SAER,MAAM;UACN,MAAM;qBACN,MAAM;qBACN,MAAM;mBACN,MAAM;YACN,MAAM;YACN,gBAAgB,GAAG,oBAAoB;qBACvC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;oBACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;WACtB,UAAU;WACV,MAAM;gBACN,UAAU;;;UAKV,MAAM;WACN,MAAM;gBACN,UAAU;oBACV,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;qBACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;0BAIb,oBAAoB,SAA9B,OAAS,aAEX,YAAY,CAAC,oBAAoB,CAAC,UAE1C;IAAyB,WAAW;IACZ,eAAe;CACvC,KAAU,UAAU;2BAIA,oBAAoB,SAA9B,OAAS;aAER,MAAM;mBACN,aAAa,CAAC,oBAAoB,CAAC;;4BArFvC,YAAY;gCAAZ,YAAY;qCAAZ,YAAY;8CAAZ,YAAY;mCAAZ,YAAY;sCAVZ,KAAK"}
|