@stateward/plugin-errors 1.2.2 → 1.3.1
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/README.md +9 -8
- package/dist/catch-hides-unexpected.d.ts +4 -1
- package/dist/catch-hides-unexpected.js +12 -5
- package/dist/catch-misses-error.d.ts +1 -1
- package/dist/catch-misses-error.js +7 -4
- package/dist/finally-can-throw.js +3 -3
- package/dist/hover.js +6 -9
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -0
- package/dist/inference/analysis.d.ts +109 -0
- package/dist/inference/analysis.js +170 -0
- package/dist/inference/builtins.d.ts +0 -2
- package/dist/inference/builtins.js +0 -33
- package/dist/inference/deps.d.ts +13 -2
- package/dist/inference/deps.js +24 -13
- package/dist/inference/needs.d.ts +16 -0
- package/dist/inference/needs.js +27 -0
- package/dist/inference/packages.d.ts +24 -32
- package/dist/inference/packages.js +156 -680
- package/dist/inference/project.d.ts +4 -4
- package/dist/inference/project.js +6 -17
- package/dist/inference/solve.d.ts +29 -4
- package/dist/inference/solve.js +42 -12
- package/dist/inference/summarize.d.ts +27 -15
- package/dist/inference/summarize.js +247 -130
- package/dist/inference/summary.d.ts +41 -5
- package/dist/inference/summary.js +84 -12
- package/dist/inference/unreachable.d.ts +5 -0
- package/dist/inference/unreachable.js +160 -0
- package/dist/inlay.d.ts +1 -5
- package/dist/inlay.js +1 -12
- package/dist/must-handle-error.d.ts +4 -3
- package/dist/must-handle-error.js +10 -13
- package/dist/plugin.d.ts +12 -2
- package/dist/plugin.js +4 -2
- package/dist/react/boundaries.d.ts +9 -7
- package/dist/react/boundaries.js +16 -24
- package/dist/react/tree.js +8 -4
- package/dist/refactors.js +1 -1
- package/dist/render-throw-without-boundary.d.ts +13 -4
- package/dist/render-throw-without-boundary.js +4 -2
- package/dist/result-ignored.d.ts +4 -1
- package/dist/result-type.js +2 -2
- package/dist/result-unchecked.d.ts +4 -1
- package/dist/result-unchecked.js +139 -61
- package/dist/rules.meta.d.ts +26 -14
- package/dist/rules.meta.js +18 -14
- package/dist/syntax.d.ts +0 -13
- package/dist/syntax.js +0 -79
- package/dist/text.d.ts +5 -2
- package/dist/text.js +11 -5
- package/dist/throws-doc-mismatch.d.ts +2 -2
- package/dist/throws-doc-mismatch.js +13 -5
- package/package.json +2 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FactNeed, UnnamedFact } from "@stateward/core";
|
|
2
|
+
import type { UnknownFact } from "./solve.js";
|
|
3
|
+
/** What a "not checked" finding carries for the places it depends on (`Finding.needs`, `unnamed`). */
|
|
4
|
+
export type DecidingFacts = {
|
|
5
|
+
needs?: readonly FactNeed[];
|
|
6
|
+
unnamed?: readonly UnnamedFact[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The `facts` lines that decide a finding, one per call, from every unknown it depends on whose
|
|
10
|
+
* call no line states: a call met on both sides needs the one side `neededSides` picks. The
|
|
11
|
+
* package calls no key can name are listed apart, once each, with why.
|
|
12
|
+
*/
|
|
13
|
+
export declare function decidingFacts(unknowns: Iterable<{
|
|
14
|
+
readonly fact?: UnknownFact | undefined;
|
|
15
|
+
}>): DecidingFacts;
|
|
16
|
+
//# sourceMappingURL=needs.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { neededSides } from "@stateward/core";
|
|
2
|
+
/**
|
|
3
|
+
* The `facts` lines that decide a finding, one per call, from every unknown it depends on whose
|
|
4
|
+
* call no line states: a call met on both sides needs the one side `neededSides` picks. The
|
|
5
|
+
* package calls no key can name are listed apart, once each, with why.
|
|
6
|
+
*/
|
|
7
|
+
export function decidingFacts(unknowns) {
|
|
8
|
+
const needs = new Map();
|
|
9
|
+
const unnamed = new Map();
|
|
10
|
+
for (const { fact } of unknowns) {
|
|
11
|
+
if (fact?.kind === "unstated") {
|
|
12
|
+
const { need } = fact;
|
|
13
|
+
const key = `${need.module}\u0000${need.name}`;
|
|
14
|
+
const known = needs.get(key);
|
|
15
|
+
const states = neededSides([...(known?.states ?? []), ...need.states]);
|
|
16
|
+
needs.set(key, { ...(known ?? need), states });
|
|
17
|
+
}
|
|
18
|
+
else if (fact?.kind === "unnamed") {
|
|
19
|
+
unnamed.set(`${fact.unnamed.name}\u0000${fact.unnamed.reason}`, fact.unnamed);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
...(needs.size === 0 ? {} : { needs: [...needs.values()] }),
|
|
24
|
+
...(unnamed.size === 0 ? {} : { unnamed: [...unnamed.values()] }),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=needs.js.map
|
|
@@ -1,40 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
1
|
+
import type { FileContext, TypeQueries } from "@stateward/core";
|
|
2
|
+
import type { PackageResolver, QuietCall } from "./summarize.js";
|
|
3
|
+
import { UNKNOWN_REASONS } from "./summary.js";
|
|
4
|
+
import type { UnknownReason } from "./summary.js";
|
|
4
5
|
/**
|
|
5
|
-
* Library facts for the Errors pack: what a call into a
|
|
6
|
-
*
|
|
6
|
+
* Library facts for the Errors pack: what a call into a package throws, from its contract only
|
|
7
|
+
* (0041), from the first source that answers:
|
|
7
8
|
*
|
|
8
9
|
* 1. the project's config (`facts`);
|
|
9
|
-
* 2.
|
|
10
|
-
* 3.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
/** Why a package's function is not (fully) known: fixed strings, shown as they are. */
|
|
16
|
-
export declare const UNKNOWN_REASONS: readonly ["no readable source", "not found in its source", "native addon", "minified", "eval", "dynamic require", "too large to follow", "untyped @throws", "calls a callback", "calls code it cannot see", "dynamic call", "throws a value of unknown class", "awaits a promise it cannot follow"];
|
|
17
|
-
export type UnknownReason = (typeof UNKNOWN_REASONS)[number];
|
|
18
|
-
/**
|
|
19
|
-
* At most this many functions are read per package function asked for.
|
|
20
|
-
* The bounds count, never time: a verdict by time would differ between machines.
|
|
10
|
+
* 2. the facts the loaded packs ship (`Plugin.facts`);
|
|
11
|
+
* 3. else unknown: "its errors are not stated", with a hint that gives the `facts` line.
|
|
12
|
+
*
|
|
13
|
+
* A line names the call when its key resolves to the called declaration (`factLineOf`). The
|
|
14
|
+
* package's code and the doc comments of its declarations are never read.
|
|
21
15
|
*/
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
export { UNKNOWN_REASONS };
|
|
17
|
+
export type { UnknownReason };
|
|
18
|
+
/** The calls the facts say throw nothing (`QuietCall`). */
|
|
19
|
+
export type Quiet = {
|
|
20
|
+
readonly test: QuietCall;
|
|
21
|
+
};
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
23
|
+
* The calls into packages that the facts the packs ship say throw and reject with nothing
|
|
24
|
+
* (`throws: []`, as the React pack says of React's hooks), unless the config's own `facts` has a
|
|
25
|
+
* line for the function: that line is read instead, as the resolver reads it.
|
|
29
26
|
*/
|
|
30
|
-
export declare function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
inferences: number;
|
|
34
|
-
cacheHits: number;
|
|
35
|
-
};
|
|
36
|
-
/** Forgets what this process knows about packages (tests: the next run reads the global cache). */
|
|
37
|
-
export declare function forgetPackageFacts(): void;
|
|
27
|
+
export declare function quietCalls(ctx: Pick<FileContext, "facts" | "shippedFacts"> & {
|
|
28
|
+
readonly types: Pick<TypeQueries, "factTarget" | "isOrExtends">;
|
|
29
|
+
}): Quiet;
|
|
38
30
|
/** Finds the facts of the calls into packages of the file `ctx` summarizes. */
|
|
39
|
-
export declare function packageResolver(ctx: Pick<FileContext, "file" | "facts">): PackageResolver;
|
|
31
|
+
export declare function packageResolver(ctx: Pick<FileContext, "file" | "facts" | "shippedFacts" | "withheldFacts" | "types">): PackageResolver;
|
|
40
32
|
//# sourceMappingURL=packages.d.ts.map
|