@nuxt/vite-builder-nightly 5.0.0-29655957.274d46bb → 5.0.0-29656176.781598bf

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/dist/index.d.mts CHANGED
@@ -2,6 +2,11 @@ import { EnvironmentOptions } from "vite";
2
2
  import { ViteConfig } from "nuxt/schema";
3
3
  import { NuxtBuilder } from "@nuxt/schema";
4
4
  declare const bundle: NuxtBuilder["bundle"];
5
+ /**
6
+ * Reuse Vite's `server.watcher` (chokidar) to drive `builder:watch` instead of
7
+ * spinning up a second FS watcher in Nuxt core. Only active in `dev` mode.
8
+ */
9
+ declare const setupWatcher: NonNullable<NuxtBuilder["setupWatcher"]>;
5
10
  declare module "nuxt/schema" {
6
11
  interface ViteOptions extends ViteConfig {
7
12
  $client?: EnvironmentOptions;
@@ -14,4 +19,4 @@ declare module "nuxt/schema" {
14
19
  };
15
20
  }
16
21
  }
17
- export { bundle };
22
+ export { bundle, setupWatcher };
package/dist/index.mjs CHANGED
@@ -2159,4 +2159,33 @@ async function withLogs(fn, message, enabled = true) {
2159
2159
  const duration = performance.now() - start;
2160
2160
  logger.success(`${message} in ${Math.round(duration)}ms`);
2161
2161
  }
2162
- export { bundle };
2162
+ const setupWatcher = (nuxt) => {
2163
+ if (!nuxt.options.dev) return;
2164
+ const isIgnored = createIsIgnored(nuxt);
2165
+ const extraPaths = /* @__PURE__ */ new Set();
2166
+ for (const layer of getLayerDirectories(nuxt)) {
2167
+ extraPaths.add(layer.app);
2168
+ if (!layer.server.startsWith(layer.app.replace(/\/?$/, "/"))) extraPaths.add(layer.server);
2169
+ }
2170
+ const srcDir = nuxt.options.srcDir.replace(/\/?$/, "/");
2171
+ for (const pattern of nuxt.options.watch) {
2172
+ if (typeof pattern !== "string") continue;
2173
+ const path = resolve(nuxt.options.srcDir, pattern);
2174
+ if (!path.startsWith(srcDir)) extraPaths.add(path);
2175
+ }
2176
+ nuxt.hook("vite:serverCreated", async (server, { isClient }) => {
2177
+ if (!isClient) return;
2178
+ const watcher = server.watcher;
2179
+ watcher.on("all", (event, path) => {
2180
+ const normalized = normalize(path);
2181
+ if (isIgnored(normalized)) return;
2182
+ nuxt.callHook("builder:watch", event, normalized);
2183
+ });
2184
+ if (extraPaths.size) {
2185
+ const ready = new Promise((resolve) => watcher.once("ready", resolve));
2186
+ watcher.add([...extraPaths]);
2187
+ await ready;
2188
+ }
2189
+ });
2190
+ };
2191
+ export { bundle, setupWatcher };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/vite-builder-nightly",
3
- "version": "5.0.0-29655957.274d46bb",
3
+ "version": "5.0.0-29656176.781598bf",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -23,7 +23,7 @@
23
23
  "dist"
24
24
  ],
25
25
  "dependencies": {
26
- "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29655957.274d46bb",
26
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29656176.781598bf",
27
27
  "@vitejs/plugin-vue": "^6.0.7",
28
28
  "consola": "^3.4.2",
29
29
  "defu": "^6.1.7",
@@ -49,7 +49,7 @@
49
49
  "devDependencies": {
50
50
  "@babel/plugin-proposal-decorators": "7.29.0",
51
51
  "@babel/plugin-syntax-jsx": "7.28.6",
52
- "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29655957.274d46bb",
52
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29656176.781598bf",
53
53
  "@vitejs/plugin-vue-jsx": "5.1.5",
54
54
  "autoprefixer": "10.5.0",
55
55
  "cssnano": "8.0.1",
@@ -69,7 +69,7 @@
69
69
  "@vitejs/plugin-vue-jsx": "^5.1.5",
70
70
  "autoprefixer": "^10.4.27",
71
71
  "cssnano": "^7.1.3 || ^8.0.0",
72
- "nuxt": "npm:nuxt-nightly@5.0.0-29655957.274d46bb",
72
+ "nuxt": "npm:nuxt-nightly@5.0.0-29656176.781598bf",
73
73
  "rollup-plugin-visualizer": "^6.0.0 || ^7.0.1",
74
74
  "vue": "^3.3.4"
75
75
  },