@vizejs/nuxt 0.667.0 → 0.669.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/dist/index.mjs
CHANGED
|
@@ -885,16 +885,21 @@ const NUXT_VUE_TYPE_GATED_TRANSFORMS = new Set([
|
|
|
885
885
|
"unctx:transform",
|
|
886
886
|
"nuxt:tree-shake-composables:transform",
|
|
887
887
|
"nuxt:vue-async-context",
|
|
888
|
-
"nuxt:prehydrate-transform"
|
|
888
|
+
"nuxt:prehydrate-transform",
|
|
889
|
+
"nuxt:navigate-to-early-return"
|
|
889
890
|
]);
|
|
890
891
|
/** The id Vize gives a compiled SFC module (`Foo.vue?vue&vize`). */
|
|
891
892
|
const VIZE_VUE_MODULE_ID_RE = /\.vue\?vue&vize(?:-ssr)?(?:&|$)/;
|
|
892
|
-
/**
|
|
893
|
+
/**
|
|
894
|
+
* Give Nuxt's `isVue(type)` gate a script identity while the plugin runs, in
|
|
895
|
+
* @vitejs/plugin-vue's shape: Nuxt 4.6's gates match `vue&type=script` with the
|
|
896
|
+
* two keys adjacent (`/[?&]vue&type=script\b/`).
|
|
897
|
+
*/
|
|
893
898
|
function toNuxtVueTransformId(id) {
|
|
894
899
|
if (!isVizeGeneratedVueModuleId(id)) return id;
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
return
|
|
900
|
+
const marker = /([?&])vue=?(?=&|$)/;
|
|
901
|
+
if (marker.test(id)) return id.replace(marker, "$1vue&type=script");
|
|
902
|
+
return `${id}${id.includes("?") ? "&" : "?"}vue&type=script`;
|
|
898
903
|
}
|
|
899
904
|
function isFilterPatternList(value) {
|
|
900
905
|
return typeof value === "string" || value instanceof RegExp || Array.isArray(value);
|
|
@@ -18,17 +18,24 @@ function sanitizeNuxtDevStylesheetLinks(html, buildAssetsDir = "/_nuxt/") {
|
|
|
18
18
|
function hasUnsafePathSegment(pathPart) {
|
|
19
19
|
return pathPart.split(/[\\/]/).some((segment) => segment === "..");
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
/** A `<style src>` module: the src stylesheet, with a style query naming its SFC. */
|
|
22
|
+
function isSfcStyleSrcModule(pathPart, query) {
|
|
23
|
+
if (!/\.(?:css|scss|sass|less|styl|stylus)$/i.test(pathPart)) return false;
|
|
24
|
+
const params = new URLSearchParams(query.replaceAll("&", "&"));
|
|
25
|
+
return params.has("vue") && params.get("type") === "style" && (params.get("vize-file")?.endsWith(".vue") ?? false);
|
|
26
|
+
}
|
|
27
|
+
function isAllowedNuxtDevStylesheetPath(pathPart, query) {
|
|
28
|
+
return isSfcStyleSrcModule(pathPart, query) || pathPart.startsWith("@fs/") || pathPart.startsWith("@id/") || pathPart.startsWith("assets/") || pathPart.startsWith("virtual:") || /^(?:[^/\\]+\/)*[^/\\]+\.vue\.__vize_style_\d+\.css$/i.test(pathPart) || /^__[\w.-]+\.css$/i.test(pathPart) || /^[\w.-]+\.css$/i.test(pathPart);
|
|
23
29
|
}
|
|
24
30
|
function shouldKeepHref(href) {
|
|
25
31
|
if (seenHrefs.has(href)) return false;
|
|
26
32
|
seenHrefs.add(href);
|
|
27
33
|
if (!href.startsWith(normalizedAssetsDir)) return true;
|
|
28
|
-
const
|
|
34
|
+
const [pathAndQuery] = href.slice(normalizedAssetsDir.length).split("#");
|
|
35
|
+
const [pathPart, query = ""] = pathAndQuery.split("?", 2);
|
|
29
36
|
const decodedPath = decodePathPart(pathPart);
|
|
30
37
|
if (decodedPath.includes("\0") || hasUnsafePathSegment(decodedPath)) return false;
|
|
31
|
-
return isAllowedNuxtDevStylesheetPath(decodedPath);
|
|
38
|
+
return isAllowedNuxtDevStylesheetPath(decodedPath, query);
|
|
32
39
|
}
|
|
33
40
|
return html.replace(/<link\b(?=[^>]*\brel=(["'])stylesheet\1)[^>]*\bhref=(["'])(.*?)\2[^>]*>/gi, (tag, _relQuote, _hrefQuote, href) => shouldKeepHref(href) ? tag : "");
|
|
34
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vizejs/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.669.0",
|
|
4
4
|
"description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compiler",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@nuxt/kit": "3.21.8",
|
|
52
|
-
"@vizejs/native": "0.
|
|
53
|
-
"@vizejs/nuxt-lint-config": "0.
|
|
54
|
-
"@vizejs/vite-plugin": "0.
|
|
55
|
-
"@vizejs/vite-plugin-musea": "0.
|
|
56
|
-
"vize": "0.
|
|
52
|
+
"@vizejs/native": "0.669.0",
|
|
53
|
+
"@vizejs/nuxt-lint-config": "0.669.0",
|
|
54
|
+
"@vizejs/vite-plugin": "0.669.0",
|
|
55
|
+
"@vizejs/vite-plugin-musea": "0.669.0",
|
|
56
|
+
"vize": "0.669.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"jiti-nuxt2": "npm:jiti@1.21.7",
|
|
60
|
-
"oxlint-plugin-vize": "0.
|
|
60
|
+
"oxlint-plugin-vize": "0.669.0",
|
|
61
61
|
"typescript": "6.0.3",
|
|
62
62
|
"vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
|
|
63
63
|
"vite-plus": "1.3.0",
|