@endo/compartment-mapper 1.5.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 (143) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +278 -111
  3. package/SECURITY.md +2 -2
  4. package/bundle.d.ts +1 -1
  5. package/bundle.js +4 -1
  6. package/functor-lite.d.ts +3 -0
  7. package/functor-lite.d.ts.map +1 -0
  8. package/functor-lite.js +4 -0
  9. package/functor.d.ts +3 -0
  10. package/functor.d.ts.map +1 -0
  11. package/functor.js +4 -0
  12. package/index.d.ts +1 -1
  13. package/index.js +4 -1
  14. package/package.json +15 -11
  15. package/script-lite.d.ts +3 -0
  16. package/script-lite.d.ts.map +1 -0
  17. package/script-lite.js +4 -0
  18. package/script.d.ts +3 -0
  19. package/script.d.ts.map +1 -0
  20. package/script.js +4 -0
  21. package/src/archive-lite.d.ts +5 -5
  22. package/src/archive-lite.d.ts.map +1 -1
  23. package/src/archive-lite.js +1 -1
  24. package/src/archive.d.ts +5 -5
  25. package/src/archive.d.ts.map +1 -1
  26. package/src/archive.js +3 -1
  27. package/src/bundle-cjs.d.ts +12 -2
  28. package/src/bundle-cjs.d.ts.map +1 -1
  29. package/src/bundle-cjs.js +57 -28
  30. package/src/bundle-json.d.ts.map +1 -1
  31. package/src/bundle-json.js +2 -3
  32. package/src/bundle-lite.d.ts +91 -0
  33. package/src/bundle-lite.d.ts.map +1 -0
  34. package/src/bundle-lite.js +667 -0
  35. package/src/bundle-mjs.d.ts +13 -3
  36. package/src/bundle-mjs.d.ts.map +1 -1
  37. package/src/bundle-mjs.js +36 -19
  38. package/src/bundle.d.ts +48 -10
  39. package/src/bundle.d.ts.map +1 -1
  40. package/src/bundle.js +392 -126
  41. package/src/capture-lite.d.ts +1 -1
  42. package/src/capture-lite.d.ts.map +1 -1
  43. package/src/capture-lite.js +4 -2
  44. package/src/compartment-map.d.ts +1 -1
  45. package/src/compartment-map.d.ts.map +1 -1
  46. package/src/import-archive-lite.d.ts +2 -2
  47. package/src/import-archive-lite.d.ts.map +1 -1
  48. package/src/import-archive-lite.js +3 -1
  49. package/src/import-archive.d.ts +3 -3
  50. package/src/import-archive.d.ts.map +1 -1
  51. package/src/import-archive.js +3 -1
  52. package/src/import-hook.d.ts +3 -16
  53. package/src/import-hook.d.ts.map +1 -1
  54. package/src/import-hook.js +214 -116
  55. package/src/import-lite.d.ts +1 -1
  56. package/src/import-lite.d.ts.map +1 -1
  57. package/src/import-lite.js +7 -3
  58. package/src/import.d.ts.map +1 -1
  59. package/src/import.js +3 -1
  60. package/src/infer-exports.d.ts +5 -7
  61. package/src/infer-exports.d.ts.map +1 -1
  62. package/src/infer-exports.js +23 -8
  63. package/src/link.d.ts.map +1 -1
  64. package/src/link.js +4 -1
  65. package/src/map-parser.d.ts.map +1 -1
  66. package/src/map-parser.js +51 -5
  67. package/src/node-module-specifier.d.ts.map +1 -1
  68. package/src/node-module-specifier.js +3 -1
  69. package/src/node-modules.d.ts +4 -47
  70. package/src/node-modules.d.ts.map +1 -1
  71. package/src/node-modules.js +267 -148
  72. package/src/node-powers.d.ts +1 -1
  73. package/src/node-powers.d.ts.map +1 -1
  74. package/src/node-powers.js +3 -1
  75. package/src/parse-archive-cjs.d.ts +5 -1
  76. package/src/parse-archive-cjs.d.ts.map +1 -1
  77. package/src/parse-archive-cjs.js +11 -4
  78. package/src/parse-archive-mjs.d.ts +5 -1
  79. package/src/parse-archive-mjs.d.ts.map +1 -1
  80. package/src/parse-archive-mjs.js +3 -1
  81. package/src/parse-bytes.d.ts +5 -1
  82. package/src/parse-bytes.d.ts.map +1 -1
  83. package/src/parse-bytes.js +3 -1
  84. package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
  85. package/src/parse-cjs-shared-export-wrapper.js +5 -11
  86. package/src/parse-cjs.d.ts +5 -1
  87. package/src/parse-cjs.d.ts.map +1 -1
  88. package/src/parse-cjs.js +4 -2
  89. package/src/parse-json.d.ts +5 -2
  90. package/src/parse-json.d.ts.map +1 -1
  91. package/src/parse-mjs.d.ts +5 -1
  92. package/src/parse-mjs.d.ts.map +1 -1
  93. package/src/parse-mjs.js +2 -2
  94. package/src/parse-pre-cjs.d.ts +5 -1
  95. package/src/parse-pre-cjs.d.ts.map +1 -1
  96. package/src/parse-pre-cjs.js +3 -1
  97. package/src/parse-pre-mjs.d.ts +5 -1
  98. package/src/parse-pre-mjs.d.ts.map +1 -1
  99. package/src/parse-pre-mjs.js +3 -1
  100. package/src/parse-text.d.ts +5 -1
  101. package/src/parse-text.d.ts.map +1 -1
  102. package/src/parse-text.js +3 -1
  103. package/src/policy-format.d.ts +2 -1
  104. package/src/policy-format.d.ts.map +1 -1
  105. package/src/policy-format.js +5 -2
  106. package/src/policy.d.ts +2 -2
  107. package/src/policy.d.ts.map +1 -1
  108. package/src/policy.js +10 -11
  109. package/src/powers.d.ts +1 -1
  110. package/src/powers.d.ts.map +1 -1
  111. package/src/powers.js +3 -1
  112. package/src/search.d.ts +7 -12
  113. package/src/search.d.ts.map +1 -1
  114. package/src/search.js +32 -13
  115. package/src/types/compartment-map-schema.d.ts +8 -1
  116. package/src/types/compartment-map-schema.d.ts.map +1 -1
  117. package/src/types/compartment-map-schema.ts +8 -1
  118. package/src/types/external.d.ts +127 -17
  119. package/src/types/external.d.ts.map +1 -1
  120. package/src/types/external.ts +142 -17
  121. package/src/types/internal.d.ts +116 -29
  122. package/src/types/internal.d.ts.map +1 -1
  123. package/src/types/internal.ts +144 -31
  124. package/src/types/node-modules.d.ts +79 -0
  125. package/src/types/node-modules.d.ts.map +1 -0
  126. package/src/types/node-modules.ts +89 -0
  127. package/src/types/node-powers.d.ts +7 -5
  128. package/src/types/node-powers.d.ts.map +1 -1
  129. package/src/types/node-powers.ts +7 -5
  130. package/src/types/policy-schema.d.ts +3 -1
  131. package/src/types/policy-schema.d.ts.map +1 -1
  132. package/src/types/policy-schema.ts +3 -1
  133. package/src/types/policy.d.ts +3 -1
  134. package/src/types/policy.d.ts.map +1 -1
  135. package/src/types/policy.ts +3 -1
  136. package/src/types/powers.d.ts +5 -3
  137. package/src/types/powers.d.ts.map +1 -1
  138. package/src/types/powers.ts +5 -3
  139. package/src/types/typescript.d.ts +3 -1
  140. package/src/types/typescript.d.ts.map +1 -1
  141. package/src/types/typescript.ts +3 -1
  142. package/src/url.d.ts.map +1 -1
  143. package/src/url.js +3 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @module Provides functions for evaluating a module and its transitive
