@unhead/svelte 3.0.0-beta.10 → 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/client.d.mts +4 -3
- package/dist/client.d.ts +4 -3
- package/dist/stream/vite.mjs +6 -3
- package/package.json +5 -5
package/dist/client.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientUnhead } from 'unhead/client';
|
|
2
|
+
export { renderDOMHead } from 'unhead/client';
|
|
3
|
+
import { CreateClientHeadOptions } from 'unhead/types';
|
|
2
4
|
export { CreateClientHeadOptions, Unhead } from 'unhead/types';
|
|
3
5
|
export { UnheadContextKey } from './server.mjs';
|
|
4
|
-
export { renderDOMHead } from 'unhead/client';
|
|
5
6
|
import 'unhead/server';
|
|
6
7
|
|
|
7
|
-
declare function createHead(options?: CreateClientHeadOptions):
|
|
8
|
+
declare function createHead(options?: CreateClientHeadOptions): ClientUnhead;
|
|
8
9
|
|
|
9
10
|
export { createHead };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClientUnhead } from 'unhead/client';
|
|
2
|
+
export { renderDOMHead } from 'unhead/client';
|
|
3
|
+
import { CreateClientHeadOptions } from 'unhead/types';
|
|
2
4
|
export { CreateClientHeadOptions, Unhead } from 'unhead/types';
|
|
3
5
|
export { UnheadContextKey } from './server.js';
|
|
4
|
-
export { renderDOMHead } from 'unhead/client';
|
|
5
6
|
import 'unhead/server';
|
|
6
7
|
|
|
7
|
-
declare function createHead(options?: CreateClientHeadOptions):
|
|
8
|
+
declare function createHead(options?: CreateClientHeadOptions): ClientUnhead;
|
|
8
9
|
|
|
9
10
|
export { createHead };
|
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,15 +98,15 @@
|
|
|
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.
|
|
109
|
-
"vite": "^7.
|
|
108
|
+
"svelte": "^5.53.9",
|
|
109
|
+
"vite": "^7.3.1"
|
|
110
110
|
},
|
|
111
111
|
"scripts": {
|
|
112
112
|
"build": "unbuild .",
|