@celestia-island/hikari 0.55.180 → 0.55.181

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.180",
3
+ "version": "0.55.181",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari Vue 3 component library — production-grade UI components based on shittim-chest design system",
@@ -58,6 +58,7 @@
58
58
  "vue": "^*"
59
59
  },
60
60
  "dependencies": {
61
+ "@celestia-island/tairitsu-transport": "^0.1",
61
62
  "@xterm/addon-fit": "^0.*",
62
63
  "@xterm/addon-image": "^0.10.0-beta.301",
63
64
  "@xterm/xterm": "^6.1.0-beta.304",
@@ -6,6 +6,8 @@
6
6
  * fails the origin is unreachable, otherwise the host responded but the
7
7
  * CORS policy rejected the credentialed request.
8
8
  */
9
+ import { bindHostFetch } from "@celestia-island/tairitsu-transport/contract";
10
+
9
11
  export type OriginProbe =
10
12
  | { ok: true }
11
13
  | { ok: false; reason: "unreachable" | "cors-blocked" };
@@ -16,8 +18,9 @@ export async function probeOrigin(
16
18
  ): Promise<OriginProbe> {
17
19
  // Bare `?? fetch` detaches Window's fetch receiver — the default path
18
20
  // throws "Illegal invocation" in a browser (2026-10-17 chest live
19
- // report family). bind(globalThis) re-attaches it, re-resolved per call.
20
- const fetchFn = opts?.fetchFn ?? fetch.bind(globalThis);
21
+ // report family). The shared bindHostFetch() from tairitsu-transport is
22
+ // the one sanctioned acquisition, re-resolved per call.
23
+ const fetchFn = opts?.fetchFn ?? bindHostFetch();
21
24
  try {
22
25
  // A successful credentialed fetch means reachable + CORS-whitelisted,
23
26
  // regardless of the HTTP status code (4xx/5xx still prove the origin).
@@ -45,7 +48,7 @@ export async function probeOriginWithBody(
45
48
  opts?: { fetchFn?: typeof fetch },
46
49
  ): Promise<{ ok: boolean; body?: string }> {
47
50
  // Same receiver rule as probeOrigin: never capture Window's fetch bare.
48
- const fetchFn = opts?.fetchFn ?? fetch.bind(globalThis);
51
+ const fetchFn = opts?.fetchFn ?? bindHostFetch();
49
52
  try {
50
53
  const resp = await fetchFn(url, { credentials: "include", mode: "cors" });
51
54
  return { ok: true, body: await resp.text().catch(() => undefined) };
@@ -9,6 +9,8 @@
9
9
  * Pure function, no app config — callers bring the URL.
10
10
  */
11
11
 
12
+ import { bindHostFetch } from "@celestia-island/tairitsu-transport/contract";
13
+
12
14
  /** Minimal subset shared by all `/api/health` consumers. */
13
15
  export interface HealthProbeBody {
14
16
  status: string;
@@ -43,8 +45,9 @@ export async function probeHealthEndpoint(
43
45
  // Bare `?? fetch` captures Window's fetch detached — every default
44
46
  // call throws "Illegal invocation" in a browser (2026-10-17 chest live
45
47
  // report; the probe then silently reported every panel unreachable).
46
- // bind(globalThis) re-attaches the receiver and re-resolves per call.
47
- const fetchFn = opts.fetchFn ?? fetch.bind(globalThis);
48
+ // The shared bindHostFetch() from tairitsu-transport re-attaches the
49
+ // receiver and re-resolves per call.
50
+ const fetchFn = opts.fetchFn ?? bindHostFetch();
48
51
  const started = performance.now();
49
52
  try {
50
53
  const resp = await fetchFn(url, {
@@ -1,3 +1,4 @@
1
+ import { bindHostFetch } from "@celestia-island/tairitsu-transport/contract";
1
2
  import { solvePow, type PowChallenge } from "./pow";
2
3
 
3
4
  export type ChallengeDescriptor =
@@ -31,9 +32,10 @@ export async function fetchChallenge(
31
32
  baseUrl: string,
32
33
  // Bare `= fetch` captures Window's fetch detached — the default throws
33
34
  // "Illegal invocation" in a browser (2026-10-17 chest live report
34
- // family). bind(globalThis) re-attaches the receiver, re-resolved per
35
- // call so vi.stubGlobal stubs stay visible.
36
- fetchFn: typeof fetch = fetch.bind(globalThis),
35
+ // family). The shared bindHostFetch() from tairitsu-transport
36
+ // re-attaches the receiver, re-resolved per call so vi.stubGlobal
37
+ // stubs stay visible.
38
+ fetchFn: typeof fetch = bindHostFetch(),
37
39
  ): Promise<ChallengeDescriptor | undefined> {
38
40
  let resp: Response;
39
41
  try {
@@ -64,7 +66,7 @@ export async function negotiateNonce(
64
66
  ): Promise<string | undefined> {
65
67
  try {
66
68
  // Same receiver rule as fetchChallenge's default: never bare `?? fetch`.
67
- const fetchFn = opts?.fetchFn ?? fetch.bind(globalThis);
69
+ const fetchFn = opts?.fetchFn ?? bindHostFetch();
68
70
  let body: Record<string, unknown> | undefined;
69
71
  if (opts?.captchaToken) {
70
72
  body = { type: "captcha", token: opts.captchaToken };