@nuxt/webpack-builder-nightly 5.0.0-29662325.0fc06dfb → 5.0.0-29662437.89c933ea

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/dist/index.d.mts CHANGED
@@ -1,5 +1,7 @@
1
1
  import webpackDevMiddleware, { IncomingMessage, ServerResponse } from "webpack-dev-middleware";
2
2
  import { NuxtBuilder } from "@nuxt/schema";
3
+
4
+ //#region src/webpack.d.ts
3
5
  declare const bundle: NuxtBuilder["bundle"];
4
6
  declare module "srvx" {
5
7
  interface ServerRequestContext {
@@ -8,4 +10,5 @@ declare module "srvx" {
8
10
  };
9
11
  }
10
12
  }
13
+ //#endregion
11
14
  export { bundle };
package/dist/index.mjs CHANGED
@@ -31,6 +31,7 @@ import { normalizeWebpackManifest, precomputeDependencies } from "vue-bundle-ren
31
31
  import { hash } from "ohash";
32
32
  import { serialize } from "seroval";
33
33
  import { parseNodeModulePath } from "mlly";
34
+ //#region src/plugins/dynamic-base.ts
34
35
  const ENTRY_RE = /import ["']#build\/css["'];/;
35
36
  const DynamicBasePlugin = createUnplugin(() => {
36
37
  return {
@@ -49,6 +50,8 @@ const DynamicBasePlugin = createUnplugin(() => {
49
50
  }
50
51
  };
51
52
  });
53
+ //#endregion
54
+ //#region src/plugins/chunk.ts
52
55
  const pluginName = "ChunkErrorPlugin";
53
56
  var ChunkErrorPlugin = class {
54
57
  apply(compiler) {
@@ -80,6 +83,14 @@ if (typeof ${ensureChunk} !== "undefined") {
80
83
  `;
81
84
  }
82
85
  };
86
+ //#endregion
87
+ //#region ../nuxt/src/core/utils/plugins.ts
88
+ /**
89
+ * Split a bundler module ID into its pathname and search (query) parts.
90
+ *
91
+ * Module IDs from Vite/webpack are already-normalized filesystem paths
92
+ * that may carry query strings (e.g. `?vue&type=style&lang=css`).
93
+ */
83
94
  function parseModuleId(id) {
84
95
  const qIndex = id.indexOf("?");
85
96
  if (qIndex === -1) return {
@@ -91,6 +102,8 @@ function parseModuleId(id) {
91
102
  search: id.slice(qIndex)
92
103
  };
93
104
  }
105
+ //#endregion
106
+ //#region src/plugins/ssr-styles.ts
94
107
  const CSS_URL_RE = /url\((['"]?)(\/[^)]+?)\1\)/g;
95
108
  const isVueFile = (id) => /\.vue(?:\?|$)/.test(id);
96
109
  const isCSSLike = (name) => /\.(?:css|scss|sass|less|styl(?:us)?|postcss|pcss)(?:\?|$)/.test(name);
@@ -403,6 +416,8 @@ var SSRStylesPlugin = class {
403
416
  return cssChunks;
404
417
  }
405
418
  };
419
+ //#endregion
420
+ //#region src/utils/mfs.ts
406
421
  function createMFS() {
407
422
  const _fs = { ...createFsFromVolume(new Volume()) };
408
423
  _fs.join = join;
@@ -410,9 +425,14 @@ function createMFS() {
410
425
  _fs.readFile = pify(_fs.readFile);
411
426
  return _fs;
412
427
  }
428
+ //#endregion
429
+ //#region src/utils/index.ts
430
+ /** @since 3.9.0 */
413
431
  function toArray(value) {
414
432
  return Array.isArray(value) ? value : [value];
415
433
  }
434
+ //#endregion
435
+ //#region src/utils/config.ts
416
436
  function createWebpackConfigContext(nuxt) {
417
437
  return {
418
438
  nuxt,
@@ -440,6 +460,8 @@ function fileName(ctx, key) {
440
460
  }
441
461
  return fileName;
442
462
  }
463
+ //#endregion
464
+ //#region src/presets/assets.ts
443
465
  function assets(ctx) {
444
466
  ctx.config.module.rules.push({
445
467
  test: /\.(png|jpe?g|gif|svg|webp)$/i,
@@ -470,6 +492,8 @@ function assets(ctx) {
470
492
  }]
471
493
  });
472
494
  }
495
+ //#endregion
496
+ //#region src/plugins/warning-ignore.ts
473
497
  var WarningIgnorePlugin = class {
474
498
  filter;
475
499
  constructor(filter) {
@@ -481,6 +505,12 @@ var WarningIgnorePlugin = class {
481
505
  });
482
506
  }
483
507
  };
508
+ //#endregion
509
+ //#region src/plugins/vue/util.ts
510
+ /**
511
+ * This file is based on Vue.js (MIT) webpack plugins
512
+ * https://github.com/vuejs/vue/blob/dev/src/server/webpack-plugin/util.js
513
+ */
484
514
  const validate = (compiler) => {
485
515
  if (compiler.options.target !== "node") logger.warn("webpack config `target` should be \"node\".");
486
516
  if (!compiler.options.externals) logger.info("It is recommended to externalize dependencies in the server build for better build performance.");
@@ -491,10 +521,17 @@ const extractQueryPartJS = (file) => isJSRegExp.exec(file)?.[1];
491
521
  const isCSSRegExp = /\.css(?:\?[^.]+)?$/;
492
522
  const isCSS = (file) => isCSSRegExp.test(file);
493
523
  const isHotUpdate = (file) => file.includes("hot-update");
524
+ //#endregion
525
+ //#region src/plugins/rollup-compat-dynamic-import.ts
494
526
  const DYNAMIC_IMPORT_RE = /import\([^)]*\+\s*__webpack_require__[^+]*\)\.then/;
495
527
  const DYNAMIC_IMPORT_REPLACE_RE = /import\([^)]*\+\s*(__webpack_require__[^+]*)\)\.then/g;
496
528
  const HELPER_FILENAME = "_dynamic-import-helper.mjs";
497
529
  const HELPER_IMPORT = `import { _rollupDynamicImport } from "./${HELPER_FILENAME}";\n`;
530
+ /**
531
+ * Webpack plugin that generates rollup-compatible dynamic imports.
532
+ * This plugin uses webpack's native compilation hooks to override dynamic import generation
533
+ * and create rollup-compatible code directly during webpack's compilation process.
534
+ */
498
535
  var RollupCompatDynamicImportPlugin = class {
499
536
  apply(compiler) {
500
537
  compiler.hooks.compilation.tap("RollupCompatDynamicImportPlugin", (compilation) => {
@@ -562,6 +599,8 @@ export function _rollupDynamicImport(chunkId) {
562
599
  `;
563
600
  }
564
601
  };
602
+ //#endregion
603
+ //#region src/presets/base.ts
565
604
  async function base(ctx) {
566
605
  await applyPresets(ctx, [
567
606
  baseAlias,
@@ -741,6 +780,8 @@ const statsMap = {
741
780
  info: "normal",
742
781
  verbose: "verbose"
743
782
  };
783
+ //#endregion
784
+ //#region src/presets/esbuild.ts
744
785
  function esbuild(ctx) {
745
786
  const target = ctx.isServer ? "es2020" : "chrome85";
746
787
  ctx.config.optimization.minimizer.push(new EsbuildPlugin());
@@ -768,6 +809,8 @@ function esbuild(ctx) {
768
809
  }
769
810
  });
770
811
  }
812
+ //#endregion
813
+ //#region src/presets/pug.ts
771
814
  function pug(ctx) {
772
815
  ctx.config.module.rules.push({
773
816
  test: /\.pug$/i,
@@ -783,6 +826,8 @@ function pug(ctx) {
783
826
  }] }]
784
827
  });
785
828
  }
829
+ //#endregion
830
+ //#region src/utils/postcss.ts
786
831
  const isPureObject = (obj) => obj !== null && !Array.isArray(obj) && typeof obj === "object";
787
832
  function sortPlugins({ plugins, order }) {
788
833
  const names = Object.keys(plugins);
@@ -794,10 +839,16 @@ async function getPostcssConfig(nuxt) {
794
839
  plugins: {
795
840
  "autoprefixer": {},
796
841
  "cssnano": nuxt.options.dev ? false : {},
842
+ /**
843
+ * https://github.com/postcss/postcss-import
844
+ */
797
845
  "postcss-import": { resolve: createResolver({
798
846
  alias: { ...nuxt.options.alias },
799
847
  modules: nuxt.options.modulesDir
800
848
  }) },
849
+ /**
850
+ * https://github.com/postcss/postcss-url
851
+ */
801
852
  "postcss-url": {}
802
853
  },
803
854
  sourceMap: nuxt.options.webpack.cssSourceMap
@@ -830,6 +881,8 @@ async function getPostcssConfig(nuxt) {
830
881
  postcssOptions
831
882
  };
832
883
  }
884
+ //#endregion
885
+ //#region src/presets/style.ts
833
886
  async function style(ctx) {
834
887
  await applyPresets(ctx, [
835
888
  loaders,
@@ -909,6 +962,12 @@ async function createPostcssLoadersRule(ctx) {
909
962
  options: config
910
963
  };
911
964
  }
965
+ //#endregion
966
+ //#region src/plugins/vue/client.ts
967
+ /**
968
+ * This file is based on Vue.js (MIT) webpack plugins
969
+ * https://github.com/vuejs/vue/blob/dev/src/server/webpack-plugin/client.js
970
+ */
912
971
  var VueSSRClientPlugin = class {
913
972
  serverDist;
914
973
  nuxt;
@@ -1013,6 +1072,8 @@ var VueSSRClientPlugin = class {
1013
1072
  });
1014
1073
  }
1015
1074
  };
1075
+ //#endregion
1076
+ //#region src/plugins/vue/server.ts
1016
1077
  const JS_MAP_RE = /\.js\.map$/;
1017
1078
  var VueSSRServerPlugin = class {
1018
1079
  options;
@@ -1064,6 +1125,8 @@ var VueSSRServerPlugin = class {
1064
1125
  });
1065
1126
  }
1066
1127
  };
