@endo/compartment-mapper 1.5.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.
Files changed (71) hide show
  1. package/README.md +278 -111
  2. package/bundle.d.ts +1 -1
  3. package/bundle.js +4 -1
  4. package/functor-lite.d.ts +3 -0
  5. package/functor-lite.d.ts.map +1 -0
  6. package/functor-lite.js +4 -0
  7. package/functor.d.ts +3 -0
  8. package/functor.d.ts.map +1 -0
  9. package/functor.js +4 -0
  10. package/index.d.ts +1 -1
  11. package/index.js +4 -1
  12. package/package.json +8 -4
  13. package/script-lite.d.ts +3 -0
  14. package/script-lite.d.ts.map +1 -0
  15. package/script-lite.js +4 -0
  16. package/script.d.ts +3 -0
  17. package/script.d.ts.map +1 -0
  18. package/script.js +4 -0
  19. package/src/archive-lite.js +1 -1
  20. package/src/bundle-cjs.d.ts +1 -1
  21. package/src/bundle-cjs.d.ts.map +1 -1
  22. package/src/bundle-cjs.js +57 -28
  23. package/src/bundle-json.d.ts.map +1 -1
  24. package/src/bundle-json.js +2 -3
  25. package/src/bundle-lite.d.ts +91 -0
  26. package/src/bundle-lite.d.ts.map +1 -0
  27. package/src/bundle-lite.js +668 -0
  28. package/src/bundle-mjs.d.ts +2 -2
  29. package/src/bundle-mjs.d.ts.map +1 -1
  30. package/src/bundle-mjs.js +36 -19
  31. package/src/bundle.d.ts +48 -10
  32. package/src/bundle.d.ts.map +1 -1
  33. package/src/bundle.js +391 -125
  34. package/src/capture-lite.js +1 -1
  35. package/src/import-hook.d.ts +3 -16
  36. package/src/import-hook.d.ts.map +1 -1
  37. package/src/import-hook.js +11 -18
  38. package/src/import-lite.d.ts.map +1 -1
  39. package/src/import-lite.js +4 -2
  40. package/src/node-modules.d.ts +4 -47
  41. package/src/node-modules.d.ts.map +1 -1
  42. package/src/node-modules.js +121 -121
  43. package/src/parse-archive-cjs.d.ts.map +1 -1
  44. package/src/parse-archive-cjs.js +8 -3
  45. package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
  46. package/src/parse-cjs-shared-export-wrapper.js +2 -10
  47. package/src/parse-cjs.js +1 -1
  48. package/src/parse-mjs.js +2 -2
  49. package/src/policy.d.ts.map +1 -1
  50. package/src/policy.js +4 -7
  51. package/src/search.d.ts +6 -12
  52. package/src/search.d.ts.map +1 -1
  53. package/src/search.js +29 -12
  54. package/src/types/compartment-map-schema.d.ts +5 -0
  55. package/src/types/compartment-map-schema.d.ts.map +1 -1
  56. package/src/types/compartment-map-schema.ts +5 -0
  57. package/src/types/external.d.ts +112 -8
  58. package/src/types/external.d.ts.map +1 -1
  59. package/src/types/external.ts +127 -8
  60. package/src/types/internal.d.ts +85 -13
  61. package/src/types/internal.d.ts.map +1 -1
  62. package/src/types/internal.ts +106 -13
  63. package/src/types/node-modules.d.ts +79 -0
  64. package/src/types/node-modules.d.ts.map +1 -0
  65. package/src/types/node-modules.ts +89 -0
  66. package/src/types/node-powers.d.ts +4 -4
  67. package/src/types/node-powers.d.ts.map +1 -1
  68. package/src/types/node-powers.ts +4 -4
  69. package/src/types/powers.d.ts +2 -2
  70. package/src/types/powers.d.ts.map +1 -1
  71. package/src/types/powers.ts +2 -2
@@ -4,9 +4,9 @@
4
4
  */
5
5
  import type { ImportHook, ImportNowHook } from 'ses';
6
6
  import type { CompartmentDescriptor, Language, LanguageForExtension, LanguageForModuleSpecifier, ModuleDescriptor } from './compartment-map-schema.js';
