@endo/compartment-mapper 1.6.1 → 1.6.3
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 +9 -8
- package/src/compartment-map.d.ts +0 -1
- package/src/compartment-map.d.ts.map +1 -1
- package/src/compartment-map.js +0 -49
- package/src/digest.d.ts.map +1 -1
- package/src/digest.js +2 -5
- package/src/generic-graph.d.ts +84 -0
- package/src/generic-graph.d.ts.map +1 -0
- package/src/generic-graph.js +351 -0
- package/src/import-hook.d.ts.map +1 -1
- package/src/import-hook.js +18 -2
- package/src/json.d.ts +1 -1
- package/src/json.d.ts.map +1 -1
- package/src/json.js +10 -3
- package/src/node-modules.d.ts +3 -2
- package/src/node-modules.d.ts.map +1 -1
- package/src/node-modules.js +200 -165
- package/src/node-powers.d.ts +6 -5
- package/src/node-powers.d.ts.map +1 -1
- package/src/node-powers.js +11 -8
- package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
- package/src/parse-cjs-shared-export-wrapper.js +20 -0
- package/src/types/external.d.ts +5 -1
- package/src/types/external.d.ts.map +1 -1
- package/src/types/external.ts +6 -1
- package/src/types/generic-graph.d.ts +17 -0
- package/src/types/generic-graph.d.ts.map +1 -0
- package/src/types/generic-graph.ts +17 -0
- package/src/types/internal.d.ts +1 -0
- package/src/types/internal.d.ts.map +1 -1
- package/src/types/internal.ts +1 -0
- package/src/types/node-modules.d.ts +36 -13
- package/src/types/node-modules.d.ts.map +1 -1
- package/src/types/node-modules.ts +40 -13
- package/src/types/powers.d.ts +38 -11
- package/src/types/powers.d.ts.map +1 -1
- package/src/types/powers.ts +50 -17
package/src/types/powers.ts
CHANGED
|
@@ -11,10 +11,15 @@
|
|
|
11
11
|
|
|
12
12
|
import type { SomeObject } from './typescript.js';
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// #region read
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* All available read powers
|
|
18
|
+
*
|
|
19
|
+
* @template T The expected input/output type of the {@link CanonicalFn}.
|
|
20
|
+
*/
|
|
21
|
+
export type ReadPowers<T extends string = any> = {
|
|
22
|
+
canonical: CanonicalFn<T>;
|
|
18
23
|
read: ReadFn;
|
|
19
24
|
maybeRead?: MaybeReadFn;
|
|
20
25
|
readNow?: ReadNowFn;
|
|
@@ -26,7 +31,10 @@ export type ReadPowers = {
|
|
|
26
31
|
isAbsolute?: IsAbsoluteFn;
|
|
27
32
|
};
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
/**
|
|
35
|
+
* @template T The expected input/output type of the {@link CanonicalFn}.
|
|
36
|
+
*/
|
|
37
|
+
export type MaybeReadPowers<T extends string = any> = ReadPowers<T> & {
|
|
30
38
|
maybeRead: MaybeReadFn;
|
|
31
39
|
};
|
|
32
40
|
|
|
@@ -39,9 +47,14 @@ export type MaybeReadPowers = ReadPowers & {
|
|
|
39
47
|
* 2. Prop `maybeReadNow` is a function
|
|
40
48
|
* 3. Prop `fileURLToPath` is a function
|
|
41
49
|
* 4. Prop `isAbsolute` is a function
|
|
50
|
+
*
|
|
51
|
+
* @template T The expected input/output type of the {@link CanonicalFn}.
|
|
42
52
|
*/
|
|
43
|
-
export type ReadNowPowers = Omit<
|
|
44
|
-
|
|
53
|
+
export type ReadNowPowers<T extends string = any> = Omit<
|
|
54
|
+
ReadPowers<T>,
|
|
55
|
+
ReadNowPowersProp
|
|
56
|
+
> &
|
|
57
|
+
Required<Pick<ReadPowers<T>, ReadNowPowersProp>>;
|
|
45
58
|
|
|
46
59
|
/**
|
|
47
60
|
* These properties are necessary for dynamic require support
|
|
@@ -50,11 +63,19 @@ export type ReadNowPowersProp = 'fileURLToPath' | 'isAbsolute' | 'maybeReadNow';
|
|
|
50
63
|
|
|
51
64
|
/**
|
|
52
65
|
* Returns a canonical URL for a given URL, following redirects or symbolic
|
|
53
|
-
* links if any exist along the path.
|
|
54
|
-
*
|
|
66
|
+
* links if any exist along the path. Must return the given logical location if
|
|
67
|
+
* the real location does not exist.
|
|
68
|
+
*
|
|
69
|
+
* @template T The expected input/output type of the {@link CanonicalFn}. This
|
|
70
|
+
* may be a particular type of URL, such as a `FileUrlString`.
|
|
55
71
|
*/
|
|
56
|
-
export type CanonicalFn =
|
|
72
|
+
export type CanonicalFn<T extends string = string> = (
|
|
73
|
+
location: T,
|
|
74
|
+
) => Promise<T>;
|
|
57
75
|
|
|
76
|
+
/**
|
|
77
|
+
* A function which reads some location and resolves with bytes.
|
|
78
|
+
*/
|
|
58
79
|
export type ReadFn = (location: string) => Promise<Uint8Array>;
|
|
59
80
|
|
|
60
81
|
/**
|
|
@@ -62,6 +83,9 @@ export type ReadFn = (location: string) => Promise<Uint8Array>;
|
|
|
62
83
|
*/
|
|
63
84
|
export type MaybeReadFn = (location: string) => Promise<Uint8Array | undefined>;
|
|
64
85
|
|
|
86
|
+
/**
|
|
87
|
+
* A function which reads some location and returns bytes.
|
|
88
|
+
*/
|
|
65
89
|
export type ReadNowFn = (location: string) => Uint8Array;
|
|
66
90
|
|
|
67
91
|
/**
|
|
@@ -69,11 +93,14 @@ export type ReadNowFn = (location: string) => Uint8Array;
|
|
|
69
93
|
*/
|
|
70
94
|
export type MaybeReadNowFn = (location: string) => Uint8Array | undefined;
|
|
71
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Returns a string hash of a byte array
|
|
98
|
+
*/
|
|
72
99
|
export type HashFn = (bytes: Uint8Array) => string;
|
|
73
100
|
|
|
74
|
-
export type FileURLToPathFn =
|
|
101
|
+
export type FileURLToPathFn = (url: URL | string) => string;
|
|
75
102
|
|
|
76
|
-
export type PathToFileURLFn =
|
|
103
|
+
export type PathToFileURLFn = (path: string) => URL;
|
|
77
104
|
|
|
78
105
|
export type RequireResolveFn = (
|
|
79
106
|
fromLocation: string,
|
|
@@ -91,14 +118,19 @@ export type ArchiveReader = {
|
|
|
91
118
|
read: ReadFn;
|
|
92
119
|
};
|
|
93
120
|
|
|
94
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Read powers with a {@link HashFn}.
|
|
123
|
+
*
|
|
124
|
+
* @template T The expected input/output type of the {@link CanonicalFn}.
|
|
125
|
+
*/
|
|
126
|
+
export type HashPowers<T extends string = any> = {
|
|
95
127
|
read: ReadFn;
|
|
96
|
-
canonical: CanonicalFn
|
|
128
|
+
canonical: CanonicalFn<T>;
|
|
97
129
|
computeSha512: HashFn;
|
|
98
130
|
};
|
|
131
|
+
// #endregion
|
|
99
132
|
|
|
100
|
-
//
|
|
101
|
-
|
|
133
|
+
// #region write
|
|
102
134
|
export type WritePowers = {
|
|
103
135
|
write: WriteFn;
|
|
104
136
|
};
|
|
@@ -111,12 +143,13 @@ export type ArchiveWriter = {
|
|
|
111
143
|
};
|
|
112
144
|
|
|
113
145
|
export type SnapshotFn = () => Promise<Uint8Array>;
|
|
146
|
+
// #endregion
|
|
114
147
|
|
|
115
|
-
//
|
|
116
|
-
|
|
148
|
+
// #region execute
|
|
117
149
|
export type Application = {
|
|
118
150
|
import: ExecuteFn;
|
|
119
151
|
sha512?: string | undefined;
|
|
120
152
|
};
|
|
121
153
|
|
|
122
154
|
export type ExecuteFn = (options?: any) => Promise<SomeObject>;
|
|
155
|
+
// #endregion
|