@cplieger/deadset-ts 3.3.0 → 3.4.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/README.md +1 -1
- package/dist/src/analysis.js +8 -1
- package/dist/src/calls.js +154 -0
- package/dist/src/class-members.js +92 -0
- package/dist/src/config.js +3 -0
- package/dist/src/configured-declarations.js +232 -0
- package/dist/src/decorator.js +3 -10
- package/dist/src/findings/dependencies-and-module-machinery.js +2 -0
- package/dist/src/findings/emitter.js +1 -0
- package/dist/src/findings/emitters.js +19 -0
- package/dist/src/findings/interfaces.js +2 -0
- package/dist/src/findings/intra-function.js +2 -0
- package/dist/src/findings/non-code-artifacts.js +2 -0
- package/dist/src/findings/reads-and-writes.js +2 -0
- package/dist/src/findings/self-check.js +2 -0
- package/dist/src/findings/unused-declarations.js +2 -0
- package/dist/src/findings/visibility-narrowing.js +2 -0
- package/dist/src/framework-lifecycle.js +192 -0
- package/dist/src/injection-container.js +101 -0
- package/dist/src/print.js +18 -0
- package/dist/src/resolve.js +98 -0
- package/dist/src/run.js +60 -176
- package/dist/src/schema.js +18 -1
- package/dist/src/serialization-contract.js +315 -0
- package/dist/src/value-reach.js +120 -0
- package/dist/src/verbs/print-config.js +9 -0
- package/dist/src/verbs/print-projects.js +34 -0
- package/dist/src/verbs/print-retained.js +23 -0
- package/dist/src/verbs/print-roots.js +36 -0
- package/dist/src/verbs/verb.js +5 -0
- package/dist/src/verbs/version.js +7 -0
- package/dist/src/version.js +1 -1
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/analysis.ts +8 -1
- package/src/calls.ts +224 -0
- package/src/class-members.ts +136 -0
- package/src/config.ts +31 -0
- package/src/configured-declarations.ts +308 -0
- package/src/decorator.ts +4 -16
- package/src/exempt.ts +5 -1
- package/src/findings/dependencies-and-module-machinery.ts +4 -0
- package/src/findings/emitter.ts +19 -0
- package/src/findings/emitters.ts +21 -0
- package/src/findings/interfaces.ts +4 -0
- package/src/findings/intra-function.ts +4 -0
- package/src/findings/non-code-artifacts.ts +4 -0
- package/src/findings/reads-and-writes.ts +4 -0
- package/src/findings/self-check.ts +4 -0
- package/src/findings/unused-declarations.ts +4 -0
- package/src/findings/visibility-narrowing.ts +4 -0
- package/src/framework-lifecycle.ts +280 -0
- package/src/injection-container.ts +141 -0
- package/src/print.ts +20 -1
- package/src/resolve.ts +155 -0
- package/src/run.ts +64 -200
- package/src/schema.ts +19 -1
- package/src/serialization-contract.ts +492 -0
- package/src/value-reach.ts +152 -0
- package/src/verbs/print-config.ts +10 -0
- package/src/verbs/print-projects.ts +35 -0
- package/src/verbs/print-retained.ts +24 -0
- package/src/verbs/print-roots.ts +38 -0
- package/src/verbs/verb.ts +38 -0
- package/src/verbs/version.ts +8 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { runSweep } from "../analysis.ts";
|
|
2
|
+
import { retainedLines } from "../exempt.ts";
|
|
3
|
+
import { resolve } from "../resolve.ts";
|
|
4
|
+
import { EXIT_CLEAN, type Verb } from "./verb.ts";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Writes every declaration an exemption held back in the production sweep a report is
|
|
8
|
+
* built from, one per line, and nothing where no exemption held one back. One fact
|
|
9
|
+
* several configurations found is one record, so the line names no configuration. The
|
|
10
|
+
* line shape is this command's own rather than a Contract format, so that sort and cut
|
|
11
|
+
* read it.
|
|
12
|
+
*/
|
|
13
|
+
export const printRetainedVerb: Verb = ({ out, host, inputs, scope, openClient }) => {
|
|
14
|
+
const { config } = resolve(inputs());
|
|
15
|
+
const scoped = scope();
|
|
16
|
+
const swept = runSweep(openClient(false), host, scoped, config, {
|
|
17
|
+
marked: [],
|
|
18
|
+
mode: { production: true },
|
|
19
|
+
});
|
|
20
|
+
for (const line of retainedLines(swept.matrix.union.symbols, swept.retained)) {
|
|
21
|
+
out.write(`${line}\n`);
|
|
22
|
+
}
|
|
23
|
+
return EXIT_CLEAN;
|
|
24
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { runRoots, type RunRoot } from "../analysis.ts";
|
|
2
|
+
import { resolve } from "../resolve.ts";
|
|
3
|
+
import { EXIT_CLEAN, EXIT_FINDINGS, type Verb } from "./verb.ts";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* One root as a line: the declaration's reference, why it is a root, and the string
|
|
7
|
+
* that named it, separated by tabs. A run of several configurations adds the ones
|
|
8
|
+
* whose project holds the root as a fourth field, and writes the third present and
|
|
9
|
+
* empty where no string named the root, so every line of one run holds the same
|
|
10
|
+
* fields.
|
|
11
|
+
*/
|
|
12
|
+
function rootLine(root: RunRoot, several: boolean): string {
|
|
13
|
+
const line = `${root.ref}\t${root.kind}`;
|
|
14
|
+
if (several) {
|
|
15
|
+
return `${line}\t${root.source}\t${root.configurations.join(" ")}`;
|
|
16
|
+
}
|
|
17
|
+
return root.source === "" ? line : `${line}\t${root.source}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Writes the root set of the run, one root per line, and then names on the error
|
|
22
|
+
* stream, by its issue kind, every configured root or pattern that named nothing;
|
|
23
|
+
* one such string fails the run. The line shape is this command's own rather than a
|
|
24
|
+
* Contract format, so that sort and cut read it.
|
|
25
|
+
*/
|
|
26
|
+
export const printRootsVerb: Verb = ({ out, err, host, inputs, scope, openClient }) => {
|
|
27
|
+
const { config, provenance } = resolve(inputs());
|
|
28
|
+
const scoped = scope();
|
|
29
|
+
const answer = runRoots(openClient(false), host, scoped, config, provenance);
|
|
30
|
+
const several = answer.configurations.length > 1;
|
|
31
|
+
for (const root of answer.roots) {
|
|
32
|
+
out.write(`${rootLine(root, several)}\n`);
|
|
33
|
+
}
|
|
34
|
+
for (const finding of answer.findings) {
|
|
35
|
+
err.write(`${finding.code}: roots.patterns names nothing: ${finding.symbol.ref}\n`);
|
|
36
|
+
}
|
|
37
|
+
return answer.findings.length > 0 ? EXIT_FINDINGS : EXIT_CLEAN;
|
|
38
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Inputs } from "../config.ts";
|
|
2
|
+
import type { Emitters } from "../findings/emitter.ts";
|
|
3
|
+
import type { Host } from "../host.ts";
|
|
4
|
+
import type { Writer } from "../run.ts";
|
|
5
|
+
import type { Scope } from "../scope.ts";
|
|
6
|
+
import type { Engine } from "../session.ts";
|
|
7
|
+
|
|
8
|
+
/** The exit codes the Contract's exit-code table names. */
|
|
9
|
+
export const EXIT_CLEAN = 0;
|
|
10
|
+
export const EXIT_FINDINGS = 1;
|
|
11
|
+
export const EXIT_USAGE = 2;
|
|
12
|
+
export const EXIT_FAILURE = 3;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* What one verb is handed: the streams it writes, the platform it reads, and the
|
|
16
|
+
* options that follow its name, read only when the verb asks for what they name, so
|
|
17
|
+
* a verb that asks for nothing refuses no option.
|
|
18
|
+
*/
|
|
19
|
+
export interface Invocation {
|
|
20
|
+
readonly out: Writer;
|
|
21
|
+
readonly err: Writer;
|
|
22
|
+
readonly host: Host;
|
|
23
|
+
/** The configuration documents the options name, and the settings they supply. */
|
|
24
|
+
readonly inputs: () => Inputs;
|
|
25
|
+
/** The scope the options name: the document `--scope` names, or the target. */
|
|
26
|
+
readonly scope: () => Scope;
|
|
27
|
+
/** Opens the compiler client. A client the verb opened is closed if the verb throws. */
|
|
28
|
+
readonly openClient: (collectTiming: boolean) => Engine;
|
|
29
|
+
/** The emitter of every kind family, which a verb that reports findings runs. */
|
|
30
|
+
readonly emitters: Emitters;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* One verb of the command line. It returns the exit code, and refuses by throwing a
|
|
35
|
+
* configuration, discovery or scope error, which the command line writes and turns
|
|
36
|
+
* into the code the Contract's table gives it.
|
|
37
|
+
*/
|
|
38
|
+
export type Verb = (invocation: Invocation) => number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CONTRACT_VERSION } from "../version.ts";
|
|
2
|
+
import { EXIT_CLEAN, type Verb } from "./verb.ts";
|
|
3
|
+
|
|
4
|
+
/** Writes the version the host reports and the Contract version this analyzer implements. */
|
|
5
|
+
export const versionVerb: Verb = ({ out, host }) => {
|
|
6
|
+
out.write(`deadset-ts ${host.analyzerVersion()}\ncontract ${CONTRACT_VERSION}\n`);
|
|
7
|
+
return EXIT_CLEAN;
|
|
8
|
+
};
|
package/src/version.ts
CHANGED