@absolutejs/absolute 0.19.0-beta.316 → 0.19.0-beta.318

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.
@@ -25,7 +25,7 @@
25
25
  "import { mkdir } from 'node:fs/promises';\nimport { dirname, extname, join, relative, resolve } from 'node:path';\nimport { lowerSvelteIslandSyntax } from '../svelte/lowerIslandSyntax';\n\nconst serverCacheRoot = join(process.cwd(), '.absolutejs', 'islands', 'svelte');\n\nconst compiledModuleCache = new Map<string, string>();\n\nconst transpiler = new Bun.Transpiler({\n\tloader: 'ts',\n\ttarget: 'browser'\n});\n\nconst ensureRelativeImportPath = (from: string, to: string) => {\n\tconst importPath = relative(dirname(from), to).replace(/\\\\/g, '/');\n\treturn importPath.startsWith('.') ? importPath : `./${importPath}`;\n};\n\nconst resolveRelativeModule = async (spec: string, from: string) => {\n\tif (!spec.startsWith('.')) {\n\t\treturn null;\n\t}\n\n\tconst basePath = resolve(dirname(from), spec);\n\tconst candidates = [\n\t\tbasePath,\n\t\t`${basePath}.ts`,\n\t\t`${basePath}.js`,\n\t\t`${basePath}.mjs`,\n\t\t`${basePath}.cjs`,\n\t\t`${basePath}.json`,\n\t\tjoin(basePath, 'index.ts'),\n\t\tjoin(basePath, 'index.js'),\n\t\tjoin(basePath, 'index.mjs'),\n\t\tjoin(basePath, 'index.cjs'),\n\t\tjoin(basePath, 'index.json')\n\t];\n\n\tfor (const candidate of candidates) {\n\t\tif ((await Bun.file(candidate).exists()) === true) {\n\t\t\treturn candidate;\n\t\t}\n\t}\n\n\treturn null;\n};\n\nconst getCachedModulePath = (sourcePath: string) => {\n\tconst relativeSourcePath = relative(process.cwd(), sourcePath).replace(\n\t\t/\\\\/g,\n\t\t'/'\n\t);\n\tconst normalizedSourcePath = relativeSourcePath.startsWith('..')\n\t\t? sourcePath.replace(/[:\\\\/]/g, '_')\n\t\t: relativeSourcePath;\n\n\treturn join(serverCacheRoot, `${normalizedSourcePath}.server.js`);\n};\n\nconst resolveSvelteImport = async (spec: string, from: string) => {\n\tif (spec.startsWith('/')) {\n\t\treturn spec;\n\t}\n\n\tif (!spec.startsWith('.')) {\n\t\treturn null;\n\t}\n\n\tconst explicitPath = resolve(dirname(from), spec);\n\tif (extname(explicitPath) === '.svelte') {\n\t\treturn explicitPath;\n\t}\n\n\tconst candidate = `${explicitPath}.svelte`;\n\tif ((await Bun.file(candidate).exists()) === true) {\n\t\treturn candidate;\n\t}\n\n\treturn null;\n};\n\nconst writeIfChanged = async (path: string, content: string) => {\n\tconst targetFile = Bun.file(path);\n\tconst exists = await targetFile.exists();\n\tif (exists) {\n\t\tconst currentContent = await targetFile.text();\n\t\tif (currentContent === content) {\n\t\t\treturn;\n\t\t}\n\t}\n\n\tawait Bun.write(path, content);\n};\n\nexport const compileSvelteServerModule = async (sourcePath: string) => {\n\tconst cachedModulePath = compiledModuleCache.get(sourcePath);\n\tif (cachedModulePath) {\n\t\treturn cachedModulePath;\n\t}\n\n\tconst source = await Bun.file(sourcePath).text();\n\tconst { compile, preprocess } = await import('svelte/compiler');\n\tconst loweredSource = lowerSvelteIslandSyntax(source, 'server');\n\tconst preprocessed = await preprocess(loweredSource.code, {});\n\tconst transpiled =\n\t\tsourcePath.endsWith('.ts') || sourcePath.endsWith('.svelte.ts')\n\t\t\t? transpiler.transformSync(preprocessed.code)\n\t\t\t: preprocessed.code;\n\tconst childImportSpecs = Array.from(\n\t\ttranspiled.matchAll(/from\\s+['\"]([^'\"]+)['\"]/g)\n\t)\n\t\t.map((match) => match[1])\n\t\t.filter((value): value is string => value !== undefined);\n\tconst resolvedChildModules = await Promise.all(\n\t\tchildImportSpecs.map((spec) => resolveSvelteImport(spec, sourcePath))\n\t);\n\tconst resolvedModuleImports = await Promise.all(\n\t\tchildImportSpecs.map((spec) => resolveRelativeModule(spec, sourcePath))\n\t);\n\tconst childModulePaths = new Map<string, string>();\n\tconst rewrittenModulePaths = new Map<string, string>();\n\n\tfor (let index = 0; index < childImportSpecs.length; index += 1) {\n\t\tconst spec = childImportSpecs[index];\n\t\tconst resolvedChild = resolvedChildModules[index];\n\t\tif (!spec || !resolvedChild) continue;\n\n\t\tconst compiledChildPath = await compileSvelteServerModule(resolvedChild);\n\t\tchildModulePaths.set(spec, compiledChildPath);\n\t}\n\n\tfor (let index = 0; index < childImportSpecs.length; index += 1) {\n\t\tconst spec = childImportSpecs[index];\n\t\tconst resolvedModuleImport = resolvedModuleImports[index];\n\t\tif (!spec || !resolvedModuleImport) continue;\n\t\tif (resolvedChildModules[index]) continue;\n\n\t\trewrittenModulePaths.set(\n\t\t\tspec,\n\t\t\tensureRelativeImportPath(\n\t\t\t\tgetCachedModulePath(sourcePath),\n\t\t\t\tresolvedModuleImport\n\t\t\t)\n\t\t);\n\t}\n\n\tlet compiledCode = compile(transpiled, {\n\t\tcss: 'injected',\n\t\texperimental: {\n\t\t\tasync: loweredSource.transformed\n\t\t},\n\t\tfilename: sourcePath,\n\t\tgenerate: 'server'\n\t}).js.code;\n\n\tfor (const [spec, compiledChildPath] of childModulePaths) {\n\t\tcompiledCode = compiledCode.replaceAll(\n\t\t\tspec,\n\t\t\tensureRelativeImportPath(\n\t\t\t\tgetCachedModulePath(sourcePath),\n\t\t\t\tcompiledChildPath\n\t\t\t)\n\t\t);\n\t}\n\n\tfor (const [spec, resolvedModuleImport] of rewrittenModulePaths) {\n\t\tcompiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);\n\t}\n\n\tconst compiledModulePath = getCachedModulePath(sourcePath);\n\tawait mkdir(dirname(compiledModulePath), { recursive: true });\n\tawait writeIfChanged(compiledModulePath, compiledCode);\n\tcompiledModuleCache.set(sourcePath, compiledModulePath);\n\n\treturn compiledModulePath;\n};\n",
