@endo/compartment-mapper 1.2.2 → 1.3.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/archive-lite.d.ts.map +1 -0
- package/archive-parsers.d.ts.map +1 -0
- package/archive.d.ts.map +1 -0
- package/bundle.d.ts.map +1 -0
- package/capture-lite.d.ts.map +1 -0
- package/import-archive-lite.d.ts.map +1 -0
- package/import-archive-parsers.d.ts.map +1 -0
- package/import-archive.d.ts.map +1 -0
- package/import-lite.d.ts.map +1 -0
- package/import-parsers.d.ts.map +1 -0
- package/import.d.ts.map +1 -0
- package/index.d.ts.map +1 -0
- package/node-modules.d.ts.map +1 -0
- package/node-powers.d.ts +1 -1
- package/node-powers.d.ts.map +1 -0
- package/node-powers.js +5 -1
- package/package.json +15 -11
- package/src/compartment-map.d.ts +1 -1
- package/src/compartment-map.d.ts.map +1 -1
- package/src/compartment-map.js +1 -1
- package/src/import-hook.d.ts +14 -1
- package/src/import-hook.d.ts.map +1 -1
- package/src/import-hook.js +493 -144
- package/src/import-lite.d.ts +20 -3
- package/src/import-lite.d.ts.map +1 -1
- package/src/import-lite.js +137 -15
- package/src/import.d.ts +45 -5
- package/src/import.d.ts.map +1 -1
- package/src/import.js +52 -6
- package/src/link.d.ts +2 -11
- package/src/link.d.ts.map +1 -1
- package/src/link.js +76 -154
- package/src/map-parser.d.ts +4 -0
- package/src/map-parser.d.ts.map +1 -0
- package/src/map-parser.js +339 -0
- package/src/node-modules.d.ts +2 -5
- package/src/node-modules.d.ts.map +1 -1
- package/src/node-modules.js +12 -5
- package/src/node-powers.d.ts +29 -23
- package/src/node-powers.d.ts.map +1 -1
- package/src/node-powers.js +102 -25
- package/src/parse-archive-cjs.js +2 -1
- package/src/parse-archive-mjs.js +2 -1
- package/src/parse-bytes.d.ts.map +1 -1
- package/src/parse-bytes.js +2 -6
- package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
- package/src/parse-cjs-shared-export-wrapper.js +23 -6
- package/src/parse-cjs.js +3 -2
- package/src/parse-json.d.ts +5 -3
- package/src/parse-json.d.ts.map +1 -1
- package/src/parse-json.js +9 -9
- package/src/parse-mjs.js +2 -1
- package/src/parse-pre-cjs.js +3 -2
- package/src/parse-pre-mjs.js +2 -1
- package/src/parse-text.d.ts.map +1 -1
- package/src/parse-text.js +2 -6
- package/src/policy.d.ts +21 -14
- package/src/policy.d.ts.map +1 -1
- package/src/policy.js +53 -43
- package/src/powers.d.ts +8 -1
- package/src/powers.d.ts.map +1 -1
- package/src/powers.js +60 -10
- package/src/search.d.ts.map +1 -1
- package/src/search.js +1 -2
- package/src/types.d.ts +343 -21
- package/src/types.d.ts.map +1 -1
- package/src/types.js +369 -22
package/src/import-lite.d.ts
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @overload
|
|
3
|
+
* @param {ReadNowPowers} readPowers
|
|
4
|
+
* @param {CompartmentMapDescriptor} compartmentMap
|
|
5
|
+
* @param {SyncImportLocationOptions} [opts]
|
|
6
|
+
* @returns {Promise<Application>}
|
|
7
|
+
*/
|
|
8
|
+
export function loadFromMap(readPowers: ReadNowPowers, compartmentMap: CompartmentMapDescriptor, opts?: SyncImportLocationOptions | undefined): Promise<Application>;
|
|
9
|
+
/**
|
|
10
|
+
* @overload
|
|
11
|
+
* @param {ReadFn | ReadPowers} readPowers
|
|
12
|
+
* @param {CompartmentMapDescriptor} compartmentMap
|
|
13
|
+
* @param {ImportLocationOptions} [opts]
|
|
14
|
+
* @returns {Promise<Application>}
|
|
15
|
+
*/
|
|
16
|
+
export function loadFromMap(readPowers: ReadFn | ReadPowers, compartmentMap: CompartmentMapDescriptor, opts?: ImportLocationOptions | undefined): Promise<Application>;
|
|
2
17
|
export function importFromMap(readPowers: ReadFn | ReadPowers, compartmentMap: CompartmentMapDescriptor, options?: ImportLocationOptions | undefined): Promise<SomeObject>;
|
|
3
|
-
import type {
|
|
4
|
-
import type { ReadPowers } from './types.js';
|
|
18
|
+
import type { ReadNowPowers } from './types.js';
|
|
5
19
|
import type { CompartmentMapDescriptor } from './types.js';
|
|
20
|
+
import type { SyncImportLocationOptions } from './types.js';
|
|
6
21
|
import type { Application } from './types.js';
|
|
22
|
+
import type { ReadFn } from './types.js';
|
|
23
|
+
import type { ReadPowers } from './types.js';
|
|
7
24
|
import type { ImportLocationOptions } from './types.js';
|
|
8
25
|
import type { SomeObject } from './types.js';
|
|
9
26
|
//# sourceMappingURL=import-lite.d.ts.map
|
package/src/import-lite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-lite.d.ts","sourceRoot":"","sources":["import-lite.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import-lite.d.ts","sourceRoot":"","sources":["import-lite.js"],"names":[],"mappings":";;;;;;;AAmEG,wCACQ,aAAa,kBACb,wBAAwB,iDAEtB,OAAO,CAAC,WAAW,CAAC,CAChC;;;;;;;;AAGE,wCACQ,MAAM,GAAG,UAAU,kBACnB,wBAAwB,6CAEtB,OAAO,CAAC,WAAW,CAAC,CAChC;AA2JM,0CANI,MAAM,GAAG,UAAU,kBACnB,wBAAwB,gDAEtB,OAAO,CAAC,UAAU,CAAC,CAU/B;mCA5NgC,YAAY;8CAJD,YAAY;+CACX,YAAY;iCAI1B,YAAY;4BAGjB,YAAY;gCACR,YAAY;2CAHD,YAAY;gCAIvB,YAAY"}
|
package/src/import-lite.js
CHANGED
|
@@ -16,11 +16,13 @@
|
|
|
16
16
|
|
|
17
17
|
// @ts-check
|
|
18
18
|
/* eslint no-shadow: "off" */
|
|
19
|
-
|
|
20
19
|
/** @import {CompartmentMapDescriptor} from './types.js' */
|
|
20
|
+
/** @import {SyncImportLocationOptions} from './types.js' */
|
|
21
|
+
/** @import {ImportNowHookMaker} from './types.js' */
|
|
22
|
+
/** @import {ModuleTransforms} from './types.js' */
|
|
23
|
+
/** @import {ReadNowPowers} from './types.js' */
|
|
21
24
|
/** @import {Application} from './types.js' */
|
|
22
25
|
/** @import {ImportLocationOptions} from './types.js' */
|
|
23
|
-
/** @import {LoadLocationOptions} from './types.js' */
|
|
24
26
|
/** @import {ExecuteFn} from './types.js' */
|
|
25
27
|
/** @import {ReadFn} from './types.js' */
|
|
26
28
|
/** @import {ReadPowers} from './types.js' */
|
|
@@ -30,19 +32,63 @@ import { link } from './link.js';
|
|
|
30
32
|
import {
|
|
31
33
|
exitModuleImportHookMaker,
|
|
32
34
|
makeImportHookMaker,
|
|
35
|
+
makeImportNowHookMaker,
|
|
33
36
|
} from './import-hook.js';
|
|
37
|
+
import { isReadNowPowers } from './powers.js';
|
|
38
|
+
|
|
39
|
+
const { assign, create, freeze, entries } = Object;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns `true` if `value` is a {@link SyncImportLocationOptions}.
|
|
43
|
+
*
|
|
44
|
+
* The requirements here are:
|
|
45
|
+
* - `moduleTransforms` _is not_ present in `value`
|
|
46
|
+
* - `parserForLanguage` - if set, contains synchronous parsers only
|
|
47
|
+
*
|
|
48
|
+
* @param {ImportLocationOptions|SyncImportLocationOptions} value
|
|
49
|
+
* @returns {value is SyncImportLocationOptions}
|
|
50
|
+
*/
|
|
51
|
+
const isSyncOptions = value => {
|
|
52
|
+
if (!value || (typeof value === 'object' && !('moduleTransforms' in value))) {
|
|
53
|
+
if (value.parserForLanguage) {
|
|
54
|
+
for (const [_language, { synchronous }] of entries(
|
|
55
|
+
value.parserForLanguage,
|
|
56
|
+
)) {
|
|
57
|
+
if (!synchronous) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
};
|
|
34
66
|
|
|
35
|
-
|
|
67
|
+
/**
|
|
68
|
+
* @overload
|
|
69
|
+
* @param {ReadNowPowers} readPowers
|
|
70
|
+
* @param {CompartmentMapDescriptor} compartmentMap
|
|
71
|
+
* @param {SyncImportLocationOptions} [opts]
|
|
72
|
+
* @returns {Promise<Application>}
|
|
73
|
+
*/
|
|
36
74
|
|
|
37
75
|
/**
|
|
76
|
+
* @overload
|
|
38
77
|
* @param {ReadFn | ReadPowers} readPowers
|
|
39
78
|
* @param {CompartmentMapDescriptor} compartmentMap
|
|
40
|
-
* @param {
|
|
79
|
+
* @param {ImportLocationOptions} [opts]
|
|
41
80
|
* @returns {Promise<Application>}
|
|
42
81
|
*/
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {ReadFn|ReadPowers|ReadNowPowers} readPowers
|
|
85
|
+
* @param {CompartmentMapDescriptor} compartmentMap
|
|
86
|
+
* @param {ImportLocationOptions} [options]
|
|
87
|
+
* @returns {Promise<Application>}
|
|
88
|
+
*/
|
|
89
|
+
|
|
43
90
|
export const loadFromMap = async (readPowers, compartmentMap, options = {}) => {
|
|
44
91
|
const {
|
|
45
|
-
moduleTransforms = {},
|
|
46
92
|
searchSuffixes = undefined,
|
|
47
93
|
parserForLanguage: parserForLanguageOption = {},
|
|
48
94
|
languageForExtension: languageForExtensionOption = {},
|
|
@@ -55,6 +101,44 @@ export const loadFromMap = async (readPowers, compartmentMap, options = {}) => {
|
|
|
55
101
|
assign(create(null), languageForExtensionOption),
|
|
56
102
|
);
|
|
57
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Object containing options and read powers that fulfills all requirements
|
|
106
|
+
* for creation of a {@link ImportNowHookMaker}, thus enabling dynamic import.
|
|
107
|
+
*
|
|
108
|
+
* @typedef SyncBehavior
|
|
109
|
+
* @property {ReadNowPowers} readPowers
|
|
110
|
+
* @property {SyncImportLocationOptions} options
|
|
111
|
+
* @property {'SYNC'} type
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Object containing options and read powers which is incompatible with
|
|
116
|
+
* creation of an {@link ImportNowHookMaker}, thus disabling dynamic import.
|
|
117
|
+
*
|
|
118
|
+
* @typedef AsyncBehavior
|
|
119
|
+
* @property {ReadFn|ReadPowers} readPowers
|
|
120
|
+
* @property {ImportLocationOptions} options
|
|
121
|
+
* @property {'ASYNC'} type
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* When we must control flow based on _n_ type guards consdering _n_ discrete
|
|
126
|
+
* values, grouping the values into an object, then leveraging a discriminated
|
|
127
|
+
* union (the `type` property) is one way to approach the problem.
|
|
128
|
+
*/
|
|
129
|
+
const behavior =
|
|
130
|
+
isReadNowPowers(readPowers) && isSyncOptions(options)
|
|
131
|
+
? /** @type {SyncBehavior} */ ({
|
|
132
|
+
readPowers,
|
|
133
|
+
options: options || {},
|
|
134
|
+
type: 'SYNC',
|
|
135
|
+
})
|
|
136
|
+
: /** @type {AsyncBehavior} */ ({
|
|
137
|
+
readPowers,
|
|
138
|
+
options: options || {},
|
|
139
|
+
type: 'ASYNC',
|
|
140
|
+
});
|
|
141
|
+
|
|
58
142
|
const {
|
|
59
143
|
entry: { compartment: entryCompartmentName, module: entryModuleSpecifier },
|
|
60
144
|
} = compartmentMap;
|
|
@@ -85,16 +169,54 @@ export const loadFromMap = async (readPowers, compartmentMap, options = {}) => {
|
|
|
85
169
|
exitModuleImportHook: compartmentExitModuleImportHook,
|
|
86
170
|
},
|
|
87
171
|
);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
172
|
+
|
|
173
|
+
/** @type {ImportNowHookMaker | undefined} */
|
|
174
|
+
let makeImportNowHook;
|
|
175
|
+
|
|
176
|
+
/** @type {Compartment} */
|
|
177
|
+
let compartment;
|
|
178
|
+
/** @type {Promise<void>} */
|
|
179
|
+
let pendingJobsPromise;
|
|
180
|
+
|
|
181
|
+
if (behavior.type === 'SYNC') {
|
|
182
|
+
const { importNowHook: exitModuleImportNowHook, syncModuleTransforms } =
|
|
183
|
+
behavior.options;
|
|
184
|
+
makeImportNowHook = makeImportNowHookMaker(
|
|
185
|
+
/** @type {ReadNowPowers} */ (readPowers),
|
|
186
|
+
entryCompartmentName,
|
|
187
|
+
{
|
|
188
|
+
compartmentDescriptors: compartmentMap.compartments,
|
|
189
|
+
searchSuffixes,
|
|
190
|
+
exitModuleImportNowHook,
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
({ compartment, pendingJobsPromise } = link(compartmentMap, {
|
|
194
|
+
makeImportHook,
|
|
195
|
+
makeImportNowHook,
|
|
196
|
+
parserForLanguage,
|
|
197
|
+
languageForExtension,
|
|
198
|
+
globals,
|
|
199
|
+
transforms,
|
|
200
|
+
syncModuleTransforms,
|
|
201
|
+
__shimTransforms__,
|
|
202
|
+
Compartment,
|
|
203
|
+
}));
|
|
204
|
+
} else {
|
|
205
|
+
// sync module transforms are allowed, because they are "compatible"
|
|
206
|
+
// with async module transforms (not vice-versa)
|
|
207
|
+
const { moduleTransforms, syncModuleTransforms } = behavior.options;
|
|
208
|
+
({ compartment, pendingJobsPromise } = link(compartmentMap, {
|
|
209
|
+
makeImportHook,
|
|
210
|
+
parserForLanguage,
|
|
211
|
+
languageForExtension,
|
|
212
|
+
globals,
|
|
213
|
+
transforms,
|
|
214
|
+
moduleTransforms,
|
|
215
|
+
syncModuleTransforms,
|
|
216
|
+
__shimTransforms__,
|
|
217
|
+
Compartment,
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
98
220
|
|
|
99
221
|
await pendingJobsPromise;
|
|
100
222
|
|
package/src/import.d.ts
CHANGED
|
@@ -1,8 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @overload
|
|
3
|
+
* @param {ReadNowPowers} readPowers
|
|
4
|
+
* @param {string} moduleLocation
|
|
5
|
+
* @param {SyncArchiveOptions} options
|
|
6
|
+
* @returns {Promise<Application>}
|
|
7
|
+
*/
|
|
8
|
+
export function loadLocation(readPowers: ReadNowPowers, moduleLocation: string, options: SyncArchiveOptions): Promise<Application>;
|
|
9
|
+
/**
|
|
10
|
+
* @overload
|
|
11
|
+
* @param {ReadFn | ReadPowers} readPowers
|
|
12
|
+
* @param {string} moduleLocation
|
|
13
|
+
* @param {LoadLocationOptions} [options]
|
|
14
|
+
* @returns {Promise<Application>}
|
|
15
|
+
*/
|
|
16
|
+
export function loadLocation(readPowers: ReadFn | ReadPowers, moduleLocation: string, options?: LoadLocationOptions | undefined): Promise<Application>;
|
|
17
|
+
/**
|
|
18
|
+
* Allows dynamic requires
|
|
19
|
+
*
|
|
20
|
+
* @overload
|
|
21
|
+
* @param {ReadNowPowers} readPowers
|
|
22
|
+
* @param {string} moduleLocation
|
|
23
|
+
* @param {SyncImportLocationOptions} options
|
|
24
|
+
* @returns {Promise<SomeObject>} the object of the imported modules exported
|
|
25
|
+
* names.
|
|
26
|
+
*/
|
|
27
|
+
export function importLocation(readPowers: ReadNowPowers, moduleLocation: string, options: SyncImportLocationOptions): Promise<SomeObject>;
|
|
28
|
+
/**
|
|
29
|
+
* Disallows dynamic requires
|
|
30
|
+
*
|
|
31
|
+
* @overload
|
|
32
|
+
* @param {ReadPowers|ReadFn} readPowers
|
|
33
|
+
* @param {string} moduleLocation
|
|
34
|
+
* @param {ImportLocationOptions} [options]
|
|
35
|
+
* @returns {Promise<SomeObject>} the object of the imported modules exported
|
|
36
|
+
* names.
|
|
37
|
+
*/
|
|
38
|
+
export function importLocation(readPowers: ReadPowers | ReadFn, moduleLocation: string, options?: ImportLocationOptions | undefined): Promise<SomeObject>;
|
|
39
|
+
import type { ReadNowPowers } from './types.js';
|
|
40
|
+
import type { SyncArchiveOptions } from './types.js';
|
|
41
|
+
import type { Application } from './types.js';
|
|
3
42
|
import type { ReadFn } from './types.js';
|
|
4
43
|
import type { ReadPowers } from './types.js';
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
44
|
+
import type { LoadLocationOptions } from './types.js';
|
|
45
|
+
import type { SyncImportLocationOptions } from './types.js';
|
|
46
|
+
import type { SomeObject } from './types.js';
|
|
47
|
+
import type { ImportLocationOptions } from './types.js';
|
|
8
48
|
//# sourceMappingURL=import.d.ts.map
|
package/src/import.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["import.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["import.js"],"names":[],"mappings":";;;;;;;AA6CG,yCACQ,aAAa,kBACb,MAAM,WACN,kBAAkB,GAChB,OAAO,CAAC,WAAW,CAAC,CAChC;;;;;;;;AAGE,yCACQ,MAAM,GAAG,UAAU,kBACnB,MAAM,8CAEJ,OAAO,CAAC,WAAW,CAAC,CAChC;;;;;;;;;;;AAiCE,2CACQ,aAAa,kBACb,MAAM,WACN,yBAAyB,GACvB,OAAO,CAAC,UAAU,CAAC,CAE/B;;;;;;;;;;;AAKE,2CACQ,UAAU,GAAC,MAAM,kBACjB,MAAM,gDAEJ,OAAO,CAAC,UAAU,CAAC,CAE/B;mCAlFgC,YAAY;wCAJP,YAAY;iCAFnB,YAAY;4BAQjB,YAAY;gCACR,YAAY;yCANH,YAAY;+CACN,YAAY;gCAC3B,YAAY;2CAJD,YAAY"}
|
package/src/import.js
CHANGED
|
@@ -19,8 +19,13 @@ import { loadFromMap } from './import-lite.js';
|
|
|
19
19
|
const { assign, create, freeze } = Object;
|
|
20
20
|
|
|
21
21
|
/** @import {Application} from './types.js' */
|
|
22
|
+
/** @import {ImportLocationOptions} from './types.js' */
|
|
23
|
+
/** @import {SyncArchiveOptions} from './types.js' */
|
|
24
|
+
/** @import {LoadLocationOptions} from './types.js' */
|
|
25
|
+
/** @import {SyncImportLocationOptions} from './types.js' */
|
|
26
|
+
/** @import {SomeObject} from './types.js' */
|
|
27
|
+
/** @import {ReadNowPowers} from './types.js' */
|
|
22
28
|
/** @import {ArchiveOptions} from './types.js' */
|
|
23
|
-
/** @import {ExecuteOptions} from './types.js' */
|
|
24
29
|
/** @import {ReadFn} from './types.js' */
|
|
25
30
|
/** @import {ReadPowers} from './types.js' */
|
|
26
31
|
|
|
@@ -38,9 +43,25 @@ const assignParserForLanguage = (options = {}) => {
|
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
/**
|
|
46
|
+
* @overload
|
|
47
|
+
* @param {ReadNowPowers} readPowers
|
|
48
|
+
* @param {string} moduleLocation
|
|
49
|
+
* @param {SyncArchiveOptions} options
|
|
50
|
+
* @returns {Promise<Application>}
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @overload
|
|
41
55
|
* @param {ReadFn | ReadPowers} readPowers
|
|
42
56
|
* @param {string} moduleLocation
|
|
43
|
-
* @param {
|
|
57
|
+
* @param {LoadLocationOptions} [options]
|
|
58
|
+
* @returns {Promise<Application>}
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {ReadFn|ReadPowers|ReadNowPowers} readPowers
|
|
63
|
+
* @param {string} moduleLocation
|
|
64
|
+
* @param {LoadLocationOptions} [options]
|
|
44
65
|
* @returns {Promise<Application>}
|
|
45
66
|
*/
|
|
46
67
|
export const loadLocation = async (
|
|
@@ -48,7 +69,10 @@ export const loadLocation = async (
|
|
|
48
69
|
moduleLocation,
|
|
49
70
|
options = {},
|
|
50
71
|
) => {
|
|
51
|
-
const { dev, tags,
|
|
72
|
+
const { dev, tags, commonDependencies, policy } = options;
|
|
73
|
+
// conditions are not present in SyncArchiveOptions
|
|
74
|
+
const conditions =
|
|
75
|
+
'conditions' in options ? options.conditions || tags : tags;
|
|
52
76
|
const compartmentMap = await mapNodeModules(readPowers, moduleLocation, {
|
|
53
77
|
dev,
|
|
54
78
|
conditions,
|
|
@@ -63,10 +87,32 @@ export const loadLocation = async (
|
|
|
63
87
|
};
|
|
64
88
|
|
|
65
89
|
/**
|
|
66
|
-
*
|
|
90
|
+
* Allows dynamic requires
|
|
91
|
+
*
|
|
92
|
+
* @overload
|
|
93
|
+
* @param {ReadNowPowers} readPowers
|
|
94
|
+
* @param {string} moduleLocation
|
|
95
|
+
* @param {SyncImportLocationOptions} options
|
|
96
|
+
* @returns {Promise<SomeObject>} the object of the imported modules exported
|
|
97
|
+
* names.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Disallows dynamic requires
|
|
102
|
+
*
|
|
103
|
+
* @overload
|
|
104
|
+
* @param {ReadPowers|ReadFn} readPowers
|
|
105
|
+
* @param {string} moduleLocation
|
|
106
|
+
* @param {ImportLocationOptions} [options]
|
|
107
|
+
* @returns {Promise<SomeObject>} the object of the imported modules exported
|
|
108
|
+
* names.
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @param {ReadPowers|ReadFn|ReadNowPowers} readPowers
|
|
67
113
|
* @param {string} moduleLocation
|
|
68
|
-
* @param {
|
|
69
|
-
* @returns {Promise<
|
|
114
|
+
* @param {ImportLocationOptions} [options]
|
|
115
|
+
* @returns {Promise<SomeObject>} the object of the imported modules exported
|
|
70
116
|
* names.
|
|
71
117
|
*/
|
|
72
118
|
export const importLocation = async (readPowers, moduleLocation, options) => {
|
package/src/link.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
export function
|
|
2
|
-
export function link({ entry, compartments: compartmentDescriptors }: CompartmentMapDescriptor, { resolve, makeImportHook, parserForLanguage: parserForLanguageOption, languageForExtension: languageForExtensionOption, globals, transforms, moduleTransforms, __shimTransforms__, archiveOnly, Compartment, }: LinkOptions): {
|
|
3
|
-
compartment: Compartment;
|
|
4
|
-
compartments: Record<string, Compartment>;
|
|
5
|
-
attenuatorsCompartment: Compartment;
|
|
6
|
-
pendingJobsPromise: Promise<void>;
|
|
7
|
-
};
|
|
1
|
+
export function link({ entry, compartments: compartmentDescriptors }: CompartmentMapDescriptor, options: LinkOptions): LinkResult;
|
|
8
2
|
export function assemble(compartmentMap: CompartmentMapDescriptor, options: LinkOptions): Compartment;
|
|
9
|
-
import type { LanguageForExtension } from './types.js';
|
|
10
|
-
import type { ParserForLanguage } from './types.js';
|
|
11
|
-
import type { ModuleTransforms } from './types.js';
|
|
12
|
-
import type { ParseFn } from './types.js';
|
|
13
3
|
import type { CompartmentMapDescriptor } from './types.js';
|
|
14
4
|
import type { LinkOptions } from './types.js';
|
|
5
|
+
import type { LinkResult } from './types.js';
|
|
15
6
|
//# sourceMappingURL=link.d.ts.map
|
package/src/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["link.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["link.js"],"names":[],"mappings":"AAqPO,sEAJI,wBAAwB,WACxB,WAAW,GACT,UAAU,CA0LtB;AAOM,yCAJI,wBAAwB,WACxB,WAAW,eAIqB;8CA5ZjC,YAAY;iCAAZ,YAAY;gCAAZ,YAAY"}
|