@absolutejs/absolute 0.19.0-beta.930 → 0.19.0-beta.931
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 +118 -221
- package/dist/angular/index.js.map +4 -5
- package/dist/angular/server.js +100 -203
- package/dist/angular/server.js.map +4 -5
- package/dist/build.js +566 -688
- package/dist/build.js.map +8 -9
- package/dist/index.js +617 -739
- package/dist/index.js.map +8 -9
- package/dist/islands/index.js +2 -105
- package/dist/islands/index.js.map +4 -5
- package/dist/react/index.js +2 -105
- package/dist/react/index.js.map +4 -5
- package/dist/src/vue/Island.browser.d.ts +12 -36
- package/dist/src/vue/Island.d.ts +11 -35
- package/dist/src/vue/pageHandler.d.ts +0 -8
- package/dist/svelte/index.js +2 -105
- package/dist/svelte/index.js.map +4 -5
- package/dist/vue/browser.js +4 -57
- package/dist/vue/browser.js.map +4 -5
- package/dist/vue/index.js +8 -172
- package/dist/vue/index.js.map +6 -8
- package/dist/vue/server.js +4 -11
- package/dist/vue/server.js.map +3 -3
- package/package.json +1 -1
- package/dist/src/core/normalizeIslandProps.d.ts +0 -15
- package/dist/src/core/vueServerModule.d.ts +0 -1
package/dist/vue/browser.js
CHANGED
|
@@ -228,58 +228,6 @@ var preserveIslandMarkup = (props) => {
|
|
|
228
228
|
};
|
|
229
229
|
};
|
|
230
230
|
|
|
231
|
-
// src/core/normalizeIslandProps.ts
|
|
232
|
-
var EMPTY_PROPS = {};
|
|
233
|
-
var ISLAND_FRAMEWORKS = [
|
|
234
|
-
"react",
|
|
235
|
-
"svelte",
|
|
236
|
-
"vue",
|
|
237
|
-
"angular",
|
|
238
|
-
"ember"
|
|
239
|
-
];
|
|
240
|
-
var ISLAND_HYDRATE_MODES = [
|
|
241
|
-
"load",
|
|
242
|
-
"idle",
|
|
243
|
-
"visible",
|
|
244
|
-
"none"
|
|
245
|
-
];
|
|
246
|
-
var isIslandFramework = (value) => ISLAND_FRAMEWORKS.some((framework) => framework === value);
|
|
247
|
-
var isIslandHydrate = (value) => ISLAND_HYDRATE_MODES.some((mode) => mode === value);
|
|
248
|
-
var normalizeRuntimeIslandRenderProps = (raw) => {
|
|
249
|
-
const { component, framework, hydrate, props } = raw;
|
|
250
|
-
if (!isIslandFramework(framework)) {
|
|
251
|
-
throw new Error(`Unknown island framework: "${framework}".`);
|
|
252
|
-
}
|
|
253
|
-
if (hydrate !== undefined && !isIslandHydrate(hydrate)) {
|
|
254
|
-
throw new Error(`Unknown island hydrate mode: "${hydrate}".`);
|
|
255
|
-
}
|
|
256
|
-
return {
|
|
257
|
-
component,
|
|
258
|
-
framework,
|
|
259
|
-
hydrate,
|
|
260
|
-
props: normalizeIslandProps(props)
|
|
261
|
-
};
|
|
262
|
-
};
|
|
263
|
-
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
264
|
-
var safeJsonParseObject = (raw) => {
|
|
265
|
-
const trimmed = raw.trim();
|
|
266
|
-
if (!trimmed)
|
|
267
|
-
return EMPTY_PROPS;
|
|
268
|
-
try {
|
|
269
|
-
const parsed = JSON.parse(trimmed);
|
|
270
|
-
return isPlainObject(parsed) ? parsed : EMPTY_PROPS;
|
|
271
|
-
} catch {
|
|
272
|
-
return EMPTY_PROPS;
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
var normalizeIslandProps = (value) => {
|
|
276
|
-
if (typeof value === "string")
|
|
277
|
-
return safeJsonParseObject(value);
|
|
278
|
-
if (isPlainObject(value))
|
|
279
|
-
return value;
|
|
280
|
-
return EMPTY_PROPS;
|
|
281
|
-
};
|
|
282
|
-
|
|
283
231
|
// src/vue/Island.browser.ts
|
|
284
232
|
var Island = defineComponent({
|
|
285
233
|
name: "AbsoluteIsland",
|
|
@@ -297,12 +245,11 @@ var Island = defineComponent({
|
|
|
297
245
|
type: String
|
|
298
246
|
},
|
|
299
247
|
props: {
|
|
300
|
-
required:
|
|
301
|
-
type:
|
|
248
|
+
required: true,
|
|
249
|
+
type: Object
|
|
302
250
|
}
|
|
303
251
|
},
|
|
304
|
-
setup(
|
|
305
|
-
const props = normalizeRuntimeIslandRenderProps(rawProps);
|
|
252
|
+
setup(props) {
|
|
306
253
|
return () => {
|
|
307
254
|
const { attributes, innerHTML } = preserveIslandMarkup(props);
|
|
308
255
|
return h("div", {
|
|
@@ -494,5 +441,5 @@ export {
|
|
|
494
441
|
Island
|
|
495
442
|
};
|
|
496
443
|
|
|
497
|
-
//# debugId=
|
|
444
|
+
//# debugId=A24547BBA24544FE64756E2164756E21
|
|
498
445
|
//# sourceMappingURL=browser.js.map
|
package/dist/vue/browser.js.map
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
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/
|
|
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"],
|
|
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 type { RuntimeIslandRenderProps } from '../../types/island';\nimport { preserveIslandMarkup } from '../client/preserveIslandMarkup';\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\tprops: {\n\t\t\trequired: true,\n\t\t\ttype: Object\n\t\t}\n\t},\n\tsetup(props: RuntimeIslandRenderProps) {\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",
|
|
11
10
|
"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",
|
|
12
11
|
"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",
|
|
13
12
|
"const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n",
|
|
@@ -15,7 +14,7 @@
|
|
|
15
14
|
"import { createStore, type StateCreator, type StoreApi } from 'zustand/vanilla';\nimport { combine } from 'zustand/middleware';\n\nexport type IslandStoreState = object;\ntype IslandStoreSnapshot = Record<string, unknown>;\ntype IslandStoreShape<\n\tTState extends IslandStoreState,\n\tTActions extends object\n> = Omit<TState, keyof TActions> & TActions;\nexport type IslandStateSnapshot = Record<string, IslandStoreSnapshot>;\ntype AnyIslandStore = StoreApi<object>;\ntype IslandStoreInstance = {\n\tapplyExternalSnapshot: (snapshot: IslandStoreSnapshot) => void;\n\tstore: AnyIslandStore;\n};\n\nconst ABSOLUTE_ISLAND_STATE = '__ABS_ISLAND_STATE__';\nconst ABSOLUTE_ISLAND_STORES = '__ABS_ISLAND_STORES__';\n\ndeclare global {\n\tvar __ABS_ISLAND_STATE__: IslandStateSnapshot | undefined;\n\tvar __ABS_ISLAND_STORES__:\n\t\t| Map<string, Set<IslandStoreInstance>>\n\t\t| undefined;\n}\n\nconst getIslandStoreSnapshot = () => {\n\tglobalThis.__ABS_ISLAND_STATE__ ??= {};\n\n\treturn globalThis.__ABS_ISLAND_STATE__;\n};\n\nconst getIslandStores = () => {\n\tglobalThis.__ABS_ISLAND_STORES__ ??= new Map();\n\n\treturn globalThis.__ABS_ISLAND_STORES__;\n};\n\nconst isSerializableValue = (value: unknown) =>\n\ttypeof value !== 'function' && value !== undefined;\n\nconst toSerializableState = <T extends object>(state: T) =>\n\tObject.fromEntries(\n\t\tObject.entries(state).filter(([, value]) => isSerializableValue(value))\n\t);\n\nconst applySnapshot = <T extends object>(\n\tstore: StoreApi<T>,\n\tsnapshot: IslandStoreSnapshot | undefined\n) => {\n\tif (!snapshot) {\n\t\treturn;\n\t}\n\n\tstore.setState({\n\t\t...store.getState(),\n\t\t...snapshot\n\t});\n};\n\nconst getPeerStores = (\n\tstoreInstances: Set<IslandStoreInstance>,\n\townerStore: AnyIslandStore\n) => [...storeInstances].filter((peer) => peer.store !== ownerStore);\n\nconst syncIslandSnapshot = <\n\tTState extends IslandStoreState,\n\tTActions extends object\n>(\n\tstoreId: string,\n\tstate: IslandStoreShape<TState, TActions>,\n\tstoreInstances: Set<IslandStoreInstance>,\n\townerStore: AnyIslandStore\n) => {\n\tconst nextSnapshot = toSerializableState(state);\n\tgetIslandStoreSnapshot()[storeId] = nextSnapshot;\n\n\tfor (const peerStore of getPeerStores(storeInstances, ownerStore)) {\n\t\tpeerStore.applyExternalSnapshot(nextSnapshot);\n\t}\n};\n\nexport const createIslandStore = <\n\tTState extends IslandStoreState,\n\tTActions extends object\n>(\n\tstoreId: string,\n\tinitialState: TState,\n\tcreateState: StateCreator<TState, [], [], TActions>\n) => {\n\tconst store = createStore(combine(initialState, createState));\n\tconst stores = getIslandStores();\n\tconst storeInstances =\n\t\tstores.get(storeId) ?? new Set<IslandStoreInstance>();\n\tconst initialSnapshot = getIslandStoreSnapshot()[storeId];\n\tapplySnapshot(store, initialSnapshot);\n\tlet isApplyingExternalSnapshot = false;\n\n\tconst applyExternalSnapshot = (snapshot: IslandStoreSnapshot) => {\n\t\tisApplyingExternalSnapshot = true;\n\t\tapplySnapshot(store, snapshot);\n\t};\n\n\tstoreInstances.add({\n\t\tapplyExternalSnapshot,\n\t\tstore\n\t});\n\tstores.set(storeId, storeInstances);\n\n\tsyncIslandSnapshot(storeId, store.getState(), storeInstances, store);\n\tstore.subscribe((state) => {\n\t\tif (isApplyingExternalSnapshot) {\n\t\t\tisApplyingExternalSnapshot = false;\n\n\t\t\treturn;\n\t\t}\n\n\t\tsyncIslandSnapshot(storeId, state, storeInstances, store);\n\t});\n\n\treturn store;\n};\nexport const getIslandStoreServerSnapshot = <\n\tTState extends IslandStoreState,\n\tTSelected\n>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => selector(store.getInitialState());\nconst applySnapshotToStoreInstances = (\n\tstoreId: string,\n\tinstances: Set<IslandStoreInstance>,\n\tsnapshot: IslandStateSnapshot\n) => {\n\tfor (const instance of instances) {\n\t\tinstance.applyExternalSnapshot(snapshot[storeId] ?? {});\n\t}\n};\n\nexport const initializeIslandStores = (state: IslandStateSnapshot) => {\n\tconst currentSnapshot = getIslandStoreSnapshot();\n\tconst nextSnapshot: IslandStateSnapshot = {\n\t\t...state,\n\t\t...currentSnapshot\n\t};\n\n\tglobalThis.__ABS_ISLAND_STATE__ = nextSnapshot;\n\n\tfor (const [storeId, store] of getIslandStores()) {\n\t\tapplySnapshotToStoreInstances(storeId, store, nextSnapshot);\n\t}\n};\nexport const readIslandStore = <TState extends IslandStoreState, TSelected>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) => selector(store.getState());\nexport const resetIslandStoreForTesting = () => {\n\tdelete globalThis.__ABS_ISLAND_STATE__;\n\tdelete globalThis.__ABS_ISLAND_STORES__;\n};\nexport const subscribeIslandStore = <\n\tTState extends IslandStoreState,\n\tTSelected\n>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected,\n\tlistener: (value: TSelected) => void\n) => {\n\tlet currentSelection = selector(store.getState());\n\n\treturn store.subscribe((state) => {\n\t\tconst nextSelection = selector(state);\n\t\tif (Object.is(nextSelection, currentSelection)) {\n\t\t\treturn;\n\t\t}\n\n\t\tcurrentSelection = nextSelection;\n\t\tlistener(nextSelection);\n\t});\n};\n\nexport { ABSOLUTE_ISLAND_STATE, ABSOLUTE_ISLAND_STORES };\n",
|
|
16
15
|
"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"
|
|
17
16
|
],
|
|
18
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,UAAU;AAAA,IACjC,MAAM,gBAAgB,SAAS,KAAK;AAAA,IACpC,IAAI,OAAO,GAAG,eAAe,gBAAgB,GAAG;AAAA,MAC/C;AAAA,IACD;AAAA,IAEA,mBAAmB;AAAA,IACnB,SAAS,aAAa;AAAA,GACtB;AAAA;;;AH1KK,IAAM,iBAAiB,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;",
|
|
18
|
+
"debugId": "A24547BBA24544FE64756E2164756E21",
|
|
20
19
|
"names": []
|
|
21
20
|
}
|
package/dist/vue/index.js
CHANGED
|
@@ -2698,100 +2698,6 @@ 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
|
-
|
|
2795
2701
|
// src/core/renderIslandMarkup.ts
|
|
2796
2702
|
var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
|
|
2797
2703
|
islandSequence += 1;
|
|
@@ -2814,17 +2720,9 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2814
2720
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
2815
2721
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
2816
2722
|
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;
|
|
2825
2723
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
2826
2724
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
2827
|
-
const importTarget = await
|
|
2725
|
+
const importTarget = resolvedModulePath.endsWith(".svelte") ? await compileSvelteServerModule(resolvedModulePath) : resolvedModulePath;
|
|
2828
2726
|
const loadedModule = await import(importTarget);
|
|
2829
2727
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
2830
2728
|
return loadedModule[exportName];
|
|
@@ -2928,7 +2826,6 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2928
2826
|
var init_renderIslandMarkup = __esm(() => {
|
|
2929
2827
|
init_islandSsr();
|
|
2930
2828
|
init_svelteServerModule();
|
|
2931
|
-
init_vueServerModule();
|
|
2932
2829
|
init_islandMarkupAttributes();
|
|
2933
2830
|
init_islands();
|
|
2934
2831
|
resolvedServerComponentCache = new Map;
|
|
@@ -4072,13 +3969,7 @@ var resolveCurrentGeneratedVueModulePath = async (pagePath) => {
|
|
|
4072
3969
|
return pagePath;
|
|
4073
3970
|
}
|
|
4074
3971
|
};
|
|
4075
|
-
var buildDirtyResponse = (headTag, indexPath, maybeProps
|
|
4076
|
-
if (clientMode === "none") {
|
|
4077
|
-
const html2 = `<!DOCTYPE html><html>${headTag}<body><div id="root"></div>` + `</body></html>`;
|
|
4078
|
-
return new Response(html2, {
|
|
4079
|
-
headers: { "Content-Type": "text/html" }
|
|
4080
|
-
});
|
|
4081
|
-
}
|
|
3972
|
+
var buildDirtyResponse = (headTag, indexPath, maybeProps) => {
|
|
4082
3973
|
const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})};`;
|
|
4083
3974
|
const dirtyFlag = "window.__SSR_DIRTY__=true;";
|
|
4084
3975
|
const html = `<!DOCTYPE html><html>${headTag}<body><div id="root"></div>` + `<script>${propsScript}${dirtyFlag}</script>` + `<script type="module" src="${indexPath}"></script>` + `</body></html>`;
|
|
@@ -4108,9 +3999,8 @@ var handleVuePageRequest = async (input) => {
|
|
|
4108
3999
|
const resolvedOptions = input;
|
|
4109
4000
|
const resolvedPagePath = input.pagePath;
|
|
4110
4001
|
const maybeProps = input.props;
|
|
4111
|
-
const clientMode = input.client ?? "auto";
|
|
4112
4002
|
if (isSsrCacheDirty("vue")) {
|
|
4113
|
-
return buildDirtyResponse(resolvedHeadTag, resolvedIndexPath, maybeProps
|
|
4003
|
+
return buildDirtyResponse(resolvedHeadTag, resolvedIndexPath, maybeProps);
|
|
4114
4004
|
}
|
|
4115
4005
|
try {
|
|
4116
4006
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
@@ -4167,7 +4057,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
4167
4057
|
const bodyStream = renderToWebStream(app);
|
|
4168
4058
|
const { firstChunk, reader } = await primeVueStream(bodyStream);
|
|
4169
4059
|
const head = `<!DOCTYPE html><html>${resolvedHeadTag}<body><div id="root">`;
|
|
4170
|
-
const tail =
|
|
4060
|
+
const tail = `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${resolvedIndexPath}"></script></body></html>`;
|
|
4171
4061
|
const stream = new ReadableStream({
|
|
4172
4062
|
start(controller) {
|
|
4173
4063
|
controller.enqueue(head);
|
|
@@ -4313,60 +4203,6 @@ var preserveIslandMarkup = (props) => {
|
|
|
4313
4203
|
|
|
4314
4204
|
// src/vue/Island.ts
|
|
4315
4205
|
init_islandMarkupAttributes();
|
|
4316
|
-
|
|
4317
|
-
// src/core/normalizeIslandProps.ts
|
|
4318
|
-
var EMPTY_PROPS = {};
|
|
4319
|
-
var ISLAND_FRAMEWORKS = [
|
|
4320
|
-
"react",
|
|
4321
|
-
"svelte",
|
|
4322
|
-
"vue",
|
|
4323
|
-
"angular",
|
|
4324
|
-
"ember"
|
|
4325
|
-
];
|
|
4326
|
-
var ISLAND_HYDRATE_MODES = [
|
|
4327
|
-
"load",
|
|
4328
|
-
"idle",
|
|
4329
|
-
"visible",
|
|
4330
|
-
"none"
|
|
4331
|
-
];
|
|
4332
|
-
var isIslandFramework = (value) => ISLAND_FRAMEWORKS.some((framework) => framework === value);
|
|
4333
|
-
var isIslandHydrate = (value) => ISLAND_HYDRATE_MODES.some((mode) => mode === value);
|
|
4334
|
-
var normalizeRuntimeIslandRenderProps = (raw) => {
|
|
4335
|
-
const { component, framework, hydrate, props } = raw;
|
|
4336
|
-
if (!isIslandFramework(framework)) {
|
|
4337
|
-
throw new Error(`Unknown island framework: "${framework}".`);
|
|
4338
|
-
}
|
|
4339
|
-
if (hydrate !== undefined && !isIslandHydrate(hydrate)) {
|
|
4340
|
-
throw new Error(`Unknown island hydrate mode: "${hydrate}".`);
|
|
4341
|
-
}
|
|
4342
|
-
return {
|
|
4343
|
-
component,
|
|
4344
|
-
framework,
|
|
4345
|
-
hydrate,
|
|
4346
|
-
props: normalizeIslandProps(props)
|
|
4347
|
-
};
|
|
4348
|
-
};
|
|
4349
|
-
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4350
|
-
var safeJsonParseObject = (raw) => {
|
|
4351
|
-
const trimmed = raw.trim();
|
|
4352
|
-
if (!trimmed)
|
|
4353
|
-
return EMPTY_PROPS;
|
|
4354
|
-
try {
|
|
4355
|
-
const parsed = JSON.parse(trimmed);
|
|
4356
|
-
return isPlainObject(parsed) ? parsed : EMPTY_PROPS;
|
|
4357
|
-
} catch {
|
|
4358
|
-
return EMPTY_PROPS;
|
|
4359
|
-
}
|
|
4360
|
-
};
|
|
4361
|
-
var normalizeIslandProps = (value) => {
|
|
4362
|
-
if (typeof value === "string")
|
|
4363
|
-
return safeJsonParseObject(value);
|
|
4364
|
-
if (isPlainObject(value))
|
|
4365
|
-
return value;
|
|
4366
|
-
return EMPTY_PROPS;
|
|
4367
|
-
};
|
|
4368
|
-
|
|
4369
|
-
// src/vue/Island.ts
|
|
4370
4206
|
init_renderIslandMarkup();
|
|
4371
4207
|
var defineRuntimeIslandComponent = (setup) => defineComponent4({
|
|
4372
4208
|
name: "AbsoluteIsland",
|
|
@@ -4384,11 +4220,11 @@ var defineRuntimeIslandComponent = (setup) => defineComponent4({
|
|
|
4384
4220
|
type: String
|
|
4385
4221
|
},
|
|
4386
4222
|
props: {
|
|
4387
|
-
required:
|
|
4388
|
-
type:
|
|
4223
|
+
required: true,
|
|
4224
|
+
type: Object
|
|
4389
4225
|
}
|
|
4390
4226
|
},
|
|
4391
|
-
setup
|
|
4227
|
+
setup
|
|
4392
4228
|
});
|
|
4393
4229
|
var Island = defineRuntimeIslandComponent((props) => {
|
|
4394
4230
|
const isBrowser = typeof window !== "undefined";
|
|
@@ -4598,5 +4434,5 @@ export {
|
|
|
4598
4434
|
Image
|
|
4599
4435
|
};
|
|
4600
4436
|
|
|
4601
|
-
//# debugId=
|
|
4437
|
+
//# debugId=EAE220F5AF4FAAD664756E2164756E21
|
|
4602
4438
|
//# sourceMappingURL=index.js.map
|