@stillwind/analysis 0.11.0 → 0.13.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/CHANGELOG.md +32 -0
- package/dist/index.js +1 -1
- package/dist/node.d.ts +116 -18
- package/dist/node.js +290 -53
- package/dist/node.js.map +1 -1
- package/dist/{reports-DvHppcFa.js → reports-Bu0OQg-C.js} +3 -2
- package/dist/reports-Bu0OQg-C.js.map +1 -0
- package/dist/{rewrite-Bdo2ssmD.js → rewrite-daiEBUgj.js} +94 -16
- package/dist/rewrite-daiEBUgj.js.map +1 -0
- package/dist/worker.js +237 -5
- package/dist/worker.js.map +1 -1
- package/package.json +5 -5
- package/dist/reports-DvHppcFa.js.map +0 -1
- package/dist/rewrite-Bdo2ssmD.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @stillwind/analysis
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- `stillwind lint`, `fmt`, and `check` now analyze the projects of a configuration in parallel worker processes, so a configuration that lists several projects, such as a monorepo root, finishes sooner. Projects that share a target file are still analyzed together in one process. `lint`, `format`, and `check` in `@stillwind/analysis` accept a `concurrency` option that sets the maximum number of worker processes. By default, the maximum is half of the available parallelism.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @stillwind/config@0.13.0
|
|
13
|
+
- @stillwind/host@0.13.0
|
|
14
|
+
- @stillwind/native@0.13.0
|
|
15
|
+
|
|
16
|
+
## 0.12.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- Added `stillwind check` and `stillwind check --fix` to run lint checks and utility sorting in a single analysis pass. `stillwind check` reports lint findings and files that need sorting without saving, and exits with `1` when errors or unsorted files remain. `stillwind check --fix` applies converged automatic fixes and utility sorting, saves changed files, and reports findings for the final sources. `@stillwind/analysis/node` exports the corresponding `check()` function, and `stillwind`'s agent instructions now recommend `stillwind check --fix`.
|
|
21
|
+
|
|
22
|
+
- Added `stillwind info` (and `info()` in `@stillwind/analysis/node`) to report each project's resolved root, stylesheet path, target and exclude globs, matched file count, registered plugins, sorting and `typeFacts` settings, and active lint rules in text or JSON format without compiling source files.
|
|
23
|
+
|
|
24
|
+
- Diagnostic actions in CLI output now distinguish automatic fixes from manual suggestions (`actions[].autofix`, `summary.autofixable`, and `(autofix)` / `(suggestion)` labels in text output), and the `--fix` hint is shown only when automatic fixes are available. `stillwind inspect` now explains why no previews were returned (`emptyReason`: `no-styles`, `line-out-of-range`, `column-out-of-range`, or `no-match-at-position`). Uncompiled runtime placeholder errors for every `style.*` macro now include guidance on build integration ordering and `docs/integrations.md`.
|
|
25
|
+
|
|
26
|
+
- Added project-scoped `hooks` (`defineHook` and `AnalysisHook` from `stillwind/config` and `@stillwind/config`) for in-memory formatting in `stillwind fmt` and `stillwind check`. Hooks support `setup`, `teardown`, and per-file `format` callbacks so formatters such as Oxfmt run after Stillwind utility sorting in one pass, including `--check`. `stillwind info` now also lists configured hook names.
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies:
|
|
31
|
+
- @stillwind/config@0.12.0
|
|
32
|
+
- @stillwind/host@0.12.0
|
|
33
|
+
- @stillwind/native@0.12.0
|
|
34
|
+
|
|
3
35
|
## 0.11.0
|
|
4
36
|
|
|
5
37
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as documentationSection, n as documentationUrl, r as lintReports } from "./reports-
|
|
1
|
+
export { t as documentationSection, n as documentationUrl, r as lintReports } from "./reports-Bu0OQg-C.js";
|
package/dist/node.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { o as OpenAnalysisWorkspaces, r as AnalysisWorkspaceContext } from "./workspace-DIADkpZF.js";
|
|
2
2
|
import { r as lintReports } from "./reports-Dy2Qrbj_.js";
|
|
3
|
+
import { LintSeverity } from "@stillwind/config";
|
|
3
4
|
import { AnalysisWorkspace, DesignCandidate, DesignSystemRequest, DesignToken, EditorEdit, WorkspaceResult } from "@stillwind/host";
|
|
4
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Original buffer and ranges excluded by a formatter adapter. Paths are absolute.
|
|
7
|
+
*/
|
|
5
8
|
interface RewriteInput {
|
|
6
9
|
/** Absolute target path used for workspace membership and dependency resolution. */
|
|
7
10
|
file: string;
|
|
@@ -15,7 +18,9 @@ interface RewriteInput {
|
|
|
15
18
|
end: number;
|
|
16
19
|
}[];
|
|
17
20
|
}
|
|
18
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Replacement text and independent project findings for one original buffer.
|
|
23
|
+
*/
|
|
19
24
|
interface RewriteResult {
|
|
20
25
|
/** Absolute path copied from the corresponding input. */
|
|
21
26
|
file: string;
|
|
@@ -26,7 +31,9 @@ interface RewriteResult {
|
|
|
26
31
|
/** Findings for the analyzed input of the final pass, in project order. */
|
|
27
32
|
results: WorkspaceResult[];
|
|
28
33
|
}
|
|
29
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* A target that could not be read, rewritten, or saved.
|
|
36
|
+
*/
|
|
30
37
|
interface RewriteFileFailure {
|
|
31
38
|
/** Absolute path of the failed target. */
|
|
32
39
|
file: string;
|
|
@@ -45,31 +52,44 @@ interface RewriteOptions {
|
|
|
45
52
|
cwd?: string;
|
|
46
53
|
/** Additional globs relative to each project root. Omission or an empty list retains all configured targets. */
|
|
47
54
|
patterns?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Maximum number of analysis worker processes. Omission selects half of the available
|
|
57
|
+
* parallelism. Projects that share a target are analyzed in the same process.
|
|
58
|
+
*/
|
|
59
|
+
concurrency?: number;
|
|
48
60
|
}
|
|
49
|
-
/**
|
|
50
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Combined lint and formatting check results for one configuration.
|
|
63
|
+
*/
|
|
64
|
+
interface CheckResult {
|
|
51
65
|
/** Absolute path of the evaluated configuration. */
|
|
52
66
|
config: string;
|
|
53
|
-
/** Absolute paths that changed
|
|
67
|
+
/** Absolute paths that changed when fix is true, or need sorting when fix is false. */
|
|
54
68
|
changed: string[];
|
|
55
|
-
/** Findings from
|
|
69
|
+
/** Findings from original sources without fix, or from final sorted sources with fix. */
|
|
56
70
|
results: WorkspaceResult[];
|
|
57
71
|
/** Targets that could not be read, rewritten, or saved. */
|
|
58
72
|
failures: RewriteFileFailure[];
|
|
59
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* - 0: no failures, no errors, and no unformatted files when fix is false
|
|
75
|
+
* - 1: compiler errors, denied lint, or unformatted files when fix is false
|
|
76
|
+
* - 2: incomplete execution or target failures
|
|
77
|
+
*/
|
|
60
78
|
exitCode: 0 | 1 | 2;
|
|
61
79
|
}
|
|
62
80
|
/**
|
|
63
|
-
*
|
|
81
|
+
* Runs lint and utility sorting in one worker pass. Without fix, checks formatting and reports
|
|
82
|
+
* findings without saving. With fix, applies converged automatic fixes and utility sorting, saves
|
|
83
|
+
* changed files, and reports findings for the final sources.
|
|
64
84
|
*
|
|
65
|
-
* @param options - Configuration discovery, target filters, and optional
|
|
66
|
-
* @returns Changed paths,
|
|
85
|
+
* @param options - Configuration discovery, target filters, and optional fix mode.
|
|
86
|
+
* @returns Changed paths, findings, failures, and exit code. Healthy targets continue after a failure.
|
|
67
87
|
* @throws If selection, configuration, worker communication, or cleanup fails.
|
|
68
88
|
*/
|
|
69
|
-
export declare function
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
}): Promise<
|
|
89
|
+
export declare function check(options?: RewriteOptions & {
|
|
90
|
+
/** Applies converged automatic fixes and utility sorting, and saves changed files. */
|
|
91
|
+
fix?: boolean;
|
|
92
|
+
}): Promise<CheckResult>;
|
|
73
93
|
/**
|
|
74
94
|
* Design-system answers from every project of one configuration.
|
|
75
95
|
*/
|
|
@@ -98,6 +118,78 @@ interface DesignSystemAnswer {
|
|
|
98
118
|
* @throws If configuration discovery, worker initialization, CSS loading, a plugin, or cleanup fails.
|
|
99
119
|
*/
|
|
100
120
|
export declare function designSystem(options: Omit<RewriteOptions, "patterns">, request: DesignSystemRequest): Promise<DesignSystemAnswer>;
|
|
121
|
+
/** Sorting results whose changed paths compare original and final source bytes. */
|
|
122
|
+
interface FormatResult {
|
|
123
|
+
/** Absolute path of the evaluated configuration. */
|
|
124
|
+
config: string;
|
|
125
|
+
/** Absolute paths that changed or would change, in sorted order. */
|
|
126
|
+
changed: string[];
|
|
127
|
+
/** Findings from the original sources, in configured project and target order. */
|
|
128
|
+
results: WorkspaceResult[];
|
|
129
|
+
/** Targets that could not be read, rewritten, or saved. */
|
|
130
|
+
failures: RewriteFileFailure[];
|
|
131
|
+
/** Failures return 2. Check mode otherwise returns 1 when any file would change. */
|
|
132
|
+
exitCode: 0 | 1 | 2;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Sorts configured targets and saves changed files unless check is true.
|
|
136
|
+
*
|
|
137
|
+
* @param options - Configuration discovery, target filters, and optional check mode.
|
|
138
|
+
* @returns Changed paths, original findings, and failures. Healthy targets continue after a failure.
|
|
139
|
+
* @throws If selection, configuration, worker communication, or cleanup fails.
|
|
140
|
+
*/
|
|
141
|
+
export declare function format(options?: RewriteOptions & {
|
|
142
|
+
/** Whether to report changes without saving them. Defaults to false. */
|
|
143
|
+
check?: boolean;
|
|
144
|
+
}): Promise<FormatResult>;
|
|
145
|
+
/** Effective setting of an active lint rule. */
|
|
146
|
+
type ActiveLintRule = Exclude<LintSeverity, "off"> | (Record<string, unknown> & {
|
|
147
|
+
/** Active severity after preset composition and rule overrides. */
|
|
148
|
+
severity: Exclude<LintSeverity, "off">;
|
|
149
|
+
});
|
|
150
|
+
/** Resolved configuration summary for one project in a configuration file. */
|
|
151
|
+
interface ProjectInfo {
|
|
152
|
+
/** Zero-based project index in the evaluated configuration. */
|
|
153
|
+
project: number;
|
|
154
|
+
/** Optional configured project name. */
|
|
155
|
+
name?: string;
|
|
156
|
+
/** Absolute project root directory. */
|
|
157
|
+
root: string;
|
|
158
|
+
/** Absolute path of the configured stylesheet entry. */
|
|
159
|
+
css: string;
|
|
160
|
+
/** Configured target globs relative to root. */
|
|
161
|
+
files: string[];
|
|
162
|
+
/** Configured exclude globs relative to root. */
|
|
163
|
+
exclude: string[];
|
|
164
|
+
/** Number of source files currently matching the project's scope. */
|
|
165
|
+
matchedFiles: number;
|
|
166
|
+
/** Names of configured Stillwind plugins. */
|
|
167
|
+
plugins: string[];
|
|
168
|
+
/** Names of configured project analysis hooks. */
|
|
169
|
+
hooks: string[];
|
|
170
|
+
/** Whether utility sorting is enabled. */
|
|
171
|
+
sort: boolean;
|
|
172
|
+
/** Whether TypeScript type facts are enabled. */
|
|
173
|
+
typeFacts: boolean;
|
|
174
|
+
/** Active lint rules (excluding rules set to `off`), in rule-name order. */
|
|
175
|
+
lint: Record<string, ActiveLintRule>;
|
|
176
|
+
}
|
|
177
|
+
/** Resolved project configurations for one configuration file. */
|
|
178
|
+
interface InfoResult {
|
|
179
|
+
/** Absolute path of the evaluated configuration. */
|
|
180
|
+
config: string;
|
|
181
|
+
/** Resolved projects in configuration order. */
|
|
182
|
+
projects: ProjectInfo[];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Resolves the configuration and returns each project's effective scope, plugins, and active lint
|
|
186
|
+
* rules in a child process without compiling source files.
|
|
187
|
+
*
|
|
188
|
+
* @param options - Configuration discovery. Target globs do not apply.
|
|
189
|
+
* @returns Configuration path and resolved project metadata.
|
|
190
|
+
* @throws If configuration discovery, evaluation, worker initialization, or cleanup fails.
|
|
191
|
+
*/
|
|
192
|
+
export declare function info(options?: Omit<RewriteOptions, "patterns">): Promise<InfoResult>;
|
|
101
193
|
/**
|
|
102
194
|
* Selects generated CSS by file, line, or position.
|
|
103
195
|
*/
|
|
@@ -152,6 +244,8 @@ interface InspectFailure {
|
|
|
152
244
|
/** Reason for the failure. */
|
|
153
245
|
message: string;
|
|
154
246
|
}
|
|
247
|
+
/** Reason why `inspect` returned no previews when no execution failures occurred. */
|
|
248
|
+
type InspectEmptyReason = "no-styles" | "line-out-of-range" | "column-out-of-range" | "no-match-at-position";
|
|
155
249
|
/**
|
|
156
250
|
* Inspection results with analysis outcomes retained for each project.
|
|
157
251
|
*/
|
|
@@ -162,6 +256,8 @@ interface InspectResult {
|
|
|
162
256
|
results: WorkspaceResult[];
|
|
163
257
|
/** Selected previews in file, project, and source order, without repeated ranges. */
|
|
164
258
|
previews: InspectPreview[];
|
|
259
|
+
/** Explains why `previews` is empty when `failures` is also empty. */
|
|
260
|
+
emptyReason?: InspectEmptyReason;
|
|
165
261
|
/** Targets that could not be read. */
|
|
166
262
|
failures: InspectFailure[];
|
|
167
263
|
}
|
|
@@ -196,12 +292,14 @@ interface LintResult {
|
|
|
196
292
|
exitCode: 0 | 1 | 2;
|
|
197
293
|
}
|
|
198
294
|
/**
|
|
199
|
-
* Analyzes configured target scopes in
|
|
295
|
+
* Analyzes configured target scopes in child processes and closes them before returning. Disjoint
|
|
296
|
+
* project groups are analyzed concurrently.
|
|
200
297
|
*
|
|
201
298
|
* @param options - Configuration discovery and optional target filters. Omission checks all
|
|
202
299
|
* configured targets from the process working directory.
|
|
203
300
|
* @returns Results and an exit code. Readonly lint returns code 2 for empty selection or incomplete analysis.
|
|
204
|
-
* @throws If configuration discovery, worker initialization, target enumeration, or cleanup fails
|
|
301
|
+
* @throws If configuration discovery, worker initialization, target enumeration, or cleanup fails,
|
|
302
|
+
* or if concurrency is invalid.
|
|
205
303
|
* Fix mode reports failures per target and continues with healthy targets. Empty selection throws.
|
|
206
304
|
*/
|
|
207
305
|
export declare function lint(options?: RewriteOptions & {
|
|
@@ -277,5 +375,5 @@ export declare class SourceFormatter {
|
|
|
277
375
|
* @returns The absolute configuration path, or undefined when discovery finds none.
|
|
278
376
|
*/
|
|
279
377
|
export declare function findFormatterConfig(file: string, config?: string): string | undefined;
|
|
280
|
-
export { type DesignSystemAnswer, type FormatResult, type InspectFailure, type InspectPreview, type InspectResult, type InspectTarget, type LintResult, type RewriteFileFailure, type RewriteInput, type RewriteOptions, type RewriteResult, lintReports };
|
|
378
|
+
export { type ActiveLintRule, type CheckResult, type DesignSystemAnswer, type FormatResult, type InfoResult, type InspectEmptyReason, type InspectFailure, type InspectPreview, type InspectResult, type InspectTarget, type LintResult, type ProjectInfo, type RewriteFileFailure, type RewriteInput, type RewriteOptions, type RewriteResult, lintReports };
|
|
281
379
|
//# sourceMappingURL=node.d.ts.map
|