@unhead/shared 2.0.0-alpha.8 → 2.0.0

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/README.md CHANGED
@@ -1,16 +1,10 @@
1
- # `@unhead/schema`
1
+ # Deprecated: `@unhead/shared`
2
2
 
3
- Typescript definitions for document `<head>`.
3
+ Shared utils needed for Unhead. This is deprecated and only acts as alias of `unhead/utils`.
4
4
 
5
- ## Installation
5
+ ## Migration
6
6
 
7
- ```bash
8
- npm install --save-dev @unhead/schema
9
-
10
- # Using yarn
11
- yarn add --dev @unhead/schema
7
+ ```diff
8
+ -import { Head } from '@unhead/shared'
9
+ +import { Head } from 'unhead/utils'
12
10
  ```
13
-
14
- ## Types
15
-
16
- See [head.ts](./src/head.ts) for the full list of types.
package/dist/index.d.mts CHANGED
@@ -1,66 +1 @@
1
- import { HeadPluginInput, HeadTag, BaseMeta, MetaFlatInput, Head, HeadEntry, MaybeArray, HeadSafe, Unhead, TemplateParams } from '@unhead/schema';
2
-
3
- declare const SelfClosingTags: Set<string>;
4
- declare const DupeableTags: Set<string>;
5
- declare const TagsWithInnerContent: Set<string>;
6
- declare const HasElementTags: Set<string>;
7
- declare const ValidHeadTags: Set<string>;
8
- declare const UniqueTags: Set<string>;
9
- declare const TagConfigKeys: Set<string>;
10
- declare const IsBrowser: boolean;
11
- declare const composableNames: string[];
12
- declare const NetworkEvents: Set<string>;
13
- declare const ScriptNetworkEvents: Set<string>;
14
-
15
- declare function defineHeadPlugin(plugin: HeadPluginInput): HeadPluginInput;
16
-
17
- declare function hashCode(s: string): string;
18
- declare function hashTag(tag: HeadTag): string;
19
-
20
- declare function resolveMetaKeyType(key: string): keyof BaseMeta;
21
- declare function resolveMetaKeyValue(key: string): string;
22
- declare function resolvePackedMetaObjectValue(value: string, key: string): string;
23
- /**
24
- * Converts a flat meta object into an array of meta entries.
25
- * @param input
26
- */
27
- declare function unpackMeta<T extends MetaFlatInput>(input: T): Required<Head>['meta'];
28
- /**
29
- * Convert an array of meta entries to a flat object.
30
- * @param inputs
31
- */
32
- declare function packMeta<T extends Required<Head>['meta']>(inputs: T): MetaFlatInput;
33
-
34
- declare function normaliseTag<T extends HeadTag>(tagName: T['tag'], input: HeadTag['props'] | string, e: HeadEntry<T>, normalizedProps?: HeadTag['props']): T | T[];
35
- declare function normaliseStyleClassProps<T extends 'class' | 'style'>(key: T, v: Required<Required<Head>['htmlAttrs']['class']> | Required<Required<Head>['htmlAttrs']['style']>): string;
36
- declare function normaliseProps<T extends HeadTag>(props: T['props'], virtual?: boolean): T["props"];
37
- declare const TagEntityBits = 10;
38
- declare function normaliseEntryTags<T extends object = Head>(e: HeadEntry<T>): HeadTag[];
39
-
40
- declare function whitelistSafeInput(input: Record<string, MaybeArray<Record<string, string>>>): HeadSafe;
41
-
42
- declare const TAG_WEIGHTS: {
43
- readonly base: -10;
44
- readonly title: 10;
45
- };
46
- declare const TAG_ALIASES: {
47
- readonly critical: -80;
48
- readonly high: -10;
49
- readonly low: 20;
50
- };
51
- declare const SortModifiers: {
52
- prefix: string;
53
- offset: number;
54
- }[];
55
- declare function tagWeight<T extends HeadTag>(head: Unhead<any>, tag: T): number;
56
-
57
- declare function tagDedupeKey<T extends HeadTag>(tag: T): string | false;
58
-
59
- declare function processTemplateParams(s: string, p: TemplateParams, sep: string, isJson?: boolean): string;
60
-
61
- declare function resolveTitleTemplate(template: string | ((title?: string) => string | null) | null, title?: string): string | null;
62
-
63
- type Arrayable<T> = T | Array<T>;
64
- declare function asArray<T>(value: Arrayable<T>): T[];
65
-
66
- export { type Arrayable, DupeableTags, HasElementTags, IsBrowser, NetworkEvents, ScriptNetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseEntryTags, normaliseProps, normaliseStyleClassProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
1
+ export * from 'unhead/utils';
package/dist/index.d.ts CHANGED
@@ -1,66 +1 @@
1
- import { HeadPluginInput, HeadTag, BaseMeta, MetaFlatInput, Head, HeadEntry, MaybeArray, HeadSafe, Unhead, TemplateParams } from '@unhead/schema';
2
-
3
- declare const SelfClosingTags: Set<string>;
4
- declare const DupeableTags: Set<string>;
5
- declare const TagsWithInnerContent: Set<string>;
6
- declare const HasElementTags: Set<string>;
7
- declare const ValidHeadTags: Set<string>;
8
- declare const UniqueTags: Set<string>;
9
- declare const TagConfigKeys: Set<string>;
10
- declare const IsBrowser: boolean;
11
- declare const composableNames: string[];
12
- declare const NetworkEvents: Set<string>;
13
- declare const ScriptNetworkEvents: Set<string>;
14
-
15
- declare function defineHeadPlugin(plugin: HeadPluginInput): HeadPluginInput;
16
-
17
- declare function hashCode(s: string): string;
18
- declare function hashTag(tag: HeadTag): string;
19
-
20
- declare function resolveMetaKeyType(key: string): keyof BaseMeta;
21
- declare function resolveMetaKeyValue(key: string): string;
22
- declare function resolvePackedMetaObjectValue(value: string, key: string): string;
23
- /**
24
- * Converts a flat meta object into an array of meta entries.
25
- * @param input
26
- */
27
- declare function unpackMeta<T extends MetaFlatInput>(input: T): Required<Head>['meta'];
28
- /**
29
- * Convert an array of meta entries to a flat object.
30
- * @param inputs
31
- */
32
- declare function packMeta<T extends Required<Head>['meta']>(inputs: T): MetaFlatInput;
33
-
34
- declare function normaliseTag<T extends HeadTag>(tagName: T['tag'], input: HeadTag['props'] | string, e: HeadEntry<T>, normalizedProps?: HeadTag['props']): T | T[];
35
- declare function normaliseStyleClassProps<T extends 'class' | 'style'>(key: T, v: Required<Required<Head>['htmlAttrs']['class']> | Required<Required<Head>['htmlAttrs']['style']>): string;
36
- declare function normaliseProps<T extends HeadTag>(props: T['props'], virtual?: boolean): T["props"];
37
- declare const TagEntityBits = 10;
38
- declare function normaliseEntryTags<T extends object = Head>(e: HeadEntry<T>): HeadTag[];
39
-
40
- declare function whitelistSafeInput(input: Record<string, MaybeArray<Record<string, string>>>): HeadSafe;
41
-
42
- declare const TAG_WEIGHTS: {
43
- readonly base: -10;
44
- readonly title: 10;
45
- };
46
- declare const TAG_ALIASES: {
47
- readonly critical: -80;
48
- readonly high: -10;
49
- readonly low: 20;
50
- };
51
- declare const SortModifiers: {
52
- prefix: string;
53
- offset: number;
54
- }[];
55
- declare function tagWeight<T extends HeadTag>(head: Unhead<any>, tag: T): number;
56
-
57
- declare function tagDedupeKey<T extends HeadTag>(tag: T): string | false;
58
-
59
- declare function processTemplateParams(s: string, p: TemplateParams, sep: string, isJson?: boolean): string;
60
-
61
- declare function resolveTitleTemplate(template: string | ((title?: string) => string | null) | null, title?: string): string | null;
62
-
63
- type Arrayable<T> = T | Array<T>;
64
- declare function asArray<T>(value: Arrayable<T>): T[];
65
-
66
- export { type Arrayable, DupeableTags, HasElementTags, IsBrowser, NetworkEvents, ScriptNetworkEvents, SelfClosingTags, SortModifiers, TAG_ALIASES, TAG_WEIGHTS, TagConfigKeys, TagEntityBits, TagsWithInnerContent, UniqueTags, ValidHeadTags, asArray, composableNames, defineHeadPlugin, hashCode, hashTag, normaliseEntryTags, normaliseProps, normaliseStyleClassProps, normaliseTag, packMeta, processTemplateParams, resolveMetaKeyType, resolveMetaKeyValue, resolvePackedMetaObjectValue, resolveTitleTemplate, tagDedupeKey, tagWeight, unpackMeta, whitelistSafeInput };
1
+ export * from 'unhead/utils';