@endo/compartment-mapper 1.6.0 → 1.6.1

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 (116) hide show
  1. package/LICENSE +1 -1
  2. package/SECURITY.md +2 -2
  3. package/package.json +11 -11
  4. package/src/archive-lite.d.ts +5 -5
  5. package/src/archive-lite.d.ts.map +1 -1
  6. package/src/archive.d.ts +5 -5
  7. package/src/archive.d.ts.map +1 -1
  8. package/src/archive.js +3 -1
  9. package/src/bundle-cjs.d.ts +12 -2
  10. package/src/bundle-cjs.d.ts.map +1 -1
  11. package/src/bundle-lite.d.ts +2 -2
  12. package/src/bundle-lite.d.ts.map +1 -1
  13. package/src/bundle-lite.js +0 -1
  14. package/src/bundle-mjs.d.ts +12 -2
  15. package/src/bundle-mjs.d.ts.map +1 -1
  16. package/src/bundle.d.ts +5 -5
  17. package/src/bundle.d.ts.map +1 -1
  18. package/src/bundle.js +1 -1
  19. package/src/capture-lite.d.ts +1 -1
  20. package/src/capture-lite.d.ts.map +1 -1
  21. package/src/capture-lite.js +3 -1
  22. package/src/compartment-map.d.ts +1 -1
  23. package/src/compartment-map.d.ts.map +1 -1
  24. package/src/import-archive-lite.d.ts +2 -2
  25. package/src/import-archive-lite.d.ts.map +1 -1
  26. package/src/import-archive-lite.js +3 -1
  27. package/src/import-archive.d.ts +3 -3
  28. package/src/import-archive.d.ts.map +1 -1
  29. package/src/import-archive.js +3 -1
  30. package/src/import-hook.d.ts.map +1 -1
  31. package/src/import-hook.js +204 -99
  32. package/src/import-lite.d.ts +1 -1
  33. package/src/import-lite.d.ts.map +1 -1
  34. package/src/import-lite.js +3 -1
  35. package/src/import.d.ts.map +1 -1
  36. package/src/import.js +3 -1
  37. package/src/infer-exports.d.ts +5 -7
  38. package/src/infer-exports.d.ts.map +1 -1
  39. package/src/infer-exports.js +23 -8
  40. package/src/link.d.ts.map +1 -1
  41. package/src/link.js +4 -1
  42. package/src/map-parser.d.ts.map +1 -1
  43. package/src/map-parser.js +51 -5
  44. package/src/node-module-specifier.d.ts.map +1 -1
  45. package/src/node-module-specifier.js +3 -1
  46. package/src/node-modules.d.ts +2 -2
  47. package/src/node-modules.d.ts.map +1 -1
  48. package/src/node-modules.js +150 -31
  49. package/src/node-powers.d.ts +1 -1
  50. package/src/node-powers.d.ts.map +1 -1
  51. package/src/node-powers.js +3 -1
  52. package/src/parse-archive-cjs.d.ts +5 -1
  53. package/src/parse-archive-cjs.d.ts.map +1 -1
  54. package/src/parse-archive-cjs.js +3 -1
  55. package/src/parse-archive-mjs.d.ts +5 -1
  56. package/src/parse-archive-mjs.d.ts.map +1 -1
  57. package/src/parse-archive-mjs.js +3 -1
  58. package/src/parse-bytes.d.ts +5 -1
  59. package/src/parse-bytes.d.ts.map +1 -1
  60. package/src/parse-bytes.js +3 -1
  61. package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
  62. package/src/parse-cjs-shared-export-wrapper.js +3 -1
  63. package/src/parse-cjs.d.ts +5 -1
  64. package/src/parse-cjs.d.ts.map +1 -1
  65. package/src/parse-cjs.js +3 -1
  66. package/src/parse-json.d.ts +5 -2
  67. package/src/parse-json.d.ts.map +1 -1
  68. package/src/parse-mjs.d.ts +5 -1
  69. package/src/parse-mjs.d.ts.map +1 -1
  70. package/src/parse-pre-cjs.d.ts +5 -1
  71. package/src/parse-pre-cjs.d.ts.map +1 -1
  72. package/src/parse-pre-cjs.js +3 -1
  73. package/src/parse-pre-mjs.d.ts +5 -1
  74. package/src/parse-pre-mjs.d.ts.map +1 -1
  75. package/src/parse-pre-mjs.js +3 -1
  76. package/src/parse-text.d.ts +5 -1
  77. package/src/parse-text.d.ts.map +1 -1
  78. package/src/parse-text.js +3 -1
  79. package/src/policy-format.d.ts +2 -1
  80. package/src/policy-format.d.ts.map +1 -1
  81. package/src/policy-format.js +5 -2
  82. package/src/policy.d.ts +2 -2
  83. package/src/policy.d.ts.map +1 -1
  84. package/src/policy.js +10 -8
  85. package/src/powers.d.ts +1 -1
  86. package/src/powers.d.ts.map +1 -1
  87. package/src/powers.js +3 -1
  88. package/src/search.d.ts +2 -1
  89. package/src/search.d.ts.map +1 -1
  90. package/src/search.js +3 -1
  91. package/src/types/compartment-map-schema.d.ts +3 -1
  92. package/src/types/compartment-map-schema.d.ts.map +1 -1
  93. package/src/types/compartment-map-schema.ts +3 -1
  94. package/src/types/external.d.ts +15 -9
  95. package/src/types/external.d.ts.map +1 -1
  96. package/src/types/external.ts +15 -9
  97. package/src/types/internal.d.ts +33 -18
  98. package/src/types/internal.d.ts.map +1 -1
  99. package/src/types/internal.ts +40 -20
  100. package/src/types/node-powers.d.ts +3 -1
  101. package/src/types/node-powers.d.ts.map +1 -1
  102. package/src/types/node-powers.ts +3 -1
  103. package/src/types/policy-schema.d.ts +3 -1
  104. package/src/types/policy-schema.d.ts.map +1 -1
  105. package/src/types/policy-schema.ts +3 -1
  106. package/src/types/policy.d.ts +3 -1
  107. package/src/types/policy.d.ts.map +1 -1
  108. package/src/types/policy.ts +3 -1
  109. package/src/types/powers.d.ts +3 -1
  110. package/src/types/powers.d.ts.map +1 -1
  111. package/src/types/powers.ts +3 -1
  112. package/src/types/typescript.d.ts +3 -1
  113. package/src/types/typescript.d.ts.map +1 -1
  114. package/src/types/typescript.ts +3 -1
  115. package/src/url.d.ts.map +1 -1
  116. package/src/url.js +3 -1
