@nuxt/webpack-builder 3.0.0 → 3.1.1

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 (4) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +126 -3
  3. package/dist/index.mjs +24 -12
  4. package/package.json +23 -23
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- MIT License
1
+ The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 - Nuxt Project
3
+ Copyright (c) 2016-present - Nuxt Team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,5 +1,128 @@
1
- # Nuxt Webpack Builder
2
1
 
3
- > The [Webpack](https://webpack.js.org) bundler for Nuxt 3
2
+ [![Nuxt banner](./.github/assets/banner.png)](https://nuxt.com)
3
+
4
+ # 👋 Welcome to Nuxt
5
+
6
+
7
+ Nuxt's goal is to make web development intuitive and performant, with a great developer experience.<br>Learn more in the ['What is Nuxt?'](https://nuxt.com/docs/getting-started/introduction) section of our documentation.
8
+
9
+
10
+ <p>
11
+ <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>
12
+ <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>
13
+ <a href="./LICENSE"><img src="https://img.shields.io/github/license/nuxt/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D" alt="License"></a>
14
+ <a href="https://volta.net/nuxt/nuxt?utm_source=nuxt_readme"><img src="https://user-images.githubusercontent.com/904724/209143798-32345f6c-3cf8-4e06-9659-f4ace4a6acde.svg" alt="Volta board"></a>
15
+ </p>
16
+
17
+ <table>
18
+ <thead>
19
+ <tr>
20
+ <th width="2000" colspan="2">
21
+ </th>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+ <tr>
26
+ <td width="80" align="center" valign="top">
27
+ <br>
28
+ <a href="https://nuxt.com/docs"><img src="./.github/assets/documentation.png"></a>
29
+ </td>
30
+ <td valign="top">
31
+ <h3>Documentation</h3>
32
+ <p>
33
+ We highly recommend you take a look at <a href="https://nuxt.com">the Nuxt documentation</a> to level up.
34
+ </p>
35
+ </td>
36
+ </tr>
37
+ <tr>
38
+ <td width="80" align="center" valign="top">
39
+ <br>
40
+ <a href="https://nuxt.com/modules"><img src="./.github/assets/modules.png"></a>
41
+ </td>
42
+ <td valign="top">
43
+ <h3>Modules</h3>
44
+ <p>
45
+ Discover our <a href="https://nuxt.com/modules">list of modules</a> to supercharge your Nuxt project. Created by the Nuxt team and community.
46
+ </p>
47
+ </td>
48
+ </tr>
49
+ <tr>
50
+ <td width="80" align="center" valign="top">
51
+ <br>
52
+ <a href="https://nuxt.com/docs/examples/hello-world"><img src="./.github/assets/examples.png"></a>
53
+ </td>
54
+ <td>
55
+ <h3>Examples</h3>
56
+ <p>
57
+ Explore different ways of using Nuxt features and get inspired with <a href="https://nuxt.com/docs/examples/essentials/hello-world">our list of examples</a>.
58
+ </p>
59
+ </td>
60
+ </tr>
61
+ </tbody>
62
+ </table>
63
+
64
+ <table>
65
+ <thead>
66
+ <tr>
67
+ <th width="2000" colspan="2">
68
+ </th>
69
+ </tr>
70
+ </thead>
71
+ <tbody>
72
+ <tr>
73
+ <td width="80" align="center" valign="top">
74
+ <br>
75
+ <a href="https://nuxt.com/docs/community/reporting-bugs"><img src="./.github/assets/reporting-bugs.png"></a>
76
+ </td>
77
+ <td valign="top">
78
+ <h3>Reporting bugs</h3>
79
+ <p>
80
+ Check out the <a href="https://nuxt.com/docs/community/reporting-bugs">Reporting Bugs</a> page.</p>
81
+ </p>
82
+ </td>
83
+ </tr>
84
+ <tr>
85
+ <td width="80" align="center" valign="top">
86
+ <br>
87
+ <a href="https://nuxt.com/docs/community/contribution"><img src="./.github/assets/suggestions.png"></a>
88
+ </td>
89
+ <td valign="top">
90
+ <h3>Suggestions</h3>
91
+ <p>
92
+ Check out the <a href="https://nuxt.com/docs/community/contribution">Contribution</a> page.
93
+ </p>
94
+ </td>
95
+ </tr>
96
+ <tr>
97
+ <td width="80" align="center" valign="top">
98
+ <br>
99
+ <a href="https://nuxt.com/docs/community/getting-help"><img src="./.github/assets/questions.png"></a>
100
+ </td>
101
+ <td valign="top">
102
+ <h3>Questions</h3>
103
+ <p>
104
+ Check out the <a href="https://nuxt.com/docs/community/getting-help">Getting Help</a> page.
105
+ </p>
106
+ </td>
107
+ </tr>
108
+ </tbody>
109
+ </table>
110
+
111
+ ## Local Development
112
+
113
+ Follow the docs to [Set Up Your Local Development Environment](https://nuxt.com/docs/community/framework-contribution#set-up-your-local-development-environment) to contribute to the framework and documentation.
114
+
115
+ ## Nuxt 2
116
+
117
+ You can find the code for Nuxt 2 on the [`2.x-dev` branch](https://github.com/nuxt/nuxt/tree/2.x-dev) and the documentation at [nuxtjs.org](https://nuxtjs.org).
118
+
119
+ ## Follow us
120
+
121
+ <p valign="center">
122
+ <a href="https://chat.nuxt.dev"><img width="20px" src="./.github/assets/discord.svg" alt="Discord"></a>&nbsp;&nbsp;<a href="https://twitter.nuxt.dev"><img width="20px" src="./.github/assets/twitter.svg" alt="Twitter"></a>&nbsp;&nbsp;<a href="https://github.nuxt.dev"><img width="20px" src="./.github/assets/github.svg" alt="GitHub"></a>
123
+ </p>
124
+
125
+ ## License
126
+
127
+ [MIT](./LICENSE)
4
128
 
5
- Learn more about this package: <https://v3.nuxtjs.org>
package/dist/index.mjs CHANGED
@@ -308,6 +308,7 @@ function basePlugins(ctx) {
308
308
  clearConsole: false,
309
309
  reporter: "consola",
310
310
  logLevel: "ERROR"
311
+ // TODO
311
312
  })
312
313
  );
313
314
  }
@@ -323,11 +324,13 @@ function basePlugins(ctx) {
323
324
  reporters: ["stats"],
324
325
  stats: !ctx.isDev,
325
326
  reporter: {
327
+ // @ts-ignore
326
328
  change: (_, { shortPath }) => {
327
329
  if (!ctx.isServer) {
328
330
  nuxt.callHook("webpack:change", shortPath);
329
331
  }
330
332
  },
333
+ // @ts-ignore
331
334
  done: ({ state }) => {
332
335
  if (state.hasErrors) {
333
336
  nuxt.callHook("webpack:error");
@@ -338,6 +341,7 @@ function basePlugins(ctx) {
338
341
  allDone: () => {
339
342
  nuxt.callHook("webpack:done");
340
343
  },
344
+ // @ts-ignore
341
345
  progress({ statesArray }) {
342
346
  nuxt.callHook("webpack:progress", statesArray);
343
347
  }
@@ -377,12 +381,16 @@ function baseTranspile(ctx) {
377
381
  const { options } = ctx;
378
382
  const transpile = [
379
383
  /\.vue\.js/i,
384
+ // include SFCs in node_modules
380
385
  /consola\/src/,
381
386
  /vue-demi/
382
387
  ];
383
388
  for (let pattern of options.build.transpile) {
384
389
  if (typeof pattern === "function") {
385
- pattern = pattern(ctx);
390
+ const result = pattern(ctx);
391
+ if (result) {
392
+ pattern = result;
393
+ }
386
394
  }
387
395
  if (typeof pattern === "string") {
388
396
  transpile.push(new RegExp(escapeRegExp(normalize(pattern))));
@@ -410,6 +418,7 @@ function getOutput(ctx) {
410
418
  function getWarningIgnoreFilter(ctx) {
411
419
  const { options } = ctx;
412
420
  const filters = [
421
+ // Hide warnings about plugins without a default export (#1179)
413
422
  (warn) => warn.name === "ModuleDependencyWarning" && warn.message.includes("export 'default'") && warn.message.includes("nuxt_plugin_"),
414
423
  ...options.webpack.warningIgnoreFilters || []
415
424
  ];
@@ -516,6 +525,7 @@ const getPostcssConfig = (nuxt) => {
516
525
  return {
517
526
  sourceMap: nuxt.options.webpack.cssSourceMap,
518
527
  plugins: nuxt.options.postcss.plugins,
528
+ // Array, String or Function
519
529
  order: "autoprefixerAndCssnanoLast"
520
530
  };
521
531
  }
@@ -543,15 +553,6 @@ const getPostcssConfig = (nuxt) => {
543
553
  if (!nuxt.options.webpack.postcss || !nuxt.options.postcss) {
544
554
  return false;
545
555
  }
546
- const configFile = nuxt.options.postcss.config;
547
- if (configFile) {
548
- return {
549
- postcssOptions: {
550
- config: configFile
551
- },
552
- sourceMap: nuxt.options.webpack.cssSourceMap
553
- };
554
- }
555
556
  let postcssOptions = cloneDeep(nuxt.options.postcss);
556
557
  if (isPureObject(postcssOptions)) {
557
558
  if (Array.isArray(postcssOptions.plugins)) {
@@ -562,6 +563,7 @@ const getPostcssConfig = (nuxt) => {
562
563
  }
563
564
  delete nuxt.options.webpack.postcss.order;
564
565
  return {
566
+ // @ts-expect-error
565
567
  sourceMap: nuxt.options.webpack.cssSourceMap,
566
568
  ...nuxt.options.webpack.postcss,
567
569
  postcssOptions
@@ -619,10 +621,12 @@ function createdStyleRule(lang, test, processorLoader, ctx) {
619
621
  return {
620
622
  test,
621
623
  oneOf: [
624
+ // This matches <style module>
622
625
  {
623
626
  resourceQuery: /module/,
624
627
  use: cssModuleLoaders.concat(styleLoaders)
625
628
  },
629
+ // This matches plain <style> or <style scoped>
626
630
  {
627
631
  use: cssLoaders.concat(styleLoaders)
628
632
  }
@@ -647,6 +651,11 @@ function createCssLoadersRule(ctx, cssLoaderOptions) {
647
651
  ];
648
652
  }
649
653
  return [
654
+ // https://github.com/vuejs/vue-style-loader/issues/56
655
+ // {
656
+ // loader: 'vue-style-loader',
657
+ // options: options.webpack.loaders.vueStyle
658
+ // },
650
659
  cssLoader
651
660
  ];
652
661
  }
@@ -706,7 +715,9 @@ class VueSSRClientPlugin {
706
715
  all: allFiles,
707
716
  initial: initialFiles,
708
717
  async: asyncFiles,
709
- modules: {},
718
+ modules: {
719
+ /* [identifier: string]: Array<index: number> */
720
+ },
710
721
  assetsMapping
711
722
  };
712
723
  const { entrypoints = {}, namedChunkGroups = {} } = stats;
@@ -743,7 +754,7 @@ class VueSSRClientPlugin {
743
754
  }
744
755
  assetModules.forEach((m2) => {
745
756
  if (m2.chunks.includes(cid)) {
746
- files.push.apply(files, m2.assets.map(fileToIndex));
757
+ files.push(...m2.assets.map(fileToIndex));
747
758
  }
748
759
  });
749
760
  }
@@ -912,6 +923,7 @@ function clientHMR(ctx) {
912
923
  const hotMiddlewareClientOptionsStr = querystring.stringify(hotMiddlewareClientOptions);
913
924
  const app = config.entry.app;
914
925
  app.unshift(
926
+ // https://github.com/glenjamin/webpack-hot-middleware#config
915
927
  `webpack-hot-middleware/client?${hotMiddlewareClientOptionsStr}`
916
928
  );
917
929
  config.plugins = config.plugins || [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder",
3
- "version": "3.0.0",
4
- "repository": "nuxt/framework",
3
+ "version": "3.1.1",
4
+ "repository": "nuxt/nuxt",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "types": "./dist/index.d.ts",
@@ -13,52 +13,52 @@
13
13
  "dist"
14
14
  ],
15
15
  "dependencies": {
16
- "@babel/core": "^7.20.2",
16
+ "@babel/core": "^7.20.12",
17
17
  "@nuxt/friendly-errors-webpack-plugin": "^2.5.2",
18
- "@nuxt/kit": "3.0.0",
18
+ "@nuxt/kit": "3.1.1",
19
19
  "autoprefixer": "^10.4.13",
20
- "css-loader": "^6.7.2",
20
+ "css-loader": "^6.7.3",
21
21
  "css-minimizer-webpack-plugin": "^4.2.2",
22
22
  "cssnano": "^5.1.14",
23
- "esbuild-loader": "^2.20.0",
23
+ "esbuild-loader": "^2.21.0",
24
24
  "escape-string-regexp": "^5.0.0",
25
- "estree-walker": "^3.0.1",
25
+ "estree-walker": "^3.0.3",
26
26
  "file-loader": "^6.2.0",
27
- "fork-ts-checker-webpack-plugin": "^7.2.13",
28
- "fs-extra": "^10.1.0",
27
+ "fork-ts-checker-webpack-plugin": "^7.3.0",
28
+ "fs-extra": "^11.1.0",
29
29
  "hash-sum": "^2.0.0",
30
30
  "lodash-es": "^4.17.21",
31
- "magic-string": "^0.26.7",
32
- "memfs": "^3.4.11",
33
- "mini-css-extract-plugin": "^2.6.1",
34
- "mlly": "^1.0.0",
31
+ "magic-string": "^0.27.0",
32
+ "memfs": "^3.4.13",
33
+ "mini-css-extract-plugin": "^2.7.2",
34
+ "mlly": "^1.1.0",
35
35
  "ohash": "^1.0.0",
36
- "pathe": "^1.0.0",
36
+ "pathe": "^1.1.0",
37
37
  "pify": "^6.1.0",
38
- "postcss": "^8.4.19",
39
- "postcss-import": "^15.0.0",
40
- "postcss-loader": "^7.0.1",
38
+ "postcss": "^8.4.21",
39
+ "postcss-import": "^15.1.0",
40
+ "postcss-loader": "^7.0.2",
41
41
  "postcss-url": "^10.1.3",
42
42
  "style-resources-loader": "^1.5.0",
43
43
  "time-fix-plugin": "^2.0.7",
44
- "ufo": "^1.0.0",
45
- "unplugin": "^1.0.0",
44
+ "ufo": "^1.0.1",
45
+ "unplugin": "^1.0.1",
46
46
  "url-loader": "^4.1.1",
47
47
  "vue-bundle-renderer": "^1.0.0",
48
48
  "vue-loader": "^17.0.1",
49
49
  "webpack": "^5.75.0",
50
50
  "webpack-bundle-analyzer": "^4.7.0",
51
- "webpack-dev-middleware": "^5.3.3",
51
+ "webpack-dev-middleware": "^6.0.1",
52
52
  "webpack-hot-middleware": "^2.25.3",
53
- "webpack-virtual-modules": "^0.4.6",
53
+ "webpack-virtual-modules": "^0.5.0",
54
54
  "webpackbar": "^5.0.2"
55
55
  },
56
56
  "devDependencies": {
57
- "@nuxt/schema": "3.0.0",
57
+ "@nuxt/schema": "3.1.1",
58
58
  "@types/lodash-es": "^4.17.6",
59
59
  "@types/pify": "^5.0.1",
60
60
  "@types/webpack-bundle-analyzer": "^4.6.0",
61
- "@types/webpack-dev-middleware": "^5.0.2",
61
+ "@types/webpack-dev-middleware": "^5.3.0",
62
62
  "@types/webpack-hot-middleware": "^2.25.6",
63
63
  "@types/webpack-virtual-modules": "^0",
64
64
  "unbuild": "latest",