@absolutejs/absolute 0.19.0-beta.1027 → 0.19.0-beta.1029
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/cli/index.js +186 -12
- package/dist/react/browser.js +1 -28
- package/dist/react/browser.js.map +3 -4
- package/dist/react/index.js +1 -28
- package/dist/react/index.js.map +3 -4
- package/dist/react/router/browser.js +95 -0
- package/dist/react/router/browser.js.map +10 -0
- package/dist/react/router/index.js +95 -0
- package/dist/react/router/index.js.map +10 -0
- package/dist/src/cli/discoverInstances.d.ts +5 -0
- package/dist/src/react/browser.d.ts +0 -2
- package/dist/src/react/index.d.ts +0 -2
- package/dist/src/react/router/UniversalRouter.d.ts +43 -0
- package/dist/src/react/router/browser.d.ts +2 -0
- package/dist/src/react/router/index.d.ts +2 -0
- package/dist/src/utils/portScan.d.ts +22 -0
- package/dist/types/cli.d.ts +1 -1
- package/package.json +11 -1
- package/dist/src/react/UniversalRouter.d.ts +0 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-Ye9d69/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-Ye9d69/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
|
48
48
|
getWarningController()?.maybeWarn(primitiveName);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// .angular-partial-tmp-
|
|
51
|
+
// .angular-partial-tmp-Ye9d69/src/core/streamingSlotRegistry.ts
|
|
52
52
|
var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
|
|
53
53
|
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
54
54
|
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
package/dist/cli/index.js
CHANGED
|
@@ -652,8 +652,99 @@ var init_loadConfig = __esm(() => {
|
|
|
652
652
|
]);
|
|
653
653
|
});
|
|
654
654
|
|
|
655
|
-
// src/
|
|
655
|
+
// src/utils/portScan.ts
|
|
656
656
|
var {$ } = globalThis.Bun;
|
|
657
|
+
var parsePort = (address) => {
|
|
658
|
+
const match = address.replace(/\(LISTEN\)$/, "").match(/:(\d+)$/);
|
|
659
|
+
return match ? Number(match[1]) : null;
|
|
660
|
+
}, parseLsof = (text) => {
|
|
661
|
+
const seen = new Set;
|
|
662
|
+
const listeners = [];
|
|
663
|
+
for (const line of text.split(`
|
|
664
|
+
`)) {
|
|
665
|
+
if (line.length === 0 || line.startsWith("COMMAND"))
|
|
666
|
+
continue;
|
|
667
|
+
const tokens = line.trim().split(/\s+/);
|
|
668
|
+
const [, pidText] = tokens;
|
|
669
|
+
const pid = Number(pidText);
|
|
670
|
+
const address = tokens.find((token) => /:\d+$/.test(token));
|
|
671
|
+
const port = address ? parsePort(address) : null;
|
|
672
|
+
if (!Number.isInteger(pid) || port === null)
|
|
673
|
+
continue;
|
|
674
|
+
const key = `${pid}:${port}`;
|
|
675
|
+
if (seen.has(key))
|
|
676
|
+
continue;
|
|
677
|
+
seen.add(key);
|
|
678
|
+
listeners.push({ pid, port });
|
|
679
|
+
}
|
|
680
|
+
return listeners;
|
|
681
|
+
}, parseSs = (text) => {
|
|
682
|
+
const seen = new Set;
|
|
683
|
+
const listeners = [];
|
|
684
|
+
for (const line of text.split(`
|
|
685
|
+
`)) {
|
|
686
|
+
if (line.trim().length === 0)
|
|
687
|
+
continue;
|
|
688
|
+
const [, , , local] = line.trim().split(/\s+/);
|
|
689
|
+
const port = local ? parsePort(local) : null;
|
|
690
|
+
const pidMatch = line.match(/pid=(\d+)/);
|
|
691
|
+
if (port === null || !pidMatch)
|
|
692
|
+
continue;
|
|
693
|
+
const pid = Number(pidMatch[1]);
|
|
694
|
+
const key = `${pid}:${port}`;
|
|
695
|
+
if (seen.has(key))
|
|
696
|
+
continue;
|
|
697
|
+
seen.add(key);
|
|
698
|
+
listeners.push({ pid, port });
|
|
699
|
+
}
|
|
700
|
+
return listeners;
|
|
701
|
+
}, rawListeners = async () => {
|
|
702
|
+
const lsof = await $`lsof -nP -iTCP -sTCP:LISTEN`.quiet().nothrow().text();
|
|
703
|
+
if (lsof.trim().length > 0)
|
|
704
|
+
return parseLsof(lsof);
|
|
705
|
+
const ssOutput = await $`ss -ltnpH`.quiet().nothrow().text();
|
|
706
|
+
if (ssOutput.trim().length > 0)
|
|
707
|
+
return parseSs(ssOutput);
|
|
708
|
+
return [];
|
|
709
|
+
}, describeProcesses = async (pids) => {
|
|
710
|
+
const details = new Map;
|
|
711
|
+
if (pids.length === 0)
|
|
712
|
+
return details;
|
|
713
|
+
const output = await $`ps -o pid=,etimes=,args= -p ${pids.join(",")}`.quiet().nothrow().text();
|
|
714
|
+
for (const line of output.split(`
|
|
715
|
+
`)) {
|
|
716
|
+
const trimmed = line.trim();
|
|
717
|
+
if (trimmed.length === 0)
|
|
718
|
+
continue;
|
|
719
|
+
const match = trimmed.match(/^(\d+)\s+(\d+)\s+(.*)$/);
|
|
720
|
+
if (!match)
|
|
721
|
+
continue;
|
|
722
|
+
const [, pidText, etimesText, command = ""] = match;
|
|
723
|
+
details.set(Number(pidText), { command, etimes: Number(etimesText) });
|
|
724
|
+
}
|
|
725
|
+
return details;
|
|
726
|
+
}, scanListeners = async () => {
|
|
727
|
+
const listeners = await rawListeners();
|
|
728
|
+
const pids = [...new Set(listeners.map((listener) => listener.pid))].filter((pid) => pid !== process.pid && pid > 0);
|
|
729
|
+
const details = await describeProcesses(pids);
|
|
730
|
+
return listeners.flatMap((listener) => {
|
|
731
|
+
const detail = details.get(listener.pid);
|
|
732
|
+
if (!detail)
|
|
733
|
+
return [];
|
|
734
|
+
return [
|
|
735
|
+
{
|
|
736
|
+
command: detail.command,
|
|
737
|
+
etimes: detail.etimes,
|
|
738
|
+
pid: listener.pid,
|
|
739
|
+
port: listener.port
|
|
740
|
+
}
|
|
741
|
+
];
|
|
742
|
+
});
|
|
743
|
+
};
|
|
744
|
+
var init_portScan = () => {};
|
|
745
|
+
|
|
746
|
+
// src/cli/utils.ts
|
|
747
|
+
var {$: $2 } = globalThis.Bun;
|
|
657
748
|
import { execSync } from "child_process";
|
|
658
749
|
import { existsSync as existsSync3, readFileSync as readFileSync5 } from "fs";
|
|
659
750
|
import { resolve as resolve2 } from "path";
|
|
@@ -745,14 +836,14 @@ var COMPOSE_PATH = "db/docker-compose.db.yml", DEFAULT_SERVER_ENTRY = "src/backe
|
|
|
745
836
|
return { downCommand, upCommand };
|
|
746
837
|
}, startDatabase = async (scripts) => {
|
|
747
838
|
await timed("Starting database container...", async () => {
|
|
748
|
-
const { exitCode } = await
|
|
839
|
+
const { exitCode } = await $2`${{ raw: scripts.upCommand }}`.quiet().nothrow();
|
|
749
840
|
if (exitCode !== 0)
|
|
750
841
|
process.exit(exitCode);
|
|
751
842
|
});
|
|
752
843
|
}, stopDatabase = async (scripts) => {
|
|
753
844
|
console.log(`
|
|
754
845
|
Stopping database container...`);
|
|
755
|
-
await
|
|
846
|
+
await $2`${{ raw: scripts.downCommand }}`.quiet().nothrow();
|
|
756
847
|
}, timed = async (label, task) => {
|
|
757
848
|
process.stdout.write(label);
|
|
758
849
|
const start = performance.now();
|
|
@@ -170767,6 +170858,62 @@ var init_build = __esm(() => {
|
|
|
170767
170858
|
init_telemetryEvent();
|
|
170768
170859
|
});
|
|
170769
170860
|
|
|
170861
|
+
// src/cli/discoverInstances.ts
|
|
170862
|
+
var MS_PER_SECOND = 1000, isJsRuntime = (command) => /\b(bun|deno|node)\b/.test(command), untrackedName = (command) => {
|
|
170863
|
+
const entry = command.split(/\s+/).find((token) => /\.(cjs|js|mjs|ts)$/.test(token));
|
|
170864
|
+
if (entry === undefined)
|
|
170865
|
+
return "untracked";
|
|
170866
|
+
const segments = entry.split("/").filter(Boolean);
|
|
170867
|
+
segments.pop();
|
|
170868
|
+
let dir = segments.pop();
|
|
170869
|
+
if (dir === "build" || dir === "dist" || dir === "src")
|
|
170870
|
+
dir = segments.pop();
|
|
170871
|
+
return dir ?? "untracked";
|
|
170872
|
+
}, toUntrackedRecord = (listener) => ({
|
|
170873
|
+
command: listener.command.split(/\s+/),
|
|
170874
|
+
configPath: null,
|
|
170875
|
+
controllerPid: listener.pid,
|
|
170876
|
+
cwd: "",
|
|
170877
|
+
frameworks: [],
|
|
170878
|
+
host: "localhost",
|
|
170879
|
+
https: false,
|
|
170880
|
+
logFile: null,
|
|
170881
|
+
name: untrackedName(listener.command),
|
|
170882
|
+
pid: listener.pid,
|
|
170883
|
+
port: listener.port,
|
|
170884
|
+
ppid: 0,
|
|
170885
|
+
source: "untracked",
|
|
170886
|
+
startedAt: new Date(Date.now() - listener.etimes * MS_PER_SECOND).toISOString()
|
|
170887
|
+
}), compareInstances2 = (left, right) => {
|
|
170888
|
+
const leftPort = left.port ?? Number.MAX_SAFE_INTEGER;
|
|
170889
|
+
const rightPort = right.port ?? Number.MAX_SAFE_INTEGER;
|
|
170890
|
+
if (leftPort !== rightPort)
|
|
170891
|
+
return leftPort - rightPort;
|
|
170892
|
+
return left.name.localeCompare(right.name);
|
|
170893
|
+
}, discoverInstances = async () => {
|
|
170894
|
+
const registered = listLiveInstances();
|
|
170895
|
+
const knownPids = new Set(registered.flatMap((record) => [record.pid, record.controllerPid]));
|
|
170896
|
+
const knownPorts = new Set(registered.map((record) => record.port).filter((port) => port !== null));
|
|
170897
|
+
const listeners = await scanListeners();
|
|
170898
|
+
const untracked = [];
|
|
170899
|
+
const seen = new Set;
|
|
170900
|
+
for (const listener of listeners) {
|
|
170901
|
+
if (knownPids.has(listener.pid) || seen.has(listener.pid))
|
|
170902
|
+
continue;
|
|
170903
|
+
if (knownPorts.has(listener.port))
|
|
170904
|
+
continue;
|
|
170905
|
+
if (!isJsRuntime(listener.command))
|
|
170906
|
+
continue;
|
|
170907
|
+
seen.add(listener.pid);
|
|
170908
|
+
untracked.push(toUntrackedRecord(listener));
|
|
170909
|
+
}
|
|
170910
|
+
return [...registered, ...untracked].sort(compareInstances2);
|
|
170911
|
+
};
|
|
170912
|
+
var init_discoverInstances = __esm(() => {
|
|
170913
|
+
init_instanceRegistry();
|
|
170914
|
+
init_portScan();
|
|
170915
|
+
});
|
|
170916
|
+
|
|
170770
170917
|
// src/cli/instanceStatus.ts
|
|
170771
170918
|
import { createConnection as createConnection2 } from "net";
|
|
170772
170919
|
var displayHost = (host) => host === "0.0.0.0" || host === "::" ? "localhost" : host, probePort = (host, port) => {
|
|
@@ -170908,7 +171055,7 @@ var TUI_HEADERS, STATUS_INDEX = 5, URL_INDEX = 6, helpLines2, statusLevelColor =
|
|
|
170908
171055
|
};
|
|
170909
171056
|
const refresh = async () => {
|
|
170910
171057
|
const previousPid = selectedInstance()?.pid;
|
|
170911
|
-
instances = await enrichInstances(
|
|
171058
|
+
instances = await enrichInstances(await discoverInstances());
|
|
170912
171059
|
const foundIndex = previousPid === undefined ? 0 : instances.findIndex((instance) => instance.pid === previousPid);
|
|
170913
171060
|
selectedIndex = foundIndex >= 0 ? foundIndex : Math.min(selectedIndex, Math.max(0, instances.length - 1));
|
|
170914
171061
|
scheduleRender();
|
|
@@ -171309,7 +171456,7 @@ var TUI_HEADERS, STATUS_INDEX = 5, URL_INDEX = 6, helpLines2, statusLevelColor =
|
|
|
171309
171456
|
var init_listTui = __esm(() => {
|
|
171310
171457
|
init_constants();
|
|
171311
171458
|
init_getDurationString();
|
|
171312
|
-
|
|
171459
|
+
init_discoverInstances();
|
|
171313
171460
|
init_instanceStatus();
|
|
171314
171461
|
init_tuiPrimitives();
|
|
171315
171462
|
init_utils();
|
|
@@ -171341,7 +171488,14 @@ var exports_list = {};
|
|
|
171341
171488
|
__export(exports_list, {
|
|
171342
171489
|
runList: () => runList
|
|
171343
171490
|
});
|
|
171344
|
-
var
|
|
171491
|
+
var killPid = (pid) => {
|
|
171492
|
+
try {
|
|
171493
|
+
process.kill(pid, "SIGTERM");
|
|
171494
|
+
return true;
|
|
171495
|
+
} catch {
|
|
171496
|
+
return false;
|
|
171497
|
+
}
|
|
171498
|
+
}, TABLE_HEADERS, statusColor2 = (status2) => {
|
|
171345
171499
|
if (status2 === "ready")
|
|
171346
171500
|
return colors.green;
|
|
171347
171501
|
if (status2 === "starting")
|
|
@@ -171380,7 +171534,24 @@ var TABLE_HEADERS, statusColor2 = (status2) => {
|
|
|
171380
171534
|
await runListTui2();
|
|
171381
171535
|
return;
|
|
171382
171536
|
}
|
|
171383
|
-
const instances = await enrichInstances(
|
|
171537
|
+
const instances = await enrichInstances(await discoverInstances());
|
|
171538
|
+
if (args.includes("--kill-all")) {
|
|
171539
|
+
const killed = instances.filter((instance) => killPid(instance.pid));
|
|
171540
|
+
process.stdout.write(`${colors.dim}Killed ${killed.length} server${killed.length === 1 ? "" : "s"}.${colors.reset}
|
|
171541
|
+
`);
|
|
171542
|
+
return;
|
|
171543
|
+
}
|
|
171544
|
+
if (args.includes("--kill")) {
|
|
171545
|
+
const value = args[args.indexOf("--kill") + 1];
|
|
171546
|
+
const target = Number(value);
|
|
171547
|
+
const match = instances.find((instance) => instance.pid === target || instance.port === target);
|
|
171548
|
+
const pid = match?.pid ?? target;
|
|
171549
|
+
const killed = Number.isInteger(pid) && killPid(pid);
|
|
171550
|
+
const label = match ? `${match.name} (pid ${pid}${match.port === null ? "" : `, port ${match.port}`})` : `pid ${pid}`;
|
|
171551
|
+
process.stdout.write(`${colors.dim}${killed ? `Killed ${label}` : `No server found for \`--kill ${value ?? ""}\``}.${colors.reset}
|
|
171552
|
+
`);
|
|
171553
|
+
return;
|
|
171554
|
+
}
|
|
171384
171555
|
if (args.includes("--json")) {
|
|
171385
171556
|
process.stdout.write(`${JSON.stringify(instances, null, 2)}
|
|
171386
171557
|
`);
|
|
@@ -171391,7 +171562,7 @@ var TABLE_HEADERS, statusColor2 = (status2) => {
|
|
|
171391
171562
|
var init_list = __esm(() => {
|
|
171392
171563
|
init_constants();
|
|
171393
171564
|
init_getDurationString();
|
|
171394
|
-
|
|
171565
|
+
init_discoverInstances();
|
|
171395
171566
|
init_instanceStatus();
|
|
171396
171567
|
init_tuiPrimitives();
|
|
171397
171568
|
TABLE_HEADERS = [
|
|
@@ -172854,7 +173025,7 @@ var init_tunnelRelay = __esm(() => {
|
|
|
172854
173025
|
|
|
172855
173026
|
// src/cli/scripts/dev.ts
|
|
172856
173027
|
init_constants();
|
|
172857
|
-
var {$: $
|
|
173028
|
+
var {$: $3, env } = globalThis.Bun;
|
|
172858
173029
|
import { spawn as nodeSpawn } from "child_process";
|
|
172859
173030
|
import { createWriteStream, existsSync as existsSync5, readFileSync as readFileSync7 } from "fs";
|
|
172860
173031
|
import { resolve as resolve3 } from "path";
|
|
@@ -173287,6 +173458,7 @@ init_telemetryEvent();
|
|
|
173287
173458
|
init_buildDirectoryLock();
|
|
173288
173459
|
init_instanceRegistry();
|
|
173289
173460
|
init_loadConfig();
|
|
173461
|
+
init_portScan();
|
|
173290
173462
|
|
|
173291
173463
|
// src/utils/resolveDevPort.ts
|
|
173292
173464
|
import { createServer } from "net";
|
|
@@ -173435,7 +173607,9 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
173435
173607
|
let { port } = initialPortProbe;
|
|
173436
173608
|
if (initialPortProbe.fellBack) {
|
|
173437
173609
|
const displayHost = resolvedDev.host === "0.0.0.0" ? "localhost" : resolvedDev.host;
|
|
173438
|
-
|
|
173610
|
+
const holders = (await scanListeners()).filter((listener) => listener.port === resolvedDev.port);
|
|
173611
|
+
const heldBy = holders.length > 0 ? ` (held by ${holders.map((holder) => `pid ${holder.pid} \u2014 ${holder.command.slice(0, 60)}`).join(", ")})` : "";
|
|
173612
|
+
console.log(cliTag("\x1B[33m", `Port ${resolvedDev.port} is in use${heldBy}, trying another one... \u2192 http://${displayHost}:${port}/`));
|
|
173439
173613
|
}
|
|
173440
173614
|
updateLockMetadata(buildDirectory, { port });
|
|
173441
173615
|
const instancePid = process.pid;
|
|
@@ -173835,7 +174009,7 @@ var dev = async (serverEntry, configPath2) => {
|
|
|
173835
174009
|
}
|
|
173836
174010
|
};
|
|
173837
174011
|
const runShellCommand2 = async (command) => {
|
|
173838
|
-
await $
|
|
174012
|
+
await $3`${{ raw: command }}`.env({ ...process.env, FORCE_COLOR: "1" }).nothrow();
|
|
173839
174013
|
};
|
|
173840
174014
|
const openInBrowser = async () => {
|
|
173841
174015
|
const url = `http://${resolvedDev.host === "0.0.0.0" ? "localhost" : resolvedDev.host}:${port}`;
|
|
@@ -176290,7 +176464,7 @@ if (command === "dev") {
|
|
|
176290
176464
|
console.error(" config [--port n] Open the unified config UI (ESLint, tsconfig, Prettier)");
|
|
176291
176465
|
console.error(" eslint Run ESLint (cached)");
|
|
176292
176466
|
console.error(" info Print system info for bug reports");
|
|
176293
|
-
console.error(" ls [--watch] [--json] List/manage running servers (alias: ps)");
|
|
176467
|
+
console.error(" ls [--watch] [--json] [--kill <pid|port>] [--kill-all] List/manage running servers (alias: ps)");
|
|
176294
176468
|
console.error(" prettier Run Prettier check (cached)");
|
|
176295
176469
|
console.error(" typecheck Run type checkers for all frameworks");
|
|
176296
176470
|
console.error(" telemetry Manage anonymous telemetry");
|
package/dist/react/browser.js
CHANGED
|
@@ -244,32 +244,6 @@ var createTypedIsland = (_registry) => {
|
|
|
244
244
|
};
|
|
245
245
|
return Island2;
|
|
246
246
|
};
|
|
247
|
-
// src/react/UniversalRouter.tsx
|
|
248
|
-
import { createElement } from "react";
|
|
249
|
-
var cachedReactRouter = null;
|
|
250
|
-
var loadReactRouter = () => {
|
|
251
|
-
if (cachedReactRouter)
|
|
252
|
-
return cachedReactRouter;
|
|
253
|
-
try {
|
|
254
|
-
const dynamicRequire = new Function("spec", "return require(spec)");
|
|
255
|
-
cachedReactRouter = dynamicRequire("react-router");
|
|
256
|
-
return cachedReactRouter;
|
|
257
|
-
} catch {
|
|
258
|
-
const fromWindow = globalThis.ReactRouterDOM;
|
|
259
|
-
if (fromWindow) {
|
|
260
|
-
cachedReactRouter = fromWindow;
|
|
261
|
-
return cachedReactRouter;
|
|
262
|
-
}
|
|
263
|
-
throw new Error("[UniversalRouter] react-router is not installed. Install it with `bun add react-router` to use UniversalRouter.");
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
var UniversalRouter = ({ url, children }) => {
|
|
267
|
-
const { BrowserRouter, StaticRouter } = loadReactRouter();
|
|
268
|
-
if (typeof window === "undefined") {
|
|
269
|
-
return createElement(StaticRouter, { location: url ?? "/" }, children);
|
|
270
|
-
}
|
|
271
|
-
return createElement(BrowserRouter, null, children);
|
|
272
|
-
};
|
|
273
247
|
// src/react/hooks/useIslandStore.ts
|
|
274
248
|
import { useSyncExternalStore } from "react";
|
|
275
249
|
|
|
@@ -393,9 +367,8 @@ var useIslandStore = (store, selector) => useSyncExternalStore((listener) => sub
|
|
|
393
367
|
export {
|
|
394
368
|
useIslandStore,
|
|
395
369
|
createTypedIsland,
|
|
396
|
-
UniversalRouter,
|
|
397
370
|
Island
|
|
398
371
|
};
|
|
399
372
|
|
|
400
|
-
//# debugId=
|
|
373
|
+
//# debugId=B0355A88842A2F2E64756E2164756E21
|
|
401
374
|
//# sourceMappingURL=browser.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/core/islandManifest.ts", "../src/core/islands.ts", "../src/core/islandMarkupAttributes.ts", "../src/client/preserveIslandMarkup.ts", "../src/react/Island.browser.tsx", "../src/react/createIsland.browser.tsx", "../src/react/
|
|
3
|
+
"sources": ["../src/core/islandManifest.ts", "../src/core/islands.ts", "../src/core/islandMarkupAttributes.ts", "../src/client/preserveIslandMarkup.ts", "../src/react/Island.browser.tsx", "../src/react/createIsland.browser.tsx", "../src/react/hooks/useIslandStore.ts", "../node_modules/zustand/esm/vanilla.mjs", "../node_modules/zustand/esm/middleware.mjs", "../src/client/islandStore.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { IslandFramework } from '../../types/island';\n\nconst toIslandFrameworkSegment = (framework: IslandFramework) =>\n\tframework[0]?.toUpperCase() + framework.slice(1);\n\nconst collectFrameworkIslands = (\n\tmanifest: Record<string, string>,\n\tprefix: string\n) => {\n\tconst entries: Record<string, string> = {};\n\tlet found = false;\n\n\tfor (const [key, value] of Object.entries(manifest)) {\n\t\tif (!key.startsWith(prefix)) continue;\n\n\t\tconst component = key.slice(prefix.length);\n\t\tif (!component) continue;\n\n\t\tentries[component] = value;\n\t\tfound = true;\n\t}\n\n\treturn found ? entries : undefined;\n};\n\nexport const getIslandManifestEntries = (manifest: Record<string, string>) => {\n\tconst islands: Partial<Record<IslandFramework, Record<string, string>>> =\n\t\t{};\n\tconst frameworks: IslandFramework[] = ['react', 'svelte', 'vue', 'angular'];\n\n\tfor (const framework of frameworks) {\n\t\tconst prefix = `Island${toIslandFrameworkSegment(framework)}`;\n\t\tconst entries = collectFrameworkIslands(manifest, prefix);\n\t\tif (entries) islands[framework] = entries;\n\t}\n\n\treturn islands;\n};\nexport const getIslandManifestKey = (\n\tframework: IslandFramework,\n\tcomponent: string\n) => `Island${toIslandFrameworkSegment(framework)}${component}`;\n",
|
|
6
6
|
"import type {\n\tIslandComponentDefinition,\n\tIslandRegistry,\n\tIslandRegistryInput\n} from '../../types/island';\n\nexport const defineIslandComponent = <Component>(\n\tcomponent: Component,\n\toptions: {\n\t\texport?: string;\n\t\tsource: string;\n\t}\n): IslandComponentDefinition<Component> => ({\n\tcomponent,\n\texport: options.export,\n\tsource: options.source\n});\nexport const defineIslandRegistry = <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T>\n) => registry;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nexport const getIslandBuildReference = <Component>(\n\tcomponent: Component | IslandComponentDefinition<Component>\n) => {\n\tif (!isIslandComponentDefinition(component)) return null;\n\n\treturn {\n\t\texport: component.export,\n\t\tsource: component.source\n\t};\n};\nexport const isIslandComponentDefinition = <Component>(\n\tvalue: Component | IslandComponentDefinition<Component>\n): value is IslandComponentDefinition<Component> =>\n\tisRecord(value) &&\n\t'component' in value &&\n\t'source' in value &&\n\ttypeof value.source === 'string';\n\nexport function getIslandComponent<Component>(component: Component): Component;\nexport function getIslandComponent<Component>(\n\tcomponent: IslandComponentDefinition<Component>\n): Component;\nexport function getIslandComponent<Component>(\n\tcomponent: Component | IslandComponentDefinition<Component>\n) {\n\tif (isIslandComponentDefinition(component)) {\n\t\treturn component.component;\n\t}\n\n\treturn component;\n}\nexport const parseIslandProps = (rawProps: string | null) => {\n\tif (!rawProps) return {};\n\n\treturn JSON.parse(rawProps);\n};\nexport const serializeIslandProps = (props: unknown) =>\n\tJSON.stringify(props ?? {});\n\nexport {\n\tgetIslandManifestEntries,\n\tgetIslandManifestKey\n} from './islandManifest';\n",
|
|
@@ -8,13 +8,12 @@
|
|
|
8
8
|
"import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { getIslandMarkerAttributes } from '../core/islandMarkupAttributes';\n\ntype PreservedIslandMarkup = {\n\tattributes: Record<string, string>;\n\tinnerHTML: string;\n};\n\ntype IslandMarkerElement = HTMLElement & {\n\tdataset: DOMStringMap & {\n\t\tcomponent?: string;\n\t\tframework?: string;\n\t\thydrate?: string;\n\t\tisland?: string;\n\t\tislandId?: string;\n\t\tprops?: string;\n\t};\n};\n\nconst getSnapshotMap = () => {\n\tif (typeof window === 'undefined') {\n\t\treturn null;\n\t}\n\n\twindow.__ABS_SERVER_ISLAND_HTML__ ??= new Map<\n\t\tstring,\n\t\tPreservedIslandMarkup[]\n\t>();\n\n\treturn window.__ABS_SERVER_ISLAND_HTML__;\n};\n\nconst getIslandSignature = (props: RuntimeIslandRenderProps) => {\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn [\n\t\tattributes['data-component'],\n\t\tattributes['data-framework'],\n\t\tattributes['data-hydrate'],\n\t\tattributes['data-props']\n\t].join('::');\n};\n\nconst isMatchingIslandElement = (\n\telement: Element,\n\tprops: RuntimeIslandRenderProps\n): element is IslandMarkerElement => {\n\tif (!(element instanceof HTMLElement)) {\n\t\treturn false;\n\t}\n\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn (\n\t\telement.dataset.island === 'true' &&\n\t\telement.dataset.component === attributes['data-component'] &&\n\t\telement.dataset.framework === attributes['data-framework'] &&\n\t\t(element.dataset.hydrate ?? 'load') === attributes['data-hydrate'] &&\n\t\t(element.dataset.props ?? '{}') === attributes['data-props']\n\t);\n};\n\nconst snapshotIslandElement = (\n\telement: HTMLElement,\n\tsnapshotMap: Map<string, PreservedIslandMarkup[]>\n) => {\n\tconst signature = [\n\t\telement.dataset.component,\n\t\telement.dataset.framework,\n\t\telement.dataset.hydrate ?? 'load',\n\t\telement.dataset.props ?? '{}'\n\t].join('::');\n\tconst existing = snapshotMap.get(signature) ?? [];\n\tconst attributes = Object.fromEntries(\n\t\telement\n\t\t\t.getAttributeNames()\n\t\t\t.map((name) => [name, element.getAttribute(name) ?? ''])\n\t);\n\texisting.push({\n\t\tattributes,\n\t\tinnerHTML: element.innerHTML\n\t});\n\tsnapshotMap.set(signature, existing);\n};\n\nexport const initializeIslandMarkupSnapshot = () => {\n\tif (typeof document === 'undefined') {\n\t\treturn;\n\t}\n\n\tconst snapshotMap = getSnapshotMap();\n\tif (!snapshotMap || snapshotMap.size > 0) {\n\t\treturn;\n\t}\n\n\tconst elements = Array.from(\n\t\tdocument.querySelectorAll<HTMLElement>('[data-island=\"true\"]')\n\t);\n\tfor (const element of elements) {\n\t\tsnapshotIslandElement(element, snapshotMap);\n\t}\n};\n\nexport const preserveIslandMarkup = (props: RuntimeIslandRenderProps) => {\n\tif (typeof document === 'undefined') {\n\t\treturn {\n\t\t\tattributes: getIslandMarkerAttributes(props),\n\t\t\tinnerHTML: ''\n\t\t};\n\t}\n\n\tconst snapshotMap = getSnapshotMap();\n\tconst signature = getIslandSignature(props);\n\t// Islands that share a signature (same component, framework, hydrate mode\n\t// and serialized props) produce byte-identical SSR markup, so the first\n\t// captured snapshot is correct for every instance. Returning it\n\t// unconditionally keeps this stateless: React may call the component many\n\t// times during a single hydration (StrictMode double-render, hydration\n\t// retries, mismatch regeneration), and a per-call claim counter would run\n\t// past the snapshot list and yield empty markup — making the host render\n\t// `dangerouslySetInnerHTML={{ __html: '' }}` and wipe the island's\n\t// server-rendered DOM before the island runtime can hydrate it.\n\tconst snapshotCandidate = snapshotMap?.get(signature)?.[0];\n\tif (snapshotCandidate) {\n\t\treturn snapshotCandidate;\n\t}\n\n\t// Snapshot not captured yet (the island runtime module hasn't evaluated):\n\t// fall back to reading the live SSR DOM directly.\n\tconst liveCandidate = Array.from(\n\t\tdocument.querySelectorAll('[data-island=\"true\"]')\n\t).find((element) => isMatchingIslandElement(element, props));\n\tif (!liveCandidate) {\n\t\treturn {\n\t\t\tattributes: getIslandMarkerAttributes(props),\n\t\t\tinnerHTML: ''\n\t\t};\n\t}\n\n\treturn {\n\t\tattributes: Object.fromEntries(\n\t\t\tliveCandidate\n\t\t\t\t.getAttributeNames()\n\t\t\t\t.map((name) => [name, liveCandidate.getAttribute(name) ?? ''])\n\t\t),\n\t\tinnerHTML: liveCandidate.innerHTML\n\t};\n};\n",
|
|
9
9
|
"import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { preserveIslandMarkup } from '../client/preserveIslandMarkup';\n\nexport const Island = (props: RuntimeIslandRenderProps) => {\n\tconst { attributes, innerHTML } = preserveIslandMarkup(props);\n\n\treturn (\n\t\t<div\n\t\t\t{...attributes}\n\t\t\tdangerouslySetInnerHTML={{ __html: innerHTML }}\n\t\t\tsuppressHydrationWarning\n\t\t/>\n\t);\n};\n",
|
|
10
10
|
"import type {\n\tIslandRegistry,\n\tIslandRegistryInput,\n\tTypedIslandRenderProps\n} from '../../types/island';\nimport { preserveIslandMarkup } from '../client/preserveIslandMarkup';\n\nexport const createTypedIsland = <T extends IslandRegistryInput>(\n\t_registry: IslandRegistry<T>\n) => {\n\tconst Island = (props: TypedIslandRenderProps<T>) => {\n\t\tconst { attributes, innerHTML } = preserveIslandMarkup(props);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...attributes}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: innerHTML }}\n\t\t\t\tsuppressHydrationWarning\n\t\t\t/>\n\t\t);\n\t};\n\n\treturn Island;\n};\n",
|
|
11
|
-
"import { createElement, type ComponentType, type ReactNode } from 'react';\n\nexport type UniversalRouterProps = {\n\t/** The request URL to seed `<StaticRouter>` with on the server. Pages\n\t * typically forward `props.url` (auto-injected by handleReactPageRequest\n\t * from `request.url`). Ignored in the browser, where `<BrowserRouter>`\n\t * reads `window.location` directly. Defaults to '/'. */\n\turl?: string;\n\tchildren?: ReactNode;\n};\n\n/** SSR-safe wrapper around react-router that picks `<StaticRouter>` on the\n * server and `<BrowserRouter>` in the browser. Without it, every SPA page\n * has to write its own `typeof window === 'undefined'` branch and import\n * both routers — boilerplate that's the same in every page.\n *\n * Usage:\n *\n * export const MySpa = ({ url }: { url?: string }) => (\n * <html>\n * <Head />\n * <body>\n * <UniversalRouter url={url}>\n * <Routes>\n * <Route path=\"/foo\" element={<Foo />} />\n * </Routes>\n * </UniversalRouter>\n * </body>\n * </html>\n * );\n *\n * Implementation note: `react-router` is required lazily via\n * `createRequire` so consumers who don't use `UniversalRouter` aren't\n * forced to install react-router just to import other things from\n * `@absolutejs/absolute/react` (the previous eager static import made\n * `dist/react/index.js` carry a `import \"react-router\"` that broke\n * every consumer's bundle who hadn't installed it). Bun resolves the\n * CJS interop synchronously, so render is still purely synchronous.\n *\n * `<BrowserRouter>` reads `window.history` at construction, so it\n * throws if instantiated on the server. The `typeof window` check has\n * to live at render time (not import time) because the module is\n * loaded in both environments. */\n\ntype ReactRouterModule = {\n\tBrowserRouter: ComponentType<{ children?: ReactNode }>;\n\tStaticRouter: ComponentType<{ location: string; children?: ReactNode }>;\n};\n\nlet cachedReactRouter: ReactRouterModule | null = null;\n\nconst loadReactRouter = (): ReactRouterModule => {\n\tif (cachedReactRouter) return cachedReactRouter;\n\n\t// Hide the bare specifier behind a Function-constructor so static\n\t// bundlers can't analyze it — they only see a `Function(string)`\n\t// call, not an `import \"react-router\"`. Resolution happens at\n\t// render time and only on the first call to `UniversalRouter`,\n\t// so consumers who never use it never pay the install cost.\n\t// `require` is available in Bun's CJS-interop context (server)\n\t// and in any bundle output that emitted a CJS-compatible runtime.\n\ttry {\n\t\tconst dynamicRequire = new Function('spec', 'return require(spec)') as (\n\t\t\tspec: string\n\t\t) => ReactRouterModule;\n\t\tcachedReactRouter = dynamicRequire('react-router');\n\n\t\treturn cachedReactRouter;\n\t} catch {\n\t\tconst fromWindow = (\n\t\t\tglobalThis as { ReactRouterDOM?: ReactRouterModule }\n\t\t).ReactRouterDOM;\n\t\tif (fromWindow) {\n\t\t\tcachedReactRouter = fromWindow;\n\n\t\t\treturn cachedReactRouter;\n\t\t}\n\t\tthrow new Error(\n\t\t\t'[UniversalRouter] react-router is not installed. Install it with `bun add react-router` to use UniversalRouter.'\n\t\t);\n\t}\n};\n\nexport const UniversalRouter = ({ url, children }: UniversalRouterProps) => {\n\tconst { BrowserRouter, StaticRouter } = loadReactRouter();\n\tif (typeof window === 'undefined') {\n\t\treturn createElement(StaticRouter, { location: url ?? '/' }, children);\n\t}\n\n\treturn createElement(BrowserRouter, null, children);\n};\n",
|
|
12
11
|
"import { useSyncExternalStore } from 'react';\nimport type { StoreApi } from 'zustand/vanilla';\nimport {\n\tgetIslandStoreServerSnapshot,\n\treadIslandStore,\n\tsubscribeIslandStore,\n\ttype IslandStoreState\n} from '../../client/islandStore';\n\nexport const useIslandStore = <TState extends IslandStoreState, TSelected>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) =>\n\tuseSyncExternalStore(\n\t\t(listener) =>\n\t\t\tsubscribeIslandStore(store, selector, () => {\n\t\t\t\tlistener();\n\t\t\t}),\n\t\t() => readIslandStore(store, selector),\n\t\t() => getIslandStoreServerSnapshot(store, selector)\n\t);\n",
|
|
13
12
|
"const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n",
|
|
14
13
|
"const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...args) => api.dispatch(...args), ...initial };\n};\nconst redux = reduxImpl;\n\nconst shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === \"function\";\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst removeStoreFromTrackedConnections = (name, store) => {\n if (store === void 0) return;\n const connectionInfo = trackedConnections.get(name);\n if (!connectionInfo) return;\n delete connectionInfo.stores[store];\n if (Object.keys(connectionInfo.stores).length === 0) {\n trackedConnections.delete(name);\n }\n};\nconst findCallerName = (stack) => {\n var _a, _b;\n if (!stack) return void 0;\n const traceLines = stack.split(\"\\n\");\n const apiSetStateLineIndex = traceLines.findIndex(\n (traceLine) => traceLine.includes(\"api.setState\")\n );\n if (apiSetStateLineIndex < 0) return void 0;\n const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || \"\";\n return (_b = /.+ (.+) .+/.exec(callerLine)) == null ? void 0 : _b[1];\n};\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);\n let isRecording = true;\n api.setState = ((state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? {\n type: anonymousActionType || findCallerName(new Error().stack) || \"anonymous\"\n } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n });\n api.devtools = {\n cleanup: () => {\n if (connection && typeof connection.unsubscribe === \"function\") {\n connection.unsubscribe();\n }\n removeStoreFromTrackedConnections(options.name, store);\n }\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (shouldDispatchFromDevtools(api)) {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...args) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && args[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...args);\n };\n }\n connection.subscribe((message) => {\n var _a;\n switch (message.type) {\n case \"ACTION\":\n if (typeof message.payload !== \"string\") {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n return parseJsonThen(\n message.payload,\n (action) => {\n if (action.type === \"__setState\") {\n if (store === void 0) {\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (shouldDispatchFromDevtools(api)) {\n api.dispatch(action);\n }\n }\n );\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, fn) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) fn(parsed);\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = ((selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n });\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nfunction combine(initialState, create) {\n return (...args) => Object.assign({}, initialState, create(...args));\n}\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (str instanceof Promise) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n if (result instanceof Promise) {\n return result;\n }\n return {\n then(onFulfilled) {\n return toThenable(onFulfilled)(result);\n },\n catch(_onRejected) {\n return this;\n }\n };\n } catch (e) {\n return {\n then(_onFulfilled) {\n return this;\n },\n catch(onRejected) {\n return toThenable(onRejected)(e);\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => window.localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n let hydrationVersion = 0;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (state, replace) => {\n savedSetState(state, replace);\n return setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n return setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n const currentVersion = ++hydrationVersion;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n const migration = options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n );\n if (migration instanceof Promise) {\n return migration.then((result) => [true, result]);\n }\n return [true, migration];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n if (currentVersion !== hydrationVersion) {\n return;\n }\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).catch((e) => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n });\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => hydrate(),\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nfunction ssrSafe(config, isSSR = typeof window === \"undefined\") {\n return (set, get, api) => {\n if (!isSSR) {\n return config(set, get, api);\n }\n const ssrSet = () => {\n throw new Error(\"Cannot set state of Zustand store in SSR\");\n };\n api.setState = ssrSet;\n return config(ssrSet, get, api);\n };\n}\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector, ssrSafe as unstable_ssrSafe };\n",
|
|
15
14
|
"import { createStore, type StateCreator, type StoreApi } from 'zustand/vanilla';\nimport { combine } from 'zustand/middleware';\n\nexport type IslandStoreState = object;\ntype IslandStoreSnapshot = Record<string, unknown>;\ntype IslandStoreShape<\n\tTState extends IslandStoreState,\n\tTActions extends object\n> = Omit<TState, keyof TActions> & TActions;\nexport type IslandStateSnapshot = Record<string, IslandStoreSnapshot>;\ntype AnyIslandStore = StoreApi<object>;\ntype IslandStoreInstance = {\n\tapplyExternalSnapshot: (snapshot: IslandStoreSnapshot) => void;\n\tstore: AnyIslandStore;\n};\n\nconst ABSOLUTE_ISLAND_STATE = '__ABS_ISLAND_STATE__';\nconst ABSOLUTE_ISLAND_STORES = '__ABS_ISLAND_STORES__';\n\ndeclare global {\n\tvar __ABS_ISLAND_STATE__: IslandStateSnapshot | undefined;\n\tvar __ABS_ISLAND_STORES__:\n\t\t| Map<string, Set<IslandStoreInstance>>\n\t\t| undefined;\n}\n\nconst getIslandStoreSnapshot = () => {\n\tglobalThis.__ABS_ISLAND_STATE__ ??= {};\n\n\treturn globalThis.__ABS_ISLAND_STATE__;\n};\n\nconst getIslandStores = () => {\n\tglobalThis.__ABS_ISLAND_STORES__ ??= new Map();\n\n\treturn globalThis.__ABS_ISLAND_STORES__;\n};\n\nconst isSerializableValue = (value: unknown) =>\n\ttypeof value !== 'function' && value !== undefined;\n\nconst toSerializableState = <T extends object>(state: T) =>\n\tObject.fromEntries(\n\t\tObject.entries(state).filter(([, value]) => isSerializableValue(value))\n\t);\n\nconst applySnapshot = <T extends object>(\n\tstore: StoreApi<T>,\n\tsnapshot: IslandStoreSnapshot | undefined\n) => {\n\tif (!snapshot) {\n\t\treturn;\n\t}\n\n\tstore.setState({\n\t\t...store.getState(),\n\t\t...snapshot\n\t});\n};\n\nconst getPeerStores = (\n\tstoreInstances: Set<IslandStoreInstance>,\n\townerStore: AnyIslandStore\n) => [...storeInstances].filter((peer) => peer.store !== ownerStore);\n\nconst syncIslandSnapshot = <\n\tTState extends IslandStoreState,\n\tTActions extends object\n>(\n\tstoreId: string,\n\tstate: IslandStoreShape<TState, TActions>,\n\tstoreInstances: Set<IslandStoreInstance>,\n\townerStore: AnyIslandStore\n) => {\n\tconst nextSnapshot = toSerializableState(state);\n\tgetIslandStoreSnapshot()[storeId] = nextSnapshot;\n\n\tfor (const peerStore of getPeerStores(storeInstances, ownerStore)) {\n\t\tpeerStore.applyExternalSnapshot(nextSnapshot);\n\t}\n};\n\nexport const createIslandStore = <\n\tTState extends IslandStoreState,\n\tTActions extends object\n>(\n\tstoreId: string,\n\tinitialState: TState,\n\tcreateState: StateCreator<TState, [], [], TActions>\n) => {\n\tconst store = createStore(combine(initialState, createState));\n\tconst stores = getIslandStores();\n\tconst storeInstances =\n\t\tstores.get(storeId) ?? new Set<IslandStoreInstance>();\n\tconst initialSnapshot = getIslandStoreSnapshot()[storeId];\n\tapplySnapshot(store, initialSnapshot);\n\tlet isApplyingExternalSnapshot = false;\n\n\tconst applyExternalSnapshot = (snapshot: IslandStoreSnapshot) => {\n\t\tisApplyingExternalSnapshot = true;\n\t\tapplySnapshot(store, snapshot);\n\t};\n\n\tstoreInstances.add({\n\t\tapplyExternalSnapshot,\n\t\tstore\n\t});\n\tstores.set(storeId, storeInstances);\n\n\tsyncIslandSnapshot(storeId, store.getState(), storeInstances, store);\n\tstore.subscribe((state) => {\n\t\tif (isApplyingExternalSnapshot) {\n\t\t\tisApplyingExternalSnapshot = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tsyncIslandSnapshot(storeId, state, storeInstances, store);\n\t});\n\n\treturn store;\n};\nexport const getIslandStoreServerSnapshot = <\n\tTState extends IslandStoreState,\n\tTSelected\n>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => selector(store.getInitialState());\nconst applySnapshotToStoreInstances = (\n\tstoreId: string,\n\tinstances: Set<IslandStoreInstance>,\n\tsnapshot: IslandStateSnapshot\n) => {\n\tfor (const instance of instances) {\n\t\tinstance.applyExternalSnapshot(snapshot[storeId] ?? {});\n\t}\n};\n\nexport const initializeIslandStores = (state: IslandStateSnapshot) => {\n\tconst currentSnapshot = getIslandStoreSnapshot();\n\tconst nextSnapshot: IslandStateSnapshot = {\n\t\t...state,\n\t\t...currentSnapshot\n\t};\n\n\tglobalThis.__ABS_ISLAND_STATE__ = nextSnapshot;\n\n\tfor (const [storeId, store] of getIslandStores()) {\n\t\tapplySnapshotToStoreInstances(storeId, store, nextSnapshot);\n\t}\n};\nexport const readIslandStore = <TState extends IslandStoreState, TSelected>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => selector(store.getState());\nexport const resetIslandStoreForTesting = () => {\n\tdelete globalThis.__ABS_ISLAND_STATE__;\n\tdelete globalThis.__ABS_ISLAND_STORES__;\n};\nexport const subscribeIslandStore = <\n\tTState extends IslandStoreState,\n\tTSelected\n>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected,\n\tlistener: (value: TSelected) => void\n) => {\n\tlet currentSelection = selector(store.getState());\n\n\treturn store.subscribe((state) => {\n\t\tconst nextSelection = selector(state);\n\t\tif (Object.is(nextSelection, currentSelection)) {\n\t\t\treturn;\n\t\t}\n\n\t\tcurrentSelection = nextSelection;\n\t\tlistener(nextSelection);\n\t});\n};\n\nexport { ABSOLUTE_ISLAND_STATE, ABSOLUTE_ISLAND_STORES };\n"
|
|
16
15
|
],
|
|
17
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEM,2BAA2B,CAAC,cACjC,UAAU,IAAI,YAAY,IAAI,UAAU,MAAM,CAAC,GAE1C,0BAA0B,CAC/B,UACA,WACI;AAAA,EACJ,MAAM,UAAkC,CAAC;AAAA,EACzC,IAAI,QAAQ;AAAA,EAEZ,YAAY,KAAK,UAAU,OAAO,QAAQ,QAAQ,GAAG;AAAA,IACpD,IAAI,CAAC,IAAI,WAAW,MAAM;AAAA,MAAG;AAAA,IAE7B,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Y,WAAW;AAAA,IACjC,SAAS,sBAAsB,SAAS,YAAY,CAAC,CAAC;AAAA,EACvD;AAAA;AAGM,IAAM,yBAAyB,CAAC,UAA+B;AAAA,EACrE,MAAM,kBAAkB,uBAAuB;AAAA,EAC/C,MAAM,eAAoC;AAAA,OACtC;AAAA,OACA;AAAA,EACJ;AAAA,EAEA,WAAW,uBAAuB;AAAA,EAElC,YAAY,SAAS,UAAU,gBAAgB,GAAG;AAAA,IACjD,8BAA8B,SAAS,OAAO,YAAY;AAAA,EAC3D;AAAA;AAEM,IAAM,kBAAkB,CAC9B,OACA,aACI,SAAS,MAAM,SAAS,CAAC;AAKvB,IAAM,uBAAuB,CAInC,OACA,UACA,aACI;AAAA,EACJ,IAAI,mBAAmB,SAAS,MAAM,SAAS,CAAC;AAAA,EAEhD,OAAO,MAAM,UAAU,CAAC,UAAU;AAAA,IACjC,MAAM,gBAAgB,SAAS,KAAK;AAAA,IACpC,IAAI,OAAO,GAAG,eAAe,gBAAgB,GAAG;AAAA,MAC/C;AAAA,IACD;AAAA,IAEA,mBAAmB;AAAA,IACnB,SAAS,aAAa;AAAA,GACtB;AAAA;;;AHzKK,IAAM,iBAAiB,CAC7B,OACA,aAEA,qBACC,CAAC,aACA,qBAAqB,OAAO,UAAU,MAAM;AAAA,EAC3C,SAAS;AAAA,CACT,GACF,MAAM,gBAAgB,OAAO,QAAQ,GACrC,MAAM,6BAA6B,OAAO,QAAQ,CACnD;",
|
|
17
|
+
"debugId": "B0355A88842A2F2E64756E2164756E21",
|
|
19
18
|
"names": []
|
|
20
19
|
}
|
package/dist/react/index.js
CHANGED
|
@@ -4120,32 +4120,6 @@ var createTypedIsland = (registry) => {
|
|
|
4120
4120
|
};
|
|
4121
4121
|
return Island2;
|
|
4122
4122
|
};
|
|
4123
|
-
// src/react/UniversalRouter.tsx
|
|
4124
|
-
import { createElement } from "react";
|
|
4125
|
-
var cachedReactRouter = null;
|
|
4126
|
-
var loadReactRouter = () => {
|
|
4127
|
-
if (cachedReactRouter)
|
|
4128
|
-
return cachedReactRouter;
|
|
4129
|
-
try {
|
|
4130
|
-
const dynamicRequire = new Function("spec", "return require(spec)");
|
|
4131
|
-
cachedReactRouter = dynamicRequire("react-router");
|
|
4132
|
-
return cachedReactRouter;
|
|
4133
|
-
} catch {
|
|
4134
|
-
const fromWindow = globalThis.ReactRouterDOM;
|
|
4135
|
-
if (fromWindow) {
|
|
4136
|
-
cachedReactRouter = fromWindow;
|
|
4137
|
-
return cachedReactRouter;
|
|
4138
|
-
}
|
|
4139
|
-
throw new Error("[UniversalRouter] react-router is not installed. Install it with `bun add react-router` to use UniversalRouter.");
|
|
4140
|
-
}
|
|
4141
|
-
};
|
|
4142
|
-
var UniversalRouter = ({ url, children }) => {
|
|
4143
|
-
const { BrowserRouter, StaticRouter } = loadReactRouter();
|
|
4144
|
-
if (typeof window === "undefined") {
|
|
4145
|
-
return createElement(StaticRouter, { location: url ?? "/" }, children);
|
|
4146
|
-
}
|
|
4147
|
-
return createElement(BrowserRouter, null, children);
|
|
4148
|
-
};
|
|
4149
4123
|
// src/react/hooks/useIslandStore.ts
|
|
4150
4124
|
import { useSyncExternalStore } from "react";
|
|
4151
4125
|
|
|
@@ -4270,9 +4244,8 @@ export {
|
|
|
4270
4244
|
useIslandStore,
|
|
4271
4245
|
handleReactPageRequest,
|
|
4272
4246
|
createTypedIsland,
|
|
4273
|
-
UniversalRouter,
|
|
4274
4247
|
Island
|
|
4275
4248
|
};
|
|
4276
4249
|
|
|
4277
|
-
//# debugId=
|
|
4250
|
+
//# debugId=79EFDFAA63C3019F64756E2164756E21
|
|
4278
4251
|
//# sourceMappingURL=index.js.map
|