@stateward/core 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/dist/analyses.d.ts +37 -0
- package/dist/analyses.js +57 -0
- package/dist/backend/fingerprints.d.ts +3 -1
- package/dist/backend/fingerprints.js +198 -9
- package/dist/backend/program-record.d.ts +7 -0
- package/dist/backend/program-size.d.ts +32 -0
- package/dist/backend/program-size.js +166 -0
- package/dist/backend/typescript6.d.ts +62 -32
- package/dist/backend/typescript6.js +1615 -164
- package/dist/baseline.d.ts +1 -1
- package/dist/baseline.js +14 -10
- package/dist/cache.d.ts +92 -4
- package/dist/cache.js +257 -68
- package/dist/checker.d.ts +28 -3
- package/dist/checker.js +42 -8
- package/dist/class-id.d.ts +34 -0
- package/dist/class-id.js +93 -0
- package/dist/code-text.d.ts +8 -0
- package/dist/code-text.js +66 -0
- package/dist/config-file.js +7 -5
- package/dist/config.d.ts +10 -2
- package/dist/config.js +490 -48
- package/dist/define.d.ts +8 -2
- package/dist/disk-cache.d.ts +34 -2
- package/dist/disk-cache.js +82 -15
- package/dist/engine.d.ts +64 -3
- package/dist/engine.js +474 -59
- package/dist/fact-lines.d.ts +31 -0
- package/dist/fact-lines.js +197 -0
- package/dist/facts-versions.d.ts +27 -0
- package/dist/facts-versions.js +99 -0
- package/dist/fixes.js +4 -1
- package/dist/ignores.d.ts +11 -0
- package/dist/ignores.js +74 -27
- package/dist/implementation.d.ts +0 -6
- package/dist/implementation.js +0 -17
- package/dist/index.d.ts +9 -9
- package/dist/index.js +12 -7
- package/dist/internal.d.ts +13 -6
- package/dist/internal.js +7 -3
- package/dist/journal.d.ts +40 -0
- package/dist/journal.js +197 -0
- package/dist/lazy.d.ts +8 -1
- package/dist/lazy.js +27 -2
- package/dist/ledger.d.ts +2 -2
- package/dist/ledger.js +2 -2
- package/dist/memory-plan.d.ts +121 -0
- package/dist/memory-plan.js +174 -0
- package/dist/off-by-default.d.ts +13 -0
- package/dist/off-by-default.js +15 -0
- package/dist/options.d.ts +21 -5
- package/dist/options.js +22 -7
- package/dist/package-facts.d.ts +211 -17
- package/dist/package-facts.js +520 -38
- package/dist/plan.d.ts +1 -1
- package/dist/plan.js +7 -2
- package/dist/release.d.ts +12 -21
- package/dist/release.js +26 -38
- package/dist/renamed.d.ts +22 -3
- package/dist/renamed.js +50 -16
- package/dist/rollout.js +7 -4
- package/dist/severity.d.ts +1 -1
- package/dist/severity.js +17 -3
- package/dist/test-runner.d.ts +18 -0
- package/dist/test-runner.js +483 -0
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +5 -5
- package/dist/timing.d.ts +17 -7
- package/dist/timing.js +60 -38
- package/dist/types.d.ts +704 -20
- package/dist/unread.d.ts +90 -0
- package/dist/unread.js +405 -0
- package/dist/vocabulary.d.ts +1 -1
- package/dist/vocabulary.js +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FactNeed } from "./types.js";
|
|
2
|
+
/** Which line to write: the call throws nothing, or it throws a class the developer names. */
|
|
3
|
+
export type FactChoice = "nothing" | "classes";
|
|
4
|
+
export declare const FACT_CHOICES: readonly FactChoice[];
|
|
5
|
+
/** One edit to the config file's text: replace `start`–`end` with `newText`. */
|
|
6
|
+
export type ConfigEdit = {
|
|
7
|
+
readonly start: number;
|
|
8
|
+
readonly end: number;
|
|
9
|
+
readonly newText: string;
|
|
10
|
+
};
|
|
11
|
+
/** A line offered for a need: its title, as the editor's menu and `check --fix` show it, and its edit. */
|
|
12
|
+
export type FactLineFix = {
|
|
13
|
+
readonly title: string;
|
|
14
|
+
readonly need: FactNeed;
|
|
15
|
+
readonly choice: FactChoice;
|
|
16
|
+
readonly edit: ConfigEdit;
|
|
17
|
+
};
|
|
18
|
+
/** The title of a choice: "state that `Repository.save` throws nothing". */
|
|
19
|
+
export declare function factChoiceTitle(need: FactNeed, choice: FactChoice): string;
|
|
20
|
+
/** How keys are written: quoted in JSON, as identifiers where they can be in code. */
|
|
21
|
+
type Style = "json" | "code";
|
|
22
|
+
/** The value of a line: `{ throws: [] }`, or `{ rejects: ["ErrorClass"] }`. */
|
|
23
|
+
export declare function factValueText(need: FactNeed, choice: FactChoice, style?: Style): string;
|
|
24
|
+
/** The edit that writes `need`'s line into the config text, or undefined when it cannot be placed. */
|
|
25
|
+
export declare function factLineEdit(configFile: string, text: string, need: FactNeed, choice: FactChoice): ConfigEdit | undefined;
|
|
26
|
+
/** The lines offered for a finding's needs, each choice of each need that can be placed. */
|
|
27
|
+
export declare function factLineFixes(configFile: string, text: string, needs: readonly FactNeed[]): FactLineFix[];
|
|
28
|
+
/** The text with one edit made. */
|
|
29
|
+
export declare function applyConfigEdit(text: string, edit: ConfigEdit): string;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=fact-lines.d.ts.map
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `facts` lines a "not checked" finding needs (`Finding.needs`), written into the config file
|
|
3
|
+
* (R128): a line that says the call throws nothing, or one that leaves the class for the developer
|
|
4
|
+
* (`PLACEHOLDER_CLASS`). stateward never chooses a class. The edit is made only where the config
|
|
5
|
+
* states its `facts` as plain object literals; anything computed (a spread, a computed key, a value
|
|
6
|
+
* from elsewhere) gives no edit, as the line could not be placed safely.
|
|
7
|
+
*/
|
|
8
|
+
import ts from "typescript";
|
|
9
|
+
import { VERSIONS_KEY } from "./config.js";
|
|
10
|
+
import { PLACEHOLDER_CLASS, factKeyText } from "./package-facts.js";
|
|
11
|
+
export const FACT_CHOICES = ["nothing", "classes"];
|
|
12
|
+
/** `throws`, `rejects`, or both, as the title names them. */
|
|
13
|
+
function verbOf(need) {
|
|
14
|
+
const throws = need.states.includes("throws");
|
|
15
|
+
const rejects = need.states.includes("rejects");
|
|
16
|
+
return throws && rejects ? "throws or rejects with" : throws ? "throws" : "rejects with";
|
|
17
|
+
}
|
|
18
|
+
/** The title of a choice: "state that `Repository.save` throws nothing". */
|
|
19
|
+
export function factChoiceTitle(need, choice) {
|
|
20
|
+
return choice === "nothing"
|
|
21
|
+
? `state that \`${need.name}\` ${verbOf(need)} nothing`
|
|
22
|
+
: `state what \`${need.name}\` ${verbOf(need)}…`;
|
|
23
|
+
}
|
|
24
|
+
function keyText(key, style) {
|
|
25
|
+
return style === "code" ? factKeyText(key) : JSON.stringify(key);
|
|
26
|
+
}
|
|
27
|
+
/** The value of a line: `{ throws: [] }`, or `{ rejects: ["ErrorClass"] }`. */
|
|
28
|
+
export function factValueText(need, choice, style = "code") {
|
|
29
|
+
const list = choice === "nothing" ? "[]" : `[${JSON.stringify(PLACEHOLDER_CLASS)}]`;
|
|
30
|
+
return `{ ${need.states.map((side) => `${keyText(side, style)}: ${list}`).join(", ")} }`;
|
|
31
|
+
}
|
|
32
|
+
/** The property of the line under its module: `"Repository.save": { rejects: [] }`. */
|
|
33
|
+
function lineText(need, choice, style) {
|
|
34
|
+
return `${keyText(need.name, style)}: ${factValueText(need, choice, style)}`;
|
|
35
|
+
}
|
|
36
|
+
/** The module's properties for a new table: its version first, when known, then the line. */
|
|
37
|
+
function tableText(need, choice, style) {
|
|
38
|
+
const version = need.version === undefined
|
|
39
|
+
? []
|
|
40
|
+
: [`${keyText(VERSIONS_KEY, style)}: ${JSON.stringify(need.version)}`];
|
|
41
|
+
return `{ ${[...version, lineText(need, choice, style)].join(", ")} }`;
|
|
42
|
+
}
|
|
43
|
+
function unwrapped(node) {
|
|
44
|
+
let current = node;
|
|
45
|
+
while (ts.isParenthesizedExpression(current) ||
|
|
46
|
+
ts.isAsExpression(current) ||
|
|
47
|
+
ts.isSatisfiesExpression(current) ||
|
|
48
|
+
ts.isTypeAssertionExpression(current)) {
|
|
49
|
+
current = current.expression;
|
|
50
|
+
}
|
|
51
|
+
return current;
|
|
52
|
+
}
|
|
53
|
+
/** The `const` a name of the file is declared with, when it has an initializer. */
|
|
54
|
+
function constInitializer(file, name) {
|
|
55
|
+
for (const statement of file.statements) {
|
|
56
|
+
if (!ts.isVariableStatement(statement))
|
|
57
|
+
continue;
|
|
58
|
+
if ((statement.declarationList.flags & ts.NodeFlags.Const) === 0)
|
|
59
|
+
continue;
|
|
60
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
61
|
+
if (ts.isIdentifier(declaration.name) && declaration.name.text === name) {
|
|
62
|
+
return declaration.initializer;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The object literal a config expression is: the literal itself, the one argument of a call
|
|
70
|
+
* (`defineConfig({ … })`), or the literal a `const` of the file holds.
|
|
71
|
+
*/
|
|
72
|
+
function objectOf(file, node) {
|
|
73
|
+
const expression = unwrapped(node);
|
|
74
|
+
if (ts.isObjectLiteralExpression(expression))
|
|
75
|
+
return expression;
|
|
76
|
+
if (ts.isCallExpression(expression) && expression.arguments.length === 1) {
|
|
77
|
+
const [only] = expression.arguments;
|
|
78
|
+
return only === undefined ? undefined : objectOf(file, only);
|
|
79
|
+
}
|
|
80
|
+
if (ts.isIdentifier(expression)) {
|
|
81
|
+
const initializer = constInitializer(file, expression.text);
|
|
82
|
+
return initializer === undefined ? undefined : objectOf(file, initializer);
|
|
83
|
+
}
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
/** The config's object: the JSON's root, `export default …` or `module.exports = …`. */
|
|
87
|
+
function configObject(file, style) {
|
|
88
|
+
for (const statement of file.statements) {
|
|
89
|
+
if (style === "json" && ts.isExpressionStatement(statement)) {
|
|
90
|
+
return objectOf(file, statement.expression);
|
|
91
|
+
}
|
|
92
|
+
if (ts.isExportAssignment(statement))
|
|
93
|
+
return objectOf(file, statement.expression);
|
|
94
|
+
if (ts.isExpressionStatement(statement) &&
|
|
95
|
+
ts.isBinaryExpression(statement.expression) &&
|
|
96
|
+
statement.expression.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
|
|
97
|
+
statement.expression.left.getText(file) === "module.exports") {
|
|
98
|
+
return objectOf(file, statement.expression.right);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
function nameOf(property) {
|
|
104
|
+
if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property)) {
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
const { name } = property;
|
|
108
|
+
return ts.isIdentifier(name) ||
|
|
109
|
+
ts.isStringLiteral(name) ||
|
|
110
|
+
ts.isNoSubstitutionTemplateLiteral(name)
|
|
111
|
+
? name.text
|
|
112
|
+
: undefined;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The property named `key` of an object whose every property has a plain name: `found` with its
|
|
116
|
+
* value when it is an object literal, `absent`, or undefined when the object cannot be read safely
|
|
117
|
+
* (a spread, a computed name, a method) or the value is not an object literal.
|
|
118
|
+
*/
|
|
119
|
+
function propertyOf(object, key) {
|
|
120
|
+
if (object.properties.some((property) => nameOf(property) === undefined))
|
|
121
|
+
return undefined;
|
|
122
|
+
const property = object.properties.find((one) => nameOf(one) === key);
|
|
123
|
+
if (property === undefined)
|
|
124
|
+
return { kind: "absent" };
|
|
125
|
+
if (!ts.isPropertyAssignment(property))
|
|
126
|
+
return undefined;
|
|
127
|
+
const value = unwrapped(property.initializer);
|
|
128
|
+
return ts.isObjectLiteralExpression(value) ? { kind: "found", value } : undefined;
|
|
129
|
+
}
|
|
130
|
+
/** The indentation of the line `offset` is on. */
|
|
131
|
+
function indentAt(text, offset) {
|
|
132
|
+
const start = text.lastIndexOf("\n", offset - 1) + 1;
|
|
133
|
+
return /^[ \t]*/.exec(text.slice(start))?.[0] ?? "";
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The edit that adds `property` to `object`: after its last property (with a comma), on a new
|
|
137
|
+
* line with the same indentation when the object spans lines, or inside `{}` when it is empty.
|
|
138
|
+
*/
|
|
139
|
+
function insertInto(file, object, property) {
|
|
140
|
+
const text = file.text;
|
|
141
|
+
const last = object.properties.at(-1);
|
|
142
|
+
const close = object.getEnd() - 1;
|
|
143
|
+
if (last === undefined) {
|
|
144
|
+
return { start: object.getStart(file), end: object.getEnd(), newText: `{ ${property} }` };
|
|
145
|
+
}
|
|
146
|
+
const comma = object.properties.hasTrailingComma;
|
|
147
|
+
const after = last.getEnd() + (comma ? text.indexOf(",", last.getEnd()) - last.getEnd() + 1 : 0);
|
|
148
|
+
const multiline = text.slice(object.getStart(file), close).includes("\n");
|
|
149
|
+
if (!multiline)
|
|
150
|
+
return { start: last.getEnd(), end: last.getEnd(), newText: `, ${property}` };
|
|
151
|
+
const indent = indentAt(text, last.getStart(file));
|
|
152
|
+
return {
|
|
153
|
+
start: after,
|
|
154
|
+
end: after,
|
|
155
|
+
newText: `${comma ? "" : ","}\n${indent}${property}${comma ? "," : ""}`,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/** The edit that writes `need`'s line into the config text, or undefined when it cannot be placed. */
|
|
159
|
+
export function factLineEdit(configFile, text, need, choice) {
|
|
160
|
+
const style = configFile.endsWith(".json") ? "json" : "code";
|
|
161
|
+
const file = ts.createSourceFile(configFile, text, ts.ScriptTarget.Latest, true, style === "json" ? ts.ScriptKind.JSON : ts.ScriptKind.TS);
|
|
162
|
+
const config = configObject(file, style);
|
|
163
|
+
if (config === undefined)
|
|
164
|
+
return undefined;
|
|
165
|
+
const facts = propertyOf(config, "facts");
|
|
166
|
+
if (facts === undefined)
|
|
167
|
+
return undefined;
|
|
168
|
+
if (facts.kind === "absent") {
|
|
169
|
+
const table = `${keyText(need.module, style)}: ${tableText(need, choice, style)}`;
|
|
170
|
+
return insertInto(file, config, `${keyText("facts", style)}: { ${table} }`);
|
|
171
|
+
}
|
|
172
|
+
const table = propertyOf(facts.value, need.module);
|
|
173
|
+
if (table === undefined)
|
|
174
|
+
return undefined;
|
|
175
|
+
if (table.kind === "absent") {
|
|
176
|
+
return insertInto(file, facts.value, `${keyText(need.module, style)}: ${tableText(need, choice, style)}`);
|
|
177
|
+
}
|
|
178
|
+
const line = propertyOf(table.value, need.name);
|
|
179
|
+
// A line for the call is there already: it is not stated twice.
|
|
180
|
+
if (line === undefined || line.kind === "found")
|
|
181
|
+
return undefined;
|
|
182
|
+
return insertInto(file, table.value, lineText(need, choice, style));
|
|
183
|
+
}
|
|
184
|
+
/** The lines offered for a finding's needs, each choice of each need that can be placed. */
|
|
185
|
+
export function factLineFixes(configFile, text, needs) {
|
|
186
|
+
return needs.flatMap((need) => FACT_CHOICES.flatMap((choice) => {
|
|
187
|
+
const edit = factLineEdit(configFile, text, need, choice);
|
|
188
|
+
return edit === undefined
|
|
189
|
+
? []
|
|
190
|
+
: [{ title: factChoiceTitle(need, choice), need, choice, edit }];
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
/** The text with one edit made. */
|
|
194
|
+
export function applyConfigEdit(text, edit) {
|
|
195
|
+
return text.slice(0, edit.start) + edit.newText + text.slice(edit.end);
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=fact-lines.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PackageFactsConfig, VerifiedFacts, WithheldFacts } from "./types.js";
|
|
2
|
+
/** The facts a file's rules read: those that hold for its project's versions, and those left out. */
|
|
3
|
+
export type FileFacts = {
|
|
4
|
+
readonly facts: PackageFactsConfig;
|
|
5
|
+
readonly shippedFacts: PackageFactsConfig;
|
|
6
|
+
readonly withheldFacts: readonly WithheldFacts[];
|
|
7
|
+
};
|
|
8
|
+
/** The facts of each file, and what they depend on besides the file, for the cache key. */
|
|
9
|
+
export type FactsGate = {
|
|
10
|
+
at(file: string): FileFacts;
|
|
11
|
+
/** The ranges, and what they decide at the config's folder. */
|
|
12
|
+
readonly key: unknown;
|
|
13
|
+
};
|
|
14
|
+
/** `` `0.3.17` to `1.1.2` `` for `>=0.3.17 <=1.1.2`; any other range as written, in backticks. */
|
|
15
|
+
export declare function rangeText(range: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* The gate of a check: `facts` (the config's, `versions` by package) and `shipped` (the packs',
|
|
18
|
+
* `verified` by package), decided once per folder.
|
|
19
|
+
*/
|
|
20
|
+
export declare function factsGate(input: {
|
|
21
|
+
readonly facts: PackageFactsConfig;
|
|
22
|
+
readonly versions: Readonly<Record<string, string>>;
|
|
23
|
+
readonly shipped: PackageFactsConfig;
|
|
24
|
+
readonly verified: Readonly<Record<string, VerifiedFacts>>;
|
|
25
|
+
readonly configDir: string;
|
|
26
|
+
}): FactsGate;
|
|
27
|
+
//# sourceMappingURL=facts-versions.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Facts lines are tied to the versions of their package they hold for: the config's by
|
|
3
|
+
* `"@versions"`, a pack's by `Plugin.factsVerified`. In a file whose project runs another version,
|
|
4
|
+
* or one whose version is not known, a package's lines are left out (`WithheldFacts`), so a call
|
|
5
|
+
* they would name is "not checked" instead of read with facts of another version.
|
|
6
|
+
*/
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { packageOfModule } from "./package-facts.js";
|
|
9
|
+
import { packageVersionOf, versionSatisfies } from "./unread.js";
|
|
10
|
+
/** `` `0.3.17` to `1.1.2` `` for `>=0.3.17 <=1.1.2`; any other range as written, in backticks. */
|
|
11
|
+
export function rangeText(range) {
|
|
12
|
+
const bounds = /^>=\s*(\S+)\s+<=\s*(\S+)$/.exec(range.trim());
|
|
13
|
+
return bounds?.[1] !== undefined && bounds[2] !== undefined
|
|
14
|
+
? `\`${bounds[1]}\` to \`${bounds[2]}\``
|
|
15
|
+
: `\`${range}\``;
|
|
16
|
+
}
|
|
17
|
+
/** What the project runs, after "; ": `the project has \`3.4.1\``. */
|
|
18
|
+
function runsText(read) {
|
|
19
|
+
if (read.kind === "exact")
|
|
20
|
+
return `the project has \`${read.version}\``;
|
|
21
|
+
if (read.kind === "range")
|
|
22
|
+
return `the project's package.json allows \`${read.range}\``;
|
|
23
|
+
return read.reason;
|
|
24
|
+
}
|
|
25
|
+
function withheld(source, key, range, functions, read, answer) {
|
|
26
|
+
const runs = runsText(read);
|
|
27
|
+
// Outside the range: what to change in the facts. Not known: what makes the version known.
|
|
28
|
+
const notKnown = answer === false
|
|
29
|
+
? undefined
|
|
30
|
+
: (answer.hint ?? `install \`${key}\`, so the version it runs is known`);
|
|
31
|
+
if (source === "config") {
|
|
32
|
+
return {
|
|
33
|
+
package: key,
|
|
34
|
+
source,
|
|
35
|
+
functions,
|
|
36
|
+
reason: `the facts stated for \`${key}\` are for ${rangeText(range)}; ${runs}`,
|
|
37
|
+
hint: notKnown ??
|
|
38
|
+
`check the facts for \`${key}\` against the version the project runs, then add that version to their \`"@versions"\``,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
package: key,
|
|
43
|
+
source,
|
|
44
|
+
functions,
|
|
45
|
+
reason: `stateward's facts for \`${key}\` were verified on ${rangeText(range)}; ${runs}`,
|
|
46
|
+
hint: notKnown ??
|
|
47
|
+
`state the facts for \`${key}\` in the config's \`facts\`, with \`"@versions"\` set to the versions they hold for`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The gate of a check: `facts` (the config's, `versions` by package) and `shipped` (the packs',
|
|
52
|
+
* `verified` by package), decided once per folder.
|
|
53
|
+
*/
|
|
54
|
+
export function factsGate(input) {
|
|
55
|
+
const ranged = (facts, rangeOf) => Object.keys(facts).flatMap((key) => {
|
|
56
|
+
const range = rangeOf(key);
|
|
57
|
+
return range === undefined ? [] : [[key, range]];
|
|
58
|
+
});
|
|
59
|
+
const own = ranged(input.facts, (key) => input.versions[key]);
|
|
60
|
+
const packs = ranged(input.shipped, (key) => (input.verified[key] ?? input.verified[packageOfModule(key)])?.verified);
|
|
61
|
+
const all = { facts: input.facts, shippedFacts: input.shipped, withheldFacts: [] };
|
|
62
|
+
if (own.length === 0 && packs.length === 0)
|
|
63
|
+
return { at: () => all, key: [] };
|
|
64
|
+
const byFolder = new Map();
|
|
65
|
+
const decide = (file) => {
|
|
66
|
+
const folder = path.dirname(file);
|
|
67
|
+
const known = byFolder.get(folder);
|
|
68
|
+
if (known !== undefined)
|
|
69
|
+
return known;
|
|
70
|
+
const left = [];
|
|
71
|
+
const filter = (source, facts, pairs) => {
|
|
72
|
+
const out = new Set();
|
|
73
|
+
for (const [key, range] of pairs) {
|
|
74
|
+
const read = packageVersionOf({ file }, packageOfModule(key));
|
|
75
|
+
const answer = versionSatisfies(read, range);
|
|
76
|
+
if (answer === true)
|
|
77
|
+
continue;
|
|
78
|
+
out.add(key);
|
|
79
|
+
left.push(withheld(source, key, range, facts[key] ?? {}, read, answer));
|
|
80
|
+
}
|
|
81
|
+
return out.size === 0
|
|
82
|
+
? facts
|
|
83
|
+
: Object.fromEntries(Object.entries(facts).filter(([key]) => !out.has(key)));
|
|
84
|
+
};
|
|
85
|
+
const made = {
|
|
86
|
+
facts: filter("config", input.facts, own),
|
|
87
|
+
shippedFacts: filter("shipped", input.shipped, packs),
|
|
88
|
+
withheldFacts: left,
|
|
89
|
+
};
|
|
90
|
+
byFolder.set(folder, made);
|
|
91
|
+
return made;
|
|
92
|
+
};
|
|
93
|
+
const atConfig = decide(path.join(input.configDir, "stateward.config.ts"));
|
|
94
|
+
return {
|
|
95
|
+
at: decide,
|
|
96
|
+
key: [own, packs, atConfig.withheldFacts.map((one) => [one.source, one.package, one.reason])],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=facts-versions.js.map
|
package/dist/fixes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { toTypeScriptPath } from "./backend/typescript6.js";
|
|
2
|
-
import { sha1 } from "./cache.js";
|
|
2
|
+
import { sha1, useKey } from "./cache.js";
|
|
3
3
|
function spanOf(edit) {
|
|
4
4
|
const { file, start, end } = edit.location;
|
|
5
5
|
return { file: toTypeScriptPath(file), start, end, newText: edit.newText };
|
|
@@ -87,6 +87,8 @@ function tryInUnit(unit, trials, cache) {
|
|
|
87
87
|
}
|
|
88
88
|
const key = verdictKey(unit, form);
|
|
89
89
|
const known = key === undefined ? undefined : cache.verdicts.get(key);
|
|
90
|
+
if (key !== undefined)
|
|
91
|
+
useKey(cache, key);
|
|
90
92
|
if (known !== undefined)
|
|
91
93
|
settle(trial, known);
|
|
92
94
|
}
|
|
@@ -116,6 +118,7 @@ function tryInUnit(unit, trials, cache) {
|
|
|
116
118
|
const plain = verdict.kind !== "compiles" || verdict.removesImports === undefined;
|
|
117
119
|
if (key !== undefined && verdict.kind !== "unchecked" && plain) {
|
|
118
120
|
cache.verdicts.set(key, verdict);
|
|
121
|
+
useKey(cache, key);
|
|
119
122
|
cache.changed = true;
|
|
120
123
|
}
|
|
121
124
|
settle(trial, verdict);
|
package/dist/ignores.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Renames } from "./renamed.js";
|
|
1
2
|
import type { RuleResult } from "./cache.js";
|
|
2
3
|
import type { ProjectUnit } from "./backend/typescript6.js";
|
|
3
4
|
import type { Finding, FixForm, IgnoreOptions, IgnoredFinding } from "./types.js";
|
|
@@ -52,6 +53,16 @@ export type IgnoreScope = {
|
|
|
52
53
|
ran: ReadonlySet<string>;
|
|
53
54
|
/** The config's `ignores`: whether a reason is required and how an unneeded comment is reported. */
|
|
54
55
|
options: IgnoreOptions;
|
|
56
|
+
/** The renamed rule ids the packs declare: a comment that names an old id still works. */
|
|
57
|
+
renames: Renames;
|
|
58
|
+
/** The rule ids a release removed: a comment that names one ignores nothing and is not needed. */
|
|
59
|
+
removed: ReadonlySet<string>;
|
|
60
|
+
/**
|
|
61
|
+
* By rule id, for the rules that ran: their options that report a kind of finding only when on
|
|
62
|
+
* and are off now (`hiddenCases` of `unions/non-exhaustive-switch`, a convention). A comment such
|
|
63
|
+
* a rule finds nothing under may be for that kind, so removing it is not safe.
|
|
64
|
+
*/
|
|
65
|
+
offOptions: ReadonlyMap<string, readonly string[]>;
|
|
55
66
|
};
|
|
56
67
|
/**
|
|
57
68
|
* Takes the findings that ignore comments cover out of `findings` and adds the findings about
|
package/dist/ignores.js
CHANGED
|
@@ -264,6 +264,10 @@ function closest(id, known) {
|
|
|
264
264
|
}
|
|
265
265
|
const MAX_HEADLINE = 100;
|
|
266
266
|
const MAX_HINT = 140;
|
|
267
|
+
/** The first of `texts` that fits `max`, else `shorter`. */
|
|
268
|
+
function firstFitting(texts, max, shorter) {
|
|
269
|
+
return texts.find((text) => text.length <= max) ?? shorter;
|
|
270
|
+
}
|
|
267
271
|
/** `text` when it fits `max`, else `shorter`. */
|
|
268
272
|
function fits(text, max, shorter) {
|
|
269
273
|
return text.length <= max ? text : shorter;
|
|
@@ -271,6 +275,10 @@ function fits(text, max, shorter) {
|
|
|
271
275
|
function names(ids) {
|
|
272
276
|
return ids.map((id) => `\`${id}\``).join(", ");
|
|
273
277
|
}
|
|
278
|
+
/** The verb for `ids` as its subject: `one` for one id, `many` for several. */
|
|
279
|
+
function verb(ids, one, many) {
|
|
280
|
+
return ids.length === 1 ? one : many;
|
|
281
|
+
}
|
|
274
282
|
function commentFinding(file, at, severity, message, hint, fixes) {
|
|
275
283
|
const location = { file, start: at.start, end: at.end };
|
|
276
284
|
return {
|
|
@@ -289,6 +297,60 @@ function rebuilt(directive, keep) {
|
|
|
289
297
|
const body = `stateward-ignore${directive.file ? "-file" : ""} ${keep.join(", ")}${reason}`;
|
|
290
298
|
return directive.block ? `/* ${body} */` : `// ${body}`;
|
|
291
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* The finding for an ignore comment that ignores nothing: its rules, `unused`, were removed from
|
|
302
|
+
* stateward or find nothing where it is. When a rule has an option that is off and reports a kind of
|
|
303
|
+
* finding only when on (`IgnoreScope.offOptions`), the comment may be for that kind: the message says it
|
|
304
|
+
* ignores nothing with the current config, names the option, and the removal is not a safe fix.
|
|
305
|
+
*/
|
|
306
|
+
function unusedFinding(file, directive, unused, scope, severity) {
|
|
307
|
+
const here = { start: directive.start, end: directive.end };
|
|
308
|
+
const everything = unused.length === directive.rules.length;
|
|
309
|
+
const keep = directive.rules.map((rule) => rule.id).filter((id) => !unused.includes(id));
|
|
310
|
+
const where = directive.file ? "in the file" : "in the code it covers";
|
|
311
|
+
// A rule a release removed finds nothing because it is gone, not because the code changed.
|
|
312
|
+
const removed = unused.filter((id) => !scope.known.has(id) && scope.removed.has(id));
|
|
313
|
+
const others = unused.filter((id) => !removed.includes(id));
|
|
314
|
+
const off = others.flatMap((id) => {
|
|
315
|
+
const options = scope.offOptions.get(id) ?? [];
|
|
316
|
+
return options.length === 0 ? [] : [{ id, options }];
|
|
317
|
+
});
|
|
318
|
+
const offOptions = off.flatMap((one) => one.options);
|
|
319
|
+
const headline = off.length > 0
|
|
320
|
+
? fits(`ignore comment ignores nothing in this config: ${off.map((one) => `\`${one.id}\` has ${names(one.options)} off`).join("; ")}`, MAX_HEADLINE, "ignore comment ignores nothing in this config: an option of its rule is off")
|
|
321
|
+
: others.length === 0
|
|
322
|
+
? fits(`ignore comment is not needed: ${names(removed)} ${verb(removed, "was", "were")} removed from stateward`, MAX_HEADLINE, "ignore comment is not needed: its rules were removed from stateward")
|
|
323
|
+
: removed.length > 0
|
|
324
|
+
? firstFitting([
|
|
325
|
+
`ignore comment is not needed: ${names(removed)} ${verb(removed, "was", "were")} removed from stateward, and ${names(others)} ${verb(others, "finds", "find")} nothing ${where}`,
|
|
326
|
+
`ignore comment is not needed: ${names(removed)} ${verb(removed, "was", "were")} removed from stateward`,
|
|
327
|
+
], MAX_HEADLINE, `ignore comment is not needed: its rules were removed from stateward or find nothing ${where}`)
|
|
328
|
+
: fits(`ignore comment is not needed: ${names(others)} ${verb(others, "finds", "find")} nothing ${where}`, MAX_HEADLINE, `ignore comment is not needed: ${String(others.length)} of its rules ${verb(others, "finds", "find")} nothing ${where}`);
|
|
329
|
+
const hint = off.length > 0
|
|
330
|
+
? fits(`if it is for what ${names(offOptions)} ${verb(offOptions, "reports", "report")}, keep it and turn ${verb(offOptions, "the option", "them")} on (\`conventions: true\` does); else remove it`, MAX_HINT, "if it is for what the option reports, keep it and turn the option on; else remove it")
|
|
331
|
+
: others.length === 0
|
|
332
|
+
? "remove it (quick fix)"
|
|
333
|
+
: removed.length > 0
|
|
334
|
+
? fits(`remove it (quick fix); ${names(others)} ${verb(others, "finds", "find")} nothing ${where} either`, MAX_HINT, `remove it (quick fix); its other rules find nothing ${where} either`)
|
|
335
|
+
: "remove it (quick fix); the code it covered is fixed, or has moved";
|
|
336
|
+
const fix = everything
|
|
337
|
+
? {
|
|
338
|
+
title: "Remove the ignore comment",
|
|
339
|
+
safe: off.length === 0,
|
|
340
|
+
edits: [
|
|
341
|
+
{
|
|
342
|
+
location: { file, start: directive.removeStart, end: directive.removeEnd },
|
|
343
|
+
newText: "",
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
}
|
|
347
|
+
: {
|
|
348
|
+
title: `Remove ${names(unused)} from the ignore comment`,
|
|
349
|
+
safe: off.length === 0,
|
|
350
|
+
edits: [{ location: { file, ...here }, newText: rebuilt(directive, keep) }],
|
|
351
|
+
};
|
|
352
|
+
return commentFinding(file, here, severity, headline, hint, [fix]);
|
|
353
|
+
}
|
|
292
354
|
/** The findings about one comment: no rule named, in the wrong place, unknown id, no reason, not needed. */
|
|
293
355
|
function judge(file, directive, used, scope) {
|
|
294
356
|
const here = { start: directive.start, end: directive.end };
|
|
@@ -309,9 +371,13 @@ function judge(file, directive, used, scope) {
|
|
|
309
371
|
if (rule.id === IGNORE_RULE_ID) {
|
|
310
372
|
found.push(commentFinding(file, rule, "error", "`stateward/ignore` findings cannot be ignored", "fix the comment the finding points at, or remove it", []));
|
|
311
373
|
}
|
|
312
|
-
else if (!scope.known.has(rule.id) &&
|
|
374
|
+
else if (!scope.known.has(rule.id) && scope.removed.has(rule.id)) {
|
|
375
|
+
// A removed rule finds nothing: the comment is not needed for it.
|
|
376
|
+
unused.push(rule.id);
|
|
377
|
+
}
|
|
378
|
+
else if (!scope.known.has(rule.id) && renamedRule(scope.renames, rule.id) !== undefined) {
|
|
313
379
|
// A renamed rule: the comment still works under the old id.
|
|
314
|
-
const now = renamedRule(rule.id) ?? rule.id;
|
|
380
|
+
const now = renamedRule(scope.renames, rule.id) ?? rule.id;
|
|
315
381
|
// One cause, one message: an ignore that is not needed is removed, not renamed; two fixes on
|
|
316
382
|
// one comment would also clash in `--fix`.
|
|
317
383
|
if (!used.has(now) && scope.ran.has(now)) {
|
|
@@ -344,28 +410,9 @@ function judge(file, directive, used, scope) {
|
|
|
344
410
|
unused.push(rule.id);
|
|
345
411
|
}
|
|
346
412
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const where = directive.file ? "in the file" : "in the code it covers";
|
|
351
|
-
found.push(commentFinding(file, here, scope.options.reportUnused, fits(`ignore comment is not needed: ${names(unused)} finds nothing ${where}`, MAX_HEADLINE, `ignore comment is not needed: ${String(unused.length)} of its rules find nothing ${where}`), "remove it (quick fix); the code it covered is fixed, or has moved", [
|
|
352
|
-
everything
|
|
353
|
-
? {
|
|
354
|
-
title: "Remove the ignore comment",
|
|
355
|
-
safe: true,
|
|
356
|
-
edits: [
|
|
357
|
-
{
|
|
358
|
-
location: { file, start: directive.removeStart, end: directive.removeEnd },
|
|
359
|
-
newText: "",
|
|
360
|
-
},
|
|
361
|
-
],
|
|
362
|
-
}
|
|
363
|
-
: {
|
|
364
|
-
title: `Remove ${names(unused)} from the ignore comment`,
|
|
365
|
-
safe: true,
|
|
366
|
-
edits: [{ location: { file, ...here }, newText: rebuilt(directive, keep) }],
|
|
367
|
-
},
|
|
368
|
-
]));
|
|
413
|
+
const severity = scope.options.reportUnused;
|
|
414
|
+
if (unused.length > 0 && severity !== "off") {
|
|
415
|
+
found.push(unusedFinding(file, directive, unused, scope, severity));
|
|
369
416
|
}
|
|
370
417
|
if (directive.reason === "" && scope.options.requireReason) {
|
|
371
418
|
const first = directive.rules[0]?.id ?? "<rule>";
|
|
@@ -388,7 +435,7 @@ export function applyIgnores(findings, directives, scope) {
|
|
|
388
435
|
const { file, start } = finding.location;
|
|
389
436
|
const reason = finding.kind === "failure"
|
|
390
437
|
? undefined
|
|
391
|
-
: coveredBy(directives.get(file) ?? [], finding.ruleId, start, used);
|
|
438
|
+
: coveredBy(directives.get(file) ?? [], finding.ruleId, start, used, scope.renames);
|
|
392
439
|
if (reason === undefined)
|
|
393
440
|
kept.push(finding);
|
|
394
441
|
else
|
|
@@ -402,12 +449,12 @@ export function applyIgnores(findings, directives, scope) {
|
|
|
402
449
|
return { findings: kept, ignored };
|
|
403
450
|
}
|
|
404
451
|
/** The reason of the first comment that covers the finding (every one that does counts as used). */
|
|
405
|
-
function coveredBy(list, ruleId, start, used) {
|
|
452
|
+
function coveredBy(list, ruleId, start, used, renames) {
|
|
406
453
|
let reason;
|
|
407
454
|
for (const directive of list) {
|
|
408
455
|
if (directive.file && !directive.placed)
|
|
409
456
|
continue;
|
|
410
|
-
if (!directive.rules.some((rule) => (renamedRule(rule.id) ?? rule.id) === ruleId))
|
|
457
|
+
if (!directive.rules.some((rule) => (renamedRule(renames, rule.id) ?? rule.id) === ruleId))
|
|
411
458
|
continue;
|
|
412
459
|
const covers = directive.file || (directive.coverStart <= start && start <= directive.coverEnd);
|
|
413
460
|
if (!covers)
|
package/dist/implementation.d.ts
CHANGED
|
@@ -14,10 +14,4 @@ export declare function configLocalImports(configFile: string): readonly string[
|
|
|
14
14
|
export declare function foreignTypeScriptWarnings(configFile: string): readonly string[];
|
|
15
15
|
/** `computeImplementationId`, once per config file in this process: the code loaded does not change under it. */
|
|
16
16
|
export declare function implementationId(configFile: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* The id of the code of the package `moduleUrl` belongs to, with core's (as `computeImplementationId`
|
|
19
|
-
* hashes them): what a plugin computed and cached outside a project (the library facts cache) is
|
|
20
|
-
* read back only by the same code. Once per package and process.
|
|
21
|
-
*/
|
|
22
|
-
export declare function packageCodeId(moduleUrl: string): string;
|
|
23
17
|
//# sourceMappingURL=implementation.d.ts.map
|
package/dist/implementation.js
CHANGED
|
@@ -294,21 +294,4 @@ export function implementationId(configFile) {
|
|
|
294
294
|
}
|
|
295
295
|
return id;
|
|
296
296
|
}
|
|
297
|
-
const codeIds = new Map();
|
|
298
|
-
/**
|
|
299
|
-
* The id of the code of the package `moduleUrl` belongs to, with core's (as `computeImplementationId`
|
|
300
|
-
* hashes them): what a plugin computed and cached outside a project (the library facts cache) is
|
|
301
|
-
* read back only by the same code. Once per package and process.
|
|
302
|
-
*/
|
|
303
|
-
export function packageCodeId(moduleUrl) {
|
|
304
|
-
const root = packageRootOf(path.dirname(fileURLToPath(moduleUrl)));
|
|
305
|
-
const key = root ?? moduleUrl;
|
|
306
|
-
let id = codeIds.get(key);
|
|
307
|
-
if (id === undefined) {
|
|
308
|
-
const coreRoot = packageRootOf(path.dirname(fileURLToPath(import.meta.url)));
|
|
309
|
-
id = sha1([coreRoot, root].map((one) => (one === undefined ? "?" : packageHash(real(one)))).join("\n"));
|
|
310
|
-
codeIds.set(key, id);
|
|
311
|
-
}
|
|
312
|
-
return id;
|
|
313
|
-
}
|
|
314
297
|
//# sourceMappingURL=implementation.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -9,18 +9,18 @@ export { check, createChecker } from "./checker.js";
|
|
|
9
9
|
export type { CheckInput, Checker } from "./checker.js";
|
|
10
10
|
export { createPropagationMemo, propagate } from "./graph.js";
|
|
11
11
|
export type { Propagation, PropagationMemo } from "./graph.js";
|
|
12
|
+
export { summaryHash } from "./cache.js";
|
|
12
13
|
export { highestUncovered, shortestPath } from "./tree.js";
|
|
13
14
|
export type { TreeEdge, Uncovered, WalkDown } from "./tree.js";
|
|
14
15
|
export { describeRelease, describeTraitSource, releaseCandidates, releaseTraitOf, } from "./release.js";
|
|
15
|
-
export {
|
|
16
|
+
export { classIdOf, declaredPackageOf, isPlatformDeclaration, packageNameOf } from "./class-id.js";
|
|
17
|
+
export { callFactOf, declarationFactOf, externalFactOf, factKeyOf, factLineOf, factLineText, factKeyText, factNeedOf, factSideOf, neededSides, pathOf, neverRejectsFactOf, reportWithheld, withheldFactOf, WILDCARD, } from "./package-facts.js";
|
|
18
|
+
export { followBounded, packageVersionOf, unread, unreadFinding, versionMajor, versionSatisfies, } from "./unread.js";
|
|
19
|
+
export type { FollowStep, Followed, PackageVersionRead, Unread } from "./unread.js";
|
|
20
|
+
export { codeOnOneLine } from "./code-text.js";
|
|
21
|
+
export { offByDefaultText } from "./off-by-default.js";
|
|
16
22
|
export { isSafePlatformCall, iteratesPlainly } from "./safe-calls.js";
|
|
17
23
|
export type { FactContext, PackageFact } from "./package-facts.js";
|
|
18
|
-
export type { ReleaseCandidate,
|
|
19
|
-
export {
|
|
20
|
-
export { readPackageCache, writePackageCache } from "./package-cache.js";
|
|
21
|
-
export type { PackageCacheKey } from "./package-cache.js";
|
|
22
|
-
export { findPackageRoot, reparsedWithJsDoc } from "./backend/package-source.js";
|
|
23
|
-
export { openPackageSource } from "./backend/typescript6.js";
|
|
24
|
-
export type { PackageSource } from "./backend/typescript6.js";
|
|
25
|
-
export type { BooleanOption, CheckNotes, CheckResult, Config, ConfigOverride, CoveredNoun, CoveredPlace, EditorAction, EditorContributions, EditorHint, ExtendedConfig, FileContext, FactSource, FileRule, Finding, FunctionFacts, LibraryTypes, LibraryUse, MissingTypes, PackageFactsConfig, Fix, FixForm, FixReview, FixSetReview, FixVerdict, FlowKind, FlowVia, RejectedFix, GroupIdOf, HiddenFindings, IgnoreOptions, IgnoredFinding, Json, Ledger, LedgerMark, LedgerRef, Literal, NarrowedMembers, SignalParameter, StatedDeclaration, StatedGuarantee, StatedReference, UncheckedPlace, TraitSource, ReleaseFact, NoOptions, NumberOption, OptionSpec, RecordOption, SeveritiesOption, SeverityMap, StringListRecord, OptionSpecs, OptionValue, OptionValueOf, Options, OptionsOf, NarrowingTest, OverrideOf, Location, ParseResult, Plugin, PluginOf, PluginsOf, Preset, ProjectContext, ProjectRule, RelatedLocation, ReadOutcome, ReferenceForm, ReportProblem, LazyRule, PluginRule, Rule, RuleConfig, RuleDeclaration, RuleIdOf, RuleInfo, RuleMeta, RuleProves, RuleSelection, RuleSetting, RuleTier, Severity, StringOption, StringsOption, SymbolRef, AliasRef, TextEdit, TokenType, TypeQueries, UnknownsSetting, UserConfig, } from "./types.js";
|
|
24
|
+
export type { ReleaseCandidate, ReleaseTrait, ReleaseWay } from "./release.js";
|
|
25
|
+
export type { Analyses, AnalysisContext, BooleanOption, CheckNotes, CheckResult, Config, ConfigOverride, CoveredNoun, DecoratorMetadata, CoveredPlace, EditorAction, EditorContributions, EditorHint, ExtendedConfig, FileContext, FactKey, FactModule, FactNeed, FactSide, FactSource, FactTarget, FileRule, Finding, UnnamedFact, UnstatedPlace, FunctionFacts, LibraryTypes, LibraryUse, MissingTypes, PackageFactsConfig, PackageFactsInput, PackageFactsTable, VerifiedFacts, WithheldFacts, Fix, FixForm, FixReview, FixSetReview, FixVerdict, FlowKind, FlowVia, RejectedFix, GroupIdOf, HiddenFindings, IgnoreOptions, IgnoredFinding, Json, Ledger, LedgerMark, LedgerRef, Literal, BuiltinType, OffByDefault, NarrowedMembers, SignalParameter, StatedDeclaration, StatedGuarantee, StatedReference, UncheckedPlace, TraitSource, ReleaseFact, NoOptions, NumberOption, OptionSpec, RecordOption, SeveritiesOption, SeverityMap, StringListRecord, OptionSpecs, OptionValue, OptionValueOf, Options, OptionsOf, NarrowingTest, OverrideOf, Location, MetadataType, GenericBase, InstanceClasses, TypeArgument, PropertyTypeText, ParseResult, Plugin, PluginAnalysis, PluginOf, PluginsOf, Preset, ProjectContext, ProjectRule, RelatedLocation, ReadOutcome, ReferenceForm, ReportInput, ReportOutput, ReportPlace, ReportProblem, LazyRule, PluginReport, PluginRule, Rule, RuleConfig, RuleDeclaration, RuleIdOf, RuleInfo, RuleMeta, RuleProves, RuleSelection, RuleSetting, RuleTier, Severity, StringOption, StringsOption, SymbolRef, AliasRef, TextEdit, TokenType, TypeQueries, TypeShape, TypeShapeProperty, UnknownsSetting, UserConfig, } from "./types.js";
|
|
26
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -11,16 +11,21 @@ export { lazyRule, moduleLoader } from "./lazy.js";
|
|
|
11
11
|
export { check, createChecker } from "./checker.js";
|
|
12
12
|
// Helpers for project rules that follow calls across files.
|
|
13
13
|
export { createPropagationMemo, propagate } from "./graph.js";
|
|
14
|
+
// The engine's hash of a summary it handed out: a solver's memo can key by it.
|
|
15
|
+
export { summaryHash } from "./cache.js";
|
|
14
16
|
export { highestUncovered, shortestPath } from "./tree.js";
|
|
15
|
-
// The release trait: where a call's result is stated to need releasing (type,
|
|
17
|
+
// The release trait: where a call's result is stated to need releasing (type, facts).
|
|
16
18
|
export { describeRelease, describeTraitSource, releaseCandidates, releaseTraitOf, } from "./release.js";
|
|
19
|
+
// How a class is named across packs: the project's symbol id, `builtin:<Name>` for the platform,
|
|
20
|
+
// `package:<name>#<Class>` for a package, and the package a declaration belongs to.
|
|
21
|
+
export { classIdOf, declaredPackageOf, isPlatformDeclaration, packageNameOf } from "./class-id.js";
|
|
17
22
|
// Facts about packages: the config's and the shipped lines, and the promises they say never reject.
|
|
18
|
-
export { neverRejectsFactOf } from "./package-facts.js";
|
|
23
|
+
export { callFactOf, declarationFactOf, externalFactOf, factKeyOf, factLineOf, factLineText, factKeyText, factNeedOf, factSideOf, neededSides, pathOf, neverRejectsFactOf, reportWithheld, withheldFactOf, WILDCARD, } from "./package-facts.js";
|
|
24
|
+
// What a rule could not read, as a typed result that becomes a "not checked" finding: the
|
|
25
|
+
// bounded follow and the package version reader return it instead of a pass or a guess.
|
|
26
|
+
export { followBounded, packageVersionOf, unread, unreadFinding, versionMajor, versionSatisfies, } from "./unread.js";
|
|
19
27
|
// The platform calls that do not throw: the closed list the proofs share.
|
|
28
|
+
export { codeOnOneLine } from "./code-text.js";
|
|
29
|
+
export { offByDefaultText } from "./off-by-default.js";
|
|
20
30
|
export { isSafePlatformCall, iteratesPlainly } from "./safe-calls.js";
|
|
21
|
-
// What a pack learns about a library's code, cached outside the project.
|
|
22
|
-
export { packageCodeId } from "./implementation.js";
|
|
23
|
-
export { readPackageCache, writePackageCache } from "./package-cache.js";
|
|
24
|
-
export { findPackageRoot, reparsedWithJsDoc } from "./backend/package-source.js";
|
|
25
|
-
export { openPackageSource } from "./backend/typescript6.js";
|
|
26
31
|
//# sourceMappingURL=index.js.map
|