monkeypatchlist 0.0.0-stage → 0.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/LICENSE +202 -0
- package/NOTICE +61 -0
- package/README.md +183 -2
- package/catalog/catalog.json +552211 -0
- package/catalog/catalog.schema.json +787 -0
- package/catalog/changelog.json +3 -0
- package/dist/bin/monkeypatchlist.d.ts +2 -0
- package/dist/bin/monkeypatchlist.js +3 -0
- package/dist/catalog.d.ts +561 -0
- package/dist/catalog.js +58 -0
- package/dist/cli.d.ts +84 -0
- package/dist/cli.js +470 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/lockfile-input.d.ts +9 -0
- package/dist/lockfile-input.js +91 -0
- package/dist/packages/analysis/binding.d.ts +2 -0
- package/dist/packages/analysis/binding.js +5 -0
- package/dist/packages/analysis/index.d.ts +10 -0
- package/dist/packages/analysis/index.js +13 -0
- package/dist/packages/analysis/job.d.ts +33 -0
- package/dist/packages/analysis/job.js +85 -0
- package/dist/packages/analysis/lib/absence-tags.d.ts +34 -0
- package/dist/packages/analysis/lib/absence-tags.js +340 -0
- package/dist/packages/analysis/lib/ast.d.ts +28 -0
- package/dist/packages/analysis/lib/ast.js +64 -0
- package/dist/packages/analysis/lib/binding.d.ts +36 -0
- package/dist/packages/analysis/lib/binding.js +66 -0
- package/dist/packages/analysis/lib/budget.d.ts +80 -0
- package/dist/packages/analysis/lib/budget.js +31 -0
- package/dist/packages/analysis/lib/catch-arms.d.ts +19 -0
- package/dist/packages/analysis/lib/catch-arms.js +351 -0
- package/dist/packages/analysis/lib/chunk-loads.d.ts +160 -0
- package/dist/packages/analysis/lib/chunk-loads.js +882 -0
- package/dist/packages/analysis/lib/chunk-registry.d.ts +45 -0
- package/dist/packages/analysis/lib/chunk-registry.js +334 -0
- package/dist/packages/analysis/lib/code-routes.d.ts +52 -0
- package/dist/packages/analysis/lib/code-routes.js +921 -0
- package/dist/packages/analysis/lib/collisions.d.ts +22 -0
- package/dist/packages/analysis/lib/collisions.js +103 -0
- package/dist/packages/analysis/lib/definitions.d.ts +76 -0
- package/dist/packages/analysis/lib/definitions.js +782 -0
- package/dist/packages/analysis/lib/early-exits.d.ts +39 -0
- package/dist/packages/analysis/lib/early-exits.js +161 -0
- package/dist/packages/analysis/lib/effect.d.ts +138 -0
- package/dist/packages/analysis/lib/effect.js +800 -0
- package/dist/packages/analysis/lib/global-object.d.ts +581 -0
- package/dist/packages/analysis/lib/global-object.js +8240 -0
- package/dist/packages/analysis/lib/keys.d.ts +33 -0
- package/dist/packages/analysis/lib/keys.js +82 -0
- package/dist/packages/analysis/lib/line-starts.d.ts +41 -0
- package/dist/packages/analysis/lib/line-starts.js +79 -0
- package/dist/packages/analysis/lib/link-group.d.ts +51 -0
- package/dist/packages/analysis/lib/link-group.js +487 -0
- package/dist/packages/analysis/lib/module-links.d.ts +117 -0
- package/dist/packages/analysis/lib/module-links.js +1060 -0
- package/dist/packages/analysis/lib/nested-code.d.ts +38 -0
- package/dist/packages/analysis/lib/nested-code.js +200 -0
- package/dist/packages/analysis/lib/numeric.d.ts +16 -0
- package/dist/packages/analysis/lib/numeric.js +216 -0
- package/dist/packages/analysis/lib/once-flags.d.ts +12 -0
- package/dist/packages/analysis/lib/once-flags.js +190 -0
- package/dist/packages/analysis/lib/parameter-arguments.d.ts +12 -0
- package/dist/packages/analysis/lib/parameter-arguments.js +34 -0
- package/dist/packages/analysis/lib/parse.d.ts +10 -0
- package/dist/packages/analysis/lib/parse.js +39 -0
- package/dist/packages/analysis/lib/partial.d.ts +60 -0
- package/dist/packages/analysis/lib/partial.js +518 -0
- package/dist/packages/analysis/lib/print.d.ts +3 -0
- package/dist/packages/analysis/lib/print.js +150 -0
- package/dist/packages/analysis/lib/reachability.d.ts +137 -0
- package/dist/packages/analysis/lib/reachability.js +1295 -0
- package/dist/packages/analysis/lib/resolver.d.ts +13 -0
- package/dist/packages/analysis/lib/resolver.js +2886 -0
- package/dist/packages/analysis/lib/restores.d.ts +42 -0
- package/dist/packages/analysis/lib/restores.js +482 -0
- package/dist/packages/analysis/lib/rewritten-deletes.d.ts +6 -0
- package/dist/packages/analysis/lib/rewritten-deletes.js +142 -0
- package/dist/packages/analysis/lib/scope.d.ts +110 -0
- package/dist/packages/analysis/lib/scope.js +443 -0
- package/dist/packages/analysis/lib/script-loads.d.ts +56 -0
- package/dist/packages/analysis/lib/script-loads.js +359 -0
- package/dist/packages/analysis/lib/summaries.d.ts +177 -0
- package/dist/packages/analysis/lib/summaries.js +498 -0
- package/dist/packages/analysis/lib/types.d.ts +632 -0
- package/dist/packages/analysis/lib/types.js +128 -0
- package/dist/packages/analysis/lib/wrap.d.ts +34 -0
- package/dist/packages/analysis/lib/wrap.js +407 -0
- package/dist/packages/analysis/lib/writes.d.ts +358 -0
- package/dist/packages/analysis/lib/writes.js +1612 -0
- package/dist/packages/analysis/visit-order.d.ts +3 -0
- package/dist/packages/analysis/visit-order.js +23 -0
- package/dist/packages/attribution/index.d.ts +233 -0
- package/dist/packages/attribution/index.js +444 -0
- package/dist/packages/attribution/lib/containing-package.d.ts +76 -0
- package/dist/packages/attribution/lib/containing-package.js +304 -0
- package/dist/packages/attribution/lib/first-party.d.ts +37 -0
- package/dist/packages/attribution/lib/first-party.js +153 -0
- package/dist/packages/attribution/lib/lockfile-graph.d.ts +99 -0
- package/dist/packages/attribution/lib/lockfile-graph.js +158 -0
- package/dist/packages/attribution/lib/lockfile.d.ts +33 -0
- package/dist/packages/attribution/lib/lockfile.js +330 -0
- package/dist/packages/attribution/lib/path-rules.d.ts +29 -0
- package/dist/packages/attribution/lib/path-rules.js +84 -0
- package/dist/packages/attribution/lib/pnpm.d.ts +4 -0
- package/dist/packages/attribution/lib/pnpm.js +133 -0
- package/dist/packages/attribution/lib/remote-url.d.ts +7 -0
- package/dist/packages/attribution/lib/remote-url.js +24 -0
- package/dist/packages/attribution/lib/source-map.d.ts +51 -0
- package/dist/packages/attribution/lib/source-map.js +125 -0
- package/dist/packages/attribution/lib/yaml.d.ts +9 -0
- package/dist/packages/attribution/lib/yaml.js +277 -0
- package/dist/packages/attribution/lib/yarn.d.ts +7 -0
- package/dist/packages/attribution/lib/yarn.js +227 -0
- package/dist/packages/baseline/index.d.ts +45 -0
- package/dist/packages/baseline/index.js +41 -0
- package/dist/packages/baseline/lib/error.d.ts +15 -0
- package/dist/packages/baseline/lib/error.js +25 -0
- package/dist/packages/baseline/lib/format.d.ts +49 -0
- package/dist/packages/baseline/lib/format.js +22 -0
- package/dist/packages/baseline/lib/migrations.d.ts +19 -0
- package/dist/packages/baseline/lib/migrations.js +7 -0
- package/dist/packages/baseline/lib/previous.d.ts +23 -0
- package/dist/packages/baseline/lib/previous.js +64 -0
- package/dist/packages/baseline/lib/read.d.ts +39 -0
- package/dist/packages/baseline/lib/read.js +219 -0
- package/dist/packages/baseline/lib/report.d.ts +25 -0
- package/dist/packages/baseline/lib/report.js +104 -0
- package/dist/packages/baseline/lib/skew.d.ts +51 -0
- package/dist/packages/baseline/lib/skew.js +75 -0
- package/dist/packages/compare/index.d.ts +120 -0
- package/dist/packages/compare/index.js +274 -0
- package/dist/packages/compare/lib/catalog-notes.d.ts +73 -0
- package/dist/packages/compare/lib/catalog-notes.js +224 -0
- package/dist/packages/completeness/index.d.ts +246 -0
- package/dist/packages/completeness/index.js +249 -0
- package/dist/packages/confidence/index.d.ts +54 -0
- package/dist/packages/confidence/index.js +71 -0
- package/dist/packages/config/index.d.ts +107 -0
- package/dist/packages/config/index.js +95 -0
- package/dist/packages/config/lib/command-line.d.ts +23 -0
- package/dist/packages/config/lib/command-line.js +239 -0
- package/dist/packages/config/lib/config-file.d.ts +11 -0
- package/dist/packages/config/lib/config-file.js +119 -0
- package/dist/packages/config/lib/scan-config-id.d.ts +28 -0
- package/dist/packages/config/lib/scan-config-id.js +54 -0
- package/dist/packages/config/lib/schema.d.ts +2 -0
- package/dist/packages/config/lib/schema.js +31 -0
- package/dist/packages/config/lib/types.d.ts +64 -0
- package/dist/packages/config/lib/types.js +6 -0
- package/dist/packages/config/lib/urls.d.ts +6 -0
- package/dist/packages/config/lib/urls.js +9 -0
- package/dist/packages/discovery/index.d.ts +277 -0
- package/dist/packages/discovery/index.js +1950 -0
- package/dist/packages/discovery/lib/import-map.d.ts +68 -0
- package/dist/packages/discovery/lib/import-map.js +180 -0
- package/dist/packages/discovery/lib/requests.d.ts +58 -0
- package/dist/packages/discovery/lib/requests.js +591 -0
- package/dist/packages/discovery/lib/scopes.d.ts +6 -0
- package/dist/packages/discovery/lib/scopes.js +286 -0
- package/dist/packages/discovery/lib/source-maps.d.ts +56 -0
- package/dist/packages/discovery/lib/source-maps.js +209 -0
- package/dist/packages/discovery/lib/swept-code.d.ts +27 -0
- package/dist/packages/discovery/lib/swept-code.js +107 -0
- package/dist/packages/discovery/lib/syntax.d.ts +17 -0
- package/dist/packages/discovery/lib/syntax.js +39 -0
- package/dist/packages/findings/index.d.ts +106 -0
- package/dist/packages/findings/index.js +254 -0
- package/dist/packages/findings/lib/scope.d.ts +38 -0
- package/dist/packages/findings/lib/scope.js +110 -0
- package/dist/packages/parallel/index.d.ts +2 -0
- package/dist/packages/parallel/index.js +5 -0
- package/dist/packages/parallel/lib/protocol.d.ts +15 -0
- package/dist/packages/parallel/lib/protocol.js +2 -0
- package/dist/packages/parallel/lib/runner.d.ts +36 -0
- package/dist/packages/parallel/lib/runner.js +96 -0
- package/dist/packages/parallel/lib/schedule.d.ts +16 -0
- package/dist/packages/parallel/lib/schedule.js +52 -0
- package/dist/packages/parallel/lib/worker.d.ts +1 -0
- package/dist/packages/parallel/lib/worker.js +18 -0
- package/dist/packages/policy/index.d.ts +36 -0
- package/dist/packages/policy/index.js +22 -0
- package/dist/packages/report/explain.d.ts +26 -0
- package/dist/packages/report/explain.js +99 -0
- package/dist/packages/report/index.d.ts +210 -0
- package/dist/packages/report/index.js +388 -0
- package/dist/packages/report/terminal.d.ts +11 -0
- package/dist/packages/report/terminal.js +331 -0
- package/dist/packages/source-store/fixture.d.ts +22 -0
- package/dist/packages/source-store/fixture.js +58 -0
- package/dist/packages/source-store/index.d.ts +278 -0
- package/dist/packages/source-store/index.js +322 -0
- package/dist/packages/source-store/lib/addresses.d.ts +6 -0
- package/dist/packages/source-store/lib/addresses.js +91 -0
- package/dist/packages/source-store/lib/connection.d.ts +15 -0
- package/dist/packages/source-store/lib/connection.js +135 -0
- package/dist/packages/source-store/lib/content-types.d.ts +16 -0
- package/dist/packages/source-store/lib/content-types.js +75 -0
- package/dist/packages/source-store/lib/data-urls.d.ts +10 -0
- package/dist/packages/source-store/lib/data-urls.js +85 -0
- package/dist/packages/source-store/lib/deadline.d.ts +18 -0
- package/dist/packages/source-store/lib/deadline.js +44 -0
- package/dist/packages/source-store/lib/exchange.d.ts +29 -0
- package/dist/packages/source-store/lib/exchange.js +112 -0
- package/dist/packages/source-store/lib/integrity.d.ts +19 -0
- package/dist/packages/source-store/lib/integrity.js +86 -0
- package/dist/packages/source-store/lib/outcomes.d.ts +12 -0
- package/dist/packages/source-store/lib/outcomes.js +22 -0
- package/dist/packages/source-store/lib/proxy.d.ts +11 -0
- package/dist/packages/source-store/lib/proxy.js +53 -0
- package/dist/packages/source-store/lib/session.d.ts +12 -0
- package/dist/packages/source-store/lib/session.js +139 -0
- package/dist/packages/source-store/lib/urls.d.ts +6 -0
- package/dist/packages/source-store/lib/urls.js +15 -0
- package/dist/packages/source-store/resolve.d.ts +59 -0
- package/dist/packages/source-store/resolve.js +45 -0
- package/dist/scan.d.ts +65 -0
- package/dist/scan.js +592 -0
- package/package.json +95 -4
- package/schema/config.schema.json +133 -0
- package/schema/report.schema.json +1905 -0
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
/** The kinds of global environment a target can live in (§4). */
|
|
2
|
+
export declare const realms: readonly ["window", "dedicated-worker", "shared-worker", "service-worker"];
|
|
3
|
+
export type Realm = (typeof realms)[number];
|
|
4
|
+
/** Where a target's property lives (§4 Targets and holders). */
|
|
5
|
+
export declare const holders: readonly ["global", "constructor", "prototype", "instance", "namespace"];
|
|
6
|
+
export type Holder = (typeof holders)[number];
|
|
7
|
+
/**
|
|
8
|
+
* The functional categories of targets (§12): `other` is the surface of an owner nobody has reviewed yet. Every member
|
|
9
|
+
* carries one (§4 Member data). A surface is context, not identity: reassigning one explains no delta (§4).
|
|
10
|
+
*/
|
|
11
|
+
export declare const surfaces: readonly ["networking", "events", "scheduling", "navigation", "storage", "crypto", "DOM", "ECMAScript", "diagnostics", "workers", "other"];
|
|
12
|
+
export type Surface = (typeof surfaces)[number];
|
|
13
|
+
/**
|
|
14
|
+
* What a target's property is:
|
|
15
|
+
* - a Web IDL member: an `operation`, `attribute` or `constant`
|
|
16
|
+
* - the property of a global or namespace that holds an interface object (`interface`) or a namespace object
|
|
17
|
+
* (`namespace`), whether Web IDL or ECMAScript defines it: `Window.XMLHttpRequest`, `Window.console`, `Window.Math`
|
|
18
|
+
* - any other ECMAScript intrinsic's property: it holds a built-in `function`, another `value`, or is an `accessor`
|
|
19
|
+
*/
|
|
20
|
+
export type MemberKind = 'operation' | 'attribute' | 'constant' | 'interface' | 'namespace' | PropertyKind;
|
|
21
|
+
/**
|
|
22
|
+
* The kinds of an ECMAScript property, which each entry of a curated overlay of single properties gives (§4 Sources):
|
|
23
|
+
* it holds a built-in `function`, holds another `value`, or is an `accessor`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const propertyKinds: readonly ["function", "value", "accessor"];
|
|
26
|
+
export type PropertyKind = (typeof propertyKinds)[number];
|
|
27
|
+
/**
|
|
28
|
+
* A native API member. The catalog keys it by realm, then by its realm-free name, e.g. `Node.prototype.normalize`:
|
|
29
|
+
* the same name in two realms is two targets.
|
|
30
|
+
*/
|
|
31
|
+
export interface CatalogTarget {
|
|
32
|
+
/**
|
|
33
|
+
* The interface, namespace or intrinsic whose holder the target is on. For Web IDL, its IDL identifier: `Window`
|
|
34
|
+
* for `Window.fetch`, `Memory` for `WebAssembly.Memory.prototype.grow`, and for a platform singleton's own member,
|
|
35
|
+
* the interface that declares it: `Location` for `location.href`. For ECMAScript, the intrinsic's path: `Array` for
|
|
36
|
+
* `Array.prototype.map`, `Intl.DateTimeFormat` for `Intl.DateTimeFormat.prototype.format`.
|
|
37
|
+
*/
|
|
38
|
+
owner: string;
|
|
39
|
+
member: string;
|
|
40
|
+
holder: Holder;
|
|
41
|
+
kind: MemberKind;
|
|
42
|
+
/**
|
|
43
|
+
* The spec shortname whose IDL declares the member, or, for a Web IDL `interface` and `namespace`, the definition;
|
|
44
|
+
* `ecma262` or `ecma402` for an ECMAScript intrinsic; for an ES addition, the spec its overlay entry names; for an
|
|
45
|
+
* engine extension, the engine its overlay entry names (`v8`).
|
|
46
|
+
*/
|
|
47
|
+
spec: string;
|
|
48
|
+
/** The interface mixin the member reached its owner through. */
|
|
49
|
+
mixin?: string;
|
|
50
|
+
/**
|
|
51
|
+
* For a data property whose value is itself a holder, that holder: `Window.XMLHttpRequest` holds the
|
|
52
|
+
* `XMLHttpRequest` interface object, `Window.Window` the `Window.Window` one, `WebAssembly.Module` the
|
|
53
|
+
* `WebAssembly.Module` one, `Window.console` the `console` namespace, `Window.Promise` the `Promise` constructor, and
|
|
54
|
+
* `Array.prototype.constructor` holds `Array`. An attribute never holds one: a platform singleton an attribute returns
|
|
55
|
+
* names that attribute as its `via` (`Window.history` for `history`).
|
|
56
|
+
*/
|
|
57
|
+
holds?: string;
|
|
58
|
+
/** The property's descriptor in the unmutated platform (§4 Member data). */
|
|
59
|
+
descriptor: Descriptor;
|
|
60
|
+
/** For a Web IDL attribute, and only for one, what an assignment to it does (§4 Member data). */
|
|
61
|
+
assign?: AssignKind;
|
|
62
|
+
/** Its functional category, from the owner → surface map (§12 Surfaces and data). */
|
|
63
|
+
surface: Surface;
|
|
64
|
+
/**
|
|
65
|
+
* Set on a **retained target** (§4 Catalog versions): one upstream removed, which the retained overlay keeps as it
|
|
66
|
+
* was last generated. It resolves like any other target, and its findings carry `catalogStatus: retained`, which is
|
|
67
|
+
* information only. The `retained` section records why it left.
|
|
68
|
+
*/
|
|
69
|
+
catalogStatus?: 'retained';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* What assigning a Web IDL attribute does, which its runtime descriptor can't tell (§4 Member data):
|
|
73
|
+
* - `setter`: runs the attribute's setter
|
|
74
|
+
* - `put-forwards`: forwards the value to an attribute of the object it returns (`[PutForwards]`, e.g. `location`)
|
|
75
|
+
* - `event-handler`: sets an event handler (an `EventHandler`, `OnErrorEventHandler` or `OnBeforeUnloadEventHandler`)
|
|
76
|
+
* - `replaceable`: replaces the attribute with an own data property (`[Replaceable]`, e.g. `length`)
|
|
77
|
+
* - `lenient-setter`: does nothing (`[LegacyLenientSetter]`)
|
|
78
|
+
* - `readonly`: does nothing, and throws in strict mode
|
|
79
|
+
*/
|
|
80
|
+
export type AssignKind = 'setter' | 'put-forwards' | 'event-handler' | 'replaceable' | 'lenient-setter' | 'readonly';
|
|
81
|
+
/** A property descriptor, as the outcome table reads it (§3): data or accessor, and its attributes. */
|
|
82
|
+
export type Descriptor = {
|
|
83
|
+
type: 'data';
|
|
84
|
+
writable: boolean;
|
|
85
|
+
enumerable: boolean;
|
|
86
|
+
configurable: boolean;
|
|
87
|
+
} | {
|
|
88
|
+
type: 'accessor';
|
|
89
|
+
/** Whether the accessor has a setter. Without one, an assignment through it changes nothing. */
|
|
90
|
+
setter: boolean;
|
|
91
|
+
enumerable: boolean;
|
|
92
|
+
configurable: boolean;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* An object that targets live on, named as the targets on it are prefixed: `Window` (the window realm's global),
|
|
96
|
+
* `EventTarget.prototype`, `XMLHttpRequest` (an interface object), `console`, `Array.prototype`, `Math`,
|
|
97
|
+
* `Intl.DateTimeFormat`, `%TypedArray%.prototype`. A `[LegacyNamespace]` interface's holders take its qualified name:
|
|
98
|
+
* `WebAssembly.Module`, `WebAssembly.Memory.prototype`. A platform singleton's holder takes its canonical path:
|
|
99
|
+
* `history`, `navigator.geolocation`. So do two objects named by their path from the global (§4): the realm global
|
|
100
|
+
* interface's own interface object, `Window.Window`, whose `prototype` is `Window.prototype`, and `console`'s empty
|
|
101
|
+
* prototype object, `console.[[Prototype]]`. An engine prototype takes its name in the engine (§4 Sources):
|
|
102
|
+
* `HTMLDocument.prototype`.
|
|
103
|
+
*/
|
|
104
|
+
export interface CatalogHolder {
|
|
105
|
+
kind: Holder;
|
|
106
|
+
/**
|
|
107
|
+
* The interface, namespace or intrinsic the holder belongs to. For Web IDL, its IDL identifier: `Memory` for
|
|
108
|
+
* `WebAssembly.Memory`, and `History` for the `history` singleton, a `History` instance. For ECMAScript, the
|
|
109
|
+
* intrinsic's path: `Array` for `Array.prototype`.
|
|
110
|
+
*/
|
|
111
|
+
owner: string;
|
|
112
|
+
/**
|
|
113
|
+
* The next holder on its prototype chain, in the same realm; `null` where the chain ends, at `Object.prototype`.
|
|
114
|
+
* Web IDL chains end in the ECMAScript intrinsics: `EventTarget.prototype` → `Object.prototype`.
|
|
115
|
+
*/
|
|
116
|
+
proto: string | null;
|
|
117
|
+
/** Set when the holder is an immutable prototype exotic object, so its prototype cannot change (§4 Member data). */
|
|
118
|
+
immutablePrototype?: true;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The name of the named properties object holder of a `[Global]` interface that supports named properties (§4):
|
|
122
|
+
* `WindowProperties` for `Window`. It is a `prototype` holder owned by the interface, between its interface prototype
|
|
123
|
+
* object and the prototype it inherits.
|
|
124
|
+
*/
|
|
125
|
+
export declare function namedPropertiesObject(global: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* A member defined on each instance of its interface rather than on the prototype: a `[LegacyUnforgeable]` member
|
|
128
|
+
* (§4), or one a spec defines in prose on each instance (`Location`'s `valueOf`, §4 Sources). It is no target of its
|
|
129
|
+
* own. Ordinary instances are never targets (§3), but a platform singleton's own members are `instance` targets named
|
|
130
|
+
* by its canonical path (§4): `location.href`, `document.location`, `location.valueOf`.
|
|
131
|
+
*/
|
|
132
|
+
export type InstanceMember = Omit<CatalogTarget, 'holder' | 'holds' | 'kind' | 'catalogStatus'> & {
|
|
133
|
+
/**
|
|
134
|
+
* `[LegacyUnforgeable]` applies only to regular operations and attributes. A prose member is a `function`, a `value`
|
|
135
|
+
* or an `accessor`, as an ECMAScript property is.
|
|
136
|
+
*/
|
|
137
|
+
kind: 'operation' | 'attribute' | PropertyKind;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* An entry of the curated overlay of own members a spec defines in prose on each instance of an interface, rather than
|
|
141
|
+
* in IDL (§4 Sources): HTML's Location object setup steps give every `Location` object its own `valueOf` and
|
|
142
|
+
* `@@toPrimitive`, non-writable and non-configurable. Each joins its interface's per-instance members.
|
|
143
|
+
*/
|
|
144
|
+
export interface ProseMember {
|
|
145
|
+
/** The spec whose prose defines it, credited on its member: `html`. */
|
|
146
|
+
spec: string;
|
|
147
|
+
/** Where the entry was curated from: the spec's section, and what its prose says. */
|
|
148
|
+
source: string;
|
|
149
|
+
/** What the property is: it holds a built-in `function`, holds another `value`, or is an `accessor`. */
|
|
150
|
+
kind: PropertyKind;
|
|
151
|
+
/** Its descriptor, as the spec's prose gives it. */
|
|
152
|
+
descriptor: Descriptor;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* What each instance of a Web IDL interface carries itself. The platform singletons (§3) that are its instances carry
|
|
156
|
+
* it on their holders: the `location` holder, a `Location` instance, has `immutablePrototype`.
|
|
157
|
+
*/
|
|
158
|
+
export interface InstanceData {
|
|
159
|
+
/** Set when every instance is an immutable prototype exotic object, as `Location` instances are (§4 Member data). */
|
|
160
|
+
immutablePrototype?: true;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* An entry of the curated ES additions overlay (§4 Sources): an addition ECMA-262 and ECMA-402 do not define yet, such
|
|
164
|
+
* as `Temporal`, described as the clause titles its spec gives its properties.
|
|
165
|
+
*/
|
|
166
|
+
export interface EsAddition {
|
|
167
|
+
/** The spec that defines it, credited on its targets. */
|
|
168
|
+
spec: string;
|
|
169
|
+
/** Where the entry was curated from: the spec's URL and version. */
|
|
170
|
+
source: string;
|
|
171
|
+
/** The objects it adds that are namespaces, e.g. `Temporal`, `Temporal.Now`. */
|
|
172
|
+
namespaces: string[];
|
|
173
|
+
/**
|
|
174
|
+
* Its properties, as ECMA-262 titles clauses: `Temporal.PlainDate.from ( item [ , options ] )`, `get
|
|
175
|
+
* Temporal.PlainDate.prototype.year`. A single name, `Temporal`, is a property of the global object.
|
|
176
|
+
*/
|
|
177
|
+
properties: string[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* An entry of the curated engine-extensions overlay (§4 Sources), by the path of the property it describes
|
|
181
|
+
* (`Error.stackTraceLimit`): an own property an engine defines on an ECMAScript intrinsic outside ECMA-262. It is a
|
|
182
|
+
* native member like any other, in every realm, so a write to it is a `replace`, not an `add`.
|
|
183
|
+
*/
|
|
184
|
+
export interface EngineExtension {
|
|
185
|
+
/** The engine that defines it, credited on its targets as their `spec`: `v8`. */
|
|
186
|
+
engine: string;
|
|
187
|
+
/** Where the entry was curated from: the engine's version, and how its descriptor was read. */
|
|
188
|
+
source: string;
|
|
189
|
+
/** What the property is: it holds a built-in `function`, holds another `value`, or is an `accessor`. */
|
|
190
|
+
kind: PropertyKind;
|
|
191
|
+
/** Its descriptor in the engine, as the engine defines it. */
|
|
192
|
+
descriptor: Descriptor;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* An entry of the curated engine-prototypes overlay (§4 Sources), by the name of the holder it adds: a prototype object
|
|
196
|
+
* an engine puts on a platform singleton's chain where Web IDL has none. `HTMLDocument.prototype` sits between
|
|
197
|
+
* `document` and `Document.prototype`, as every engine has it, although `@webref/idl` has no `HTMLDocument`. It is a
|
|
198
|
+
* `prototype` holder whose only own members are `constructor` and `@@toStringTag`, and its interface object is a
|
|
199
|
+
* `constructor` holder named by `owner`, held by a `global` target of each realm it is in (`Window.HTMLDocument`), with
|
|
200
|
+
* the `prototype` that holds it (§4 Sources, Targets and holders).
|
|
201
|
+
*/
|
|
202
|
+
export interface EnginePrototype {
|
|
203
|
+
/** The engine whose chain it follows: `blink`. */
|
|
204
|
+
engine: string;
|
|
205
|
+
/** Where the entry was curated from: the engine, and how its chain was read. */
|
|
206
|
+
source: string;
|
|
207
|
+
/** The realms it is in, each a realm where every holder in `prototypeOf` is. */
|
|
208
|
+
realms: Realm[];
|
|
209
|
+
/** The interface it belongs to in the engine: `HTMLDocument`. It is the holder's `owner`. */
|
|
210
|
+
owner: string;
|
|
211
|
+
/** The holder it inherits from, the one each holder in `prototypeOf` had as its prototype: `Document.prototype`. */
|
|
212
|
+
proto: string;
|
|
213
|
+
/** The holders whose prototype it becomes: `document`. */
|
|
214
|
+
prototypeOf: string[];
|
|
215
|
+
/** Its interface object, the `constructor` holder named by `owner`: `proto` is the holder it inherits from, `Document`. */
|
|
216
|
+
interfaceObject: {
|
|
217
|
+
proto: string;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* An entry of the curated overlay of ECMA-262 own properties that have no clause of their own (§4 Sources), by the
|
|
222
|
+
* path of the property it describes: `Function.prototype.caller` and `.arguments`, which AddRestrictedFunctionProperties
|
|
223
|
+
* defines, and `Array.prototype.length` and `String.prototype.length`, which the prose of their prototype objects'
|
|
224
|
+
* clauses defines. A biblio lists no clause title for them, so the generator can't read them from ECMA-262. Each is an
|
|
225
|
+
* ECMA-262 member like any other, in every realm, credited to `ecma262`.
|
|
226
|
+
*/
|
|
227
|
+
export interface EsProseProperty {
|
|
228
|
+
/** Where ECMA-262 defines it: the clause, and what its prose says. */
|
|
229
|
+
source: string;
|
|
230
|
+
/** What the property is: it holds a built-in `function`, holds another `value`, or is an `accessor`. */
|
|
231
|
+
kind: PropertyKind;
|
|
232
|
+
/** Its descriptor, as ECMA-262 gives it. */
|
|
233
|
+
descriptor: Descriptor;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* A curated shape of a normalized source path (§10 Escaped sources), which a framework path rule or an escape-only
|
|
237
|
+
* shape matches. It is matched against a source with no `node_modules` segment, on its normalized path: the scheme and
|
|
238
|
+
* namespace stripped, a relative `sourceRoot` joined, `.` and `x/..` segments collapsed, leading `..` segments kept.
|
|
239
|
+
*/
|
|
240
|
+
export interface PathShape {
|
|
241
|
+
/** Where the shape was observed, and why it is curated. */
|
|
242
|
+
source: string;
|
|
243
|
+
/**
|
|
244
|
+
* The bundler namespace the source must be in, as attribution names it: `webpack:<ns>` for `webpack://<ns>/`
|
|
245
|
+
* (`webpack:_N_E`). Absent, a source in any namespace matches.
|
|
246
|
+
*/
|
|
247
|
+
namespace?: string;
|
|
248
|
+
/**
|
|
249
|
+
* The fewest leading `..` segments the path must start with, with `segments` right after them. Absent, the run of
|
|
250
|
+
* `segments` may start at any segment of the path.
|
|
251
|
+
*/
|
|
252
|
+
up?: number;
|
|
253
|
+
/**
|
|
254
|
+
* The run of whole segments to match, at least one of them. In a segment, `*` matches any characters, possibly none,
|
|
255
|
+
* and `<name>` matches one or more characters, which the shape captures as `name`. The path has at least one segment
|
|
256
|
+
* after the run.
|
|
257
|
+
*/
|
|
258
|
+
segments: string[];
|
|
259
|
+
/**
|
|
260
|
+
* The whole values a placeholder may capture, by placeholder name: `{ pkg: ['core', 'common', …] }` limits `<pkg>` to
|
|
261
|
+
* those. Absent, or for a placeholder it doesn't list, a placeholder captures any value.
|
|
262
|
+
*/
|
|
263
|
+
captures?: Record<string, string[]>;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* A framework path rule (§10 Framework path rules), by its id: a shape whose escaped source is named as a file of
|
|
267
|
+
* `package`. It only names a package: never first-party, never `high` (§9 `framework-path-rule`), never a version.
|
|
268
|
+
*/
|
|
269
|
+
export interface FrameworkPathRule extends PathShape {
|
|
270
|
+
/** The package it names, where `<name>` stands for what the shape captured as `name`: `next`, `@angular/<pkg>`. */
|
|
271
|
+
package: string;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* An escape-only shape (§10 Escaped sources), by its id: a shape that names no package. A source that matches one is
|
|
275
|
+
* always escaped (`unknown`, `escaped-source`), wherever the inferred root is.
|
|
276
|
+
*/
|
|
277
|
+
export type EscapeOnlyShape = PathShape;
|
|
278
|
+
/**
|
|
279
|
+
* A platform singleton (§3) in a realm: a native instance reachable from the global object and shared by the whole
|
|
280
|
+
* realm. The catalog keys it by its canonical path from the global, without the global's prefix (`history`,
|
|
281
|
+
* `navigator.geolocation`, `crypto.subtle`), which is also the name of its holder and the prefix of its targets.
|
|
282
|
+
*/
|
|
283
|
+
export type Singleton = {
|
|
284
|
+
/**
|
|
285
|
+
* The property its value is read from, as a target of the same realm: a property of the global (`Window.history`)
|
|
286
|
+
* or of the singleton its path extends (`Navigator.prototype.geolocation`).
|
|
287
|
+
*/
|
|
288
|
+
via: string;
|
|
289
|
+
} & ({
|
|
290
|
+
/** The interface it is an instance of: its holder is an `instance` holder on that interface's prototype. */
|
|
291
|
+
interface: string;
|
|
292
|
+
} | {
|
|
293
|
+
/** The namespace it is, for `console`: its holder is that namespace's `namespace` holder. */
|
|
294
|
+
namespace: string;
|
|
295
|
+
});
|
|
296
|
+
/**
|
|
297
|
+
* An entry of the curated exclusions overlay (§4 Sources): an interface, namespace or intrinsic upstream publishes that
|
|
298
|
+
* the catalog leaves out, such as a test-only API.
|
|
299
|
+
*/
|
|
300
|
+
export interface Exclusion {
|
|
301
|
+
/** Why it is left out. */
|
|
302
|
+
reason: string;
|
|
303
|
+
/** The targets it would have had, per realm, by name, sorted. None of them is in `targets`. */
|
|
304
|
+
targets: Record<Realm, string[]>;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* The curated owner → surface map (§12 Surfaces and data), with per-member overrides. It was seeded once from spec
|
|
308
|
+
* shortname and HTML section page, and its protected owners were reviewed by hand. It never says `other`: a member it
|
|
309
|
+
* says nothing about is `other`, the surface of an owner nobody has reviewed. ECMAScript members are always
|
|
310
|
+
* `ECMAScript`, and are not in it.
|
|
311
|
+
*/
|
|
312
|
+
export interface SurfaceMap {
|
|
313
|
+
/**
|
|
314
|
+
* The surface of each interface or namespace, by name, and of an interface mixin, whose members take its surface on
|
|
315
|
+
* every interface that includes it.
|
|
316
|
+
*/
|
|
317
|
+
owners: Record<string, Surface>;
|
|
318
|
+
/** The surface of single members, by the interface, namespace or mixin that declares them, and then by member. */
|
|
319
|
+
members: Record<string, Record<string, Surface>>;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* An entry of the protected-surface list (§12 The list), keyed on (interface, member) and independent of realm and
|
|
323
|
+
* holder. Without a `member`, it is a whole-interface or namespace entry.
|
|
324
|
+
*/
|
|
325
|
+
export interface ProtectedEntry {
|
|
326
|
+
/** An interface, namespace or intrinsic; for a member entry, also an interface mixin (`WindowOrWorkerGlobalScope`). */
|
|
327
|
+
interface: string;
|
|
328
|
+
member?: string;
|
|
329
|
+
/**
|
|
330
|
+
* For a member entry, the interface that declares the member's worker-realm equivalent (§12 Matching): the entry also
|
|
331
|
+
* names that interface's member of the same name in each worker realm. `WorkerNavigator.prototype.serviceWorker` is
|
|
332
|
+
* the `Navigator.serviceWorker` entry's.
|
|
333
|
+
*/
|
|
334
|
+
workerEquivalent?: string;
|
|
335
|
+
/**
|
|
336
|
+
* The catalog targets the entry names, per realm, by name, sorted. A member entry names that member on its owner, or
|
|
337
|
+
* on each interface that includes its mixin, and in the worker realms on its `workerEquivalent`. A whole entry names
|
|
338
|
+
* the properties that hold its interface or namespace object (`Window.XMLHttpRequest`) and the members it owns on its
|
|
339
|
+
* constructor, prototype or namespace holders, but no event-handler attribute (`onX`). The shadowing writes and other forms an entry matches in a scan (§12 Matching) are
|
|
340
|
+
* no catalog targets, so they are not listed.
|
|
341
|
+
*/
|
|
342
|
+
targets: Record<Realm, string[]>;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Why a retained target or holder (§4 Catalog versions) is in the catalog although upstream removed it: the last
|
|
346
|
+
* upstream version that had it, and why it left.
|
|
347
|
+
*/
|
|
348
|
+
export interface Retention {
|
|
349
|
+
/** The last upstream package and version that had it, e.g. `@webref/idl 3.84.0`. */
|
|
350
|
+
lastUpstream: string;
|
|
351
|
+
/** Why upstream removed it, and why it stays, e.g. that its spec was discontinued but an engine still ships it. */
|
|
352
|
+
reason: string;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* A deliberate drop (§4 Catalog versions): a target or holder upstream removed that the catalog lets go, backed by BCD
|
|
356
|
+
* evidence that no current engine ships it.
|
|
357
|
+
*/
|
|
358
|
+
export interface Drop {
|
|
359
|
+
/** The BCD feature the evidence is about, e.g. `api.Navigator.joinAdInterestGroup`. */
|
|
360
|
+
bcd: string;
|
|
361
|
+
/** What BCD, at a version it names, shows. */
|
|
362
|
+
evidence: string;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* The remote URL normalization rules (§11 Remote URL normalization): versioned data, so a change to them shows in the
|
|
366
|
+
* catalog diff. A remote artifact's attribution key is `url:` and its URL normalized by them, in order:
|
|
367
|
+
* 1. `scheme`: a URL whose scheme is one of `from` takes `to` (`http:` → `https:`). A protocol-relative reference has
|
|
368
|
+
* already resolved to its page's scheme.
|
|
369
|
+
* 2. `host` is lowercased, and `drop` names what is dropped: the default port, the query and the fragment.
|
|
370
|
+
* 3. and 4. `path`: rewrites of the path only, in order. Each replaces every match of its `pattern`, a JavaScript
|
|
371
|
+
* regular expression (with the `u` flag), with its `replacement`: version tokens with `*` (step 3) and hex runs of 8
|
|
372
|
+
* or more characters with `#` (step 4), as whole tokens bounded by `/`, `.`, `-`, `_`, `@` or the ends.
|
|
373
|
+
*/
|
|
374
|
+
export interface RemoteUrlNormalization {
|
|
375
|
+
scheme: {
|
|
376
|
+
from: string[];
|
|
377
|
+
to: string;
|
|
378
|
+
};
|
|
379
|
+
host: 'lowercase';
|
|
380
|
+
drop: ('default-port' | 'query' | 'fragment')[];
|
|
381
|
+
path: PathRule[];
|
|
382
|
+
}
|
|
383
|
+
/** A rewrite of a remote URL's path (§11 Remote URL normalization, steps 3 and 4). */
|
|
384
|
+
export interface PathRule {
|
|
385
|
+
id: string;
|
|
386
|
+
step: 3 | 4;
|
|
387
|
+
pattern: string;
|
|
388
|
+
replacement: string;
|
|
389
|
+
}
|
|
390
|
+
/** The runtime catalog, as committed in `catalog/catalog.json` (§19 Catalog as data). */
|
|
391
|
+
export interface SerializedCatalog {
|
|
392
|
+
metadata: {
|
|
393
|
+
/**
|
|
394
|
+
* The catalog version (§4 Catalog versions): one version for all of monkeypatchlist's curated data, separate from the
|
|
395
|
+
* monkeypatchlist version. It only ever grows, one bump per monkeypatchlist minor release, so two versions compare as integers.
|
|
396
|
+
*/
|
|
397
|
+
catalogVersion: number;
|
|
398
|
+
/** Exact pins of the upstream packages the catalog was generated from. */
|
|
399
|
+
upstream: Record<string, string>;
|
|
400
|
+
/** A pin of each curated overlay the catalog was generated from: the sha256 of the file's bytes, by file name. */
|
|
401
|
+
overlays: Record<string, string>;
|
|
402
|
+
};
|
|
403
|
+
/** Targets and their member data, per realm: each realm lists the targets exposed in it. */
|
|
404
|
+
targets: Record<Realm, Record<string, CatalogTarget>>;
|
|
405
|
+
/** The objects targets live on, per realm, by name, with their prototype chains. */
|
|
406
|
+
holders: Record<Realm, Record<string, CatalogHolder>>;
|
|
407
|
+
/**
|
|
408
|
+
* Per-instance members, per realm, by interface and then member name. The `[LegacyUnforgeable]` members of a realm's
|
|
409
|
+
* `[Global]` interface are not listed: the global is that interface's only instance, so they are its own targets.
|
|
410
|
+
*/
|
|
411
|
+
instanceMembers: Record<Realm, Record<string, Record<string, InstanceMember>>>;
|
|
412
|
+
/** What each instance of an interface carries itself, per realm, by interface, for the interfaces that carry any. */
|
|
413
|
+
instances: Record<Realm, Record<string, InstanceData>>;
|
|
414
|
+
/** The ES additions overlay, as the generator read it. */
|
|
415
|
+
esAdditions: Record<string, EsAddition>;
|
|
416
|
+
/** The engine-extensions overlay, as the generator read it, by the path of each property. */
|
|
417
|
+
engineExtensions: Record<string, EngineExtension>;
|
|
418
|
+
/** The overlay of ECMA-262 own properties without a clause of their own, as the generator read it, by path. */
|
|
419
|
+
esProseProperties: Record<string, EsProseProperty>;
|
|
420
|
+
/** The engine-prototypes overlay, as the generator read it, by the name of each holder it adds. */
|
|
421
|
+
enginePrototypes: Record<string, EnginePrototype>;
|
|
422
|
+
/**
|
|
423
|
+
* The overlay of own members a spec defines in prose on each instance of an interface, as the generator read it, by
|
|
424
|
+
* interface and then member. Each is also in `instanceMembers`.
|
|
425
|
+
*/
|
|
426
|
+
proseMembers: Record<string, Record<string, ProseMember>>;
|
|
427
|
+
/** The platform singletons overlay, resolved against the IDL: each realm's singletons, by canonical path. */
|
|
428
|
+
singletons: Record<Realm, Record<string, Singleton>>;
|
|
429
|
+
/**
|
|
430
|
+
* Each singleton's alias group, per realm, by canonical path: every access path from the global that reaches it,
|
|
431
|
+
* including the canonical path itself, sorted. `window.history`, `self.history` and `document.location` are paths to
|
|
432
|
+
* `history` and `location` (§4).
|
|
433
|
+
*/
|
|
434
|
+
aliasGroups: Record<Realm, Record<string, string[]>>;
|
|
435
|
+
/** The exclusions overlay, by the owner it excludes, with the targets each leaves out. */
|
|
436
|
+
exclusions: Record<string, Exclusion>;
|
|
437
|
+
/** The owner → surface map every member's `surface` comes from. */
|
|
438
|
+
surfaceMap: SurfaceMap;
|
|
439
|
+
/**
|
|
440
|
+
* The protected-surface list (§12), by surface: the entries a `--surface protected` scan reports, baselines and gates
|
|
441
|
+
* on. Every target an entry names has the entry's surface.
|
|
442
|
+
*/
|
|
443
|
+
protectedSurface: Partial<Record<Surface, ProtectedEntry[]>>;
|
|
444
|
+
/**
|
|
445
|
+
* The retained overlay (§4 Catalog versions), per realm, by name. The catalog is monotonic, holders too: a target or
|
|
446
|
+
* holder upstream removes stays, as it was last generated, until a deliberate drop.
|
|
447
|
+
*/
|
|
448
|
+
retained: {
|
|
449
|
+
/** The retained targets, each also in `targets`, flagged `catalogStatus: retained`. */
|
|
450
|
+
targets: Record<Realm, Record<string, Retention>>;
|
|
451
|
+
/** The holders upstream removed that the catalog keeps, each also in `holders`. */
|
|
452
|
+
holders: Record<Realm, Record<string, Retention>>;
|
|
453
|
+
/** The targets deliberately dropped, none of them in `targets`. */
|
|
454
|
+
dropped: Record<Realm, Record<string, Drop>>;
|
|
455
|
+
/** The holders deliberately dropped (holders are monotonic too), none of them in `holders`. */
|
|
456
|
+
droppedHolders: Record<Realm, Record<string, Drop>>;
|
|
457
|
+
};
|
|
458
|
+
/** The remote URL normalization rules (§11), as the generator read them. */
|
|
459
|
+
remoteUrlNormalization: RemoteUrlNormalization;
|
|
460
|
+
/** The framework path rules (§10), as the generator read them, by id. */
|
|
461
|
+
frameworkPathRules: Record<string, FrameworkPathRule>;
|
|
462
|
+
/** The escape-only shapes (§10), as the generator read them, by id. */
|
|
463
|
+
escapeOnlyShapes: Record<string, EscapeOnlyShape>;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* The `spec`s of a catalog's ECMAScript targets: `ecma262`, `ecma402`, each ES addition's spec and each engine
|
|
467
|
+
* extension's engine. A catalog written before either overlay has none of its specs.
|
|
468
|
+
*/
|
|
469
|
+
export declare function ecmascriptSpecs(catalog: {
|
|
470
|
+
esAdditions?: Readonly<Record<string, Pick<EsAddition, 'spec'>>> | undefined;
|
|
471
|
+
engineExtensions?: Readonly<Record<string, Pick<EngineExtension, 'engine'>>> | undefined;
|
|
472
|
+
}): Set<string>;
|
|
473
|
+
/**
|
|
474
|
+
* Reads the catalog that ships with this package. Only the CLI's composition root calls this; the pipeline modules
|
|
475
|
+
* receive the catalog as data (§19 Invariants).
|
|
476
|
+
*/
|
|
477
|
+
export declare function loadCatalog(): SerializedCatalog;
|
|
478
|
+
/**
|
|
479
|
+
* A change record of the catalog changelog (§4 Catalog versions): one change between a catalog version and the one
|
|
480
|
+
* before it, which `explainedBy` offers as what could explain a delta. Surface reassignments explain nothing (surface
|
|
481
|
+
* is context only), so the changelog has none.
|
|
482
|
+
* - `target`: a target `added`, or `dropped` (a deliberate drop, or an exclusion, which counts as one)
|
|
483
|
+
* - `protected-entry`: a protected-surface entry `gained` or `lost` (§12), with the targets it named in its catalog
|
|
484
|
+
* - `member-data`: a target's descriptor or `assign` kind changed (§4 Member data)
|
|
485
|
+
* - `holder`: a holder `added`, `dropped` or `rechained`, with its prototype on each side it has
|
|
486
|
+
* - `immutable-prototype`: a holder's `immutablePrototype` flag flipped
|
|
487
|
+
* - `framework-path-rule`: a framework path rule (§10) `added`, `removed` or `changed`, by id
|
|
488
|
+
* - `url-normalization`: a remote URL normalization rule (§11) `added`, `removed` or `changed`: a path rule by its id,
|
|
489
|
+
* or the `scheme`, `host` or `drop` step
|
|
490
|
+
*
|
|
491
|
+
* A member entering or leaving a holder's enumeration is a `target` record (the member is added or dropped) or a
|
|
492
|
+
* `member-data` record (its `enumerable` flips).
|
|
493
|
+
*/
|
|
494
|
+
export type ChangeRecord = {
|
|
495
|
+
kind: 'target';
|
|
496
|
+
change: 'added' | 'dropped';
|
|
497
|
+
realm: Realm;
|
|
498
|
+
name: string;
|
|
499
|
+
} | {
|
|
500
|
+
kind: 'protected-entry';
|
|
501
|
+
change: 'gained' | 'lost';
|
|
502
|
+
surface: Surface;
|
|
503
|
+
entry: ProtectedEntry;
|
|
504
|
+
} | {
|
|
505
|
+
kind: 'member-data';
|
|
506
|
+
realm: Realm;
|
|
507
|
+
name: string;
|
|
508
|
+
before: MemberData;
|
|
509
|
+
after: MemberData;
|
|
510
|
+
} | {
|
|
511
|
+
kind: 'holder';
|
|
512
|
+
change: 'added' | 'dropped' | 'rechained';
|
|
513
|
+
realm: Realm;
|
|
514
|
+
holder: string;
|
|
515
|
+
/** Its prototype in the earlier catalog; absent for an added holder. */
|
|
516
|
+
before?: {
|
|
517
|
+
proto: string | null;
|
|
518
|
+
};
|
|
519
|
+
/** Its prototype in the later catalog; absent for a dropped holder. */
|
|
520
|
+
after?: {
|
|
521
|
+
proto: string | null;
|
|
522
|
+
};
|
|
523
|
+
} | {
|
|
524
|
+
kind: 'immutable-prototype';
|
|
525
|
+
realm: Realm;
|
|
526
|
+
holder: string;
|
|
527
|
+
before: boolean;
|
|
528
|
+
after: boolean;
|
|
529
|
+
} | {
|
|
530
|
+
kind: 'framework-path-rule';
|
|
531
|
+
change: 'added' | 'removed' | 'changed';
|
|
532
|
+
id: string;
|
|
533
|
+
before?: FrameworkPathRule;
|
|
534
|
+
after?: FrameworkPathRule;
|
|
535
|
+
} | {
|
|
536
|
+
kind: 'url-normalization';
|
|
537
|
+
change: 'added' | 'removed' | 'changed';
|
|
538
|
+
id: string;
|
|
539
|
+
before?: unknown;
|
|
540
|
+
after?: unknown;
|
|
541
|
+
};
|
|
542
|
+
/** The member data a `member-data` change record compares: the descriptor and, for an attribute, its `assign` kind. */
|
|
543
|
+
export interface MemberData {
|
|
544
|
+
descriptor: Descriptor;
|
|
545
|
+
assign?: AssignKind;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* The catalog changelog (§4 Catalog versions), shipped in the package as `catalog/changelog.json`: for each catalog
|
|
549
|
+
* version after the first, ascending, the change records from the version before it.
|
|
550
|
+
*/
|
|
551
|
+
export interface CatalogChangelog {
|
|
552
|
+
versions: {
|
|
553
|
+
catalogVersion: number;
|
|
554
|
+
changes: ChangeRecord[];
|
|
555
|
+
}[];
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Reads the catalog changelog that ships with this package. Only the CLI's composition root calls this; the pipeline
|
|
559
|
+
* modules receive it as data (§19 Invariants).
|
|
560
|
+
*/
|
|
561
|
+
export declare function loadChangelog(): CatalogChangelog;
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
/** The kinds of global environment a target can live in (§4). */
|
|
3
|
+
export const realms = ['window', 'dedicated-worker', 'shared-worker', 'service-worker'];
|
|
4
|
+
/** Where a target's property lives (§4 Targets and holders). */
|
|
5
|
+
export const holders = ['global', 'constructor', 'prototype', 'instance', 'namespace'];
|
|
6
|
+
/**
|
|
7
|
+
* The functional categories of targets (§12): `other` is the surface of an owner nobody has reviewed yet. Every member
|
|
8
|
+
* carries one (§4 Member data). A surface is context, not identity: reassigning one explains no delta (§4).
|
|
9
|
+
*/
|
|
10
|
+
export const surfaces = [
|
|
11
|
+
'networking',
|
|
12
|
+
'events',
|
|
13
|
+
'scheduling',
|
|
14
|
+
'navigation',
|
|
15
|
+
'storage',
|
|
16
|
+
'crypto',
|
|
17
|
+
'DOM',
|
|
18
|
+
'ECMAScript',
|
|
19
|
+
'diagnostics',
|
|
20
|
+
'workers',
|
|
21
|
+
'other',
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* The kinds of an ECMAScript property, which each entry of a curated overlay of single properties gives (§4 Sources):
|
|
25
|
+
* it holds a built-in `function`, holds another `value`, or is an `accessor`.
|
|
26
|
+
*/
|
|
27
|
+
export const propertyKinds = ['function', 'value', 'accessor'];
|
|
28
|
+
/**
|
|
29
|
+
* The name of the named properties object holder of a `[Global]` interface that supports named properties (§4):
|
|
30
|
+
* `WindowProperties` for `Window`. It is a `prototype` holder owned by the interface, between its interface prototype
|
|
31
|
+
* object and the prototype it inherits.
|
|
32
|
+
*/
|
|
33
|
+
export function namedPropertiesObject(global) {
|
|
34
|
+
return `${global}Properties`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The `spec`s of a catalog's ECMAScript targets: `ecma262`, `ecma402`, each ES addition's spec and each engine
|
|
38
|
+
* extension's engine. A catalog written before either overlay has none of its specs.
|
|
39
|
+
*/
|
|
40
|
+
export function ecmascriptSpecs(catalog) {
|
|
41
|
+
const additions = Object.values(catalog.esAdditions ?? {}).map(({ spec }) => spec);
|
|
42
|
+
const engines = Object.values(catalog.engineExtensions ?? {}).map(({ engine }) => engine);
|
|
43
|
+
return new Set(['ecma262', 'ecma402', ...additions, ...engines]);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Reads the catalog that ships with this package. Only the CLI's composition root calls this; the pipeline modules
|
|
47
|
+
* receive the catalog as data (§19 Invariants).
|
|
48
|
+
*/
|
|
49
|
+
export function loadCatalog() {
|
|
50
|
+
return JSON.parse(readFileSync(new URL('../catalog/catalog.json', import.meta.url), 'utf8'));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Reads the catalog changelog that ships with this package. Only the CLI's composition root calls this; the pipeline
|
|
54
|
+
* modules receive it as data (§19 Invariants).
|
|
55
|
+
*/
|
|
56
|
+
export function loadChangelog() {
|
|
57
|
+
return JSON.parse(readFileSync(new URL('../catalog/changelog.json', import.meta.url), 'utf8'));
|
|
58
|
+
}
|