@unhead/vue 1.3.4 → 1.3.7

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/index.cjs CHANGED
@@ -1,20 +1,28 @@
1
1
  'use strict';
2
2
 
3
3
  const unhead = require('unhead');
4
- const useHead = require('./shared/vue.1e06c522.cjs');
4
+ const useHead = require('./shared/vue.3633f8ad.cjs');
5
5
  const vue = require('vue');
6
6
  const shared = require('@unhead/shared');
7
7
 
8
8
  const VueHeadMixin = {
9
9
  created() {
10
- const instance = vue.getCurrentInstance();
11
- if (!instance)
12
- return;
13
- const options = instance.type;
14
- if (!options || !("head" in options))
15
- return;
16
- const source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
17
- useHead.useHead(source);
10
+ let source = false;
11
+ if (useHead.Vue3) {
12
+ const instance = vue.getCurrentInstance();
13
+ if (!instance)
14
+ return;
15
+ const options = instance.type;
16
+ if (!options || !("head" in options))
17
+ return;
18
+ source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
19
+ } else {
20
+ const head = this.$options.head;
21
+ if (head) {
22
+ source = typeof head === "function" ? () => head.call(this) : head;
23
+ }
24
+ }
25
+ source && useHead.useHead(source);
18
26
  }
19
27
  };
20
28
 
@@ -83,6 +91,7 @@ exports.createHeadCore = unhead.createHeadCore;
83
91
  exports.createHead = useHead.createHead;
84
92
  exports.createServerHead = useHead.createServerHead;
85
93
  exports.injectHead = useHead.injectHead;
94
+ exports.resolveUnrefHeadInput = useHead.resolveUnrefHeadInput;
86
95
  exports.useHead = useHead.useHead;
87
96
  exports.Vue2ProvideUnheadPlugin = Vue2ProvideUnheadPlugin;
88
97
  exports.VueHeadMixin = VueHeadMixin;
package/dist/index.d.ts CHANGED
@@ -19,6 +19,8 @@ type UseHeadSafeInput = MaybeComputedRef<HeadSafe>;
19
19
  declare function createServerHead<T extends MergeHead>(options?: Omit<CreateHeadOptions, 'domDelayFn' | 'document'>): VueHeadClient<T>;
20
20
  declare function createHead<T extends MergeHead>(options?: CreateHeadOptions): VueHeadClient<T>;
21
21
 
22
+ declare function resolveUnrefHeadInput(ref: any, lastKey?: string | number): any;
23
+
22
24
  declare const VueHeadMixin: {
23
25
  created(): void;
24
26
  };
@@ -43,4 +45,4 @@ declare function useServerHeadSafe(input: UseHeadSafeInput, options?: HeadEntryO
43
45
 
44
46
  declare function useServerSeoMeta(input: UseSeoMetaInput, options?: HeadEntryOptions): ActiveHeadEntry<any> | void;
45
47
 
46
- export { HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, ReactiveHead, UseHeadInput, UseHeadSafeInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, createHead, createServerHead, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
48
+ export { HeadSafe, MaybeComputedRef, MaybeComputedRefEntries, ReactiveHead, UseHeadInput, UseHeadSafeInput, UseSeoMetaInput, Vue2ProvideUnheadPlugin, VueHeadClient, VueHeadMixin, createHead, createServerHead, injectHead, resolveUnrefHeadInput, unheadVueComposablesImports, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
package/dist/index.mjs CHANGED
@@ -1,19 +1,27 @@
1
1
  export { CapoPlugin, HashHydrationPlugin, createHeadCore } from 'unhead';
2
- import { u as useHead, h as headSymbol, r as resolveUnrefHeadInput, i as injectHead } from './shared/vue.e6972f28.mjs';
3
- export { c as createHead, a as createServerHead } from './shared/vue.e6972f28.mjs';
2
+ import { V as Vue3, u as useHead, h as headSymbol, r as resolveUnrefHeadInput, i as injectHead } from './shared/vue.cf073917.mjs';
3
+ export { c as createHead, a as createServerHead } from './shared/vue.cf073917.mjs';
4
4
  import { getCurrentInstance, ref, watchEffect } from 'vue';
5
5
  import { composableNames, whitelistSafeInput, unpackMeta } from '@unhead/shared';
6
6
 
7
7
  const VueHeadMixin = {
8
8
  created() {
9
- const instance = getCurrentInstance();
10
- if (!instance)
11
- return;
12
- const options = instance.type;
13
- if (!options || !("head" in options))
14
- return;
15
- const source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
16
- useHead(source);
9
+ let source = false;
10
+ if (Vue3) {
11
+ const instance = getCurrentInstance();
12
+ if (!instance)
13
+ return;
14
+ const options = instance.type;
15
+ if (!options || !("head" in options))
16
+ return;
17
+ source = typeof options.head === "function" ? () => options.head.call(instance.proxy) : options.head;
18
+ } else {
19
+ const head = this.$options.head;
20
+ if (head) {
21
+ source = typeof head === "function" ? () => head.call(this) : head;
22
+ }
23
+ }
24
+ source && useHead(source);
17
25
  }
18
26
  };
19
27
 
@@ -76,4 +84,4 @@ function useServerSeoMeta(input, options) {
76
84
  return useSeoMeta(input, { ...options || {}, mode: "server" });
77
85
  }
78
86
 
79
- export { Vue2ProvideUnheadPlugin, VueHeadMixin, injectHead, unheadVueComposablesImports, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
87
+ export { Vue2ProvideUnheadPlugin, VueHeadMixin, injectHead, resolveUnrefHeadInput, unheadVueComposablesImports, useHead, useHeadSafe, useSeoMeta, useServerHead, useServerHeadSafe, useServerSeoMeta };
package/dist/polyfill.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const useHead = require('./shared/vue.1e06c522.cjs');
3
+ const useHead = require('./shared/vue.3633f8ad.cjs');
4
4
  require('vue');
5
5
  require('unhead');
6
6
  require('@unhead/shared');
package/dist/polyfill.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { u as useHead } from './shared/vue.e6972f28.mjs';
1
+ import { u as useHead } from './shared/vue.cf073917.mjs';
2
2
  import 'vue';
3
3
  import 'unhead';
4
4
  import '@unhead/shared';
@@ -102,6 +102,7 @@ function clientUseHead(head, input, options = {}) {
102
102
  return entry;
103
103
  }
104
104
 
105
+ exports.Vue3 = Vue3;
105
106
  exports.createHead = createHead;
106
107
  exports.createServerHead = createServerHead;
107
108
  exports.headSymbol = headSymbol;
@@ -100,4 +100,4 @@ function clientUseHead(head, input, options = {}) {
100
100
  return entry;
101
101
  }
102
102
 
103
- export { createServerHead as a, createHead as c, headSymbol as h, injectHead as i, resolveUnrefHeadInput as r, useHead as u };
103
+ export { Vue3 as V, createServerHead as a, createHead as c, headSymbol as h, injectHead as i, resolveUnrefHeadInput as r, useHead as u };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/vue",
3
3
  "type": "module",
4
- "version": "1.3.4",
4
+ "version": "1.3.7",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -38,9 +38,9 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "hookable": "^5.5.3",
41
- "@unhead/schema": "1.3.4",
42
- "@unhead/shared": "1.3.4",
43
- "unhead": "1.3.4"
41
+ "@unhead/schema": "1.3.7",
42
+ "@unhead/shared": "1.3.7",
43
+ "unhead": "1.3.7"
44
44
  },
45
45
  "devDependencies": {
46
46
  "vue": "^3.3.4"