@nuxt/webpack-builder-nightly 4.4.0-29506647.0fa65fc3 → 4.4.0-29532435.dd5ca638

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/README.md CHANGED
@@ -1,10 +1,10 @@
1
- [![Nuxt banner](https://github.com/nuxt/nuxt/blob/main/.github/assets/banner.svg)](https://nuxt.com)
1
+ <a href="https://nuxt.com"><img width="830" height="213" src="https://github.com/nuxt/nuxt/blob/main/.github/assets/banner.svg" alt="Nuxt banner"></a>
2
2
 
3
3
  # Nuxt
4
4
 
5
5
  <p>
6
- <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a>
7
- <a href="https://www.npmjs.com/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a>
6
+ <a href="https://npmx.dev/package/nuxt"><img src="https://img.shields.io/npm/v/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Version"></a>
7
+ <a href="https://npmx.dev/package/nuxt"><img src="https://img.shields.io/npm/dm/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="Downloads"></a>
8
8
  <a href="https://github.com/nuxt/nuxt/blob/main/LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
9
9
  <a href="https://nuxt.com/modules"><img src="https://img.shields.io/badge/dynamic/json?url=https://nuxt.com/api/v1/modules&query=$.stats.modules&label=Modules&style=flat&colorA=18181B&colorB=28CF8D" alt="Modules"></a>
10
10
  <a href="https://nuxt.com"><img src="https://img.shields.io/badge/Nuxt%20Docs-18181B?logo=nuxt" alt="Website"></a>
package/dist/index.mjs CHANGED
@@ -7,10 +7,7 @@ import { joinURL, parseURL, withTrailingSlash } from "ufo";
7
7
  import { directoryToURL, logger, resolveAlias, useNitro, useNuxt } from "@nuxt/kit";
8
8
  import { createUnplugin } from "unplugin";
9
9
  import MagicString from "magic-string";
10
- import webpack from "webpack";
11
- import MiniCssExtractPlugin from "mini-css-extract-plugin";
12
- import WebpackBarPlugin from "webpackbar";
13
- import TsCheckerPlugin from "fork-ts-checker-webpack-plugin";
10
+ import { MiniCssExtractPlugin, TsCheckerPlugin, WebpackBarPlugin, builder, webpack } from "#builder";
14
11
  import { existsSync, readFileSync } from "node:fs";
15
12
  import { pathToFileURL } from "node:url";
16
13
  import { basename, isAbsolute, join, normalize, relative, resolve } from "pathe";
@@ -36,8 +33,6 @@ import { normalizeWebpackManifest, precomputeDependencies } from "vue-bundle-ren
36
33
  import { hash } from "ohash";
37
34
  import { serialize } from "seroval";
38
35
  import { parseNodeModulePath } from "mlly";
39
-
40
- //#region src/plugins/dynamic-base.ts
41
36
  const defaults = {
42
37
  globalPublicPath: "__webpack_public_path__",
43
38
  sourcemap: true
@@ -67,13 +62,6 @@ const DynamicBasePlugin = createUnplugin((options = {}) => {
67
62
  }
68
63
  };
69
64
  });
70
-
71
- //#endregion
72
- //#region builder.mjs
73
- const builder = "webpack";
74
-
75
- //#endregion
76
- //#region src/plugins/chunk.ts
77
65
  const pluginName = "ChunkErrorPlugin";
78
66
  var ChunkErrorPlugin = class {
79
67
  apply(compiler) {
@@ -105,16 +93,13 @@ if (typeof ${ensureChunk} !== "undefined") {
105
93
  `;
106
94
  }
107
95
  };
108
-
109
- //#endregion
110
- //#region src/plugins/ssr-styles.ts
111
96
  const CSS_URL_RE = /url\((['"]?)(\/[^)]+?)\1\)/g;
112
97
  const isVueFile = (id) => /\.vue(?:\?|$)/.test(id);
113
98
  const isCSSLike = (name) => /\.(?:css|scss|sass|less|styl(?:us)?|postcss|pcss)(?:\?|$)/.test(name);
114
- function normalizePath(nuxt$1, id) {
99
+ function normalizePath(nuxt, id) {
115
100
  if (!id) return null;
116
101
  const { pathname } = parseURL(decodeURIComponent(pathToFileURL(id).href));
117
- const rel = relative(nuxt$1.options.srcDir, pathname);
102
+ const rel = relative(nuxt.options.srcDir, pathname);
118
103
  if (rel.startsWith("..")) return null;
119
104
  return rel;
120
105
  }
@@ -134,12 +119,12 @@ function extractVueStyles(filePath) {
134
119
  const styles = [];
135
120
  const scopeId = createHash("sha256").update(filePath).digest("hex").slice(0, 8);
136
121
  for (let i = 0; i < descriptor.styles.length; i++) {
137
- const style$1 = descriptor.styles[i];
122
+ const style = descriptor.styles[i];
138
123
  const result = compileStyle({
139
- source: style$1.content,
124
+ source: style.content,
140
125
  filename: filePath,
141
126
  id: `data-v-${scopeId}`,
142
- scoped: style$1.scoped
127
+ scoped: style.scoped
143
128
  });
144
129
  if (!result.errors.length && result.code) styles.push(normalizeCSSContent(result.code));
145
130
  }
@@ -153,10 +138,10 @@ var SSRStylesPlugin = class {
153
138
  clientCSSByIssuer = /* @__PURE__ */ new Map();
154
139
  chunksWithInlinedCSS = /* @__PURE__ */ new Set();
155
140
  globalCSSPaths = /* @__PURE__ */ new Set();
156
- constructor(nuxt$1) {
157
- this.nuxt = nuxt$1;
141
+ constructor(nuxt) {
142
+ this.nuxt = nuxt;
158
143
  this.globalCSSPaths = this.resolveGlobalCSS();
159
- nuxt$1.hook("build:manifest", (manifest) => {
144
+ nuxt.hook("build:manifest", (manifest) => {
160
145
  for (const [id, chunk] of Object.entries(manifest)) {
161
146
  if (chunk.isEntry && chunk.src) this.chunksWithInlinedCSS.add(chunk.src);
162
147
  else if (this.chunksWithInlinedCSS.has(id)) chunk.css &&= [];
@@ -182,9 +167,9 @@ var SSRStylesPlugin = class {
182
167
  isPublicAsset(url, nitro) {
183
168
  const cleaned = url.replace(/[?#].*$/, "");
184
169
  for (const dir of nitro.options.publicAssets) {
185
- const base$1 = withTrailingSlash(dir.baseURL || "/");
186
- if (!url.startsWith(base$1)) continue;
187
- if (existsSync(cleaned.replace(base$1, withTrailingSlash(dir.dir)))) return true;
170
+ const base = withTrailingSlash(dir.baseURL || "/");
171
+ if (!url.startsWith(base)) continue;
172
+ if (existsSync(cleaned.replace(base, withTrailingSlash(dir.dir)))) return true;
188
173
  }
189
174
  return false;
190
175
  }
@@ -264,8 +249,8 @@ var SSRStylesPlugin = class {
264
249
  });
265
250
  }
266
251
  emitServerStyles(compilation) {
267
- const { webpack: webpack$1 } = compilation.compiler;
268
- const stage = webpack$1.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE;
252
+ const { webpack } = compilation.compiler;
253
+ const stage = webpack.Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE;
269
254
  compilation.hooks.processAssets.tap({
270
255
  name: "SSRStylesPlugin",
271
256
  stage
@@ -295,10 +280,10 @@ var SSRStylesPlugin = class {
295
280
  if (vueStyles.length) collected.set(rel, new Set(vueStyles));
296
281
  }
297
282
  const emitted = {};
298
- const rawSource = webpack$1.sources.RawSource;
283
+ const rawSource = webpack.sources.RawSource;
299
284
  for (const [rel, cssSet] of collected.entries()) {
300
285
  if (!cssSet.size) continue;
301
- const transformed = Array.from(cssSet).map((style$1) => this.rewriteStyle(style$1, nitro));
286
+ const transformed = Array.from(cssSet).map((style) => this.rewriteStyle(style, nitro));
302
287
  const needsPublicAssets = transformed.some((t) => t.needsPublicAsset);
303
288
  const needsBuildAssets = transformed.some((t) => t.needsBuildAsset);
304
289
  const imports = [];
@@ -365,8 +350,8 @@ var SSRStylesPlugin = class {
365
350
  });
366
351
  }
367
352
  collectCSS(compilation) {
368
- const { webpack: webpack$1 } = compilation.compiler;
369
- const stage = compilation.compiler.options.name === "server" ? webpack$1.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS : webpack$1.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER;
353
+ const { webpack } = compilation.compiler;
354
+ const stage = compilation.compiler.options.name === "server" ? webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS : webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_TRANSFER;
370
355
  const chunkCSSMeta = /* @__PURE__ */ new Map();
371
356
  compilation.hooks.processAssets.tap({
372
357
  name: "SSRStylesPlugin",
@@ -425,9 +410,6 @@ var SSRStylesPlugin = class {
425
410
  return cssChunks;
426
411
  }
427
412
  };
428
-
429
- //#endregion
430
- //#region src/utils/mfs.ts
431
413
  function createMFS() {
432
414
  const _fs = { ...createFsFromVolume(new Volume()) };
433
415
  _fs.join = join;
@@ -435,24 +417,18 @@ function createMFS() {
435
417
  _fs.readFile = pify(_fs.readFile);
436
418
  return _fs;
437
419
  }
438
-
439
- //#endregion
440
- //#region src/utils/index.ts
441
420
  /** @since 3.9.0 */
442
421
  function toArray(value) {
443
422
  return Array.isArray(value) ? value : [value];
444
423
  }
445
-
446
- //#endregion
447
- //#region src/utils/config.ts
448
- function createWebpackConfigContext(nuxt$1) {
424
+ function createWebpackConfigContext(nuxt) {
449
425
  return {
450
- nuxt: nuxt$1,
451
- options: nuxt$1.options,
452
- userConfig: nuxt$1.options.webpack,
426
+ nuxt,
427
+ options: nuxt.options,
428
+ userConfig: nuxt.options.webpack,
453
429
  config: {},
454
430
  name: "base",
455
- isDev: nuxt$1.options.dev,
431
+ isDev: nuxt.options.dev,
456
432
  isServer: false,
457
433
  isClient: false,
458
434
  alias: {},
@@ -464,17 +440,14 @@ async function applyPresets(ctx, presets) {
464
440
  else await preset(ctx);
465
441
  }
466
442
  function fileName(ctx, key) {
467
- let fileName$1 = ctx.userConfig.filenames[key];
468
- if (typeof fileName$1 === "function") fileName$1 = fileName$1(ctx);
469
- if (typeof fileName$1 === "string" && ctx.options.dev) {
470
- const hash$1 = /\[(chunkhash|contenthash|hash)(?::\d+)?\]/.exec(fileName$1);
471
- if (hash$1) logger.warn(`Notice: Please do not use ${hash$1[1]} in dev mode to prevent memory leak`);
443
+ let fileName = ctx.userConfig.filenames[key];
444
+ if (typeof fileName === "function") fileName = fileName(ctx);
445
+ if (typeof fileName === "string" && ctx.options.dev) {
446
+ const hash = /\[(chunkhash|contenthash|hash)(?::\d+)?\]/.exec(fileName);
447
+ if (hash) logger.warn(`Notice: Please do not use ${hash[1]} in dev mode to prevent memory leak`);
472
448
  }
473
- return fileName$1;
449
+ return fileName;
474
450
  }
475
-
476
- //#endregion
477
- //#region src/presets/assets.ts
478
451
  function assets(ctx) {
479
452
  ctx.config.module.rules.push({
480
453
  test: /\.(png|jpe?g|gif|svg|webp)$/i,
@@ -505,9 +478,6 @@ function assets(ctx) {
505
478
  }]
506
479
  });
507
480
  }
508
-
509
- //#endregion
510
- //#region src/plugins/warning-ignore.ts
511
481
  var WarningIgnorePlugin = class {
512
482
  filter;
513
483
  constructor(filter) {
@@ -519,9 +489,6 @@ var WarningIgnorePlugin = class {
519
489
  });
520
490
  }
521
491
  };
522
-
523
- //#endregion
524
- //#region src/plugins/vue/util.ts
525
492
  /**
526
493
  * This file is based on Vue.js (MIT) webpack plugins
527
494
  * https://github.com/vuejs/vue/blob/dev/src/server/webpack-plugin/util.js
@@ -536,9 +503,6 @@ const extractQueryPartJS = (file) => isJSRegExp.exec(file)?.[1];
536
503
  const isCSSRegExp = /\.css(?:\?[^.]+)?$/;
537
504
  const isCSS = (file) => isCSSRegExp.test(file);
538
505
  const isHotUpdate = (file) => file.includes("hot-update");
539
-
540
- //#endregion
541
- //#region src/plugins/rollup-compat-dynamic-import.ts
542
506
  const DYNAMIC_IMPORT_RE = /import\([^)]*\+\s*__webpack_require__[^+]*\)\.then/;
543
507
  const DYNAMIC_IMPORT_REPLACE_RE = /import\([^)]*\+\s*(__webpack_require__[^+]*)\)\.then/g;
544
508
  const HELPER_FILENAME = "_dynamic-import-helper.mjs";
@@ -554,18 +518,18 @@ var RollupCompatDynamicImportPlugin = class {
554
518
  compilation.hooks.processAssets.tapAsync({
555
519
  name: "RollupCompatDynamicImportPlugin",
556
520
  stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE
557
- }, (assets$1, callback) => {
521
+ }, (assets, callback) => {
558
522
  try {
559
523
  const targetFiles = /* @__PURE__ */ new Set();
560
524
  for (const chunk of compilation.chunks) if (chunk.canBeInitial() || chunk.hasRuntime()) for (const file of chunk.files || []) targetFiles.add(file);
561
- for (const [filename, asset] of Object.entries(assets$1)) {
525
+ for (const [filename, asset] of Object.entries(assets)) {
562
526
  if (!isJS(filename)) continue;
563
527
  if (!targetFiles.has(filename)) continue;
564
528
  const source = asset.source();
565
529
  const originalCode = typeof source === "string" ? source : source.toString();
566
530
  if (!DYNAMIC_IMPORT_RE.test(originalCode)) continue;
567
531
  const transformedCode = this.transformDynamicImports(originalCode);
568
- if (transformedCode !== originalCode) assets$1[filename] = new compiler.webpack.sources.RawSource(transformedCode);
532
+ if (transformedCode !== originalCode) assets[filename] = new compiler.webpack.sources.RawSource(transformedCode);
569
533
  }
570
534
  this.generateDynamicImportHelper(compilation);
571
535
  callback();
@@ -615,9 +579,6 @@ export function _rollupDynamicImport(chunkId) {
615
579
  `;
616
580
  }
617
581
  };
618
-
619
- //#endregion
620
- //#region src/presets/base.ts
621
582
  async function base(ctx) {
622
583
  await applyPresets(ctx, [
623
584
  baseAlias,
@@ -793,9 +754,6 @@ const statsMap = {
793
754
  info: "normal",
794
755
  verbose: "verbose"
795
756
  };
796
-
797
- //#endregion
798
- //#region src/presets/esbuild.ts
799
757
  function esbuild(ctx) {
800
758
  const target = ctx.isServer ? "es2020" : "chrome85";
801
759
  ctx.config.optimization.minimizer.push(new EsbuildPlugin());
@@ -823,9 +781,6 @@ function esbuild(ctx) {
823
781
  }
824
782
  });
825
783
  }
826
-
827
- //#endregion
828
- //#region src/presets/pug.ts
829
784
  function pug(ctx) {
830
785
  ctx.config.module.rules.push({
831
786
  test: /\.pug$/i,
@@ -841,35 +796,32 @@ function pug(ctx) {
841
796
  }] }]
842
797
  });
843
798
  }
