@nuxt/vite-builder-nightly 4.2.0-29331207.25e91a2b → 4.2.0-29331232.6f9cb0d2

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.
Files changed (2) hide show
  1. package/dist/index.mjs +17 -15
  2. package/package.json +4 -3
package/dist/index.mjs CHANGED
@@ -22,10 +22,11 @@ import net from 'node:net';
22
22
  import os from 'node:os';
23
23
  import { Buffer } from 'node:buffer';
24
24
  import { ViteNodeServer } from 'vite-node/server';
25
- import { normalizeViteManifest } from 'vue-bundle-renderer';
25
+ import { normalizeViteManifest, precomputeDependencies } from 'vue-bundle-renderer';
26
26
  import { provider, hasTTY, isCI } from 'std-env';
27
27
  import { colorize } from 'consola/utils';
28
28
  import escapeStringRegexp from 'escape-string-regexp';
29
+ import { serialize } from 'seroval';
29
30
  import { isBuiltin } from 'node:module';
30
31
  import { createJiti } from 'jiti';
31
32
  import { genImport, genArrayFromRaw, genObjectFromRawEntries } from 'knitwork';
@@ -556,16 +557,12 @@ function sendError(socket, id, error) {
556
557
  async function writeDevServer(nuxt) {
557
558
  const serverResolvedPath = resolve(distDir, "runtime/vite-node.mjs");
558
559
  const manifestResolvedPath = resolve(distDir, "runtime/client.manifest.mjs");
559
- await mkdir(join(nuxt.options.buildDir, "dist/server"), { recursive: true });
560
+ const serverDist = join(nuxt.options.buildDir, "dist/server");
561
+ await mkdir(serverDist, { recursive: true });
560
562
  await Promise.all([
561
- writeFile(
562
- resolve(nuxt.options.buildDir, "dist/server/server.mjs"),
563
- `export { default } from ${JSON.stringify(pathToFileURL(serverResolvedPath).href)}`
564
- ),
565
- writeFile(
566
- resolve(nuxt.options.buildDir, "dist/server/client.manifest.mjs"),
567
- `export { default } from ${JSON.stringify(pathToFileURL(manifestResolvedPath).href)}`
568
- )
563
+ writeFile(join(serverDist, "server.mjs"), `export { default } from ${JSON.stringify(pathToFileURL(serverResolvedPath).href)}`),
564
+ writeFile(join(serverDist, "client.precomputed.mjs"), `export default undefined`),
565
+ writeFile(join(serverDist, "client.manifest.mjs"), `export { default } from ${JSON.stringify(pathToFileURL(manifestResolvedPath).href)}`)
569
566
  ]);
570
567
  }
571
568
 
@@ -1130,9 +1127,9 @@ async function writeManifest(ctx) {
1130
1127
  }
1131
1128
  const manifest = normalizeViteManifest(clientManifest);
1132
1129
  await nuxt.callHook("build:manifest", manifest);
1133
- const stringifiedManifest = JSON.stringify(manifest, null, 2);
1134
- await writeFile(resolve(serverDist, "client.manifest.json"), stringifiedManifest, "utf8");
1135
- await writeFile(resolve(serverDist, "client.manifest.mjs"), "export default " + stringifiedManifest, "utf8");
1130
+ const precomputed = precomputeDependencies(manifest);
1131
+ await writeFile(resolve(serverDist, "client.manifest.mjs"), "export default " + serialize(manifest), "utf8");
1132
+ await writeFile(resolve(serverDist, "client.precomputed.mjs"), "export default " + serialize(precomputed), "utf8");
1136
1133
  if (!nuxt.options.dev) {
1137
1134
  await rm(manifestFile, { force: true });
1138
1135
  }
@@ -1869,18 +1866,23 @@ const bundle = async (nuxt) => {
1869
1866
  entry: ctx.entry
1870
1867
  }));
1871
1868
  });
1869
+ const nitro = useNitro();
1872
1870
  nuxt.hook("build:manifest", (manifest) => {
1871
+ const entryIds = /* @__PURE__ */ new Set();
1873
1872
  for (const id of chunksWithInlinedCSS) {
1874
1873
  const chunk = manifest[id];
1875
1874
  if (!chunk) {
1876
1875
  continue;
1877
1876
  }
1878
- if (chunk.isEntry) {
1879
- chunk._globalCSS = true;
1877
+ if (chunk.isEntry && chunk.src) {
1878
+ entryIds.add(chunk.src);
1880
1879
  } else {
1881
1880
  chunk.css &&= [];
1882
1881
  }
1883
1882
  }
1883
+ nitro.options.virtual["#internal/nuxt/entry-ids.mjs"] = () => `export default ${JSON.stringify(Array.from(entryIds))}`;
1884
+ nitro.options._config.virtual ||= {};
1885
+ nitro.options._config.virtual["#internal/nuxt/entry-ids.mjs"] = nitro.options.virtual["#internal/nuxt/entry-ids.mjs"];
1884
1886
  });
1885
1887
  }
1886
1888
  nuxt.hook("vite:serverCreated", (server, env) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/vite-builder-nightly",
3
- "version": "4.2.0-29331207.25e91a2b",
3
+ "version": "4.2.0-29331232.6f9cb0d2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -21,7 +21,7 @@
21
21
  "dist"
22
22
  ],
23
23
  "devDependencies": {
24
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.0-29331207.25e91a2b",
24
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.0-29331232.6f9cb0d2",
25
25
  "nitropack": "2.12.6",
26
26
  "rolldown": "1.0.0-beta.42",
27
27
  "rollup": "4.52.4",
@@ -29,7 +29,7 @@
29
29
  "vue": "3.5.22"
30
30
  },
31
31
  "dependencies": {
32
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.0-29331207.25e91a2b",
32
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.0-29331232.6f9cb0d2",
33
33
  "@rollup/plugin-replace": "^6.0.2",
34
34
  "@vitejs/plugin-vue": "^6.0.1",
35
35
  "@vitejs/plugin-vue-jsx": "^5.1.1",
@@ -51,6 +51,7 @@
51
51
  "pkg-types": "^2.3.0",
52
52
  "postcss": "^8.5.6",
53
53
  "rollup-plugin-visualizer": "^6.0.4",
54
+ "seroval": "^1.3.2",
54
55
  "std-env": "^3.9.0",
55
56
  "ufo": "^1.6.1",
56
57
  "unenv": "^2.0.0-rc.21",