@nuxt/rspack-builder 4.1.2 → 4.2.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.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/dist/index.mjs +26 -17
  3. package/package.json +17 -16
package/README.md CHANGED
@@ -60,7 +60,7 @@ Example of an `app.vue`:
60
60
  <script setup lang="ts">
61
61
  useSeoMeta({
62
62
  title: 'Meet Nuxt',
63
- description: 'The Intuitive Vue Framework.'
63
+ description: 'The Intuitive Vue Framework.',
64
64
  })
65
65
  </script>
66
66
 
@@ -93,13 +93,13 @@ Discover our [list of modules](https://nuxt.com/modules) to supercharge your Nux
93
93
  We invite you to contribute and help improve Nuxt 💚
94
94
 
95
95
  Here are a few ways you can get involved:
96
- - **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/community/reporting-bugs) to learn how to submit a bug report.
97
- - **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/community/contribution) to share your suggestions.
98
- - **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/community/getting-help) provides resources to help you out.
96
+ - **Reporting Bugs:** If you come across any bugs or issues, please check out the [reporting bugs guide](https://nuxt.com/docs/4.x/community/reporting-bugs) to learn how to submit a bug report.
97
+ - **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/4.x/community/contribution) to share your suggestions.
98
+ - **Questions:** If you have questions or need assistance, the [getting help guide](https://nuxt.com/docs/4.x/community/getting-help) provides resources to help you out.
99
99
 
100
100
  ## <a name="local-development">🏠 Local Development</a>
101
101
 
102
- Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#setup) to contribute to the framework and documentation.
102
+ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/4.x/community/framework-contribution#setup) to contribute to the framework and documentation.
103
103
 
104
104
  ## <a name="professional-support">🛟 Professional Support</a>
105
105
 
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__",
@@ -475,6 +476,17 @@ function getEnv(ctx) {
475
476
  "import.meta.client": ctx.isClient,
476
477
  "import.meta.server": ctx.isServer
477
478
  };
479
+ if (ctx.isClient) {
480
+ _env["process.prerender"] = false;
481
+ _env["process.nitro"] = false;
482
+ _env["import.meta.prerender"] = false;
483
+ _env["import.meta.nitro"] = false;
484
+ } else {
485
+ _env["process.prerender"] = "(()=>process.prerender)()";
486
+ _env["process.nitro"] = "(()=>process.nitro)()";
487
+ _env["import.meta.prerender"] = "(()=>import.meta.prerender)()";
488
+ _env["import.meta.nitro"] = "(()=>import.meta.nitro)()";
489
+ }
478
490
  if (ctx.userConfig.aggressiveCodeRemoval) {
479
491
  _env["typeof process"] = JSON.stringify(ctx.isServer ? "object" : "undefined");
480
492
  _env["typeof window"] = _env["typeof document"] = JSON.stringify(!ctx.isServer ? "object" : "undefined");
@@ -703,11 +715,11 @@ async function createPostcssLoadersRule(ctx) {
703
715
  }
704
716
 
705
717
  class VueSSRClientPlugin {
706
- options;
718
+ serverDist;
719
+ nuxt;
707
720
  constructor(options) {
708
- this.options = Object.assign({
709
- filename: null
710
- }, options);
721
+ this.serverDist = resolve(options.nuxt.options.buildDir, "dist/server");
722
+ this.nuxt = options.nuxt;
711
723
  }
712
724
  apply(compiler) {
713
725
  compiler.hooks.afterEmit.tap("VueSSRClientPlugin", async (compilation) => {
@@ -798,12 +810,12 @@ class VueSSRClientPlugin {
798
810
  }
799
811
  }
800
812
  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);
813
+ await this.nuxt.callHook("build:manifest", manifest);
814
+ await mkdir(this.serverDist, { recursive: true });
815
+ const precomputed = precomputeDependencies(manifest);
816
+ await writeFile(join(this.serverDist, `client.manifest.json`), JSON.stringify(manifest, null, 2));
817
+ await writeFile(join(this.serverDist, "client.manifest.mjs"), "export default " + serialize(manifest), "utf8");
818
+ await writeFile(join(this.serverDist, "client.precomputed.mjs"), "export default " + serialize(precomputed), "utf8");
807
819
  });
808
820
  }
809
821
  }