2
+ * Provides functions for evaluating a module and its transitive
3
3
  * dependencies given a partially completed compartment map.
4
4
  * The compartment map needs to describe every reachable compartment, where to
5
5
  * find modules in that compartment, and how to link modules between
@@ -13,6 +13,8 @@
13
13
  * The default `parserForLanguage` mapping is empty.
14
14
  * You will need to provide the `defaultParserForLanguage` from
15
15
  * `@endo/compartment-mapper/import-parsers.js` or similar.
16
+ *
17
+ * @module
16
18
  */
17
19
 
18
20
  /* eslint no-shadow: "off" */
@@ -169,7 +171,7 @@ export const loadFromMap = async (readPowers, compartmentMap, options = {}) => {
169
171
  archiveOnly: false,
170
172
  entryCompartmentName,
171
173
  entryModuleSpecifier,
172
- exitModuleImportHook: compartmentExitModuleImportHook,
174
+ importHook: compartmentExitModuleImportHook,
173
175
  },
174
176
  );
175
177
 
@@ -188,9 +190,11 @@ export const loadFromMap = async (readPowers, compartmentMap, options = {}) => {
188
190
  /** @type {ReadNowPowers} */ (readPowers),
189
191
  entryCompartmentName,
190
192
  {
193
+ entryCompartmentName,
194
+ entryModuleSpecifier,
191
195
  compartmentDescriptors: compartmentMap.compartments,
192
196
  searchSuffixes,
193
- exitModuleImportNowHook,
197
+ importNowHook: exitModuleImportNowHook,
194
198
  },
195
199
  );
