@nuxt/webpack-builder 3.12.0 → 3.12.2

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 +20 -21
  2. package/package.json +6 -7
package/dist/index.mjs CHANGED
@@ -6,14 +6,14 @@ import webpackHotMiddleware from 'webpack-hot-middleware';
6
6
  import { defu } from 'defu';
7
7
  import { parseURL, parseQuery, joinURL } from 'ufo';
8
8
  import { useNuxt, logger, requireModule } from '@nuxt/kit';
9
- import { pathToFileURL } from 'node:url';
9
+ import { pathToFileURL, fileURLToPath } from 'node:url';
10
10
  import { createUnplugin } from 'unplugin';
11
11
  import { isAbsolute, relative, join, resolve, normalize, dirname } from 'pathe';
12
12
  import { walk } from 'estree-walker';
13
13
  import MagicString from 'magic-string';
14
14
  import { hash } from 'ohash';
15
15
  import escapeRE from 'escape-string-regexp';
16
- import { findStaticImports, parseStaticImport, createCommonJS } from 'mlly';
16
+ import { findStaticImports, parseStaticImport } from 'mlly';
17
17
  import { createFsFromVolume, Volume } from 'memfs';
18
18
  import VirtualModulesPlugin from 'webpack-virtual-modules';
19
19
  import querystring from 'node:querystring';
@@ -54,11 +54,14 @@ const NUXT_LIB_RE = /node_modules\/(?:nuxt|nuxt3|nuxt-nightly)\//;
54
54
  const SUPPORTED_EXT_RE = /\.(?:m?[jt]sx?|vue)/;
55
55
  const composableKeysPlugin = createUnplugin((options) => {
56
56
  const composableMeta = {};
57
+ const composableLengths = /* @__PURE__ */ new Set();
58
+ const keyedFunctions = /* @__PURE__ */ new Set();
57
59
  for (const { name, ...meta } of options.composables) {
58
60
  composableMeta[name] = meta;
61
+ keyedFunctions.add(name);
62
+ composableLengths.add(meta.argumentLength);
59
63
  }
60
- const maxLength = Math.max(...options.composables.map(({ argumentLength }) => argumentLength));
61
- const keyedFunctions = new Set(options.composables.map(({ name }) => name));
64
+ const maxLength = Math.max(...composableLengths);
62
65
  const KEYED_FUNCTIONS_RE = new RegExp(`\\b(${[...keyedFunctions].map((f) => escapeRE(f)).join("|")})\\b`);
63
66
  return {
64
67
  name: "nuxt:composable-keys",
@@ -738,9 +741,9 @@ const getPostcssConfig = (nuxt) => {
738
741
  order: "autoprefixerAndCssnanoLast"
739
742
  });
740
743
  if (!Array.isArray(postcssOptions.plugins) && isPureObject(postcssOptions.plugins)) {
741
- const cjs = createCommonJS(import.meta.url);
744
+ const cwd = fileURLToPath(new URL(".", import.meta.url));
742
745
  postcssOptions.plugins = sortPlugins(postcssOptions).map((pluginName) => {
743
- const pluginFn = requireModule(pluginName, { paths: [cjs.__dirname] });
746
+ const pluginFn = requireModule(pluginName, { paths: [cwd] });
744
747
  const pluginOptions = postcssOptions.plugins[pluginName];
745
748
  if (!pluginOptions || typeof pluginFn !== "function") {
746
749
  return null;
@@ -899,24 +902,20 @@ class VueSSRClientPlugin {
899
902
  }
900
903
  const allFiles = /* @__PURE__ */ new Set();
901
904
  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
- }
914
905
  const assetsMapping = {};
915
- for (const { name, chunkNames = [] } of stats.assets) {
916
- if (isJS(name) && !isHotUpdate(name)) {
906
+ for (const { name: file, chunkNames = [] } of stats.assets) {
907
+ if (isHotUpdate(file)) {
908
+ continue;
909
+ }
910
+ allFiles.add(file);
911
+ const isFileJS = isJS(file);
912
+ if (!initialFiles.has(file) && (isFileJS || isCSS(file))) {
913
+ asyncFiles.add(file);
914
+ }
915
+ if (isFileJS) {
917
916
  const componentHash = hash$1(chunkNames.join("|"));
918
917
  const map = assetsMapping[componentHash] || (assetsMapping[componentHash] = []);
919
- map.push(name);
918
+ map.push(file);
920
919
  }
921
920
  }
922
921
  const webpackManifest = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder",
3
- "version": "3.12.0",
3
+ "version": "3.12.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -38,7 +38,7 @@
38
38
  "hash-sum": "^2.0.0",
39
39
  "lodash-es": "4.17.21",
40
40
  "magic-string": "^0.30.10",
41
- "memfs": "^4.9.2",
41
+ "memfs": "^4.9.3",
42
42
  "mini-css-extract-plugin": "^2.9.0",
43
43
  "mlly": "^1.7.1",
44
44
  "ohash": "^1.1.3",
@@ -58,13 +58,13 @@
58
58
  "url-loader": "^4.1.1",
59
59
  "vue-bundle-renderer": "^2.1.0",
60
60
  "vue-loader": "^17.4.2",
61
- "webpack": "^5.91.0",
61
+ "webpack": "^5.92.0",
62
62
  "webpack-bundle-analyzer": "^4.10.2",
63
63
  "webpack-dev-middleware": "^7.2.1",
64
64
  "webpack-hot-middleware": "^2.26.1",
65
65
  "webpack-virtual-modules": "^0.6.2",
66
66
  "webpackbar": "^6.0.1",
67
- "@nuxt/kit": "3.12.0"
67
+ "@nuxt/kit": "3.12.2"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/fs-extra": "11.0.4",
@@ -73,10 +73,9 @@
73
73
  "@types/pify": "5.0.4",
74
74
  "@types/webpack-bundle-analyzer": "4.7.0",
75
75
  "@types/webpack-hot-middleware": "2.25.9",
76
- "@types/webpack-virtual-modules": "0.4.2",
77
76
  "unbuild": "latest",
78
- "vue": "3.4.27",
79
- "@nuxt/schema": "3.12.0"
77
+ "vue": "3.4.29",
78
+ "@nuxt/schema": "3.12.2"
80
79
  },
81
80
  "peerDependencies": {
82
81
  "vue": "^3.3.4"