@stillwind/analysis 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 +21 -0
- package/README.md +11 -2
- package/dist/browser.d.ts +141 -0
- package/dist/browser.js +342 -0
- package/dist/browser.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/memory.d.ts +52 -0
- package/dist/memory.js +113 -0
- package/dist/memory.js.map +1 -0
- package/dist/node.d.ts +152 -0
- package/dist/node.js +510 -0
- package/dist/node.js.map +1 -0
- package/dist/reports-BKeFV47o.d.ts +12 -0
- package/dist/reports-nlgN4YL4.js +21 -0
- package/dist/reports-nlgN4YL4.js.map +1 -0
- package/dist/rewrite-Bdo2ssmD.js +155 -0
- package/dist/rewrite-Bdo2ssmD.js.map +1 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.js +78 -0
- package/dist/worker.js.map +1 -0
- package/dist/workspace-BF46yPpm.d.ts +149 -0
- package/package.json +51 -3
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { fingerprint } from "@stillwind/native";
|
|
2
|
+
// src/rewrite.ts
|
|
3
|
+
/** Failed rewrite planning with the analysis results that prevented writing. */
|
|
4
|
+
var RewriteFailure = class extends Error {
|
|
5
|
+
results;
|
|
6
|
+
constructor(message, results) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.results = results;
|
|
9
|
+
this.name = "RewriteFailure";
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
/** Owns buffer versions while computing changes against one workspace. Calls must be serialized. */
|
|
13
|
+
var SourceRewriter = class {
|
|
14
|
+
workspace;
|
|
15
|
+
/** Increasing version assigned to every buffer in each rewrite pass. */
|
|
16
|
+
#version = 0;
|
|
17
|
+
/**
|
|
18
|
+
* Attaches rewriting to a workspace whose buffers the caller reserves for this rewriter.
|
|
19
|
+
*
|
|
20
|
+
* @param workspace - Open workspace. Serialize rewrite calls and avoid concurrent updates to input paths.
|
|
21
|
+
* When prepare is available, the rewriter calls it after installing each pass's buffers.
|
|
22
|
+
*/
|
|
23
|
+
constructor(workspace) {
|
|
24
|
+
this.workspace = workspace;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Computes sorting or converged lint fixes without saving files. All input buffers are visible
|
|
28
|
+
* to dependency analysis. After distinct paths are validated, captured
|
|
29
|
+
* buffers are removed even when rewriting fails. Preparation runs once before each pass's per-file queries.
|
|
30
|
+
*
|
|
31
|
+
* @param inputs - Distinct absolute paths and complete text. Only sorting uses protected ranges.
|
|
32
|
+
* @param operation - One sort pass or lint-fix passes until the text stops changing.
|
|
33
|
+
* @returns Successful buffers and failures in input order. Failed buffers retain their original
|
|
34
|
+
* text in subsequent passes. Fixes return no edits because their offsets span several passes.
|
|
35
|
+
* @throws If paths repeat or workspace invalidation, preparation, buffer installation, or cleanup fails.
|
|
36
|
+
*/
|
|
37
|
+
async rewrite(inputs, operation) {
|
|
38
|
+
if (new Set(inputs.map((input) => input.file)).size !== inputs.length) throw new Error("Rewrite inputs must have distinct file paths");
|
|
39
|
+
let buffers = inputs;
|
|
40
|
+
const failures = /* @__PURE__ */ new Map();
|
|
41
|
+
const originals = new Map(inputs.map((input) => [input.file, input.source]));
|
|
42
|
+
const seen = new Map(inputs.map((input) => [input.file, /* @__PURE__ */ new Set()]));
|
|
43
|
+
try {
|
|
44
|
+
this.workspace.invalidate();
|
|
45
|
+
for (;;) {
|
|
46
|
+
const snapshot = JSON.stringify([buffers.map((input) => input.source), [...failures.keys()]]);
|
|
47
|
+
const version = ++this.#version;
|
|
48
|
+
for (const input of buffers) this.workspace.update(input.file, input.source, version);
|
|
49
|
+
await this.workspace.prepare?.(buffers.filter((input) => !failures.has(input.file)).map((input) => input.file));
|
|
50
|
+
const outputs = [];
|
|
51
|
+
let changed = false;
|
|
52
|
+
for (const input of buffers) {
|
|
53
|
+
if (failures.has(input.file)) continue;
|
|
54
|
+
try {
|
|
55
|
+
const output = await this.#rewriteBuffer(input, operation);
|
|
56
|
+
if (operation === "fixes" && output.code !== input.source) {
|
|
57
|
+
const history = seen.get(input.file);
|
|
58
|
+
if (history.has(snapshot)) throw new RewriteFailure("Stillwind fixes did not converge", output.results);
|
|
59
|
+
if (history.size >= 10) throw new RewriteFailure("Stillwind fixes exceeded ten passes", output.results);
|
|
60
|
+
history.add(snapshot);
|
|
61
|
+
changed = true;
|
|
62
|
+
}
|
|
63
|
+
outputs.push(output);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
failures.set(input.file, {
|
|
66
|
+
file: input.file,
|
|
67
|
+
message: error instanceof Error ? error.message : String(error),
|
|
68
|
+
results: error instanceof RewriteFailure ? error.results : []
|
|
69
|
+
});
|
|
70
|
+
changed ||= input.source !== originals.get(input.file);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (operation === "sort" || !changed) return {
|
|
74
|
+
outputs: outputs.map((output) => ({
|
|
75
|
+
...output,
|
|
76
|
+
edits: operation === "sort" ? output.edits : []
|
|
77
|
+
})),
|
|
78
|
+
failures: inputs.flatMap((input) => {
|
|
79
|
+
const failure = failures.get(input.file);
|
|
80
|
+
return failure ? [failure] : [];
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
const replacements = new Map(outputs.map((output) => [output.file, output.code]));
|
|
84
|
+
buffers = inputs.map((input) => ({
|
|
85
|
+
file: input.file,
|
|
86
|
+
source: replacements.get(input.file) ?? input.source
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
} finally {
|
|
90
|
+
for (const input of inputs) this.workspace.closeDocument(input.file);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Analyzes one installed buffer and requires matching project answers to produce the same text.
|
|
95
|
+
*
|
|
96
|
+
* @param input - Buffer already installed in the workspace for the current pass.
|
|
97
|
+
* @param operation - Sort or fixes query to apply to the original text of this pass.
|
|
98
|
+
* @returns The first project's edits and all project findings, or unchanged text outside every scope.
|
|
99
|
+
* @throws If analysis is incomplete, syntax is invalid, answers are missing or stale, or projects disagree.
|
|
100
|
+
*/
|
|
101
|
+
async #rewriteBuffer(input, operation) {
|
|
102
|
+
const results = await this.workspace.analyze(input.file);
|
|
103
|
+
if (results.some(({ result }) => result.status !== "complete")) {
|
|
104
|
+
const reasons = results.flatMap(({ result }) => result.status === "complete" ? [] : [result.error ?? result.graph?.unverified[0]?.reason ?? result.status]);
|
|
105
|
+
throw new RewriteFailure(`Incomplete analysis for ${input.file}: ${reasons.join("; ")}`, results);
|
|
106
|
+
}
|
|
107
|
+
const syntaxErrors = results.flatMap(({ result }) => result.reports.filter((report) => ["SW10001", "SW10002"].includes(report.code)));
|
|
108
|
+
if (syntaxErrors.length) throw new RewriteFailure(`Cannot rewrite ${input.file}: ${syntaxErrors.map((report) => report.message).join("; ")}`, results);
|
|
109
|
+
const answers = await this.workspace.query(input.file, operation === "sort" ? {
|
|
110
|
+
kind: "sort",
|
|
111
|
+
protectedRanges: input.protectedRanges
|
|
112
|
+
} : { kind: "fixes" });
|
|
113
|
+
if (answers.length !== results.length) throw new Error(`Missing rewrite result for ${input.file}`);
|
|
114
|
+
const revision = fingerprint(input.source);
|
|
115
|
+
const candidates = answers.map(({ result }) => {
|
|
116
|
+
if (result.revision !== revision) throw new Error(`Stale edits for ${input.file}`);
|
|
117
|
+
const edits = result.edits ?? [];
|
|
118
|
+
return {
|
|
119
|
+
code: applySourceEdits(input.source, edits),
|
|
120
|
+
edits
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
const first = candidates[0] ?? {
|
|
124
|
+
code: input.source,
|
|
125
|
+
edits: []
|
|
126
|
+
};
|
|
127
|
+
if (candidates.some((candidate) => candidate.code !== first.code)) throw new Error(`Conflicting project rewrites for ${input.file}`);
|
|
128
|
+
return {
|
|
129
|
+
file: input.file,
|
|
130
|
+
...first,
|
|
131
|
+
results
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Applies edits from the end of the original text after validating their ranges.
|
|
137
|
+
*
|
|
138
|
+
* @param source - Original text from which all edit offsets were measured.
|
|
139
|
+
* @param edits - Half-open ranges with safe integer UTF-16 offsets, in any order. The array is unchanged.
|
|
140
|
+
* @returns Text with every replacement applied.
|
|
141
|
+
* @throws If a range is invalid, outside the source, or overlaps another range.
|
|
142
|
+
*/
|
|
143
|
+
function applySourceEdits(source, edits) {
|
|
144
|
+
const ordered = [...edits].sort((a, b) => a.start - b.start || a.end - b.end);
|
|
145
|
+
let end = 0;
|
|
146
|
+
for (const edit of ordered) {
|
|
147
|
+
if (!Number.isSafeInteger(edit.start) || !Number.isSafeInteger(edit.end) || edit.start < end || edit.end < edit.start || edit.end > source.length) throw new Error("Invalid or overlapping source edits");
|
|
148
|
+
end = edit.end;
|
|
149
|
+
}
|
|
150
|
+
for (const edit of ordered.reverse()) source = source.slice(0, edit.start) + edit.newText + source.slice(edit.end);
|
|
151
|
+
return source;
|
|
152
|
+
}
|
|
153
|
+
export { SourceRewriter as n, RewriteFailure as t };
|
|
154
|
+
|
|
155
|
+
//# sourceMappingURL=rewrite-Bdo2ssmD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewrite-Bdo2ssmD.js","names":[],"sources":["../src/rewrite.ts"],"sourcesContent":["import type { AnalysisWorkspace, EditorEdit, WorkspaceResult } from \"@stillwind/host\";\nimport { fingerprint } from \"@stillwind/native\";\n\n/** Failed rewrite planning with the analysis results that prevented writing. */\nexport class RewriteFailure extends Error {\n constructor(\n message: string,\n readonly results: WorkspaceResult[],\n ) {\n super(message);\n this.name = \"RewriteFailure\";\n }\n}\n\n/** Original buffer and ranges excluded by a formatter adapter. Paths are absolute. */\nexport interface RewriteInput {\n /** Absolute target path used for workspace membership and dependency resolution. */\n file: string;\n /** Complete original text against which edits are measured. */\n source: string;\n /** Half-open UTF-16 ranges in source. Only sorting accepts protected ranges. */\n protectedRanges?: readonly {\n /** Inclusive original UTF-16 offset. */\n start: number;\n /** Exclusive original UTF-16 offset. */\n end: number;\n }[];\n}\n\n/** Replacement text and independent project findings for one original buffer. */\nexport interface RewriteResult {\n /** Absolute path copied from the corresponding input. */\n file: string;\n /** Final text after sorting or converged fixes. */\n code: string;\n /** Sorting edits in the input buffer. Iterated lint fixes omit these edits. */\n edits: EditorEdit[];\n /** Findings for the analyzed input of the final pass, in project order. */\n results: WorkspaceResult[];\n}\n\n/** A target that could not be read, rewritten, or saved. */\nexport interface RewriteFileFailure {\n /** Absolute path of the failed target. */\n file: string;\n /** Reason that reading, planning, or saving this target failed. */\n message: string;\n /** Analysis findings captured before planning failed, when available. */\n results: WorkspaceResult[];\n}\n\n/** Independent target outcomes from a shared set of captured buffers. */\nexport interface RewriteBatchResult {\n /** Successful replacements in input order. */\n outputs: RewriteResult[];\n /** Failed targets in input order. */\n failures: RewriteFileFailure[];\n}\n\n/** Owns buffer versions while computing changes against one workspace. Calls must be serialized. */\nexport class SourceRewriter {\n /** Increasing version assigned to every buffer in each rewrite pass. */\n #version = 0;\n\n /**\n * Attaches rewriting to a workspace whose buffers the caller reserves for this rewriter.\n *\n * @param workspace - Open workspace. Serialize rewrite calls and avoid concurrent updates to input paths.\n * When prepare is available, the rewriter calls it after installing each pass's buffers.\n */\n constructor(\n private readonly workspace: Pick<\n AnalysisWorkspace,\n \"invalidate\" | \"update\" | \"analyze\" | \"query\" | \"closeDocument\"\n > &\n Partial<Pick<AnalysisWorkspace, \"prepare\">>,\n ) {}\n\n /**\n * Computes sorting or converged lint fixes without saving files. All input buffers are visible\n * to dependency analysis. After distinct paths are validated, captured\n * buffers are removed even when rewriting fails. Preparation runs once before each pass's per-file queries.\n *\n * @param inputs - Distinct absolute paths and complete text. Only sorting uses protected ranges.\n * @param operation - One sort pass or lint-fix passes until the text stops changing.\n * @returns Successful buffers and failures in input order. Failed buffers retain their original\n * text in subsequent passes. Fixes return no edits because their offsets span several passes.\n * @throws If paths repeat or workspace invalidation, preparation, buffer installation, or cleanup fails.\n */\n async rewrite(\n inputs: readonly RewriteInput[],\n operation: \"sort\" | \"fixes\",\n ): Promise<RewriteBatchResult> {\n if (new Set(inputs.map((input) => input.file)).size !== inputs.length) {\n throw new Error(\"Rewrite inputs must have distinct file paths\");\n }\n let buffers = inputs;\n const failures = new Map<string, RewriteFileFailure>();\n const originals = new Map(inputs.map((input) => [input.file, input.source]));\n const seen = new Map(inputs.map((input) => [input.file, new Set<string>()]));\n try {\n this.workspace.invalidate();\n for (;;) {\n const snapshot = JSON.stringify([\n buffers.map((input) => input.source),\n [...failures.keys()],\n ]);\n const version = ++this.#version;\n for (const input of buffers) {\n this.workspace.update(input.file, input.source, version);\n }\n await this.workspace.prepare?.(\n buffers.filter((input) => !failures.has(input.file)).map((input) => input.file),\n );\n const outputs: RewriteResult[] = [];\n let changed = false;\n for (const input of buffers) {\n if (failures.has(input.file)) {\n continue;\n }\n try {\n const output = await this.#rewriteBuffer(input, operation);\n if (operation === \"fixes\" && output.code !== input.source) {\n const history = seen.get(input.file)!;\n if (history.has(snapshot)) {\n throw new RewriteFailure(\"Stillwind fixes did not converge\", output.results);\n }\n if (history.size >= 10) {\n throw new RewriteFailure(\"Stillwind fixes exceeded ten passes\", output.results);\n }\n history.add(snapshot);\n changed = true;\n }\n outputs.push(output);\n } catch (error) {\n failures.set(input.file, {\n file: input.file,\n message: error instanceof Error ? error.message : String(error),\n results: error instanceof RewriteFailure ? error.results : [],\n });\n changed ||= input.source !== originals.get(input.file);\n }\n }\n if (operation === \"sort\" || !changed) {\n return {\n outputs: outputs.map((output) => ({\n ...output,\n edits: operation === \"sort\" ? output.edits : [],\n })),\n failures: inputs.flatMap((input) => {\n const failure = failures.get(input.file);\n return failure ? [failure] : [];\n }),\n };\n }\n const replacements = new Map(outputs.map((output) => [output.file, output.code]));\n buffers = inputs.map((input) => ({\n file: input.file,\n source: replacements.get(input.file) ?? input.source,\n }));\n }\n } finally {\n for (const input of inputs) {\n this.workspace.closeDocument(input.file);\n }\n }\n }\n\n /**\n * Analyzes one installed buffer and requires matching project answers to produce the same text.\n *\n * @param input - Buffer already installed in the workspace for the current pass.\n * @param operation - Sort or fixes query to apply to the original text of this pass.\n * @returns The first project's edits and all project findings, or unchanged text outside every scope.\n * @throws If analysis is incomplete, syntax is invalid, answers are missing or stale, or projects disagree.\n */\n async #rewriteBuffer(input: RewriteInput, operation: \"sort\" | \"fixes\"): Promise<RewriteResult> {\n const results = await this.workspace.analyze(input.file);\n if (results.some(({ result }) => result.status !== \"complete\")) {\n const reasons = results.flatMap(({ result }) =>\n result.status === \"complete\"\n ? []\n : [result.error ?? result.graph?.unverified[0]?.reason ?? result.status],\n );\n throw new RewriteFailure(\n `Incomplete analysis for ${input.file}: ${reasons.join(\"; \")}`,\n results,\n );\n }\n const syntaxErrors = results.flatMap(({ result }) =>\n result.reports.filter((report) => [\"SW10001\", \"SW10002\"].includes(report.code)),\n );\n if (syntaxErrors.length) {\n throw new RewriteFailure(\n `Cannot rewrite ${input.file}: ${syntaxErrors.map((report) => report.message).join(\"; \")}`,\n results,\n );\n }\n const answers = await this.workspace.query(\n input.file,\n operation === \"sort\"\n ? {\n kind: \"sort\",\n protectedRanges: input.protectedRanges,\n }\n : {\n kind: \"fixes\",\n },\n );\n if (answers.length !== results.length) {\n throw new Error(`Missing rewrite result for ${input.file}`);\n }\n const revision = fingerprint(input.source);\n const candidates = answers.map(({ result }) => {\n if (result.revision !== revision) {\n throw new Error(`Stale edits for ${input.file}`);\n }\n const edits = result.edits ?? [];\n return {\n code: applySourceEdits(input.source, edits),\n edits,\n };\n });\n const first = candidates[0] ?? {\n code: input.source,\n edits: [],\n };\n if (candidates.some((candidate) => candidate.code !== first.code)) {\n throw new Error(`Conflicting project rewrites for ${input.file}`);\n }\n return {\n file: input.file,\n ...first,\n results,\n };\n }\n}\n\n/**\n * Applies edits from the end of the original text after validating their ranges.\n *\n * @param source - Original text from which all edit offsets were measured.\n * @param edits - Half-open ranges with safe integer UTF-16 offsets, in any order. The array is unchanged.\n * @returns Text with every replacement applied.\n * @throws If a range is invalid, outside the source, or overlaps another range.\n */\nexport function applySourceEdits(source: string, edits: readonly EditorEdit[]): string {\n const ordered = [...edits].sort((a, b) => a.start - b.start || a.end - b.end);\n let end = 0;\n for (const edit of ordered) {\n if (\n !Number.isSafeInteger(edit.start) ||\n !Number.isSafeInteger(edit.end) ||\n edit.start < end ||\n edit.end < edit.start ||\n edit.end > source.length\n ) {\n throw new Error(\"Invalid or overlapping source edits\");\n }\n end = edit.end;\n }\n for (const edit of ordered.reverse()) {\n source = source.slice(0, edit.start) + edit.newText + source.slice(edit.end);\n }\n return source;\n}\n"],"mappings":";;;AAIA,IAAa,iBAAb,cAAoC,MAAM;CAG7B;CAFX,YACE,SACA,SACA;EACA,MAAM,OAAO;EAFJ,KAAA,UAAA;EAGT,KAAK,OAAO;CACd;AACF;;AAgDA,IAAa,iBAAb,MAA4B;CAWP;;CATnB,WAAW;;;;;;;CAQX,YACE,WAKA;EALiB,KAAA,YAAA;CAKhB;;;;;;;;;;;;CAaH,MAAM,QACJ,QACA,WAC6B;EAC7B,IAAI,IAAI,IAAI,OAAO,KAAK,UAAU,MAAM,IAAI,CAAC,CAAC,CAAC,SAAS,OAAO,QAC7D,MAAM,IAAI,MAAM,8CAA8C;EAEhE,IAAI,UAAU;EACd,MAAM,2BAAW,IAAI,IAAgC;EACrD,MAAM,YAAY,IAAI,IAAI,OAAO,KAAK,UAAU,CAAC,MAAM,MAAM,MAAM,MAAM,CAAC,CAAC;EAC3E,MAAM,OAAO,IAAI,IAAI,OAAO,KAAK,UAAU,CAAC,MAAM,sBAAM,IAAI,IAAY,CAAC,CAAC,CAAC;EAC3E,IAAI;GACF,KAAK,UAAU,WAAW;GAC1B,SAAS;IACP,MAAM,WAAW,KAAK,UAAU,CAC9B,QAAQ,KAAK,UAAU,MAAM,MAAM,GACnC,CAAC,GAAG,SAAS,KAAK,CAAC,CACrB,CAAC;IACD,MAAM,UAAU,EAAE,KAAK;IACvB,KAA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B,MAAM,MAAM;GAEjD,MAAM,QAAQ,OAAO,SAAS,CAAC;GAC/B,OAAO;IACL,MAAM,iBAAiB,MAAM,QAAQ,KAAK;IAC1C;GACF;EACF,CAAC;EACD,MAAM,QAAQ,WAAW,MAAM;GAC7B,MAAM,MAAM;GACZ,OAAO,CAAC;EACV;EACA,IAAI,WAAW,MAAM,cAAc,UAAU,SAAS,MAAM,IAAI,GAC9D,MAAM,IAAI,MAAM,oCAAoC,MAAM,MAAM;EAElE,OAAO;GACL,MAAM,MAAM;GACZ,GAAG;GACH;EACF;CACF;AACF;;;;;;;;;AAUA,SAAgB,iBAAiB,QAAgB,OAAsC;CACrF,MAAM,UAAU,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG;CAC5E,IAAI,MAAM;CACV,KAAK,MAAM,QAAQ,SAAS;EAC1B,IACE,CAAC,OAAO,cAAc,KAAK,KAAK,KAChC,CAAC,OAAO,cAAc,KAAK,GAAG,KAC9B,KAAK,QAAQ,OACb,KAAK,MAAM,KAAK,SAChB,KAAK,MAAM,OAAO,QAElB,MAAM,IAAI,MAAM,qCAAqC;EAEvD,MAAM,KAAK;CACb;CACA,KAAK,MAAM,QAAQ,QAAQ,QAAQ,GACjC,SAAS,OAAO,MAAM,GAAG,KAAK,KAAK,IAAI,KAAK,UAAU,OAAO,MAAM,KAAK,GAAG;CAE7E,OAAO;AACT"}
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { n as SourceRewriter, t as RewriteFailure } from "./rewrite-Bdo2ssmD.js";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { AnalysisWorkspace } from "@stillwind/host";
|
|
4
|
+
// src/worker.ts
|
|
5
|
+
let workspace;
|
|
6
|
+
let rewriter;
|
|
7
|
+
process.on("message", (message) => {
|
|
8
|
+
handle(message.request).then((value) => {
|
|
9
|
+
process.send?.({
|
|
10
|
+
id: message.id,
|
|
11
|
+
value
|
|
12
|
+
}, () => {
|
|
13
|
+
if (message.request.method === "close") process.disconnect?.();
|
|
14
|
+
});
|
|
15
|
+
}, (error) => {
|
|
16
|
+
process.send?.({
|
|
17
|
+
id: message.id,
|
|
18
|
+
error: {
|
|
19
|
+
message: error instanceof Error ? error.message : String(error),
|
|
20
|
+
results: error instanceof RewriteFailure ? error.results : void 0
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
process.on("disconnect", () => {
|
|
26
|
+
Promise.resolve(workspace?.close()).finally(() => {
|
|
27
|
+
process.exit();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Dispatches one IPC operation against the child-owned workspace and rewriter.
|
|
32
|
+
*
|
|
33
|
+
* @param request - Operation payload. Open must complete before other operations except close.
|
|
34
|
+
* @returns The operation result, including a boolean for refresh, or undefined for state changes.
|
|
35
|
+
* The targets operation returns sorted, distinct paths.
|
|
36
|
+
* @throws If no workspace is open or the selected workspace operation fails.
|
|
37
|
+
*/
|
|
38
|
+
async function handle(request) {
|
|
39
|
+
if (request.method === "open") {
|
|
40
|
+
await workspace?.close();
|
|
41
|
+
workspace = void 0;
|
|
42
|
+
workspace = await AnalysisWorkspace.open(request.config);
|
|
43
|
+
rewriter = new SourceRewriter(workspace);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (!workspace) {
|
|
47
|
+
if (request.method === "close") return;
|
|
48
|
+
throw new Error("Stillwind workspace has not been opened");
|
|
49
|
+
}
|
|
50
|
+
switch (request.method) {
|
|
51
|
+
case "targets": {
|
|
52
|
+
const files = await Promise.all(workspace.projects.map((project) => workspace.targets(project, request.patterns ? [...request.patterns] : void 0, { stylesheets: request.stylesheets })));
|
|
53
|
+
return [...new Set(files.flat())].sort();
|
|
54
|
+
}
|
|
55
|
+
case "rewrite": return rewriter.rewrite(request.inputs, request.operation);
|
|
56
|
+
case "lint": return workspace.lint(request.patterns ? [...request.patterns] : void 0);
|
|
57
|
+
case "analyze": return workspace.analyze(request.file);
|
|
58
|
+
case "prepare": return workspace.prepare(request.files);
|
|
59
|
+
case "query": return workspace.query(request.file, request.request);
|
|
60
|
+
case "update":
|
|
61
|
+
workspace.update(request.file, request.source, request.version);
|
|
62
|
+
return;
|
|
63
|
+
case "closeDocument":
|
|
64
|
+
workspace.closeDocument(request.file);
|
|
65
|
+
return;
|
|
66
|
+
case "invalidate":
|
|
67
|
+
workspace.invalidate();
|
|
68
|
+
return;
|
|
69
|
+
case "refresh": return workspace.refresh(request.files);
|
|
70
|
+
case "close":
|
|
71
|
+
await workspace.close();
|
|
72
|
+
workspace = void 0;
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","names":[],"sources":["../src/worker.ts"],"sourcesContent":["import process from \"node:process\";\n\nimport { AnalysisWorkspace } from \"@stillwind/host\";\n\nimport { RewriteFailure, SourceRewriter } from \"./rewrite.ts\";\nimport type { WorkerRequest } from \"./worker-client.ts\";\n\nlet workspace: AnalysisWorkspace | undefined;\nlet rewriter: SourceRewriter | undefined;\n\nprocess.on(\n \"message\",\n (message: {\n /** Sequence number copied into the IPC reply. */\n id: number;\n /** Operation payload sent by AnalysisWorker. Callers serialize workspace replacement and rewrites. */\n request: WorkerRequest;\n }) => {\n void handle(message.request).then(\n (value) => {\n process.send?.({ id: message.id, value }, () => {\n if (message.request.method === \"close\") {\n process.disconnect?.();\n }\n });\n },\n (error: unknown) => {\n process.send?.({\n id: message.id,\n error: {\n message: error instanceof Error ? error.message : String(error),\n results: error instanceof RewriteFailure ? error.results : undefined,\n },\n });\n },\n );\n },\n);\n\nprocess.on(\"disconnect\", () => {\n void Promise.resolve(workspace?.close()).finally(() => {\n process.exit();\n });\n});\n\n/**\n * Dispatches one IPC operation against the child-owned workspace and rewriter.\n *\n * @param request - Operation payload. Open must complete before other operations except close.\n * @returns The operation result, including a boolean for refresh, or undefined for state changes.\n * The targets operation returns sorted, distinct paths.\n * @throws If no workspace is open or the selected workspace operation fails.\n */\nasync function handle(request: WorkerRequest): Promise<unknown> {\n if (request.method === \"open\") {\n await workspace?.close();\n workspace = undefined;\n workspace = await AnalysisWorkspace.open(request.config);\n rewriter = new SourceRewriter(workspace);\n return undefined;\n }\n\n if (!workspace) {\n if (request.method === \"close\") {\n return undefined;\n }\n throw new Error(\"Stillwind workspace has not been opened\");\n }\n\n switch (request.method) {\n case \"targets\": {\n const files = await Promise.all(\n workspace.projects.map((project) =>\n workspace!.targets(project, request.patterns ? [...request.patterns] : undefined, {\n stylesheets: request.stylesheets,\n }),\n ),\n );\n return [...new Set(files.flat())].sort();\n }\n\n case \"rewrite\":\n return rewriter!.rewrite(request.inputs, request.operation);\n\n case \"lint\":\n return workspace.lint(request.patterns ? [...request.patterns] : undefined);\n\n case \"analyze\":\n return workspace.analyze(request.file);\n\n case \"prepare\":\n return workspace.prepare(request.files);\n\n case \"query\":\n return workspace.query(request.file, request.request);\n\n case \"update\":\n workspace.update(request.file, request.source, request.version);\n return undefined;\n\n case \"closeDocument\":\n workspace.closeDocument(request.file);\n return undefined;\n\n case \"invalidate\":\n workspace.invalidate();\n return undefined;\n\n case \"refresh\":\n return workspace.refresh(request.files);\n\n case \"close\":\n await workspace.close();\n workspace = undefined;\n return undefined;\n }\n}\n"],"mappings":";;;;AAOA,IAAI;AACJ,IAAI;AAEJ,QAAQ,GACN,YACC,YAKK;CACJ,OAAY,QAAQ,OAAO,CAAC,CAAC,MAC1B,UAAU;EACT,QAAQ,OAAO;GAAE,IAAI,QAAQ;GAAI;EAAM,SAAS;GAC9C,IAAI,QAAQ,QAAQ,WAAW,SAC7B,QAAQ,aAAa;EAEz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AQ,MAAM,QAAQ,OAAO;EAEtD,KAAK;GACH,UAAU,OAAO,QAAQ,MAAM,QAAQ,QAAQ,QAAQ,OAAO;GAC9D;EAEF,KAAK;GACH,UAAU,cAAc,QAAQ,IAAI;GACpC;EAEF,KAAK;GACH,UAAU,WAAW;GACrB;EAEF,KAAK,WACH,OAAO,UAAU,QAAQ,QAAQ,KAAK;EAExC,KAAK;GACH,MAAM,UAAU,MAAM;GACtB,YAAY,KAAA;GACZ;CACJ;AACF"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { BindingReport } from "@stillwind/native";
|
|
2
|
+
import { EditorRequest, EditorResult, UnverifiedRange } from "@stillwind/host";
|
|
3
|
+
/** Analysis results tied to one target and the project revision captured for that request. */
|
|
4
|
+
interface AnalysisResult {
|
|
5
|
+
/** Entry identity supplied to the service. Node hosts use a file path. Memory hosts use a URI. */
|
|
6
|
+
entry: string;
|
|
7
|
+
/** Project change counter captured before analysis. Document changes make older results stale. */
|
|
8
|
+
revision: number;
|
|
9
|
+
/**
|
|
10
|
+
* Complete means analysis had the required inputs, even when reports contain compiler errors.
|
|
11
|
+
* Incomplete means some inputs or host operations failed. Stale and cancelled results omit reports.
|
|
12
|
+
*/
|
|
13
|
+
status: "complete" | "incomplete" | "stale" | "cancelled";
|
|
14
|
+
/** Findings for this project's scope. Locations use original documents and zero-based UTF-16 positions. */
|
|
15
|
+
reports: BindingReport[];
|
|
16
|
+
/** Imports observed by semantic traversal. Omission means no dependency information was returned. */
|
|
17
|
+
dependencies?: AnalysisDependency[];
|
|
18
|
+
/** Original UTF-8 ranges whose semantic information was unavailable. */
|
|
19
|
+
unverified?: UnverifiedRange[];
|
|
20
|
+
/** Whether code generation has the required validated facts and no compiler errors. */
|
|
21
|
+
generation?: "complete" | "blocked";
|
|
22
|
+
/** Caught host or compiler exception as text. Compiler error reports alone do not populate it. */
|
|
23
|
+
error?: string;
|
|
24
|
+
}
|
|
25
|
+
/** A dependency observed by the analysis engine's module resolver. */
|
|
26
|
+
interface AnalysisDependency {
|
|
27
|
+
/** Full resolver identity of the importing source. */
|
|
28
|
+
importer: string;
|
|
29
|
+
/** Authored import request. */
|
|
30
|
+
specifier: string;
|
|
31
|
+
/** Resolved dependency identity, omitted when the request could not be resolved. */
|
|
32
|
+
id?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Resolved sources are traversed. External modules and dependencies handled through checker
|
|
35
|
+
* declarations (`types`) are skipped.
|
|
36
|
+
* Unresolved requests and unsupported sources leave analysis incomplete.
|
|
37
|
+
*/
|
|
38
|
+
status: "resolved" | "external" | "unresolved" | "unsupported" | "types";
|
|
39
|
+
}
|
|
40
|
+
/** Keeps the project's membership when several projects analyze the same target. */
|
|
41
|
+
interface WorkspaceResult$1 {
|
|
42
|
+
/** Zero-based project index within this configuration. Memory services use zero. */
|
|
43
|
+
project: number;
|
|
44
|
+
/** Configuration identity for grouping findings. It can be an absolute file path or an embedding's label. */
|
|
45
|
+
config: string;
|
|
46
|
+
/** Captured analysis for this project, retained separately from overlapping projects. */
|
|
47
|
+
result: AnalysisResult;
|
|
48
|
+
}
|
|
49
|
+
/** URI-based operations shared by Node hosts and browser compiler workers. */
|
|
50
|
+
interface AnalysisWorkspaceService {
|
|
51
|
+
/**
|
|
52
|
+
* Prepares targets together so later analyses can reuse their source and checker inputs.
|
|
53
|
+
*
|
|
54
|
+
* @param uris - Target document URIs. Each service applies its own project membership rules.
|
|
55
|
+
* @param signal - Optional cancellation. Work already started may finish without publishing results.
|
|
56
|
+
* @returns Completion of preparation. Source failures are reported by analyze for each target.
|
|
57
|
+
* @throws If the service or its transport cannot prepare the workspace.
|
|
58
|
+
*/
|
|
59
|
+
prepare?(uris: readonly string[], signal?: AbortSignal): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Checks whether a save or watch notification allows the caller to keep this workspace.
|
|
62
|
+
* This method does not reopen the workspace.
|
|
63
|
+
*
|
|
64
|
+
* @param uris - Document URIs reported by save or watch notifications.
|
|
65
|
+
* @returns True when current buffers cover every change and configuration is unchanged.
|
|
66
|
+
* False, or the absence of this method, tells the caller to reopen the workspace.
|
|
67
|
+
* @throws If the service or its transport cannot check the files.
|
|
68
|
+
*/
|
|
69
|
+
refresh?(uris: readonly string[]): Promise<boolean>;
|
|
70
|
+
/**
|
|
71
|
+
* Queries optional editor features against captured original documents.
|
|
72
|
+
*
|
|
73
|
+
* @param uri - Target document URI within a configured project.
|
|
74
|
+
* @param request - Operation using original UTF-16 offsets.
|
|
75
|
+
* @param signal - Cancellation discards obsolete results.
|
|
76
|
+
* @returns Independent project answers. Absence of this method means diagnostic-only support.
|
|
77
|
+
*/
|
|
78
|
+
query?(uri: string, request: EditorRequest, signal?: AbortSignal): Promise<WorkspaceEditorResult[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Replaces an open document's buffer in every project that may depend on it.
|
|
81
|
+
*
|
|
82
|
+
* @param uri - Document URI, including documents outside the project's target scope.
|
|
83
|
+
* @param source - Complete original document text.
|
|
84
|
+
* @param version - Safe integer that increases while the document is open. Repeating identical
|
|
85
|
+
* text at the same version can be accepted as an unchanged update.
|
|
86
|
+
* @returns Nothing, or a promise that resolves when subsequent analysis can use the buffer.
|
|
87
|
+
* @throws If the version is invalid or does not increase, or the service cannot store the buffer.
|
|
88
|
+
*/
|
|
89
|
+
update(uri: string, source: string, version: number): void | Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Removes an open buffer so future reads can use the underlying source provider.
|
|
92
|
+
*
|
|
93
|
+
* @param uri - Document URI. An unknown document has no effect.
|
|
94
|
+
* @returns Nothing, or a promise that resolves when the buffer has been removed.
|
|
95
|
+
*/
|
|
96
|
+
closeDocument(uri: string): void | Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* Analyzes a target against captured buffers and keeps each matching project's result.
|
|
99
|
+
*
|
|
100
|
+
* @param uri - Target document URI.
|
|
101
|
+
* @param signal - Optional cancellation signal. Services may discard results without interrupting
|
|
102
|
+
* compiler work that already started.
|
|
103
|
+
* @returns Results for matching projects, or an empty list when the URI is outside their scopes
|
|
104
|
+
* or uses a scheme that the service does not handle.
|
|
105
|
+
* @throws If the service is closed or its transport fails. Source failures may instead be returned
|
|
106
|
+
* as incomplete results.
|
|
107
|
+
*/
|
|
108
|
+
analyze(uri: string, signal?: AbortSignal): Promise<WorkspaceResult$1[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Releases analysis resources after pending work. Call before replacing a workspace service.
|
|
111
|
+
*
|
|
112
|
+
* @returns A promise that resolves after cleanup completes.
|
|
113
|
+
* @throws If cleanup fails.
|
|
114
|
+
*/
|
|
115
|
+
close(): Promise<void>;
|
|
116
|
+
}
|
|
117
|
+
/** Keeps the project identity and source fingerprint of an editor answer. */
|
|
118
|
+
interface WorkspaceEditorResult {
|
|
119
|
+
/** Zero-based project index in the evaluated configuration. */
|
|
120
|
+
project: number;
|
|
121
|
+
/** Configuration identity used to distinguish overlapping project answers. */
|
|
122
|
+
config: string;
|
|
123
|
+
/** Data computed from an immutable source and design-system snapshot. */
|
|
124
|
+
result: EditorResult;
|
|
125
|
+
}
|
|
126
|
+
/** Initialization context without assumptions about filesystem paths or process state. */
|
|
127
|
+
interface AnalysisWorkspaceContext {
|
|
128
|
+
/** Workspace directory URIs supplied by LSP initialization or the embedding application. */
|
|
129
|
+
workspaceFolders: readonly string[];
|
|
130
|
+
/** Embedding-specific files or settings supplied with the LSP initialize request. */
|
|
131
|
+
initializationOptions?: unknown;
|
|
132
|
+
}
|
|
133
|
+
/** Opened services and initialization errors, retained independently for each workspace. */
|
|
134
|
+
interface OpenAnalysisWorkspaces {
|
|
135
|
+
/** Owned services keyed by configuration identity. The consumer closes them before reopening. */
|
|
136
|
+
workspaces: ReadonlyMap<string, AnalysisWorkspaceService>;
|
|
137
|
+
/** Initialization failure messages keyed by workspace or configuration identity. */
|
|
138
|
+
errors?: ReadonlyMap<string, string>;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Creates fresh services after the language server closes its previous services.
|
|
142
|
+
*
|
|
143
|
+
* @param context - Current workspace directory URIs, possibly empty.
|
|
144
|
+
* @returns Independently opened services and any initialization errors. Successful services remain
|
|
145
|
+
* usable when another workspace cannot be opened.
|
|
146
|
+
*/
|
|
147
|
+
type OpenWorkspaces = (context: AnalysisWorkspaceContext) => Promise<OpenAnalysisWorkspaces>;
|
|
148
|
+
export { OpenAnalysisWorkspaces as a, WorkspaceResult$1 as c, AnalysisWorkspaceService as i, AnalysisResult as n, OpenWorkspaces as o, AnalysisWorkspaceContext as r, WorkspaceEditorResult as s, AnalysisDependency as t };
|
|
149
|
+
//# sourceMappingURL=workspace-BF46yPpm.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stillwind/analysis",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Analysis services for Stillwind tools",
|
|
5
|
+
"homepage": "https://stillwind.dev/",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/SegaraRai/stillwind/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/SegaraRai/stillwind.git",
|
|
13
|
+
"directory": "packages/analysis"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./browser": {
|
|
25
|
+
"types": "./dist/browser.d.ts",
|
|
26
|
+
"default": "./dist/browser.js"
|
|
27
|
+
},
|
|
28
|
+
"./memory": {
|
|
29
|
+
"types": "./dist/memory.d.ts",
|
|
30
|
+
"default": "./dist/memory.js"
|
|
31
|
+
},
|
|
32
|
+
"./node": {
|
|
33
|
+
"types": "./dist/node.d.ts",
|
|
34
|
+
"default": "./dist/node.js"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@stillwind/config": "0.1.0",
|
|
43
|
+
"@stillwind/host": "0.1.0",
|
|
44
|
+
"@stillwind/native": "0.1.0",
|
|
45
|
+
"minimatch": "^10.2.6",
|
|
46
|
+
"pathe": "^2.0.3"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@stillwind-internal/tools-workspace": "0.0.0",
|
|
50
|
+
"@types/node": "^26.6.5",
|
|
51
|
+
"typescript": "^6.0.3",
|
|
52
|
+
"vite-plus": "1.4.0"
|
|
53
|
+
}
|
|
6
54
|
}
|