@absolutejs/absolute 0.19.0-beta.931 → 0.19.0-beta.933
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +285 -136
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +267 -118
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +807 -584
- package/dist/build.js.map +17 -16
- package/dist/dev/client/handlers/angularHmrShim.ts +4 -1
- package/dist/dev/client/handlers/angularRemount.ts +2 -2
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -4
- package/dist/dev/client/vendor/lview/lViewOps.ts +8 -6
- package/dist/index.js +925 -651
- package/dist/index.js.map +21 -19
- package/dist/islands/index.js +105 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +167 -18
- package/dist/react/index.js.map +6 -5
- package/dist/react/server.js +63 -17
- package/dist/react/server.js.map +3 -3
- package/dist/src/core/normalizeIslandProps.d.ts +15 -0
- package/dist/src/core/vueServerModule.d.ts +1 -0
- package/dist/src/utils/defineConvention.d.ts +3 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/vue/Island.browser.d.ts +36 -12
- package/dist/src/vue/Island.d.ts +35 -11
- package/dist/src/vue/pageHandler.d.ts +8 -0
- package/dist/svelte/index.js +167 -18
- package/dist/svelte/index.js.map +6 -5
- package/dist/svelte/server.js +63 -17
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/conventions.d.ts +5 -0
- package/dist/vue/browser.js +57 -4
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +234 -24
- package/dist/vue/index.js.map +9 -7
- package/dist/vue/server.js +73 -20
- package/dist/vue/server.js.map +4 -4
- package/package.json +1 -1
package/dist/vue/browser.js.map
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/core/islandManifest.ts", "../src/core/islands.ts", "../src/core/islandMarkupAttributes.ts", "../src/vue/Island.browser.ts", "../src/client/preserveIslandMarkup.ts", "../src/vue/createIsland.browser.ts", "../src/vue/useIslandStore.ts", "../node_modules/zustand/esm/vanilla.mjs", "../node_modules/zustand/esm/middleware.mjs", "../src/client/islandStore.ts", "../src/vue/defineVuePage.ts"],
|
|
3
|
+
"sources": ["../src/core/islandManifest.ts", "../src/core/islands.ts", "../src/core/islandMarkupAttributes.ts", "../src/vue/Island.browser.ts", "../src/client/preserveIslandMarkup.ts", "../src/core/normalizeIslandProps.ts", "../src/vue/createIsland.browser.ts", "../src/vue/useIslandStore.ts", "../node_modules/zustand/esm/vanilla.mjs", "../node_modules/zustand/esm/middleware.mjs", "../src/client/islandStore.ts", "../src/vue/defineVuePage.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import type { IslandFramework } from '../../types/island';\n\nconst toIslandFrameworkSegment = (framework: IslandFramework) =>\n\tframework[0]?.toUpperCase() + framework.slice(1);\n\nconst collectFrameworkIslands = (\n\tmanifest: Record<string, string>,\n\tprefix: string\n) => {\n\tconst entries: Record<string, string> = {};\n\tlet found = false;\n\n\tfor (const [key, value] of Object.entries(manifest)) {\n\t\tif (!key.startsWith(prefix)) continue;\n\n\t\tconst component = key.slice(prefix.length);\n\t\tif (!component) continue;\n\n\t\tentries[component] = value;\n\t\tfound = true;\n\t}\n\n\treturn found ? entries : undefined;\n};\n\nexport const getIslandManifestEntries = (manifest: Record<string, string>) => {\n\tconst islands: Partial<Record<IslandFramework, Record<string, string>>> =\n\t\t{};\n\tconst frameworks: IslandFramework[] = ['react', 'svelte', 'vue', 'angular'];\n\n\tfor (const framework of frameworks) {\n\t\tconst prefix = `Island${toIslandFrameworkSegment(framework)}`;\n\t\tconst entries = collectFrameworkIslands(manifest, prefix);\n\t\tif (entries) islands[framework] = entries;\n\t}\n\n\treturn islands;\n};\nexport const getIslandManifestKey = (\n\tframework: IslandFramework,\n\tcomponent: string\n) => `Island${toIslandFrameworkSegment(framework)}${component}`;\n",
|
|
6
6
|
"import type {\n\tIslandComponentDefinition,\n\tIslandRegistry,\n\tIslandRegistryInput\n} from '../../types/island';\n\nexport const defineIslandComponent = <Component>(\n\tcomponent: Component,\n\toptions: {\n\t\texport?: string;\n\t\tsource: string;\n\t}\n): IslandComponentDefinition<Component> => ({\n\tcomponent,\n\texport: options.export,\n\tsource: options.source\n});\nexport const defineIslandRegistry = <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T>\n) => registry;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nexport const getIslandBuildReference = <Component>(\n\tcomponent: Component | IslandComponentDefinition<Component>\n) => {\n\tif (!isIslandComponentDefinition(component)) return null;\n\n\treturn {\n\t\texport: component.export,\n\t\tsource: component.source\n\t};\n};\nexport const isIslandComponentDefinition = <Component>(\n\tvalue: Component | IslandComponentDefinition<Component>\n): value is IslandComponentDefinition<Component> =>\n\tisRecord(value) &&\n\t'component' in value &&\n\t'source' in value &&\n\ttypeof value.source === 'string';\n\nexport function getIslandComponent<Component>(component: Component): Component;\nexport function getIslandComponent<Component>(\n\tcomponent: IslandComponentDefinition<Component>\n): Component;\nexport function getIslandComponent<Component>(\n\tcomponent: Component | IslandComponentDefinition<Component>\n) {\n\tif (isIslandComponentDefinition(component)) {\n\t\treturn component.component;\n\t}\n\n\treturn component;\n}\nexport const parseIslandProps = (rawProps: string | null) => {\n\tif (!rawProps) return {};\n\n\treturn JSON.parse(rawProps);\n};\nexport const serializeIslandProps = (props: unknown) =>\n\tJSON.stringify(props ?? {});\n\nexport {\n\tgetIslandManifestEntries,\n\tgetIslandManifestKey\n} from './islandManifest';\n",
|
|
7
7
|
"import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { serializeIslandProps } from './islands';\n\ntype IslandMarkerAttributes = {\n\t'data-component': string;\n\t'data-framework': string;\n\t'data-hydrate': string;\n\t'data-island': 'true';\n\t'data-island-id'?: string;\n\t'data-props': string;\n};\n\nexport const getIslandMarkerAttributes = (\n\tprops: RuntimeIslandRenderProps,\n\tislandId?: string\n): IslandMarkerAttributes => ({\n\t'data-component': props.component,\n\t'data-framework': props.framework,\n\t'data-hydrate': props.hydrate ?? 'load',\n\t'data-island': 'true',\n\t...(islandId ? { 'data-island-id': islandId } : {}),\n\t'data-props': serializeIslandProps(props.props)\n});\n\nconst escapeHtmlAttribute = (value: string) =>\n\tvalue\n\t\t.replaceAll('&', '&')\n\t\t.replaceAll('\"', '"')\n\t\t.replaceAll('<', '<')\n\t\t.replaceAll('>', '>');\n\nexport const serializeIslandAttributes = (attributes: Record<string, string>) =>\n\tObject.entries(attributes)\n\t\t.map(([key, value]) => `${key}=\"${escapeHtmlAttribute(value)}\"`)\n\t\t.join(' ');\n",
|
|
8
|
-
"import { defineComponent, h } from 'vue';\nimport
|
|
8
|
+
"import { defineComponent, h } from 'vue';\nimport { preserveIslandMarkup } from '../client/preserveIslandMarkup';\nimport { normalizeRuntimeIslandRenderProps } from '../core/normalizeIslandProps';\n\nexport const Island = defineComponent({\n\tname: 'AbsoluteIsland',\n\tprops: {\n\t\tcomponent: {\n\t\t\trequired: true,\n\t\t\ttype: String\n\t\t},\n\t\tframework: {\n\t\t\trequired: true,\n\t\t\ttype: String\n\t\t},\n\t\thydrate: {\n\t\t\trequired: false,\n\t\t\ttype: String\n\t\t},\n\t\t/* Accept either an object or a JSON-serialized string — see\n\t\t the SSR `Island.ts` for the rationale. */\n\t\tprops: {\n\t\t\trequired: false,\n\t\t\ttype: [Object, String]\n\t\t}\n\t},\n\tsetup(rawProps) {\n\t\tconst props = normalizeRuntimeIslandRenderProps(rawProps);\n\n\t\treturn () => {\n\t\t\tconst { attributes, innerHTML } = preserveIslandMarkup(props);\n\n\t\t\treturn h('div', {\n\t\t\t\t...attributes,\n\t\t\t\t'data-allow-mismatch': '',\n\t\t\t\tinnerHTML\n\t\t\t});\n\t\t};\n\t}\n});\n",
|
|
9
9
|
"import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { getIslandMarkerAttributes } from '../core/islandMarkupAttributes';\n\ntype PreservedIslandMarkup = {\n\tattributes: Record<string, string>;\n\tinnerHTML: string;\n};\n\ntype IslandMarkerElement = HTMLElement & {\n\tdataset: DOMStringMap & {\n\t\tcomponent?: string;\n\t\tframework?: string;\n\t\thydrate?: string;\n\t\tisland?: string;\n\t\tislandId?: string;\n\t\tprops?: string;\n\t};\n};\n\nconst getClaimMap = () => {\n\tif (typeof window === 'undefined') {\n\t\treturn null;\n\t}\n\n\twindow.__ABS_CLAIMED_ISLAND_MARKUP__ ??= new Map<string, number>();\n\n\treturn window.__ABS_CLAIMED_ISLAND_MARKUP__;\n};\n\nconst getSnapshotMap = () => {\n\tif (typeof window === 'undefined') {\n\t\treturn null;\n\t}\n\n\twindow.__ABS_SERVER_ISLAND_HTML__ ??= new Map<\n\t\tstring,\n\t\tPreservedIslandMarkup[]\n\t>();\n\n\treturn window.__ABS_SERVER_ISLAND_HTML__;\n};\n\nconst getIslandSignature = (props: RuntimeIslandRenderProps) => {\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn [\n\t\tattributes['data-component'],\n\t\tattributes['data-framework'],\n\t\tattributes['data-hydrate'],\n\t\tattributes['data-props']\n\t].join('::');\n};\n\nconst isMatchingIslandElement = (\n\telement: Element,\n\tprops: RuntimeIslandRenderProps\n): element is IslandMarkerElement => {\n\tif (!(element instanceof HTMLElement)) {\n\t\treturn false;\n\t}\n\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn (\n\t\telement.dataset.island === 'true' &&\n\t\telement.dataset.component === attributes['data-component'] &&\n\t\telement.dataset.framework === attributes['data-framework'] &&\n\t\t(element.dataset.hydrate ?? 'load') === attributes['data-hydrate'] &&\n\t\t(element.dataset.props ?? '{}') === attributes['data-props']\n\t);\n};\n\nconst snapshotIslandElement = (\n\telement: HTMLElement,\n\tsnapshotMap: Map<string, PreservedIslandMarkup[]>\n) => {\n\tconst signature = [\n\t\telement.dataset.component,\n\t\telement.dataset.framework,\n\t\telement.dataset.hydrate ?? 'load',\n\t\telement.dataset.props ?? '{}'\n\t].join('::');\n\tconst existing = snapshotMap.get(signature) ?? [];\n\tconst attributes = Object.fromEntries(\n\t\telement\n\t\t\t.getAttributeNames()\n\t\t\t.map((name) => [name, element.getAttribute(name) ?? ''])\n\t);\n\texisting.push({\n\t\tattributes,\n\t\tinnerHTML: element.innerHTML\n\t});\n\tsnapshotMap.set(signature, existing);\n};\n\nexport const initializeIslandMarkupSnapshot = () => {\n\tif (typeof document === 'undefined') {\n\t\treturn;\n\t}\n\n\tconst snapshotMap = getSnapshotMap();\n\tif (!snapshotMap || snapshotMap.size > 0) {\n\t\treturn;\n\t}\n\n\tconst elements = Array.from(\n\t\tdocument.querySelectorAll<HTMLElement>('[data-island=\"true\"]')\n\t);\n\tfor (const element of elements) {\n\t\tsnapshotIslandElement(element, snapshotMap);\n\t}\n};\n\nexport const preserveIslandMarkup = (props: RuntimeIslandRenderProps) => {\n\tif (typeof document === 'undefined') {\n\t\treturn {\n\t\t\tattributes: getIslandMarkerAttributes(props),\n\t\t\tinnerHTML: ''\n\t\t};\n\t}\n\n\tconst claimMap = getClaimMap();\n\tconst snapshotMap = getSnapshotMap();\n\tconst signature = getIslandSignature(props);\n\tconst claimedCount = claimMap?.get(signature) ?? 0;\n\tconst snapshotCandidate = snapshotMap?.get(signature)?.[claimedCount];\n\tconst candidates = Array.from(\n\t\tdocument.querySelectorAll('[data-island=\"true\"]')\n\t).filter((element) => isMatchingIslandElement(element, props));\n\tconst candidate = candidates[claimedCount];\n\tif (claimMap) {\n\t\tclaimMap.set(signature, claimedCount + 1);\n\t}\n\n\treturn {\n\t\tattributes:\n\t\t\tsnapshotCandidate?.attributes ?? getIslandMarkerAttributes(props),\n\t\tinnerHTML: snapshotCandidate?.innerHTML ?? candidate?.innerHTML ?? ''\n\t};\n};\n",
|
|
10
|
+
"import type { IslandFramework, IslandHydrate } from '../../types/island';\n\n/* `<Island>` (Vue/Svelte/React/Angular component form) historically took\n `props` as an object, while `<absolute-island>` (custom-element form\n used in HTML/HTMX hosts) takes `props` as a JSON-serialized string.\n The two surfaces have the same mental model — \"render an island\" —\n but a value that's valid in one shape would silently break in the\n other. This helper normalizes whichever shape arrives at runtime. */\nconst EMPTY_PROPS: Record<string, unknown> = {};\n\nconst ISLAND_FRAMEWORKS: readonly IslandFramework[] = [\n\t'react',\n\t'svelte',\n\t'vue',\n\t'angular',\n\t'ember'\n];\n\nconst ISLAND_HYDRATE_MODES: readonly IslandHydrate[] = [\n\t'load',\n\t'idle',\n\t'visible',\n\t'none'\n];\n\nconst isIslandFramework = (value: string): value is IslandFramework =>\n\tISLAND_FRAMEWORKS.some((framework) => framework === value);\n\nconst isIslandHydrate = (value: string): value is IslandHydrate =>\n\tISLAND_HYDRATE_MODES.some((mode) => mode === value);\n\ntype RawIslandProps = {\n\tcomponent: string;\n\tframework: string;\n\thydrate?: string | undefined;\n\tprops: unknown;\n};\n\nexport const normalizeRuntimeIslandRenderProps = (raw: RawIslandProps) => {\n\tconst { component, framework, hydrate, props } = raw;\n\tif (!isIslandFramework(framework)) {\n\t\tthrow new Error(`Unknown island framework: \"${framework}\".`);\n\t}\n\n\tif (hydrate !== undefined && !isIslandHydrate(hydrate)) {\n\t\tthrow new Error(`Unknown island hydrate mode: \"${hydrate}\".`);\n\t}\n\n\treturn {\n\t\tcomponent,\n\t\tframework,\n\t\thydrate,\n\t\tprops: normalizeIslandProps(props)\n\t};\n};\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null && !Array.isArray(value);\n\nconst safeJsonParseObject = (raw: string) => {\n\tconst trimmed = raw.trim();\n\tif (!trimmed) return EMPTY_PROPS;\n\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(trimmed);\n\n\t\treturn isPlainObject(parsed) ? parsed : EMPTY_PROPS;\n\t} catch {\n\t\treturn EMPTY_PROPS;\n\t}\n};\n\nexport const normalizeIslandProps = (value: unknown) => {\n\tif (typeof value === 'string') return safeJsonParseObject(value);\n\tif (isPlainObject(value)) return value;\n\n\treturn EMPTY_PROPS;\n};\n",
|
|
10
11
|
"import { defineComponent, h } from 'vue';\nimport type {\n\tIslandRegistry,\n\tIslandRegistryInput,\n\tRuntimeIslandRenderProps\n} from '../../types/island';\nimport { preserveIslandMarkup } from '../client/preserveIslandMarkup';\n\nconst defineRuntimeIslandComponent = (\n\tsetup: (props: RuntimeIslandRenderProps) => () => ReturnType<typeof h>\n) =>\n\tdefineComponent({\n\t\tname: 'AbsoluteIsland',\n\t\tprops: {\n\t\t\tcomponent: {\n\t\t\t\trequired: true,\n\t\t\t\ttype: String\n\t\t\t},\n\t\t\tframework: {\n\t\t\t\trequired: true,\n\t\t\t\ttype: String\n\t\t\t},\n\t\t\thydrate: {\n\t\t\t\trequired: false,\n\t\t\t\ttype: String\n\t\t\t},\n\t\t\tprops: {\n\t\t\t\trequired: true,\n\t\t\t\ttype: Object\n\t\t\t}\n\t\t},\n\t\tsetup\n\t});\n\nexport const createTypedIsland = <T extends IslandRegistryInput>(\n\t_registry: IslandRegistry<T>\n) =>\n\tdefineRuntimeIslandComponent((props) => {\n\t\tconst { attributes, innerHTML } = preserveIslandMarkup(props);\n\n\t\treturn () =>\n\t\t\th('div', {\n\t\t\t\t...attributes,\n\t\t\t\t'data-allow-mismatch': '',\n\t\t\t\tinnerHTML\n\t\t\t});\n\t});\n",
|
|
11
12
|
"import { customRef, onBeforeUnmount } from 'vue';\nimport type { StoreApi } from 'zustand/vanilla';\nimport {\n\treadIslandStore,\n\tsubscribeIslandStore,\n\ttype IslandStoreState\n} from '../client/islandStore';\n\nexport const useIslandStore = <TState extends IslandStoreState, TSelected>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => {\n\tlet current = readIslandStore(store, selector);\n\tlet unsubscribe: (() => void) | undefined;\n\n\tconst state = customRef<TSelected>((track, trigger) => {\n\t\tunsubscribe = subscribeIslandStore(store, selector, (value) => {\n\t\t\tcurrent = value;\n\t\t\ttrigger();\n\t\t});\n\n\t\treturn {\n\t\t\tget() {\n\t\t\t\ttrack();\n\n\t\t\t\treturn current;\n\t\t\t},\n\t\t\tset() {}\n\t\t};\n\t});\n\n\tonBeforeUnmount(() => {\n\t\tunsubscribe?.();\n\t});\n\n\treturn state;\n};\n",
|
|
12
13
|
"const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n",
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
"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",
|
|
15
16
|
"import type { VueRoutes, VueSetupApp } from '../../types/vue';\n\n/** Identity helper that types a Vue page's `setupApp` export without\n * forcing the user to `import type { VueSetupApp }` every time. Use as\n * `export const setupApp = defineVueSetupApp(async (app, ctx) => { ... });` */\nexport const defineVueSetupApp = (hook: VueSetupApp) => hook;\n\n/** Identity helper that signals — to humans and to TypeScript — that a\n * Vue page's `routes` export is the input to AbsoluteJS's auto-generated\n * vue-router. Without this, `export const routes = [...]` reads as an\n * ordinary const that nobody references locally; the import + call make\n * the contract explicit (mirroring Vue's `defineProps` convention).\n *\n * At runtime this is identity (`(routes) => routes`); the actual\n * router-creation code lives in the compile-time transform applied to\n * the page's `<script>` block. Use as\n * `export const routes = defineRoutes([{ path: '/foo', component: Foo }]);` */\nexport const defineRoutes = <T extends VueRoutes>(routes: T) => routes;\n"
|
|
16
17
|
],
|
|
17
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEM,2BAA2B,CAAC,cACjC,UAAU,IAAI,YAAY,IAAI,UAAU,MAAM,CAAC,GAE1C,0BAA0B,CAC/B,UACA,WACI;AAAA,EACJ,MAAM,UAAkC,CAAC;AAAA,EACzC,IAAI,QAAQ;AAAA,EAEZ,YAAY,KAAK,UAAU,OAAO,QAAQ,QAAQ,GAAG;AAAA,I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B,CAC7B,OACA,aACI;AAAA,EACJ,IAAI,UAAU,gBAAgB,OAAO,QAAQ;AAAA,EAC7C,IAAI;AAAA,EAEJ,MAAM,QAAQ,UAAqB,CAAC,OAAO,YAAY;AAAA,IACtD,cAAc,qBAAqB,OAAO,UAAU,CAAC,UAAU;AAAA,MAC9D,UAAU;AAAA,MACV,QAAQ;AAAA,KACR;AAAA,IAED,OAAO;AAAA,MACN,GAAG,GAAG;AAAA,QACL,MAAM;AAAA,QAEN,OAAO;AAAA;AAAA,MAER,GAAG,GAAG;AAAA,IACP;AAAA,GACA;AAAA,EAED,gBAAgB,MAAM;AAAA,IACrB,cAAc;AAAA,GACd;AAAA,EAED,OAAO;AAAA;;AI9BD,IAAM,oBAAoB,CAAC,SAAsB;AAYjD,IAAM,eAAe,CAAsB,WAAc;",
|
|
19
|
+
"debugId": "2173C9230989530064756E2164756E21",
|
|
19
20
|
"names": []
|
|
20
21
|
}
|
package/dist/vue/index.js
CHANGED
|
@@ -2698,6 +2698,100 @@ var init_svelteServerModule = __esm(() => {
|
|
|
2698
2698
|
});
|
|
2699
2699
|
});
|
|
2700
2700
|
|
|
2701
|
+
// src/core/vueServerModule.ts
|
|
2702
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
2703
|
+
import { dirname as dirname4, join as join5, relative as relative3, resolve as resolve5 } from "path";
|
|
2704
|
+
var {Transpiler } = globalThis.Bun;
|
|
2705
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
2706
|
+
const importPath = relative3(dirname4(from), target).replace(/\\/g, "/");
|
|
2707
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2708
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
2709
|
+
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2710
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2711
|
+
return join5(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
2712
|
+
}, writeIfChanged2 = async (path, content) => {
|
|
2713
|
+
const targetFile = Bun.file(path);
|
|
2714
|
+
if (await targetFile.exists()) {
|
|
2715
|
+
const currentContent = await targetFile.text();
|
|
2716
|
+
if (currentContent === content)
|
|
2717
|
+
return;
|
|
2718
|
+
}
|
|
2719
|
+
await Bun.write(path, content);
|
|
2720
|
+
}, stripExports = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports = (code) => {
|
|
2721
|
+
const lines = code.split(`
|
|
2722
|
+
`);
|
|
2723
|
+
const specifierSet = new Set;
|
|
2724
|
+
const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
|
|
2725
|
+
lines.forEach((line) => {
|
|
2726
|
+
const match = line.match(vueImportRegex);
|
|
2727
|
+
if (match?.[1])
|
|
2728
|
+
match[1].split(",").forEach((importSpecifier) => specifierSet.add(importSpecifier.trim()));
|
|
2729
|
+
});
|
|
2730
|
+
const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
|
|
2731
|
+
return specifierSet.size ? [
|
|
2732
|
+
`import { ${[...specifierSet].join(", ")} } from "vue";`,
|
|
2733
|
+
...nonVueLines
|
|
2734
|
+
].join(`
|
|
2735
|
+
`) : nonVueLines.join(`
|
|
2736
|
+
`);
|
|
2737
|
+
}, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
|
|
2738
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
2739
|
+
if (cachedModulePath)
|
|
2740
|
+
return cachedModulePath;
|
|
2741
|
+
const compiler = await import("@vue/compiler-sfc");
|
|
2742
|
+
const source = await Bun.file(sourcePath).text();
|
|
2743
|
+
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
2744
|
+
const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
|
|
2745
|
+
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
2746
|
+
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
2747
|
+
id: componentId,
|
|
2748
|
+
inlineTemplate: false
|
|
2749
|
+
}) : { bindings: {}, content: "export default {};" };
|
|
2750
|
+
const renderCode = descriptor.template ? compiler.compileTemplate({
|
|
2751
|
+
compilerOptions: {
|
|
2752
|
+
bindingMetadata: compiledScript.bindings,
|
|
2753
|
+
expressionPlugins: ["typescript"],
|
|
2754
|
+
prefixIdentifiers: true,
|
|
2755
|
+
isCustomElement: (tag) => tag === "absolute-island"
|
|
2756
|
+
},
|
|
2757
|
+
filename: sourcePath,
|
|
2758
|
+
id: componentId,
|
|
2759
|
+
scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
|
|
2760
|
+
source: descriptor.template.content,
|
|
2761
|
+
ssr: true,
|
|
2762
|
+
ssrCssVars: descriptor.cssVars
|
|
2763
|
+
}).code : "const ssrRender = () => {};";
|
|
2764
|
+
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
2765
|
+
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
2766
|
+
compiledPath: await compileVueServerModule(resolve5(dirname4(sourcePath), relativeImport)),
|
|
2767
|
+
spec: relativeImport
|
|
2768
|
+
})));
|
|
2769
|
+
const strippedScript = stripExports(compiledScript.content);
|
|
2770
|
+
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
2771
|
+
const assembled = mergeVueImports([
|
|
2772
|
+
transpiledScript,
|
|
2773
|
+
renderCode,
|
|
2774
|
+
"script.ssrRender = ssrRender;",
|
|
2775
|
+
"export default script;"
|
|
2776
|
+
].join(`
|
|
2777
|
+
`));
|
|
2778
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
2779
|
+
let rewritten = assembled;
|
|
2780
|
+
for (const child of compiledChildren) {
|
|
2781
|
+
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
2782
|
+
}
|
|
2783
|
+
await mkdir2(dirname4(compiledModulePath), { recursive: true });
|
|
2784
|
+
await writeIfChanged2(compiledModulePath, rewritten);
|
|
2785
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
2786
|
+
return compiledModulePath;
|
|
2787
|
+
};
|
|
2788
|
+
var init_vueServerModule = __esm(() => {
|
|
2789
|
+
init_constants();
|
|
2790
|
+
serverCacheRoot2 = join5(process.cwd(), ".absolutejs", "islands", "vue");
|
|
2791
|
+
compiledModuleCache2 = new Map;
|
|
2792
|
+
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
2793
|
+
});
|
|
2794
|
+
|
|
2701
2795
|
// src/core/renderIslandMarkup.ts
|
|
2702
2796
|
var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
|
|
2703
2797
|
islandSequence += 1;
|
|
@@ -2720,9 +2814,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2720
2814
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
2721
2815
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
2722
2816
|
return loadPromise;
|
|
2817
|
+
}, resolveRuntimeImportTarget = async (resolvedModulePath) => {
|
|
2818
|
+
if (resolvedModulePath.endsWith(".svelte")) {
|
|
2819
|
+
return compileSvelteServerModule(resolvedModulePath);
|
|
2820
|
+
}
|
|
2821
|
+
if (resolvedModulePath.endsWith(".vue")) {
|
|
2822
|
+
return compileVueServerModule(resolvedModulePath);
|
|
2823
|
+
}
|
|
2824
|
+
return resolvedModulePath;
|
|
2723
2825
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
2724
2826
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
2725
|
-
const importTarget =
|
|
2827
|
+
const importTarget = await resolveRuntimeImportTarget(resolvedModulePath);
|
|
2726
2828
|
const loadedModule = await import(importTarget);
|
|
2727
2829
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
2728
2830
|
return loadedModule[exportName];
|
|
@@ -2826,6 +2928,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2826
2928
|
var init_renderIslandMarkup = __esm(() => {
|
|
2827
2929
|
init_islandSsr();
|
|
2828
2930
|
init_svelteServerModule();
|
|
2931
|
+
init_vueServerModule();
|
|
2829
2932
|
init_islandMarkupAttributes();
|
|
2830
2933
|
init_islands();
|
|
2831
2934
|
resolvedServerComponentCache = new Map;
|
|
@@ -3734,16 +3837,22 @@ var setConventions = (map) => {
|
|
|
3734
3837
|
};
|
|
3735
3838
|
var isDev = () => true;
|
|
3736
3839
|
var buildErrorProps = (error) => {
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3840
|
+
if (error instanceof Error) {
|
|
3841
|
+
return {
|
|
3842
|
+
name: error.name,
|
|
3843
|
+
message: error.message,
|
|
3844
|
+
...isDev() && error.stack ? { stack: error.stack } : {}
|
|
3845
|
+
};
|
|
3846
|
+
}
|
|
3847
|
+
return { name: "Error", message: String(error) };
|
|
3740
3848
|
};
|
|
3741
3849
|
var renderReactError = async (conventionPath, errorProps) => {
|
|
3742
3850
|
const { createElement } = await import("react");
|
|
3743
3851
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
3744
3852
|
const mod = await import(conventionPath);
|
|
3745
|
-
const
|
|
3746
|
-
|
|
3853
|
+
const ErrorComponent = mod.default;
|
|
3854
|
+
if (typeof ErrorComponent !== "function")
|
|
3855
|
+
return null;
|
|
3747
3856
|
const element = createElement(ErrorComponent, errorProps);
|
|
3748
3857
|
const stream = await renderToReadableStream(element);
|
|
3749
3858
|
return new Response(stream, {
|
|
@@ -3755,6 +3864,8 @@ var renderSvelteError = async (conventionPath, errorProps) => {
|
|
|
3755
3864
|
const { render } = await import("svelte/server");
|
|
3756
3865
|
const mod = await import(conventionPath);
|
|
3757
3866
|
const ErrorComponent = mod.default;
|
|
3867
|
+
if (!ErrorComponent)
|
|
3868
|
+
return null;
|
|
3758
3869
|
const { head, body } = render(ErrorComponent, {
|
|
3759
3870
|
props: errorProps
|
|
3760
3871
|
});
|
|
@@ -3777,6 +3888,8 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
3777
3888
|
const { renderToString } = await import("vue/server-renderer");
|
|
3778
3889
|
const mod = await import(conventionPath);
|
|
3779
3890
|
const ErrorComponent = mod.default;
|
|
3891
|
+
if (!ErrorComponent)
|
|
3892
|
+
return null;
|
|
3780
3893
|
const app = createSSRApp({
|
|
3781
3894
|
render: () => h4(ErrorComponent, errorProps)
|
|
3782
3895
|
});
|
|
@@ -3790,10 +3903,20 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
3790
3903
|
};
|
|
3791
3904
|
var renderAngularError = async (conventionPath, errorProps) => {
|
|
3792
3905
|
const mod = await import(conventionPath);
|
|
3793
|
-
const
|
|
3794
|
-
if (typeof
|
|
3906
|
+
const renderFn = mod.default;
|
|
3907
|
+
if (typeof renderFn !== "function")
|
|
3795
3908
|
return null;
|
|
3796
|
-
const html =
|
|
3909
|
+
const html = renderFn(errorProps);
|
|
3910
|
+
return new Response(html, {
|
|
3911
|
+
headers: { "Content-Type": "text/html" },
|
|
3912
|
+
status: 500
|
|
3913
|
+
});
|
|
3914
|
+
};
|
|
3915
|
+
var escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
3916
|
+
var replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : "");
|
|
3917
|
+
var renderHtmlError = async (conventionPath, errorProps) => {
|
|
3918
|
+
const template = await Bun.file(conventionPath).text();
|
|
3919
|
+
const html = replaceErrorTokens(template, errorProps);
|
|
3797
3920
|
return new Response(html, {
|
|
3798
3921
|
headers: { "Content-Type": "text/html" },
|
|
3799
3922
|
status: 500
|
|
@@ -3812,11 +3935,12 @@ var renderEmberNotFound = async () => null;
|
|
|
3812
3935
|
var ERROR_RENDERERS = {
|
|
3813
3936
|
angular: renderAngularError,
|
|
3814
3937
|
ember: renderEmberError,
|
|
3938
|
+
html: renderHtmlError,
|
|
3815
3939
|
react: renderReactError,
|
|
3816
3940
|
svelte: renderSvelteError,
|
|
3817
3941
|
vue: renderVueError
|
|
3818
3942
|
};
|
|
3819
|
-
var
|
|
3943
|
+
var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
|
|
3820
3944
|
let conventionPath = resolveErrorConventionPath(framework, pageName);
|
|
3821
3945
|
if (!conventionPath && error instanceof Error && error.stack) {
|
|
3822
3946
|
for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
@@ -3830,7 +3954,6 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
3830
3954
|
}
|
|
3831
3955
|
if (!conventionPath)
|
|
3832
3956
|
return null;
|
|
3833
|
-
const errorProps = buildErrorProps(error);
|
|
3834
3957
|
const renderer = ERROR_RENDERERS[framework];
|
|
3835
3958
|
if (!renderer)
|
|
3836
3959
|
return null;
|
|
@@ -3841,12 +3964,25 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
3841
3964
|
}
|
|
3842
3965
|
return null;
|
|
3843
3966
|
};
|
|
3967
|
+
var renderConventionError = async (framework, pageName, error) => {
|
|
3968
|
+
const errorProps = buildErrorProps(error);
|
|
3969
|
+
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
3970
|
+
if (frameworkResponse)
|
|
3971
|
+
return frameworkResponse;
|
|
3972
|
+
if (framework !== "html") {
|
|
3973
|
+
const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
|
|
3974
|
+
if (htmlResponse)
|
|
3975
|
+
return htmlResponse;
|
|
3976
|
+
}
|
|
3977
|
+
return null;
|
|
3978
|
+
};
|
|
3844
3979
|
var renderReactNotFound = async (conventionPath) => {
|
|
3845
3980
|
const { createElement } = await import("react");
|
|
3846
3981
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
3847
3982
|
const mod = await import(conventionPath);
|
|
3848
|
-
const
|
|
3849
|
-
|
|
3983
|
+
const NotFoundComponent = mod.default;
|
|
3984
|
+
if (typeof NotFoundComponent !== "function")
|
|
3985
|
+
return null;
|
|
3850
3986
|
const element = createElement(NotFoundComponent);
|
|
3851
3987
|
const stream = await renderToReadableStream(element);
|
|
3852
3988
|
return new Response(stream, {
|
|
@@ -3858,6 +3994,8 @@ var renderSvelteNotFound = async (conventionPath) => {
|
|
|
3858
3994
|
const { render } = await import("svelte/server");
|
|
3859
3995
|
const mod = await import(conventionPath);
|
|
3860
3996
|
const NotFoundComponent = mod.default;
|
|
3997
|
+
if (!NotFoundComponent)
|
|
3998
|
+
return null;
|
|
3861
3999
|
const { head, body } = render(NotFoundComponent);
|
|
3862
4000
|
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
3863
4001
|
return new Response(html, {
|
|
@@ -3870,6 +4008,8 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
3870
4008
|
const { renderToString } = await import("vue/server-renderer");
|
|
3871
4009
|
const mod = await import(conventionPath);
|
|
3872
4010
|
const NotFoundComponent = mod.default;
|
|
4011
|
+
if (!NotFoundComponent)
|
|
4012
|
+
return null;
|
|
3873
4013
|
const app = createSSRApp({
|
|
3874
4014
|
render: () => h4(NotFoundComponent)
|
|
3875
4015
|
});
|
|
@@ -3883,10 +4023,17 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
3883
4023
|
};
|
|
3884
4024
|
var renderAngularNotFound = async (conventionPath) => {
|
|
3885
4025
|
const mod = await import(conventionPath);
|
|
3886
|
-
const
|
|
3887
|
-
if (typeof
|
|
4026
|
+
const renderFn = mod.default;
|
|
4027
|
+
if (typeof renderFn !== "function")
|
|
3888
4028
|
return null;
|
|
3889
|
-
const html =
|
|
4029
|
+
const html = renderFn();
|
|
4030
|
+
return new Response(html, {
|
|
4031
|
+
headers: { "Content-Type": "text/html" },
|
|
4032
|
+
status: 404
|
|
4033
|
+
});
|
|
4034
|
+
};
|
|
4035
|
+
var renderHtmlNotFound = async (conventionPath) => {
|
|
4036
|
+
const html = await Bun.file(conventionPath).text();
|
|
3890
4037
|
return new Response(html, {
|
|
3891
4038
|
headers: { "Content-Type": "text/html" },
|
|
3892
4039
|
status: 404
|
|
@@ -3895,6 +4042,7 @@ var renderAngularNotFound = async (conventionPath) => {
|
|
|
3895
4042
|
var NOT_FOUND_RENDERERS = {
|
|
3896
4043
|
angular: renderAngularNotFound,
|
|
3897
4044
|
ember: renderEmberNotFound,
|
|
4045
|
+
html: renderHtmlNotFound,
|
|
3898
4046
|
react: renderReactNotFound,
|
|
3899
4047
|
svelte: renderSvelteNotFound,
|
|
3900
4048
|
vue: renderVueNotFound
|
|
@@ -3917,7 +4065,8 @@ var NOT_FOUND_PRIORITY = [
|
|
|
3917
4065
|
"react",
|
|
3918
4066
|
"svelte",
|
|
3919
4067
|
"vue",
|
|
3920
|
-
"angular"
|
|
4068
|
+
"angular",
|
|
4069
|
+
"html"
|
|
3921
4070
|
];
|
|
3922
4071
|
var renderFirstNotFound = async () => {
|
|
3923
4072
|
const renderNext = async (frameworks) => {
|
|
@@ -3969,7 +4118,13 @@ var resolveCurrentGeneratedVueModulePath = async (pagePath) => {
|
|
|
3969
4118
|
return pagePath;
|
|
3970
4119
|
}
|
|
3971
4120
|
};
|
|
3972
|
-
var buildDirtyResponse = (headTag, indexPath, maybeProps) => {
|
|
4121
|
+
var buildDirtyResponse = (headTag, indexPath, maybeProps, clientMode) => {
|
|
4122
|
+
if (clientMode === "none") {
|
|
4123
|
+
const html2 = `<!DOCTYPE html><html>${headTag}<body><div id="root"></div>` + `</body></html>`;
|
|
4124
|
+
return new Response(html2, {
|
|
4125
|
+
headers: { "Content-Type": "text/html" }
|
|
4126
|
+
});
|
|
4127
|
+
}
|
|
3973
4128
|
const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})};`;
|
|
3974
4129
|
const dirtyFlag = "window.__SSR_DIRTY__=true;";
|
|
3975
4130
|
const html = `<!DOCTYPE html><html>${headTag}<body><div id="root"></div>` + `<script>${propsScript}${dirtyFlag}</script>` + `<script type="module" src="${indexPath}"></script>` + `</body></html>`;
|
|
@@ -3999,8 +4154,9 @@ var handleVuePageRequest = async (input) => {
|
|
|
3999
4154
|
const resolvedOptions = input;
|
|
4000
4155
|
const resolvedPagePath = input.pagePath;
|
|
4001
4156
|
const maybeProps = input.props;
|
|
4157
|
+
const clientMode = input.client ?? "auto";
|
|
4002
4158
|
if (isSsrCacheDirty("vue")) {
|
|
4003
|
-
return buildDirtyResponse(resolvedHeadTag, resolvedIndexPath, maybeProps);
|
|
4159
|
+
return buildDirtyResponse(resolvedHeadTag, resolvedIndexPath, maybeProps, clientMode);
|
|
4004
4160
|
}
|
|
4005
4161
|
try {
|
|
4006
4162
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
@@ -4057,7 +4213,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
4057
4213
|
const bodyStream = renderToWebStream(app);
|
|
4058
4214
|
const { firstChunk, reader } = await primeVueStream(bodyStream);
|
|
4059
4215
|
const head = `<!DOCTYPE html><html>${resolvedHeadTag}<body><div id="root">`;
|
|
4060
|
-
const tail = `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${resolvedIndexPath}"></script></body></html>`;
|
|
4216
|
+
const tail = clientMode === "none" ? `</div></body></html>` : `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${resolvedIndexPath}"></script></body></html>`;
|
|
4061
4217
|
const stream = new ReadableStream({
|
|
4062
4218
|
start(controller) {
|
|
4063
4219
|
controller.enqueue(head);
|
|
@@ -4203,6 +4359,60 @@ var preserveIslandMarkup = (props) => {
|
|
|
4203
4359
|
|
|
4204
4360
|
// src/vue/Island.ts
|
|
4205
4361
|
init_islandMarkupAttributes();
|
|
4362
|
+
|
|
4363
|
+
// src/core/normalizeIslandProps.ts
|
|
4364
|
+
var EMPTY_PROPS = {};
|
|
4365
|
+
var ISLAND_FRAMEWORKS = [
|
|
4366
|
+
"react",
|
|
4367
|
+
"svelte",
|
|
4368
|
+
"vue",
|
|
4369
|
+
"angular",
|
|
4370
|
+
"ember"
|
|
4371
|
+
];
|
|
4372
|
+
var ISLAND_HYDRATE_MODES = [
|
|
4373
|
+
"load",
|
|
4374
|
+
"idle",
|
|
4375
|
+
"visible",
|
|
4376
|
+
"none"
|
|
4377
|
+
];
|
|
4378
|
+
var isIslandFramework = (value) => ISLAND_FRAMEWORKS.some((framework) => framework === value);
|
|
4379
|
+
var isIslandHydrate = (value) => ISLAND_HYDRATE_MODES.some((mode) => mode === value);
|
|
4380
|
+
var normalizeRuntimeIslandRenderProps = (raw) => {
|
|
4381
|
+
const { component, framework, hydrate, props } = raw;
|
|
4382
|
+
if (!isIslandFramework(framework)) {
|
|
4383
|
+
throw new Error(`Unknown island framework: "${framework}".`);
|
|
4384
|
+
}
|
|
4385
|
+
if (hydrate !== undefined && !isIslandHydrate(hydrate)) {
|
|
4386
|
+
throw new Error(`Unknown island hydrate mode: "${hydrate}".`);
|
|
4387
|
+
}
|
|
4388
|
+
return {
|
|
4389
|
+
component,
|
|
4390
|
+
framework,
|
|
4391
|
+
hydrate,
|
|
4392
|
+
props: normalizeIslandProps(props)
|
|
4393
|
+
};
|
|
4394
|
+
};
|
|
4395
|
+
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4396
|
+
var safeJsonParseObject = (raw) => {
|
|
4397
|
+
const trimmed = raw.trim();
|
|
4398
|
+
if (!trimmed)
|
|
4399
|
+
return EMPTY_PROPS;
|
|
4400
|
+
try {
|
|
4401
|
+
const parsed = JSON.parse(trimmed);
|
|
4402
|
+
return isPlainObject(parsed) ? parsed : EMPTY_PROPS;
|
|
4403
|
+
} catch {
|
|
4404
|
+
return EMPTY_PROPS;
|
|
4405
|
+
}
|
|
4406
|
+
};
|
|
4407
|
+
var normalizeIslandProps = (value) => {
|
|
4408
|
+
if (typeof value === "string")
|
|
4409
|
+
return safeJsonParseObject(value);
|
|
4410
|
+
if (isPlainObject(value))
|
|
4411
|
+
return value;
|
|
4412
|
+
return EMPTY_PROPS;
|
|
4413
|
+
};
|
|
4414
|
+
|
|
4415
|
+
// src/vue/Island.ts
|
|
4206
4416
|
init_renderIslandMarkup();
|
|
4207
4417
|
var defineRuntimeIslandComponent = (setup) => defineComponent4({
|
|
4208
4418
|
name: "AbsoluteIsland",
|
|
@@ -4220,11 +4430,11 @@ var defineRuntimeIslandComponent = (setup) => defineComponent4({
|
|
|
4220
4430
|
type: String
|
|
4221
4431
|
},
|
|
4222
4432
|
props: {
|
|
4223
|
-
required:
|
|
4224
|
-
type: Object
|
|
4433
|
+
required: false,
|
|
4434
|
+
type: [Object, String]
|
|
4225
4435
|
}
|
|
4226
4436
|
},
|
|
4227
|
-
setup
|
|
4437
|
+
setup: (rawProps) => setup(normalizeRuntimeIslandRenderProps(rawProps))
|
|
4228
4438
|
});
|
|
4229
4439
|
var Island = defineRuntimeIslandComponent((props) => {
|
|
4230
4440
|
const isBrowser = typeof window !== "undefined";
|
|
@@ -4434,5 +4644,5 @@ export {
|
|
|
4434
4644
|
Image
|
|
4435
4645
|
};
|
|
4436
4646
|
|
|
4437
|
-
//# debugId=
|
|
4647
|
+
//# debugId=C533BB46082E586D64756E2164756E21
|
|
4438
4648
|
//# sourceMappingURL=index.js.map
|