@nuxt/webpack-builder 3.11.2 → 3.12.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.
- package/README.md +9 -1
- package/dist/index.mjs +70 -53
- package/package.json +15 -14
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ It provides a number of features that make it easy to build fast, SEO-friendly,
|
|
|
33
33
|
- ❤️ [Contribute](#contribute)
|
|
34
34
|
- 🏠 [Local Development](#local-development)
|
|
35
35
|
- ⛰️ [Nuxt 2](#nuxt-2)
|
|
36
|
+
- 🛟 [Professional Support](#professional-support)
|
|
36
37
|
- 🔗 [Follow us](#follow-us)
|
|
37
38
|
- ⚖️ [License](#license)
|
|
38
39
|
|
|
@@ -93,7 +94,7 @@ We invite you to contribute and help improve Nuxt 💚
|
|
|
93
94
|
|
|
94
95
|
Here are a few ways you can get involved:
|
|
95
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.
|
|
96
|
-
- **Suggestions:** Have ideas to enhance Nuxt? We'd love to hear them! Check out the [contribution guide](https://nuxt.com/docs/community/contribution
|
|
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.
|
|
97
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.
|
|
98
99
|
|
|
99
100
|
## <a name="local-development">🏠 Local Development</a>
|
|
@@ -104,6 +105,13 @@ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/
|
|
|
104
105
|
|
|
105
106
|
You can find the code for Nuxt 2 on the [`2.x` branch](https://github.com/nuxt/nuxt/tree/2.x) and the documentation at [v2.nuxt.com](https://v2.nuxt.com).
|
|
106
107
|
|
|
108
|
+
If you expect to be using Nuxt 2 beyond the EOL (End of Life) date (June 30, 2024), and still need a maintained version that can satisfy security and browser compatibility requirements, make sure to check out [HeroDevs’ NES (Never-Ending Support) Nuxt 2](https://www.herodevs.com/support/nuxt-nes?utm_source=nuxt-github&utm_medium=nuxt-readme).
|
|
109
|
+
|
|
110
|
+
## <a name="professional-support">🛟 Professional Support</a>
|
|
111
|
+
|
|
112
|
+
- Technical audit & consulting: [Nuxt Experts](https://nuxt.com/enterprise/support)
|
|
113
|
+
- Custom development & more: [Nuxt Agencies Partners](https://nuxt.com/enterprise/agencies)
|
|
114
|
+
|
|
107
115
|
## <a name="follow-us">🔗 Follow us</a>
|
|
108
116
|
|
|
109
117
|
<p valign="center">
|
package/dist/index.mjs
CHANGED
|
@@ -50,8 +50,8 @@ var __publicField$3 = (obj, key, value) => {
|
|
|
50
50
|
return value;
|
|
51
51
|
};
|
|
52
52
|
const stringTypes = ["Literal", "TemplateLiteral"];
|
|
53
|
-
const NUXT_LIB_RE = /node_modules\/(nuxt|nuxt3|nuxt-nightly)\//;
|
|
54
|
-
const SUPPORTED_EXT_RE = /\.(m?[jt]sx?|vue)/;
|
|
53
|
+
const NUXT_LIB_RE = /node_modules\/(?:nuxt|nuxt3|nuxt-nightly)\//;
|
|
54
|
+
const SUPPORTED_EXT_RE = /\.(?:m?[jt]sx?|vue)/;
|
|
55
55
|
const composableKeysPlugin = createUnplugin((options) => {
|
|
56
56
|
const composableMeta = {};
|
|
57
57
|
for (const { name, ...meta } of options.composables) {
|
|
@@ -71,7 +71,7 @@ const composableKeysPlugin = createUnplugin((options) => {
|
|
|
71
71
|
if (!KEYED_FUNCTIONS_RE.test(code)) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
const { 0: script = code, index: codeIndex = 0 } = code.match(/(?<=<script[^>]*>)[\S
|
|
74
|
+
const { 0: script = code, index: codeIndex = 0 } = code.match(/(?<=<script[^>]*>)[\s\S]*?(?=<\/script>)/) || { index: 0, 0: code };
|
|
75
75
|
const s = new MagicString(code);
|
|
76
76
|
let imports;
|
|
77
77
|
let count = 0;
|
|
@@ -335,7 +335,7 @@ function registerVirtualModules() {
|
|
|
335
335
|
const virtualModules = new VirtualModulesPlugin(nuxt.vfs);
|
|
336
336
|
const writeFiles = () => {
|
|
337
337
|
for (const filePath in nuxt.vfs) {
|
|
338
|
-
virtualModules.writeModule(filePath, nuxt.vfs[filePath]);
|
|
338
|
+
virtualModules.writeModule(filePath, nuxt.vfs[filePath] || "");
|
|
339
339
|
}
|
|
340
340
|
};
|
|
341
341
|
nuxt.hook("webpack:compile", ({ compiler }) => {
|
|
@@ -382,7 +382,7 @@ function fileName(ctx, key) {
|
|
|
382
382
|
fileName2 = fileName2(ctx);
|
|
383
383
|
}
|
|
384
384
|
if (typeof fileName2 === "string" && ctx.options.dev) {
|
|
385
|
-
const hash = /\[(chunkhash|contenthash|hash)(
|
|
385
|
+
const hash = /\[(chunkhash|contenthash|hash)(?::\d+)?\]/.exec(fileName2);
|
|
386
386
|
if (hash) {
|
|
387
387
|
logger.warn(`Notice: Please do not use ${hash[1]} in dev mode to prevent memory leak`);
|
|
388
388
|
}
|
|
@@ -431,7 +431,7 @@ function assets(ctx) {
|
|
|
431
431
|
var __defProp$2 = Object.defineProperty;
|
|
432
432
|
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
433
433
|
var __publicField$2 = (obj, key, value) => {
|
|
434
|
-
__defNormalProp$2(obj,
|
|
434
|
+
__defNormalProp$2(obj, key + "" , value);
|
|
435
435
|
return value;
|
|
436
436
|
};
|
|
437
437
|
class WarningIgnorePlugin {
|
|
@@ -605,8 +605,8 @@ function getWarningIgnoreFilter(ctx) {
|
|
|
605
605
|
function getEnv(ctx) {
|
|
606
606
|
const _env = {
|
|
607
607
|
"process.env.NODE_ENV": JSON.stringify(ctx.config.mode),
|
|
608
|
-
__NUXT_VERSION__: JSON.stringify(ctx.nuxt._version),
|
|
609
|
-
__NUXT_ASYNC_CONTEXT__: ctx.options.experimental.asyncContext,
|
|
608
|
+
"__NUXT_VERSION__": JSON.stringify(ctx.nuxt._version),
|
|
609
|
+
"__NUXT_ASYNC_CONTEXT__": ctx.options.experimental.asyncContext,
|
|
610
610
|
"process.env.VUE_ENV": JSON.stringify(ctx.name),
|
|
611
611
|
"process.dev": ctx.options.dev,
|
|
612
612
|
"process.test": isTest,
|
|
@@ -639,11 +639,11 @@ function esbuild(ctx) {
|
|
|
639
639
|
test: /\.m?[jt]s$/i,
|
|
640
640
|
loader: "esbuild-loader",
|
|
641
641
|
exclude: (file) => {
|
|
642
|
-
|
|
643
|
-
if (!
|
|
642
|
+
const lastSegment = file.split("node_modules", 2)[1];
|
|
643
|
+
if (!lastSegment) {
|
|
644
644
|
return false;
|
|
645
645
|
}
|
|
646
|
-
return !ctx.transpile.some((module) => module.test(
|
|
646
|
+
return !ctx.transpile.some((module) => module.test(lastSegment));
|
|
647
647
|
},
|
|
648
648
|
resolve: {
|
|
649
649
|
fullySpecified: false
|
|
@@ -691,21 +691,17 @@ function pug(ctx) {
|
|
|
691
691
|
}
|
|
692
692
|
|
|
693
693
|
const isPureObject = (obj) => obj !== null && !Array.isArray(obj) && typeof obj === "object";
|
|
694
|
+
const ensureItemIsLast = (item) => (arr) => {
|
|
695
|
+
const index = arr.indexOf(item);
|
|
696
|
+
if (index !== -1) {
|
|
697
|
+
arr.splice(index, 1);
|
|
698
|
+
arr.push(item);
|
|
699
|
+
}
|
|
700
|
+
return arr;
|
|
701
|
+
};
|
|
694
702
|
const orderPresets = {
|
|
695
|
-
cssnanoLast(
|
|
696
|
-
|
|
697
|
-
if (nanoIndex !== names.length - 1) {
|
|
698
|
-
names.push(names.splice(nanoIndex, 1)[0]);
|
|
699
|
-
}
|
|
700
|
-
return names;
|
|
701
|
-
},
|
|
702
|
-
autoprefixerLast(names) {
|
|
703
|
-
const nanoIndex = names.indexOf("autoprefixer");
|
|
704
|
-
if (nanoIndex !== names.length - 1) {
|
|
705
|
-
names.push(names.splice(nanoIndex, 1)[0]);
|
|
706
|
-
}
|
|
707
|
-
return names;
|
|
708
|
-
},
|
|
703
|
+
cssnanoLast: ensureItemIsLast("cssnano"),
|
|
704
|
+
autoprefixerLast: ensureItemIsLast("autoprefixer"),
|
|
709
705
|
autoprefixerAndCssnanoLast(names) {
|
|
710
706
|
return orderPresets.cssnanoLast(orderPresets.autoprefixerLast(names));
|
|
711
707
|
}
|
|
@@ -774,13 +770,16 @@ function minimizer(ctx) {
|
|
|
774
770
|
}
|
|
775
771
|
}
|
|
776
772
|
function extractCSS(ctx) {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
chunkFilename: fileName(ctx, "css"),
|
|
781
|
-
...ctx.userConfig.extractCSS === true ? {} : ctx.userConfig.extractCSS
|
|
782
|
-
}));
|
|
773
|
+
const config = ctx.userConfig.extractCSS;
|
|
774
|
+
if (!config) {
|
|
775
|
+
return;
|
|
783
776
|
}
|
|
777
|
+
const filename = fileName(ctx, "css");
|
|
778
|
+
ctx.config.plugins.push(new MiniCssExtractPlugin({
|
|
779
|
+
filename,
|
|
780
|
+
chunkFilename: filename,
|
|
781
|
+
...config === true ? {} : config
|
|
782
|
+
}));
|
|
784
783
|
}
|
|
785
784
|
function loaders(ctx) {
|
|
786
785
|
ctx.config.module.rules.push(createdStyleRule("css", /\.css$/i, null, ctx));
|
|
@@ -869,18 +868,15 @@ const validate = (compiler) => {
|
|
|
869
868
|
const isJSRegExp = /\.[cm]?js(\?[^.]+)?$/;
|
|
870
869
|
const isJS = (file) => isJSRegExp.test(file);
|
|
871
870
|
const extractQueryPartJS = (file) => isJSRegExp.exec(file)?.[1];
|
|
872
|
-
const isCSS = (file) => /\.css(
|
|
871
|
+
const isCSS = (file) => /\.css(?:\?[^.]+)?$/.test(file);
|
|
873
872
|
const isHotUpdate = (file) => file.includes("hot-update");
|
|
874
873
|
|
|
875
874
|
var __defProp$1 = Object.defineProperty;
|
|
876
875
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
877
876
|
var __publicField$1 = (obj, key, value) => {
|
|
878
|
-
__defNormalProp$1(obj,
|
|
877
|
+
__defNormalProp$1(obj, key + "" , value);
|
|
879
878
|
return value;
|
|
880
879
|
};
|
|
881
|
-
function uniq(items) {
|
|
882
|
-
return [...new Set(items)];
|
|
883
|
-
}
|
|
884
880
|
class VueSSRClientPlugin {
|
|
885
881
|
constructor(options) {
|
|
886
882
|
__publicField$1(this, "options");
|
|
@@ -891,22 +887,43 @@ class VueSSRClientPlugin {
|
|
|
891
887
|
apply(compiler) {
|
|
892
888
|
compiler.hooks.afterEmit.tap("VueSSRClientPlugin", async (compilation) => {
|
|
893
889
|
const stats = compilation.getStats().toJson();
|
|
894
|
-
const
|
|
895
|
-
const
|
|
896
|
-
|
|
890
|
+
const initialFiles = /* @__PURE__ */ new Set();
|
|
891
|
+
for (const name in stats.entrypoints) {
|
|
892
|
+
const entryAssets = stats.entrypoints[name].assets;
|
|
893
|
+
for (const asset of entryAssets) {
|
|
894
|
+
const file = asset.name;
|
|
895
|
+
if ((isJS(file) || isCSS(file)) && !isHotUpdate(file)) {
|
|
896
|
+
initialFiles.add(file);
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
const allFiles = /* @__PURE__ */ new Set();
|
|
901
|
+
const asyncFiles = /* @__PURE__ */ new Set();
|
|
902
|
+
for (const asset of stats.assets) {
|
|
903
|
+
const file = asset.name;
|
|
904
|
+
if (!isHotUpdate(file)) {
|
|
905
|
+
allFiles.add(file);
|
|
906
|
+
if (initialFiles.has(file)) {
|
|
907
|
+
continue;
|
|
908
|
+
}
|
|
909
|
+
if (isJS(file) || isCSS(file)) {
|
|
910
|
+
asyncFiles.add(file);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
897
914
|
const assetsMapping = {};
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
assetsMapping[componentHash] = [];
|
|
915
|
+
for (const { name, chunkNames = [] } of stats.assets) {
|
|
916
|
+
if (isJS(name) && !isHotUpdate(name)) {
|
|
917
|
+
const componentHash = hash$1(chunkNames.join("|"));
|
|
918
|
+
const map = assetsMapping[componentHash] || (assetsMapping[componentHash] = []);
|
|
919
|
+
map.push(name);
|
|
902
920
|
}
|
|
903
|
-
|
|
904
|
-
});
|
|
921
|
+
}
|
|
905
922
|
const webpackManifest = {
|
|
906
923
|
publicPath: stats.publicPath,
|
|
907
|
-
all: allFiles,
|
|
908
|
-
initial: initialFiles,
|
|
909
|
-
async: asyncFiles,
|
|
924
|
+
all: [...allFiles],
|
|
925
|
+
initial: [...initialFiles],
|
|
926
|
+
async: [...asyncFiles],
|
|
910
927
|
modules: {
|
|
911
928
|
/* [identifier: string]: Array<index: number> */
|
|
912
929
|
},
|
|
@@ -919,7 +936,7 @@ class VueSSRClientPlugin {
|
|
|
919
936
|
if (m.chunks.length === 1) {
|
|
920
937
|
const [cid] = m.chunks;
|
|
921
938
|
const chunk = stats.chunks.find((c) => c.id === cid);
|
|
922
|
-
if (!chunk || !chunk.files) {
|
|
939
|
+
if (!chunk || !chunk.files || !cid) {
|
|
923
940
|
return;
|
|
924
941
|
}
|
|
925
942
|
const id = m.identifier.replace(/\s\w+$/, "");
|
|
@@ -965,7 +982,7 @@ class VueSSRClientPlugin {
|
|
|
965
982
|
var __defProp = Object.defineProperty;
|
|
966
983
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
967
984
|
var __publicField = (obj, key, value) => {
|
|
968
|
-
__defNormalProp(obj,
|
|
985
|
+
__defNormalProp(obj, key + "" , value);
|
|
969
986
|
return value;
|
|
970
987
|
};
|
|
971
988
|
const JS_MAP_RE = /\.js\.map$/;
|
|
@@ -1190,12 +1207,12 @@ function node(ctx) {
|
|
|
1190
1207
|
ctx.config.performance = {
|
|
1191
1208
|
...ctx.config.performance,
|
|
1192
1209
|
hints: false,
|
|
1193
|
-
maxEntrypointSize:
|
|
1194
|
-
maxAssetSize:
|
|
1210
|
+
maxEntrypointSize: Number.POSITIVE_INFINITY,
|
|
1211
|
+
maxAssetSize: Number.POSITIVE_INFINITY
|
|
1195
1212
|
};
|
|
1196
1213
|
}
|
|
1197
1214
|
|
|
1198
|
-
const assetPattern = /\.(css|s[ca]ss|png|jpe?g|gif|svg|woff2?|eot|ttf|otf|webp|webm|mp4|ogv)(
|
|
1215
|
+
const assetPattern = /\.(?:css|s[ca]ss|png|jpe?g|gif|svg|woff2?|eot|ttf|otf|webp|webm|mp4|ogv)(?:\?.*)?$/i;
|
|
1199
1216
|
function server(ctx) {
|
|
1200
1217
|
ctx.name = "server";
|
|
1201
1218
|
ctx.isServer = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/webpack-builder",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
|
|
26
26
|
"autoprefixer": "^10.4.19",
|
|
27
|
-
"css-loader": "^
|
|
28
|
-
"css-minimizer-webpack-plugin": "^
|
|
29
|
-
"cssnano": "^
|
|
27
|
+
"css-loader": "^7.1.2",
|
|
28
|
+
"css-minimizer-webpack-plugin": "^7.0.0",
|
|
29
|
+
"cssnano": "^7.0.2",
|
|
30
30
|
"defu": "^6.1.4",
|
|
31
31
|
"esbuild-loader": "^4.1.0",
|
|
32
32
|
"escape-string-regexp": "^5.0.0",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"h3": "^1.11.1",
|
|
38
38
|
"hash-sum": "^2.0.0",
|
|
39
39
|
"lodash-es": "4.17.21",
|
|
40
|
-
"magic-string": "^0.30.
|
|
41
|
-
"memfs": "^4.
|
|
42
|
-
"mini-css-extract-plugin": "^2.
|
|
43
|
-
"mlly": "^1.
|
|
40
|
+
"magic-string": "^0.30.10",
|
|
41
|
+
"memfs": "^4.9.2",
|
|
42
|
+
"mini-css-extract-plugin": "^2.9.0",
|
|
43
|
+
"mlly": "^1.7.1",
|
|
44
44
|
"ohash": "^1.1.3",
|
|
45
45
|
"pathe": "^1.1.2",
|
|
46
46
|
"pify": "^6.1.0",
|
|
@@ -56,26 +56,27 @@
|
|
|
56
56
|
"unenv": "^1.9.0",
|
|
57
57
|
"unplugin": "^1.10.1",
|
|
58
58
|
"url-loader": "^4.1.1",
|
|
59
|
-
"vue-bundle-renderer": "^2.
|
|
59
|
+
"vue-bundle-renderer": "^2.1.0",
|
|
60
60
|
"vue-loader": "^17.4.2",
|
|
61
61
|
"webpack": "^5.91.0",
|
|
62
|
-
"webpack-bundle-analyzer": "^4.10.
|
|
62
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
63
63
|
"webpack-dev-middleware": "^7.2.1",
|
|
64
64
|
"webpack-hot-middleware": "^2.26.1",
|
|
65
|
-
"webpack-virtual-modules": "^0.6.
|
|
65
|
+
"webpack-virtual-modules": "^0.6.2",
|
|
66
66
|
"webpackbar": "^6.0.1",
|
|
67
|
-
"@nuxt/kit": "3.
|
|
67
|
+
"@nuxt/kit": "3.12.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/fs-extra": "11.0.4",
|
|
71
71
|
"@types/hash-sum": "1.0.2",
|
|
72
|
+
"@types/lodash-es": "4.17.12",
|
|
72
73
|
"@types/pify": "5.0.4",
|
|
73
74
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
74
75
|
"@types/webpack-hot-middleware": "2.25.9",
|
|
75
76
|
"@types/webpack-virtual-modules": "0.4.2",
|
|
76
77
|
"unbuild": "latest",
|
|
77
|
-
"vue": "3.4.
|
|
78
|
-
"@nuxt/schema": "3.
|
|
78
|
+
"vue": "3.4.27",
|
|
79
|
+
"@nuxt/schema": "3.12.0"
|
|
79
80
|
},
|
|
80
81
|
"peerDependencies": {
|
|
81
82
|
"vue": "^3.3.4"
|