@@ -885,10 +897,7 @@ function vue(ctx) {
885
897
  options: ctx.userConfig.loaders.vue
886
898
  });
887
899
  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
- }));
900
+ ctx.config.plugins.push(new VueSSRClientPlugin({ nuxt: ctx.nuxt }));
892
901
  } else {
893
902
  ctx.config.plugins.push(new VueSSRServerPlugin({
894
903
  filename: `${ctx.name}.manifest.json`
@@ -1245,7 +1254,7 @@ async function compile(compiler) {
1245
1254
  if (nuxt.options.dev) {
1246
1255
  const compilersWatching = [];
1247
1256
  nuxt.hook("close", async () => {
1248
- await Promise.all(compilersWatching.map((watching) => pify(watching.close.bind(watching))()));
1257
+ await Promise.all(compilersWatching.map((watching) => watching && pify(watching.close.bind(watching))()));
1249
1258
  });
1250
1259
  if (compiler.options.name === "client") {
1251
1260
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/rspack-builder",
3
- "version": "4.1.2",
3
+ "version": "4.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -27,20 +27,20 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
30
- "@rspack/core": "^1.5.3",
30
+ "@rspack/core": "^1.5.8",
31
31
  "autoprefixer": "^10.4.21",
32
32
  "css-loader": "^7.1.2",
33
33
  "css-minimizer-webpack-plugin": "^7.0.2",
34
34
  "cssnano": "^7.1.1",
35
35
  "defu": "^6.1.4",
36
- "esbuild-loader": "^4.3.0",
36
+ "esbuild-loader": "^4.4.0",
37
37
  "escape-string-regexp": "^5.0.0",
38
38
  "file-loader": "^6.2.0",
39
39
  "h3": "^1.15.4",
40
- "jiti": "^2.5.1",
40
+ "jiti": "^2.6.1",
41
41
  "knitwork": "^1.2.0",
42
- "magic-string": "^0.30.19",
43
- "memfs": "^4.38.3",
42
+ "magic-string": "^0.30.21",
43
+ "memfs": "^4.49.0",
44
44
  "ohash": "^2.0.11",
45
45
  "pathe": "^2.0.3",
46
46
  "pify": "^6.1.0",
@@ -50,29 +50,30 @@
50
50
  "postcss-loader": "^8.2.0",
51
51
  "postcss-url": "^10.1.3",
52
52
  "pug-plain-loader": "^1.1.0",
53
- "std-env": "^3.9.0",
53
+ "seroval": "^1.3.2",
54
+ "std-env": "^3.10.0",
54
55
  "time-fix-plugin": "^2.0.7",
55
56
  "tinyglobby": "^0.2.15",
56
- "ts-checker-rspack-plugin": "^1.1.5",
57
+ "ts-checker-rspack-plugin": "^1.1.6",
57
58
  "ufo": "^1.6.1",
58
- "unenv": "^2.0.0-rc.21",
59
+ "unenv": "^2.0.0-rc.22",
59
60
  "unplugin": "^2.3.10",
60
61
  "url-loader": "^4.1.1",
61
- "vue-bundle-renderer": "^2.1.2",
62
+ "vue-bundle-renderer": "^2.2.0",
62
63
  "vue-loader": "^17.4.2",
63
64
  "webpack-bundle-analyzer": "^4.10.2",
64
- "webpack-dev-middleware": "^7.4.3",
65
+ "webpack-dev-middleware": "^7.4.5",
65
66
  "webpack-hot-middleware": "^2.26.1",
66
67
  "webpackbar": "^7.0.0",
67
- "@nuxt/kit": "4.1.2"
68
+ "@nuxt/kit": "4.2.0"
68
69
  },
69
70
  "devDependencies": {
70
71
  "@types/webpack-bundle-analyzer": "4.7.0",
71
- "@types/webpack-hot-middleware": "2.25.10",
72
- "rollup": "4.50.1",
72
+ "@types/webpack-hot-middleware": "2.25.11",
73
+ "rollup": "4.52.5",
73
74
  "unbuild": "3.6.1",
74
- "vue": "3.5.21",
75
- "@nuxt/schema": "4.1.2"
75
+ "vue": "3.5.22",
76
+ "@nuxt/schema": "4.2.0"
76
77
  },
77
78
  "peerDependencies": {
78
79
  "vue": "^3.3.4"