@endo/compartment-mapper 1.6.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -16
- package/src/archive-lite.d.ts +7 -7
- package/src/archive-lite.d.ts.map +1 -1
- package/src/archive-lite.js +78 -27
- package/src/archive.d.ts.map +1 -1
- package/src/archive.js +7 -0
- package/src/bundle-lite.d.ts +3 -3
- package/src/bundle-lite.d.ts.map +1 -1
- package/src/bundle-lite.js +19 -24
- package/src/bundle.d.ts +3 -3
- package/src/bundle.d.ts.map +1 -1
- package/src/bundle.js +19 -24
- package/src/capture-lite.d.ts +2 -2
- package/src/capture-lite.d.ts.map +1 -1
- package/src/capture-lite.js +217 -25
- package/src/compartment-map.d.ts +9 -2
- package/src/compartment-map.d.ts.map +1 -1
- package/src/compartment-map.js +737 -254
- package/src/digest.d.ts +22 -2
- package/src/digest.d.ts.map +1 -1
- package/src/digest.js +179 -56
- package/src/generic-graph.d.ts.map +1 -1
- package/src/generic-graph.js +8 -3
- package/src/guards.d.ts +18 -0
- package/src/guards.d.ts.map +1 -0
- package/src/guards.js +109 -0
- package/src/hooks.md +124 -0
- package/src/import-archive-lite.d.ts.map +1 -1
- package/src/import-archive-lite.js +15 -11
- package/src/import-archive.d.ts +5 -19
- package/src/import-archive.d.ts.map +1 -1
- package/src/import-archive.js +7 -27
- package/src/import-hook.d.ts +4 -3
- package/src/import-hook.d.ts.map +1 -1
- package/src/import-hook.js +138 -69
- package/src/import-lite.d.ts +6 -6
- package/src/import-lite.d.ts.map +1 -1
- package/src/import-lite.js +8 -5
- package/src/import.d.ts +3 -3
- package/src/import.d.ts.map +1 -1
- package/src/import.js +16 -6
- package/src/infer-exports.d.ts.map +1 -1
- package/src/infer-exports.js +16 -6
- package/src/link.d.ts +4 -3
- package/src/link.d.ts.map +1 -1
- package/src/link.js +70 -58
- package/src/node-modules.d.ts +4 -3
- package/src/node-modules.d.ts.map +1 -1
- package/src/node-modules.js +482 -114
- package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
- package/src/parse-cjs-shared-export-wrapper.js +3 -1
- package/src/policy-format.d.ts +22 -5
- package/src/policy-format.d.ts.map +1 -1
- package/src/policy-format.js +342 -108
- package/src/policy.d.ts +13 -28
- package/src/policy.d.ts.map +1 -1
- package/src/policy.js +161 -106
- package/src/types/canonical-name.d.ts +97 -0
- package/src/types/canonical-name.d.ts.map +1 -0
- package/src/types/canonical-name.ts +151 -0
- package/src/types/compartment-map-schema.d.ts +114 -35
- package/src/types/compartment-map-schema.d.ts.map +1 -1
- package/src/types/compartment-map-schema.ts +202 -37
- package/src/types/external.d.ts +168 -28
- package/src/types/external.d.ts.map +1 -1
- package/src/types/external.ts +215 -26
- package/src/types/internal.d.ts +23 -42
- package/src/types/internal.d.ts.map +1 -1
- package/src/types/internal.ts +51 -50
- package/src/types/node-modules.d.ts +71 -10
- package/src/types/node-modules.d.ts.map +1 -1
- package/src/types/node-modules.ts +107 -9
- package/src/types/policy-schema.d.ts +26 -11
- package/src/types/policy-schema.d.ts.map +1 -1
- package/src/types/policy-schema.ts +29 -16
- package/src/types/policy.d.ts +6 -2
- package/src/types/policy.d.ts.map +1 -1
- package/src/types/policy.ts +7 -2
- package/src/types/typescript.d.ts +28 -0
- package/src/types/typescript.d.ts.map +1 -1
- package/src/types/typescript.ts +37 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fairly exhaustive, excruciatingly pedantic _type-level_ helpers for
|
|
3
|
+
* representing and validating **Canonical Names** and npm package names.
|
|
4
|
+
*
|
|
5
|
+
* A {@link CanonicalName | Canonical Name} is a string containing one or more
|
|
6
|
+
* npm package names (scoped or unscoped) delimited by a `>` character.
|
|
7
|
+
*
|
|
8
|
+
* The following rules about npm package names are enforced:
|
|
9
|
+
*
|
|
10
|
+
* - ✅ Length > 0
|
|
11
|
+
* - ✅ Can contain hyphens
|
|
12
|
+
* - ✅ No leading `.` or `_`
|
|
13
|
+
* - ✅ No spaces
|
|
14
|
+
* - ✅ No `~)('!*` characters
|
|
15
|
+
*
|
|
16
|
+
* The following rules are not enforced:
|
|
17
|
+
*
|
|
18
|
+
* - ❌ All lowercase - Not feasible due to recursion limits & legacy package
|
|
19
|
+
* names
|
|
20
|
+
* - ❌ Not a reserved name - unmaintainable list of node builtin module names
|
|
21
|
+
* - ❌ Length ≤ 214 - Not feasible due to recursion limits & legacy package
|
|
22
|
+
* names
|
|
23
|
+
*
|
|
24
|
+
* "Legacy" package names may contain uppercase letters and be longer than 214
|
|
25
|
+
* characters.
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
* @see {@link https://www.npmjs.com/package/validate-npm-package-name}
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Characters that are explicitly forbidden in npm package names. These include:
|
|
33
|
+
* ` `, `~`, `)`, `(`, `'`, `!`, `*`
|
|
34
|
+
*
|
|
35
|
+
* We check each one individually because TypeScript's template literal types
|
|
36
|
+
* can detect if a string contains a specific substring.
|
|
37
|
+
*
|
|
38
|
+
* Returns `true` if the string contains a forbidden character, `false`
|
|
39
|
+
* otherwise.
|
|
40
|
+
*/
|
|
41
|
+
type ContainsForbiddenChar<S extends string> = S extends
|
|
42
|
+
| `${string} ${string}`
|
|
43
|
+
| `${string}~${string}`
|
|
44
|
+
| `${string})${string}`
|
|
45
|
+
| `${string}(${string}`
|
|
46
|
+
| `${string}'${string}`
|
|
47
|
+
| `${string}!${string}`
|
|
48
|
+
| `${string}*${string}`
|
|
49
|
+
? true
|
|
50
|
+
: false;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Validates that a string doesn't start with `.` or `_`.
|
|
54
|
+
*
|
|
55
|
+
* Returns `true` if the string doesn't start with `.` or `_`, `false`
|
|
56
|
+
* otherwise.
|
|
57
|
+
*/
|
|
58
|
+
type HasValidStart<S extends string> = S extends `.${string}` | `_${string}`
|
|
59
|
+
? false
|
|
60
|
+
: true;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Validates that a string is non-empty.
|
|
64
|
+
*
|
|
65
|
+
* Returns `true` if the string is non-empty, `false` otherwise.
|
|
66
|
+
*/
|
|
67
|
+
type IsNonEmpty<S extends string> = S extends '' ? false : true;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Combines all validation checks for a package name segment.
|
|
71
|
+
*
|
|
72
|
+
* Returns `true` if the string passes all checks, `false` otherwise.
|
|
73
|
+
*/
|
|
74
|
+
type IsValidPackageNameSegment<S extends string> =
|
|
75
|
+
IsNonEmpty<S> extends false
|
|
76
|
+
? false
|
|
77
|
+
: HasValidStart<S> extends false
|
|
78
|
+
? false
|
|
79
|
+
: ContainsForbiddenChar<S> extends true
|
|
80
|
+
? false
|
|
81
|
+
: true;
|
|
82
|
+
|
|
83
|
+
// ============================================================================
|
|
84
|
+
// Scoped and Unscoped Package Names
|
|
85
|
+
// ============================================================================
|
|
86
|
+
|
|
87
|
+
/** A scoped npm package name, like "@scope/pkg" */
|
|
88
|
+
export type ScopedPackageName<S extends string = string> =
|
|
89
|
+
S extends `@${infer Scope}/${infer Name}`
|
|
90
|
+
? IsValidPackageNameSegment<Scope> extends true
|
|
91
|
+
? IsValidPackageNameSegment<Name> extends true
|
|
92
|
+
? S
|
|
93
|
+
: never
|
|
94
|
+
: never
|
|
95
|
+
: never;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* An unscoped npm package name.
|
|
99
|
+
*
|
|
100
|
+
* Must pass all validation checks and must not contain a `/` (which would
|
|
101
|
+
* indicate a scoped package or a subpath).
|
|
102
|
+
*
|
|
103
|
+
* Note: Package names containing uppercase letters are technically invalid per
|
|
104
|
+
* npm rules, but they exist in the wild. TypeScript cannot reliably validate
|
|
105
|
+
* case at the type level, so we don't enforce this.
|
|
106
|
+
*/
|
|
107
|
+
export type UnscopedPackageName<S extends string = string> =
|
|
108
|
+
S extends `${string}/${string}`
|
|
109
|
+
? never
|
|
110
|
+
: IsValidPackageNameSegment<S> extends true
|
|
111
|
+
? S
|
|
112
|
+
: never;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* A scoped or unscoped npm package name.
|
|
116
|
+
*/
|
|
117
|
+
export type NpmPackageName<S extends string = string> =
|
|
118
|
+
S extends `@${string}/${string}`
|
|
119
|
+
? ScopedPackageName<S>
|
|
120
|
+
: UnscopedPackageName<S>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Split a string on `>`—the canonical name delimiter—into a tuple of segments.
|
|
124
|
+
*/
|
|
125
|
+
export type SplitOnDelimiter<S extends string> =
|
|
126
|
+
S extends `${infer Head}>${infer Tail}`
|
|
127
|
+
? [Head, ...SplitOnDelimiter<Tail>]
|
|
128
|
+
: [S];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Validate that every element in a tuple of strings is a valid npm package
|
|
132
|
+
* name.
|
|
133
|
+
*/
|
|
134
|
+
export type AllValidPackageNames<Parts extends readonly string[]> =
|
|
135
|
+
Parts extends [
|
|
136
|
+
infer Head extends string,
|
|
137
|
+
...infer Tail extends readonly string[],
|
|
138
|
+
]
|
|
139
|
+
? NpmPackageName<Head> extends never
|
|
140
|
+
? never
|
|
141
|
+
: AllValidPackageNames<Tail>
|
|
142
|
+
: Parts;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* A Canonical Name string comprised of one or more npm package names separated
|
|
146
|
+
* by `>` (e.g., `foo`, `@scope/foo>bar`, `foo>@scope/bar>baz`).
|
|
147
|
+
*
|
|
148
|
+
* When given a string literal type, invalid shapes narrow to `never`.
|
|
149
|
+
*/
|
|
150
|
+
export type CanonicalName<S extends string = string> =
|
|
151
|
+
AllValidPackageNames<SplitOnDelimiter<S>> extends never ? never : S;
|
|
@@ -5,76 +5,150 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module
|
|
7
7
|
*/
|
|
8
|
+
import type { ATTENUATORS_COMPARTMENT, ENTRY_COMPARTMENT } from '../policy-format.js';
|
|
9
|
+
import type { CanonicalName } from './canonical-name.js';
|
|
10
|
+
import type { FileUrlString } from './external.js';
|
|
8
11
|
import type { SomePackagePolicy } from './policy-schema.js';
|
|
9
12
|
import type { LiteralUnion } from './typescript.js';
|
|
13
|
+
/**
|
|
14
|
+
* The type of a {@link CompartmentMapDescriptor.compartments} property.
|
|
15
|
+
*/
|
|
16
|
+
export type CompartmentDescriptors<T extends CompartmentDescriptor = CompartmentDescriptor, K extends string = string> = Record<K, T>;
|
|
10
17
|
/**
|
|
11
18
|
* A compartment map describes how to construct an application as a graph of
|
|
12
19
|
* Compartments, each corresponding to Node.js style packaged modules.
|
|
13
20
|
*/
|
|
14
|
-
export type CompartmentMapDescriptor = {
|
|
21
|
+
export type CompartmentMapDescriptor<T extends CompartmentDescriptor = CompartmentDescriptor, Name extends string = string, EntryName extends string = Name> = {
|
|
15
22
|
tags: Array<string>;
|
|
16
|
-
entry: EntryDescriptor
|
|
17
|
-
compartments:
|
|
23
|
+
entry: EntryDescriptor<EntryName>;
|
|
24
|
+
compartments: CompartmentDescriptors<T, Name>;
|
|
18
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* The type of a {@link PackageCompartmentMapDescriptor.compartments} property.
|
|
28
|
+
*/
|
|
29
|
+
export type PackageCompartmentDescriptors = CompartmentDescriptors<PackageCompartmentDescriptor, PackageCompartmentDescriptorName>;
|
|
30
|
+
/**
|
|
31
|
+
* The {@link CompartmentDescriptor} type in the
|
|
32
|
+
* {@link PackageCompartmentMapDescriptor} returned by `mapNodeModules()`
|
|
33
|
+
*/
|
|
34
|
+
export type PackageCompartmentMapDescriptor = CompartmentMapDescriptor<PackageCompartmentDescriptor, PackageCompartmentDescriptorName, FileUrlString>;
|
|
35
|
+
export interface FileCompartmentDescriptor extends CompartmentDescriptor<FileModuleConfiguration | CompartmentModuleConfiguration> {
|
|
36
|
+
location: FileUrlString;
|
|
37
|
+
}
|
|
38
|
+
export type FileCompartmentDescriptors = CompartmentDescriptors<FileCompartmentDescriptor>;
|
|
39
|
+
export type FileCompartmentMapDescriptor = CompartmentMapDescriptor<FileCompartmentDescriptor>;
|
|
19
40
|
/**
|
|
20
41
|
* The entry descriptor of a compartment map denotes the root module of an
|
|
21
42
|
* application and the compartment that contains it.
|
|
22
43
|
*/
|
|
23
|
-
export type EntryDescriptor = {
|
|
24
|
-
compartment:
|
|
44
|
+
export type EntryDescriptor<K extends string = string> = {
|
|
45
|
+
compartment: K;
|
|
25
46
|
module: string;
|
|
26
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Keys of {@link PackageCompartmentMapDescriptor.compartments}
|
|
50
|
+
*/
|
|
51
|
+
export type PackageCompartmentDescriptorName = LiteralUnion<typeof ATTENUATORS_COMPARTMENT, FileUrlString>;
|
|
52
|
+
export interface PackageCompartmentDescriptor extends CompartmentDescriptor<CompartmentModuleConfiguration> {
|
|
53
|
+
label: LiteralUnion<typeof ATTENUATORS_COMPARTMENT | typeof ENTRY_COMPARTMENT, string>;
|
|
54
|
+
version: string;
|
|
55
|
+
location: PackageCompartmentDescriptorName;
|
|
56
|
+
name: LiteralUnion<typeof ATTENUATORS_COMPARTMENT | typeof ENTRY_COMPARTMENT, string>;
|
|
57
|
+
scopes: Record<string, ScopeDescriptor<PackageCompartmentDescriptorName>>;
|
|
58
|
+
sourceDirname: string;
|
|
59
|
+
}
|
|
27
60
|
/**
|
|
28
61
|
* A compartment descriptor corresponds to a single Compartment
|
|
29
62
|
* of an assembled Application and describes how to construct
|
|
30
63
|
* one for a given library or application `package.json`.
|
|
31
64
|
*/
|
|
32
|
-
export
|
|
33
|
-
label:
|
|
34
|
-
/**
|
|
35
|
-
* name of the parent directory of the package from which the compartment is derived,
|
|
36
|
-
* for purposes of generating sourceURL comments that are most likely to unite with the original sources in an IDE workspace.
|
|
37
|
-
*/
|
|
38
|
-
sourceDirname?: string;
|
|
39
|
-
/** shortest path of dependency names to this compartment */
|
|
40
|
-
path?: Array<string>;
|
|
65
|
+
export interface CompartmentDescriptor<T extends ModuleConfiguration = ModuleConfiguration, U extends string = string> {
|
|
66
|
+
label: CanonicalName<U>;
|
|
41
67
|
/**
|
|
42
68
|
* the name of the originating package suitable for constructing a sourceURL
|
|
43
69
|
* prefix that will match it to files in a developer workspace.
|
|
44
70
|
*/
|
|
45
71
|
name: string;
|
|
72
|
+
modules: Record<string, T>;
|
|
73
|
+
scopes?: Record<string, ScopeDescriptor>;
|
|
74
|
+
/** language for extension */
|
|
75
|
+
parsers?: LanguageForExtension;
|
|
76
|
+
/** language for module specifier */
|
|
77
|
+
types?: LanguageForModuleSpecifier;
|
|
78
|
+
/** policy specific to compartment */
|
|
79
|
+
policy?: SomePackagePolicy;
|
|
46
80
|
location: string;
|
|
81
|
+
/**
|
|
82
|
+
* name of the parent directory of the package from which the compartment is derived,
|
|
83
|
+
* for purposes of generating sourceURL comments that are most likely to unite with the original sources in an IDE workspace.
|
|
84
|
+
*/
|
|
85
|
+
sourceDirname?: string;
|
|
47
86
|
/**
|
|
48
87
|
* whether this compartment was retained by any module in the solution. This
|
|
49
88
|
* property should never appear in an archived compartment map.
|
|
50
89
|
*/
|
|
51
|
-
retained?:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
/** language for extension */
|
|
55
|
-
parsers: LanguageForExtension;
|
|
56
|
-
/** language for module specifier */
|
|
57
|
-
types: LanguageForModuleSpecifier;
|
|
58
|
-
/** policy specific to compartment */
|
|
90
|
+
retained?: true;
|
|
91
|
+
}
|
|
92
|
+
export type CompartmentDescriptorWithPolicy<T extends ModuleConfiguration = ModuleConfiguration> = Omit<CompartmentDescriptor<T>, 'policy'> & {
|
|
59
93
|
policy: SomePackagePolicy;
|
|
60
|
-
/** List of compartment names this Compartment depends upon */
|
|
61
|
-
compartments: Set<string>;
|
|
62
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* A compartment descriptor digested by `digestCompartmentMap()`
|
|
97
|
+
*/
|
|
98
|
+
export interface DigestedCompartmentDescriptor extends CompartmentDescriptor<ModuleConfiguration> {
|
|
99
|
+
path: never;
|
|
100
|
+
retained: never;
|
|
101
|
+
scopes: never;
|
|
102
|
+
parsers: never;
|
|
103
|
+
types: never;
|
|
104
|
+
__createdBy: never;
|
|
105
|
+
sourceDirname: never;
|
|
106
|
+
}
|
|
107
|
+
export type DigestedCompartmentDescriptors = CompartmentDescriptors<DigestedCompartmentDescriptor>;
|
|
108
|
+
export type DigestedCompartmentMapDescriptor = CompartmentMapDescriptor<DigestedCompartmentDescriptor>;
|
|
63
109
|
/**
|
|
64
110
|
* For every module explicitly mentioned in an `exports` field of a
|
|
65
|
-
* `package.json`, there is a corresponding
|
|
111
|
+
* `package.json`, there is a corresponding `ModuleConfiguration`.
|
|
66
112
|
*/
|
|
67
|
-
export type
|
|
68
|
-
|
|
69
|
-
|
|
113
|
+
export type ModuleConfiguration = ErrorModuleConfiguration | ExitModuleConfiguration | FileModuleConfiguration | CompartmentModuleConfiguration;
|
|
114
|
+
export type ModuleConfigurationCreator = 'link' | 'transform' | 'import-hook' | 'digest' | 'node-modules';
|
|
115
|
+
export interface BaseModuleConfiguration {
|
|
116
|
+
deferredError?: string;
|
|
117
|
+
retained?: true;
|
|
118
|
+
__createdBy?: ModuleConfigurationCreator;
|
|
119
|
+
}
|
|
120
|
+
export interface ErrorModuleConfiguration extends BaseModuleConfiguration {
|
|
121
|
+
deferredError: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* This module configuration is a reference to another module in a a compartment descriptor (it may be the same compartment descriptor)
|
|
125
|
+
*/
|
|
126
|
+
export interface CompartmentModuleConfiguration extends BaseModuleConfiguration {
|
|
127
|
+
/**
|
|
128
|
+
* The name of the compartment that contains this module.
|
|
129
|
+
*/
|
|
130
|
+
compartment: LiteralUnion<typeof ATTENUATORS_COMPARTMENT, FileUrlString>;
|
|
131
|
+
/**
|
|
132
|
+
* The module name within {@link CompartmentDescriptor.modules} of the
|
|
133
|
+
* `CompartmentDescriptor` referred to by {@link compartment}
|
|
134
|
+
*/
|
|
135
|
+
module: string;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A module configuration representing an exit module
|
|
139
|
+
*/
|
|
140
|
+
export interface ExitModuleConfiguration extends BaseModuleConfiguration {
|
|
141
|
+
exit: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A module configuration representing a file on disk
|
|
145
|
+
*/
|
|
146
|
+
export interface FileModuleConfiguration extends BaseModuleConfiguration {
|
|
70
147
|
location?: string;
|
|
71
|
-
parser
|
|
148
|
+
parser: Language;
|
|
72
149
|
/** in base 16, hex */
|
|
73
150
|
sha512?: string;
|
|
74
|
-
|
|
75
|
-
deferredError?: string;
|
|
76
|
-
retained?: boolean;
|
|
77
|
-
};
|
|
151
|
+
}
|
|
78
152
|
/**
|
|
79
153
|
* Scope descriptors link all names under a prefix to modules in another
|
|
80
154
|
* compartment, like a wildcard.
|
|
@@ -82,8 +156,11 @@ export type ModuleDescriptor = {
|
|
|
82
156
|
* in a `package.json` file, when that `package.json` file does not have
|
|
83
157
|
* an explicit `exports` map.
|
|
84
158
|
*/
|
|
85
|
-
export type ScopeDescriptor = {
|
|
86
|
-
|
|
159
|
+
export type ScopeDescriptor<T extends string = string> = {
|
|
160
|
+
/**
|
|
161
|
+
* A compartment name; not a `Compartment`.
|
|
162
|
+
*/
|
|
163
|
+
compartment: T;
|
|
87
164
|
module?: string;
|
|
88
165
|
};
|
|
89
166
|
/**
|
|
@@ -102,4 +179,6 @@ export type LanguageForExtension = Record<string, Language>;
|
|
|
102
179
|
* Mapping of module specifier to {@link Language Languages}.
|
|
103
180
|
*/
|
|
104
181
|
export type LanguageForModuleSpecifier = Record<string, Language>;
|
|
182
|
+
export type ModuleConfigurationKind = 'file' | 'compartment' | 'exit' | 'error';
|
|
183
|
+
export type ModuleConfigurationKindToType<T extends ModuleConfigurationKind> = T extends 'file' ? FileModuleConfiguration : T extends 'compartment' ? CompartmentModuleConfiguration : T extends 'exit' ? ExitModuleConfiguration : T extends 'error' ? ErrorModuleConfiguration : never;
|
|
105
184
|
//# sourceMappingURL=compartment-map-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compartment-map-schema.d.ts","sourceRoot":"","sources":["compartment-map-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;
|
|
1
|
+
{"version":3,"file":"compartment-map-schema.d.ts","sourceRoot":"","sources":["compartment-map-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,sBAAsB,CAChC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,EACvD,CAAC,SAAS,MAAM,GAAG,MAAM,IACvB,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjB;;;GAGG;AACH,MAAM,MAAM,wBAAwB,CAClC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,EACvD,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,SAAS,SAAS,MAAM,GAAG,IAAI,IAC7B;IACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACpB,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAClC,YAAY,EAAE,sBAAsB,CAAC,CAAC,EAA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AM,EAAE,QAAQ,CAAC,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,aAAa,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhF,MAAM,MAAM,6BAA6B,CAAC,CAAC,SAAS,uBAAuB,IACzE,CAAC,SAAS,MAAM,GACZ,uBAAuB,GACvB,CAAC,SAAS,aAAa,GACrB,8BAA8B,GAC9B,CAAC,SAAS,MAAM,GACd,uBAAuB,GACvB,CAAC,SAAS,OAAO,GACf,wBAAwB,GACxB,KAAK,CAAC"}
|
|
@@ -8,80 +8,229 @@
|
|
|
8
8
|
|
|
9
9
|
/* eslint-disable no-use-before-define */
|
|
10
10
|
|
|
11
|
+
import type {
|
|
12
|
+
ATTENUATORS_COMPARTMENT,
|
|
13
|
+
ENTRY_COMPARTMENT,
|
|
14
|
+
} from '../policy-format.js';
|
|
15
|
+
import type { CanonicalName } from './canonical-name.js';
|
|
16
|
+
import type { FileUrlString } from './external.js';
|
|
11
17
|
import type { SomePackagePolicy } from './policy-schema.js';
|
|
12
18
|
import type { LiteralUnion } from './typescript.js';
|
|
13
19
|
|
|
20
|
+
/**
|
|
21
|
+
* The type of a {@link CompartmentMapDescriptor.compartments} property.
|
|
22
|
+
*/
|
|
23
|
+
export type CompartmentDescriptors<
|
|
24
|
+
T extends CompartmentDescriptor = CompartmentDescriptor,
|
|
25
|
+
K extends string = string,
|
|
26
|
+
> = Record<K, T>;
|
|
27
|
+
|
|
14
28
|
/**
|
|
15
29
|
* A compartment map describes how to construct an application as a graph of
|
|
16
30
|
* Compartments, each corresponding to Node.js style packaged modules.
|
|
17
31
|
*/
|
|
18
|
-
export type CompartmentMapDescriptor
|
|
32
|
+
export type CompartmentMapDescriptor<
|
|
33
|
+
T extends CompartmentDescriptor = CompartmentDescriptor,
|
|
34
|
+
Name extends string = string,
|
|
35
|
+
EntryName extends string = Name,
|
|
36
|
+
> = {
|
|
19
37
|
tags: Array<string>;
|
|
20
|
-
entry: EntryDescriptor
|
|
21
|
-
compartments:
|
|
38
|
+
entry: EntryDescriptor<EntryName>;
|
|
39
|
+
compartments: CompartmentDescriptors<T, Name>;
|
|
22
40
|
};
|
|
23
41
|
|
|
42
|
+
/**
|
|
43
|
+
* The type of a {@link PackageCompartmentMapDescriptor.compartments} property.
|
|
44
|
+
*/
|
|
45
|
+
export type PackageCompartmentDescriptors = CompartmentDescriptors<
|
|
46
|
+
PackageCompartmentDescriptor,
|
|
47
|
+
PackageCompartmentDescriptorName
|
|
48
|
+
>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The {@link CompartmentDescriptor} type in the
|
|
52
|
+
* {@link PackageCompartmentMapDescriptor} returned by `mapNodeModules()`
|
|
53
|
+
*/
|
|
54
|
+
export type PackageCompartmentMapDescriptor = CompartmentMapDescriptor<
|
|
55
|
+
PackageCompartmentDescriptor,
|
|
56
|
+
PackageCompartmentDescriptorName,
|
|
57
|
+
FileUrlString
|
|
58
|
+
>;
|
|
59
|
+
|
|
60
|
+
export interface FileCompartmentDescriptor
|
|
61
|
+
extends CompartmentDescriptor<
|
|
62
|
+
FileModuleConfiguration | CompartmentModuleConfiguration
|
|
63
|
+
> {
|
|
64
|
+
location: FileUrlString;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type FileCompartmentDescriptors =
|
|
68
|
+
CompartmentDescriptors<FileCompartmentDescriptor>;
|
|
69
|
+
|
|
70
|
+
export type FileCompartmentMapDescriptor =
|
|
71
|
+
CompartmentMapDescriptor<FileCompartmentDescriptor>;
|
|
72
|
+
|
|
24
73
|
/**
|
|
25
74
|
* The entry descriptor of a compartment map denotes the root module of an
|
|
26
75
|
* application and the compartment that contains it.
|
|
27
76
|
*/
|
|
28
|
-
export type EntryDescriptor = {
|
|
29
|
-
compartment:
|
|
77
|
+
export type EntryDescriptor<K extends string = string> = {
|
|
78
|
+
compartment: K;
|
|
30
79
|
module: string;
|
|
31
80
|
};
|
|
32
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Keys of {@link PackageCompartmentMapDescriptor.compartments}
|
|
84
|
+
*/
|
|
85
|
+
export type PackageCompartmentDescriptorName = LiteralUnion<
|
|
86
|
+
typeof ATTENUATORS_COMPARTMENT,
|
|
87
|
+
FileUrlString
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
export interface PackageCompartmentDescriptor
|
|
91
|
+
extends CompartmentDescriptor<CompartmentModuleConfiguration> {
|
|
92
|
+
label: LiteralUnion<
|
|
93
|
+
typeof ATTENUATORS_COMPARTMENT | typeof ENTRY_COMPARTMENT,
|
|
94
|
+
string
|
|
95
|
+
>;
|
|
96
|
+
|
|
97
|
+
version: string;
|
|
98
|
+
|
|
99
|
+
location: PackageCompartmentDescriptorName;
|
|
100
|
+
|
|
101
|
+
name: LiteralUnion<
|
|
102
|
+
typeof ATTENUATORS_COMPARTMENT | typeof ENTRY_COMPARTMENT,
|
|
103
|
+
string
|
|
104
|
+
>;
|
|
105
|
+
|
|
106
|
+
scopes: Record<string, ScopeDescriptor<PackageCompartmentDescriptorName>>;
|
|
107
|
+
|
|
108
|
+
sourceDirname: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
33
111
|
/**
|
|
34
112
|
* A compartment descriptor corresponds to a single Compartment
|
|
35
113
|
* of an assembled Application and describes how to construct
|
|
36
114
|
* one for a given library or application `package.json`.
|
|
37
115
|
*/
|
|
38
|
-
export
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*/
|
|
44
|
-
sourceDirname?: string;
|
|
45
|
-
/** shortest path of dependency names to this compartment */
|
|
46
|
-
path?: Array<string>;
|
|
116
|
+
export interface CompartmentDescriptor<
|
|
117
|
+
T extends ModuleConfiguration = ModuleConfiguration,
|
|
118
|
+
U extends string = string,
|
|
119
|
+
> {
|
|
120
|
+
label: CanonicalName<U>;
|
|
47
121
|
/**
|
|
48
122
|
* the name of the originating package suitable for constructing a sourceURL
|
|
49
123
|
* prefix that will match it to files in a developer workspace.
|
|
50
124
|
*/
|
|
51
125
|
name: string;
|
|
126
|
+
modules: Record<string, T>;
|
|
127
|
+
scopes?: Record<string, ScopeDescriptor>;
|
|
128
|
+
/** language for extension */
|
|
129
|
+
parsers?: LanguageForExtension;
|
|
130
|
+
/** language for module specifier */
|
|
131
|
+
types?: LanguageForModuleSpecifier;
|
|
132
|
+
/** policy specific to compartment */
|
|
133
|
+
policy?: SomePackagePolicy;
|
|
134
|
+
|
|
52
135
|
location: string;
|
|
136
|
+
/**
|
|
137
|
+
* name of the parent directory of the package from which the compartment is derived,
|
|
138
|
+
* for purposes of generating sourceURL comments that are most likely to unite with the original sources in an IDE workspace.
|
|
139
|
+
*/
|
|
140
|
+
sourceDirname?: string;
|
|
141
|
+
|
|
53
142
|
/**
|
|
54
143
|
* whether this compartment was retained by any module in the solution. This
|
|
55
144
|
* property should never appear in an archived compartment map.
|
|
56
145
|
*/
|
|
57
|
-
retained?:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
146
|
+
retained?: true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export type CompartmentDescriptorWithPolicy<
|
|
150
|
+
T extends ModuleConfiguration = ModuleConfiguration,
|
|
151
|
+
> = Omit<CompartmentDescriptor<T>, 'policy'> & { policy: SomePackagePolicy };
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* A compartment descriptor digested by `digestCompartmentMap()`
|
|
155
|
+
*/
|
|
156
|
+
export interface DigestedCompartmentDescriptor
|
|
157
|
+
extends CompartmentDescriptor<ModuleConfiguration> {
|
|
158
|
+
path: never;
|
|
159
|
+
retained: never;
|
|
160
|
+
scopes: never;
|
|
161
|
+
parsers: never;
|
|
162
|
+
types: never;
|
|
163
|
+
__createdBy: never;
|
|
164
|
+
sourceDirname: never;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export type DigestedCompartmentDescriptors =
|
|
168
|
+
CompartmentDescriptors<DigestedCompartmentDescriptor>;
|
|
169
|
+
|
|
170
|
+
export type DigestedCompartmentMapDescriptor =
|
|
171
|
+
CompartmentMapDescriptor<DigestedCompartmentDescriptor>;
|
|
69
172
|
|
|
70
173
|
/**
|
|
71
174
|
* For every module explicitly mentioned in an `exports` field of a
|
|
72
|
-
* `package.json`, there is a corresponding
|
|
175
|
+
* `package.json`, there is a corresponding `ModuleConfiguration`.
|
|
73
176
|
*/
|
|
74
|
-
export type
|
|
75
|
-
|
|
76
|
-
|
|
177
|
+
export type ModuleConfiguration =
|
|
178
|
+
| ErrorModuleConfiguration
|
|
179
|
+
| ExitModuleConfiguration
|
|
180
|
+
| FileModuleConfiguration
|
|
181
|
+
| CompartmentModuleConfiguration;
|
|
182
|
+
|
|
183
|
+
export type ModuleConfigurationCreator =
|
|
184
|
+
| 'link'
|
|
185
|
+
| 'transform'
|
|
186
|
+
| 'import-hook'
|
|
187
|
+
| 'digest'
|
|
188
|
+
| 'node-modules';
|
|
189
|
+
|
|
190
|
+
export interface BaseModuleConfiguration {
|
|
191
|
+
deferredError?: string;
|
|
192
|
+
|
|
193
|
+
retained?: true;
|
|
194
|
+
|
|
195
|
+
__createdBy?: ModuleConfigurationCreator;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface ErrorModuleConfiguration extends BaseModuleConfiguration {
|
|
199
|
+
deferredError: string;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* This module configuration is a reference to another module in a a compartment descriptor (it may be the same compartment descriptor)
|
|
204
|
+
*/
|
|
205
|
+
export interface CompartmentModuleConfiguration
|
|
206
|
+
extends BaseModuleConfiguration {
|
|
207
|
+
/**
|
|
208
|
+
* The name of the compartment that contains this module.
|
|
209
|
+
*/
|
|
210
|
+
compartment: LiteralUnion<typeof ATTENUATORS_COMPARTMENT, FileUrlString>;
|
|
211
|
+
/**
|
|
212
|
+
* The module name within {@link CompartmentDescriptor.modules} of the
|
|
213
|
+
* `CompartmentDescriptor` referred to by {@link compartment}
|
|
214
|
+
*/
|
|
215
|
+
module: string;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* A module configuration representing an exit module
|
|
220
|
+
*/
|
|
221
|
+
export interface ExitModuleConfiguration extends BaseModuleConfiguration {
|
|
222
|
+
exit: string;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* A module configuration representing a file on disk
|
|
227
|
+
*/
|
|
228
|
+
export interface FileModuleConfiguration extends BaseModuleConfiguration {
|
|
77
229
|
location?: string;
|
|
78
|
-
parser
|
|
230
|
+
parser: Language;
|
|
79
231
|
/** in base 16, hex */
|
|
80
232
|
sha512?: string;
|
|
81
|
-
|
|
82
|
-
deferredError?: string;
|
|
83
|
-
retained?: boolean;
|
|
84
|
-
};
|
|
233
|
+
}
|
|
85
234
|
|
|
86
235
|
/**
|
|
87
236
|
* Scope descriptors link all names under a prefix to modules in another
|
|
@@ -90,8 +239,11 @@ export type ModuleDescriptor = {
|
|
|
90
239
|
* in a `package.json` file, when that `package.json` file does not have
|
|
91
240
|
* an explicit `exports` map.
|
|
92
241
|
*/
|
|
93
|
-
export type ScopeDescriptor = {
|
|
94
|
-
|
|
242
|
+
export type ScopeDescriptor<T extends string = string> = {
|
|
243
|
+
/**
|
|
244
|
+
* A compartment name; not a `Compartment`.
|
|
245
|
+
*/
|
|
246
|
+
compartment: T;
|
|
95
247
|
module?: string;
|
|
96
248
|
};
|
|
97
249
|
|
|
@@ -121,3 +273,16 @@ export type LanguageForExtension = Record<string, Language>;
|
|
|
121
273
|
* Mapping of module specifier to {@link Language Languages}.
|
|
122
274
|
*/
|
|
123
275
|
export type LanguageForModuleSpecifier = Record<string, Language>;
|
|
276
|
+
|
|
277
|
+
export type ModuleConfigurationKind = 'file' | 'compartment' | 'exit' | 'error';
|
|
278
|
+
|
|
279
|
+
export type ModuleConfigurationKindToType<T extends ModuleConfigurationKind> =
|
|
280
|
+
T extends 'file'
|
|
281
|
+
? FileModuleConfiguration
|
|
282
|
+
: T extends 'compartment'
|
|
283
|
+
? CompartmentModuleConfiguration
|
|
284
|
+
: T extends 'exit'
|
|
285
|
+
? ExitModuleConfiguration
|
|
286
|
+
: T extends 'error'
|
|
287
|
+
? ErrorModuleConfiguration
|
|
288
|
+
: never;
|