@unhead/schema 1.8.0-beta.8 → 1.8.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/dist/index.d.cts CHANGED
@@ -10,15 +10,23 @@ interface SSRHeadPayload {
10
10
  htmlAttrs: string;
11
11
  bodyAttrs: string;
12
12
  }
13
- type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error';
13
+ type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
14
14
  interface ScriptInstance<T> {
15
15
  id: string;
16
+ entry?: ActiveHeadEntry<any>;
16
17
  loaded: boolean;
17
18
  status: UseScriptStatus;
18
19
  load: () => Promise<T>;
19
- waitForUse: () => Promise<T>;
20
+ waitForLoad: () => Promise<T>;
21
+ remove: () => boolean;
20
22
  }
21
23
  interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
24
+ /**
25
+ * Should the `dns-prefetch` tag be skipped.
26
+ *
27
+ * Useful if loading the script through a local proxy.
28
+ */
29
+ skipEarlyConnections?: boolean;
22
30
  use?: () => T | undefined | null;
23
31
  stub?: ((ctx: {
24
32
  script: ScriptInstance<T>;
@@ -83,13 +91,7 @@ interface HeadHooks {
83
91
  'script:transform': (ctx: {
84
92
  script: Script;
85
93
  }) => HookResult;
86
- 'script:loaded': (ctx: {
87
- script: ScriptInstance<any>;
88
- }) => HookResult;
89
- 'script:error': (ctx: {
90
- script: ScriptInstance<any>;
91
- }) => HookResult;
92
- 'script:loading': (ctx: {
94
+ 'script:updated': (ctx: {
93
95
  script: ScriptInstance<any>;
94
96
  }) => HookResult;
95
97
  }
package/dist/index.d.mts CHANGED
@@ -10,15 +10,23 @@ interface SSRHeadPayload {
10
10
  htmlAttrs: string;
11
11
  bodyAttrs: string;
12
12
  }
13
- type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error';
13
+ type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
14
14
  interface ScriptInstance<T> {
15
15
  id: string;
16
+ entry?: ActiveHeadEntry<any>;
16
17
  loaded: boolean;
17
18
  status: UseScriptStatus;
18
19
  load: () => Promise<T>;
19
- waitForUse: () => Promise<T>;
20
+ waitForLoad: () => Promise<T>;
21
+ remove: () => boolean;
20
22
  }
21
23
  interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
24
+ /**
25
+ * Should the `dns-prefetch` tag be skipped.
26
+ *
27
+ * Useful if loading the script through a local proxy.
28
+ */
29
+ skipEarlyConnections?: boolean;
22
30
  use?: () => T | undefined | null;
23
31
  stub?: ((ctx: {
24
32
  script: ScriptInstance<T>;
@@ -83,13 +91,7 @@ interface HeadHooks {
83
91
  'script:transform': (ctx: {
84
92
  script: Script;
85
93
  }) => HookResult;
86
- 'script:loaded': (ctx: {
87
- script: ScriptInstance<any>;
88
- }) => HookResult;
89
- 'script:error': (ctx: {
90
- script: ScriptInstance<any>;
91
- }) => HookResult;
92
- 'script:loading': (ctx: {
94
+ 'script:updated': (ctx: {
93
95
  script: ScriptInstance<any>;
94
96
  }) => HookResult;
95
97
  }
package/dist/index.d.ts CHANGED
@@ -10,15 +10,23 @@ interface SSRHeadPayload {
10
10
  htmlAttrs: string;
11
11
  bodyAttrs: string;
12
12
  }
13
- type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error';
13
+ type UseScriptStatus = 'awaitingLoad' | 'loading' | 'loaded' | 'error' | 'removed';
14
14
  interface ScriptInstance<T> {
15
15
  id: string;
16
+ entry?: ActiveHeadEntry<any>;
16
17
  loaded: boolean;
17
18
  status: UseScriptStatus;
18
19
  load: () => Promise<T>;
19
- waitForUse: () => Promise<T>;
20
+ waitForLoad: () => Promise<T>;
21
+ remove: () => boolean;
20
22
  }
21
23
  interface UseScriptOptions<T> extends Omit<HeadEntryOptions, 'transform'> {
24
+ /**
25
+ * Should the `dns-prefetch` tag be skipped.
26
+ *
27
+ * Useful if loading the script through a local proxy.
28
+ */
29
+ skipEarlyConnections?: boolean;
22
30
  use?: () => T | undefined | null;
23
31
  stub?: ((ctx: {
24
32
  script: ScriptInstance<T>;
@@ -83,13 +91,7 @@ interface HeadHooks {
83
91
  'script:transform': (ctx: {
84
92
  script: Script;
85
93
  }) => HookResult;
86
- 'script:loaded': (ctx: {
87
- script: ScriptInstance<any>;
88
- }) => HookResult;
89
- 'script:error': (ctx: {
90
- script: ScriptInstance<any>;
91
- }) => HookResult;
92
- 'script:loading': (ctx: {
94
+ 'script:updated': (ctx: {
93
95
  script: ScriptInstance<any>;
94
96
  }) => HookResult;
95
97
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unhead/schema",
3
3
  "type": "module",
4
- "version": "1.8.0-beta.8",
4
+ "version": "1.8.0",
5
5
  "author": "Harlan Wilton <harlan@harlanzw.com>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/harlan-zw",
@@ -35,7 +35,7 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "hookable": "^5.5.3",
38
- "zhead": "^2.1.1"
38
+ "zhead": "^2.2.4"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "unbuild .",