tempo-sdk 0.0.79 → 0.0.85
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/astro.js +3 -3
- package/dist/canvas/astro.js +2 -2
- package/dist/canvas/index.js +12 -7
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +2 -2
- package/dist/canvas/svelte.js +2 -2
- package/dist/canvas/vue.js +2 -2
- package/dist/{chunk-4PGZTWKS.js → chunk-2OFKPSKO.js} +4 -3
- package/dist/{chunk-4PGZTWKS.js.map → chunk-2OFKPSKO.js.map} +1 -1
- package/dist/{chunk-XFPFWTWX.js → chunk-2ZQMVAFM.js} +4 -1
- package/dist/{chunk-XFPFWTWX.js.map → chunk-2ZQMVAFM.js.map} +1 -1
- package/dist/{chunk-UBTL6JUF.js → chunk-DMT5MRMS.js} +4 -1
- package/dist/chunk-DMT5MRMS.js.map +1 -0
- package/dist/{chunk-QJA366VX.js → chunk-DNERBE7A.js} +70 -25
- package/dist/chunk-DNERBE7A.js.map +1 -0
- package/dist/{chunk-JMG5IDS5.js → chunk-G3W3FVUJ.js} +2 -2
- package/dist/{chunk-JMG5IDS5.js.map → chunk-G3W3FVUJ.js.map} +1 -1
- package/dist/{chunk-TFPT6T3K.js → chunk-KPWCY6PY.js} +93 -55
- package/dist/chunk-KPWCY6PY.js.map +1 -0
- package/dist/{chunk-54P7S7VU.js → chunk-O74WU2S7.js} +2 -2
- package/dist/{chunk-54P7S7VU.js.map → chunk-O74WU2S7.js.map} +1 -1
- package/dist/{chunk-D3WLLHZU.js → chunk-PPIIUCX5.js} +2 -2
- package/dist/{chunk-BHDCNLCO.js → chunk-WP74QZYX.js} +2 -2
- package/dist/{chunk-BHDCNLCO.js.map → chunk-WP74QZYX.js.map} +1 -1
- package/dist/expo/plugin.cjs +3 -0
- package/dist/expo/plugin.cjs.map +1 -1
- package/dist/expo/plugin.js +1 -1
- package/dist/expo-babel-plugin.cjs +3 -0
- package/dist/expo-babel-plugin.cjs.map +1 -1
- package/dist/expo-babel-plugin.js +1 -1
- package/dist/index.js +3 -3
- package/dist/nextjs/plugin.cjs +1 -1
- package/dist/nextjs/plugin.cjs.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs-loader.cjs +4 -1
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/nextjs.cjs +1 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/nuxt/runtime/identity.js +1 -1
- package/dist/nuxt.js +5 -1
- package/dist/nuxt.js.map +1 -1
- package/dist/svelte.js +1 -1
- package/dist/vue.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-QJA366VX.js.map +0 -1
- package/dist/chunk-TFPT6T3K.js.map +0 -1
- package/dist/chunk-UBTL6JUF.js.map +0 -1
- /package/dist/{chunk-D3WLLHZU.js.map → chunk-PPIIUCX5.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../annotation-strategy.ts"],"sourcesContent":["import { realpathSync, statSync } from \"node:fs\";\nimport { relative } from \"node:path\";\n\nimport type {\n ElementInfo,\n PropValue,\n} from \"../../modules/annotation/annotate-file.ts\";\nimport {\n EXPRESSION_FACTS_ATTRIBUTE,\n expressionFacts,\n} from \"../../modules/annotation/expression-facts.ts\";\nimport { sourceVersionHash } from \"../../modules/annotation/source-version.ts\";\n\nexport const DEFAULT_EXCLUDE = [\"**/node_modules/**\"] as const;\n\n/**\n * Static per-component declaration of whether a custom component accepts\n * `children`. Supplied by callers that know this from a fixed table (e.g. the\n * Expo plugin's React Native host-component overrides). The Vite/Next.js\n * plugins supply no overrides — custom components are left without a\n * `supports-children` flag and consumers treat their support as unknown.\n */\nexport interface ElementTypeSupport {\n supportsChildren: boolean;\n}\n\n/** HTML void elements that cannot have children (self-closing only). */\nexport const HTML_VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\nexport type ComputeAnnotatedProps = (\n info: ElementInfo,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n) => Record<string, PropValue>;\n\nexport function cleanModuleId(id: string): string {\n return id.replace(/[?#].*$/, \"\");\n}\n\nexport function resolveCanonicalRoot(root: string): string {\n try {\n return realpathSync.native(root);\n } catch {\n return root;\n }\n}\n\nexport function isIntrinsicElement(tagName: string): boolean {\n return tagName.length > 0 && tagName[0] === tagName[0]!.toLowerCase();\n}\n\nexport function hasJsxAttribute(info: ElementInfo, attrName: string): boolean {\n for (const attr of info.element.openingElement.attributes) {\n const name = (attr as { name?: { name?: unknown } }).name;\n if (name?.name === attrName) return true;\n }\n return false;\n}\n\nexport function defaultComputeAnnotatedProps(\n info: ElementInfo,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n): Record<string, PropValue> {\n return {\n \"data-tempo-filepath\": filepath,\n \"data-tempo-position\": info.element.openingElement.start,\n \"data-tempo-modifiedts\": modifiedtsMs,\n // Content-hash identity of the file this element was annotated from. The\n // canvas reconcile loop equality-compares it against the write pipeline's\n // computed version to decide whether a capture reflects a given edit.\n \"data-tempo-source-version\": sourceVersion,\n };\n}\n\n/**\n * Appends the module version record: one guarded statement that runs when the\n * browser evaluates the module and pushes `{file, modifiedTs, sourceVersion}`\n * onto `globalThis.__TEMPO_MODULE_VERSIONS__`, keyed by the same `filepath`\n * the element stamps carry. The projection producer joins these records to\n * React's refresh so the canvas learns that a write reached the host even\n * when the write left no element of the file on a board (V2-498).\n *\n * It is appended to every filtered module, JSX or not: a write that removes a\n * file's last element is exactly the case that needs it. It goes at the end\n * so it never displaces a leading directive such as \"use client\", and adds no\n * line above existing code so positions and source maps are unchanged. The\n * `window` guard keeps server-side evaluation (Next server components, SSR)\n * from recording anything.\n */\nexport function appendModuleVersionRecord(\n source: string,\n filepath: string,\n modifiedtsMs: number,\n sourceVersion: string,\n): string {\n const record = JSON.stringify({\n file: filepath,\n modifiedTs: modifiedtsMs,\n sourceVersion,\n });\n return `${source}\\n;typeof window !== \"undefined\" && (globalThis.__TEMPO_MODULE_VERSIONS__ || (globalThis.__TEMPO_MODULE_VERSIONS__ = [])).push(${record});\\n`;\n}\n\nexport function computeTempoAnnotatedProps(params: {\n info: ElementInfo;\n filepath: string;\n modifiedtsMs: number;\n sourceVersion: string;\n computeAnnotatedProps?: ComputeAnnotatedProps;\n elementSupportOverrides?: ReadonlyMap<string, ElementTypeSupport>;\n}): Record<string, PropValue> {\n const {\n info,\n filepath,\n modifiedtsMs,\n sourceVersion,\n computeAnnotatedProps,\n elementSupportOverrides,\n } = params;\n\n const userProps = {\n ...(computeAnnotatedProps\n ? computeAnnotatedProps(info, filepath, modifiedtsMs, sourceVersion)\n : defaultComputeAnnotatedProps(\n info,\n filepath,\n modifiedtsMs,\n sourceVersion,\n )),\n // Only a caller that knows the parent can say whether the slot is a JSX\n // child; without it every element would read as a dynamic slot.\n ...(info.parentType !== undefined &&\n !hasJsxAttribute(info, EXPRESSION_FACTS_ATTRIBUTE)\n ? {\n [EXPRESSION_FACTS_ATTRIBUTE]: expressionFacts(\n info.element,\n info.parentType,\n ),\n }\n : {}),\n };\n\n if (isIntrinsicElement(info.tagName)) {\n return {\n ...userProps,\n \"data-tempo-supports-children\": hasJsxAttribute(\n info,\n \"data-tempo-supports-children\",\n )\n ? undefined\n : !HTML_VOID_ELEMENTS.has(info.tagName),\n };\n }\n\n const override = elementSupportOverrides?.get(info.tagName);\n if (override) {\n return {\n ...userProps,\n \"data-tempo-supports-children\": hasJsxAttribute(\n info,\n \"data-tempo-supports-children\",\n )\n ? undefined\n : override.supportsChildren,\n };\n }\n\n // Custom component with no static override: emit no `data-tempo-supports-*`\n // flags. Determining them required a per-file TypeScript program, which was\n // removed for being the dominant cost of devserver startup. Consumers treat\n // the absent flags as \"unknown\" and fall back to their own defaults.\n return userProps;\n}\n\nexport function getFileAnnotationContext(params: {\n source: string;\n filename: string;\n root: string;\n canonicalizeFilename?: boolean;\n}): {\n cleanFilename: string;\n filepath: string;\n modifiedtsMs: number;\n sourceVersion: string;\n} {\n const rawCleanFilename = cleanModuleId(params.filename);\n let cleanFilename = rawCleanFilename;\n if (params.canonicalizeFilename) {\n try {\n cleanFilename = realpathSync.native(rawCleanFilename);\n } catch {\n cleanFilename = rawCleanFilename;\n }\n }\n return {\n cleanFilename,\n filepath: relative(params.root, cleanFilename),\n modifiedtsMs: Math.trunc(statSync(cleanFilename).mtimeMs),\n // Hashed once per file per transform (the context is built once, reused\n // for every element) so the per-element funnel just forwards the token.\n sourceVersion: sourceVersionHash(params.source),\n };\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAc,gBAAgB;AACvC,SAAS,gBAAgB;AA0BlB,IAAM,qBAAqB,oBAAI,IAAI;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AASM,SAAS,cAAc,IAAoB;AAChD,SAAO,GAAG,QAAQ,WAAW,EAAE;AACjC;AAUO,SAAS,mBAAmB,SAA0B;AAC3D,SAAO,QAAQ,SAAS,KAAK,QAAQ,CAAC,MAAM,QAAQ,CAAC,EAAG,YAAY;AACtE;AAEO,SAAS,gBAAgB,MAAmB,UAA2B;AAC5E,aAAW,QAAQ,KAAK,QAAQ,eAAe,YAAY;AACzD,UAAM,OAAQ,KAAuC;AACrD,QAAI,MAAM,SAAS,SAAU,QAAO;AAAA,EACtC;AACA,SAAO;AACT;AAEO,SAAS,6BACd,MACA,UACA,cACA,eAC2B;AAC3B,SAAO;AAAA,IACL,uBAAuB;AAAA,IACvB,uBAAuB,KAAK,QAAQ,eAAe;AAAA,IACnD,yBAAyB;AAAA;AAAA;AAAA;AAAA,IAIzB,6BAA6B;AAAA,E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