26
26
  "import type {\n\tIslandRegistry,\n\tIslandRegistryInput,\n\tRuntimeIslandRenderProps\n} from '../../types/island';\nimport {\n\trenderAngularIslandToHtml,\n\trenderReactIslandToHtml,\n\trenderSvelteIslandToHtml,\n\trenderVueIslandToHtml\n} from './islandSsr';\nimport { compileSvelteServerModule } from './svelteServerModule';\nimport {\n\tgetIslandMarkerAttributes,\n\tserializeIslandAttributes\n} from './islandMarkupAttributes';\nimport {\n\tgetIslandBuildReference,\n\tgetIslandComponent\n} from './islands';\n\nlet islandSequence = 0;\nconst resolvedServerComponentCache = new Map<unknown, Promise<unknown>>();\nconst resolvedServerBuildComponentCache = new Map<string, Promise<unknown>>();\n\nconst nextIslandId = () => {\n\tislandSequence += 1;\n\treturn `island-${islandSequence}`;\n};\n\ntype IslandRenderResult = {\n\tattributes: ReturnType<typeof getIslandMarkerAttributes>;\n\thtml: string;\n};\n\ntype AngularServerIslandComponent = import('@angular/core').Type<object>;\ntype ReactServerIslandComponent = import('react').ComponentType<\n\tRecord<string, unknown>\n>;\ntype SvelteServerIslandComponent = import('svelte').Component<\n\tRecord<string, unknown>\n>;\ntype VueServerIslandComponent = import('vue').Component<\n\tRecord<string, unknown>\n>;\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nconst isReactServerIslandComponent = (\n\tvalue: unknown\n): value is ReactServerIslandComponent => typeof value === 'function';\n\nconst isSvelteServerIslandComponent = (\n\tvalue: unknown\n): value is SvelteServerIslandComponent => typeof value === 'function';\n\nconst isVueServerIslandComponent = (\n\tvalue: unknown\n): value is VueServerIslandComponent =>\n\ttypeof value === 'function' || isRecord(value);\n\nconst isAngularServerIslandComponent = (\n\tvalue: unknown\n): value is AngularServerIslandComponent => typeof value === 'function';\n\nconst resolveBuildReferencePath = (source: string, registryPath: string) =>\n\tsource.startsWith('file://')\n\t\t? new URL(source).pathname\n\t\t: source.startsWith('.')\n\t\t\t? new URL(source, registryPath).pathname\n\t\t\t: source;\n\nconst loadServerBuildComponent = async (buildReferencePath: string) => {\n\tconst cachedBuildComponent =\n\t\tresolvedServerBuildComponentCache.get(buildReferencePath);\n\tif (cachedBuildComponent) {\n\t\treturn cachedBuildComponent;\n\t}\n\n\tconst loadPromise = (async () => {\n\t\tconst compiledModulePath =\n\t\t\tawait compileSvelteServerModule(buildReferencePath);\n\t\tconst loadedModule = await import(compiledModulePath);\n\n\t\treturn 'default' in loadedModule ? loadedModule.default : loadedModule;\n\t})();\n\tresolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);\n\n\treturn loadPromise;\n};\n\nconst loadServerImportComponent = async (resolvedComponent: string) => {\n\tconst resolvedModulePath = resolvedComponent.startsWith('.')\n\t\t? new URL(resolvedComponent, import.meta.url).pathname\n\t\t: resolvedComponent;\n\tconst importTarget = resolvedModulePath.endsWith('.svelte')\n\t\t? await compileSvelteServerModule(resolvedModulePath)\n\t\t: resolvedModulePath;\n\tconst loadedModule = await import(importTarget);\n\n\treturn 'default' in loadedModule ? loadedModule.default : loadedModule;\n};\n\nconst resolveServerIslandComponent = async (\n\tcomponent: unknown\n) => {\n\tconst cachedResolvedComponent = resolvedServerComponentCache.get(component);\n\tif (cachedResolvedComponent) {\n\t\treturn cachedResolvedComponent;\n\t}\n\n\tconst resolutionPromise = (async () => {\n\t\tconst buildReference = getIslandBuildReference(component);\n\t\tconst buildReferencePath = buildReference?.source\n\t\t\t? resolveBuildReferencePath(buildReference.source, import.meta.url)\n\t\t\t: null;\n\t\tif (buildReferencePath?.endsWith('.svelte')) {\n\t\t\treturn loadServerBuildComponent(buildReferencePath);\n\t\t}\n\n\t\tconst resolvedComponent = getIslandComponent(component);\n\t\tif (typeof resolvedComponent !== 'string') {\n\t\t\treturn resolvedComponent;\n\t\t}\n\n\t\treturn loadServerImportComponent(resolvedComponent);\n\t})();\n\n\tresolvedServerComponentCache.set(component, resolutionPromise);\n\n\treturn resolutionPromise;\n};\n\nconst resolveReactServerIslandComponent = async (\n\tcomponent: unknown\n): Promise<ReactServerIslandComponent> => {\n\tconst resolvedComponent = await resolveServerIslandComponent(component);\n\tif (!isReactServerIslandComponent(resolvedComponent)) {\n\t\tthrow new Error('Resolved React island is not a valid React component.');\n\t}\n\n\treturn resolvedComponent;\n};\n\nconst resolveSvelteServerIslandComponent = async (\n\tcomponent: unknown\n): Promise<SvelteServerIslandComponent> => {\n\tconst resolvedComponent = await resolveServerIslandComponent(component);\n\tif (!isSvelteServerIslandComponent(resolvedComponent)) {\n\t\tthrow new Error(\n\t\t\t'Resolved Svelte island is not a valid Svelte component.'\n\t\t);\n\t}\n\n\treturn resolvedComponent;\n};\n\nconst resolveVueServerIslandComponent = async (\n\tcomponent: unknown\n): Promise<VueServerIslandComponent> => {\n\tconst resolvedComponent = await resolveServerIslandComponent(component);\n\tif (!isVueServerIslandComponent(resolvedComponent)) {\n\t\tthrow new Error('Resolved Vue island is not a valid Vue component.');\n\t}\n\n\treturn resolvedComponent;\n};\n\nconst resolveAngularServerIslandComponent = async (\n\tcomponent: unknown\n): Promise<AngularServerIslandComponent> => {\n\tconst resolvedComponent = await resolveServerIslandComponent(component);\n\tif (!isAngularServerIslandComponent(resolvedComponent)) {\n\t\tthrow new Error(\n\t\t\t'Resolved Angular island is not a valid Angular component.'\n\t\t);\n\t}\n\n\treturn resolvedComponent;\n};\n\nexport const renderIslandResult = async <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T> | T,\n\tprops: RuntimeIslandRenderProps\n) : Promise<IslandRenderResult> => {\n\tconst islandId = nextIslandId();\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\tif (props.framework === 'react') {\n\t\tconst entry = registry.react?.[props.component];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Island component \"${props.component}\" is not registered for framework \"react\".`\n\t\t\t);\n\t\t}\n\t\tconst component =\n\t\t\tawait resolveReactServerIslandComponent(entry);\n\t\tconst html = renderReactIslandToHtml(component, props.props);\n\n\t\treturn { attributes, html };\n\t}\n\n\tif (props.framework === 'svelte') {\n\t\tconst entry = registry.svelte?.[props.component];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Island component \"${props.component}\" is not registered for framework \"svelte\".`\n\t\t\t);\n\t\t}\n\t\tconst component =\n\t\t\tawait resolveSvelteServerIslandComponent(entry);\n\t\tconst html = renderSvelteIslandToHtml(component, props.props);\n\n\t\treturn { attributes, html };\n\t}\n\n\tif (props.framework === 'vue') {\n\t\tconst entry = registry.vue?.[props.component];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Island component \"${props.component}\" is not registered for framework \"vue\".`\n\t\t\t);\n\t\t}\n\t\tconst component =\n\t\t\tawait resolveVueServerIslandComponent(entry);\n\t\tconst html = await renderVueIslandToHtml(component, props.props);\n\n\t\treturn { attributes, html };\n\t}\n\n\tif (props.framework === 'angular') {\n\t\tconst entry = registry.angular?.[props.component];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Island component \"${props.component}\" is not registered for framework \"angular\".`\n\t\t\t);\n\t\t}\n\t\tconst component =\n\t\t\tawait resolveAngularServerIslandComponent(entry);\n\t\tconst html = await renderAngularIslandToHtml(\n\t\t\tcomponent,\n\t\t\tprops.props,\n\t\t\tislandId\n\t\t);\n\n\t\treturn {\n\t\t\tattributes: {\n\t\t\t\t...getIslandMarkerAttributes(props, islandId)\n\t\t\t},\n\t\t\thtml\n\t\t};\n\t}\n\n\tthrow new Error(\n\t\t`Framework \"${props.framework}\" is not implemented in this prototype.`\n\t);\n};\n\nexport const renderIslandMarkup = async <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T> | T,\n\tprops: RuntimeIslandRenderProps\n) => {\n\tconst result = await renderIslandResult(registry, props);\n\n\treturn `<div ${serializeIslandAttributes(result.attributes)}>${result.html}</div>`;\n};\n",
