@nuxt/webpack-builder-nightly 4.2.0-29331188.9ad35781 → 4.2.0-29331210.766a637b

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 +14 -16
  2. package/package.json +4 -3
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import { logger, useNitro, useNuxt } from '@nuxt/kit';
8
8
  import { createUnplugin } from 'unplugin';
9
9
  import MagicString from 'magic-string';
10
10
  import { webpack, WebpackBarPlugin, builder, MiniCssExtractPlugin, TsCheckerPlugin } from '#builder';
11
- import { join, resolve, basename, normalize, dirname, isAbsolute } from 'pathe';
11
+ import { join, resolve, basename, normalize, isAbsolute } from 'pathe';
12
12
  import { createFsFromVolume, Volume } from 'memfs';
13
13
  import querystring from 'node:querystring';
14
14
  import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';
@@ -24,8 +24,9 @@ import createResolver from 'postcss-import-resolver';
24
24
  import { createJiti } from 'jiti';
25
25
  import VueLoaderPlugin from 'vue-loader/dist/pluginWebpack5.js';
26
26
  import { mkdir, writeFile } from 'node:fs/promises';
27
- import { normalizeWebpackManifest } from 'vue-bundle-renderer';
27
+ import { normalizeWebpackManifest, precomputeDependencies } from 'vue-bundle-renderer';
28
28
  import { hash } from 'ohash';
29
+ import { serialize } from 'seroval';
29
30
 
30
31
  const defaults = {
31
32
  globalPublicPath: "__webpack_public_path__",
@@ -703,11 +704,11 @@ async function createPostcssLoadersRule(ctx) {
703
704
  }
704
705
 
705
706
  class VueSSRClientPlugin {
706
- options;
707
+ serverDist;
708
+ nuxt;
707
709
  constructor(options) {
708
- this.options = Object.assign({
709
- filename: null
710
- }, options);
710
+ this.serverDist = resolve(options.nuxt.options.buildDir, "dist/server");
711
+ this.nuxt = options.nuxt;
711
712
  }
712
713
  apply(compiler) {
713
714
  compiler.hooks.afterEmit.tap("VueSSRClientPlugin", async (compilation) => {
@@ -798,12 +799,12 @@ class VueSSRClientPlugin {
798
799
  }
799
800
  }
800
801
  const manifest = normalizeWebpackManifest(webpackManifest);
801
- await this.options.nuxt.callHook("build:manifest", manifest);
802
- const src = JSON.stringify(manifest, null, 2);
803
- await mkdir(dirname(this.options.filename), { recursive: true });
804
- await writeFile(this.options.filename, src);
805
- const mjsSrc = "export default " + src;
806
- await writeFile(this.options.filename.replace(".json", ".mjs"), mjsSrc);
802
+ await this.nuxt.callHook("build:manifest", manifest);
803
+ await mkdir(this.serverDist, { recursive: true });
804
+ const precomputed = precomputeDependencies(manifest);
805
+ await writeFile(join(this.serverDist, `client.manifest.json`), JSON.stringify(manifest, null, 2));
806
+ await writeFile(join(this.serverDist, "client.manifest.mjs"), "export default " + serialize(manifest), "utf8");
807
+ await writeFile(join(this.serverDist, "client.precomputed.mjs"), "export default " + serialize(precomputed), "utf8");
807
808
  });
808
809
  }
809
810
  }
@@ -885,10 +886,7 @@ function vue(ctx) {
885
886
  options: ctx.userConfig.loaders.vue
886
887
  });
887
888
  if (ctx.isClient) {
888
- ctx.config.plugins.push(new VueSSRClientPlugin({
889
- filename: resolve(ctx.options.buildDir, "dist/server", `${ctx.name}.manifest.json`),
890
- nuxt: ctx.nuxt
891
- }));
889
+ ctx.config.plugins.push(new VueSSRClientPlugin({ nuxt: ctx.nuxt }));
892
890
  } else {
893
891
  ctx.config.plugins.push(new VueSSRServerPlugin({
894
892
  filename: `${ctx.name}.manifest.json`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder-nightly",
3
- "version": "4.2.0-29331188.9ad35781",
3
+ "version": "4.2.0-29331210.766a637b",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
30
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.0-29331188.9ad35781",
30
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.0-29331210.766a637b",
31
31
  "autoprefixer": "^10.4.21",
32
32
  "css-loader": "^7.1.2",
33
33
  "css-minimizer-webpack-plugin": "^7.0.2",
@@ -52,6 +52,7 @@
52
52
  "postcss-loader": "^8.2.0",
53
53
  "postcss-url": "^10.1.3",
54
54
  "pug-plain-loader": "^1.1.0",
55
+ "seroval": "^1.3.2",
55
56
  "std-env": "^3.9.0",
56
57
  "time-fix-plugin": "^2.0.7",
57
58
  "tinyglobby": "^0.2.15",
@@ -68,7 +69,7 @@
68
69
  "webpackbar": "^7.0.0"
69
70
  },
70
71
  "devDependencies": {
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.0-29331188.9ad35781",
72
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.0-29331210.766a637b",
72
73
  "@rspack/core": "1.5.8",
73
74
  "@types/webpack-bundle-analyzer": "4.7.0",
74
75
  "@types/webpack-hot-middleware": "2.25.11",