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,137 @@
|
|
|
1
|
+
import type { Realm, SerializedCatalog } from '../../../catalog.ts';
|
|
2
|
+
import { type AstNode } from './ast.ts';
|
|
3
|
+
import type { Caps } from './budget.ts';
|
|
4
|
+
import { type GlobalResolution, type Position } from './global-object.ts';
|
|
5
|
+
import { type Starts } from './line-starts.ts';
|
|
6
|
+
import { type ScopeRules } from './scope.ts';
|
|
7
|
+
import { type Binding } from './summaries.ts';
|
|
8
|
+
import type { CreationSiteStep, GeneratedLocation, GuardStep, Reachability, ReachabilityBasis } from './types.ts';
|
|
9
|
+
/** Two guards on one path (AND): `config.polyfill && !window.fetch` is `guarded-native-absence` (§7). */
|
|
10
|
+
export declare function along(a: Reachability, b: Reachability): Reachability;
|
|
11
|
+
/** Two alternatives (OR): the most-reaching, so `!window.fetch || force` is `conditional` (§7). */
|
|
12
|
+
export declare function across(a: Reachability, b: Reachability): Reachability;
|
|
13
|
+
export interface GuardContext {
|
|
14
|
+
resolution: GlobalResolution;
|
|
15
|
+
scope: ScopeRules;
|
|
16
|
+
catalog: SerializedCatalog;
|
|
17
|
+
realm: Realm;
|
|
18
|
+
/** The realm's global holder, e.g. `Window`. */
|
|
19
|
+
global: string;
|
|
20
|
+
/** The host artifact's text and line-start table. */
|
|
21
|
+
text: string;
|
|
22
|
+
starts: Starts;
|
|
23
|
+
/** The node a node is a child of, to judge a test that reads a parameter with the arguments of its call. */
|
|
24
|
+
parentOf?: (node: AstNode) => AstNode | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* The resolved call the function the path is in is judged under, when it has no frame: a test of one of its
|
|
27
|
+
* parameters is judged as the argument this call passes (§7).
|
|
28
|
+
*/
|
|
29
|
+
call?: Binding | undefined;
|
|
30
|
+
/** The caps (§18): `testReads` and `throwDepth` here. */
|
|
31
|
+
caps: Pick<Caps, 'testReads' | 'throwDepth'>;
|
|
32
|
+
/** Counts a hit of one of them, at the node where it cut (§18). */
|
|
33
|
+
capHit(name: 'testReads' | 'throwDepth', node: AstNode): void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The write a reachability is judged for: its site, its target, and the `with` statements and direct `eval` calls on
|
|
37
|
+
* the resolution paths of its names (§5 post-pass 3), whose taint makes it `unknown` (§7).
|
|
38
|
+
*/
|
|
39
|
+
export interface Judged {
|
|
40
|
+
site: AstNode;
|
|
41
|
+
target: {
|
|
42
|
+
name: string;
|
|
43
|
+
shadows?: string;
|
|
44
|
+
};
|
|
45
|
+
taints: readonly GeneratedLocation[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A write's reachability, and the `guard` steps (§14) of the guards on its path, outermost first, with a `creation-site`
|
|
49
|
+
* step where the path goes out through where a caller-less function was created. `tests` maps each test a guard step
|
|
50
|
+
* was made for to its step. `dead` is set when a statically false catalog check on the path means the write never runs
|
|
51
|
+
* (§7 Checking guards against the catalog): the test that decides it. `basis` is how it was judged (§7), `call-path`
|
|
52
|
+
* when left out.
|
|
53
|
+
*/
|
|
54
|
+
export interface Judgement {
|
|
55
|
+
reachability: Reachability;
|
|
56
|
+
steps: (GuardStep | CreationSiteStep)[];
|
|
57
|
+
tests: ReadonlyMap<AstNode, GuardStep>;
|
|
58
|
+
dead?: AstNode;
|
|
59
|
+
/** For a `dead` test a call argument literal's field settled: that literal, which a `prune` step names. */
|
|
60
|
+
by?: AstNode;
|
|
61
|
+
/**
|
|
62
|
+
* The install entry the write waits on when it is `deferred` (§7 Install context): the function with no resolved
|
|
63
|
+
* caller that every live chain out from the write ends at. Absent when a chain reaches top-level code (`load`).
|
|
64
|
+
*/
|
|
65
|
+
entry?: AstNode;
|
|
66
|
+
basis?: ReachabilityBasis;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The reachability of a write, judged from the guards between it and the start of its function (§7). `path` is the
|
|
70
|
+
* walk's ancestors of the node that makes the write, outermost first, ending with that node.
|
|
71
|
+
*/
|
|
72
|
+
export declare function judge(path: readonly AstNode[], write: Judged, at: Position, context: GuardContext): Judgement;
|
|
73
|
+
/**
|
|
74
|
+
* The `catch` arms whose `try` block can't throw (§5 Resolver capabilities 9): a
|
|
75
|
+
* write only such an arm reaches never happens, so it gives nothing, but the resolver counts it as a `prune`.
|
|
76
|
+
*/
|
|
77
|
+
export declare const unreachedArms: WeakSet<AstNode>;
|
|
78
|
+
/**
|
|
79
|
+
* The tests that are filters on a swept key (§5 Resolver capabilities 9): a write such a test drops is no write of
|
|
80
|
+
* that key at all, so it gives nothing, and no `prune` counts it.
|
|
81
|
+
*/
|
|
82
|
+
export declare const sweepFilters: WeakSet<AstNode>;
|
|
83
|
+
/**
|
|
84
|
+
* The tests a call argument literal's field decides against the path (§5 Resolver capabilities 5): the arm they
|
|
85
|
+
* rule out is not reached, so a write there gives nothing, but the resolver counts it as a `prune`.
|
|
86
|
+
*/
|
|
87
|
+
export declare const ruledOutTests: WeakSet<AstNode>;
|
|
88
|
+
/**
|
|
89
|
+
* The `guard` steps of tests a call argument literal's field settled the way the path needs, each with the test
|
|
90
|
+
* and that literal: a write that only the arm the test rules out reaches leaves a `prune` step after it.
|
|
91
|
+
*/
|
|
92
|
+
export declare const argumentGuards: WeakMap<GuardStep, {
|
|
93
|
+
test: AstNode;
|
|
94
|
+
literal: AstNode | undefined;
|
|
95
|
+
}>;
|
|
96
|
+
/** The tests that are filters on a swept key, which the sweep's `enumeration` step records (§14). */
|
|
97
|
+
export declare const sweepTests: WeakSet<AstNode>;
|
|
98
|
+
/** The path from the top of the function a node is in down to the node, outermost first. */
|
|
99
|
+
export declare function functionPath(node: AstNode, parentOf: (node: AstNode) => AstNode | undefined): AstNode[];
|
|
100
|
+
/** What judging along call chains needs besides the guards' context: the resolved calls of a function. */
|
|
101
|
+
export interface ChainContext extends GuardContext {
|
|
102
|
+
/** The resolved calls of a function, each with its caller's frame when the resolver has one. */
|
|
103
|
+
callers(fn: AstNode): readonly Binding[];
|
|
104
|
+
parentOf(node: AstNode): AstNode | undefined;
|
|
105
|
+
/** For the function a direct eval's code is grafted in as, the eval call that runs it where the call is (§2). */
|
|
106
|
+
runBy?(fn: AstNode): AstNode | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* For the function a link group's member runs in, the dynamic imports that load it, when only they do (§6 Link
|
|
109
|
+
* groups): the code runs where an import is, after its guards, but never at load.
|
|
110
|
+
*/
|
|
111
|
+
loadedBy?(fn: AstNode): readonly AstNode[] | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* For a factory a lazy chunk pushes into a chunk registry, the function its chunk runs in (§6 idiom 6): code reached
|
|
114
|
+
* only through a chunk load waits on it, even when its module is required at top level.
|
|
115
|
+
*/
|
|
116
|
+
chunkOf?(fn: AstNode): AstNode | undefined;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Judges writes along their call chains (§7): the guards on a write's path in the function it is in, AND the chain out
|
|
120
|
+
* from there, with the `guard` steps of the alternative that gives it, outermost first. The chain ends at top-level
|
|
121
|
+
* code, the install entry, with basis `call-path`.
|
|
122
|
+
*
|
|
123
|
+
* A function with no resolved caller, or one reached only through itself, is no install entry: it is judged from its
|
|
124
|
+
* **creation site** (ADR 0013), the reachability of the code that created it AND the guards in force where it was
|
|
125
|
+
* created, then its own guards, with basis `creation-site` and a `creation-site` step after the creation path's guards.
|
|
126
|
+
* A creation that no code reaches (after an unconditional `return` or `throw`), or that only the function itself
|
|
127
|
+
* creates, was never evaluated, and gives `unknown`.
|
|
128
|
+
*
|
|
129
|
+
* The guards in a function are judged in its frame when the write is instantiated in one. Otherwise each resolved call
|
|
130
|
+
* of the function is an alternative of its own, and a test of a parameter is judged as the argument that call passes.
|
|
131
|
+
*/
|
|
132
|
+
export declare function chainJudge(context: ChainContext): (path: readonly AstNode[], write: Judged, at: Position, fn: AstNode | undefined) => Judgement;
|
|
133
|
+
/**
|
|
134
|
+
* The name of an install entry (§7 Install context): the function's own name, else the name it is bound to where it is
|
|
135
|
+
* created (a variable, an assigned member, an object's property or a class's method), else null.
|
|
136
|
+
*/
|
|
137
|
+
export declare function entryName(fn: AstNode, parentOf: (node: AstNode) => AstNode | undefined): string | null;
|