27
27
  "export { handleReactPageRequest } from './pageHandler';\nexport { Island } from './Island';\nexport { createTypedIsland } from './createIsland';\nexport { useIslandState } from './hooks/useIslandState';\n",
28
- "import type { JSX } from 'react';\nimport type { ConfiguredTypedIslandRenderProps } from '../../types/island';\nimport { getIslandMarkerAttributes } from '../core/islandMarkupAttributes';\nimport { requireCurrentIslandRegistry } from '../core/currentIslandRegistry';\nimport { renderIslandResult } from '../core/renderIslandMarkup';\n\nexport const Island = async (\n\tprops: ConfiguredTypedIslandRenderProps\n): Promise<JSX.Element> => {\n\tif (typeof window !== 'undefined') {\n\t\treturn (\n\t\t\t<div {...getIslandMarkerAttributes(props)} suppressHydrationWarning />\n\t\t);\n\t}\n\n\tconst result = await renderIslandResult(\n\t\trequireCurrentIslandRegistry(),\n\t\tprops\n\t);\n\n\treturn (\n\t\t<div\n\t\t\t{...result.attributes}\n\t\t\tdangerouslySetInnerHTML={{ __html: result.html }}\n\t\t/>\n\t);\n};\n",
28
+ "import type { JSX } from 'react';\nimport type { RuntimeIslandRenderProps } from '../../types/island';\nimport { getIslandMarkerAttributes } from '../core/islandMarkupAttributes';\nimport { requireCurrentIslandRegistry } from '../core/currentIslandRegistry';\nimport { renderIslandResult } from '../core/renderIslandMarkup';\n\nexport const Island = async (\n\tprops: RuntimeIslandRenderProps\n): Promise<JSX.Element> => {\n\tif (typeof window !== 'undefined') {\n\t\treturn (\n\t\t\t<div {...getIslandMarkerAttributes(props)} suppressHydrationWarning />\n\t\t);\n\t}\n\n\tconst result = await renderIslandResult(\n\t\trequireCurrentIslandRegistry(),\n\t\tprops\n\t);\n\n\treturn (\n\t\t<div\n\t\t\t{...result.attributes}\n\t\t\tdangerouslySetInnerHTML={{ __html: result.html }}\n\t\t/>\n\t);\n};\n",
29
29
  "import type { JSX } from 'react';\nimport type {\n\tIslandRegistry,\n\tIslandRegistryInput,\n\tTypedIslandRenderProps\n} from '../../types/island';\nimport { getIslandMarkerAttributes } from '../core/islandMarkupAttributes';\nimport { renderIslandResult } from '../core/renderIslandMarkup';\n\nexport const createTypedIsland = <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T>\n) => {\n\tconst Island = async (\n\t\tprops: TypedIslandRenderProps<T>\n\t): Promise<JSX.Element> => {\n\t\tif (typeof window !== 'undefined') {\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\t{...getIslandMarkerAttributes(props)}\n\t\t\t\t\tsuppressHydrationWarning\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\t\tconst result = await renderIslandResult(registry, props);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...result.attributes}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: result.html }}\n\t\t\t/>\n\t\t);\n\t};\n\n\treturn Island;\n};\n",
