tempo-sdk 0.0.52 → 0.0.57
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 +4 -2
- package/dist/assets/index.js.map +1 -1
- package/dist/canvas/editor.d.ts +11 -16
- package/dist/canvas/editor.js +79 -49
- package/dist/canvas/editor.js.map +1 -1
- package/dist/canvas/index.d.ts +10 -6
- package/dist/canvas/index.js +130 -47
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +4 -3
- package/dist/canvas/parser.d.ts +10 -5
- package/dist/canvas/parser.js +3 -1
- package/dist/canvas/svelte.d.ts +8 -5
- package/dist/canvas/svelte.js +20 -5
- package/dist/canvas/svelte.js.map +1 -1
- package/dist/chunk-2IQD2KPS.js +219 -0
- package/dist/chunk-2IQD2KPS.js.map +1 -0
- package/dist/chunk-5BHIHP25.js +410 -0
- package/dist/chunk-5BHIHP25.js.map +1 -0
- package/dist/chunk-EMYYTS6D.js +1585 -0
- package/dist/chunk-EMYYTS6D.js.map +1 -0
- package/dist/{chunk-DX6XAXCK.js → chunk-N2TYN3RB.js} +189 -420
- package/dist/chunk-N2TYN3RB.js.map +1 -0
- package/dist/{chunk-7Y7XNHUM.js → chunk-QXL6GL2P.js} +18 -3
- package/dist/chunk-QXL6GL2P.js.map +1 -0
- package/dist/{chunk-QP2NTODB.js → chunk-RHHVVWAC.js} +115 -25
- package/dist/chunk-RHHVVWAC.js.map +1 -0
- package/dist/chunk-TL4MGN7E.js +2570 -0
- package/dist/chunk-TL4MGN7E.js.map +1 -0
- package/dist/{chunk-PULSTDX2.js → chunk-U3SLJNRS.js} +284 -46
- package/dist/chunk-U3SLJNRS.js.map +1 -0
- package/dist/{chunk-ZZYNOX24.js → chunk-U64AHDHZ.js} +1708 -2461
- package/dist/chunk-U64AHDHZ.js.map +1 -0
- package/dist/expo/plugin.cjs +1256 -16
- package/dist/expo/plugin.cjs.map +1 -1
- package/dist/expo/plugin.d.cts +0 -1
- package/dist/expo/plugin.d.ts +0 -1
- package/dist/expo/plugin.js +1 -1
- package/dist/expo-babel-plugin.cjs +1258 -16
- package/dist/expo-babel-plugin.cjs.map +1 -1
- package/dist/expo-babel-plugin.d.cts +8 -5
- package/dist/expo-babel-plugin.d.ts +8 -5
- package/dist/expo-babel-plugin.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +463 -153
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.cjs +151 -0
- package/dist/nextjs/plugin.cjs.map +1 -1
- package/dist/nextjs/plugin.d.cts +1 -1
- package/dist/nextjs/plugin.d.ts +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs-loader.cjs +1432 -35
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/nextjs.cjs +17 -2
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.d.cts +14 -3
- package/dist/nextjs.d.ts +14 -3
- package/dist/nextjs.js +1 -1
- package/dist/{page-xi1aI5a7.d.ts → page-DwLnOM5d.d.ts} +12 -6
- package/dist/{storyboard-DbtzTPvI.d.ts → storyboard-BtQuVGpl.d.ts} +33 -15
- package/dist/svelte.d.ts +3 -2
- package/dist/svelte.js +103 -29
- package/dist/svelte.js.map +1 -1
- package/dist/v1-client-compat-qxaXEDm_.d.ts +23 -0
- package/package.json +5 -2
- package/dist/chunk-57KAYXHF.js +0 -19
- package/dist/chunk-57KAYXHF.js.map +0 -1
- package/dist/chunk-7Y7XNHUM.js.map +0 -1
- package/dist/chunk-CB5NJJJT.js +0 -345
- package/dist/chunk-CB5NJJJT.js.map +0 -1
- package/dist/chunk-DX6XAXCK.js.map +0 -1
- package/dist/chunk-F3KJDCMU.js +0 -19
- package/dist/chunk-F3KJDCMU.js.map +0 -1
- package/dist/chunk-PULSTDX2.js.map +0 -1
- package/dist/chunk-QP2NTODB.js.map +0 -1
- package/dist/chunk-ZZYNOX24.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated V1 client compat.
|
|
3
|
+
*
|
|
4
|
+
* Everything a released V1 Tempo client (app 0.0.114, driving tempo-sdk
|
|
5
|
+
* 0.0.51 behavior) still expects from this host and that V2 no longer does.
|
|
6
|
+
* A workspace's installed tempo-sdk follows registry `latest` independently
|
|
7
|
+
* of the desktop app's update cadence, so a V1 client keeps loading hosts
|
|
8
|
+
* built from this SDK until the force-upgrade floor ages it out.
|
|
9
|
+
*
|
|
10
|
+
* Every call site gates on `isV1CanvasClient()`, so a V2 client runs today's
|
|
11
|
+
* code paths untouched. Delete this file once no protocol-1 client is
|
|
12
|
+
* supported; the compiler then lists every call site to remove.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** The layout spelling a V1 client still writes and type-checks
|
|
16
|
+
* (`tsc --noEmit` over canvases against `TempoStoryboard`). */
|
|
17
|
+
type V1LayoutCompat = {
|
|
18
|
+
/** @deprecated A legacy responsive marker: the width and height beside it
|
|
19
|
+
* are first-paint hints, not a frame. V2 reads the triple as responsive. */
|
|
20
|
+
intrinsicSizing?: "root-element";
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type { V1LayoutCompat as V };
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tempo-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"tag": "sdk-v2-latest"
|
|
6
|
+
},
|
|
4
7
|
"type": "module",
|
|
5
8
|
"description": "Tempo SDK — Vite, Next.js, and Expo plugins for JSX annotation and shared page/storyboard types",
|
|
6
9
|
"repository": {
|
|
@@ -81,7 +84,7 @@
|
|
|
81
84
|
"demo": "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
|
|
82
85
|
"demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
|
|
83
86
|
"test": "vitest run",
|
|
84
|
-
"test:browser": "vitest run asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts",
|
|
87
|
+
"test:browser": "vitest run pruned-module-deletion-browser.test.ts asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts",
|
|
85
88
|
"test:watch": "vitest",
|
|
86
89
|
"test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
|
|
87
90
|
"test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
|
package/dist/chunk-57KAYXHF.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// ../../modules/iframe-projection/combined/projection-pending.ts
|
|
2
|
-
var PROJECTION_PENDING_ATTRIBUTE = "data-tempo-projection-pending";
|
|
3
|
-
function isProjectionPendingOnly(rootElement) {
|
|
4
|
-
const children = rootElement.children;
|
|
5
|
-
if (children.length === 0) return false;
|
|
6
|
-
for (let index = 0; index < children.length; index += 1) {
|
|
7
|
-
const child = children[index];
|
|
8
|
-
if (!child || !child.hasAttribute(PROJECTION_PENDING_ATTRIBUTE)) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
PROJECTION_PENDING_ATTRIBUTE,
|
|
17
|
-
isProjectionPendingOnly
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=chunk-57KAYXHF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../modules/iframe-projection/combined/projection-pending.ts"],"sourcesContent":["/**\n * The pending-marker contract, shared between the source app and the producer.\n *\n * A Tempo-owned admission or Suspense boundary renders a single hidden marker\n * element while waiting instead of `null`. That turns \"this subtree is briefly\n * empty because content is loading\" — which is indistinguishable from \"this\n * subtree is now empty\" once it reaches the DOM — into something the producer can\n * recognise without inspecting React internals.\n *\n * This file is imported directly by tempo-sdk and bundled into it, so it must\n * stay dependency-free: no imports, no DOM globals beyond the element passed in.\n */\n\n/** Marks an element as a Tempo-owned boundary's pending placeholder. */\nexport const PROJECTION_PENDING_ATTRIBUTE = \"data-tempo-projection-pending\";\n\n/**\n * Is this root showing a pending marker and nothing else?\n *\n * The rule is deliberately strict — marker-ONLY. A root that still holds real\n * content alongside a marker is a partially-loaded tree, and partial content is\n * exactly what the mirror should show; only a root whose entire visible output\n * is placeholder has nothing worth publishing. An empty root is likewise not\n * pending: emptiness with no marker is a real state (a conditional unmount, a\n * foreign boundary with `fallback={null}`) and stays a real change.\n */\nexport function isProjectionPendingOnly(rootElement: Element): boolean {\n const children = rootElement.children;\n if (children.length === 0) return false;\n for (let index = 0; index < children.length; index += 1) {\n const child = children[index];\n if (!child || !child.hasAttribute(PROJECTION_PENDING_ATTRIBUTE)) {\n return false;\n }\n }\n return true;\n}\n"],"mappings":";AAcO,IAAM,+BAA+B;AAYrC,SAAS,wBAAwB,aAA+B;AACrE,QAAM,WAAW,YAAY;AAC7B,MAAI,SAAS,WAAW,EAAG,QAAO;AAClC,WAAS,QAAQ,GAAG,QAAQ,SAAS,QAAQ,SAAS,GAAG;AACvD,UAAM,QAAQ,SAAS,KAAK;AAC5B,QAAI,CAAC,SAAS,CAAC,MAAM,aAAa,4BAA4B,GAAG;AAC/D,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../nextjs.ts","../host-identity.ts","../package.json"],"sourcesContent":["/**\n * Next.js plugin that registers the tempo-annotate loader for Webpack and\n * Turbopack. Mirrors the user-facing pattern of `@next/mdx`: a higher-order\n * function that takes plugin options, returns a function that takes the user's\n * `next.config`, and returns a new config with the plugin's loader rules\n * merged in.\n *\n * See SPEC_NEXTJS.md (in this directory) for the full design rationale.\n *\n * @example\n * ```js\n * // next.config.js\n * const tempoNextjsPlugin = require(\"tempo-sdk/nextjs\");\n * module.exports = tempoNextjsPlugin()({ reactStrictMode: true });\n * ```\n */\n\nimport { existsSync, realpathSync } from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport { dirname, resolve } from \"node:path\";\n\nimport type { ElementInfo, PropValue } from \"@modules/annotation\";\nimport {\n createTempoHostIdentity,\n type TempoHostIdentity,\n} from \"./host-identity.ts\";\n\n// ---------------------------------------------------------------------------\n// Types. We keep these minimal and self-contained rather than depending on\n// Next.js types — the plugin file is loaded by `next.config.js` evaluation,\n// before `next` itself is fully resolved in some environments.\n// ---------------------------------------------------------------------------\n\nexport type ComputeAnnotatedProps = (\n info: ElementInfo,\n filepath: string,\n modifiedtsMs: number,\n) => Record<string, PropValue>;\n\nexport interface TempoNextjsOptions {\n /** Path to a JS/TS module that default-exports a `ComputeAnnotatedProps`\n * function. Resolved relative to the project root (CWD where the user\n * invokes `next dev` / `next build`). Turbopack does not allow function-\n * valued loader options, so this must be a path. */\n computeAnnotatedPropsModule?: string;\n\n /** File patterns to include. Default: `[\"**\\/*.tsx\", \"**\\/*.jsx\"]`. */\n include?: string | RegExp | Array<string | RegExp>;\n\n /** File patterns to exclude. Default: `[\"**\\/node_modules\\/**\"]`. */\n exclude?: string | RegExp | Array<string | RegExp>;\n\n /** Auto-inject `<meta name=\"tempo-project-root\">` into JSX `<head>`.\n * Default: `true`. */\n autoInjectRootMeta?: boolean;\n\n /** Run the loader during production builds too. Default: `false`. */\n productionBuild?: boolean;\n}\n\ninterface TurbopackRule {\n condition?: unknown;\n loaders?: Array<{ loader: string; options?: unknown } | string>;\n}\n\ninterface TurbopackConfig {\n rules?: Record<string, TurbopackRule | TurbopackRule[]>;\n [key: string]: unknown;\n}\n\ninterface NextConfigLike {\n webpack?:\n | ((\n config: unknown,\n context: { dev: boolean; [k: string]: unknown },\n ) => unknown)\n | null;\n turbopack?: TurbopackConfig;\n experimental?: { turbo?: TurbopackConfig; [k: string]: unknown };\n [key: string]: unknown;\n}\n\ntype NextConfigInput = NextConfigLike | undefined;\n\ninterface WebpackHookContext {\n dev: boolean;\n [key: string]: unknown;\n}\n\ninterface WebpackConfigLike {\n module?: { rules?: unknown[] };\n [key: string]: unknown;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst TURBOPACK_RULE_KEY = \"*.{tsx,jsx}\";\n\nconst requireFromHere = createRequire(\n typeof import.meta.url === \"string\" && import.meta.url.length > 0\n ? import.meta.url\n : __filename,\n);\n\nfunction resolveLoaderPath(): string {\n // Production: dist/nextjs.{js,cjs} sits next to dist/nextjs-loader.cjs.\n // Development: source nextjs.ts sits at <pkg>/nextjs.ts; the built\n // loader is at <pkg>/dist/nextjs-loader.cjs. Try both so unit tests\n // running directly against the .ts source file still find the loader.\n for (const candidate of [\"./nextjs-loader.cjs\", \"./dist/nextjs-loader.cjs\"]) {\n try {\n return requireFromHere.resolve(candidate);\n } catch {\n // try next candidate\n }\n }\n throw new Error(\n \"tempo-sdk/nextjs: could not resolve nextjs-loader.cjs. \" +\n \"Run `pnpm build` in the tempo-sdk package to produce the dist/ output.\",\n );\n}\n\ninterface NextVersionInfo {\n major: number;\n minor: number;\n}\n\nfunction detectNextVersion(): NextVersionInfo | null {\n try {\n const pkg = requireFromHere(\"next/package.json\") as { version: string };\n const m = /^(\\d+)\\.(\\d+)/.exec(pkg.version);\n if (!m) return null;\n return { major: Number(m[1]), minor: Number(m[2]) };\n } catch {\n return null;\n }\n}\n\n/** Should the wrapper write to `experimental.turbo` instead of `turbopack`? */\nfunction useExperimentalTurbo(version: NextVersionInfo | null): boolean {\n if (!version) return false;\n if (version.major < 15) return true;\n if (version.major === 15 && version.minor < 3) return true;\n return false;\n}\n\n/** Should the wrapper omit Turbopack registration entirely? Some pre-13 versions\n * error on unknown config keys. */\nfunction shouldOmitTurbopack(version: NextVersionInfo | null): boolean {\n if (!version) return false;\n return version.major < 13;\n}\n\nfunction buildTurbopackRule(\n loaderPath: string,\n options: TempoNextjsOptions,\n): TurbopackRule {\n const loaderOptions: Record<string, unknown> = {};\n if (options.computeAnnotatedPropsModule !== undefined) {\n loaderOptions.computeAnnotatedPropsModule =\n options.computeAnnotatedPropsModule;\n }\n if (options.autoInjectRootMeta !== undefined) {\n loaderOptions.autoInjectRootMeta = options.autoInjectRootMeta;\n }\n\n // {all: [{not: \"foreign\"}, \"development\"]} — exclude node_modules / Next\n // internals AND only run during `next dev`. The \"development\" condition is\n // a Turbopack built-in; it matches both `next dev` and `next build` in dev\n // mode but is inert during a production `next build`.\n const condition = options.productionBuild\n ? { not: \"foreign\" }\n : { all: [{ not: \"foreign\" }, \"development\"] };\n\n return {\n condition,\n loaders: [{ loader: loaderPath, options: loaderOptions }],\n };\n}\n\nfunction mergeTurbopackRules(\n existing: TurbopackConfig | undefined,\n newRule: TurbopackRule,\n): TurbopackConfig {\n const existingRule = existing?.rules?.[TURBOPACK_RULE_KEY];\n let mergedRule: TurbopackRule | TurbopackRule[];\n if (!existingRule) {\n mergedRule = newRule;\n } else if (Array.isArray(existingRule)) {\n mergedRule = [...existingRule, newRule];\n } else {\n mergedRule = [existingRule, newRule];\n }\n return {\n ...existing,\n rules: {\n ...existing?.rules,\n [TURBOPACK_RULE_KEY]: mergedRule,\n },\n };\n}\n\nfunction buildWebpackHook(\n loaderPath: string,\n options: TempoNextjsOptions,\n userWebpack: NextConfigLike[\"webpack\"],\n): NonNullable<NextConfigLike[\"webpack\"]> {\n const loaderOptions: Record<string, unknown> = {};\n if (options.computeAnnotatedPropsModule !== undefined) {\n loaderOptions.computeAnnotatedPropsModule =\n options.computeAnnotatedPropsModule;\n }\n if (options.autoInjectRootMeta !== undefined) {\n loaderOptions.autoInjectRootMeta = options.autoInjectRootMeta;\n }\n\n const allowProduction = options.productionBuild === true;\n\n return (configIn, context) => {\n const config = configIn as WebpackConfigLike;\n const ctx = context as WebpackHookContext;\n if (ctx.dev || allowProduction) {\n config.module ??= {};\n config.module.rules ??= [];\n config.module.rules.push({\n test: /\\.(tsx|jsx)$/,\n exclude: /node_modules/,\n enforce: \"pre\",\n use: [{ loader: loaderPath, options: loaderOptions }],\n });\n }\n if (typeof userWebpack === \"function\") {\n return userWebpack(config, context);\n }\n return config;\n };\n}\n\n// ---------------------------------------------------------------------------\n// tempoProjectRoot — sync helper for Pages Router users (Section 6.4)\n// ---------------------------------------------------------------------------\n\nlet cachedTempoProjectRoot: string | null = null;\n\n/**\n * Returns the canonical project root that the Tempo loader uses to compute\n * `data-tempo-filepath` values. Use this in `pages/_document.tsx` to set the\n * content of `<meta name=\"tempo-project-root\">`, ensuring the manual meta tag\n * value matches what the loader produces.\n */\nexport function tempoProjectRoot(): string {\n if (cachedTempoProjectRoot !== null) return cachedTempoProjectRoot;\n\n // Walk upward from CWD looking for the nearest package.json. CWD is what\n // Next.js itself uses as the project root when the user invokes\n // `next dev` / `next build` — the loader's `rootContext` matches.\n let dir = process.cwd();\n // eslint-disable-next-line no-constant-condition\n while (true) {\n if (existsSync(resolve(dir, \"package.json\"))) break;\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n let canonical = dir;\n try {\n canonical = realpathSync.native(dir);\n } catch {\n // Keep `dir` as fallback.\n }\n cachedTempoProjectRoot = canonical;\n return canonical;\n}\n\n/** Request-time identity for a Next route served by a Tempo-enabled host. */\nexport function tempoHostIdentity(): TempoHostIdentity {\n return createTempoHostIdentity(\"nextjs\");\n}\n\n/** Reset the cached project root. For tests only. */\nexport function _resetTempoProjectRoot(): void {\n cachedTempoProjectRoot = null;\n}\n\n// ---------------------------------------------------------------------------\n// tempoNextjsPlugin — the wrapper\n// ---------------------------------------------------------------------------\n\n/**\n * Higher-order function that wraps a Next.js config to register the\n * tempo-annotate loader with both Webpack and Turbopack. No-op when\n * `process.env.TEMPO` is not set.\n *\n * @example\n * ```js\n * // next.config.js\n * const tempoNextjsPlugin = require(\"tempo-sdk/nextjs\");\n * module.exports = tempoNextjsPlugin()({ reactStrictMode: true });\n * ```\n */\nexport function tempoNextjsPlugin(\n pluginOptions: TempoNextjsOptions = {},\n): (inputConfig?: NextConfigLike) => NextConfigLike {\n return (inputConfigArg?: NextConfigLike): NextConfigLike => {\n const inputConfig: NextConfigLike = inputConfigArg ?? {};\n\n if (!process.env.TEMPO) return inputConfig;\n\n // Routed through `_internal.*` so unit tests can spy on these helpers\n // without rewiring the imports.\n const loaderPath = _internal.resolveLoaderPath();\n const version = _internal.detectNextVersion();\n const omitTurbopack = _internal.shouldOmitTurbopack(version);\n const useExperimental = _internal.useExperimentalTurbo(version);\n\n const newRule = buildTurbopackRule(loaderPath, pluginOptions);\n\n const existingTurbo = useExperimental\n ? inputConfig.experimental?.turbo\n : inputConfig.turbopack;\n const mergedTurbo = mergeTurbopackRules(existingTurbo, newRule);\n\n const webpackHook = buildWebpackHook(\n loaderPath,\n pluginOptions,\n inputConfig.webpack ?? null,\n );\n\n const next: NextConfigLike = {\n ...inputConfig,\n webpack: webpackHook,\n };\n\n // Tempo-owned build cache: the supervisor always points managed Next hosts\n // at `.next/tempo`, isolating them from the user's own `next dev` cache.\n // A suffixed sibling is selected only after Next reports a lock conflict\n // for the stable directory. Runs outside Tempo never receive this variable.\n const distDirOverride = process.env.TEMPO_NEXT_DIST_DIR;\n if (distDirOverride) {\n next.distDir = distDirOverride;\n }\n\n if (!omitTurbopack) {\n if (useExperimental) {\n next.experimental = {\n ...inputConfig.experimental,\n turbo: mergedTurbo,\n };\n } else {\n next.turbopack = mergedTurbo;\n }\n }\n\n return next;\n };\n}\n\nexport default tempoNextjsPlugin;\n\n// ---------------------------------------------------------------------------\n// Type re-exports for users writing custom strategies.\n// ---------------------------------------------------------------------------\n\nexport type { ElementInfo, PropValue } from \"@modules/annotation\";\n\n// Internal exports used by tests.\nexport const _internal = {\n buildTurbopackRule,\n mergeTurbopackRules,\n buildWebpackHook,\n detectNextVersion,\n useExperimentalTurbo,\n shouldOmitTurbopack,\n resolveLoaderPath,\n};\n","import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport sdkPackage from \"./package.json\" with { type: \"json\" };\n\nexport const TEMPO_HOST_IDENTITY_ENDPOINT = \"/__tempo/identity\";\nexport const TEMPO_HOST_IDENTITY_CAPABILITY_HEADER =\n \"x-tempo-host-identity\";\nexport const TEMPO_HOST_IDENTITY_CONTRACT_VERSION = 1;\nexport const TEMPO_WORKSPACE_NONCE_ENV = \"TEMPO_WORKSPACE_NONCE\";\nexport const TEMPO_WORKSPACE_NONCE_META_NAME = \"tempo-workspace-nonce\";\n\nconst WORKSPACE_NONCE_RELATIVE_PATH = \".tempo/workspace-nonce\";\nconst MAX_WORKSPACE_NONCE_LENGTH = 128;\n\nexport type TempoHostFramework = \"vite\" | \"nextjs\";\n\nexport interface TempoHostIdentity {\n tempoHost: true;\n contractVersion: number;\n workspaceNonce: string;\n sdkVersion: string;\n pluginActive: boolean;\n framework: TempoHostFramework;\n}\n\nfunction normalizeWorkspaceNonce(value: string | undefined): string {\n const nonce = value?.trim() ?? \"\";\n return nonce.length > 0 && nonce.length <= MAX_WORKSPACE_NONCE_LENGTH\n ? nonce\n : \"\";\n}\n\nexport function readTempoWorkspaceNonce(root = process.cwd()): string {\n const fromEnvironment = normalizeWorkspaceNonce(\n process.env[TEMPO_WORKSPACE_NONCE_ENV],\n );\n if (fromEnvironment) return fromEnvironment;\n try {\n return normalizeWorkspaceNonce(\n readFileSync(resolve(root, WORKSPACE_NONCE_RELATIVE_PATH), \"utf-8\"),\n );\n } catch {\n return \"\";\n }\n}\n\nexport function createTempoHostIdentity(\n framework: TempoHostFramework,\n options: { root?: string; pluginActive?: boolean } = {},\n): TempoHostIdentity {\n return {\n tempoHost: true,\n contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,\n workspaceNonce: readTempoWorkspaceNonce(options.root),\n sdkVersion: sdkPackage.version,\n pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),\n framework,\n };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.52\",\n \"type\": \"module\",\n \"description\": \"Tempo SDK — Vite, Next.js, and Expo plugins for JSX annotation and shared page/storyboard types\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/TempoLabsAI/tempo-monorepo.git\",\n \"directory\": \"tempo-modules/tempo-sdk\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./canvas\": {\n \"types\": \"./dist/canvas/index.d.ts\",\n \"import\": \"./dist/canvas/index.js\"\n },\n \"./canvas/svelte\": {\n \"types\": \"./dist/canvas/svelte.d.ts\",\n \"import\": \"./dist/canvas/svelte.js\"\n },\n \"./canvas/interact-projection\": {\n \"types\": \"./dist/canvas/interact-projection.d.ts\",\n \"import\": \"./dist/canvas/interact-projection.js\"\n },\n \"./canvas/parser\": {\n \"types\": \"./dist/canvas/parser.d.ts\",\n \"import\": \"./dist/canvas/parser.js\"\n },\n \"./canvas/editor\": {\n \"types\": \"./dist/canvas/editor.d.ts\",\n \"import\": \"./dist/canvas/editor.js\"\n },\n \"./assets\": {\n \"types\": \"./dist/assets/index.d.ts\",\n \"import\": \"./dist/assets/index.js\"\n },\n \"./assets/parser\": {\n \"types\": \"./dist/assets/parser.d.ts\",\n \"import\": \"./dist/assets/parser.js\"\n },\n \"./assets/editor\": {\n \"types\": \"./dist/assets/editor.d.ts\",\n \"import\": \"./dist/assets/editor.js\"\n },\n \"./nextjs\": {\n \"types\": \"./dist/nextjs.d.ts\",\n \"import\": \"./dist/nextjs.js\",\n \"require\": \"./dist/nextjs.cjs\"\n },\n \"./nextjs/plugin\": {\n \"types\": \"./dist/nextjs/plugin.d.ts\",\n \"import\": \"./dist/nextjs/plugin.js\"\n },\n \"./expo\": {\n \"types\": \"./dist/expo-babel-plugin.d.ts\",\n \"import\": \"./dist/expo-babel-plugin.js\",\n \"require\": \"./dist/expo-babel-plugin.cjs\"\n },\n \"./expo/plugin\": {\n \"types\": \"./dist/expo/plugin.d.ts\",\n \"import\": \"./dist/expo/plugin.js\",\n \"require\": \"./dist/expo/plugin.cjs\"\n },\n \"./svelte\": {\n \"types\": \"./dist/svelte.d.ts\",\n \"import\": \"./dist/svelte.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"clean\": \"rm -rf dist\",\n \"build\": \"pnpm run clean && tsup\",\n \"build:if-missing\": \"test -f dist/index.js || pnpm run build\",\n \"prepare\": \"pnpm run build\",\n \"prepublishOnly\": \"pnpm build\",\n \"demo\": \"TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev\",\n \"demo:nextjs\": \"TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run asset-live-preview-browser.test.ts asset-popover-lifecycle-browser.test.ts component-controls-browser.test.ts canvas-controls-browser.test.ts canvas-capture-determinism-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts\",\n \"test:watch\": \"vitest\",\n \"test:nextjs:unit\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts\",\n \"test:nextjs:integration\": \"vitest run nextjs-e2e-correctness.test.ts\",\n \"test:nextjs:production\": \"vitest run nextjs-production.test.ts\",\n \"test:nextjs\": \"vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts nextjs-e2e-correctness.test.ts nextjs-production.test.ts\"\n },\n \"dependencies\": {\n \"@rollup/pluginutils\": \"^5.1.0\",\n \"oxc-parser\": \"^0.110.0\"\n },\n \"peerDependencies\": {\n \"@babel/core\": \"^7.0.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\"\n },\n \"peerDependenciesMeta\": {\n \"@babel/core\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@types/babel__core\": \"^7.20.5\",\n \"@types/node\": \"^25.0.8\",\n \"@types/react\": \"catalog:\",\n \"@types/react-dom\": \"catalog:\",\n \"@vitejs/plugin-react\": \"catalog:\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\"\n }\n}\n"],"mappings":";AAiBA,SAAS,YAAY,oBAAoB;AACzC,SAAS,qBAAqB;AAC9B,SAAS,SAAS,WAAAA,gBAAe;;;ACnBjC,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,MAAQ;AAAA,EACR,aAAe;AAAA,EACf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,YAAY;AAAA,MACV,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,mBAAmB;AAAA,MACjB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,gCAAgC;AAAA,MAC9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,QACT;AAAA,MACF,OAAO;AACL,aAAK,YAAY;AAAA,MACnB;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEA,IAAO,iBAAQ;AASR,IAAM,YAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":["resolve","resolve"]}
|
package/dist/chunk-CB5NJJJT.js
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
// expo-babel-plugin.ts
|
|
2
|
-
import { existsSync } from "fs";
|
|
3
|
-
import { dirname, resolve } from "path";
|
|
4
|
-
import { createFilter } from "@rollup/pluginutils";
|
|
5
|
-
|
|
6
|
-
// annotation-strategy.ts
|
|
7
|
-
import { realpathSync, statSync } from "fs";
|
|
8
|
-
import { relative } from "path";
|
|
9
|
-
|
|
10
|
-
// ../../modules/annotation/source-version.ts
|
|
11
|
-
function sourceVersionHash(content) {
|
|
12
|
-
let djb2 = 5381;
|
|
13
|
-
let sdbm = 0;
|
|
14
|
-
for (let i = 0; i < content.length; i++) {
|
|
15
|
-
const c = content.charCodeAt(i);
|
|
16
|
-
djb2 = (djb2 << 5) + djb2 ^ c;
|
|
17
|
-
sdbm = c + (sdbm << 6) + (sdbm << 16) - sdbm | 0;
|
|
18
|
-
}
|
|
19
|
-
return toHex8(djb2) + toHex8(sdbm);
|
|
20
|
-
}
|
|
21
|
-
function toHex8(n) {
|
|
22
|
-
return (n >>> 0).toString(16).padStart(8, "0");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// annotation-strategy.ts
|
|
26
|
-
var DEFAULT_EXCLUDE = ["**/node_modules/**"];
|
|
27
|
-
var HTML_VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
28
|
-
"area",
|
|
29
|
-
"base",
|
|
30
|
-
"br",
|
|
31
|
-
"col",
|
|
32
|
-
"embed",
|
|
33
|
-
"hr",
|
|
34
|
-
"img",
|
|
35
|
-
"input",
|
|
36
|
-
"link",
|
|
37
|
-
"meta",
|
|
38
|
-
"param",
|
|
39
|
-
"source",
|
|
40
|
-
"track",
|
|
41
|
-
"wbr"
|
|
42
|
-
]);
|
|
43
|
-
function cleanModuleId(id) {
|
|
44
|
-
return id.replace(/[?#].*$/, "");
|
|
45
|
-
}
|
|
46
|
-
function resolveCanonicalRoot(root) {
|
|
47
|
-
try {
|
|
48
|
-
return realpathSync.native(root);
|
|
49
|
-
} catch {
|
|
50
|
-
return root;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function isIntrinsicElement(tagName) {
|
|
54
|
-
return tagName.length > 0 && tagName[0] === tagName[0].toLowerCase();
|
|
55
|
-
}
|
|
56
|
-
function hasJsxAttribute(info, attrName) {
|
|
57
|
-
for (const attr of info.element.openingElement.attributes) {
|
|
58
|
-
const name = attr.name;
|
|
59
|
-
if (name?.name === attrName) return true;
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
function defaultComputeAnnotatedProps(info, filepath, modifiedtsMs, sourceVersion) {
|
|
64
|
-
return {
|
|
65
|
-
"data-tempo-filepath": filepath,
|
|
66
|
-
"data-tempo-position": info.element.openingElement.start,
|
|
67
|
-
"data-tempo-modifiedts": modifiedtsMs,
|
|
68
|
-
// Content-hash identity of the file this element was annotated from. The
|
|
69
|
-
// canvas reconcile loop equality-compares it against the write pipeline's
|
|
70
|
-
// computed version to decide whether a capture reflects a given edit.
|
|
71
|
-
"data-tempo-source-version": sourceVersion
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
function computeTempoAnnotatedProps(params) {
|
|
75
|
-
const {
|
|
76
|
-
info,
|
|
77
|
-
filepath,
|
|
78
|
-
modifiedtsMs,
|
|
79
|
-
sourceVersion,
|
|
80
|
-
computeAnnotatedProps,
|
|
81
|
-
elementSupportOverrides
|
|
82
|
-
} = params;
|
|
83
|
-
const userProps = computeAnnotatedProps ? computeAnnotatedProps(info, filepath, modifiedtsMs, sourceVersion) : defaultComputeAnnotatedProps(info, filepath, modifiedtsMs, sourceVersion);
|
|
84
|
-
if (isIntrinsicElement(info.tagName)) {
|
|
85
|
-
return {
|
|
86
|
-
...userProps,
|
|
87
|
-
"data-tempo-supports-children": hasJsxAttribute(
|
|
88
|
-
info,
|
|
89
|
-
"data-tempo-supports-children"
|
|
90
|
-
) ? void 0 : !HTML_VOID_ELEMENTS.has(info.tagName)
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
const override = elementSupportOverrides?.get(info.tagName);
|
|
94
|
-
if (override) {
|
|
95
|
-
return {
|
|
96
|
-
...userProps,
|
|
97
|
-
"data-tempo-supports-children": hasJsxAttribute(
|
|
98
|
-
info,
|
|
99
|
-
"data-tempo-supports-children"
|
|
100
|
-
) ? void 0 : override.supportsChildren
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
return userProps;
|
|
104
|
-
}
|
|
105
|
-
function getFileAnnotationContext(params) {
|
|
106
|
-
const rawCleanFilename = cleanModuleId(params.filename);
|
|
107
|
-
let cleanFilename = rawCleanFilename;
|
|
108
|
-
if (params.canonicalizeFilename) {
|
|
109
|
-
try {
|
|
110
|
-
cleanFilename = realpathSync.native(rawCleanFilename);
|
|
111
|
-
} catch {
|
|
112
|
-
cleanFilename = rawCleanFilename;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
cleanFilename,
|
|
117
|
-
filepath: relative(params.root, cleanFilename),
|
|
118
|
-
modifiedtsMs: Math.trunc(statSync(cleanFilename).mtimeMs),
|
|
119
|
-
// Hashed once per file per transform (the context is built once, reused
|
|
120
|
-
// for every element) so the per-element funnel just forwards the token.
|
|
121
|
-
sourceVersion: sourceVersionHash(params.source)
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// expo-babel-plugin.ts
|
|
126
|
-
var EXPO_DEFAULT_INCLUDE = ["**/*.tsx", "**/*.jsx", "**/*.js"];
|
|
127
|
-
var FRAGMENT_TAG_NAMES = /* @__PURE__ */ new Set(["Fragment", "React.Fragment"]);
|
|
128
|
-
var REACT_NATIVE_HOST_COMPONENTS = /* @__PURE__ */ new Set([
|
|
129
|
-
"ActivityIndicator",
|
|
130
|
-
"Button",
|
|
131
|
-
"FlatList",
|
|
132
|
-
"Image",
|
|
133
|
-
"ImageBackground",
|
|
134
|
-
"KeyboardAvoidingView",
|
|
135
|
-
"Modal",
|
|
136
|
-
"Pressable",
|
|
137
|
-
"RefreshControl",
|
|
138
|
-
"SafeAreaView",
|
|
139
|
-
"ScrollView",
|
|
140
|
-
"SectionList",
|
|
141
|
-
"Switch",
|
|
142
|
-
"Text",
|
|
143
|
-
"TextInput",
|
|
144
|
-
"TouchableHighlight",
|
|
145
|
-
"TouchableNativeFeedback",
|
|
146
|
-
"TouchableOpacity",
|
|
147
|
-
"TouchableWithoutFeedback",
|
|
148
|
-
"View",
|
|
149
|
-
"VirtualizedList"
|
|
150
|
-
]);
|
|
151
|
-
var REACT_NATIVE_NO_CHILDREN_COMPONENTS = /* @__PURE__ */ new Set([
|
|
152
|
-
"ActivityIndicator",
|
|
153
|
-
"Image",
|
|
154
|
-
"RefreshControl",
|
|
155
|
-
"Switch"
|
|
156
|
-
]);
|
|
157
|
-
var REACT_NATIVE_SUPPORT_OVERRIDES = new Map(
|
|
158
|
-
[...REACT_NATIVE_HOST_COMPONENTS].map((tagName) => [
|
|
159
|
-
tagName,
|
|
160
|
-
{ supportsChildren: !REACT_NATIVE_NO_CHILDREN_COMPONENTS.has(tagName) }
|
|
161
|
-
])
|
|
162
|
-
);
|
|
163
|
-
function hasParserPlugin(plugins, name) {
|
|
164
|
-
return plugins.some(
|
|
165
|
-
(plugin) => Array.isArray(plugin) ? plugin[0] === name : plugin === name
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
function getBabelTagName(name) {
|
|
169
|
-
switch (name.type) {
|
|
170
|
-
case "JSXIdentifier":
|
|
171
|
-
return name.name;
|
|
172
|
-
case "JSXNamespacedName":
|
|
173
|
-
return `${name.namespace.name}:${name.name.name}`;
|
|
174
|
-
case "JSXMemberExpression":
|
|
175
|
-
return `${getBabelTagName(name.object)}.${name.property.name}`;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function hasAttribute(node, attrName) {
|
|
179
|
-
return node.attributes.some(
|
|
180
|
-
(attr) => attr.type === "JSXAttribute" && attr.name.name === attrName
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
function propValueToExpression(api, value) {
|
|
184
|
-
if (typeof value === "function") {
|
|
185
|
-
return api.template.expression(value.toString())();
|
|
186
|
-
}
|
|
187
|
-
return api.types.valueToNode(value);
|
|
188
|
-
}
|
|
189
|
-
function dataAttrToDataSetKey(attrName) {
|
|
190
|
-
return attrName.replace(/^data-/, "").replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
191
|
-
}
|
|
192
|
-
function findDataSetAttribute(openingElement) {
|
|
193
|
-
return openingElement.attributes.find(
|
|
194
|
-
(attr) => attr.type === "JSXAttribute" && attr.name.name === "dataSet"
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
function addAnnotations(api, tagName, openingElement, props) {
|
|
198
|
-
const t = api.types;
|
|
199
|
-
if (isIntrinsicElement(tagName)) {
|
|
200
|
-
for (const [key, value] of Object.entries(props)) {
|
|
201
|
-
if (value === void 0 || hasAttribute(openingElement, key)) continue;
|
|
202
|
-
openingElement.attributes.push(
|
|
203
|
-
t.jsxAttribute(
|
|
204
|
-
t.jsxIdentifier(key),
|
|
205
|
-
t.jsxExpressionContainer(propValueToExpression(api, value))
|
|
206
|
-
)
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
const dataSetProps = [];
|
|
212
|
-
for (const [key, value] of Object.entries(props)) {
|
|
213
|
-
if (value === void 0) continue;
|
|
214
|
-
dataSetProps.push(
|
|
215
|
-
t.objectProperty(
|
|
216
|
-
t.identifier(dataAttrToDataSetKey(key)),
|
|
217
|
-
propValueToExpression(api, value)
|
|
218
|
-
)
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
if (dataSetProps.length === 0) return;
|
|
222
|
-
const existing = findDataSetAttribute(openingElement);
|
|
223
|
-
if (!existing) {
|
|
224
|
-
openingElement.attributes.push(
|
|
225
|
-
t.jsxAttribute(
|
|
226
|
-
t.jsxIdentifier("dataSet"),
|
|
227
|
-
t.jsxExpressionContainer(t.objectExpression(dataSetProps))
|
|
228
|
-
)
|
|
229
|
-
);
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
if (existing.value?.type === "JSXExpressionContainer" && existing.value.expression.type !== "JSXEmptyExpression") {
|
|
233
|
-
existing.value.expression = t.objectExpression([
|
|
234
|
-
t.spreadElement(existing.value.expression),
|
|
235
|
-
...dataSetProps
|
|
236
|
-
]);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
var ROOT_META_NAME = "tempo-project-root";
|
|
240
|
-
function injectProjectRootMeta(api, programPath, root) {
|
|
241
|
-
const setter = api.template.statement(`
|
|
242
|
-
if (typeof document !== "undefined") {
|
|
243
|
-
var __tempoRootMeta = document.querySelector('meta[name="${ROOT_META_NAME}"]');
|
|
244
|
-
if (!__tempoRootMeta) {
|
|
245
|
-
__tempoRootMeta = document.createElement("meta");
|
|
246
|
-
__tempoRootMeta.setAttribute("name", "${ROOT_META_NAME}");
|
|
247
|
-
document.head.appendChild(__tempoRootMeta);
|
|
248
|
-
}
|
|
249
|
-
__tempoRootMeta.setAttribute("content", ${JSON.stringify(root)});
|
|
250
|
-
}
|
|
251
|
-
`)();
|
|
252
|
-
programPath.pushContainer("body", setter);
|
|
253
|
-
}
|
|
254
|
-
function resolveBabelRoot(state, options, filename) {
|
|
255
|
-
return resolveCanonicalRoot(
|
|
256
|
-
resolve(
|
|
257
|
-
options.root ?? findNearestPackageRoot(filename) ?? state.cwd ?? state.file.opts.cwd ?? state.file.opts.root ?? process.cwd()
|
|
258
|
-
)
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
function findNearestPackageRoot(filename) {
|
|
262
|
-
let current = dirname(filename);
|
|
263
|
-
while (true) {
|
|
264
|
-
if (existsSync(resolve(current, "package.json"))) return current;
|
|
265
|
-
const parent = dirname(current);
|
|
266
|
-
if (parent === current) return null;
|
|
267
|
-
current = parent;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
function resolveFilename(state) {
|
|
271
|
-
const filename = state.filename ?? state.file.opts.filename;
|
|
272
|
-
if (!filename) return null;
|
|
273
|
-
return resolve(cleanModuleId(filename));
|
|
274
|
-
}
|
|
275
|
-
function tempoExpoBabelPlugin(api, rawOptions = {}) {
|
|
276
|
-
api.assertVersion(7);
|
|
277
|
-
const enabled = rawOptions.enabled ?? !!process.env.TEMPO;
|
|
278
|
-
const include = rawOptions.include === void 0 ? EXPO_DEFAULT_INCLUDE : rawOptions.include;
|
|
279
|
-
const exclude = rawOptions.exclude === void 0 ? DEFAULT_EXCLUDE : rawOptions.exclude;
|
|
280
|
-
const filter = createFilter(include, exclude);
|
|
281
|
-
return {
|
|
282
|
-
name: "tempo-expo-annotate",
|
|
283
|
-
manipulateOptions(opts, parserOpts) {
|
|
284
|
-
parserOpts.plugins ?? (parserOpts.plugins = []);
|
|
285
|
-
if (!hasParserPlugin(parserOpts.plugins, "jsx")) {
|
|
286
|
-
parserOpts.plugins.push("jsx");
|
|
287
|
-
}
|
|
288
|
-
const filename = opts.filename ?? "";
|
|
289
|
-
if (/\.(ts|tsx)$/.test(filename) && !hasParserPlugin(parserOpts.plugins, "typescript")) {
|
|
290
|
-
parserOpts.plugins.push("typescript");
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
visitor: {
|
|
294
|
-
Program: {
|
|
295
|
-
enter(path, state) {
|
|
296
|
-
if (!enabled) return;
|
|
297
|
-
const options = { ...rawOptions, ...state.opts };
|
|
298
|
-
const filename = resolveFilename(state);
|
|
299
|
-
if (!filename || !filter(filename)) return;
|
|
300
|
-
const source = state.file.code;
|
|
301
|
-
const root = resolveBabelRoot(state, options, filename);
|
|
302
|
-
let context;
|
|
303
|
-
try {
|
|
304
|
-
context = getFileAnnotationContext({
|
|
305
|
-
source,
|
|
306
|
-
filename,
|
|
307
|
-
root,
|
|
308
|
-
canonicalizeFilename: true
|
|
309
|
-
});
|
|
310
|
-
} catch {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
if (context.filepath === "index.js") {
|
|
314
|
-
injectProjectRootMeta(api, path, root);
|
|
315
|
-
}
|
|
316
|
-
path.traverse({
|
|
317
|
-
JSXElement(elementPath) {
|
|
318
|
-
const element = elementPath.node;
|
|
319
|
-
const tagName = getBabelTagName(element.openingElement.name);
|
|
320
|
-
if (FRAGMENT_TAG_NAMES.has(tagName)) return;
|
|
321
|
-
const info = {
|
|
322
|
-
element,
|
|
323
|
-
tagName
|
|
324
|
-
};
|
|
325
|
-
const props = computeTempoAnnotatedProps({
|
|
326
|
-
info,
|
|
327
|
-
filepath: context.filepath,
|
|
328
|
-
modifiedtsMs: context.modifiedtsMs,
|
|
329
|
-
sourceVersion: context.sourceVersion,
|
|
330
|
-
computeAnnotatedProps: options.computeAnnotatedProps,
|
|
331
|
-
elementSupportOverrides: REACT_NATIVE_SUPPORT_OVERRIDES
|
|
332
|
-
});
|
|
333
|
-
addAnnotations(api, tagName, element.openingElement, props);
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
export {
|
|
343
|
-
tempoExpoBabelPlugin
|
|
344
|
-
};
|
|
345
|
-
//# sourceMappingURL=chunk-CB5NJJJT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../expo-babel-plugin.ts","../annotation-strategy.ts","../../../modules/annotation/source-version.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\n\nimport { createFilter, type FilterPattern } from \"@rollup/pluginutils\";\n\nimport type {\n ElementInfo,\n PropValue,\n} from \"../../modules/annotation/annotate-file.ts\";\nimport {\n cleanModuleId,\n computeTempoAnnotatedProps,\n DEFAULT_EXCLUDE,\n getFileAnnotationContext,\n isIntrinsicElement,\n resolveCanonicalRoot,\n type ComputeAnnotatedProps,\n} from \"./annotation-strategy.ts\";\n\nconst EXPO_DEFAULT_INCLUDE: FilterPattern = [\"**/*.tsx\", \"**/*.jsx\", \"**/*.js\"];\n\nconst FRAGMENT_TAG_NAMES = new Set([\"Fragment\", \"React.Fragment\"]);\n\n// The React Native builtin host components we annotate. Membership decides\n// whether a component is annotated at all; `supports-children` is then keyed\n// off REACT_NATIVE_NO_CHILDREN_COMPONENTS below.\nconst REACT_NATIVE_HOST_COMPONENTS = new Set([\n \"ActivityIndicator\",\n \"Button\",\n \"FlatList\",\n \"Image\",\n \"ImageBackground\",\n \"KeyboardAvoidingView\",\n \"Modal\",\n \"Pressable\",\n \"RefreshControl\",\n \"SafeAreaView\",\n \"ScrollView\",\n \"SectionList\",\n \"Switch\",\n \"Text\",\n \"TextInput\",\n \"TouchableHighlight\",\n \"TouchableNativeFeedback\",\n \"TouchableOpacity\",\n \"TouchableWithoutFeedback\",\n \"View\",\n \"VirtualizedList\",\n]);\n\nconst REACT_NATIVE_NO_CHILDREN_COMPONENTS = new Set([\n \"ActivityIndicator\",\n \"Image\",\n \"RefreshControl\",\n \"Switch\",\n]);\n\nconst REACT_NATIVE_SUPPORT_OVERRIDES = new Map(\n [...REACT_NATIVE_HOST_COMPONENTS].map((tagName) => [\n tagName,\n { supportsChildren: !REACT_NATIVE_NO_CHILDREN_COMPONENTS.has(tagName) },\n ]),\n);\n\nexport interface TempoExpoBabelPluginOptions {\n /**\n * Defaults to `!!process.env.TEMPO`, matching `tempoVitePlugin`.\n * Expo users can pass `{ enabled: true }` in babel.config.js for direct tests.\n */\n enabled?: boolean;\n root?: string;\n include?: FilterPattern;\n exclude?: FilterPattern;\n computeAnnotatedProps?: ComputeAnnotatedProps;\n}\n\ntype BabelApi = {\n assertVersion(version: number): void;\n types: typeof import(\"@babel/types\");\n template: {\n expression(source: string): () => import(\"@babel/types\").Expression;\n statement(source: string): () => import(\"@babel/types\").Statement;\n };\n};\n\ntype BabelPluginState = {\n cwd?: string;\n filename?: string;\n file: {\n code: string;\n opts: {\n cwd?: string;\n filename?: string;\n root?: string;\n };\n };\n opts: TempoExpoBabelPluginOptions;\n};\n\nfunction hasParserPlugin(\n plugins: NonNullable<import(\"@babel/core\").ParserOptions[\"plugins\"]>,\n name: string,\n): boolean {\n return plugins.some((plugin) =>\n Array.isArray(plugin) ? plugin[0] === name : plugin === name,\n );\n}\n\nfunction getBabelTagName(\n name: import(\"@babel/types\").JSXElement[\"openingElement\"][\"name\"],\n): string {\n switch (name.type) {\n case \"JSXIdentifier\":\n return name.name;\n case \"JSXNamespacedName\":\n return `${name.namespace.name}:${name.name.name}`;\n case \"JSXMemberExpression\":\n return `${getBabelTagName(name.object)}.${name.property.name}`;\n }\n}\n\nfunction hasAttribute(\n node: import(\"@babel/types\").JSXOpeningElement,\n attrName: string,\n): boolean {\n return node.attributes.some(\n (attr) => attr.type === \"JSXAttribute\" && attr.name.name === attrName,\n );\n}\n\nfunction propValueToExpression(\n api: BabelApi,\n value: Exclude<PropValue, undefined>,\n): import(\"@babel/types\").Expression {\n if (typeof value === \"function\") {\n return api.template.expression(value.toString())();\n }\n return api.types.valueToNode(value) as import(\"@babel/types\").Expression;\n}\n\n// \"data-tempo-filepath\" -> \"tempoFilepath\". react-native-web hyphenates dataSet\n// keys back to \"data-tempo-filepath\" on the rendered DOM node, so this round-trips.\nfunction dataAttrToDataSetKey(attrName: string): string {\n return attrName\n .replace(/^data-/, \"\")\n .replace(/-([a-z])/g, (_, char: string) => char.toUpperCase());\n}\n\nfunction findDataSetAttribute(\n openingElement: import(\"@babel/types\").JSXOpeningElement,\n): import(\"@babel/types\").JSXAttribute | undefined {\n return openingElement.attributes.find(\n (attr): attr is import(\"@babel/types\").JSXAttribute =>\n attr.type === \"JSXAttribute\" && attr.name.name === \"dataSet\",\n );\n}\n\nfunction addAnnotations(\n api: BabelApi,\n tagName: string,\n openingElement: import(\"@babel/types\").JSXOpeningElement,\n props: Record<string, PropValue>,\n) {\n const t = api.types;\n\n // Intrinsic web elements (lowercase: div/span/...) are real DOM nodes that\n // forward arbitrary `data-*` attributes, so annotate them directly. React\n // Native host components (View, Text, ...) and any other component are NOT\n // DOM nodes: react-native-web only forwards an allow-list of props plus\n // `dataSet` to the rendered element and drops raw `data-*`. For those we emit\n // the annotations through `dataSet` (camelCase keys), which RNW maps back to\n // `data-*` on the host element.\n if (isIntrinsicElement(tagName)) {\n for (const [key, value] of Object.entries(props)) {\n if (value === undefined || hasAttribute(openingElement, key)) continue;\n openingElement.attributes.push(\n t.jsxAttribute(\n t.jsxIdentifier(key),\n t.jsxExpressionContainer(propValueToExpression(api, value)),\n ),\n );\n }\n return;\n }\n\n const dataSetProps: import(\"@babel/types\").ObjectProperty[] = [];\n for (const [key, value] of Object.entries(props)) {\n if (value === undefined) continue;\n dataSetProps.push(\n t.objectProperty(\n t.identifier(dataAttrToDataSetKey(key)),\n propValueToExpression(api, value),\n ),\n );\n }\n if (dataSetProps.length === 0) return;\n\n const existing = findDataSetAttribute(openingElement);\n if (!existing) {\n openingElement.attributes.push(\n t.jsxAttribute(\n t.jsxIdentifier(\"dataSet\"),\n t.jsxExpressionContainer(t.objectExpression(dataSetProps)),\n ),\n );\n return;\n }\n\n // Merge into a user-provided `dataSet={...}` without clobbering their keys:\n // { ...existingDataSet, ...tempoKeys }.\n if (\n existing.value?.type === \"JSXExpressionContainer\" &&\n existing.value.expression.type !== \"JSXEmptyExpression\"\n ) {\n existing.value.expression = t.objectExpression([\n t.spreadElement(existing.value.expression),\n ...dataSetProps,\n ]);\n }\n}\n\nconst ROOT_META_NAME = \"tempo-project-root\";\n\n// Rewrite the sidecar entry to stamp the absolute sidecar root into a\n// `<meta name=\"tempo-project-root\">` at runtime. The canvas reads this meta off\n// the live DOM (`read-source.ts`) to resolve `data-tempo-filepath` annotations —\n// which are relative to this root — back to absolute on-disk paths.\n//\n// Why stamp at runtime instead of writing the path into the committed\n// `public/index.html`: that file is committed to the user's repo, so it must not\n// hold a machine-specific absolute path. `root` here is resolved from the\n// sidecar's `__dirname` when Metro bundles, so it lives only in the built bundle\n// — never in committed source — yet still points at wherever the sidecar lives on\n// the machine running the dev server.\n//\n// Guarded on `typeof document` so it's inert under native/SSR bundles, and\n// idempotent (reuses an existing meta) so the static `public/index.html` marker —\n// kept present-but-empty for dev-server readiness detection — is upgraded in\n// place rather than duplicated.\nfunction injectProjectRootMeta(\n api: BabelApi,\n programPath: import(\"@babel/core\").NodePath<import(\"@babel/types\").Program>,\n root: string,\n) {\n const setter = api.template.statement(`\n if (typeof document !== \"undefined\") {\n var __tempoRootMeta = document.querySelector('meta[name=\"${ROOT_META_NAME}\"]');\n if (!__tempoRootMeta) {\n __tempoRootMeta = document.createElement(\"meta\");\n __tempoRootMeta.setAttribute(\"name\", \"${ROOT_META_NAME}\");\n document.head.appendChild(__tempoRootMeta);\n }\n __tempoRootMeta.setAttribute(\"content\", ${JSON.stringify(root)});\n }\n `)();\n programPath.pushContainer(\"body\", setter);\n}\n\nfunction resolveBabelRoot(\n state: BabelPluginState,\n options: TempoExpoBabelPluginOptions,\n filename: string,\n): string {\n return resolveCanonicalRoot(\n resolve(\n options.root ??\n findNearestPackageRoot(filename) ??\n state.cwd ??\n state.file.opts.cwd ??\n state.file.opts.root ??\n process.cwd(),\n ),\n );\n}\n\nfunction findNearestPackageRoot(filename: string): string | null {\n let current = dirname(filename);\n while (true) {\n if (existsSync(resolve(current, \"package.json\"))) return current;\n const parent = dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n}\n\nfunction resolveFilename(state: BabelPluginState): string | null {\n const filename = state.filename ?? state.file.opts.filename;\n if (!filename) return null;\n return resolve(cleanModuleId(filename));\n}\n\nexport default function tempoExpoBabelPlugin(\n api: BabelApi,\n rawOptions: TempoExpoBabelPluginOptions = {},\n) {\n api.assertVersion(7);\n\n const enabled = rawOptions.enabled ?? !!process.env.TEMPO;\n const include =\n rawOptions.include === undefined\n ? EXPO_DEFAULT_INCLUDE\n : rawOptions.include;\n const exclude =\n rawOptions.exclude === undefined ? DEFAULT_EXCLUDE : rawOptions.exclude;\n const filter = createFilter(include, exclude);\n\n return {\n name: \"tempo-expo-annotate\",\n\n manipulateOptions(\n opts: { filename?: string },\n parserOpts: NonNullable<\n import(\"@babel/core\").TransformOptions[\"parserOpts\"]\n >,\n ) {\n parserOpts.plugins ??= [];\n if (!hasParserPlugin(parserOpts.plugins, \"jsx\")) {\n parserOpts.plugins.push(\"jsx\");\n }\n const filename = opts.filename ?? \"\";\n if (\n /\\.(ts|tsx)$/.test(filename) &&\n !hasParserPlugin(parserOpts.plugins, \"typescript\")\n ) {\n parserOpts.plugins.push(\"typescript\");\n }\n },\n\n visitor: {\n Program: {\n enter(\n path: import(\"@babel/core\").NodePath<import(\"@babel/types\").Program>,\n state: BabelPluginState,\n ) {\n if (!enabled) return;\n const options = { ...rawOptions, ...state.opts };\n const filename = resolveFilename(state);\n if (!filename || !filter(filename)) return;\n\n const source = state.file.code;\n const root = resolveBabelRoot(state, options, filename);\n let context: ReturnType<typeof getFileAnnotationContext>;\n try {\n context = getFileAnnotationContext({\n source,\n filename,\n root,\n canonicalizeFilename: true,\n });\n } catch {\n return;\n }\n\n // The sidecar entry runs once at startup; stamp the project-root meta\n // there so the canvas can resolve annotations off the live DOM. Keyed\n // on the entry's root-relative path (`index.js`), matching the entry\n // scaffolded by tempo-project's `EXPO_INDEX_JS`.\n if (context.filepath === \"index.js\") {\n injectProjectRootMeta(api, path, root);\n }\n\n path.traverse({\n JSXElement(elementPath) {\n const element = elementPath.node;\n const tagName = getBabelTagName(element.openingElement.name);\n if (FRAGMENT_TAG_NAMES.has(tagName)) return;\n\n const info = {\n element,\n tagName,\n } as unknown as ElementInfo;\n const props = computeTempoAnnotatedProps({\n info,\n filepath: context.filepath,\n modifiedtsMs: context.modifiedtsMs,\n sourceVersion: context.sourceVersion,\n computeAnnotatedProps: options.computeAnnotatedProps,\n elementSupportOverrides: REACT_NATIVE_SUPPORT_OVERRIDES,\n });\n\n addAnnotations(api, tagName, element.openingElement, props);\n },\n });\n },\n },\n },\n };\n}\n\nexport { tempoExpoBabelPlugin };\n","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 { 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\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 = computeAnnotatedProps\n ? computeAnnotatedProps(info, filepath, modifiedtsMs, sourceVersion)\n : defaultComputeAnnotatedProps(info, filepath, modifiedtsMs, sourceVersion);\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","/**\n * Canvas source-version identity.\n *\n * `sourceVersionHash` maps the exact text of a source file to a 16-hex-character\n * token identifying that content. It is the version stamp the canvas edit/\n * reconcile loop uses to answer \"has the host caught up to write W?\": the SDK\n * JSX transforms stamp `data-tempo-source-version` with the hash of the source\n * they annotate, and the write pipeline (`applyWrites` → `sourceVersionsByFile`)\n * reports the hash of the exact bytes it wrote. A captured element's stamp is\n * compared for EQUALITY against a write's version — never ordered, never\n * subtracted, never used as a high-water mark. Two identical contents MUST\n * produce the same token; two different contents MUST (for identity purposes)\n * produce different tokens.\n *\n * Because coverage is an equality test across independently-computed hashes,\n * every producer of a version — this function's callers in the vite/next/expo\n * transforms and in `applyWrites` — MUST route through THIS function so the\n * tokens are bit-identical. Changing the algorithm requires changing it for all\n * producers in lockstep, or old stamps and new write-versions stop matching.\n *\n * The token concatenates two independent 32-bit rolling hashes over the string's\n * UTF-16 code units — djb2 and sdbm — each rendered as unsigned 8-char hex. Two\n * independent hash families make an accidental collision between distinct source\n * contents vanishingly unlikely for version-identity use, while the function\n * stays dependency-free and single-pass (fast enough to run once per file per\n * transform on the devserver hot path).\n */\nexport function sourceVersionHash(content: string): string {\n let djb2 = 5381;\n let sdbm = 0;\n for (let i = 0; i < content.length; i++) {\n const c = content.charCodeAt(i);\n // djb2: hash * 33 ^ c. The trailing `^ c` keeps the value inside 32-bit\n // signed range every iteration, so no explicit coercion is needed.\n djb2 = ((djb2 << 5) + djb2) ^ c;\n // sdbm: c + hash*65599. The final term is an arithmetic subtraction, so\n // coerce back to a 32-bit int each step to prevent float drift.\n sdbm = (c + (sdbm << 6) + (sdbm << 16) - sdbm) | 0;\n }\n return toHex8(djb2) + toHex8(sdbm);\n}\n\n/** Render a 32-bit value as unsigned, zero-padded 8-char lowercase hex. */\nfunction toHex8(n: number): string {\n return (n >>> 0).toString(16).padStart(8, \"0\");\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,SAAS,eAAe;AAEjC,SAAS,oBAAwC;;;ACHjD,SAAS,cAAc,gBAAgB;AACvC,SAAS,gBAAgB;;;AC0BlB,SAAS,kBAAkB,SAAyB;AACzD,MAAI,OAAO;AACX,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,UAAM,IAAI,QAAQ,WAAW,CAAC;AAG9B,YAAS,QAAQ,KAAK,OAAQ;AAG9B,WAAQ,KAAK,QAAQ,MAAM,QAAQ,MAAM,OAAQ;AAAA,EACnD;AACA,SAAO,OAAO,IAAI,IAAI,OAAO,IAAI;AACnC;AAGA,SAAS,OAAO,GAAmB;AACjC,UAAQ,MAAM,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAC/C;;;ADpCO,IAAM,kBAAkB,CAAC,oBAAoB;AAc7C,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;AAEO,SAAS,qBAAqB,MAAsB;AACzD,MAAI;AACF,WAAO,aAAa,OAAO,IAAI;AAAA,EACjC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEO,SAAS,mBAAmB,SAA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