@unhead/svelte 3.0.0-beta.11 → 3.0.0-beta.12
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/stream/vite.mjs +6 -3
- package/package.json +4 -4
package/dist/stream/vite.mjs
CHANGED
|
@@ -2,16 +2,19 @@ import MagicString from 'magic-string';
|
|
|
2
2
|
import { parseAndWalk } from 'oxc-walker';
|
|
3
3
|
import { createStreamingPlugin } from 'unhead/stream/vite';
|
|
4
4
|
|
|
5
|
+
const SCRIPT_CLOSE_RE = /<\/script>/;
|
|
6
|
+
const SCRIPT_RE = /<script[^>]*>/i;
|
|
7
|
+
const FILTER_RE = /\.svelte$/;
|
|
5
8
|
function transform(code, id, isSSR, s) {
|
|
6
9
|
if (!code.includes("useHead") && !code.includes("useSeoMeta") && !code.includes("useHeadSafe"))
|
|
7
10
|
return false;
|
|
8
|
-
const scriptCloseMatch = code.match(
|
|
11
|
+
const scriptCloseMatch = code.match(SCRIPT_CLOSE_RE);
|
|
9
12
|
if (!scriptCloseMatch)
|
|
10
13
|
return false;
|
|
11
14
|
const templateStart = scriptCloseMatch.index + scriptCloseMatch[0].length;
|
|
12
15
|
s.appendRight(templateStart, "\n{@html HeadStream()}");
|
|
13
16
|
const importPath = `@unhead/svelte/stream/${isSSR ? "server" : "client"}`;
|
|
14
|
-
const scriptMatch = code.match(
|
|
17
|
+
const scriptMatch = code.match(SCRIPT_RE);
|
|
15
18
|
if (!scriptMatch)
|
|
16
19
|
return true;
|
|
17
20
|
const scriptEnd = scriptMatch.index + scriptMatch[0].length;
|
|
@@ -49,7 +52,7 @@ import { HeadStream } from '${importPath}'`);
|
|
|
49
52
|
function unheadSveltePlugin(options) {
|
|
50
53
|
return createStreamingPlugin({
|
|
51
54
|
framework: "@unhead/svelte",
|
|
52
|
-
filter:
|
|
55
|
+
filter: FILTER_RE,
|
|
53
56
|
mode: options?.mode,
|
|
54
57
|
transform(code, id, opts) {
|
|
55
58
|
const s = new MagicString(code);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/svelte",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.12",
|
|
5
5
|
"description": "Full-stack <head> manager built for Svelte.",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -98,14 +98,14 @@
|
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"magic-string": "^0.30.21",
|
|
101
|
-
"oxc-parser": "^0.
|
|
101
|
+
"oxc-parser": "^0.117.0",
|
|
102
102
|
"oxc-walker": "^0.7.0",
|
|
103
|
-
"unhead": "3.0.0-beta.
|
|
103
|
+
"unhead": "3.0.0-beta.12"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
106
|
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
107
107
|
"@testing-library/svelte": "^5.3.1",
|
|
108
|
-
"svelte": "^5.
|
|
108
|
+
"svelte": "^5.53.9",
|
|
109
109
|
"vite": "^7.3.1"
|
|
110
110
|
},
|
|
111
111
|
"scripts": {
|