30
30
  "import {\n\tuseSyncExternalStore,\n\ttype Dispatch,\n\ttype SetStateAction\n} from 'react';\nimport {\n\treadIslandState,\n\tsubscribeIslandState,\n\tupdateIslandState\n} from '../../client/islandState';\n\nexport const useIslandState = <T>(\n\tkey: string,\n\tfallback: T\n): [T, Dispatch<SetStateAction<T>>] => {\n\tconst value = useSyncExternalStore(\n\t\t(listener) => subscribeIslandState(key, listener),\n\t\t() => readIslandState(key, fallback),\n\t\t() => fallback\n\t);\n\n\tconst setValue: Dispatch<SetStateAction<T>> = (nextValue) => {\n\t\tupdateIslandState(key, fallback, nextValue);\n\t};\n\n\treturn [value, setValue];\n};\n",
31
31
  "type IslandStateKey = string;\n\ntype IslandStateValue = unknown;\n\ntype IslandStateListener = () => void;\n\ntype IslandStateUpdater<T> = T | ((value: T) => T);\n\ntype IslandStateSnapshot = Record<IslandStateKey, IslandStateValue>;\n\nconst isIslandStateUpdater = <T>(\n\tvalue: IslandStateUpdater<T>\n): value is (value: T) => T => typeof value === 'function';\n\ndeclare global {\n\tvar __ABS_ISLAND_STATE_STORE__: IslandStateStore | undefined;\n\tvar __ABS_ISLAND_STATE__: IslandStateSnapshot | undefined;\n}\n\nclass IslandStateStore {\n\tprivate listeners = new Map<IslandStateKey, Set<IslandStateListener>>();\n\n\tprivate state: Record<IslandStateKey, any> = {};\n\n\tget<T>(key: IslandStateKey, fallback: T): T {\n\t\tif (key in this.state) {\n\t\t\treturn this.state[key];\n\t\t}\n\n\t\treturn fallback;\n\t}\n\n\tinitialize(nextState: IslandStateSnapshot) {\n\t\tfor (const [key, value] of Object.entries(nextState)) {\n\t\t\tif (key in this.state) continue;\n\t\t\tthis.state[key] = value;\n\t\t}\n\t}\n\n\tset<T>(key: IslandStateKey, value: T) {\n\t\tthis.state[key] = value;\n\t\tglobalThis.__ABS_ISLAND_STATE__ = {\n\t\t\t...(globalThis.__ABS_ISLAND_STATE__ ?? {}),\n\t\t\t[key]: value\n\t\t};\n\t\tthis.emit(key);\n\t\treturn value;\n\t}\n\n\tsubscribe(key: IslandStateKey, listener: IslandStateListener) {\n\t\tconst listeners = this.listeners.get(key) ?? new Set<IslandStateListener>();\n\t\tlisteners.add(listener);\n\t\tthis.listeners.set(key, listeners);\n\n\t\treturn () => {\n\t\t\tconst current = this.listeners.get(key);\n\t\t\tif (!current) return;\n\n\t\t\tcurrent.delete(listener);\n\t\t\tif (current.size === 0) {\n\t\t\t\tthis.listeners.delete(key);\n\t\t\t}\n\t\t};\n\t}\n\n\tupdate<T>(key: IslandStateKey, fallback: T, updater: IslandStateUpdater<T>) {\n\t\tconst previous = this.get(key, fallback);\n\t\tconst nextValue =\n\t\t\tisIslandStateUpdater(updater)\n\t\t\t\t? updater(previous)\n\t\t\t\t: updater;\n\n\t\treturn this.set(key, nextValue);\n\t}\n\n\tprivate emit(key: IslandStateKey) {\n\t\tconst listeners = this.listeners.get(key);\n\t\tif (!listeners) return;\n\n\t\tfor (const listener of listeners) {\n\t\t\tlistener();\n\t\t}\n\t}\n}\n\nconst getGlobalIslandStateStore = () => {\n\tglobalThis.__ABS_ISLAND_STATE_STORE__ ??= new IslandStateStore();\n\n\tif (globalThis.__ABS_ISLAND_STATE__) {\n\t\tglobalThis.__ABS_ISLAND_STATE_STORE__.initialize(\n\t\t\tglobalThis.__ABS_ISLAND_STATE__\n\t\t);\n\t}\n\n\treturn globalThis.__ABS_ISLAND_STATE_STORE__;\n};\n\nexport const initializeIslandState = (state: IslandStateSnapshot) => {\n\tglobalThis.__ABS_ISLAND_STATE__ = {\n\t\t...(globalThis.__ABS_ISLAND_STATE__ ?? {}),\n\t\t...state\n\t};\n\n\tgetGlobalIslandStateStore().initialize(state);\n};\n\nexport const readIslandState = <T>(key: IslandStateKey, fallback: T) =>\n\tgetGlobalIslandStateStore().get(key, fallback);\n\nexport const setIslandState = <T>(key: IslandStateKey, value: T) =>\n\tgetGlobalIslandStateStore().set(key, value);\n\nexport const subscribeIslandState = (\n\tkey: IslandStateKey,\n\tlistener: IslandStateListener\n) => getGlobalIslandStateStore().subscribe(key, listener);\n\nexport const updateIslandState = <T>(\n\tkey: IslandStateKey,\n\tfallback: T,\n\tupdater: IslandStateUpdater<T>\n) => getGlobalIslandStateStore().update(key, fallback, updater);\n"
