tempo-sdk 0.0.44 → 0.0.45
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/canvas/index.js +20 -12
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +2 -2
- package/dist/canvas/svelte.js +2 -2
- package/dist/{chunk-ZT2REPH4.js → chunk-57KAYXHF.js} +1 -1
- package/dist/chunk-57KAYXHF.js.map +1 -0
- package/dist/{chunk-MUW75SOS.js → chunk-7AJVPFFG.js} +2 -2
- package/dist/{chunk-MUW75SOS.js.map → chunk-7AJVPFFG.js.map} +1 -1
- package/dist/{chunk-KQHC77IF.js → chunk-7O6DPEMF.js} +9 -3
- package/dist/chunk-7O6DPEMF.js.map +1 -0
- package/dist/{chunk-U52RN7MP.js → chunk-FIIU52RN.js} +2 -2
- package/dist/chunk-K3EYTZLL.js +45 -0
- package/dist/chunk-K3EYTZLL.js.map +1 -0
- package/dist/index.js +110 -7
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs.cjs +1 -1
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-KQHC77IF.js.map +0 -1
- package/dist/chunk-ZT2REPH4.js.map +0 -1
- /package/dist/{chunk-U52RN7MP.js.map → chunk-FIIU52RN.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sourceVersionHash
|
|
3
3
|
} from "./chunk-F3KJDCMU.js";
|
|
4
|
+
import {
|
|
5
|
+
VITE_ERROR_CLIENT_PATH,
|
|
6
|
+
VITE_ERROR_CLIENT_SOURCE,
|
|
7
|
+
VITE_ERROR_STATE_EVENT,
|
|
8
|
+
VITE_ERROR_SUBSCRIBE_EVENT
|
|
9
|
+
} from "./chunk-K3EYTZLL.js";
|
|
4
10
|
import {
|
|
5
11
|
TEMPO_INTERACT_FRAME_NAME
|
|
6
12
|
} from "./chunk-65B52AR7.js";
|
|
@@ -294,7 +300,7 @@ import { resolve } from "path";
|
|
|
294
300
|
// package.json
|
|
295
301
|
var package_default = {
|
|
296
302
|
name: "tempo-sdk",
|
|
297
|
-
version: "0.0.
|
|
303
|
+
version: "0.0.45",
|
|
298
304
|
type: "module",
|
|
299
305
|
description: "Tempo SDK \u2014 Vite, Next.js, and Expo plugins for JSX annotation and shared page/storyboard types",
|
|
300
306
|
repository: {
|
|
@@ -591,6 +597,72 @@ function createRapidHotUpdateReplay(options) {
|
|
|
591
597
|
};
|
|
592
598
|
}
|
|
593
599
|
|
|
600
|
+
// react-refresh-boundary.ts
|
|
601
|
+
var installed = /* @__PURE__ */ new WeakSet();
|
|
602
|
+
function installSynchronousReactRefreshBoundary(plugins) {
|
|
603
|
+
for (const plugin of plugins) {
|
|
604
|
+
if (plugin.name !== "vite:react-babel" || !plugin.transform || installed.has(plugin))
|
|
605
|
+
continue;
|
|
606
|
+
installed.add(plugin);
|
|
607
|
+
const hook = plugin.transform;
|
|
608
|
+
const transform = typeof hook === "function" ? hook : hook.handler;
|
|
609
|
+
const wrapped = async function(...args) {
|
|
610
|
+
const result = await transform.apply(this, args);
|
|
611
|
+
if (!result) return result;
|
|
612
|
+
const source = typeof result === "string" ? result : result.code;
|
|
613
|
+
if (!source) return result;
|
|
614
|
+
const code = source.replace(
|
|
615
|
+
/RefreshRuntime\.__hmr_import\(import\.meta\.url\)\.then\(\(currentExports\) => \{\n(\s*RefreshRuntime\.registerExportsForReactRefresh\([^\n]+\);)\n\s*import\.meta\.hot\.accept\(\(nextExports\) => \{([\s\S]*?)\n\s*\}\);\n\s*\}\);/,
|
|
616
|
+
(_match, register, accept) => `const __tempoReactRefreshExports = RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
|
617
|
+
${register}
|
|
618
|
+
return currentExports;
|
|
619
|
+
});
|
|
620
|
+
import.meta.hot.accept(async (nextExports) => {
|
|
621
|
+
const currentExports = await __tempoReactRefreshExports;${accept}
|
|
622
|
+
});`
|
|
623
|
+
);
|
|
624
|
+
return code === source ? result : typeof result === "string" ? code : { ...result, code };
|
|
625
|
+
};
|
|
626
|
+
plugin.transform = typeof hook === "function" ? wrapped : { ...hook, handler: wrapped };
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// vite-client-pending-updates.ts
|
|
631
|
+
function preservePendingViteModuleUpdates(source) {
|
|
632
|
+
const missingBoundary = /(const mod = this\.hotModulesMap\.get\(path\);\s*)if \(!mod\)\s*(?:return;|\{\s*return;\s*\})/;
|
|
633
|
+
const registeredBoundary = "this.hmrClient.hotModulesMap.set(this.ownerPath, mod);";
|
|
634
|
+
if (!missingBoundary.test(source) || !source.includes(registeredBoundary)) {
|
|
635
|
+
return source;
|
|
636
|
+
}
|
|
637
|
+
return source.replace(
|
|
638
|
+
missingBoundary,
|
|
639
|
+
`$1if (!mod || mod.pendingUpdates) {
|
|
640
|
+
const pending = mod || {
|
|
641
|
+
id: path,
|
|
642
|
+
callbacks: [],
|
|
643
|
+
pendingUpdates: new Map(),
|
|
644
|
+
};
|
|
645
|
+
pending.pendingUpdates.set(acceptedPath, update);
|
|
646
|
+
this.hotModulesMap.set(path, pending);
|
|
647
|
+
return;
|
|
648
|
+
}`
|
|
649
|
+
).replace(
|
|
650
|
+
registeredBoundary,
|
|
651
|
+
`${registeredBoundary}
|
|
652
|
+
if (mod.pendingUpdates) {
|
|
653
|
+
const pendingUpdates = [...mod.pendingUpdates.values()];
|
|
654
|
+
delete mod.pendingUpdates;
|
|
655
|
+
queueMicrotask(() => {
|
|
656
|
+
for (const update of pendingUpdates) {
|
|
657
|
+
void this.hmrClient.queueUpdate(update).catch((error) => {
|
|
658
|
+
this.hmrClient.logger.error(error);
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
}`
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
|
|
594
666
|
// tailwind-scan-net.ts
|
|
595
667
|
var SCANNABLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
596
668
|
"ts",
|
|
@@ -711,6 +783,7 @@ var ROOT_META_NAME = "tempo-project-root";
|
|
|
711
783
|
var SOURCE_IDENTITY_ROOT_META_NAME = "tempo-source-identity-root";
|
|
712
784
|
var INTERACT_PROJECTION_CLIENT_PATH = "/@tempo/interact-projection";
|
|
713
785
|
var INTERACT_PROJECTION_CLIENT_ID = "\0tempo:interact-projection";
|
|
786
|
+
var VITE_ERROR_CLIENT_ID = "\0tempo:server-errors";
|
|
714
787
|
var INTERACT_PROJECTION_SDK_SPECIFIER = "tempo-sdk/canvas/interact-projection";
|
|
715
788
|
function resolveOwnInteractProjectionModule() {
|
|
716
789
|
const selfDir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -827,7 +900,7 @@ function hasWorkspaceNonceMetaTag(html) {
|
|
|
827
900
|
function isSameError(left, right) {
|
|
828
901
|
return left.type === right.type && left.message === right.message && left.loc?.line === right.loc?.line && left.loc?.column === right.loc?.column;
|
|
829
902
|
}
|
|
830
|
-
function createErrorServer(onErrorFile) {
|
|
903
|
+
function createErrorServer(onErrorFile, onState) {
|
|
831
904
|
const errorsByFile = /* @__PURE__ */ new Map();
|
|
832
905
|
function getMostRecentError() {
|
|
833
906
|
if (errorsByFile.size === 0) return null;
|
|
@@ -836,6 +909,7 @@ function createErrorServer(onErrorFile) {
|
|
|
836
909
|
return latest;
|
|
837
910
|
}
|
|
838
911
|
function broadcastCurrentState() {
|
|
912
|
+
onState?.(server.currentError);
|
|
839
913
|
const data = JSON.stringify(server.currentError);
|
|
840
914
|
for (const client of server.clients) {
|
|
841
915
|
client.write(`data: ${data}
|
|
@@ -1125,8 +1199,10 @@ function tempoVitePlugin(options = {}) {
|
|
|
1125
1199
|
let canonicalRoot = process.cwd();
|
|
1126
1200
|
let sourceIdentityRoot = canonicalRoot;
|
|
1127
1201
|
let command = "serve";
|
|
1202
|
+
let hmrEnabled = true;
|
|
1128
1203
|
const errorServer = createErrorServer(
|
|
1129
|
-
(file) => pinErroneousRevisionCoverage(file)
|
|
1204
|
+
(file) => pinErroneousRevisionCoverage(file),
|
|
1205
|
+
(error) => devServer?.ws.send(VITE_ERROR_STATE_EVENT, error)
|
|
1130
1206
|
);
|
|
1131
1207
|
const unresolvedImports = /* @__PURE__ */ new Map();
|
|
1132
1208
|
let devServer;
|
|
@@ -1466,6 +1542,9 @@ function tempoVitePlugin(options = {}) {
|
|
|
1466
1542
|
resolveId: {
|
|
1467
1543
|
order: "pre",
|
|
1468
1544
|
async handler(id, importer, resolveOptions) {
|
|
1545
|
+
if (enabled && id === VITE_ERROR_CLIENT_PATH) {
|
|
1546
|
+
return VITE_ERROR_CLIENT_ID;
|
|
1547
|
+
}
|
|
1469
1548
|
if (id === INTERACT_PROJECTION_CLIENT_PATH) {
|
|
1470
1549
|
return INTERACT_PROJECTION_CLIENT_ID;
|
|
1471
1550
|
}
|
|
@@ -1504,6 +1583,9 @@ function tempoVitePlugin(options = {}) {
|
|
|
1504
1583
|
load: {
|
|
1505
1584
|
order: "pre",
|
|
1506
1585
|
async handler(id) {
|
|
1586
|
+
if (enabled && id === VITE_ERROR_CLIENT_ID) {
|
|
1587
|
+
return VITE_ERROR_CLIENT_SOURCE;
|
|
1588
|
+
}
|
|
1507
1589
|
if (id === INTERACT_PROJECTION_CLIENT_ID) {
|
|
1508
1590
|
return `import { installTempoInteractProjectionSource } from ${JSON.stringify(INTERACT_PROJECTION_SDK_SPECIFIER)};
|
|
1509
1591
|
let stop;
|
|
@@ -1575,6 +1657,10 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1575
1657
|
configResolved(resolvedConfig) {
|
|
1576
1658
|
if (!enabled) return;
|
|
1577
1659
|
command = resolvedConfig.command;
|
|
1660
|
+
hmrEnabled = resolvedConfig.server?.hmr !== false;
|
|
1661
|
+
if (command === "serve" && hmrEnabled) {
|
|
1662
|
+
installSynchronousReactRefreshBoundary(resolvedConfig.plugins ?? []);
|
|
1663
|
+
}
|
|
1578
1664
|
canonicalRoot = resolveCanonicalRoot(resolvedConfig.root);
|
|
1579
1665
|
sourceIdentityRoot = options.sourceIdentityRoot ? resolveCanonicalRoot(
|
|
1580
1666
|
resolve2(resolvedConfig.root, options.sourceIdentityRoot)
|
|
@@ -1589,6 +1675,9 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1589
1675
|
if (!allow.includes(ownDir)) allow.push(ownDir);
|
|
1590
1676
|
}
|
|
1591
1677
|
devServer = server;
|
|
1678
|
+
server.ws.on?.(VITE_ERROR_SUBSCRIBE_EVENT, (_data, client) => {
|
|
1679
|
+
client.send(VITE_ERROR_STATE_EVENT, errorServer.currentError);
|
|
1680
|
+
});
|
|
1592
1681
|
syncUnresolvedImportWatcher();
|
|
1593
1682
|
server.watcher?.once?.("close", closeUnresolvedImportWatchers);
|
|
1594
1683
|
server.httpServer?.once("close", closeUnresolvedImportWatchers);
|
|
@@ -1713,6 +1802,13 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1713
1802
|
return;
|
|
1714
1803
|
}
|
|
1715
1804
|
const tags = [];
|
|
1805
|
+
if (hmrEnabled) {
|
|
1806
|
+
tags.push({
|
|
1807
|
+
tag: "script",
|
|
1808
|
+
attrs: { type: "module", src: VITE_ERROR_CLIENT_PATH },
|
|
1809
|
+
injectTo: "head-prepend"
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1716
1812
|
if (!hasRootMetaTag(html)) {
|
|
1717
1813
|
tags.push({
|
|
1718
1814
|
tag: "meta",
|
|
@@ -1771,6 +1867,10 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1771
1867
|
return null;
|
|
1772
1868
|
}
|
|
1773
1869
|
const cleanId = cleanModuleId(id);
|
|
1870
|
+
if (cleanId.replace(/\\/g, "/").endsWith("/vite/dist/client/client.mjs")) {
|
|
1871
|
+
const code = preservePendingViteModuleUpdates(source);
|
|
1872
|
+
return code === source ? null : { code, map: null };
|
|
1873
|
+
}
|
|
1774
1874
|
if (!filter(cleanId)) {
|
|
1775
1875
|
return null;
|
|
1776
1876
|
}
|
|
@@ -1779,10 +1879,13 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1779
1879
|
const modifiedtsMs = Math.trunc(statSync2(cleanId).mtimeMs);
|
|
1780
1880
|
const rawSource = readFileSync2(cleanId, "utf8");
|
|
1781
1881
|
const sourceVersion = sourceVersionHash(rawSource);
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1882
|
+
const identityKey = canonicalIdentityKey(cleanId);
|
|
1883
|
+
if (!defaultExportIdentityByFile.has(identityKey)) {
|
|
1884
|
+
defaultExportIdentityByFile.set(
|
|
1885
|
+
identityKey,
|
|
1886
|
+
readDefaultExportIdentity(rawSource)
|
|
1887
|
+
);
|
|
1888
|
+
}
|
|
1786
1889
|
const result = annotateFile(
|
|
1787
1890
|
source,
|
|
1788
1891
|
cleanId,
|