@endo/compartment-mapper 1.6.3 → 2.1.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 +24 -14
- package/src/archive-lite.d.ts +7 -7
- package/src/archive-lite.d.ts.map +1 -1
- package/src/archive-lite.js +81 -30
- 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 +243 -25
- package/src/compartment-map.d.ts +9 -2
- package/src/compartment-map.d.ts.map +1 -1
- package/src/compartment-map.js +738 -254
- package/src/digest.d.ts +22 -2
- package/src/digest.d.ts.map +1 -1
- package/src/digest.js +180 -57
- package/src/generic-graph.d.ts +7 -25
- package/src/generic-graph.d.ts.map +1 -1
- package/src/generic-graph.js +83 -108
- 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 +140 -70
- 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 +4 -2
- package/src/infer-exports.d.ts.map +1 -1
- package/src/infer-exports.js +172 -23
- package/src/link.d.ts +4 -3
- package/src/link.d.ts.map +1 -1
- package/src/link.js +122 -52
- package/src/node-modules.d.ts +4 -3
- package/src/node-modules.d.ts.map +1 -1
- package/src/node-modules.js +513 -151
- package/src/parse-cjs-shared-export-wrapper.d.ts.map +1 -1
- package/src/parse-cjs-shared-export-wrapper.js +3 -1
- package/src/pattern-replacement.d.ts +6 -0
- package/src/pattern-replacement.d.ts.map +1 -0
- package/src/pattern-replacement.js +198 -0
- 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 +121 -35
- package/src/types/compartment-map-schema.d.ts.map +1 -1
- package/src/types/compartment-map-schema.ts +211 -37
- package/src/types/external.d.ts +240 -76
- package/src/types/external.d.ts.map +1 -1
- package/src/types/external.ts +305 -74
- package/src/types/generic-graph.d.ts +8 -2
- package/src/types/generic-graph.d.ts.map +1 -1
- package/src/types/generic-graph.ts +7 -2
- package/src/types/internal.d.ts +31 -50
- package/src/types/internal.d.ts.map +1 -1
- package/src/types/internal.ts +60 -58
- package/src/types/node-modules.d.ts +112 -14
- package/src/types/node-modules.d.ts.map +1 -1
- package/src/types/node-modules.ts +152 -13
- package/src/types/pattern-replacement.d.ts +62 -0
- package/src/types/pattern-replacement.d.ts.map +1 -0
- package/src/types/pattern-replacement.ts +70 -0
- 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/powers.d.ts +11 -9
- package/src/types/powers.d.ts.map +1 -1
- package/src/types/powers.ts +11 -10
- package/src/types/typescript.d.ts +28 -0
- package/src/types/typescript.d.ts.map +1 -1
- package/src/types/typescript.ts +37 -1
package/src/types/powers.ts
CHANGED
|
@@ -21,14 +21,14 @@ import type { SomeObject } from './typescript.js';
|
|
|
21
21
|
export type ReadPowers<T extends string = any> = {
|
|
22
22
|
canonical: CanonicalFn<T>;
|
|
23
23
|
read: ReadFn;
|
|
24
|
-
maybeRead?: MaybeReadFn;
|
|
25
|
-
readNow?: ReadNowFn;
|
|
26
|
-
maybeReadNow?: MaybeReadNowFn;
|
|
27
|
-
computeSha512?: HashFn;
|
|
28
|
-
fileURLToPath?: FileURLToPathFn;
|
|
29
|
-
pathToFileURL?: PathToFileURLFn;
|
|
30
|
-
requireResolve?: RequireResolveFn;
|
|
31
|
-
isAbsolute?: IsAbsoluteFn;
|
|
24
|
+
maybeRead?: MaybeReadFn | undefined;
|
|
25
|
+
readNow?: ReadNowFn | undefined;
|
|
26
|
+
maybeReadNow?: MaybeReadNowFn | undefined;
|
|
27
|
+
computeSha512?: HashFn | undefined;
|
|
28
|
+
fileURLToPath?: FileURLToPathFn | undefined;
|
|
29
|
+
pathToFileURL?: PathToFileURLFn | undefined;
|
|
30
|
+
requireResolve?: RequireResolveFn | undefined;
|
|
31
|
+
isAbsolute?: IsAbsoluteFn | undefined;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -53,8 +53,9 @@ export type MaybeReadPowers<T extends string = any> = ReadPowers<T> & {
|
|
|
53
53
|
export type ReadNowPowers<T extends string = any> = Omit<
|
|
54
54
|
ReadPowers<T>,
|
|
55
55
|
ReadNowPowersProp
|
|
56
|
-
> &
|
|
57
|
-
|
|
56
|
+
> & {
|
|
57
|
+
[P in ReadNowPowersProp]-?: NonNullable<ReadPowers<T>[P]>;
|
|
58
|
+
};
|
|
58
59
|
|
|
59
60
|
/**
|
|
60
61
|
* These properties are necessary for dynamic require support
|
|
@@ -25,6 +25,34 @@ export type Primitive = null | undefined | string | number | boolean | symbol |
|
|
|
25
25
|
* https://github.com/Microsoft/TypeScript/issues/29729
|
|
26
26
|
* Microsoft/TypeScript#29729}. It will be removed as soon as it's not needed
|
|
27
27
|
* anymore.
|
|
28
|
+
* @see {@link https://www.npmjs.com/package/type-fest}
|
|
28
29
|
*/
|
|
29
30
|
export type LiteralUnion<LiteralType, PrimitiveType extends Primitive> = LiteralType | (PrimitiveType & Record<never, never>);
|
|
31
|
+
/**
|
|
32
|
+
* Generic type guard function that checks if a value of type `T` is also of type `U`.
|
|
33
|
+
* @template T The type of the value to check.
|
|
34
|
+
* @template U The type that the value should be checked against.
|
|
35
|
+
*/
|
|
36
|
+
export type TypeGuard<T, U extends T> = (value: T) => value is U;
|
|
37
|
+
/**
|
|
38
|
+
* Helper type for a generic type guard used in an "extends" clause
|
|
39
|
+
*/
|
|
40
|
+
export type SomeTypeGuard = TypeGuard<any, any>;
|
|
41
|
+
/**
|
|
42
|
+
* Infers the type that a type guard function checks for.
|
|
43
|
+
*
|
|
44
|
+
* @template T The type guard function type itself
|
|
45
|
+
* @returns The type that the guard checks for
|
|
46
|
+
*/
|
|
47
|
+
export type GuardedType<T> = T extends (value: any) => value is infer U ? U : never;
|
|
48
|
+
/**
|
|
49
|
+
* Converts a union type to an intersection type
|
|
50
|
+
*/
|
|
51
|
+
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
52
|
+
/**
|
|
53
|
+
* Makes a nicer tooltip for `T` in IDEs (most of the time).
|
|
54
|
+
*/
|
|
55
|
+
export type Simplify<T> = {
|
|
56
|
+
[K in keyof T]: T[K];
|
|
57
|
+
} & {};
|
|
30
58
|
//# sourceMappingURL=typescript.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["typescript.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mDAAmD;AACnD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAElD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,SAAS,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C,CAAC,CAAC;CAAE,GAAG,EAAE,CAAC"}
|
package/src/types/typescript.ts
CHANGED
|
@@ -35,9 +35,45 @@ export type Primitive =
|
|
|
35
35
|
* https://github.com/Microsoft/TypeScript/issues/29729
|
|
36
36
|
* Microsoft/TypeScript#29729}. It will be removed as soon as it's not needed
|
|
37
37
|
* anymore.
|
|
38
|
+
* @see {@link https://www.npmjs.com/package/type-fest}
|
|
38
39
|
*/
|
|
39
40
|
export type LiteralUnion<LiteralType, PrimitiveType extends Primitive> =
|
|
40
41
|
| LiteralType
|
|
41
42
|
| (PrimitiveType & Record<never, never>);
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Generic type guard function that checks if a value of type `T` is also of type `U`.
|
|
46
|
+
* @template T The type of the value to check.
|
|
47
|
+
* @template U The type that the value should be checked against.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export type TypeGuard<T, U extends T> = (value: T) => value is U;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Helper type for a generic type guard used in an "extends" clause
|
|
54
|
+
*/
|
|
55
|
+
export type SomeTypeGuard = TypeGuard<any, any>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Infers the type that a type guard function checks for.
|
|
59
|
+
*
|
|
60
|
+
* @template T The type guard function type itself
|
|
61
|
+
* @returns The type that the guard checks for
|
|
62
|
+
*/
|
|
63
|
+
export type GuardedType<T> = T extends (value: any) => value is infer U
|
|
64
|
+
? U
|
|
65
|
+
: never;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Converts a union type to an intersection type
|
|
69
|
+
*/
|
|
70
|
+
export type UnionToIntersection<U> = (
|
|
71
|
+
U extends any ? (k: U) => void : never
|
|
72
|
+
) extends (k: infer I) => void
|
|
73
|
+
? I
|
|
74
|
+
: never;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Makes a nicer tooltip for `T` in IDEs (most of the time).
|
|
78
|
+
*/
|
|
79
|
+
export type Simplify<T> = { [K in keyof T]: T[K] } & {};
|