@@ -1,11 +1,11 @@
1
1
  import '@angular/compiler';
2
2
  import { type OnChanges } from '@angular/core';
3
- import type { ConfiguredTypedIslandRenderProps } from '../../types/island';
3
+ import type { RuntimeIslandRenderProps } from '../../types/island';
4
4
  export declare class IslandComponent implements OnChanges {
5
5
  component: string;
6
- framework: ConfiguredTypedIslandRenderProps['framework'];
7
- hydrate: ConfiguredTypedIslandRenderProps['hydrate'];
8
- props: ConfiguredTypedIslandRenderProps['props'];
6
+ framework: RuntimeIslandRenderProps['framework'];
7
+ hydrate: RuntimeIslandRenderProps['hydrate'];
8
+ props: RuntimeIslandRenderProps['props'];
9
9
  markup: string;
10
10
  ngOnChanges(): void;
11
11
  }
@@ -1,10 +1,10 @@
1
1
  import '@angular/compiler';
2
- import type { ConfiguredTypedIslandRenderProps } from '../../types/island';
2
+ import type { RuntimeIslandRenderProps } from '../../types/island';
3
3
  export declare class IslandComponent {
4
4
  component: string;
5
- framework: ConfiguredTypedIslandRenderProps['framework'];
6
- hydrate: ConfiguredTypedIslandRenderProps['hydrate'];
7
- props: ConfiguredTypedIslandRenderProps['props'];
5
+ framework: RuntimeIslandRenderProps['framework'];
6
+ hydrate: RuntimeIslandRenderProps['hydrate'];
7
+ props: RuntimeIslandRenderProps['props'];
8
8
  get serializedProps(): string;
9
9
  }