844
-
845
- //#endregion
846
- //#region src/utils/postcss.ts
847
799
  const isPureObject = (obj) => obj !== null && !Array.isArray(obj) && typeof obj === "object";
848
800
  function sortPlugins({ plugins, order }) {
849
801
  const names = Object.keys(plugins);
850
802
  return typeof order === "function" ? order(names) : order || names;
851
803
  }
852
- async function getPostcssConfig(nuxt$1) {
853
- if (!nuxt$1.options.webpack.postcss || !nuxt$1.options.postcss) return false;
854
- const postcssOptions = defu({}, nuxt$1.options.postcss, {
804
+ async function getPostcssConfig(nuxt) {
805
+ if (!nuxt.options.webpack.postcss || !nuxt.options.postcss) return false;
806
+ const postcssOptions = defu({}, nuxt.options.postcss, {
855
807
  plugins: {
856
808
  "postcss-import": { resolve: createResolver({
857
- alias: { ...nuxt$1.options.alias },
858
- modules: nuxt$1.options.modulesDir
809
+ alias: { ...nuxt.options.alias },
810
+ modules: nuxt.options.modulesDir
859
811
  }) },
860
812
  "postcss-url": {}
861
813
  },
862
- sourceMap: nuxt$1.options.webpack.cssSourceMap
814
+ sourceMap: nuxt.options.webpack.cssSourceMap
863
815
  });
864
- const jiti = createJiti(nuxt$1.options.rootDir, { alias: nuxt$1.options.alias });
816
+ const jiti = createJiti(nuxt.options.rootDir, { alias: nuxt.options.alias });
865
817
  if (!Array.isArray(postcssOptions.plugins) && isPureObject(postcssOptions.plugins)) {
866
818
  const plugins = [];
867
- for (const pluginName$1 of sortPlugins(postcssOptions)) {
868
- const pluginOptions = postcssOptions.plugins[pluginName$1];
819
+ for (const pluginName of sortPlugins(postcssOptions)) {
820
+ const pluginOptions = postcssOptions.plugins[pluginName];
869
821
  if (!pluginOptions) continue;
870
822
  let pluginFn;
871
- for (const parentURL of nuxt$1.options.modulesDir) {
872
- pluginFn = await jiti.import(pluginName$1, {
823
+ for (const parentURL of nuxt.options.modulesDir) {
824
+ pluginFn = await jiti.import(pluginName, {
873
825
  parentURL: parentURL.replace(/\/node_modules\/?$/, ""),
874
826
  try: true,
875
827
  default: true
@@ -879,19 +831,16 @@ async function getPostcssConfig(nuxt$1) {
879
831
  break;
880
832
  }
881
833
  }
882
- if (typeof pluginFn !== "function") console.warn(`[nuxt] could not import postcss plugin \`${pluginName$1}\`. Please report this as a bug.`);
834
+ if (typeof pluginFn !== "function") console.warn(`[nuxt] could not import postcss plugin \`${pluginName}\`. Please report this as a bug.`);
883
835
  }
884
836
  postcssOptions.plugins = plugins;
885
837
  }
886
838
  return {
887
- sourceMap: nuxt$1.options.webpack.cssSourceMap,
888
- ...nuxt$1.options.webpack.postcss,
839
+ sourceMap: nuxt.options.webpack.cssSourceMap,
840
+ ...nuxt.options.webpack.postcss,
889
841
  postcssOptions
890
842
  };
891
843
  }
892
-
893
- //#endregion
894
- //#region src/presets/style.ts
895
844
  async function style(ctx) {
896
845
  await applyPresets(ctx, [
897
846
  loaders,
@@ -971,9 +920,6 @@ async function createPostcssLoadersRule(ctx) {
971
920
  options: config
972
921
  };
973
922
  }
974
-
975
- //#endregion
976
- //#region src/plugins/vue/client.ts
977
923
  /**
978
924
  * This file is based on Vue.js (MIT) webpack plugins
979
925
  * https://github.com/vuejs/vue/blob/dev/src/server/webpack-plugin/client.js
@@ -995,9 +941,9 @@ var VueSSRClientPlugin = class {
995
941
  const stats = compilation.getStats().toJson();
996
942
  const context = this.nuxt.options.srcDir;
997
943
  const initialFiles = /* @__PURE__ */ new Set();
998
- for (const { assets: assets$1 } of Object.values(stats.entrypoints)) {
999
- if (!assets$1) continue;
1000
- for (const asset of assets$1) {
944
+ for (const { assets } of Object.values(stats.entrypoints)) {
945
+ if (!assets) continue;
946
+ for (const asset of assets) {
1001
947
  const file = asset.name;
1002
948
  if ((isJS(file) || isCSS(file)) && !isHotUpdate(file)) initialFiles.add(file);
1003
949
  }
@@ -1043,11 +989,11 @@ var VueSSRClientPlugin = class {
1043
989
  const files = Array.from(filesSet);
1044
990
  webpackManifest.modules[relativeId] = files;
1045
991
  if (Array.isArray(m.modules)) for (const concatenatedModule of m.modules) {
1046
- const relativeId$1 = this.getRelativeModuleId(concatenatedModule.identifier, context);
1047
- webpackManifest.modules[relativeId$1] ||= files;
992
+ const relativeId = this.getRelativeModuleId(concatenatedModule.identifier, context);
993
+ webpackManifest.modules[relativeId] ||= files;
1048
994
  }
1049
995
  if (stats.modules) {
1050
- for (const m$1 of stats.modules) if (m$1.assets?.length && m$1.chunks?.includes(cid)) files.push(...m$1.assets.map(fileToIndex));
996
+ for (const m of stats.modules) if (m.assets?.length && m.chunks?.includes(cid)) files.push(...m.assets.map(fileToIndex));
1051
997
  }
1052
998
  }
1053
999
  const manifest = normalizeWebpackManifest(webpackManifest);
@@ -1060,9 +1006,6 @@ var VueSSRClientPlugin = class {
1060
1006
  });
1061
1007
  }
1062
1008
  };
1063
-
1064
- //#endregion
1065
- //#region src/plugins/vue/server.ts
1066
1009
  const JS_MAP_RE = /\.js\.map$/;
1067
1010
  var VueSSRServerPlugin = class {
1068
1011
  options;
@@ -1075,7 +1018,7 @@ var VueSSRServerPlugin = class {
1075
1018
  compilation.hooks.processAssets.tapAsync({
1076
1019
  name: "VueSSRServerPlugin",
1077
1020
  stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL
1078
- }, (assets$1, cb) => {
1021
+ }, (assets, cb) => {
1079
1022
  const stats = compilation.getStats().toJson();
1080
1023
  const [entryName] = Object.keys(stats.entrypoints);
1081
1024
  const entryInfo = stats.entrypoints[entryName];
@@ -1084,24 +1027,24 @@ var VueSSRServerPlugin = class {
1084
1027
  if (entryAssets.length > 1) throw new Error("Server-side bundle should have one single entry file. Avoid using CommonsChunkPlugin in the server config.");
1085
1028
  const [entry] = entryAssets;
1086
1029
  if (!entry || typeof entry.name !== "string") throw new Error(`Entry "${entryName}" not found. Did you specify the correct entry option?`);
1087
- const bundle$1 = {
1030
+ const bundle = {
1088
1031
  entry: entry.name,
1089
1032
  files: {},
1090
1033
  maps: {}
1091
1034
  };
1092
1035
  for (const asset of stats.assets) if (isJS(asset.name)) {
1093
1036
  const queryPart = extractQueryPartJS(asset.name);
1094
- if (queryPart !== void 0) bundle$1.files[asset.name] = asset.name.replace(queryPart, "");
1095
- else bundle$1.files[asset.name] = asset.name;
1096
- } else if (JS_MAP_RE.test(asset.name)) bundle$1.maps[asset.name.replace(/\.map$/, "")] = asset.name;
1097
- else delete assets$1[asset.name];
1098
- const src = JSON.stringify(bundle$1, null, 2);
1099
- assets$1[this.options.filename] = {
1037
+ if (queryPart !== void 0) bundle.files[asset.name] = asset.name.replace(queryPart, "");
1038
+ else bundle.files[asset.name] = asset.name;
1039
+ } else if (JS_MAP_RE.test(asset.name)) bundle.maps[asset.name.replace(/\.map$/, "")] = asset.name;
1040
+ else delete assets[asset.name];
1041
+ const src = JSON.stringify(bundle, null, 2);
1042
+ assets[this.options.filename] = {
1100
1043
  source: () => src,
1101
1044
  size: () => src.length
1102
1045
  };
1103
1046
  const mjsSrc = "export default " + src;
1104
- assets$1[this.options.filename.replace(".json", ".mjs")] = {
1047
+ assets[this.options.filename.replace(".json", ".mjs")] = {
1105
1048
  source: () => mjsSrc,
1106
1049
  map: () => null,
1107
1050
  size: () => mjsSrc.length
@@ -1111,9 +1054,6 @@ var VueSSRServerPlugin = class {
1111
1054
  });
1112
1055
  }
1113
1056
  };
1114
-
1115
- //#endregion
1116
- //#region src/presets/vue.ts
1117
1057
  function vue(ctx) {
1118
1058
  ctx.config.plugins.push(new (VueLoaderPlugin.default || VueLoaderPlugin)());
1119
1059
  ctx.config.module.rules.push({
@@ -1143,9 +1083,6 @@ function vue(ctx) {
1143
1083
  "__VUE_PROD_HYDRATION_MISMATCH_DETAILS__": ctx.nuxt.options.debug && ctx.nuxt.options.debug.hydration
1144
1084
  }));
1145
1085
  }
1146
-
1147
- //#endregion
1148
- //#region src/presets/nuxt.ts
1149
1086
  async function nuxt(ctx) {
1150
1087
  await applyPresets(ctx, [
1151
1088
  base,
@@ -1156,9 +1093,6 @@ async function nuxt(ctx) {
1156
1093
  vue
1157
1094
  ]);
1158
1095
  }
1159
-
1160
- //#endregion
1161
- //#region src/configs/client.ts
1162
1096
  async function client(ctx) {
1163
1097
  ctx.name = "client";
1164
1098
  ctx.isClient = true;
@@ -1264,9 +1198,6 @@ function clientPlugins(ctx) {
1264
1198
  if (!ctx.nuxt.options.test && (ctx.nuxt.options.typescript.typeCheck === true || ctx.nuxt.options.typescript.typeCheck === "build" && !ctx.nuxt.options.dev)) ctx.config.plugins.push(new TsCheckerPlugin({ logger }));
1265
1199
  }
1266
1200
  }
1267
-
1268
- //#endregion
1269
- //#region src/presets/node.ts
1270
1201
  function node(ctx) {
1271
1202
  ctx.config.target = "node";
1272
1203
  ctx.config.node = false;
@@ -1295,9 +1226,6 @@ function node(ctx) {
1295
1226
  maxAssetSize: Number.POSITIVE_INFINITY
1296
1227
  };
1297
1228
  }
1298
-
1299
- //#endregion
1300
- //#region src/configs/server.ts
1301
1229
  const assetPattern = /\.(?:css|s[ca]ss|png|jpe?g|gif|svg|woff2?|eot|ttf|otf|webp|webm|mp4|ogv)(?:\?.*)?$/i;
1302
1230
  const VIRTUAL_RE = /^\0?virtual:(?:nuxt:)?/;
1303
1231
  async function server(ctx) {
@@ -1390,120 +1318,118 @@ function serverPlugins(ctx) {
1390
1318
  }));
1391
1319
  if (!ctx.nuxt.options.test && (ctx.nuxt.options.typescript.typeCheck === true || ctx.nuxt.options.typescript.typeCheck === "build" && !ctx.nuxt.options.dev)) ctx.config.plugins.push(new TsCheckerPlugin({ logger }));
1392
1320
  }
1393
-
1394
- //#endregion
1395
- //#region src/webpack.ts
1396
- const bundle = async (nuxt$1) => {
1397
- const webpackConfigs = await Promise.all([client, ...nuxt$1.options.ssr ? [server] : []].map(async (preset) => {
1398
- const ctx = createWebpackConfigContext(nuxt$1);
1399
- ctx.userConfig = defu(nuxt$1.options.webpack[`$${preset.name}`], ctx.userConfig);
1321
+ const bundle = async (nuxt) => {
1322
+ const webpackConfigs = await Promise.all([client, ...nuxt.options.ssr ? [server] : []].map(async (preset) => {
1323
+ const ctx = createWebpackConfigContext(nuxt);
1324
+ ctx.userConfig = defu(nuxt.options.webpack[`$${preset.name}`], ctx.userConfig);
1400
1325
  await applyPresets(ctx, preset);
1401
1326
  return ctx.config;
1402
1327
  }));
1403
1328
  /** Remove Nitro rollup plugin for handling dynamic imports from webpack chunks */
1404
- if (!nuxt$1.options.dev) useNitro().hooks.hook("rollup:before", (_nitro, config) => {
1329
+ if (!nuxt.options.dev) useNitro().hooks.hook("rollup:before", (_nitro, config) => {
1405
1330
  const plugins = config.plugins;
1406
1331
  const existingPlugin = plugins.findIndex((i) => i && "name" in i && i.name === "dynamic-require");
1407
1332
  if (existingPlugin >= 0) plugins.splice(existingPlugin, 1);
1408
1333
  });
1409
- await nuxt$1.callHook(`${builder}:config`, webpackConfigs);
1410
- const mfs = nuxt$1.options.dev ? createMFS() : null;
1411
- const ssrStylesPlugin = nuxt$1.options.ssr && !nuxt$1.options.dev && nuxt$1.options.features.inlineStyles ? new SSRStylesPlugin(nuxt$1) : null;
1334
+ await nuxt.callHook(`${builder}:config`, webpackConfigs);
1335
+ const mfs = nuxt.options.dev ? createMFS() : null;
1336
+ const ssrStylesPlugin = nuxt.options.ssr && !nuxt.options.dev && nuxt.options.features.inlineStyles ? new SSRStylesPlugin(nuxt) : null;
1412
1337
  for (const config of webpackConfigs) {
1413
- config.plugins.push(DynamicBasePlugin.webpack({ sourcemap: !!nuxt$1.options.sourcemap[config.name] }));
1414
- if (config.name === "client" && nuxt$1.options.experimental.emitRouteChunkError && nuxt$1.options.builder !== "@nuxt/rspack-builder") config.plugins.push(new ChunkErrorPlugin());
1338
+ config.plugins.push(DynamicBasePlugin.webpack({ sourcemap: !!nuxt.options.sourcemap[config.name] }));
1339
+ if (config.name === "client" && nuxt.options.experimental.emitRouteChunkError && nuxt.options.builder !== "@nuxt/rspack-builder") config.plugins.push(new ChunkErrorPlugin());
1415
1340
  if (ssrStylesPlugin) config.plugins.push(ssrStylesPlugin);
1416
1341
  }
1417
- await nuxt$1.callHook(`${builder}:configResolved`, webpackConfigs);
1342
+ await nuxt.callHook(`${builder}:configResolved`, webpackConfigs);
1418
1343
  const compilers = webpackConfigs.map((config) => {
1419
1344
  const compiler = webpack(config);
1420
- if (nuxt$1.options.dev && compiler) compiler.outputFileSystem = mfs;
1345
+ if (nuxt.options.dev && compiler) compiler.outputFileSystem = mfs;
1421
1346
  return compiler;
1422
1347
  });
1423
- nuxt$1.hook("close", async () => {
1424
- for (const compiler of compilers) await new Promise((resolve$1) => compiler.close(resolve$1));
1348
+ nuxt.hook("close", async () => {
1349
+ for (const compiler of compilers) await new Promise((resolve) => compiler.close(resolve));
1425
1350
  });
1426
- if (nuxt$1.options.dev) {
1351
+ if (nuxt.options.dev) {
1427
1352
  await Promise.all(compilers.map((c) => compile(c)));
1428
1353
  return;
1429
1354
  }
1430
1355
  for (const c of compilers) await compile(c);
1431
1356
  };
1432
1357
  async function createDevMiddleware(compiler) {
1433
- const nuxt$1 = useNuxt();
1358
+ const nuxt = useNuxt();
1434
1359
  logger.debug("Creating webpack middleware...");
1435
1360
  const devMiddleware = webpackDevMiddleware(compiler, {
1436
- publicPath: joinURL(nuxt$1.options.app.baseURL, nuxt$1.options.app.buildAssetsDir),
1361
+ publicPath: joinURL(nuxt.options.app.baseURL, nuxt.options.app.buildAssetsDir),
1437
1362
  outputFileSystem: compiler.outputFileSystem,
1438
1363
  stats: "none",
1439
- ...nuxt$1.options.webpack.devMiddleware
1364
+ ...nuxt.options.webpack.devMiddleware
1440
1365
  });
1441
- nuxt$1.hook("close", () => pify(devMiddleware.close.bind(devMiddleware))());
1442
- const { client: _client, ...hotMiddlewareOptions } = nuxt$1.options.webpack.hotMiddleware || {};
1366
+ nuxt.hook("close", () => pify(devMiddleware.close.bind(devMiddleware))());
1367
+ const { client: _client, ...hotMiddlewareOptions } = nuxt.options.webpack.hotMiddleware || {};
1443
1368
  const hotMiddleware = webpackHotMiddleware(compiler, {
1444
1369
  log: false,
1445
1370
  heartbeat: 1e4,
1446
- path: joinURL(nuxt$1.options.app.baseURL, "__webpack_hmr", compiler.options.name),
1371
+ path: joinURL(nuxt.options.app.baseURL, "__webpack_hmr", compiler.options.name),
1447
1372
  ...hotMiddlewareOptions
1448
1373
  });
1449
1374
  const devHandler = wdmToH3Handler(devMiddleware);
1450
- await nuxt$1.callHook("server:devHandler", defineEventHandler(async (event) => {
1375
+ await nuxt.callHook("server:devHandler", defineEventHandler(async (event) => {
1451
1376
  const body = await devHandler(event);
1452
1377
  if (body !== void 0) return body;
1453
1378
  const { req, res } = "runtime" in event ? event.runtime.node : event.node;
1454
- await new Promise((resolve$1, reject) => hotMiddleware(req, res, (err) => err ? reject(err) : resolve$1()));
1379
+ await new Promise((resolve, reject) => hotMiddleware(req, res, (err) => err ? reject(err) : resolve()));
1455
1380
  }), { cors: () => true });
1456
1381
  return devMiddleware;
1457
1382
  }
1458
1383
  function wdmToH3Handler(devMiddleware) {
1459
1384
  return defineEventHandler(async (event) => {
1460
1385
  const { req, res } = "runtime" in event ? event.runtime.node : event.node;
1461
- if (req.headers["sec-fetch-mode"] === "no-cors" && req.headers["sec-fetch-site"] === "cross-site") throw {
1462
- status: 403,
1463
- unhandled: false
1464
- };
1386
+ if (req.headers["sec-fetch-mode"] === "no-cors" && req.headers["sec-fetch-site"] === "cross-site") {
1387
+ res.statusCode = 403;
1388
+ res.end("Forbidden");
1389
+ return;
1390
+ }
1465
1391
  event.context.webpack = {
1466
1392
  ...event.context.webpack,
1467
1393
  devMiddleware: devMiddleware.context
1468
1394
  };
1469
- return await new Promise((resolve$1, reject) => {
1395
+ return await new Promise((resolve, reject) => {
1470
1396
  res.stream = (stream) => {
1471
- resolve$1(stream);
1397
+ resolve(stream);
1472
1398
  };
1473
1399
  res.send = (data) => {
1474
- resolve$1(data);
1400
+ resolve(data);
1475
1401
  };
1476
1402
  res.finish = (data) => {
1477
- resolve$1(data);
1403
+ resolve(data);
1478
1404
  };
1479
1405
  devMiddleware(req, res, (err) => {
1480
1406
  if (err) reject(err);
1481
- else resolve$1(void 0);
1407
+ else resolve(void 0);
1482
1408
  });
1483
1409
  });
1484
1410
  });
1485
1411
  }
1486
1412
  async function compile(compiler) {
1487
- const nuxt$1 = useNuxt();
1488
- await nuxt$1.callHook(`${builder}:compile`, {
1413
+ const nuxt = useNuxt();
1414
+ await nuxt.callHook(`${builder}:compile`, {
1489
1415
  name: compiler.options.name,
1490
1416
  compiler
1491
1417
  });
1492
- compiler.hooks.done.tap("load-resources", async (stats$1) => {
1493
- await nuxt$1.callHook(`${builder}:compiled`, {
1418
+ compiler.hooks.done.tap("load-resources", async (stats) => {
1419
+ await nuxt.callHook(`${builder}:compiled`, {
1494
1420
  name: compiler.options.name,
1495
1421
  compiler,
1496
- stats: stats$1
1422
+ stats
1497
1423
  });
1498
1424
  });
1499
- if (nuxt$1.options.dev) {
1425
+ if (nuxt.options.dev) {
1500
1426
  const compilersWatching = [];
1501
- nuxt$1.hook("close", async () => {
1427
+ nuxt.hook("close", async () => {
1502
1428
  await Promise.all(compilersWatching.map((watching) => watching && pify(watching.close.bind(watching))()));
1503
1429
  });
1504
- if (compiler.options.name === "client") return new Promise((resolve$1, reject) => {
1430
+ if (compiler.options.name === "client") return new Promise((resolve, reject) => {
1505
1431
  compiler.hooks.done.tap("nuxt-dev", () => {
1506
- resolve$1(null);
1432
+ resolve(null);
1507
1433
  });
1508
1434
  compiler.hooks.failed.tap("nuxt-errorlog", (err) => {
1509
1435
  reject(err);
@@ -1512,15 +1438,15 @@ async function compile(compiler) {
1512
1438
  if (devMiddleware.context.watching) compilersWatching.push(devMiddleware.context.watching);
1513
1439
  });
1514
1440
  });
1515
- return new Promise((resolve$1, reject) => {
1516
- const watching = compiler.watch(nuxt$1.options.watchers.webpack, (err) => {
1441
+ return new Promise((resolve, reject) => {
1442
+ const watching = compiler.watch(nuxt.options.watchers.webpack, (err) => {
1517
1443
  if (err) return reject(err);
1518
- resolve$1(null);
1444
+ resolve(null);
1519
1445
  });
1520
1446
  compilersWatching.push(watching);
1521
1447
  });
1522
1448
  }
1523
- const stats = await new Promise((resolve$1, reject) => compiler.run((err, stats$1) => err ? reject(err) : resolve$1(stats$1)));
1449
+ const stats = await new Promise((resolve, reject) => compiler.run((err, stats) => err ? reject(err) : resolve(stats)));
1524
1450
  if (stats.hasErrors()) {
1525
1451
  const error = /* @__PURE__ */ new Error("Nuxt build error");
1526
1452
  error.stack = stats.toString("errors-only");
@@ -1530,6 +1456,4 @@ async function compile(compiler) {
1530
1456
  function defineEventHandler(handler) {
1531
1457
  return Object.assign(handler, { __is_handler__: true });
1532
1458
  }
1533
-
1534
- //#endregion
1535
- export { bundle };
1459
+ export { bundle };
@@ -1,6 +1,4 @@
1
1
  import { normalize, relative } from "pathe";
2
-
3
- //#region src/loaders/vue-module-identifier.ts
4
2
  const vueModuleIdentifierLoader = function(source) {
5
3
  this.cacheable?.();
6
4
  const { srcDir } = this.getOptions() || {};
@@ -10,7 +8,4 @@ const vueModuleIdentifierLoader = function(source) {
10
8
  const moduleId = normalize(context ? relative(context, resourcePath) : resourcePath).replace(/^\.\//, "").replace(/\\/g, "/");
11
9
  return source + `\n;__exports__.__moduleIdentifier = ${JSON.stringify(moduleId)};`;
12
10
  };
13
- var vue_module_identifier_default = vueModuleIdentifierLoader;
14
-
15
- //#endregion
16
- export { vue_module_identifier_default as default };
11
+ export { vueModuleIdentifierLoader as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder-nightly",
3
- "version": "4.4.0-29506647.0fa65fc3",
3
+ "version": "4.4.0-29532435.dd5ca638",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -25,10 +25,10 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
28
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.4.0-29506647.0fa65fc3",
29
- "@vue/compiler-sfc": "3.5.27",
30
- "autoprefixer": "^10.4.23",
31
- "css-loader": "^7.1.3",
28
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.4.0-29532435.dd5ca638",
29
+ "@vue/compiler-sfc": "3.5.28",
30
+ "autoprefixer": "^10.4.24",
31
+ "css-loader": "^7.1.4",
32
32
  "css-minimizer-webpack-plugin": "^7.0.4",
33
33
  "cssnano": "^7.1.2",
34
34
  "defu": "^6.1.4",
@@ -49,7 +49,7 @@
49
49
  "postcss": "^8.5.6",
50
50
  "postcss-import": "^16.1.1",
51
51
  "postcss-import-resolver": "^2.0.0",
52
- "postcss-loader": "^8.2.0",
52
+ "postcss-loader": "^8.2.1",
53
53
  "postcss-url": "^10.1.3",
54
54
  "pug-plain-loader": "^1.1.0",
55
55
  "seroval": "^1.5.0",
@@ -62,29 +62,29 @@
62
62
  "url-loader": "^4.1.1",
63
63
  "vue-bundle-renderer": "^2.2.0",
64
64
  "vue-loader": "^17.4.2",
65
- "webpack": "^5.104.1",
65
+ "webpack": "^5.105.2",
66
66
  "webpack-bundle-analyzer": "^5.2.0",
67
67
  "webpack-dev-middleware": "^7.4.5",
68
68
  "webpack-hot-middleware": "^2.26.1",
69
69
  "webpackbar": "^7.0.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.4.0-29506647.0fa65fc3",
73
- "@rspack/core": "1.7.3",
72
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.4.0-29532435.dd5ca638",
73
+ "@rspack/core": "1.7.6",
74
74
  "@types/webpack-bundle-analyzer": "4.7.0",
75
75
  "@types/webpack-hot-middleware": "2.25.12",
76
76
  "h3": "1.15.5",
77
- "h3-next": "npm:h3@2.0.1-rc.8",
78
- "obuild": "0.4.14",
79
- "rollup": "4.56.0",
80
- "vue": "3.5.27"
77
+ "h3-next": "npm:h3@2.0.1-rc.14",
78
+ "obuild": "0.4.31",
79
+ "rollup": "4.59.0",
80
+ "vue": "3.5.28"
81
81
  },
82
82
  "peerDependencies": {
83
- "nuxt": "npm:nuxt-nightly@4.4.0-29506647.0fa65fc3",
83
+ "nuxt": "npm:nuxt-nightly@4.4.0-29532435.dd5ca638",
84
84
  "vue": "^3.3.4"
85
85
  },
86
86
  "engines": {
87
- "node": "^20.19.0 || >=22.12.0"
87
+ "node": ">=22.12.0"
88
88
  },
89
89
  "_name": "@nuxt/webpack-builder",
90
90
  "scripts": {