@stillwind/integration 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 CHANGED
@@ -1,5 +1,31 @@
1
1
  # @stillwind/integration
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Patch Changes
6
+
7
+ - The Vite integration no longer stops a build when an import that Stillwind reads for type facts does not resolve. For example, a Svelte component with `import type { HTMLAttributes } from "svelte/elements"` now builds without an alias, although `svelte/elements` exports that path only under the `types` condition.
8
+
9
+ - Vite development servers now load fonts, images, and other files that the stylesheet references from a directory whose name contains `@`, `+`, or `:`, such as a scoped package like `@fontsource-variable/geist`. Before this fix, the development CSS referred to these files by URLs that Vite did not serve, so the page received an HTML response instead of the file. Production builds were not affected.
10
+
11
+ - Updated dependencies:
12
+ - @stillwind/config@0.13.0
13
+ - @stillwind/host@0.13.0
14
+ - @stillwind/native@0.13.0
15
+ - stillwind@0.13.0
16
+
17
+ ## 0.12.0
18
+
19
+ ### Patch Changes
20
+
21
+ - Make CLI and build output easier to read. `stillwind --help` now highlights headings and options, lists `--format files` only for `stillwind fmt`, and suggests valid commands and `--help` for an unknown command or option. Text output colors file paths, codes, `note:`, `help:`, and `docs:` labels, shows `[project N]` only when results come from several projects, and gives `stillwind inspect` diagnostics the same colors and docs links. Compiler and lint messages no longer show internal byte offsets or debug values, name the conflicting framework and source format for `SW02001`, show the rejected prefix for `SW01001`, and use consistent punctuation and backticks. Unterminated blocks, nesting overflows, and syntax errors in CSS now point at the failing character instead of the whole stylesheet. When the failing CSS has no document URI, such as CSS that a plugin generates, the error message names that source and the byte offset. Vite reports compile errors in the error overlay with a clickable location and a code frame, and build warnings use the `stillwind: <rule>: <message> (<path>:<line>:<column>)` form.
22
+
23
+ - Updated dependencies:
24
+ - @stillwind/config@0.12.0
25
+ - @stillwind/host@0.12.0
26
+ - @stillwind/native@0.12.0
27
+ - stillwind@0.12.0
28
+
3
29
  ## 0.11.0
4
30
 
5
31
  ### Patch Changes
package/README.md CHANGED
@@ -9,8 +9,8 @@ styles during development and production builds, and delivers generated CSS thro
9
9
  ## Install
10
10
 
11
11
  ```sh
12
- vp i stillwind
13
- vp i -D @stillwind/integration
12
+ npm install stillwind
13
+ npm install -D @stillwind/integration
14
14
  ```
15
15
 
16
16
  Create the stylesheet and project configuration described in the
