@vizejs/nuxt 0.666.0 → 0.668.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.
|
@@ -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.668.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.668.0",
|
|
53
|
+
"@vizejs/nuxt-lint-config": "0.668.0",
|
|
54
|
+
"@vizejs/vite-plugin": "0.668.0",
|
|
55
|
+
"@vizejs/vite-plugin-musea": "0.668.0",
|
|
56
|
+
"vize": "0.668.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.668.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",
|