tempo-sdk 0.0.87 → 0.0.89
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 +2 -2
- package/dist/canvas/astro.js +1 -1
- package/dist/canvas/index.js +2 -2
- package/dist/canvas/interact-projection.js +1 -1
- package/dist/canvas/svelte.js +1 -1
- package/dist/canvas/vue.js +1 -1
- package/dist/{chunk-AUG3ZWTR.js → chunk-3JR2JRSV.js} +2 -2
- package/dist/{chunk-AUG3ZWTR.js.map → chunk-3JR2JRSV.js.map} +1 -1
- package/dist/{chunk-RQ54RXOY.js → chunk-3XEEVCM3.js} +36 -12
- package/dist/chunk-3XEEVCM3.js.map +1 -0
- package/dist/{chunk-GVH7HUMT.js → chunk-GZ6KY7ZF.js} +2 -2
- package/dist/{chunk-GVH7HUMT.js.map → chunk-GZ6KY7ZF.js.map} +1 -1
- package/dist/{chunk-PPIIUCX5.js → chunk-NXPP3CSM.js} +5 -4
- package/dist/chunk-NXPP3CSM.js.map +1 -0
- package/dist/{chunk-PTL3UFIF.js → chunk-SLAZCXFE.js} +2 -2
- package/dist/{chunk-PTL3UFIF.js.map → chunk-SLAZCXFE.js.map} +1 -1
- package/dist/{chunk-CXGAJRK7.js → chunk-X5ORR3FI.js} +2 -2
- package/dist/index.js +2 -2
- 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 +1 -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 +1 -1
- package/dist/vue.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-PPIIUCX5.js.map +0 -1
- package/dist/chunk-RQ54RXOY.js.map +0 -1
- /package/dist/{chunk-CXGAJRK7.js.map → chunk-X5ORR3FI.js.map} +0 -0
package/dist/astro.js
CHANGED
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
} from "./chunk-JVVHU3A7.js";
|
|
9
9
|
import {
|
|
10
10
|
tempoVitePlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-X5ORR3FI.js";
|
|
12
12
|
import "./chunk-PYAJHLXO.js";
|
|
13
13
|
import "./chunk-DI2ZFAWL.js";
|
|
14
14
|
import {
|
|
15
15
|
TEMPO_HOST_IDENTITY_CAPABILITY_HEADER,
|
|
16
16
|
TEMPO_HOST_IDENTITY_ENDPOINT,
|
|
17
17
|
createTempoHostIdentity
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3JR2JRSV.js";
|
|
19
19
|
import "./chunk-DMT5MRMS.js";
|
|
20
20
|
import "./chunk-H6OZIX2U.js";
|
|
21
21
|
import {
|
package/dist/canvas/astro.js
CHANGED
package/dist/canvas/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
installTempoInteractProjectionSource
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-3XEEVCM3.js";
|
|
4
4
|
import "../chunk-SGN7BDRE.js";
|
|
5
5
|
import "../chunk-XN2K7GED.js";
|
|
6
6
|
import {
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
useStoryboardSize,
|
|
39
39
|
v1DirectUrlSize,
|
|
40
40
|
v1RenderRequestSize
|
|
41
|
-
} from "../chunk-
|
|
41
|
+
} from "../chunk-NXPP3CSM.js";
|
|
42
42
|
import {
|
|
43
43
|
PROJECTION_PENDING_ATTRIBUTE,
|
|
44
44
|
PROJECTION_SCOPE_ROLE,
|
package/dist/canvas/svelte.js
CHANGED
package/dist/canvas/vue.js
CHANGED
|
@@ -5,7 +5,7 @@ import { resolve } from "path";
|
|
|
5
5
|
// package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "tempo-sdk",
|
|
8
|
-
version: "0.0.
|
|
8
|
+
version: "0.0.89",
|
|
9
9
|
publishConfig: {
|
|
10
10
|
tag: "sdk-v2-latest"
|
|
11
11
|
},
|
|
@@ -339,4 +339,4 @@ export {
|
|
|
339
339
|
createTempoHostIdentity,
|
|
340
340
|
createSdkFileMatcher
|
|
341
341
|
};
|
|
342
|
-
//# sourceMappingURL=chunk-
|
|
342
|
+
//# sourceMappingURL=chunk-3JR2JRSV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../host-identity.ts","../package.json","../release-channel.ts","../sdk-package-files.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport { TEMPO_SDK_CHANNEL } from \"./release-channel\";\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 = \"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\" | \"nuxt\" | \"astro\";\n\n/**\n * The name of `tempoVuePlugin()`'s annotating plugin. A Vite server that runs\n * it reports the `vueSourceAnnotation` capability, which is what proves an\n * app's Vue templates are stamped: `pluginActive` only proves\n * `tempoVitePlugin()`, and a Vue app with that alone serves route documents\n * whose layers carry no `.vue` source.\n */\nexport const TEMPO_VUE_ANNOTATION_PLUGIN_NAME = \"tempo-vue-source-annotation\";\n\n/** Optional features a host's served identity vouches for. */\nexport interface TempoHostIdentityCapabilities {\n /** 1 when the server renders Astro components for the canvas. */\n astroComponents?: number;\n /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */\n vueSourceAnnotation?: number;\n}\n\nexport interface TempoHostIdentity<\n Framework extends TempoHostFramework = TempoHostFramework,\n> {\n tempoHost: true;\n contractVersion: number;\n workspaceNonce: string;\n sdkVersion: string;\n sdkChannel: string;\n pluginActive: boolean;\n framework: Framework;\n capabilities?: TempoHostIdentityCapabilities;\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<Framework extends TempoHostFramework>(\n framework: Framework,\n options: {\n root?: string;\n pluginActive?: boolean;\n capabilities?: TempoHostIdentityCapabilities;\n } = {},\n): TempoHostIdentity<Framework> {\n return {\n tempoHost: true,\n contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,\n workspaceNonce: readTempoWorkspaceNonce(options.root),\n sdkVersion: sdkPackage.version,\n sdkChannel: TEMPO_SDK_CHANNEL,\n pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),\n framework,\n ...(options.capabilities ? { capabilities: options.capabilities } : {}),\n };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.87\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\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 \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\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/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.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 \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.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 \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\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 \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts 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 flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.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 \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\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 \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\n/** This package's published name, as declared in its package.json. */\nexport const SDK_PACKAGE_NAME = \"tempo-sdk\";\n\nconst SDK_NODE_MODULES_SEGMENT = `/node_modules/${SDK_PACKAGE_NAME}/`;\n\n/**\n * A predicate for \"this file belongs to tempo-sdk itself\". The SDK's own\n * components (storyboard shells, error boundaries, admission gates) are\n * canvas plumbing, never authored UI, so no annotation entry point may stamp\n * source locations on them — the canvas treats every stamped element as user\n * code.\n *\n * A project can reach SDK files under many spellings: a published copy in\n * node_modules, a pnpm store path, a workspace link, a symlink, or a source\n * alias into a checkout. Ownership is therefore decided by where the file\n * really lives — the nearest package.json above its real path declares this\n * package — and not by the id's spelling or the caller's include/exclude\n * patterns. A package nested inside the SDK checkout (the demo apps) has its\n * own package.json and stays annotatable.\n */\nexport function createSdkFileMatcher(): (file: string) => boolean {\n // Directory → whether its nearest enclosing package.json is this package.\n const ownerIsSdkByDirectory = new Map<string, boolean>();\n\n const nearestPackageIsSdk = (startDirectory: string): boolean => {\n const visited: string[] = [];\n let directory = startDirectory;\n let isSdk = false;\n while (true) {\n const cached = ownerIsSdkByDirectory.get(directory);\n if (cached !== undefined) {\n isSdk = cached;\n break;\n }\n visited.push(directory);\n const manifest = readPackageManifest(directory);\n if (manifest !== undefined) {\n isSdk = manifest?.name === SDK_PACKAGE_NAME;\n break;\n }\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const entry of visited) ownerIsSdkByDirectory.set(entry, isSdk);\n return isSdk;\n };\n\n return (file) => {\n if (file.replace(/\\\\/g, \"/\").includes(SDK_NODE_MODULES_SEGMENT)) {\n return true;\n }\n let realFile = file;\n try {\n realFile = realpathSync.native(file);\n } catch {\n // Virtual or not-yet-written ids keep their authored spelling.\n }\n return nearestPackageIsSdk(dirname(realFile));\n };\n}\n\n/** The package.json in `directory`: `undefined` when there is none, `null`\n * when one exists but cannot be read as a manifest (still a package\n * boundary, just not this package). */\nfunction readPackageManifest(\n directory: string,\n): { name?: unknown } | null | undefined {\n let text: string;\n try {\n text = readFileSync(join(directory, \"package.json\"), \"utf8\");\n } catch {\n return undefined;\n }\n try {\n const manifest: unknown = JSON.parse(text);\n return manifest && typeof manifest === \"object\" ? manifest : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EAEX,eAAiB;AAAA,IACf,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EAEf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,oBAAoB;AAAA,MAClB,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,WAAW;AAAA,MACT,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,IACX;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,2BAA2B;AAAA,MACzB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,KAAK;AAAA,MACH,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,YAAY;AAAA,MACV,OAAS;AAAA,MACT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A,QAAI,WAAW;AACf,QAAI;AACF,iBAAW,aAAa,OAAO,IAAI;AAAA,IACrC,QAAQ;AAAA,IAER;AACA,WAAO,oBAAoB,QAAQ,QAAQ,CAAC;AAAA,EAC9C;AACF;AAKA,SAAS,oBACP,WACuC;AACvC,MAAI;AACJ,MAAI;AACF,WAAOA,cAAa,KAAK,WAAW,cAAc,GAAG,MAAM;AAAA,EAC7D,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,WAAoB,KAAK,MAAM,IAAI;AACzC,WAAO,YAAY,OAAO,aAAa,WAAW,WAAW;AAAA,EAC/D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["readFileSync"]}
|
|
1
|
+
{"version":3,"sources":["../host-identity.ts","../package.json","../release-channel.ts","../sdk-package-files.ts"],"sourcesContent":["import { readFileSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nimport { TEMPO_SDK_CHANNEL } from \"./release-channel\";\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 = \"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\" | \"nuxt\" | \"astro\";\n\n/**\n * The name of `tempoVuePlugin()`'s annotating plugin. A Vite server that runs\n * it reports the `vueSourceAnnotation` capability, which is what proves an\n * app's Vue templates are stamped: `pluginActive` only proves\n * `tempoVitePlugin()`, and a Vue app with that alone serves route documents\n * whose layers carry no `.vue` source.\n */\nexport const TEMPO_VUE_ANNOTATION_PLUGIN_NAME = \"tempo-vue-source-annotation\";\n\n/** Optional features a host's served identity vouches for. */\nexport interface TempoHostIdentityCapabilities {\n /** 1 when the server renders Astro components for the canvas. */\n astroComponents?: number;\n /** 1 when `tempoVuePlugin()` annotates this Vite server's `.vue` files. */\n vueSourceAnnotation?: number;\n}\n\nexport interface TempoHostIdentity<\n Framework extends TempoHostFramework = TempoHostFramework,\n> {\n tempoHost: true;\n contractVersion: number;\n workspaceNonce: string;\n sdkVersion: string;\n sdkChannel: string;\n pluginActive: boolean;\n framework: Framework;\n capabilities?: TempoHostIdentityCapabilities;\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<Framework extends TempoHostFramework>(\n framework: Framework,\n options: {\n root?: string;\n pluginActive?: boolean;\n capabilities?: TempoHostIdentityCapabilities;\n } = {},\n): TempoHostIdentity<Framework> {\n return {\n tempoHost: true,\n contractVersion: TEMPO_HOST_IDENTITY_CONTRACT_VERSION,\n workspaceNonce: readTempoWorkspaceNonce(options.root),\n sdkVersion: sdkPackage.version,\n sdkChannel: TEMPO_SDK_CHANNEL,\n pluginActive: options.pluginActive ?? Boolean(process.env.TEMPO),\n framework,\n ...(options.capabilities ? { capabilities: options.capabilities } : {}),\n };\n}\n","{\n \"name\": \"tempo-sdk\",\n \"version\": \"0.0.89\",\n\n \"publishConfig\": {\n \"tag\": \"sdk-v2-latest\"\n },\n \"type\": \"module\",\n \"description\": \"Tempo SDK \\u2014 Vite, Next.js, Nuxt, Expo, Svelte, Vue and Astro canvas integration, source annotations and storyboard types\",\n\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 \"./astro/controls\": {\n \"types\": \"./dist/astro/controls.d.ts\",\n \"import\": \"./dist/astro/controls.js\",\n \"default\": \"./dist/astro/controls.js\"\n },\n \"./astro\": {\n \"types\": \"./dist/astro.d.ts\",\n \"import\": \"./dist/astro.js\"\n },\n \"./astro/client\": {\n \"types\": \"./astro/client.d.ts\"\n },\n \"./canvas/astro\": {\n \"types\": \"./dist/canvas/astro.d.ts\",\n \"import\": \"./dist/canvas/astro.js\"\n },\n \"./canvas/astro-contract\": {\n \"types\": \"./dist/canvas/astro-contract.d.ts\",\n \"import\": \"./dist/canvas/astro-contract.js\"\n },\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/vue\": {\n \"types\": \"./dist/canvas/vue.d.ts\",\n \"import\": \"./dist/canvas/vue.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 \"./nuxt\": {\n \"types\": \"./dist/nuxt.d.ts\",\n \"import\": \"./dist/nuxt.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 \"./vue\": {\n \"types\": \"./dist/vue.d.ts\",\n \"import\": \"./dist/vue.js\"\n },\n \"./astro/asset-preview-client\": {\n \"types\": \"./dist/astro/asset-preview-client.d.ts\",\n \"import\": \"./dist/astro/asset-preview-client.js\"\n },\n \"./flutter-preview-path\": {\n \"types\": \"./dist/flutter-preview-path.d.ts\",\n \"import\": \"./dist/flutter-preview-path.js\"\n },\n \"./canvas/flutter-preview\": {\n \"types\": \"./dist/canvas/flutter-preview.d.ts\",\n \"import\": \"./dist/canvas/flutter-preview.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"astro/client.d.ts\"\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 \"demo:nuxt\": \"pnpm --filter @tempo-modules/tempo-sdk-nuxt-demo dev\",\n \"test\": \"vitest run\",\n \"test:browser\": \"vitest run canvas-dependency-scan-browser.test.ts 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 flutter-storyboard-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts astro-integration.test.ts astro-storyboard-routing.test.ts astro-react-integration.test.ts astro-descriptor-browser.test.ts astro-packed.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 \"optionalDependencies\": {\n \"@astrojs/compiler-rs\": \"0.5.1\"\n },\n \"peerDependencies\": {\n \"astro\": \"^7.0.0\",\n \"@babel/core\": \"^7.0.0\",\n \"h3\": \"^1.12.0\",\n \"next\": \"^13 || ^14 || ^15 || ^16\",\n \"nuxt\": \"^3.18.0 || ^4.0.0\",\n \"react\": \"^18 || ^19\",\n \"svelte\": \"^5.0.0\",\n \"vite\": \"^5 || ^6 || ^7 || ^8\",\n \"vue\": \"^3.3.0\"\n },\n \"peerDependenciesMeta\": {\n \"astro\": {\n \"optional\": true\n },\n \"react\": {\n \"optional\": true\n },\n \"@babel/core\": {\n \"optional\": true\n },\n \"h3\": {\n \"optional\": true\n },\n \"next\": {\n \"optional\": true\n },\n \"nuxt\": {\n \"optional\": true\n },\n \"svelte\": {\n \"optional\": true\n },\n \"vite\": {\n \"optional\": true\n },\n \"vue\": {\n \"optional\": true\n }\n },\n \"devDependencies\": {\n \"@astrojs/react\": \"7.0.1\",\n \"@babel/core\": \"^7.29.0\",\n \"@babel/types\": \"^7.29.0\",\n \"@modules/annotation\": \"workspace:*\",\n \"@modules/astro-editor\": \"workspace:*\",\n \"@modules/file-parser\": \"workspace:*\",\n \"@modules/frame-pool\": \"workspace:*\",\n \"@modules/iframe-projection\": \"workspace:*\",\n \"@modules/svelte-editor\": \"workspace:*\",\n \"@modules/vue-editor\": \"workspace:*\",\n \"@nuxt/kit\": \"^4.6.2\",\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 \"@vitejs/plugin-vue\": \"6.0.10\",\n \"astro\": \"7.3.8\",\n \"h3\": \"^1.15.11\",\n \"magic-string\": \"^0.30.21\",\n \"nuxt\": \"^4.6.2\",\n \"playwright\": \"^1.58.2\",\n \"react-dom\": \"catalog:\",\n \"react-dom18\": \"npm:react-dom@18.3.1\",\n \"react18\": \"npm:react@18.3.1\",\n \"svelte\": \"5.56.9\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"catalog:\",\n \"vite\": \"catalog:\",\n \"vitest\": \"catalog:\",\n \"vue\": \"3.5.44\"\n }\n}\n","import sdkPackage from \"./package.json\" with { type: \"json\" };\n\n/** Shared by the app, generated projects and the SDK host identity. */\nexport const TEMPO_SDK_CHANNEL = sdkPackage.publishConfig.tag;\n\nexport function sdkChannelGeneration(channel: unknown): number | null {\n if (typeof channel !== \"string\") return null;\n const match = /^sdk-v([1-9]\\d*)-latest$/.exec(channel);\n return match ? Number(match[1]) : null;\n}\n\nif (sdkChannelGeneration(TEMPO_SDK_CHANNEL) === null) {\n throw new Error(\"tempo-sdk publishConfig.tag must be sdk-v<N>-latest\");\n}\n\n/** Preserve local development links; registry installs follow the app channel. */\nexport function managedTempoSdkSpec(spec: string): string {\n const generation = sdkChannelGeneration(spec);\n if (\n generation !== null &&\n generation > sdkChannelGeneration(TEMPO_SDK_CHANNEL)!\n ) {\n throw new Error(\n `This project requires tempo-sdk@${spec}. Update Tempo before opening it; this app supports ${TEMPO_SDK_CHANNEL}.`,\n );\n }\n if (/^(workspace:|file:|link:|portal:|git|https?:|ssh:|github:)/.test(spec))\n return spec;\n return TEMPO_SDK_CHANNEL;\n}\n","import { readFileSync, realpathSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\n\n/** This package's published name, as declared in its package.json. */\nexport const SDK_PACKAGE_NAME = \"tempo-sdk\";\n\nconst SDK_NODE_MODULES_SEGMENT = `/node_modules/${SDK_PACKAGE_NAME}/`;\n\n/**\n * A predicate for \"this file belongs to tempo-sdk itself\". The SDK's own\n * components (storyboard shells, error boundaries, admission gates) are\n * canvas plumbing, never authored UI, so no annotation entry point may stamp\n * source locations on them — the canvas treats every stamped element as user\n * code.\n *\n * A project can reach SDK files under many spellings: a published copy in\n * node_modules, a pnpm store path, a workspace link, a symlink, or a source\n * alias into a checkout. Ownership is therefore decided by where the file\n * really lives — the nearest package.json above its real path declares this\n * package — and not by the id's spelling or the caller's include/exclude\n * patterns. A package nested inside the SDK checkout (the demo apps) has its\n * own package.json and stays annotatable.\n */\nexport function createSdkFileMatcher(): (file: string) => boolean {\n // Directory → whether its nearest enclosing package.json is this package.\n const ownerIsSdkByDirectory = new Map<string, boolean>();\n\n const nearestPackageIsSdk = (startDirectory: string): boolean => {\n const visited: string[] = [];\n let directory = startDirectory;\n let isSdk = false;\n while (true) {\n const cached = ownerIsSdkByDirectory.get(directory);\n if (cached !== undefined) {\n isSdk = cached;\n break;\n }\n visited.push(directory);\n const manifest = readPackageManifest(directory);\n if (manifest !== undefined) {\n isSdk = manifest?.name === SDK_PACKAGE_NAME;\n break;\n }\n const parent = dirname(directory);\n if (parent === directory) break;\n directory = parent;\n }\n for (const entry of visited) ownerIsSdkByDirectory.set(entry, isSdk);\n return isSdk;\n };\n\n return (file) => {\n if (file.replace(/\\\\/g, \"/\").includes(SDK_NODE_MODULES_SEGMENT)) {\n return true;\n }\n let realFile = file;\n try {\n realFile = realpathSync.native(file);\n } catch {\n // Virtual or not-yet-written ids keep their authored spelling.\n }\n return nearestPackageIsSdk(dirname(realFile));\n };\n}\n\n/** The package.json in `directory`: `undefined` when there is none, `null`\n * when one exists but cannot be read as a manifest (still a package\n * boundary, just not this package). */\nfunction readPackageManifest(\n directory: string,\n): { name?: unknown } | null | undefined {\n let text: string;\n try {\n text = readFileSync(join(directory, \"package.json\"), \"utf8\");\n } catch {\n return undefined;\n }\n try {\n const manifest: unknown = JSON.parse(text);\n return manifest && typeof manifest === \"object\" ? manifest : null;\n } catch {\n return null;\n }\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EAEX,eAAiB;AAAA,IACf,KAAO;AAAA,EACT;AAAA,EACA,MAAQ;AAAA,EACR,aAAe;AAAA,EAEf,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,SAAW;AAAA,IACT,oBAAoB;AAAA,MAClB,OAAS;AAAA,MACT,QAAU;AAAA,MACV,SAAW;AAAA,IACb;AAAA,IACA,WAAW;AAAA,MACT,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,IACX;AAAA,IACA,kBAAkB;AAAA,MAChB,OAAS;AAAA,MACT,QAAU;AAAA,IACZ;AAAA,IACA,2BAA2B;AAAA,MACzB,OAA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;AACnE,WAAO;AAAA,EACT;AAEA,SAAO,CAAC,SAAS;AACf,QAAI,KAAK,QAAQ,OAAO,GAAG,EAAE,SAAS,wBAAwB,GAAG;AAC/D,aAAO;AAAA,IACT;AACA,QAAI,WAAW;AACf,QAAI;AACF,iBAAW,aAAa,OAAO,IAAI;AAAA,IACrC,QAAQ;AAAA,IAER;AACA,WAAO,oBAAoB,QAAQ,QAAQ,CAAC;AAAA,EAC9C;AACF;AAKA,SAAS,oBACP,WACuC;AACvC,MAAI;AACJ,MAAI;AACF,WAAOA,cAAa,KAAK,WAAW,cAAc,GAAG,MAAM;AAAA,EAC7D,QAAQ;AACN,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,WAAoB,KAAK,MAAM,IAAI;AACzC,WAAO,YAAY,OAAO,aAAa,WAAW,WAAW;AAAA,EAC/D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["readFileSync"]}
|
|
@@ -140,6 +140,12 @@ function browserFrameClock() {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
// ../../modules/rate-limiter/work-scheduler.ts
|
|
143
|
+
var keyPriorityRank = {
|
|
144
|
+
low: 0,
|
|
145
|
+
normal: 1,
|
|
146
|
+
high: 2,
|
|
147
|
+
"extra-high": 3
|
|
148
|
+
};
|
|
143
149
|
var browserClock = () => ({
|
|
144
150
|
now: () => performance.now(),
|
|
145
151
|
...browserFrameClock(),
|
|
@@ -173,7 +179,8 @@ function createWorkScheduler(options = {}) {
|
|
|
173
179
|
const interactive = /* @__PURE__ */ new Set();
|
|
174
180
|
const priorities = /* @__PURE__ */ new Map();
|
|
175
181
|
let highPriorityKeys = 0;
|
|
176
|
-
|
|
182
|
+
let extraHighPriorityKeys = 0;
|
|
183
|
+
const rank = keyPriorityRank;
|
|
177
184
|
const getPriority = (key) => {
|
|
178
185
|
if (key === void 0) return "normal";
|
|
179
186
|
if (typeof key === "symbol") return priorities.get(key) ?? "normal";
|
|
@@ -184,8 +191,13 @@ function createWorkScheduler(options = {}) {
|
|
|
184
191
|
}
|
|
185
192
|
return result;
|
|
186
193
|
};
|
|
187
|
-
const priorityOf = (job) =>
|
|
188
|
-
|
|
194
|
+
const priorityOf = (job) => {
|
|
195
|
+
const owner = getPriority(job.key);
|
|
196
|
+
return job.foreground?.() && rank[owner] < rank.high ? "high" : owner;
|
|
197
|
+
};
|
|
198
|
+
const high = (job) => job !== void 0 && rank[priorityOf(job)] >= rank.high;
|
|
199
|
+
const extraHigh = (job) => job !== void 0 && priorityOf(job) === "extra-high";
|
|
200
|
+
const byPriority = (a, b) => rank[priorityOf(b)] - rank[priorityOf(a)] || (a.priority === "frame" ? -1 : b.priority === "frame" ? 1 : 0) || a.at - b.at;
|
|
189
201
|
const paintWaits = /* @__PURE__ */ new Set();
|
|
190
202
|
let frame = null;
|
|
191
203
|
let idle = null;
|
|
@@ -221,17 +233,25 @@ function createWorkScheduler(options = {}) {
|
|
|
221
233
|
if (kind === "frame" && interactive.size && queues.input.size)
|
|
222
234
|
return first(queues.input);
|
|
223
235
|
const urgentInput = candidate(queues.input);
|
|
224
|
-
if (high(urgentInput)) return urgentInput;
|
|
225
|
-
if (kind === "frame" && queues.input.size) return first(queues.input);
|
|
226
|
-
if (interactive.size) return void 0;
|
|
227
236
|
const candidates = [
|
|
228
237
|
candidate(queues.visible),
|
|
229
238
|
candidate(queues.background),
|
|
230
239
|
...kind === "frame" ? [candidate(queues.frame)] : []
|
|
231
240
|
].filter((job) => !!job);
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
241
|
+
if (!interactive.size) {
|
|
242
|
+
const clicked = [urgentInput, ...candidates].filter(
|
|
243
|
+
(job) => extraHigh(job)
|
|
244
|
+
);
|
|
245
|
+
const aged = clicked.filter((job) => clock.now() - job.at >= highPriorityAgeMs).sort((a, b) => a.at - b.at)[0];
|
|
246
|
+
if (aged) return aged;
|
|
247
|
+
if (extraHigh(urgentInput)) return urgentInput;
|
|
248
|
+
const ready = clicked.sort(byPriority)[0];
|
|
249
|
+
if (ready) return ready;
|
|
250
|
+
}
|
|
251
|
+
if (high(urgentInput)) return urgentInput;
|
|
252
|
+
if (kind === "frame" && queues.input.size) return first(queues.input);
|
|
253
|
+
if (interactive.size) return void 0;
|
|
254
|
+
return candidates.filter((job) => high(job) && clock.now() - job.at >= highPriorityAgeMs).sort((a, b) => a.at - b.at)[0] ?? candidates.sort(byPriority)[0];
|
|
235
255
|
};
|
|
236
256
|
async function pump(kind, deadline) {
|
|
237
257
|
if (disposed || draining) return;
|
|
@@ -433,8 +453,10 @@ function createWorkScheduler(options = {}) {
|
|
|
433
453
|
setPriority(key, priority) {
|
|
434
454
|
const before = getPriority(key);
|
|
435
455
|
if (disposed || before === priority) return;
|
|
436
|
-
if (before
|
|
437
|
-
if (priority
|
|
456
|
+
if (rank[before] >= rank.high) highPriorityKeys--;
|
|
457
|
+
if (rank[priority] >= rank.high) highPriorityKeys++;
|
|
458
|
+
if (before === "extra-high") extraHighPriorityKeys--;
|
|
459
|
+
if (priority === "extra-high") extraHighPriorityKeys++;
|
|
438
460
|
if (priority === "normal") priorities.delete(key);
|
|
439
461
|
else priorities.set(key, priority);
|
|
440
462
|
request();
|
|
@@ -453,6 +475,7 @@ function createWorkScheduler(options = {}) {
|
|
|
453
475
|
return {
|
|
454
476
|
interactiveClaims: interactive.size,
|
|
455
477
|
highPriorityKeys,
|
|
478
|
+
extraHighPriorityKeys,
|
|
456
479
|
eligibleJobs: count(),
|
|
457
480
|
queued: count(),
|
|
458
481
|
oldestMs: Math.max(
|
|
@@ -471,6 +494,7 @@ function createWorkScheduler(options = {}) {
|
|
|
471
494
|
disposed = true;
|
|
472
495
|
priorities.clear();
|
|
473
496
|
highPriorityKeys = 0;
|
|
497
|
+
extraHighPriorityKeys = 0;
|
|
474
498
|
for (const abort of paintWaits) abort();
|
|
475
499
|
if (frame !== null) clock.cancelFrame(frame);
|
|
476
500
|
if (idle !== null) clock.cancelIdle?.(idle);
|
|
@@ -8242,4 +8266,4 @@ function installTempoInteractProjectionSource() {
|
|
|
8242
8266
|
export {
|
|
8243
8267
|
installTempoInteractProjectionSource
|
|
8244
8268
|
};
|
|
8245
|
-
//# sourceMappingURL=chunk-
|
|
8269
|
+
//# sourceMappingURL=chunk-3XEEVCM3.js.map
|