@@ -1,7 +1,9 @@
1
1
  /**
2
- * @module Provides functions for interacting with Node.js module specifiers in
2
+ * Provides functions for interacting with Node.js module specifiers in
3
3
  * their canonical form.
4
4
  * This is a kind of path math that is platform-agnostic.
5
+ *
6
+ * @module
5
7
  */
6
8
 
7
9
  // q, as in quote, for error messages.
@@ -1,6 +1,6 @@
1
1
  export function basename(location: string): string;
2
- export function compartmentMapForNodeModules(readPowers: ReadFn | ReadPowers | MaybeReadPowers, packageLocation: string, conditionsOption: Set<string>, packageDescriptor: PackageDescriptor, moduleSpecifier: string, options?: CompartmentMapForNodeModulesOptions | undefined): Promise<CompartmentMapDescriptor>;
3
- export function mapNodeModules(readPowers: ReadFn | ReadPowers | MaybeReadPowers, moduleLocation: string, { tags, conditions, log, ...otherOptions }?: MapNodeModulesOptions | undefined): Promise<CompartmentMapDescriptor>;
2
+ export function compartmentMapForNodeModules(readPowers: ReadFn | ReadPowers | MaybeReadPowers, packageLocation: string, conditionsOption: Set<string>, packageDescriptor: PackageDescriptor, moduleSpecifier: string, options?: CompartmentMapForNodeModulesOptions): Promise<CompartmentMapDescriptor>;
3
+ export function mapNodeModules(readPowers: ReadFn | ReadPowers | MaybeReadPowers, moduleLocation: string, { tags, conditions, log, ...otherOptions }?: MapNodeModulesOptions): Promise<CompartmentMapDescriptor>;
4
4
  import type { ReadFn } from './types.js';
5
5
  import type { ReadPowers } from './types.js';
6
6
  import type { MaybeReadPowers } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"node-modules.d.ts","sourceRoot":"","sources":["node-modules.js"],"names":[],"mappings":"AAiFO,mCAHI,MAAM,GACJ,MAAM,CAYlB;AAuwBM,yDATI,MAAM,GAAG,UAAU,GAAG,eAAe,mBACrC,MAAM,oBACN,GAAG,CAAC,MAAM,CAAC,qBACX,iBAAiB,mBACjB,MAAM,8DAEJ,OAAO,CAAC,wBAAwB,CAAC,CAkE7C;AAaM,2CALI,MAAM,GAAG,UAAU,GAAG,eAAe,kBACrC,MAAM,mFAEJ,OAAO,CAAC,wBAAwB,CAAC,CA0B7C;4BAz6BS,YAAY;gCAAZ,YAAY;qCAAZ,YAAY;uCAAZ,YAAY;yDAAZ,YAAY;8CAAZ,YAAY;2CAAZ,YAAY"}
