@unhead/vue 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 +5 -5
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 TEMPLATE_RE = /<template[^>]*>/;
|
|
6
|
+
const SCRIPT_RE = /<script[^>]*>/i;
|
|
7
|
+
const FILTER_RE = /\.vue$/;
|
|
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 templateMatch = code.match(
|
|
11
|
+
const templateMatch = code.match(TEMPLATE_RE);
|
|
9
12
|
if (!templateMatch)
|
|
10
13
|
return false;
|
|
11
14
|
const templateStart = templateMatch.index + templateMatch[0].length;
|
|
12
15
|
s.appendRight(templateStart, "<HeadStream />");
|
|
13
16
|
const importPath = `@unhead/vue/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;
|
|
@@ -50,7 +53,7 @@ import { HeadStream } from '${importPath}'`);
|
|
|
50
53
|
function unheadVuePlugin(options) {
|
|
51
54
|
return createStreamingPlugin({
|
|
52
55
|
framework: "@unhead/vue",
|
|
53
|
-
filter:
|
|
56
|
+
filter: FILTER_RE,
|
|
54
57
|
mode: options?.mode,
|
|
55
58
|
transform(code, id, opts) {
|
|
56
59
|
const s = new MagicString(code);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
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 Vue.",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -124,14 +124,14 @@
|
|
|
124
124
|
"dependencies": {
|
|
125
125
|
"hookable": "^6.0.1",
|
|
126
126
|
"magic-string": "^0.30.21",
|
|
127
|
-
"oxc-parser": "^0.
|
|
127
|
+
"oxc-parser": "^0.117.0",
|
|
128
128
|
"oxc-walker": "^0.7.0",
|
|
129
|
-
"unhead": "3.0.0-beta.
|
|
129
|
+
"unhead": "3.0.0-beta.12"
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
|
-
"@vue/server-renderer": "^3.5.
|
|
132
|
+
"@vue/server-renderer": "^3.5.30",
|
|
133
133
|
"vite": "^7.3.1",
|
|
134
|
-
"vue": "^3.5.
|
|
134
|
+
"vue": "^3.5.30"
|
|
135
135
|
},
|
|
136
136
|
"scripts": {
|
|
137
137
|
"build": "unbuild",
|