7
- import type { HashFn, MaybeReadFn, MaybeReadNowFn, ReadFn, ReadPowers } from './powers.js';
7
+ import type { MaybeReadFn, MaybeReadNowFn, ReadFn, ReadPowers } from './powers.js';
8
8
  import type { DeferredAttenuatorsProvider } from './policy.js';
9
- import type { AsyncParseFn, CompartmentSources, ExecuteOptions, ExitModuleImportNowHook, ModuleTransforms, ParseFn, ParserForLanguage, SearchSuffixesOption, SourceMapHook, SourceMapHookOption, Sources, SyncModuleTransforms } from './external.js';
9
+ import type { ArchiveOnlyOption, AsyncParseFn, CompartmentSources, ComputeSha512Option, ExecuteOptions, ExitModuleImportHookOption, ExitModuleImportNowHookOption, LogOptions, ModuleTransforms, ParseFn, ParserForLanguage, SearchSuffixesOption, SourceMapHook, SourceMapHookOption, Sources, SyncModuleTransforms } from './external.js';
10
10
  export type LinkOptions = {
11
11
  resolve?: ResolveHook;
12
12
  makeImportHook: ImportHookMaker;
@@ -14,9 +14,8 @@ export type LinkOptions = {
14
14
  parserForLanguage?: ParserForLanguage;
15
15
  moduleTransforms?: ModuleTransforms;
16
16
  syncModuleTransforms?: SyncModuleTransforms;
17
- archiveOnly?: boolean;
18
17
  __native__?: boolean;
19
- } & ExecuteOptions;
18
+ } & ArchiveOnlyOption & ExecuteOptions;
20
19
  export type LinkResult = {
21
20
  compartment: Compartment;
22
21
  compartments: Record<string, Compartment>;
@@ -25,12 +24,20 @@ export type LinkResult = {
25
24
  };
26
25
  export type ResolveHook = (importSpecifier: string, referrerSpecifier: string) => string;
27
26
  export type ShouldDeferError = (language: Language | undefined) => boolean;
28
- export type MakeImportNowHookMakerOptions = Partial<{
29
- sources: Sources;
30
- compartmentDescriptors: Record<string, CompartmentDescriptor>;
31
- computeSha512: HashFn;
32
- exitModuleImportNowHook: ExitModuleImportNowHook;
33
- }> & SearchSuffixesOption & SourceMapHookOption;
27
+ export type MakeImportHookMakersOptions = {
28
+ entryCompartmentName: string;
29
+ entryModuleSpecifier: string;
30
+ /**
31
+ * For depositing captured sources.
32
+ */
33
+ sources?: Sources;
34
+ /**
35
+ * For depositing captured compartment descriptors.
36
+ */
37
+ compartmentDescriptors?: Record<string, CompartmentDescriptor>;
38
+ } & ComputeSha512Option & SearchSuffixesOption & ArchiveOnlyOption & SourceMapHookOption;
39
+ export type MakeImportHookMakerOptions = MakeImportHookMakersOptions & ExitModuleImportHookOption;
40
+ export type MakeImportNowHookMakerOptions = MakeImportHookMakersOptions & ExitModuleImportNowHookOption;
34
41
  export type ImportHookMaker = (params: {
35
42
  packageLocation: string;
36
43
  packageName: string;
@@ -72,16 +79,18 @@ export type ChooseModuleDescriptorParams = {
72
79
  /** All compartments */
73
80
  compartments: Record<string, Compartment>;
74
81
  packageSources: CompartmentSources;
75
- /** Function to compute SHA-512 hash */
76
- computeSha512?: HashFn;
77
82
  readPowers: ReadPowers | ReadFn;
83
+ /**
84
+ * Whether to embed a sourceURL in applicable compiled sources.
85
+ * Should be false for archives and bundles, but true for runtime.
86
+ */
78
87
  sourceMapHook?: SourceMapHook;
79
88
  /**
80
89
  * Function returning a set of module names (scoped to the compartment) whose
81
90
  * parser is not using heuristics to determine imports.
82
91
  */
83
92
  strictlyRequiredForCompartment: (compartmentName: string) => Set<string>;
84
- };
93
+ } & ComputeSha512Option & ArchiveOnlyOption;
85
94
  type SyncChooseModuleDescriptorOperators = {
86
95
  /**
87
96
  * A function that reads a file, returning its binary contents _or_
@@ -158,5 +167,68 @@ export type MakeMapParsersOptions = {
158
167
  */
159
168
  syncModuleTransforms?: SyncModuleTransforms;
160
169
  };
170
+ /**
171
+ * Options for `search()`
172
+ */
173
+ export type SearchOptions = LogOptions;
174
+ /**
175
+ * Object fulfilled from `search()`
176
+ */
177
+ export interface SearchResult {
178
+ packageLocation: string;
179
+ packageDescriptorLocation: string;
180
+ packageDescriptorText: string;
181
+ moduleSpecifier: string;
182
+ }
183
+ /**
184
+ * Object fulfilled from `searchDescriptor()`
185
+ *
186
+ * @template T The datatype; may be a {@link PackageDescriptor}, blob, string, etc.
187
+ */
188
+ export interface SearchDescriptorResult<T> {
189
+ data: T;
190
+ directory: string;
191
+ location: string;
192
+ packageDescriptorLocation: string;
193
+ }
194
+ /**
195
+ * Options for `searchDescriptor()`
196
+ */
197
+ export type SearchDescriptorOptions = LogOptions;
198
+ /**
199
+ * A power to read a package descriptor
200
+ * @template T Format of package descriptor
201
+ */
202
+ export type ReadDescriptorFn<T = PackageDescriptor> = (location: string) => Promise<T>;
203
+ /**
204
+ * A power to _maybe_ read a package descriptor
205
+ * @template T Format of package descriptor
206
+ */
207
+ export type MaybeReadDescriptorFn<T = PackageDescriptor> = (location: string) => Promise<T | undefined>;
208
+ /**
209
+ * The type of a `package.json` file containing relevant fields; used by `graphPackages` and its ilk
210
+ */
211
+ export interface PackageDescriptor {
212
+ /**
213
+ * TODO: In reality, this is optional, but `graphPackage` does not consider it to be. This will need to be fixed once support for "anonymous" packages lands; see https://github.com/endojs/endo/pull/2664
214
+ */
215
+ name: string;
216
+ version?: string;
217
+ /**
218
+ * TODO: Update with proper type when this field is handled.
219
+ */
220
+ exports?: unknown;
221
+ type?: 'module' | 'commonjs';
222
+ dependencies?: Record<string, string>;
223
+ devDependencies?: Record<string, string>;
224
+ peerDependencies?: Record<string, string>;
225
+ optionalDependencies?: Record<string, string>;
226
+ bundleDependencies?: string[];
227
+ peerDependenciesMeta?: Record<string, {
228
+ optional?: boolean;
229
+ [k: string]: unknown;
230
+ }>;
231
+ [k: string]: unknown;
232
+ }
161
233
  export {};
162
234
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["internal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACR,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACV,MAAM,EACN,WAAW,EACX,cAAc,EACd,MAAM,EACN,UAAU,EACX,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,OAAO,EACP,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,OAAO,EACP,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAEvB,MA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,GAAG,UAAU,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,iBAAiB,IAAI,CACpD,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,iBAAiB,IAAI,CACzD,QAAQ,EAAE,MAAM,KACb,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAC3B,MAAM,EACN;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAC7C,CAAC;IAEF,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB"}
@@ -14,7 +14,6 @@ import type {
14
14
  ModuleDescriptor,
15
15
  } from './compartment-map-schema.js';
16
16
  import type {
17
- HashFn,
18
17
  MaybeReadFn,
19
18
  MaybeReadNowFn,
20
19
  ReadFn,
@@ -22,10 +21,14 @@ import type {
22
21
  } from './powers.js';
23
22
  import type { DeferredAttenuatorsProvider } from './policy.js';
24
23
  import type {
24
+ ArchiveOnlyOption,
25
25
  AsyncParseFn,
26
26
  CompartmentSources,
27
+ ComputeSha512Option,
27
28
  ExecuteOptions,
28
- ExitModuleImportNowHook,
29
+ ExitModuleImportHookOption,
30
+ ExitModuleImportNowHookOption,
31
+ LogOptions,
29
32
  ModuleTransforms,
30
33
  ParseFn,
31
34
  ParserForLanguage,
@@ -43,9 +46,9 @@ export type LinkOptions = {
43
46
  parserForLanguage?: ParserForLanguage;
44
47
  moduleTransforms?: ModuleTransforms;
45
48
  syncModuleTransforms?: SyncModuleTransforms;
46
- archiveOnly?: boolean;
47
49
  __native__?: boolean;
48
- } & ExecuteOptions;
50
+ } & ArchiveOnlyOption &
51
+ ExecuteOptions;
49
52
 
50
53
  export type LinkResult = {
51
54
  compartment: Compartment;
@@ -61,15 +64,27 @@ export type ResolveHook = (
61
64
 
62
65
  export type ShouldDeferError = (language: Language | undefined) => boolean;
63
66
 
64
- export type MakeImportNowHookMakerOptions = Partial<{
65
- sources: Sources;
66
- compartmentDescriptors: Record<string, CompartmentDescriptor>;
67
- computeSha512: HashFn;
68
- exitModuleImportNowHook: ExitModuleImportNowHook;
69
- }> &
67
+ export type MakeImportHookMakersOptions = {
68
+ entryCompartmentName: string;
69
+ entryModuleSpecifier: string;
70
+ /**
71
+ * For depositing captured sources.
72
+ */
73
+ sources?: Sources;
74
+ /**
75
+ * For depositing captured compartment descriptors.
76
+ */
77
+ compartmentDescriptors?: Record<string, CompartmentDescriptor>;
78
+ } & ComputeSha512Option &
70
79
  SearchSuffixesOption &
80
+ ArchiveOnlyOption &
71
81
  SourceMapHookOption;
72
82
 
83
+ export type MakeImportHookMakerOptions = MakeImportHookMakersOptions &
84
+ ExitModuleImportHookOption;
85
+ export type MakeImportNowHookMakerOptions = MakeImportHookMakersOptions &
86
+ ExitModuleImportNowHookOption;
87
+
73
88
  export type ImportHookMaker = (params: {
74
89
  packageLocation: string;
75
90
  packageName: string;
@@ -118,16 +133,19 @@ export type ChooseModuleDescriptorParams = {
118
133
  /** All compartments */
119
134
  compartments: Record<string, Compartment>;
120
135
  packageSources: CompartmentSources;
121
- /** Function to compute SHA-512 hash */
122
- computeSha512?: HashFn;
123
136
  readPowers: ReadPowers | ReadFn;
137
+ /**
138
+ * Whether to embed a sourceURL in applicable compiled sources.
139
+ * Should be false for archives and bundles, but true for runtime.
140
+ */
124
141
  sourceMapHook?: SourceMapHook;
125
142
  /**
126
143
  * Function returning a set of module names (scoped to the compartment) whose
127
144
  * parser is not using heuristics to determine imports.
128
145
  */
129
146
  strictlyRequiredForCompartment: (compartmentName: string) => Set<string>;
130
- };
147
+ } & ComputeSha512Option &
148
+ ArchiveOnlyOption;
131
149
 
132
150
  type SyncChooseModuleDescriptorOperators = {
133
151
  /**
@@ -215,3 +233,78 @@ export type MakeMapParsersOptions = {
215
233
  */
216
234
  syncModuleTransforms?: SyncModuleTransforms;
217
235
  };
236
+
237
+ /**
238
+ * Options for `search()`
239
+ */
240
+ export type SearchOptions = LogOptions;
241
+
242
+ /**
243
+ * Object fulfilled from `search()`
244
+ */
245
+ export interface SearchResult {
246
+ packageLocation: string;
247
+ packageDescriptorLocation: string;
248
+ packageDescriptorText: string;
249
+ moduleSpecifier: string;
250
+ }
251
+
252
+ /**
253
+ * Object fulfilled from `searchDescriptor()`
254
+ *
255
+ * @template T The datatype; may be a {@link PackageDescriptor}, blob, string, etc.
256
+ */
257
+ export interface SearchDescriptorResult<T> {
258
+ data: T;
259
+ directory: string;
260
+ location: string;
261
+ packageDescriptorLocation: string;
262
+ }
263
+
264
+ /**
265
+ * Options for `searchDescriptor()`
266
+ */
267
+ export type SearchDescriptorOptions = LogOptions;
268
+
269
+ /**
270
+ * A power to read a package descriptor
271
+ * @template T Format of package descriptor
272
+ */
273
+ export type ReadDescriptorFn<T = PackageDescriptor> = (
274
+ location: string,
275
+ ) => Promise<T>;
276
+
277
+ /**
278
+ * A power to _maybe_ read a package descriptor
279
+ * @template T Format of package descriptor
280
+ */
281
+ export type MaybeReadDescriptorFn<T = PackageDescriptor> = (
282
+ location: string,
283
+ ) => Promise<T | undefined>;
284
+
285
+ /**
286
+ * The type of a `package.json` file containing relevant fields; used by `graphPackages` and its ilk
287
+ */
288
+ export interface PackageDescriptor {
289
+ /**
290
+ * TODO: In reality, this is optional, but `graphPackage` does not consider it to be. This will need to be fixed once support for "anonymous" packages lands; see https://github.com/endojs/endo/pull/2664
291
+ */
292
+ name: string;
293
+ version?: string;
294
+ /**
295
+ * TODO: Update with proper type when this field is handled.
296
+ */
297
+ exports?: unknown;
298
+ type?: 'module' | 'commonjs';
299
+ dependencies?: Record<string, string>;
300
+ devDependencies?: Record<string, string>;
301
+ peerDependencies?: Record<string, string>;
302
+ optionalDependencies?: Record<string, string>;
303
+ bundleDependencies?: string[];
304
+ peerDependenciesMeta?: Record<
305
+ string,
306
+ { optional?: boolean; [k: string]: unknown }
307
+ >;
308
+
309
+ [k: string]: unknown;
310
+ }
@@ -0,0 +1,79 @@
1
+ import type { Language, LanguageForExtension } from './compartment-map-schema.js';
2
+ import type { LogOptions } from './external.js';
3
+ import type { PackageDescriptor } from './internal.js';
4
+ export type CommonDependencyDescriptors = Record<string, {
5
+ spec: string;
6
+ alias: string;
7
+ }>;
8
+ export type GraphPackageOptions = {
9
+ preferredPackageLogicalPathMap?: Map<string, string[]>;
10
+ logicalPath?: string[];
11
+ commonDependencyDescriptors?: CommonDependencyDescriptors;
12
+ } & LogOptions;
13
+ export type GraphPackagesOptions = LogOptions;
14
+ export type GatherDependencyOptions = {
15
+ childLogicalPath?: string[];
16
+ /**
17
+ * If `true` the dependency is optional
18
+ */
19
+ optional?: boolean;
20
+ /**
21
+ * Dependencies added to _all_ packages
22
+ */
23
+ commonDependencyDescriptors?: CommonDependencyDescriptors;
24
+ } & LogOptions;
25
+ export interface Node {
26
+ /**
27
+ * Informative compartment label based on the package name and version (if available)
28
+ */
29
+ label: string;
30
+ /**
31
+ * Package name
32
+ */
33
+ name: string;
34
+ path: Array<string>;
35
+ logicalPath: Array<string>;
36
+ /**
37
+ * `true` if the package's {@link PackageDescriptor} has an `exports` field
38
+ */
39
+ explicitExports: boolean;
40
+ internalAliases: Record<string, string>;
41
+ externalAliases: Record<string, string>;
42
+ /**
43
+ * The name of the original package's parent directory, for reconstructing
44
+ * a sourceURL that is likely to converge with the original location in an IDE.
45
+ */
46
+ sourceDirname: string;
47
+ /**
48
+ * An object whose keys are the thing being imported, and the values are the
49
+ * names of the matching module (relative to the containing package's root;
50
+ * i.e. the URL that was used as the key of graph).
51
+ *
52
+ * The values are the keys of other {@link Node Nodes} in the {@link Graph}.
53
+ */
54
+ dependencyLocations: Record<string, string>;
55
+ parsers: LanguageForExtension;
56
+ types: Record<string, Language>;
57
+ }
58
+ /**
59
+ * The graph is an intermediate object model that the functions of this module
60
+ * build by exploring the `node_modules` tree dropped by tools like npm and
61
+ * consumed by tools like Node.js.
62
+ * This gets translated finally into a compartment map.
63
+ */
64
+ export type Graph = Record<string, Node>;
65
+ export interface LanguageOptions {
66
+ commonjsLanguageForExtension: LanguageForExtension;
67
+ moduleLanguageForExtension: LanguageForExtension;
68
+ workspaceCommonjsLanguageForExtension: LanguageForExtension;
69
+ workspaceModuleLanguageForExtension: LanguageForExtension;
70
+ languages: Set<string>;
71
+ }
72
+ /**
73
+ * Object result of `findPackage()`
74
+ */
75
+ export interface PackageDetails {
76
+ packageLocation: string;
77
+ packageDescriptor: PackageDescriptor;
78
+ }
79
+ //# sourceMappingURL=node-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-modules.d.ts","sourceRoot":"","sources":["node-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,MA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C,MAAM,EAAE,IAAI,CAAC,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B,4BAA4B,EAAE,oBAAoB,CAAC;IACnD,0BAA0B,EAAE,oBAAoB,CAAC;IACjD,qCAAqC,EAAE,oBAAoB,CAAC;IAC5D,mCAAmC,EAAE,oBAAoB,CAAC;IAC1D,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC"}
@@ -0,0 +1,89 @@
1
+ import type {
2
+ Language,
3
+ LanguageForExtension,
4
+ } from './compartment-map-schema.js';
5
+ import type { LogOptions } from './external.js';
6
+ import type { PackageDescriptor } from './internal.js';
7
+
8
+ export type CommonDependencyDescriptors = Record<
9
+ string,
10
+ { spec: string; alias: string }
11
+ >;
12
+
13
+ export type GraphPackageOptions = {
14
+ preferredPackageLogicalPathMap?: Map<string, string[]>;
15
+ logicalPath?: string[];
16
+ commonDependencyDescriptors?: CommonDependencyDescriptors;
17
+ } & LogOptions;
18
+
19
+ export type GraphPackagesOptions = LogOptions;
20
+
21
+ export type GatherDependencyOptions = {
22
+ childLogicalPath?: string[];
23
+ /**
24
+ * If `true` the dependency is optional
25
+ */
26
+ optional?: boolean;
27
+ /**
28
+ * Dependencies added to _all_ packages
29
+ */
30
+ commonDependencyDescriptors?: CommonDependencyDescriptors;
31
+ } & LogOptions;
32
+
33
+ export interface Node {
34
+ /**
35
+ * Informative compartment label based on the package name and version (if available)
36
+ */
37
+ label: string;
38
+ /**
39
+ * Package name
40
+ */
41
+ name: string;
42
+ path: Array<string>;
43
+ logicalPath: Array<string>;
44
+ /**
45
+ * `true` if the package's {@link PackageDescriptor} has an `exports` field
46
+ */
47
+ explicitExports: boolean;
48
+ internalAliases: Record<string, string>;
49
+ externalAliases: Record<string, string>;
50
+ /**
51
+ * The name of the original package's parent directory, for reconstructing
52
+ * a sourceURL that is likely to converge with the original location in an IDE.
53
+ */
54
+ sourceDirname: string;
55
+ /**
56
+ * An object whose keys are the thing being imported, and the values are the
57
+ * names of the matching module (relative to the containing package's root;
58
+ * i.e. the URL that was used as the key of graph).
59
+ *
60
+ * The values are the keys of other {@link Node Nodes} in the {@link Graph}.
61
+ */
62
+ dependencyLocations: Record<string, string>;
63
+ parsers: LanguageForExtension;
64
+ types: Record<string, Language>;
65
+ }
66
+
67
+ /**
68
+ * The graph is an intermediate object model that the functions of this module
69
+ * build by exploring the `node_modules` tree dropped by tools like npm and
70
+ * consumed by tools like Node.js.
71
+ * This gets translated finally into a compartment map.
72
+ */
73
+ export type Graph = Record<string, Node>;
74
+
75
+ export interface LanguageOptions {
76
+ commonjsLanguageForExtension: LanguageForExtension;
77
+ moduleLanguageForExtension: LanguageForExtension;
78
+ workspaceCommonjsLanguageForExtension: LanguageForExtension;
79
+ workspaceModuleLanguageForExtension: LanguageForExtension;
80
+ languages: Set<string>;
81
+ }
82
+
83
+ /**
84
+ * Object result of `findPackage()`
85
+ */
86
+ export interface PackageDetails {
87
+ packageLocation: string;
88
+ packageDescriptor: PackageDescriptor;
89
+ }
@@ -15,10 +15,10 @@ export type FsInterface = {
15
15
  * The portion of the "node:url" module needed to normalize paths to fully
16
16
  * qualified file URLs, as used by the compartment mapper internally.
17
17
  */
18
- export type UrlInterface = {
19
- fileURLToPath: (location: string | URL) => string;
20
- pathToFileURL: (location: string) => URL;
21
- };
18
+ export interface UrlInterface {
19
+ fileURLToPath: typeof import('node:url').fileURLToPath;
20
+ pathToFileURL: typeof import('node:url').pathToFileURL;
21
+ }
22
22
  /**
23
23
  * The portion of the "node:path" module needed to support dynamic-require for
24
24
  * a module specifier that is an absolute path.
@@ -1 +1 @@
1
- {"version":3,"file":"node-powers.d.ts","sourceRoot":"","sources":["node-powers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,gCAAgC;AAChC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EA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,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAClE,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;KACrD,CAAC;IACF,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,UAAU,CAAC;CAChD,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,cAAc,UAAU,EAAE,aAAa,CAAC;IACvD,aAAa,EAAE,cAAc,UAAU,EAAE,aAAa,CAAC;CACxD;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAC3C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,KAAK,IAAI,GAAG;IACV,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,KAAK,IAAI,CAAC;IAC5C,MAAM,EAAE,MAAM;QAEZ,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;KACpC,CAAC;CACH,CAAC"}
@@ -19,10 +19,10 @@ export type FsInterface = {
19
19
  * The portion of the "node:url" module needed to normalize paths to fully
20
20
  * qualified file URLs, as used by the compartment mapper internally.
21
21
  */
22
- export type UrlInterface = {
23
- fileURLToPath: (location: string | URL) => string;
24
- pathToFileURL: (location: string) => URL;
25
- };
22
+ export interface UrlInterface {
23
+ fileURLToPath: typeof import('node:url').fileURLToPath;
24
+ pathToFileURL: typeof import('node:url').pathToFileURL;
25
+ }
26
26
 
27
27
  /**
28
28
  * The portion of the "node:path" module needed to support dynamic-require for
@@ -52,8 +52,8 @@ export type ReadNowFn = (location: string) => Uint8Array;
52
52
  */
53
53
  export type MaybeReadNowFn = (location: string) => Uint8Array | undefined;
54
54
  export type HashFn = (bytes: Uint8Array) => string;
55
- export type FileURLToPathFn = (location: string | URL) => string;
56
- export type PathToFileURLFn = (location: string) => URL;
55
+ export type FileURLToPathFn = typeof import('node:url').fileURLToPath;
56
+ export type PathToFileURLFn = typeof import('node:url').pathToFileURL;
57
57
  export type RequireResolveFn = (fromLocation: string, specifier: string, options?: {
58
58
  paths?: string[];
59
59
  } | undefined) => any;
@@ -1 +1 @@
1
- {"version":3,"file":"powers.d.ts","sourceRoot":"","sources":["powers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,WAAW,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAClC,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG;IACzC,SAAS,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,GAC7D,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,YAAY,GAAG,cAAc,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAA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AAM,CAAC;CACvB,CAAC;AAIF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE7E,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,UAAU,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;AAInD,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC"}
@@ -69,9 +69,9 @@ export type MaybeReadNowFn = (location: string) => Uint8Array | undefined;
69
69
 
70
70
  export type HashFn = (bytes: Uint8Array) => string;
71
71
 
72
- export type FileURLToPathFn = (location: string | URL) => string;
72
+ export type FileURLToPathFn = typeof import('node:url').fileURLToPath;
73
73
 
74
- export type PathToFileURLFn = (location: string) => URL;
74
+ export type PathToFileURLFn = typeof import('node:url').pathToFileURL;
75
75
 
76
76
  export type RequireResolveFn = (
77
77
  fromLocation: string,