1128
+ //#endregion
1129
+ //#region src/presets/vue.ts
1067
1130
  function vue(ctx) {
1068
1131
  ctx.nuxt.hooks.hookOnce(`${builder}:config`, () => {
1069
1132
  ctx.nuxt.hook(`${builder}:configResolved`, (configs) => {
@@ -1097,6 +1160,8 @@ function vue(ctx) {
1097
1160
  "__VUE_PROD_HYDRATION_MISMATCH_DETAILS__": ctx.nuxt.options.debug && ctx.nuxt.options.debug.hydration
1098
1161
  }));
1099
1162
  }
1163
+ //#endregion
1164
+ //#region src/presets/nuxt.ts
1100
1165
  async function nuxt(ctx) {
1101
1166
  await applyPresets(ctx, [
1102
1167
  base,
@@ -1107,6 +1172,8 @@ async function nuxt(ctx) {
1107
1172
  vue
1108
1173
  ]);
1109
1174
  }
1175
+ //#endregion
1176
+ //#region src/configs/client.ts
1110
1177
  async function client(ctx) {
1111
1178
  ctx.name = "client";
1112
1179
  ctx.isClient = true;
@@ -1212,6 +1279,8 @@ function clientPlugins(ctx) {
1212
1279
  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 }));
1213
1280
  }
1214
1281
  }
