@stillwind/integration 0.9.0 → 0.10.1
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 +24 -0
- package/dist/astro/index.js +1 -1
- package/dist/fresh/index.js +1 -1
- package/dist/nuxt/index.js +1 -1
- package/dist/{plugin-DQH8QlYh.js → plugin-EX3Ckcsu.js} +42 -7
- package/dist/plugin-EX3Ckcsu.js.map +1 -0
- package/dist/vite/index.js +1 -1
- package/package.json +9 -9
- package/dist/plugin-DQH8QlYh.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @stillwind/integration
|
|
2
2
|
|
|
3
|
+
## 0.10.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Vite development servers now apply edits of style modules that an editor or tool saves by truncating the file and then writing it. Before this fix, a hot update on Linux could read the file while it was empty, and the edited styles stayed missing until the next edit.
|
|
8
|
+
|
|
9
|
+
- Vite development servers now reload CSS for every file that is added to a directory that a CSS plugin lists, such as an icon directory. Before this fix, a file that was created while the server started or while the design system reloaded could be missed until the next change in that directory.
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @stillwind/config@0.10.1
|
|
13
|
+
- @stillwind/host@0.10.1
|
|
14
|
+
- @stillwind/native@0.10.1
|
|
15
|
+
- stillwind@0.10.1
|
|
16
|
+
|
|
17
|
+
## 0.10.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies:
|
|
22
|
+
- @stillwind/config@0.10.0
|
|
23
|
+
- @stillwind/host@0.10.0
|
|
24
|
+
- @stillwind/native@0.10.0
|
|
25
|
+
- stillwind@0.10.0
|
|
26
|
+
|
|
3
27
|
## 0.9.0
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/astro/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { i as renderChunkStyles, r as createViteProject, t as createVitePlugins } from "../plugin-EX3Ckcsu.js";
|
|
2
2
|
import { registerDevelopmentCss } from "./development.js";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
package/dist/fresh/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { r as createViteProject, t as createVitePlugins } from "../plugin-EX3Ckcsu.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) {
|
package/dist/nuxt/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createViteProject, t as createVitePlugins } from "../plugin-
|
|
1
|
+
import { r as createViteProject, t as createVitePlugins } from "../plugin-EX3Ckcsu.js";
|
|
2
2
|
import { addPluginTemplate, defineNuxtModule } from "nuxt/kit";
|
|
3
3
|
// src/nuxt/index.ts
|
|
4
4
|
/**
|
|
@@ -3,8 +3,8 @@ import { a as eachMapping, i as TraceMap, n as addSegment, r as toEncodedMap, t
|
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
5
|
import { attachPlugins, cleanModuleId, compilerModuleId, composeFrameworkSourceMap, createStylesheetResolver, cssEntrypoint, cssWithSourceMap, decodeCssSourceMap, fileSourceKind, finalizeCss, finalizeModuleWithMap, isStylesheet, loadCssGraph, moduleSourceMap, nodePluginHost, resolveTypeFactsEnvironment, tracePhase, warnRejectedNames } from "@stillwind/host";
|
|
6
|
-
import { dirname, extname, isAbsolute, posix, relative, resolve } from "node:path";
|
|
7
|
-
import { readFile, readdir, realpath } from "node:fs/promises";
|
|
6
|
+
import { basename, dirname, extname, isAbsolute, posix, relative, resolve, sep } from "node:path";
|
|
7
|
+
import { readFile, readdir, realpath, stat } from "node:fs/promises";
|
|
8
8
|
import { minifyCss } from "@stillwind/native";
|
|
9
9
|
import { isFileServingAllowed } from "vite";
|
|
10
10
|
import { cssBanners } from "stillwind/css";
|
|
@@ -196,6 +196,28 @@ async function readableFile(id, server) {
|
|
|
196
196
|
if (server && !isFileServingAllowed(canonical, server)) throw new Error("Stillwind file access denied");
|
|
197
197
|
return canonical;
|
|
198
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Reads a file after a watcher reports a change to it.
|
|
201
|
+
*
|
|
202
|
+
* A writer that truncates a file before it writes the new text can cause the change event between
|
|
203
|
+
* the two steps, and the watcher drops the event of the write that follows. An empty read
|
|
204
|
+
* therefore waits up to 100 ms for the modification time to change and then reads the file again,
|
|
205
|
+
* as Vite does when it reads a file for a hot update.
|
|
206
|
+
*
|
|
207
|
+
* @param file - Absolute path of the changed file.
|
|
208
|
+
* @returns The UTF-8 text of the file. The text is empty when the file stays empty after the wait.
|
|
209
|
+
* @throws If reading or checking the file fails.
|
|
210
|
+
*/
|
|
211
|
+
async function readChangedFile(file) {
|
|
212
|
+
const text = await readFile(file, "utf8");
|
|
213
|
+
if (text) return text;
|
|
214
|
+
const modified = (await stat(file)).mtimeMs;
|
|
215
|
+
for (let attempt = 0; attempt < 10; attempt++) {
|
|
216
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
217
|
+
if ((await stat(file)).mtimeMs !== modified) break;
|
|
218
|
+
}
|
|
219
|
+
return readFile(file, "utf8");
|
|
220
|
+
}
|
|
199
221
|
// src/vite/build-assets.ts
|
|
200
222
|
/**
|
|
201
223
|
* Emits referenced resource files and computes URLs relative to the CSS asset directory.
|
|
@@ -554,7 +576,7 @@ function developmentHooks(project) {
|
|
|
554
576
|
const id = cleanModuleId(file);
|
|
555
577
|
pending.delete(id);
|
|
556
578
|
if (change.event !== "update" || !environment || project.environment(name).designSystem.observes(resolve(file), false)) return;
|
|
557
|
-
const compiled = compileChange(name, id, "update", () =>
|
|
579
|
+
const compiled = compileChange(name, id, "update", () => readChangedFile(file), {
|
|
558
580
|
resolve: (specifier, importer, options) => environment.pluginContainer.resolveId(specifier, importer, options),
|
|
559
581
|
addWatchFile: (id) => {
|
|
560
582
|
server?.watcher.add(id);
|
|
@@ -1209,8 +1231,8 @@ var DesignSystem = class {
|
|
|
1209
1231
|
const directories = /* @__PURE__ */ new Set();
|
|
1210
1232
|
const trackingDirectories = this.cssObservedDirectories;
|
|
1211
1233
|
/**
|
|
1212
|
-
* Records a directory that a plugin lists once for this load
|
|
1213
|
-
*
|
|
1234
|
+
* Records a directory that a plugin lists once for this load. The development server's watcher
|
|
1235
|
+
* receives the directory only when the watcher does not already cover it.
|
|
1214
1236
|
*
|
|
1215
1237
|
* @param directory - Absolute directory path.
|
|
1216
1238
|
*/
|
|
@@ -1219,8 +1241,10 @@ var DesignSystem = class {
|
|
|
1219
1241
|
if (directories.has(path)) return;
|
|
1220
1242
|
directories.add(path);
|
|
1221
1243
|
trackingDirectories.add(path);
|
|
1244
|
+
const server = this.settings.devServerRef;
|
|
1245
|
+
if (server && (isWithin(server.config.root, path) || server.watcher.getWatched()[dirname(path)]?.includes(basename(path)))) return;
|
|
1222
1246
|
context.addWatchFile(path);
|
|
1223
|
-
|
|
1247
|
+
server?.watcher.add(path);
|
|
1224
1248
|
};
|
|
1225
1249
|
return {
|
|
1226
1250
|
...await loadDesignSystem(this.settings, this.config, async (specifier, importer) => resolvedFile(await context.resolve(specifier, importer, { skipSelf: true }), `CSS ${specifier} from ${importer}`), dependencies, this.#initialized ? this.#compiler?.native : void 0, watch, watchDirectory, this.#plugins),
|
|
@@ -1354,6 +1378,17 @@ async function designSystemVersion(files, directories) {
|
|
|
1354
1378
|
}
|
|
1355
1379
|
return hash.digest("hex");
|
|
1356
1380
|
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Checks whether a path is a directory or a descendant of it.
|
|
1383
|
+
*
|
|
1384
|
+
* @param directory - Absolute directory path. Forward and platform separators are accepted.
|
|
1385
|
+
* @param path - Absolute path to check.
|
|
1386
|
+
* @returns Whether `path` equals `directory` or lies below it.
|
|
1387
|
+
*/
|
|
1388
|
+
function isWithin(directory, path) {
|
|
1389
|
+
const child = relative(directory, path);
|
|
1390
|
+
return child !== ".." && !child.startsWith(`..${sep}`) && !isAbsolute(child);
|
|
1391
|
+
}
|
|
1357
1392
|
// src/vite/module-registry.ts
|
|
1358
1393
|
/**
|
|
1359
1394
|
* References issued by one project environment. Unknown IDs never supply file paths.
|
|
@@ -2977,4 +3012,4 @@ function compilerPlugin(project, transform, closed) {
|
|
|
2977
3012
|
}
|
|
2978
3013
|
export { renderChunkStyles as i, stillwind as n, createViteProject as r, createVitePlugins as t };
|
|
2979
3014
|
|
|
2980
|
-
//# sourceMappingURL=plugin-
|
|
3015
|
+
//# sourceMappingURL=plugin-EX3Ckcsu.js.map
|