1
+ {"version":3,"file":"node-modules.d.ts","sourceRoot":"","sources":["node-modules.js"],"names":[],"mappings":"AAmFO,mCAHI,MAAM,GACJ,MAAM,CAYlB;AA43BM,yDATI,MAAM,GAAG,UAAU,GAAG,eAAe,mBACrC,MAAM,oBACN,GAAG,CAAC,MAAM,CAAC,qBACX,iBAAiB,mBACjB,MAAM,YACN,mCAAmC,GACjC,OAAO,CAAC,wBAAwB,CAAC,CAkE7C;AAaM,2CALI,MAAM,GAAG,UAAU,GAAG,eAAe,kBACrC,MAAM,+CACN,qBAAqB,GACnB,OAAO,CAAC,wBAAwB,CAAC,CA0B7C;4BA9hCS,YAAY;gCAAZ,YAAY;qCAAZ,YAAY;uCAAZ,YAAY;yDAAZ,YAAY;8CAAZ,YAAY;2CAAZ,YAAY"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @module Provides functions for constructing a compartment map that has a
2
+ * Provides functions for constructing a compartment map that has a
3
3
  * compartment descriptor corresponding to every reachable package from an
4
4
  * entry module and how to create links between them.
5
5
  * The resulting compartment map does not describe individual modules but does
@@ -7,6 +7,8 @@
7
7
  * wildcard expansion.
8
8
  * See {@link link} to expand a compartment map to capture module descriptors
9
9
  * for transitive dependencies.
10
+ *
11
+ * @module
10
12
  */
11
13
 
12
14
  /* eslint no-shadow: 0 */
@@ -53,7 +55,7 @@ import {
53
55
  import { unpackReadPowers } from './powers.js';
54
56
  import { search, searchDescriptor } from './search.js';
55
57
 
56
- const { assign, create, keys, values } = Object;
58
+ const { assign, create, keys, values, entries } = Object;
57
59
 
58
60
  const decoder = new TextDecoder();
59
61
 
@@ -123,6 +125,90 @@ const readDescriptorWithMemo = async (memo, maybeRead, packageLocation) => {
123
125
  return promise;
124
126
  };
125
127
 
128
+ /**
129
+ * Compares `logicalPath` to the current best logical path in `preferredPackageLogicalPathMap` for `packageLocation`.
130
+ *
131
+ * If no current best path exists, it returns `logicalPath`.
132
+ *
133
+ * @template {string[]} T
134
+ * @template {string[]} U
135
+ * @param {T} logicalPath
136
+ * @param {string} packageLocation
137
+ * @param {Map<string, U>} preferredPackageLogicalPathMap
138
+ * @returns {T|U}
139
+ */
140
+ const currentBestLogicalPath = (
141
+ logicalPath,
142
+ packageLocation,
143
+ preferredPackageLogicalPathMap,
144
+ ) => {
145
+ const theCurrentBest = preferredPackageLogicalPathMap.get(packageLocation);
146
+ if (theCurrentBest === undefined) {
147
+ return logicalPath;
148
+ }
149
+ return pathCompare(logicalPath, theCurrentBest) < 0
150
+ ? logicalPath
151
+ : theCurrentBest;
152
+ };
153
+
154
+ /**
155
+ * Updates the shortest paths in a subgraph of `graph` starting with `packageLocation`.
156
+ *
157
+ * This should be called upon the second (and each subsequent) visit to a graph node.
158
+ *
159
+ * @param {Graph} graph Graph
160
+ * @param {string} packageLocation Location of the package to start with
161
+ * @param {string[]} logicalPath Current path parts of the same package
162
+ * @param {Map<string, string[]>} [preferredPackageLogicalPathMap] Mapping of shortest known paths for each package location
163
+ * @returns {void}
164
+ */
165
+ const updateShortestPaths = (
166
+ graph,
167
+ packageLocation,
168
+ logicalPath,
169
+ preferredPackageLogicalPathMap = new Map(),
170
+ ) => {
171
+ const node = graph[packageLocation];
172
+ if (!node) {
173
+ throw new ReferenceError(
174
+ `Cannot find package at ${packageLocation} in graph`,
175
+ );
176
+ }
177
+
178
+ const bestLogicalPath = currentBestLogicalPath(
179
+ logicalPath,
180
+ packageLocation,
181
+ preferredPackageLogicalPathMap,
182
+ );
183
+
184
+ if (bestLogicalPath === logicalPath) {
185
+ preferredPackageLogicalPathMap.set(packageLocation, bestLogicalPath);
186
+
187
+ for (const name of keys(node.dependencyLocations).sort()) {
188
+ const packageLocation = node.dependencyLocations[name];
189
+ if (!packageLocation) {
190
+ // "should never happen"
191
+ throw new ReferenceError(
192
+ `Expected graph node ${q(node.name)} to contain a dependency location for ${q(name)}`,
193
+ );
194
+ }
195
+ updateShortestPaths(
196
+ graph,
197
+ packageLocation,
198
+ [...logicalPath, name],
199
+ preferredPackageLogicalPathMap,
200
+ );
201
+ }
202
+ }
203
+
204
+ // a path length of 0 means the node represents the eventual entry compartment.
205
+ // we do not want to mess with that path.
206
+ if (node.path.length && node.path !== bestLogicalPath) {
207
+ node.path = bestLogicalPath;
208
+ }
209
+
210
+ return undefined;
211
+ };
126
212
  /**
127
213
  * `findPackage` behaves as Node.js to find third-party modules by searching
128
214
  * parent to ancestor directories for a `node_modules` directory that contains
@@ -291,6 +377,13 @@ const graphPackage = async (
291
377
  } = {},
292
378
  ) => {
293
379
  if (graph[packageLocation] !== undefined) {
380
+ updateShortestPaths(
381
+ graph,
382
+ packageLocation,
383
+ logicalPath,
384
+ preferredPackageLogicalPathMap,
385
+ );
386
+
294
387
  // Returning the promise here would create a causal cycle and stall recursion.
295
388
  return undefined;
296
389
  }
@@ -310,7 +403,20 @@ const graphPackage = async (
310
403
  const dependencyLocations = {};
311
404
  /** @type {ReturnType<typeof gatherDependency>[]} */
312
405
  const children = [];
406
+
407
+ /**
408
+ * A set containing dependency names which are considered "optional"
409
+ */
313
410
  const optionals = new Set();
411
+
412
+ /**
413
+ * Contains the names of _all_ dependencies
414
+ *
415
+ * @type {Set<string>}
416
+ */
417
+ const allDependencies = new Set();
418
+
419
+ // these are fields from package.json containing dependencies
314
420
  const {
315
421
  dependencies = {},
316
422
  peerDependencies = {},
@@ -319,32 +425,40 @@ const graphPackage = async (
319
425
  optionalDependencies = {},
320
426
  devDependencies = {},
321
427
  } = packageDescriptor;
322
- const allDependencies = {};
323
- for (const [name, descriptor] of Object.entries(
324
- commonDependencyDescriptors,
325
- )) {
428
+
429
+ for (const [name, descriptor] of entries(commonDependencyDescriptors)) {
326
430
  if (Object(descriptor) === descriptor) {
327
- const { spec } = descriptor;
328
- allDependencies[name] = spec;
431
+ allDependencies.add(name);
329
432
  }
330
433
  }
331
- assign(allDependencies, dependencies);
332
- assign(allDependencies, peerDependencies);
333
- for (const [name, meta] of Object.entries(peerDependenciesMeta)) {
434
+
435
+ // only consider devDependencies if dev flag is true
436
+ for (const name of keys({
437
+ ...dependencies,
438
+ ...peerDependencies,
439
+ ...bundleDependencies,
440
+ ...optionalDependencies,
441
+ ...(dev ? devDependencies : {}),
442
+ })) {
443
+ allDependencies.add(name);
444
+ }
445
+
446
+ // for historical reasons, some packages omit peerDependencies and only
447
+ // use the peerDependenciesMeta field (because there was no way to define
448
+ // an "optional" peerDependency prior to npm v7). this is plainly wrong,
449
+ // but not exactly rare, either
450
+ for (const [name, meta] of entries(peerDependenciesMeta)) {
334
451
  if (Object(meta) === meta && meta.optional) {
335
452
  optionals.add(name);
453
+ allDependencies.add(name);
336
454
  }
337
455
  }
338
- assign(allDependencies, bundleDependencies);
339
- assign(allDependencies, optionalDependencies);
340
- for (const name of Object.keys(optionalDependencies)) {
456
+
457
+ for (const name of keys(optionalDependencies)) {
341
458
  optionals.add(name);
342
459
  }
343
- if (dev) {
344
- assign(allDependencies, devDependencies);
345
- }
346
460
 
347
- for (const name of keys(allDependencies).sort()) {
461
+ for (const name of [...allDependencies].sort()) {
348
462
  const optional = optionals.has(name);
349
463
  const childLogicalPath = [...logicalPath, name];
350
464
  children.push(
@@ -407,7 +521,7 @@ const graphPackage = async (
407
521
 
408
522
  const sourceDirname = basename(packageLocation);
409
523
 
410
- Object.assign(result, {
524
+ assign(result, {
411
525
  name,
412
526
  path: logicalPath,
413
527
  label: `${name}${version ? `-v${version}` : ''}`,
@@ -432,7 +546,7 @@ const graphPackage = async (
432
546
  await Promise.all(children);
433
547
 
434
548
  // handle commonDependencyDescriptors package aliases
435
- for (const [name, { alias }] of Object.entries(commonDependencyDescriptors)) {
549
+ for (const [name, { alias }] of entries(commonDependencyDescriptors)) {
436
550
  // update the dependencyLocations to point to the common dependency
437
551
  const targetLocation = dependencyLocations[name];
438
552
  if (targetLocation === undefined) {
@@ -510,15 +624,20 @@ const gatherDependency = async (
510
624
  throw Error(`Cannot find dependency ${name} for ${packageLocation}`);
511
625
  }
512
626
  dependencyLocations[name] = dependency.packageLocation;
513
- const theCurrentBest = preferredPackageLogicalPathMap.get(
627
+
628
+ const bestLogicalPath = currentBestLogicalPath(
629
+ childLogicalPath,
514
630
  dependency.packageLocation,
631
+ preferredPackageLogicalPathMap,
515
632
  );
516
- if (pathCompare(childLogicalPath, theCurrentBest) < 0) {
633
+
634
+ if (bestLogicalPath === childLogicalPath) {
517
635
  preferredPackageLogicalPathMap.set(
518
636
  dependency.packageLocation,
519
- childLogicalPath,
637
+ bestLogicalPath,
520
638
  );
521
639
  }
640
+
522
641
  await graphPackage(
523
642
  name,
524
643
  readDescriptor,
@@ -598,7 +717,7 @@ const graphPackages = async (
598
717
  /** @type {CommonDependencyDescriptors} */
599
718
  const commonDependencyDescriptors = {};
600
719
  const packageDescriptorDependencies = packageDescriptor.dependencies || {};
601
- for (const [alias, dependencyName] of Object.entries(commonDependencies)) {
720
+ for (const [alias, dependencyName] of entries(commonDependencies)) {
602
721
  const spec = packageDescriptorDependencies[dependencyName];
603
722
  if (spec === undefined) {
604
723
  throw Error(
@@ -653,7 +772,7 @@ const translateGraph = (
653
772
  policy,
654
773
  ) => {
655
774
  /** @type {CompartmentMapDescriptor['compartments']} */
656
- const compartments = Object.create(null);
775
+ const compartments = create(null);
657
776
 
658
777
  // For each package, build a map of all the external modules the package can
659
778
  // import from other packages.
@@ -676,9 +795,9 @@ const translateGraph = (
676
795
  types,
677
796
  } = graph[dependeeLocation];
678
797
  /** @type {CompartmentDescriptor['modules']} */
679
- const moduleDescriptors = Object.create(null);
798
+ const moduleDescriptors = create(null);
680
799
  /** @type {CompartmentDescriptor['scopes']} */
681
- const scopes = Object.create(null);
800
+ const scopes = create(null);
682
801
 
683
802
  /**
684
803
  * List of all the compartments (by name) that this compartment can import from.
@@ -838,10 +957,10 @@ const makeLanguageOptions = ({
838
957
  };
839
958
 
840
959
  const languages = new Set([
841
- ...Object.values(moduleLanguageForExtension),
842
- ...Object.values(commonjsLanguageForExtension),
843
- ...Object.values(workspaceModuleLanguageForExtension),
844
- ...Object.values(workspaceCommonjsLanguageForExtension),
960
+ ...values(moduleLanguageForExtension),
961
+ ...values(commonjsLanguageForExtension),
962
+ ...values(workspaceModuleLanguageForExtension),
963
+ ...values(workspaceCommonjsLanguageForExtension),
845
964
  ...additionalLanguages,
846
965
  ]);
847
966
 
@@ -37,7 +37,7 @@ export function makeWritePowers({ fs, url }: {
37
37
  }): {
38
38
  write: (location: string, data: Uint8Array) => Promise<void>;
39
39
  };
40
- export function makeNodeReadPowers(fs: FsInterface, crypto?: CryptoInterface | undefined): ReadPowers;
40
+ export function makeNodeReadPowers(fs: FsInterface, crypto?: CryptoInterface): ReadPowers;
41
41
  export function makeNodeWritePowers(fs: FsInterface): WritePowers;
42
42
  import type { FsInterface } from './types/node-powers.js';
43
43
  import type { UrlInterface } from './types/node-powers.js';
@@ -1 +1 @@
1
- {"version":3,"file":"node-powers.d.ts","sourceRoot":"","sources":["node-powers.js"],"names":[],"mappings":"AA0LO,8DANJ;IAA0B,EAAE,EAApB,WAAW;IACS,GAAG;IACA,MAAM;IACR,IAAI;CACjC,GAAU,eAAe,GAAG,aAAa,CAoC3C;AAlKD;;;;;;;;;;;GAWG;AACH,2DANG;IAA0B,EAAE,EAApB,WAAW;IACS,GAAG;IACA,MAAM;IACR,IAAI;CACjC,GAAU,eAAe,CA0G3B;AAgDD;;;;;;;;GAQG;AACH,6CAHG;IAA0B,EAAE,EAApB,WAAW;IACS,GAAG;CAAC;sBAOtB,MAAM,QACN,UAAU;EAYtB;AA2BM,uCALI,WAAW,yCAET,UAAU,CAKtB;AAWM,wCAJI,WAAW,GACT,WAAW,CAKvB;iCApRS,wBAAwB;kCAAxB,wBAAwB;qCAAxB,wBAAwB;mCAAxB,wBAAwB;qCAexB,mBAAmB;mCAAnB,mBAAmB;gCAAnB,mBAAmB;iCAAnB,mBAAmB"}
1
+ {"version":3,"file":"node-powers.d.ts","sourceRoot":"","sources":["node-powers.js"],"names":[],"mappings":"AA4LO,8DANJ;IAA0B,EAAE,EAApB,WAAW;IACS,GAAG;IACA,MAAM;IACR,IAAI;CACjC,GAAU,eAAe,GAAG,aAAa,CAoC3C;AAlKD;;;;;;;;;;;GAWG;AACH,2DANG;IAA0B,EAAE,EAApB,WAAW;IACS,GAAG;IACA,MAAM;IACR,IAAI;CACjC,GAAU,eAAe,CA0G3B;AAgDD;;;;;;;;GAQG;AACH,6CAHG;IAA0B,EAAE,EAApB,WAAW;IACS,GAAG;CAAC;sBAOtB,MAAM,QACN,UAAU;EAYtB;AA2BM,uCALI,WAAW,WACX,eAAe,GACb,UAAU,CAKtB;AAWM,wCAJI,WAAW,GACT,WAAW,CAKvB;iCApRS,wBAAwB;kCAAxB,wBAAwB;qCAAxB,wBAAwB;mCAAxB,wBAAwB;qCAexB,mBAAmB;mCAAnB,mBAAmB;gCAAnB,mBAAmB;iCAAnB,mBAAmB"}
@@ -1,10 +1,12 @@
1
1
  /**
2
- * @module Provides adapters for Compartment Mapper I/O to the corresponding
2
+ * Provides adapters for Compartment Mapper I/O to the corresponding
3
3
  * Node.js implementations of those behaviors.
4
4
  *
5
5
  * The Compartment Mapper generalizes its I/O interface to allow for a wide
6
6
  * variety of I/O providers, but especially for reading and writing from
7
7
  * virtualized file systems like zip files.
8
+ *
9
+ * @module
8
10
  */
9
11
 
10
12
  /**
@@ -1,6 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parseArchiveCjs: ParseFn;
3
- declare const _default: import("./types.js").ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: true;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
10
  //# sourceMappingURL=parse-archive-cjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-archive-cjs.d.ts","sourceRoot":"","sources":["parse-archive-cjs.js"],"names":[],"mappings":"AAkBA,sBAAsB;AACtB,8BADW,OAAO,CAkDhB;wBAES,OAAO,YAAY,EAAE,oBAAoB;;6BAjEzB,YAAY"}
1
+ {"version":3,"file":"parse-archive-cjs.d.ts","sourceRoot":"","sources":["parse-archive-cjs.js"],"names":[],"mappings":"AAoBA,sBAAsB;AACtB,8BADW,OAAO,CAkDhB;;;;;;;6BA/DyB,YAAY"}
@@ -1,6 +1,8 @@
1
1
  /**
2
- * @module Provides language behavior for analyzing, pre-compiling, and storing
2
+ * Provides language behavior for analyzing, pre-compiling, and storing
3
3
  * CommonJS modules for an archive.
4
+ *
5
+ * @module
4
6
  */
5
7
 
6
8
  /** @import {ParseFn} from './types.js' */
@@ -1,6 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parseArchiveMjs: ParseFn;
3
- declare const _default: import("./types.js").ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: false;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
10
  //# sourceMappingURL=parse-archive-mjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-archive-mjs.d.ts","sourceRoot":"","sources":["parse-archive-mjs.js"],"names":[],"mappings":"AAYA,sBAAsB;AACtB,8BADW,OAAO,CAqBhB;wBAES,OAAO,YAAY,EAAE,oBAAoB;;6BA9BzB,YAAY"}
1
+ {"version":3,"file":"parse-archive-mjs.d.ts","sourceRoot":"","sources":["parse-archive-mjs.js"],"names":[],"mappings":"AAcA,sBAAsB;AACtB,8BADW,OAAO,CAqBhB;;;;;;;6BA5ByB,YAAY"}
@@ -1,6 +1,8 @@
1
1
  /**
2
- * @module Provides language behavior for analyzing, pre-compiling, and storing ESM
2
+ * Provides language behavior for analyzing, pre-compiling, and storing ESM
3
3
  * modules for an archive.
4
+ *
5
+ * @module
4
6
  */
5
7
 
6
8
  /** @import {ParseFn} from './types.js' */
@@ -1,6 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parseBytes: ParseFn;
3
- declare const _default: import("./types.js").ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: false;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
10
  //# sourceMappingURL=parse-bytes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-bytes.d.ts","sourceRoot":"","sources":["parse-bytes.js"],"names":[],"mappings":"AAgBA,sBAAsB;AACtB,yBADW,OAAO,CA0BhB;wBAES,OAAO,YAAY,EAAE,oBAAoB;;6BAtCzB,YAAY"}
1
+ {"version":3,"file":"parse-bytes.d.ts","sourceRoot":"","sources":["parse-bytes.js"],"names":[],"mappings":"AAkBA,sBAAsB;AACtB,yBADW,OAAO,CA0BhB;;;;;;;6BApCyB,YAAY"}
@@ -1,6 +1,8 @@
1
1
  /**
2
- * @module Provides rudimentary support for treating an arbitrary file as a
2
+ * Provides rudimentary support for treating an arbitrary file as a
3
3
  * module that exports the bytes of that file.
4
+ *
5
+ * @module
4
6
  */
5
7
 
6
8
  /** @import {Harden} from 'ses' */
@@ -1 +1 @@
1
- {"version":3,"file":"parse-cjs-shared-export-wrapper.d.ts","sourceRoot":"","sources":["parse-cjs-shared-export-wrapper.js"],"names":[],"mappings":"AAwCO,2CAPI,UAAU,GAAG,MAAM,GAAG,SAAS,YAC/B,MAAM,GACJ;IACR,QAAQ,EAAC,MAAM,GAAC,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAC,IAAI,CAAA;CACrB,CAgCH;AAmBM,uGAZJ;IAAmB,uBAAuB,EAAlC,MAAM;IACU,WAAW,EAA3B,WAAW;IACgB,eAAe,EAA1C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACX,QAAQ,EAAnB,MAAM;IAC8B,UAAU,EAA9C,MAAM,GAAG,UAAU,GAAG,SAAS;CACvC,GAAU;IACR,MAAM,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC;IACzB,aAAa,EAAE,GAAG,CAAC;IACnB,YAAY,WAAW;IACvB,OAAO,WAAW;CACnB,CA2HH;gCA5MqC,YAAY;4BAAZ,YAAY"}
1
+ {"version":3,"file":"parse-cjs-shared-export-wrapper.d.ts","sourceRoot":"","sources":["parse-cjs-shared-export-wrapper.js"],"names":[],"mappings":"AA0CO,2CAPI,UAAU,GAAG,MAAM,GAAG,SAAS,YAC/B,MAAM,GACJ;IACR,QAAQ,EAAC,MAAM,GAAC,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,GAAC,IAAI,CAAA;CACrB,CAgCH;AAmBM,uGAZJ;IAAmB,uBAAuB,EAAlC,MAAM;IACU,WAAW,EAA3B,WAAW;IACgB,eAAe,EAA1C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IACX,QAAQ,EAAnB,MAAM;IAC8B,UAAU,EAA9C,MAAM,GAAG,UAAU,GAAG,SAAS;CACvC,GAAU;IACR,MAAM,EAAE;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,CAAC;IACzB,aAAa,EAAE,GAAG,CAAC;IACnB,YAAY,WAAW;IACvB,OAAO,WAAW;CACnB,CA2HH;gCA5MqC,YAAY;4BAAZ,YAAY"}
@@ -1,7 +1,9 @@
1
1
  /**
2
- * @module Provides shared functionality for {@link parse-cjs.js} and {@link
2
+ * Provides shared functionality for {@link parse-cjs.js} and {@link
3
3
  * parse-archive-cjs.js} toward importing or archiving CommonJS as a virtual
4
4
  * module source.
5
+ *
6
+ * @module
5
7
  */
6
8
 
7
9
  /** @import {ReadFn, ReadPowers} from './types.js' */
@@ -1,6 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parseCjs: ParseFn;
3
- declare const _default: import("./types.js").ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: true;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
10
  //# sourceMappingURL=parse-cjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-cjs.d.ts","sourceRoot":"","sources":["parse-cjs.js"],"names":[],"mappings":"AAcA,sBAAsB;AACtB,uBADW,OAAO,CA0DhB;wBAES,OAAO,YAAY,EAAE,oBAAoB;;6BArEzB,YAAY"}
1
+ {"version":3,"file":"parse-cjs.d.ts","sourceRoot":"","sources":["parse-cjs.js"],"names":[],"mappings":"AAgBA,sBAAsB;AACtB,uBADW,OAAO,CA0DhB;;;;;;;6BAnEyB,YAAY"}
package/src/parse-cjs.js CHANGED
@@ -1,6 +1,8 @@
1
1
  /**
2
- * @module Provides language behavior (parser) for importing CommonJS as a
2
+ * Provides language behavior (parser) for importing CommonJS as a
3
3
  * virtual module source.
4
+ *
5
+ * @module
4
6
  */
5
7
 
6
8
  /** @import {ParseFn} from './types.js' */
@@ -1,7 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parseJson: ParseFn;
3
- declare const _default: ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: false;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
- import type { ParserImplementation } from './types.js';
7
10
  //# sourceMappingURL=parse-json.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-json.d.ts","sourceRoot":"","sources":["parse-json.js"],"names":[],"mappings":"AAmBA,sBAAsB;AACtB,wBADW,OAAO,CAqBhB;wBAES,oBAAoB;;6BAtCiB,YAAY;0CAAZ,YAAY"}
1
+ {"version":3,"file":"parse-json.d.ts","sourceRoot":"","sources":["parse-json.js"],"names":[],"mappings":"AAmBA,sBAAsB;AACtB,wBADW,OAAO,CAqBhB;;;;;;;6BApC8C,YAAY"}
@@ -1,6 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parseMjs: ParseFn;
3
- declare const _default: import("./types.js").ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: false;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
10
  //# sourceMappingURL=parse-mjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-mjs.d.ts","sourceRoot":"","sources":["parse-mjs.js"],"names":[],"mappings":"AAQA,sBAAsB;AACtB,uBADW,OAAO,CAqBhB;wBAES,OAAO,YAAY,EAAE,oBAAoB;;6BA7BzB,YAAY"}
1
+ {"version":3,"file":"parse-mjs.d.ts","sourceRoot":"","sources":["parse-mjs.js"],"names":[],"mappings":"AAQA,sBAAsB;AACtB,uBADW,OAAO,CAqBhB;;;;;;;6BA3ByB,YAAY"}
@@ -1,6 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parsePreCjs: ParseFn;
3
- declare const _default: import("./types.js").ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: true;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
10
  //# sourceMappingURL=parse-pre-cjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-pre-cjs.d.ts","sourceRoot":"","sources":["parse-pre-cjs.js"],"names":[],"mappings":"AAeA,sBAAsB;AACtB,0BADW,OAAO,CAuDhB;wBAES,OAAO,YAAY,EAAE,oBAAoB;;6BAhEzB,YAAY"}
1
+ {"version":3,"file":"parse-pre-cjs.d.ts","sourceRoot":"","sources":["parse-pre-cjs.js"],"names":[],"mappings":"AAiBA,sBAAsB;AACtB,0BADW,OAAO,CAuDhB;;;;;;;6BA9DyB,YAAY"}
@@ -1,9 +1,11 @@
1
1
  /**
2
- * @module Provides language-specific behavior for importing pre-compiled
2
+ * Provides language-specific behavior for importing pre-compiled
3
3
  * CommonJS.
4
4
  * Pre-compiled CommonJS is a module in JSON format that describes its imports,
5
5
  * exports, and source to execute in the presence of `require`, `module`, and
6
6
  * `exports`.
7
+ *
8
+ * @module
7
9
  */
8
10
 
9
11
  /** @import {ParseFn} from './types.js' */
@@ -1,6 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parsePreMjs: ParseFn;
3
- declare const _default: import("./types.js").ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: false;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
10
  //# sourceMappingURL=parse-pre-mjs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-pre-mjs.d.ts","sourceRoot":"","sources":["parse-pre-mjs.js"],"names":[],"mappings":"AAaA,sBAAsB;AACtB,0BADW,OAAO,CAsBhB;wBAES,OAAO,YAAY,EAAE,oBAAoB;;6BA9BzB,YAAY"}
1
+ {"version":3,"file":"parse-pre-mjs.d.ts","sourceRoot":"","sources":["parse-pre-mjs.js"],"names":[],"mappings":"AAeA,sBAAsB;AACtB,0BADW,OAAO,CAsBhB;;;;;;;6BA5ByB,YAAY"}
@@ -1,8 +1,10 @@
1
1
  /**
2
- * @module Provides language-specific behaviors for importing pre-compiled ESM.
2
+ * Provides language-specific behaviors for importing pre-compiled ESM.
3
3
  * Pre-compiling or translating ESM from a module to a script with a
4
4
  * calling-convention is necessary to prepare an archive so that it can be
5
5
  * imported by the SES shim without entraining a dependency on Babel.
6
+ *
7
+ * @module
6
8
  */
7
9
 
8
10
  /** @import {ParseFn} from './types.js' */
@@ -1,6 +1,10 @@
1
1
  /** @type {ParseFn} */
2
2
  export const parseText: ParseFn;
3
- declare const _default: import("./types.js").ParserImplementation;
3
+ declare const _default: {
4
+ parse: ParseFn;
5
+ heuristicImports: false;
6
+ synchronous: true;
7
+ };
4
8
  export default _default;
5
9
  import type { ParseFn } from './types.js';
6
10
  //# sourceMappingURL=parse-text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse-text.d.ts","sourceRoot":"","sources":["parse-text.js"],"names":[],"mappings":"AAkBA,sBAAsB;AACtB,wBADW,OAAO,CAuBhB;wBAES,OAAO,YAAY,EAAE,oBAAoB;;6BArCzB,YAAY"}
1
+ {"version":3,"file":"parse-text.d.ts","sourceRoot":"","sources":["parse-text.js"],"names":[],"mappings":"AAoBA,sBAAsB;AACtB,wBADW,OAAO,CAuBhB;;;;;;;6BAnCyB,YAAY"}
package/src/parse-text.js CHANGED
@@ -1,7 +1,9 @@
1
1
  /**
2
- * @module Provides language-behaviors for importing a module as a document
2
+ * Provides language-behaviors for importing a module as a document
3
3
  * that exports itself as a string based on a UTF-8 interpretation of the
4
4
  * module's text.
5
+ *
6
+ * @module
5
7
  */
6
8
 
7
9
  /** @import {ParseFn} from './types.js' */
@@ -1,8 +1,9 @@
1
+ export const WILDCARD_POLICY_VALUE: "any";
1
2
  export function policyLookupHelper(packagePolicy: import("./types.js").PackagePolicy, field: "builtins" | "globals" | "packages", itemName: string): boolean | import("./types.js").AttenuationDefinition;
2
3
  export function isAllowingEverything(policyValue: unknown): policyValue is import("./types.js").WildcardPolicy;
3
4
  export function isAttenuationDefinition(allegedDefinition: unknown): allegedDefinition is import("./types.js").AttenuationDefinition;
4
5
  export function getAttenuatorFromDefinition(attenuationDefinition: import("./types.js").AttenuationDefinition): import("./types.js").UnifiedAttenuationDefinition;
5
- export function assertPackagePolicy(allegedPackagePolicy: unknown, path: string, url?: string | undefined): asserts allegedPackagePolicy is SomePackagePolicy | undefined;
6
+ export function assertPackagePolicy(allegedPackagePolicy: unknown, path: string, url?: string): asserts allegedPackagePolicy is SomePackagePolicy | undefined;
6
7
  export function assertPolicy(allegedPolicy: unknown): asserts allegedPolicy is (SomePolicy | undefined);
7
8
  import type { SomePackagePolicy } from './types.js';
8
9
  import type { SomePolicy } from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"policy-format.d.ts","sourceRoot":"","sources":["policy-format.js"],"names":[],"mappings":"AA2BO,kDALI,OAAO,YAAY,EAAE,aAAa,SAClC,UAAU,GAAC,SAAS,GAAC,UAAU,YAC/B,MAAM,GACJ,OAAO,GAAG,OAAO,YAAY,EAAE,qBAAqB,CAyBhE;AAQM,kDAHI,OAAO,GACL,WAAW,IAAI,OAAO,YAAY,EAAE,cAAc,CAGxB;AAOhC,2DAHI,OAAO,GACL,iBAAiB,IAAI,OAAO,YAAY,EAAE,qBAAqB,CAS3E;AAOM,mEAHI,OAAO,YAAY,EAAE,qBAAqB,GACxC,OAAO,YAAY,EAAE,4BAA4B,CAuB7D;AA0CM,0DALI,OAAO,QACP,MAAM,6BAEJ,QAAQ,oBAAoB,IAAI,iBAAiB,GAAC,SAAS,CA4DvE;AAUM,4CAHI,OAAO,GACL,QAAQ,aAAa,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAgC7D;uCA5OgD,YAAY;gCAAZ,YAAY"}
1
+ {"version":3,"file":"policy-format.d.ts","sourceRoot":"","sources":["policy-format.js"],"names":[],"mappings":"AAeA,oCAAqC,KAAK,CAAC;AAepC,kDALI,OAAO,YAAY,EAAE,aAAa,SAClC,UAAU,GAAC,SAAS,GAAC,UAAU,YAC/B,MAAM,GACJ,OAAO,GAAG,OAAO,YAAY,EAAE,qBAAqB,CAyBhE;AAQM,kDAHI,OAAO,GACL,WAAW,IAAI,OAAO,YAAY,EAAE,cAAc,CAGxB;AAOhC,2DAHI,OAAO,GACL,iBAAiB,IAAI,OAAO,YAAY,EAAE,qBAAqB,CAS3E;AAOM,mEAHI,OAAO,YAAY,EAAE,qBAAqB,GACxC,OAAO,YAAY,EAAE,4BAA4B,CAuB7D;AA0CM,0DALI,OAAO,QACP,MAAM,QACN,MAAM,GACJ,QAAQ,oBAAoB,IAAI,iBAAiB,GAAC,SAAS,CA4DvE;AAUM,4CAHI,OAAO,GACL,QAAQ,aAAa,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAgC7D;uCA7OgD,YAAY;gCAAZ,YAAY"}