10
10
  export declare const Island: typeof IslandComponent;
@@ -1 +1,4 @@
1
+ import type { IslandRegistryInput } from '../../types/island';
2
+ export declare const transformStaticPageHtml: (originalHtml: string, registry: IslandRegistryInput) => Promise<string>;
1
3
  export declare const transformStaticPagesWithIslands: (registryPath: string | undefined, pagePaths: string[]) => Promise<void>;
4
+ export declare const transformCurrentStaticPageHtml: (html: string) => Promise<string>;
@@ -1,3 +1,3 @@
1
1
  import type { JSX } from 'react';
2
- import type { ConfiguredTypedIslandRenderProps } from '../../types/island';
3
- export declare const Island: (props: ConfiguredTypedIslandRenderProps) => Promise<JSX.Element>;
2
+ import type { RuntimeIslandRenderProps } from '../../types/island';
3
+ export declare const Island: (props: RuntimeIslandRenderProps) => Promise<JSX.Element>;
@@ -10,14 +10,14 @@
10
10
  </script>
11
11
 
12
12
  <script lang="ts">
13
- import type { ConfiguredTypedIslandRenderProps } from '../../../types/island';
13
+ import type { RuntimeIslandRenderProps } from '../../../types/island';
14
14
 
15
15
  let {
16
16
  component,
17
17
  framework,
18
18
  hydrate = 'load',
19
19
  props
20
- }: ConfiguredTypedIslandRenderProps = $props();
20
+ }: RuntimeIslandRenderProps = $props();
21
21
 
