@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.
- package/LICENSE +1 -1
- package/README.md +278 -111
- package/SECURITY.md +2 -2
- package/bundle.d.ts +1 -1
- package/bundle.js +4 -1
- package/functor-lite.d.ts +3 -0
- package/functor-lite.d.ts.map +1 -0
- package/functor-lite.js +4 -0
- package/functor.d.ts +3 -0
- package/functor.d.ts.map +1 -0
- package/functor.js +4 -0
- package/index.d.ts +1 -1
- package/index.js +4 -1
- package/package.json +15 -11
- package/script-lite.d.ts +3 -0
- package/script-lite.d.ts.map +1 -0
- package/script-lite.js +4 -0
- package/script.d.ts +3 -0
- package/script.d.ts.map +1 -0
- package/script.js +4 -0
- package/src/archive-lite.d.ts +5 -5
- package/src/archive-lite.d.ts.map +1 -1
- package/src/archive-lite.js +1 -1
- package/src/archive.d.ts +5 -5
- package/src/archive.d.ts.map +1 -1
- package/src/archive.js +3 -1
- package/src/bundle-cjs.d.ts +12 -2
- package/src/bundle-cjs.d.ts.map +1 -1
- package/src/bundle-cjs.js +57 -28
- package/src/bundle-json.d.ts.map +1 -1
- package/src/bundle-json.js +2 -3
- package/src/bundle-lite.d.ts +91 -0
- package/src/bundle-lite.d.ts.map +1 -0
- package/src/bundle-lite.js +667 -0
- package/src/bundle-mjs.d.ts +13 -3
- package/src/bundle-mjs.d.ts.map +1 -1
- package/src/bundle-mjs.js +36 -19
- package/src/bundle.d.ts +48 -10
- package/src/bundle.d.ts.map +1 -1
- package/src/bundle.js +392 -126
- package/src/capture-lite.d.ts +1 -1
- package/src/capture-lite.d.ts.map +1 -1
- package/src/capture-lite.js +4 -2
- package/src/compartment-map.d.ts +1 -1
- package/src/compartment-map.d.ts.map +1 -1
- package/src/import-archive-lite.d.ts +2 -2
- package/src/import-archive-lite.d.ts.map +1 -1
- package/src/import-archive-lite.js +3 -1
- package/src/import-archive.d.ts +3 -3
- package/src/import-archive.d.ts.map +1 -1
- package/src/import-archive.js +3 -1
- package/src/import-hook.d.ts +3 -16
- package/src/import-hook.d.ts.map +1 -1
- package/src/import-hook.js +214 -116
- package/src/import-lite.d.ts +1 -1
- package/src/import-lite.d.ts.map +1 -1
- package/src/import-lite.js +7 -3
- package/src/import.d.ts.map +1 -1
- package/src/import.js +3 -1
- package/src/infer-exports.d.ts +5 -7
- package/src/infer-exports.d.ts.map +1 -1
- package/src/infer-exports.js +23 -8
- package/src/link.d.ts.map +1 -1
- package/src/link.js +4 -1
- package/src/map-parser.d.ts.map +1 -1
- package/src/map-parser.js +51 -5
- package/src/node-module-specifier.d.ts.map +1 -1
- package/src/node-module-specifier.js +3 -1
- package/src/node-modules.d.ts +4 -47
- package/src/node-modules.d.ts.map +1 -1
- package/src/node-modules.js +267 -148
- package/src/node-powers.d.ts +1 -1
- package/src/node-powers.d.ts.map +1 -1
- package/src/node-powers.js +3 -1
- package/src/parse-archive-cjs.d.ts +5 -1
- package/src/parse-archive-cjs.d.ts.map +1 -1
- package/src/parse-archive-cjs.js +11 -4
- package/src/parse-archive-mjs.d.ts +5 -1
- package/src/parse-archive-mjs.d.ts.map +1 -1
- package/src/parse-archive-mjs.js +3 -1
- package/src/parse-bytes.d.ts +5 -1
- package/src/parse-bytes.d.ts.map +1 -1
- package/src/parse-bytes.js +3 -1
- package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
- package/src/parse-cjs-shared-export-wrapper.js +5 -11
- package/src/parse-cjs.d.ts +5 -1
- package/src/parse-cjs.d.ts.map +1 -1
- package/src/parse-cjs.js +4 -2
- package/src/parse-json.d.ts +5 -2
- package/src/parse-json.d.ts.map +1 -1
- package/src/parse-mjs.d.ts +5 -1
- package/src/parse-mjs.d.ts.map +1 -1
- package/src/parse-mjs.js +2 -2
- package/src/parse-pre-cjs.d.ts +5 -1
- package/src/parse-pre-cjs.d.ts.map +1 -1
- package/src/parse-pre-cjs.js +3 -1
- package/src/parse-pre-mjs.d.ts +5 -1
- package/src/parse-pre-mjs.d.ts.map +1 -1
- package/src/parse-pre-mjs.js +3 -1
- package/src/parse-text.d.ts +5 -1
- package/src/parse-text.d.ts.map +1 -1
- package/src/parse-text.js +3 -1
- package/src/policy-format.d.ts +2 -1
- package/src/policy-format.d.ts.map +1 -1
- package/src/policy-format.js +5 -2
- package/src/policy.d.ts +2 -2
- package/src/policy.d.ts.map +1 -1
- package/src/policy.js +10 -11
- package/src/powers.d.ts +1 -1
- package/src/powers.d.ts.map +1 -1
- package/src/powers.js +3 -1
- package/src/search.d.ts +7 -12
- package/src/search.d.ts.map +1 -1
- package/src/search.js +32 -13
- package/src/types/compartment-map-schema.d.ts +8 -1
- package/src/types/compartment-map-schema.d.ts.map +1 -1
- package/src/types/compartment-map-schema.ts +8 -1
- package/src/types/external.d.ts +127 -17
- package/src/types/external.d.ts.map +1 -1
- package/src/types/external.ts +142 -17
- package/src/types/internal.d.ts +116 -29
- package/src/types/internal.d.ts.map +1 -1
- package/src/types/internal.ts +144 -31
- package/src/types/node-modules.d.ts +79 -0
- package/src/types/node-modules.d.ts.map +1 -0
- package/src/types/node-modules.ts +89 -0
- package/src/types/node-powers.d.ts +7 -5
- package/src/types/node-powers.d.ts.map +1 -1
- package/src/types/node-powers.ts +7 -5
- package/src/types/policy-schema.d.ts +3 -1
- package/src/types/policy-schema.d.ts.map +1 -1
- package/src/types/policy-schema.ts +3 -1
- package/src/types/policy.d.ts +3 -1
- package/src/types/policy.d.ts.map +1 -1
- package/src/types/policy.ts +3 -1
- package/src/types/powers.d.ts +5 -3
- package/src/types/powers.d.ts.map +1 -1
- package/src/types/powers.ts +5 -3
- package/src/types/typescript.d.ts +3 -1
- package/src/types/typescript.d.ts.map +1 -1
- package/src/types/typescript.ts +3 -1
- package/src/url.d.ts.map +1 -1
- package/src/url.js +3 -1
package/src/import-lite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
-
|
|
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, {
|
package/src/import.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["import.js"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["import.js"],"names":[],"mappings":";;;;;;;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
|
-
*
|
|
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
|
/**
|
package/src/infer-exports.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
export function inferExportsEntries({ main, module, exports }:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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":"
|
|
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"}
|
package/src/infer-exports.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
|
|
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 {
|
|
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 {
|
|
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":"
|
|
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
|
-
*
|
|
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(
|
package/src/map-parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-parser.d.ts","sourceRoot":"","sources":["map-parser.js"],"names":[],"mappings":"
|
|
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
|
-
*
|
|
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
|
|
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":"
|
|
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
|
-
*
|
|
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.
|
package/src/node-modules.d.ts
CHANGED
|
@@ -1,54 +1,11 @@
|
|
|
1
|
-
export function
|
|
2
|
-
export function
|
|
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":"
|
|
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"}
|