@absolutejs/absolute 0.20.0-beta.167 → 0.20.0-beta.169
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/CHANGELOG.md +18 -0
- package/README.md +81 -0
- package/changelog.json +35 -0
- package/dist/angular/browser.js +3 -3
- package/dist/angular/browser.js.map +3 -3
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +211 -197
- package/dist/angular/index.js.map +8 -8
- package/dist/angular/server.js +211 -197
- package/dist/angular/server.js.map +8 -8
- package/dist/build.js +1324 -998
- package/dist/build.js.map +12 -8
- package/dist/cli/{add-kwyqxccz.js → add-7azr0c83.js} +5 -5
- package/dist/cli/{androidEmulatorController-3zn6a4j3.js → androidEmulatorController-68jjdxmx.js} +3 -3
- package/dist/cli/{androidNativeWatcher-wz7vhnkr.js → androidNativeWatcher-x032x9yr.js} +3 -3
- package/dist/cli/{api-m3n8xbcv.js → api-mshjr4ah.js} +1 -1
- package/dist/cli/{compile-30m09382.js → compile-4jnfxts9.js} +2 -2
- package/dist/cli/config/server.js +129 -115
- package/dist/cli/{dev-ny2vah78.js → dev-9tk5hn2e.js} +9 -9
- package/dist/cli/{emulatorDoctor-1m4rr9y3.js → emulatorDoctor-p3yt7140.js} +2 -2
- package/dist/cli/{emulatorInstaller-70v711bj.js → emulatorInstaller-4pm2kx9w.js} +3 -3
- package/dist/cli/{expoDevController-hen9sra5.js → expoDevController-0vj8dvkh.js} +3 -3
- package/dist/cli/{generate-vx6tz1y2.js → generate-v75p2fct.js} +4 -4
- package/dist/cli/{htmx-dym03fq5.js → htmx-427swtdz.js} +2 -2
- package/dist/cli/{index-j9yrhw7a.js → index-066qhc6n.js} +1 -1
- package/dist/cli/{index-x1swv7rw.js → index-3vmc30gf.js} +1 -1
- package/dist/cli/{index-g8489j4d.js → index-a4ws2jwd.js} +1 -1
- package/dist/cli/{index-xj68ep9n.js → index-b7hjgknf.js} +2 -2
- package/dist/cli/{index-vkba3289.js → index-bhbs6d5z.js} +2 -2
- package/dist/cli/{index-v4cg4dvm.js → index-exfkpjja.js} +4 -3
- package/dist/cli/{index-vy8zejts.js → index-eyzwc7gz.js} +1 -1
- package/dist/cli/{index-d3br7c47.js → index-k3y8cb6c.js} +1 -1
- package/dist/cli/{index-52a2csjm.js → index-ppphkyps.js} +1 -1
- package/dist/cli/{index-bvwkwgjw.js → index-s3xvccq3.js} +1 -1
- package/dist/cli/{index-6ps18fvr.js → index-t8cf0zj9.js} +2 -2
- package/dist/cli/{index-wwnnfhm6.js → index-w09fzs9f.js} +1 -1
- package/dist/cli/{index-px7fqsfk.js → index-zd3cna19.js} +1 -1
- package/dist/cli/index.js +16 -16
- package/dist/cli/{info-9ffx5h3h.js → info-mn125212.js} +1 -1
- package/dist/cli/{iosNativeWatcher-ntzec3hx.js → iosNativeWatcher-0nm6qad5.js} +4 -4
- package/dist/cli/{iosSimulatorController-hjzy6pq6.js → iosSimulatorController-hza2c3rv.js} +4 -4
- package/dist/cli/{islands-rq6wx0kh.js → islands-8sgky9gh.js} +1 -1
- package/dist/cli/{mobile-41sev6v0.js → mobile-hcxjr2gf.js} +10 -10
- package/dist/cli/{ps-0tryaye0.js → ps-ezmzyscn.js} +1 -1
- package/dist/cli/{psTui-0nx63pmr.js → psTui-3x3ykjve.js} +1 -1
- package/dist/cli/{remoteMacProtocol-2ej6fbnj.js → remoteMacProtocol-g09myqt5.js} +4 -4
- package/dist/cli/{remove-qgme4h2s.js → remove-1ycjx85k.js} +4 -4
- package/dist/cli/{start-0ebxkwga.js → start-mbaejxhm.js} +3 -3
- package/dist/cli/{typecheck-7yhekrc0.js → typecheck-dr068pmh.js} +209 -43
- package/dist/cli/{workspace-atcxzyee.js → workspace-1sycp9g1.js} +7 -4
- package/dist/client/index.js +8 -3
- package/dist/client/index.js.map +4 -4
- package/dist/index.js +1402 -1075
- package/dist/index.js.map +14 -10
- package/dist/islands/browser.js +3 -3
- package/dist/islands/browser.js.map +3 -3
- package/dist/islands/index.js +3 -3
- package/dist/islands/index.js.map +3 -3
- package/dist/mobile/index.js.map +1 -1
- package/dist/react/browser.js +3 -3
- package/dist/react/browser.js.map +3 -3
- package/dist/react/index.js +231 -217
- package/dist/react/index.js.map +9 -9
- package/dist/react/server.js +231 -191
- package/dist/react/server.js.map +9 -8
- package/dist/src/build/islandBootstrap.d.ts +22 -0
- package/dist/src/build/missingClientFrameworks.d.ts +29 -0
- package/dist/src/build/svelteDeclarations.d.ts +27 -0
- package/dist/src/cli/utils.d.ts +5 -1
- package/dist/src/client/islandResolver.d.ts +3 -1
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/core/islandManifest.d.ts +10 -0
- package/dist/src/core/islandPageContext.d.ts +2 -0
- package/dist/src/dev/svelteDeclarationRefresher.d.ts +6 -0
- package/dist/svelte/browser.js +3 -3
- package/dist/svelte/browser.js.map +3 -3
- package/dist/svelte/index.js +211 -197
- package/dist/svelte/index.js.map +8 -8
- package/dist/svelte/server.js +211 -171
- package/dist/svelte/server.js.map +8 -7
- package/dist/vue/browser.js +3 -3
- package/dist/vue/browser.js.map +3 -3
- package/dist/vue/index.js +231 -217
- package/dist/vue/index.js.map +9 -9
- package/dist/vue/server.js +231 -191
- package/dist/vue/server.js.map +9 -8
- package/package.json +6 -1
- /package/dist/cli/{index-e6ysp900.js → index-z794p5qg.js} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/core/islandManifest.ts", "../src/core/islands.ts", "../src/core/islandMarkupAttributes.ts", "../src/client/preserveIslandMarkup.ts", "../src/react/Island.browser.tsx", "../src/react/createIsland.browser.tsx", "../src/react/hooks/useIslandStore.ts", "../node_modules/zustand/esm/vanilla.mjs", "../node_modules/zustand/esm/middleware.mjs", "../src/client/islandStore.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
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",
|
|
5
|
+
"import type { IslandFramework } from '../../types/island';\n\n/** Manifest key the server injects as the islands bootstrap script on any\n * page with island markers. The build records the configured\n * `islands.bootstrap` (whatever its file name) or a generated default under\n * it — see build/islandBootstrap.ts. */\nexport const ISLAND_BOOTSTRAP_MANIFEST_KEY = 'AbsoluteIslandBootstrap';\n\n/** Key a bootstrap file named `bootstrapClient.*` gets naturally, which is\n * all the server used to look for. Still honored for manifests built\n * before the reserved key existed. */\nexport const LEGACY_ISLAND_BOOTSTRAP_MANIFEST_KEY = 'BootstrapClient';\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 getIslandBootstrapPath = (manifest: Record<string, string>) =>\n\tmanifest[ISLAND_BOOTSTRAP_MANIFEST_KEY] ??\n\tmanifest[LEGACY_ISLAND_BOOTSTRAP_MANIFEST_KEY];\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
8
|
"import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { getIslandMarkerAttributes } from '../core/islandMarkupAttributes';\n\ntype PreservedIslandMarkup = {\n\tattributes: Record<string, string>;\n\tinnerHTML: string;\n};\n\ntype IslandMarkerElement = HTMLElement & {\n\tdataset: DOMStringMap & {\n\t\tcomponent?: string;\n\t\tframework?: string;\n\t\thydrate?: string;\n\t\tisland?: string;\n\t\tislandId?: string;\n\t\tprops?: string;\n\t};\n};\n\nconst getSnapshotMap = () => {\n\tif (typeof window === 'undefined') {\n\t\treturn null;\n\t}\n\n\twindow.__ABS_SERVER_ISLAND_HTML__ ??= new Map<\n\t\tstring,\n\t\tPreservedIslandMarkup[]\n\t>();\n\n\treturn window.__ABS_SERVER_ISLAND_HTML__;\n};\n\nconst getIslandSignature = (props: RuntimeIslandRenderProps) => {\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn [\n\t\tattributes['data-component'],\n\t\tattributes['data-framework'],\n\t\tattributes['data-hydrate'],\n\t\tattributes['data-props']\n\t].join('::');\n};\n\nconst isMatchingIslandElement = (\n\telement: Element,\n\tprops: RuntimeIslandRenderProps\n): element is IslandMarkerElement => {\n\tif (!(element instanceof HTMLElement)) {\n\t\treturn false;\n\t}\n\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn (\n\t\telement.dataset.island === 'true' &&\n\t\telement.dataset.component === attributes['data-component'] &&\n\t\telement.dataset.framework === attributes['data-framework'] &&\n\t\t(element.dataset.hydrate ?? 'load') === attributes['data-hydrate'] &&\n\t\t(element.dataset.props ?? '{}') === attributes['data-props']\n\t);\n};\n\nconst snapshotIslandElement = (\n\telement: HTMLElement,\n\tsnapshotMap: Map<string, PreservedIslandMarkup[]>\n) => {\n\tconst signature = [\n\t\telement.dataset.component,\n\t\telement.dataset.framework,\n\t\telement.dataset.hydrate ?? 'load',\n\t\telement.dataset.props ?? '{}'\n\t].join('::');\n\tconst existing = snapshotMap.get(signature) ?? [];\n\tconst attributes = Object.fromEntries(\n\t\telement\n\t\t\t.getAttributeNames()\n\t\t\t.map((name) => [name, element.getAttribute(name) ?? ''])\n\t);\n\texisting.push({\n\t\tattributes,\n\t\tinnerHTML: element.innerHTML\n\t});\n\tsnapshotMap.set(signature, existing);\n};\n\nexport const initializeIslandMarkupSnapshot = () => {\n\tif (typeof document === 'undefined') {\n\t\treturn;\n\t}\n\n\tconst snapshotMap = getSnapshotMap();\n\tif (!snapshotMap || snapshotMap.size > 0) {\n\t\treturn;\n\t}\n\n\tconst elements = Array.from(\n\t\tdocument.querySelectorAll<HTMLElement>('[data-island=\"true\"]')\n\t);\n\tfor (const element of elements) {\n\t\tsnapshotIslandElement(element, snapshotMap);\n\t}\n};\n\nexport const preserveIslandMarkup = (props: RuntimeIslandRenderProps) => {\n\tif (typeof document === 'undefined') {\n\t\treturn {\n\t\t\tattributes: getIslandMarkerAttributes(props),\n\t\t\tinnerHTML: ''\n\t\t};\n\t}\n\n\tconst snapshotMap = getSnapshotMap();\n\tconst signature = getIslandSignature(props);\n\t// Islands that share a signature (same component, framework, hydrate mode\n\t// and serialized props) produce byte-identical SSR markup, so the first\n\t// captured snapshot is correct for every instance. Returning it\n\t// unconditionally keeps this stateless: React may call the component many\n\t// times during a single hydration (StrictMode double-render, hydration\n\t// retries, mismatch regeneration), and a per-call claim counter would run\n\t// past the snapshot list and yield empty markup — making the host render\n\t// `dangerouslySetInnerHTML={{ __html: '' }}` and wipe the island's\n\t// server-rendered DOM before the island runtime can hydrate it.\n\tconst snapshotCandidate = snapshotMap?.get(signature)?.[0];\n\tif (snapshotCandidate) {\n\t\treturn snapshotCandidate;\n\t}\n\n\t// Snapshot not captured yet (the island runtime module hasn't evaluated):\n\t// fall back to reading the live SSR DOM directly.\n\tconst liveCandidate = Array.from(\n\t\tdocument.querySelectorAll('[data-island=\"true\"]')\n\t).find((element) => isMatchingIslandElement(element, props));\n\tif (!liveCandidate) {\n\t\treturn {\n\t\t\tattributes: getIslandMarkerAttributes(props),\n\t\t\tinnerHTML: ''\n\t\t};\n\t}\n\n\treturn {\n\t\tattributes: Object.fromEntries(\n\t\t\tliveCandidate\n\t\t\t\t.getAttributeNames()\n\t\t\t\t.map((name) => [name, liveCandidate.getAttribute(name) ?? ''])\n\t\t),\n\t\tinnerHTML: liveCandidate.innerHTML\n\t};\n};\n",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...args) => api.dispatch(...args), ...initial };\n};\nconst redux = reduxImpl;\n\nconst shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === \"function\";\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst removeStoreFromTrackedConnections = (name, store) => {\n if (store === void 0) return;\n const connectionInfo = trackedConnections.get(name);\n if (!connectionInfo) return;\n delete connectionInfo.stores[store];\n if (Object.keys(connectionInfo.stores).length === 0) {\n trackedConnections.delete(name);\n }\n};\nconst findCallerName = (stack) => {\n var _a, _b;\n if (!stack) return void 0;\n const traceLines = stack.split(\"\\n\");\n const apiSetStateLineIndex = traceLines.findIndex(\n (traceLine) => traceLine.includes(\"api.setState\")\n );\n if (apiSetStateLineIndex < 0) return void 0;\n const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || \"\";\n return (_b = /.+ (.+) .+/.exec(callerLine)) == null ? void 0 : _b[1];\n};\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);\n let isRecording = true;\n api.setState = ((state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? {\n type: anonymousActionType || findCallerName(new Error().stack) || \"anonymous\"\n } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n });\n api.devtools = {\n cleanup: () => {\n if (connection && typeof connection.unsubscribe === \"function\") {\n connection.unsubscribe();\n }\n removeStoreFromTrackedConnections(options.name, store);\n }\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (shouldDispatchFromDevtools(api)) {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...args) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && args[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...args);\n };\n }\n connection.subscribe((message) => {\n var _a;\n switch (message.type) {\n case \"ACTION\":\n if (typeof message.payload !== \"string\") {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n return parseJsonThen(\n message.payload,\n (action) => {\n if (action.type === \"__setState\") {\n if (store === void 0) {\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (shouldDispatchFromDevtools(api)) {\n api.dispatch(action);\n }\n }\n );\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, fn) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) fn(parsed);\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = ((selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n });\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nfunction combine(initialState, create) {\n return (...args) => Object.assign({}, initialState, create(...args));\n}\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (str instanceof Promise) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n if (result instanceof Promise) {\n return result;\n }\n return {\n then(onFulfilled) {\n return toThenable(onFulfilled)(result);\n },\n catch(_onRejected) {\n return this;\n }\n };\n } catch (e) {\n return {\n then(_onFulfilled) {\n return this;\n },\n catch(onRejected) {\n return toThenable(onRejected)(e);\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => window.localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n let hydrationVersion = 0;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (state, replace) => {\n savedSetState(state, replace);\n return setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n return setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n const currentVersion = ++hydrationVersion;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n const migration = options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n );\n if (migration instanceof Promise) {\n return migration.then((result) => [true, result]);\n }\n return [true, migration];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n if (currentVersion !== hydrationVersion) {\n return;\n }\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).catch((e) => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n });\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => hydrate(),\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nfunction ssrSafe(config, isSSR = typeof window === \"undefined\") {\n return (set, get, api) => {\n if (!isSSR) {\n return config(set, get, api);\n }\n const ssrSet = () => {\n throw new Error(\"Cannot set state of Zustand store in SSR\");\n };\n api.setState = ssrSet;\n return config(ssrSet, get, api);\n };\n}\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector, ssrSafe as unstable_ssrSafe };\n",
|
|
14
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\nexport const ABSOLUTE_ISLAND_STATE = '__ABS_ISLAND_STATE__';\nexport const ABSOLUTE_ISLAND_STORES = '__ABS_ISLAND_STORES__';\n\ndeclare global {\n\tvar __ABS_ISLAND_STATE__: IslandStateSnapshot | undefined;\n\tvar __ABS_ISLAND_STORES__:\n\t\tMap<string, Set<IslandStoreInstance>> | 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"
|
|
15
15
|
],
|
|
16
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
17
|
-
"debugId": "
|
|
16
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMa,gCAAgC,2BAKhC,uCAAuC,m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, res, err) => () => {
|
|
|
72
72
|
};
|
|
73
73
|
var __require = import.meta.require;
|
|
74
74
|
|
|
75
|
+
// src/constants.ts
|
|
76
|
+
var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", TAILWIND_BUN_CSS_WARNING_PATTERN, BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_RELOAD_BACKOFF_BASE_MS = 1000, CSS_RELOAD_BACKOFF_MAX_MS = 60000, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, ESLINT_STUDIO_DEFAULT_HOST = "eslint.absolute.localhost", ESLINT_STUDIO_DEFAULT_PORT = 4099, CONFIG_DEFAULT_HOST = "config.absolute.localhost", CONFIG_DEFAULT_PORT = 4099, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HTTP_STATUS_GONE = 410, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, INSTANCE_PROBE_TIMEOUT_MS = 250, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, LIST_LOG_TAIL_MAX_BYTES = 65536, LIST_TUI_COLUMN_GAP = 2, LIST_TUI_DEFAULT_HEIGHT = 28, LIST_TUI_DEFAULT_WIDTH = 100, LIST_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, LIST_TUI_FOOTER_LINE_COUNT = 2, LIST_TUI_MARKER_WIDTH = 2, LIST_TUI_MIN_LOG_HEIGHT = 3, LIST_TUI_MIN_URL_WIDTH = 16, LIST_TUI_RENDER_DEBOUNCE_MS = 16, LIST_TUI_STATUS_MESSAGE_TIMEOUT_MS = 4000, LIST_WATCH_REFRESH_MS = 1000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, DEFAULT_WEBSOCKET_IDLE_TIMEOUT_SECONDS = 240, DEFAULT_HTTP_IDLE_TIMEOUT_SECONDS = 240, MAX_HTTP_IDLE_TIMEOUT_SECONDS = 255, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
|
|
77
|
+
var init_constants = __esm(() => {
|
|
78
|
+
TAILWIND_BUN_CSS_WARNING_PATTERN = /invalid @ rule encountered: '@(theme|tailwind|source|utility|variant|custom-variant|apply|reference|plugin|config)'/;
|
|
79
|
+
IMAGE_DEFAULT_DEVICE_SIZES = [
|
|
80
|
+
640,
|
|
81
|
+
750,
|
|
82
|
+
828,
|
|
83
|
+
1080,
|
|
84
|
+
1200,
|
|
85
|
+
1920,
|
|
86
|
+
2048,
|
|
87
|
+
3840
|
|
88
|
+
];
|
|
89
|
+
IMAGE_DEFAULT_IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
90
|
+
MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
|
|
91
|
+
MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
|
|
92
|
+
TWO_THIRDS = 2 / 3;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// src/utils/getDurationString.ts
|
|
96
|
+
var getDurationString = (duration) => {
|
|
97
|
+
let durationString;
|
|
98
|
+
if (duration < MILLISECONDS_IN_A_SECOND) {
|
|
99
|
+
durationString = `${duration.toFixed(TIME_PRECISION)}ms`;
|
|
100
|
+
} else if (duration < MILLISECONDS_IN_A_MINUTE) {
|
|
101
|
+
durationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;
|
|
102
|
+
} else {
|
|
103
|
+
const totalSeconds = Math.round(duration / MILLISECONDS_IN_A_SECOND);
|
|
104
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
105
|
+
const seconds = totalSeconds % 60;
|
|
106
|
+
durationString = seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;
|
|
107
|
+
}
|
|
108
|
+
return durationString;
|
|
109
|
+
};
|
|
110
|
+
var init_getDurationString = __esm(() => {
|
|
111
|
+
init_constants();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// src/utils/startupBanner.ts
|
|
115
|
+
var colors, MONTHS, formatTimestamp = () => {
|
|
116
|
+
const now = new Date;
|
|
117
|
+
const month = MONTHS[now.getMonth()];
|
|
118
|
+
const day = now.getDate().toString().padStart(2, "0");
|
|
119
|
+
let hours = now.getHours();
|
|
120
|
+
const minutes = now.getMinutes().toString().padStart(2, "0");
|
|
121
|
+
const seconds = now.getSeconds().toString().padStart(2, "0");
|
|
122
|
+
const ampm = hours >= HOURS_IN_HALF_DAY ? "PM" : "AM";
|
|
123
|
+
hours = hours % HOURS_IN_HALF_DAY || HOURS_IN_HALF_DAY;
|
|
124
|
+
return `${month} ${day} ${hours}:${minutes}:${seconds} ${ampm}`;
|
|
125
|
+
}, startupBanner = (options) => {
|
|
126
|
+
const {
|
|
127
|
+
version,
|
|
128
|
+
readyDuration,
|
|
129
|
+
buildDuration,
|
|
130
|
+
port,
|
|
131
|
+
host,
|
|
132
|
+
networkUrl,
|
|
133
|
+
mobilePreviewUrl,
|
|
134
|
+
protocol = "http"
|
|
135
|
+
} = options;
|
|
136
|
+
const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
|
|
137
|
+
const ver = `${colors.dim}v${version}${colors.reset}`;
|
|
138
|
+
const time = `${colors.dim}ready in${colors.reset} ${colors.bold}${getDurationString(readyDuration)}${colors.reset}`;
|
|
139
|
+
const build = typeof buildDuration === "number" && Number.isFinite(buildDuration) ? ` ${colors.dim}(build ${getDurationString(buildDuration)})${colors.reset}` : "";
|
|
140
|
+
console.log("");
|
|
141
|
+
console.log(` ${name} ${ver} ${time}${build}`);
|
|
142
|
+
console.log("");
|
|
143
|
+
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} ${protocol}://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
|
|
144
|
+
if (networkUrl) {
|
|
145
|
+
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
|
|
146
|
+
}
|
|
147
|
+
if (mobilePreviewUrl) {
|
|
148
|
+
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Mobile:${colors.reset} ${mobilePreviewUrl}`);
|
|
149
|
+
}
|
|
150
|
+
console.log("");
|
|
151
|
+
};
|
|
152
|
+
var init_startupBanner = __esm(() => {
|
|
153
|
+
init_constants();
|
|
154
|
+
init_getDurationString();
|
|
155
|
+
colors = {
|
|
156
|
+
bold: "\x1B[1m",
|
|
157
|
+
cyan: "\x1B[36m",
|
|
158
|
+
dim: "\x1B[2m",
|
|
159
|
+
green: "\x1B[32m",
|
|
160
|
+
reset: "\x1B[0m"
|
|
161
|
+
};
|
|
162
|
+
MONTHS = [
|
|
163
|
+
"Jan",
|
|
164
|
+
"Feb",
|
|
165
|
+
"Mar",
|
|
166
|
+
"Apr",
|
|
167
|
+
"May",
|
|
168
|
+
"Jun",
|
|
169
|
+
"Jul",
|
|
170
|
+
"Aug",
|
|
171
|
+
"Sep",
|
|
172
|
+
"Oct",
|
|
173
|
+
"Nov",
|
|
174
|
+
"Dec"
|
|
175
|
+
];
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// src/utils/logger.ts
|
|
179
|
+
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
180
|
+
const cwd = process.cwd();
|
|
181
|
+
let relative = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
182
|
+
relative = relative.replace(/\\/g, "/");
|
|
183
|
+
if (!relative.startsWith("/")) {
|
|
184
|
+
relative = `/${relative}`;
|
|
185
|
+
}
|
|
186
|
+
return relative;
|
|
187
|
+
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
188
|
+
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
189
|
+
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
190
|
+
let message = action;
|
|
191
|
+
if (options?.path) {
|
|
192
|
+
const pathColor = options.framework ? getFrameworkColor(options.framework) : colors2.white;
|
|
193
|
+
message += ` ${pathColor}${formatPath(options.path)}${colors2.reset}`;
|
|
194
|
+
}
|
|
195
|
+
if (options?.duration !== undefined) {
|
|
196
|
+
message += ` ${colors2.dim}(${options.duration}ms)${colors2.reset}`;
|
|
197
|
+
}
|
|
198
|
+
console.log(`${timestamp} ${tag} ${message}`);
|
|
199
|
+
}, logCssUpdate = (path, framework, duration) => {
|
|
200
|
+
log("css update", { duration, framework: framework ?? "css", path });
|
|
201
|
+
}, logError = (message, error) => {
|
|
202
|
+
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
203
|
+
const tag = `${colors2.red}[hmr]${colors2.reset}`;
|
|
204
|
+
const errorMsg = error instanceof Error ? error.message : error;
|
|
205
|
+
const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
|
|
206
|
+
console.error(`${timestamp} ${tag} ${fullMessage}`);
|
|
207
|
+
}, logHmrClientUpdate = (path, framework, duration, target, serverMs, clientMs, outcome = "applied", kind) => {
|
|
208
|
+
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
209
|
+
const targetLabel = target.startsWith("capacitor-") ? target.slice("capacitor-".length) : target;
|
|
210
|
+
const tag = `${colors2.cyan}[hmr:${targetLabel}]${colors2.reset}`;
|
|
211
|
+
const pathColor = framework ? getFrameworkColor(framework) : colors2.white;
|
|
212
|
+
const breakdown = serverMs === undefined || clientMs === undefined ? "" : `; server ${serverMs}ms, client ${clientMs}ms`;
|
|
213
|
+
let action = "failed after";
|
|
214
|
+
if (outcome === "applied")
|
|
215
|
+
action = "applied in";
|
|
216
|
+
else if (outcome === "reloaded")
|
|
217
|
+
action = "falling back to reload after";
|
|
218
|
+
const kindLabel = kind ? `${kind} ` : "";
|
|
219
|
+
console.log(`${timestamp} ${tag} ${framework ?? "update"} ${kindLabel}${pathColor}${formatPath(path)}${colors2.reset} ${colors2.dim}${action} ${duration}ms${breakdown}${colors2.reset}`);
|
|
220
|
+
}, logHmrUpdate = (path, framework, duration) => {
|
|
221
|
+
log("hmr update", { duration, framework, path });
|
|
222
|
+
}, logInfo = (message) => {
|
|
223
|
+
log(message);
|
|
224
|
+
}, logPageBuild = (path, framework, duration) => {
|
|
225
|
+
log("page build", { duration, framework, path });
|
|
226
|
+
}, logScriptUpdate = (path, framework, duration) => {
|
|
227
|
+
log("script update", { duration, framework, path });
|
|
228
|
+
}, logServerReload = () => {
|
|
229
|
+
log(`${colors2.cyan}server module reloaded${colors2.reset}`);
|
|
230
|
+
}, logWarn = (message) => {
|
|
231
|
+
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
232
|
+
const tag = `${colors2.yellow}[hmr]${colors2.reset}`;
|
|
233
|
+
console.log(`${timestamp} ${tag} ${colors2.yellow}warning ${message}${colors2.reset}`);
|
|
234
|
+
};
|
|
235
|
+
var init_logger = __esm(() => {
|
|
236
|
+
init_startupBanner();
|
|
237
|
+
colors2 = {
|
|
238
|
+
blue: "\x1B[34m",
|
|
239
|
+
bold: "\x1B[1m",
|
|
240
|
+
cyan: "\x1B[36m",
|
|
241
|
+
dim: "\x1B[2m",
|
|
242
|
+
green: "\x1B[32m",
|
|
243
|
+
magenta: "\x1B[35m",
|
|
244
|
+
red: "\x1B[31m",
|
|
245
|
+
reset: "\x1B[0m",
|
|
246
|
+
white: "\x1B[37m",
|
|
247
|
+
yellow: "\x1B[33m"
|
|
248
|
+
};
|
|
249
|
+
frameworkColors = {
|
|
250
|
+
angular: colors2.magenta,
|
|
251
|
+
assets: colors2.dim,
|
|
252
|
+
css: colors2.cyan,
|
|
253
|
+
html: colors2.white,
|
|
254
|
+
htmx: colors2.white,
|
|
255
|
+
react: colors2.blue,
|
|
256
|
+
svelte: colors2.yellow,
|
|
257
|
+
vue: colors2.green
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// src/core/islandManifest.ts
|
|
262
|
+
var ISLAND_BOOTSTRAP_MANIFEST_KEY = "AbsoluteIslandBootstrap", LEGACY_ISLAND_BOOTSTRAP_MANIFEST_KEY = "BootstrapClient", toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
|
|
263
|
+
const entries = {};
|
|
264
|
+
let found = false;
|
|
265
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
266
|
+
if (!key.startsWith(prefix))
|
|
267
|
+
continue;
|
|
268
|
+
const component = key.slice(prefix.length);
|
|
269
|
+
if (!component)
|
|
270
|
+
continue;
|
|
271
|
+
entries[component] = value;
|
|
272
|
+
found = true;
|
|
273
|
+
}
|
|
274
|
+
return found ? entries : undefined;
|
|
275
|
+
}, getIslandBootstrapPath = (manifest) => manifest[ISLAND_BOOTSTRAP_MANIFEST_KEY] ?? manifest[LEGACY_ISLAND_BOOTSTRAP_MANIFEST_KEY], getIslandManifestEntries = (manifest) => {
|
|
276
|
+
const islands = {};
|
|
277
|
+
const frameworks = ["react", "svelte", "vue", "angular"];
|
|
278
|
+
for (const framework of frameworks) {
|
|
279
|
+
const prefix = `Island${toIslandFrameworkSegment(framework)}`;
|
|
280
|
+
const entries = collectFrameworkIslands(manifest, prefix);
|
|
281
|
+
if (entries)
|
|
282
|
+
islands[framework] = entries;
|
|
283
|
+
}
|
|
284
|
+
return islands;
|
|
285
|
+
}, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
286
|
+
|
|
75
287
|
// src/core/islandPageContext.ts
|
|
76
|
-
var
|
|
288
|
+
var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__", ISLAND_STATE_MARKER = "__ABS_ISLAND_STATE__", CLOSING_HEAD_TAG = "</head>", warnedMissingBootstrap = false, warnIfBootstrapMissing = (manifest) => {
|
|
289
|
+
if (warnedMissingBootstrap || getIslandBootstrapPath(manifest))
|
|
290
|
+
return;
|
|
291
|
+
if (false)
|
|
292
|
+
;
|
|
293
|
+
warnedMissingBootstrap = true;
|
|
294
|
+
logWarn("A page contains islands, but the build manifest has no islands bootstrap, so they will render without hydrating. Set `islands.registry` in absolute.config.ts (a default bootstrap is generated from it) or point `islands.bootstrap` at a file that calls startIslands().");
|
|
295
|
+
}, buildIslandsHeadMarkup = (manifest) => {
|
|
77
296
|
const manifestScript = `<script>window.__ABSOLUTE_MANIFEST__ = ${JSON.stringify(manifest)}</script>`;
|
|
78
297
|
const islandStateScript = `<script>window.__ABS_ISLAND_STATE__ = ${JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {})}</script>`;
|
|
79
|
-
const bootstrapPath = manifest
|
|
298
|
+
const bootstrapPath = getIslandBootstrapPath(manifest);
|
|
80
299
|
const bootstrapScript = bootstrapPath ? `<script type="module" src="${bootstrapPath}"></script>` : "";
|
|
81
300
|
return `${manifestScript}${islandStateScript}${bootstrapScript}`;
|
|
82
301
|
}, injectHeadMarkup = (html, markup) => {
|
|
@@ -178,7 +397,7 @@ var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient", ISLAND_MARKER = 'data-island="tr
|
|
|
178
397
|
}
|
|
179
398
|
}
|
|
180
399
|
});
|
|
181
|
-
}, pipeStreamWithIslandMarkerDetection = (stream, markup) => {
|
|
400
|
+
}, pipeStreamWithIslandMarkerDetection = (stream, markup, onIslandsDetected) => {
|
|
182
401
|
const encoder = new TextEncoder;
|
|
183
402
|
const decoder = new TextDecoder;
|
|
184
403
|
const headLookbehind = CLOSING_HEAD_TAG.length - 1;
|
|
@@ -191,6 +410,7 @@ var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient", ISLAND_MARKER = 'data-island="tr
|
|
|
191
410
|
if (!held.includes(ISLAND_MARKER)) {
|
|
192
411
|
return { held, injected: false, pending: "", sawHead: true };
|
|
193
412
|
}
|
|
413
|
+
onIslandsDetected();
|
|
194
414
|
enqueue(controller, `${markup}${held}`);
|
|
195
415
|
return { held: "", injected: true, pending: "", sawHead: true };
|
|
196
416
|
};
|
|
@@ -258,6 +478,7 @@ var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient", ISLAND_MARKER = 'data-island="tr
|
|
|
258
478
|
if (html.includes(MANIFEST_MARKER) || html.includes(ISLAND_STATE_MARKER)) {
|
|
259
479
|
return html;
|
|
260
480
|
}
|
|
481
|
+
warnIfBootstrapMissing(manifest);
|
|
261
482
|
return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest));
|
|
262
483
|
}, injectIslandPageContextStream = (stream, options) => {
|
|
263
484
|
const manifest = globalThis.__absoluteManifest;
|
|
@@ -265,15 +486,19 @@ var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient", ISLAND_MARKER = 'data-island="tr
|
|
|
265
486
|
return stream;
|
|
266
487
|
const markup = buildIslandsHeadMarkup(manifest);
|
|
267
488
|
if (options?.hasIslands === true) {
|
|
489
|
+
warnIfBootstrapMissing(manifest);
|
|
268
490
|
return pipeStreamWithHeadInjection(stream, markup);
|
|
269
491
|
}
|
|
270
492
|
if (options?.hasIslands === false) {
|
|
271
493
|
return stream;
|
|
272
494
|
}
|
|
273
|
-
return pipeStreamWithIslandMarkerDetection(stream, markup);
|
|
495
|
+
return pipeStreamWithIslandMarkerDetection(stream, markup, () => warnIfBootstrapMissing(manifest));
|
|
274
496
|
}, setCurrentIslandManifest = (manifest) => {
|
|
275
497
|
globalThis.__absoluteManifest = manifest;
|
|
276
498
|
};
|
|
499
|
+
var init_islandPageContext = __esm(() => {
|
|
500
|
+
init_logger();
|
|
501
|
+
});
|
|
277
502
|
|
|
278
503
|
// src/core/devRouteRegistrationCallsite.ts
|
|
279
504
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -1025,26 +1250,6 @@ var streamSwapRuntime = () => {
|
|
|
1025
1250
|
return value.slice(start + 1, end);
|
|
1026
1251
|
}, getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(streamSwapRuntime.toString())}})();`;
|
|
1027
1252
|
|
|
1028
|
-
// src/constants.ts
|
|
1029
|
-
var ANGULAR_INIT_TIMEOUT_MS = 500, ANSI_ESCAPE_CODE = 27, ANSI_ESCAPE_LENGTH = 3, ASCII_SPACE = 32, BASE_36_RADIX = 36, BUN_BUILD_WARNING_SUPPRESSION = "wildcard sideEffects are not supported yet", TAILWIND_BUN_CSS_WARNING_PATTERN, BODY_SLICE_LENGTH = 2000, BYTES_PER_KILOBYTE = 1024, CLI_ARGS_OFFSET = 3, CSS_ERROR_RESOLVE_DELAY_MS = 50, CSS_MAX_CHECK_ATTEMPTS = 10, CSS_MAX_PARSE_TIMEOUT_MS = 500, CSS_RELOAD_BACKOFF_BASE_MS = 1000, CSS_RELOAD_BACKOFF_MAX_MS = 60000, CSS_SHEET_READY_TIMEOUT_MS = 100, DEFAULT_CHUNK_SIZE = 16384, DEFAULT_DEBOUNCE_MS = 15, DEFAULT_PORT = 3000, DEV_SERVER_RESTART_DEBOUNCE_MS = 100, DOM_UPDATE_DELAY_MS = 50, FILE_PROTOCOL_PREFIX_LENGTH = 7, FOCUS_ID_PREFIX_LENGTH = 3, FOCUS_IDX_PREFIX_LENGTH = 4, FOCUS_NAME_PREFIX_LENGTH = 5, ESLINT_STUDIO_DEFAULT_HOST = "eslint.absolute.localhost", ESLINT_STUDIO_DEFAULT_PORT = 4099, CONFIG_DEFAULT_HOST = "config.absolute.localhost", CONFIG_DEFAULT_PORT = 4099, HMR_UPDATE_TIMEOUT_MS = 2000, HOOK_SIGNATURE_LENGTH = 12, EXCLUDE_LAST_OFFSET = -1, HTTP_STATUS_OK = 200, HTTP_STATUS_BAD_REQUEST = 400, HTTP_STATUS_NOT_FOUND = 404, HTTP_STATUS_GONE = 410, HOURS_IN_DAY = 24, HOURS_IN_HALF_DAY = 12, IMAGE_DEFAULT_DEVICE_SIZES, IMAGE_DEFAULT_IMAGE_SIZES, IMAGE_DEFAULT_QUALITY = 75, IMAGE_GLOB_SUFFIX_LENGTH = 2, INSTANCE_PROBE_TIMEOUT_MS = 250, MAX_ERROR_LENGTH = 200, MAX_RECONNECT_ATTEMPTS = 60, MILLISECONDS_IN_A_SECOND = 1000, MINUTES_IN_AN_HOUR = 60, SECONDS_IN_A_MINUTE = 60, MILLISECONDS_IN_A_MINUTE, MILLISECONDS_IN_A_DAY, OVERLAY_FADE_DURATION_MS = 150, PING_INTERVAL_MS = 30000, LIST_LOG_TAIL_MAX_BYTES = 65536, LIST_TUI_COLUMN_GAP = 2, LIST_TUI_DEFAULT_HEIGHT = 28, LIST_TUI_DEFAULT_WIDTH = 100, LIST_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, LIST_TUI_FOOTER_LINE_COUNT = 2, LIST_TUI_MARKER_WIDTH = 2, LIST_TUI_MIN_LOG_HEIGHT = 3, LIST_TUI_MIN_URL_WIDTH = 16, LIST_TUI_RENDER_DEBOUNCE_MS = 16, LIST_TUI_STATUS_MESSAGE_TIMEOUT_MS = 4000, LIST_WATCH_REFRESH_MS = 1000, RAF_BATCH_COUNT = 3, RANDOM_ID_END_INDEX = 11, REBUILD_BATCH_DELAY_MS = 10, REBUILD_RELOAD_DELAY_MS = 200, RECONNECT_INITIAL_DELAY_MS = 500, RECONNECT_POLL_INTERVAL_MS = 300, REACT_STREAM_SLOT_FAST_DELAY_MS = 5, REACT_STREAM_SLOT_SLOW_DELAY_MS = 20, SIGINT_EXIT_CODE = 130, SIGTERM_EXIT_CODE = 143, SVELTE_CSS_LOAD_TIMEOUT_MS = 500, TIME_PRECISION = 2, TWO_THIRDS, UNFOUND_INDEX = -1, WEBSOCKET_NORMAL_CLOSURE = 1000, DEFAULT_WEBSOCKET_IDLE_TIMEOUT_SECONDS = 240, DEFAULT_HTTP_IDLE_TIMEOUT_SECONDS = 240, MAX_HTTP_IDLE_TIMEOUT_SECONDS = 255, WORKSPACE_COMMAND_ARGS_OFFSET = 3, WORKSPACE_FAILURE_LOG_PRINT_LIMIT = 30, WORKSPACE_FAILURE_RECENT_LOG_LIMIT = 60, WORKSPACE_READY_ATTEMPT_TIMEOUT_MS = 5000, WORKSPACE_READY_PROBE_INTERVAL_MS = 250, WORKSPACE_READY_TIMEOUT_MS = 30000, WORKSPACE_SHUTDOWN_TIMEOUT_MS = 1e4, WORKSPACE_TUI_DEFAULT_HEIGHT = 28, WORKSPACE_TUI_DEFAULT_WIDTH = 100, WORKSPACE_TUI_ESCAPE_SEQUENCE_TIMEOUT_MS = 30, WORKSPACE_TUI_FOOTER_LINE_COUNT = 3, WORKSPACE_TUI_MIN_LOG_HEIGHT = 3, WORKSPACE_TUI_MIN_SERVICE_NAME_WIDTH = 7, WORKSPACE_TUI_MIN_TARGET_WIDTH = 8, WORKSPACE_TUI_MIN_WRAP_WIDTH = 12, WORKSPACE_TUI_PROMPT_CURSOR_OFFSET = 3, WORKSPACE_TUI_RECENT_LOG_LIMIT = 40, WORKSPACE_TUI_RENDER_DEBOUNCE_MS = 16, WORKSPACE_TUI_STATUS_WIDTH = 10, WORKSPACE_TUI_TARGET_PADDING_WIDTH = 6, WORKSPACE_TUI_VISIBILITY_WIDTH = 8;
|
|
1030
|
-
var init_constants = __esm(() => {
|
|
1031
|
-
TAILWIND_BUN_CSS_WARNING_PATTERN = /invalid @ rule encountered: '@(theme|tailwind|source|utility|variant|custom-variant|apply|reference|plugin|config)'/;
|
|
1032
|
-
IMAGE_DEFAULT_DEVICE_SIZES = [
|
|
1033
|
-
640,
|
|
1034
|
-
750,
|
|
1035
|
-
828,
|
|
1036
|
-
1080,
|
|
1037
|
-
1200,
|
|
1038
|
-
1920,
|
|
1039
|
-
2048,
|
|
1040
|
-
3840
|
|
1041
|
-
];
|
|
1042
|
-
IMAGE_DEFAULT_IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
1043
|
-
MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE;
|
|
1044
|
-
MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR * HOURS_IN_DAY;
|
|
1045
|
-
TWO_THIRDS = 2 / 3;
|
|
1046
|
-
});
|
|
1047
|
-
|
|
1048
1253
|
// src/utils/escapeScriptContent.ts
|
|
1049
1254
|
var ESCAPE_LOOKUP, ESCAPE_REGEX, escapeScriptContent = (content) => content.replace(ESCAPE_REGEX, (char) => {
|
|
1050
1255
|
const escaped = ESCAPE_LOOKUP[char];
|
|
@@ -1613,172 +1818,6 @@ var init_streamingSlots = __esm(() => {
|
|
|
1613
1818
|
};
|
|
1614
1819
|
});
|
|
1615
1820
|
|
|
1616
|
-
// src/utils/getDurationString.ts
|
|
1617
|
-
var getDurationString = (duration) => {
|
|
1618
|
-
let durationString;
|
|
1619
|
-
if (duration < MILLISECONDS_IN_A_SECOND) {
|
|
1620
|
-
durationString = `${duration.toFixed(TIME_PRECISION)}ms`;
|
|
1621
|
-
} else if (duration < MILLISECONDS_IN_A_MINUTE) {
|
|
1622
|
-
durationString = `${(duration / MILLISECONDS_IN_A_SECOND).toFixed(TIME_PRECISION)}s`;
|
|
1623
|
-
} else {
|
|
1624
|
-
const totalSeconds = Math.round(duration / MILLISECONDS_IN_A_SECOND);
|
|
1625
|
-
const minutes = Math.floor(totalSeconds / 60);
|
|
1626
|
-
const seconds = totalSeconds % 60;
|
|
1627
|
-
durationString = seconds === 0 ? `${minutes}m` : `${minutes}m ${seconds}s`;
|
|
1628
|
-
}
|
|
1629
|
-
return durationString;
|
|
1630
|
-
};
|
|
1631
|
-
var init_getDurationString = __esm(() => {
|
|
1632
|
-
init_constants();
|
|
1633
|
-
});
|
|
1634
|
-
|
|
1635
|
-
// src/utils/startupBanner.ts
|
|
1636
|
-
var colors, MONTHS, formatTimestamp = () => {
|
|
1637
|
-
const now = new Date;
|
|
1638
|
-
const month = MONTHS[now.getMonth()];
|
|
1639
|
-
const day = now.getDate().toString().padStart(2, "0");
|
|
1640
|
-
let hours = now.getHours();
|
|
1641
|
-
const minutes = now.getMinutes().toString().padStart(2, "0");
|
|
1642
|
-
const seconds = now.getSeconds().toString().padStart(2, "0");
|
|
1643
|
-
const ampm = hours >= HOURS_IN_HALF_DAY ? "PM" : "AM";
|
|
1644
|
-
hours = hours % HOURS_IN_HALF_DAY || HOURS_IN_HALF_DAY;
|
|
1645
|
-
return `${month} ${day} ${hours}:${minutes}:${seconds} ${ampm}`;
|
|
1646
|
-
}, startupBanner = (options) => {
|
|
1647
|
-
const {
|
|
1648
|
-
version,
|
|
1649
|
-
readyDuration,
|
|
1650
|
-
buildDuration,
|
|
1651
|
-
port,
|
|
1652
|
-
host,
|
|
1653
|
-
networkUrl,
|
|
1654
|
-
mobilePreviewUrl,
|
|
1655
|
-
protocol = "http"
|
|
1656
|
-
} = options;
|
|
1657
|
-
const name = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset}`;
|
|
1658
|
-
const ver = `${colors.dim}v${version}${colors.reset}`;
|
|
1659
|
-
const time = `${colors.dim}ready in${colors.reset} ${colors.bold}${getDurationString(readyDuration)}${colors.reset}`;
|
|
1660
|
-
const build = typeof buildDuration === "number" && Number.isFinite(buildDuration) ? ` ${colors.dim}(build ${getDurationString(buildDuration)})${colors.reset}` : "";
|
|
1661
|
-
console.log("");
|
|
1662
|
-
console.log(` ${name} ${ver} ${time}${build}`);
|
|
1663
|
-
console.log("");
|
|
1664
|
-
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Local:${colors.reset} ${protocol}://${host === "0.0.0.0" ? "localhost" : host}:${port}/`);
|
|
1665
|
-
if (networkUrl) {
|
|
1666
|
-
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Network:${colors.reset} ${networkUrl}`);
|
|
1667
|
-
}
|
|
1668
|
-
if (mobilePreviewUrl) {
|
|
1669
|
-
console.log(` ${colors.green}\u279C${colors.reset} ${colors.bold}Mobile:${colors.reset} ${mobilePreviewUrl}`);
|
|
1670
|
-
}
|
|
1671
|
-
console.log("");
|
|
1672
|
-
};
|
|
1673
|
-
var init_startupBanner = __esm(() => {
|
|
1674
|
-
init_constants();
|
|
1675
|
-
init_getDurationString();
|
|
1676
|
-
colors = {
|
|
1677
|
-
bold: "\x1B[1m",
|
|
1678
|
-
cyan: "\x1B[36m",
|
|
1679
|
-
dim: "\x1B[2m",
|
|
1680
|
-
green: "\x1B[32m",
|
|
1681
|
-
reset: "\x1B[0m"
|
|
1682
|
-
};
|
|
1683
|
-
MONTHS = [
|
|
1684
|
-
"Jan",
|
|
1685
|
-
"Feb",
|
|
1686
|
-
"Mar",
|
|
1687
|
-
"Apr",
|
|
1688
|
-
"May",
|
|
1689
|
-
"Jun",
|
|
1690
|
-
"Jul",
|
|
1691
|
-
"Aug",
|
|
1692
|
-
"Sep",
|
|
1693
|
-
"Oct",
|
|
1694
|
-
"Nov",
|
|
1695
|
-
"Dec"
|
|
1696
|
-
];
|
|
1697
|
-
});
|
|
1698
|
-
|
|
1699
|
-
// src/utils/logger.ts
|
|
1700
|
-
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
1701
|
-
const cwd = process.cwd();
|
|
1702
|
-
let relative = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
1703
|
-
relative = relative.replace(/\\/g, "/");
|
|
1704
|
-
if (!relative.startsWith("/")) {
|
|
1705
|
-
relative = `/${relative}`;
|
|
1706
|
-
}
|
|
1707
|
-
return relative;
|
|
1708
|
-
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
1709
|
-
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1710
|
-
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
1711
|
-
let message = action;
|
|
1712
|
-
if (options?.path) {
|
|
1713
|
-
const pathColor = options.framework ? getFrameworkColor(options.framework) : colors2.white;
|
|
1714
|
-
message += ` ${pathColor}${formatPath(options.path)}${colors2.reset}`;
|
|
1715
|
-
}
|
|
1716
|
-
if (options?.duration !== undefined) {
|
|
1717
|
-
message += ` ${colors2.dim}(${options.duration}ms)${colors2.reset}`;
|
|
1718
|
-
}
|
|
1719
|
-
console.log(`${timestamp} ${tag} ${message}`);
|
|
1720
|
-
}, logCssUpdate = (path, framework, duration) => {
|
|
1721
|
-
log("css update", { duration, framework: framework ?? "css", path });
|
|
1722
|
-
}, logError = (message, error) => {
|
|
1723
|
-
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1724
|
-
const tag = `${colors2.red}[hmr]${colors2.reset}`;
|
|
1725
|
-
const errorMsg = error instanceof Error ? error.message : error;
|
|
1726
|
-
const fullMessage = `${colors2.red}error${colors2.reset} ${message}${errorMsg ? `: ${errorMsg}` : ""}`;
|
|
1727
|
-
console.error(`${timestamp} ${tag} ${fullMessage}`);
|
|
1728
|
-
}, logHmrClientUpdate = (path, framework, duration, target, serverMs, clientMs, outcome = "applied", kind) => {
|
|
1729
|
-
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1730
|
-
const targetLabel = target.startsWith("capacitor-") ? target.slice("capacitor-".length) : target;
|
|
1731
|
-
const tag = `${colors2.cyan}[hmr:${targetLabel}]${colors2.reset}`;
|
|
1732
|
-
const pathColor = framework ? getFrameworkColor(framework) : colors2.white;
|
|
1733
|
-
const breakdown = serverMs === undefined || clientMs === undefined ? "" : `; server ${serverMs}ms, client ${clientMs}ms`;
|
|
1734
|
-
let action = "failed after";
|
|
1735
|
-
if (outcome === "applied")
|
|
1736
|
-
action = "applied in";
|
|
1737
|
-
else if (outcome === "reloaded")
|
|
1738
|
-
action = "falling back to reload after";
|
|
1739
|
-
const kindLabel = kind ? `${kind} ` : "";
|
|
1740
|
-
console.log(`${timestamp} ${tag} ${framework ?? "update"} ${kindLabel}${pathColor}${formatPath(path)}${colors2.reset} ${colors2.dim}${action} ${duration}ms${breakdown}${colors2.reset}`);
|
|
1741
|
-
}, logHmrUpdate = (path, framework, duration) => {
|
|
1742
|
-
log("hmr update", { duration, framework, path });
|
|
1743
|
-
}, logInfo = (message) => {
|
|
1744
|
-
log(message);
|
|
1745
|
-
}, logPageBuild = (path, framework, duration) => {
|
|
1746
|
-
log("page build", { duration, framework, path });
|
|
1747
|
-
}, logScriptUpdate = (path, framework, duration) => {
|
|
1748
|
-
log("script update", { duration, framework, path });
|
|
1749
|
-
}, logServerReload = () => {
|
|
1750
|
-
log(`${colors2.cyan}server module reloaded${colors2.reset}`);
|
|
1751
|
-
}, logWarn = (message) => {
|
|
1752
|
-
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1753
|
-
const tag = `${colors2.yellow}[hmr]${colors2.reset}`;
|
|
1754
|
-
console.log(`${timestamp} ${tag} ${colors2.yellow}warning ${message}${colors2.reset}`);
|
|
1755
|
-
};
|
|
1756
|
-
var init_logger = __esm(() => {
|
|
1757
|
-
init_startupBanner();
|
|
1758
|
-
colors2 = {
|
|
1759
|
-
blue: "\x1B[34m",
|
|
1760
|
-
bold: "\x1B[1m",
|
|
1761
|
-
cyan: "\x1B[36m",
|
|
1762
|
-
dim: "\x1B[2m",
|
|
1763
|
-
green: "\x1B[32m",
|
|
1764
|
-
magenta: "\x1B[35m",
|
|
1765
|
-
red: "\x1B[31m",
|
|
1766
|
-
reset: "\x1B[0m",
|
|
1767
|
-
white: "\x1B[37m",
|
|
1768
|
-
yellow: "\x1B[33m"
|
|
1769
|
-
};
|
|
1770
|
-
frameworkColors = {
|
|
1771
|
-
angular: colors2.magenta,
|
|
1772
|
-
assets: colors2.dim,
|
|
1773
|
-
css: colors2.cyan,
|
|
1774
|
-
html: colors2.white,
|
|
1775
|
-
htmx: colors2.white,
|
|
1776
|
-
react: colors2.blue,
|
|
1777
|
-
svelte: colors2.yellow,
|
|
1778
|
-
vue: colors2.green
|
|
1779
|
-
};
|
|
1780
|
-
});
|
|
1781
|
-
|
|
1782
1821
|
// src/utils/stringModifiers.ts
|
|
1783
1822
|
var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toPascal = (str) => {
|
|
1784
1823
|
if (!str.includes("-") && !str.includes("_")) {
|
|
@@ -2150,32 +2189,6 @@ var init_browserTranslation = __esm(() => {
|
|
|
2150
2189
|
BROWSER_TRANSLATION_BASELINE_SCRIPT = "window.__ABSOLUTE_SSR_TEXT_BASELINES__=new WeakMap();" + "window.__ABSOLUTE_SSR_ATTRIBUTE_BASELINES__=new WeakMap();" + "{const r=document.body,b=window.__ABSOLUTE_SSR_TEXT_BASELINES__," + "a=window.__ABSOLUTE_SSR_ATTRIBUTE_BASELINES__;" + 'if(r)for(const e of [r,...r.querySelectorAll("*")]){' + "const t=new Map();for(const [i,n]of[...e.childNodes].entries())" + 'if(n.nodeType===3)t.set(i,n.nodeValue??"");if(t.size)b.set(e,t);' + `const v=new Map();for(const k of ${JSON.stringify(TRANSLATABLE_ATTRIBUTES)}){` + "const s=e.getAttribute(k);if(s!==null)v.set(k,s);}if(v.size)a.set(e,v);}}";
|
|
2151
2190
|
});
|
|
2152
2191
|
|
|
2153
|
-
// src/core/islandManifest.ts
|
|
2154
|
-
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
|
|
2155
|
-
const entries = {};
|
|
2156
|
-
let found = false;
|
|
2157
|
-
for (const [key, value] of Object.entries(manifest)) {
|
|
2158
|
-
if (!key.startsWith(prefix))
|
|
2159
|
-
continue;
|
|
2160
|
-
const component = key.slice(prefix.length);
|
|
2161
|
-
if (!component)
|
|
2162
|
-
continue;
|
|
2163
|
-
entries[component] = value;
|
|
2164
|
-
found = true;
|
|
2165
|
-
}
|
|
2166
|
-
return found ? entries : undefined;
|
|
2167
|
-
}, getIslandManifestEntries = (manifest) => {
|
|
2168
|
-
const islands = {};
|
|
2169
|
-
const frameworks = ["react", "svelte", "vue", "angular"];
|
|
2170
|
-
for (const framework of frameworks) {
|
|
2171
|
-
const prefix = `Island${toIslandFrameworkSegment(framework)}`;
|
|
2172
|
-
const entries = collectFrameworkIslands(manifest, prefix);
|
|
2173
|
-
if (entries)
|
|
2174
|
-
islands[framework] = entries;
|
|
2175
|
-
}
|
|
2176
|
-
return islands;
|
|
2177
|
-
}, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
2178
|
-
|
|
2179
2192
|
// src/core/islands.ts
|
|
2180
2193
|
function getIslandComponent(component) {
|
|
2181
2194
|
if (isIslandComponentDefinition(component)) {
|
|
@@ -4462,6 +4475,7 @@ var init_renderIslandMarkup = __esm(() => {
|
|
|
4462
4475
|
});
|
|
4463
4476
|
|
|
4464
4477
|
// src/react/pageHandler.ts
|
|
4478
|
+
init_islandPageContext();
|
|
4465
4479
|
init_devRouteRegistrationCallsite();
|
|
4466
4480
|
init_requestContext();
|
|
4467
4481
|
init_pageProtocol();
|
|
@@ -4937,5 +4951,5 @@ export {
|
|
|
4937
4951
|
useIslandStore
|
|
4938
4952
|
};
|
|
4939
4953
|
|
|
4940
|
-
//# debugId=
|
|
4954
|
+
//# debugId=8D36FF35DD96804964756E2164756E21
|
|
4941
4955
|
//# sourceMappingURL=index.js.map
|