tempo-sdk 0.0.69 → 0.0.75
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/assets/index.js +3 -3
- package/dist/astro/asset-preview-client.js +2 -2
- package/dist/astro.js +17 -11
- package/dist/astro.js.map +1 -1
- package/dist/canvas/astro.d.ts +1 -1
- package/dist/canvas/astro.js +2 -2
- package/dist/canvas/editor.d.ts +15 -5
- package/dist/canvas/editor.js +13 -8
- package/dist/canvas/editor.js.map +1 -1
- package/dist/canvas/flutter-preview.d.ts +18 -0
- package/dist/canvas/flutter-preview.js +9 -0
- package/dist/canvas/flutter-preview.js.map +1 -0
- package/dist/canvas/index.d.ts +33 -2
- package/dist/canvas/index.js +1134 -26
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +5 -4
- package/dist/canvas/parser.d.ts +142 -3
- package/dist/canvas/parser.js +14 -1
- package/dist/canvas/svelte.d.ts +1 -1
- package/dist/canvas/svelte.js +2 -2
- package/dist/canvas/vue.d.ts +74 -0
- package/dist/canvas/vue.js +264 -0
- package/dist/canvas/vue.js.map +1 -0
- package/dist/{chunk-6BSLP7P3.js → chunk-2YX4WVFH.js} +49 -7
- package/dist/chunk-2YX4WVFH.js.map +1 -0
- package/dist/chunk-5HIIF354.js +67 -0
- package/dist/chunk-5HIIF354.js.map +1 -0
- package/dist/{chunk-FE6TYCLF.js → chunk-5VIBKVFO.js} +2 -2
- package/dist/{chunk-FE6TYCLF.js.map → chunk-5VIBKVFO.js.map} +1 -1
- package/dist/{chunk-77DZCV5Z.js → chunk-CXIW4IKC.js} +2 -2
- package/dist/chunk-CYQE3TLC.js +37 -0
- package/dist/chunk-CYQE3TLC.js.map +1 -0
- package/dist/{chunk-WTQQOLXM.js → chunk-DNSCVLKV.js} +1571 -1410
- package/dist/chunk-DNSCVLKV.js.map +1 -0
- package/dist/chunk-EGRHWZRV.js +1 -0
- package/dist/chunk-EGRHWZRV.js.map +1 -0
- package/dist/{chunk-EYKOOLPL.js → chunk-GKDDNDG3.js} +1039 -134
- package/dist/chunk-GKDDNDG3.js.map +1 -0
- package/dist/{chunk-KOSJXE4G.js → chunk-H6BQZOAW.js} +4 -3
- package/dist/chunk-HOBTDB6G.js +112 -0
- package/dist/chunk-HOBTDB6G.js.map +1 -0
- package/dist/chunk-HZXQPM4W.js +285 -0
- package/dist/chunk-HZXQPM4W.js.map +1 -0
- package/dist/chunk-SGN7BDRE.js +16 -0
- package/dist/chunk-SGN7BDRE.js.map +1 -0
- package/dist/{chunk-F23JGM4U.js → chunk-UBTL6JUF.js} +6 -2
- package/dist/{chunk-F23JGM4U.js.map → chunk-UBTL6JUF.js.map} +1 -1
- package/dist/{chunk-2JRAG36X.js → chunk-WBMO4ZYO.js} +2 -2
- package/dist/chunk-WBMO4ZYO.js.map +1 -0
- package/dist/{chunk-K3EYTZLL.js → chunk-WTXOWQ7N.js} +3 -1
- package/dist/chunk-WTXOWQ7N.js.map +1 -0
- package/dist/{chunk-Q2A46HHW.js → chunk-XFPFWTWX.js} +276 -43
- package/dist/chunk-XFPFWTWX.js.map +1 -0
- package/dist/chunk-XMFVWJUY.js +342 -0
- package/dist/chunk-XMFVWJUY.js.map +1 -0
- package/dist/{chunk-PXDTH36X.js → chunk-Y72PIE3I.js} +212 -20
- package/dist/chunk-Y72PIE3I.js.map +1 -0
- package/dist/{chunk-6IR5JY6W.js → chunk-YECMP34I.js} +41 -9
- package/dist/chunk-YECMP34I.js.map +1 -0
- package/dist/{chunk-NSKYOKG5.js → chunk-ZXC7SZIT.js} +278 -26
- package/dist/chunk-ZXC7SZIT.js.map +1 -0
- package/dist/{controls-reader-SNMI2UY7.js → controls-reader-Z7OQWYWQ.js} +4 -3
- package/dist/{controls-reader-SNMI2UY7.js.map → controls-reader-Z7OQWYWQ.js.map} +1 -1
- package/dist/expo/plugin.cjs +301 -58
- package/dist/expo/plugin.cjs.map +1 -1
- package/dist/expo/plugin.js +1 -1
- package/dist/expo-babel-plugin.cjs +301 -58
- package/dist/expo-babel-plugin.cjs.map +1 -1
- package/dist/expo-babel-plugin.js +1 -1
- package/dist/flutter-preview-path.d.ts +9 -0
- package/dist/flutter-preview-path.js +16 -0
- package/dist/flutter-preview-path.js.map +1 -0
- package/dist/index.d.ts +16 -15
- package/dist/index.js +9 -6
- package/dist/nextjs/plugin.cjs +46 -5
- package/dist/nextjs/plugin.cjs.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs-loader.cjs +343 -68
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/nextjs.cjs +48 -6
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.d.cts +9 -1
- package/dist/nextjs.d.ts +9 -1
- package/dist/nextjs.js +1 -1
- package/dist/nuxt/runtime/identity.d.ts +24 -0
- package/dist/nuxt/runtime/identity.js +18 -0
- package/dist/nuxt/runtime/identity.js.map +1 -0
- package/dist/nuxt.d.ts +102 -0
- package/dist/nuxt.js +5673 -0
- package/dist/nuxt.js.map +1 -0
- package/dist/{storyboard-4YdTYq_e.d.ts → storyboard-CMJVBSXn.d.ts} +9 -3
- package/dist/svelte.d.ts +4 -2
- package/dist/svelte.js +21 -88
- package/dist/svelte.js.map +1 -1
- package/dist/vue.d.ts +66 -0
- package/dist/vue.js +1403 -0
- package/dist/vue.js.map +1 -0
- package/package.json +48 -5
- package/dist/chunk-2JRAG36X.js.map +0 -1
- package/dist/chunk-6BSLP7P3.js.map +0 -1
- package/dist/chunk-6IR5JY6W.js.map +0 -1
- package/dist/chunk-EYKOOLPL.js.map +0 -1
- package/dist/chunk-K3EYTZLL.js.map +0 -1
- package/dist/chunk-NSKYOKG5.js.map +0 -1
- package/dist/chunk-PXDTH36X.js.map +0 -1
- package/dist/chunk-Q2A46HHW.js.map +0 -1
- package/dist/chunk-WTQQOLXM.js.map +0 -1
- /package/dist/{chunk-77DZCV5Z.js.map → chunk-CXIW4IKC.js.map} +0 -0
- /package/dist/{chunk-KOSJXE4G.js.map → chunk-H6BQZOAW.js.map} +0 -0
package/dist/assets/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
captureAssetPreview
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-2JRAG36X.js";
|
|
5
|
-
import "../chunk-6AAE4LYV.js";
|
|
3
|
+
} from "../chunk-CXIW4IKC.js";
|
|
6
4
|
import {
|
|
7
5
|
UNRESOLVED_VALUE
|
|
8
6
|
} from "../chunk-DI2ZFAWL.js";
|
|
7
|
+
import "../chunk-WBMO4ZYO.js";
|
|
8
|
+
import "../chunk-6AAE4LYV.js";
|
|
9
9
|
|
|
10
10
|
// assets/controls.ts
|
|
11
11
|
function normalizeAssetControl(control) {
|
package/dist/astro.js
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
annotateAstroSource,
|
|
3
3
|
parseAstroSource
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5VIBKVFO.js";
|
|
5
|
+
import "./chunk-EGRHWZRV.js";
|
|
5
6
|
import {
|
|
6
7
|
MagicString
|
|
7
8
|
} from "./chunk-JVVHU3A7.js";
|
|
9
|
+
import {
|
|
10
|
+
tempoVitePlugin
|
|
11
|
+
} from "./chunk-DNSCVLKV.js";
|
|
12
|
+
import "./chunk-PYAJHLXO.js";
|
|
13
|
+
import "./chunk-DI2ZFAWL.js";
|
|
8
14
|
import {
|
|
9
15
|
TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,
|
|
10
16
|
TEMPO_HOST_IDENTITY_ENDPOINT,
|
|
11
|
-
createTempoHostIdentity
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import "./chunk-F23JGM4U.js";
|
|
17
|
+
createTempoHostIdentity
|
|
18
|
+
} from "./chunk-XMFVWJUY.js";
|
|
19
|
+
import "./chunk-UBTL6JUF.js";
|
|
15
20
|
import "./chunk-H6OZIX2U.js";
|
|
16
21
|
import {
|
|
17
22
|
sourceVersionHash
|
|
18
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-H6BQZOAW.js";
|
|
19
24
|
import {
|
|
25
|
+
componentFrameworkForStoryboard,
|
|
20
26
|
parseCanvasFile
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-K3EYTZLL.js";
|
|
27
|
+
} from "./chunk-Y72PIE3I.js";
|
|
28
|
+
import "./chunk-5HIIF354.js";
|
|
29
|
+
import "./chunk-WTXOWQ7N.js";
|
|
25
30
|
import "./chunk-65B52AR7.js";
|
|
31
|
+
import "./chunk-CYQE3TLC.js";
|
|
26
32
|
import {
|
|
27
33
|
astroStoryboardPath
|
|
28
34
|
} from "./chunk-OX2YKYSL.js";
|
|
@@ -254,7 +260,7 @@ function collectAstroStoryboards(root, canvasesRoot, generatedRoot, styles = [])
|
|
|
254
260
|
const canvas = parseCanvasFile(canvasFile, source);
|
|
255
261
|
const canvasPath = canvas.canvasPath ?? relative(root, dirname(canvasFile)).replaceAll("\\", "/");
|
|
256
262
|
for (const storyboard of canvas.storyboards) {
|
|
257
|
-
if (storyboard
|
|
263
|
+
if (componentFrameworkForStoryboard(storyboard) !== "astro") continue;
|
|
258
264
|
const path = astroStoryboardPath(canvasPath, storyboard.storyboardKey);
|
|
259
265
|
const file = join(
|
|
260
266
|
generatedRoot,
|
package/dist/astro.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../astro.ts","../astro/compiler-adapter.ts","../astro/storyboards.ts","../astro/json.ts","../astro/project-context.ts","../astro/tailwind.ts"],"sourcesContent":["import {\n closeSync,\n fstatSync,\n openSync,\n readFileSync,\n realpathSync,\n} from \"node:fs\";\nimport { isAbsolute, relative, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createRequire } from \"node:module\";\nimport type { AstroIntegration, AstroUserConfig } from \"astro\";\nimport type { Plugin } from \"vite\";\nimport {\n annotateAstroSource,\n parseAstroSource,\n type AstroModuleSource,\n} from \"@modules/astro-editor\";\nimport {\n instrumentAstroModule,\n instrumentFrameworkModule,\n} from \"./astro/compiler-adapter\";\nimport { sourceVersionHash } from \"@modules/annotation/source-version\";\nimport { createAstroStoryboardRegistry } from \"./astro/storyboards\";\nimport {\n astroProjectContext,\n discoverAstroStyles,\n} from \"./astro/project-context\";\nimport { astroTailwindSources } from \"./astro/tailwind\";\nimport { tempoVitePlugin } from \"./index\";\nimport {\n createTempoHostIdentity,\n TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,\n TEMPO_HOST_IDENTITY_ENDPOINT,\n} from \"./host-identity\";\n\nexport interface TempoAstroOptions {\n /** Annotation root; the application root by default. */\n root?: string;\n enabled?: boolean;\n /** Canvas declarations to expose as isolated documents. Defaults to tempo/designs. */\n canvasesRoot?: string;\n /** App-relative CSS entries for isolated components. Defaults to layout/global CSS discovery. */\n styles?: string[];\n}\n\n/** Native Astro server instrumentation. Inert for builds, previews and normal dev. */\nexport function tempoAstro(options: TempoAstroOptions = {}): AstroIntegration {\n return {\n name: \"tempo-astro\",\n hooks: {\n \"astro:config:setup\"({\n config,\n command,\n updateConfig,\n injectRoute,\n createCodegenDir,\n injectScript,\n }) {\n if (\n command !== \"dev\" ||\n !(options.enabled ?? Boolean(process.env.TEMPO))\n )\n return;\n const [nodeMajor, nodeMinor] = process.versions.node\n .split(\".\")\n .map(Number);\n if (nodeMajor! < 22 || (nodeMajor === 22 && nodeMinor! < 12))\n throw new Error(\"Tempo Astro support requires Node 22.12 or newer\");\n const appRequire = createRequire(new URL(\"package.json\", config.root));\n const version = appRequire(\"astro/package.json\").version as string;\n if (!version.startsWith(\"7.\"))\n throw new Error(\n `Tempo native Astro support requires Astro 7; this app uses ${version}`,\n );\n const appRoot = realpathSync.native(fileURLToPath(config.root));\n const { root, tempoRoot, canvasesRoot } = astroProjectContext(\n appRoot,\n options.root,\n options.canvasesRoot,\n );\n const generatedRoot = fileURLToPath(createCodegenDir());\n const canvasRoots = [\n canvasesRoot,\n resolve(tempoRoot, \".tempo/library-canvases\"),\n resolve(tempoRoot, \".tempo/asset-edit-previews\"),\n ];\n const registry = createAstroStoryboardRegistry(\n root,\n canvasRoots,\n generatedRoot,\n options.styles?.map((file) => resolve(appRoot, file)) ??\n discoverAstroStyles(appRoot),\n );\n injectRoute({\n pattern: \"/__tempo/astro/[...storyboard]\",\n entrypoint: registry.entrypoint,\n prerender: false,\n });\n injectScript(\n \"head-inline\",\n `if(!document.querySelector('meta[name=\"tempo-project-root\"]')){const m=document.createElement('meta');m.name='tempo-project-root';m.content=${JSON.stringify(root).replaceAll(\"<\", \"\\\\u003c\")};document.head.append(m)}`,\n );\n const documentClient = fileURLToPath(\n new URL(\n import.meta.url.endsWith(\".ts\")\n ? \"./astro/document-client.ts\"\n : \"./astro/document-client.js\",\n import.meta.url,\n ),\n );\n injectScript(\n \"page\",\n `import { startAstroDocumentClient } from ${JSON.stringify(documentClient)}; startAstroDocumentClient(import.meta.hot);`,\n );\n const identity: Plugin = {\n name: \"tempo:astro-identity\",\n // The generic annotation plugin also serves /__tempo/identity.\n // Register Astro's capability first, before its pre-enforced middleware.\n enforce: \"pre\",\n configureServer(server) {\n server.middlewares.use((req, res, next) => {\n if (\n req.method !== \"GET\" ||\n req.url?.split(\"?\")[0] !== TEMPO_HOST_IDENTITY_ENDPOINT\n )\n return next();\n res.setHeader(TEMPO_HOST_IDENTITY_CAPABILITY_HEADER, \"1\");\n res.setHeader(\"Cache-Control\", \"no-store\");\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(\n JSON.stringify({\n ...createTempoHostIdentity(\"astro\", {\n root: tempoRoot,\n pluginActive: true,\n }),\n capabilities: { astroComponents: 1 },\n }),\n );\n });\n },\n };\n updateConfig({\n vite: {\n plugins: [\n identity,\n astroTailwindSources(root, [\n ...canvasRoots,\n // Request-time registry data contains paths, never utilities.\n // Scanning it makes Tailwind reload pages on every board add.\n resolve(generatedRoot, \"*.astro\"),\n ]),\n ...astroAnnotationPlugins(root, generatedRoot),\n tempoVitePlugin({ root, enabled: true }),\n registry.plugin,\n ],\n },\n });\n },\n },\n };\n}\n\nexport function astroAnnotationPlugins(\n root: string,\n generatedRoot?: string,\n): Plugin[] {\n // Astro has separate SSR and prerender transform chains for the same module id.\n const environments = new WeakMap<\n object,\n Map<string, { metadata: AstroModuleSource; occurrenceFactory?: string }>\n >();\n const receiptMap = (environment: object) => {\n let map = environments.get(environment);\n if (!map) {\n map = new Map();\n environments.set(environment, map);\n }\n return map;\n };\n const runtime = fileURLToPath(new URL(\"./astro/runtime.js\", import.meta.url));\n // Development from source; published SDKs contain the .js sibling.\n const runtimeId = import.meta.url.endsWith(\".ts\")\n ? runtime.replace(/\\.js$/, \".ts\")\n : runtime;\n return [\n {\n name: \"tempo:astro-source\",\n enforce: \"pre\",\n transform: {\n order: \"pre\",\n handler(source, id, options) {\n const astro = id.endsWith(\".astro\");\n const framework = options?.ssr && /\\.[jt]sx?$/.test(id);\n if ((!astro && !framework) || id.includes(\"?\") || !isAbsolute(id))\n return;\n const receipts = receiptMap(this.environment);\n receipts.delete(id);\n let physical: string;\n try {\n physical = realpathSync.native(id);\n } catch {\n // Other integrations can emit virtual JS modules with file-like\n // ids. Only exact, on-disk source can authorize an edit receipt.\n return;\n }\n if (\n generatedRoot &&\n !relative(generatedRoot, physical).startsWith(\"..\")\n )\n return;\n const filepath = relative(root, physical).replaceAll(\"\\\\\", \"/\");\n if (\n !filepath ||\n filepath.startsWith(\"../\") ||\n isAbsolute(filepath) ||\n filepath.split(\"/\").includes(\"node_modules\")\n )\n return;\n // One descriptor ties disk bytes and stats to this transform, not a watcher cache.\n const fd = openSync(physical, \"r\");\n let metadata: AstroModuleSource;\n try {\n const before = fstatSync(fd);\n const raw = readFileSync(fd, \"utf8\");\n const after = fstatSync(fd);\n if (\n source !== raw ||\n !([\"mtimeMs\", \"ctimeMs\", \"size\", \"ino\", \"dev\"] as const).every(\n (key) => before[key] === after[key],\n )\n )\n return;\n const parsed = astro ? parseAstroSource(source) : null;\n if (parsed && parsed.kind !== \"ok\") return;\n metadata = {\n filepath,\n sourceVersion: parsed?.sourceVersion ?? sourceVersionHash(source),\n modifiedTs: Math.trunc(before.mtimeMs),\n };\n } finally {\n closeSync(fd);\n }\n if (framework) {\n receipts.set(id, { metadata });\n return;\n }\n const transformed = annotateAstroSource(source, metadata, id);\n if (transformed.kind !== \"ok\") this.error(transformed.message);\n receipts.set(id, {\n metadata,\n occurrenceFactory: transformed.occurrenceFactory,\n });\n return { code: transformed.code, map: transformed.map };\n },\n },\n },\n {\n name: \"tempo:astro-compiled\",\n enforce: \"post\",\n transform: {\n order: \"post\",\n handler(code, id) {\n if (\n generatedRoot &&\n id.endsWith(\".astro\") &&\n !relative(generatedRoot, id).startsWith(\"..\")\n ) {\n return instrumentAstroModule(\n code,\n id,\n null,\n runtimeId,\n \"$$tempoStoryboardHostId\",\n );\n }\n const receipts = receiptMap(this.environment);\n const receipt = receipts.get(id);\n if (!receipt) return;\n receipts.delete(id);\n if (!receipt.occurrenceFactory)\n return instrumentFrameworkModule(\n code,\n id,\n receipt.metadata,\n runtimeId,\n );\n return instrumentAstroModule(\n code,\n id,\n receipt.metadata,\n runtimeId,\n receipt.occurrenceFactory,\n );\n },\n },\n },\n ];\n}\n\nexport default tempoAstro;\n\n/** Preserve the app's complete config and integrate only at Astro's dev hook. */\nexport function withTempoAstro<T extends AstroUserConfig>(config: T): T;\nexport function withTempoAstro<T extends AstroUserConfig>(\n config: Promise<T>,\n): Promise<T>;\nexport function withTempoAstro<T extends AstroUserConfig>(\n config: T | Promise<T>,\n): T | Promise<T> {\n if (config instanceof Promise)\n return config.then((value) => withTempoAstro(value));\n return {\n ...config,\n integrations: [...(config.integrations ?? []), tempoAstro()],\n };\n}\n","import MagicString from \"magic-string\";\nimport { parseSync } from \"oxc-parser\";\nimport type { AstroModuleSource } from \"@modules/astro-editor\";\n\n/** SSR-only framework exports carry the same definition receipt as native\n * Astro factories, including when React renders null or an empty fragment. */\nexport function instrumentFrameworkModule(\n code: string,\n id: string,\n metadata: AstroModuleSource,\n runtimeId: string,\n) {\n const parsed = parseSync(`${id}.js`, code);\n if (parsed.errors.length) return;\n let name = \"$$tempoFrameworkComponent\";\n while (code.includes(name)) name += \"_\";\n const output = new MagicString(code);\n const bindings = new Map<string, string>();\n let wrapped = false;\n for (const node of parsed.program.body) {\n if (node.type === \"ExportDefaultDeclaration\") {\n const value = node.declaration;\n if (value.type === \"Identifier\") bindings.set(value.name, \"default\");\n else if (\n (value.type === \"FunctionDeclaration\" ||\n value.type === \"ClassDeclaration\") &&\n value.id\n )\n bindings.set(value.id.name, \"default\");\n else {\n output.prependLeft(value.start, `${name}(`);\n output.appendLeft(\n value.end,\n `, ${JSON.stringify({ ...metadata, exportName: \"default\" })})`,\n );\n wrapped = true;\n }\n } else if (node.type === \"ExportNamedDeclaration\" && !node.source) {\n const value = node.declaration;\n if (value?.type === \"VariableDeclaration\") {\n for (const declaration of value.declarations)\n if (declaration.id.type === \"Identifier\")\n bindings.set(declaration.id.name, declaration.id.name);\n } else if (\n (value?.type === \"FunctionDeclaration\" ||\n value?.type === \"ClassDeclaration\") &&\n value.id\n )\n bindings.set(value.id.name, value.id.name);\n for (const specifier of node.specifiers)\n if (specifier.local.type === \"Identifier\")\n bindings.set(\n specifier.local.name,\n specifier.exported.type === \"Identifier\"\n ? specifier.exported.name\n : specifier.exported.value,\n );\n }\n }\n if (!wrapped && !bindings.size) return;\n output.prepend(\n `import { instrumentFrameworkComponent as ${name} } from ${JSON.stringify(runtimeId)};\\n`,\n );\n for (const [binding, exportName] of bindings)\n output.append(\n `\\n${name}(${binding}, ${JSON.stringify({ ...metadata, exportName })});`,\n );\n return {\n code: output.toString(),\n map: output.generateMap({ source: id, includeContent: true, hires: true }),\n };\n}\n\n/** One isolated Astro 7 compiled-helper contract, validated before running any user code. */\nexport function instrumentAstroModule(\n code: string,\n id: string,\n metadata: AstroModuleSource | null,\n runtimeId: string,\n occurrenceFactory: string,\n) {\n const parsed = parseSync(`${id}.js`, code);\n if (parsed.errors.length)\n throw new Error(`Tempo could not parse Astro's compiled module: ${id}`);\n const output = new MagicString(code);\n let prefix = \"$$tempo\";\n while (code.includes(prefix)) prefix += \"_\";\n const wrappers: string[] = [];\n let hasFactory = false;\n for (const node of parsed.program.body) {\n if (node.type !== \"ImportDeclaration\") continue;\n const runtime = node.source.value;\n if (\n runtime !== \"astro/runtime/server/index.js\" &&\n runtime !== \"astro/compiler-runtime\" &&\n runtime !== \"astro/runtime/compiler/index.js\" &&\n !runtime.endsWith(\"/astro/dist/runtime/compiler/index.js\")\n )\n continue;\n for (const specifier of node.specifiers) {\n if (\n specifier.type !== \"ImportSpecifier\" ||\n specifier.imported.type !== \"Identifier\"\n )\n continue;\n const imported = specifier.imported.name;\n if (imported !== \"createComponent\" && imported !== \"renderComponent\")\n continue;\n if (imported === \"createComponent\" && !metadata) {\n hasFactory = true;\n continue;\n }\n const local = specifier.local;\n const original = `${prefix}_${imported}`;\n output.overwrite(\n specifier.start,\n specifier.end,\n `${imported} as ${original}`,\n );\n const helper =\n imported === \"createComponent\"\n ? \"instrumentCreateComponent\"\n : \"instrumentRenderComponent\";\n wrappers.push(\n `const ${local.name} = ${prefix}_${helper}(${original}${imported === \"createComponent\" ? `, ${JSON.stringify(metadata)}` : \"\"});`,\n );\n if (imported === \"createComponent\") hasFactory = true;\n }\n }\n if (!hasFactory)\n throw new Error(\n `Unsupported Astro compiler output for ${id}; Tempo requires Astro 7 createComponent (${parsed.program.body\n .filter((n) => n.type === \"ImportDeclaration\")\n .map((n) => n.source.value)\n .join(\", \")})`,\n );\n output.prepend(\n `import { astroHostId as ${occurrenceFactory}, instrumentCreateComponent as ${prefix}_instrumentCreateComponent, instrumentRenderComponent as ${prefix}_instrumentRenderComponent } from ${JSON.stringify(runtimeId)};\\n${wrappers.join(\"\\n\")}\\n`,\n );\n return {\n code: output.toString(),\n map: output.generateMap({ source: id, includeContent: true, hires: true }),\n };\n}\n","import { createHash } from \"node:crypto\";\nimport {\n existsSync,\n readFileSync,\n readdirSync,\n mkdirSync,\n writeFileSync,\n openSync,\n closeSync,\n fstatSync,\n} from \"node:fs\";\nimport { sourceVersionHash } from \"@modules/annotation/source-version\";\nimport { dirname, isAbsolute, join, relative, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { Plugin } from \"vite\";\nimport { parseCanvasFile } from \"../canvas/parser\";\nimport { astroStoryboardPath } from \"../canvas/astro-contract\";\nimport { readAstroStoryboardProps } from \"./json\";\nimport { parseSync } from \"oxc-parser\";\n\ninterface AstroStoryboardRoute {\n path: string;\n file: string;\n source: string;\n revision: string;\n}\n\n// A document can receive its HTML before a canvas write, then connect to Vite\n// after that write's full-reload event. Reconcile on connection so the missed\n// event cannot leave the newly opened storyboard showing old props forever.\nconst revisionClient = `<script>\nconst hot = import.meta.hot;\nif (hot) {\n const receipt = () => JSON.parse(document.querySelector('meta[name=\"tempo-astro-storyboard\"]')?.getAttribute('content') ?? 'null');\n const check = () => hot.send('tempo:astro:revision-request', { path: location.pathname, revision: receipt()?.revision });\n const accept = (data) => {\n if (data.path === location.pathname && data.revision !== receipt()?.revision) location.reload();\n };\n hot.on('tempo:astro:revision', accept);\n hot.on('vite:ws:connect', check);\n check();\n hot.dispose(() => {\n hot.off('tempo:astro:revision', accept);\n hot.off('vite:ws:connect', check);\n });\n}\n</script>`;\n\nfunction filesUnder(root: string): string[] {\n if (!existsSync(root)) return [];\n return readdirSync(root, { withFileTypes: true }).flatMap((entry) => {\n if (entry.isSymbolicLink()) return [];\n const file = join(root, entry.name);\n return entry.isDirectory()\n ? filesUnder(file)\n : entry.name.endsWith(\".canvas.tsx\")\n ? [file]\n : [];\n });\n}\n\n/** Only the owning canvas is parsed. Its module and frontmatter are never executed. */\nexport function collectAstroStoryboards(\n root: string,\n canvasesRoot: string | string[],\n generatedRoot: string,\n styles: string[] = [],\n): AstroStoryboardRoute[] {\n const routes: AstroStoryboardRoute[] = [];\n for (const canvasFile of new Set(\n (Array.isArray(canvasesRoot) ? canvasesRoot : [canvasesRoot]).flatMap(\n filesUnder,\n ),\n )) {\n const fd = openSync(canvasFile, \"r\");\n let source: string, modifiedTs: number;\n try {\n const before = fstatSync(fd);\n source = readFileSync(fd, \"utf8\");\n const after = fstatSync(fd);\n if (\n !([\"mtimeMs\", \"ctimeMs\", \"size\", \"ino\", \"dev\"] as const).every(\n (key) => before[key] === after[key],\n )\n )\n throw new Error(`Canvas changed while reading: ${canvasFile}`);\n modifiedTs = Math.trunc(before.mtimeMs);\n } finally {\n closeSync(fd);\n }\n const canvas = parseCanvasFile(canvasFile, source);\n const canvasPath =\n canvas.canvasPath ??\n relative(root, dirname(canvasFile)).replaceAll(\"\\\\\", \"/\");\n for (const storyboard of canvas.storyboards) {\n if (storyboard.runtimeFramework !== \"astro\") continue;\n const path = astroStoryboardPath(canvasPath, storyboard.storyboardKey);\n const file = join(\n generatedRoot,\n `${createHash(\"sha256\").update(path).digest(\"hex\")}.astro`,\n );\n const revision = createHash(\"sha256\").update(source).digest(\"hex\");\n let generated: string;\n try {\n if (\n canvas.errors.some((error) => error.kind === \"structural\") ||\n storyboard.errors.length\n )\n throw new Error(\n \"Fix the Astro storyboard's canvas declaration before rendering it\",\n );\n const imported = storyboard.component?.import;\n if (\n !imported ||\n imported.kind !== \"default\" ||\n !imported.source.endsWith(\".astro?tempo-component\")\n )\n throw new Error(\n \"AstroStoryboard requires a default .astro?tempo-component import; use an authored .astro fixture for slots and server data\",\n );\n const module = imported.source.slice(0, -\"?tempo-component\".length);\n const specifier = module.startsWith(\".\")\n ? resolve(dirname(canvasFile), module).replaceAll(\"\\\\\", \"/\")\n : module;\n const props = JSON.stringify(\n readAstroStoryboardProps(storyboard.props?.expression),\n ).replaceAll(\"<\", \"\\\\u003c\");\n const callsite = JSON.stringify({\n filepath: relative(root, canvasFile).replaceAll(\"\\\\\", \"/\"),\n sourceVersion: sourceVersionHash(source),\n modifiedTs,\n position: storyboard.jsxElementSpan.start,\n name: storyboard.component?.localName ?? \"Component\",\n });\n const receipt = JSON.stringify({\n canvasPath,\n storyboardId: storyboard.storyboardKey,\n revision,\n });\n let preview: Record<string, unknown> | undefined;\n if (\n canvasFile\n .replaceAll(\"\\\\\", \"/\")\n .includes(\"/.tempo/asset-edit-previews/\")\n ) {\n for (const statement of parseSync(canvasFile, source).program.body) {\n if (\n statement.type !== \"ExportNamedDeclaration\" ||\n statement.declaration?.type !== \"VariableDeclaration\"\n )\n continue;\n for (const declaration of statement.declaration.declarations)\n if (\n declaration.id.type === \"Identifier\" &&\n declaration.id.name === \"__tempoAstroAssetPreview\" &&\n declaration.init\n )\n preview = readAstroStoryboardProps(\n source.slice(declaration.init.start, declaration.init.end),\n );\n }\n }\n generated = `---\\nimport Component from ${JSON.stringify(specifier)};\\nimport ComponentMetadata from ${JSON.stringify(specifier + \"?tempo-component\")};\\n${styles.map((file) => `import ${JSON.stringify(file.replaceAll(\"\\\\\", \"/\"))};`).join(\"\\n\")}\\nconst props = ${props};\\nconst controls = JSON.stringify(ComponentMetadata.__tempoAstroControls ?? {});\\n---\\n<!doctype html><html><head><meta charset=\"UTF-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /><meta name=\"tempo-project-root\" content={${JSON.stringify(root)}} /><meta name=\"tempo-astro-storyboard\" content={${JSON.stringify(receipt)}} /></head><body style=\"margin:0\"><Component {...props} __tempo_astro_callsite__={${callsite}} /><pre hidden data-asset-definition={controls}>Component controls</pre></body></html>`;\n if (preview) {\n const client = fileURLToPath(\n new URL(\n import.meta.url.endsWith(\".ts\")\n ? \"./asset-preview-client.ts\"\n : \"./astro/asset-preview-client.js\",\n import.meta.url,\n ),\n );\n generated = generated\n .replace(\n `const props = ${props};`,\n `const preview = ${JSON.stringify(preview).replaceAll(\"<\", \"\\\\u003c\")};\nconst raw = Astro.url.searchParams.get(\"__tempo_asset_update\");\nif (raw && raw.length > 64000) throw new Error(\"Astro preview props are too large\");\nconst update = raw ? JSON.parse(raw) : {variant:null,edits:{}};\nif (!(update.variant === null || typeof update.variant === \"string\") || !update.edits || typeof update.edits !== \"object\" || Array.isArray(update.edits)) throw new Error(\"Invalid Astro preview props\");\nconst variant = update.variant !== null && Object.hasOwn(preview.asset.variants,update.variant) ? preview.asset.variants[update.variant] : undefined;\nif (update.variant !== null && (!variant || variant.error)) throw new Error(variant?.error ?? \"The Astro asset variant no longer exists\");\nconst props = {...variant?.props};\nfor (const [key,value] of Object.entries(update.edits)) { if(value && typeof value === \"object\" && Object.keys(value).length===1 && value.__tempo_omit_prop__===true) delete props[key]; else Object.defineProperty(props,key,{value,enumerable:true,configurable:true}); }\nconst assetMetadata = JSON.stringify({sessionId:preview.sessionId,metadata:{asset:preview.asset,...ComponentMetadata.__tempoAstroControls}});`,\n )\n .replace(\n \"</head>\",\n `<meta name=\"tempo-astro-asset-preview\" content={assetMetadata} /></head>`,\n )\n .replace(\n `<Component {...props} __tempo_astro_callsite__={${callsite}} />`,\n `{update.variant !== null && <Component {...props} __tempo_astro_callsite__={${callsite}} />}`,\n )\n .replace(\n \"</body>\",\n `<script>import {startAstroAssetPreview} from ${JSON.stringify(client)}; startAstroAssetPreview();</script></body>`,\n );\n }\n } catch (error) {\n // A broken board fails in its own route without importing or breaking siblings.\n generated = `---\\nthrow new Error(${JSON.stringify(error instanceof Error ? error.message : String(error))});\\n---`;\n }\n generated = generated.replace(\"</body>\", `${revisionClient}</body>`);\n routes.push({ path, file, source: generated, revision });\n }\n }\n const seen = new Set<string>();\n for (const route of routes) {\n if (seen.has(route.path))\n throw new Error(`Duplicate Astro storyboard address: ${route.path}`);\n seen.add(route.path);\n }\n return routes;\n}\n\nfunction writeChanged(file: string, source: string) {\n const exists = existsSync(file);\n if (exists && readFileSync(file, \"utf8\") === source) return;\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(file, source);\n return exists ? \"updated\" : \"created\";\n}\n\nfunction storyboardEntrypoint(registryFile: string): string {\n // Astro's normal page CSS collector traverses every statically known import,\n // including lazy glob imports. Use its content asset boundary to collect only\n // the selected document's assets. This is an Astro 7 adapter: the real-server\n // tests pin both the propagation module and native SSR result contracts.\n return String.raw`---\nimport { readFileSync } from \"node:fs\";\nimport { createComponent } from \"astro/runtime/server/index.js\";\nconst base = import.meta.env.BASE_URL.replace(/\\/$/, \"\");\nconst pathname = Astro.url.pathname.slice(base.length).replace(/\\/$/, \"\");\nconst routes = JSON.parse(readFileSync(${JSON.stringify(registryFile)}, \"utf8\"));\nconst route = routes.find((entry) => entry.path === pathname);\nif (!route) return new Response(\"Astro storyboard not found\", { status: 404 });\n// Do not turn these into a glob or a static import map: unopened boards may\n// contain broken imports, and their global CSS must never enter this document.\nconst { default: assets } = await import(/* @vite-ignore */ route.file + \"?astroPropagatedAssets\");\nconst { default: Page } = await assets.getMod();\nconst Preview = createComponent((result, props, slots) => {\n // The generated document owns its <head>. It was loaded during frontmatter,\n // after Astro computed the dispatch page's static head metadata.\n result._metadata.headInTree = true;\n result._metadata.routeHasPropagation = true;\n for (const style of assets.collectedStyles) {\n result.styles.add({ props: { \"data-vite-dev-id\": style.id }, children: style.content });\n const src = style.id.startsWith(\"/@id/\") ? style.id : \"/@fs/\" + style.id.replace(/^\\//, \"\");\n result.scripts.add({ props: { type: \"module\", src: base + src }, children: \"\" });\n }\n for (const href of assets.collectedLinks) {\n result.links.add({ props: { rel: \"stylesheet\", href }, children: \"\" });\n }\n return Page(result, props, slots);\n});\n---\n<Preview />`;\n}\n\n/** A permanent route dispatches into isolated native documents without restarting Astro. */\nexport function createAstroStoryboardRegistry(\n root: string,\n canvasesRoot: string | string[],\n generatedRoot: string,\n styles: string[] = [],\n) {\n const roots = Array.isArray(canvasesRoot) ? canvasesRoot : [canvasesRoot];\n const routes = collectAstroStoryboards(root, roots, generatedRoot, styles);\n let currentRoutes = routes;\n const registryFile = join(generatedRoot, \"routes.json\");\n const entrypoint = join(generatedRoot, \"storyboards.astro\");\n const shape = (items: AstroStoryboardRoute[]) =>\n JSON.stringify(\n items.map(({ path, file }) => ({\n path,\n file: file.replaceAll(\"\\\\\", \"/\"),\n })),\n );\n const unmodifiedNewFiles = new Set<string>();\n const writeDocument = (route: AstroStoryboardRoute) => {\n const change = writeChanged(route.file, route.source);\n const file = route.file.replaceAll(\"\\\\\", \"/\");\n if (change === \"created\") unmodifiedNewFiles.add(file);\n // Do not suppress a delayed create event after a second write: a client\n // may already have rendered the first version, and still needs HMR.\n else if (change === \"updated\") unmodifiedNewFiles.delete(file);\n return change;\n };\n for (const route of routes) writeDocument(route);\n writeChanged(registryFile, shape(routes));\n writeChanged(entrypoint, storyboardEntrypoint(registryFile));\n const plugin: Plugin = {\n name: \"tempo:astro-storyboards\",\n hotUpdate: {\n order: \"pre\",\n handler({ type, file, modules }) {\n // A new document may be requested before its watcher add event arrives.\n // Astro then sees an already-loaded SSR module and reloads every page,\n // even though nobody has rendered an older version of this new file.\n // Real changes still use Astro's ordinary invalidation and HMR path.\n if (type === \"create\" && unmodifiedNewFiles.has(file))\n return modules.filter((module) => module.file !== file);\n },\n },\n configureServer(server) {\n const changed = (file: string) => {\n if (\n !file.endsWith(\".canvas.tsx\") ||\n !roots.some((root) => {\n const path = relative(root, file);\n return !isAbsolute(path) && !path.startsWith(\"../\");\n })\n )\n return;\n try {\n const next = collectAstroStoryboards(\n root,\n roots,\n generatedRoot,\n styles,\n );\n const updatedFiles = next\n .filter((route) => writeDocument(route) === \"updated\")\n .map((route) => route.file);\n const nextFiles = new Set(\n next.map((route) => route.file.replaceAll(\"\\\\\", \"/\")),\n );\n for (const file of unmodifiedNewFiles)\n if (!nextFiles.has(file)) unmodifiedNewFiles.delete(file);\n currentRoutes = next;\n // This is request-time data, never an Astro config watch file or a\n // static module import. Registry membership cannot restart Vite.\n writeChanged(registryFile, shape(next));\n // These writes are already known; don't depend on a second native\n // event to invalidate Astro's compiled output. A newly generated\n // document can be imported before its directory is being watched,\n // especially while the replacement watcher is starting after restart.\n for (const file of updatedFiles) server.watcher.emit(\"change\", file);\n } catch (error) {\n server.config.logger.error(String(error));\n }\n };\n server.watcher.add(roots);\n server.watcher\n .on(\"add\", changed)\n .on(\"change\", changed)\n .on(\"unlink\", changed);\n const verifyRevision = (\n data: { path?: string; revision?: string },\n client: {\n send(payload: { type: \"custom\"; event: string; data: unknown }): void;\n },\n ) => {\n if (typeof data?.path !== \"string\" || typeof data.revision !== \"string\")\n return;\n const base = server.config.base.replace(/\\/$/, \"\");\n const pathname =\n base && data.path.startsWith(`${base}/`)\n ? data.path.slice(base.length)\n : data.path;\n const route = currentRoutes.find((route) => route.path === pathname);\n if (route)\n client.send({\n type: \"custom\",\n event: \"tempo:astro:revision\",\n data: { path: data.path, revision: route.revision },\n });\n };\n server.ws.on(\"tempo:astro:revision-request\", verifyRevision);\n const dispose = () => {\n server.ws.off(\"tempo:astro:revision-request\", verifyRevision);\n server.watcher\n .off(\"add\", changed)\n .off(\"change\", changed)\n .off(\"unlink\", changed);\n };\n // Vite creates the next server before closing the old one. A shared\n // closeBundle callback would tear down the new server's registrations.\n server.httpServer?.once(\"close\", dispose);\n },\n };\n return { routes, registryFile, entrypoint, plugin };\n}\n","import { parseSync } from \"oxc-parser\";\nimport type { AstroJson } from \"../canvas/astro-contract\";\n\n/** Static data extraction only. Reject syntax which could execute frontmatter or canvas code. */\nexport function readAstroStoryboardProps(\n expression?: string,\n): Record<string, AstroJson> {\n if (!expression) return {};\n const parsed = parseSync(\"props.ts\", `(${expression})`);\n if (parsed.errors.length)\n throw new Error(\"Astro storyboard props must be a JSON object literal\");\n const read = (node: any): AstroJson => {\n if (node?.type === \"ParenthesizedExpression\") return read(node.expression);\n if (\n node?.type === \"Literal\" &&\n (node.value === null ||\n [\"string\", \"boolean\"].includes(typeof node.value) ||\n (typeof node.value === \"number\" && Number.isFinite(node.value)))\n )\n return node.value;\n if (\n node?.type === \"UnaryExpression\" &&\n [\"-\", \"+\"].includes(node.operator) &&\n node.argument?.type === \"Literal\" &&\n typeof node.argument.value === \"number\" &&\n Number.isFinite(node.argument.value)\n )\n return node.operator === \"-\" ? -node.argument.value : node.argument.value;\n if (node?.type === \"ArrayExpression\") return node.elements.map(read);\n if (node?.type === \"ObjectExpression\") {\n const value: Record<string, AstroJson> = Object.create(null);\n for (const property of node.properties) {\n if (\n property.type !== \"Property\" ||\n property.computed ||\n property.method ||\n property.shorthand ||\n property.kind !== \"init\"\n )\n throw new Error(\n \"Astro storyboard props cannot contain expressions, spreads or getters\",\n );\n const key =\n property.key.type === \"Identifier\"\n ? property.key.name\n : property.key.value;\n if (typeof key !== \"string\" && typeof key !== \"number\")\n throw new Error(\"Astro storyboard props require literal keys\");\n value[key] = read(property.value);\n }\n return value;\n }\n throw new Error(\n \"Astro storyboard props must be static JSON; use an authored .astro fixture for server data or slots\",\n );\n };\n const statement = parsed.program.body[0];\n const value = read(\n statement?.type === \"ExpressionStatement\"\n ? statement.expression\n : undefined,\n );\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n throw new Error(\"Astro storyboard props must be a JSON object literal\");\n return value;\n}\n","import { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { parseAstroSource } from \"@modules/astro-editor\";\n\n/** Locate the workspace owning this app without assuming the app is at its root. */\nexport function astroProjectContext(\n appRoot: string,\n rootOverride?: string,\n canvasesOverride?: string,\n) {\n let root = resolve(rootOverride ?? appRoot);\n if (!rootOverride) {\n for (let candidate = root; ; candidate = dirname(candidate)) {\n const file = join(candidate, \"tempo/tempo.config.json\");\n if (existsSync(file)) {\n const config = JSON.parse(readFileSync(file, \"utf8\"));\n if (\n candidate === appRoot ||\n resolve(\n candidate,\n config.apps?.[0]?.appDir ?? config.appDir ?? \".\",\n ) === appRoot\n ) {\n root = candidate;\n break;\n }\n }\n if (dirname(candidate) === candidate) break;\n }\n }\n const tempoRoot = join(root, \"tempo\");\n const configFile = join(tempoRoot, \"tempo.config.json\");\n const config = existsSync(configFile)\n ? JSON.parse(readFileSync(configFile, \"utf8\"))\n : {};\n return {\n root,\n tempoRoot,\n canvasesRoot: canvasesOverride\n ? resolve(root, canvasesOverride)\n : resolve(tempoRoot, config.paths?.canvases ?? \"designs\"),\n };\n}\n\n/** Components inherit the app's stylesheet entry, including its Tailwind theme. */\nexport function discoverAstroStyles(appRoot: string): string[] {\n const styles = new Set<string>();\n const scan = (directory: string, depth: number) => {\n if (!existsSync(directory) || depth > 5) return;\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n if (entry.isSymbolicLink()) continue;\n const file = join(directory, entry.name);\n if (entry.isDirectory()) scan(file, depth + 1);\n else if (entry.name.endsWith(\".astro\")) {\n const source = readFileSync(file, \"utf8\");\n const parsed = parseAstroSource(source);\n if (parsed.kind !== \"ok\") continue;\n for (const declaration of parsed.imports) {\n const specifier = (declaration.source as { value?: unknown })?.value;\n if (\n typeof specifier !== \"string\" ||\n !specifier.endsWith(\".css\") ||\n specifier.endsWith(\".module.css\")\n )\n continue;\n const style = specifier.startsWith(\".\")\n ? resolve(dirname(file), specifier)\n : specifier;\n if (!specifier.startsWith(\".\") || existsSync(style))\n styles.add(style);\n }\n }\n }\n };\n scan(join(appRoot, \"src/layouts\"), 0);\n if (!styles.size) scan(join(appRoot, \"src/pages\"), 0);\n if (!styles.size)\n for (const file of [\n \"src/styles/global.css\",\n \"src/styles/tailwind.css\",\n \"src/styles.css\",\n \"src/index.css\",\n ]) {\n const candidate = resolve(appRoot, file);\n if (existsSync(candidate)) {\n styles.add(candidate);\n break;\n }\n }\n return [...styles];\n}\n","import { isAbsolute, relative } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\n/** The app owns CSS compilation. Include generated/native storyboard sources\n * even when Tailwind's automatic scan omits gitignored or sibling directories. */\nexport function astroTailwindSources(root: string, sources: string[]): Plugin {\n return {\n name: \"tempo:astro-tailwind-sources\",\n enforce: \"pre\",\n transform: {\n order: \"pre\",\n handler(code, id) {\n const file = id.split(\"?\")[0]!;\n if (\n !file.endsWith(\".css\") ||\n file.replaceAll(\"\\\\\", \"/\").includes(\"/node_modules/\")\n )\n return;\n const path = relative(root, file);\n if (path.startsWith(\"..\") || isAbsolute(path)) return;\n if (\n !/@import\\s+(?:url\\(\\s*)?[\"']tailwindcss(?:\\/[\\w.-]+)?[\"']/.test(code)\n )\n return;\n return {\n code: `${code}\\n${sources.map((directory) => `@source ${JSON.stringify(directory.replaceAll(\"\\\\\", \"/\"))};`).join(\"\\n\")}\\n`,\n map: null,\n };\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE,aAAAA;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAAC,aAAY,YAAAC,WAAU,WAAAC,gBAAe;AAC9C,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,qBAAqB;;;ACR9B,SAAS,iBAAiB;AAKnB,SAAS,0BACd,MACA,IACA,UACA,WACA;AACA,QAAM,SAAS,UAAU,GAAG,EAAE,OAAO,IAAI;AACzC,MAAI,OAAO,OAAO,OAAQ;AAC1B,MAAI,OAAO;AACX,SAAO,KAAK,SAAS,IAAI,EAAG,SAAQ;AACpC,QAAM,SAAS,IAAI,YAAY,IAAI;AACnC,QAAM,WAAW,oBAAI,IAAoB;AACzC,MAAI,UAAU;AACd,aAAW,QAAQ,OAAO,QAAQ,MAAM;AACtC,QAAI,KAAK,SAAS,4BAA4B;AAC5C,YAAM,QAAQ,KAAK;AACnB,UAAI,MAAM,SAAS,aAAc,UAAS,IAAI,MAAM,MAAM,SAAS;AAAA,gBAEhE,MAAM,SAAS,yBACd,MAAM,SAAS,uBACjB,MAAM;AAEN,iBAAS,IAAI,MAAM,GAAG,MAAM,SAAS;AAAA,WAClC;AACH,eAAO,YAAY,MAAM,OAAO,GAAG,IAAI,GAAG;AAC1C,eAAO;AAAA,UACL,MAAM;AAAA,UACN,KAAK,KAAK,UAAU,EAAE,GAAG,UAAU,YAAY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ACH,cAAc,CAAC,GAAI,OAAO,gBAAgB,CAAC,GAAI,WAAW,CAAC;AAAA,EAC7D;AACF;","names":["closeSync","fstatSync","openSync","readFileSync","isAbsolute","relative","resolve","fileURLToPath","parseSync","value","parseSync","file","root","route","existsSync","readFileSync","readdirSync","dirname","join","resolve","resolve","dirname","join","existsSync","config","readFileSync","readdirSync","isAbsolute","relative","fileURLToPath","resolve","isAbsolute","relative","openSync","fstatSync","readFileSync","closeSync"]}
|
|
1
|
+
{"version":3,"sources":["../astro.ts","../astro/compiler-adapter.ts","../astro/storyboards.ts","../astro/json.ts","../astro/project-context.ts","../astro/tailwind.ts"],"sourcesContent":["import {\n closeSync,\n fstatSync,\n openSync,\n readFileSync,\n realpathSync,\n} from \"node:fs\";\nimport { isAbsolute, relative, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { createRequire } from \"node:module\";\nimport type { AstroIntegration, AstroUserConfig } from \"astro\";\nimport type { Plugin } from \"vite\";\nimport {\n annotateAstroSource,\n parseAstroSource,\n type AstroModuleSource,\n} from \"@modules/astro-editor\";\nimport {\n instrumentAstroModule,\n instrumentFrameworkModule,\n} from \"./astro/compiler-adapter\";\nimport { sourceVersionHash } from \"@modules/annotation/source-version\";\nimport { createAstroStoryboardRegistry } from \"./astro/storyboards\";\nimport {\n astroProjectContext,\n discoverAstroStyles,\n} from \"./astro/project-context\";\nimport { astroTailwindSources } from \"./astro/tailwind\";\nimport { tempoVitePlugin } from \"./index\";\nimport {\n createTempoHostIdentity,\n TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,\n TEMPO_HOST_IDENTITY_ENDPOINT,\n} from \"./host-identity\";\n\nexport interface TempoAstroOptions {\n /** Annotation root; the application root by default. */\n root?: string;\n enabled?: boolean;\n /** Canvas declarations to expose as isolated documents. Defaults to tempo/designs. */\n canvasesRoot?: string;\n /** App-relative CSS entries for isolated components. Defaults to layout/global CSS discovery. */\n styles?: string[];\n}\n\n/** Native Astro server instrumentation. Inert for builds, previews and normal dev. */\nexport function tempoAstro(options: TempoAstroOptions = {}): AstroIntegration {\n return {\n name: \"tempo-astro\",\n hooks: {\n \"astro:config:setup\"({\n config,\n command,\n updateConfig,\n injectRoute,\n createCodegenDir,\n injectScript,\n }) {\n if (\n command !== \"dev\" ||\n !(options.enabled ?? Boolean(process.env.TEMPO))\n )\n return;\n const [nodeMajor, nodeMinor] = process.versions.node\n .split(\".\")\n .map(Number);\n if (nodeMajor! < 22 || (nodeMajor === 22 && nodeMinor! < 12))\n throw new Error(\"Tempo Astro support requires Node 22.12 or newer\");\n const appRequire = createRequire(new URL(\"package.json\", config.root));\n const version = appRequire(\"astro/package.json\").version as string;\n if (!version.startsWith(\"7.\"))\n throw new Error(\n `Tempo native Astro support requires Astro 7; this app uses ${version}`,\n );\n const appRoot = realpathSync.native(fileURLToPath(config.root));\n const { root, tempoRoot, canvasesRoot } = astroProjectContext(\n appRoot,\n options.root,\n options.canvasesRoot,\n );\n const generatedRoot = fileURLToPath(createCodegenDir());\n const canvasRoots = [\n canvasesRoot,\n resolve(tempoRoot, \".tempo/library-canvases\"),\n resolve(tempoRoot, \".tempo/asset-edit-previews\"),\n ];\n const registry = createAstroStoryboardRegistry(\n root,\n canvasRoots,\n generatedRoot,\n options.styles?.map((file) => resolve(appRoot, file)) ??\n discoverAstroStyles(appRoot),\n );\n injectRoute({\n pattern: \"/__tempo/astro/[...storyboard]\",\n entrypoint: registry.entrypoint,\n prerender: false,\n });\n injectScript(\n \"head-inline\",\n `if(!document.querySelector('meta[name=\"tempo-project-root\"]')){const m=document.createElement('meta');m.name='tempo-project-root';m.content=${JSON.stringify(root).replaceAll(\"<\", \"\\\\u003c\")};document.head.append(m)}`,\n );\n const documentClient = fileURLToPath(\n new URL(\n import.meta.url.endsWith(\".ts\")\n ? \"./astro/document-client.ts\"\n : \"./astro/document-client.js\",\n import.meta.url,\n ),\n );\n injectScript(\n \"page\",\n `import { startAstroDocumentClient } from ${JSON.stringify(documentClient)}; startAstroDocumentClient(import.meta.hot);`,\n );\n const identity: Plugin = {\n name: \"tempo:astro-identity\",\n // The generic annotation plugin also serves /__tempo/identity.\n // Register Astro's capability first, before its pre-enforced middleware.\n enforce: \"pre\",\n configureServer(server) {\n server.middlewares.use((req, res, next) => {\n if (\n req.method !== \"GET\" ||\n req.url?.split(\"?\")[0] !== TEMPO_HOST_IDENTITY_ENDPOINT\n )\n return next();\n res.setHeader(TEMPO_HOST_IDENTITY_CAPABILITY_HEADER, \"1\");\n res.setHeader(\"Cache-Control\", \"no-store\");\n res.setHeader(\"Content-Type\", \"application/json\");\n res.end(\n JSON.stringify({\n ...createTempoHostIdentity(\"astro\", {\n root: tempoRoot,\n pluginActive: true,\n }),\n capabilities: { astroComponents: 1 },\n }),\n );\n });\n },\n };\n updateConfig({\n vite: {\n plugins: [\n identity,\n astroTailwindSources(root, [\n ...canvasRoots,\n // Request-time registry data contains paths, never utilities.\n // Scanning it makes Tailwind reload pages on every board add.\n resolve(generatedRoot, \"*.astro\"),\n ]),\n ...astroAnnotationPlugins(root, generatedRoot),\n tempoVitePlugin({ root, enabled: true }),\n registry.plugin,\n ],\n },\n });\n },\n },\n };\n}\n\nexport function astroAnnotationPlugins(\n root: string,\n generatedRoot?: string,\n): Plugin[] {\n // Astro has separate SSR and prerender transform chains for the same module id.\n const environments = new WeakMap<\n object,\n Map<string, { metadata: AstroModuleSource; occurrenceFactory?: string }>\n >();\n const receiptMap = (environment: object) => {\n let map = environments.get(environment);\n if (!map) {\n map = new Map();\n environments.set(environment, map);\n }\n return map;\n };\n const runtime = fileURLToPath(new URL(\"./astro/runtime.js\", import.meta.url));\n // Development from source; published SDKs contain the .js sibling.\n const runtimeId = import.meta.url.endsWith(\".ts\")\n ? runtime.replace(/\\.js$/, \".ts\")\n : runtime;\n return [\n {\n name: \"tempo:astro-source\",\n enforce: \"pre\",\n transform: {\n order: \"pre\",\n handler(source, id, options) {\n const astro = id.endsWith(\".astro\");\n const framework = options?.ssr && /\\.[jt]sx?$/.test(id);\n if ((!astro && !framework) || id.includes(\"?\") || !isAbsolute(id))\n return;\n const receipts = receiptMap(this.environment);\n receipts.delete(id);\n let physical: string;\n try {\n physical = realpathSync.native(id);\n } catch {\n // Other integrations can emit virtual JS modules with file-like\n // ids. Only exact, on-disk source can authorize an edit receipt.\n return;\n }\n if (\n generatedRoot &&\n !relative(generatedRoot, physical).startsWith(\"..\")\n )\n return;\n const filepath = relative(root, physical).replaceAll(\"\\\\\", \"/\");\n if (\n !filepath ||\n filepath.startsWith(\"../\") ||\n isAbsolute(filepath) ||\n filepath.split(\"/\").includes(\"node_modules\")\n )\n return;\n // One descriptor ties disk bytes and stats to this transform, not a watcher cache.\n const fd = openSync(physical, \"r\");\n let metadata: AstroModuleSource;\n try {\n const before = fstatSync(fd);\n const raw = readFileSync(fd, \"utf8\");\n const after = fstatSync(fd);\n if (\n source !== raw ||\n !([\"mtimeMs\", \"ctimeMs\", \"size\", \"ino\", \"dev\"] as const).every(\n (key) => before[key] === after[key],\n )\n )\n return;\n const parsed = astro ? parseAstroSource(source) : null;\n if (parsed && parsed.kind !== \"ok\") return;\n metadata = {\n filepath,\n sourceVersion: parsed?.sourceVersion ?? sourceVersionHash(source),\n modifiedTs: Math.trunc(before.mtimeMs),\n };\n } finally {\n closeSync(fd);\n }\n if (framework) {\n receipts.set(id, { metadata });\n return;\n }\n const transformed = annotateAstroSource(source, metadata, id);\n if (transformed.kind !== \"ok\") this.error(transformed.message);\n receipts.set(id, {\n metadata,\n occurrenceFactory: transformed.occurrenceFactory,\n });\n return { code: transformed.code, map: transformed.map };\n },\n },\n },\n {\n name: \"tempo:astro-compiled\",\n enforce: \"post\",\n transform: {\n order: \"post\",\n handler(code, id) {\n if (\n generatedRoot &&\n id.endsWith(\".astro\") &&\n !relative(generatedRoot, id).startsWith(\"..\")\n ) {\n return instrumentAstroModule(\n code,\n id,\n null,\n runtimeId,\n \"$$tempoStoryboardHostId\",\n );\n }\n const receipts = receiptMap(this.environment);\n const receipt = receipts.get(id);\n if (!receipt) return;\n receipts.delete(id);\n if (!receipt.occurrenceFactory)\n return instrumentFrameworkModule(\n code,\n id,\n receipt.metadata,\n runtimeId,\n );\n return instrumentAstroModule(\n code,\n id,\n receipt.metadata,\n runtimeId,\n receipt.occurrenceFactory,\n );\n },\n },\n },\n ];\n}\n\nexport default tempoAstro;\n\n/** Preserve the app's complete config and integrate only at Astro's dev hook. */\nexport function withTempoAstro<T extends AstroUserConfig>(config: T): T;\nexport function withTempoAstro<T extends AstroUserConfig>(\n config: Promise<T>,\n): Promise<T>;\nexport function withTempoAstro<T extends AstroUserConfig>(\n config: T | Promise<T>,\n): T | Promise<T> {\n if (config instanceof Promise)\n return config.then((value) => withTempoAstro(value));\n return {\n ...config,\n integrations: [...(config.integrations ?? []), tempoAstro()],\n };\n}\n","import MagicString from \"magic-string\";\nimport { parseSync } from \"oxc-parser\";\nimport type { AstroModuleSource } from \"@modules/astro-editor\";\n\n/** SSR-only framework exports carry the same definition receipt as native\n * Astro factories, including when React renders null or an empty fragment. */\nexport function instrumentFrameworkModule(\n code: string,\n id: string,\n metadata: AstroModuleSource,\n runtimeId: string,\n) {\n const parsed = parseSync(`${id}.js`, code);\n if (parsed.errors.length) return;\n let name = \"$$tempoFrameworkComponent\";\n while (code.includes(name)) name += \"_\";\n const output = new MagicString(code);\n const bindings = new Map<string, string>();\n let wrapped = false;\n for (const node of parsed.program.body) {\n if (node.type === \"ExportDefaultDeclaration\") {\n const value = node.declaration;\n if (value.type === \"Identifier\") bindings.set(value.name, \"default\");\n else if (\n (value.type === \"FunctionDeclaration\" ||\n value.type === \"ClassDeclaration\") &&\n value.id\n )\n bindings.set(value.id.name, \"default\");\n else {\n output.prependLeft(value.start, `${name}(`);\n output.appendLeft(\n value.end,\n `, ${JSON.stringify({ ...metadata, exportName: \"default\" })})`,\n );\n wrapped = true;\n }\n } else if (node.type === \"ExportNamedDeclaration\" && !node.source) {\n const value = node.declaration;\n if (value?.type === \"VariableDeclaration\") {\n for (const declaration of value.declarations)\n if (declaration.id.type === \"Identifier\")\n bindings.set(declaration.id.name, declaration.id.name);\n } else if (\n (value?.type === \"FunctionDeclaration\" ||\n value?.type === \"ClassDeclaration\") &&\n value.id\n )\n bindings.set(value.id.name, value.id.name);\n for (const specifier of node.specifiers)\n if (specifier.local.type === \"Identifier\")\n bindings.set(\n specifier.local.name,\n specifier.exported.type === \"Identifier\"\n ? specifier.exported.name\n : specifier.exported.value,\n );\n }\n }\n if (!wrapped && !bindings.size) return;\n output.prepend(\n `import { instrumentFrameworkComponent as ${name} } from ${JSON.stringify(runtimeId)};\\n`,\n );\n for (const [binding, exportName] of bindings)\n output.append(\n `\\n${name}(${binding}, ${JSON.stringify({ ...metadata, exportName })});`,\n );\n return {\n code: output.toString(),\n map: output.generateMap({ source: id, includeContent: true, hires: true }),\n };\n}\n\n/** One isolated Astro 7 compiled-helper contract, validated before running any user code. */\nexport function instrumentAstroModule(\n code: string,\n id: string,\n metadata: AstroModuleSource | null,\n runtimeId: string,\n occurrenceFactory: string,\n) {\n const parsed = parseSync(`${id}.js`, code);\n if (parsed.errors.length)\n throw new Error(`Tempo could not parse Astro's compiled module: ${id}`);\n const output = new MagicString(code);\n let prefix = \"$$tempo\";\n while (code.includes(prefix)) prefix += \"_\";\n const wrappers: string[] = [];\n let hasFactory = false;\n for (const node of parsed.program.body) {\n if (node.type !== \"ImportDeclaration\") continue;\n const runtime = node.source.value;\n if (\n runtime !== \"astro/runtime/server/index.js\" &&\n runtime !== \"astro/compiler-runtime\" &&\n runtime !== \"astro/runtime/compiler/index.js\" &&\n !runtime.endsWith(\"/astro/dist/runtime/compiler/index.js\")\n )\n continue;\n for (const specifier of node.specifiers) {\n if (\n specifier.type !== \"ImportSpecifier\" ||\n specifier.imported.type !== \"Identifier\"\n )\n continue;\n const imported = specifier.imported.name;\n if (imported !== \"createComponent\" && imported !== \"renderComponent\")\n continue;\n if (imported === \"createComponent\" && !metadata) {\n hasFactory = true;\n continue;\n }\n const local = specifier.local;\n const original = `${prefix}_${imported}`;\n output.overwrite(\n specifier.start,\n specifier.end,\n `${imported} as ${original}`,\n );\n const helper =\n imported === \"createComponent\"\n ? \"instrumentCreateComponent\"\n : \"instrumentRenderComponent\";\n wrappers.push(\n `const ${local.name} = ${prefix}_${helper}(${original}${imported === \"createComponent\" ? `, ${JSON.stringify(metadata)}` : \"\"});`,\n );\n if (imported === \"createComponent\") hasFactory = true;\n }\n }\n if (!hasFactory)\n throw new Error(\n `Unsupported Astro compiler output for ${id}; Tempo requires Astro 7 createComponent (${parsed.program.body\n .filter((n) => n.type === \"ImportDeclaration\")\n .map((n) => n.source.value)\n .join(\", \")})`,\n );\n output.prepend(\n `import { astroHostId as ${occurrenceFactory}, instrumentCreateComponent as ${prefix}_instrumentCreateComponent, instrumentRenderComponent as ${prefix}_instrumentRenderComponent } from ${JSON.stringify(runtimeId)};\\n${wrappers.join(\"\\n\")}\\n`,\n );\n return {\n code: output.toString(),\n map: output.generateMap({ source: id, includeContent: true, hires: true }),\n };\n}\n","import { createHash } from \"node:crypto\";\nimport {\n existsSync,\n readFileSync,\n readdirSync,\n mkdirSync,\n writeFileSync,\n openSync,\n closeSync,\n fstatSync,\n} from \"node:fs\";\nimport { sourceVersionHash } from \"@modules/annotation/source-version\";\nimport { dirname, isAbsolute, join, relative, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { Plugin } from \"vite\";\nimport {\n componentFrameworkForStoryboard,\n parseCanvasFile,\n} from \"../canvas/parser\";\nimport { astroStoryboardPath } from \"../canvas/astro-contract\";\nimport { readAstroStoryboardProps } from \"./json\";\nimport { parseSync } from \"oxc-parser\";\n\ninterface AstroStoryboardRoute {\n path: string;\n file: string;\n source: string;\n revision: string;\n}\n\n// A document can receive its HTML before a canvas write, then connect to Vite\n// after that write's full-reload event. Reconcile on connection so the missed\n// event cannot leave the newly opened storyboard showing old props forever.\nconst revisionClient = `<script>\nconst hot = import.meta.hot;\nif (hot) {\n const receipt = () => JSON.parse(document.querySelector('meta[name=\"tempo-astro-storyboard\"]')?.getAttribute('content') ?? 'null');\n const check = () => hot.send('tempo:astro:revision-request', { path: location.pathname, revision: receipt()?.revision });\n const accept = (data) => {\n if (data.path === location.pathname && data.revision !== receipt()?.revision) location.reload();\n };\n hot.on('tempo:astro:revision', accept);\n hot.on('vite:ws:connect', check);\n check();\n hot.dispose(() => {\n hot.off('tempo:astro:revision', accept);\n hot.off('vite:ws:connect', check);\n });\n}\n</script>`;\n\nfunction filesUnder(root: string): string[] {\n if (!existsSync(root)) return [];\n return readdirSync(root, { withFileTypes: true }).flatMap((entry) => {\n if (entry.isSymbolicLink()) return [];\n const file = join(root, entry.name);\n return entry.isDirectory()\n ? filesUnder(file)\n : entry.name.endsWith(\".canvas.tsx\")\n ? [file]\n : [];\n });\n}\n\n/** Only the owning canvas is parsed. Its module and frontmatter are never executed. */\nexport function collectAstroStoryboards(\n root: string,\n canvasesRoot: string | string[],\n generatedRoot: string,\n styles: string[] = [],\n): AstroStoryboardRoute[] {\n const routes: AstroStoryboardRoute[] = [];\n for (const canvasFile of new Set(\n (Array.isArray(canvasesRoot) ? canvasesRoot : [canvasesRoot]).flatMap(\n filesUnder,\n ),\n )) {\n const fd = openSync(canvasFile, \"r\");\n let source: string, modifiedTs: number;\n try {\n const before = fstatSync(fd);\n source = readFileSync(fd, \"utf8\");\n const after = fstatSync(fd);\n if (\n !([\"mtimeMs\", \"ctimeMs\", \"size\", \"ino\", \"dev\"] as const).every(\n (key) => before[key] === after[key],\n )\n )\n throw new Error(`Canvas changed while reading: ${canvasFile}`);\n modifiedTs = Math.trunc(before.mtimeMs);\n } finally {\n closeSync(fd);\n }\n const canvas = parseCanvasFile(canvasFile, source);\n const canvasPath =\n canvas.canvasPath ??\n relative(root, dirname(canvasFile)).replaceAll(\"\\\\\", \"/\");\n for (const storyboard of canvas.storyboards) {\n if (componentFrameworkForStoryboard(storyboard) !== \"astro\") continue;\n const path = astroStoryboardPath(canvasPath, storyboard.storyboardKey);\n const file = join(\n generatedRoot,\n `${createHash(\"sha256\").update(path).digest(\"hex\")}.astro`,\n );\n const revision = createHash(\"sha256\").update(source).digest(\"hex\");\n let generated: string;\n try {\n if (\n canvas.errors.some((error) => error.kind === \"structural\") ||\n storyboard.errors.length\n )\n throw new Error(\n \"Fix the Astro storyboard's canvas declaration before rendering it\",\n );\n const imported = storyboard.component?.import;\n if (\n !imported ||\n imported.kind !== \"default\" ||\n !imported.source.endsWith(\".astro?tempo-component\")\n )\n throw new Error(\n \"AstroStoryboard requires a default .astro?tempo-component import; use an authored .astro fixture for slots and server data\",\n );\n const module = imported.source.slice(0, -\"?tempo-component\".length);\n const specifier = module.startsWith(\".\")\n ? resolve(dirname(canvasFile), module).replaceAll(\"\\\\\", \"/\")\n : module;\n const props = JSON.stringify(\n readAstroStoryboardProps(storyboard.props?.expression),\n ).replaceAll(\"<\", \"\\\\u003c\");\n const callsite = JSON.stringify({\n filepath: relative(root, canvasFile).replaceAll(\"\\\\\", \"/\"),\n sourceVersion: sourceVersionHash(source),\n modifiedTs,\n position: storyboard.jsxElementSpan.start,\n name: storyboard.component?.localName ?? \"Component\",\n });\n const receipt = JSON.stringify({\n canvasPath,\n storyboardId: storyboard.storyboardKey,\n revision,\n });\n let preview: Record<string, unknown> | undefined;\n if (\n canvasFile\n .replaceAll(\"\\\\\", \"/\")\n .includes(\"/.tempo/asset-edit-previews/\")\n ) {\n for (const statement of parseSync(canvasFile, source).program.body) {\n if (\n statement.type !== \"ExportNamedDeclaration\" ||\n statement.declaration?.type !== \"VariableDeclaration\"\n )\n continue;\n for (const declaration of statement.declaration.declarations)\n if (\n declaration.id.type === \"Identifier\" &&\n declaration.id.name === \"__tempoAstroAssetPreview\" &&\n declaration.init\n )\n preview = readAstroStoryboardProps(\n source.slice(declaration.init.start, declaration.init.end),\n );\n }\n }\n generated = `---\\nimport Component from ${JSON.stringify(specifier)};\\nimport ComponentMetadata from ${JSON.stringify(specifier + \"?tempo-component\")};\\n${styles.map((file) => `import ${JSON.stringify(file.replaceAll(\"\\\\\", \"/\"))};`).join(\"\\n\")}\\nconst props = ${props};\\nconst controls = JSON.stringify(ComponentMetadata.__tempoAstroControls ?? {});\\n---\\n<!doctype html><html><head><meta charset=\"UTF-8\" /><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /><meta name=\"tempo-project-root\" content={${JSON.stringify(root)}} /><meta name=\"tempo-astro-storyboard\" content={${JSON.stringify(receipt)}} /></head><body style=\"margin:0\"><Component {...props} __tempo_astro_callsite__={${callsite}} /><pre hidden data-asset-definition={controls}>Component controls</pre></body></html>`;\n if (preview) {\n const client = fileURLToPath(\n new URL(\n import.meta.url.endsWith(\".ts\")\n ? \"./asset-preview-client.ts\"\n : \"./astro/asset-preview-client.js\",\n import.meta.url,\n ),\n );\n generated = generated\n .replace(\n `const props = ${props};`,\n `const preview = ${JSON.stringify(preview).replaceAll(\"<\", \"\\\\u003c\")};\nconst raw = Astro.url.searchParams.get(\"__tempo_asset_update\");\nif (raw && raw.length > 64000) throw new Error(\"Astro preview props are too large\");\nconst update = raw ? JSON.parse(raw) : {variant:null,edits:{}};\nif (!(update.variant === null || typeof update.variant === \"string\") || !update.edits || typeof update.edits !== \"object\" || Array.isArray(update.edits)) throw new Error(\"Invalid Astro preview props\");\nconst variant = update.variant !== null && Object.hasOwn(preview.asset.variants,update.variant) ? preview.asset.variants[update.variant] : undefined;\nif (update.variant !== null && (!variant || variant.error)) throw new Error(variant?.error ?? \"The Astro asset variant no longer exists\");\nconst props = {...variant?.props};\nfor (const [key,value] of Object.entries(update.edits)) { if(value && typeof value === \"object\" && Object.keys(value).length===1 && value.__tempo_omit_prop__===true) delete props[key]; else Object.defineProperty(props,key,{value,enumerable:true,configurable:true}); }\nconst assetMetadata = JSON.stringify({sessionId:preview.sessionId,metadata:{asset:preview.asset,...ComponentMetadata.__tempoAstroControls}});`,\n )\n .replace(\n \"</head>\",\n `<meta name=\"tempo-astro-asset-preview\" content={assetMetadata} /></head>`,\n )\n .replace(\n `<Component {...props} __tempo_astro_callsite__={${callsite}} />`,\n `{update.variant !== null && <Component {...props} __tempo_astro_callsite__={${callsite}} />}`,\n )\n .replace(\n \"</body>\",\n `<script>import {startAstroAssetPreview} from ${JSON.stringify(client)}; startAstroAssetPreview();</script></body>`,\n );\n }\n } catch (error) {\n // A broken board fails in its own route without importing or breaking siblings.\n generated = `---\\nthrow new Error(${JSON.stringify(error instanceof Error ? error.message : String(error))});\\n---`;\n }\n generated = generated.replace(\"</body>\", `${revisionClient}</body>`);\n routes.push({ path, file, source: generated, revision });\n }\n }\n const seen = new Set<string>();\n for (const route of routes) {\n if (seen.has(route.path))\n throw new Error(`Duplicate Astro storyboard address: ${route.path}`);\n seen.add(route.path);\n }\n return routes;\n}\n\nfunction writeChanged(file: string, source: string) {\n const exists = existsSync(file);\n if (exists && readFileSync(file, \"utf8\") === source) return;\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(file, source);\n return exists ? \"updated\" : \"created\";\n}\n\nfunction storyboardEntrypoint(registryFile: string): string {\n // Astro's normal page CSS collector traverses every statically known import,\n // including lazy glob imports. Use its content asset boundary to collect only\n // the selected document's assets. This is an Astro 7 adapter: the real-server\n // tests pin both the propagation module and native SSR result contracts.\n return String.raw`---\nimport { readFileSync } from \"node:fs\";\nimport { createComponent } from \"astro/runtime/server/index.js\";\nconst base = import.meta.env.BASE_URL.replace(/\\/$/, \"\");\nconst pathname = Astro.url.pathname.slice(base.length).replace(/\\/$/, \"\");\nconst routes = JSON.parse(readFileSync(${JSON.stringify(registryFile)}, \"utf8\"));\nconst route = routes.find((entry) => entry.path === pathname);\nif (!route) return new Response(\"Astro storyboard not found\", { status: 404 });\n// Do not turn these into a glob or a static import map: unopened boards may\n// contain broken imports, and their global CSS must never enter this document.\nconst { default: assets } = await import(/* @vite-ignore */ route.file + \"?astroPropagatedAssets\");\nconst { default: Page } = await assets.getMod();\nconst Preview = createComponent((result, props, slots) => {\n // The generated document owns its <head>. It was loaded during frontmatter,\n // after Astro computed the dispatch page's static head metadata.\n result._metadata.headInTree = true;\n result._metadata.routeHasPropagation = true;\n for (const style of assets.collectedStyles) {\n result.styles.add({ props: { \"data-vite-dev-id\": style.id }, children: style.content });\n const src = style.id.startsWith(\"/@id/\") ? style.id : \"/@fs/\" + style.id.replace(/^\\//, \"\");\n result.scripts.add({ props: { type: \"module\", src: base + src }, children: \"\" });\n }\n for (const href of assets.collectedLinks) {\n result.links.add({ props: { rel: \"stylesheet\", href }, children: \"\" });\n }\n return Page(result, props, slots);\n});\n---\n<Preview />`;\n}\n\n/** A permanent route dispatches into isolated native documents without restarting Astro. */\nexport function createAstroStoryboardRegistry(\n root: string,\n canvasesRoot: string | string[],\n generatedRoot: string,\n styles: string[] = [],\n) {\n const roots = Array.isArray(canvasesRoot) ? canvasesRoot : [canvasesRoot];\n const routes = collectAstroStoryboards(root, roots, generatedRoot, styles);\n let currentRoutes = routes;\n const registryFile = join(generatedRoot, \"routes.json\");\n const entrypoint = join(generatedRoot, \"storyboards.astro\");\n const shape = (items: AstroStoryboardRoute[]) =>\n JSON.stringify(\n items.map(({ path, file }) => ({\n path,\n file: file.replaceAll(\"\\\\\", \"/\"),\n })),\n );\n const unmodifiedNewFiles = new Set<string>();\n const writeDocument = (route: AstroStoryboardRoute) => {\n const change = writeChanged(route.file, route.source);\n const file = route.file.replaceAll(\"\\\\\", \"/\");\n if (change === \"created\") unmodifiedNewFiles.add(file);\n // Do not suppress a delayed create event after a second write: a client\n // may already have rendered the first version, and still needs HMR.\n else if (change === \"updated\") unmodifiedNewFiles.delete(file);\n return change;\n };\n for (const route of routes) writeDocument(route);\n writeChanged(registryFile, shape(routes));\n writeChanged(entrypoint, storyboardEntrypoint(registryFile));\n const plugin: Plugin = {\n name: \"tempo:astro-storyboards\",\n hotUpdate: {\n order: \"pre\",\n handler({ type, file, modules }) {\n // A new document may be requested before its watcher add event arrives.\n // Astro then sees an already-loaded SSR module and reloads every page,\n // even though nobody has rendered an older version of this new file.\n // Real changes still use Astro's ordinary invalidation and HMR path.\n if (type === \"create\" && unmodifiedNewFiles.has(file))\n return modules.filter((module) => module.file !== file);\n },\n },\n configureServer(server) {\n const changed = (file: string) => {\n if (\n !file.endsWith(\".canvas.tsx\") ||\n !roots.some((root) => {\n const path = relative(root, file);\n return !isAbsolute(path) && !path.startsWith(\"../\");\n })\n )\n return;\n try {\n const next = collectAstroStoryboards(\n root,\n roots,\n generatedRoot,\n styles,\n );\n const updatedFiles = next\n .filter((route) => writeDocument(route) === \"updated\")\n .map((route) => route.file);\n const nextFiles = new Set(\n next.map((route) => route.file.replaceAll(\"\\\\\", \"/\")),\n );\n for (const file of unmodifiedNewFiles)\n if (!nextFiles.has(file)) unmodifiedNewFiles.delete(file);\n currentRoutes = next;\n // This is request-time data, never an Astro config watch file or a\n // static module import. Registry membership cannot restart Vite.\n writeChanged(registryFile, shape(next));\n // These writes are already known; don't depend on a second native\n // event to invalidate Astro's compiled output. A newly generated\n // document can be imported before its directory is being watched,\n // especially while the replacement watcher is starting after restart.\n for (const file of updatedFiles) server.watcher.emit(\"change\", file);\n } catch (error) {\n server.config.logger.error(String(error));\n }\n };\n server.watcher.add(roots);\n server.watcher\n .on(\"add\", changed)\n .on(\"change\", changed)\n .on(\"unlink\", changed);\n const verifyRevision = (\n data: { path?: string; revision?: string },\n client: {\n send(payload: { type: \"custom\"; event: string; data: unknown }): void;\n },\n ) => {\n if (typeof data?.path !== \"string\" || typeof data.revision !== \"string\")\n return;\n const base = server.config.base.replace(/\\/$/, \"\");\n const pathname =\n base && data.path.startsWith(`${base}/`)\n ? data.path.slice(base.length)\n : data.path;\n const route = currentRoutes.find((route) => route.path === pathname);\n if (route)\n client.send({\n type: \"custom\",\n event: \"tempo:astro:revision\",\n data: { path: data.path, revision: route.revision },\n });\n };\n server.ws.on(\"tempo:astro:revision-request\", verifyRevision);\n const dispose = () => {\n server.ws.off(\"tempo:astro:revision-request\", verifyRevision);\n server.watcher\n .off(\"add\", changed)\n .off(\"change\", changed)\n .off(\"unlink\", changed);\n };\n // Vite creates the next server before closing the old one. A shared\n // closeBundle callback would tear down the new server's registrations.\n server.httpServer?.once(\"close\", dispose);\n },\n };\n return { routes, registryFile, entrypoint, plugin };\n}\n","import { parseSync } from \"oxc-parser\";\nimport type { AstroJson } from \"../canvas/astro-contract\";\n\n/** Static data extraction only. Reject syntax which could execute frontmatter or canvas code. */\nexport function readAstroStoryboardProps(\n expression?: string,\n): Record<string, AstroJson> {\n if (!expression) return {};\n const parsed = parseSync(\"props.ts\", `(${expression})`);\n if (parsed.errors.length)\n throw new Error(\"Astro storyboard props must be a JSON object literal\");\n const read = (node: any): AstroJson => {\n if (node?.type === \"ParenthesizedExpression\") return read(node.expression);\n if (\n node?.type === \"Literal\" &&\n (node.value === null ||\n [\"string\", \"boolean\"].includes(typeof node.value) ||\n (typeof node.value === \"number\" && Number.isFinite(node.value)))\n )\n return node.value;\n if (\n node?.type === \"UnaryExpression\" &&\n [\"-\", \"+\"].includes(node.operator) &&\n node.argument?.type === \"Literal\" &&\n typeof node.argument.value === \"number\" &&\n Number.isFinite(node.argument.value)\n )\n return node.operator === \"-\" ? -node.argument.value : node.argument.value;\n if (node?.type === \"ArrayExpression\") return node.elements.map(read);\n if (node?.type === \"ObjectExpression\") {\n const value: Record<string, AstroJson> = Object.create(null);\n for (const property of node.properties) {\n if (\n property.type !== \"Property\" ||\n property.computed ||\n property.method ||\n property.shorthand ||\n property.kind !== \"init\"\n )\n throw new Error(\n \"Astro storyboard props cannot contain expressions, spreads or getters\",\n );\n const key =\n property.key.type === \"Identifier\"\n ? property.key.name\n : property.key.value;\n if (typeof key !== \"string\" && typeof key !== \"number\")\n throw new Error(\"Astro storyboard props require literal keys\");\n value[key] = read(property.value);\n }\n return value;\n }\n throw new Error(\n \"Astro storyboard props must be static JSON; use an authored .astro fixture for server data or slots\",\n );\n };\n const statement = parsed.program.body[0];\n const value = read(\n statement?.type === \"ExpressionStatement\"\n ? statement.expression\n : undefined,\n );\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n throw new Error(\"Astro storyboard props must be a JSON object literal\");\n return value;\n}\n","import { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { parseAstroSource } from \"@modules/astro-editor\";\n\n/** Locate the workspace owning this app without assuming the app is at its root. */\nexport function astroProjectContext(\n appRoot: string,\n rootOverride?: string,\n canvasesOverride?: string,\n) {\n let root = resolve(rootOverride ?? appRoot);\n if (!rootOverride) {\n for (let candidate = root; ; candidate = dirname(candidate)) {\n const file = join(candidate, \"tempo/tempo.config.json\");\n if (existsSync(file)) {\n const config = JSON.parse(readFileSync(file, \"utf8\"));\n if (\n candidate === appRoot ||\n resolve(\n candidate,\n config.apps?.[0]?.appDir ?? config.appDir ?? \".\",\n ) === appRoot\n ) {\n root = candidate;\n break;\n }\n }\n if (dirname(candidate) === candidate) break;\n }\n }\n const tempoRoot = join(root, \"tempo\");\n const configFile = join(tempoRoot, \"tempo.config.json\");\n const config = existsSync(configFile)\n ? JSON.parse(readFileSync(configFile, \"utf8\"))\n : {};\n return {\n root,\n tempoRoot,\n canvasesRoot: canvasesOverride\n ? resolve(root, canvasesOverride)\n : resolve(tempoRoot, config.paths?.canvases ?? \"designs\"),\n };\n}\n\n/** Components inherit the app's stylesheet entry, including its Tailwind theme. */\nexport function discoverAstroStyles(appRoot: string): string[] {\n const styles = new Set<string>();\n const scan = (directory: string, depth: number) => {\n if (!existsSync(directory) || depth > 5) return;\n for (const entry of readdirSync(directory, { withFileTypes: true })) {\n if (entry.isSymbolicLink()) continue;\n const file = join(directory, entry.name);\n if (entry.isDirectory()) scan(file, depth + 1);\n else if (entry.name.endsWith(\".astro\")) {\n const source = readFileSync(file, \"utf8\");\n const parsed = parseAstroSource(source);\n if (parsed.kind !== \"ok\") continue;\n for (const declaration of parsed.imports) {\n const specifier = (declaration.source as { value?: unknown })?.value;\n if (\n typeof specifier !== \"string\" ||\n !specifier.endsWith(\".css\") ||\n specifier.endsWith(\".module.css\")\n )\n continue;\n const style = specifier.startsWith(\".\")\n ? resolve(dirname(file), specifier)\n : specifier;\n if (!specifier.startsWith(\".\") || existsSync(style))\n styles.add(style);\n }\n }\n }\n };\n scan(join(appRoot, \"src/layouts\"), 0);\n if (!styles.size) scan(join(appRoot, \"src/pages\"), 0);\n if (!styles.size)\n for (const file of [\n \"src/styles/global.css\",\n \"src/styles/tailwind.css\",\n \"src/styles.css\",\n \"src/index.css\",\n ]) {\n const candidate = resolve(appRoot, file);\n if (existsSync(candidate)) {\n styles.add(candidate);\n break;\n }\n }\n return [...styles];\n}\n","import { isAbsolute, relative } from \"node:path\";\nimport type { Plugin } from \"vite\";\n\n/** The app owns CSS compilation. Include generated/native storyboard sources\n * even when Tailwind's automatic scan omits gitignored or sibling directories. */\nexport function astroTailwindSources(root: string, sources: string[]): Plugin {\n return {\n name: \"tempo:astro-tailwind-sources\",\n enforce: \"pre\",\n transform: {\n order: \"pre\",\n handler(code, id) {\n const file = id.split(\"?\")[0]!;\n if (\n !file.endsWith(\".css\") ||\n file.replaceAll(\"\\\\\", \"/\").includes(\"/node_modules/\")\n )\n return;\n const path = relative(root, file);\n if (path.startsWith(\"..\") || isAbsolute(path)) return;\n if (\n !/@import\\s+(?:url\\(\\s*)?[\"']tailwindcss(?:\\/[\\w.-]+)?[\"']/.test(code)\n )\n return;\n return {\n code: `${code}\\n${sources.map((directory) => `@source ${JSON.stringify(directory.replaceAll(\"\\\\\", \"/\"))};`).join(\"\\n\")}\\n`,\n map: null,\n };\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE,aAAAA;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAAC,aAAY,YAAAC,WAAU,WAAAC,gBAAe;AAC9C,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,qBAAqB;;;ACR9B,SAAS,iBAAiB;AA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AQ,KACpB,CAACJ,UAAS,eAAe,EAAE,EAAE,WAAW,IAAI,GAC5C;AACA,mBAAO;AAAA,cACL;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,UACF;AACA,gBAAM,WAAW,WAAW,KAAK,WAAW;AAC5C,gBAAM,UAAU,SAAS,IAAI,EAAE;AAC/B,cAAI,CAAC,QAAS;AACd,mBAAS,OAAO,EAAE;AAClB,cAAI,CAAC,QAAQ;AACX,mBAAO;AAAA,cACL;AAAA,cACA;AAAA,cACA,QAAQ;AAAA,cACR;AAAA,YACF;AACF,iBAAO;AAAA,YACL;AAAA,YACA;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,YACA,QAAQ;AAAA,UACV;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,gBAAQ;AAOR,SAAS,eACd,QACgB;AAChB,MAAI,kBAAkB;AACpB,WAAO,OAAO,KAAK,CAAC,UAAU,eAAe,KAAK,CAAC;AACrD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,cAAc,CAAC,GAAI,OAAO,gBAAgB,CAAC,GAAI,WAAW,CAAC;AAAA,EAC7D;AACF;","names":["closeSync","fstatSync","openSync","readFileSync","isAbsolute","relative","resolve","fileURLToPath","parseSync","value","parseSync","file","root","route","existsSync","readFileSync","readdirSync","dirname","join","resolve","resolve","dirname","join","existsSync","config","readFileSync","readdirSync","isAbsolute","relative","fileURLToPath","resolve","isAbsolute","relative","openSync","fstatSync","readFileSync","closeSync"]}
|
package/dist/canvas/astro.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { AstroJson, AstroComponent } from './astro-contract.js';
|
|
3
3
|
export { astroStoryboardPath, isAstroComponent } from './astro-contract.js';
|
|
4
|
-
import {
|
|
4
|
+
import { S as StoryboardLayout, a as StoryboardVrtConfig } from '../storyboard-CMJVBSXn.js';
|
|
5
5
|
import '../page-DwLnOM5d.js';
|
|
6
6
|
import '../v1-client-compat-qxaXEDm_.js';
|
|
7
7
|
|
package/dist/canvas/astro.js
CHANGED
package/dist/canvas/editor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ParsedCanvasFile, CanvasSourceSpan } from './parser.js';
|
|
1
|
+
import { StoryboardUiFramework, ParsedCanvasFile, CanvasSourceSpan } from './parser.js';
|
|
2
2
|
import { V as V1LayoutCompat } from '../v1-client-compat-qxaXEDm_.js';
|
|
3
3
|
import 'oxc-parser';
|
|
4
4
|
|
|
@@ -21,10 +21,13 @@ type CanvasEditorLayout = {
|
|
|
21
21
|
};
|
|
22
22
|
type AddCanvasStoryboardInput = {
|
|
23
23
|
kind: "component";
|
|
24
|
-
/** The component's authored framework, as the declaration
|
|
25
|
-
* parser
|
|
26
|
-
*
|
|
27
|
-
|
|
24
|
+
/** The component's authored framework, as the declaration spells it
|
|
25
|
+
* (the parser reports it through `componentFramework`): a Svelte
|
|
26
|
+
* component is written as
|
|
27
|
+
* `<SvelteStoryboard>` from "tempo-sdk/canvas/svelte", a Vue one as
|
|
28
|
+
* `<VueStoryboard>` from "tempo-sdk/canvas/vue", an Astro one as
|
|
29
|
+
* `<AstroStoryboard>` from "tempo-sdk/canvas/astro". */
|
|
30
|
+
uiFramework?: StoryboardUiFramework;
|
|
28
31
|
id: string;
|
|
29
32
|
/** Migration passes a legacy responsive layout in its V1-readable
|
|
30
33
|
* spelling (see v1-file-compat.ts). */
|
|
@@ -54,6 +57,13 @@ type AddCanvasStoryboardInput = {
|
|
|
54
57
|
name?: string;
|
|
55
58
|
filepath?: string;
|
|
56
59
|
src?: string;
|
|
60
|
+
} | {
|
|
61
|
+
kind: "flutter";
|
|
62
|
+
id: string;
|
|
63
|
+
layout: CanvasEditorLayout;
|
|
64
|
+
name?: string;
|
|
65
|
+
/** `lib/<file>.dart#<function>` inside the project's Flutter app. */
|
|
66
|
+
preview: string;
|
|
57
67
|
};
|
|
58
68
|
declare function applyCanvasSourceEdits(source: string, edits: readonly CanvasSourceEdit[]): string;
|
|
59
69
|
declare function updateCanvasName(options: {
|
package/dist/canvas/editor.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
STORYBOARD_SDK_COMPONENTS,
|
|
3
|
+
parseCanvasFile,
|
|
4
|
+
storyboardComponentForFramework
|
|
5
|
+
} from "../chunk-Y72PIE3I.js";
|
|
6
|
+
import "../chunk-CYQE3TLC.js";
|
|
4
7
|
|
|
5
8
|
// canvas/editor.ts
|
|
6
9
|
import { parseSync } from "oxc-parser";
|
|
@@ -662,8 +665,8 @@ function storyboardElementProps(storyboard, componentExpression) {
|
|
|
662
665
|
if (storyboard.kind === "legacy-v1") {
|
|
663
666
|
return [idProp, `storyboard={${storyboard.storyboardExpression}}`];
|
|
664
667
|
}
|
|
665
|
-
if ((storyboard.kind === "route" || storyboard.kind === "html") && (storyboard.layout.width === void 0 || storyboard.layout.height === void 0)) {
|
|
666
|
-
throw new Error("Route and
|
|
668
|
+
if ((storyboard.kind === "route" || storyboard.kind === "html" || storyboard.kind === "flutter") && (storyboard.layout.width === void 0 || storyboard.layout.height === void 0)) {
|
|
669
|
+
throw new Error("Route, HTML and Flutter layouts require width and height");
|
|
667
670
|
}
|
|
668
671
|
return [
|
|
669
672
|
idProp,
|
|
@@ -687,6 +690,9 @@ function storyboardKindProps(storyboard, componentExpression) {
|
|
|
687
690
|
if (storyboard.kind === "route") {
|
|
688
691
|
return [formatJsxStringAttribute("route", storyboard.route)];
|
|
689
692
|
}
|
|
693
|
+
if (storyboard.kind === "flutter") {
|
|
694
|
+
return [formatJsxStringAttribute("preview", storyboard.preview)];
|
|
695
|
+
}
|
|
690
696
|
return [
|
|
691
697
|
...storyboard.filepath ? [formatJsxStringAttribute("filepath", storyboard.filepath)] : [],
|
|
692
698
|
...storyboard.src ? [formatJsxStringAttribute("src", storyboard.src)] : []
|
|
@@ -705,13 +711,12 @@ function formatLayout(layout) {
|
|
|
705
711
|
function sdkComponentForStoryboard(storyboard) {
|
|
706
712
|
if (storyboard.kind === "route") return "RouteStoryboard";
|
|
707
713
|
if (storyboard.kind === "html") return "HtmlStoryboard";
|
|
714
|
+
if (storyboard.kind === "flutter") return "FlutterStoryboard";
|
|
708
715
|
if (storyboard.kind === "legacy-v1") return "LegacyStoryboardV1";
|
|
709
|
-
|
|
710
|
-
if (storyboard.uiFramework === "astro") return "AstroStoryboard";
|
|
711
|
-
return "Storyboard";
|
|
716
|
+
return storyboardComponentForFramework(storyboard.uiFramework);
|
|
712
717
|
}
|
|
713
718
|
function resolveSdkTag(parsed, component) {
|
|
714
|
-
const sdkSource = component
|
|
719
|
+
const sdkSource = STORYBOARD_SDK_COMPONENTS[component].importSource;
|
|
715
720
|
for (const item of parsed.imports) {
|
|
716
721
|
if (item.source !== sdkSource) continue;
|
|
717
722
|
if (item.kind === "namespace")
|