@endo/compartment-mapper 1.3.1 → 1.5.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 +64 -27
- package/archive-lite.d.ts +1 -0
- package/archive-lite.js +3 -0
- package/archive-parsers.d.ts +1 -0
- package/archive-parsers.js +3 -0
- package/archive.d.ts +1 -0
- package/archive.js +3 -0
- package/bundle.d.ts +1 -0
- package/bundle.js +3 -0
- package/capture-lite.d.ts +1 -0
- package/capture-lite.js +3 -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/import-archive-lite.d.ts +1 -0
- package/import-archive-lite.js +3 -0
- package/import-archive-parsers.d.ts +1 -0
- package/import-archive-parsers.js +3 -0
- package/import-archive.d.ts +1 -0
- package/import-archive.js +3 -0
- package/import-lite.d.ts +1 -0
- package/import-lite.js +3 -0
- package/import-parsers.d.ts +1 -0
- package/import-parsers.js +3 -0
- package/import.d.ts +1 -0
- package/import.js +3 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/node-modules.d.ts +1 -0
- package/node-modules.js +3 -0
- package/node-powers.d.ts +1 -0
- package/node-powers.js +3 -0
- package/package.json +16 -15
- package/src/archive-lite.d.ts +8 -10
- package/src/archive-lite.d.ts.map +1 -1
- package/src/archive-lite.js +35 -209
- package/src/archive.d.ts.map +1 -1
- package/src/archive.js +140 -28
- package/src/bundle.d.ts.map +1 -1
- package/src/bundle.js +62 -16
- package/src/capture-lite.d.ts +2 -2
- package/src/capture-lite.d.ts.map +1 -1
- package/src/capture-lite.js +27 -201
- package/src/compartment-map.d.ts +2 -1
- package/src/compartment-map.d.ts.map +1 -1
- package/src/compartment-map.js +11 -3
- package/src/digest.d.ts +5 -0
- package/src/digest.d.ts.map +1 -0
- package/src/digest.js +235 -0
- package/src/extension.d.ts.map +1 -1
- package/src/extension.js +1 -3
- 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 +3 -19
- package/src/import-archive-lite.d.ts.map +1 -1
- package/src/import-archive-lite.js +47 -57
- package/src/import-archive-parsers.d.ts.map +1 -1
- package/src/import-archive-parsers.js +1 -0
- package/src/import-archive.d.ts +2 -2
- package/src/import-archive.d.ts.map +1 -1
- package/src/import-archive.js +15 -12
- package/src/import-hook.d.ts +2 -1
- package/src/import-hook.d.ts.map +1 -1
- package/src/import-hook.js +87 -76
- package/src/import-lite.d.ts.map +1 -1
- package/src/import-lite.js +26 -23
- package/src/import.d.ts.map +1 -1
- package/src/import.js +49 -23
- package/src/infer-exports.d.ts.map +1 -1
- package/src/infer-exports.js +2 -3
- package/src/json.d.ts.map +1 -1
- package/src/json.js +1 -2
- package/src/link.d.ts.map +1 -1
- package/src/link.js +14 -29
- package/src/map-parser.d.ts.map +1 -1
- package/src/map-parser.js +25 -17
- package/src/node-module-specifier.d.ts.map +1 -1
- package/src/node-module-specifier.js +2 -3
- package/src/node-modules.d.ts +10 -8
- package/src/node-modules.d.ts.map +1 -1
- package/src/node-modules.js +212 -97
- package/src/node-powers.d.ts +8 -8
- package/src/node-powers.d.ts.map +1 -1
- package/src/node-powers.js +29 -24
- package/src/parse-archive-cjs.d.ts +3 -2
- package/src/parse-archive-cjs.d.ts.map +1 -1
- package/src/parse-archive-cjs.js +5 -4
- package/src/parse-archive-mjs.d.ts +3 -2
- package/src/parse-archive-mjs.d.ts.map +1 -1
- package/src/parse-archive-mjs.js +7 -5
- package/src/parse-bytes.d.ts +3 -2
- package/src/parse-bytes.d.ts.map +1 -1
- package/src/parse-bytes.js +7 -5
- package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
- package/src/parse-cjs-shared-export-wrapper.js +7 -6
- package/src/parse-cjs.d.ts +3 -2
- package/src/parse-cjs.d.ts.map +1 -1
- package/src/parse-cjs.js +14 -5
- package/src/parse-json.d.ts.map +1 -1
- package/src/parse-json.js +6 -6
- package/src/parse-mjs.d.ts +3 -2
- package/src/parse-mjs.d.ts.map +1 -1
- package/src/parse-mjs.js +3 -3
- package/src/parse-pre-cjs.d.ts +3 -2
- package/src/parse-pre-cjs.d.ts.map +1 -1
- package/src/parse-pre-cjs.js +14 -4
- package/src/parse-pre-mjs.d.ts +3 -2
- package/src/parse-pre-mjs.d.ts.map +1 -1
- package/src/parse-pre-mjs.js +4 -3
- package/src/parse-text.d.ts +3 -2
- package/src/parse-text.d.ts.map +1 -1
- package/src/parse-text.js +6 -5
- package/src/policy-format.d.ts +1 -1
- package/src/policy-format.d.ts.map +1 -1
- package/src/policy-format.js +5 -7
- package/src/policy.d.ts.map +1 -1
- package/src/policy.js +15 -10
- package/src/powers.d.ts.map +1 -1
- package/src/powers.js +15 -12
- package/src/search.d.ts.map +1 -1
- package/src/search.js +10 -7
- package/src/types/compartment-map-schema.d.ts +98 -0
- package/src/types/compartment-map-schema.d.ts.map +1 -0
- package/src/types/compartment-map-schema.ts +116 -0
- package/src/types/external.d.ts +299 -0
- package/src/types/external.d.ts.map +1 -0
- package/src/types/external.ts +428 -0
- package/src/types/internal.d.ts +162 -0
- package/src/types/internal.d.ts.map +1 -0
- package/src/types/internal.ts +217 -0
- package/src/types/node-powers.d.ts +46 -0
- package/src/types/node-powers.d.ts.map +1 -0
- package/src/types/node-powers.ts +52 -0
- package/src/types/policy-schema.d.ts +81 -0
- package/src/types/policy-schema.d.ts.map +1 -0
- package/src/types/policy-schema.ts +131 -0
- package/src/types/policy.d.ts +20 -0
- package/src/types/policy.d.ts.map +1 -0
- package/src/types/policy.ts +42 -0
- package/src/types/powers.d.ts +83 -0
- package/src/types/powers.d.ts.map +1 -0
- package/src/types/powers.ts +120 -0
- package/src/types/typescript.d.ts +28 -0
- package/src/types/typescript.d.ts.map +1 -0
- package/src/types/typescript.ts +41 -0
- package/src/types-external.d.ts +14 -0
- package/src/types-external.js +2 -0
- package/src/types.d.ts +9 -787
- package/src/url.d.ts.map +1 -1
- package/src/url.js +2 -3
- package/src/types.d.ts.map +0 -1
- package/src/types.js +0 -995
- package/types.d.ts +0 -19
package/src/types.d.ts
CHANGED
|
@@ -1,787 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* The entry descriptor of a compartment map denotes the root module of an
|
|
12
|
-
* application and the compartment that contains it.
|
|
13
|
-
*/
|
|
14
|
-
export type EntryDescriptor = {
|
|
15
|
-
compartment: string;
|
|
16
|
-
module: string;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* A compartment descriptor corresponds to a single Compartment
|
|
20
|
-
* of an assembled Application and describes how to construct
|
|
21
|
-
* one for a given library or application `package.json`.
|
|
22
|
-
*/
|
|
23
|
-
export type CompartmentDescriptor = {
|
|
24
|
-
label: string;
|
|
25
|
-
/**
|
|
26
|
-
* - shortest path of dependency names to this
|
|
27
|
-
* compartment
|
|
28
|
-
*/
|
|
29
|
-
path?: string[] | undefined;
|
|
30
|
-
/**
|
|
31
|
-
* - the name of the originating package suitable for
|
|
32
|
-
* constructing a sourceURL prefix that will match it to files in a developer
|
|
33
|
-
* workspace.
|
|
34
|
-
*/
|
|
35
|
-
name: string;
|
|
36
|
-
location: string;
|
|
37
|
-
/**
|
|
38
|
-
* - whether this compartment was retained by
|
|
39
|
-
* any module in the solution. This property should never appear in an archived
|
|
40
|
-
* compartment map.
|
|
41
|
-
*/
|
|
42
|
-
retained?: boolean | undefined;
|
|
43
|
-
modules: Record<string, ModuleDescriptor>;
|
|
44
|
-
scopes: Record<string, ScopeDescriptor>;
|
|
45
|
-
/**
|
|
46
|
-
* - language for extension
|
|
47
|
-
*/
|
|
48
|
-
parsers: LanguageForExtension;
|
|
49
|
-
/**
|
|
50
|
-
* - language for module specifier
|
|
51
|
-
*/
|
|
52
|
-
types: LanguageForModuleSpecifier;
|
|
53
|
-
/**
|
|
54
|
-
* - policy specific to compartment
|
|
55
|
-
*/
|
|
56
|
-
policy: SomePackagePolicy;
|
|
57
|
-
/**
|
|
58
|
-
* - List of compartment names this Compartment depends upon
|
|
59
|
-
*/
|
|
60
|
-
compartments: Set<string>;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* For every module explicitly mentioned in an `exports` field of a
|
|
64
|
-
* `package.json`, there is a corresponding module descriptor.
|
|
65
|
-
*/
|
|
66
|
-
export type ModuleDescriptor = {
|
|
67
|
-
compartment?: string | undefined;
|
|
68
|
-
module?: string | undefined;
|
|
69
|
-
location?: string | undefined;
|
|
70
|
-
parser?: Language | undefined;
|
|
71
|
-
/**
|
|
72
|
-
* in base 16, hex
|
|
73
|
-
*/
|
|
74
|
-
sha512?: string | undefined;
|
|
75
|
-
exit?: string | undefined;
|
|
76
|
-
deferredError?: string | undefined;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Scope descriptors link all names under a prefix to modules in another
|
|
80
|
-
* compartment, like a wildcard.
|
|
81
|
-
* These are employed to link any module not explicitly mentioned
|
|
82
|
-
* in a `package.json` file, when that `package.json` file does not have
|
|
83
|
-
* an explicit `exports` map.
|
|
84
|
-
*/
|
|
85
|
-
export type ScopeDescriptor = {
|
|
86
|
-
compartment: string;
|
|
87
|
-
module?: string | undefined;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* Natively-recognized and custom languages
|
|
91
|
-
*/
|
|
92
|
-
export type Language = LiteralUnion<BuiltinLanguage, string>;
|
|
93
|
-
/**
|
|
94
|
-
* Languages natively recognized by `compartment-mapper`
|
|
95
|
-
*/
|
|
96
|
-
export type BuiltinLanguage = "mjs" | "cjs" | "json" | "bytes" | "text" | "pre-mjs-json" | "pre-cjs-json";
|
|
97
|
-
export type ArchiveWriter = {
|
|
98
|
-
write: WriteFn;
|
|
99
|
-
snapshot: SnapshotFn;
|
|
100
|
-
};
|
|
101
|
-
export type WriteFn = (location: string, bytes: Uint8Array) => Promise<void>;
|
|
102
|
-
export type ArchiveReader = {
|
|
103
|
-
read: ReadFn;
|
|
104
|
-
};
|
|
105
|
-
export type ReadFn = (location: string) => Promise<Uint8Array>;
|
|
106
|
-
export type ReadNowFn = (location: string) => Uint8Array;
|
|
107
|
-
/**
|
|
108
|
-
* A resolution of `undefined` indicates `ENOENT` or the equivalent.
|
|
109
|
-
*/
|
|
110
|
-
export type MaybeReadFn = (location: string) => Promise<Uint8Array | undefined>;
|
|
111
|
-
/**
|
|
112
|
-
* A resolution of `undefined` indicates `ENOENT` or the equivalent.
|
|
113
|
-
*/
|
|
114
|
-
export type MaybeReadNowFn = (location: string) => Uint8Array | undefined;
|
|
115
|
-
/**
|
|
116
|
-
* Returns a canonical URL for a given URL, following redirects or symbolic
|
|
117
|
-
* links if any exist along the path.
|
|
118
|
-
* Must return the given logical location if the real location does not exist.
|
|
119
|
-
*/
|
|
120
|
-
export type CanonicalFn = (location: string) => Promise<string>;
|
|
121
|
-
export type HashFn = (bytes: string | Uint8Array) => string;
|
|
122
|
-
export type Application = {
|
|
123
|
-
import: ExecuteFn;
|
|
124
|
-
sha512?: string | undefined;
|
|
125
|
-
};
|
|
126
|
-
export type ExecuteFn = (options?: ExecuteOptions | undefined) => Promise<SomeObject>;
|
|
127
|
-
export type SnapshotFn = () => Promise<Uint8Array>;
|
|
128
|
-
export type FileURLToPathFn = (location: string | URL) => string;
|
|
129
|
-
export type IsAbsoluteFn = (location: string) => boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Node.js' `url.pathToFileURL` only returns a {@link URL}.
|
|
132
|
-
*/
|
|
133
|
-
export type PathToFileURLFn = (location: string) => URL | string;
|
|
134
|
-
export type RequireResolveFn = (fromLocation: string, specifier: string, options?: {
|
|
135
|
-
paths?: string[];
|
|
136
|
-
} | undefined) => any;
|
|
137
|
-
export type ReadPowers = {
|
|
138
|
-
read: ReadFn;
|
|
139
|
-
canonical: CanonicalFn;
|
|
140
|
-
maybeReadNow?: MaybeReadNowFn | undefined;
|
|
141
|
-
computeSha512?: HashFn | undefined;
|
|
142
|
-
fileURLToPath?: FileURLToPathFn | undefined;
|
|
143
|
-
pathToFileURL?: PathToFileURLFn | undefined;
|
|
144
|
-
requireResolve?: RequireResolveFn | undefined;
|
|
145
|
-
isAbsolute?: IsAbsoluteFn | undefined;
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* These properties are necessary for dynamic require support
|
|
149
|
-
*/
|
|
150
|
-
export type ReadNowPowersProp = "fileURLToPath" | "isAbsolute" | "maybeReadNow";
|
|
151
|
-
/**
|
|
152
|
-
* The extension of {@link ReadPowers} necessary for dynamic require support
|
|
153
|
-
*
|
|
154
|
-
* For a `ReadPowers` to be a `ReadNowPowers`:
|
|
155
|
-
*
|
|
156
|
-
* 1. It must be an object (not a {@link ReadFn})
|
|
157
|
-
* 2. Prop `maybeReadNow` is a function
|
|
158
|
-
* 3. Prop `fileURLToPath` is a function
|
|
159
|
-
* 4. Prop `isAbsolute` is a function
|
|
160
|
-
*/
|
|
161
|
-
export type ReadNowPowers = Omit<ReadPowers, ReadNowPowersProp> & Required<Pick<ReadPowers, ReadNowPowersProp>>;
|
|
162
|
-
export type MakeImportNowHookMakerOptions = {
|
|
163
|
-
sources?: Sources | undefined;
|
|
164
|
-
compartmentDescriptors?: Record<string, CompartmentDescriptor> | undefined;
|
|
165
|
-
computeSha512?: HashFn | undefined;
|
|
166
|
-
/**
|
|
167
|
-
* Suffixes to search if the unmodified
|
|
168
|
-
* specifier is not found. Pass `[]` to emulate Node.js' strict behavior. The
|
|
169
|
-
* default handles Node.js' CommonJS behavior. Unlike Node.js, the Compartment
|
|
170
|
-
* Mapper lifts CommonJS up, more like a bundler, and does not attempt to vary
|
|
171
|
-
* the behavior of resolution depending on the language of the importing module.
|
|
172
|
-
*/
|
|
173
|
-
searchSuffixes?: string[] | undefined;
|
|
174
|
-
sourceMapHook?: SourceMapHook | undefined;
|
|
175
|
-
exitModuleImportNowHook?: ExitModuleImportNowHook | undefined;
|
|
176
|
-
};
|
|
177
|
-
export type MaybeReadPowers = ReadPowers & {
|
|
178
|
-
maybeRead: MaybeReadFn;
|
|
179
|
-
};
|
|
180
|
-
export type HashPowers = {
|
|
181
|
-
read: ReadFn;
|
|
182
|
-
canonical: CanonicalFn;
|
|
183
|
-
computeSha512: HashFn;
|
|
184
|
-
};
|
|
185
|
-
export type WritePowers = {
|
|
186
|
-
write: WriteFn;
|
|
187
|
-
};
|
|
188
|
-
export type ResolveHook = (importSpecifier: string, referrerSpecifier: string) => string;
|
|
189
|
-
export type ShouldDeferError = (language: Language | undefined) => boolean;
|
|
190
|
-
export type ImportHookMakerOptions = {
|
|
191
|
-
packageLocation: string;
|
|
192
|
-
packageName: string;
|
|
193
|
-
attenuators: DeferredAttenuatorsProvider;
|
|
194
|
-
parse: ParseFn | ParseFnAsync;
|
|
195
|
-
shouldDeferError: ShouldDeferError;
|
|
196
|
-
compartments: Record<string, Compartment>;
|
|
197
|
-
};
|
|
198
|
-
export type ImportHookMaker = (options: ImportHookMakerOptions) => ImportHook;
|
|
199
|
-
export type ImportNowHookMakerParams = {
|
|
200
|
-
packageLocation: string;
|
|
201
|
-
packageName: string;
|
|
202
|
-
parse: ParseFn | ParseFnAsync;
|
|
203
|
-
compartments: Record<string, Compartment>;
|
|
204
|
-
};
|
|
205
|
-
export type ImportNowHookMaker = (params: ImportNowHookMakerParams) => ImportNowHook;
|
|
206
|
-
export type SourceMapHookDetails = {
|
|
207
|
-
compartment: string;
|
|
208
|
-
module: string;
|
|
209
|
-
location: string;
|
|
210
|
-
sha512: string;
|
|
211
|
-
};
|
|
212
|
-
export type SourceMapHook = (sourceMap: string, details: SourceMapHookDetails) => any;
|
|
213
|
-
export type ComputeSourceMapLocationDetails = {
|
|
214
|
-
compartment: string;
|
|
215
|
-
module: string;
|
|
216
|
-
location: string;
|
|
217
|
-
sha512: string;
|
|
218
|
-
};
|
|
219
|
-
export type ComputeSourceMapLocationHook = (details: ComputeSourceMapLocationDetails) => string;
|
|
220
|
-
/**
|
|
221
|
-
* Result of a {@link ParseFn}
|
|
222
|
-
*/
|
|
223
|
-
export type ParseResult = {
|
|
224
|
-
bytes: Uint8Array;
|
|
225
|
-
parser: Language;
|
|
226
|
-
record: FinalStaticModuleType;
|
|
227
|
-
sourceMap?: string | undefined;
|
|
228
|
-
};
|
|
229
|
-
export type ParseFn_ = (bytes: Uint8Array, specifier: string, location: string, packageLocation: string, options?: {
|
|
230
|
-
sourceMap?: string | undefined;
|
|
231
|
-
sourceMapHook?: SourceMapHook | undefined;
|
|
232
|
-
sourceMapUrl?: string | undefined;
|
|
233
|
-
readPowers?: ReadFn | ReadPowers | undefined;
|
|
234
|
-
compartmentDescriptor?: CompartmentDescriptor | undefined;
|
|
235
|
-
} | undefined) => ParseResult;
|
|
236
|
-
export type ParseFn = ParseFn_ & {
|
|
237
|
-
isSyncParser?: true;
|
|
238
|
-
};
|
|
239
|
-
export type ParseFnAsync = (bytes: Uint8Array, specifier: string, location: string, packageLocation: string, options?: {
|
|
240
|
-
sourceMap?: string | undefined;
|
|
241
|
-
sourceMapHook?: SourceMapHook | undefined;
|
|
242
|
-
sourceMapUrl?: string | undefined;
|
|
243
|
-
readPowers?: ReadFn | ReadPowers | undefined;
|
|
244
|
-
} | undefined) => Promise<ParseResult>;
|
|
245
|
-
/**
|
|
246
|
-
* ParserImplementation declares if a heuristic is used by parser to detect
|
|
247
|
-
* imports - is set to true for cjs, which uses a lexer to find require calls
|
|
248
|
-
*/
|
|
249
|
-
export type ParserImplementation = {
|
|
250
|
-
heuristicImports: boolean;
|
|
251
|
-
synchronous?: boolean | undefined;
|
|
252
|
-
parse: ParseFn;
|
|
253
|
-
};
|
|
254
|
-
export type ComputeSourceLocationHook = (compartmentName: string, moduleSpecifier: string) => string | undefined;
|
|
255
|
-
export type ExitModuleImportHook = (specifier: string) => Promise<ThirdPartyStaticModuleInterface | undefined>;
|
|
256
|
-
export type ExitModuleImportNowHook = (specifier: string, referrer: string) => ThirdPartyStaticModuleInterface | undefined;
|
|
257
|
-
export type ExtraLoadArchiveOptions = {
|
|
258
|
-
expectedSha512?: string | undefined;
|
|
259
|
-
modules?: Record<string, any> | undefined;
|
|
260
|
-
Compartment?: typeof Compartment | undefined;
|
|
261
|
-
computeSourceLocation?: ComputeSourceLocationHook | undefined;
|
|
262
|
-
computeSourceMapLocation?: ComputeSourceMapLocationHook | undefined;
|
|
263
|
-
parserForLanguage?: ParserForLanguage | undefined;
|
|
264
|
-
languageForExtension?: LanguageForExtension | undefined;
|
|
265
|
-
};
|
|
266
|
-
/**
|
|
267
|
-
* Options for `loadArchive()`
|
|
268
|
-
*/
|
|
269
|
-
export type LoadArchiveOptions = ExecuteOptions & ExtraLoadArchiveOptions;
|
|
270
|
-
/**
|
|
271
|
-
* Set of options available in the context of code execution.
|
|
272
|
-
*
|
|
273
|
-
* May be used only as an intersection with other "options" types
|
|
274
|
-
*/
|
|
275
|
-
export type ExecuteOptions = {
|
|
276
|
-
globals?: object;
|
|
277
|
-
transforms?: Transform[] | undefined;
|
|
278
|
-
__shimTransforms__?: Transform[] | undefined;
|
|
279
|
-
modules?: Record<string, any> | undefined;
|
|
280
|
-
importHook?: ExitModuleImportHook | undefined;
|
|
281
|
-
attenuations?: Record<string, any> | undefined;
|
|
282
|
-
Compartment?: typeof Compartment | undefined;
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
* Mapping of {@link Language Languages} to {@link ParserImplementation ParserImplementations}
|
|
286
|
-
*/
|
|
287
|
-
export type ParserForLanguage = Record<Language | string, ParserImplementation>;
|
|
288
|
-
/**
|
|
289
|
-
* Mapping of file extension to {@link Language Languages}.
|
|
290
|
-
*/
|
|
291
|
-
export type LanguageForExtension = Record<string, Language>;
|
|
292
|
-
/**
|
|
293
|
-
* Mapping of module specifier to {@link Language Languages}.
|
|
294
|
-
*/
|
|
295
|
-
export type LanguageForModuleSpecifier = Record<string, Language>;
|
|
296
|
-
/**
|
|
297
|
-
* Options for `loadLocation()`
|
|
298
|
-
*/
|
|
299
|
-
export type LoadLocationOptions = ArchiveOptions | SyncArchiveOptions;
|
|
300
|
-
export type ExtraLinkOptions = {
|
|
301
|
-
resolve?: ResolveHook | undefined;
|
|
302
|
-
makeImportHook: ImportHookMaker;
|
|
303
|
-
makeImportNowHook?: ImportNowHookMaker | undefined;
|
|
304
|
-
parserForLanguage?: ParserForLanguage | undefined;
|
|
305
|
-
languageForExtension?: LanguageForExtension | undefined;
|
|
306
|
-
moduleTransforms?: ModuleTransforms | undefined;
|
|
307
|
-
syncModuleTransforms?: SyncModuleTransforms | undefined;
|
|
308
|
-
archiveOnly?: boolean | undefined;
|
|
309
|
-
};
|
|
310
|
-
export type LinkResult = {
|
|
311
|
-
/**
|
|
312
|
-
* ,
|
|
313
|
-
*/
|
|
314
|
-
compartment: Compartment;
|
|
315
|
-
compartments: Record<string, Compartment>;
|
|
316
|
-
attenuatorsCompartment: Compartment;
|
|
317
|
-
pendingJobsPromise: Promise<void>;
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
* Options for `link()`
|
|
321
|
-
*/
|
|
322
|
-
export type LinkOptions = ExecuteOptions & ExtraLinkOptions;
|
|
323
|
-
export type ModuleTransforms = Record<string, ModuleTransform>;
|
|
324
|
-
export type SyncModuleTransforms = Record<string, SyncModuleTransform>;
|
|
325
|
-
export type ModuleTransform = (bytes: Uint8Array, specifier: string, location: string, packageLocation: string, params?: {
|
|
326
|
-
sourceMap?: string | undefined;
|
|
327
|
-
} | undefined) => Promise<{
|
|
328
|
-
bytes: Uint8Array;
|
|
329
|
-
parser: Language;
|
|
330
|
-
sourceMap?: string;
|
|
331
|
-
}>;
|
|
332
|
-
export type SyncModuleTransform = (bytes: Uint8Array, specifier: string, location: string, packageLocation: string, params?: {
|
|
333
|
-
sourceMap?: string | undefined;
|
|
334
|
-
} | undefined) => {
|
|
335
|
-
bytes: Uint8Array;
|
|
336
|
-
parser: Language;
|
|
337
|
-
sourceMap?: string;
|
|
338
|
-
};
|
|
339
|
-
export type Sources = Record<string, CompartmentSources>;
|
|
340
|
-
export type CompartmentSources = Record<string, ModuleSource>;
|
|
341
|
-
export type ModuleSource = {
|
|
342
|
-
/**
|
|
343
|
-
* - module loading error deferred to later stage
|
|
344
|
-
*/
|
|
345
|
-
deferredError?: string | undefined;
|
|
346
|
-
/**
|
|
347
|
-
* - package relative location
|
|
348
|
-
*/
|
|
349
|
-
location?: string | undefined;
|
|
350
|
-
/**
|
|
351
|
-
* - fully qualified location
|
|
352
|
-
*/
|
|
353
|
-
sourceLocation?: string | undefined;
|
|
354
|
-
bytes?: Uint8Array | undefined;
|
|
355
|
-
/**
|
|
356
|
-
* in base16, hex
|
|
357
|
-
*/
|
|
358
|
-
sha512?: string | undefined;
|
|
359
|
-
parser?: Language | undefined;
|
|
360
|
-
exit?: string | undefined;
|
|
361
|
-
record?: StaticModuleType | undefined;
|
|
362
|
-
};
|
|
363
|
-
export type Artifact = {
|
|
364
|
-
bytes: Uint8Array;
|
|
365
|
-
parser: Language;
|
|
366
|
-
};
|
|
367
|
-
export type CaptureSourceLocationHook = (compartmentName: string, moduleSpecifier: string, sourceLocation: string) => any;
|
|
368
|
-
export type ArchiveOptions = {
|
|
369
|
-
moduleTransforms?: ModuleTransforms | undefined;
|
|
370
|
-
syncModuleTransforms?: SyncModuleTransforms | undefined;
|
|
371
|
-
modules?: Record<string, any> | undefined;
|
|
372
|
-
dev?: boolean | undefined;
|
|
373
|
-
policy?: SomePolicy | undefined;
|
|
374
|
-
/**
|
|
375
|
-
* deprecated in favor of `conditions`
|
|
376
|
-
*/
|
|
377
|
-
tags?: Set<string> | undefined;
|
|
378
|
-
conditions?: Set<string> | undefined;
|
|
379
|
-
captureSourceLocation?: CaptureSourceLocationHook | undefined;
|
|
380
|
-
importHook?: ExitModuleImportHook | undefined;
|
|
381
|
-
searchSuffixes?: string[] | undefined;
|
|
382
|
-
commonDependencies?: Record<string, string> | undefined;
|
|
383
|
-
sourceMapHook?: SourceMapHook | undefined;
|
|
384
|
-
parserForLanguage?: Record<string, ParserImplementation> | undefined;
|
|
385
|
-
languageForExtension?: LanguageForExtension | undefined;
|
|
386
|
-
};
|
|
387
|
-
export type SyncArchiveOptions = {
|
|
388
|
-
syncModuleTransforms?: SyncModuleTransforms | undefined;
|
|
389
|
-
modules?: Record<string, any> | undefined;
|
|
390
|
-
dev?: boolean | undefined;
|
|
391
|
-
policy?: object;
|
|
392
|
-
tags?: Set<string> | undefined;
|
|
393
|
-
captureSourceLocation?: CaptureSourceLocationHook | undefined;
|
|
394
|
-
importHook?: ExitModuleImportHook | undefined;
|
|
395
|
-
searchSuffixes?: string[] | undefined;
|
|
396
|
-
commonDependencies?: Record<string, string> | undefined;
|
|
397
|
-
sourceMapHook?: SourceMapHook | undefined;
|
|
398
|
-
importNowHook?: ExitModuleImportNowHook | undefined;
|
|
399
|
-
parserForLanguage?: Record<string, ParserImplementation> | undefined;
|
|
400
|
-
languageForExtension?: LanguageForExtension | undefined;
|
|
401
|
-
};
|
|
402
|
-
export type PackageNamingKit = {
|
|
403
|
-
/**
|
|
404
|
-
* - true if location is the entry compartment
|
|
405
|
-
*/
|
|
406
|
-
isEntry?: boolean | undefined;
|
|
407
|
-
name: string;
|
|
408
|
-
path: Array<string>;
|
|
409
|
-
};
|
|
410
|
-
/**
|
|
411
|
-
* An object representing a full attenuation definition.
|
|
412
|
-
*/
|
|
413
|
-
export type FullAttenuationDefinition = {
|
|
414
|
-
/**
|
|
415
|
-
* - The type of attenuation.
|
|
416
|
-
*/
|
|
417
|
-
attenuate: string;
|
|
418
|
-
/**
|
|
419
|
-
* - The parameters for the attenuation.
|
|
420
|
-
*/
|
|
421
|
-
params: ImplicitAttenuationDefinition;
|
|
422
|
-
};
|
|
423
|
-
/**
|
|
424
|
-
* An array of any type representing an implicit attenuation definition.
|
|
425
|
-
*/
|
|
426
|
-
export type ImplicitAttenuationDefinition = [any, ...any[]];
|
|
427
|
-
/**
|
|
428
|
-
* A type representing an attenuation definition, which can be either a full or implicit definition.
|
|
429
|
-
*/
|
|
430
|
-
export type AttenuationDefinition = FullAttenuationDefinition | ImplicitAttenuationDefinition;
|
|
431
|
-
export type UnifiedAttenuationDefinition = {
|
|
432
|
-
displayName: string;
|
|
433
|
-
specifier: string | null;
|
|
434
|
-
params?: any[] | undefined;
|
|
435
|
-
};
|
|
436
|
-
export type Attenuator<GlobalParams extends [any, ...any[]] = [any, ...any[]], ModuleParams extends [any, ...any[]] = [any, ...any[]]> = {
|
|
437
|
-
attenuateGlobals?: GlobalAttenuatorFn<GlobalParams> | undefined;
|
|
438
|
-
attenuateModule?: ModuleAttenuatorFn<ModuleParams, SomeObject, SomeObject> | undefined;
|
|
439
|
-
};
|
|
440
|
-
export type GlobalAttenuatorFn<Params extends [any, ...any[]] = [any, ...any[]]> = (params: Params, originalObject: Record<PropertyKey, any>, globalThis: Record<PropertyKey, any>) => void;
|
|
441
|
-
export type ModuleAttenuatorFn<Params extends [any, ...any[]] = [any, ...any[]], T = SomeObject, U = T> = (params: Params, ns: T) => U;
|
|
442
|
-
export type DeferredAttenuatorsProvider = {
|
|
443
|
-
import: (attenuatorSpecifier: string | null) => Promise<Attenuator>;
|
|
444
|
-
};
|
|
445
|
-
/**
|
|
446
|
-
* A type representing a wildcard policy, which can be 'any'.
|
|
447
|
-
*/
|
|
448
|
-
export type WildcardPolicy = "any";
|
|
449
|
-
/**
|
|
450
|
-
* A type representing a property policy, which is a record of string keys and boolean values
|
|
451
|
-
*/
|
|
452
|
-
export type PropertyPolicy = Record<string, boolean>;
|
|
453
|
-
/**
|
|
454
|
-
* A type representing a policy item, which can be a {@link WildcardPolicy wildcard policy}, a property policy, `undefined`, or defined by an attenuator
|
|
455
|
-
*/
|
|
456
|
-
export type PolicyItem<T = void> = WildcardPolicy | PropertyPolicy | T;
|
|
457
|
-
/**
|
|
458
|
-
* An object representing a nested attenuation definition.
|
|
459
|
-
*/
|
|
460
|
-
export type NestedAttenuationDefinition = Record<string, AttenuationDefinition | boolean>;
|
|
461
|
-
/**
|
|
462
|
-
* An object representing a base package policy.
|
|
463
|
-
*/
|
|
464
|
-
export type PackagePolicy<PackagePolicyItem = void, GlobalsPolicyItem = void, BuiltinsPolicyItem = void, ExtraOptions = unknown> = {
|
|
465
|
-
/**
|
|
466
|
-
* - The default attenuator.
|
|
467
|
-
*/
|
|
468
|
-
defaultAttenuator?: string | undefined;
|
|
469
|
-
/**
|
|
470
|
-
* - The policy item for packages.
|
|
471
|
-
*/
|
|
472
|
-
packages?: PolicyItem<PackagePolicyItem> | undefined;
|
|
473
|
-
/**
|
|
474
|
-
* - The policy item or full attenuation definition for globals.
|
|
475
|
-
*/
|
|
476
|
-
globals?: AttenuationDefinition | PolicyItem<GlobalsPolicyItem> | undefined;
|
|
477
|
-
/**
|
|
478
|
-
* - The policy item or nested attenuation definition for builtins.
|
|
479
|
-
*/
|
|
480
|
-
builtins?: NestedAttenuationDefinition | PolicyItem<BuiltinsPolicyItem> | undefined;
|
|
481
|
-
/**
|
|
482
|
-
* - Whether to disable global freeze.
|
|
483
|
-
*/
|
|
484
|
-
noGlobalFreeze?: boolean | undefined;
|
|
485
|
-
/**
|
|
486
|
-
* - Whether to allow dynamic imports
|
|
487
|
-
*/
|
|
488
|
-
dynamic?: boolean | undefined;
|
|
489
|
-
/**
|
|
490
|
-
* - Any additional user-defined options can be added to the policy here
|
|
491
|
-
*/
|
|
492
|
-
options?: ExtraOptions | undefined;
|
|
493
|
-
};
|
|
494
|
-
/**
|
|
495
|
-
* An object representing a base policy.
|
|
496
|
-
*/
|
|
497
|
-
export type Policy<PackagePolicyItem = void, GlobalsPolicyItem = void, BuiltinsPolicyItem = void, ExtraOptions = unknown> = {
|
|
498
|
-
/**
|
|
499
|
-
* - The package policies for the resources.
|
|
500
|
-
*/
|
|
501
|
-
resources: Record<string, PackagePolicy<PackagePolicyItem, GlobalsPolicyItem, BuiltinsPolicyItem, ExtraOptions>>;
|
|
502
|
-
/**
|
|
503
|
-
* - The default attenuator.
|
|
504
|
-
*/
|
|
505
|
-
defaultAttenuator?: string | undefined;
|
|
506
|
-
/**
|
|
507
|
-
* - The package policy for the entry.
|
|
508
|
-
*/
|
|
509
|
-
entry?: PackagePolicy<PackagePolicyItem, GlobalsPolicyItem, BuiltinsPolicyItem, ExtraOptions> | undefined;
|
|
510
|
-
};
|
|
511
|
-
/**
|
|
512
|
-
* Any object. All objects. Not `null`, though.
|
|
513
|
-
*/
|
|
514
|
-
export type SomeObject = Record<PropertyKey, any>;
|
|
515
|
-
/**
|
|
516
|
-
* Function in {@link CryptoInterface}
|
|
517
|
-
*/
|
|
518
|
-
export type CreateHashFn = (algorithm: "sha512") => Hash;
|
|
519
|
-
/**
|
|
520
|
-
* Object returned by function in {@link CryptoInterface}
|
|
521
|
-
*/
|
|
522
|
-
export type Hash = {
|
|
523
|
-
update: (data: Uint8Array | string) => Hash;
|
|
524
|
-
digest: () => Buffer;
|
|
525
|
-
};
|
|
526
|
-
/**
|
|
527
|
-
* Function in {@link FsPromisesInterface}
|
|
528
|
-
*/
|
|
529
|
-
export type RealpathFn = (filepath: string) => Promise<string>;
|
|
530
|
-
/**
|
|
531
|
-
* Object within {@link FsPromisesInterface}
|
|
532
|
-
*/
|
|
533
|
-
export type FsPromisesInterface = {
|
|
534
|
-
realpath: RealpathFn;
|
|
535
|
-
writeFile: WriteFn;
|
|
536
|
-
readFile: ReadFn;
|
|
537
|
-
};
|
|
538
|
-
/**
|
|
539
|
-
* For creating {@link ReadPowers}
|
|
540
|
-
*/
|
|
541
|
-
export type FsInterface = {
|
|
542
|
-
promises: FsPromisesInterface;
|
|
543
|
-
readFileSync: ReadNowFn;
|
|
544
|
-
};
|
|
545
|
-
/**
|
|
546
|
-
* For creating {@link ReadPowers}
|
|
547
|
-
*/
|
|
548
|
-
export type UrlInterface = {
|
|
549
|
-
fileURLToPath: FileURLToPathFn;
|
|
550
|
-
pathToFileURL: PathToFileURLFn;
|
|
551
|
-
};
|
|
552
|
-
/**
|
|
553
|
-
* For creating {@link ReadPowers}
|
|
554
|
-
*/
|
|
555
|
-
export type CryptoInterface = {
|
|
556
|
-
createHash: CreateHashFn;
|
|
557
|
-
};
|
|
558
|
-
export type PathInterface = {
|
|
559
|
-
isAbsolute: IsAbsoluteFn;
|
|
560
|
-
};
|
|
561
|
-
/**
|
|
562
|
-
* Options for `compartmentMapForNodeModules`
|
|
563
|
-
*/
|
|
564
|
-
export type CompartmentMapForNodeModulesOptions = Pick<ArchiveOptions, "dev" | "commonDependencies" | "policy">;
|
|
565
|
-
/**
|
|
566
|
-
* Any {@link PackagePolicy}
|
|
567
|
-
*/
|
|
568
|
-
export type SomePackagePolicy = PackagePolicy<PolicyItem, PolicyItem, PolicyItem, unknown>;
|
|
569
|
-
/**
|
|
570
|
-
* Any {@link Policy}
|
|
571
|
-
*/
|
|
572
|
-
export type SomePolicy = Policy<any, any, any, any>;
|
|
573
|
-
/**
|
|
574
|
-
* Matches any {@link https://developer.mozilla.org/en-US/docs/Glossary/Primitive primitive value}.
|
|
575
|
-
*/
|
|
576
|
-
export type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
577
|
-
/**
|
|
578
|
-
* Allows creating a union type by combining primitive types and literal
|
|
579
|
-
* types without sacrificing auto-completion in IDEs for the literal type part
|
|
580
|
-
* of the union.
|
|
581
|
-
*
|
|
582
|
-
* Currently, when a union type of a primitive type is combined with literal types,
|
|
583
|
-
* TypeScript loses all information about the combined literals. Thus, when such
|
|
584
|
-
* a type is used in an IDE with autocompletion, no suggestions are made for the
|
|
585
|
-
* declared literals.
|
|
586
|
-
*
|
|
587
|
-
* This type is a workaround for {@link https://github.com/Microsoft/TypeScript/issues/29729 Microsoft/TypeScript#29729}.
|
|
588
|
-
* It will be removed as soon as it's not needed anymore.
|
|
589
|
-
*/
|
|
590
|
-
export type LiteralUnion<LiteralType, PrimitiveType extends Primitive> = LiteralType | (PrimitiveType & Record<never, never>);
|
|
591
|
-
/**
|
|
592
|
-
* Options for `importLocation()`
|
|
593
|
-
*/
|
|
594
|
-
export type ImportLocationOptions = ExecuteOptions & ArchiveOptions;
|
|
595
|
-
/**
|
|
596
|
-
* Options for `importLocation()` necessary (but not sufficient--see
|
|
597
|
-
* {@link ReadNowPowers}) for dynamic require support
|
|
598
|
-
*/
|
|
599
|
-
export type SyncImportLocationOptions = ExecuteOptions & SyncArchiveOptions;
|
|
600
|
-
/**
|
|
601
|
-
* Options for `captureFromMap()`
|
|
602
|
-
*/
|
|
603
|
-
export type CaptureOptions = {
|
|
604
|
-
moduleTransforms?: ModuleTransforms | undefined;
|
|
605
|
-
syncModuleTransforms?: SyncModuleTransforms | undefined;
|
|
606
|
-
modules?: Record<string, any> | undefined;
|
|
607
|
-
dev?: boolean | undefined;
|
|
608
|
-
policy?: SomePolicy | undefined;
|
|
609
|
-
/**
|
|
610
|
-
* deprecated in favor of `conditions`
|
|
611
|
-
*/
|
|
612
|
-
tags?: Set<string> | undefined;
|
|
613
|
-
conditions?: Set<string> | undefined;
|
|
614
|
-
importHook?: ExitModuleImportHook | undefined;
|
|
615
|
-
searchSuffixes?: string[] | undefined;
|
|
616
|
-
commonDependencies?: Record<string, string> | undefined;
|
|
617
|
-
sourceMapHook?: SourceMapHook | undefined;
|
|
618
|
-
parserForLanguage?: Record<string, ParserImplementation> | undefined;
|
|
619
|
-
languageForExtension?: LanguageForExtension | undefined;
|
|
620
|
-
importNowHook?: ExitModuleImportNowHook | undefined;
|
|
621
|
-
};
|
|
622
|
-
/**
|
|
623
|
-
* The result of `captureFromMap()`
|
|
624
|
-
*/
|
|
625
|
-
export type CaptureResult = {
|
|
626
|
-
captureCompartmentMap: CompartmentMapDescriptor;
|
|
627
|
-
captureSources: Sources;
|
|
628
|
-
compartmentRenames: Record<string, string>;
|
|
629
|
-
};
|
|
630
|
-
/**
|
|
631
|
-
* Options object for `chooseModuleDescriptor`.
|
|
632
|
-
*/
|
|
633
|
-
export type ChooseModuleDescriptorOptions = {
|
|
634
|
-
/**
|
|
635
|
-
* List of `moduleSpecifier` with search
|
|
636
|
-
* suffixes appended
|
|
637
|
-
*/
|
|
638
|
-
candidates: string[];
|
|
639
|
-
/**
|
|
640
|
-
* Compartment
|
|
641
|
-
* descriptor
|
|
642
|
-
*/
|
|
643
|
-
compartmentDescriptor: CompartmentDescriptor;
|
|
644
|
-
/**
|
|
645
|
-
* All
|
|
646
|
-
* compartment descriptors
|
|
647
|
-
*/
|
|
648
|
-
compartmentDescriptors: Record<string, CompartmentDescriptor>;
|
|
649
|
-
/**
|
|
650
|
-
* All compartments
|
|
651
|
-
*/
|
|
652
|
-
compartments: Record<string, Compartment>;
|
|
653
|
-
/**
|
|
654
|
-
* Function to compute SHA-512 hash
|
|
655
|
-
*/
|
|
656
|
-
computeSha512?: HashFn | undefined;
|
|
657
|
-
/**
|
|
658
|
-
* All module
|
|
659
|
-
* descriptors
|
|
660
|
-
*/
|
|
661
|
-
moduleDescriptors: Record<string, ModuleDescriptor>;
|
|
662
|
-
/**
|
|
663
|
-
* Module specifier
|
|
664
|
-
*/
|
|
665
|
-
moduleSpecifier: string;
|
|
666
|
-
/**
|
|
667
|
-
* Package location
|
|
668
|
-
*/
|
|
669
|
-
packageLocation: string;
|
|
670
|
-
/**
|
|
671
|
-
* Sources
|
|
672
|
-
*/
|
|
673
|
-
packageSources: CompartmentSources;
|
|
674
|
-
/**
|
|
675
|
-
* Powers
|
|
676
|
-
*/
|
|
677
|
-
readPowers: ReadPowers | ReadFn;
|
|
678
|
-
/**
|
|
679
|
-
* Source map hook
|
|
680
|
-
*/
|
|
681
|
-
sourceMapHook?: SourceMapHook | undefined;
|
|
682
|
-
/**
|
|
683
|
-
* Function
|
|
684
|
-
* returning a set of module names (scoped to the compartment) whose parser is not using
|
|
685
|
-
* heuristics to determine imports.
|
|
686
|
-
*/
|
|
687
|
-
strictlyRequiredForCompartment: (compartmentName: string) => Set<string>;
|
|
688
|
-
};
|
|
689
|
-
/**
|
|
690
|
-
* Operators for `chooseModuleDescriptor` representing synchronous operation.
|
|
691
|
-
*/
|
|
692
|
-
export type SyncChooseModuleDescriptorOperators = {
|
|
693
|
-
/**
|
|
694
|
-
* A function that reads a file, returning
|
|
695
|
-
* its binary contents _or_ `undefined` if the file is not found
|
|
696
|
-
*/
|
|
697
|
-
maybeRead: MaybeReadNowFn;
|
|
698
|
-
/**
|
|
699
|
-
* A function which parses the (defined) binary
|
|
700
|
-
* contents from `maybeRead` into a `ParseResult`
|
|
701
|
-
*/
|
|
702
|
-
parse: ParseFn;
|
|
703
|
-
/**
|
|
704
|
-
* Should be omitted.
|
|
705
|
-
*/
|
|
706
|
-
shouldDeferError?: undefined;
|
|
707
|
-
};
|
|
708
|
-
/**
|
|
709
|
-
* Operators for `chooseModuleDescriptor` representing asynchronous operation.
|
|
710
|
-
*/
|
|
711
|
-
export type AsyncChooseModuleDescriptorOperators = {
|
|
712
|
-
/**
|
|
713
|
-
* A function that reads a file, resolving w/
|
|
714
|
-
* its binary contents _or_ `undefined` if the file is not found
|
|
715
|
-
*/
|
|
716
|
-
maybeRead: MaybeReadFn;
|
|
717
|
-
/**
|
|
718
|
-
* A function which parses the (defined)
|
|
719
|
-
* binary contents from `maybeRead` into a `ParseResult`
|
|
720
|
-
*/
|
|
721
|
-
parse: ParseFnAsync | ParseFn;
|
|
722
|
-
/**
|
|
723
|
-
* A function that
|
|
724
|
-
* returns `true` if the language returned by `parse` should defer errors.
|
|
725
|
-
*/
|
|
726
|
-
shouldDeferError: (language: Language) => boolean;
|
|
727
|
-
};
|
|
728
|
-
/**
|
|
729
|
-
* Either synchronous or asynchronous operators for `chooseModuleDescriptor`.
|
|
730
|
-
*/
|
|
731
|
-
export type ChooseModuleDescriptorOperators = AsyncChooseModuleDescriptorOperators | SyncChooseModuleDescriptorOperators;
|
|
732
|
-
/**
|
|
733
|
-
* The agglomeration of things that the `chooseModuleDescriptor` generator can
|
|
734
|
-
* yield.
|
|
735
|
-
*
|
|
736
|
-
* The generator does not necessarily yield _all_ of these; it depends on
|
|
737
|
-
* whether the operators are {@link AsyncChooseModuleDescriptorOperators} or
|
|
738
|
-
* {@link SyncChooseModuleDescriptorOperators}.
|
|
739
|
-
*/
|
|
740
|
-
export type ChooseModuleDescriptorYieldables = ReturnType<ChooseModuleDescriptorOperators["maybeRead"]> | ReturnType<ChooseModuleDescriptorOperators["parse"]>;
|
|
741
|
-
/**
|
|
742
|
-
* Parameters for `findRedirect()`.
|
|
743
|
-
*/
|
|
744
|
-
export type FindRedirectParams = {
|
|
745
|
-
compartmentDescriptor: CompartmentDescriptor;
|
|
746
|
-
compartmentDescriptors: Record<string, CompartmentDescriptor>;
|
|
747
|
-
compartments: Record<string, Compartment>;
|
|
748
|
-
/**
|
|
749
|
-
* A module specifier which is an absolute path. NOT a file:// URL.
|
|
750
|
-
*/
|
|
751
|
-
absoluteModuleSpecifier: string;
|
|
752
|
-
/**
|
|
753
|
-
* Location of the compartment descriptor's package
|
|
754
|
-
*/
|
|
755
|
-
packageLocation: string;
|
|
756
|
-
};
|
|
757
|
-
/**
|
|
758
|
-
* Options for `makeMapParsers()`
|
|
759
|
-
*/
|
|
760
|
-
export type MakeMapParsersOptions = {
|
|
761
|
-
/**
|
|
762
|
-
* Mapping of language to
|
|
763
|
-
* {@link ParserImplementation}
|
|
764
|
-
*/
|
|
765
|
-
parserForLanguage: ParserForLanguage;
|
|
766
|
-
/**
|
|
767
|
-
* Async or sync module
|
|
768
|
-
* transforms. If non-empty, dynamic requires are unsupported.
|
|
769
|
-
*/
|
|
770
|
-
moduleTransforms?: ModuleTransforms | undefined;
|
|
771
|
-
/**
|
|
772
|
-
* Sync module
|
|
773
|
-
* transforms
|
|
774
|
-
*/
|
|
775
|
-
syncModuleTransforms?: SyncModuleTransforms | undefined;
|
|
776
|
-
};
|
|
777
|
-
/**
|
|
778
|
-
* The value returned by `makeMapParsers()`
|
|
779
|
-
*/
|
|
780
|
-
export type MapParsersFn<T extends ParseFn | ParseFnAsync = ParseFn | ParseFnAsync> = (languageForExtension: LanguageForExtension, languageForModuleSpecifier: LanguageForModuleSpecifier) => T;
|
|
781
|
-
import type { ImportHook } from 'ses';
|
|
782
|
-
import type { ImportNowHook } from 'ses';
|
|
783
|
-
import type { FinalStaticModuleType } from 'ses';
|
|
784
|
-
import type { ThirdPartyStaticModuleInterface } from 'ses';
|
|
785
|
-
import type { Transform } from 'ses';
|
|
786
|
-
import type { StaticModuleType } from 'ses';
|
|
787
|
-
//# sourceMappingURL=types.d.ts.map
|
|
1
|
+
// ESlint does not understand export *
|
|
2
|
+
/* eslint-disable import/export */
|
|
3
|
+
|
|
4
|
+
// These type definitions include all of the external and internal types used
|
|
5
|
+
// within the compartment mapper.
|
|
6
|
+
|
|
7
|
+
export type * from './types-external.js';
|
|
8
|
+
export type * from './types/internal.js';
|
|
9
|
+
export type * from './types/typescript.js';
|