@unhead/vue 2.1.9 → 3.0.0-beta.10
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 +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.mjs +7 -9
- package/dist/components.mjs +1 -1
- package/dist/index.d.mts +9 -30
- package/dist/index.d.ts +9 -30
- package/dist/index.mjs +5 -9
- package/dist/scripts.d.mts +4 -4
- package/dist/scripts.d.ts +4 -4
- package/dist/scripts.mjs +3 -3
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.mjs +3 -3
- package/dist/shared/{vue.DoxLTFJk.d.mts → vue.9wC_EyGs.d.mts} +25 -17
- package/dist/shared/{vue.DoxLTFJk.d.ts → vue.9wC_EyGs.d.ts} +25 -17
- package/dist/shared/{vue.CVf9mpRR.mjs → vue.BUll6Wuy.mjs} +1 -1
- package/dist/shared/{vue.BM998iwd.mjs → vue.CLCWY4Ey.mjs} +1 -1
- package/dist/shared/{vue.Cr7xSEtD.mjs → vue.DdPIVN-K.mjs} +1 -10
- package/dist/stream/client.d.mts +17 -0
- package/dist/stream/client.d.ts +17 -0
- package/dist/stream/client.mjs +27 -0
- package/dist/stream/server.d.mts +50 -0
- package/dist/stream/server.d.ts +50 -0
- package/dist/stream/server.mjs +43 -0
- package/dist/stream/vite.d.mts +27 -0
- package/dist/stream/vite.d.ts +27 -0
- package/dist/stream/vite.mjs +67 -0
- package/dist/types.d.mts +68 -5
- package/dist/types.d.ts +68 -5
- package/dist/utils.d.mts +1 -6
- package/dist/utils.d.ts +1 -6
- package/dist/utils.mjs +1 -9
- package/package.json +33 -9
- package/dist/legacy.d.mts +0 -34
- package/dist/legacy.d.ts +0 -34
- package/dist/legacy.mjs +0 -114
- package/dist/shared/vue.CzjZUNjB.d.ts +0 -63
- package/dist/shared/vue.DMlT7xkj.d.mts +0 -63
- package/legacy.d.ts +0 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { WebStreamableHeadContext } from 'unhead/stream/server';
|
|
3
|
+
export { CreateStreamableServerHeadOptions, StreamingTemplateParts, prepareStreamingTemplate, renderSSRHeadShell, renderSSRHeadSuspenseChunk, wrapStream } from 'unhead/stream/server';
|
|
4
|
+
import { ResolvableHead, CreateStreamableServerHeadOptions } from 'unhead/types';
|
|
5
|
+
import { V as VueHeadClient } from '../shared/vue.9wC_EyGs.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Streaming script component - outputs inline script with current head state.
|
|
9
|
+
* The Vite plugin with streaming: true auto-injects this.
|
|
10
|
+
*/
|
|
11
|
+
declare const HeadStream: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}> | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
14
|
+
/**
|
|
15
|
+
* Vue-specific context returned by createStreamableHead.
|
|
16
|
+
* Extends WebStreamableHeadContext with Vue-specific head type.
|
|
17
|
+
*/
|
|
18
|
+
interface VueStreamableHeadContext extends Omit<WebStreamableHeadContext<ResolvableHead>, 'head'> {
|
|
19
|
+
/**
|
|
20
|
+
* The Vue head instance to use with app.use(head)
|
|
21
|
+
*/
|
|
22
|
+
head: VueHeadClient;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a head instance configured for Vue streaming SSR.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* export async function render(url: string, template: string) {
|
|
30
|
+
* const { app, router } = createApp()
|
|
31
|
+
* const { head, wrapStream } = createStreamableHead()
|
|
32
|
+
*
|
|
33
|
+
* app.use(head)
|
|
34
|
+
* app.mixin(VueHeadMixin)
|
|
35
|
+
* router.push(url)
|
|
36
|
+
*
|
|
37
|
+
* // Create stream first - Vue starts rendering synchronously
|
|
38
|
+
* const vueStream = renderToWebStream(app)
|
|
39
|
+
*
|
|
40
|
+
* // Wait for router - by now Vue's sync render has pushed head entries
|
|
41
|
+
* await router.isReady()
|
|
42
|
+
*
|
|
43
|
+
* return wrapStream(vueStream, template)
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function createStreamableHead(options?: Omit<CreateStreamableServerHeadOptions, 'propsResolver'>): VueStreamableHeadContext;
|
|
48
|
+
|
|
49
|
+
export { HeadStream, VueHeadClient, createStreamableHead };
|
|
50
|
+
export type { VueStreamableHeadContext };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { WebStreamableHeadContext } from 'unhead/stream/server';
|
|
3
|
+
export { CreateStreamableServerHeadOptions, StreamingTemplateParts, prepareStreamingTemplate, renderSSRHeadShell, renderSSRHeadSuspenseChunk, wrapStream } from 'unhead/stream/server';
|
|
4
|
+
import { ResolvableHead, CreateStreamableServerHeadOptions } from 'unhead/types';
|
|
5
|
+
import { V as VueHeadClient } from '../shared/vue.9wC_EyGs.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Streaming script component - outputs inline script with current head state.
|
|
9
|
+
* The Vite plugin with streaming: true auto-injects this.
|
|
10
|
+
*/
|
|
11
|
+
declare const HeadStream: vue.DefineComponent<{}, () => vue.VNode<vue.RendererNode, vue.RendererElement, {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}> | null, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
14
|
+
/**
|
|
15
|
+
* Vue-specific context returned by createStreamableHead.
|
|
16
|
+
* Extends WebStreamableHeadContext with Vue-specific head type.
|
|
17
|
+
*/
|
|
18
|
+
interface VueStreamableHeadContext extends Omit<WebStreamableHeadContext<ResolvableHead>, 'head'> {
|
|
19
|
+
/**
|
|
20
|
+
* The Vue head instance to use with app.use(head)
|
|
21
|
+
*/
|
|
22
|
+
head: VueHeadClient;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a head instance configured for Vue streaming SSR.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* export async function render(url: string, template: string) {
|
|
30
|
+
* const { app, router } = createApp()
|
|
31
|
+
* const { head, wrapStream } = createStreamableHead()
|
|
32
|
+
*
|
|
33
|
+
* app.use(head)
|
|
34
|
+
* app.mixin(VueHeadMixin)
|
|
35
|
+
* router.push(url)
|
|
36
|
+
*
|
|
37
|
+
* // Create stream first - Vue starts rendering synchronously
|
|
38
|
+
* const vueStream = renderToWebStream(app)
|
|
39
|
+
*
|
|
40
|
+
* // Wait for router - by now Vue's sync render has pushed head entries
|
|
41
|
+
* await router.isReady()
|
|
42
|
+
*
|
|
43
|
+
* return wrapStream(vueStream, template)
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function createStreamableHead(options?: Omit<CreateStreamableServerHeadOptions, 'propsResolver'>): VueStreamableHeadContext;
|
|
48
|
+
|
|
49
|
+
export { HeadStream, VueHeadClient, createStreamableHead };
|
|
50
|
+
export type { VueStreamableHeadContext };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { renderSSRHeadSuspenseChunk, createStreamableHead as createStreamableHead$1, wrapStream } from 'unhead/stream/server';
|
|
2
|
+
export { prepareStreamingTemplate, renderSSRHeadShell, renderSSRHeadSuspenseChunk, wrapStream } from 'unhead/stream/server';
|
|
3
|
+
import { defineComponent, h } from 'vue';
|
|
4
|
+
import { i as injectHead, v as vueInstall } from '../shared/vue.DdPIVN-K.mjs';
|
|
5
|
+
import { V as VueResolver } from '../shared/vue.N9zWjxoK.mjs';
|
|
6
|
+
import 'unhead/plugins';
|
|
7
|
+
import 'unhead/utils';
|
|
8
|
+
|
|
9
|
+
const HeadStream = defineComponent({
|
|
10
|
+
name: "HeadStream",
|
|
11
|
+
setup() {
|
|
12
|
+
const head = injectHead();
|
|
13
|
+
return () => {
|
|
14
|
+
if (!head._shellRendered?.())
|
|
15
|
+
return null;
|
|
16
|
+
const update = renderSSRHeadSuspenseChunk(head);
|
|
17
|
+
if (!update)
|
|
18
|
+
return null;
|
|
19
|
+
return h("script", { innerHTML: update });
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
function createStreamableHead(options = {}) {
|
|
24
|
+
const { head } = createStreamableHead$1({
|
|
25
|
+
...options,
|
|
26
|
+
propResolvers: [VueResolver]
|
|
27
|
+
});
|
|
28
|
+
const vueHead = head;
|
|
29
|
+
vueHead.install = vueInstall(vueHead);
|
|
30
|
+
let shellRendered = false;
|
|
31
|
+
vueHead._shellRendered = () => shellRendered;
|
|
32
|
+
return {
|
|
33
|
+
head: vueHead,
|
|
34
|
+
wrapStream: (stream, template) => {
|
|
35
|
+
const preRenderedState = vueHead.render();
|
|
36
|
+
vueHead.entries.clear();
|
|
37
|
+
shellRendered = true;
|
|
38
|
+
return wrapStream(vueHead, stream, template, preRenderedState);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { HeadStream, createStreamableHead };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
import { StreamingPluginOptions } from 'unhead/stream/vite';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Vite plugin for Vue streaming SSR support.
|
|
6
|
+
* Automatically injects HeadStream components into Vue SFC templates.
|
|
7
|
+
*
|
|
8
|
+
* @returns Vite plugin configuration object with:
|
|
9
|
+
* - `name`: Plugin identifier
|
|
10
|
+
* - `enforce`: Plugin execution order ('pre')
|
|
11
|
+
* - `transform`: Transform hook for processing .vue files
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // vite.config.ts
|
|
16
|
+
* import { unheadVuePlugin } from '@unhead/vue/stream/vite'
|
|
17
|
+
*
|
|
18
|
+
* export default {
|
|
19
|
+
* plugins: [
|
|
20
|
+
* unheadVuePlugin()
|
|
21
|
+
* ]
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function unheadVuePlugin(options?: Pick<StreamingPluginOptions, 'mode'>): vite.Plugin<any>;
|
|
26
|
+
|
|
27
|
+
export { unheadVuePlugin as default, unheadVuePlugin };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as vite from 'vite';
|
|
2
|
+
import { StreamingPluginOptions } from 'unhead/stream/vite';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Vite plugin for Vue streaming SSR support.
|
|
6
|
+
* Automatically injects HeadStream components into Vue SFC templates.
|
|
7
|
+
*
|
|
8
|
+
* @returns Vite plugin configuration object with:
|
|
9
|
+
* - `name`: Plugin identifier
|
|
10
|
+
* - `enforce`: Plugin execution order ('pre')
|
|
11
|
+
* - `transform`: Transform hook for processing .vue files
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // vite.config.ts
|
|
16
|
+
* import { unheadVuePlugin } from '@unhead/vue/stream/vite'
|
|
17
|
+
*
|
|
18
|
+
* export default {
|
|
19
|
+
* plugins: [
|
|
20
|
+
* unheadVuePlugin()
|
|
21
|
+
* ]
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function unheadVuePlugin(options?: Pick<StreamingPluginOptions, 'mode'>): vite.Plugin<any>;
|
|
26
|
+
|
|
27
|
+
export { unheadVuePlugin as default, unheadVuePlugin };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import MagicString from 'magic-string';
|
|
2
|
+
import { parseAndWalk } from 'oxc-walker';
|
|
3
|
+
import { createStreamingPlugin } from 'unhead/stream/vite';
|
|
4
|
+
|
|
5
|
+
function transform(code, id, isSSR, s) {
|
|
6
|
+
if (!code.includes("useHead") && !code.includes("useSeoMeta") && !code.includes("useHeadSafe"))
|
|
7
|
+
return false;
|
|
8
|
+
const templateMatch = code.match(/<template[^>]*>/);
|
|
9
|
+
if (!templateMatch)
|
|
10
|
+
return false;
|
|
11
|
+
const templateStart = templateMatch.index + templateMatch[0].length;
|
|
12
|
+
s.appendRight(templateStart, "<HeadStream />");
|
|
13
|
+
const importPath = `@unhead/vue/stream/${isSSR ? "server" : "client"}`;
|
|
14
|
+
const scriptMatch = code.match(/<script[^>]*>/i);
|
|
15
|
+
if (!scriptMatch)
|
|
16
|
+
return true;
|
|
17
|
+
const scriptEnd = scriptMatch.index + scriptMatch[0].length;
|
|
18
|
+
const scriptCloseIndex = code.indexOf("<\/script>", scriptEnd);
|
|
19
|
+
if (scriptCloseIndex === -1)
|
|
20
|
+
return true;
|
|
21
|
+
const scriptContent = code.slice(scriptEnd, scriptCloseIndex);
|
|
22
|
+
let existingImport = null;
|
|
23
|
+
parseAndWalk(scriptContent, id, {
|
|
24
|
+
parseOptions: { lang: "ts" },
|
|
25
|
+
enter(node) {
|
|
26
|
+
if (node.type === "ImportDeclaration" && node.source.value === importPath) {
|
|
27
|
+
existingImport = {
|
|
28
|
+
start: scriptEnd + node.start,
|
|
29
|
+
end: scriptEnd + node.end,
|
|
30
|
+
specifiers: node.specifiers?.map((spec) => spec.local?.name).filter(Boolean) || []
|
|
31
|
+
};
|
|
32
|
+
this.skip();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const foundImport = existingImport;
|
|
37
|
+
if (foundImport) {
|
|
38
|
+
if (!foundImport.specifiers.includes("HeadStream")) {
|
|
39
|
+
const inner = foundImport.specifiers.join(", ");
|
|
40
|
+
const newImports = inner ? `${inner}, HeadStream` : "HeadStream";
|
|
41
|
+
s.overwrite(foundImport.start, foundImport.end, `import { ${newImports} } from '${importPath}'
|
|
42
|
+
`);
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
s.appendRight(scriptEnd, `
|
|
46
|
+
import { HeadStream } from '${importPath}'`);
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
function unheadVuePlugin(options) {
|
|
51
|
+
return createStreamingPlugin({
|
|
52
|
+
framework: "@unhead/vue",
|
|
53
|
+
filter: /\.vue$/,
|
|
54
|
+
mode: options?.mode,
|
|
55
|
+
transform(code, id, opts) {
|
|
56
|
+
const s = new MagicString(code);
|
|
57
|
+
if (!transform(code, id, opts?.ssr ?? false, s))
|
|
58
|
+
return null;
|
|
59
|
+
return {
|
|
60
|
+
code: s.toString(),
|
|
61
|
+
map: s.generateMap({ includeContent: true, source: id })
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export { unheadVuePlugin as default, unheadVuePlugin };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,9 +1,71 @@
|
|
|
1
|
-
import { RawInput } from 'unhead/types';
|
|
2
|
-
export { ActiveHeadEntry, AriaAttributes, BodyAttributesWithoutEvents, BodyEvents, DataKeys,
|
|
3
|
-
|
|
4
|
-
export { B as BodyAttr, D as DeepResolvableProperties, H as HtmlAttr, M as MaybeFalsy,
|
|
1
|
+
import { ResolvableHead, GenericLink, DataKeys, SchemaAugmentations, MetaGeneric, Style as Style$1, GenericScript, TagPriority, TagPosition, ResolvesDuplicates, ProcessesTemplateParams, Noscript as Noscript$1, HtmlAttributes as HtmlAttributes$1, BodyAttributesWithoutEvents, RawInput } from 'unhead/types';
|
|
2
|
+
export { ActiveHeadEntry, AriaAttributes, BodyAttributesWithoutEvents, BodyEvents, DataKeys, GenericLink, GenericScript, GlobalAttributes, HeadEntryOptions, HeadTag, HttpEventAttributes, MetaFlat, MetaFlat as MetaFlatInput, RawInput, RenderSSRHeadOptions, ResolvableHead, SerializableHead, SpeculationRules, Unhead } from 'unhead/types';
|
|
3
|
+
import { R as ResolvableValue, a as ResolvableProperties } from './shared/vue.9wC_EyGs.mjs';
|
|
4
|
+
export { B as BodyAttr, D as DeepResolvableProperties, b as Head, H as HtmlAttr, M as MaybeFalsy, b as ReactiveHead, o as ResolvableArray, e as ResolvableBase, l as ResolvableBodyAttributes, k as ResolvableHtmlAttributes, f as ResolvableLink, g as ResolvableMeta, j as ResolvableNoscript, i as ResolvableScript, h as ResolvableStyle, c as ResolvableTitle, d as ResolvableTitleTemplate, p as ResolvableUnion, m as UseHeadInput, U as UseHeadOptions, n as UseSeoMetaInput, V as VueHeadClient } from './shared/vue.9wC_EyGs.mjs';
|
|
5
5
|
import 'vue';
|
|
6
6
|
|
|
7
|
+
type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributesWithoutEvents, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
|
|
8
|
+
type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes$1, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
|
9
|
+
type SafeMeta = ResolvableProperties<Pick<MetaGeneric, 'id' | 'name' | 'property' | 'charset' | 'content' | 'media'> & DataKeys & SchemaAugmentations['meta']>;
|
|
10
|
+
type SafeLink = ResolvableProperties<Pick<GenericLink, 'id' | 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesrcset' | 'imagesizes' | 'integrity' | 'media' | 'referrerpolicy' | 'rel' | 'sizes' | 'type'> & DataKeys & SchemaAugmentations['link']>;
|
|
11
|
+
type SafeScript = ResolvableProperties<Pick<GenericScript, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & {
|
|
12
|
+
textContent?: string;
|
|
13
|
+
} & TagPriority & TagPosition & ResolvesDuplicates & ProcessesTemplateParams>;
|
|
14
|
+
type SafeNoscript = ResolvableProperties<Pick<Noscript$1, 'id'> & DataKeys & Omit<SchemaAugmentations['noscript'], 'innerHTML'>>;
|
|
15
|
+
type SafeStyle = ResolvableProperties<Pick<Style$1, 'id' | 'media' | 'nonce' | 'title' | 'blocking'> & DataKeys & Omit<SchemaAugmentations['style'], 'innerHTML'>>;
|
|
16
|
+
interface HeadSafe extends Pick<ResolvableHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
17
|
+
/**
|
|
18
|
+
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
|
19
|
+
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
|
20
|
+
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
|
21
|
+
*
|
|
22
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
|
23
|
+
*/
|
|
24
|
+
link?: ResolvableValue<ResolvableValue<SafeLink[]>>;
|
|
25
|
+
/**
|
|
26
|
+
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
|
27
|
+
*
|
|
28
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
29
|
+
*/
|
|
30
|
+
meta?: ResolvableValue<ResolvableValue<SafeMeta>[]>;
|
|
31
|
+
/**
|
|
32
|
+
* The `<style>` HTML element contains style information for a document, or part of a document.
|
|
33
|
+
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
|
34
|
+
*
|
|
35
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
36
|
+
*/
|
|
37
|
+
style?: ResolvableValue<ResolvableValue<(SafeStyle | string)>[]>;
|
|
38
|
+
/**
|
|
39
|
+
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
40
|
+
*
|
|
41
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
42
|
+
*/
|
|
43
|
+
script?: ResolvableValue<ResolvableValue<(SafeScript | string)>[]>;
|
|
44
|
+
/**
|
|
45
|
+
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
46
|
+
* or if scripting is currently turned off in the browser.
|
|
47
|
+
*
|
|
48
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
49
|
+
*/
|
|
50
|
+
noscript?: ResolvableValue<ResolvableValue<(SafeNoscript | string)>[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Attributes for the `<html>` HTML element.
|
|
53
|
+
*
|
|
54
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
|
55
|
+
*/
|
|
56
|
+
htmlAttrs?: ResolvableValue<SafeHtmlAttr>;
|
|
57
|
+
/**
|
|
58
|
+
* Attributes for the `<body>` HTML element.
|
|
59
|
+
*
|
|
60
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
|
61
|
+
*/
|
|
62
|
+
bodyAttrs?: ResolvableValue<SafeBodyAttr>;
|
|
63
|
+
}
|
|
64
|
+
type UseHeadSafeInput = ResolvableValue<HeadSafe>;
|
|
65
|
+
|
|
66
|
+
/** @deprecated */
|
|
67
|
+
type MergeHead = object;
|
|
68
|
+
|
|
7
69
|
type Base = RawInput<'base'>;
|
|
8
70
|
type HtmlAttributes = RawInput<'htmlAttrs'>;
|
|
9
71
|
type Noscript = RawInput<'noscript'>;
|
|
@@ -13,4 +75,5 @@ type Script = RawInput<'script'>;
|
|
|
13
75
|
type Link = RawInput<'link'>;
|
|
14
76
|
type BodyAttributes = RawInput<'bodyAttrs'>;
|
|
15
77
|
|
|
16
|
-
export
|
|
78
|
+
export { ResolvableProperties, ResolvableValue };
|
|
79
|
+
export type { Base, BodyAttributes, HeadSafe, HtmlAttributes, Link, MergeHead, Meta, Noscript, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SafeStyle, Script, Style, UseHeadSafeInput };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,71 @@
|
|
|
1
|
-
import { RawInput } from 'unhead/types';
|
|
2
|
-
export { ActiveHeadEntry, AriaAttributes, BodyAttributesWithoutEvents, BodyEvents, DataKeys,
|
|
3
|
-
|
|
4
|
-
export { B as BodyAttr, D as DeepResolvableProperties, H as HtmlAttr, M as MaybeFalsy,
|
|
1
|
+
import { ResolvableHead, GenericLink, DataKeys, SchemaAugmentations, MetaGeneric, Style as Style$1, GenericScript, TagPriority, TagPosition, ResolvesDuplicates, ProcessesTemplateParams, Noscript as Noscript$1, HtmlAttributes as HtmlAttributes$1, BodyAttributesWithoutEvents, RawInput } from 'unhead/types';
|
|
2
|
+
export { ActiveHeadEntry, AriaAttributes, BodyAttributesWithoutEvents, BodyEvents, DataKeys, GenericLink, GenericScript, GlobalAttributes, HeadEntryOptions, HeadTag, HttpEventAttributes, MetaFlat, MetaFlat as MetaFlatInput, RawInput, RenderSSRHeadOptions, ResolvableHead, SerializableHead, SpeculationRules, Unhead } from 'unhead/types';
|
|
3
|
+
import { R as ResolvableValue, a as ResolvableProperties } from './shared/vue.9wC_EyGs.js';
|
|
4
|
+
export { B as BodyAttr, D as DeepResolvableProperties, b as Head, H as HtmlAttr, M as MaybeFalsy, b as ReactiveHead, o as ResolvableArray, e as ResolvableBase, l as ResolvableBodyAttributes, k as ResolvableHtmlAttributes, f as ResolvableLink, g as ResolvableMeta, j as ResolvableNoscript, i as ResolvableScript, h as ResolvableStyle, c as ResolvableTitle, d as ResolvableTitleTemplate, p as ResolvableUnion, m as UseHeadInput, U as UseHeadOptions, n as UseSeoMetaInput, V as VueHeadClient } from './shared/vue.9wC_EyGs.js';
|
|
5
5
|
import 'vue';
|
|
6
6
|
|
|
7
|
+
type SafeBodyAttr = ResolvableProperties<Pick<BodyAttributesWithoutEvents, 'id' | 'class' | 'style'> & DataKeys & SchemaAugmentations['bodyAttrs']>;
|
|
8
|
+
type SafeHtmlAttr = ResolvableProperties<Pick<HtmlAttributes$1, 'id' | 'class' | 'style' | 'lang' | 'dir'> & DataKeys & SchemaAugmentations['htmlAttrs']>;
|
|
9
|
+
type SafeMeta = ResolvableProperties<Pick<MetaGeneric, 'id' | 'name' | 'property' | 'charset' | 'content' | 'media'> & DataKeys & SchemaAugmentations['meta']>;
|
|
10
|
+
type SafeLink = ResolvableProperties<Pick<GenericLink, 'id' | 'color' | 'crossorigin' | 'fetchpriority' | 'href' | 'hreflang' | 'imagesrcset' | 'imagesizes' | 'integrity' | 'media' | 'referrerpolicy' | 'rel' | 'sizes' | 'type'> & DataKeys & SchemaAugmentations['link']>;
|
|
11
|
+
type SafeScript = ResolvableProperties<Pick<GenericScript, 'id' | 'type' | 'nonce' | 'blocking'> & DataKeys & {
|
|
12
|
+
textContent?: string;
|
|
13
|
+
} & TagPriority & TagPosition & ResolvesDuplicates & ProcessesTemplateParams>;
|
|
14
|
+
type SafeNoscript = ResolvableProperties<Pick<Noscript$1, 'id'> & DataKeys & Omit<SchemaAugmentations['noscript'], 'innerHTML'>>;
|
|
15
|
+
type SafeStyle = ResolvableProperties<Pick<Style$1, 'id' | 'media' | 'nonce' | 'title' | 'blocking'> & DataKeys & Omit<SchemaAugmentations['style'], 'innerHTML'>>;
|
|
16
|
+
interface HeadSafe extends Pick<ResolvableHead, 'title' | 'titleTemplate' | 'templateParams'> {
|
|
17
|
+
/**
|
|
18
|
+
* The `<link>` HTML element specifies relationships between the current document and an external resource.
|
|
19
|
+
* This element is most commonly used to link to stylesheets, but is also used to establish site icons
|
|
20
|
+
* (both "favicon" style icons and icons for the home screen and apps on mobile devices) among other things.
|
|
21
|
+
*
|
|
22
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as
|
|
23
|
+
*/
|
|
24
|
+
link?: ResolvableValue<ResolvableValue<SafeLink[]>>;
|
|
25
|
+
/**
|
|
26
|
+
* The `<meta>` element represents metadata that cannot be expressed in other HTML elements, like `<link>` or `<script>`.
|
|
27
|
+
*
|
|
28
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta
|
|
29
|
+
*/
|
|
30
|
+
meta?: ResolvableValue<ResolvableValue<SafeMeta>[]>;
|
|
31
|
+
/**
|
|
32
|
+
* The `<style>` HTML element contains style information for a document, or part of a document.
|
|
33
|
+
* It contains CSS, which is applied to the contents of the document containing the `<style>` element.
|
|
34
|
+
*
|
|
35
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style
|
|
36
|
+
*/
|
|
37
|
+
style?: ResolvableValue<ResolvableValue<(SafeStyle | string)>[]>;
|
|
38
|
+
/**
|
|
39
|
+
* The `<script>` HTML element is used to embed executable code or data; this is typically used to embed or refer to JavaScript code.
|
|
40
|
+
*
|
|
41
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
|
|
42
|
+
*/
|
|
43
|
+
script?: ResolvableValue<ResolvableValue<(SafeScript | string)>[]>;
|
|
44
|
+
/**
|
|
45
|
+
* The `<noscript>` HTML element defines a section of HTML to be inserted if a script type on the page is unsupported
|
|
46
|
+
* or if scripting is currently turned off in the browser.
|
|
47
|
+
*
|
|
48
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/noscript
|
|
49
|
+
*/
|
|
50
|
+
noscript?: ResolvableValue<ResolvableValue<(SafeNoscript | string)>[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Attributes for the `<html>` HTML element.
|
|
53
|
+
*
|
|
54
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html
|
|
55
|
+
*/
|
|
56
|
+
htmlAttrs?: ResolvableValue<SafeHtmlAttr>;
|
|
57
|
+
/**
|
|
58
|
+
* Attributes for the `<body>` HTML element.
|
|
59
|
+
*
|
|
60
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body
|
|
61
|
+
*/
|
|
62
|
+
bodyAttrs?: ResolvableValue<SafeBodyAttr>;
|
|
63
|
+
}
|
|
64
|
+
type UseHeadSafeInput = ResolvableValue<HeadSafe>;
|
|
65
|
+
|
|
66
|
+
/** @deprecated */
|
|
67
|
+
type MergeHead = object;
|
|
68
|
+
|
|
7
69
|
type Base = RawInput<'base'>;
|
|
8
70
|
type HtmlAttributes = RawInput<'htmlAttrs'>;
|
|
9
71
|
type Noscript = RawInput<'noscript'>;
|
|
@@ -13,4 +75,5 @@ type Script = RawInput<'script'>;
|
|
|
13
75
|
type Link = RawInput<'link'>;
|
|
14
76
|
type BodyAttributes = RawInput<'bodyAttrs'>;
|
|
15
77
|
|
|
16
|
-
export
|
|
78
|
+
export { ResolvableProperties, ResolvableValue };
|
|
79
|
+
export type { Base, BodyAttributes, HeadSafe, HtmlAttributes, Link, MergeHead, Meta, Noscript, SafeBodyAttr, SafeHtmlAttr, SafeLink, SafeMeta, SafeNoscript, SafeScript, SafeStyle, Script, Style, UseHeadSafeInput };
|
package/dist/utils.d.mts
CHANGED
|
@@ -3,9 +3,4 @@ export * from 'unhead/utils';
|
|
|
3
3
|
|
|
4
4
|
declare const VueResolver: PropResolver;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* @deprecated Use head.resolveTags() instead
|
|
8
|
-
*/
|
|
9
|
-
declare function resolveUnrefHeadInput<T extends Record<string, any>>(input: T): T;
|
|
10
|
-
|
|
11
|
-
export { VueResolver, resolveUnrefHeadInput };
|
|
6
|
+
export { VueResolver };
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,9 +3,4 @@ export * from 'unhead/utils';
|
|
|
3
3
|
|
|
4
4
|
declare const VueResolver: PropResolver;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
* @deprecated Use head.resolveTags() instead
|
|
8
|
-
*/
|
|
9
|
-
declare function resolveUnrefHeadInput<T extends Record<string, any>>(input: T): T;
|
|
10
|
-
|
|
11
|
-
export { VueResolver, resolveUnrefHeadInput };
|
|
6
|
+
export { VueResolver };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
export { V as VueResolver } from './shared/vue.N9zWjxoK.mjs';
|
|
2
2
|
export * from 'unhead/utils';
|
|
3
|
-
import { V as VueResolver } from './shared/vue.N9zWjxoK.mjs';
|
|
4
3
|
import 'vue';
|
|
5
|
-
|
|
6
|
-
// @__NO_SIDE_EFFECTS__
|
|
7
|
-
function resolveUnrefHeadInput(input) {
|
|
8
|
-
return walkResolver(input, VueResolver);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { VueResolver, resolveUnrefHeadInput };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unhead/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "3.0.0-beta.10",
|
|
5
5
|
"description": "Full-stack <head> manager built for Vue.",
|
|
6
6
|
"author": "Harlan Wilton <harlan@harlanzw.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,14 +37,18 @@
|
|
|
37
37
|
"types": "./dist/client.d.ts",
|
|
38
38
|
"default": "./dist/client.mjs"
|
|
39
39
|
},
|
|
40
|
+
"./stream/server": {
|
|
41
|
+
"types": "./dist/stream/server.d.ts",
|
|
42
|
+
"default": "./dist/stream/server.mjs"
|
|
43
|
+
},
|
|
44
|
+
"./stream/client": {
|
|
45
|
+
"types": "./dist/stream/client.d.ts",
|
|
46
|
+
"default": "./dist/stream/client.mjs"
|
|
47
|
+
},
|
|
40
48
|
"./types": {
|
|
41
49
|
"types": "./dist/types.d.ts",
|
|
42
50
|
"default": "./dist/types.mjs"
|
|
43
51
|
},
|
|
44
|
-
"./legacy": {
|
|
45
|
-
"types": "./dist/legacy.d.ts",
|
|
46
|
-
"default": "./dist/legacy.mjs"
|
|
47
|
-
},
|
|
48
52
|
"./plugins": {
|
|
49
53
|
"types": "./dist/plugins.d.ts",
|
|
50
54
|
"default": "./dist/plugins.mjs"
|
|
@@ -56,6 +60,10 @@
|
|
|
56
60
|
"./scripts": {
|
|
57
61
|
"types": "./dist/scripts.d.ts",
|
|
58
62
|
"default": "./dist/scripts.mjs"
|
|
63
|
+
},
|
|
64
|
+
"./stream/vite": {
|
|
65
|
+
"types": "./dist/stream/vite.d.ts",
|
|
66
|
+
"default": "./dist/stream/vite.mjs"
|
|
59
67
|
}
|
|
60
68
|
},
|
|
61
69
|
"main": "dist/index.mjs",
|
|
@@ -72,12 +80,15 @@
|
|
|
72
80
|
"client": [
|
|
73
81
|
"dist/client"
|
|
74
82
|
],
|
|
83
|
+
"stream/server": [
|
|
84
|
+
"dist/stream/server"
|
|
85
|
+
],
|
|
86
|
+
"stream/client": [
|
|
87
|
+
"dist/stream/client"
|
|
88
|
+
],
|
|
75
89
|
"types": [
|
|
76
90
|
"dist/types"
|
|
77
91
|
],
|
|
78
|
-
"legacy": [
|
|
79
|
-
"dist/legacy"
|
|
80
|
-
],
|
|
81
92
|
"plugins": [
|
|
82
93
|
"dist/plugins"
|
|
83
94
|
],
|
|
@@ -86,6 +97,9 @@
|
|
|
86
97
|
],
|
|
87
98
|
"scripts": [
|
|
88
99
|
"dist/scripts"
|
|
100
|
+
],
|
|
101
|
+
"stream/vite": [
|
|
102
|
+
"dist/stream/vite"
|
|
89
103
|
]
|
|
90
104
|
}
|
|
91
105
|
},
|
|
@@ -94,8 +108,14 @@
|
|
|
94
108
|
"dist"
|
|
95
109
|
],
|
|
96
110
|
"peerDependencies": {
|
|
111
|
+
"vite": ">=6",
|
|
97
112
|
"vue": ">=3.5.18"
|
|
98
113
|
},
|
|
114
|
+
"peerDependenciesMeta": {
|
|
115
|
+
"vite": {
|
|
116
|
+
"optional": true
|
|
117
|
+
}
|
|
118
|
+
},
|
|
99
119
|
"build": {
|
|
100
120
|
"external": [
|
|
101
121
|
"vue"
|
|
@@ -103,10 +123,14 @@
|
|
|
103
123
|
},
|
|
104
124
|
"dependencies": {
|
|
105
125
|
"hookable": "^6.0.1",
|
|
106
|
-
"
|
|
126
|
+
"magic-string": "^0.30.21",
|
|
127
|
+
"oxc-parser": "^0.106.0",
|
|
128
|
+
"oxc-walker": "^0.7.0",
|
|
129
|
+
"unhead": "3.0.0-beta.10"
|
|
107
130
|
},
|
|
108
131
|
"devDependencies": {
|
|
109
132
|
"@vue/server-renderer": "^3.5.26",
|
|
133
|
+
"vite": "^7.2.2",
|
|
110
134
|
"vue": "^3.5.26"
|
|
111
135
|
},
|
|
112
136
|
"scripts": {
|
package/dist/legacy.d.mts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as unhead_types from 'unhead/types';
|
|
2
|
-
import { CreateClientHeadOptions, ActiveHeadEntry } from 'unhead/types';
|
|
3
|
-
import { createUnhead } from 'unhead';
|
|
4
|
-
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.DoxLTFJk.mjs';
|
|
5
|
-
import { U as UseHeadSafeInput } from './shared/vue.DMlT7xkj.mjs';
|
|
6
|
-
import 'vue';
|
|
7
|
-
|
|
8
|
-
declare const createHeadCore: typeof createUnhead;
|
|
9
|
-
declare function resolveUnrefHeadInput(input: any): any;
|
|
10
|
-
declare function CapoPlugin(): unhead_types.HeadPluginInput;
|
|
11
|
-
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
12
|
-
declare function createServerHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Please switch to non-legacy version
|
|
15
|
-
*/
|
|
16
|
-
declare function setHeadInjectionHandler(handler: () => VueHeadClient<any> | undefined): void;
|
|
17
|
-
declare function injectHead(): VueHeadClient<any> | undefined;
|
|
18
|
-
declare function useHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadInput> | void;
|
|
19
|
-
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
20
|
-
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated use `useHead` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
23
|
-
*/
|
|
24
|
-
declare function useServerHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated use `useHeadSafe` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
27
|
-
*/
|
|
28
|
-
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated use `useSeoMeta` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
31
|
-
*/
|
|
32
|
-
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
33
|
-
|
|
34
|
-
export { CapoPlugin, createHead, createHeadCore, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|
package/dist/legacy.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import * as unhead_types from 'unhead/types';
|
|
2
|
-
import { CreateClientHeadOptions, ActiveHeadEntry } from 'unhead/types';
|
|
3
|
-
import { createUnhead } from 'unhead';
|
|
4
|
-
import { V as VueHeadClient, U as UseHeadInput, a as UseHeadOptions, b as UseSeoMetaInput } from './shared/vue.DoxLTFJk.js';
|
|
5
|
-
import { U as UseHeadSafeInput } from './shared/vue.CzjZUNjB.js';
|
|
6
|
-
import 'vue';
|
|
7
|
-
|
|
8
|
-
declare const createHeadCore: typeof createUnhead;
|
|
9
|
-
declare function resolveUnrefHeadInput(input: any): any;
|
|
10
|
-
declare function CapoPlugin(): unhead_types.HeadPluginInput;
|
|
11
|
-
declare function createHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
12
|
-
declare function createServerHead(options?: CreateClientHeadOptions): VueHeadClient;
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Please switch to non-legacy version
|
|
15
|
-
*/
|
|
16
|
-
declare function setHeadInjectionHandler(handler: () => VueHeadClient<any> | undefined): void;
|
|
17
|
-
declare function injectHead(): VueHeadClient<any> | undefined;
|
|
18
|
-
declare function useHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<UseHeadInput> | void;
|
|
19
|
-
declare function useHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
20
|
-
declare function useSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated use `useHead` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
23
|
-
*/
|
|
24
|
-
declare function useServerHead(input: UseHeadInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated use `useHeadSafe` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
27
|
-
*/
|
|
28
|
-
declare function useServerHeadSafe(input: UseHeadSafeInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated use `useSeoMeta` instead. Advanced use cases should tree shake using import.meta.* if statements.
|
|
31
|
-
*/
|
|
32
|
-
declare function useServerSeoMeta(input: UseSeoMetaInput, options?: UseHeadOptions): ActiveHeadEntry<any> | void;
|
|
33
|
-
|
|
34
|
-
export { CapoPlugin, createHead, createHeadCore, createServerHead, injectHead, resolveUnrefHeadInput, setHeadInjectionHandler, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
|