@unhead/schema 1.8.0-beta.9 → 1.8.1

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
@@ -17,16 +17,22 @@ interface ScriptInstance<T> {
17
17
  loaded: boolean;
18
18
  status: UseScriptStatus;
19
19
  load: () => Promise<T>;
20
- waitForUse: () => Promise<T>;
20
+ waitForLoad: () => Promise<T>;
21
21
  remove: () => boolean;
22
22
  }
23
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;
24
30
  use?: () => T | undefined | null;
25
31
  stub?: ((ctx: {
26
32
  script: ScriptInstance<T>;
27
33
  fn: string | symbol;
28
34
  }) => any);
29
- transform?: (script: Script) => Promise<Script> | Script;
35
+ transform?: (script: UseScriptInput) => Promise<UseScriptInput> | UseScriptInput;
30
36
  trigger?: 'idle' | 'manual' | Promise<void>;
31
37
  }
32
38
  type UseScriptInput = Omit<Script, 'src'> & {
@@ -83,7 +89,7 @@ interface HeadHooks {
83
89
  }) => HookResult;
84
90
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
85
91
  'script:transform': (ctx: {
86
- script: Script;
92
+ script: UseScriptInput;
87
93
  }) => HookResult;
88
94
  'script:updated': (ctx: {
89
95
  script: ScriptInstance<any>;
package/dist/index.d.mts CHANGED
@@ -17,16 +17,22 @@ interface ScriptInstance<T> {
17
17
  loaded: boolean;
18
18
  status: UseScriptStatus;
19
19
  load: () => Promise<T>;
20
- waitForUse: () => Promise<T>;
20
+ waitForLoad: () => Promise<T>;
21
21
  remove: () => boolean;
22
22
  }
23
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;
24
30
  use?: () => T | undefined | null;
25
31
  stub?: ((ctx: {
26
32
  script: ScriptInstance<T>;
27
33
  fn: string | symbol;
28
34
  }) => any);
29
- transform?: (script: Script) => Promise<Script> | Script;
35
+ transform?: (script: UseScriptInput) => Promise<UseScriptInput> | UseScriptInput;
30
36
  trigger?: 'idle' | 'manual' | Promise<void>;
31
37
  }
32
38
  type UseScriptInput = Omit<Script, 'src'> & {
@@ -83,7 +89,7 @@ interface HeadHooks {
83
89
  }) => HookResult;
84
90
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
85
91
  'script:transform': (ctx: {
86
- script: Script;
92
+ script: UseScriptInput;
87
93
  }) => HookResult;
88
94
  'script:updated': (ctx: {
89
95
  script: ScriptInstance<any>;
package/dist/index.d.ts CHANGED
@@ -17,16 +17,22 @@ interface ScriptInstance<T> {
17
17
  loaded: boolean;
18
18
  status: UseScriptStatus;
19
19
  load: () => Promise<T>;
20
- waitForUse: () => Promise<T>;
20
+ waitForLoad: () => Promise<T>;
21
21
  remove: () => boolean;
22
22
  }
23
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;
24
30
  use?: () => T | undefined | null;
25
31
  stub?: ((ctx: {
26
32
  script: ScriptInstance<T>;
27
33
  fn: string | symbol;
28
34
  }) => any);
29
- transform?: (script: Script) => Promise<Script> | Script;
35
+ transform?: (script: UseScriptInput) => Promise<UseScriptInput> | UseScriptInput;
30
36
  trigger?: 'idle' | 'manual' | Promise<void>;
31
37
  }
32
38
  type UseScriptInput = Omit<Script, 'src'> & {
@@ -83,7 +89,7 @@ interface HeadHooks {
83
89
  }) => HookResult;
84
90
  'ssr:rendered': (ctx: SSRRenderContext) => HookResult;
85
91
  'script:transform': (ctx: {
86
- script: Script;
92
+ script: UseScriptInput;
87
93
  }) => HookResult;
88
94
  'script:updated': (ctx: {
89
95
  script: ScriptInstance<any>;
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.9",
4
+ "version": "1.8.1",
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 .",