196
200
  ({ compartment, pendingJobsPromise } = link(compartmentMap, {
@@ -1 +1 @@
1
- {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["import.js"],"names":[],"mappings":";;;;;;;AAiDG,yCACQ,aAAa,kBACb,MAAM,WACN,kBAAkB,GAChB,OAAO,CAAC,WAAW,CAAC,CAChC;;;;;;;;AAGE,yCACQ,MAAM,GAAG,UAAU,kBACnB,MAAM,8CAEJ,OAAO,CAAC,WAAW,CAAC,CAChC;;;;;;;;;;;AAuDE,2CACQ,aAAa,kBACb,MAAM,WACN,yBAAyB,GACvB,OAAO,CAAC,UAAU,CAAC,CAE/B;;;;;;;;;;;AAKE,2CACQ,UAAU,GAAC,MAAM,kBACjB,MAAM,gDAEJ,OAAO,CAAC,UAAU,CAAC,CAE/B;mCA7GS,YAAY;wCAAZ,YAAY;iCAAZ,YAAY;4BAAZ,YAAY;gCAAZ,YAAY;yCAAZ,YAAY;+CAAZ,YAAY;gCAAZ,YAAY;2CAAZ,YAAY"}
1
+ {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["import.js"],"names":[],"mappings":";;;;;;;AAmDG,yCACQ,aAAa,kBACb,MAAM,WACN,kBAAkB,GAChB,OAAO,CAAC,WAAW,CAAC,CAChC;;;;;;;;AAGE,yCACQ,MAAM,GAAG,UAAU,kBACnB,MAAM,8CAEJ,OAAO,CAAC,WAAW,CAAC,CAChC;;;;;;;;;;;AAuDE,2CACQ,aAAa,kBACb,MAAM,WACN,yBAAyB,GACvB,OAAO,CAAC,UAAU,CAAC,CAE/B;;;;;;;;;;;AAKE,2CACQ,UAAU,GAAC,MAAM,kBACjB,MAAM,gDAEJ,OAAO,CAAC,UAAU,CAAC,CAE/B;mCA7GS,YAAY;wCAAZ,YAAY;iCAAZ,YAAY;4BAAZ,YAAY;gCAAZ,YAAY;yCAAZ,YAAY;+CAAZ,YAAY;gCAAZ,YAAY;2CAAZ,YAAY"}
package/src/import.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @module Provides functions for evaluating a module and its transitive
2
+ * Provides functions for evaluating a module and its transitive
3
3
  * dependencies given the URL of the entry module and assuming packages laid
4
4
  * out according to the `node_modules` conventions.
5
5
  *
@@ -9,6 +9,8 @@
9
9
  *
10
10
  * The default `parserForLanguage` is `import-parsers.js`, which is suitable
11
11
  * for most cases.
12
+ *
13
+ * @module
12
14
  */
13
15
 
14
16
  /**
@@ -1,9 +1,7 @@
1
- export function inferExportsEntries({ main, module, exports }: {
2
- main: string;
3
- module?: string | undefined;
4
- exports?: object;
5
- }, conditions: Set<string>, types: LanguageForExtension): Generator<string[], void, any>;
6
- export function inferExports(descriptor: object, conditions: Set<string>, types: LanguageForExtension): Record<string, string>;
7
- export function inferExportsAndAliases(descriptor: any, externalAliases: any, internalAliases: any, conditions: any, types: any): void;
1
+ export function inferExportsEntries({ main, module, exports }: PackageDescriptor, conditions: Set<string>, types: LanguageForExtension): Generator<string[], void, any>;
2
+ export function inferExports(descriptor: PackageDescriptor, conditions: Set<string>, types: LanguageForExtension): Record<string, string>;
3
+ export function inferExportsAndAliases(descriptor: PackageDescriptor, externalAliases: Node["externalAliases"], internalAliases: Node["internalAliases"], conditions: Set<string>, types: Record<string, string>): void;
4
+ import type { PackageDescriptor } from './types.js';
8
5
  import type { LanguageForExtension } from './types.js';
6
+ import type { Node } from './types/node-modules.js';
9
7
  //# sourceMappingURL=infer-exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"infer-exports.d.ts","sourceRoot":"","sources":["infer-exports.js"],"names":[],"mappings":"AAqHO,+DATJ;IAAkC,IAAI,EAA9B,MAAM;IACqB,MAAM;IACN,OAAO,GAAlC,MAAM;CACd,cAAQ,GAAG,CAAC,MAAM,CAAC,SAEX,oBAAoB,kCA2B9B;AAkBM,yCAPI,MAAM,cACN,GAAG,CAAC,MAAM,CAAC,SAEX,oBAAoB,GAElB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAG8B;AAE1D,uIA2CN;0CApMuC,YAAY"}
1
+ {"version":3,"file":"infer-exports.d.ts","sourceRoot":"","sources":["infer-exports.js"],"names":[],"mappings":"AA4HO,+DAPI,iBAAiB,cACjB,GAAG,CAAC,MAAM,CAAC,SAEX,oBAAoB,kCA2B9B;AAkBM,yCAPI,iBAAiB,cACjB,GAAG,CAAC,MAAM,CAAC,SAEX,oBAAoB,GAElB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAG8B;AAU1D,mDANI,iBAAiB,mBACjB,IAAI,CAAC,iBAAiB,CAAC,mBACvB,IAAI,CAAC,iBAAiB,CAAC,cACvB,GAAG,CAAC,MAAM,CAAC,SACX,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QA6ChC;uCAhNyD,YAAY;0CAAZ,YAAY;0BAC/C,yBAAyB"}
@@ -1,12 +1,17 @@
1
1
  /**
2
- * @module Provides functions needed by `node-modules.js` for building
2
+ * Provides functions needed by `node-modules.js` for building
3
3
  * inter-compartment linkage according to the specifications in a
4
4
  * `package.json` as laid out in the `node_modules` convention.
5
5
  * These functions implement the behavior for a package's `"main"`,
6
6
  * `"browser"`, `"imports"`, and `"exports"` properties in a `package.json`.
7
+ *
8
+ * @module
7
9
  */
8
10
 
9
- /** @import {LanguageForExtension} from './types.js' */
11
+ /**
12
+ * @import {LanguageForExtension, PackageDescriptor} from './types.js'
13
+ * @import {Node} from './types/node-modules.js'
14
+ */
10
15
 
11
16
  import { join, relativize } from './node-module-specifier.js';
12
17
 
@@ -81,7 +86,12 @@ function* interpretExports(name, exports, conditions) {
81
86
  );
82
87
  }
83
88
  for (const [key, value] of entries(exports)) {
84
- if (key.startsWith('./') || key === '.') {
89
+ // "./" is explicitly an invalid key, but that doesn't
90
+ // stop people from trying to use it.
91
+ if (key === './') {
92
+ // eslint-disable-next-line no-continue
93
+ continue; // or no-op
94
+ } else if (key.startsWith('./') || key === '.') {
85
95
  if (name === '.') {
86
96
  yield* interpretExports(key, value, conditions);
87
97
  } else {
@@ -105,10 +115,7 @@ function* interpretExports(name, exports, conditions) {
105
115
  * There may be multiple pairs for a single `name`, but they will be yielded in
106
116
  * ascending priority order, and the caller should use the last one that exists.
107
117
  *
108
- * @param {object} packageDescriptor - the parsed body of a package.json file.
109
- * @param {string} packageDescriptor.main
110
- * @param {string} [packageDescriptor.module]
111
- * @param {object} [packageDescriptor.exports]
118
+ * @param {PackageDescriptor} packageDescriptor - the parsed body of a package.json file.
112
119
  * @param {Set<string>} conditions - build conditions about the target environment
113
120
  * for selecting relevant exports, e.g., "browser" or "node".
114
121
  * @param {LanguageForExtension} types - an object to populate
@@ -149,7 +156,7 @@ export const inferExportsEntries = function* inferExportsEntries(
149
156
  * The values are the corresponding module specifiers in the dependency
150
157
  * package's module map, like `./index.js`.
151
158
  *
152
- * @param {object} descriptor - the parsed body of a package.json file.
159
+ * @param {PackageDescriptor} descriptor - the parsed body of a package.json file.
153
160
  * @param {Set<string>} conditions - build conditions about the target environment
154
161
  * for selecting relevant exports, e.g., "browser" or "node".
155
162
  * @param {LanguageForExtension} types - an object to populate
@@ -159,6 +166,14 @@ export const inferExportsEntries = function* inferExportsEntries(
159
166
  export const inferExports = (descriptor, conditions, types) =>
160
167
  fromEntries(inferExportsEntries(descriptor, conditions, types));
161
168
 
169
+ /**
170
+ *
171
+ * @param {PackageDescriptor} descriptor
172
+ * @param {Node['externalAliases']} externalAliases
173
+ * @param {Node['internalAliases']} internalAliases
174
+ * @param {Set<string>} conditions
175
+ * @param {Record<string, string>} types
176
+ */
162
177
  export const inferExportsAndAliases = (
163
178
  descriptor,
164
179
  externalAliases,
package/src/link.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["link.js"],"names":[],"mappings":"AAsPO,sEAJI,wBAAwB,WACxB,WAAW,GACT,UAAU,CA0KtB;AAOM,yCAJI,wBAAwB,WACxB,WAAW,eAIqB;8CA9YjC,YAAY;iCAAZ,YAAY;gCAAZ,YAAY"}
1
+ {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["link.js"],"names":[],"mappings":"AAwPO,sEAJI,wBAAwB,WACxB,WAAW,GACT,UAAU,CA2KtB;AAOM,yCAJI,wBAAwB,WACxB,WAAW,eAIqB;8CA/YjC,YAAY;iCAAZ,YAAY;gCAAZ,YAAY"}
package/src/link.js CHANGED
@@ -1,11 +1,13 @@
1
1
  /**
2
- * @module Provides the linking behavior shared by all Compartment Mapper
2
+ * Provides the linking behavior shared by all Compartment Mapper
3
3
  * workflows.
4
4
  * This involves creating and configuring compartments according to the
5
5
  * specifications in a compartment map, and is suitable for compartment maps
6
6
  * that just outline the locations of compartments and their inter-linkage and
7
7
  * also compartment maps that include every module descriptor in the transitive
8
8
  * dependencies of their entry module.
9
+ *
10
+ * @module
9
11
  */
10
12
 
11
13
  /**
@@ -344,6 +346,7 @@ export const link = (
344
346
  packageName: name,
345
347
  parse,
346
348
  compartments,
349
+ shouldDeferError,
347
350
  });
348
351
 
349
352
  const moduleMapHook = makeModuleMapHook(
@@ -1 +1 @@
1
- {"version":3,"file":"map-parser.d.ts","sourceRoot":"","sources":["map-parser.js"],"names":[],"mappings":"AA6SO,+FAHI,qBAAqB,GACnB,YAAY,CA+CxB;2CAvUS,YAAY;kCAAZ,YAAY"}
1
+ {"version":3,"file":"map-parser.d.ts","sourceRoot":"","sources":["map-parser.js"],"names":[],"mappings":"AA2VO,+FAHI,qBAAqB,GACnB,YAAY,CA+CxB;2CAnXS,YAAY;kCAAZ,YAAY"}
package/src/map-parser.js CHANGED
@@ -1,6 +1,8 @@
1
1
  /**
2
- * @module Exports {@link makeMapParsers}, which creates a function which matches a
2
+ * Exports {@link makeMapParsers}, which creates a function which matches a
3
3
  * module to a parser based on reasons.
4
+ *
5
+ * @module
4
6
  */
5
7
 
6
8
  /**
@@ -46,6 +48,48 @@ const has = (object, key) => apply(hasOwnProperty, object, [key]);
46
48
  */
47
49
  const extensionImpliesLanguage = extension => extension !== 'js';
48
50
 
51
+ /**
52
+ * Produces a `parser` that parses the content of a module according to the
53
+ * corresponding module language, given the extension of the module specifier
54
+ * and the configuration of the containing compartment. We do not yet support
55
+ * import assertions and we do not have a mechanism for validating the MIME type
56
+ * of the module content against the language implied by the extension or file
57
+ * name.
58
+ *
59
+ * @overload
60
+ * @param {true} preferSynchronous
61
+ * @param {Record<string, string>} languageForExtension - maps a file extension
62
+ * to the corresponding language.
63
+ * @param {Record<string, string>} languageForModuleSpecifier - In a rare case,
64
+ * the type of a module is implied by package.json and should not be inferred
65
+ * from its extension.
66
+ * @param {ParserForLanguage} parserForLanguage
67
+ * @param {ModuleTransforms} moduleTransforms
68
+ * @param {SyncModuleTransforms} syncModuleTransforms
69
+ * @returns {ParseFn}
70
+ */
71
+
72
+ /**
73
+ * Produces a `parser` that parses the content of a module according to the
74
+ * corresponding module language, given the extension of the module specifier
75
+ * and the configuration of the containing compartment. We do not yet support
76
+ * import assertions and we do not have a mechanism for validating the MIME type
77
+ * of the module content against the language implied by the extension or file
78
+ * name.
79
+ *
80
+ * @overload
81
+ * @param {false} preferSynchronous
82
+ * @param {Record<string, string>} languageForExtension - maps a file extension
83
+ * to the corresponding language.
84
+ * @param {Record<string, string>} languageForModuleSpecifier - In a rare case,
85
+ * the type of a module is implied by package.json and should not be inferred
86
+ * from its extension.
87
+ * @param {ParserForLanguage} parserForLanguage
88
+ * @param {ModuleTransforms} moduleTransforms
89
+ * @param {SyncModuleTransforms} syncModuleTransforms
90
+ * @returns {AsyncParseFn}
91
+ */
92
+
49
93
  /**
50
94
  * Produces a `parser` that parses the content of a module according to the
51
95
  * corresponding module language, given the extension of the module specifier
@@ -259,10 +303,12 @@ function mapParsers(
259
303
  languageForExtension,
260
304
  languageForModuleSpecifier,
261
305
  parserForLanguage,
262
- moduleTransforms = {},
263
- syncModuleTransforms = {},
264
- preferSynchronous = false,
306
+ moduleTransforms,
307
+ syncModuleTransforms,
308
+ preferSynchronous,
265
309
  ) {
310
+ moduleTransforms = moduleTransforms || {};
311
+ syncModuleTransforms = syncModuleTransforms || {};
266
312
  const languageForExtensionEntries = [];
267
313
  const problems = [];
268
314
  for (const [extension, language] of entries(languageForExtension)) {
@@ -276,7 +322,7 @@ function mapParsers(
276
322
  throw Error(`No parser available for language: ${problems.join(', ')}`);
277
323
  }
278
324
  return makeExtensionParser(
279
- preferSynchronous,
325
+ /** @type {any} */ (preferSynchronous),
280
326
  fromEntries(languageForExtensionEntries),
281
327
  languageForModuleSpecifier,
282
328
  parserForLanguage,
@@ -1 +1 @@
1
- {"version":3,"file":"node-module-specifier.d.ts","sourceRoot":"","sources":["node-module-specifier.js"],"names":[],"mappings":"AAwDO,8BAJI,MAAM,YACN,MAAM,GACJ,MAAM,CAiClB;AAeM,2BAJI,MAAM,QACN,MAAM,GACJ,MAAM,CA6BlB;AAaM,iCALI,MAAM,GAEJ,MAAM,CAclB"}
1
+ {"version":3,"file":"node-module-specifier.d.ts","sourceRoot":"","sources":["node-module-specifier.js"],"names":[],"mappings":"AA0DO,8BAJI,MAAM,YACN,MAAM,GACJ,MAAM,CAiClB;AAeM,2BAJI,MAAM,QACN,MAAM,GACJ,MAAM,CA6BlB;AAaM,iCALI,MAAM,GAEJ,MAAM,CAclB"}
@@ -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,54 +1,11 @@
1
- export function compartmentMapForNodeModules(readPowers: ReadFn | ReadPowers | MaybeReadPowers, packageLocation: string, conditionsOption: Set<string>, packageDescriptor: object, moduleSpecifier: string, options?: CompartmentMapForNodeModulesOptions | undefined): Promise<CompartmentMapDescriptor>;
2
- export function mapNodeModules(readPowers: ReadFn | ReadPowers | MaybeReadPowers, moduleLocation: string, options?: MapNodeModulesOptions | undefined): Promise<CompartmentMapDescriptor>;
3
- /**
4
- * The graph is an intermediate object model that the functions of this module
5
- * build by exploring the `node_modules` tree dropped by tools like npm and
6
- * consumed by tools like Node.js.
7
- * This gets translated finally into a compartment map.
8
- */
9
- export type Graph = Record<string, Node>;
10
- export type Node = {
11
- label: string;
12
- name: string;
13
- path: Array<string>;
14
- logicalPath: Array<string>;
15
- explicitExports: boolean;
16
- internalAliases: Record<string, string>;
17
- externalAliases: Record<string, string>;
18
- /**
19
- * - from module name to
20
- * location in storage.
21
- */
22
- dependencyLocations: Record<string, string>;
23
- /**
24
- * - the parser for
25
- * modules based on their extension.
26
- */
27
- parsers: LanguageForExtension;
28
- /**
29
- * - the parser for specific
30
- * modules.
31
- */
32
- types: Record<string, Language>;
33
- };
34
- export type LanguageOptions = {
35
- commonjsLanguageForExtension: LanguageForExtension;
36
- moduleLanguageForExtension: LanguageForExtension;
37
- workspaceCommonjsLanguageForExtension: LanguageForExtension;
38
- workspaceModuleLanguageForExtension: LanguageForExtension;
39
- languages: Set<string>;
40
- };
41
- export type CommonDependencyDescriptors = Record<string, {
42
- spec: string;
43
- alias: string;
44
- }>;
45
- export type ReadDescriptorFn = (packageLocation: string) => Promise<object>;
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): Promise<CompartmentMapDescriptor>;
3
+ export function mapNodeModules(readPowers: ReadFn | ReadPowers | MaybeReadPowers, moduleLocation: string, { tags, conditions, log, ...otherOptions }?: MapNodeModulesOptions): Promise<CompartmentMapDescriptor>;
46
4
  import type { ReadFn } from './types.js';
47
5
  import type { ReadPowers } from './types.js';
48
6
  import type { MaybeReadPowers } from './types.js';
7
+ import type { PackageDescriptor } from './types.js';
49
8
  import type { CompartmentMapForNodeModulesOptions } from './types.js';
50
9
  import type { CompartmentMapDescriptor } from './types.js';
51
10
  import type { MapNodeModulesOptions } from './types.js';
52
- import type { LanguageForExtension } from './types.js';
53
- import type { Language } from './types.js';
54
11
  //# sourceMappingURL=node-modules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-modules.d.ts","sourceRoot":"","sources":["node-modules.js"],"names":[],"mappings":"AAs2BO,yDARI,MAAM,GAAG,UAAU,GAAG,eAAe,mBACrC,MAAM,oBACN,GAAG,CAAC,MAAM,CAAC,qBACX,MAAM,mBACN,MAAM,8DAEJ,OAAO,CAAC,wBAAwB,CAAC,CA+D7C;AAQM,2CALI,MAAM,GAAG,UAAU,GAAG,eAAe,kBACrC,MAAM,gDAEJ,OAAO,CAAC,wBAAwB,CAAC,CA6B7C;;;;;;;oBA/5BY,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;;WAKnB,MAAM;UACN,MAAM;UACN,KAAK,CAAC,MAAM,CAAC;iBACb,KAAK,CAAC,MAAM,CAAC;qBACb,OAAO;qBACP,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;qBACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;yBACtB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;aAEtB,oBAAoB;;;;;WAEpB,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;;;kCAMxB,oBAAoB;gCACpB,oBAAoB;2CACpB,oBAAoB;yCACpB,oBAAoB;eACpB,GAAG,CAAC,MAAM,CAAC;;0CAIZ,MAAM,CAAC,MAAM,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC;iDA+E/C,MAAM,KACJ,OAAO,CAAC,MAAM,CAAC;4BAvHlB,YAAY;gCAAZ,YAAY;qCAAZ,YAAY;yDAAZ,YAAY;8CAAZ,YAAY;2CAAZ,YAAY;0CAAZ,YAAY;8BAAZ,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"}