@nuxt/webpack-builder-nightly 4.5.0-29703645.7aa31156 → 4.5.0-29705236.f2ca6ea5

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 +30 -1
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -597,6 +597,32 @@ export function _rollupDynamicImport(chunkId) {
597
597
  `;
598
598
  }
599
599
  };
600
+ const STUB_MARKER = "/* unused pure expression or super */";
601
+ const INVALID_ANNOTATION_RE = /\/\* @__PURE__ \*\/(?= \(\/\* unused pure expression or super \*\/ null && \()/g;
602
+ const PURE_ANNOTATION_REPLACEMENT = " ".repeat(15);
603
+ function stripInvalidPureAnnotations(code) {
604
+ if (!code.includes(STUB_MARKER)) return code;
605
+ return code.replace(INVALID_ANNOTATION_RE, PURE_ANNOTATION_REPLACEMENT);
606
+ }
607
+ var StripInvalidPureAnnotationsPlugin = class {
608
+ apply(compiler) {
609
+ compiler.hooks.compilation.tap("StripInvalidPureAnnotationsPlugin", (compilation) => {
610
+ compilation.hooks.processAssets.tap({
611
+ name: "StripInvalidPureAnnotationsPlugin",
612
+ stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
613
+ }, (assets) => {
614
+ for (const [filename, asset] of Object.entries(assets)) {
615
+ if (!isJS(filename)) continue;
616
+ const source = asset.source();
617
+ const code = typeof source === "string" ? source : source.toString();
618
+ const replaced = stripInvalidPureAnnotations(code);
619
+ if (replaced === code) continue;
620
+ assets[filename] = new compiler.webpack.sources.RawSource(replaced);
621
+ }
622
+ });
623
+ });
624
+ }
625
+ };
600
626
  async function base(ctx) {
601
627
  await applyPresets(ctx, [
602
628
  baseAlias,
@@ -666,7 +692,10 @@ function basePlugins(ctx) {
666
692
  }
667
693
  } }
668
694
  }));
669
- if (ctx.isServer && !ctx.isDev) ctx.config.plugins.push(new RollupCompatDynamicImportPlugin());
695
+ if (ctx.isServer && !ctx.isDev) {
696
+ ctx.config.plugins.push(new RollupCompatDynamicImportPlugin());
697
+ ctx.config.plugins.push(new StripInvalidPureAnnotationsPlugin());
698
+ }
670
699
  }
671
700
  function baseAlias(ctx) {
672
701
  ctx.alias = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder-nightly",
3
- "version": "4.5.0-29703645.7aa31156",
3
+ "version": "4.5.0-29705236.f2ca6ea5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
28
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.5.0-29703645.7aa31156",
28
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.5.0-29705236.f2ca6ea5",
29
29
  "@vue/compiler-sfc": "3.5.35",
30
30
  "autoprefixer": "^10.5.0",
31
31
  "css-loader": "^7.1.4",
@@ -59,7 +59,7 @@
59
59
  "unenv": "^2.0.0-rc.24",
60
60
  "unplugin": "^3.0.0",
61
61
  "url-loader": "^4.1.1",
62
- "vue-bundle-renderer": "^2.2.0",
62
+ "vue-bundle-renderer": "^2.3.1",
63
63
  "vue-loader": "^17.4.2",
64
64
  "webpack": "^5.107.2",
65
65
  "webpack-bundle-analyzer": "^5.3.0",
@@ -68,7 +68,7 @@
68
68
  "webpackbar": "^7.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.5.0-29703645.7aa31156",
71
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.5.0-29705236.f2ca6ea5",
72
72
  "@rspack/core": "2.0.6",
73
73
  "@types/webpack-bundle-analyzer": "4.7.0",
74
74
  "@types/webpack-hot-middleware": "2.25.12",
@@ -79,7 +79,7 @@
79
79
  "vue": "3.5.35"
80
80
  },
81
81
  "peerDependencies": {
82
- "nuxt": "npm:nuxt-nightly@4.5.0-29703645.7aa31156",
82
+ "nuxt": "npm:nuxt-nightly@4.5.0-29705236.f2ca6ea5",
83
83
  "vue": "^3.3.4"
84
84
  },
85
85
  "engines": {