unhead 1.9.13 → 1.9.15

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
@@ -468,7 +468,7 @@ function useScript(_input, _options) {
468
468
  _fn?.(e);
469
469
  };
470
470
  });
471
- const proxy = { value: !head.ssr && options?.use?.() || {} };
471
+ const proxy = { instance: !head.ssr && options?.use?.() || {} };
472
472
  const loadPromise = new Promise((resolve, reject) => {
473
473
  const emit = (api) => requestAnimationFrame(() => resolve(api));
474
474
  const _ = head.hooks.hook("script:updated", ({ script: script2 }) => {
@@ -486,7 +486,7 @@ function useScript(_input, _options) {
486
486
  _();
487
487
  }
488
488
  });
489
- }).then((api) => proxy.value = api);
489
+ }).then((api) => proxy.instance = api);
490
490
  const script = {
491
491
  id,
492
492
  status: "awaitingLoad",
@@ -524,16 +524,16 @@ function useScript(_input, _options) {
524
524
  trigger.then(script.load);
525
525
  else if (typeof trigger === "function")
526
526
  trigger(async () => script.load());
527
+ proxy.$script = Object.assign(loadPromise, script);
527
528
  const instance = new Proxy(proxy, {
528
- get({ value: _ }, k) {
529
- const $script = Object.assign(loadPromise, script);
530
- const stub = options.stub?.({ script: $script, fn: k });
529
+ get({ instance: _ }, k) {
530
+ const stub = options.stub?.({ script: proxy.$script, fn: k });
531
531
  if (stub)
532
532
  return stub;
533
533
  if (k === "$script")
534
- return $script;
535
- const exists = k in _ && typeof _[k] !== "undefined";
536
- head.hooks.callHook("script:instance-fn", { script, fn: k, exists: k in _ });
534
+ return proxy.$script;
535
+ const exists = _ && k in _ && typeof _[k] !== "undefined";
536
+ head.hooks.callHook("script:instance-fn", { script, fn: k, exists });
537
537
  return exists ? Reflect.get(_, k) : (...args) => loadPromise.then((api) => {
538
538
  const _k = Reflect.get(api, k);
539
539
  return typeof _k === "function" ? Reflect.apply(api[k], api, args) : _k;
package/dist/index.mjs CHANGED
@@ -467,7 +467,7 @@ function useScript(_input, _options) {
467
467
  _fn?.(e);
468
468
  };
469
469
  });
470
- const proxy = { value: !head.ssr && options?.use?.() || {} };
470
+ const proxy = { instance: !head.ssr && options?.use?.() || {} };
471
471
  const loadPromise = new Promise((resolve, reject) => {
472
472
  const emit = (api) => requestAnimationFrame(() => resolve(api));
473
473
  const _ = head.hooks.hook("script:updated", ({ script: script2 }) => {
@@ -485,7 +485,7 @@ function useScript(_input, _options) {
485
485
  _();
486
486
  }
487
487
  });
488
- }).then((api) => proxy.value = api);
488
+ }).then((api) => proxy.instance = api);
489
489
  const script = {
490
490
  id,
491
491
  status: "awaitingLoad",
@@ -523,16 +523,16 @@ function useScript(_input, _options) {
523
523
  trigger.then(script.load);
524
524
  else if (typeof trigger === "function")
525
525
  trigger(async () => script.load());
526
+ proxy.$script = Object.assign(loadPromise, script);
526
527
  const instance = new Proxy(proxy, {
527
- get({ value: _ }, k) {
528
- const $script = Object.assign(loadPromise, script);
529
- const stub = options.stub?.({ script: $script, fn: k });
528
+ get({ instance: _ }, k) {
529
+ const stub = options.stub?.({ script: proxy.$script, fn: k });
530
530
  if (stub)
531
531
  return stub;
532
532
  if (k === "$script")
533
- return $script;
534
- const exists = k in _ && typeof _[k] !== "undefined";
535
- head.hooks.callHook("script:instance-fn", { script, fn: k, exists: k in _ });
533
+ return proxy.$script;
534
+ const exists = _ && k in _ && typeof _[k] !== "undefined";
535
+ head.hooks.callHook("script:instance-fn", { script, fn: k, exists });
536
536
  return exists ? Reflect.get(_, k) : (...args) => loadPromise.then((api) => {
537
537
  const _k = Reflect.get(api, k);
538
538
  return typeof _k === "function" ? Reflect.apply(api[k], api, args) : _k;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unhead",
3
3
  "type": "module",
4
- "version": "1.9.13",
4
+ "version": "1.9.15",
5
5
  "author": {
6
6
  "name": "Harlan Wilton",
7
7
  "email": "harlan@harlanzw.com",
@@ -34,9 +34,9 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "hookable": "^5.5.3",
37
- "@unhead/dom": "1.9.13",
38
- "@unhead/shared": "1.9.13",
39
- "@unhead/schema": "1.9.13"
37
+ "@unhead/dom": "1.9.15",
38
+ "@unhead/schema": "1.9.15",
39
+ "@unhead/shared": "1.9.15"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "unbuild .",