@@ -23,7 +23,7 @@ Place Stillwind before your framework's JSX transform:
23
23
  ```ts
24
24
  import { stillwind } from "@stillwind/integration/vite";
25
25
  import react from "@vitejs/plugin-react";
26
- import { defineConfig } from "vite-plus";
26
+ import { defineConfig } from "vite";
27
27
 
28
28
  export default defineConfig({
29
29
  plugins: [stillwind(), react()],
@@ -1,4 +1,4 @@
1
- import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-EX3Ckcsu.js";
1
+ import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-Lp15OaLQ.js";
2
2
  import { registerDevelopmentCss } from "./development.js";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { fileURLToPath } from "node:url";
@@ -1,4 +1,4 @@
1
- import { r as createViteProject, t as createVitePlugins } from "../plugin-EX3Ckcsu.js";
1
+ import { r as createViteProject, t as createVitePlugins } from "../plugin-Lp15OaLQ.js";
2
2
  // src/fresh/manifest.ts
3
3
  /** Filters repeated static files for Fresh's move operation without changing the emitted manifest. */
4
4
  function registrationManifest(source) {
@@ -1,4 +1,4 @@
1
- import { r as createViteProject, t as createVitePlugins } from "../plugin-EX3Ckcsu.js";
1
+ import { r as createViteProject, t as createVitePlugins } from "../plugin-Lp15OaLQ.js";
2
2
  import { addPluginTemplate, defineNuxtModule } from "nuxt/kit";
3
3
  // src/nuxt/index.ts
4
4
  /**
@@ -2,7 +2,7 @@ import { a as buildCompilerOptions, i as SharedTypeFacts, n as isSourceEntry, o
2
2
  import { a as eachMapping, i as TraceMap, n as addSegment, r as toEncodedMap, t as GenMapping } from "./gen-mapping-D7jFzOEh.js";
3
3
  import { createHash } from "node:crypto";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
- import { attachPlugins, cleanModuleId, compilerModuleId, composeFrameworkSourceMap, createStylesheetResolver, cssEntrypoint, cssWithSourceMap, decodeCssSourceMap, fileSourceKind, finalizeCss, finalizeModuleWithMap, isStylesheet, loadCssGraph, moduleSourceMap, nodePluginHost, resolveTypeFactsEnvironment, tracePhase, warnRejectedNames } from "@stillwind/host";
5
+ import { CompilationFailure, attachPlugins, cleanModuleId, compilerModuleId, composeFrameworkSourceMap, createStylesheetResolver, cssEntrypoint, cssWithSourceMap, decodeCssSourceMap, fileSourceKind, finalizeCss, finalizeModuleWithMap, formatReport, isStylesheet, loadCssGraph, moduleSourceMap, nodePluginHost, resolveTypeFactsEnvironment, tracePhase, warnRejectedNames } from "@stillwind/host";
6
6
  import { basename, dirname, extname, isAbsolute, posix, relative, resolve, sep } from "node:path";
7
7
  import { readFile, readdir, realpath, stat } from "node:fs/promises";
8
8
  import { minifyCss } from "@stillwind/native";
@@ -337,10 +337,10 @@ function resourceReplacements(resources) {
337
337
  * Encodes an absolute file path as a Vite filesystem URL.
338
338
  *
339
339
  * @param file - Canonical absolute path, using either path separator spelling.
340
- * @returns An /@fs/ URL with each path segment encoded for use in stylesheet resource requests.
340
+ * @returns An /@fs/ URL for use in stylesheet resource requests.
341
341
  */
342
342
  function resourceUrl(file) {
343
- return `/@fs/${file.replaceAll("\\", "/").split("/").map((segment) => encodeURIComponent(segment).replaceAll("'", "%27").replaceAll("(", "%28").replaceAll(")", "%29")).join("/")}`;
343
+ return `/@fs/${encodeURI(file.replaceAll("\\", "/")).replaceAll("#", "%23").replaceAll("?", "%3F").replaceAll("'", "%27").replaceAll("(", "%28").replaceAll(")", "%29")}`;
344
344
  }
345
345
  /**
346
346
  * Extracts a readable identity from a bundler resolution without checking file existence or access.
@@ -638,7 +638,7 @@ function developmentHooks(project) {
638
638
  await publish(name, host);
639
639
  } catch (error) {
640
640
  if (!stale.length) throw error;
641
- this.warn(`Stillwind update failed; retaining published styles: ${String(error)}`);
641
+ this.warn(`stillwind: update failed; retaining published styles: ${error instanceof Error ? error.message : String(error)}`);
642
642
  return [.../* @__PURE__ */ new Set([...context.modules, ...stale])];
643
643
  }
644
644
  if (previous && source !== void 0) {
@@ -661,7 +661,7 @@ function developmentHooks(project) {
661
661
  }
662
662
  if (stale.length) return [.../* @__PURE__ */ new Set([...context.modules, ...stale])];
663
663
  } catch (error) {
664
- this.warn(`Stillwind update failed; retaining published styles: ${String(error)}`);
664
+ this.warn(`stillwind: update failed; retaining published styles: ${error instanceof Error ? error.message : String(error)}`);
665
665
  }
666
666
  },
667
667
  /**
@@ -927,7 +927,13 @@ async function compileProducer(compiler, settings, config, registry, code, id, c
927
927
  };
928
928
  const sourceDependencies = /* @__PURE__ */ new Set();
929
929
  const output = await compiler.compile(code, id, {
930
- resolve: (specifier, importer) => resolveServerSource((specifier, importer, options) => context.resolve(specifier, importer, options), specifier, importer),
930
+ resolve: async (specifier, importer) => {
931
+ try {
932
+ return await resolveServerSource((specifier, importer, options) => context.resolve(specifier, importer, options), specifier, importer);
933
+ } catch {
934
+ return null;
935
+ }
936
+ },
931
937
  read: (id) => readFile(cleanModuleId(id), "utf8"),
932
938
  describe: (resolvedId) => {
933
939
  const virtual = resolvedId.startsWith("\0") || resolvedId.startsWith("virtual:");
@@ -1195,7 +1201,7 @@ var DesignSystem = class {
1195
1201
  if (this.settings.cssWatching && change !== this.cssChange) continue;
1196
1202
  this.cssAttempted = change;
1197
1203
  this.cssError = error;
1198
- this.settings.devServerRef?.config.logger.warn(`Stillwind update failed; retaining published styles: ${String(error)}`);
1204
+ this.settings.devServerRef?.config.logger.warn(`stillwind: update failed; retaining published styles: ${error instanceof Error ? error.message : String(error)}`);
1199
1205
  return;
1200
1206
  }
1201
1207
  }
@@ -2281,7 +2287,7 @@ function createViteProject(supplied = {}, applicationRoot = () => void 0) {
2281
2287
  }
2282
2288
  });
2283
2289
  } catch (error) {
2284
- server.config.logger.warn(`Stillwind update failed; retaining published styles: ${String(error)}`);
2290
+ server.config.logger.warn(`stillwind: update failed; retaining published styles: ${error instanceof Error ? error.message : String(error)}`);
2285
2291
  } finally {
2286
2292
  done.resolve();
2287
2293
  }
@@ -2525,7 +2531,33 @@ function transformHooks(project, virtualModules, options = {}) {
2525
2531
  addWatchFile: this.addWatchFile.bind(this),
2526
2532
  warn: this.warn.bind(this)
2527
2533
  } : this;
2528
- const result = await compile(name, code, id, context);
2534
+ let result;
2535
+ try {
2536
+ result = await compile(name, code, id, context);
2537
+ } catch (error) {
2538
+ if (error instanceof CompilationFailure) {
2539
+ const [first, ...rest] = error.batches.flatMap((batch) => batch.reports);
2540
+ const primary = first?.primary;
2541
+ if (first && primary?.scope === "range") {
2542
+ let file = id;
2543
+ if (primary.location.uri.startsWith("file:")) try {
2544
+ file = fileURLToPath(primary.location.uri);
2545
+ } catch {
2546
+ file = id;
2547
+ }
2548
+ this.error({
2549
+ message: [formatReport(first, { primaryLocation: false }), ...rest.map((report) => formatReport(report))].join("\n"),
2550
+ id: file,
2551
+ loc: {
2552
+ file,
2553
+ line: primary.location.startLine + 1,
2554
+ column: primary.location.startColumn
2555
+ }
2556
+ });
2557
+ }
2558
+ }
2559
+ throw error;
2560
+ }
2529
2561
  publishSoon(name);
2530
2562
  return result;
2531
2563
  }
@@ -3012,4 +3044,4 @@ function compilerPlugin(project, transform, closed) {
3012
3044
  }
3013
3045
  export { renderChunkStyles as i, stillwind as n, createViteProject as r, createVitePlugins as t };
3014
3046
 
3015
- //# sourceMappingURL=plugin-EX3Ckcsu.js.map
3047
+ //# sourceMappingURL=plugin-Lp15OaLQ.js.map