@nuxt/webpack-builder-nightly 4.6.0-29778602.bfddf2f0 → 4.6.0-29779067.e5421201

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 +16 -11
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -10,7 +10,8 @@ import { promisify } from "node:util";
10
10
  import { defu } from "defu";
11
11
  import { basename, dirname, isAbsolute, join, normalize, relative, resolve } from "pathe";
12
12
  import { joinURL, withTrailingSlash } from "ufo";
13
- import { DEFAULT_JS_FILE_EXTENSIONS, bundlerDiagnostics, configDiagnostics, directoryToURL, getAddDependencyCommand, logger, parseNodeModulePath, resolveAlias, setBuildOutput, tryImportModule, useNitro, useNuxt } from "@nuxt/kit";
13
+ import { directoryToURL, getAddDependencyCommand, logger, resolveAlias, setBuildOutput, tryImportModule, useNitro, useNuxt } from "@nuxt/kit";
14
+ import { DEFAULT_JS_FILE_EXTENSIONS, bundlerDiagnostics, configDiagnostics, parseNodeModulePath } from "@nuxt/kit/internal";
14
15
  import { createUnplugin } from "unplugin";
15
16
  import { generateTransform, rolldownString } from "rolldown-string";
16
17
  import { existsSync, readFileSync } from "node:fs";
@@ -210,9 +211,9 @@ var SSRStylesPlugin = class {
210
211
  escapeTemplateLiteral(str) {
211
212
  return str.replace(/[`\\$]/g, (m) => m === "$" ? "\\$" : `\\${m}`);
212
213
  }
213
- isBuildAsset(url) {
214
+ buildAssetPath(url) {
214
215
  const buildDir = withTrailingSlash(this.nuxt.options.app.buildAssetsDir || "/_nuxt/");
215
- return url.startsWith(buildDir);
216
+ return url.startsWith(buildDir) ? url.slice(buildDir.length) : null;
216
217
  }
217
218
  isPublicAsset(url, nitro) {
218
219
  const cleaned = url.replace(/[?#].*$/, "");
@@ -237,14 +238,16 @@ var SSRStylesPlugin = class {
237
238
  const full = match[0];
238
239
  const rawUrl = match[2] || "";
239
240
  const stripped = rawUrl.replace(/[?#].*$/, "");
240
- if (this.isPublicAsset(stripped, nitro)) {
241
- needsPublicAsset = true;
242
- changed = true;
243
- out += "${publicAssetsURL(" + JSON.stringify(rawUrl) + ")}";
244
- } else if (this.isBuildAsset(stripped)) {
241
+ const quote = match[1] || "";
242
+ const buildAssetPath = this.buildAssetPath(stripped);
243
+ if (buildAssetPath) {
245
244
  needsBuildAsset = true;
246
245
  changed = true;
247
- out += "${buildAssetsURL(" + JSON.stringify(rawUrl) + ")}";
246
+ out += `url(${quote}\${buildAssetsURL(${JSON.stringify(buildAssetPath + rawUrl.slice(stripped.length))})}${quote})`;
247
+ } else if (this.isPublicAsset(stripped, nitro)) {
248
+ needsPublicAsset = true;
249
+ changed = true;
250
+ out += `url(${quote}\${publicAssetsURL(${JSON.stringify(rawUrl)})}${quote})`;
248
251
  } else out += this.escapeTemplateLiteral(full);
249
252
  lastIndex = index + full.length;
250
253
  }
@@ -1036,6 +1039,7 @@ async function getPostcssConfig(nuxt) {
1036
1039
  "postcss-url": {}
1037
1040
  };
1038
1041
  const postcssOptions = defu({}, nuxt.options.postcss, {
1042
+ config: false,
1039
1043
  plugins: defaultPlugins,
1040
1044
  sourceMap: nuxt.options.webpack.cssSourceMap
1041
1045
  });
@@ -1417,7 +1421,8 @@ function clientHMR(ctx) {
1417
1421
  ctx.config.entry.app.unshift(`webpack-hot-middleware/client?${hotMiddlewareClientOptionsStr}`);
1418
1422
  }
1419
1423
  function clientOptimization(ctx) {
1420
- if (!ctx.nuxt.options.features.inlineStyles) return;
1424
+ const inlineStyles = ctx.nuxt.options.features.inlineStyles;
1425
+ if (!inlineStyles) return;
1421
1426
  const globalCSSPaths = /* @__PURE__ */ new Set();
1422
1427
  for (const css of ctx.options.css) if (typeof css === "string") {
1423
1428
  const resolved = resolveAlias(css, ctx.options.alias);
@@ -1434,7 +1439,7 @@ function clientOptimization(ctx) {
1434
1439
  test: (module) => {
1435
1440
  if (module.type !== "css/mini-extract") return false;
1436
1441
  const identifier = normalize(module.identifier());
1437
- for (const globalPath of globalCSSPaths) if (identifier.includes(globalPath)) return true;
1442
+ for (const globalPath of globalCSSPaths) if (identifier.includes(globalPath)) return typeof inlineStyles === "boolean" ? inlineStyles : inlineStyles(module.identifier());
1438
1443
  return false;
1439
1444
  }
1440
1445
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/webpack-builder-nightly",
3
- "version": "4.6.0-29778602.bfddf2f0",
3
+ "version": "4.6.0-29779067.e5421201",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "@nuxt/friendly-errors-webpack-plugin": "^2.6.0",
27
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.6.0-29778602.bfddf2f0",
27
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.6.0-29779067.e5421201",
28
28
  "@vue/compiler-sfc": "3.5.40",
29
29
  "autoprefixer": "^10.5.4",
30
30
  "css-loader": "^7.1.4",
@@ -65,7 +65,7 @@
65
65
  "webpackbar": "^7.0.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.6.0-29778602.bfddf2f0",
68
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.6.0-29779067.e5421201",
69
69
  "@rspack/core": "2.1.7",
70
70
  "@types/hash-sum": "1.0.2",
71
71
  "@types/webpack-bundle-analyzer": "4.7.0",
@@ -77,7 +77,7 @@
77
77
  "vue": "^3.5.40"
78
78
  },
79
79
  "peerDependencies": {
80
- "nuxt": "npm:nuxt-nightly@4.6.0-29778602.bfddf2f0",
80
+ "nuxt": "npm:nuxt-nightly@4.6.0-29779067.e5421201",
81
81
  "vue": "^3.3.4"
82
82
  },
83
83
  "engines": {