@absolutejs/absolute 0.19.0-beta.808 → 0.19.0-beta.809
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/browser.js +9801 -57
- package/dist/angular/browser.js.map +246 -4
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +14877 -60
- package/dist/angular/index.js.map +281 -4
- package/dist/angular/server.js +5610 -45
- package/dist/angular/server.js.map +51 -3
- package/dist/build.js +18092 -45
- package/dist/build.js.map +99 -3
- package/dist/cli/index.js +317 -86
- package/dist/client/index.js +1100 -40
- package/dist/client/index.js.map +24 -4
- package/dist/core/streamingSlotRegistrar.js +108 -11
- package/dist/core/streamingSlotRegistrar.js.map +4 -3
- package/dist/core/streamingSlotRegistry.js +169 -7
- package/dist/core/streamingSlotRegistry.js.map +5 -3
- package/dist/index.js +19957 -547
- package/dist/index.js.map +116 -3
- package/dist/islands/browser.js +228 -9
- package/dist/islands/browser.js.map +9 -4
- package/dist/islands/index.js +1908 -17
- package/dist/islands/index.js.map +27 -3
- package/dist/react/browser.js +328 -12
- package/dist/react/browser.js.map +12 -4
- package/dist/react/components/index.js +167 -16
- package/dist/react/components/index.js.map +6 -3
- package/dist/react/hooks/index.js +183 -8
- package/dist/react/hooks/index.js.map +7 -3
- package/dist/react/index.js +3627 -36
- package/dist/react/index.js.map +45 -4
- package/dist/react/jsxDevRuntimeCompat.js +61 -2
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +1789 -18
- package/dist/react/server.js.map +21 -3
- package/dist/src/angular/injectorPatch.d.ts +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/svelte/browser.js +247 -12
- package/dist/svelte/browser.js.map +10 -3
- package/dist/svelte/index.js +3732 -37
- package/dist/svelte/index.js.map +47 -4
- package/dist/svelte/server.js +2794 -21
- package/dist/svelte/server.js.map +27 -3
- package/dist/vue/browser.js +348 -12
- package/dist/vue/browser.js.map +12 -4
- package/dist/vue/components/Image.js +240 -7
- package/dist/vue/components/Image.js.map +6 -3
- package/dist/vue/components/index.js +544 -11
- package/dist/vue/components/index.js.map +9 -3
- package/dist/vue/index.js +4212 -52
- package/dist/vue/index.js.map +50 -4
- package/dist/vue/server.js +1849 -18
- package/dist/vue/server.js.map +21 -3
- package/package.json +1 -1
- package/dist/chunk-0867j0r0.js +0 -136
- package/dist/chunk-0867j0r0.js.map +0 -10
- package/dist/chunk-0kdc6r16.js +0 -20
- package/dist/chunk-0kdc6r16.js.map +0 -10
- package/dist/chunk-102fp7xe.js +0 -63
- package/dist/chunk-102fp7xe.js.map +0 -10
- package/dist/chunk-11zpfqz6.js +0 -19
- package/dist/chunk-11zpfqz6.js.map +0 -10
- package/dist/chunk-1rfh7hw9.js +0 -319
- package/dist/chunk-1rfh7hw9.js.map +0 -11
- package/dist/chunk-25v9t56f.js +0 -29
- package/dist/chunk-25v9t56f.js.map +0 -11
- package/dist/chunk-2f21eenc.js +0 -21
- package/dist/chunk-2f21eenc.js.map +0 -10
- package/dist/chunk-2ga2znex.js +0 -13
- package/dist/chunk-2ga2znex.js.map +0 -9
- package/dist/chunk-30yrw0f6.js +0 -33
- package/dist/chunk-30yrw0f6.js.map +0 -10
- package/dist/chunk-38jwhqcw.js +0 -4410
- package/dist/chunk-38jwhqcw.js.map +0 -28
- package/dist/chunk-3g91wb4f.js +0 -358
- package/dist/chunk-3g91wb4f.js.map +0 -10
- package/dist/chunk-3yjzpcne.js +0 -34
- package/dist/chunk-3yjzpcne.js.map +0 -10
- package/dist/chunk-41bf6aqt.js +0 -17
- package/dist/chunk-41bf6aqt.js.map +0 -9
- package/dist/chunk-4d39r92n.js +0 -81
- package/dist/chunk-4d39r92n.js.map +0 -10
- package/dist/chunk-5003emhv.js +0 -17
- package/dist/chunk-5003emhv.js.map +0 -10
- package/dist/chunk-5f67rsed.js +0 -466
- package/dist/chunk-5f67rsed.js.map +0 -10
- package/dist/chunk-5fhp1jap.js +0 -9169
- package/dist/chunk-5fhp1jap.js.map +0 -236
- package/dist/chunk-6pdj08z3.js +0 -73
- package/dist/chunk-6pdj08z3.js.map +0 -12
- package/dist/chunk-6qjbrt0k.js +0 -13
- package/dist/chunk-6qjbrt0k.js.map +0 -9
- package/dist/chunk-6sccb4jr.js +0 -14
- package/dist/chunk-6sccb4jr.js.map +0 -9
- package/dist/chunk-798spvzv.js +0 -50
- package/dist/chunk-798spvzv.js.map +0 -10
- package/dist/chunk-7fw6x3js.js +0 -131
- package/dist/chunk-7fw6x3js.js.map +0 -11
- package/dist/chunk-7kjj42xm.js +0 -11
- package/dist/chunk-7kjj42xm.js.map +0 -10
- package/dist/chunk-7mtstdqn.js +0 -90
- package/dist/chunk-7mtstdqn.js.map +0 -10
- package/dist/chunk-851whwc7.js +0 -17
- package/dist/chunk-851whwc7.js.map +0 -10
- package/dist/chunk-85n68sy6.js +0 -103
- package/dist/chunk-85n68sy6.js.map +0 -10
- package/dist/chunk-8kcfffry.js +0 -35
- package/dist/chunk-8kcfffry.js.map +0 -10
- package/dist/chunk-8qqxc1h2.js +0 -426
- package/dist/chunk-8qqxc1h2.js.map +0 -14
- package/dist/chunk-92fsjfpp.js +0 -1731
- package/dist/chunk-92fsjfpp.js.map +0 -11
- package/dist/chunk-93sqk7be.js +0 -139
- package/dist/chunk-93sqk7be.js.map +0 -12
- package/dist/chunk-94gvx0hg.js +0 -28
- package/dist/chunk-94gvx0hg.js.map +0 -10
- package/dist/chunk-9c5tj4k3.js +0 -130
- package/dist/chunk-9c5tj4k3.js.map +0 -10
- package/dist/chunk-9ve9jq72.js +0 -203
- package/dist/chunk-9ve9jq72.js.map +0 -10
- package/dist/chunk-9xrsjeem.js +0 -12
- package/dist/chunk-9xrsjeem.js.map +0 -9
- package/dist/chunk-a9mvyp04.js +0 -87
- package/dist/chunk-a9mvyp04.js.map +0 -10
- package/dist/chunk-b3gbnrwe.js +0 -21
- package/dist/chunk-b3gbnrwe.js.map +0 -10
- package/dist/chunk-bmgqm774.js +0 -65
- package/dist/chunk-bmgqm774.js.map +0 -9
- package/dist/chunk-bxfghpma.js +0 -69
- package/dist/chunk-bxfghpma.js.map +0 -10
- package/dist/chunk-c1jfjnka.js +0 -74
- package/dist/chunk-c1jfjnka.js.map +0 -10
- package/dist/chunk-cbkrwmvh.js +0 -80
- package/dist/chunk-cbkrwmvh.js.map +0 -10
- package/dist/chunk-cdxd7sy2.js +0 -71
- package/dist/chunk-cdxd7sy2.js.map +0 -10
- package/dist/chunk-cg95827x.js +0 -21
- package/dist/chunk-cg95827x.js.map +0 -10
- package/dist/chunk-cm0g4q6w.js +0 -149
- package/dist/chunk-cm0g4q6w.js.map +0 -10
- package/dist/chunk-cwfy538a.js +0 -51
- package/dist/chunk-cwfy538a.js.map +0 -9
- package/dist/chunk-d7mwkzry.js +0 -261
- package/dist/chunk-d7mwkzry.js.map +0 -10
- package/dist/chunk-d8w0qm28.js +0 -184
- package/dist/chunk-d8w0qm28.js.map +0 -11
- package/dist/chunk-d9c0am65.js +0 -12
- package/dist/chunk-d9c0am65.js.map +0 -10
- package/dist/chunk-daqghmg8.js +0 -12
- package/dist/chunk-daqghmg8.js.map +0 -9
- package/dist/chunk-e3r9fxaa.js +0 -149
- package/dist/chunk-e3r9fxaa.js.map +0 -10
- package/dist/chunk-e8eecyrq.js +0 -244
- package/dist/chunk-e8eecyrq.js.map +0 -10
- package/dist/chunk-ex2hxe0v.js +0 -160
- package/dist/chunk-ex2hxe0v.js.map +0 -11
- package/dist/chunk-fak944et.js +0 -91
- package/dist/chunk-fak944et.js.map +0 -10
- package/dist/chunk-ff70rnhd.js +0 -672
- package/dist/chunk-ff70rnhd.js.map +0 -15
- package/dist/chunk-fygx2ymm.js +0 -118
- package/dist/chunk-fygx2ymm.js.map +0 -12
- package/dist/chunk-g15qj669.js +0 -271
- package/dist/chunk-g15qj669.js.map +0 -11
- package/dist/chunk-gd6wmknh.js +0 -121
- package/dist/chunk-gd6wmknh.js.map +0 -11
- package/dist/chunk-gf0ygptk.js +0 -85
- package/dist/chunk-gf0ygptk.js.map +0 -11
- package/dist/chunk-gytkmthr.js +0 -220
- package/dist/chunk-gytkmthr.js.map +0 -10
- package/dist/chunk-h5bbfn3n.js +0 -28
- package/dist/chunk-h5bbfn3n.js.map +0 -11
- package/dist/chunk-h6mye9r3.js +0 -93
- package/dist/chunk-h6mye9r3.js.map +0 -10
- package/dist/chunk-hcsmxw1v.js +0 -85
- package/dist/chunk-hcsmxw1v.js.map +0 -10
- package/dist/chunk-hyjs4bqs.js +0 -8
- package/dist/chunk-hyjs4bqs.js.map +0 -10
- package/dist/chunk-j88z31ep.js +0 -25
- package/dist/chunk-j88z31ep.js.map +0 -10
- package/dist/chunk-jn91vzkh.js +0 -66
- package/dist/chunk-jn91vzkh.js.map +0 -10
- package/dist/chunk-jpkjdgsk.js +0 -167
- package/dist/chunk-jpkjdgsk.js.map +0 -11
- package/dist/chunk-jwxt8gnp.js +0 -13
- package/dist/chunk-jwxt8gnp.js.map +0 -9
- package/dist/chunk-kk8w9rh5.js +0 -195
- package/dist/chunk-kk8w9rh5.js.map +0 -10
- package/dist/chunk-m97ze5hz.js +0 -46
- package/dist/chunk-m97ze5hz.js.map +0 -10
- package/dist/chunk-mbazhahf.js +0 -60
- package/dist/chunk-mbazhahf.js.map +0 -10
- package/dist/chunk-mgfwq18r.js +0 -15
- package/dist/chunk-mgfwq18r.js.map +0 -9
- package/dist/chunk-mtgf69xn.js +0 -88
- package/dist/chunk-mtgf69xn.js.map +0 -10
- package/dist/chunk-mtxzyxpg.js +0 -102
- package/dist/chunk-mtxzyxpg.js.map +0 -10
- package/dist/chunk-nehhtthw.js +0 -225
- package/dist/chunk-nehhtthw.js.map +0 -10
- package/dist/chunk-p5504p14.js +0 -16
- package/dist/chunk-p5504p14.js.map +0 -10
- package/dist/chunk-pnscgw95.js +0 -90
- package/dist/chunk-pnscgw95.js.map +0 -10
- package/dist/chunk-pvpp4pvs.js +0 -17
- package/dist/chunk-pvpp4pvs.js.map +0 -10
- package/dist/chunk-qh75agse.js +0 -95
- package/dist/chunk-qh75agse.js.map +0 -10
- package/dist/chunk-qxq2zcty.js +0 -52
- package/dist/chunk-qxq2zcty.js.map +0 -10
- package/dist/chunk-r6e8pytx.js +0 -22
- package/dist/chunk-r6e8pytx.js.map +0 -9
- package/dist/chunk-r7jmgqnw.js +0 -114
- package/dist/chunk-r7jmgqnw.js.map +0 -10
- package/dist/chunk-s6defjk2.js +0 -116
- package/dist/chunk-s6defjk2.js.map +0 -10
- package/dist/chunk-sd39p726.js +0 -619
- package/dist/chunk-sd39p726.js.map +0 -10
- package/dist/chunk-swrnzs4c.js +0 -63
- package/dist/chunk-swrnzs4c.js.map +0 -10
- package/dist/chunk-tfe3sb44.js +0 -33
- package/dist/chunk-tfe3sb44.js.map +0 -10
- package/dist/chunk-tjr0kcev.js +0 -41
- package/dist/chunk-tjr0kcev.js.map +0 -9
- package/dist/chunk-tx9edm1x.js +0 -34
- package/dist/chunk-tx9edm1x.js.map +0 -10
- package/dist/chunk-txhm2vb5.js +0 -18
- package/dist/chunk-txhm2vb5.js.map +0 -9
- package/dist/chunk-v5vmsxmy.js +0 -526
- package/dist/chunk-v5vmsxmy.js.map +0 -12
- package/dist/chunk-vjhxm8n2.js +0 -29
- package/dist/chunk-vjhxm8n2.js.map +0 -9
- package/dist/chunk-vkrpm7kc.js +0 -247
- package/dist/chunk-vkrpm7kc.js.map +0 -12
- package/dist/chunk-w3m4m5we.js +0 -4925
- package/dist/chunk-w3m4m5we.js.map +0 -12
- package/dist/chunk-wrxtn9ve.js +0 -18
- package/dist/chunk-wrxtn9ve.js.map +0 -10
- package/dist/chunk-wwzvp0zn.js +0 -192
- package/dist/chunk-wwzvp0zn.js.map +0 -10
- package/dist/chunk-x09cskqd.js +0 -377
- package/dist/chunk-x09cskqd.js.map +0 -10
- package/dist/chunk-xnt8c6h2.js +0 -576
- package/dist/chunk-xnt8c6h2.js.map +0 -10
- package/dist/chunk-xw0tx842.js +0 -13
- package/dist/chunk-xw0tx842.js.map +0 -9
- package/dist/chunk-xx5b6b9m.js +0 -69
- package/dist/chunk-xx5b6b9m.js.map +0 -10
- package/dist/chunk-xz1kdswj.js +0 -21
- package/dist/chunk-xz1kdswj.js.map +0 -9
- package/dist/chunk-y84qnsd3.js +0 -32
- package/dist/chunk-y84qnsd3.js.map +0 -10
- package/dist/chunk-ywjn0rad.js +0 -14
- package/dist/chunk-ywjn0rad.js.map +0 -9
- package/dist/chunk-z9nvhm6r.js +0 -13
- package/dist/chunk-z9nvhm6r.js.map +0 -9
- package/dist/chunk-zhmvdpk6.js +0 -15
- package/dist/chunk-zhmvdpk6.js.map +0 -9
- package/dist/chunk-zrg9d4zw.js +0 -784
- package/dist/chunk-zrg9d4zw.js.map +0 -10
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/build/compileTailwind.ts", "../src/utils/startupTimings.ts", "../src/build/islandEntries.ts", "../src/core/staticStreaming.ts", "../src/build/staticIslandPages.ts", "../src/islands/pageMetadata.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { mkdir } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport type {\n\tStylePreprocessorConfig,\n\tTailwindConfig\n} from '../../types/build';\nimport { incrementalTailwindBuild } from './tailwindCompiler';\n\n/* Files Tailwind v4 may scan for candidate utility classes via the `@source`\n directive. When any of these change in dev, the Tailwind output must be\n regenerated so newly referenced utilities show up in the CSS — otherwise\n classes appear in markup with no rules behind them. */\nconst TAILWIND_CANDIDATE_EXTENSION_PATTERN =\n\t/\\.(html?|m?[jt]sx?|cjs|vue|svelte|astro|mdx?|css|s[ac]ss|less|styl(?:us)?)$/i;\n\nexport const isTailwindCandidate = (filePath: string) =>\n\tTAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath);\n\n/* Production / cold-start build of the Tailwind output CSS.\n\n Uses the same persistent-compiler path as HMR — calling\n `incrementalTailwindBuild` with no changed-file hint forces a fresh\n compile + full source scan. The compiler instance is then cached for\n the remainder of the process, so subsequent rebuilds (HMR ticks during\n `absolute dev`) get the per-candidate cache for free.\n\n This replaces the old `bun.build` + `bun-plugin-tailwind` pipeline:\n the bundler was being spun up just to drive Tailwind, which made every\n call pay bundler-init cost and discarded Tailwind's internal caches\n between calls. Going directly through `tailwindcss`'s own `compile()`\n API drops both costs and brings the production build into the same\n fast path as dev. */\nexport const compileTailwind = async (\n\tinput: string,\n\toutput: string,\n\tbuildPath: string,\n\tstyleTransformConfig?: StylePreprocessorConfig\n) => {\n\tconst outputPath = join(buildPath, output);\n\tawait mkdir(dirname(outputPath), { recursive: true });\n\tawait incrementalTailwindBuild(\n\t\t{ input, output },\n\t\tbuildPath,\n\t\t[],\n\t\tstyleTransformConfig\n\t);\n};\n\nexport const compileTailwindConfig = async (\n\ttailwind: TailwindConfig,\n\tbuildPath: string,\n\tstyleTransformConfig?: StylePreprocessorConfig\n) =>\n\tcompileTailwind(\n\t\ttailwind.input,\n\t\ttailwind.output,\n\t\tbuildPath,\n\t\tstyleTransformConfig\n\t);\n",
|
|
6
|
-
"import { getDurationString } from './getDurationString';\n\nexport type StartupTimingStep = {\n\tlabel: string;\n\tdurationMs: number;\n};\n\nexport const startupTimingsEnabled =\n\tprocess.env.ABSOLUTE_STARTUP_TIMINGS === '1' ||\n\tprocess.env.ABSOLUTE_STARTUP_TIMINGS === 'true';\n\nexport const formatStartupTimingBlock = (\n\ttitle: string,\n\tsteps: StartupTimingStep[]\n) => {\n\tconst totalDuration = steps.reduce((sum, step) => sum + step.durationMs, 0);\n\n\treturn [\n\t\ttitle,\n\t\t...steps.map(\n\t\t\t(step) => ` - ${step.label}: ${getDurationString(step.durationMs)}`\n\t\t),\n\t\t` Total: ${getDurationString(totalDuration)}`\n\t].join('\\n');\n};\n\nexport const logStartupTimingBlock = (\n\ttitle: string,\n\tsteps: StartupTimingStep[]\n) => {\n\tif (!startupTimingsEnabled || steps.length === 0) {\n\t\treturn;\n\t}\n\n\tconsole.log(formatStartupTimingBlock(title, steps));\n};\n",
|
|
7
|
-
"import { mkdirSync, rmSync, writeFileSync } from 'node:fs';\nimport { dirname, extname, join, relative, resolve } from 'node:path';\nimport ts from 'typescript';\nimport type { IslandFramework, IslandRegistryInput } from '../../types/island';\nimport { getIslandBuildReference } from '../core/islands';\n\ntype RegistryModuleExport = {\n\tdefault?: unknown;\n\tislandRegistry?: unknown;\n};\n\ntype IslandBuildEntry = {\n\tcomponent: string;\n\tentryPath: string;\n\tframework: IslandFramework;\n};\n\ntype IslandDefinition = {\n\tbuildReference: {\n\t\texport?: string;\n\t\tsource: string;\n\t} | null;\n\tcomponent: string;\n\tframework: IslandFramework;\n};\n\ntype IslandRegistryBuildInfo = {\n\tdefinitions: IslandDefinition[];\n\thasNamedExport: boolean;\n\tregistry: IslandRegistryInput;\n\tresolvedRegistryPath: string;\n};\n\ntype ParsedImportReference = {\n\texport?: string;\n\tsource: string;\n};\n\ntype ParsedRegistryBuildInfo = {\n\tdefinitions: IslandDefinition[];\n\thasNamedExport: boolean;\n\tregistry: IslandRegistryInput;\n};\n\ntype IslandEntryPathMaps = Partial<\n\tRecord<IslandFramework, Map<string, string>>\n>;\n\nconst frameworks: IslandFramework[] = ['react', 'svelte', 'vue', 'angular'];\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nconst resolveRegistryExport = (mod: RegistryModuleExport) => {\n\tif (isRecord(mod.islandRegistry)) return mod.islandRegistry;\n\tif (isRecord(mod.default)) return mod.default;\n\n\tthrow new Error(\n\t\t'Island registry module must export `islandRegistry` or a default registry object.'\n\t);\n};\n\nconst hasSvelteImport = (source: string) =>\n\t/from\\s+['\"][^'\"]+\\.svelte['\"]/.test(source);\n\nconst normalizeImportPath = (wrapperPath: string, targetPath: string) => {\n\tconst importPath = relative(dirname(wrapperPath), targetPath).replace(\n\t\t/\\\\/g,\n\t\t'/'\n\t);\n\n\treturn importPath.startsWith('.') ? importPath : `./${importPath}`;\n};\n\nconst isIdentifier = (value: string) =>\n\t/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value);\n\nconst resolveIslandSourcePath = (registryPath: string, sourcePath: string) => {\n\tif (sourcePath.startsWith('file://')) {\n\t\treturn new URL(sourcePath).pathname;\n\t}\n\n\treturn resolve(dirname(registryPath), sourcePath);\n};\n\nconst getObjectPropertyName = (name: ts.PropertyName) => {\n\tif (ts.isIdentifier(name) || ts.isStringLiteral(name)) {\n\t\treturn name.text;\n\t}\n\n\treturn null;\n};\n\nconst collectDefaultImport = (\n\timports: Map<string, ParsedImportReference>,\n\timportClause: ts.ImportClause,\n\tsource: string\n) => {\n\tif (!importClause.name) return;\n\n\timports.set(importClause.name.text, {\n\t\texport: 'default',\n\t\tsource\n\t});\n};\n\nconst collectNamedImports = (\n\timports: Map<string, ParsedImportReference>,\n\timportClause: ts.ImportClause,\n\tsource: string\n) => {\n\tconst bindings = importClause.namedBindings;\n\tif (!bindings || !ts.isNamedImports(bindings)) return;\n\n\tfor (const element of bindings.elements) {\n\t\timports.set(element.name.text, {\n\t\t\texport: element.propertyName?.text ?? element.name.text,\n\t\t\tsource\n\t\t});\n\t}\n};\n\nconst isIslandRegistryHelperImport = (source: string) =>\n\tsource === '@absolutejs/absolute/islands' ||\n\tsource.endsWith('/islands') ||\n\tsource.endsWith('/core/islands');\n\nconst collectRegistryHelperImports = (\n\timportClause: ts.ImportClause,\n\tsource: string,\n\tregistryFactoryNames: Set<string>,\n\tregistryNamespaceNames: Set<string>\n) => {\n\tif (!isIslandRegistryHelperImport(source)) return;\n\n\tconst bindings = importClause.namedBindings;\n\tif (!bindings) return;\n\n\tif (ts.isNamespaceImport(bindings)) {\n\t\tregistryNamespaceNames.add(bindings.name.text);\n\n\t\treturn;\n\t}\n\n\tfor (const element of bindings.elements) {\n\t\tconst importedName = element.propertyName?.text ?? element.name.text;\n\t\tif (importedName === 'defineIslandRegistry') {\n\t\t\tregistryFactoryNames.add(element.name.text);\n\t\t}\n\t}\n};\n\nconst createRegistryEntryValue = (reference: ParsedImportReference) => ({\n\tcomponent: reference.source,\n\texport: reference.export,\n\tsource: reference.source\n});\n\nconst addRegistryEntries = (\n\tframeworkNode: ts.ObjectLiteralExpression,\n\tframework: IslandFramework,\n\timports: Map<string, ParsedImportReference>,\n\tdefinitions: IslandDefinition[],\n\tregistry: IslandRegistryInput\n) => {\n\tconst frameworkRegistry = registry[framework] ?? {};\n\tregistry[framework] = frameworkRegistry;\n\n\tfor (const property of frameworkNode.properties) {\n\t\tif (\n\t\t\t!ts.isPropertyAssignment(property) &&\n\t\t\t!ts.isShorthandPropertyAssignment(property)\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst componentName = getObjectPropertyName(property.name);\n\t\tif (!componentName) continue;\n\n\t\tconst initializer = ts.isPropertyAssignment(property)\n\t\t\t? property.initializer\n\t\t\t: property.name;\n\t\tif (!ts.isIdentifier(initializer)) continue;\n\n\t\tconst reference = imports.get(initializer.text);\n\t\tif (!reference) continue;\n\n\t\tframeworkRegistry[componentName] = createRegistryEntryValue(reference);\n\t\tdefinitions.push({\n\t\t\tbuildReference: reference,\n\t\t\tcomponent: componentName,\n\t\t\tframework\n\t\t});\n\t}\n};\n\nconst processDefineIslandRegistry = (\n\tnode: ts.CallExpression,\n\timports: Map<string, ParsedImportReference>,\n\tdefinitions: IslandDefinition[],\n\tregistry: IslandRegistryInput\n) => {\n\tconst [firstArg] = node.arguments;\n\tif (!firstArg || !ts.isObjectLiteralExpression(firstArg)) return;\n\n\tconst validFrameworks: IslandFramework[] = [\n\t\t'react',\n\t\t'svelte',\n\t\t'vue',\n\t\t'angular'\n\t];\n\tfor (const property of firstArg.properties) {\n\t\tif (!ts.isPropertyAssignment(property)) continue;\n\t\tconst frameworkName = getObjectPropertyName(property.name);\n\t\tif (!frameworkName) continue;\n\t\tconst framework = validFrameworks.find((f) => f === frameworkName);\n\t\tif (!framework) continue;\n\t\tif (!ts.isObjectLiteralExpression(property.initializer)) continue;\n\n\t\taddRegistryEntries(\n\t\t\tproperty.initializer,\n\t\t\tframework,\n\t\t\timports,\n\t\t\tdefinitions,\n\t\t\tregistry\n\t\t);\n\t}\n};\n\nconst walkRegistryNode = (\n\tnode: ts.Node,\n\timports: Map<string, ParsedImportReference>,\n\tregistryFactoryNames: Set<string>,\n\tregistryNamespaceNames: Set<string>,\n\tdefinitions: IslandDefinition[],\n\tregistry: IslandRegistryInput\n) => {\n\tif (\n\t\tts.isCallExpression(node) &&\n\t\tisDefineIslandRegistryCall(\n\t\t\tnode.expression,\n\t\t\tregistryFactoryNames,\n\t\t\tregistryNamespaceNames\n\t\t)\n\t) {\n\t\tprocessDefineIslandRegistry(node, imports, definitions, registry);\n\t}\n\n\tts.forEachChild(node, (child) =>\n\t\twalkRegistryNode(\n\t\t\tchild,\n\t\t\timports,\n\t\t\tregistryFactoryNames,\n\t\t\tregistryNamespaceNames,\n\t\t\tdefinitions,\n\t\t\tregistry\n\t\t)\n\t);\n};\n\nconst isDefineIslandRegistryCall = (\n\texpression: ts.Expression,\n\tregistryFactoryNames: Set<string>,\n\tregistryNamespaceNames: Set<string>\n) => {\n\tif (ts.isIdentifier(expression)) {\n\t\treturn registryFactoryNames.has(expression.text);\n\t}\n\n\treturn (\n\t\tts.isPropertyAccessExpression(expression) &&\n\t\texpression.name.text === 'defineIslandRegistry' &&\n\t\tts.isIdentifier(expression.expression) &&\n\t\tregistryNamespaceNames.has(expression.expression.text)\n\t);\n};\n\nconst hasIslandRegistryNamedExport = (sourceFile: ts.SourceFile) => {\n\tfor (const statement of sourceFile.statements) {\n\t\tif (\n\t\t\tts.isVariableStatement(statement) &&\n\t\t\tstatement.modifiers?.some(\n\t\t\t\t(modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword\n\t\t\t) &&\n\t\t\tstatement.declarationList.declarations.some(\n\t\t\t\t(declaration) =>\n\t\t\t\t\tts.isIdentifier(declaration.name) &&\n\t\t\t\t\tdeclaration.name.text === 'islandRegistry'\n\t\t\t)\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (!ts.isExportDeclaration(statement) || !statement.exportClause)\n\t\t\tcontinue;\n\t\tif (!ts.isNamedExports(statement.exportClause)) continue;\n\n\t\tif (\n\t\t\tstatement.exportClause.elements.some(\n\t\t\t\t(element) => element.name.text === 'islandRegistry'\n\t\t\t)\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n};\n\nconst collectImportDeclarations = (\n\tsourceFile: ts.SourceFile,\n\tregistryPath: string,\n\timports: Map<string, ParsedImportReference>,\n\tregistryFactoryNames: Set<string>,\n\tregistryNamespaceNames: Set<string>\n) => {\n\tfor (const statement of sourceFile.statements) {\n\t\tif (\n\t\t\t!ts.isImportDeclaration(statement) ||\n\t\t\t!ts.isStringLiteral(statement.moduleSpecifier)\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst { importClause } = statement;\n\t\tif (!importClause) continue;\n\n\t\tconst source = resolveIslandSourcePath(\n\t\t\tregistryPath,\n\t\t\tstatement.moduleSpecifier.text\n\t\t);\n\n\t\tcollectDefaultImport(imports, importClause, source);\n\t\tcollectNamedImports(imports, importClause, source);\n\t\tcollectRegistryHelperImports(\n\t\t\timportClause,\n\t\t\tstatement.moduleSpecifier.text,\n\t\t\tregistryFactoryNames,\n\t\t\tregistryNamespaceNames\n\t\t);\n\t}\n};\n\nconst parseIslandRegistryBuildInfo = (\n\tregistrySource: string,\n\tregistryPath: string\n): ParsedRegistryBuildInfo => {\n\tconst sourceFile = ts.createSourceFile(\n\t\tregistryPath,\n\t\tregistrySource,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS\n\t);\n\tconst imports = new Map<string, ParsedImportReference>();\n\tconst registryFactoryNames = new Set<string>(['defineIslandRegistry']);\n\tconst registryNamespaceNames = new Set<string>();\n\tconst definitions: IslandDefinition[] = [];\n\tconst registry: IslandRegistryInput = {};\n\n\tcollectImportDeclarations(\n\t\tsourceFile,\n\t\tregistryPath,\n\t\timports,\n\t\tregistryFactoryNames,\n\t\tregistryNamespaceNames\n\t);\n\twalkRegistryNode(\n\t\tsourceFile,\n\t\timports,\n\t\tregistryFactoryNames,\n\t\tregistryNamespaceNames,\n\t\tdefinitions,\n\t\tregistry\n\t);\n\n\treturn {\n\t\tdefinitions,\n\t\thasNamedExport: hasIslandRegistryNamedExport(sourceFile),\n\t\tregistry\n\t};\n};\n\nconst loadDynamicIslandRegistryBuildInfo = async (\n\tresolvedRegistryPath: string\n) => {\n\tconst registryModule: RegistryModuleExport = await import(\n\t\tresolvedRegistryPath\n\t);\n\tconst registry: IslandRegistryInput = resolveRegistryExport(registryModule);\n\tconst definitions = frameworks.flatMap((framework) => {\n\t\tconst frameworkRegistry = registry[framework];\n\t\tif (!isRecord(frameworkRegistry)) return [];\n\n\t\treturn Object.entries(frameworkRegistry).map(([component, value]) => ({\n\t\t\tbuildReference: getIslandBuildReference(value),\n\t\t\tcomponent,\n\t\t\tframework\n\t\t}));\n\t});\n\n\treturn {\n\t\tdefinitions,\n\t\thasNamedExport: isRecord(registryModule.islandRegistry),\n\t\tregistry\n\t};\n};\n\nconst createRegistryImportCode = (\n\twrapperPath: string,\n\tregistryPath: string,\n\thasNamedExport: boolean\n) => {\n\tconst normalizedPath = normalizeImportPath(wrapperPath, registryPath);\n\n\tif (hasNamedExport) {\n\t\treturn {\n\t\t\timportStatement: `import { islandRegistry as __absoluteIslandRegistry } from ${JSON.stringify(normalizedPath)};`,\n\t\t\tregistryReference: '__absoluteIslandRegistry'\n\t\t};\n\t}\n\n\treturn {\n\t\timportStatement: `import __absoluteIslandRegistry from ${JSON.stringify(normalizedPath)};`,\n\t\tregistryReference: '__absoluteIslandRegistry'\n\t};\n};\n\nconst createDirectEntrySource = (\n\twrapperPath: string,\n\timportPath: string,\n\texportName?: string\n) => {\n\tconst normalizedImportPath = normalizeImportPath(wrapperPath, importPath);\n\tif (!exportName || exportName === 'default') {\n\t\treturn `export { default } from ${JSON.stringify(normalizedImportPath)};\\n`;\n\t}\n\n\treturn `export { ${exportName} as default } from ${JSON.stringify(normalizedImportPath)};\\n`;\n};\n\nconst createRegistryEntrySource = (\n\twrapperPath: string,\n\tregistryPath: string,\n\thasNamedExport: boolean,\n\tframework: IslandFramework,\n\tcomponent: string\n) => {\n\tconst { importStatement, registryReference } = createRegistryImportCode(\n\t\twrapperPath,\n\t\tregistryPath,\n\t\thasNamedExport\n\t);\n\tconst frameworkAccess = isIdentifier(framework)\n\t\t? `${registryReference}.${framework}`\n\t\t: `${registryReference}[${JSON.stringify(framework)}]`;\n\tconst componentAccess = isIdentifier(component)\n\t\t? `${frameworkAccess}.${component}`\n\t\t: `${frameworkAccess}[${JSON.stringify(component)}]`;\n\n\treturn `${importStatement}\n\nconst component = ${componentAccess};\n\nexport default component;\n`;\n};\n\nconst shouldUseCompiledClientPath = (\n\tframework: IslandFramework,\n\tsourcePath: string\n) => {\n\tif (framework === 'svelte') {\n\t\treturn /\\.svelte(?:\\.(?:ts|js))?$/.test(sourcePath);\n\t}\n\n\tif (framework === 'vue') {\n\t\treturn extname(sourcePath) === '.vue';\n\t}\n\n\tif (framework === 'angular') {\n\t\treturn /\\.(?:ts|js|tsx|jsx|mjs|cjs)$/.test(sourcePath);\n\t}\n\n\treturn false;\n};\n\nexport const collectIslandFrameworkSources = (\n\tbuildInfo: IslandRegistryBuildInfo\n) => {\n\tconst sources: Partial<Record<IslandFramework, string[]>> = {};\n\n\tfor (const definition of buildInfo.definitions) {\n\t\tconst { buildReference } = definition;\n\t\tif (!buildReference) continue;\n\n\t\tconst resolvedSourcePath = resolveIslandSourcePath(\n\t\t\tbuildInfo.resolvedRegistryPath,\n\t\t\tbuildReference.source\n\t\t);\n\t\tif (\n\t\t\t!shouldUseCompiledClientPath(\n\t\t\t\tdefinition.framework,\n\t\t\t\tresolvedSourcePath\n\t\t\t)\n\t\t)\n\t\t\tcontinue;\n\n\t\tconst frameworkSources = sources[definition.framework] ?? [];\n\t\tif (frameworkSources.includes(resolvedSourcePath)) continue;\n\n\t\tframeworkSources.push(resolvedSourcePath);\n\t\tsources[definition.framework] = frameworkSources;\n\t}\n\n\treturn sources;\n};\nexport const generateIslandEntryPoints = async ({\n\tbuildInfo,\n\tbuildPath,\n\tclientPathMaps = {}\n}: {\n\tbuildInfo: IslandRegistryBuildInfo;\n\tbuildPath: string;\n\tclientPathMaps?: IslandEntryPathMaps;\n}) => {\n\tconst generatedRoot = join(buildPath, '_island_entries');\n\n\trmSync(generatedRoot, { force: true, recursive: true });\n\n\tconst entries: IslandBuildEntry[] = [];\n\n\tfor (const definition of buildInfo.definitions) {\n\t\tconst entryPath = join(\n\t\t\tgeneratedRoot,\n\t\t\t'islands',\n\t\t\tdefinition.framework,\n\t\t\t`${definition.component}.ts`\n\t\t);\n\t\tconst { buildReference } = definition;\n\t\tconst source = buildReference\n\t\t\t? resolveIslandSourcePath(\n\t\t\t\t\tbuildInfo.resolvedRegistryPath,\n\t\t\t\t\tbuildReference.source\n\t\t\t\t)\n\t\t\t: null;\n\t\tconst compiledSourcePath =\n\t\t\tsource && shouldUseCompiledClientPath(definition.framework, source)\n\t\t\t\t? clientPathMaps[definition.framework]?.get(source)\n\t\t\t\t: undefined;\n\t\tconst entrySource =\n\t\t\tsource &&\n\t\t\t(compiledSourcePath ||\n\t\t\t\t!shouldUseCompiledClientPath(definition.framework, source))\n\t\t\t\t? createDirectEntrySource(\n\t\t\t\t\t\tentryPath,\n\t\t\t\t\t\tcompiledSourcePath ?? source,\n\t\t\t\t\t\tcompiledSourcePath ? undefined : buildReference?.export\n\t\t\t\t\t)\n\t\t\t\t: createRegistryEntrySource(\n\t\t\t\t\t\tentryPath,\n\t\t\t\t\t\tbuildInfo.resolvedRegistryPath,\n\t\t\t\t\t\tbuildInfo.hasNamedExport,\n\t\t\t\t\t\tdefinition.framework,\n\t\t\t\t\t\tdefinition.component\n\t\t\t\t\t);\n\n\t\tmkdirSync(dirname(entryPath), { recursive: true });\n\t\twriteFileSync(entryPath, entrySource);\n\t\tentries.push({\n\t\t\tcomponent: definition.component,\n\t\t\tentryPath,\n\t\t\tframework: definition.framework\n\t\t});\n\t}\n\n\treturn {\n\t\tentries,\n\t\tgeneratedRoot\n\t};\n};\nexport const loadIslandRegistryBuildInfo = async (\n\tregistryPath: string\n): Promise<IslandRegistryBuildInfo> => {\n\tconst resolvedRegistryPath = resolve(registryPath);\n\tconst registrySource = Bun.file(resolvedRegistryPath);\n\tconst registrySourceText = await registrySource.text();\n\tconst parsedInfo = parseIslandRegistryBuildInfo(\n\t\tregistrySourceText,\n\t\tresolvedRegistryPath\n\t);\n\tif (parsedInfo.definitions.length > 0) {\n\t\treturn {\n\t\t\tdefinitions: parsedInfo.definitions,\n\t\t\thasNamedExport: parsedInfo.hasNamedExport,\n\t\t\tregistry: parsedInfo.registry,\n\t\t\tresolvedRegistryPath\n\t\t};\n\t}\n\tif (hasSvelteImport(registrySourceText)) {\n\t\tthrow new Error(\n\t\t\t'Unable to statically analyze the island registry. Registries that import .svelte files must use defineIslandRegistry({ ... }) with direct imported component references.'\n\t\t);\n\t}\n\n\tconst dynamicInfo =\n\t\tawait loadDynamicIslandRegistryBuildInfo(resolvedRegistryPath);\n\n\treturn {\n\t\tdefinitions: dynamicInfo.definitions,\n\t\thasNamedExport: dynamicInfo.hasNamedExport,\n\t\tregistry: dynamicInfo.registry,\n\t\tresolvedRegistryPath\n\t};\n};\n",
|
|
8
|
-
"import { statSync } from 'node:fs';\nimport { extname } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type {\n\tStreamingSlot,\n\tStreamingSlotPatchPayload\n} from '../utils/streamingSlots';\n\nexport type StaticStreamingSlotResolver = () =>\n\t| Promise<StreamingSlotPatchPayload>\n\t| StreamingSlotPatchPayload;\n\nexport type StaticStreamingSlotDefinition = {\n\tresolve: StaticStreamingSlotResolver;\n\ttimeoutMs?: number;\n\terrorHtml?: string;\n};\n\nexport type StaticStreamingSlotDefinitions = Record<\n\tstring,\n\tStaticStreamingSlotResolver | StaticStreamingSlotDefinition\n>;\n\nexport const defineStaticStreamingSlots = <\n\tconst T extends StaticStreamingSlotDefinitions\n>(\n\tslots: T\n) => slots;\n\nconst STATIC_SLOT_TAG_RE =\n\t/<abs-stream-slot\\b([^>]*?)(?:\\/>|>([\\s\\S]*?)<\\/abs-stream-slot>)/gi;\nconst ATTRIBUTE_RE =\n\t/([A-Za-z_:][-A-Za-z0-9_:.]*)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')/g;\n\ntype StaticStreamingTagDefinition = {\n\terrorHtml?: string;\n\tfallbackHtml: string;\n\tid: string;\n\tresolver: string;\n\ttimeoutMs?: number;\n};\n\nconst parseAttributes = (attributeString: string) => {\n\tconst attributes = new Map<string, string>();\n\tconst setAttributeFromMatch = (matchParts: RegExpExecArray) => {\n\t\tconst [, key, doubleQuotedValue, singleQuotedValue] = matchParts;\n\t\tif (!key) {\n\t\t\treturn;\n\t\t}\n\n\t\tattributes.set(key, doubleQuotedValue ?? singleQuotedValue ?? '');\n\t};\n\n\tlet match = ATTRIBUTE_RE.exec(attributeString);\n\twhile (match) {\n\t\tsetAttributeFromMatch(match);\n\t\tmatch = ATTRIBUTE_RE.exec(attributeString);\n\t}\n\n\tATTRIBUTE_RE.lastIndex = 0;\n\n\treturn attributes;\n};\n\nconst parseTimeout = (value: string | undefined) => {\n\tif (!value) return undefined;\n\tconst parsed = Number(value);\n\tif (!Number.isFinite(parsed) || parsed < 0) {\n\t\tthrow new Error(\n\t\t\t`Invalid <abs-stream-slot timeout-ms=\"${value}\">. Expected a non-negative number.`\n\t\t);\n\t}\n\n\treturn parsed;\n};\n\nconst parseStaticStreamingTag = (\n\tattributeString: string,\n\tinnerHtml: string | undefined\n): StaticStreamingTagDefinition => {\n\tconst attributes = parseAttributes(attributeString);\n\tconst resolver = attributes.get('resolver');\n\tif (!resolver) {\n\t\tthrow new Error(\n\t\t\t'Static <abs-stream-slot> requires a \"resolver\" attribute.'\n\t\t);\n\t}\n\n\tconst id = attributes.get('id') ?? resolver;\n\n\treturn {\n\t\terrorHtml: attributes.get('error-html') ?? undefined,\n\t\tfallbackHtml:\n\t\t\tinnerHtml?.trim() ?? attributes.get('fallback-html') ?? '',\n\t\tid,\n\t\tresolver,\n\t\ttimeoutMs: parseTimeout(attributes.get('timeout-ms') ?? undefined)\n\t};\n};\n\nexport const extractStaticStreamingTags = (html: string) => {\n\tconst tagRe = new RegExp(STATIC_SLOT_TAG_RE);\n\tconst tags: StaticStreamingTagDefinition[] = [];\n\tlet match = tagRe.exec(html);\n\n\twhile (match) {\n\t\tconst [, rawAttributeString, innerHtml] = match;\n\t\ttags.push(parseStaticStreamingTag(rawAttributeString ?? '', innerHtml));\n\t\tmatch = tagRe.exec(html);\n\t}\n\n\treturn tags;\n};\n\nconst toStaticStreamingSlotDefinition = (\n\tvalue: StaticStreamingSlotResolver | StaticStreamingSlotDefinition\n) => (typeof value === 'function' ? { resolve: value } : value);\n\nconst isObjectRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nconst toStaticStreamingDefinitionEntry = (\n\tentry: unknown\n): StaticStreamingSlotDefinition | StaticStreamingSlotResolver | null => {\n\tif (typeof entry === 'function') {\n\t\treturn () => entry();\n\t}\n\n\tif (!isObjectRecord(entry) || typeof entry.resolve !== 'function') {\n\t\treturn null;\n\t}\n\tconst { resolve } = entry;\n\n\treturn {\n\t\terrorHtml:\n\t\t\ttypeof entry.errorHtml === 'string' ? entry.errorHtml : undefined,\n\t\ttimeoutMs:\n\t\t\ttypeof entry.timeoutMs === 'number' ? entry.timeoutMs : undefined,\n\t\tresolve: () => resolve()\n\t};\n};\n\nconst toStaticStreamingSlotDefinitions = (value: unknown) => {\n\tif (!isObjectRecord(value)) {\n\t\treturn null;\n\t}\n\n\tconst definitions: StaticStreamingSlotDefinitions = {};\n\tfor (const [key, entry] of Object.entries(value)) {\n\t\tconst definition = toStaticStreamingDefinitionEntry(entry);\n\t\tif (!definition) {\n\t\t\treturn null;\n\t\t}\n\n\t\tdefinitions[key] = definition;\n\t}\n\n\treturn definitions;\n};\n\ntype StaticStreamingModuleExports = {\n\tdefault?: unknown;\n\tstreamingSlots?: unknown;\n};\n\nconst resolveStaticStreamingDefinitions = (\n\tmoduleExports: StaticStreamingModuleExports\n) =>\n\ttoStaticStreamingSlotDefinitions(moduleExports.streamingSlots) ??\n\ttoStaticStreamingSlotDefinitions(moduleExports.default);\n\nconst serverModuleExtensions = [\n\t'.server.ts',\n\t'.server.js',\n\t'.server.mjs',\n\t'.slots.ts',\n\t'.slots.js',\n\t'.slots.mjs'\n] as const;\n\nconst resolveSidecarCandidates = (pagePath: string) => {\n\tconst pageExt = extname(pagePath);\n\tif (!pageExt) return [];\n\n\tconst pageStem = pagePath.slice(0, -pageExt.length);\n\n\treturn serverModuleExtensions.map((extension) => `${pageStem}${extension}`);\n};\n\nconst fileExists = async (path: string) => Bun.file(path).exists();\n\nconst loadStaticStreamingModule = async (pagePath: string) => {\n\tconst loadCandidate = async (candidates: string[]) => {\n\t\tconst [candidate, ...remaining] = candidates;\n\t\tif (!candidate) {\n\t\t\treturn null;\n\t\t}\n\t\tif (!(await fileExists(candidate))) {\n\t\t\treturn loadCandidate(remaining);\n\t\t}\n\n\t\tconst version = statSync(candidate).mtimeMs;\n\t\tconst moduleUrl = new URL(pathToFileURL(candidate).href);\n\t\tmoduleUrl.searchParams.set('t', String(version));\n\n\t\tconst moduleExports: StaticStreamingModuleExports = await import(\n\t\t\tmoduleUrl.href\n\t\t);\n\t\tconst definitions = resolveStaticStreamingDefinitions(moduleExports);\n\t\tif (!definitions) {\n\t\t\tthrow new Error(\n\t\t\t\t`Static streaming module \"${candidate}\" must export a default value or named \"streamingSlots\" object.`\n\t\t\t);\n\t\t}\n\n\t\treturn definitions;\n\t};\n\n\treturn loadCandidate(resolveSidecarCandidates(pagePath));\n};\n\nexport const loadStaticStreamingSlots = async (\n\tpagePath: string,\n\thtml: string\n) => {\n\tconst tagDefinitions = extractStaticStreamingTags(html);\n\tif (tagDefinitions.length === 0) {\n\t\treturn [];\n\t}\n\n\tconst definitions = await loadStaticStreamingModule(pagePath);\n\tif (!definitions) {\n\t\tthrow new Error(\n\t\t\t`Static page \"${pagePath}\" uses <abs-stream-slot> but no page-adjacent server module was found. Create a sibling \".server.ts\" file that exports defineStaticStreamingSlots({...}).`\n\t\t);\n\t}\n\n\treturn tagDefinitions.map((tag) => {\n\t\tconst entry = definitions[tag.resolver];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Static streaming resolver \"${tag.resolver}\" was not found for \"${pagePath}\".`\n\t\t\t);\n\t\t}\n\n\t\tconst definition = toStaticStreamingSlotDefinition(entry);\n\n\t\treturn {\n\t\t\terrorHtml: tag.errorHtml ?? definition.errorHtml,\n\t\t\tfallbackHtml: tag.fallbackHtml,\n\t\t\tid: tag.id,\n\t\t\tresolve: definition.resolve,\n\t\t\ttimeoutMs: tag.timeoutMs ?? definition.timeoutMs\n\t\t} satisfies StreamingSlot;\n\t});\n};\n",
|
|
9
|
-
"import { readFileSync, writeFileSync } from 'node:fs';\nimport type {\n\tIslandFramework,\n\tIslandHydrate,\n\tIslandRegistryInput,\n\tRuntimeIslandRenderProps\n} from '../../types/island';\nimport { renderStreamingSlotPlaceholder } from '../utils/streamingSlots';\nimport { renderIslandMarkup } from '../core/renderIslandMarkup';\nimport { loadIslandRegistryBuildInfo } from './islandEntries';\nimport { requireCurrentIslandRegistry } from '../core/currentIslandRegistry';\nimport { extractStaticStreamingTags } from '../core/staticStreaming';\n\nconst ISLAND_TAG_RE_SOURCE =\n\t'<(?:absolute-island|island)\\\\b([^>]*?)(?:\\\\/\\\\>|>(?:[\\\\s\\\\S]*?)<\\\\/(?:absolute-island|island)>)';\nconst ATTRIBUTE_RE_SOURCE =\n\t'([A-Za-z_:][-A-Za-z0-9_:.]*)\\\\s*=\\\\s*(?:\"([^\"]*)\"|\\'([^\\']*)\\')';\n\nconst islandFrameworks: IslandFramework[] = [\n\t'react',\n\t'svelte',\n\t'vue',\n\t'angular'\n];\n\nconst islandHydrationModes = ['load', 'idle', 'visible', 'none'] as const;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nconst isIslandFramework = (value: string): value is IslandFramework =>\n\tislandFrameworks.some((framework) => framework === value);\n\nconst isIslandHydrationMode = (\n\tvalue: string\n): value is IslandHydrate =>\n\tislandHydrationModes.some((mode) => mode === value);\n\ntype HTMLAttributeMap = Map<string, string>;\n\nconst parseHtmlAttributes = (attributeString: string): HTMLAttributeMap => {\n\tconst attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, 'g');\n\tconst attributes = new Map<string, string>();\n\tlet match = attributeRe.exec(attributeString);\n\n\twhile (match) {\n\t\tconst [, key, doubleQuotedValue, singleQuotedValue] = match;\n\t\tmatch = attributeRe.exec(attributeString);\n\t\tif (!key) continue;\n\n\t\tconst value = doubleQuotedValue ?? singleQuotedValue ?? '';\n\t\tattributes.set(key, value);\n\t}\n\n\treturn attributes;\n};\n\nconst parseIslandTag = (\n\tattributeString: string\n): RuntimeIslandRenderProps | null => {\n\tconst attributes = parseHtmlAttributes(attributeString);\n\tconst framework = attributes.get('framework');\n\tconst component = attributes.get('component');\n\tconst hydrate = attributes.get('hydrate') ?? 'load';\n\tconst propsSource = attributes.get('props') ?? '{}';\n\n\tif (!framework || !component) {\n\t\treturn null;\n\t}\n\n\tif (!isIslandFramework(framework)) {\n\t\tthrow new Error(`Unsupported static island framework \"${framework}\".`);\n\t}\n\n\tif (!isIslandHydrationMode(hydrate)) {\n\t\tthrow new Error(`Unsupported static island hydrate mode \"${hydrate}\".`);\n\t}\n\n\tlet parsedProps: Record<string, unknown>;\n\ttry {\n\t\tconst candidate: unknown = JSON.parse(propsSource);\n\t\tparsedProps = isRecord(candidate) ? candidate : {};\n\t} catch (error) {\n\t\tthrow new Error(\n\t\t\t`Failed to parse static island props JSON for ${framework}:${component}: ${\n\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t}`,\n\t\t\t{ cause: error }\n\t\t);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tframework,\n\t\thydrate,\n\t\tprops: parsedProps\n\t};\n};\n\nexport const transformStaticPageHtml = async (\n\toriginalHtml: string,\n\tregistry: IslandRegistryInput\n) => {\n\tconst islandTagRe = new RegExp(ISLAND_TAG_RE_SOURCE, 'gi');\n\tif (!islandTagRe.test(originalHtml)) {\n\t\treturn originalHtml;\n\t}\n\n\tislandTagRe.lastIndex = 0;\n\n\tconst segments: { before: string; props: ReturnType<typeof parseIslandTag>; fullMatch: string }[] = [];\n\tlet lastIndex = 0;\n\tlet match = islandTagRe.exec(originalHtml);\n\n\twhile (match) {\n\t\tconst [fullMatch, rawAttributeString] = match;\n\t\tconst attributeString = rawAttributeString ?? '';\n\t\tsegments.push({\n\t\t\tbefore: originalHtml.slice(lastIndex, match.index),\n\t\t\tfullMatch,\n\t\t\tprops: parseIslandTag(attributeString)\n\t\t});\n\t\tlastIndex = match.index + fullMatch.length;\n\t\tmatch = islandTagRe.exec(originalHtml);\n\t}\n\n\tconst renderedSegments = await Promise.all(\n\t\tsegments.map(async (segment) =>\n\t\t\tsegment.before + (segment.props ? await renderIslandMarkup(registry, segment.props) : segment.fullMatch)\n\t\t)\n\t);\n\n\treturn renderedSegments.join('') + originalHtml.slice(lastIndex);\n};\n\nconst HTMX_STREAM_SLOT_TAG_RE =\n\t/<abs-htmx-stream-slot\\b([^>]*?)(?:\\/>|>([\\s\\S]*?)<\\/abs-htmx-stream-slot>)/gi;\n\nconst requireAttribute = (\n\tattributes: HTMLAttributeMap,\n\tname: string\n) => {\n\tconst value = attributes.get(name)?.trim();\n\tif (!value) {\n\t\tthrow new Error(\n\t\t\t`Static <abs-htmx-stream-slot> requires a \"${name}\" attribute.`\n\t\t);\n\t}\n\n\treturn value;\n};\n\nconst injectAttributesIntoSingleRootElement = (\n\tfallbackHtml: string,\n\tattributes: HTMLAttributeMap\n) => {\n\tconst trimmed = fallbackHtml.trim();\n\tif (!trimmed) {\n\t\tthrow new Error(\n\t\t\t'Static <abs-htmx-stream-slot> requires fallback HTML inside the element body.'\n\t\t);\n\t}\n\n\tconst openingTagMatch = trimmed.match(/^<([A-Za-z][\\w:-]*)([^>]*)>/);\n\tif (!openingTagMatch) {\n\t\tthrow new Error(\n\t\t\t'Static <abs-htmx-stream-slot> fallback must start with a single root HTML element.'\n\t\t);\n\t}\n\n\tconst attributeSource = [...attributes.entries()]\n\t\t.map(([key, value]) => `${key}=\"${value}\"`)\n\t\t.join(' ');\n\tif (!attributeSource) {\n\t\treturn trimmed;\n\t}\n\n\tconst [openingTag, tagName, rawExistingAttributes = ''] = openingTagMatch;\n\tconst existingAttributes = rawExistingAttributes.trim();\n\tconst mergedAttributes = existingAttributes\n\t\t? `${existingAttributes} ${attributeSource}`\n\t\t: attributeSource;\n\n\treturn trimmed.replace(openingTag, `<${tagName} ${mergedAttributes}>`);\n};\n\nexport const transformStaticHTMXStreamSlotHtml = (originalHtml: string) => {\n\tlet nextIndex = 0;\n\tlet result = '';\n\tlet match = HTMX_STREAM_SLOT_TAG_RE.exec(originalHtml);\n\n\twhile (match) {\n\t\tconst [fullMatch, rawAttributeString = '', innerHtml = ''] = match;\n\t\tconst attributes = parseHtmlAttributes(rawAttributeString);\n\t\tconst loweredAttributes = new Map<string, string>([\n\t\t\t['hx-get', requireAttribute(attributes, 'src')],\n\t\t\t['hx-trigger', attributes.get('trigger') ?? 'load'],\n\t\t\t['hx-swap', attributes.get('swap') ?? 'outerHTML'],\n\t\t\t['hx-target', attributes.get('target') ?? 'this']\n\t\t]);\n\n\t\tresult += originalHtml.slice(nextIndex, match.index);\n\t\tresult += injectAttributesIntoSingleRootElement(innerHtml, loweredAttributes);\n\t\tnextIndex = match.index + fullMatch.length;\n\t\tmatch = HTMX_STREAM_SLOT_TAG_RE.exec(originalHtml);\n\t}\n\n\treturn result + originalHtml.slice(nextIndex);\n};\n\nexport const transformStaticStreamingSlotHtml = (originalHtml: string) => {\n\tconst slotDefinitions = extractStaticStreamingTags(originalHtml);\n\tif (slotDefinitions.length === 0) {\n\t\treturn originalHtml;\n\t}\n\n\tconst tagRe =\n\t\t/<abs-stream-slot\\b([^>]*?)(?:\\/>|>([\\s\\S]*?)<\\/abs-stream-slot>)/gi;\n\tlet nextIndex = 0;\n\tlet slotIndex = 0;\n\tlet result = '';\n\tlet match = tagRe.exec(originalHtml);\n\n\twhile (match) {\n\t\tconst [fullMatch] = match;\n\t\tconst tag = slotDefinitions[slotIndex++];\n\t\tif (!tag) {\n\t\t\tthrow new Error(\n\t\t\t\t'Static streaming slot transform lost sync with parsed slot definitions.'\n\t\t\t);\n\t\t}\n\t\tresult += originalHtml.slice(nextIndex, match.index);\n\t\tresult += renderStreamingSlotPlaceholder(tag.id, tag.fallbackHtml);\n\t\tnextIndex = match.index + fullMatch.length;\n\t\tmatch = tagRe.exec(originalHtml);\n\t}\n\n\treturn result + originalHtml.slice(nextIndex);\n};\n\nconst transformStaticPage = async (\n\tpagePath: string,\n\tregistry: IslandRegistryInput\n) => {\n\tconst originalHtml = readFileSync(pagePath, 'utf-8');\n\tconst transformedHtml = await transformStaticPageHtml(\n\t\toriginalHtml,\n\t\tregistry\n\t);\n\n\tif (transformedHtml !== originalHtml) {\n\t\twriteFileSync(pagePath, transformedHtml);\n\t}\n};\n\nexport const transformCurrentStaticPageHtml = async (\n\thtml: string,\n\toptions: {\n\t\tenableHTMXStreaming?: boolean;\n\t\tenableStaticStreaming?: boolean;\n\t} = {}\n) => {\n\tconst transformedHTMXStreamingHtml =\n\t\toptions.enableHTMXStreaming === false\n\t\t\t? html\n\t\t\t: transformStaticHTMXStreamSlotHtml(html);\n\tconst transformedStreamingHtml =\n\t\toptions.enableStaticStreaming === false\n\t\t\t? transformedHTMXStreamingHtml\n\t\t\t: transformStaticStreamingSlotHtml(transformedHTMXStreamingHtml);\n\tconst islandTagRe = new RegExp(ISLAND_TAG_RE_SOURCE, 'i');\n\tif (!islandTagRe.test(transformedStreamingHtml)) {\n\t\treturn transformedStreamingHtml;\n\t}\n\n\treturn transformStaticPageHtml(\n\t\ttransformedStreamingHtml,\n\t\trequireCurrentIslandRegistry()\n\t);\n};\nexport const transformStaticPagesWithIslands = async (\n\tregistryPath: string | undefined,\n\tpagePaths: string[]\n) => {\n\tif (!registryPath || pagePaths.length === 0) {\n\t\treturn;\n\t}\n\n\tconst { registry } = await loadIslandRegistryBuildInfo(registryPath);\n\n\tawait Promise.all(\n\t\tpagePaths.map((pagePath) => transformStaticPage(pagePath, registry))\n\t);\n};\n",
|
|
10
|
-
"import { readFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type { BuildConfig } from '../../types/build';\nimport type { IslandFramework } from '../../types/island';\nimport { loadIslandRegistryBuildInfo } from '../build/islandEntries';\nimport { scanEntryPoints } from '../build/scanEntryPoints';\nimport {\n\textractIslandUsagesFromSource,\n\ttype PageIslandUsage\n} from './sourceMetadata';\n\nexport type PageIslandMetadata = {\n\tislands: PageIslandUsage[];\n\tpagePath: string;\n};\n\ndeclare global {\n\tvar __absolutePageIslandMetadata:\n\t\t| Map<string, PageIslandMetadata>\n\t\t| undefined;\n}\n\nconst pagePatterns: Partial<Record<IslandFramework | 'html' | 'htmx', string>> =\n\t{\n\t\tangular: 'pages/**/*.{ts,js}',\n\t\thtml: 'pages/**/*.html',\n\t\thtmx: 'pages/**/*.html',\n\t\treact: 'pages/**/*.{ts,tsx,js,jsx}',\n\t\tsvelte: 'pages/**/*.svelte',\n\t\tvue: 'pages/**/*.vue'\n\t};\n\ntype PageDirectoryEntry = {\n\tdir: string;\n\tframework: keyof typeof pagePatterns;\n};\n\nconst getPageDirs = (config: BuildConfig) =>\n\t(\n\t\t[\n\t\t\t{ dir: config.angularDirectory, framework: 'angular' },\n\t\t\t{ dir: config.reactDirectory, framework: 'react' },\n\t\t\t{ dir: config.svelteDirectory, framework: 'svelte' },\n\t\t\t{ dir: config.vueDirectory, framework: 'vue' },\n\t\t\t{ dir: config.htmlDirectory, framework: 'html' },\n\t\t\t{ dir: config.htmxDirectory, framework: 'htmx' }\n\t\t] satisfies Array<{\n\t\t\tdir: string | undefined;\n\t\t\tframework: keyof typeof pagePatterns;\n\t\t}>\n\t).filter(\n\t\t(entry): entry is PageDirectoryEntry =>\n\t\t\ttypeof entry.dir === 'string' && entry.dir.length > 0\n\t);\n\nconst buildIslandSourceLookup = async (config: BuildConfig) => {\n\tconst registryPath = config.islands?.registry;\n\tif (!registryPath) {\n\t\treturn new Map<string, string>();\n\t}\n\n\tconst buildInfo = await loadIslandRegistryBuildInfo(registryPath);\n\tconst lookup = new Map<string, string>();\n\n\tfor (const definition of buildInfo.definitions) {\n\t\tconst source = definition.buildReference?.source;\n\t\tif (!source) continue;\n\n\t\tconst resolvedSource = source.startsWith('file://')\n\t\t\t? new URL(source).pathname\n\t\t\t: resolve(dirname(buildInfo.resolvedRegistryPath), source);\n\n\t\tlookup.set(\n\t\t\t`${definition.framework}:${definition.component}`,\n\t\t\tresolve(resolvedSource)\n\t\t);\n\t}\n\n\treturn lookup;\n};\n\nexport const getCurrentPageIslandMetadata = () =>\n\tglobalThis.__absolutePageIslandMetadata ??\n\tnew Map<string, PageIslandMetadata>();\nconst metadataUsesSource = (metadata: PageIslandMetadata, target: string) =>\n\tmetadata.islands.some((usage) => {\n\t\tconst candidate = usage.source;\n\n\t\treturn candidate ? resolve(candidate) === target : false;\n\t});\n\nexport const getPagesUsingIslandSource = (sourcePath: string) => {\n\tconst target = resolve(sourcePath);\n\n\treturn [...getCurrentPageIslandMetadata().values()]\n\t\t.filter((metadata) => metadataUsesSource(metadata, target))\n\t\t.map((metadata) => metadata.pagePath);\n};\nconst resolveIslandUsages = (\n\tislands: PageIslandUsage[],\n\tislandSourceLookup: Map<string, string>\n) =>\n\tislands.map((usage) => {\n\t\tconst sourcePath = islandSourceLookup.get(\n\t\t\t`${usage.framework}:${usage.component}`\n\t\t);\n\n\t\treturn sourcePath\n\t\t\t? {\n\t\t\t\t\t...usage,\n\t\t\t\t\tsource: sourcePath\n\t\t\t\t}\n\t\t\t: usage;\n\t});\n\nconst loadPageIslandFiles = async (\n\tentry: PageDirectoryEntry,\n\tislandSourceLookup: Map<string, string>,\n\tpageMetadata: Map<string, PageIslandMetadata>\n) => {\n\tconst pattern = pagePatterns[entry.framework];\n\tif (!pattern) return;\n\n\tconst files = await scanEntryPoints(resolve(entry.dir), pattern);\n\tfor (const filePath of files) {\n\t\tconst source = readFileSync(filePath, 'utf-8');\n\t\tconst islands = extractIslandUsagesFromSource(source);\n\t\tpageMetadata.set(resolve(filePath), {\n\t\t\tislands: resolveIslandUsages(islands, islandSourceLookup),\n\t\t\tpagePath: resolve(filePath)\n\t\t});\n\t}\n};\n\nexport const loadPageIslandMetadata = async (config: BuildConfig) => {\n\tconst pageMetadata = new Map<string, PageIslandMetadata>();\n\tconst islandSourceLookup = await buildIslandSourceLookup(config);\n\n\tawait Promise.all(\n\t\tgetPageDirs(config).map((entry) =>\n\t\t\tloadPageIslandFiles(entry, islandSourceLookup, pageMetadata)\n\t\t)\n\t);\n\n\treturn pageMetadata;\n};\nexport const setCurrentPageIslandMetadata = (\n\tmetadata: Map<string, PageIslandMetadata>\n) => {\n\tglobalThis.__absolutePageIslandMetadata = metadata;\n};\n"
|
|
11
|
-
],
|
|
12
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAWA,IAAM,uCACL;AAEM,IAAM,sBAAsB,CAAC,aACnC,qCAAqC,KAAK,QAAQ;AAgB5C,IAAM,kBAAkB,OAC9B,OACA,QACA,WACA,yBACI;AAAA,EACJ,MAAM,aAAa,KAAK,WAAW,MAAM;AAAA,EACzC,MAAM,MAAM,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;AAAA,EACpD,MAAM,yBACL,EAAE,OAAO,OAAO,GAChB,WACA,CAAC,GACD,oBACD;AAAA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B,YAAY,CAC5D,CACD;AAAA,EAEA,OAAO;AAAA;AAED,IAAM,+BAA+B,CAC3C,aACI;AAAA,EACJ,WAAW,+BAA+B;AAAA;",
|
|
13
|
-
"debugId": "EA2793B90D7FF16C64756E2164756E21",
|
|
14
|
-
"names": []
|
|
15
|
-
}
|
package/dist/chunk-fygx2ymm.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// node_modules/zustand/esm/vanilla.mjs
|
|
3
|
-
var createStoreImpl = (createState) => {
|
|
4
|
-
let state;
|
|
5
|
-
const listeners = /* @__PURE__ */ new Set;
|
|
6
|
-
const setState = (partial, replace) => {
|
|
7
|
-
const nextState = typeof partial === "function" ? partial(state) : partial;
|
|
8
|
-
if (!Object.is(nextState, state)) {
|
|
9
|
-
const previousState = state;
|
|
10
|
-
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
11
|
-
listeners.forEach((listener) => listener(state, previousState));
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const getState = () => state;
|
|
15
|
-
const getInitialState = () => initialState;
|
|
16
|
-
const subscribe = (listener) => {
|
|
17
|
-
listeners.add(listener);
|
|
18
|
-
return () => listeners.delete(listener);
|
|
19
|
-
};
|
|
20
|
-
const api = { setState, getState, getInitialState, subscribe };
|
|
21
|
-
const initialState = state = createState(setState, getState, api);
|
|
22
|
-
return api;
|
|
23
|
-
};
|
|
24
|
-
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
25
|
-
|
|
26
|
-
// node_modules/zustand/esm/middleware.mjs
|
|
27
|
-
function combine(initialState, create) {
|
|
28
|
-
return (...args) => Object.assign({}, initialState, create(...args));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// src/client/islandStore.ts
|
|
32
|
-
var getIslandStoreSnapshot = () => {
|
|
33
|
-
globalThis.__ABS_ISLAND_STATE__ ??= {};
|
|
34
|
-
return globalThis.__ABS_ISLAND_STATE__;
|
|
35
|
-
};
|
|
36
|
-
var getIslandStores = () => {
|
|
37
|
-
globalThis.__ABS_ISLAND_STORES__ ??= new Map;
|
|
38
|
-
return globalThis.__ABS_ISLAND_STORES__;
|
|
39
|
-
};
|
|
40
|
-
var isSerializableValue = (value) => typeof value !== "function" && value !== undefined;
|
|
41
|
-
var toSerializableState = (state) => Object.fromEntries(Object.entries(state).filter(([, value]) => isSerializableValue(value)));
|
|
42
|
-
var applySnapshot = (store, snapshot) => {
|
|
43
|
-
if (!snapshot) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
store.setState({
|
|
47
|
-
...store.getState(),
|
|
48
|
-
...snapshot
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
var getPeerStores = (storeInstances, ownerStore) => [...storeInstances].filter((peer) => peer.store !== ownerStore);
|
|
52
|
-
var syncIslandSnapshot = (storeId, state, storeInstances, ownerStore) => {
|
|
53
|
-
const nextSnapshot = toSerializableState(state);
|
|
54
|
-
getIslandStoreSnapshot()[storeId] = nextSnapshot;
|
|
55
|
-
for (const peerStore of getPeerStores(storeInstances, ownerStore)) {
|
|
56
|
-
peerStore.applyExternalSnapshot(nextSnapshot);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
var createIslandStore = (storeId, initialState, createState) => {
|
|
60
|
-
const store = createStore(combine(initialState, createState));
|
|
61
|
-
const stores = getIslandStores();
|
|
62
|
-
const storeInstances = stores.get(storeId) ?? new Set;
|
|
63
|
-
const initialSnapshot = getIslandStoreSnapshot()[storeId];
|
|
64
|
-
applySnapshot(store, initialSnapshot);
|
|
65
|
-
let isApplyingExternalSnapshot = false;
|
|
66
|
-
const applyExternalSnapshot = (snapshot) => {
|
|
67
|
-
isApplyingExternalSnapshot = true;
|
|
68
|
-
applySnapshot(store, snapshot);
|
|
69
|
-
};
|
|
70
|
-
storeInstances.add({
|
|
71
|
-
applyExternalSnapshot,
|
|
72
|
-
store
|
|
73
|
-
});
|
|
74
|
-
stores.set(storeId, storeInstances);
|
|
75
|
-
syncIslandSnapshot(storeId, store.getState(), storeInstances, store);
|
|
76
|
-
store.subscribe((state) => {
|
|
77
|
-
if (isApplyingExternalSnapshot) {
|
|
78
|
-
isApplyingExternalSnapshot = false;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
syncIslandSnapshot(storeId, state, storeInstances, store);
|
|
82
|
-
});
|
|
83
|
-
return store;
|
|
84
|
-
};
|
|
85
|
-
var getIslandStoreServerSnapshot = (store, selector) => selector(store.getInitialState());
|
|
86
|
-
var applySnapshotToStoreInstances = (storeId, instances, snapshot) => {
|
|
87
|
-
for (const instance of instances) {
|
|
88
|
-
instance.applyExternalSnapshot(snapshot[storeId] ?? {});
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
var initializeIslandStores = (state) => {
|
|
92
|
-
const currentSnapshot = getIslandStoreSnapshot();
|
|
93
|
-
const nextSnapshot = {
|
|
94
|
-
...state,
|
|
95
|
-
...currentSnapshot
|
|
96
|
-
};
|
|
97
|
-
globalThis.__ABS_ISLAND_STATE__ = nextSnapshot;
|
|
98
|
-
for (const [storeId, store] of getIslandStores()) {
|
|
99
|
-
applySnapshotToStoreInstances(storeId, store, nextSnapshot);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
var readIslandStore = (store, selector) => selector(store.getState());
|
|
103
|
-
var subscribeIslandStore = (store, selector, listener) => {
|
|
104
|
-
let currentSelection = selector(store.getState());
|
|
105
|
-
return store.subscribe((state) => {
|
|
106
|
-
const nextSelection = selector(state);
|
|
107
|
-
if (Object.is(nextSelection, currentSelection)) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
currentSelection = nextSelection;
|
|
111
|
-
listener(nextSelection);
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export { createIslandStore, getIslandStoreServerSnapshot, initializeIslandStores, readIslandStore, subscribeIslandStore };
|
|
116
|
-
|
|
117
|
-
//# debugId=BAB6679FFC15F26F64756E2164756E21
|
|
118
|
-
//# sourceMappingURL=chunk-fygx2ymm.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../node_modules/zustand/esm/vanilla.mjs", "../node_modules/zustand/esm/middleware.mjs", "../src/client/islandStore.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"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",
|
|
6
|
-
"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",
|
|
7
|
-
"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"
|
|
8
|
-
],
|
|
9
|
-
"mappings": ";;AAAA,IAAM,kBAAkB,CAAC,gBAAgB;AAAA,EACvC,IAAI;AAAA,EACJ,MAAM,4BAA4B,IAAI;AAAA,EACtC,MAAM,WAAW,CAAC,SAAS,YAAY;AAAA,IACrC,MAAM,YAAY,OAAO,YAAY,aAAa,QAAQ,KAAK,IAAI;AAAA,IACnE,IAAI,CAAC,OAAO,GAAG,WAAW,KAAK,GAAG;AAAA,MAChC,MAAM,gBAAgB;AAAA,MACtB,SAAS,WAAW,OAAO,UAAU,OAAO,cAAc,YAAY,cAAc,QAAQ,YAAY,OAAO,OAAO,CAAC,GAAG,OAAO,SAAS;AAAA,MAC1I,UAAU,QAAQ,CAAC,aAAa,SAAS,OAAO,aAAa,CAAC;AAAA,IAChE;AAAA;AAAA,EAEF,MAAM,WAAW,MAAM;AAAA,EACvB,MAAM,kBAAkB,MAAM;AAAA,EAC9B,MAAM,YAAY,CAAC,aAAa;AAAA,IAC9B,UAAU,IAAI,QAAQ;AAAA,IACtB,OAAO,MAAM,UAAU,OAAO,QAAQ;AAAA;AAAA,EAExC,MAAM,MAAM,EAAE,UAAU,UAAU,iBAAiB,UAAU;AAAA,EAC7D,MAAM,eAAe,QAAQ,YAAY,UAAU,UAAU,GAAG;AAAA,EAChE,OAAO;AAAA;AAET,IAAM,cAAe,CAAC,gBAAgB,cAAc,gBAAgB,WAAW,IAAI;;;AC0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AAAA,MAC/C;AAAA,IACD;AAAA,IAEA,mBAAmB;AAAA,IACnB,SAAS,aAAa;AAAA,GACtB;AAAA;",
|
|
10
|
-
"debugId": "BAB6679FFC15F26F64756E2164756E21",
|
|
11
|
-
"names": []
|
|
12
|
-
}
|
package/dist/chunk-g15qj669.js
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
isStreamingSlotCollectionActive,
|
|
4
|
-
registerStreamingSlot,
|
|
5
|
-
warnMissingStreamingSlotCollector
|
|
6
|
-
} from "./chunk-qxq2zcty.js";
|
|
7
|
-
import {
|
|
8
|
-
__require
|
|
9
|
-
} from "./chunk-bmgqm774.js";
|
|
10
|
-
// src/vue/components/SuspenseSlot.ts
|
|
11
|
-
import {
|
|
12
|
-
cloneVNode,
|
|
13
|
-
defineComponent,
|
|
14
|
-
h,
|
|
15
|
-
isVNode,
|
|
16
|
-
onMounted,
|
|
17
|
-
onBeforeUnmount,
|
|
18
|
-
ref,
|
|
19
|
-
useSSRContext
|
|
20
|
-
} from "vue";
|
|
21
|
-
var renderVueNodesToHtml = async (nodes) => {
|
|
22
|
-
const { createSSRApp, h: createVNode } = await import("vue");
|
|
23
|
-
const { renderToString } = await import("vue/server-renderer");
|
|
24
|
-
const app = createSSRApp({
|
|
25
|
-
render: () => createVNode("div", undefined, nodes ?? undefined)
|
|
26
|
-
});
|
|
27
|
-
const html = await renderToString(app);
|
|
28
|
-
return html.replace(/^<div>|<\/div>$/g, "");
|
|
29
|
-
};
|
|
30
|
-
var hasFrameworkSlots = (defaultSlot, fallbackSlot, errorSlot, promise) => defaultSlot !== undefined || fallbackSlot !== undefined || errorSlot !== undefined || promise !== undefined;
|
|
31
|
-
var allowMismatchOnSlotNodes = (nodes) => {
|
|
32
|
-
if (Array.isArray(nodes)) {
|
|
33
|
-
return nodes.map((node) => allowMismatchOnSlotNodes(node));
|
|
34
|
-
}
|
|
35
|
-
if (isVNode(nodes)) {
|
|
36
|
-
return cloneVNode(nodes, {
|
|
37
|
-
"data-allow-mismatch": ""
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return nodes;
|
|
41
|
-
};
|
|
42
|
-
var resolveSuspenseValue = async (resolve, promise) => {
|
|
43
|
-
if (resolve !== undefined) {
|
|
44
|
-
return resolve();
|
|
45
|
-
}
|
|
46
|
-
if (promise !== undefined) {
|
|
47
|
-
return promise;
|
|
48
|
-
}
|
|
49
|
-
return;
|
|
50
|
-
};
|
|
51
|
-
var isObjectRecord = (value) => Boolean(value) && typeof value === "object";
|
|
52
|
-
var isVueSuspensePayload = (payload) => {
|
|
53
|
-
if (!isObjectRecord(payload)) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
return payload.kind === "vue-suspense";
|
|
57
|
-
};
|
|
58
|
-
var hasEventDetailId = (event, id) => {
|
|
59
|
-
if (!(event instanceof CustomEvent)) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
const { detail } = event;
|
|
63
|
-
if (!detail || typeof detail !== "object") {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
return detail.id === id;
|
|
67
|
-
};
|
|
68
|
-
var toLegacySuspenseSlotRegistration = (props) => {
|
|
69
|
-
if (!props.resolve) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
errorHtml: props.errorHtml,
|
|
74
|
-
fallbackHtml: props.fallbackHtml,
|
|
75
|
-
id: props.id,
|
|
76
|
-
timeoutMs: props.timeoutMs,
|
|
77
|
-
resolve: async () => {
|
|
78
|
-
const resolved = await props.resolve?.();
|
|
79
|
-
return typeof resolved === "string" ? resolved : "";
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
var registerLegacySuspenseSlot = (props) => {
|
|
84
|
-
registerStreamingSlot({
|
|
85
|
-
errorHtml: props.errorHtml,
|
|
86
|
-
fallbackHtml: props.fallbackHtml,
|
|
87
|
-
id: props.id,
|
|
88
|
-
resolve: props.resolve,
|
|
89
|
-
timeoutMs: props.timeoutMs
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
var resolveStreamingSuspenseSlot = async (props, slots) => {
|
|
93
|
-
try {
|
|
94
|
-
const value = await resolveSuspenseValue(props.resolve, props.promise);
|
|
95
|
-
const nodes = allowMismatchOnSlotNodes(slots.default?.({ value }) ?? []);
|
|
96
|
-
const html = await renderVueNodesToHtml(nodes);
|
|
97
|
-
return {
|
|
98
|
-
html,
|
|
99
|
-
kind: "vue-suspense",
|
|
100
|
-
value
|
|
101
|
-
};
|
|
102
|
-
} catch (error) {
|
|
103
|
-
const errorNodes = slots.error?.({ error });
|
|
104
|
-
if (errorNodes !== undefined)
|
|
105
|
-
return renderVueNodesToHtml(allowMismatchOnSlotNodes(errorNodes));
|
|
106
|
-
if (typeof props.errorHtml === "string")
|
|
107
|
-
return props.errorHtml;
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
var registerSuspenseSlotForSsr = (props, slots, usesFrameworkSlots) => {
|
|
112
|
-
if (!isStreamingSlotCollectionActive()) {
|
|
113
|
-
warnMissingStreamingSlotCollector("SuspenseSlot");
|
|
114
|
-
}
|
|
115
|
-
const legacyRegistration = toLegacySuspenseSlotRegistration(props);
|
|
116
|
-
if (!usesFrameworkSlots && legacyRegistration) {
|
|
117
|
-
registerLegacySuspenseSlot(legacyRegistration);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
registerStreamingSlot({
|
|
121
|
-
id: props.id,
|
|
122
|
-
timeoutMs: props.timeoutMs,
|
|
123
|
-
resolve: () => resolveStreamingSuspenseSlot(props, slots)
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
var applySuspensePayload = (payload, state) => {
|
|
127
|
-
state.hasError.value = payload.state === "error";
|
|
128
|
-
state.resolvedValue.value = payload.value;
|
|
129
|
-
state.isResolved.value = payload.state !== "error";
|
|
130
|
-
};
|
|
131
|
-
var SuspenseSlot = defineComponent({
|
|
132
|
-
name: "AbsoluteSuspenseSlot",
|
|
133
|
-
props: {
|
|
134
|
-
className: { default: undefined, type: String },
|
|
135
|
-
errorHtml: { default: undefined, type: String },
|
|
136
|
-
fallbackHtml: { default: "", type: String },
|
|
137
|
-
id: { required: true, type: String },
|
|
138
|
-
promise: {
|
|
139
|
-
default: undefined,
|
|
140
|
-
type: Object
|
|
141
|
-
},
|
|
142
|
-
resolve: {
|
|
143
|
-
default: undefined,
|
|
144
|
-
type: Function
|
|
145
|
-
},
|
|
146
|
-
timeoutMs: { default: undefined, type: Number }
|
|
147
|
-
},
|
|
148
|
-
setup(props, { slots }) {
|
|
149
|
-
const readPatchedDomState = () => {
|
|
150
|
-
if (typeof document === "undefined")
|
|
151
|
-
return false;
|
|
152
|
-
const slotNode = document.getElementById(props.id);
|
|
153
|
-
if (!slotNode)
|
|
154
|
-
return false;
|
|
155
|
-
return slotNode.getAttribute("data-absolute-slot-state") === "resolved";
|
|
156
|
-
};
|
|
157
|
-
const isResolved = ref(false);
|
|
158
|
-
const resolvedValue = ref(undefined);
|
|
159
|
-
const hasError = ref(false);
|
|
160
|
-
const hasPatchedDom = ref(readPatchedDomState());
|
|
161
|
-
const usesFrameworkSlots = hasFrameworkSlots(slots.default, slots.fallback, slots.error, props.promise);
|
|
162
|
-
const isSsrRender = useSSRContext() !== undefined;
|
|
163
|
-
if (isSsrRender) {
|
|
164
|
-
registerSuspenseSlotForSsr(props, slots, usesFrameworkSlots);
|
|
165
|
-
}
|
|
166
|
-
if (typeof window !== "undefined" && usesFrameworkSlots) {
|
|
167
|
-
const consumers = window.__ABS_SLOT_CONSUMERS__ = window.__ABS_SLOT_CONSUMERS__ ?? {};
|
|
168
|
-
let runtimeReady = false;
|
|
169
|
-
consumers[props.id] = (payload) => {
|
|
170
|
-
if (!runtimeReady)
|
|
171
|
-
return false;
|
|
172
|
-
if (!isVueSuspensePayload(payload)) {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
applySuspensePayload(payload, {
|
|
176
|
-
hasError,
|
|
177
|
-
isResolved,
|
|
178
|
-
resolvedValue
|
|
179
|
-
});
|
|
180
|
-
return true;
|
|
181
|
-
};
|
|
182
|
-
const handlePatchedDom = (event) => {
|
|
183
|
-
if (hasEventDetailId(event, props.id)) {
|
|
184
|
-
hasPatchedDom.value = true;
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
onMounted(() => {
|
|
188
|
-
hasPatchedDom.value = readPatchedDomState();
|
|
189
|
-
window.addEventListener("absolutejs:slot-patch", handlePatchedDom);
|
|
190
|
-
runtimeReady = true;
|
|
191
|
-
window.__ABS_SLOT_FLUSH__?.();
|
|
192
|
-
});
|
|
193
|
-
onBeforeUnmount(() => {
|
|
194
|
-
window.removeEventListener("absolutejs:slot-patch", handlePatchedDom);
|
|
195
|
-
delete window.__ABS_SLOT_CONSUMERS__?.[props.id];
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
const resolveSlotChildren = () => {
|
|
199
|
-
if (hasPatchedDom.value) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
if (hasError.value) {
|
|
203
|
-
return allowMismatchOnSlotNodes(slots.error?.({ error: undefined }) ?? slots.fallback?.() ?? undefined) ?? undefined;
|
|
204
|
-
}
|
|
205
|
-
if (isResolved.value) {
|
|
206
|
-
return allowMismatchOnSlotNodes(slots.default?.({ value: resolvedValue.value }) ?? undefined) ?? undefined;
|
|
207
|
-
}
|
|
208
|
-
return allowMismatchOnSlotNodes(slots.fallback?.() ?? undefined);
|
|
209
|
-
};
|
|
210
|
-
return () => {
|
|
211
|
-
if (!usesFrameworkSlots) {
|
|
212
|
-
return h("div", {
|
|
213
|
-
class: props.className,
|
|
214
|
-
"data-absolute-slot": "true",
|
|
215
|
-
id: props.id,
|
|
216
|
-
innerHTML: props.fallbackHtml
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
return h("div", {
|
|
220
|
-
class: props.className,
|
|
221
|
-
"data-absolute-slot": "true",
|
|
222
|
-
"data-allow-mismatch": "",
|
|
223
|
-
id: props.id
|
|
224
|
-
}, resolveSlotChildren() ?? undefined);
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
// src/vue/components/StreamSlot.ts
|
|
229
|
-
import { defineComponent as defineComponent2, h as h2, useSSRContext as useSSRContext2 } from "vue";
|
|
230
|
-
var StreamSlot = defineComponent2({
|
|
231
|
-
name: "AbsoluteStreamSlot",
|
|
232
|
-
props: {
|
|
233
|
-
className: { default: undefined, type: String },
|
|
234
|
-
errorHtml: { default: undefined, type: String },
|
|
235
|
-
fallbackHtml: { default: "", type: String },
|
|
236
|
-
id: { required: true, type: String },
|
|
237
|
-
resolve: {
|
|
238
|
-
required: true,
|
|
239
|
-
type: Function
|
|
240
|
-
},
|
|
241
|
-
timeoutMs: { default: undefined, type: Number }
|
|
242
|
-
},
|
|
243
|
-
setup(props) {
|
|
244
|
-
if (useSSRContext2() !== undefined) {
|
|
245
|
-
registerStreamSlotForSsr(props);
|
|
246
|
-
}
|
|
247
|
-
return () => h2("div", {
|
|
248
|
-
class: props.className,
|
|
249
|
-
"data-absolute-slot": "true",
|
|
250
|
-
id: props.id,
|
|
251
|
-
innerHTML: props.fallbackHtml
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
var registerStreamSlotForSsr = (props) => {
|
|
256
|
-
if (!isStreamingSlotCollectionActive()) {
|
|
257
|
-
warnMissingStreamingSlotCollector("StreamSlot");
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
registerStreamingSlot({
|
|
261
|
-
errorHtml: props.errorHtml,
|
|
262
|
-
fallbackHtml: props.fallbackHtml,
|
|
263
|
-
id: props.id,
|
|
264
|
-
resolve: props.resolve,
|
|
265
|
-
timeoutMs: props.timeoutMs
|
|
266
|
-
});
|
|
267
|
-
};
|
|
268
|
-
export { SuspenseSlot, StreamSlot };
|
|
269
|
-
|
|
270
|
-
//# debugId=20D4051859B2A33064756E2164756E21
|
|
271
|
-
//# sourceMappingURL=chunk-g15qj669.js.map
|