tempo-sdk 0.0.44 → 0.0.51
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/editor.d.ts +1 -1
- package/dist/assets/editor.js +4 -2
- package/dist/assets/editor.js.map +1 -1
- package/dist/assets/index.d.ts +112 -24
- package/dist/assets/index.js +309 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/parser.d.ts +14 -3
- package/dist/assets/parser.js +7 -3
- package/dist/canvas/index.d.ts +1 -1
- package/dist/canvas/index.js +21 -12
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/interact-projection.js +3 -2
- package/dist/canvas/svelte.d.ts +1 -1
- 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-DI2ZFAWL.js +14 -0
- package/dist/chunk-DI2ZFAWL.js.map +1 -0
- package/dist/chunk-DX6XAXCK.js +827 -0
- package/dist/chunk-DX6XAXCK.js.map +1 -0
- package/dist/chunk-K3EYTZLL.js +45 -0
- package/dist/chunk-K3EYTZLL.js.map +1 -0
- package/dist/{chunk-MUW75SOS.js → chunk-LFYKJJC5.js} +3 -3
- package/dist/{chunk-MUW75SOS.js.map → chunk-LFYKJJC5.js.map} +1 -1
- package/dist/{chunk-IWULHYPW.js → chunk-O65OD3NA.js} +216 -19
- package/dist/chunk-O65OD3NA.js.map +1 -0
- package/dist/{chunk-KQHC77IF.js → chunk-PULSTDX2.js} +17 -5
- package/dist/chunk-PULSTDX2.js.map +1 -0
- package/dist/{chunk-U52RN7MP.js → chunk-ZZYNOX24.js} +23 -811
- package/dist/chunk-ZZYNOX24.js.map +1 -0
- package/dist/index.js +195 -19
- package/dist/index.js.map +1 -1
- package/dist/nextjs/plugin.js +1 -1
- package/dist/nextjs.cjs +2 -2
- package/dist/nextjs.cjs.map +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/{storyboard-xVaRTJAu.d.ts → storyboard-CBHki7Aw.d.ts} +2 -1
- package/dist/{types-B-dRoF2T.d.ts → types-C7cvcY6T.d.ts} +5 -1
- package/package.json +2 -2
- package/dist/chunk-IWULHYPW.js.map +0 -1
- package/dist/chunk-KQHC77IF.js.map +0 -1
- package/dist/chunk-U52RN7MP.js.map +0 -1
- package/dist/chunk-ZT2REPH4.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
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";
|
|
13
|
+
import {
|
|
14
|
+
parseControlsFile
|
|
15
|
+
} from "./chunk-O65OD3NA.js";
|
|
16
|
+
import "./chunk-DI2ZFAWL.js";
|
|
7
17
|
|
|
8
18
|
// index.ts
|
|
9
19
|
import {
|
|
@@ -14,6 +24,26 @@ import {
|
|
|
14
24
|
watch as watchFileSystem
|
|
15
25
|
} from "fs";
|
|
16
26
|
import { createRequire } from "module";
|
|
27
|
+
|
|
28
|
+
// assets/controls-transform.ts
|
|
29
|
+
function transformControlsForHmr(source, filePath, previouslyDefinedControls = false) {
|
|
30
|
+
const calls = source.includes("defineControls") ? parseControlsFile(filePath, source) : [];
|
|
31
|
+
if (!calls.length && !previouslyDefinedControls) return source;
|
|
32
|
+
for (const { start, end } of calls.reverse()) {
|
|
33
|
+
source = source.slice(0, start) + `((dispose) => { if (import.meta.hot && typeof dispose === "function") import.meta.hot.data.__tempoControlsDisposers.push(dispose); })(${source.slice(start, end)})` + source.slice(end);
|
|
34
|
+
}
|
|
35
|
+
return `if (import.meta.hot) {
|
|
36
|
+
for (const dispose of import.meta.hot.data.__tempoControlsDisposers ?? []) dispose();
|
|
37
|
+
import.meta.hot.data.__tempoControlsDisposers = [];
|
|
38
|
+
import.meta.hot.dispose(() => {
|
|
39
|
+
for (const dispose of import.meta.hot.data.__tempoControlsDisposers ?? []) dispose();
|
|
40
|
+
import.meta.hot.data.__tempoControlsDisposers = [];
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
${source}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// index.ts
|
|
17
47
|
import { dirname, isAbsolute, join, relative as relative2, resolve as resolve2 } from "path";
|
|
18
48
|
import { fileURLToPath } from "url";
|
|
19
49
|
import { createFilter } from "@rollup/pluginutils";
|
|
@@ -294,7 +324,7 @@ import { resolve } from "path";
|
|
|
294
324
|
// package.json
|
|
295
325
|
var package_default = {
|
|
296
326
|
name: "tempo-sdk",
|
|
297
|
-
version: "0.0.
|
|
327
|
+
version: "0.0.51",
|
|
298
328
|
type: "module",
|
|
299
329
|
description: "Tempo SDK \u2014 Vite, Next.js, and Expo plugins for JSX annotation and shared page/storyboard types",
|
|
300
330
|
repository: {
|
|
@@ -375,7 +405,7 @@ var package_default = {
|
|
|
375
405
|
demo: "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
|
|
376
406
|
"demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
|
|
377
407
|
test: "vitest run",
|
|
378
|
-
"test:browser": "vitest run canvas-capture-determinism-browser.test.ts canvas-host-vite-e2e.test.ts canvas-host-packed-sdk-e2e.test.ts error-tracking-e2e.test.ts",
|
|
408
|
+
"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",
|
|
379
409
|
"test:watch": "vitest",
|
|
380
410
|
"test:nextjs:unit": "vitest run nextjs-loader.test.ts nextjs-wrapper.test.ts nextjs-fixtures.test.ts nextjs-published.test.ts",
|
|
381
411
|
"test:nextjs:integration": "vitest run nextjs-e2e-correctness.test.ts",
|
|
@@ -591,6 +621,72 @@ function createRapidHotUpdateReplay(options) {
|
|
|
591
621
|
};
|
|
592
622
|
}
|
|
593
623
|
|
|
624
|
+
// react-refresh-boundary.ts
|
|
625
|
+
var installed = /* @__PURE__ */ new WeakSet();
|
|
626
|
+
function installSynchronousReactRefreshBoundary(plugins) {
|
|
627
|
+
for (const plugin of plugins) {
|
|
628
|
+
if (plugin.name !== "vite:react-babel" || !plugin.transform || installed.has(plugin))
|
|
629
|
+
continue;
|
|
630
|
+
installed.add(plugin);
|
|
631
|
+
const hook = plugin.transform;
|
|
632
|
+
const transform = typeof hook === "function" ? hook : hook.handler;
|
|
633
|
+
const wrapped = async function(...args) {
|
|
634
|
+
const result = await transform.apply(this, args);
|
|
635
|
+
if (!result) return result;
|
|
636
|
+
const source = typeof result === "string" ? result : result.code;
|
|
637
|
+
if (!source) return result;
|
|
638
|
+
const code = source.replace(
|
|
639
|
+
/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*\}\);/,
|
|
640
|
+
(_match, register, accept) => `const __tempoReactRefreshExports = RefreshRuntime.__hmr_import(import.meta.url).then((currentExports) => {
|
|
641
|
+
${register}
|
|
642
|
+
return currentExports;
|
|
643
|
+
});
|
|
644
|
+
import.meta.hot.accept(async (nextExports) => {
|
|
645
|
+
const currentExports = await __tempoReactRefreshExports;${accept}
|
|
646
|
+
});`
|
|
647
|
+
);
|
|
648
|
+
return code === source ? result : typeof result === "string" ? code : { ...result, code };
|
|
649
|
+
};
|
|
650
|
+
plugin.transform = typeof hook === "function" ? wrapped : { ...hook, handler: wrapped };
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// vite-client-pending-updates.ts
|
|
655
|
+
function preservePendingViteModuleUpdates(source) {
|
|
656
|
+
const missingBoundary = /(const mod = this\.hotModulesMap\.get\(path\);\s*)if \(!mod\)\s*(?:return;|\{\s*return;\s*\})/;
|
|
657
|
+
const registeredBoundary = "this.hmrClient.hotModulesMap.set(this.ownerPath, mod);";
|
|
658
|
+
if (!missingBoundary.test(source) || !source.includes(registeredBoundary)) {
|
|
659
|
+
return source;
|
|
660
|
+
}
|
|
661
|
+
return source.replace(
|
|
662
|
+
missingBoundary,
|
|
663
|
+
`$1if (!mod || mod.pendingUpdates) {
|
|
664
|
+
const pending = mod || {
|
|
665
|
+
id: path,
|
|
666
|
+
callbacks: [],
|
|
667
|
+
pendingUpdates: new Map(),
|
|
668
|
+
};
|
|
669
|
+
pending.pendingUpdates.set(acceptedPath, update);
|
|
670
|
+
this.hotModulesMap.set(path, pending);
|
|
671
|
+
return;
|
|
672
|
+
}`
|
|
673
|
+
).replace(
|
|
674
|
+
registeredBoundary,
|
|
675
|
+
`${registeredBoundary}
|
|
676
|
+
if (mod.pendingUpdates) {
|
|
677
|
+
const pendingUpdates = [...mod.pendingUpdates.values()];
|
|
678
|
+
delete mod.pendingUpdates;
|
|
679
|
+
queueMicrotask(() => {
|
|
680
|
+
for (const update of pendingUpdates) {
|
|
681
|
+
void this.hmrClient.queueUpdate(update).catch((error) => {
|
|
682
|
+
this.hmrClient.logger.error(error);
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
}`
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
|
|
594
690
|
// tailwind-scan-net.ts
|
|
595
691
|
var SCANNABLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
596
692
|
"ts",
|
|
@@ -711,6 +807,7 @@ var ROOT_META_NAME = "tempo-project-root";
|
|
|
711
807
|
var SOURCE_IDENTITY_ROOT_META_NAME = "tempo-source-identity-root";
|
|
712
808
|
var INTERACT_PROJECTION_CLIENT_PATH = "/@tempo/interact-projection";
|
|
713
809
|
var INTERACT_PROJECTION_CLIENT_ID = "\0tempo:interact-projection";
|
|
810
|
+
var VITE_ERROR_CLIENT_ID = "\0tempo:server-errors";
|
|
714
811
|
var INTERACT_PROJECTION_SDK_SPECIFIER = "tempo-sdk/canvas/interact-projection";
|
|
715
812
|
function resolveOwnInteractProjectionModule() {
|
|
716
813
|
const selfDir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -827,7 +924,7 @@ function hasWorkspaceNonceMetaTag(html) {
|
|
|
827
924
|
function isSameError(left, right) {
|
|
828
925
|
return left.type === right.type && left.message === right.message && left.loc?.line === right.loc?.line && left.loc?.column === right.loc?.column;
|
|
829
926
|
}
|
|
830
|
-
function createErrorServer(onErrorFile) {
|
|
927
|
+
function createErrorServer(onErrorFile, onState) {
|
|
831
928
|
const errorsByFile = /* @__PURE__ */ new Map();
|
|
832
929
|
function getMostRecentError() {
|
|
833
930
|
if (errorsByFile.size === 0) return null;
|
|
@@ -836,6 +933,7 @@ function createErrorServer(onErrorFile) {
|
|
|
836
933
|
return latest;
|
|
837
934
|
}
|
|
838
935
|
function broadcastCurrentState() {
|
|
936
|
+
onState?.(server.currentError);
|
|
839
937
|
const data = JSON.stringify(server.currentError);
|
|
840
938
|
for (const client of server.clients) {
|
|
841
939
|
client.write(`data: ${data}
|
|
@@ -923,22 +1021,39 @@ async function synchronizeCanvasHostRegistrationTransform(server, canvasPath) {
|
|
|
923
1021
|
);
|
|
924
1022
|
}
|
|
925
1023
|
const canonicalWrapperPath = realpathSync2(wrapperPath);
|
|
1024
|
+
const modulePattern = /\bcanvasPath:\s*("(?:\\.|[^"\\])*")\s*,\s*load:\s*\(\)\s*=>\s*import\(\s*("(?:\\.|[^"\\])*")\s*\)/g;
|
|
1025
|
+
const transformer = server.environments?.client ?? server;
|
|
1026
|
+
for (const match of wrapperSource.matchAll(modulePattern)) {
|
|
1027
|
+
if (normalizeCanvasRegistrationPath(JSON.parse(match[1])) !== canvasPath)
|
|
1028
|
+
continue;
|
|
1029
|
+
const resolvedModule = await transformer.pluginContainer.resolveId(
|
|
1030
|
+
JSON.parse(match[2]),
|
|
1031
|
+
wrapperPath
|
|
1032
|
+
);
|
|
1033
|
+
if (!resolvedModule) throw new Error(`Cannot resolve canvas ${canvasPath}`);
|
|
1034
|
+
const modulePath = fsPathFromModuleId(resolvedModule.id);
|
|
1035
|
+
await retransformCanvasHostWrapper(
|
|
1036
|
+
transformer,
|
|
1037
|
+
realpathSync2(modulePath),
|
|
1038
|
+
modulePath,
|
|
1039
|
+
`/@fs/${modulePath.replace(/^\/+/, "")}`
|
|
1040
|
+
);
|
|
1041
|
+
break;
|
|
1042
|
+
}
|
|
926
1043
|
await retransformCanvasHostWrapper(
|
|
927
|
-
|
|
1044
|
+
transformer,
|
|
928
1045
|
canonicalWrapperPath,
|
|
929
1046
|
wrapperPath
|
|
930
1047
|
);
|
|
931
1048
|
}
|
|
932
|
-
async function retransformCanvasHostWrapper(transformer, canonicalWrapperPath, wrapperPath) {
|
|
1049
|
+
async function retransformCanvasHostWrapper(transformer, canonicalWrapperPath, wrapperPath, requestUrl = CANVAS_HOST_WRAPPER_URL) {
|
|
933
1050
|
const modules = transformer.moduleGraph.getModulesByFile(canonicalWrapperPath) ?? transformer.moduleGraph.getModulesByFile(wrapperPath);
|
|
934
1051
|
for (const module of modules ?? []) {
|
|
935
1052
|
transformer.moduleGraph.invalidateModule(module);
|
|
936
1053
|
}
|
|
937
|
-
const result = await transformer.transformRequest(
|
|
1054
|
+
const result = await transformer.transformRequest(requestUrl);
|
|
938
1055
|
if (!result) {
|
|
939
|
-
throw new Error(
|
|
940
|
-
`Vite did not transform ${CANVAS_HOST_WRAPPER_URL} after registration`
|
|
941
|
-
);
|
|
1056
|
+
throw new Error(`Vite did not transform ${requestUrl} after registration`);
|
|
942
1057
|
}
|
|
943
1058
|
}
|
|
944
1059
|
function writeCanvasRegistrationResponseHeaders(res) {
|
|
@@ -1122,11 +1237,23 @@ function tempoVitePlugin(options = {}) {
|
|
|
1122
1237
|
const include = options.include === void 0 ? DEFAULT_INCLUDE : options.include;
|
|
1123
1238
|
const exclude = options.exclude === void 0 ? DEFAULT_EXCLUDE : options.exclude;
|
|
1124
1239
|
const filter = createFilter(include, exclude);
|
|
1240
|
+
const controlsFilter = createFilter(
|
|
1241
|
+
["**/*.tsx", "**/*.jsx", "**/*.ts", "**/*.js"],
|
|
1242
|
+
exclude
|
|
1243
|
+
);
|
|
1244
|
+
const controlsModules = /* @__PURE__ */ new Set();
|
|
1245
|
+
function transformControls(source, id) {
|
|
1246
|
+
const code = transformControlsForHmr(source, id, controlsModules.has(id));
|
|
1247
|
+
if (code !== source) controlsModules.add(id);
|
|
1248
|
+
return code;
|
|
1249
|
+
}
|
|
1125
1250
|
let canonicalRoot = process.cwd();
|
|
1126
1251
|
let sourceIdentityRoot = canonicalRoot;
|
|
1127
1252
|
let command = "serve";
|
|
1253
|
+
let hmrEnabled = true;
|
|
1128
1254
|
const errorServer = createErrorServer(
|
|
1129
|
-
(file) => pinErroneousRevisionCoverage(file)
|
|
1255
|
+
(file) => pinErroneousRevisionCoverage(file),
|
|
1256
|
+
(error) => devServer?.ws.send(VITE_ERROR_STATE_EVENT, error)
|
|
1130
1257
|
);
|
|
1131
1258
|
const unresolvedImports = /* @__PURE__ */ new Map();
|
|
1132
1259
|
let devServer;
|
|
@@ -1466,6 +1593,9 @@ function tempoVitePlugin(options = {}) {
|
|
|
1466
1593
|
resolveId: {
|
|
1467
1594
|
order: "pre",
|
|
1468
1595
|
async handler(id, importer, resolveOptions) {
|
|
1596
|
+
if (enabled && id === VITE_ERROR_CLIENT_PATH) {
|
|
1597
|
+
return VITE_ERROR_CLIENT_ID;
|
|
1598
|
+
}
|
|
1469
1599
|
if (id === INTERACT_PROJECTION_CLIENT_PATH) {
|
|
1470
1600
|
return INTERACT_PROJECTION_CLIENT_ID;
|
|
1471
1601
|
}
|
|
@@ -1504,6 +1634,9 @@ function tempoVitePlugin(options = {}) {
|
|
|
1504
1634
|
load: {
|
|
1505
1635
|
order: "pre",
|
|
1506
1636
|
async handler(id) {
|
|
1637
|
+
if (enabled && id === VITE_ERROR_CLIENT_ID) {
|
|
1638
|
+
return VITE_ERROR_CLIENT_SOURCE;
|
|
1639
|
+
}
|
|
1507
1640
|
if (id === INTERACT_PROJECTION_CLIENT_ID) {
|
|
1508
1641
|
return `import { installTempoInteractProjectionSource } from ${JSON.stringify(INTERACT_PROJECTION_SDK_SPECIFIER)};
|
|
1509
1642
|
let stop;
|
|
@@ -1575,6 +1708,10 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1575
1708
|
configResolved(resolvedConfig) {
|
|
1576
1709
|
if (!enabled) return;
|
|
1577
1710
|
command = resolvedConfig.command;
|
|
1711
|
+
hmrEnabled = resolvedConfig.server?.hmr !== false;
|
|
1712
|
+
if (command === "serve" && hmrEnabled) {
|
|
1713
|
+
installSynchronousReactRefreshBoundary(resolvedConfig.plugins ?? []);
|
|
1714
|
+
}
|
|
1578
1715
|
canonicalRoot = resolveCanonicalRoot(resolvedConfig.root);
|
|
1579
1716
|
sourceIdentityRoot = options.sourceIdentityRoot ? resolveCanonicalRoot(
|
|
1580
1717
|
resolve2(resolvedConfig.root, options.sourceIdentityRoot)
|
|
@@ -1584,15 +1721,32 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1584
1721
|
if (!enabled) return;
|
|
1585
1722
|
const ownInteractModule = resolveOwnInteractProjectionModule();
|
|
1586
1723
|
const allow = server.config?.server?.fs?.allow;
|
|
1587
|
-
if (
|
|
1588
|
-
const
|
|
1589
|
-
|
|
1724
|
+
if (Array.isArray(allow)) {
|
|
1725
|
+
const requiredRoots = [
|
|
1726
|
+
sourceIdentityRoot,
|
|
1727
|
+
...ownInteractModule ? [dirname(ownInteractModule)] : []
|
|
1728
|
+
];
|
|
1729
|
+
for (const requiredRoot of requiredRoots) {
|
|
1730
|
+
if (!allow.includes(requiredRoot)) allow.push(requiredRoot);
|
|
1731
|
+
}
|
|
1590
1732
|
}
|
|
1591
1733
|
devServer = server;
|
|
1734
|
+
server.ws.on?.(VITE_ERROR_SUBSCRIBE_EVENT, (_data, client) => {
|
|
1735
|
+
client.send(VITE_ERROR_STATE_EVENT, errorServer.currentError);
|
|
1736
|
+
});
|
|
1592
1737
|
syncUnresolvedImportWatcher();
|
|
1593
1738
|
server.watcher?.once?.("close", closeUnresolvedImportWatchers);
|
|
1594
1739
|
server.httpServer?.once("close", closeUnresolvedImportWatchers);
|
|
1595
1740
|
server.middlewares.use((req, res, next) => {
|
|
1741
|
+
const name = req.url?.match(
|
|
1742
|
+
/^\/tempo-assets\/([a-zA-Z0-9._-]+)(?:\?.*)?$/
|
|
1743
|
+
)?.[1];
|
|
1744
|
+
if (name) {
|
|
1745
|
+
const file = ["public", "static"].map(
|
|
1746
|
+
(directory) => join(sourceIdentityRoot, directory, "tempo-assets", name)
|
|
1747
|
+
).find((file2) => existsSync(file2));
|
|
1748
|
+
if (file) req.url = `/@fs/${file.replace(/\\/g, "/")}`;
|
|
1749
|
+
}
|
|
1596
1750
|
handleTempoMiddleware(errorServer, server, req, res, next);
|
|
1597
1751
|
});
|
|
1598
1752
|
installMissedChangeSweep(
|
|
@@ -1657,6 +1811,11 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1657
1811
|
order: "post",
|
|
1658
1812
|
async handler(context) {
|
|
1659
1813
|
if (!enabled || this.environment.config.consumer !== "client") return;
|
|
1814
|
+
if (context.type === "create" && /\/\.tempo\/asset-edit-previews\/\d+\/index\.canvas\.tsx$/.test(
|
|
1815
|
+
context.file.replace(/\\/g, "/")
|
|
1816
|
+
)) {
|
|
1817
|
+
return [];
|
|
1818
|
+
}
|
|
1660
1819
|
recordHotUpdateCoverage(context.file);
|
|
1661
1820
|
if (context.type === "update" && context.modules.length > 0) {
|
|
1662
1821
|
rapidHotUpdateReplay.observe(burstKey(context.file), () => {
|
|
@@ -1713,6 +1872,13 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1713
1872
|
return;
|
|
1714
1873
|
}
|
|
1715
1874
|
const tags = [];
|
|
1875
|
+
if (hmrEnabled) {
|
|
1876
|
+
tags.push({
|
|
1877
|
+
tag: "script",
|
|
1878
|
+
attrs: { type: "module", src: VITE_ERROR_CLIENT_PATH },
|
|
1879
|
+
injectTo: "head-prepend"
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1716
1882
|
if (!hasRootMetaTag(html)) {
|
|
1717
1883
|
tags.push({
|
|
1718
1884
|
tag: "meta",
|
|
@@ -1771,7 +1937,14 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1771
1937
|
return null;
|
|
1772
1938
|
}
|
|
1773
1939
|
const cleanId = cleanModuleId(id);
|
|
1940
|
+
if (cleanId.replace(/\\/g, "/").endsWith("/vite/dist/client/client.mjs")) {
|
|
1941
|
+
const code = preservePendingViteModuleUpdates(source);
|
|
1942
|
+
return code === source ? null : { code, map: null };
|
|
1943
|
+
}
|
|
1944
|
+
const controlsSource = controlsFilter(cleanId) ? transformControls(source, cleanId) : source;
|
|
1774
1945
|
if (!filter(cleanId)) {
|
|
1946
|
+
if (controlsSource !== source)
|
|
1947
|
+
return { code: controlsSource, map: null };
|
|
1775
1948
|
return null;
|
|
1776
1949
|
}
|
|
1777
1950
|
try {
|
|
@@ -1779,10 +1952,13 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1779
1952
|
const modifiedtsMs = Math.trunc(statSync2(cleanId).mtimeMs);
|
|
1780
1953
|
const rawSource = readFileSync2(cleanId, "utf8");
|
|
1781
1954
|
const sourceVersion = sourceVersionHash(rawSource);
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1955
|
+
const identityKey = canonicalIdentityKey(cleanId);
|
|
1956
|
+
if (!defaultExportIdentityByFile.has(identityKey)) {
|
|
1957
|
+
defaultExportIdentityByFile.set(
|
|
1958
|
+
identityKey,
|
|
1959
|
+
readDefaultExportIdentity(rawSource)
|
|
1960
|
+
);
|
|
1961
|
+
}
|
|
1786
1962
|
const result = annotateFile(
|
|
1787
1963
|
source,
|
|
1788
1964
|
cleanId,
|
|
@@ -1795,10 +1971,10 @@ if (import.meta.hot) import.meta.hot.dispose(() => {
|
|
|
1795
1971
|
})
|
|
1796
1972
|
);
|
|
1797
1973
|
if (result.elementsAnnotated === 0) {
|
|
1798
|
-
return null;
|
|
1974
|
+
return controlsSource === source ? null : { code: controlsSource, map: null };
|
|
1799
1975
|
}
|
|
1800
1976
|
return {
|
|
1801
|
-
code: result.annotatedSource,
|
|
1977
|
+
code: controlsFilter(cleanId) ? transformControls(result.annotatedSource, cleanId) : result.annotatedSource,
|
|
1802
1978
|
map: null
|
|
1803
1979
|
};
|
|
1804
1980
|
} catch {
|