1282
+ //#endregion
1283
+ //#region src/presets/node.ts
1215
1284
  function node(ctx) {
1216
1285
  ctx.config.target = "node";
1217
1286
  ctx.config.node = false;
@@ -1240,6 +1309,8 @@ function node(ctx) {
1240
1309
  maxAssetSize: Number.POSITIVE_INFINITY
1241
1310
  };
1242
1311
  }
1312
+ //#endregion
1313
+ //#region src/configs/server.ts
1243
1314
  const assetPattern = /\.(?:css|s[ca]ss|png|jpe?g|gif|svg|woff2?|eot|ttf|otf|webp|webm|mp4|ogv)(?:\?.*)?$/i;
1244
1315
  const VIRTUAL_RE = /^\0?virtual:(?:nuxt:)?/;
1245
1316
  async function server(ctx) {
@@ -1332,6 +1403,8 @@ function serverPlugins(ctx) {
1332
1403
  }));
1333
1404
  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 }));
1334
1405
  }
1406
+ //#endregion
1407
+ //#region src/webpack.ts
1335
1408
  const bundle = async (nuxt) => {
1336
1409
  const webpackConfigs = await Promise.all([client, ...nuxt.options.ssr ? [server] : []].map(async (preset) => {
1337
1410
  const ctx = createWebpackConfigContext(nuxt);
@@ -1339,6 +1412,7 @@ const bundle = async (nuxt) => {
1339
1412
  await applyPresets(ctx, preset);
1340
1413
  return ctx.config;
1341
1414
  }));
1415
+ /** Remove Nitro rollup plugin for handling dynamic imports from webpack chunks */
1342
1416
  if (!nuxt.options.dev) useNitro().hooks.hook("rollup:before", (_nitro, config) => {
1343
1417
  const plugins = config.plugins;
1344
1418
  const existingPlugin = plugins.findIndex((i) => i && "name" in i && i.name === "dynamic-require");
@@ -1479,4 +1553,5 @@ async function compile(compiler) {
1479
1553
  function defineEventHandler(handler) {
1480
1554
  return Object.assign(handler, { __is_handler__: true });
1481
1555
  }
1556
+ //#endregion
1482
1557
  export { bundle };
@@ -0,0 +1,9 @@
1
+ import { LoaderDefinitionFunction } from "webpack";
2
+
3
+ //#region src/loaders/vue-module-identifier.d.ts
4
+ interface LoaderOptions {
5
+ srcDir?: string;
6
+ }
7
+ declare const vueModuleIdentifierLoader: LoaderDefinitionFunction<LoaderOptions>;
8
+ //#endregion
9
+ export { vueModuleIdentifierLoader as default };
@@ -1,4 +1,5 @@
1
1
  import { normalize, relative } from "pathe";
2
+ //#region src/loaders/vue-module-identifier.ts
2
3
  const vueModuleIdentifierLoader = function(source) {
3
4
  this.cacheable?.();
4
5
  const { srcDir } = this.getOptions() || {};
@@ -8,4 +9,5 @@ const vueModuleIdentifierLoader = function(source) {
8
9
  const moduleId = normalize(context ? relative(context, resourcePath) : resourcePath).replace(/^\.\//, "").replace(/\\/g, "/");
9
10
  return source + `\n;__exports__.__moduleIdentifier = ${JSON.stringify(moduleId)};`;
10
11
  };
12
+ //#endregion
11
13
  export { vueModuleIdentifierLoader as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder-nightly",
3
- "version": "5.0.0-29662325.0fc06dfb",
3
+ "version": "5.0.0-29662437.89c933ea",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -17,7 +17,8 @@
17
17
  },
18
18
  "exports": {
19
19
  ".": "./dist/index.mjs",
20
- "./dist/*": "./dist/*"
20
+ "./dist/*": "./dist/*",
21
+ "./package.json": "./package.json"
21
22
  },
22
23
  "files": [
23
24
  "dist",
@@ -25,7 +26,7 @@
25
26
  ],
26
27
  "dependencies": {
27
28
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
28
- "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29662325.0fc06dfb",
29
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29662437.89c933ea",
29
30
  "@vue/compiler-sfc": "3.5.34",
30
31
  "autoprefixer": "^10.5.0",
31
32
  "css-loader": "^7.1.4",
@@ -68,18 +69,18 @@
68
69
  "webpackbar": "^7.0.0"
69
70
  },
70
71
  "devDependencies": {
71
- "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29662325.0fc06dfb",
72
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29662437.89c933ea",
72
73
  "@rspack/core": "2.0.4",
73
74
  "@types/webpack-bundle-analyzer": "4.7.0",
74
75
  "@types/webpack-hot-middleware": "2.25.12",
75
76
  "h3": "1.15.11",
76
77
  "h3-next": "npm:h3@2.0.1-rc.22",
77
- "obuild": "0.4.36",
78
78
  "rollup": "4.60.4",
79
+ "tsdown": "0.22.0",
79
80
  "vue": "3.5.34"
80
81
  },
81
82
  "peerDependencies": {
82
- "nuxt": "npm:nuxt-nightly@5.0.0-29662325.0fc06dfb",
83
+ "nuxt": "npm:nuxt-nightly@5.0.0-29662437.89c933ea",
83
84
  "vue": "^3.3.4"
84
85
  },
85
86
  "engines": {
@@ -87,7 +88,7 @@
87
88
  },
88
89
  "_name": "@nuxt/webpack-builder",
89
90
  "scripts": {
90
- "build:stub": "obuild --stub",
91
+ "build": "tsdown",
91
92
  "test:attw": "attw --pack"
92
93
  }
93
94
  }