@nuxt/vite-builder-nightly 5.0.0-29741513.94de156f → 5.0.0-29741521.e01f6e8b
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.mjs +33 -0
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import { hasTTY, isCI } from "std-env";
|
|
|
16
16
|
import { generateTransform, rolldownString } from "rolldown-string";
|
|
17
17
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
18
18
|
import { genArrayFromRaw, genImport, genObjectFromRawEntries } from "knitwork";
|
|
19
|
+
import genericNames from "generic-names";
|
|
19
20
|
import "unplugin";
|
|
20
21
|
import { replacePlugin } from "rolldown/plugins";
|
|
21
22
|
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
@@ -704,6 +705,31 @@ const QUERY_RE$2 = /\?.+$/;
|
|
|
704
705
|
const MACRO_QUERY_RE = /[?&]macro(?:=|&|$)/;
|
|
705
706
|
const NUXT_COMPONENT_QUERY_RE = /[?&]nuxt_component=/;
|
|
706
707
|
const STYLE_QUERY_RE$1 = /[?&]type=style/;
|
|
708
|
+
/**
|
|
709
|
+
* Wrap a string `generateScopedName` pattern into a function that strips any
|
|
710
|
+
* Vite query string (e.g. `?inline&used`) from the resource path before it is
|
|
711
|
+
* hashed.
|
|
712
|
+
*
|
|
713
|
+
* When `features.inlineStyles` is enabled, this plugin imports CSS files with
|
|
714
|
+
* `?inline&used` appended to the module id. For string patterns Vite delegates
|
|
715
|
+
* scoped-name generation to `generic-names`, which folds the full resource path
|
|
716
|
+
* (query included) into the `[hash]`. The client build processes the same file
|
|
717
|
+
* without the query, so it produces a different hash and therefore different
|
|
718
|
+
* class names, leaving the SSR markup mismatched against the inlined `<style>`
|
|
719
|
+
* tags (see https://github.com/nuxt/nuxt/issues/35591 and
|
|
720
|
+
* https://github.com/vitejs/vite/issues/22957).
|
|
721
|
+
*
|
|
722
|
+
* Delegating to `generic-names` with `process.cwd()` (the same context Vite
|
|
723
|
+
* uses) means the generated names stay byte-identical to the client build for
|
|
724
|
+
* every supported token, not just `[local]`/`[hash]`.
|
|
725
|
+
*/
|
|
726
|
+
function wrapStringGenerateScopedName(pattern, hashPrefix) {
|
|
727
|
+
const generate = genericNames(pattern, {
|
|
728
|
+
context: process.cwd(),
|
|
729
|
+
hashPrefix
|
|
730
|
+
});
|
|
731
|
+
return (localName, resourcePath) => generate(localName, resourcePath.replace(QUERY_RE$2, ""));
|
|
732
|
+
}
|
|
707
733
|
function SSRStylesPlugin(nuxt) {
|
|
708
734
|
if (nuxt.options.dev) return;
|
|
709
735
|
const chunksWithInlinedCSS = /* @__PURE__ */ new Set();
|
|
@@ -774,6 +800,13 @@ function SSRStylesPlugin(nuxt) {
|
|
|
774
800
|
let entry;
|
|
775
801
|
return {
|
|
776
802
|
name: "ssr-styles",
|
|
803
|
+
config(config) {
|
|
804
|
+
if (!nuxt.options.features.inlineStyles) return;
|
|
805
|
+
const modules = config.css?.modules;
|
|
806
|
+
if (typeof modules !== "object" || !modules || typeof modules.generateScopedName !== "string") return;
|
|
807
|
+
const hashPrefix = typeof modules.hashPrefix === "string" ? modules.hashPrefix : "";
|
|
808
|
+
modules.generateScopedName = wrapStringGenerateScopedName(modules.generateScopedName, hashPrefix);
|
|
809
|
+
},
|
|
777
810
|
configResolved(config) {
|
|
778
811
|
entry = resolveClientEntry(config);
|
|
779
812
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/vite-builder-nightly",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-29741521.e01f6e8b",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -24,12 +24,13 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-
|
|
27
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@5.0.0-29741521.e01f6e8b",
|
|
28
28
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
29
29
|
"consola": "^3.4.2",
|
|
30
30
|
"defu": "^6.1.7",
|
|
31
31
|
"escape-string-regexp": "^5.0.0",
|
|
32
32
|
"exsolve": "^1.1.0",
|
|
33
|
+
"generic-names": "^4.0.0",
|
|
33
34
|
"get-port-please": "^3.2.0",
|
|
34
35
|
"jiti": "^2.7.0",
|
|
35
36
|
"js-tokens": "^10.0.0",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@babel/plugin-proposal-decorators": "8.0.2",
|
|
53
54
|
"@babel/plugin-syntax-jsx": "8.0.1",
|
|
54
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-
|
|
55
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@5.0.0-29741521.e01f6e8b",
|
|
55
56
|
"@vitejs/plugin-vue-jsx": "5.1.6",
|
|
56
57
|
"autoprefixer": "10.5.4",
|
|
57
58
|
"cssnano": "8.0.2",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
72
73
|
"autoprefixer": "^10.4.27",
|
|
73
74
|
"cssnano": "^7.1.3 || ^8.0.0",
|
|
74
|
-
"nuxt": "npm:nuxt-nightly@5.0.0-
|
|
75
|
+
"nuxt": "npm:nuxt-nightly@5.0.0-29741521.e01f6e8b",
|
|
75
76
|
"rollup-plugin-visualizer": "^6.0.0 || ^7.0.1",
|
|
76
77
|
"vue": "^3.3.4"
|
|
77
78
|
},
|