@stillwind/analysis 0.10.1 → 0.12.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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @stillwind/analysis
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 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`.
8
+
9
+ - 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.
10
+
11
+ - 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`.
12
+
13
+ - 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.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies:
18
+ - @stillwind/config@0.12.0
19
+ - @stillwind/host@0.12.0
20
+ - @stillwind/native@0.12.0
21
+
22
+ ## 0.11.0
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies:
27
+ - @stillwind/config@0.11.0
28
+ - @stillwind/host@0.11.0
29
+ - @stillwind/native@0.11.0
30
+
3
31
  ## 0.10.1
4
32
 
5
33
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { t as documentationSection, n as documentationUrl, r as lintReports } from "./reports-DvHppcFa.js";
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
- /** Original buffer and ranges excluded by a formatter adapter. Paths are absolute. */
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
- /** Replacement text and independent project findings for one original buffer. */
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
- /** A target that could not be read, rewritten, or saved. */
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;
@@ -46,30 +53,38 @@ interface RewriteOptions {
46
53
  /** Additional globs relative to each project root. Omission or an empty list retains all configured targets. */
47
54
  patterns?: string[];
48
55
  }
49
- /** Sorting results whose changed paths compare original and final source bytes. */
50
- interface FormatResult {
56
+ /**
57
+ * Combined lint and formatting check results for one configuration.
58
+ */
59
+ interface CheckResult {
51
60
  /** Absolute path of the evaluated configuration. */
52
61
  config: string;
53
- /** Absolute paths that changed or would change, in sorted order. */
62
+ /** Absolute paths that changed when fix is true, or need sorting when fix is false. */
54
63
  changed: string[];
55
- /** Findings from the original sources, in configured project and target order. */
64
+ /** Findings from original sources without fix, or from final sorted sources with fix. */
56
65
  results: WorkspaceResult[];
57
66
  /** Targets that could not be read, rewritten, or saved. */
58
67
  failures: RewriteFileFailure[];
59
- /** Failures return 2. Check mode otherwise returns 1 when any file would change. */
68
+ /**
69
+ * - 0: no failures, no errors, and no unformatted files when fix is false
70
+ * - 1: compiler errors, denied lint, or unformatted files when fix is false
71
+ * - 2: incomplete execution or target failures
72
+ */
60
73
  exitCode: 0 | 1 | 2;
61
74
  }
62
75
  /**
63
- * Sorts configured targets and saves changed files unless check is true.
76
+ * Runs lint and utility sorting in one worker pass. Without fix, checks formatting and reports
77
+ * findings without saving. With fix, applies converged automatic fixes and utility sorting, saves
78
+ * changed files, and reports findings for the final sources.
64
79
  *
65
- * @param options - Configuration discovery, target filters, and optional check mode.
66
- * @returns Changed paths, original findings, and failures. Healthy targets continue after a failure.
80
+ * @param options - Configuration discovery, target filters, and optional fix mode.
81
+ * @returns Changed paths, findings, failures, and exit code. Healthy targets continue after a failure.
67
82
  * @throws If selection, configuration, worker communication, or cleanup fails.
68
83
  */
69
- export declare function format(options?: RewriteOptions & {
70
- /** Whether to report changes without saving them. Defaults to false. */
71
- check?: boolean;
72
- }): Promise<FormatResult>;
84
+ export declare function check(options?: RewriteOptions & {
85
+ /** Applies converged automatic fixes and utility sorting, and saves changed files. */
86
+ fix?: boolean;
87
+ }): Promise<CheckResult>;
73
88
  /**
74
89
  * Design-system answers from every project of one configuration.
75
90
  */
@@ -98,6 +113,78 @@ interface DesignSystemAnswer {
98
113
  * @throws If configuration discovery, worker initialization, CSS loading, a plugin, or cleanup fails.
99
114
  */
100
115
  export declare function designSystem(options: Omit<RewriteOptions, "patterns">, request: DesignSystemRequest): Promise<DesignSystemAnswer>;
116
+ /** Sorting results whose changed paths compare original and final source bytes. */
117
+ interface FormatResult {
118
+ /** Absolute path of the evaluated configuration. */
119
+ config: string;
120
+ /** Absolute paths that changed or would change, in sorted order. */
121
+ changed: string[];
122
+ /** Findings from the original sources, in configured project and target order. */
123
+ results: WorkspaceResult[];
124
+ /** Targets that could not be read, rewritten, or saved. */
125
+ failures: RewriteFileFailure[];
126
+ /** Failures return 2. Check mode otherwise returns 1 when any file would change. */
127
+ exitCode: 0 | 1 | 2;
128
+ }
129
+ /**
130
+ * Sorts configured targets and saves changed files unless check is true.
131
+ *
132
+ * @param options - Configuration discovery, target filters, and optional check mode.
133
+ * @returns Changed paths, original findings, and failures. Healthy targets continue after a failure.
134
+ * @throws If selection, configuration, worker communication, or cleanup fails.
135
+ */
136
+ export declare function format(options?: RewriteOptions & {
137
+ /** Whether to report changes without saving them. Defaults to false. */
138
+ check?: boolean;
139
+ }): Promise<FormatResult>;
140
+ /** Effective setting of an active lint rule. */
141
+ type ActiveLintRule = Exclude<LintSeverity, "off"> | (Record<string, unknown> & {
142
+ /** Active severity after preset composition and rule overrides. */
143
+ severity: Exclude<LintSeverity, "off">;
144
+ });
145
+ /** Resolved configuration summary for one project in a configuration file. */
146
+ interface ProjectInfo {
147
+ /** Zero-based project index in the evaluated configuration. */
148
+ project: number;
149
+ /** Optional configured project name. */
150
+ name?: string;
151
+ /** Absolute project root directory. */
152
+ root: string;
153
+ /** Absolute path of the configured stylesheet entry. */
154
+ css: string;
155
+ /** Configured target globs relative to root. */
156
+ files: string[];
157
+ /** Configured exclude globs relative to root. */
158
+ exclude: string[];
159
+ /** Number of source files currently matching the project's scope. */
160
+ matchedFiles: number;
161
+ /** Names of configured Stillwind plugins. */
162
+ plugins: string[];
163
+ /** Names of configured project analysis hooks. */
164
+ hooks: string[];
165
+ /** Whether utility sorting is enabled. */
166
+ sort: boolean;
167
+ /** Whether TypeScript type facts are enabled. */
168
+ typeFacts: boolean;
169
+ /** Active lint rules (excluding rules set to `off`), in rule-name order. */
170
+ lint: Record<string, ActiveLintRule>;
171
+ }
172
+ /** Resolved project configurations for one configuration file. */
173
+ interface InfoResult {
174
+ /** Absolute path of the evaluated configuration. */
175
+ config: string;
176
+ /** Resolved projects in configuration order. */
177
+ projects: ProjectInfo[];
178
+ }
179
+ /**
180
+ * Resolves the configuration and returns each project's effective scope, plugins, and active lint
181
+ * rules in a child process without compiling source files.
182
+ *
183
+ * @param options - Configuration discovery. Target globs do not apply.
184
+ * @returns Configuration path and resolved project metadata.
185
+ * @throws If configuration discovery, evaluation, worker initialization, or cleanup fails.
186
+ */
187
+ export declare function info(options?: Omit<RewriteOptions, "patterns">): Promise<InfoResult>;
101
188
  /**
102
189
  * Selects generated CSS by file, line, or position.
103
190
  */
@@ -152,6 +239,8 @@ interface InspectFailure {
152
239
  /** Reason for the failure. */
153
240
  message: string;
154
241
  }
242
+ /** Reason why `inspect` returned no previews when no execution failures occurred. */
243
+ type InspectEmptyReason = "no-styles" | "line-out-of-range" | "column-out-of-range" | "no-match-at-position";
155
244
  /**
156
245
  * Inspection results with analysis outcomes retained for each project.
157
246
  */
@@ -162,6 +251,8 @@ interface InspectResult {
162
251
  results: WorkspaceResult[];
163
252
  /** Selected previews in file, project, and source order, without repeated ranges. */
164
253
  previews: InspectPreview[];
254
+ /** Explains why `previews` is empty when `failures` is also empty. */
255
+ emptyReason?: InspectEmptyReason;
165
256
  /** Targets that could not be read. */
166
257
  failures: InspectFailure[];
167
258
  }
@@ -277,5 +368,5 @@ export declare class SourceFormatter {
277
368
  * @returns The absolute configuration path, or undefined when discovery finds none.
278
369
  */
279
370
  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 };
371
+ 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
372
  //# sourceMappingURL=node.d.ts.map
package/dist/node.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as RewriteFailure } from "./rewrite-Bdo2ssmD.js";
2
- import { r as lintReports } from "./reports-DvHppcFa.js";
1
+ import { t as RewriteFailure } from "./rewrite-daiEBUgj.js";
2
+ import { r as lintReports } from "./reports-Bu0OQg-C.js";
3
3
  import { readFile, writeFile } from "node:fs/promises";
4
4
  import path from "node:path";
5
5
  import { findConfiguration, findDocumentConfiguration } from "@stillwind/config/node";
@@ -8,7 +8,9 @@ import process$1 from "node:process";
8
8
  import { fileURLToPath, pathToFileURL } from "node:url";
9
9
  import { isStylesheet } from "@stillwind/host";
10
10
  // src/worker-client.ts
11
- /** Isolates configuration and plugin logs from CLI JSON and the LSP stdout transport. */
11
+ /**
12
+ * Isolates configuration and plugin logs from CLI JSON and the LSP stdout transport.
13
+ */
12
14
  var AnalysisWorker = class {
13
15
  /** Owned child with IPC enabled. Both output streams are forwarded to the parent's stderr. */
14
16
  #child;
@@ -151,11 +153,12 @@ var AnalysisWorker = class {
151
153
  * @returns Successful replacements and target failures in input order. Captured buffers are removed after planning.
152
154
  * @throws If workspace setup, buffer installation, cleanup, or transport fails.
153
155
  */
154
- rewrite(inputs, operation) {
156
+ rewrite(inputs, operation, hooks) {
155
157
  return this.request({
156
158
  method: "rewrite",
157
159
  inputs,
158
- operation
160
+ operation,
161
+ hooks
159
162
  });
160
163
  }
161
164
  /**
@@ -215,13 +218,13 @@ async function writeChangedFiles(changes) {
215
218
  * Computes all replacements before optionally saving changed files. Fixes return final findings.
216
219
  *
217
220
  * @param options - Configuration discovery and optional filters within configured target scopes.
218
- * @param operation - Utility sorting or converged lint fixes.
221
+ * @param operation - Utility sorting, converged lint fixes, or converged lint fixes followed by sorting.
219
222
  * @param write - Whether to verify and save changed bytes after every replacement is planned.
220
223
  * @returns Configuration, sorted changed paths, findings, and independent target failures.
221
224
  * Saving reports only paths whose writes succeeded. Check mode reports planned changes.
222
225
  * @throws If selection is empty, configuration, worker communication, or cleanup fails.
223
226
  */
224
- async function rewriteFiles(options, operation, write) {
227
+ async function rewriteFiles(options, operation, write, hooks) {
225
228
  const config = resolveRewriteConfig(options);
226
229
  const worker = new AnalysisWorker();
227
230
  try {
@@ -251,7 +254,7 @@ async function rewriteFiles(options, operation, write) {
251
254
  });
252
255
  }
253
256
  }
254
- const batch = await worker.rewrite(inputs, operation);
257
+ const batch = await worker.rewrite(inputs, operation, hooks);
255
258
  failures.push(...batch.failures);
256
259
  const changes = batch.outputs.map((output) => ({
257
260
  file: output.file,
@@ -290,19 +293,25 @@ function resolveRewriteConfig(options) {
290
293
  if (!config) throw new Error(`Cannot find Stillwind configuration above ${cwd}`);
291
294
  return config;
292
295
  }
293
- // src/format.ts
296
+ // src/check.ts
294
297
  /**
295
- * Sorts configured targets and saves changed files unless check is true.
298
+ * Runs lint and utility sorting in one worker pass. Without fix, checks formatting and reports
299
+ * findings without saving. With fix, applies converged automatic fixes and utility sorting, saves
300
+ * changed files, and reports findings for the final sources.
296
301
  *
297
- * @param options - Configuration discovery, target filters, and optional check mode.
298
- * @returns Changed paths, original findings, and failures. Healthy targets continue after a failure.
302
+ * @param options - Configuration discovery, target filters, and optional fix mode.
303
+ * @returns Changed paths, findings, failures, and exit code. Healthy targets continue after a failure.
299
304
  * @throws If selection, configuration, worker communication, or cleanup fails.
300
305
  */
301
- async function format(options = {}) {
302
- const result = await rewriteFiles(options, "sort", !options.check);
306
+ async function check(options = {}) {
307
+ const result = await rewriteFiles(options, options.fix ? "fixes-and-sort" : "sort", !!options.fix, {
308
+ command: "check",
309
+ mode: options.fix ? "write" : "check"
310
+ });
311
+ const hasErrors = result.results.some(({ result: entry }) => entry.reports.some((report) => report.severity === "error"));
303
312
  return {
304
313
  ...result,
305
- exitCode: result.failures.length ? 2 : options.check && result.changed.length ? 1 : 0
314
+ exitCode: result.failures.length ? 2 : hasErrors || !options.fix && result.changed.length ? 1 : 0
306
315
  };
307
316
  }
308
317
  // src/design-system.ts
@@ -339,6 +348,46 @@ async function designSystem(options, request) {
339
348
  await worker.close();
340
349
  }
341
350
  }
351
+ // src/format.ts
352
+ /**
353
+ * Sorts configured targets and saves changed files unless check is true.
354
+ *
355
+ * @param options - Configuration discovery, target filters, and optional check mode.
356
+ * @returns Changed paths, original findings, and failures. Healthy targets continue after a failure.
357
+ * @throws If selection, configuration, worker communication, or cleanup fails.
358
+ */
359
+ async function format(options = {}) {
360
+ const result = await rewriteFiles(options, "sort", !options.check, {
361
+ command: "fmt",
362
+ mode: options.check ? "check" : "write"
363
+ });
364
+ return {
365
+ ...result,
366
+ exitCode: result.failures.length ? 2 : options.check && result.changed.length ? 1 : 0
367
+ };
368
+ }
369
+ // src/info.ts
370
+ /**
371
+ * Resolves the configuration and returns each project's effective scope, plugins, and active lint
372
+ * rules in a child process without compiling source files.
373
+ *
374
+ * @param options - Configuration discovery. Target globs do not apply.
375
+ * @returns Configuration path and resolved project metadata.
376
+ * @throws If configuration discovery, evaluation, worker initialization, or cleanup fails.
377
+ */
378
+ async function info(options = {}) {
379
+ const config = resolveRewriteConfig(options);
380
+ const worker = new AnalysisWorker();
381
+ try {
382
+ await worker.open(config);
383
+ return {
384
+ config,
385
+ projects: await worker.request({ method: "info" })
386
+ };
387
+ } finally {
388
+ await worker.close();
389
+ }
390
+ }
342
391
  // src/inspect.ts
343
392
  /**
344
393
  * Parses a command-line target with an optional `:line` or `:line:column` suffix.
@@ -409,9 +458,15 @@ async function selectPreviews(worker, file, source, target, reports) {
409
458
  const line = target.line === void 0 ? void 0 : target.line - 1;
410
459
  const lineStart = line === void 0 ? void 0 : lines[line];
411
460
  const lineEnd = line === void 0 ? void 0 : (lines[line + 1] ?? source.length + 1) - 1;
412
- if (line !== void 0 && lineStart === void 0) return [];
461
+ if (line !== void 0 && lineStart === void 0) return {
462
+ previews: [],
463
+ emptyReason: "line-out-of-range"
464
+ };
413
465
  const offset = target.column === void 0 ? void 0 : lineStart + target.column - 1;
414
- if (offset !== void 0 && offset > lineEnd) return [];
466
+ if (offset !== void 0 && offset > lineEnd) return {
467
+ previews: [],
468
+ emptyReason: "column-out-of-range"
469
+ };
415
470
  const query = (request) => worker.request({
416
471
  method: "query",
417
472
  file,
@@ -419,11 +474,15 @@ async function selectPreviews(worker, file, source, target, reports) {
419
474
  });
420
475
  const uri = pathToFileURL(file).href;
421
476
  let selected;
422
- if (offset === void 0) selected = (await query({ kind: "previews" })).flatMap(({ project, result }) => (result.previews ?? []).filter(({ start, end }) => line === void 0 || end > lineStart && start <= lineEnd).map((range) => ({
423
- project,
424
- range
425
- })));
426
- else {
477
+ let fileHasPreviews = false;
478
+ if (offset === void 0) {
479
+ const all = await query({ kind: "previews" });
480
+ fileHasPreviews = all.some(({ result }) => (result.previews?.length ?? 0) > 0);
481
+ selected = all.flatMap(({ project, result }) => (result.previews ?? []).filter(({ start, end }) => line === void 0 || end > lineStart && start <= lineEnd).map((range) => ({
482
+ project,
483
+ range
484
+ })));
485
+ } else {
427
486
  const hovers = await query({
428
487
  kind: "hover",
429
488
  offset
@@ -434,13 +493,15 @@ async function selectPreviews(worker, file, source, target, reports) {
434
493
  }] : []);
435
494
  if (selected.length < hovers.length) {
436
495
  const answered = new Set(selected.map(({ project }) => project));
437
- selected.push(...(await query({ kind: "previews" })).flatMap(({ project, result }) => answered.has(project) ? [] : (result.previews ?? []).filter(({ start, end }) => start <= offset && offset <= end).map((range) => ({
496
+ const all = await query({ kind: "previews" });
497
+ fileHasPreviews = all.some(({ result }) => (result.previews?.length ?? 0) > 0);
498
+ selected.push(...all.flatMap(({ project, result }) => answered.has(project) ? [] : (result.previews ?? []).filter(({ start, end }) => start <= offset && offset <= end).map((range) => ({
438
499
  project,
439
500
  range
440
501
  }))));
441
502
  }
442
503
  }
443
- return selected.flatMap(({ project, range: { start, end, css, valid = true, documentation, runtimeNames } }) => {
504
+ const previews = selected.flatMap(({ project, range: { start, end, css, valid = true, documentation, runtimeNames } }) => {
444
505
  const diagnostics = reports.filter(({ project: owner, report: { primary } }) => owner === project && primary.location.startUtf16 < end && start < Math.max(primary.location.endUtf16, primary.location.startUtf16 + 1)).map(({ report: { severity, code, message } }) => ({
445
506
  severity,
446
507
  code,
@@ -466,6 +527,11 @@ async function selectPreviews(worker, file, source, target, reports) {
466
527
  ...runtimeNames ? { runtimeNames } : {}
467
528
  }];
468
529
  });
530
+ if (!previews.length) return {
531
+ previews,
532
+ emptyReason: line !== void 0 && fileHasPreviews ? "no-match-at-position" : "no-styles"
533
+ };
534
+ return { previews };
469
535
  }
470
536
  /**
471
537
  * Reports the generated CSS of configured source files in a child process.
@@ -499,6 +565,7 @@ async function inspect(options = {}) {
499
565
  previews: [],
500
566
  failures: []
501
567
  };
568
+ const emptyReasons = /* @__PURE__ */ new Set();
502
569
  for (const file of files) {
503
570
  const analyses = await worker.analyze(file);
504
571
  result.results.push(...analyses);
@@ -518,22 +585,27 @@ async function inspect(options = {}) {
518
585
  const reports = lintReports(analyses).filter(({ report }) => report.primary.scope === "range" && isDocument(report.primary.location.uri, file));
519
586
  const seen = /* @__PURE__ */ new Set();
520
587
  const previews = [];
521
- for (const target of selections.get(file)) for (const preview of await selectPreviews(worker, file, source, target, reports)) {
522
- const { startLine, startColumn, endLine, endColumn } = preview.location;
523
- const key = [
524
- preview.project,
525
- startLine,
526
- startColumn,
527
- endLine,
528
- endColumn
529
- ].join();
530
- if (complete.has(preview.project) && !seen.has(key)) {
531
- seen.add(key);
532
- previews.push(preview);
588
+ for (const target of selections.get(file)) {
589
+ const selection = await selectPreviews(worker, file, source, target, reports);
590
+ if (selection.emptyReason) emptyReasons.add(selection.emptyReason);
591
+ for (const preview of selection.previews) {
592
+ const { startLine, startColumn, endLine, endColumn } = preview.location;
593
+ const key = [
594
+ preview.project,
595
+ startLine,
596
+ startColumn,
597
+ endLine,
598
+ endColumn
599
+ ].join();
600
+ if (complete.has(preview.project) && !seen.has(key)) {
601
+ seen.add(key);
602
+ previews.push(preview);
603
+ }
533
604
  }
534
605
  }
535
606
  result.previews.push(...previews.sort((a, b) => a.project - b.project || a.location.startLine - b.location.startLine || a.location.startColumn - b.location.startColumn));
536
607
  }
608
+ if (!result.previews.length && !result.failures.length) result.emptyReason = emptyReasons.has("no-match-at-position") ? "no-match-at-position" : emptyReasons.has("column-out-of-range") ? "column-out-of-range" : emptyReasons.has("line-out-of-range") ? "line-out-of-range" : "no-styles";
537
609
  return result;
538
610
  } finally {
539
611
  await worker.close();
@@ -796,6 +868,6 @@ function findFormatterConfig(file, config) {
796
868
  if (config) return path.resolve(config);
797
869
  return findConfiguration(path.dirname(path.resolve(file)));
798
870
  }
799
- export { SourceFormatter, designSystem, discoverNodeWorkspace, findFormatterConfig, format, formatLint, inspect, lint, lintReports, openNodeWorkspaces };
871
+ export { SourceFormatter, check, designSystem, discoverNodeWorkspace, findFormatterConfig, format, formatLint, info, inspect, lint, lintReports, openNodeWorkspaces };
800
872
 
801
873
  //# sourceMappingURL=node.js.map