22
22
  const slotId = createSlotId();
23
23
 
@@ -28,7 +28,7 @@
28
28
  .replaceAll('<', '&lt;')
29
29
  .replaceAll('>', '&gt;');
30
30
 
31
- const buildFallbackMarkup = (runtimeProps: ConfiguredTypedIslandRenderProps) => {
31
+ const buildFallbackMarkup = (runtimeProps: RuntimeIslandRenderProps) => {
32
32
  const attributes = [
33
33
  ['data-component', runtimeProps.component],
34
34
  ['data-framework', runtimeProps.framework],
@@ -1,5 +1,5 @@
1
- import type { ConfiguredTypedIslandRenderProps } from '../../types/metadata';
1
+ import type { RuntimeIslandRenderProps } from '../../types/metadata';
2
2
  import { SvelteComponent } from 'svelte';
3
- declare const __propDef: { props: ConfiguredTypedIslandRenderProps };
3
+ declare const __propDef: { props: RuntimeIslandRenderProps };
4
4
  type Props = typeof __propDef.props;
5
5
  export default class Island extends SvelteComponent<Props> {}
@@ -30767,7 +30767,7 @@ var getIslandState = (key, fallback) => ({
30767
30767
  }
30768
30768
  });
30769
30769
  // src/svelte/components/Island.svelte
30770
- var Island_default = "../Island-p1b3nrte.svelte";
30770
+ var Island_default = "../Island-c38gqq3d.svelte";
30771
30771
  // src/svelte/renderIsland.ts
30772
30772
  init_renderIslandMarkup();
30773
30773
  var renderIsland = (props) => renderIslandMarkup(requireCurrentIslandRegistry(), props);
@@ -91,6 +91,26 @@ declare global {
91
91
  __REFRESH_BUFFER__?: Array<[unknown, string]>;
92
92
  htmx?: { process: (element: HTMLElement | Document) => void };
93
93
  }
94
+
95
+ /**
96
+ * Platform-native island element for HTML and HTMX host pages.
97
+ *
98
+ * Attributes:
99
+ * - `framework`: one of `react`, `svelte`, `vue`, or `angular`
100
+ * - `component`: the registry component name to render
101
+ * - `hydrate`: one of `load`, `idle`, `visible`, or `none`
102
+ * - `props`: JSON-serialized props payload
103
+ */
104
+ interface AbsoluteIslandElement extends HTMLElement {
105
+ component: string;
106
+ framework: 'react' | 'svelte' | 'vue' | 'angular';
107
+ hydrate?: 'load' | 'idle' | 'visible' | 'none';
108
+ props: string;
109
+ }
110
+
111
+ interface HTMLElementTagNameMap {
112
+ 'absolute-island': AbsoluteIslandElement;
113
+ }
94
114
  }
95
115
 
96
116
  export {};
@@ -66,11 +66,4 @@ export type TypedIslandRenderProps<T extends IslandRegistryInput> = {
66
66
  };
67
67
  }[IslandRegistryComponent<T, Framework>];
68
68
  }[IslandRegistryFramework<T>];
69
- declare global {
70
- interface AbsoluteIslandRegistry {
71
- }
72
- }
73
- type HasConfiguredIslandRegistry = [keyof AbsoluteIslandRegistry] extends [never] ? false : true;
74
- export type ConfiguredIslandRegistry = HasConfiguredIslandRegistry extends true ? AbsoluteIslandRegistry & IslandRegistryInput : IslandRegistryInput;
75
- export type ConfiguredTypedIslandRenderProps = HasConfiguredIslandRegistry extends true ? TypedIslandRenderProps<AbsoluteIslandRegistry & IslandRegistryInput> : RuntimeIslandRenderProps;
76
69
  export {};