@tempo-ai/mcp 0.0.120 → 0.0.121-staging.1
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/bin.js +1 -1
- package/dist/{call-IIIBQ5BB.js → call-M3ZZQAYP.js} +2 -2
- package/dist/{chunk-NA7LS57T.js → chunk-D4LH5L7S.js} +4 -4
- package/dist/index.js +1 -1
- package/dist/{serve-5O3DTGPO.js → serve-D3Q5GOTK.js} +719 -648
- package/dist/serve-D3Q5GOTK.js.map +1 -0
- package/package.json +1 -1
- package/dist/serve-5O3DTGPO.js.map +0 -1
- /package/dist/{call-IIIBQ5BB.js.map → call-M3ZZQAYP.js.map} +0 -0
- /package/dist/{chunk-NA7LS57T.js.map → chunk-D4LH5L7S.js.map} +0 -0
|
@@ -1350,8 +1350,8 @@ var require_utils = __commonJS({
|
|
|
1350
1350
|
}
|
|
1351
1351
|
return output;
|
|
1352
1352
|
};
|
|
1353
|
-
exports.basename = (
|
|
1354
|
-
const segs =
|
|
1353
|
+
exports.basename = (path64, { windows } = {}) => {
|
|
1354
|
+
const segs = path64.split(windows ? /[\\/]/ : "/");
|
|
1355
1355
|
const last2 = segs[segs.length - 1];
|
|
1356
1356
|
if (last2 === "") {
|
|
1357
1357
|
return segs[segs.length - 2];
|
|
@@ -3653,10 +3653,10 @@ var require_src2 = __commonJS({
|
|
|
3653
3653
|
var fs_1 = __require("fs");
|
|
3654
3654
|
var debug_1 = __importDefault(require_src());
|
|
3655
3655
|
var log = debug_1.default("@kwsites/file-exists");
|
|
3656
|
-
function check(
|
|
3657
|
-
log(`checking %s`,
|
|
3656
|
+
function check(path64, isFile, isDirectory) {
|
|
3657
|
+
log(`checking %s`, path64);
|
|
3658
3658
|
try {
|
|
3659
|
-
const stat11 = fs_1.statSync(
|
|
3659
|
+
const stat11 = fs_1.statSync(path64);
|
|
3660
3660
|
if (stat11.isFile() && isFile) {
|
|
3661
3661
|
log(`[OK] path represents a file`);
|
|
3662
3662
|
return true;
|
|
@@ -3676,8 +3676,8 @@ var require_src2 = __commonJS({
|
|
|
3676
3676
|
throw e;
|
|
3677
3677
|
}
|
|
3678
3678
|
}
|
|
3679
|
-
function exists4(
|
|
3680
|
-
return check(
|
|
3679
|
+
function exists4(path64, type = exports.READABLE) {
|
|
3680
|
+
return check(path64, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
|
3681
3681
|
}
|
|
3682
3682
|
exports.exists = exists4;
|
|
3683
3683
|
exports.FILE = 1;
|
|
@@ -6856,8 +6856,8 @@ var STAGE_RANK_END = Number.MAX_SAFE_INTEGER;
|
|
|
6856
6856
|
// ../issues-core/share-url.ts
|
|
6857
6857
|
function buildIssueShareUrl(baseUrl, orgSlugOrId, humanId, titleSlug) {
|
|
6858
6858
|
const base = `/${encodeURIComponent(orgSlugOrId)}/issues/${encodeURIComponent(humanId)}`;
|
|
6859
|
-
const
|
|
6860
|
-
const u = new URL(
|
|
6859
|
+
const path64 = titleSlug ? `${base}/${encodeURIComponent(titleSlug)}` : base;
|
|
6860
|
+
const u = new URL(path64, baseUrl);
|
|
6861
6861
|
return u.toString();
|
|
6862
6862
|
}
|
|
6863
6863
|
|
|
@@ -8345,19 +8345,19 @@ function normalizeRepoUrl(url) {
|
|
|
8345
8345
|
const sshMatch = cleaned.match(sshShorthand);
|
|
8346
8346
|
if (sshMatch) {
|
|
8347
8347
|
const host = sshMatch[1];
|
|
8348
|
-
const
|
|
8349
|
-
return finalize(host,
|
|
8348
|
+
const path64 = sshMatch[2];
|
|
8349
|
+
return finalize(host, path64);
|
|
8350
8350
|
}
|
|
8351
8351
|
const protocolMatch = cleaned.match(/^[\w+.-]+:\/\/(?:[^@]+@)?([\w.-]+)\/([\w./-]+)$/);
|
|
8352
8352
|
if (protocolMatch) {
|
|
8353
8353
|
const host = protocolMatch[1];
|
|
8354
|
-
const
|
|
8355
|
-
return finalize(host,
|
|
8354
|
+
const path64 = protocolMatch[2];
|
|
8355
|
+
return finalize(host, path64);
|
|
8356
8356
|
}
|
|
8357
8357
|
return null;
|
|
8358
8358
|
}
|
|
8359
|
-
function finalize(host,
|
|
8360
|
-
let cleaned =
|
|
8359
|
+
function finalize(host, path64) {
|
|
8360
|
+
let cleaned = path64.replace(/\.git$/, "");
|
|
8361
8361
|
cleaned = cleaned.replace(/^\/+|\/+$/g, "");
|
|
8362
8362
|
if (!cleaned) return null;
|
|
8363
8363
|
return `${host}/${cleaned}`.toLowerCase();
|
|
@@ -9958,8 +9958,8 @@ var api2 = anyApi2;
|
|
|
9958
9958
|
// ../doc-editor/src/client/docShareUrl.ts
|
|
9959
9959
|
function buildDocShareUrl(baseUrl, orgSlugOrId, docId, titleSlug) {
|
|
9960
9960
|
const base = `/${encodeURIComponent(orgSlugOrId)}/docs/${encodeURIComponent(docId)}`;
|
|
9961
|
-
const
|
|
9962
|
-
return new URL(
|
|
9961
|
+
const path64 = titleSlug ? `${base}/${encodeURIComponent(titleSlug)}` : base;
|
|
9962
|
+
return new URL(path64, baseUrl).toString();
|
|
9963
9963
|
}
|
|
9964
9964
|
|
|
9965
9965
|
// ../doc-editor/mcp/tools/read.ts
|
|
@@ -19329,7 +19329,7 @@ ${assetLibrarySection}## Hard invariants
|
|
|
19329
19329
|
}
|
|
19330
19330
|
|
|
19331
19331
|
// ../canvas-mcp/tools.ts
|
|
19332
|
-
import
|
|
19332
|
+
import path60 from "path";
|
|
19333
19333
|
|
|
19334
19334
|
// ../asset-libraries/mcp/tools.ts
|
|
19335
19335
|
import { readFile as readFile4, writeFile } from "fs/promises";
|
|
@@ -21442,7 +21442,7 @@ function parseCanvasFile(filePath, source) {
|
|
|
21442
21442
|
"name",
|
|
21443
21443
|
objectStringBindings
|
|
21444
21444
|
);
|
|
21445
|
-
const
|
|
21445
|
+
const path64 = readStringAttribute(openingElement, "path");
|
|
21446
21446
|
const backgroundColor = readResolvableStringAttribute(
|
|
21447
21447
|
openingElement,
|
|
21448
21448
|
"backgroundColor",
|
|
@@ -21461,7 +21461,7 @@ function parseCanvasFile(filePath, source) {
|
|
|
21461
21461
|
}
|
|
21462
21462
|
return {
|
|
21463
21463
|
filePath,
|
|
21464
|
-
canvasPath:
|
|
21464
|
+
canvasPath: path64?.value,
|
|
21465
21465
|
pageName: name?.value ?? fallbackPageName(filePath),
|
|
21466
21466
|
backgroundColor: backgroundColor?.value,
|
|
21467
21467
|
canvasElementSpan: toSpan(canvasElement),
|
|
@@ -21469,8 +21469,8 @@ function parseCanvasFile(filePath, source) {
|
|
|
21469
21469
|
canvasChildrenInsertionOffset: typeof canvasElement?.closingElement?.start === "number" ? canvasElement.closingElement.start : void 0,
|
|
21470
21470
|
nameSpan: name?.valueSpan,
|
|
21471
21471
|
nameAttributeSpan: name?.attributeSpan,
|
|
21472
|
-
pathSpan:
|
|
21473
|
-
pathAttributeSpan:
|
|
21472
|
+
pathSpan: path64?.valueSpan,
|
|
21473
|
+
pathAttributeSpan: path64?.attributeSpan,
|
|
21474
21474
|
backgroundColorSpan: backgroundColor?.valueSpan,
|
|
21475
21475
|
backgroundColorAttributeSpan: backgroundColor?.attributeSpan,
|
|
21476
21476
|
imports: imports.all,
|
|
@@ -23533,7 +23533,7 @@ function registerMembershipTool(server, context, tool) {
|
|
|
23533
23533
|
}
|
|
23534
23534
|
|
|
23535
23535
|
// ../canvas-tools/commands/compute-layout.ts
|
|
23536
|
-
import
|
|
23536
|
+
import path45 from "path";
|
|
23537
23537
|
|
|
23538
23538
|
// ../canvas-pages/positioning.ts
|
|
23539
23539
|
var DEFAULT_STORYBOARD_WIDTH = 600;
|
|
@@ -24367,7 +24367,7 @@ function createQueuedFileEditor() {
|
|
|
24367
24367
|
};
|
|
24368
24368
|
return runAtIndex(0);
|
|
24369
24369
|
}
|
|
24370
|
-
async function
|
|
24370
|
+
async function readFile29(absolutePath) {
|
|
24371
24371
|
return withFileLock(absolutePath, () => readFileUnlocked(absolutePath));
|
|
24372
24372
|
}
|
|
24373
24373
|
async function readBinaryFile(absolutePath) {
|
|
@@ -24453,7 +24453,7 @@ function createQueuedFileEditor() {
|
|
|
24453
24453
|
});
|
|
24454
24454
|
}
|
|
24455
24455
|
return {
|
|
24456
|
-
readFile:
|
|
24456
|
+
readFile: readFile29,
|
|
24457
24457
|
readBinaryFile,
|
|
24458
24458
|
readFileIfExists,
|
|
24459
24459
|
writeFile: writeFile12,
|
|
@@ -24465,7 +24465,7 @@ function createQueuedFileEditor() {
|
|
|
24465
24465
|
unlinkFile,
|
|
24466
24466
|
withFileLock,
|
|
24467
24467
|
withFileLocks,
|
|
24468
|
-
readWorkspaceFile: (workspacePath, relativePath) =>
|
|
24468
|
+
readWorkspaceFile: (workspacePath, relativePath) => readFile29(resolveWorkspaceRelativePath(workspacePath, relativePath)),
|
|
24469
24469
|
readWorkspaceFileIfExists: (workspacePath, relativePath) => readFileIfExists(resolveWorkspaceRelativePath(workspacePath, relativePath)),
|
|
24470
24470
|
writeWorkspaceFile: (workspacePath, relativePath, content, expectedMtime, nextMtime) => writeFile12(
|
|
24471
24471
|
resolveWorkspaceRelativePath(workspacePath, relativePath),
|
|
@@ -25764,17 +25764,17 @@ async function ensureCanvasPageFileMigrated(pageFilePath) {
|
|
|
25764
25764
|
|
|
25765
25765
|
// ../canvas-pages/delete-storyboard.ts
|
|
25766
25766
|
import fs5 from "fs/promises";
|
|
25767
|
-
import
|
|
25767
|
+
import path34 from "path";
|
|
25768
25768
|
import ts2 from "typescript";
|
|
25769
25769
|
|
|
25770
25770
|
// ../canvas-pages/discovery.ts
|
|
25771
25771
|
import { readdir as readdir9, stat as stat7 } from "fs/promises";
|
|
25772
|
-
import
|
|
25772
|
+
import path33 from "path";
|
|
25773
25773
|
|
|
25774
25774
|
// ../tempo-project/config.ts
|
|
25775
25775
|
import { readFileSync as readFileSync2 } from "fs";
|
|
25776
|
-
import
|
|
25777
|
-
import { access as access5, mkdir as mkdir7, readFile as
|
|
25776
|
+
import path24 from "path";
|
|
25777
|
+
import { access as access5, mkdir as mkdir7, readFile as readFile17, rm as rm6, writeFile as writeFile8 } from "fs/promises";
|
|
25778
25778
|
|
|
25779
25779
|
// ../tempo-devserver/abortable-shell-command.ts
|
|
25780
25780
|
import { spawn } from "child_process";
|
|
@@ -26524,8 +26524,8 @@ function extractImporterFromLine(line) {
|
|
|
26524
26524
|
}
|
|
26525
26525
|
return null;
|
|
26526
26526
|
}
|
|
26527
|
-
function normalizeImporterPath(
|
|
26528
|
-
return
|
|
26527
|
+
function normalizeImporterPath(path64) {
|
|
26528
|
+
return path64.replace(/^\.\//, "");
|
|
26529
26529
|
}
|
|
26530
26530
|
|
|
26531
26531
|
// ../tempo-devserver/port-listener.ts
|
|
@@ -28575,6 +28575,66 @@ function missingInstallEnvironment(error) {
|
|
|
28575
28575
|
) || /cannot connect to the docker daemon/i.test(message) || /is the docker daemon running\?/i.test(message);
|
|
28576
28576
|
}
|
|
28577
28577
|
|
|
28578
|
+
// ../tempo-devserver/install-registry-env.ts
|
|
28579
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
28580
|
+
import path15 from "path";
|
|
28581
|
+
import { parseEnv } from "util";
|
|
28582
|
+
async function readOptional(file) {
|
|
28583
|
+
try {
|
|
28584
|
+
return await readFile8(file, "utf-8");
|
|
28585
|
+
} catch (error) {
|
|
28586
|
+
const code = error.code;
|
|
28587
|
+
if (code === "ENOENT" || code === "ENOTDIR") return "";
|
|
28588
|
+
throw error;
|
|
28589
|
+
}
|
|
28590
|
+
}
|
|
28591
|
+
async function readInstallRegistryEnv(cwd, projectRoot, inheritedEnv) {
|
|
28592
|
+
const root = path15.resolve(projectRoot);
|
|
28593
|
+
const commandDir = path15.resolve(cwd);
|
|
28594
|
+
const relative3 = path15.relative(root, commandDir);
|
|
28595
|
+
if (relative3 === ".." || relative3.startsWith(`..${path15.sep}`) || path15.isAbsolute(relative3)) {
|
|
28596
|
+
return {};
|
|
28597
|
+
}
|
|
28598
|
+
const dirs = [root];
|
|
28599
|
+
if (relative3) {
|
|
28600
|
+
for (const segment of relative3.split(path15.sep)) {
|
|
28601
|
+
dirs.push(path15.join(dirs[dirs.length - 1], segment));
|
|
28602
|
+
}
|
|
28603
|
+
}
|
|
28604
|
+
const configs = await Promise.all(
|
|
28605
|
+
dirs.map((dir) => readOptional(path15.join(dir, ".npmrc")))
|
|
28606
|
+
);
|
|
28607
|
+
const keys = /* @__PURE__ */ new Set();
|
|
28608
|
+
for (const config of configs) {
|
|
28609
|
+
for (const line of config.split(/\r?\n/)) {
|
|
28610
|
+
if (/^\s*[#;]/.test(line)) continue;
|
|
28611
|
+
for (const match of line.matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g)) {
|
|
28612
|
+
keys.add(match[1]);
|
|
28613
|
+
}
|
|
28614
|
+
}
|
|
28615
|
+
}
|
|
28616
|
+
if (keys.size === 0) return {};
|
|
28617
|
+
let fileEnv = {};
|
|
28618
|
+
if ([...keys].some((key) => inheritedEnv[key] === void 0)) {
|
|
28619
|
+
const files = await Promise.all(
|
|
28620
|
+
dirs.flatMap(
|
|
28621
|
+
(dir) => [".env", ".env.local"].map(
|
|
28622
|
+
(name) => readOptional(path15.join(dir, name))
|
|
28623
|
+
)
|
|
28624
|
+
)
|
|
28625
|
+
);
|
|
28626
|
+
for (const contents of files) {
|
|
28627
|
+
fileEnv = { ...fileEnv, ...parseEnv(contents) };
|
|
28628
|
+
}
|
|
28629
|
+
}
|
|
28630
|
+
return Object.fromEntries(
|
|
28631
|
+
[...keys].flatMap((key) => {
|
|
28632
|
+
const value = inheritedEnv[key] ?? fileEnv[key];
|
|
28633
|
+
return value === void 0 ? [] : [[key, value]];
|
|
28634
|
+
})
|
|
28635
|
+
);
|
|
28636
|
+
}
|
|
28637
|
+
|
|
28578
28638
|
// ../tempo-devserver/tempo-devserver.ts
|
|
28579
28639
|
import { spawn as spawn4 } from "child_process";
|
|
28580
28640
|
import { createHash as createHash3, randomUUID as randomUUID3 } from "crypto";
|
|
@@ -28584,7 +28644,7 @@ import {
|
|
|
28584
28644
|
mkdir as mkdir6,
|
|
28585
28645
|
mkdtemp,
|
|
28586
28646
|
readdir as readdir6,
|
|
28587
|
-
readFile as
|
|
28647
|
+
readFile as readFile15,
|
|
28588
28648
|
rm as rm5,
|
|
28589
28649
|
stat as stat4,
|
|
28590
28650
|
writeFile as writeFile7
|
|
@@ -28592,7 +28652,7 @@ import {
|
|
|
28592
28652
|
import { request as httpRequest } from "http";
|
|
28593
28653
|
import { createServer, connect as netConnect } from "net";
|
|
28594
28654
|
import os2 from "os";
|
|
28595
|
-
import
|
|
28655
|
+
import path21 from "path";
|
|
28596
28656
|
|
|
28597
28657
|
// ../../modules/file-watcher/provider.ts
|
|
28598
28658
|
var PROVIDER_SLOT = /* @__PURE__ */ Symbol.for("@modules/file-watcher:watch-provider");
|
|
@@ -28646,7 +28706,7 @@ function createEventKeepFilter(rootRealPath, relativePathFilters) {
|
|
|
28646
28706
|
}
|
|
28647
28707
|
|
|
28648
28708
|
// ../../modules/file-watcher/polling-backend.ts
|
|
28649
|
-
import { lstat, readdir as readdir3, readFile as
|
|
28709
|
+
import { lstat, readdir as readdir3, readFile as readFile9, writeFile as writeFile5 } from "fs/promises";
|
|
28650
28710
|
import { isAbsolute, join as join2, resolve } from "path";
|
|
28651
28711
|
var STAT_CONCURRENCY = 32;
|
|
28652
28712
|
var MAX_DEPTH = 64;
|
|
@@ -28687,10 +28747,10 @@ async function scanTree(realRoot, ignorePaths = []) {
|
|
|
28687
28747
|
for (let i = 0; i < pendingStats.length; i += STAT_CONCURRENCY) {
|
|
28688
28748
|
const slice = pendingStats.slice(i, i + STAT_CONCURRENCY);
|
|
28689
28749
|
await Promise.all(
|
|
28690
|
-
slice.map(async (
|
|
28750
|
+
slice.map(async (path64) => {
|
|
28691
28751
|
try {
|
|
28692
|
-
const st = await lstat(
|
|
28693
|
-
scan.set(
|
|
28752
|
+
const st = await lstat(path64);
|
|
28753
|
+
scan.set(path64, {
|
|
28694
28754
|
mtimeMs: st.mtimeMs,
|
|
28695
28755
|
size: st.size,
|
|
28696
28756
|
isDir: false
|
|
@@ -28704,16 +28764,16 @@ async function scanTree(realRoot, ignorePaths = []) {
|
|
|
28704
28764
|
}
|
|
28705
28765
|
function diffScans(previous, next) {
|
|
28706
28766
|
const events = [];
|
|
28707
|
-
for (const [
|
|
28708
|
-
const before = previous.get(
|
|
28767
|
+
for (const [path64, now] of next) {
|
|
28768
|
+
const before = previous.get(path64);
|
|
28709
28769
|
if (!before) {
|
|
28710
|
-
events.push({ path:
|
|
28770
|
+
events.push({ path: path64, type: "create" });
|
|
28711
28771
|
} else if (!now.isDir && (before.mtimeMs !== now.mtimeMs || before.size !== now.size)) {
|
|
28712
|
-
events.push({ path:
|
|
28772
|
+
events.push({ path: path64, type: "update" });
|
|
28713
28773
|
}
|
|
28714
28774
|
}
|
|
28715
|
-
for (const
|
|
28716
|
-
if (!next.has(
|
|
28775
|
+
for (const path64 of previous.keys()) {
|
|
28776
|
+
if (!next.has(path64)) events.push({ path: path64, type: "delete" });
|
|
28717
28777
|
}
|
|
28718
28778
|
return events;
|
|
28719
28779
|
}
|
|
@@ -28727,7 +28787,7 @@ async function writeScanSnapshot(snapshotPath, scan) {
|
|
|
28727
28787
|
async function readScanSnapshot(snapshotPath) {
|
|
28728
28788
|
try {
|
|
28729
28789
|
const parsed = JSON.parse(
|
|
28730
|
-
await
|
|
28790
|
+
await readFile9(snapshotPath, "utf8")
|
|
28731
28791
|
);
|
|
28732
28792
|
if (parsed?.version !== 1 || !Array.isArray(parsed.entries)) return null;
|
|
28733
28793
|
const scan = /* @__PURE__ */ new Map();
|
|
@@ -29896,8 +29956,8 @@ if (selfHot) {
|
|
|
29896
29956
|
`;
|
|
29897
29957
|
|
|
29898
29958
|
// ../tempo-devserver/canvas-registry.ts
|
|
29899
|
-
import { mkdir as mkdir4, readdir as readdir4, readFile as
|
|
29900
|
-
import
|
|
29959
|
+
import { mkdir as mkdir4, readdir as readdir4, readFile as readFile10, rm as rm3 } from "fs/promises";
|
|
29960
|
+
import path16 from "path";
|
|
29901
29961
|
|
|
29902
29962
|
// ../tempo-devserver/errors.ts
|
|
29903
29963
|
var TempoDevServerError = class extends Error {
|
|
@@ -30147,13 +30207,13 @@ function toPosixPath2(value) {
|
|
|
30147
30207
|
return value.replace(/\\/g, "/");
|
|
30148
30208
|
}
|
|
30149
30209
|
function toRelativeImportSpecifier(fromDir, absolutePath) {
|
|
30150
|
-
const relativePath = toPosixPath2(
|
|
30210
|
+
const relativePath = toPosixPath2(path16.relative(fromDir, absolutePath));
|
|
30151
30211
|
const extensionlessPath = relativePath.replace(/\.(tsx|ts|jsx|js)$/, "");
|
|
30152
30212
|
return extensionlessPath.startsWith(".") ? extensionlessPath : `./${extensionlessPath}`;
|
|
30153
30213
|
}
|
|
30154
30214
|
async function readTextFileOptional(filePath) {
|
|
30155
30215
|
try {
|
|
30156
|
-
return await
|
|
30216
|
+
return await readFile10(filePath, "utf-8");
|
|
30157
30217
|
} catch (error) {
|
|
30158
30218
|
if (error.code === "ENOENT") {
|
|
30159
30219
|
return null;
|
|
@@ -30188,7 +30248,7 @@ async function walkPagesDir(directory, collector) {
|
|
|
30188
30248
|
throw error;
|
|
30189
30249
|
}
|
|
30190
30250
|
for (const entry of entries) {
|
|
30191
|
-
const fullPath =
|
|
30251
|
+
const fullPath = path16.join(directory, entry.name);
|
|
30192
30252
|
if (entry.isDirectory()) {
|
|
30193
30253
|
await walkPagesDir(fullPath, collector);
|
|
30194
30254
|
} else if (entry.isFile() && entry.name === CANVAS_FILE_NAME) {
|
|
@@ -30203,7 +30263,7 @@ var CanvasRegistry = class {
|
|
|
30203
30263
|
this.requestedCanvasesQueue = Promise.resolve();
|
|
30204
30264
|
this.projectRoot = projectRoot;
|
|
30205
30265
|
this.tempoRoot = tempoRoot;
|
|
30206
|
-
this.requestedCanvasesPath =
|
|
30266
|
+
this.requestedCanvasesPath = path16.join(
|
|
30207
30267
|
tempoRoot,
|
|
30208
30268
|
".tempo",
|
|
30209
30269
|
REQUESTED_CANVASES_FILE_NAME
|
|
@@ -30227,9 +30287,9 @@ var CanvasRegistry = class {
|
|
|
30227
30287
|
}
|
|
30228
30288
|
buildEntry(absolutePath) {
|
|
30229
30289
|
return {
|
|
30230
|
-
importPath: toPosixPath2(
|
|
30290
|
+
importPath: toPosixPath2(path16.relative(this.projectRoot, absolutePath)),
|
|
30231
30291
|
importSpecifier: toRelativeImportSpecifier(
|
|
30232
|
-
|
|
30292
|
+
path16.join(this.tempoRoot, ".tempo"),
|
|
30233
30293
|
absolutePath
|
|
30234
30294
|
)
|
|
30235
30295
|
};
|
|
@@ -30266,17 +30326,17 @@ var CanvasRegistry = class {
|
|
|
30266
30326
|
if (typeof relativePath !== "string" || relativePath.length === 0) {
|
|
30267
30327
|
return null;
|
|
30268
30328
|
}
|
|
30269
|
-
const absolutePath =
|
|
30329
|
+
const absolutePath = path16.resolve(this.projectRoot, relativePath);
|
|
30270
30330
|
const normalizedRelative = toPosixPath2(
|
|
30271
|
-
|
|
30331
|
+
path16.relative(this.projectRoot, absolutePath)
|
|
30272
30332
|
);
|
|
30273
|
-
if (normalizedRelative === ".." || normalizedRelative.startsWith("../") ||
|
|
30333
|
+
if (normalizedRelative === ".." || normalizedRelative.startsWith("../") || path16.isAbsolute(normalizedRelative)) {
|
|
30274
30334
|
return null;
|
|
30275
30335
|
}
|
|
30276
30336
|
return absolutePath;
|
|
30277
30337
|
}
|
|
30278
30338
|
toRequestedPath(absolutePath) {
|
|
30279
|
-
return toPosixPath2(
|
|
30339
|
+
return toPosixPath2(path16.relative(this.projectRoot, absolutePath));
|
|
30280
30340
|
}
|
|
30281
30341
|
async readRequestedCanvasPaths() {
|
|
30282
30342
|
const source = await readTextFileOptional(this.requestedCanvasesPath);
|
|
@@ -30313,7 +30373,7 @@ var CanvasRegistry = class {
|
|
|
30313
30373
|
return mergedPaths;
|
|
30314
30374
|
}
|
|
30315
30375
|
async writeRequestedCanvasPaths(requestedPaths) {
|
|
30316
|
-
await mkdir4(
|
|
30376
|
+
await mkdir4(path16.dirname(this.requestedCanvasesPath), { recursive: true });
|
|
30317
30377
|
await atomicWriteText2(
|
|
30318
30378
|
this.requestedCanvasesPath,
|
|
30319
30379
|
JSON.stringify({ version: 1, canvases: requestedPaths }, null, 2)
|
|
@@ -30344,7 +30404,7 @@ var CanvasRegistry = class {
|
|
|
30344
30404
|
async canvasFileExistsWithRecheck(absolutePath) {
|
|
30345
30405
|
for (let attempt = 0; ; attempt += 1) {
|
|
30346
30406
|
try {
|
|
30347
|
-
await
|
|
30407
|
+
await readFile10(absolutePath, "utf-8");
|
|
30348
30408
|
return true;
|
|
30349
30409
|
} catch (error) {
|
|
30350
30410
|
if (error.code !== "ENOENT") {
|
|
@@ -30370,10 +30430,10 @@ var CanvasRegistry = class {
|
|
|
30370
30430
|
);
|
|
30371
30431
|
}
|
|
30372
30432
|
async ensureReactCanvasHostEntry(canvasFile) {
|
|
30373
|
-
const absolutePath =
|
|
30433
|
+
const absolutePath = path16.resolve(canvasFile);
|
|
30374
30434
|
let source;
|
|
30375
30435
|
try {
|
|
30376
|
-
source = await
|
|
30436
|
+
source = await readFile10(absolutePath, "utf-8");
|
|
30377
30437
|
} catch (error) {
|
|
30378
30438
|
if (error.code === "ENOENT") {
|
|
30379
30439
|
return null;
|
|
@@ -30447,8 +30507,8 @@ var ProcessHintSlots = class {
|
|
|
30447
30507
|
};
|
|
30448
30508
|
|
|
30449
30509
|
// ../tempo-devserver/package-manager.ts
|
|
30450
|
-
import { access, readFile as
|
|
30451
|
-
import
|
|
30510
|
+
import { access, readFile as readFile11 } from "fs/promises";
|
|
30511
|
+
import path17 from "path";
|
|
30452
30512
|
var LOCKFILE_PRIORITY = [
|
|
30453
30513
|
// Order matters: a project with both bun.lock and package-lock.json is
|
|
30454
30514
|
// a bun project (the package-lock.json is stale). We bias to whichever
|
|
@@ -30489,15 +30549,15 @@ function parsePackageManagerField(value) {
|
|
|
30489
30549
|
}
|
|
30490
30550
|
async function readPackageManagerFromPackageJson(packageJsonPath) {
|
|
30491
30551
|
try {
|
|
30492
|
-
const parsed = JSON.parse(await
|
|
30552
|
+
const parsed = JSON.parse(await readFile11(packageJsonPath, "utf-8"));
|
|
30493
30553
|
return parsePackageManagerField(parsed.packageManager);
|
|
30494
30554
|
} catch {
|
|
30495
30555
|
return null;
|
|
30496
30556
|
}
|
|
30497
30557
|
}
|
|
30498
30558
|
async function detectRootPackageManager(projectRoot) {
|
|
30499
|
-
const resolvedRoot =
|
|
30500
|
-
const packageJsonPath =
|
|
30559
|
+
const resolvedRoot = path17.resolve(projectRoot);
|
|
30560
|
+
const packageJsonPath = path17.join(resolvedRoot, "package.json");
|
|
30501
30561
|
if (!await fileExists(packageJsonPath)) {
|
|
30502
30562
|
return null;
|
|
30503
30563
|
}
|
|
@@ -30506,7 +30566,7 @@ async function detectRootPackageManager(projectRoot) {
|
|
|
30506
30566
|
return { ...pin, installCmd: INSTALL_COMMAND_BY_PM[pin.pm] };
|
|
30507
30567
|
}
|
|
30508
30568
|
for (const candidate of LOCKFILE_PRIORITY) {
|
|
30509
|
-
if (await fileExists(
|
|
30569
|
+
if (await fileExists(path17.join(resolvedRoot, candidate.file))) {
|
|
30510
30570
|
return { pm: candidate.pm, installCmd: candidate.installCmd };
|
|
30511
30571
|
}
|
|
30512
30572
|
}
|
|
@@ -30522,32 +30582,32 @@ var OWNERSHIP_MARKER_PRIORITY = [
|
|
|
30522
30582
|
];
|
|
30523
30583
|
async function detectPackageManagerMarkerInDir(dir) {
|
|
30524
30584
|
const fromPackageJson = await readPackageManagerFromPackageJson(
|
|
30525
|
-
|
|
30585
|
+
path17.join(dir, "package.json")
|
|
30526
30586
|
);
|
|
30527
30587
|
if (fromPackageJson) return fromPackageJson;
|
|
30528
30588
|
for (const candidate of OWNERSHIP_MARKER_PRIORITY) {
|
|
30529
|
-
if (await fileExists(
|
|
30589
|
+
if (await fileExists(path17.join(dir, candidate.file))) {
|
|
30530
30590
|
return { pm: candidate.pm };
|
|
30531
30591
|
}
|
|
30532
30592
|
}
|
|
30533
30593
|
return null;
|
|
30534
30594
|
}
|
|
30535
30595
|
async function detectOwningPackageManager(packageRoot) {
|
|
30536
|
-
const resolvedRoot =
|
|
30537
|
-
if (!await fileExists(
|
|
30596
|
+
const resolvedRoot = path17.resolve(packageRoot);
|
|
30597
|
+
if (!await fileExists(path17.join(resolvedRoot, "package.json"))) {
|
|
30538
30598
|
return null;
|
|
30539
30599
|
}
|
|
30540
|
-
for (let dir = resolvedRoot; ; dir =
|
|
30600
|
+
for (let dir = resolvedRoot; ; dir = path17.dirname(dir)) {
|
|
30541
30601
|
const pin = await detectPackageManagerMarkerInDir(dir);
|
|
30542
30602
|
if (pin) return { ...pin, installCmd: INSTALL_COMMAND_BY_PM[pin.pm] };
|
|
30543
|
-
if (
|
|
30603
|
+
if (path17.dirname(dir) === dir) break;
|
|
30544
30604
|
}
|
|
30545
30605
|
return { pm: "npm", installCmd: "npm install" };
|
|
30546
30606
|
}
|
|
30547
30607
|
|
|
30548
30608
|
// ../tempo-devserver/project-node-version.ts
|
|
30549
|
-
import { access as access2, readFile as
|
|
30550
|
-
import
|
|
30609
|
+
import { access as access2, readFile as readFile12, readdir as readdir5 } from "fs/promises";
|
|
30610
|
+
import path18 from "path";
|
|
30551
30611
|
function parseTriple(value) {
|
|
30552
30612
|
const match = value.trim().replace(/^v/i, "").match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/);
|
|
30553
30613
|
if (!match?.[1]) return null;
|
|
@@ -30678,15 +30738,15 @@ async function pathExists(candidate) {
|
|
|
30678
30738
|
async function readProjectNodeRequirement(startDir) {
|
|
30679
30739
|
const engines = [];
|
|
30680
30740
|
let versionFileSpec = null;
|
|
30681
|
-
for (let dir =
|
|
30682
|
-
const packageJson = await
|
|
30741
|
+
for (let dir = path18.resolve(startDir); ; dir = path18.dirname(dir)) {
|
|
30742
|
+
const packageJson = await readFile12(path18.join(dir, "package.json"), "utf-8").then((raw) => JSON.parse(raw)).catch(() => null);
|
|
30683
30743
|
const range = packageJson?.engines?.node;
|
|
30684
30744
|
if (typeof range === "string" && range.trim() && range.trim() !== "*") {
|
|
30685
30745
|
engines.push({ range: range.trim(), dir });
|
|
30686
30746
|
}
|
|
30687
30747
|
if (versionFileSpec === null) {
|
|
30688
30748
|
for (const file of [".nvmrc", ".node-version"]) {
|
|
30689
|
-
const raw = await
|
|
30749
|
+
const raw = await readFile12(path18.join(dir, file), "utf-8").catch(
|
|
30690
30750
|
() => null
|
|
30691
30751
|
);
|
|
30692
30752
|
const trimmed2 = raw?.trim();
|
|
@@ -30696,10 +30756,10 @@ async function readProjectNodeRequirement(startDir) {
|
|
|
30696
30756
|
}
|
|
30697
30757
|
}
|
|
30698
30758
|
}
|
|
30699
|
-
const atBoundary = await pathExists(
|
|
30700
|
-
BOUNDARY_LOCKFILES.map((file) => pathExists(
|
|
30759
|
+
const atBoundary = await pathExists(path18.join(dir, ".git")) || (await Promise.all(
|
|
30760
|
+
BOUNDARY_LOCKFILES.map((file) => pathExists(path18.join(dir, file)))
|
|
30701
30761
|
)).some(Boolean);
|
|
30702
|
-
if (atBoundary ||
|
|
30762
|
+
if (atBoundary || path18.dirname(dir) === dir) break;
|
|
30703
30763
|
}
|
|
30704
30764
|
return { engines, versionFileSpec };
|
|
30705
30765
|
}
|
|
@@ -30711,8 +30771,8 @@ async function discoverVersionManagerNodes(options) {
|
|
|
30711
30771
|
for (const entry of entries) {
|
|
30712
30772
|
const parsed = parseTriple(entry);
|
|
30713
30773
|
if (!parsed || parsed.precision !== 3) continue;
|
|
30714
|
-
const binDir = layout === "bin-subdir" ?
|
|
30715
|
-
const nodeBinary =
|
|
30774
|
+
const binDir = layout === "bin-subdir" ? path18.join(versionsDir, entry, "bin") : path18.join(versionsDir, entry);
|
|
30775
|
+
const nodeBinary = path18.join(
|
|
30716
30776
|
binDir,
|
|
30717
30777
|
platform === "win32" ? "node.exe" : "node"
|
|
30718
30778
|
);
|
|
@@ -30725,10 +30785,10 @@ async function discoverVersionManagerNodes(options) {
|
|
|
30725
30785
|
}
|
|
30726
30786
|
};
|
|
30727
30787
|
if (platform !== "win32") {
|
|
30728
|
-
const nvmDir = env.NVM_DIR?.trim() ||
|
|
30729
|
-
await collect(
|
|
30730
|
-
const nodenvRoot = env.NODENV_ROOT?.trim() ||
|
|
30731
|
-
await collect(
|
|
30788
|
+
const nvmDir = env.NVM_DIR?.trim() || path18.join(homeDir, ".nvm");
|
|
30789
|
+
await collect(path18.join(nvmDir, "versions", "node"), "nvm", "bin-subdir");
|
|
30790
|
+
const nodenvRoot = env.NODENV_ROOT?.trim() || path18.join(homeDir, ".nodenv");
|
|
30791
|
+
await collect(path18.join(nodenvRoot, "versions"), "nodenv", "bin-subdir");
|
|
30732
30792
|
}
|
|
30733
30793
|
if (env.NVM_HOME?.trim()) {
|
|
30734
30794
|
await collect(env.NVM_HOME.trim(), "nvm-windows", "flat");
|
|
@@ -30777,8 +30837,8 @@ function buildUnsatisfiedNodeHint(args) {
|
|
|
30777
30837
|
}
|
|
30778
30838
|
|
|
30779
30839
|
// ../tempo-devserver/sdk-upgrade-plan.ts
|
|
30780
|
-
import { access as access3, readFile as
|
|
30781
|
-
import
|
|
30840
|
+
import { access as access3, readFile as readFile13 } from "fs/promises";
|
|
30841
|
+
import path19 from "path";
|
|
30782
30842
|
var INSTALL_MARKERS = [
|
|
30783
30843
|
// Order matters, same rationale as pm-detect: a tree carrying both bun.lock
|
|
30784
30844
|
// and package-lock.json is a bun tree with a stale npm lockfile.
|
|
@@ -30840,9 +30900,9 @@ function buildCommands(pm, yarnBerry, metadataCacheDir, ignorePnpmWorkspace) {
|
|
|
30840
30900
|
}
|
|
30841
30901
|
}
|
|
30842
30902
|
async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
30843
|
-
const resolvedRoot =
|
|
30844
|
-
const declared = await
|
|
30845
|
-
|
|
30903
|
+
const resolvedRoot = path19.resolve(tempoRoot);
|
|
30904
|
+
const declared = await readFile13(
|
|
30905
|
+
path19.join(resolvedRoot, "package.json"),
|
|
30846
30906
|
"utf-8"
|
|
30847
30907
|
).then((raw) => {
|
|
30848
30908
|
const parsed = JSON.parse(raw);
|
|
@@ -30851,7 +30911,7 @@ async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
|
30851
30911
|
const owner = await findInstallOwner(resolvedRoot);
|
|
30852
30912
|
const resolvedPm = declared ?? owner?.pm ?? "npm";
|
|
30853
30913
|
const governedByAncestorWorkspace = owner !== null && owner.dir !== resolvedRoot;
|
|
30854
|
-
const hasOwnPnpmWorkspace = resolvedPm === "pnpm" && await fileExists2(
|
|
30914
|
+
const hasOwnPnpmWorkspace = resolvedPm === "pnpm" && await fileExists2(path19.join(resolvedRoot, "pnpm-workspace.yaml"));
|
|
30855
30915
|
return {
|
|
30856
30916
|
packageManager: resolvedPm,
|
|
30857
30917
|
cwd: resolvedRoot,
|
|
@@ -30865,21 +30925,21 @@ async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
|
30865
30925
|
};
|
|
30866
30926
|
}
|
|
30867
30927
|
async function findInstallOwner(startDir) {
|
|
30868
|
-
for (let dir = startDir; ; dir =
|
|
30928
|
+
for (let dir = startDir; ; dir = path19.dirname(dir)) {
|
|
30869
30929
|
for (const candidate of INSTALL_MARKERS) {
|
|
30870
|
-
const markerPath =
|
|
30930
|
+
const markerPath = path19.join(dir, candidate.file);
|
|
30871
30931
|
if (!await fileExists2(markerPath)) continue;
|
|
30872
30932
|
return {
|
|
30873
30933
|
dir,
|
|
30874
30934
|
pm: candidate.pm,
|
|
30875
30935
|
...candidate.pm === "yarn" ? {
|
|
30876
|
-
yarnLockContents: await
|
|
30936
|
+
yarnLockContents: await readFile13(markerPath, "utf-8").catch(
|
|
30877
30937
|
() => ""
|
|
30878
30938
|
)
|
|
30879
30939
|
} : {}
|
|
30880
30940
|
};
|
|
30881
30941
|
}
|
|
30882
|
-
if (
|
|
30942
|
+
if (path19.dirname(dir) === dir) return null;
|
|
30883
30943
|
}
|
|
30884
30944
|
}
|
|
30885
30945
|
|
|
@@ -30887,13 +30947,13 @@ async function findInstallOwner(startDir) {
|
|
|
30887
30947
|
import {
|
|
30888
30948
|
lstat as lstat3,
|
|
30889
30949
|
mkdir as mkdir5,
|
|
30890
|
-
readFile as
|
|
30950
|
+
readFile as readFile14,
|
|
30891
30951
|
realpath as realpath2,
|
|
30892
30952
|
rm as rm4,
|
|
30893
30953
|
symlink,
|
|
30894
30954
|
writeFile as writeFile6
|
|
30895
30955
|
} from "fs/promises";
|
|
30896
|
-
import
|
|
30956
|
+
import path20 from "path";
|
|
30897
30957
|
var TEMPO_SDK_SOURCE_ENV = "TEMPO_MONOREPO_SDK_SOURCE";
|
|
30898
30958
|
var LOCAL_SDK_MARKER_FILE = "local-tempo-sdk.json";
|
|
30899
30959
|
async function realpathIfPresent(filePath) {
|
|
@@ -30909,7 +30969,7 @@ async function realpathIfPresent(filePath) {
|
|
|
30909
30969
|
async function isTempoSdkRoot(candidate) {
|
|
30910
30970
|
try {
|
|
30911
30971
|
const manifest = JSON.parse(
|
|
30912
|
-
await
|
|
30972
|
+
await readFile14(path20.join(candidate, "package.json"), "utf8")
|
|
30913
30973
|
);
|
|
30914
30974
|
return manifest.name === "tempo-sdk";
|
|
30915
30975
|
} catch {
|
|
@@ -30917,10 +30977,10 @@ async function isTempoSdkRoot(candidate) {
|
|
|
30917
30977
|
}
|
|
30918
30978
|
}
|
|
30919
30979
|
async function discoverLocalSdkRoot(start) {
|
|
30920
|
-
for (let current =
|
|
30921
|
-
const candidate =
|
|
30980
|
+
for (let current = path20.resolve(start); ; current = path20.dirname(current)) {
|
|
30981
|
+
const candidate = path20.join(current, "tempo-modules", "tempo-sdk");
|
|
30922
30982
|
if (await isTempoSdkRoot(candidate)) return candidate;
|
|
30923
|
-
if (
|
|
30983
|
+
if (path20.dirname(current) === current) return null;
|
|
30924
30984
|
}
|
|
30925
30985
|
}
|
|
30926
30986
|
async function assertLocalSdkPrebuilt(localSdkRoot) {
|
|
@@ -30928,7 +30988,7 @@ async function assertLocalSdkPrebuilt(localSdkRoot) {
|
|
|
30928
30988
|
const missingOutputs = (await Promise.all(
|
|
30929
30989
|
requiredOutputs.map(async (relativePath) => ({
|
|
30930
30990
|
relativePath,
|
|
30931
|
-
present: await realpathIfPresent(
|
|
30991
|
+
present: await realpathIfPresent(path20.join(localSdkRoot, relativePath)) !== null
|
|
30932
30992
|
}))
|
|
30933
30993
|
)).filter(({ present }) => !present).map(({ relativePath }) => relativePath);
|
|
30934
30994
|
if (missingOutputs.length === 0) return;
|
|
@@ -30944,8 +31004,8 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
30944
31004
|
);
|
|
30945
31005
|
}
|
|
30946
31006
|
const mode = options.mode ?? (configuredMode === "local-prebuilt" ? configuredMode : "published");
|
|
30947
|
-
const installedSdkRoot =
|
|
30948
|
-
const markerPath =
|
|
31007
|
+
const installedSdkRoot = path20.join(tempoRoot, "node_modules", "tempo-sdk");
|
|
31008
|
+
const markerPath = path20.join(tempoRoot, ".tempo", LOCAL_SDK_MARKER_FILE);
|
|
30949
31009
|
if (mode === "local-prebuilt") {
|
|
30950
31010
|
const localSdkRoot = options.localSdkRoot ?? await discoverLocalSdkRoot(options.discoveryStart ?? process.cwd());
|
|
30951
31011
|
if (!localSdkRoot || !await isTempoSdkRoot(localSdkRoot)) {
|
|
@@ -30960,14 +31020,14 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
30960
31020
|
]);
|
|
30961
31021
|
if (resolvedInstalledSdk !== resolvedLocalSdk) {
|
|
30962
31022
|
await rm4(installedSdkRoot, { force: true, recursive: true });
|
|
30963
|
-
await mkdir5(
|
|
31023
|
+
await mkdir5(path20.dirname(installedSdkRoot), { recursive: true });
|
|
30964
31024
|
await symlink(
|
|
30965
31025
|
resolvedLocalSdk,
|
|
30966
31026
|
installedSdkRoot,
|
|
30967
31027
|
process.platform === "win32" ? "junction" : "dir"
|
|
30968
31028
|
);
|
|
30969
31029
|
}
|
|
30970
|
-
await mkdir5(
|
|
31030
|
+
await mkdir5(path20.dirname(markerPath), { recursive: true });
|
|
30971
31031
|
await writeFile6(
|
|
30972
31032
|
markerPath,
|
|
30973
31033
|
`${JSON.stringify({ localSdkRoot: resolvedLocalSdk }, null, 2)}
|
|
@@ -30975,7 +31035,7 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
30975
31035
|
);
|
|
30976
31036
|
return { source: "local", localSdkRoot: resolvedLocalSdk };
|
|
30977
31037
|
}
|
|
30978
|
-
const marker = await
|
|
31038
|
+
const marker = await readFile14(markerPath, "utf8").then((raw) => JSON.parse(raw)).catch(() => null);
|
|
30979
31039
|
if (!marker) return { source: "published", removedLocalLink: false };
|
|
30980
31040
|
let removedLocalLink = false;
|
|
30981
31041
|
if (typeof marker.localSdkRoot === "string") {
|
|
@@ -31065,9 +31125,9 @@ var MANAGED_WATCH_OPTIONS = {
|
|
|
31065
31125
|
}
|
|
31066
31126
|
};
|
|
31067
31127
|
function resolveRuntimePaths(tempoConfigPath) {
|
|
31068
|
-
const resolvedConfigPath =
|
|
31069
|
-
const tempoRoot =
|
|
31070
|
-
const projectRoot =
|
|
31128
|
+
const resolvedConfigPath = path21.resolve(tempoConfigPath);
|
|
31129
|
+
const tempoRoot = path21.dirname(resolvedConfigPath);
|
|
31130
|
+
const projectRoot = path21.basename(tempoRoot) === TEMPO_DIR_NAME ? path21.dirname(tempoRoot) : tempoRoot;
|
|
31071
31131
|
let canvasesPath = DEFAULT_CANVASES_DIR2;
|
|
31072
31132
|
try {
|
|
31073
31133
|
const raw = JSON.parse(fs3.readFileSync(resolvedConfigPath, "utf-8"));
|
|
@@ -31079,20 +31139,20 @@ function resolveRuntimePaths(tempoConfigPath) {
|
|
|
31079
31139
|
return {
|
|
31080
31140
|
projectRoot,
|
|
31081
31141
|
tempoRoot,
|
|
31082
|
-
pagesDir:
|
|
31142
|
+
pagesDir: path21.resolve(tempoRoot, canvasesPath)
|
|
31083
31143
|
};
|
|
31084
31144
|
}
|
|
31085
31145
|
function isManagedDevServerPath(eventRelativePath, roots) {
|
|
31086
31146
|
const relativePath = toPosixPath2(eventRelativePath);
|
|
31087
|
-
const tempoDir =
|
|
31147
|
+
const tempoDir = path21.join(roots.tempoRoot, ".tempo");
|
|
31088
31148
|
const managedRelativePaths = [
|
|
31089
31149
|
roots.tempoConfigPath,
|
|
31090
31150
|
roots.pagesDir,
|
|
31091
31151
|
...MANAGED_TEMPO_DIR_FILE_NAMES.map(
|
|
31092
|
-
(fileName) =>
|
|
31152
|
+
(fileName) => path21.join(tempoDir, fileName)
|
|
31093
31153
|
)
|
|
31094
31154
|
].map(
|
|
31095
|
-
(managedPath) => toPosixPath2(
|
|
31155
|
+
(managedPath) => toPosixPath2(path21.relative(roots.projectRoot, managedPath))
|
|
31096
31156
|
).filter((value) => value.length > 0 && !value.startsWith("../"));
|
|
31097
31157
|
return managedRelativePaths.some(
|
|
31098
31158
|
(managedPath) => relativePath === managedPath || relativePath.startsWith(`${managedPath}/`) || managedPath.startsWith(`${relativePath}/`)
|
|
@@ -31844,7 +31904,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
31844
31904
|
this.tempoRoot = paths.tempoRoot;
|
|
31845
31905
|
this.pagesDir = paths.pagesDir;
|
|
31846
31906
|
this.commandCwd = paths.tempoRoot;
|
|
31847
|
-
this.processMarkerPath =
|
|
31907
|
+
this.processMarkerPath = path21.join(
|
|
31848
31908
|
paths.tempoRoot,
|
|
31849
31909
|
".tempo",
|
|
31850
31910
|
TEMPO_PROCESS_MARKER_FILE
|
|
@@ -31975,14 +32035,14 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
31975
32035
|
void this.persistRecentExits();
|
|
31976
32036
|
}
|
|
31977
32037
|
recentExitsFilePath() {
|
|
31978
|
-
return
|
|
32038
|
+
return path21.join(this.tempoRoot, ".tempo", TEMPO_RECENT_EXITS_FILE);
|
|
31979
32039
|
}
|
|
31980
32040
|
// Fire-and-forget mirror of the exit log to disk. Best-effort: a failed write
|
|
31981
32041
|
// just means a fresh supervisor won't see this crash, which is no worse than
|
|
31982
32042
|
// before persistence existed.
|
|
31983
32043
|
async persistRecentExits() {
|
|
31984
32044
|
try {
|
|
31985
|
-
await mkdir6(
|
|
32045
|
+
await mkdir6(path21.dirname(this.recentExitsFilePath()), {
|
|
31986
32046
|
recursive: true
|
|
31987
32047
|
});
|
|
31988
32048
|
await atomicWriteText2(
|
|
@@ -32248,7 +32308,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32248
32308
|
sdkInstallReceipts.set(
|
|
32249
32309
|
root,
|
|
32250
32310
|
await pathExists2(
|
|
32251
|
-
|
|
32311
|
+
path21.join(
|
|
32252
32312
|
root,
|
|
32253
32313
|
"node_modules",
|
|
32254
32314
|
EXTERNAL_LAYOUT_INSTALL_MARKER
|
|
@@ -32262,7 +32322,8 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32262
32322
|
command,
|
|
32263
32323
|
cwd,
|
|
32264
32324
|
signal,
|
|
32265
|
-
options?.onInstallOutput
|
|
32325
|
+
options?.onInstallOutput,
|
|
32326
|
+
this.projectRoot
|
|
32266
32327
|
);
|
|
32267
32328
|
sdkCommandCompleted = true;
|
|
32268
32329
|
}
|
|
@@ -32488,7 +32549,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32488
32549
|
try {
|
|
32489
32550
|
for (const step of steps) {
|
|
32490
32551
|
throwIfLaunchAborted(signal);
|
|
32491
|
-
await runInstallStep(step, signal, onOutput);
|
|
32552
|
+
await runInstallStep(step, signal, onOutput, this.projectRoot);
|
|
32492
32553
|
}
|
|
32493
32554
|
} catch (error) {
|
|
32494
32555
|
throwIfLaunchAborted(signal);
|
|
@@ -32501,7 +32562,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32501
32562
|
);
|
|
32502
32563
|
for (const step of localSteps) {
|
|
32503
32564
|
throwIfLaunchAborted(signal);
|
|
32504
|
-
await runInstallStep(step, signal, onOutput);
|
|
32565
|
+
await runInstallStep(step, signal, onOutput, this.projectRoot);
|
|
32505
32566
|
}
|
|
32506
32567
|
}
|
|
32507
32568
|
};
|
|
@@ -32606,7 +32667,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32606
32667
|
return filterProtectedInstallSteps(steps);
|
|
32607
32668
|
}
|
|
32608
32669
|
async selectNodeRuntimeForStart() {
|
|
32609
|
-
const packageJson = await readJsonFile(
|
|
32670
|
+
const packageJson = await readJsonFile(path21.join(this.tempoRoot, "package.json"));
|
|
32610
32671
|
const viteSpec = packageJson?.dependencies?.vite ?? packageJson?.devDependencies?.vite;
|
|
32611
32672
|
const viteMajor = typeof viteSpec === "string" ? parseFirstSemverMajor(viteSpec) : null;
|
|
32612
32673
|
const requireFloor = viteMajor != null && viteMajor >= 7;
|
|
@@ -32677,7 +32738,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32677
32738
|
async readExpectedHostIdentity() {
|
|
32678
32739
|
const framework = await this.resolveStartFramework();
|
|
32679
32740
|
if (framework === "expo") return null;
|
|
32680
|
-
const noncePath =
|
|
32741
|
+
const noncePath = path21.join(this.tempoRoot, ".tempo", "workspace-nonce");
|
|
32681
32742
|
const workspaceNonce = (await readTextFileOptional(noncePath))?.trim();
|
|
32682
32743
|
if (!workspaceNonce) {
|
|
32683
32744
|
devLog("supervisor:workspace_nonce_unavailable", {
|
|
@@ -32695,7 +32756,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32695
32756
|
if (isExpoStartCommand(this.config.scripts.start)) {
|
|
32696
32757
|
return true;
|
|
32697
32758
|
}
|
|
32698
|
-
const packageJson = await readJsonFile(
|
|
32759
|
+
const packageJson = await readJsonFile(path21.join(this.tempoRoot, "package.json"));
|
|
32699
32760
|
return Boolean(
|
|
32700
32761
|
packageJson?.dependencies?.expo ?? packageJson?.devDependencies?.expo
|
|
32701
32762
|
);
|
|
@@ -32727,10 +32788,10 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32727
32788
|
* of trusted and later crashing Vite at startup.
|
|
32728
32789
|
*/
|
|
32729
32790
|
async tempoInstallReady() {
|
|
32730
|
-
const packageJsonPath =
|
|
32791
|
+
const packageJsonPath = path21.join(this.tempoRoot, "package.json");
|
|
32731
32792
|
let raw;
|
|
32732
32793
|
try {
|
|
32733
|
-
raw = await
|
|
32794
|
+
raw = await readFile15(packageJsonPath, "utf-8");
|
|
32734
32795
|
} catch {
|
|
32735
32796
|
return true;
|
|
32736
32797
|
}
|
|
@@ -32755,7 +32816,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32755
32816
|
return await installCompletedForCurrentDeps(this.tempoRoot);
|
|
32756
32817
|
}
|
|
32757
32818
|
for (const name of declared) {
|
|
32758
|
-
const depPath =
|
|
32819
|
+
const depPath = path21.join(this.tempoRoot, "node_modules", name);
|
|
32759
32820
|
try {
|
|
32760
32821
|
await access4(depPath);
|
|
32761
32822
|
} catch {
|
|
@@ -32768,7 +32829,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32768
32829
|
return await installCompletedForCurrentDeps(this.projectRoot) && await this.projectRootDepsPresentOrNotRequired();
|
|
32769
32830
|
}
|
|
32770
32831
|
async projectRootDepsPresentOrNotRequired(acceptExternalLayoutProof = true) {
|
|
32771
|
-
const rootPackageJson =
|
|
32832
|
+
const rootPackageJson = path21.join(this.projectRoot, "package.json");
|
|
32772
32833
|
const packageJson = await readJsonFile(rootPackageJson);
|
|
32773
32834
|
if (!packageJson) {
|
|
32774
32835
|
return true;
|
|
@@ -32783,7 +32844,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32783
32844
|
}
|
|
32784
32845
|
for (const name of declared) {
|
|
32785
32846
|
try {
|
|
32786
|
-
await access4(
|
|
32847
|
+
await access4(path21.join(this.projectRoot, "node_modules", name));
|
|
32787
32848
|
} catch {
|
|
32788
32849
|
return false;
|
|
32789
32850
|
}
|
|
@@ -32809,25 +32870,25 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32809
32870
|
}
|
|
32810
32871
|
}
|
|
32811
32872
|
nextDistClaimsDir() {
|
|
32812
|
-
return
|
|
32873
|
+
return path21.join(this.tempoRoot, ".tempo", TEMPO_NEXT_CLAIMS_DIR);
|
|
32813
32874
|
}
|
|
32814
32875
|
nextDistCachePath(distDir) {
|
|
32815
|
-
return
|
|
32876
|
+
return path21.resolve(this.commandCwd, distDir);
|
|
32816
32877
|
}
|
|
32817
32878
|
nextDistClaimPath(distDir) {
|
|
32818
|
-
return
|
|
32879
|
+
return path21.join(
|
|
32819
32880
|
this.nextDistClaimsDir(),
|
|
32820
|
-
`${
|
|
32881
|
+
`${path21.basename(distDir)}.json`
|
|
32821
32882
|
);
|
|
32822
32883
|
}
|
|
32823
32884
|
async tryClaimNextDistDir(distDir) {
|
|
32824
32885
|
const cachePath = this.nextDistCachePath(distDir);
|
|
32825
32886
|
const claimPath = this.nextDistClaimPath(distDir);
|
|
32826
32887
|
await mkdir6(cachePath, { recursive: true });
|
|
32827
|
-
await writeFile7(
|
|
32888
|
+
await writeFile7(path21.join(cachePath, TEMPO_NEXT_CACHE_MARKER), "1\n", {
|
|
32828
32889
|
flag: "a"
|
|
32829
32890
|
});
|
|
32830
|
-
await mkdir6(
|
|
32891
|
+
await mkdir6(path21.dirname(claimPath), { recursive: true });
|
|
32831
32892
|
const token = randomUUID3();
|
|
32832
32893
|
const processStartedAt = await readProcessStartedAt(process.pid);
|
|
32833
32894
|
const claimText = `${JSON.stringify({
|
|
@@ -32862,7 +32923,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32862
32923
|
}
|
|
32863
32924
|
async selectSuffixedNextDistDir() {
|
|
32864
32925
|
await this.releaseNextDistDirClaim();
|
|
32865
|
-
const nextRoot =
|
|
32926
|
+
const nextRoot = path21.join(this.commandCwd, ".next");
|
|
32866
32927
|
const existing = await readdir6(nextRoot, { withFileTypes: true }).catch(
|
|
32867
32928
|
() => []
|
|
32868
32929
|
);
|
|
@@ -32871,9 +32932,9 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32871
32932
|
if (!entry.isDirectory() || !/^tempo-[a-z0-9]+$/i.test(entry.name)) {
|
|
32872
32933
|
continue;
|
|
32873
32934
|
}
|
|
32874
|
-
const cachePath =
|
|
32935
|
+
const cachePath = path21.join(nextRoot, entry.name);
|
|
32875
32936
|
try {
|
|
32876
|
-
await access4(
|
|
32937
|
+
await access4(path21.join(cachePath, TEMPO_NEXT_CACHE_MARKER));
|
|
32877
32938
|
const cacheStat = await stat4(cachePath);
|
|
32878
32939
|
reusable.push({
|
|
32879
32940
|
distDir: `.next/${entry.name}`,
|
|
@@ -32909,7 +32970,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32909
32970
|
await this.sweepNextDistDirs();
|
|
32910
32971
|
}
|
|
32911
32972
|
async sweepNextDistDirs() {
|
|
32912
|
-
const nextRoot =
|
|
32973
|
+
const nextRoot = path21.join(this.commandCwd, ".next");
|
|
32913
32974
|
const entries = await readdir6(nextRoot, { withFileTypes: true }).catch(
|
|
32914
32975
|
() => []
|
|
32915
32976
|
);
|
|
@@ -32917,7 +32978,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32917
32978
|
const unclaimedManaged = [];
|
|
32918
32979
|
for (const entry of entries) {
|
|
32919
32980
|
if (!entry.isDirectory()) continue;
|
|
32920
|
-
const cachePath =
|
|
32981
|
+
const cachePath = path21.join(nextRoot, entry.name);
|
|
32921
32982
|
if (/^tempo-sidestep-/i.test(entry.name)) {
|
|
32922
32983
|
const cacheStat2 = await stat4(cachePath).catch(() => null);
|
|
32923
32984
|
if (cacheStat2 && now - cacheStat2.mtimeMs > TEMPO_NEXT_LEGACY_CACHE_MAX_AGE_MS) {
|
|
@@ -32928,7 +32989,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32928
32989
|
}
|
|
32929
32990
|
if (!/^tempo-[a-z0-9]+$/i.test(entry.name)) continue;
|
|
32930
32991
|
try {
|
|
32931
|
-
await access4(
|
|
32992
|
+
await access4(path21.join(cachePath, TEMPO_NEXT_CACHE_MARKER));
|
|
32932
32993
|
} catch {
|
|
32933
32994
|
const cacheStat2 = await stat4(cachePath).catch(() => null);
|
|
32934
32995
|
if (cacheStat2 && now - cacheStat2.mtimeMs > TEMPO_NEXT_LEGACY_CACHE_MAX_AGE_MS) {
|
|
@@ -32958,13 +33019,13 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32958
33019
|
async ensureDevserverWatchdogScript() {
|
|
32959
33020
|
const enabled = process.env.TEMPO_DEVSERVER_WATCHDOG !== "0";
|
|
32960
33021
|
if (!enabled) return null;
|
|
32961
|
-
const watchdogPath =
|
|
33022
|
+
const watchdogPath = path21.join(
|
|
32962
33023
|
this.tempoRoot,
|
|
32963
33024
|
".tempo",
|
|
32964
33025
|
DEVSERVER_WATCHDOG_FILE_NAME
|
|
32965
33026
|
);
|
|
32966
33027
|
try {
|
|
32967
|
-
await mkdir6(
|
|
33028
|
+
await mkdir6(path21.dirname(watchdogPath), { recursive: true });
|
|
32968
33029
|
await atomicWriteText2(watchdogPath, DEVSERVER_WATCHDOG_SOURCE);
|
|
32969
33030
|
return watchdogPath;
|
|
32970
33031
|
} catch {
|
|
@@ -32984,12 +33045,12 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32984
33045
|
];
|
|
32985
33046
|
for (const configFile of nextConfigPaths) {
|
|
32986
33047
|
try {
|
|
32987
|
-
await access4(
|
|
33048
|
+
await access4(path21.join(this.tempoRoot, configFile));
|
|
32988
33049
|
return true;
|
|
32989
33050
|
} catch {
|
|
32990
33051
|
}
|
|
32991
33052
|
}
|
|
32992
|
-
const packageJson = await readJsonFile(
|
|
33053
|
+
const packageJson = await readJsonFile(path21.join(this.tempoRoot, "package.json"));
|
|
32993
33054
|
return Boolean(
|
|
32994
33055
|
packageJson?.dependencies?.next ?? packageJson?.devDependencies?.next
|
|
32995
33056
|
);
|
|
@@ -32998,7 +33059,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32998
33059
|
if (!pid || !await this.isNextTempoHost()) {
|
|
32999
33060
|
return;
|
|
33000
33061
|
}
|
|
33001
|
-
await mkdir6(
|
|
33062
|
+
await mkdir6(path21.dirname(this.processMarkerPath), { recursive: true });
|
|
33002
33063
|
await writeFile7(
|
|
33003
33064
|
this.processMarkerPath,
|
|
33004
33065
|
`${JSON.stringify(
|
|
@@ -33042,7 +33103,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33042
33103
|
async listRegisteredCanvases() {
|
|
33043
33104
|
const files = await scanCanvasFiles(this.pagesDir);
|
|
33044
33105
|
return files.map(
|
|
33045
|
-
(absolutePath) => toPosixPath2(
|
|
33106
|
+
(absolutePath) => toPosixPath2(path21.relative(this.projectRoot, absolutePath))
|
|
33046
33107
|
);
|
|
33047
33108
|
}
|
|
33048
33109
|
/**
|
|
@@ -33467,23 +33528,23 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33467
33528
|
// — pairs with the drift-correction reconcile (a force=false
|
|
33468
33529
|
// compare-and-write pass) which actually restores drift.
|
|
33469
33530
|
async hasManagedFileDrift() {
|
|
33470
|
-
const tempoDir =
|
|
33531
|
+
const tempoDir = path21.join(this.tempoRoot, ".tempo");
|
|
33471
33532
|
const reactCanvasEntries = await this.registry.collectReactCanvasHostEntries();
|
|
33472
33533
|
const startFramework = await this.resolveStartFramework();
|
|
33473
|
-
const wrapperPath =
|
|
33534
|
+
const wrapperPath = path21.join(tempoDir, TEMPO_HOST_FILE_NAME);
|
|
33474
33535
|
const expectedWrapper = buildTempoHostWrapper(reactCanvasEntries, {
|
|
33475
33536
|
startFramework
|
|
33476
33537
|
});
|
|
33477
33538
|
if (await readTextFileOptional(wrapperPath) !== expectedWrapper) {
|
|
33478
33539
|
return true;
|
|
33479
33540
|
}
|
|
33480
|
-
const recoveryPath =
|
|
33541
|
+
const recoveryPath = path21.join(tempoDir, CANVAS_HOST_RECOVERY_FILE_NAME);
|
|
33481
33542
|
const expectedRecovery = canvasHostRecoverySourceFor(startFramework);
|
|
33482
33543
|
if (await readTextFileOptional(recoveryPath) !== expectedRecovery) {
|
|
33483
33544
|
return true;
|
|
33484
33545
|
}
|
|
33485
33546
|
for (const staleFileName of STALE_MANAGED_CANVAS_FILES) {
|
|
33486
|
-
if (await readTextFileOptional(
|
|
33547
|
+
if (await readTextFileOptional(path21.join(tempoDir, staleFileName)) !== null) {
|
|
33487
33548
|
return true;
|
|
33488
33549
|
}
|
|
33489
33550
|
}
|
|
@@ -33504,7 +33565,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33504
33565
|
this.state.generation += 1;
|
|
33505
33566
|
}
|
|
33506
33567
|
this.state.reconcileStatus = "idle";
|
|
33507
|
-
const changedBasenames = changedFiles.map((p2) =>
|
|
33568
|
+
const changedBasenames = changedFiles.map((p2) => path21.basename(p2));
|
|
33508
33569
|
this.recordReconcileActivity({
|
|
33509
33570
|
at: Date.now(),
|
|
33510
33571
|
reason,
|
|
@@ -33582,7 +33643,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33582
33643
|
});
|
|
33583
33644
|
if (arming) {
|
|
33584
33645
|
devLog("reconcile:managed_rewrite_backoff", {
|
|
33585
|
-
file:
|
|
33646
|
+
file: path21.basename(filePath),
|
|
33586
33647
|
consecutiveRewrites,
|
|
33587
33648
|
backoffMs: _TempoDevServer.MANAGED_REWRITE_BACKOFF_MS
|
|
33588
33649
|
});
|
|
@@ -33606,8 +33667,8 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33606
33667
|
}
|
|
33607
33668
|
async reconcileGeneratedFiles(force) {
|
|
33608
33669
|
const changedFiles = [];
|
|
33609
|
-
const tempoDir =
|
|
33610
|
-
const wrapperPath =
|
|
33670
|
+
const tempoDir = path21.join(this.tempoRoot, ".tempo");
|
|
33671
|
+
const wrapperPath = path21.join(tempoDir, TEMPO_HOST_FILE_NAME);
|
|
33611
33672
|
const reactCanvasEntries = await this.registry.collectReactCanvasHostEntries();
|
|
33612
33673
|
const startFramework = await this.resolveStartFramework();
|
|
33613
33674
|
const currentWrapper = await readTextFileOptional(wrapperPath);
|
|
@@ -33623,7 +33684,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33623
33684
|
} else {
|
|
33624
33685
|
this.noteManagedFileConverged(wrapperPath);
|
|
33625
33686
|
}
|
|
33626
|
-
const recoveryPath =
|
|
33687
|
+
const recoveryPath = path21.join(tempoDir, CANVAS_HOST_RECOVERY_FILE_NAME);
|
|
33627
33688
|
const currentRecovery = await readTextFileOptional(recoveryPath);
|
|
33628
33689
|
const nextRecovery = canvasHostRecoverySourceFor(startFramework);
|
|
33629
33690
|
if (currentRecovery !== nextRecovery) {
|
|
@@ -33640,7 +33701,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33640
33701
|
this.noteManagedFileConverged(recoveryPath);
|
|
33641
33702
|
}
|
|
33642
33703
|
for (const staleFileName of STALE_MANAGED_CANVAS_FILES) {
|
|
33643
|
-
const stalePath =
|
|
33704
|
+
const stalePath = path21.join(tempoDir, staleFileName);
|
|
33644
33705
|
if (await readTextFileOptional(stalePath) !== null) {
|
|
33645
33706
|
if (this.shouldRewriteManagedFile(stalePath, force, null)) {
|
|
33646
33707
|
await rm5(stalePath, { force: true });
|
|
@@ -33654,7 +33715,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33654
33715
|
return changedFiles;
|
|
33655
33716
|
}
|
|
33656
33717
|
getStatusFilePath() {
|
|
33657
|
-
return
|
|
33718
|
+
return path21.join(this.tempoRoot, ".tempo", "status.json");
|
|
33658
33719
|
}
|
|
33659
33720
|
// Restore the previous session's dependencies-install cache (distrust-
|
|
33660
33721
|
// verified again before every start — see tempoInstallReady). The persisted
|
|
@@ -33893,12 +33954,12 @@ ${directCanvasSelection}
|
|
|
33893
33954
|
`;
|
|
33894
33955
|
}
|
|
33895
33956
|
function installCompletionMarkerPath(packageRoot) {
|
|
33896
|
-
return
|
|
33957
|
+
return path21.join(packageRoot, "node_modules", ".tempo-install-complete");
|
|
33897
33958
|
}
|
|
33898
33959
|
var INSTALL_COMPLETION_MARKER_VERSION = "tempo-install-complete-v3";
|
|
33899
33960
|
var EXTERNAL_LAYOUT_INSTALL_MARKER = ".tempo-external-install-complete";
|
|
33900
33961
|
async function computeInstallCompletionKey(packageRoot) {
|
|
33901
|
-
const packageJsonPath =
|
|
33962
|
+
const packageJsonPath = path21.join(packageRoot, "package.json");
|
|
33902
33963
|
const raw = await readTextFileOptional(packageJsonPath);
|
|
33903
33964
|
if (raw == null) return null;
|
|
33904
33965
|
let dependencyInput = raw;
|
|
@@ -33924,21 +33985,21 @@ async function computeInstallCompletionKey(packageRoot) {
|
|
|
33924
33985
|
"bun.lock",
|
|
33925
33986
|
"bun.lockb"
|
|
33926
33987
|
];
|
|
33927
|
-
let current =
|
|
33988
|
+
let current = path21.resolve(packageRoot);
|
|
33928
33989
|
let lockfile = null;
|
|
33929
33990
|
while (true) {
|
|
33930
33991
|
for (const name of lockfileNames) {
|
|
33931
33992
|
try {
|
|
33932
33993
|
lockfile = {
|
|
33933
|
-
path:
|
|
33934
|
-
content: await
|
|
33994
|
+
path: path21.relative(packageRoot, path21.join(current, name)),
|
|
33995
|
+
content: await readFile15(path21.join(current, name))
|
|
33935
33996
|
};
|
|
33936
33997
|
break;
|
|
33937
33998
|
} catch {
|
|
33938
33999
|
}
|
|
33939
34000
|
}
|
|
33940
34001
|
if (lockfile) break;
|
|
33941
|
-
const parent =
|
|
34002
|
+
const parent = path21.dirname(current);
|
|
33942
34003
|
if (parent === current) break;
|
|
33943
34004
|
current = parent;
|
|
33944
34005
|
}
|
|
@@ -33959,7 +34020,7 @@ async function readInstallCompletionMarker(packageRoot) {
|
|
|
33959
34020
|
async function installCompletedForCurrentDeps(packageRoot) {
|
|
33960
34021
|
const marker = await readInstallCompletionMarker(packageRoot);
|
|
33961
34022
|
if (marker === null) {
|
|
33962
|
-
return !await pathExists2(
|
|
34023
|
+
return !await pathExists2(path21.join(packageRoot, "package.json"));
|
|
33963
34024
|
}
|
|
33964
34025
|
const key = await computeInstallCompletionKey(packageRoot);
|
|
33965
34026
|
if (key == null) {
|
|
@@ -33971,7 +34032,7 @@ async function writeInstallCompletionMarker(packageRoot) {
|
|
|
33971
34032
|
const key = await computeInstallCompletionKey(packageRoot);
|
|
33972
34033
|
if (key == null) return;
|
|
33973
34034
|
try {
|
|
33974
|
-
await mkdir6(
|
|
34035
|
+
await mkdir6(path21.join(packageRoot, "node_modules"), { recursive: true });
|
|
33975
34036
|
await writeFile7(installCompletionMarkerPath(packageRoot), key, "utf-8");
|
|
33976
34037
|
} catch (error) {
|
|
33977
34038
|
console.warn(
|
|
@@ -33982,14 +34043,14 @@ async function writeInstallCompletionMarker(packageRoot) {
|
|
|
33982
34043
|
}
|
|
33983
34044
|
async function externalLayoutInstallCompleted(packageRoot) {
|
|
33984
34045
|
const marker = await readTextFileOptional(
|
|
33985
|
-
|
|
34046
|
+
path21.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER)
|
|
33986
34047
|
);
|
|
33987
34048
|
return marker !== null && marker === await computeInstallCompletionKey(packageRoot);
|
|
33988
34049
|
}
|
|
33989
34050
|
async function invalidateInstallCompletionMarkers(packageRoot) {
|
|
33990
34051
|
await Promise.all([
|
|
33991
34052
|
rm5(installCompletionMarkerPath(packageRoot), { force: true }),
|
|
33992
|
-
rm5(
|
|
34053
|
+
rm5(path21.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER), {
|
|
33993
34054
|
force: true
|
|
33994
34055
|
})
|
|
33995
34056
|
]);
|
|
@@ -33997,9 +34058,9 @@ async function invalidateInstallCompletionMarkers(packageRoot) {
|
|
|
33997
34058
|
async function writeExternalLayoutInstallMarker(packageRoot) {
|
|
33998
34059
|
const key = await computeInstallCompletionKey(packageRoot);
|
|
33999
34060
|
if (key == null) return;
|
|
34000
|
-
await mkdir6(
|
|
34061
|
+
await mkdir6(path21.join(packageRoot, "node_modules"), { recursive: true });
|
|
34001
34062
|
await writeFile7(
|
|
34002
|
-
|
|
34063
|
+
path21.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER),
|
|
34003
34064
|
key,
|
|
34004
34065
|
"utf-8"
|
|
34005
34066
|
);
|
|
@@ -34010,7 +34071,7 @@ async function refreshInstallCompletionMarkers(packageRoot) {
|
|
|
34010
34071
|
return;
|
|
34011
34072
|
await writeInstallCompletionMarker(packageRoot);
|
|
34012
34073
|
if (await pathExists2(
|
|
34013
|
-
|
|
34074
|
+
path21.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER)
|
|
34014
34075
|
)) {
|
|
34015
34076
|
await writeExternalLayoutInstallMarker(packageRoot);
|
|
34016
34077
|
}
|
|
@@ -34024,11 +34085,11 @@ async function pathExists2(filePath) {
|
|
|
34024
34085
|
}
|
|
34025
34086
|
}
|
|
34026
34087
|
async function hasPnpLoader(packageRoot) {
|
|
34027
|
-
return await pathExists2(
|
|
34088
|
+
return await pathExists2(path21.join(packageRoot, ".pnp.cjs")) || await pathExists2(path21.join(packageRoot, ".pnp.js"));
|
|
34028
34089
|
}
|
|
34029
34090
|
async function nodeModulesHasMeaningfulEntries(packageRoot) {
|
|
34030
34091
|
try {
|
|
34031
|
-
const entries = await readdir6(
|
|
34092
|
+
const entries = await readdir6(path21.join(packageRoot, "node_modules"));
|
|
34032
34093
|
return entries.some((entry) => !entry.startsWith("."));
|
|
34033
34094
|
} catch {
|
|
34034
34095
|
return false;
|
|
@@ -34065,12 +34126,12 @@ async function resolvePackageManagerCommand(pm, cwd) {
|
|
|
34065
34126
|
function protectedRootFor(cwd) {
|
|
34066
34127
|
const raw = process.env.TEMPO_DEVSERVER_PROTECTED_ROOTS;
|
|
34067
34128
|
if (!raw) return null;
|
|
34068
|
-
const protectedRoots = raw.split(
|
|
34129
|
+
const protectedRoots = raw.split(path21.delimiter).map((p2) => p2.trim()).filter((p2) => p2.length > 0).map((p2) => path21.resolve(p2));
|
|
34069
34130
|
if (protectedRoots.length === 0) return null;
|
|
34070
|
-
const resolved =
|
|
34131
|
+
const resolved = path21.resolve(cwd);
|
|
34071
34132
|
for (const root of protectedRoots) {
|
|
34072
|
-
const rel =
|
|
34073
|
-
if (rel === "" || !rel.startsWith("..") && !
|
|
34133
|
+
const rel = path21.relative(root, resolved);
|
|
34134
|
+
if (rel === "" || !rel.startsWith("..") && !path21.isAbsolute(rel)) {
|
|
34074
34135
|
return root;
|
|
34075
34136
|
}
|
|
34076
34137
|
}
|
|
@@ -34139,11 +34200,11 @@ function toProjectNodeEnvOption(override) {
|
|
|
34139
34200
|
};
|
|
34140
34201
|
}
|
|
34141
34202
|
function getProjectNodeUnsatisfiedHint(cwd) {
|
|
34142
|
-
const unsatisfied = projectNodeUnsatisfiedByDir.get(
|
|
34203
|
+
const unsatisfied = projectNodeUnsatisfiedByDir.get(path21.resolve(cwd));
|
|
34143
34204
|
return unsatisfied ? buildUnsatisfiedNodeHint(unsatisfied) : null;
|
|
34144
34205
|
}
|
|
34145
34206
|
async function resolveProjectNodeOverrideForDir(cwd) {
|
|
34146
|
-
const dir =
|
|
34207
|
+
const dir = path21.resolve(cwd);
|
|
34147
34208
|
const key = `${dir}|bundled:${isBundledNodeActivated()}`;
|
|
34148
34209
|
const cached = projectNodeOverrideCache.get(key);
|
|
34149
34210
|
if (cached) {
|
|
@@ -34163,7 +34224,7 @@ async function resolveProjectNodeOverrideForDir(cwd) {
|
|
|
34163
34224
|
projectNodeUnsatisfiedByDir.delete(dir);
|
|
34164
34225
|
return null;
|
|
34165
34226
|
}
|
|
34166
|
-
const treePackageJson = await readJsonFile(
|
|
34227
|
+
const treePackageJson = await readJsonFile(path21.join(dir, "package.json"));
|
|
34167
34228
|
const viteSpec = treePackageJson?.dependencies?.vite ?? treePackageJson?.devDependencies?.vite;
|
|
34168
34229
|
const viteMajor = typeof viteSpec === "string" ? parseFirstSemverMajor(viteSpec) : null;
|
|
34169
34230
|
const requireFloor = viteMajor != null && viteMajor >= 7;
|
|
@@ -34399,7 +34460,7 @@ async function runInstallCommandWithLockRetry(command, cwd, runCommandFn = runSh
|
|
|
34399
34460
|
}
|
|
34400
34461
|
}
|
|
34401
34462
|
}
|
|
34402
|
-
async function runInstallStep(step, signal, onOutput) {
|
|
34463
|
+
async function runInstallStep(step, signal, onOutput, projectRoot = step.cwd) {
|
|
34403
34464
|
throwIfLaunchAborted(signal);
|
|
34404
34465
|
await Promise.all(
|
|
34405
34466
|
[
|
|
@@ -34411,7 +34472,7 @@ async function runInstallStep(step, signal, onOutput) {
|
|
|
34411
34472
|
);
|
|
34412
34473
|
throwIfLaunchAborted(signal);
|
|
34413
34474
|
if (step.cleanBeforeInstall) {
|
|
34414
|
-
await rm5(
|
|
34475
|
+
await rm5(path21.join(step.cwd, "node_modules"), {
|
|
34415
34476
|
recursive: true,
|
|
34416
34477
|
force: true
|
|
34417
34478
|
}).catch((error) => {
|
|
@@ -34426,7 +34487,7 @@ async function runInstallStep(step, signal, onOutput) {
|
|
|
34426
34487
|
await runInstallCommandWithLockRetry(
|
|
34427
34488
|
step.command,
|
|
34428
34489
|
step.cwd,
|
|
34429
|
-
(command, cwd, signal2) => runShellCommand(command, cwd, signal2, onOutput),
|
|
34490
|
+
(command, cwd, signal2) => runShellCommand(command, cwd, signal2, onOutput, projectRoot),
|
|
34430
34491
|
INSTALL_LOCK_RETRY_DELAYS_MS,
|
|
34431
34492
|
signal
|
|
34432
34493
|
);
|
|
@@ -34462,7 +34523,7 @@ async function sleepForStatusRetry(delayMs) {
|
|
|
34462
34523
|
await new Promise((resolve2) => setTimeout(resolve2, delayMs));
|
|
34463
34524
|
}
|
|
34464
34525
|
async function writeStatusTextBestEffort(statusPath, text) {
|
|
34465
|
-
await mkdir6(
|
|
34526
|
+
await mkdir6(path21.dirname(statusPath), { recursive: true });
|
|
34466
34527
|
const delays = [25, 75, 150];
|
|
34467
34528
|
let lastError = null;
|
|
34468
34529
|
for (let attempt = 0; attempt <= delays.length; attempt += 1) {
|
|
@@ -34488,15 +34549,15 @@ function augmentManagedPath(env) {
|
|
|
34488
34549
|
return env;
|
|
34489
34550
|
}
|
|
34490
34551
|
const candidates = [
|
|
34491
|
-
process.env.ProgramFiles ?
|
|
34492
|
-
process.env.APPDATA ?
|
|
34493
|
-
process.env.LOCALAPPDATA ?
|
|
34494
|
-
process.env.USERPROFILE ?
|
|
34495
|
-
process.env.USERPROFILE ?
|
|
34552
|
+
process.env.ProgramFiles ? path21.join(process.env.ProgramFiles, "nodejs") : null,
|
|
34553
|
+
process.env.APPDATA ? path21.join(process.env.APPDATA, "npm") : null,
|
|
34554
|
+
process.env.LOCALAPPDATA ? path21.join(process.env.LOCALAPPDATA, "pnpm") : null,
|
|
34555
|
+
process.env.USERPROFILE ? path21.join(process.env.USERPROFILE, ".bun", "bin") : null,
|
|
34556
|
+
process.env.USERPROFILE ? path21.join(process.env.USERPROFILE, ".volta", "bin") : null
|
|
34496
34557
|
].filter((value) => Boolean(value));
|
|
34497
34558
|
const pathKey = Object.keys(env).find((key) => key.toLowerCase() === "path");
|
|
34498
34559
|
const existingPath = pathKey ? env[pathKey] : env.PATH;
|
|
34499
|
-
const nextPath = [...candidates, existingPath].filter(Boolean).join(
|
|
34560
|
+
const nextPath = [...candidates, existingPath].filter(Boolean).join(path21.delimiter);
|
|
34500
34561
|
return {
|
|
34501
34562
|
...env,
|
|
34502
34563
|
[pathKey ?? "PATH"]: nextPath
|
|
@@ -34900,17 +34961,27 @@ async function runBoundedShellCommand(options) {
|
|
|
34900
34961
|
);
|
|
34901
34962
|
});
|
|
34902
34963
|
}
|
|
34903
|
-
async function runShellCommand(command, cwd, signal, onOutput) {
|
|
34964
|
+
async function runShellCommand(command, cwd, signal, onOutput, projectRoot = cwd) {
|
|
34904
34965
|
throwIfLaunchAborted(signal);
|
|
34905
34966
|
const projectNode = toProjectNodeEnvOption(
|
|
34906
34967
|
await resolveProjectNodeOverrideForDir(cwd)
|
|
34907
34968
|
);
|
|
34908
34969
|
const lifted = extractLeadingEnvAssignments(command);
|
|
34970
|
+
const registryEnv = await readInstallRegistryEnv(cwd, projectRoot, {
|
|
34971
|
+
...process.env,
|
|
34972
|
+
...lifted.env
|
|
34973
|
+
});
|
|
34909
34974
|
const result = await runAbortableShellCommand({
|
|
34910
34975
|
command: lifted.command,
|
|
34911
34976
|
cwd,
|
|
34912
34977
|
signal,
|
|
34913
|
-
env: {
|
|
34978
|
+
env: {
|
|
34979
|
+
// Restore referenced credentials (including NPM_TOKEN, otherwise
|
|
34980
|
+
// stripped with npm session state) without overriding managed flags.
|
|
34981
|
+
...registryEnv,
|
|
34982
|
+
...buildManagedCommandEnv({ projectNode }),
|
|
34983
|
+
...lifted.env
|
|
34984
|
+
},
|
|
34914
34985
|
onOutput,
|
|
34915
34986
|
idleTimeoutMs: INSTALL_IDLE_TIMEOUT_MS
|
|
34916
34987
|
});
|
|
@@ -34925,7 +34996,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
34925
34996
|
throwIfLaunchAborted(signal);
|
|
34926
34997
|
const configuredUpdateCommand = options.updateCommand?.trim();
|
|
34927
34998
|
const runCommandFn = options.runCommand ?? runShellCommand;
|
|
34928
|
-
const metadataCacheDir = configuredUpdateCommand ? null : await mkdtemp(
|
|
34999
|
+
const metadataCacheDir = configuredUpdateCommand ? null : await mkdtemp(path21.join(os2.tmpdir(), "tempo-sdk-meta-")).catch(
|
|
34929
35000
|
() => null
|
|
34930
35001
|
);
|
|
34931
35002
|
const cleanupMetadataCache = async () => {
|
|
@@ -34978,9 +35049,9 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
34978
35049
|
let updateCommandStarted = false;
|
|
34979
35050
|
let ignoredBuildScriptsAfterLink = false;
|
|
34980
35051
|
try {
|
|
34981
|
-
const packageJsonPath =
|
|
35052
|
+
const packageJsonPath = path21.join(cwd, "package.json");
|
|
34982
35053
|
const ensureSpecLatest = async () => {
|
|
34983
|
-
const raw = await
|
|
35054
|
+
const raw = await readFile15(packageJsonPath, "utf-8").catch(() => null);
|
|
34984
35055
|
if (!raw) return false;
|
|
34985
35056
|
const parsed = JSON.parse(raw);
|
|
34986
35057
|
const dependencies = parsed.dependencies && typeof parsed.dependencies === "object" && !Array.isArray(parsed.dependencies) ? parsed.dependencies : void 0;
|
|
@@ -35025,14 +35096,14 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
35025
35096
|
await ensureSpecLatest();
|
|
35026
35097
|
return { attempted: true, plan };
|
|
35027
35098
|
}
|
|
35028
|
-
const nodeModulesPath =
|
|
35029
|
-
const installedPkgPath =
|
|
35099
|
+
const nodeModulesPath = path21.join(cwd, "node_modules");
|
|
35100
|
+
const installedPkgPath = path21.join(
|
|
35030
35101
|
nodeModulesPath,
|
|
35031
35102
|
"tempo-sdk",
|
|
35032
35103
|
"package.json"
|
|
35033
35104
|
);
|
|
35034
35105
|
const [installedRaw, registryResponse] = await Promise.all([
|
|
35035
|
-
|
|
35106
|
+
readFile15(installedPkgPath, "utf-8").catch(() => null),
|
|
35036
35107
|
fetch("https://registry.npmjs.org/tempo-sdk/latest", {
|
|
35037
35108
|
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(3e3)]) : AbortSignal.timeout(3e3)
|
|
35038
35109
|
}).catch(() => null)
|
|
@@ -35077,7 +35148,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
35077
35148
|
}
|
|
35078
35149
|
throwIfLaunchAborted(signal);
|
|
35079
35150
|
await ensureSpecLatest();
|
|
35080
|
-
const upgradedRaw = await
|
|
35151
|
+
const upgradedRaw = await readFile15(installedPkgPath, "utf-8").catch(
|
|
35081
35152
|
() => null
|
|
35082
35153
|
);
|
|
35083
35154
|
const upgradedVersion = upgradedRaw ? JSON.parse(upgradedRaw).version : null;
|
|
@@ -35104,7 +35175,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
35104
35175
|
}
|
|
35105
35176
|
async function readJsonFile(filePath) {
|
|
35106
35177
|
try {
|
|
35107
|
-
return JSON.parse(await
|
|
35178
|
+
return JSON.parse(await readFile15(filePath, "utf-8"));
|
|
35108
35179
|
} catch {
|
|
35109
35180
|
return null;
|
|
35110
35181
|
}
|
|
@@ -35199,14 +35270,14 @@ function advertisedRootBelongsToWorkspace(advertised, expected) {
|
|
|
35199
35270
|
try {
|
|
35200
35271
|
return fs3.realpathSync(p2);
|
|
35201
35272
|
} catch {
|
|
35202
|
-
return
|
|
35273
|
+
return path21.resolve(p2);
|
|
35203
35274
|
}
|
|
35204
35275
|
};
|
|
35205
35276
|
const a = norm(advertised);
|
|
35206
35277
|
const e = norm(expected);
|
|
35207
35278
|
if (a === e) return true;
|
|
35208
|
-
const aWithSep = a.endsWith(
|
|
35209
|
-
const eWithSep = e.endsWith(
|
|
35279
|
+
const aWithSep = a.endsWith(path21.sep) ? a : `${a}${path21.sep}`;
|
|
35280
|
+
const eWithSep = e.endsWith(path21.sep) ? e : `${e}${path21.sep}`;
|
|
35210
35281
|
return a.startsWith(eWithSep) || e.startsWith(aWithSep);
|
|
35211
35282
|
}
|
|
35212
35283
|
var MAX_PROBE_RESPONSE_BYTES = 64 * 1024;
|
|
@@ -35529,13 +35600,13 @@ function sleep3(ms) {
|
|
|
35529
35600
|
}
|
|
35530
35601
|
|
|
35531
35602
|
// ../tempo-devserver/read-status.ts
|
|
35532
|
-
import { readFile as
|
|
35533
|
-
import
|
|
35603
|
+
import { readFile as readFile16 } from "fs/promises";
|
|
35604
|
+
import path22 from "path";
|
|
35534
35605
|
async function readDevServerStatus(tempoRoot) {
|
|
35535
|
-
const statusPath =
|
|
35606
|
+
const statusPath = path22.join(tempoRoot, ".tempo", "status.json");
|
|
35536
35607
|
let raw;
|
|
35537
35608
|
try {
|
|
35538
|
-
raw = await
|
|
35609
|
+
raw = await readFile16(statusPath, "utf-8");
|
|
35539
35610
|
} catch {
|
|
35540
35611
|
return { dependenciesInstalled: false, devserverUrl: null };
|
|
35541
35612
|
}
|
|
@@ -35558,7 +35629,7 @@ function buildInstallScript(rootInstallCmd) {
|
|
|
35558
35629
|
}
|
|
35559
35630
|
|
|
35560
35631
|
// ../tempo-project/canvas-zones.ts
|
|
35561
|
-
import
|
|
35632
|
+
import path23 from "path";
|
|
35562
35633
|
var DESIGN_SYSTEM_ZONE_DIR = "design-system";
|
|
35563
35634
|
var LIBRARIES_ZONE_DIR = "libraries";
|
|
35564
35635
|
var FREEFORM_CANVASES_DIR = "canvases";
|
|
@@ -35585,7 +35656,7 @@ function isStrictZone(zone) {
|
|
|
35585
35656
|
return zone.kind !== "freeform";
|
|
35586
35657
|
}
|
|
35587
35658
|
async function resolveFreeformCanvasesDir(canvasesRoot) {
|
|
35588
|
-
return
|
|
35659
|
+
return path23.join(canvasesRoot, FREEFORM_CANVASES_DIR);
|
|
35589
35660
|
}
|
|
35590
35661
|
|
|
35591
35662
|
// ../tempo-project/config.ts
|
|
@@ -35977,7 +36048,7 @@ async function buildRepairConfig(projectRoot, rawConfig) {
|
|
|
35977
36048
|
};
|
|
35978
36049
|
}
|
|
35979
36050
|
async function ensureValidTempoConfigFile(projectRoot) {
|
|
35980
|
-
const normalizedRoot =
|
|
36051
|
+
const normalizedRoot = path24.resolve(projectRoot);
|
|
35981
36052
|
const configPath = await findTempoConfigPath(normalizedRoot);
|
|
35982
36053
|
if (!configPath) {
|
|
35983
36054
|
return {
|
|
@@ -35997,19 +36068,19 @@ async function ensureValidTempoConfigFile(projectRoot) {
|
|
|
35997
36068
|
const repairError = error instanceof Error ? error.message : String(error);
|
|
35998
36069
|
let rawConfig = null;
|
|
35999
36070
|
try {
|
|
36000
|
-
const raw = await
|
|
36071
|
+
const raw = await readFile17(configPath, "utf-8");
|
|
36001
36072
|
const parsed = JSON.parse(raw);
|
|
36002
36073
|
rawConfig = isObjectRecord(parsed) ? parsed : null;
|
|
36003
36074
|
} catch {
|
|
36004
36075
|
}
|
|
36005
|
-
const canonicalConfigDir =
|
|
36006
|
-
const configDir =
|
|
36007
|
-
if (
|
|
36076
|
+
const canonicalConfigDir = path24.join(normalizedRoot, TEMPO_DIR_NAME2);
|
|
36077
|
+
const configDir = path24.dirname(configPath) === normalizedRoot ? canonicalConfigDir : path24.dirname(configPath);
|
|
36078
|
+
if (path24.dirname(configPath) === normalizedRoot) {
|
|
36008
36079
|
await rm6(configPath, { force: true });
|
|
36009
36080
|
}
|
|
36010
36081
|
const repaired = await buildRepairConfig(normalizedRoot, rawConfig);
|
|
36011
36082
|
await writeTempoConfigFile(configDir, repaired);
|
|
36012
|
-
const wroteConfigPath =
|
|
36083
|
+
const wroteConfigPath = path24.join(configDir, TEMPO_CONFIG_FILE);
|
|
36013
36084
|
devLog("tempo-config:schema-repaired", {
|
|
36014
36085
|
projectRoot: normalizedRoot,
|
|
36015
36086
|
previousConfigPath: configPath,
|
|
@@ -36025,8 +36096,8 @@ async function ensureValidTempoConfigFile(projectRoot) {
|
|
|
36025
36096
|
}
|
|
36026
36097
|
}
|
|
36027
36098
|
async function findTempoConfigPath(projectRoot) {
|
|
36028
|
-
const legacyRootPath =
|
|
36029
|
-
const canonicalPath2 =
|
|
36099
|
+
const legacyRootPath = path24.join(projectRoot, TEMPO_CONFIG_FILE);
|
|
36100
|
+
const canonicalPath2 = path24.join(
|
|
36030
36101
|
projectRoot,
|
|
36031
36102
|
TEMPO_DIR_NAME2,
|
|
36032
36103
|
TEMPO_CONFIG_FILE
|
|
@@ -36042,7 +36113,7 @@ async function findTempoConfigPath(projectRoot) {
|
|
|
36042
36113
|
async function isForeignRootConfig(configPath) {
|
|
36043
36114
|
let parsed;
|
|
36044
36115
|
try {
|
|
36045
|
-
parsed = JSON.parse(await
|
|
36116
|
+
parsed = JSON.parse(await readFile17(configPath, "utf-8"));
|
|
36046
36117
|
} catch {
|
|
36047
36118
|
return false;
|
|
36048
36119
|
}
|
|
@@ -36051,7 +36122,7 @@ async function isForeignRootConfig(configPath) {
|
|
|
36051
36122
|
async function parseConfigAt(configPath) {
|
|
36052
36123
|
let rawContents;
|
|
36053
36124
|
try {
|
|
36054
|
-
rawContents = await
|
|
36125
|
+
rawContents = await readFile17(configPath, "utf-8");
|
|
36055
36126
|
} catch (error) {
|
|
36056
36127
|
throw new ConfigInvalidError(
|
|
36057
36128
|
configPath,
|
|
@@ -36078,10 +36149,10 @@ async function parseConfigAt(configPath) {
|
|
|
36078
36149
|
}
|
|
36079
36150
|
}
|
|
36080
36151
|
async function tempoConfigExists(projectRoot) {
|
|
36081
|
-
return await findTempoConfigPath(
|
|
36152
|
+
return await findTempoConfigPath(path24.resolve(projectRoot)) !== null;
|
|
36082
36153
|
}
|
|
36083
36154
|
async function writeTempoConfigFile(configDir, config) {
|
|
36084
|
-
const configPath =
|
|
36155
|
+
const configPath = path24.join(configDir, TEMPO_CONFIG_FILE);
|
|
36085
36156
|
const normalized = validateTempoConfigFile(config);
|
|
36086
36157
|
const rendered = {};
|
|
36087
36158
|
if (normalized.paths) {
|
|
@@ -36150,10 +36221,10 @@ function buildExpoTempoConfig(opts) {
|
|
|
36150
36221
|
};
|
|
36151
36222
|
}
|
|
36152
36223
|
function resolveCanvasesDirSync(projectRoot) {
|
|
36153
|
-
const normalizedRoot =
|
|
36224
|
+
const normalizedRoot = path24.resolve(projectRoot);
|
|
36154
36225
|
const candidates = [
|
|
36155
|
-
|
|
36156
|
-
|
|
36226
|
+
path24.join(normalizedRoot, TEMPO_DIR_NAME2, TEMPO_CONFIG_FILE),
|
|
36227
|
+
path24.join(normalizedRoot, TEMPO_CONFIG_FILE)
|
|
36157
36228
|
];
|
|
36158
36229
|
for (const configPath of candidates) {
|
|
36159
36230
|
let parsed;
|
|
@@ -36165,21 +36236,21 @@ function resolveCanvasesDirSync(projectRoot) {
|
|
|
36165
36236
|
if (!isObjectRecord(parsed) || !("scripts" in parsed)) continue;
|
|
36166
36237
|
const paths = isObjectRecord(parsed.paths) ? parsed.paths : void 0;
|
|
36167
36238
|
const canvases = typeof paths?.canvases === "string" && paths.canvases.trim().length > 0 ? toPosixPath4(paths.canvases.trim()) : NEW_PROJECT_CANVASES_PATH;
|
|
36168
|
-
return
|
|
36239
|
+
return path24.resolve(path24.dirname(configPath), canvases);
|
|
36169
36240
|
}
|
|
36170
|
-
return
|
|
36241
|
+
return path24.join(normalizedRoot, TEMPO_DIR_NAME2, "designs");
|
|
36171
36242
|
}
|
|
36172
36243
|
async function resolveTempoConfig(projectRoot) {
|
|
36173
|
-
const normalizedProjectRoot =
|
|
36244
|
+
const normalizedProjectRoot = path24.resolve(projectRoot);
|
|
36174
36245
|
const configPath = await findTempoConfigPath(normalizedProjectRoot);
|
|
36175
36246
|
if (!configPath) {
|
|
36176
36247
|
throw new ConfigMissingError(normalizedProjectRoot);
|
|
36177
36248
|
}
|
|
36178
36249
|
const config = await parseConfigAt(configPath);
|
|
36179
|
-
const tempoRoot =
|
|
36180
|
-
const relativeTempoRoot =
|
|
36250
|
+
const tempoRoot = path24.dirname(configPath);
|
|
36251
|
+
const relativeTempoRoot = path24.relative(normalizedProjectRoot, tempoRoot);
|
|
36181
36252
|
const rootRel = relativeTempoRoot === "" ? "." : `./${toPosixPath4(relativeTempoRoot)}`;
|
|
36182
|
-
const pagesDir =
|
|
36253
|
+
const pagesDir = path24.resolve(
|
|
36183
36254
|
tempoRoot,
|
|
36184
36255
|
config.paths?.canvases ?? NEW_PROJECT_CANVASES_PATH
|
|
36185
36256
|
);
|
|
@@ -36214,9 +36285,9 @@ async function resolveTempoConfig(projectRoot) {
|
|
|
36214
36285
|
rootRel,
|
|
36215
36286
|
tempoRoot,
|
|
36216
36287
|
pagesDir,
|
|
36217
|
-
packageJsonPath:
|
|
36218
|
-
viteConfigPath:
|
|
36219
|
-
tsconfigPath:
|
|
36288
|
+
packageJsonPath: path24.join(tempoRoot, "package.json"),
|
|
36289
|
+
viteConfigPath: path24.join(tempoRoot, "vite.config.ts"),
|
|
36290
|
+
tsconfigPath: path24.join(tempoRoot, "tsconfig.json"),
|
|
36220
36291
|
tempoHostUrl: config.urls?.tempoHost ?? null,
|
|
36221
36292
|
appUrl: activeApp.url,
|
|
36222
36293
|
scripts: {
|
|
@@ -36232,12 +36303,12 @@ async function resolveTempoConfig(projectRoot) {
|
|
|
36232
36303
|
}
|
|
36233
36304
|
|
|
36234
36305
|
// ../tempo-project/git.ts
|
|
36235
|
-
import
|
|
36306
|
+
import path26 from "path";
|
|
36236
36307
|
import { access as access6 } from "fs/promises";
|
|
36237
36308
|
|
|
36238
36309
|
// ../workspaces/meta-repo/meta-repo.ts
|
|
36239
36310
|
import fs4 from "fs/promises";
|
|
36240
|
-
import
|
|
36311
|
+
import path25 from "path";
|
|
36241
36312
|
|
|
36242
36313
|
// ../../node_modules/.pnpm/simple-git@3.32.3/node_modules/simple-git/dist/esm/index.js
|
|
36243
36314
|
var import_file_exists = __toESM(require_dist(), 1);
|
|
@@ -36276,8 +36347,8 @@ function pathspec(...paths) {
|
|
|
36276
36347
|
cache.set(key, paths);
|
|
36277
36348
|
return key;
|
|
36278
36349
|
}
|
|
36279
|
-
function isPathSpec(
|
|
36280
|
-
return
|
|
36350
|
+
function isPathSpec(path64) {
|
|
36351
|
+
return path64 instanceof String && cache.has(path64);
|
|
36281
36352
|
}
|
|
36282
36353
|
function toPaths(pathSpec) {
|
|
36283
36354
|
return cache.get(pathSpec) || [];
|
|
@@ -36366,8 +36437,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
36366
36437
|
function forEachLineWithContent(input, callback) {
|
|
36367
36438
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
36368
36439
|
}
|
|
36369
|
-
function folderExists(
|
|
36370
|
-
return (0, import_file_exists.exists)(
|
|
36440
|
+
function folderExists(path64) {
|
|
36441
|
+
return (0, import_file_exists.exists)(path64, import_file_exists.FOLDER);
|
|
36371
36442
|
}
|
|
36372
36443
|
function append(target, item) {
|
|
36373
36444
|
if (Array.isArray(target)) {
|
|
@@ -36771,8 +36842,8 @@ function checkIsRepoRootTask() {
|
|
|
36771
36842
|
commands,
|
|
36772
36843
|
format: "utf-8",
|
|
36773
36844
|
onError,
|
|
36774
|
-
parser(
|
|
36775
|
-
return /^\.(git)?$/.test(
|
|
36845
|
+
parser(path64) {
|
|
36846
|
+
return /^\.(git)?$/.test(path64.trim());
|
|
36776
36847
|
}
|
|
36777
36848
|
};
|
|
36778
36849
|
}
|
|
@@ -37206,11 +37277,11 @@ function parseGrep(grep) {
|
|
|
37206
37277
|
const paths = /* @__PURE__ */ new Set();
|
|
37207
37278
|
const results = {};
|
|
37208
37279
|
forEachLineWithContent(grep, (input) => {
|
|
37209
|
-
const [
|
|
37210
|
-
paths.add(
|
|
37211
|
-
(results[
|
|
37280
|
+
const [path64, line, preview] = input.split(NULL);
|
|
37281
|
+
paths.add(path64);
|
|
37282
|
+
(results[path64] = results[path64] || []).push({
|
|
37212
37283
|
line: asNumber(line),
|
|
37213
|
-
path:
|
|
37284
|
+
path: path64,
|
|
37214
37285
|
preview
|
|
37215
37286
|
});
|
|
37216
37287
|
});
|
|
@@ -37975,14 +38046,14 @@ var init_hash_object = __esm({
|
|
|
37975
38046
|
init_task();
|
|
37976
38047
|
}
|
|
37977
38048
|
});
|
|
37978
|
-
function parseInit(bare,
|
|
38049
|
+
function parseInit(bare, path64, text) {
|
|
37979
38050
|
const response = String(text).trim();
|
|
37980
38051
|
let result;
|
|
37981
38052
|
if (result = initResponseRegex.exec(response)) {
|
|
37982
|
-
return new InitSummary(bare,
|
|
38053
|
+
return new InitSummary(bare, path64, false, result[1]);
|
|
37983
38054
|
}
|
|
37984
38055
|
if (result = reInitResponseRegex.exec(response)) {
|
|
37985
|
-
return new InitSummary(bare,
|
|
38056
|
+
return new InitSummary(bare, path64, true, result[1]);
|
|
37986
38057
|
}
|
|
37987
38058
|
let gitDir = "";
|
|
37988
38059
|
const tokens = response.split(" ");
|
|
@@ -37993,7 +38064,7 @@ function parseInit(bare, path63, text) {
|
|
|
37993
38064
|
break;
|
|
37994
38065
|
}
|
|
37995
38066
|
}
|
|
37996
|
-
return new InitSummary(bare,
|
|
38067
|
+
return new InitSummary(bare, path64, /^re/i.test(response), gitDir);
|
|
37997
38068
|
}
|
|
37998
38069
|
var InitSummary;
|
|
37999
38070
|
var initResponseRegex;
|
|
@@ -38002,9 +38073,9 @@ var init_InitSummary = __esm({
|
|
|
38002
38073
|
"src/lib/responses/InitSummary.ts"() {
|
|
38003
38074
|
"use strict";
|
|
38004
38075
|
InitSummary = class {
|
|
38005
|
-
constructor(bare,
|
|
38076
|
+
constructor(bare, path64, existing, gitDir) {
|
|
38006
38077
|
this.bare = bare;
|
|
38007
|
-
this.path =
|
|
38078
|
+
this.path = path64;
|
|
38008
38079
|
this.existing = existing;
|
|
38009
38080
|
this.gitDir = gitDir;
|
|
38010
38081
|
}
|
|
@@ -38016,7 +38087,7 @@ var init_InitSummary = __esm({
|
|
|
38016
38087
|
function hasBareCommand(command) {
|
|
38017
38088
|
return command.includes(bareCommand);
|
|
38018
38089
|
}
|
|
38019
|
-
function initTask(bare = false,
|
|
38090
|
+
function initTask(bare = false, path64, customArgs) {
|
|
38020
38091
|
const commands = ["init", ...customArgs];
|
|
38021
38092
|
if (bare && !hasBareCommand(commands)) {
|
|
38022
38093
|
commands.splice(1, 0, bareCommand);
|
|
@@ -38025,7 +38096,7 @@ function initTask(bare = false, path63, customArgs) {
|
|
|
38025
38096
|
commands,
|
|
38026
38097
|
format: "utf-8",
|
|
38027
38098
|
parser(text) {
|
|
38028
|
-
return parseInit(commands.includes("--bare"),
|
|
38099
|
+
return parseInit(commands.includes("--bare"), path64, text);
|
|
38029
38100
|
}
|
|
38030
38101
|
};
|
|
38031
38102
|
}
|
|
@@ -38841,12 +38912,12 @@ var init_FileStatusSummary = __esm({
|
|
|
38841
38912
|
"use strict";
|
|
38842
38913
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
38843
38914
|
FileStatusSummary = class {
|
|
38844
|
-
constructor(
|
|
38845
|
-
this.path =
|
|
38915
|
+
constructor(path64, index, working_dir) {
|
|
38916
|
+
this.path = path64;
|
|
38846
38917
|
this.index = index;
|
|
38847
38918
|
this.working_dir = working_dir;
|
|
38848
38919
|
if (index === "R" || working_dir === "R") {
|
|
38849
|
-
const detail = fromPathRegex.exec(
|
|
38920
|
+
const detail = fromPathRegex.exec(path64) || [null, path64, path64];
|
|
38850
38921
|
this.from = detail[2] || "";
|
|
38851
38922
|
this.path = detail[1] || "";
|
|
38852
38923
|
}
|
|
@@ -38877,14 +38948,14 @@ function splitLine(result, lineStr) {
|
|
|
38877
38948
|
default:
|
|
38878
38949
|
return;
|
|
38879
38950
|
}
|
|
38880
|
-
function data(index, workingDir,
|
|
38951
|
+
function data(index, workingDir, path64) {
|
|
38881
38952
|
const raw = `${index}${workingDir}`;
|
|
38882
38953
|
const handler = parsers6.get(raw);
|
|
38883
38954
|
if (handler) {
|
|
38884
|
-
handler(result,
|
|
38955
|
+
handler(result, path64);
|
|
38885
38956
|
}
|
|
38886
38957
|
if (raw !== "##" && raw !== "!!") {
|
|
38887
|
-
result.files.push(new FileStatusSummary(
|
|
38958
|
+
result.files.push(new FileStatusSummary(path64, index, workingDir));
|
|
38888
38959
|
}
|
|
38889
38960
|
}
|
|
38890
38961
|
}
|
|
@@ -39193,9 +39264,9 @@ var init_simple_git_api = __esm({
|
|
|
39193
39264
|
next
|
|
39194
39265
|
);
|
|
39195
39266
|
}
|
|
39196
|
-
hashObject(
|
|
39267
|
+
hashObject(path64, write2) {
|
|
39197
39268
|
return this._runTask(
|
|
39198
|
-
hashObjectTask(
|
|
39269
|
+
hashObjectTask(path64, write2 === true),
|
|
39199
39270
|
trailingFunctionArgument(arguments)
|
|
39200
39271
|
);
|
|
39201
39272
|
}
|
|
@@ -39548,8 +39619,8 @@ var init_branch = __esm({
|
|
|
39548
39619
|
}
|
|
39549
39620
|
});
|
|
39550
39621
|
function toPath(input) {
|
|
39551
|
-
const
|
|
39552
|
-
return
|
|
39622
|
+
const path64 = input.trim().replace(/^["']|["']$/g, "");
|
|
39623
|
+
return path64 && normalize(path64);
|
|
39553
39624
|
}
|
|
39554
39625
|
var parseCheckIgnore;
|
|
39555
39626
|
var init_CheckIgnore = __esm({
|
|
@@ -39863,8 +39934,8 @@ __export(sub_module_exports, {
|
|
|
39863
39934
|
subModuleTask: () => subModuleTask,
|
|
39864
39935
|
updateSubModuleTask: () => updateSubModuleTask
|
|
39865
39936
|
});
|
|
39866
|
-
function addSubModuleTask(repo,
|
|
39867
|
-
return subModuleTask(["add", repo,
|
|
39937
|
+
function addSubModuleTask(repo, path64) {
|
|
39938
|
+
return subModuleTask(["add", repo, path64]);
|
|
39868
39939
|
}
|
|
39869
39940
|
function initSubModuleTask(customArgs) {
|
|
39870
39941
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -40197,8 +40268,8 @@ var require_git = __commonJS2({
|
|
|
40197
40268
|
}
|
|
40198
40269
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
40199
40270
|
};
|
|
40200
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
40201
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
40271
|
+
Git2.prototype.submoduleAdd = function(repo, path64, then) {
|
|
40272
|
+
return this._runTask(addSubModuleTask2(repo, path64), trailingFunctionArgument2(arguments));
|
|
40202
40273
|
};
|
|
40203
40274
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
40204
40275
|
return this._runTask(
|
|
@@ -40808,7 +40879,7 @@ async function pathExists4(targetPath) {
|
|
|
40808
40879
|
}
|
|
40809
40880
|
}
|
|
40810
40881
|
async function ensureGitRepo(repoPath) {
|
|
40811
|
-
const gitDir =
|
|
40882
|
+
const gitDir = path25.join(repoPath, ".git");
|
|
40812
40883
|
await fs4.mkdir(repoPath, { recursive: true });
|
|
40813
40884
|
const git = simpleGit(repoPath);
|
|
40814
40885
|
let isWorkTree = false;
|
|
@@ -40866,7 +40937,7 @@ function describeGitFailure(err) {
|
|
|
40866
40937
|
return msg || "Git failed for an unknown reason.";
|
|
40867
40938
|
}
|
|
40868
40939
|
async function ensureTempoGitRepo(projectRoot) {
|
|
40869
|
-
const gitDir =
|
|
40940
|
+
const gitDir = path26.join(projectRoot, ".git");
|
|
40870
40941
|
const hadGit = await pathExists5(gitDir);
|
|
40871
40942
|
try {
|
|
40872
40943
|
await ensureGitRepo(projectRoot);
|
|
@@ -40884,8 +40955,8 @@ async function ensureTempoGitRepo(projectRoot) {
|
|
|
40884
40955
|
}
|
|
40885
40956
|
|
|
40886
40957
|
// ../tempo-project/ignores.ts
|
|
40887
|
-
import
|
|
40888
|
-
import { access as access7, lstat as lstat4, mkdir as mkdir8, readFile as
|
|
40958
|
+
import path27 from "path";
|
|
40959
|
+
import { access as access7, lstat as lstat4, mkdir as mkdir8, readFile as readFile18, writeFile as writeFile9 } from "fs/promises";
|
|
40889
40960
|
async function pathExists6(targetPath) {
|
|
40890
40961
|
try {
|
|
40891
40962
|
await access7(targetPath);
|
|
@@ -40904,17 +40975,17 @@ function getIgnorePrefix(config) {
|
|
|
40904
40975
|
return `${config.rootRel.replace(/^\.\//, "").replace(/\/+$/, "")}/`;
|
|
40905
40976
|
}
|
|
40906
40977
|
async function resolveGitDir(projectRoot) {
|
|
40907
|
-
const dotGit =
|
|
40978
|
+
const dotGit = path27.join(projectRoot, ".git");
|
|
40908
40979
|
try {
|
|
40909
40980
|
const stat11 = await lstat4(dotGit);
|
|
40910
40981
|
if (stat11.isDirectory()) {
|
|
40911
40982
|
return dotGit;
|
|
40912
40983
|
}
|
|
40913
|
-
const content = await
|
|
40984
|
+
const content = await readFile18(dotGit, "utf-8");
|
|
40914
40985
|
const match = content.match(/^gitdir:\s*(.+)$/m);
|
|
40915
40986
|
if (!match) return null;
|
|
40916
40987
|
const gitdir = match[1].trim();
|
|
40917
|
-
return
|
|
40988
|
+
return path27.isAbsolute(gitdir) ? gitdir : path27.resolve(projectRoot, gitdir);
|
|
40918
40989
|
} catch {
|
|
40919
40990
|
return null;
|
|
40920
40991
|
}
|
|
@@ -40962,10 +41033,10 @@ var TEMPO_FOLDER_GITIGNORE_ENTRIES = [
|
|
|
40962
41033
|
".DS_Store"
|
|
40963
41034
|
];
|
|
40964
41035
|
function getTempoFolderGitignorePath(config) {
|
|
40965
|
-
return
|
|
41036
|
+
return path27.join(config.tempoRoot, ".gitignore");
|
|
40966
41037
|
}
|
|
40967
41038
|
async function ensureTextFileEntries(filePath, entriesToEnsure) {
|
|
40968
|
-
const existingRaw = await pathExists6(filePath) ? await
|
|
41039
|
+
const existingRaw = await pathExists6(filePath) ? await readFile18(filePath, "utf-8") : "";
|
|
40969
41040
|
const existingEntries = existingRaw.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
40970
41041
|
const existingSet = new Set(existingEntries);
|
|
40971
41042
|
let changed = false;
|
|
@@ -40980,7 +41051,7 @@ async function ensureTextFileEntries(filePath, entriesToEnsure) {
|
|
|
40980
41051
|
if (!changed && await pathExists6(filePath)) {
|
|
40981
41052
|
return false;
|
|
40982
41053
|
}
|
|
40983
|
-
await mkdir8(
|
|
41054
|
+
await mkdir8(path27.dirname(filePath), { recursive: true });
|
|
40984
41055
|
const body = existingEntries.length > 0 ? `${existingEntries.join("\n")}
|
|
40985
41056
|
` : "";
|
|
40986
41057
|
await writeFile9(filePath, body, "utf-8");
|
|
@@ -40988,12 +41059,12 @@ async function ensureTextFileEntries(filePath, entriesToEnsure) {
|
|
|
40988
41059
|
}
|
|
40989
41060
|
async function ensureTempoIgnoreEntries(config) {
|
|
40990
41061
|
const entries = getIgnoreEntries(config);
|
|
40991
|
-
const gitignorePath =
|
|
41062
|
+
const gitignorePath = path27.join(config.projectRoot, ".gitignore");
|
|
40992
41063
|
const updatedGitignore = await ensureTextFileEntries(gitignorePath, entries);
|
|
40993
41064
|
let updatedGitExclude = false;
|
|
40994
41065
|
const gitDir = await resolveGitDir(config.projectRoot);
|
|
40995
41066
|
if (gitDir) {
|
|
40996
|
-
const gitExcludePath =
|
|
41067
|
+
const gitExcludePath = path27.join(gitDir, "info", "exclude");
|
|
40997
41068
|
updatedGitExclude = await ensureTextFileEntries(gitExcludePath, entries);
|
|
40998
41069
|
}
|
|
40999
41070
|
const updatedTempoFolderGitignore = await ensureTextFileEntries(
|
|
@@ -41013,14 +41084,14 @@ import {
|
|
|
41013
41084
|
access as access8,
|
|
41014
41085
|
mkdir as mkdir9,
|
|
41015
41086
|
readdir as readdir7,
|
|
41016
|
-
readFile as
|
|
41087
|
+
readFile as readFile19,
|
|
41017
41088
|
rename as rename4,
|
|
41018
41089
|
stat as stat5,
|
|
41019
41090
|
unlink as unlink2,
|
|
41020
41091
|
writeFile as writeFile10
|
|
41021
41092
|
} from "fs/promises";
|
|
41022
41093
|
import { createRequire as createRequire4 } from "module";
|
|
41023
|
-
import
|
|
41094
|
+
import path28 from "path";
|
|
41024
41095
|
|
|
41025
41096
|
// ../tempo-project/ui-framework.ts
|
|
41026
41097
|
function resolveAppUiFramework(configured) {
|
|
@@ -41089,7 +41160,7 @@ var REQUIRED_SCRIPTS = {
|
|
|
41089
41160
|
build: "vite build",
|
|
41090
41161
|
preview: "vite preview --host 127.0.0.1"
|
|
41091
41162
|
};
|
|
41092
|
-
var TEMPO_WORKSPACE_NONCE_RELATIVE_PATH =
|
|
41163
|
+
var TEMPO_WORKSPACE_NONCE_RELATIVE_PATH = path28.join(
|
|
41093
41164
|
".tempo",
|
|
41094
41165
|
"workspace-nonce"
|
|
41095
41166
|
);
|
|
@@ -41317,8 +41388,8 @@ function buildExpoAppJson(config) {
|
|
|
41317
41388
|
return `${JSON.stringify(
|
|
41318
41389
|
{
|
|
41319
41390
|
expo: {
|
|
41320
|
-
name: `${
|
|
41321
|
-
slug: sanitizePackageName(`${
|
|
41391
|
+
name: `${path28.basename(config.projectRoot)} Tempo`,
|
|
41392
|
+
slug: sanitizePackageName(`${path28.basename(config.projectRoot)}-tempo`),
|
|
41322
41393
|
platforms: ["web"],
|
|
41323
41394
|
web: {
|
|
41324
41395
|
bundler: "metro"
|
|
@@ -41681,7 +41752,7 @@ async function shouldImportExpoMetroRuntime(config) {
|
|
|
41681
41752
|
}
|
|
41682
41753
|
for (const fromDir of [config.tempoRoot, config.projectRoot]) {
|
|
41683
41754
|
const requireFromProject = createRequire4(
|
|
41684
|
-
|
|
41755
|
+
path28.join(fromDir, "__tempo_expo_runtime_resolve__.cjs")
|
|
41685
41756
|
);
|
|
41686
41757
|
try {
|
|
41687
41758
|
requireFromProject.resolve("@expo/metro-runtime");
|
|
@@ -41692,7 +41763,7 @@ async function shouldImportExpoMetroRuntime(config) {
|
|
|
41692
41763
|
return false;
|
|
41693
41764
|
}
|
|
41694
41765
|
async function collectExpoWebShims(config) {
|
|
41695
|
-
const shimDir =
|
|
41766
|
+
const shimDir = path28.join(config.projectRoot, "web-shims");
|
|
41696
41767
|
let entries;
|
|
41697
41768
|
try {
|
|
41698
41769
|
entries = await readdir7(shimDir, { withFileTypes: true });
|
|
@@ -41709,7 +41780,7 @@ async function collectExpoWebShims(config) {
|
|
|
41709
41780
|
module: moduleName,
|
|
41710
41781
|
targetRelToTempo: `${toPosixRelativePath(
|
|
41711
41782
|
config.tempoRoot,
|
|
41712
|
-
|
|
41783
|
+
path28.join(shimDir, entry.name)
|
|
41713
41784
|
)}`
|
|
41714
41785
|
});
|
|
41715
41786
|
}
|
|
@@ -41820,7 +41891,7 @@ var NEXT_TAILWIND_V3_POSTCSS_CONFIG_MJS = `export default {
|
|
|
41820
41891
|
`;
|
|
41821
41892
|
async function readTextFileOptional2(filePath) {
|
|
41822
41893
|
try {
|
|
41823
|
-
return await
|
|
41894
|
+
return await readFile19(filePath, "utf-8");
|
|
41824
41895
|
} catch (error) {
|
|
41825
41896
|
if (error.code === "ENOENT") {
|
|
41826
41897
|
return null;
|
|
@@ -41829,8 +41900,8 @@ async function readTextFileOptional2(filePath) {
|
|
|
41829
41900
|
}
|
|
41830
41901
|
}
|
|
41831
41902
|
async function ensureTempoWorkspaceNonce(tempoRoot) {
|
|
41832
|
-
const noncePath =
|
|
41833
|
-
await mkdir9(
|
|
41903
|
+
const noncePath = path28.join(tempoRoot, TEMPO_WORKSPACE_NONCE_RELATIVE_PATH);
|
|
41904
|
+
await mkdir9(path28.dirname(noncePath), { recursive: true });
|
|
41834
41905
|
const existing = (await readTextFileOptional2(noncePath))?.trim();
|
|
41835
41906
|
if (existing) return existing;
|
|
41836
41907
|
const nonce = randomUUID4();
|
|
@@ -41908,8 +41979,8 @@ async function pathIsDirectory(targetPath) {
|
|
|
41908
41979
|
}
|
|
41909
41980
|
}
|
|
41910
41981
|
function isInsidePath(parentPath, childPath) {
|
|
41911
|
-
const relativePath =
|
|
41912
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
41982
|
+
const relativePath = path28.relative(parentPath, childPath);
|
|
41983
|
+
return relativePath === "" || !relativePath.startsWith("..") && !path28.isAbsolute(relativePath);
|
|
41913
41984
|
}
|
|
41914
41985
|
function cleanLocalSpecifier(specifier) {
|
|
41915
41986
|
const trimmed2 = specifier.trim();
|
|
@@ -41922,19 +41993,19 @@ function resolveDeclaredProjectPath(projectRoot, specifier) {
|
|
|
41922
41993
|
const clean = cleanLocalSpecifier(specifier);
|
|
41923
41994
|
if (!clean) return null;
|
|
41924
41995
|
if (clean.startsWith("/")) {
|
|
41925
|
-
return
|
|
41996
|
+
return path28.resolve(projectRoot, clean.slice(1));
|
|
41926
41997
|
}
|
|
41927
41998
|
if (clean.startsWith("./") || clean.startsWith("../")) {
|
|
41928
|
-
return
|
|
41999
|
+
return path28.resolve(projectRoot, clean);
|
|
41929
42000
|
}
|
|
41930
42001
|
if (clean.startsWith("@/")) {
|
|
41931
|
-
return
|
|
42002
|
+
return path28.resolve(projectRoot, "src", clean.slice(2));
|
|
41932
42003
|
}
|
|
41933
42004
|
if (clean.startsWith("~/")) {
|
|
41934
|
-
return
|
|
42005
|
+
return path28.resolve(projectRoot, clean.slice(2));
|
|
41935
42006
|
}
|
|
41936
42007
|
if (/^(?:src|app|styles|components|packages|lib|pages)\//.test(clean)) {
|
|
41937
|
-
return
|
|
42008
|
+
return path28.resolve(projectRoot, clean);
|
|
41938
42009
|
}
|
|
41939
42010
|
return null;
|
|
41940
42011
|
}
|
|
@@ -41942,18 +42013,18 @@ function resolveImportCandidates(projectRoot, importerPath, specifier) {
|
|
|
41942
42013
|
const clean = cleanLocalSpecifier(specifier);
|
|
41943
42014
|
if (!clean) return [];
|
|
41944
42015
|
if (clean.startsWith("./") || clean.startsWith("../")) {
|
|
41945
|
-
return [
|
|
42016
|
+
return [path28.resolve(path28.dirname(importerPath), clean)];
|
|
41946
42017
|
}
|
|
41947
42018
|
if (clean.startsWith("/")) {
|
|
41948
|
-
return [
|
|
42019
|
+
return [path28.resolve(projectRoot, clean.slice(1))];
|
|
41949
42020
|
}
|
|
41950
42021
|
if (clean.startsWith("@/")) {
|
|
41951
|
-
const rootRelative =
|
|
41952
|
-
const srcRelative =
|
|
42022
|
+
const rootRelative = path28.resolve(projectRoot, clean.slice(2));
|
|
42023
|
+
const srcRelative = path28.resolve(projectRoot, "src", clean.slice(2));
|
|
41953
42024
|
return [srcRelative, rootRelative];
|
|
41954
42025
|
}
|
|
41955
42026
|
if (clean.startsWith("~/")) {
|
|
41956
|
-
return [
|
|
42027
|
+
return [path28.resolve(projectRoot, clean.slice(2))];
|
|
41957
42028
|
}
|
|
41958
42029
|
return [];
|
|
41959
42030
|
}
|
|
@@ -42105,14 +42176,14 @@ function inferTailwindMajorVersion(options) {
|
|
|
42105
42176
|
}
|
|
42106
42177
|
async function addExistingUserFile(set, config, filePath) {
|
|
42107
42178
|
if (!filePath) return;
|
|
42108
|
-
const normalized =
|
|
42179
|
+
const normalized = path28.resolve(filePath);
|
|
42109
42180
|
if (!isInsidePath(config.projectRoot, normalized)) return;
|
|
42110
42181
|
if (isInsidePath(config.tempoRoot, normalized)) return;
|
|
42111
42182
|
if (!await pathIsFile(normalized)) return;
|
|
42112
42183
|
set.add(normalized);
|
|
42113
42184
|
}
|
|
42114
42185
|
async function addExistingUserDirectory(set, config, dirPath) {
|
|
42115
|
-
const normalized =
|
|
42186
|
+
const normalized = path28.resolve(dirPath);
|
|
42116
42187
|
if (!isInsidePath(config.projectRoot, normalized)) return;
|
|
42117
42188
|
if (isInsidePath(config.tempoRoot, normalized)) return;
|
|
42118
42189
|
if (!await pathIsDirectory(normalized)) return;
|
|
@@ -42153,7 +42224,7 @@ async function collectNextLayoutFiles(projectRoot) {
|
|
|
42153
42224
|
"src/app/layout.jsx",
|
|
42154
42225
|
"src/app/layout.ts",
|
|
42155
42226
|
"src/app/layout.js"
|
|
42156
|
-
].map((relativePath) =>
|
|
42227
|
+
].map((relativePath) => path28.join(projectRoot, relativePath));
|
|
42157
42228
|
const result = /* @__PURE__ */ new Set();
|
|
42158
42229
|
for (const candidate of exactCandidates) {
|
|
42159
42230
|
if (await pathIsFile(candidate)) {
|
|
@@ -42161,8 +42232,8 @@ async function collectNextLayoutFiles(projectRoot) {
|
|
|
42161
42232
|
}
|
|
42162
42233
|
}
|
|
42163
42234
|
for (const root of [
|
|
42164
|
-
|
|
42165
|
-
|
|
42235
|
+
path28.join(projectRoot, "app"),
|
|
42236
|
+
path28.join(projectRoot, "src", "app")
|
|
42166
42237
|
]) {
|
|
42167
42238
|
await collectNamedFiles(root, /^layout\.(?:tsx|jsx|ts|js)$/, 3, result);
|
|
42168
42239
|
}
|
|
@@ -42177,7 +42248,7 @@ async function collectNamedFiles(dirPath, fileNamePattern, maxDepth, result) {
|
|
|
42177
42248
|
return;
|
|
42178
42249
|
}
|
|
42179
42250
|
for (const entry of entries) {
|
|
42180
|
-
const entryPath =
|
|
42251
|
+
const entryPath = path28.join(dirPath, entry.name);
|
|
42181
42252
|
if (entry.isFile() && fileNamePattern.test(entry.name)) {
|
|
42182
42253
|
result.add(entryPath);
|
|
42183
42254
|
} else if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules" && entry.name !== ".next") {
|
|
@@ -42189,13 +42260,13 @@ async function discoverProjectStyleContext(config, framework) {
|
|
|
42189
42260
|
const cssFiles = /* @__PURE__ */ new Set();
|
|
42190
42261
|
const tailwindConfigCandidates = /* @__PURE__ */ new Set();
|
|
42191
42262
|
const projectPackageVersions = readPackageDependencyVersions(
|
|
42192
|
-
await readJsonObjectOptional(
|
|
42263
|
+
await readJsonObjectOptional(path28.join(config.projectRoot, "package.json"))
|
|
42193
42264
|
);
|
|
42194
42265
|
const tempoPackageVersions = readPackageDependencyVersions(
|
|
42195
42266
|
await readJsonObjectOptional(config.packageJsonPath)
|
|
42196
42267
|
);
|
|
42197
42268
|
const componentsJson = await readJsonObjectOptional(
|
|
42198
|
-
|
|
42269
|
+
path28.join(config.projectRoot, "components.json")
|
|
42199
42270
|
);
|
|
42200
42271
|
const declaredCssPath = getNestedString(componentsJson, ["tailwind", "css"]);
|
|
42201
42272
|
const declaredConfigPath = getNestedString(componentsJson, [
|
|
@@ -42231,7 +42302,7 @@ async function discoverProjectStyleContext(config, framework) {
|
|
|
42231
42302
|
await addCssImportsFromSourceFile(
|
|
42232
42303
|
cssFiles,
|
|
42233
42304
|
config,
|
|
42234
|
-
|
|
42305
|
+
path28.join(config.projectRoot, appPath)
|
|
42235
42306
|
);
|
|
42236
42307
|
}
|
|
42237
42308
|
} else {
|
|
@@ -42256,36 +42327,36 @@ async function discoverProjectStyleContext(config, framework) {
|
|
|
42256
42327
|
await addCssImportsFromSourceFile(
|
|
42257
42328
|
cssFiles,
|
|
42258
42329
|
config,
|
|
42259
|
-
|
|
42330
|
+
path28.join(config.projectRoot, entryPath)
|
|
42260
42331
|
);
|
|
42261
42332
|
}
|
|
42262
42333
|
await addCssLinksFromHtmlFile(
|
|
42263
42334
|
cssFiles,
|
|
42264
42335
|
config,
|
|
42265
|
-
|
|
42336
|
+
path28.join(config.projectRoot, "index.html")
|
|
42266
42337
|
);
|
|
42267
42338
|
await addCssLinksFromHtmlFile(
|
|
42268
42339
|
cssFiles,
|
|
42269
42340
|
config,
|
|
42270
|
-
|
|
42341
|
+
path28.join(config.projectRoot, "client", "index.html")
|
|
42271
42342
|
);
|
|
42272
42343
|
}
|
|
42273
42344
|
for (const candidate of COMMON_CSS_CANDIDATES) {
|
|
42274
42345
|
await addExistingUserFile(
|
|
42275
42346
|
cssFiles,
|
|
42276
42347
|
config,
|
|
42277
|
-
|
|
42348
|
+
path28.join(config.projectRoot, candidate)
|
|
42278
42349
|
);
|
|
42279
42350
|
}
|
|
42280
42351
|
for (const candidate of TAILWIND_CONFIG_CANDIDATES) {
|
|
42281
|
-
tailwindConfigCandidates.add(
|
|
42352
|
+
tailwindConfigCandidates.add(path28.join(config.projectRoot, candidate));
|
|
42282
42353
|
}
|
|
42283
42354
|
const sourceDirs = /* @__PURE__ */ new Set();
|
|
42284
42355
|
for (const candidate of COMMON_SOURCE_DIR_CANDIDATES) {
|
|
42285
42356
|
await addExistingUserDirectory(
|
|
42286
42357
|
sourceDirs,
|
|
42287
42358
|
config,
|
|
42288
|
-
|
|
42359
|
+
path28.join(config.projectRoot, candidate)
|
|
42289
42360
|
);
|
|
42290
42361
|
}
|
|
42291
42362
|
sourceDirs.add(config.pagesDir);
|
|
@@ -42332,7 +42403,7 @@ async function discoverNextFontSetup(config, layoutFiles) {
|
|
|
42332
42403
|
const setup = extractNextFontSetup(
|
|
42333
42404
|
source,
|
|
42334
42405
|
layoutPath,
|
|
42335
|
-
|
|
42406
|
+
path28.join(config.tempoRoot, "app", "layout.tsx")
|
|
42336
42407
|
);
|
|
42337
42408
|
if (setup) return setup;
|
|
42338
42409
|
}
|
|
@@ -42373,8 +42444,8 @@ function extractNextFontSetup(source, sourceLayoutPath, targetLayoutPath) {
|
|
|
42373
42444
|
declarations.push(
|
|
42374
42445
|
rewriteLocalFontPaths(
|
|
42375
42446
|
declaration,
|
|
42376
|
-
|
|
42377
|
-
|
|
42447
|
+
path28.dirname(sourceLayoutPath),
|
|
42448
|
+
path28.dirname(targetLayoutPath)
|
|
42378
42449
|
)
|
|
42379
42450
|
);
|
|
42380
42451
|
}
|
|
@@ -42445,7 +42516,7 @@ function rewriteLocalFontPaths(declaration, sourceDir, targetDir) {
|
|
|
42445
42516
|
return declaration.replace(
|
|
42446
42517
|
/(\b(?:src|path)\s*:\s*)(["'])(\.{1,2}\/[^"']+)\2/g,
|
|
42447
42518
|
(_match, prefix, quote, relativeFontPath) => {
|
|
42448
|
-
const absoluteFontPath =
|
|
42519
|
+
const absoluteFontPath = path28.resolve(sourceDir, relativeFontPath);
|
|
42449
42520
|
return `${prefix}${quote}${toCssRelativePath(
|
|
42450
42521
|
targetDir,
|
|
42451
42522
|
absoluteFontPath
|
|
@@ -42589,7 +42660,7 @@ ${userCss}
|
|
|
42589
42660
|
}
|
|
42590
42661
|
}
|
|
42591
42662
|
async function reconcileLegacyTempoIndexCss(tempoRoot) {
|
|
42592
|
-
const indexCssPath =
|
|
42663
|
+
const indexCssPath = path28.join(tempoRoot, "index.css");
|
|
42593
42664
|
const current = await readTextFileOptional2(indexCssPath);
|
|
42594
42665
|
if (current === null) return;
|
|
42595
42666
|
const userCss = extractUserCssOutsideTempoBlock(current, "");
|
|
@@ -42600,7 +42671,7 @@ async function reconcileLegacyTempoIndexCss(tempoRoot) {
|
|
|
42600
42671
|
}
|
|
42601
42672
|
}
|
|
42602
42673
|
async function ensureNextLayoutFile(config, styleContext) {
|
|
42603
|
-
const layoutPath =
|
|
42674
|
+
const layoutPath = path28.join(config.tempoRoot, "app", "layout.tsx");
|
|
42604
42675
|
const desired = buildNextLayoutTsx(styleContext.nextFontSetup);
|
|
42605
42676
|
const current = await readTextFileOptional2(layoutPath);
|
|
42606
42677
|
if (current === null || isTempoGeneratedNextLayout(current)) {
|
|
@@ -42699,7 +42770,7 @@ function buildTailwindV3HostConfig(config, styleContext) {
|
|
|
42699
42770
|
);
|
|
42700
42771
|
const userConfigDirFromTempo = toPosixRelativePath(
|
|
42701
42772
|
config.tempoRoot,
|
|
42702
|
-
|
|
42773
|
+
path28.dirname(styleContext.tailwindConfigPath)
|
|
42703
42774
|
);
|
|
42704
42775
|
return `${TAILWIND_V3_HOST_CONFIG_MARKER}
|
|
42705
42776
|
import type { Config } from "tailwindcss";
|
|
@@ -42751,26 +42822,26 @@ export default config;
|
|
|
42751
42822
|
async function seedHomeCanvas(config) {
|
|
42752
42823
|
const freeformDir = await resolveFreeformCanvasesDir(config.pagesDir);
|
|
42753
42824
|
await writeFileIfMissing(
|
|
42754
|
-
|
|
42825
|
+
path28.join(freeformDir, "home", "index.canvas.tsx"),
|
|
42755
42826
|
TEMPLATE_HOME_CANVAS_INDEX_TSX
|
|
42756
42827
|
);
|
|
42757
42828
|
}
|
|
42758
42829
|
async function seedZoneDirectories(config) {
|
|
42759
42830
|
const freeformDir = await resolveFreeformCanvasesDir(config.pagesDir);
|
|
42760
|
-
if (
|
|
42831
|
+
if (path28.resolve(freeformDir) === path28.resolve(config.pagesDir)) {
|
|
42761
42832
|
return;
|
|
42762
42833
|
}
|
|
42763
42834
|
await mkdir9(freeformDir, { recursive: true });
|
|
42764
|
-
await mkdir9(
|
|
42835
|
+
await mkdir9(path28.join(config.pagesDir, DESIGN_SYSTEM_ZONE_DIR), {
|
|
42765
42836
|
recursive: true
|
|
42766
42837
|
});
|
|
42767
|
-
await mkdir9(
|
|
42838
|
+
await mkdir9(path28.join(config.pagesDir, LIBRARIES_ZONE_DIR), {
|
|
42768
42839
|
recursive: true
|
|
42769
42840
|
});
|
|
42770
42841
|
}
|
|
42771
42842
|
async function seedSharedControls(config) {
|
|
42772
42843
|
await writeFileIfMissing(
|
|
42773
|
-
|
|
42844
|
+
path28.join(config.tempoRoot, "controls.ts"),
|
|
42774
42845
|
`// Optional controls for existing components whose source should stay untouched.
|
|
42775
42846
|
// New components always keep defineControls in their own file.
|
|
42776
42847
|
// For existing components, honor the user/repo preference; fully integrated apps
|
|
@@ -42795,7 +42866,7 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42795
42866
|
const metroRuntime = await shouldImportExpoMetroRuntime(config);
|
|
42796
42867
|
const webShims = await collectExpoWebShims(config);
|
|
42797
42868
|
await reconcileGeneratedTextFile(
|
|
42798
|
-
|
|
42869
|
+
path28.join(config.tempoRoot, "index.js"),
|
|
42799
42870
|
buildExpoIndexJs({
|
|
42800
42871
|
nativewind: styleTooling.nativewind,
|
|
42801
42872
|
metroRuntime
|
|
@@ -42804,35 +42875,35 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42804
42875
|
);
|
|
42805
42876
|
if (styleTooling.nativewind) {
|
|
42806
42877
|
await reconcileGeneratedTextFile(
|
|
42807
|
-
|
|
42878
|
+
path28.join(config.tempoRoot, "tailwind.config.js"),
|
|
42808
42879
|
buildExpoNativeWindTailwindConfig(config),
|
|
42809
42880
|
isTempoOwnedExpoTailwindConfig
|
|
42810
42881
|
);
|
|
42811
42882
|
await writeFileIfMissing(
|
|
42812
|
-
|
|
42883
|
+
path28.join(config.tempoRoot, "global.css"),
|
|
42813
42884
|
EXPO_NATIVEWIND_GLOBAL_CSS
|
|
42814
42885
|
);
|
|
42815
42886
|
}
|
|
42816
42887
|
await reconcileGeneratedTextFile(
|
|
42817
|
-
|
|
42888
|
+
path28.join(config.tempoRoot, "App.tsx"),
|
|
42818
42889
|
EXPO_APP_TSX,
|
|
42819
42890
|
isOverwriteableExpoAppTsx
|
|
42820
42891
|
);
|
|
42821
42892
|
await writeFileIfMissing(
|
|
42822
|
-
|
|
42893
|
+
path28.join(config.tempoRoot, "public", "index.html"),
|
|
42823
42894
|
buildExpoPublicIndexHtml(config)
|
|
42824
42895
|
);
|
|
42825
42896
|
await writeFileIfMissing(
|
|
42826
|
-
|
|
42897
|
+
path28.join(config.tempoRoot, "app.json"),
|
|
42827
42898
|
buildExpoAppJson(config)
|
|
42828
42899
|
);
|
|
42829
42900
|
await reconcileGeneratedTextFile(
|
|
42830
|
-
|
|
42901
|
+
path28.join(config.tempoRoot, "babel.config.js"),
|
|
42831
42902
|
buildExpoBabelConfig({ nativewind: styleTooling.nativewind }),
|
|
42832
42903
|
isTempoOwnedExpoBabelConfig
|
|
42833
42904
|
);
|
|
42834
42905
|
await reconcileGeneratedTextFile(
|
|
42835
|
-
|
|
42906
|
+
path28.join(config.tempoRoot, "metro.config.js"),
|
|
42836
42907
|
buildExpoMetroConfig(metroAliases, {
|
|
42837
42908
|
nativewind: styleTooling.nativewind,
|
|
42838
42909
|
svgTransformer: styleTooling.svgTransformer,
|
|
@@ -42841,16 +42912,16 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42841
42912
|
isTempoOwnedExpoMetroConfig
|
|
42842
42913
|
);
|
|
42843
42914
|
await reconcileGeneratedTsconfig(
|
|
42844
|
-
|
|
42915
|
+
path28.join(config.tempoRoot, "tsconfig.json"),
|
|
42845
42916
|
buildExpoTsconfigFile(config, aliasPaths),
|
|
42846
42917
|
isTempoOwnedExpoTsconfig
|
|
42847
42918
|
);
|
|
42848
42919
|
await writeFileIfMissing(
|
|
42849
|
-
|
|
42920
|
+
path28.join(config.tempoRoot, "expo-env.d.ts"),
|
|
42850
42921
|
'/// <reference types="expo/types" />\n'
|
|
42851
42922
|
);
|
|
42852
42923
|
await writeFileIfMissing(
|
|
42853
|
-
|
|
42924
|
+
path28.join(config.tempoRoot, ".tempo-storybook-stub.js"),
|
|
42854
42925
|
EXPO_STORYBOOK_STUB
|
|
42855
42926
|
);
|
|
42856
42927
|
return;
|
|
@@ -42859,18 +42930,18 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42859
42930
|
if (framework === "nextjs") {
|
|
42860
42931
|
await ensureNextLayoutFile(config, styleContext);
|
|
42861
42932
|
await writeFileIfMissing(
|
|
42862
|
-
|
|
42933
|
+
path28.join(config.tempoRoot, "app", "page.tsx"),
|
|
42863
42934
|
NEXT_PAGE_TSX
|
|
42864
42935
|
);
|
|
42865
42936
|
await writeFileIfMissing(
|
|
42866
|
-
|
|
42937
|
+
path28.join(config.tempoRoot, "app", "tempo-host", "page.tsx"),
|
|
42867
42938
|
NEXT_TEMPO_HOST_PAGE_TSX
|
|
42868
42939
|
);
|
|
42869
42940
|
await writeFileIfMissing(
|
|
42870
|
-
|
|
42941
|
+
path28.join(config.tempoRoot, "app", "%5F%5Ftempo", "identity", "route.ts"),
|
|
42871
42942
|
NEXT_TEMPO_IDENTITY_ROUTE_TS
|
|
42872
42943
|
);
|
|
42873
|
-
const legacyIdentityRoutePath =
|
|
42944
|
+
const legacyIdentityRoutePath = path28.join(
|
|
42874
42945
|
config.tempoRoot,
|
|
42875
42946
|
"app",
|
|
42876
42947
|
"tempo-host",
|
|
@@ -42881,24 +42952,24 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42881
42952
|
await unlink2(legacyIdentityRoutePath);
|
|
42882
42953
|
}
|
|
42883
42954
|
await writeManagedTempoGlobalsCss(
|
|
42884
|
-
|
|
42885
|
-
buildTempoGlobalsCss(
|
|
42955
|
+
path28.join(config.tempoRoot, "app", "globals.css"),
|
|
42956
|
+
buildTempoGlobalsCss(path28.join(config.tempoRoot, "app"), styleContext)
|
|
42886
42957
|
);
|
|
42887
42958
|
return;
|
|
42888
42959
|
}
|
|
42889
42960
|
await writeFileIfMissing(
|
|
42890
|
-
|
|
42961
|
+
path28.join(config.tempoRoot, "index.html"),
|
|
42891
42962
|
TEMPO_INDEX_HTML
|
|
42892
42963
|
);
|
|
42893
42964
|
await writeFileIfMissing(
|
|
42894
|
-
|
|
42965
|
+
path28.join(config.tempoRoot, "main.tsx"),
|
|
42895
42966
|
TEMPO_MAIN_TSX
|
|
42896
42967
|
);
|
|
42897
42968
|
await ensureViteMainImportsGlobalsCss(
|
|
42898
|
-
|
|
42969
|
+
path28.join(config.tempoRoot, "main.tsx")
|
|
42899
42970
|
);
|
|
42900
42971
|
await writeManagedTempoGlobalsCss(
|
|
42901
|
-
|
|
42972
|
+
path28.join(config.tempoRoot, "globals.css"),
|
|
42902
42973
|
buildTempoGlobalsCss(config.tempoRoot, styleContext)
|
|
42903
42974
|
);
|
|
42904
42975
|
await reconcileLegacyTempoIndexCss(config.tempoRoot);
|
|
@@ -42926,7 +42997,7 @@ function collectDependencyNames(pkg) {
|
|
|
42926
42997
|
return names;
|
|
42927
42998
|
}
|
|
42928
42999
|
async function isAppPackageDir(dir) {
|
|
42929
|
-
const pkg = await readJsonObjectOptional(
|
|
43000
|
+
const pkg = await readJsonObjectOptional(path28.join(dir, "package.json"));
|
|
42930
43001
|
if (!pkg) return false;
|
|
42931
43002
|
const deps = collectDependencyNames(pkg);
|
|
42932
43003
|
return APP_FRAMEWORK_DEPS.some((name) => deps.has(name));
|
|
@@ -42938,20 +43009,20 @@ async function findAppPackageSubdirs(config) {
|
|
|
42938
43009
|
} catch {
|
|
42939
43010
|
return [];
|
|
42940
43011
|
}
|
|
42941
|
-
const resolvedTempoRoot =
|
|
43012
|
+
const resolvedTempoRoot = path28.resolve(config.tempoRoot);
|
|
42942
43013
|
const found = [];
|
|
42943
43014
|
for (const entry of entries) {
|
|
42944
43015
|
if (!entry.isDirectory()) continue;
|
|
42945
43016
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
|
|
42946
|
-
const subdir =
|
|
42947
|
-
if (
|
|
43017
|
+
const subdir = path28.join(config.projectRoot, entry.name);
|
|
43018
|
+
if (path28.resolve(subdir) === resolvedTempoRoot) continue;
|
|
42948
43019
|
if (await isAppPackageDir(subdir)) found.push(subdir);
|
|
42949
43020
|
}
|
|
42950
43021
|
return found;
|
|
42951
43022
|
}
|
|
42952
43023
|
async function resolveAppRoot(config) {
|
|
42953
43024
|
if (config.appDir && config.appDir !== ".") {
|
|
42954
|
-
const explicit =
|
|
43025
|
+
const explicit = path28.resolve(config.projectRoot, config.appDir);
|
|
42955
43026
|
if (await pathIsDirectory(explicit)) {
|
|
42956
43027
|
return { appRoot: explicit, warning: null };
|
|
42957
43028
|
}
|
|
@@ -42970,7 +43041,7 @@ async function resolveAppRoot(config) {
|
|
|
42970
43041
|
if (candidates.length > 1) {
|
|
42971
43042
|
return {
|
|
42972
43043
|
appRoot: config.projectRoot,
|
|
42973
|
-
warning: `Found multiple app directories (${candidates.map((c) =>
|
|
43044
|
+
warning: `Found multiple app directories (${candidates.map((c) => path28.basename(c)).join(
|
|
42974
43045
|
", "
|
|
42975
43046
|
)}); set "appDir" in tempo.config.json to pick one. Using the project root.`
|
|
42976
43047
|
};
|
|
@@ -42992,7 +43063,7 @@ async function ensureProjectSetupFiles(config, framework = "vite", options = {})
|
|
|
42992
43063
|
);
|
|
42993
43064
|
}
|
|
42994
43065
|
for (const rootDir of /* @__PURE__ */ new Set([config.projectRoot, appRoot])) {
|
|
42995
|
-
const rootPackageJsonPath =
|
|
43066
|
+
const rootPackageJsonPath = path28.join(rootDir, "package.json");
|
|
42996
43067
|
const healed = await healUnsatisfiableTempoSdkPins(rootPackageJsonPath);
|
|
42997
43068
|
if (healed.length > 0) {
|
|
42998
43069
|
console.warn(
|
|
@@ -43012,14 +43083,14 @@ async function ensureProjectSetupFiles(config, framework = "vite", options = {})
|
|
|
43012
43083
|
createIfMissing: createPackageJsonIfMissing
|
|
43013
43084
|
});
|
|
43014
43085
|
await ensureNextTsconfigFile(appConfig);
|
|
43015
|
-
const hostNextConfigPath =
|
|
43086
|
+
const hostNextConfigPath = path28.join(config.tempoRoot, "next.config.mjs");
|
|
43016
43087
|
await writeFileIfMissing(
|
|
43017
43088
|
hostNextConfigPath,
|
|
43018
43089
|
buildNextConfigFile(await collectAppTranspilePackages(appConfig))
|
|
43019
43090
|
);
|
|
43020
43091
|
await healNextConfigTracingRoot(hostNextConfigPath);
|
|
43021
43092
|
await ensureNextPostcssConfigFile(
|
|
43022
|
-
|
|
43093
|
+
path28.join(config.tempoRoot, "postcss.config.mjs"),
|
|
43023
43094
|
styleContext
|
|
43024
43095
|
);
|
|
43025
43096
|
if (styleContext.tailwindMajor === 3) {
|
|
@@ -43047,7 +43118,7 @@ var SVELTE_CONFIG_BASENAMES = [
|
|
|
43047
43118
|
];
|
|
43048
43119
|
async function findSvelteConfigFile(appRoot) {
|
|
43049
43120
|
for (const basename3 of SVELTE_CONFIG_BASENAMES) {
|
|
43050
|
-
const candidate =
|
|
43121
|
+
const candidate = path28.join(appRoot, basename3);
|
|
43051
43122
|
if (await pathExists7(candidate)) return candidate;
|
|
43052
43123
|
}
|
|
43053
43124
|
return null;
|
|
@@ -43080,7 +43151,7 @@ export default {
|
|
|
43080
43151
|
};
|
|
43081
43152
|
`;
|
|
43082
43153
|
await atomicWriteText(
|
|
43083
|
-
|
|
43154
|
+
path28.join(config.tempoRoot, "svelte.config.mjs"),
|
|
43084
43155
|
desired
|
|
43085
43156
|
);
|
|
43086
43157
|
}
|
|
@@ -43096,10 +43167,10 @@ function isTempoOwnedTailwindV3HostConfig(source) {
|
|
|
43096
43167
|
return source.includes("Tempo-owned Tailwind v3 config for the canvas host");
|
|
43097
43168
|
}
|
|
43098
43169
|
async function ensureTailwindV3HostConfigFile(config, styleContext) {
|
|
43099
|
-
const targetPath =
|
|
43170
|
+
const targetPath = path28.join(config.tempoRoot, "tailwind.config.ts");
|
|
43100
43171
|
const desired = buildTailwindV3HostConfig(config, styleContext);
|
|
43101
43172
|
for (const basename3 of TAILWIND_V3_HOST_CONFIG_BASENAMES) {
|
|
43102
|
-
const existingPath =
|
|
43173
|
+
const existingPath = path28.join(config.tempoRoot, basename3);
|
|
43103
43174
|
const source = await readTextFileOptional2(existingPath);
|
|
43104
43175
|
if (source === null) continue;
|
|
43105
43176
|
if (existingPath === targetPath && isTempoOwnedTailwindV3HostConfig(source)) {
|
|
@@ -43371,7 +43442,7 @@ async function detectProjectFramework(config) {
|
|
|
43371
43442
|
return "vite";
|
|
43372
43443
|
}
|
|
43373
43444
|
async function readRootPackageDeps(dir) {
|
|
43374
|
-
const filePath =
|
|
43445
|
+
const filePath = path28.join(dir, "package.json");
|
|
43375
43446
|
const contents = await readTextFileOptional2(filePath);
|
|
43376
43447
|
if (!contents) return {};
|
|
43377
43448
|
let parsed;
|
|
@@ -43387,7 +43458,7 @@ async function readRootPackageDeps(dir) {
|
|
|
43387
43458
|
}
|
|
43388
43459
|
async function anyFileExists(dir, names) {
|
|
43389
43460
|
for (const name of names) {
|
|
43390
|
-
if (await pathExists7(
|
|
43461
|
+
if (await pathExists7(path28.join(dir, name))) return true;
|
|
43391
43462
|
}
|
|
43392
43463
|
return false;
|
|
43393
43464
|
}
|
|
@@ -43453,19 +43524,19 @@ async function healFrameworkMismatch(config, detectedFramework, options = {}) {
|
|
|
43453
43524
|
}
|
|
43454
43525
|
const ts7 = options.now ?? Date.now();
|
|
43455
43526
|
const backupDirName = `.tempo-backup-${previousFramework}-${ts7}`;
|
|
43456
|
-
const backupPath =
|
|
43527
|
+
const backupPath = path28.join(config.tempoRoot, backupDirName);
|
|
43457
43528
|
const filesToMove = [
|
|
43458
43529
|
...FRAMEWORK_DISTINCTIVE_FILES[previousFramework],
|
|
43459
43530
|
...HEAL_PACKAGE_FILES
|
|
43460
43531
|
];
|
|
43461
43532
|
let movedAny = false;
|
|
43462
43533
|
for (const name of filesToMove) {
|
|
43463
|
-
const from =
|
|
43534
|
+
const from = path28.join(config.tempoRoot, name);
|
|
43464
43535
|
if (!await pathExists7(from)) continue;
|
|
43465
43536
|
if (!movedAny) {
|
|
43466
43537
|
await mkdir9(backupPath, { recursive: true });
|
|
43467
43538
|
}
|
|
43468
|
-
await rename4(from,
|
|
43539
|
+
await rename4(from, path28.join(backupPath, name));
|
|
43469
43540
|
movedAny = true;
|
|
43470
43541
|
}
|
|
43471
43542
|
if (!movedAny) {
|
|
@@ -43502,7 +43573,7 @@ async function rescueWronglyBackedUpFiles(config) {
|
|
|
43502
43573
|
"tsconfig.json",
|
|
43503
43574
|
"globals.css"
|
|
43504
43575
|
]);
|
|
43505
|
-
const backupDir =
|
|
43576
|
+
const backupDir = path28.join(config.tempoRoot, topEntry.name);
|
|
43506
43577
|
let backupEntries;
|
|
43507
43578
|
try {
|
|
43508
43579
|
backupEntries = await readdir7(backupDir, { withFileTypes: true });
|
|
@@ -43511,10 +43582,10 @@ async function rescueWronglyBackedUpFiles(config) {
|
|
|
43511
43582
|
}
|
|
43512
43583
|
for (const fileEntry of backupEntries) {
|
|
43513
43584
|
if (expectedMoves.has(fileEntry.name)) continue;
|
|
43514
|
-
const restoreTarget =
|
|
43585
|
+
const restoreTarget = path28.join(config.tempoRoot, fileEntry.name);
|
|
43515
43586
|
if (await pathExists7(restoreTarget)) continue;
|
|
43516
43587
|
try {
|
|
43517
|
-
await rename4(
|
|
43588
|
+
await rename4(path28.join(backupDir, fileEntry.name), restoreTarget);
|
|
43518
43589
|
restored.push(fileEntry.name);
|
|
43519
43590
|
} catch {
|
|
43520
43591
|
}
|
|
@@ -43678,7 +43749,7 @@ function withUserReactMajorAdopted(managed, userReactVersions) {
|
|
|
43678
43749
|
function buildTempoOwnedPackage(currentContent, config, styleContext, userReactVersions = {}, userSvelteVersions = {}, uiFramework = "react") {
|
|
43679
43750
|
const parsedCurrent = currentContent ? parsePackageJson(config.packageJsonPath, currentContent) : {};
|
|
43680
43751
|
const projectName = sanitizePackageName(
|
|
43681
|
-
`${
|
|
43752
|
+
`${path28.basename(config.projectRoot)}-tempo`
|
|
43682
43753
|
);
|
|
43683
43754
|
const currentDevDependencies = toStringRecord(parsedCurrent.devDependencies);
|
|
43684
43755
|
const currentDependencies = toStringRecord(parsedCurrent.dependencies);
|
|
@@ -43756,7 +43827,7 @@ function withCompatibleVersionsPreserved(managed, current) {
|
|
|
43756
43827
|
function buildNextTempoOwnedPackage(currentContent, config, styleContext) {
|
|
43757
43828
|
const parsedCurrent = currentContent ? parsePackageJson(config.packageJsonPath, currentContent) : {};
|
|
43758
43829
|
const projectName = sanitizePackageName(
|
|
43759
|
-
`${
|
|
43830
|
+
`${path28.basename(config.projectRoot)}-tempo`
|
|
43760
43831
|
);
|
|
43761
43832
|
const currentScripts = toStringRecord(parsedCurrent.scripts);
|
|
43762
43833
|
const dependencies = toStringRecord(parsedCurrent.dependencies);
|
|
@@ -43800,7 +43871,7 @@ function buildNextTempoOwnedPackage(currentContent, config, styleContext) {
|
|
|
43800
43871
|
`;
|
|
43801
43872
|
}
|
|
43802
43873
|
async function readUserExpoVersions(projectRoot) {
|
|
43803
|
-
const rootPath =
|
|
43874
|
+
const rootPath = path28.join(projectRoot, "package.json");
|
|
43804
43875
|
const contents = await readTextFileOptional2(rootPath);
|
|
43805
43876
|
if (!contents) return {};
|
|
43806
43877
|
let parsed;
|
|
@@ -43820,7 +43891,7 @@ async function readUserExpoVersions(projectRoot) {
|
|
|
43820
43891
|
return out;
|
|
43821
43892
|
}
|
|
43822
43893
|
async function readUserReactVersions(projectRoot) {
|
|
43823
|
-
const rootPath =
|
|
43894
|
+
const rootPath = path28.join(projectRoot, "package.json");
|
|
43824
43895
|
const contents = await readTextFileOptional2(rootPath);
|
|
43825
43896
|
if (!contents) return {};
|
|
43826
43897
|
let parsed;
|
|
@@ -43840,7 +43911,7 @@ async function readUserReactVersions(projectRoot) {
|
|
|
43840
43911
|
return out;
|
|
43841
43912
|
}
|
|
43842
43913
|
async function readUserSvelteVersions(projectRoot) {
|
|
43843
|
-
const rootPath =
|
|
43914
|
+
const rootPath = path28.join(projectRoot, "package.json");
|
|
43844
43915
|
const contents = await readTextFileOptional2(rootPath);
|
|
43845
43916
|
if (!contents) return {};
|
|
43846
43917
|
let parsed;
|
|
@@ -43863,7 +43934,7 @@ async function readUserSvelteVersions(projectRoot) {
|
|
|
43863
43934
|
function buildExpoTempoOwnedPackage(currentContent, config, userExpoVersions = {}) {
|
|
43864
43935
|
const parsedCurrent = currentContent ? parsePackageJson(config.packageJsonPath, currentContent) : {};
|
|
43865
43936
|
const projectName = sanitizePackageName(
|
|
43866
|
-
`${
|
|
43937
|
+
`${path28.basename(config.projectRoot)}-tempo`
|
|
43867
43938
|
);
|
|
43868
43939
|
const currentScripts = toStringRecord(parsedCurrent.scripts);
|
|
43869
43940
|
const dependencies = toStringRecord(parsedCurrent.dependencies);
|
|
@@ -44005,12 +44076,12 @@ function normalizePathsRecord(raw) {
|
|
|
44005
44076
|
return out;
|
|
44006
44077
|
}
|
|
44007
44078
|
function resolveReferencePath(baseDir, refPath) {
|
|
44008
|
-
const resolved =
|
|
44009
|
-
return refPath.endsWith(".json") ? resolved :
|
|
44079
|
+
const resolved = path28.resolve(baseDir, refPath);
|
|
44080
|
+
return refPath.endsWith(".json") ? resolved : path28.join(resolved, "tsconfig.json");
|
|
44010
44081
|
}
|
|
44011
44082
|
async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
44012
44083
|
if (depth > 8) return null;
|
|
44013
|
-
const normalized =
|
|
44084
|
+
const normalized = path28.resolve(tsconfigPath);
|
|
44014
44085
|
if (seen.has(normalized)) return null;
|
|
44015
44086
|
seen.add(normalized);
|
|
44016
44087
|
const raw = await readTextFileOptional2(normalized);
|
|
@@ -44026,7 +44097,7 @@ async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
|
44026
44097
|
const paths = normalizePathsRecord(rawPaths);
|
|
44027
44098
|
if (Object.keys(paths).length > 0) {
|
|
44028
44099
|
const baseUrl = typeof compilerOptions?.baseUrl === "string" ? compilerOptions.baseUrl : ".";
|
|
44029
|
-
return { configDir:
|
|
44100
|
+
return { configDir: path28.dirname(normalized), baseUrl, paths };
|
|
44030
44101
|
}
|
|
44031
44102
|
}
|
|
44032
44103
|
const references = Array.isArray(obj.references) ? obj.references : [];
|
|
@@ -44035,7 +44106,7 @@ async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
|
44035
44106
|
const refPath = ref.path;
|
|
44036
44107
|
if (typeof refPath !== "string") continue;
|
|
44037
44108
|
const found = await readTsconfigPathsFrom(
|
|
44038
|
-
resolveReferencePath(
|
|
44109
|
+
resolveReferencePath(path28.dirname(normalized), refPath),
|
|
44039
44110
|
depth + 1,
|
|
44040
44111
|
seen
|
|
44041
44112
|
);
|
|
@@ -44044,7 +44115,7 @@ async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
|
44044
44115
|
const extendsEntries = Array.isArray(obj.extends) ? obj.extends : typeof obj.extends === "string" ? [obj.extends] : [];
|
|
44045
44116
|
for (const entry of [...extendsEntries].reverse()) {
|
|
44046
44117
|
if (typeof entry !== "string") continue;
|
|
44047
|
-
const extPath = resolveExtendsConfigPath(
|
|
44118
|
+
const extPath = resolveExtendsConfigPath(path28.dirname(normalized), entry);
|
|
44048
44119
|
if (extPath === null) continue;
|
|
44049
44120
|
const found = await readTsconfigPathsFrom(extPath, depth + 1, seen);
|
|
44050
44121
|
if (found) return found;
|
|
@@ -44053,10 +44124,10 @@ async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
|
44053
44124
|
}
|
|
44054
44125
|
function resolveExtendsConfigPath(fromDir, ext) {
|
|
44055
44126
|
if (ext.startsWith("./") || ext.startsWith("../")) {
|
|
44056
|
-
return ext.endsWith(".json") ?
|
|
44127
|
+
return ext.endsWith(".json") ? path28.resolve(fromDir, ext) : path28.resolve(fromDir, `${ext}.json`);
|
|
44057
44128
|
}
|
|
44058
44129
|
const requireFromConfig = createRequire4(
|
|
44059
|
-
|
|
44130
|
+
path28.join(fromDir, "__tempo_tsconfig_resolve__.cjs")
|
|
44060
44131
|
);
|
|
44061
44132
|
const candidates = ext.endsWith(".json") ? [ext] : [ext, `${ext}/tsconfig.json`];
|
|
44062
44133
|
for (const candidate of candidates) {
|
|
@@ -44069,12 +44140,12 @@ function resolveExtendsConfigPath(fromDir, ext) {
|
|
|
44069
44140
|
return null;
|
|
44070
44141
|
}
|
|
44071
44142
|
function rebaseAliasTarget(configDir, baseUrl, target, tempoRoot) {
|
|
44072
|
-
const absTarget =
|
|
44143
|
+
const absTarget = path28.resolve(configDir, baseUrl, target);
|
|
44073
44144
|
return toPosixRelativePath(tempoRoot, absTarget);
|
|
44074
44145
|
}
|
|
44075
44146
|
async function collectHostAliasPaths(config) {
|
|
44076
44147
|
for (const configName of ["tsconfig.json", "jsconfig.json"]) {
|
|
44077
|
-
const appConfigPath =
|
|
44148
|
+
const appConfigPath = path28.join(config.projectRoot, configName);
|
|
44078
44149
|
const appConfigRaw = await readTextFileOptional2(appConfigPath);
|
|
44079
44150
|
if (appConfigRaw === null) continue;
|
|
44080
44151
|
if (parseJsonc(appConfigRaw) === null) {
|
|
@@ -44190,7 +44261,7 @@ function buildNextTsconfigIncludes(config) {
|
|
|
44190
44261
|
];
|
|
44191
44262
|
const parentSrc = toPosixRelativePath(
|
|
44192
44263
|
config.tempoRoot,
|
|
44193
|
-
|
|
44264
|
+
path28.join(config.projectRoot, "src")
|
|
44194
44265
|
);
|
|
44195
44266
|
const pages = toPosixRelativePath(config.tempoRoot, config.pagesDir);
|
|
44196
44267
|
for (const includePath of [`${parentSrc}/**/*`, `${pages}/**/*`]) {
|
|
@@ -44261,7 +44332,7 @@ function buildExpoTsconfigFile(config, appAliasPaths = {}) {
|
|
|
44261
44332
|
...EXPO_HOST_TSCONFIG_INCLUDE_PREFIX,
|
|
44262
44333
|
toPosixRelativePath(
|
|
44263
44334
|
config.tempoRoot,
|
|
44264
|
-
|
|
44335
|
+
path28.join(config.projectRoot, "src")
|
|
44265
44336
|
) + "/**/*",
|
|
44266
44337
|
toPosixRelativePath(config.tempoRoot, config.pagesDir) + "/**/*"
|
|
44267
44338
|
];
|
|
@@ -44361,7 +44432,7 @@ var NEXT_CONFIG_FILENAMES = [
|
|
|
44361
44432
|
];
|
|
44362
44433
|
async function findNextConfigInDir(dir) {
|
|
44363
44434
|
for (const name of NEXT_CONFIG_FILENAMES) {
|
|
44364
|
-
const candidate =
|
|
44435
|
+
const candidate = path28.join(dir, name);
|
|
44365
44436
|
if (await pathIsFile(candidate)) return candidate;
|
|
44366
44437
|
}
|
|
44367
44438
|
return null;
|
|
@@ -44382,7 +44453,7 @@ async function collectAppTranspilePackages(config) {
|
|
|
44382
44453
|
return extractTranspilePackagesFromSource(source);
|
|
44383
44454
|
}
|
|
44384
44455
|
function toPosixRelativePath(from, to) {
|
|
44385
|
-
const relativePath =
|
|
44456
|
+
const relativePath = path28.relative(from, to);
|
|
44386
44457
|
if (relativePath === "") {
|
|
44387
44458
|
return ".";
|
|
44388
44459
|
}
|
|
@@ -44396,7 +44467,7 @@ function toCssRelativePath(from, to) {
|
|
|
44396
44467
|
return `./${relativePath}`;
|
|
44397
44468
|
}
|
|
44398
44469
|
function toRelativeAllowPath(config) {
|
|
44399
|
-
const relativePath =
|
|
44470
|
+
const relativePath = path28.relative(config.tempoRoot, config.projectRoot);
|
|
44400
44471
|
if (relativePath === "") {
|
|
44401
44472
|
return ".";
|
|
44402
44473
|
}
|
|
@@ -44539,7 +44610,7 @@ function sanitizePackageName(value) {
|
|
|
44539
44610
|
|
|
44540
44611
|
// ../tempo-project/migrate-legacy-layout.ts
|
|
44541
44612
|
import { access as access9, mkdir as mkdir10, rm as rm7 } from "fs/promises";
|
|
44542
|
-
import
|
|
44613
|
+
import path29 from "path";
|
|
44543
44614
|
var TEMPO_DIR_NAME3 = "tempo";
|
|
44544
44615
|
var TEMPO_CONFIG_FILE2 = "tempo.config.json";
|
|
44545
44616
|
var NO_MIGRATION_REPORT = {
|
|
@@ -44562,12 +44633,12 @@ async function writeCanonicalDefaultConfig(options) {
|
|
|
44562
44633
|
options.tempoRoot,
|
|
44563
44634
|
buildDefaultTempoConfig({ installScript })
|
|
44564
44635
|
);
|
|
44565
|
-
return
|
|
44636
|
+
return path29.join(options.tempoRoot, TEMPO_CONFIG_FILE2);
|
|
44566
44637
|
}
|
|
44567
44638
|
async function migrateLegacyRootLayout(projectRoot) {
|
|
44568
|
-
const resolvedRoot =
|
|
44569
|
-
const legacyConfigCandidate =
|
|
44570
|
-
const canonicalConfigCandidate =
|
|
44639
|
+
const resolvedRoot = path29.resolve(projectRoot);
|
|
44640
|
+
const legacyConfigCandidate = path29.join(resolvedRoot, TEMPO_CONFIG_FILE2);
|
|
44641
|
+
const canonicalConfigCandidate = path29.join(
|
|
44571
44642
|
resolvedRoot,
|
|
44572
44643
|
TEMPO_DIR_NAME3,
|
|
44573
44644
|
TEMPO_CONFIG_FILE2
|
|
@@ -44587,7 +44658,7 @@ async function migrateLegacyRootLayout(projectRoot) {
|
|
|
44587
44658
|
autoCleanedLegacyConfigPath: legacyConfigCandidate
|
|
44588
44659
|
};
|
|
44589
44660
|
}
|
|
44590
|
-
const tempoRoot =
|
|
44661
|
+
const tempoRoot = path29.join(resolvedRoot, TEMPO_DIR_NAME3);
|
|
44591
44662
|
await mkdir10(tempoRoot, { recursive: true });
|
|
44592
44663
|
const createdCanonicalConfigPath = await writeCanonicalDefaultConfig({
|
|
44593
44664
|
projectRoot: resolvedRoot,
|
|
@@ -44609,14 +44680,14 @@ async function migrateLegacyRootLayout(projectRoot) {
|
|
|
44609
44680
|
}
|
|
44610
44681
|
|
|
44611
44682
|
// ../tempo-project/mirror-user-canvas-deps.ts
|
|
44612
|
-
import { readFile as
|
|
44683
|
+
import { readFile as readFile20, realpath as realpath3 } from "fs/promises";
|
|
44613
44684
|
import { createRequire as createRequire5 } from "module";
|
|
44614
|
-
import
|
|
44685
|
+
import path30 from "path";
|
|
44615
44686
|
|
|
44616
44687
|
// ../tempo-project/install-app-dep-roots.ts
|
|
44617
44688
|
import { spawn as spawn6 } from "child_process";
|
|
44618
44689
|
import { access as access10 } from "fs/promises";
|
|
44619
|
-
import
|
|
44690
|
+
import path31 from "path";
|
|
44620
44691
|
var {
|
|
44621
44692
|
error: abortError,
|
|
44622
44693
|
throwIfAborted,
|
|
@@ -44624,13 +44695,13 @@ var {
|
|
|
44624
44695
|
} = abortableWait("Dependency installation was cancelled");
|
|
44625
44696
|
|
|
44626
44697
|
// ../tempo-project/tempo-project.ts
|
|
44627
|
-
import
|
|
44698
|
+
import path32 from "path";
|
|
44628
44699
|
|
|
44629
44700
|
// ../../modules/project-config/analyze.ts
|
|
44630
44701
|
import { relative as relative2 } from "path";
|
|
44631
44702
|
|
|
44632
44703
|
// ../../modules/project-config/discover.ts
|
|
44633
|
-
import { access as access12, readdir as readdir8, readFile as
|
|
44704
|
+
import { access as access12, readdir as readdir8, readFile as readFile22 } from "fs/promises";
|
|
44634
44705
|
import { basename as basename2, join as join6 } from "path";
|
|
44635
44706
|
|
|
44636
44707
|
// ../../modules/project-config/nextjs.ts
|
|
@@ -44647,17 +44718,17 @@ var APP_LAYOUT_CANDIDATES = [
|
|
|
44647
44718
|
"src/app/layout.js"
|
|
44648
44719
|
];
|
|
44649
44720
|
var PAGES_DIRECTORY_CANDIDATES = ["pages", "src/pages"];
|
|
44650
|
-
async function fileExists3(
|
|
44721
|
+
async function fileExists3(path64) {
|
|
44651
44722
|
try {
|
|
44652
|
-
await access11(
|
|
44723
|
+
await access11(path64);
|
|
44653
44724
|
return true;
|
|
44654
44725
|
} catch {
|
|
44655
44726
|
return false;
|
|
44656
44727
|
}
|
|
44657
44728
|
}
|
|
44658
|
-
async function directoryExists(
|
|
44729
|
+
async function directoryExists(path64) {
|
|
44659
44730
|
try {
|
|
44660
|
-
const stats = await stat6(
|
|
44731
|
+
const stats = await stat6(path64);
|
|
44661
44732
|
return stats.isDirectory();
|
|
44662
44733
|
} catch {
|
|
44663
44734
|
return false;
|
|
@@ -44734,7 +44805,7 @@ async function detectFramework(projectPath, packageJson) {
|
|
|
44734
44805
|
}
|
|
44735
44806
|
|
|
44736
44807
|
// ../../modules/project-config/package-json.ts
|
|
44737
|
-
import { readFile as
|
|
44808
|
+
import { readFile as readFile21 } from "fs/promises";
|
|
44738
44809
|
import { join as join5 } from "path";
|
|
44739
44810
|
function toStringRecord2(value) {
|
|
44740
44811
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -44750,7 +44821,7 @@ async function readPackageJson(projectPath) {
|
|
|
44750
44821
|
const packageJsonPath = join5(projectPath, "package.json");
|
|
44751
44822
|
let rawContents;
|
|
44752
44823
|
try {
|
|
44753
|
-
rawContents = await
|
|
44824
|
+
rawContents = await readFile21(packageJsonPath, "utf8");
|
|
44754
44825
|
} catch (error) {
|
|
44755
44826
|
const message = error instanceof Error ? error.message : "Unknown read error";
|
|
44756
44827
|
throw new Error(
|
|
@@ -44794,9 +44865,9 @@ var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
|
44794
44865
|
]);
|
|
44795
44866
|
var DEFAULT_SCAN_ROOTS = ["apps", "packages"];
|
|
44796
44867
|
var MAX_SCAN_DEPTH = 8;
|
|
44797
|
-
async function pathExists9(
|
|
44868
|
+
async function pathExists9(path64) {
|
|
44798
44869
|
try {
|
|
44799
|
-
await access12(
|
|
44870
|
+
await access12(path64);
|
|
44800
44871
|
return true;
|
|
44801
44872
|
} catch {
|
|
44802
44873
|
return false;
|
|
@@ -44839,7 +44910,7 @@ async function readWorkspaceBaseDirs(projectPath) {
|
|
|
44839
44910
|
if (!await pathExists9(packageJsonPath)) {
|
|
44840
44911
|
return [];
|
|
44841
44912
|
}
|
|
44842
|
-
const packageJsonContents = await
|
|
44913
|
+
const packageJsonContents = await readFile22(packageJsonPath, "utf8");
|
|
44843
44914
|
const patterns = extractWorkspacePatterns(packageJsonContents);
|
|
44844
44915
|
return patterns.map(normalizeWorkspaceBaseDir);
|
|
44845
44916
|
}
|
|
@@ -44931,9 +45002,9 @@ var LOCK_FILE_PRIORITY = [
|
|
|
44931
45002
|
packageManager: PackageManager.NPM
|
|
44932
45003
|
}
|
|
44933
45004
|
];
|
|
44934
|
-
async function fileExists4(
|
|
45005
|
+
async function fileExists4(path64) {
|
|
44935
45006
|
try {
|
|
44936
|
-
await access13(
|
|
45007
|
+
await access13(path64);
|
|
44937
45008
|
return true;
|
|
44938
45009
|
} catch {
|
|
44939
45010
|
return false;
|
|
@@ -44976,7 +45047,7 @@ async function detectPackageManager(projectPath, packageJson) {
|
|
|
44976
45047
|
}
|
|
44977
45048
|
|
|
44978
45049
|
// ../../modules/project-config/vite.ts
|
|
44979
|
-
import { access as access14, readFile as
|
|
45050
|
+
import { access as access14, readFile as readFile23 } from "fs/promises";
|
|
44980
45051
|
import { join as join8, normalize as normalize2 } from "path";
|
|
44981
45052
|
var VITE_CONFIG_FILES = [
|
|
44982
45053
|
"vite.config.ts",
|
|
@@ -44984,9 +45055,9 @@ var VITE_CONFIG_FILES = [
|
|
|
44984
45055
|
"vite.config.mjs",
|
|
44985
45056
|
"vite.config.mts"
|
|
44986
45057
|
];
|
|
44987
|
-
async function fileExists5(
|
|
45058
|
+
async function fileExists5(path64) {
|
|
44988
45059
|
try {
|
|
44989
|
-
await access14(
|
|
45060
|
+
await access14(path64);
|
|
44990
45061
|
return true;
|
|
44991
45062
|
} catch {
|
|
44992
45063
|
return false;
|
|
@@ -45006,7 +45077,7 @@ async function readViteConfig(projectPath) {
|
|
|
45006
45077
|
for (const configFileName of VITE_CONFIG_FILES) {
|
|
45007
45078
|
const configPath = join8(projectPath, configFileName);
|
|
45008
45079
|
if (await fileExists5(configPath)) {
|
|
45009
|
-
return await
|
|
45080
|
+
return await readFile23(configPath, "utf8");
|
|
45010
45081
|
}
|
|
45011
45082
|
}
|
|
45012
45083
|
return null;
|
|
@@ -45263,7 +45334,7 @@ var TempoProject = class _TempoProject {
|
|
|
45263
45334
|
this.devserver = null;
|
|
45264
45335
|
this.devserverConfig = null;
|
|
45265
45336
|
this.initializePromise = null;
|
|
45266
|
-
this.projectRoot =
|
|
45337
|
+
this.projectRoot = path32.resolve(projectRoot);
|
|
45267
45338
|
}
|
|
45268
45339
|
static async open(projectRoot) {
|
|
45269
45340
|
const normalizedRoot = typeof projectRoot === "string" ? projectRoot : projectRoot.projectRoot;
|
|
@@ -45456,7 +45527,7 @@ var TempoProject = class _TempoProject {
|
|
|
45456
45527
|
const gitResult = await ensureTempoGitRepo(this.projectRoot);
|
|
45457
45528
|
const createdConfig = await ensureTempoConfigFile(
|
|
45458
45529
|
this.projectRoot,
|
|
45459
|
-
|
|
45530
|
+
path32.join(this.projectRoot, TEMPO_DIR_NAME2),
|
|
45460
45531
|
buildDefaultTempoConfig()
|
|
45461
45532
|
);
|
|
45462
45533
|
const config = await this.getResolvedConfig();
|
|
@@ -45489,7 +45560,7 @@ var TempoProject = class _TempoProject {
|
|
|
45489
45560
|
const requestedFramework = options.framework;
|
|
45490
45561
|
const createdConfig = await ensureTempoConfigFile(
|
|
45491
45562
|
this.projectRoot,
|
|
45492
|
-
|
|
45563
|
+
path32.join(this.projectRoot, TEMPO_DIR_NAME2),
|
|
45493
45564
|
requestedFramework === "expo" ? buildExpoTempoConfig({ installScript }) : buildDefaultTempoConfig({ installScript })
|
|
45494
45565
|
);
|
|
45495
45566
|
await ensureValidTempoConfigFile(this.projectRoot);
|
|
@@ -45551,12 +45622,12 @@ async function findPageFilesInPagesRoot(pagesRoot) {
|
|
|
45551
45622
|
return [];
|
|
45552
45623
|
}
|
|
45553
45624
|
const pageFiles2 = [];
|
|
45554
|
-
const pageFilePath =
|
|
45625
|
+
const pageFilePath = path33.join(dirPath, PAGE_FILE_NAME);
|
|
45555
45626
|
if (await pathExists10(pageFilePath)) {
|
|
45556
45627
|
pageFiles2.push(pageFilePath);
|
|
45557
45628
|
}
|
|
45558
45629
|
const nestedPageFiles = await Promise.all(
|
|
45559
|
-
entries.filter((entry) => entry.isDirectory()).map((entry) => walkDirectories(
|
|
45630
|
+
entries.filter((entry) => entry.isDirectory()).map((entry) => walkDirectories(path33.join(dirPath, entry.name)))
|
|
45560
45631
|
);
|
|
45561
45632
|
return [...pageFiles2, ...nestedPageFiles.flat()];
|
|
45562
45633
|
}
|
|
@@ -45567,7 +45638,7 @@ async function resolveCanvasesRoot(repoRoot) {
|
|
|
45567
45638
|
try {
|
|
45568
45639
|
return (await resolveTempoConfig(repoRoot)).pagesDir;
|
|
45569
45640
|
} catch {
|
|
45570
|
-
return
|
|
45641
|
+
return path33.join(repoRoot, "tempo", "designs");
|
|
45571
45642
|
}
|
|
45572
45643
|
}
|
|
45573
45644
|
async function findPageFilesInRepo(repoRoot) {
|
|
@@ -45580,7 +45651,7 @@ async function listPageInfosInRepo(options) {
|
|
|
45580
45651
|
const parsed = await parsePageFile(filePath);
|
|
45581
45652
|
return {
|
|
45582
45653
|
filePath,
|
|
45583
|
-
pageDir:
|
|
45654
|
+
pageDir: path33.dirname(filePath),
|
|
45584
45655
|
repoName: options.repoName,
|
|
45585
45656
|
pageName: parsed.pageName,
|
|
45586
45657
|
storyboardNames: parsed.storyboards.map(
|
|
@@ -45600,7 +45671,7 @@ async function listPageInfosInRepo(options) {
|
|
|
45600
45671
|
|
|
45601
45672
|
// ../canvas-pages/resolve-canvas-path.ts
|
|
45602
45673
|
import { readdir as readdir10, stat as stat8 } from "fs/promises";
|
|
45603
|
-
import
|
|
45674
|
+
import path35 from "path";
|
|
45604
45675
|
var PAGE_FILE_NAME2 = "index.canvas.tsx";
|
|
45605
45676
|
var CANVAS_FILE_SUFFIX = ".canvas.tsx";
|
|
45606
45677
|
async function statSafe(targetPath) {
|
|
@@ -45612,19 +45683,19 @@ async function statSafe(targetPath) {
|
|
|
45612
45683
|
}
|
|
45613
45684
|
}
|
|
45614
45685
|
async function resolveCanvasFilePath(candidate) {
|
|
45615
|
-
const abs =
|
|
45686
|
+
const abs = path35.resolve(candidate);
|
|
45616
45687
|
const info = await statSafe(abs);
|
|
45617
45688
|
if (!info) return null;
|
|
45618
45689
|
let dir;
|
|
45619
45690
|
if (info.isFile) {
|
|
45620
45691
|
if (abs.endsWith(CANVAS_FILE_SUFFIX)) return abs;
|
|
45621
|
-
dir =
|
|
45692
|
+
dir = path35.dirname(abs);
|
|
45622
45693
|
} else if (info.isDirectory) {
|
|
45623
45694
|
dir = abs;
|
|
45624
45695
|
} else {
|
|
45625
45696
|
return null;
|
|
45626
45697
|
}
|
|
45627
|
-
const indexFile =
|
|
45698
|
+
const indexFile = path35.join(dir, PAGE_FILE_NAME2);
|
|
45628
45699
|
if (await statSafe(indexFile)) return indexFile;
|
|
45629
45700
|
let entries;
|
|
45630
45701
|
try {
|
|
@@ -45636,19 +45707,19 @@ async function resolveCanvasFilePath(candidate) {
|
|
|
45636
45707
|
(entry) => entry.isFile() && entry.name.endsWith(CANVAS_FILE_SUFFIX)
|
|
45637
45708
|
);
|
|
45638
45709
|
if (canvasFiles.length === 1) {
|
|
45639
|
-
return
|
|
45710
|
+
return path35.join(dir, canvasFiles[0].name);
|
|
45640
45711
|
}
|
|
45641
45712
|
return null;
|
|
45642
45713
|
}
|
|
45643
45714
|
async function resolveCanvasDirPath(candidate) {
|
|
45644
45715
|
const file = await resolveCanvasFilePath(candidate);
|
|
45645
|
-
return file ?
|
|
45716
|
+
return file ? path35.dirname(file) : null;
|
|
45646
45717
|
}
|
|
45647
45718
|
|
|
45648
45719
|
// ../canvas-pages/page-tools.ts
|
|
45649
45720
|
import { execFile as execFile3 } from "child_process";
|
|
45650
|
-
import { access as access15, mkdir as mkdir11, readFile as
|
|
45651
|
-
import
|
|
45721
|
+
import { access as access15, mkdir as mkdir11, readFile as readFile24, rm as rm8 } from "fs/promises";
|
|
45722
|
+
import path36 from "path";
|
|
45652
45723
|
import { promisify as promisify3 } from "util";
|
|
45653
45724
|
var execFileAsync3 = promisify3(execFile3);
|
|
45654
45725
|
async function pathExists11(targetPath) {
|
|
@@ -45708,7 +45779,7 @@ function buildInitSummary(options) {
|
|
|
45708
45779
|
};
|
|
45709
45780
|
}
|
|
45710
45781
|
function notInitializedMessage(projectRoot) {
|
|
45711
|
-
return `Project is not initialized for Tempo canvases: no tempo.config.json found in ${projectRoot} or ${
|
|
45782
|
+
return `Project is not initialized for Tempo canvases: no tempo.config.json found in ${projectRoot} or ${path36.join(projectRoot, "tempo")}. Run canvas_project_init first.`;
|
|
45712
45783
|
}
|
|
45713
45784
|
async function useProject(projectRoot, provided, framework, fn) {
|
|
45714
45785
|
if (provided) {
|
|
@@ -45737,7 +45808,7 @@ async function useExistingProject(projectRoot, provided, fn) {
|
|
|
45737
45808
|
}
|
|
45738
45809
|
}
|
|
45739
45810
|
async function initializePagesSupport(options) {
|
|
45740
|
-
const projectRoot =
|
|
45811
|
+
const projectRoot = path36.resolve(options.projectRoot);
|
|
45741
45812
|
return useProject(
|
|
45742
45813
|
projectRoot,
|
|
45743
45814
|
options.project,
|
|
@@ -45769,12 +45840,12 @@ function resolveCanvasLocalStubPath(importPath, pageDir, uiFramework) {
|
|
|
45769
45840
|
if (!importPath.startsWith("./") && !importPath.startsWith("../")) {
|
|
45770
45841
|
return null;
|
|
45771
45842
|
}
|
|
45772
|
-
const resolved =
|
|
45773
|
-
const relToPageDir =
|
|
45774
|
-
if (relToPageDir.startsWith("..") ||
|
|
45843
|
+
const resolved = path36.resolve(pageDir, importPath);
|
|
45844
|
+
const relToPageDir = path36.relative(pageDir, resolved);
|
|
45845
|
+
if (relToPageDir.startsWith("..") || path36.isAbsolute(relToPageDir)) {
|
|
45775
45846
|
return null;
|
|
45776
45847
|
}
|
|
45777
|
-
const ext =
|
|
45848
|
+
const ext = path36.extname(resolved);
|
|
45778
45849
|
if (ext === ".tsx" || ext === ".ts" || ext === ".jsx" || ext === ".js" || ext === ".svelte") {
|
|
45779
45850
|
return resolved;
|
|
45780
45851
|
}
|
|
@@ -45808,7 +45879,7 @@ async function scaffoldCanvasLocalStubs(storyboards, pageDir, uiFramework) {
|
|
|
45808
45879
|
);
|
|
45809
45880
|
if (!stubPath) continue;
|
|
45810
45881
|
if (await pathExists11(stubPath)) continue;
|
|
45811
|
-
await mkdir11(
|
|
45882
|
+
await mkdir11(path36.dirname(stubPath), { recursive: true });
|
|
45812
45883
|
await queuedFileEditor.writeFile(
|
|
45813
45884
|
stubPath,
|
|
45814
45885
|
canvasLocalStubContent(
|
|
@@ -45822,7 +45893,7 @@ async function scaffoldCanvasLocalStubs(storyboards, pageDir, uiFramework) {
|
|
|
45822
45893
|
return written;
|
|
45823
45894
|
}
|
|
45824
45895
|
async function markCanvasAsHome(filePath) {
|
|
45825
|
-
const source = await
|
|
45896
|
+
const source = await readFile24(filePath, "utf-8");
|
|
45826
45897
|
if (sourceHasHomeMarker(source)) return false;
|
|
45827
45898
|
const updated = `${HOME_CANVAS_MARKER_LINE}
|
|
45828
45899
|
${source}`;
|
|
@@ -45830,14 +45901,14 @@ ${source}`;
|
|
|
45830
45901
|
return true;
|
|
45831
45902
|
}
|
|
45832
45903
|
async function unmarkCanvasAsHome(filePath) {
|
|
45833
|
-
const source = await
|
|
45904
|
+
const source = await readFile24(filePath, "utf-8");
|
|
45834
45905
|
if (!sourceHasHomeMarker(source)) return false;
|
|
45835
45906
|
const updated = source.split("\n").filter((line) => !line.includes(HOME_CANVAS_MARKER)).join("\n");
|
|
45836
45907
|
await queuedFileEditor.writeFile(filePath, updated);
|
|
45837
45908
|
return true;
|
|
45838
45909
|
}
|
|
45839
45910
|
async function createPage(options) {
|
|
45840
|
-
const projectRoot =
|
|
45911
|
+
const projectRoot = path36.resolve(options.projectRoot);
|
|
45841
45912
|
const pageName = options.pageName?.trim();
|
|
45842
45913
|
if (!pageName) {
|
|
45843
45914
|
throw new Error("pageName is required");
|
|
@@ -45861,11 +45932,11 @@ async function createPage(options) {
|
|
|
45861
45932
|
);
|
|
45862
45933
|
}
|
|
45863
45934
|
const slugSegments = pageSlug.split("/");
|
|
45864
|
-
const pageDir = slugSegments.length > 1 ?
|
|
45935
|
+
const pageDir = slugSegments.length > 1 ? path36.join(resolvedConfig.pagesDir, ...slugSegments) : path36.join(
|
|
45865
45936
|
await resolveFreeformCanvasesDir(resolvedConfig.pagesDir),
|
|
45866
45937
|
pageSlug
|
|
45867
45938
|
);
|
|
45868
|
-
const pageFile =
|
|
45939
|
+
const pageFile = path36.join(pageDir, "index.canvas.tsx");
|
|
45869
45940
|
if (await pathExists11(pageFile)) {
|
|
45870
45941
|
throw new Error(`Canvas already exists: ${pageFile}`);
|
|
45871
45942
|
}
|
|
@@ -45917,14 +45988,14 @@ async function createPage(options) {
|
|
|
45917
45988
|
}
|
|
45918
45989
|
|
|
45919
45990
|
// ../canvas-pages/pages/validate-page.ts
|
|
45920
|
-
import
|
|
45991
|
+
import path42 from "path";
|
|
45921
45992
|
|
|
45922
45993
|
// ../../modules/typescript/workspace-service.ts
|
|
45923
45994
|
import { realpathSync as realpathSync2, statSync as statSync3 } from "fs";
|
|
45924
|
-
import
|
|
45995
|
+
import path37 from "path";
|
|
45925
45996
|
import ts3 from "typescript";
|
|
45926
45997
|
function canonicalPath(input) {
|
|
45927
|
-
const resolved =
|
|
45998
|
+
const resolved = path37.resolve(input);
|
|
45928
45999
|
try {
|
|
45929
46000
|
return realpathSync2.native(resolved);
|
|
45930
46001
|
} catch {
|
|
@@ -45943,7 +46014,7 @@ function compareProjectPriority(left, right) {
|
|
|
45943
46014
|
return left.id.localeCompare(right.id);
|
|
45944
46015
|
}
|
|
45945
46016
|
function isWithinRoot(filePath, rootDir) {
|
|
45946
|
-
return filePath === rootDir || filePath.startsWith(`${rootDir}${
|
|
46017
|
+
return filePath === rootDir || filePath.startsWith(`${rootDir}${path37.sep}`);
|
|
45947
46018
|
}
|
|
45948
46019
|
function loadProject(descriptor) {
|
|
45949
46020
|
const id = descriptor.id.trim();
|
|
@@ -45964,7 +46035,7 @@ function loadProject(descriptor) {
|
|
|
45964
46035
|
const parsed = ts3.parseJsonConfigFileContent(
|
|
45965
46036
|
readResult.config,
|
|
45966
46037
|
ts3.sys,
|
|
45967
|
-
|
|
46038
|
+
path37.dirname(tsconfigPath)
|
|
45968
46039
|
);
|
|
45969
46040
|
if (parsed.errors.length > 0) {
|
|
45970
46041
|
const message = parsed.errors.map(
|
|
@@ -46159,7 +46230,7 @@ import ts6 from "typescript";
|
|
|
46159
46230
|
|
|
46160
46231
|
// ../canvas-pages/pages/validate-service-cache.ts
|
|
46161
46232
|
import { statSync as statSync4 } from "fs";
|
|
46162
|
-
import
|
|
46233
|
+
import path38 from "path";
|
|
46163
46234
|
function fingerprintsEqual(a, b2) {
|
|
46164
46235
|
return a.tsconfig === b2.tsconfig && a.packageJson === b2.packageJson && a.tempoPackageJson === b2.tempoPackageJson;
|
|
46165
46236
|
}
|
|
@@ -46168,9 +46239,9 @@ function createValidateServiceCache(deps) {
|
|
|
46168
46239
|
function fingerprint(projectRoot, tsconfigPath) {
|
|
46169
46240
|
return {
|
|
46170
46241
|
tsconfig: deps.statMtimeMs(tsconfigPath),
|
|
46171
|
-
packageJson: deps.statMtimeMs(
|
|
46242
|
+
packageJson: deps.statMtimeMs(path38.join(projectRoot, "package.json")),
|
|
46172
46243
|
tempoPackageJson: deps.statMtimeMs(
|
|
46173
|
-
|
|
46244
|
+
path38.join(projectRoot, "tempo", "package.json")
|
|
46174
46245
|
)
|
|
46175
46246
|
};
|
|
46176
46247
|
}
|
|
@@ -46186,8 +46257,8 @@ function createValidateServiceCache(deps) {
|
|
|
46186
46257
|
}
|
|
46187
46258
|
return {
|
|
46188
46259
|
get(projectRoot, tsconfigPath) {
|
|
46189
|
-
const resolvedProjectRoot =
|
|
46190
|
-
const resolvedTsconfigPath =
|
|
46260
|
+
const resolvedProjectRoot = path38.resolve(projectRoot);
|
|
46261
|
+
const resolvedTsconfigPath = path38.resolve(tsconfigPath);
|
|
46191
46262
|
const key = `${resolvedProjectRoot}::${resolvedTsconfigPath}`;
|
|
46192
46263
|
const existing = entries.get(key);
|
|
46193
46264
|
if (existing) {
|
|
@@ -46205,7 +46276,7 @@ function createValidateServiceCache(deps) {
|
|
|
46205
46276
|
return entry.service;
|
|
46206
46277
|
},
|
|
46207
46278
|
evict(projectRoot, tsconfigPath) {
|
|
46208
|
-
const key = `${
|
|
46279
|
+
const key = `${path38.resolve(projectRoot)}::${path38.resolve(tsconfigPath)}`;
|
|
46209
46280
|
const entry = entries.get(key);
|
|
46210
46281
|
if (!entry) return;
|
|
46211
46282
|
entries.delete(key);
|
|
@@ -46237,11 +46308,11 @@ var defaultValidateServiceCache = createValidateServiceCache({
|
|
|
46237
46308
|
});
|
|
46238
46309
|
|
|
46239
46310
|
// ../canvas-pages/pages/dependency-checker.ts
|
|
46240
|
-
import
|
|
46311
|
+
import path40 from "path";
|
|
46241
46312
|
|
|
46242
46313
|
// ../canvas-pages/pages/package-root.ts
|
|
46243
46314
|
import { access as access16 } from "fs/promises";
|
|
46244
|
-
import
|
|
46315
|
+
import path39 from "path";
|
|
46245
46316
|
async function exists2(filePath) {
|
|
46246
46317
|
try {
|
|
46247
46318
|
await access16(filePath);
|
|
@@ -46251,16 +46322,16 @@ async function exists2(filePath) {
|
|
|
46251
46322
|
}
|
|
46252
46323
|
}
|
|
46253
46324
|
function importerResolutionDirs(importerFile, boundaryRoot) {
|
|
46254
|
-
const stop =
|
|
46325
|
+
const stop = path39.resolve(boundaryRoot);
|
|
46255
46326
|
const dirs = [];
|
|
46256
|
-
let dir =
|
|
46327
|
+
let dir = path39.dirname(path39.resolve(importerFile));
|
|
46257
46328
|
while (true) {
|
|
46258
46329
|
dirs.push(dir);
|
|
46259
46330
|
if (dir === stop) break;
|
|
46260
|
-
const parent =
|
|
46331
|
+
const parent = path39.dirname(dir);
|
|
46261
46332
|
if (parent === dir) break;
|
|
46262
|
-
const rel =
|
|
46263
|
-
if (rel.startsWith("..") ||
|
|
46333
|
+
const rel = path39.relative(stop, parent);
|
|
46334
|
+
if (rel.startsWith("..") || path39.isAbsolute(rel)) break;
|
|
46264
46335
|
dir = parent;
|
|
46265
46336
|
}
|
|
46266
46337
|
return dirs;
|
|
@@ -46268,7 +46339,7 @@ function importerResolutionDirs(importerFile, boundaryRoot) {
|
|
|
46268
46339
|
async function packageResolvesFromImporter(packageName, importerFile, boundaryRoot) {
|
|
46269
46340
|
const segments = packageName.split("/");
|
|
46270
46341
|
for (const dir of importerResolutionDirs(importerFile, boundaryRoot)) {
|
|
46271
|
-
if (await exists2(
|
|
46342
|
+
if (await exists2(path39.join(dir, "node_modules", ...segments, "package.json"))) {
|
|
46272
46343
|
return true;
|
|
46273
46344
|
}
|
|
46274
46345
|
}
|
|
@@ -46276,13 +46347,13 @@ async function packageResolvesFromImporter(packageName, importerFile, boundaryRo
|
|
|
46276
46347
|
}
|
|
46277
46348
|
async function findNearestPackageRoot(importerFile, boundaryRoot) {
|
|
46278
46349
|
for (const dir of importerResolutionDirs(importerFile, boundaryRoot)) {
|
|
46279
|
-
if (await exists2(
|
|
46350
|
+
if (await exists2(path39.join(dir, "package.json"))) return dir;
|
|
46280
46351
|
}
|
|
46281
46352
|
return null;
|
|
46282
46353
|
}
|
|
46283
46354
|
function repoRootForCanvasWalk(projectRoot) {
|
|
46284
|
-
const resolved =
|
|
46285
|
-
return
|
|
46355
|
+
const resolved = path39.resolve(projectRoot);
|
|
46356
|
+
return path39.basename(resolved) === "tempo" ? path39.dirname(resolved) : resolved;
|
|
46286
46357
|
}
|
|
46287
46358
|
|
|
46288
46359
|
// ../canvas-pages/pages/dependency-checker.ts
|
|
@@ -46299,13 +46370,13 @@ async function readDepsSafe(dir) {
|
|
|
46299
46370
|
}
|
|
46300
46371
|
}
|
|
46301
46372
|
async function checkDependencies(npmPackages, projectRoot, _tempoPackageDir) {
|
|
46302
|
-
const resolvedProjectRoot =
|
|
46373
|
+
const resolvedProjectRoot = path40.resolve(projectRoot);
|
|
46303
46374
|
const repoRoot = repoRootForCanvasWalk(resolvedProjectRoot);
|
|
46304
46375
|
const fallbackDeps = await readDepsSafe(resolvedProjectRoot);
|
|
46305
46376
|
const issues = [];
|
|
46306
46377
|
for (const [packageName, requiredByFile] of npmPackages) {
|
|
46307
46378
|
if (EXCLUDED_PACKAGES.has(packageName)) continue;
|
|
46308
|
-
const importerFile =
|
|
46379
|
+
const importerFile = path40.resolve(resolvedProjectRoot, requiredByFile);
|
|
46309
46380
|
if (await packageResolvesFromImporter(packageName, importerFile, repoRoot)) {
|
|
46310
46381
|
continue;
|
|
46311
46382
|
}
|
|
@@ -46314,14 +46385,14 @@ async function checkDependencies(npmPackages, projectRoot, _tempoPackageDir) {
|
|
|
46314
46385
|
const declaredVersion = ownerDeps[packageName] ?? fallbackDeps[packageName];
|
|
46315
46386
|
const declarationRoot = ownerDeps[packageName] ? ownerRoot : fallbackDeps[packageName] ? resolvedProjectRoot : null;
|
|
46316
46387
|
const version = declaredVersion && isInstallableVersion(declaredVersion) ? declaredVersion : "latest";
|
|
46317
|
-
const ownerPackageJsonRel = ownerRoot ?
|
|
46388
|
+
const ownerPackageJsonRel = ownerRoot ? path40.relative(repoRoot, path40.join(ownerRoot, "package.json")) || "package.json" : "package.json";
|
|
46318
46389
|
issues.push({
|
|
46319
46390
|
kind: "missing_package",
|
|
46320
46391
|
package_name: packageName,
|
|
46321
46392
|
version,
|
|
46322
46393
|
required_by: requiredByFile,
|
|
46323
|
-
package_root: ownerRoot ?
|
|
46324
|
-
declared_in: declarationRoot ?
|
|
46394
|
+
package_root: ownerRoot ? path40.relative(repoRoot, ownerRoot) || "." : void 0,
|
|
46395
|
+
declared_in: declarationRoot ? path40.relative(repoRoot, path40.join(declarationRoot, "package.json")) || "package.json" : void 0,
|
|
46325
46396
|
fix: declaredVersion ? `Install dependencies for ${ownerPackageJsonRel} (already declares "${packageName}")` : `Add "${packageName}": "${version}" to ${ownerPackageJsonRel} dependencies`
|
|
46326
46397
|
});
|
|
46327
46398
|
}
|
|
@@ -46333,7 +46404,7 @@ import ts5 from "typescript";
|
|
|
46333
46404
|
|
|
46334
46405
|
// ../canvas-pages/pages/import-walker.ts
|
|
46335
46406
|
import { isBuiltin } from "module";
|
|
46336
|
-
import
|
|
46407
|
+
import path41 from "path";
|
|
46337
46408
|
import ts4 from "typescript";
|
|
46338
46409
|
function isServerComponentOnlySpecifier(specifier) {
|
|
46339
46410
|
const cleaned = specifier.split("?")[0].split("#")[0];
|
|
@@ -46434,18 +46505,18 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46434
46505
|
const serverOnlyImports = /* @__PURE__ */ new Map();
|
|
46435
46506
|
const canonicalProjectRoot = ts4.sys.realpath?.(projectRoot) ?? projectRoot;
|
|
46436
46507
|
const repoRoot = repoRootForCanvasWalk(canonicalProjectRoot);
|
|
46437
|
-
const primaryConfigPath = primaryTsconfigPath ?
|
|
46508
|
+
const primaryConfigPath = primaryTsconfigPath ? path41.resolve(primaryTsconfigPath) : null;
|
|
46438
46509
|
const queue = [entryFile];
|
|
46439
46510
|
const configPathByDir = /* @__PURE__ */ new Map();
|
|
46440
46511
|
const optionsByConfig = /* @__PURE__ */ new Map();
|
|
46441
46512
|
const viteAliasKeysByDir = /* @__PURE__ */ new Map();
|
|
46442
46513
|
function nearestConfigPath(dir) {
|
|
46443
46514
|
for (const candidateDir of importerResolutionDirs(
|
|
46444
|
-
|
|
46515
|
+
path41.join(dir, "__probe__"),
|
|
46445
46516
|
repoRoot
|
|
46446
46517
|
)) {
|
|
46447
46518
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
46448
|
-
const candidate =
|
|
46519
|
+
const candidate = path41.join(candidateDir, name);
|
|
46449
46520
|
if (moduleResolutionHost.fileExists(candidate)) return candidate;
|
|
46450
46521
|
}
|
|
46451
46522
|
}
|
|
@@ -46456,7 +46527,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46456
46527
|
}
|
|
46457
46528
|
function resolveConfigOptions(configPath, depth, seen) {
|
|
46458
46529
|
if (depth > 8) return null;
|
|
46459
|
-
const normalized =
|
|
46530
|
+
const normalized = path41.resolve(configPath);
|
|
46460
46531
|
if (seen.has(normalized)) return null;
|
|
46461
46532
|
seen.add(normalized);
|
|
46462
46533
|
const read2 = ts4.readConfigFile(normalized, ts4.sys.readFile);
|
|
@@ -46464,7 +46535,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46464
46535
|
const parsed = ts4.parseJsonConfigFileContent(
|
|
46465
46536
|
read2.config,
|
|
46466
46537
|
ts4.sys,
|
|
46467
|
-
|
|
46538
|
+
path41.dirname(normalized),
|
|
46468
46539
|
void 0,
|
|
46469
46540
|
normalized
|
|
46470
46541
|
);
|
|
@@ -46474,15 +46545,15 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46474
46545
|
if (!ref || typeof ref !== "object") continue;
|
|
46475
46546
|
const refPath = ref.path;
|
|
46476
46547
|
if (typeof refPath !== "string") continue;
|
|
46477
|
-
const resolved =
|
|
46478
|
-
const refConfig = refPath.endsWith(".json") ? resolved :
|
|
46548
|
+
const resolved = path41.resolve(path41.dirname(normalized), refPath);
|
|
46549
|
+
const refConfig = refPath.endsWith(".json") ? resolved : path41.join(resolved, "tsconfig.json");
|
|
46479
46550
|
const found = resolveConfigOptions(refConfig, depth + 1, seen);
|
|
46480
46551
|
if (found && hasAliasOptions(found)) return found;
|
|
46481
46552
|
}
|
|
46482
46553
|
return parsed.options;
|
|
46483
46554
|
}
|
|
46484
46555
|
function importerConfig(importerFile) {
|
|
46485
|
-
const dir =
|
|
46556
|
+
const dir = path41.dirname(importerFile);
|
|
46486
46557
|
let configPath = configPathByDir.get(dir);
|
|
46487
46558
|
if (configPath === void 0) {
|
|
46488
46559
|
configPath = nearestConfigPath(dir);
|
|
@@ -46497,7 +46568,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46497
46568
|
return options ? { configPath, options } : null;
|
|
46498
46569
|
}
|
|
46499
46570
|
function nearestViteAliasKeys(importerFile) {
|
|
46500
|
-
const dir =
|
|
46571
|
+
const dir = path41.dirname(importerFile);
|
|
46501
46572
|
let keys = viteAliasKeysByDir.get(dir);
|
|
46502
46573
|
if (keys !== void 0) return keys;
|
|
46503
46574
|
keys = /* @__PURE__ */ new Set();
|
|
@@ -46512,7 +46583,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46512
46583
|
"vite.config.mjs",
|
|
46513
46584
|
"vite.config.cjs"
|
|
46514
46585
|
]) {
|
|
46515
|
-
const candidate =
|
|
46586
|
+
const candidate = path41.join(candidateDir, name);
|
|
46516
46587
|
if (!moduleResolutionHost.fileExists(candidate)) continue;
|
|
46517
46588
|
const source = ts4.sys.readFile(candidate);
|
|
46518
46589
|
if (source !== void 0) keys = extractViteAliasKeys(source);
|
|
@@ -46547,7 +46618,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46547
46618
|
if (isServerComponentOnlySpecifier(specifier) && !serverOnlyImports.has(specifier)) {
|
|
46548
46619
|
serverOnlyImports.set(
|
|
46549
46620
|
specifier,
|
|
46550
|
-
|
|
46621
|
+
path41.relative(canonicalProjectRoot, canonical)
|
|
46551
46622
|
);
|
|
46552
46623
|
}
|
|
46553
46624
|
let resolvedModule2 = importer && importer.configPath !== primaryConfigPath ? ts4.resolveModuleName(
|
|
@@ -46569,7 +46640,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46569
46640
|
if (packageName && !npmPackages.has(packageName) && !matchesViteAlias(specifier, canonical)) {
|
|
46570
46641
|
npmPackages.set(
|
|
46571
46642
|
packageName,
|
|
46572
|
-
|
|
46643
|
+
path41.relative(canonicalProjectRoot, canonical)
|
|
46573
46644
|
);
|
|
46574
46645
|
}
|
|
46575
46646
|
continue;
|
|
@@ -46579,7 +46650,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46579
46650
|
if (packageName && !npmPackages.has(packageName)) {
|
|
46580
46651
|
npmPackages.set(
|
|
46581
46652
|
packageName,
|
|
46582
|
-
|
|
46653
|
+
path41.relative(canonicalProjectRoot, canonical)
|
|
46583
46654
|
);
|
|
46584
46655
|
}
|
|
46585
46656
|
} else {
|
|
@@ -46734,9 +46805,9 @@ function getCanvasFormatIssues(file, source, parsed) {
|
|
|
46734
46805
|
return issues;
|
|
46735
46806
|
}
|
|
46736
46807
|
async function validatePage(pageFile, projectRoot, config) {
|
|
46737
|
-
const resolvedPageFile =
|
|
46738
|
-
const resolvedProjectRoot =
|
|
46739
|
-
const tsconfigPath = config?.tsconfigPath ??
|
|
46808
|
+
const resolvedPageFile = path42.resolve(pageFile);
|
|
46809
|
+
const resolvedProjectRoot = path42.resolve(projectRoot);
|
|
46810
|
+
const tsconfigPath = config?.tsconfigPath ?? path42.join(resolvedProjectRoot, "tsconfig.json");
|
|
46740
46811
|
const readResult = ts6.readConfigFile(tsconfigPath, ts6.sys.readFile);
|
|
46741
46812
|
if (readResult.error) {
|
|
46742
46813
|
const errorText = ts6.flattenDiagnosticMessageText(
|
|
@@ -46839,7 +46910,7 @@ async function validatePage(pageFile, projectRoot, config) {
|
|
|
46839
46910
|
|
|
46840
46911
|
// ../canvas-pages/pages/validate-host.ts
|
|
46841
46912
|
import { access as access17 } from "fs/promises";
|
|
46842
|
-
import
|
|
46913
|
+
import path43 from "path";
|
|
46843
46914
|
var DOCS_HINT = "Refer to get_guide({ topic: 'tempo-canvas-instructions' }) for details on setting up the canvas infrastructure.";
|
|
46844
46915
|
async function pathExists12(targetPath) {
|
|
46845
46916
|
try {
|
|
@@ -46862,7 +46933,7 @@ async function isUrlReachable(url) {
|
|
|
46862
46933
|
}
|
|
46863
46934
|
async function validateHost(config) {
|
|
46864
46935
|
const issues = [];
|
|
46865
|
-
const tempoSdkPath =
|
|
46936
|
+
const tempoSdkPath = path43.join(config.tempoRoot, "node_modules", "tempo-sdk");
|
|
46866
46937
|
if (!await pathExists12(tempoSdkPath)) {
|
|
46867
46938
|
issues.push({
|
|
46868
46939
|
kind: "host_setup_issue",
|
|
@@ -46894,7 +46965,7 @@ async function validateHost(config) {
|
|
|
46894
46965
|
|
|
46895
46966
|
// ../canvas-tools/commands/utils.ts
|
|
46896
46967
|
import { readdir as readdir11, stat as stat9 } from "fs/promises";
|
|
46897
|
-
import
|
|
46968
|
+
import path44 from "path";
|
|
46898
46969
|
async function pathExists13(targetPath) {
|
|
46899
46970
|
try {
|
|
46900
46971
|
await stat9(targetPath);
|
|
@@ -46907,7 +46978,7 @@ async function listFilesRecursively(directoryPath) {
|
|
|
46907
46978
|
const entries = await readdir11(directoryPath, { withFileTypes: true });
|
|
46908
46979
|
const files = [];
|
|
46909
46980
|
for (const entry of entries) {
|
|
46910
|
-
const absolutePath =
|
|
46981
|
+
const absolutePath = path44.join(directoryPath, entry.name);
|
|
46911
46982
|
if (entry.isDirectory()) {
|
|
46912
46983
|
files.push(...await listFilesRecursively(absolutePath));
|
|
46913
46984
|
continue;
|
|
@@ -46925,7 +46996,7 @@ async function runComputeLayoutCommand(args) {
|
|
|
46925
46996
|
}
|
|
46926
46997
|
let existingRects = [];
|
|
46927
46998
|
if (args.canvas_file) {
|
|
46928
|
-
const pageFilePath = await resolveCanvasFilePath(args.canvas_file) ??
|
|
46999
|
+
const pageFilePath = await resolveCanvasFilePath(args.canvas_file) ?? path45.resolve(args.canvas_file);
|
|
46929
47000
|
if (!await pathExists13(pageFilePath)) {
|
|
46930
47001
|
throw new Error(`Canvas file not found: ${pageFilePath}`);
|
|
46931
47002
|
}
|
|
@@ -46955,9 +47026,9 @@ async function runComputeLayoutCommand(args) {
|
|
|
46955
47026
|
}
|
|
46956
47027
|
|
|
46957
47028
|
// ../canvas-tools/commands/create-page.ts
|
|
46958
|
-
import
|
|
47029
|
+
import path46 from "path";
|
|
46959
47030
|
async function runCreatePageCommand(args) {
|
|
46960
|
-
const projectRoot =
|
|
47031
|
+
const projectRoot = path46.resolve(args.repo_root);
|
|
46961
47032
|
const pageName = args.canvas_name;
|
|
46962
47033
|
const storyboards = (args.storyboards ?? []).map(
|
|
46963
47034
|
(storyboard) => ({
|
|
@@ -46993,13 +47064,13 @@ async function runCreatePageCommand(args) {
|
|
|
46993
47064
|
|
|
46994
47065
|
// ../canvas-tools/commands/delete-page.ts
|
|
46995
47066
|
import { rm as rm9 } from "fs/promises";
|
|
46996
|
-
import
|
|
47067
|
+
import path47 from "path";
|
|
46997
47068
|
async function runDeletePageCommand(args) {
|
|
46998
|
-
const pageDir = await resolveCanvasDirPath(args.canvas_dir) ??
|
|
47069
|
+
const pageDir = await resolveCanvasDirPath(args.canvas_dir) ?? path47.resolve(args.canvas_dir);
|
|
46999
47070
|
if (!await pathExists13(pageDir)) {
|
|
47000
47071
|
throw new Error(`Directory not found: ${pageDir}`);
|
|
47001
47072
|
}
|
|
47002
|
-
const pageFilePath =
|
|
47073
|
+
const pageFilePath = path47.join(pageDir, "index.canvas.tsx");
|
|
47003
47074
|
if (!await pathExists13(pageFilePath)) {
|
|
47004
47075
|
throw new Error(
|
|
47005
47076
|
`Not a canvas folder: ${pageDir} (missing index.canvas.tsx)`
|
|
@@ -47014,9 +47085,9 @@ async function runDeletePageCommand(args) {
|
|
|
47014
47085
|
}
|
|
47015
47086
|
|
|
47016
47087
|
// ../canvas-tools/commands/list-pages.ts
|
|
47017
|
-
import
|
|
47088
|
+
import path48 from "path";
|
|
47018
47089
|
async function runListPagesCommand(args) {
|
|
47019
|
-
const workspaceRoot =
|
|
47090
|
+
const workspaceRoot = path48.resolve(args.workspace_root);
|
|
47020
47091
|
if (!await pathExists13(workspaceRoot)) {
|
|
47021
47092
|
throw new Error(`Workspace root does not exist: ${workspaceRoot}`);
|
|
47022
47093
|
}
|
|
@@ -47025,7 +47096,7 @@ async function runListPagesCommand(args) {
|
|
|
47025
47096
|
args.repo_names.map((repoName) => repoName.trim()).filter((repoName) => repoName.length > 0)
|
|
47026
47097
|
)
|
|
47027
47098
|
).map((repoName) => ({
|
|
47028
|
-
repoRoot:
|
|
47099
|
+
repoRoot: path48.join(workspaceRoot, repoName),
|
|
47029
47100
|
repoName
|
|
47030
47101
|
})) : [{ repoRoot: workspaceRoot, repoName: "" }];
|
|
47031
47102
|
const pages = [];
|
|
@@ -47052,10 +47123,10 @@ async function runListPagesCommand(args) {
|
|
|
47052
47123
|
}
|
|
47053
47124
|
|
|
47054
47125
|
// ../canvas-tools/commands/migrate-canvas.ts
|
|
47055
|
-
import
|
|
47126
|
+
import path49 from "path";
|
|
47056
47127
|
async function runMigrateCanvasCommand(args) {
|
|
47057
|
-
const projectRoot =
|
|
47058
|
-
const candidate =
|
|
47128
|
+
const projectRoot = path49.resolve(args.repo_root);
|
|
47129
|
+
const candidate = path49.isAbsolute(args.canvas_file) ? args.canvas_file : path49.join(projectRoot, args.canvas_file);
|
|
47059
47130
|
const canvasFile = await resolveCanvasFilePath(candidate);
|
|
47060
47131
|
if (!canvasFile) {
|
|
47061
47132
|
throw new Error(
|
|
@@ -47071,10 +47142,10 @@ async function runMigrateCanvasCommand(args) {
|
|
|
47071
47142
|
}
|
|
47072
47143
|
|
|
47073
47144
|
// ../canvas-tools/commands/set-home.ts
|
|
47074
|
-
import
|
|
47145
|
+
import path50 from "path";
|
|
47075
47146
|
async function runSetHomeCanvasCommand(args) {
|
|
47076
|
-
const projectRoot =
|
|
47077
|
-
const candidate =
|
|
47147
|
+
const projectRoot = path50.resolve(args.repo_root);
|
|
47148
|
+
const candidate = path50.isAbsolute(args.canvas_dir) ? args.canvas_dir : path50.join(projectRoot, args.canvas_dir);
|
|
47078
47149
|
const canvasFile = await resolveCanvasFilePath(candidate);
|
|
47079
47150
|
if (!canvasFile) {
|
|
47080
47151
|
throw new Error(
|
|
@@ -47095,7 +47166,7 @@ async function runSetHomeCanvasCommand(args) {
|
|
|
47095
47166
|
}
|
|
47096
47167
|
const newlyMarked = await markCanvasAsHome(canvasFile);
|
|
47097
47168
|
return {
|
|
47098
|
-
canvas_dir:
|
|
47169
|
+
canvas_dir: path50.dirname(canvasFile),
|
|
47099
47170
|
canvas_file: canvasFile,
|
|
47100
47171
|
repo_root: projectRoot,
|
|
47101
47172
|
newly_marked: newlyMarked,
|
|
@@ -47104,7 +47175,7 @@ async function runSetHomeCanvasCommand(args) {
|
|
|
47104
47175
|
}
|
|
47105
47176
|
|
|
47106
47177
|
// ../canvas-tools/commands/validate-page.ts
|
|
47107
|
-
import
|
|
47178
|
+
import path51 from "path";
|
|
47108
47179
|
var DOCS_HINT2 = "Refer to get_guide({ topic: 'tempo-canvas-instructions' }) for details on setting up the canvas infrastructure.";
|
|
47109
47180
|
function formatIssueAsString(issue) {
|
|
47110
47181
|
switch (issue.kind) {
|
|
@@ -47123,8 +47194,8 @@ function formatIssueAsString(issue) {
|
|
|
47123
47194
|
}
|
|
47124
47195
|
}
|
|
47125
47196
|
async function runValidatePageCommand(args, options) {
|
|
47126
|
-
const pageFile = await resolveCanvasFilePath(args.canvas_file) ??
|
|
47127
|
-
const projectRoot =
|
|
47197
|
+
const pageFile = await resolveCanvasFilePath(args.canvas_file) ?? path51.resolve(args.canvas_file);
|
|
47198
|
+
const projectRoot = path51.resolve(args.repo_root);
|
|
47128
47199
|
let resolvedConfig;
|
|
47129
47200
|
try {
|
|
47130
47201
|
resolvedConfig = await resolveTempoConfig(projectRoot);
|
|
@@ -47132,7 +47203,7 @@ async function runValidatePageCommand(args, options) {
|
|
|
47132
47203
|
const configIssue = {
|
|
47133
47204
|
kind: "host_setup_issue",
|
|
47134
47205
|
check: "config_invalid",
|
|
47135
|
-
file:
|
|
47206
|
+
file: path51.join(projectRoot, "tempo.config.json"),
|
|
47136
47207
|
message: "tempo.config.json is missing or invalid.",
|
|
47137
47208
|
fix: `Create or fix tempo.config.json in the project root. ${DOCS_HINT2}`
|
|
47138
47209
|
};
|
|
@@ -47149,7 +47220,7 @@ async function runValidatePageCommand(args, options) {
|
|
|
47149
47220
|
});
|
|
47150
47221
|
const config = {
|
|
47151
47222
|
tsconfigPath: resolvedConfig.tsconfigPath,
|
|
47152
|
-
tempoPackageDir:
|
|
47223
|
+
tempoPackageDir: path51.dirname(resolvedConfig.packageJsonPath),
|
|
47153
47224
|
reuseTypeCheckService: options?.reuseTypeCheckService
|
|
47154
47225
|
};
|
|
47155
47226
|
const pageResult = await validatePage(pageFile, projectRoot, config);
|
|
@@ -47162,7 +47233,7 @@ async function runValidatePageCommand(args, options) {
|
|
|
47162
47233
|
}
|
|
47163
47234
|
|
|
47164
47235
|
// ../canvas-tools/commands/init.ts
|
|
47165
|
-
import
|
|
47236
|
+
import path52 from "path";
|
|
47166
47237
|
function toInitCommandResult(framework, initResult) {
|
|
47167
47238
|
return {
|
|
47168
47239
|
framework,
|
|
@@ -47174,7 +47245,7 @@ function toInitCommandResult(framework, initResult) {
|
|
|
47174
47245
|
}
|
|
47175
47246
|
async function runInitCommand(args) {
|
|
47176
47247
|
const framework = args.framework ?? "vite";
|
|
47177
|
-
const projectRoot =
|
|
47248
|
+
const projectRoot = path52.resolve(args.repo_root);
|
|
47178
47249
|
const initResult = await initializePagesSupport({ projectRoot, framework });
|
|
47179
47250
|
return toInitCommandResult(framework, initResult);
|
|
47180
47251
|
}
|
|
@@ -47276,10 +47347,10 @@ async function verifyAppInstrumentation(status) {
|
|
|
47276
47347
|
}
|
|
47277
47348
|
|
|
47278
47349
|
// ../canvas-mcp/canvas-validation.ts
|
|
47279
|
-
import
|
|
47350
|
+
import path54 from "path";
|
|
47280
47351
|
|
|
47281
47352
|
// ../canvas-mcp/asset-validation.ts
|
|
47282
|
-
import
|
|
47353
|
+
import path53 from "path";
|
|
47283
47354
|
import { readFileSync as readFileSync3 } from "fs";
|
|
47284
47355
|
var FIXES = {
|
|
47285
47356
|
duplicate_asset_declaration: "Keep one defineAsset beside the component. Existing canvas-owned declarations are also supported, but must not duplicate it.",
|
|
@@ -47291,11 +47362,11 @@ function formatAssetDeclarationIssue(issue) {
|
|
|
47291
47362
|
return `${issue.file} - ${issue.message}. Fix: ${issue.fix}`;
|
|
47292
47363
|
}
|
|
47293
47364
|
async function collectAssetDeclarationIssues(options) {
|
|
47294
|
-
const canvasFileAbs =
|
|
47295
|
-
const looksLikeFile = /\.[cm]?[jt]sx?$/i.test(
|
|
47365
|
+
const canvasFileAbs = path53.isAbsolute(options.canvasFile) ? options.canvasFile : path53.join(options.workspaceRoot, options.canvasFile);
|
|
47366
|
+
const looksLikeFile = /\.[cm]?[jt]sx?$/i.test(path53.basename(canvasFileAbs));
|
|
47296
47367
|
const canvasFolderRel = normalizeWorkspaceRelativePath(
|
|
47297
47368
|
options.workspaceRoot,
|
|
47298
|
-
looksLikeFile ?
|
|
47369
|
+
looksLikeFile ? path53.dirname(canvasFileAbs) : canvasFileAbs
|
|
47299
47370
|
);
|
|
47300
47371
|
const inCanvasFolder = (fileRel) => fileRel === canvasFolderRel || fileRel.startsWith(`${canvasFolderRel}/`);
|
|
47301
47372
|
const index = await loadWorkspaceAssetIndex({
|
|
@@ -47303,14 +47374,14 @@ async function collectAssetDeclarationIssues(options) {
|
|
|
47303
47374
|
canvasesDir: options.canvasesDir
|
|
47304
47375
|
});
|
|
47305
47376
|
const referenced = /* @__PURE__ */ new Set();
|
|
47306
|
-
const
|
|
47377
|
+
const readFile29 = (file) => {
|
|
47307
47378
|
try {
|
|
47308
|
-
return readFileSync3(
|
|
47379
|
+
return readFileSync3(path53.join(options.workspaceRoot, file), "utf8");
|
|
47309
47380
|
} catch {
|
|
47310
47381
|
return null;
|
|
47311
47382
|
}
|
|
47312
47383
|
};
|
|
47313
|
-
const canvasSource =
|
|
47384
|
+
const canvasSource = readFile29(`${canvasFolderRel}/index.canvas.tsx`);
|
|
47314
47385
|
if (canvasSource) {
|
|
47315
47386
|
const { program } = parseAssetProgram(
|
|
47316
47387
|
`${canvasFolderRel}/index.canvas.tsx`,
|
|
@@ -47322,7 +47393,7 @@ async function collectAssetDeclarationIssues(options) {
|
|
|
47322
47393
|
).referenceableImports.values()) {
|
|
47323
47394
|
const identityPath = imported.importSpecifier.startsWith(".") ? resolveRelativeImport(canvasFolderRel, imported.importSpecifier) : `pkg:${imported.importSpecifier}`;
|
|
47324
47395
|
const identity = resolveComponentIdentity(
|
|
47325
|
-
{ readFile:
|
|
47396
|
+
{ readFile: readFile29 },
|
|
47326
47397
|
identityPath,
|
|
47327
47398
|
imported.importedName,
|
|
47328
47399
|
`${canvasFolderRel}/index.canvas.tsx`
|
|
@@ -47365,7 +47436,7 @@ async function collectAssetDeclarationIssues(options) {
|
|
|
47365
47436
|
}
|
|
47366
47437
|
const canvasesDirRel = normalizeWorkspaceRelativePath(
|
|
47367
47438
|
options.workspaceRoot,
|
|
47368
|
-
|
|
47439
|
+
path53.resolve(options.workspaceRoot, options.canvasesDir)
|
|
47369
47440
|
);
|
|
47370
47441
|
const underCanvasesRoot = canvasFolderRel === canvasesDirRel || canvasFolderRel.startsWith(`${canvasesDirRel}/`);
|
|
47371
47442
|
const zone = underCanvasesRoot ? classifyCanvasZone(canvasFolderRel.slice(canvasesDirRel.length + 1)) : null;
|
|
@@ -47392,7 +47463,7 @@ async function collectAssetDeclarationIssues(options) {
|
|
|
47392
47463
|
// ../canvas-mcp/canvas-validation.ts
|
|
47393
47464
|
async function runCanvasValidation(args, options) {
|
|
47394
47465
|
if (args.validation_kind === "page-dependencies") {
|
|
47395
|
-
const result = await (options?.validatePageDependencies ?? ((pageFile, projectRoot) => validatePage(pageFile, projectRoot, { skipTypeCheck: true })))(
|
|
47466
|
+
const result = await (options?.validatePageDependencies ?? ((pageFile, projectRoot) => validatePage(pageFile, projectRoot, { skipTypeCheck: true })))(path54.resolve(args.canvas_file), path54.resolve(args.repo_root));
|
|
47396
47467
|
return {
|
|
47397
47468
|
valid: result.valid,
|
|
47398
47469
|
issues: result.issues,
|
|
@@ -47405,8 +47476,8 @@ async function runCanvasValidation(args, options) {
|
|
|
47405
47476
|
if (args.assets_enabled === false) {
|
|
47406
47477
|
return pageResult;
|
|
47407
47478
|
}
|
|
47408
|
-
const workspaceRoot =
|
|
47409
|
-
const canvasesDir = args.canvases_dir ??
|
|
47479
|
+
const workspaceRoot = path54.resolve(args.workspace_root ?? args.repo_root);
|
|
47480
|
+
const canvasesDir = args.canvases_dir ?? path54.join(workspaceRoot, "tempo", "designs");
|
|
47410
47481
|
const assetIssues = await collectAssetDeclarationIssues({
|
|
47411
47482
|
workspaceRoot,
|
|
47412
47483
|
canvasesDir,
|
|
@@ -47427,8 +47498,8 @@ async function runCanvasValidation(args, options) {
|
|
|
47427
47498
|
}
|
|
47428
47499
|
|
|
47429
47500
|
// ../canvas-mcp/storyboard-stability.ts
|
|
47430
|
-
import { readFile as
|
|
47431
|
-
import
|
|
47501
|
+
import { readFile as readFile25, realpath as realpath4 } from "fs/promises";
|
|
47502
|
+
import path55 from "path";
|
|
47432
47503
|
|
|
47433
47504
|
// ../../node_modules/.pnpm/pixelmatch@7.1.0/node_modules/pixelmatch/index.js
|
|
47434
47505
|
function pixelmatch(img1, img2, output, width, height, options = {}) {
|
|
@@ -47601,11 +47672,11 @@ function toPosix(value) {
|
|
|
47601
47672
|
return value.replace(/\\/g, "/");
|
|
47602
47673
|
}
|
|
47603
47674
|
function absoluteCanvasesRoot(workspaceRoot, canvasesDir) {
|
|
47604
|
-
return
|
|
47675
|
+
return path55.isAbsolute(canvasesDir) ? path55.resolve(canvasesDir) : path55.resolve(workspaceRoot, canvasesDir);
|
|
47605
47676
|
}
|
|
47606
47677
|
function isInsideRoot(root, target) {
|
|
47607
|
-
const relative3 =
|
|
47608
|
-
return relative3 === "" || !relative3.startsWith("..") && !
|
|
47678
|
+
const relative3 = path55.relative(root, target);
|
|
47679
|
+
return relative3 === "" || !relative3.startsWith("..") && !path55.isAbsolute(relative3);
|
|
47609
47680
|
}
|
|
47610
47681
|
async function isInsideRootForReal(root, file) {
|
|
47611
47682
|
try {
|
|
@@ -47625,7 +47696,7 @@ async function resolveCanvasFile(options) {
|
|
|
47625
47696
|
);
|
|
47626
47697
|
const identifier = options.canvasSlug;
|
|
47627
47698
|
const resolved = /* @__PURE__ */ new Set();
|
|
47628
|
-
const candidate =
|
|
47699
|
+
const candidate = path55.resolve(canvasesRoot, identifier);
|
|
47629
47700
|
const direct = isInsideRoot(canvasesRoot, candidate) ? await resolveCanvasFilePath(candidate) : null;
|
|
47630
47701
|
if (direct && await isInsideRootForReal(canvasesRoot, direct)) {
|
|
47631
47702
|
resolved.add(direct);
|
|
@@ -47633,7 +47704,7 @@ async function resolveCanvasFile(options) {
|
|
|
47633
47704
|
if (resolved.size === 0 && !identifier.includes("/")) {
|
|
47634
47705
|
const files = await findPageFilesInPagesRoot(canvasesRoot);
|
|
47635
47706
|
for (const file of files) {
|
|
47636
|
-
if (
|
|
47707
|
+
if (path55.basename(path55.dirname(file)) === identifier && await isInsideRootForReal(canvasesRoot, file)) {
|
|
47637
47708
|
resolved.add(file);
|
|
47638
47709
|
}
|
|
47639
47710
|
}
|
|
@@ -47645,7 +47716,7 @@ async function resolveCanvasFile(options) {
|
|
|
47645
47716
|
);
|
|
47646
47717
|
}
|
|
47647
47718
|
if (resolved.size > 1) {
|
|
47648
|
-
const candidates = [...resolved].map((file) => toPosix(
|
|
47719
|
+
const candidates = [...resolved].map((file) => toPosix(path55.relative(canvasesRoot, path55.dirname(file)))).sort();
|
|
47649
47720
|
throw new StoryboardStabilityTargetError(
|
|
47650
47721
|
"ambiguous_canvas_slug",
|
|
47651
47722
|
`"${options.canvasSlug}" names ${candidates.length} canvases: ${candidates.join(", ")}. Pass the full canvases-root-relative path.`
|
|
@@ -47662,7 +47733,7 @@ async function resolveCanvasFile(options) {
|
|
|
47662
47733
|
}
|
|
47663
47734
|
async function resolveTestedStoryboard(options) {
|
|
47664
47735
|
const canvasFile = await resolveCanvasFile(options);
|
|
47665
|
-
const source = await
|
|
47736
|
+
const source = await readFile25(canvasFile, "utf8");
|
|
47666
47737
|
const parsed = parsePageSource(canvasFile, source);
|
|
47667
47738
|
const storyboard = parsed.storyboards.find(
|
|
47668
47739
|
(candidate) => candidate.storyboardKey === options.storyboard || candidate.exportName === options.storyboard
|
|
@@ -47671,7 +47742,7 @@ async function resolveTestedStoryboard(options) {
|
|
|
47671
47742
|
const available = parsed.storyboards.map((candidate) => candidate.storyboardKey ?? candidate.exportName).join(", ");
|
|
47672
47743
|
throw new StoryboardStabilityTargetError(
|
|
47673
47744
|
"storyboard_not_found",
|
|
47674
|
-
`Storyboard "${options.storyboard}" was not found in ${toPosix(
|
|
47745
|
+
`Storyboard "${options.storyboard}" was not found in ${toPosix(path55.relative(options.workspaceRoot, canvasFile))}.${available ? ` Available storyboards: ${available}.` : ""}`
|
|
47675
47746
|
);
|
|
47676
47747
|
}
|
|
47677
47748
|
if (storyboard.error) {
|
|
@@ -47709,11 +47780,11 @@ async function resolveTestedStoryboard(options) {
|
|
|
47709
47780
|
);
|
|
47710
47781
|
}
|
|
47711
47782
|
return {
|
|
47712
|
-
canvasFile: toPosix(
|
|
47783
|
+
canvasFile: toPosix(path55.relative(options.workspaceRoot, canvasFile)),
|
|
47713
47784
|
canvasSlug: toPosix(
|
|
47714
|
-
|
|
47785
|
+
path55.relative(
|
|
47715
47786
|
absoluteCanvasesRoot(options.workspaceRoot, options.canvasesDir),
|
|
47716
|
-
|
|
47787
|
+
path55.dirname(canvasFile)
|
|
47717
47788
|
)
|
|
47718
47789
|
),
|
|
47719
47790
|
storyboardId: storyboard.storyboardKey ?? storyboard.exportName,
|
|
@@ -48002,11 +48073,11 @@ import {
|
|
|
48002
48073
|
access as access19,
|
|
48003
48074
|
mkdir as mkdir12,
|
|
48004
48075
|
readdir as readdir12,
|
|
48005
|
-
readFile as
|
|
48076
|
+
readFile as readFile28,
|
|
48006
48077
|
realpath as realpath5,
|
|
48007
48078
|
writeFile as writeFile11
|
|
48008
48079
|
} from "fs/promises";
|
|
48009
|
-
import
|
|
48080
|
+
import path59 from "path";
|
|
48010
48081
|
import { promisify as promisify4 } from "util";
|
|
48011
48082
|
|
|
48012
48083
|
// ../canvas-capture-headless/src/capture.ts
|
|
@@ -48404,7 +48475,7 @@ async function settlePage(page, targetSelector, options = {}) {
|
|
|
48404
48475
|
// ../canvas-capture-headless/src/ensure-chromium.ts
|
|
48405
48476
|
import { spawn as spawn7 } from "child_process";
|
|
48406
48477
|
import { createRequire as createRequire6 } from "module";
|
|
48407
|
-
import
|
|
48478
|
+
import path56 from "path";
|
|
48408
48479
|
var INSTALL_TIMEOUT_MS = 8 * 60 * 1e3;
|
|
48409
48480
|
function isMissingBrowserError(err) {
|
|
48410
48481
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -48415,8 +48486,8 @@ function autoInstallDisabled() {
|
|
|
48415
48486
|
}
|
|
48416
48487
|
async function installChromium(log, spawnImpl = spawn7) {
|
|
48417
48488
|
const require3 = createRequire6(import.meta.url);
|
|
48418
|
-
const cliPath =
|
|
48419
|
-
|
|
48489
|
+
const cliPath = path56.join(
|
|
48490
|
+
path56.dirname(require3.resolve("playwright/package.json")),
|
|
48420
48491
|
"cli.js"
|
|
48421
48492
|
);
|
|
48422
48493
|
await new Promise((resolve2, reject) => {
|
|
@@ -49582,10 +49653,10 @@ function compositeStoryboardPngs(images, options = {}) {
|
|
|
49582
49653
|
}
|
|
49583
49654
|
|
|
49584
49655
|
// ../canvas-capture-headless/src/devserver.ts
|
|
49585
|
-
import { readFile as
|
|
49586
|
-
import
|
|
49656
|
+
import { readFile as readFile26 } from "fs/promises";
|
|
49657
|
+
import path57 from "path";
|
|
49587
49658
|
async function readTempoDevserverConfig(tempoConfigPath) {
|
|
49588
|
-
const config = JSON.parse(await
|
|
49659
|
+
const config = JSON.parse(await readFile26(tempoConfigPath, "utf-8"));
|
|
49589
49660
|
if (!config.scripts?.install || !config.scripts?.start) {
|
|
49590
49661
|
throw new Error(
|
|
49591
49662
|
`tempo.config.json at ${tempoConfigPath} must declare scripts.install and scripts.start`
|
|
@@ -49608,47 +49679,47 @@ async function readTempoDevserverConfig(tempoConfigPath) {
|
|
|
49608
49679
|
};
|
|
49609
49680
|
}
|
|
49610
49681
|
function projectRootForTempoDir(tempoDir) {
|
|
49611
|
-
const resolved =
|
|
49612
|
-
return
|
|
49682
|
+
const resolved = path57.resolve(tempoDir);
|
|
49683
|
+
return path57.basename(resolved) === "tempo" ? path57.dirname(resolved) : resolved;
|
|
49613
49684
|
}
|
|
49614
49685
|
async function resolveCanvasHostLayout(options) {
|
|
49615
|
-
const repoRoot =
|
|
49616
|
-
const candidates = options.tempoDir ? [
|
|
49617
|
-
|
|
49618
|
-
|
|
49686
|
+
const repoRoot = path57.resolve(options.repoRoot);
|
|
49687
|
+
const candidates = options.tempoDir ? [path57.join(path57.resolve(options.tempoDir), "tempo.config.json")] : [
|
|
49688
|
+
path57.join(repoRoot, "tempo", "tempo.config.json"),
|
|
49689
|
+
path57.join(repoRoot, "tempo.config.json")
|
|
49619
49690
|
];
|
|
49620
49691
|
for (const configPath of candidates) {
|
|
49621
49692
|
let parsed;
|
|
49622
49693
|
try {
|
|
49623
|
-
parsed = JSON.parse(await
|
|
49694
|
+
parsed = JSON.parse(await readFile26(configPath, "utf-8"));
|
|
49624
49695
|
} catch {
|
|
49625
49696
|
continue;
|
|
49626
49697
|
}
|
|
49627
49698
|
if (typeof parsed !== "object" || parsed === null || !("scripts" in parsed)) {
|
|
49628
49699
|
continue;
|
|
49629
49700
|
}
|
|
49630
|
-
const tempoDir2 =
|
|
49701
|
+
const tempoDir2 = path57.dirname(configPath);
|
|
49631
49702
|
const paths = parsed.paths;
|
|
49632
49703
|
const canvases = typeof paths?.canvases === "string" && paths.canvases.trim().length > 0 ? paths.canvases.trim().split("\\").join("/") : "designs";
|
|
49633
49704
|
return {
|
|
49634
49705
|
tempoDir: tempoDir2,
|
|
49635
49706
|
projectRoot: projectRootForTempoDir(tempoDir2),
|
|
49636
|
-
pagesDir:
|
|
49707
|
+
pagesDir: path57.resolve(tempoDir2, canvases),
|
|
49637
49708
|
configPath
|
|
49638
49709
|
};
|
|
49639
49710
|
}
|
|
49640
|
-
const tempoDir = options.tempoDir ?
|
|
49711
|
+
const tempoDir = options.tempoDir ? path57.resolve(options.tempoDir) : path57.join(repoRoot, "tempo");
|
|
49641
49712
|
return {
|
|
49642
49713
|
tempoDir,
|
|
49643
49714
|
projectRoot: projectRootForTempoDir(tempoDir),
|
|
49644
|
-
pagesDir:
|
|
49715
|
+
pagesDir: path57.join(tempoDir, "designs"),
|
|
49645
49716
|
configPath: null
|
|
49646
49717
|
};
|
|
49647
49718
|
}
|
|
49648
49719
|
function resolveTempoDir(options) {
|
|
49649
|
-
if (options.tempoConfigPath) return
|
|
49720
|
+
if (options.tempoConfigPath) return path57.dirname(options.tempoConfigPath);
|
|
49650
49721
|
if (options.tempoDir) return options.tempoDir;
|
|
49651
|
-
if (options.repoRoot) return
|
|
49722
|
+
if (options.repoRoot) return path57.join(options.repoRoot, "tempo");
|
|
49652
49723
|
throw new Error(
|
|
49653
49724
|
"startDevserverSession needs one of tempoDir, repoRoot, or tempoConfigPath"
|
|
49654
49725
|
);
|
|
@@ -49707,7 +49778,7 @@ async function startDevserverSession(options) {
|
|
|
49707
49778
|
const log = options.log ?? (() => {
|
|
49708
49779
|
});
|
|
49709
49780
|
const tempoDir = resolveTempoDir(options);
|
|
49710
|
-
const tempoConfigPath = options.tempoConfigPath ??
|
|
49781
|
+
const tempoConfigPath = options.tempoConfigPath ?? path57.join(tempoDir, "tempo.config.json");
|
|
49711
49782
|
const config = await readTempoDevserverConfig(tempoConfigPath);
|
|
49712
49783
|
const hostCanvasPaths = options.hostCanvasPaths ?? [];
|
|
49713
49784
|
const devServer = new TempoDevServer({
|
|
@@ -49719,7 +49790,7 @@ async function startDevserverSession(options) {
|
|
|
49719
49790
|
const projectRoot = projectRootForTempoDir(tempoDir);
|
|
49720
49791
|
for (const hostCanvasPath of hostCanvasPaths) {
|
|
49721
49792
|
await devServer.ensureCanvasRegistered(
|
|
49722
|
-
|
|
49793
|
+
path57.join(projectRoot, hostCanvasPath)
|
|
49723
49794
|
);
|
|
49724
49795
|
}
|
|
49725
49796
|
const handle = await devServer.startDevServer();
|
|
@@ -49755,13 +49826,13 @@ async function startDevserverSession(options) {
|
|
|
49755
49826
|
log(`devserver ready at ${hostUrl}`);
|
|
49756
49827
|
const registerCanvas = async (hostCanvasPath) => {
|
|
49757
49828
|
await devServer.ensureCanvasRegistered(
|
|
49758
|
-
|
|
49829
|
+
path57.join(projectRoot, hostCanvasPath)
|
|
49759
49830
|
);
|
|
49760
49831
|
await awaitCanvasRegistration({
|
|
49761
49832
|
origin,
|
|
49762
49833
|
hostCanvasPath,
|
|
49763
49834
|
reRegister: () => devServer.ensureCanvasRegistered(
|
|
49764
|
-
|
|
49835
|
+
path57.join(projectRoot, hostCanvasPath)
|
|
49765
49836
|
),
|
|
49766
49837
|
log
|
|
49767
49838
|
});
|
|
@@ -49771,7 +49842,7 @@ async function startDevserverSession(options) {
|
|
|
49771
49842
|
origin,
|
|
49772
49843
|
hostCanvasPath,
|
|
49773
49844
|
reRegister: () => devServer.ensureCanvasRegistered(
|
|
49774
|
-
|
|
49845
|
+
path57.join(projectRoot, hostCanvasPath)
|
|
49775
49846
|
),
|
|
49776
49847
|
log
|
|
49777
49848
|
});
|
|
@@ -49792,13 +49863,13 @@ async function startDevserverSession(options) {
|
|
|
49792
49863
|
}
|
|
49793
49864
|
|
|
49794
49865
|
// ../canvas-capture-headless/src/enumerate.ts
|
|
49795
|
-
import { access as access18, readFile as
|
|
49796
|
-
import
|
|
49866
|
+
import { access as access18, readFile as readFile27 } from "fs/promises";
|
|
49867
|
+
import path58 from "path";
|
|
49797
49868
|
function toPosixPath7(value) {
|
|
49798
|
-
return value.split(
|
|
49869
|
+
return value.split(path58.sep).join("/");
|
|
49799
49870
|
}
|
|
49800
49871
|
async function enumerateCanvasStoryboards(options) {
|
|
49801
|
-
const pagesDir = options.pagesDir ??
|
|
49872
|
+
const pagesDir = options.pagesDir ?? path58.join(options.tempoDir, "designs");
|
|
49802
49873
|
const projectRoot = projectRootForTempoDir(options.tempoDir);
|
|
49803
49874
|
const canvasFiles = await scanCanvasFiles(pagesDir);
|
|
49804
49875
|
const storyboards = [];
|
|
@@ -49806,7 +49877,7 @@ async function enumerateCanvasStoryboards(options) {
|
|
|
49806
49877
|
const vrtConfigErrors = [];
|
|
49807
49878
|
let totalStoryboards = 0;
|
|
49808
49879
|
for (const filePath of canvasFiles) {
|
|
49809
|
-
const source = await
|
|
49880
|
+
const source = await readFile27(filePath, "utf-8");
|
|
49810
49881
|
const parsed = parseCanvasFile(filePath, source);
|
|
49811
49882
|
const structural = parsed.errors.filter(
|
|
49812
49883
|
(error) => error.kind === "structural"
|
|
@@ -49834,9 +49905,9 @@ async function enumerateCanvasStoryboards(options) {
|
|
|
49834
49905
|
continue;
|
|
49835
49906
|
}
|
|
49836
49907
|
const canvasPath = toPosixPath7(
|
|
49837
|
-
|
|
49908
|
+
path58.relative(options.tempoDir, path58.dirname(filePath))
|
|
49838
49909
|
);
|
|
49839
|
-
const hostCanvasPath = toPosixPath7(
|
|
49910
|
+
const hostCanvasPath = toPosixPath7(path58.relative(projectRoot, filePath));
|
|
49840
49911
|
for (const storyboard of parsed.storyboards) {
|
|
49841
49912
|
totalStoryboards += 1;
|
|
49842
49913
|
if (storyboard.kind !== "component") continue;
|
|
@@ -49944,19 +50015,19 @@ function normalizeRepoUrl2(url) {
|
|
|
49944
50015
|
const sshMatch = cleaned.match(sshShorthand);
|
|
49945
50016
|
if (sshMatch) {
|
|
49946
50017
|
const host = sshMatch[1];
|
|
49947
|
-
const
|
|
49948
|
-
return finalize2(host,
|
|
50018
|
+
const path64 = sshMatch[2];
|
|
50019
|
+
return finalize2(host, path64);
|
|
49949
50020
|
}
|
|
49950
50021
|
const protocolMatch = cleaned.match(/^[\w+.-]+:\/\/(?:[^@]+@)?([\w.-]+)\/([\w./-]+)$/);
|
|
49951
50022
|
if (protocolMatch) {
|
|
49952
50023
|
const host = protocolMatch[1];
|
|
49953
|
-
const
|
|
49954
|
-
return finalize2(host,
|
|
50024
|
+
const path64 = protocolMatch[2];
|
|
50025
|
+
return finalize2(host, path64);
|
|
49955
50026
|
}
|
|
49956
50027
|
return null;
|
|
49957
50028
|
}
|
|
49958
|
-
function finalize2(host,
|
|
49959
|
-
let cleaned =
|
|
50029
|
+
function finalize2(host, path64) {
|
|
50030
|
+
let cleaned = path64.replace(/\.git$/, "");
|
|
49960
50031
|
cleaned = cleaned.replace(/^\/+|\/+$/g, "");
|
|
49961
50032
|
if (!cleaned) return null;
|
|
49962
50033
|
return `${host}/${cleaned}`.toLowerCase();
|
|
@@ -50568,18 +50639,18 @@ async function exists3(target) {
|
|
|
50568
50639
|
}
|
|
50569
50640
|
async function assertWriteInsideRepo(repoRoot, target) {
|
|
50570
50641
|
const realRoot = await realpath5(repoRoot);
|
|
50571
|
-
let probe =
|
|
50642
|
+
let probe = path59.resolve(target);
|
|
50572
50643
|
while (!await exists3(probe)) {
|
|
50573
|
-
const parent =
|
|
50644
|
+
const parent = path59.dirname(probe);
|
|
50574
50645
|
if (parent === probe) break;
|
|
50575
50646
|
probe = parent;
|
|
50576
50647
|
}
|
|
50577
50648
|
const realProbe = await realpath5(probe);
|
|
50578
|
-
const relative3 =
|
|
50579
|
-
if (relative3.startsWith("..") ||
|
|
50649
|
+
const relative3 = path59.relative(realRoot, realProbe);
|
|
50650
|
+
if (relative3.startsWith("..") || path59.isAbsolute(relative3)) {
|
|
50580
50651
|
throw new VisualReviewSetupError(
|
|
50581
50652
|
"path_outside_repo",
|
|
50582
|
-
`${toPosix2(
|
|
50653
|
+
`${toPosix2(path59.relative(repoRoot, target))} resolves outside the repository (${realProbe}), so nothing was written. Replace that symlink with a real directory or file, then re-run visual_review_init.`
|
|
50583
50654
|
);
|
|
50584
50655
|
}
|
|
50585
50656
|
}
|
|
@@ -50680,17 +50751,17 @@ async function readHostConfig(repoRoot) {
|
|
|
50680
50751
|
}
|
|
50681
50752
|
}
|
|
50682
50753
|
async function enumerateTrackedStoryboards2(options) {
|
|
50683
|
-
const repoRoot =
|
|
50754
|
+
const repoRoot = path59.resolve(options.workspaceRoot);
|
|
50684
50755
|
const { tempoDir, pagesDir, projectRoot } = await resolveCanvasHostLayout({
|
|
50685
50756
|
repoRoot,
|
|
50686
50757
|
tempoDir: options.tempoDir
|
|
50687
50758
|
});
|
|
50688
50759
|
const result = await enumerateTrackedStoryboards({ tempoDir, pagesDir });
|
|
50689
50760
|
const summarize2 = (board) => {
|
|
50690
|
-
const absolute =
|
|
50761
|
+
const absolute = path59.resolve(projectRoot, board.hostCanvasPath);
|
|
50691
50762
|
return {
|
|
50692
|
-
canvas_slug: toPosix2(
|
|
50693
|
-
canvas_file: toPosix2(
|
|
50763
|
+
canvas_slug: toPosix2(path59.relative(pagesDir, path59.dirname(absolute))),
|
|
50764
|
+
canvas_file: toPosix2(path59.relative(repoRoot, absolute)),
|
|
50694
50765
|
storyboard: board.storyboardId,
|
|
50695
50766
|
name: board.name ?? null,
|
|
50696
50767
|
threshold: board.threshold ?? null,
|
|
@@ -50703,27 +50774,27 @@ async function enumerateTrackedStoryboards2(options) {
|
|
|
50703
50774
|
total_canvases: result.totalCanvases,
|
|
50704
50775
|
total_storyboards: result.totalStoryboards,
|
|
50705
50776
|
errors: result.errors.map((error) => ({
|
|
50706
|
-
file: toPosix2(
|
|
50777
|
+
file: toPosix2(path59.relative(repoRoot, error.filePath)),
|
|
50707
50778
|
message: error.message
|
|
50708
50779
|
}))
|
|
50709
50780
|
};
|
|
50710
50781
|
}
|
|
50711
50782
|
async function findVisualReviewWorkflow(repoRoot) {
|
|
50712
|
-
const workflowsDir =
|
|
50783
|
+
const workflowsDir = path59.join(repoRoot, ".github", "workflows");
|
|
50713
50784
|
if (!await exists3(workflowsDir)) return null;
|
|
50714
|
-
const canonical =
|
|
50785
|
+
const canonical = path59.join(repoRoot, VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH);
|
|
50715
50786
|
if (await exists3(canonical)) {
|
|
50716
50787
|
return {
|
|
50717
50788
|
file: VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH,
|
|
50718
|
-
content: await
|
|
50789
|
+
content: await readFile28(canonical, "utf8")
|
|
50719
50790
|
};
|
|
50720
50791
|
}
|
|
50721
50792
|
const entries = (await readdir12(workflowsDir)).filter((name) => /\.ya?ml$/i.test(name)).sort();
|
|
50722
50793
|
for (const name of entries) {
|
|
50723
|
-
const file =
|
|
50724
|
-
const content = await
|
|
50794
|
+
const file = path59.join(workflowsDir, name);
|
|
50795
|
+
const content = await readFile28(file, "utf8");
|
|
50725
50796
|
if (content.includes("@tempo-ai/visual-review") || content.includes(`context=${VISUAL_REVIEW_STATUS_CONTEXT2}`)) {
|
|
50726
|
-
return { file: toPosix2(
|
|
50797
|
+
return { file: toPosix2(path59.relative(repoRoot, file)), content };
|
|
50727
50798
|
}
|
|
50728
50799
|
}
|
|
50729
50800
|
return null;
|
|
@@ -50739,13 +50810,13 @@ var OTHER_CI_MARKERS = [
|
|
|
50739
50810
|
async function classifyCiProvider(identity) {
|
|
50740
50811
|
const otherCi = [];
|
|
50741
50812
|
for (const marker of OTHER_CI_MARKERS) {
|
|
50742
|
-
if (await exists3(
|
|
50813
|
+
if (await exists3(path59.join(identity.repoRoot, marker))) otherCi.push(marker);
|
|
50743
50814
|
}
|
|
50744
50815
|
return {
|
|
50745
50816
|
provider: identity.host === "github.com" ? "github-actions" : identity.host ? "unsupported" : "unknown",
|
|
50746
50817
|
host: identity.host,
|
|
50747
50818
|
workflows_dir_exists: await exists3(
|
|
50748
|
-
|
|
50819
|
+
path59.join(identity.repoRoot, ".github", "workflows")
|
|
50749
50820
|
),
|
|
50750
50821
|
other_ci_configs: otherCi
|
|
50751
50822
|
};
|
|
@@ -50802,14 +50873,14 @@ var LOCKFILES_BY_PM = {
|
|
|
50802
50873
|
};
|
|
50803
50874
|
async function findLockfile(repoRoot, pm) {
|
|
50804
50875
|
for (const name of LOCKFILES_BY_PM[pm]) {
|
|
50805
|
-
if (await exists3(
|
|
50876
|
+
if (await exists3(path59.join(repoRoot, name))) return name;
|
|
50806
50877
|
}
|
|
50807
50878
|
return null;
|
|
50808
50879
|
}
|
|
50809
50880
|
async function hasPackageManagerField(repoRoot) {
|
|
50810
50881
|
try {
|
|
50811
50882
|
const parsed = JSON.parse(
|
|
50812
|
-
await
|
|
50883
|
+
await readFile28(path59.join(repoRoot, "package.json"), "utf8")
|
|
50813
50884
|
);
|
|
50814
50885
|
return typeof parsed.packageManager === "string" && parsed.packageManager.trim() !== "";
|
|
50815
50886
|
} catch {
|
|
@@ -50942,7 +51013,7 @@ async function safeCheck(id, run) {
|
|
|
50942
51013
|
}
|
|
50943
51014
|
}
|
|
50944
51015
|
async function runVisualReviewDoctor(context, args = {}) {
|
|
50945
|
-
const repoRoot =
|
|
51016
|
+
const repoRoot = path59.resolve(args.repoRoot ?? context.workspaceRoot);
|
|
50946
51017
|
const identity = await resolveRepoIdentity(repoRoot, {
|
|
50947
51018
|
githubApi: context.githubApi
|
|
50948
51019
|
});
|
|
@@ -50963,8 +51034,8 @@ async function runVisualReviewDoctor(context, args = {}) {
|
|
|
50963
51034
|
return {
|
|
50964
51035
|
id: "canvas_host",
|
|
50965
51036
|
ok: complete,
|
|
50966
|
-
tempo_dir: toPosix2(
|
|
50967
|
-
canvases_dir: toPosix2(
|
|
51037
|
+
tempo_dir: toPosix2(path59.relative(repoRoot, host.config.tempoDir)) || ".",
|
|
51038
|
+
canvases_dir: toPosix2(path59.relative(repoRoot, host.config.pagesDir)),
|
|
50968
51039
|
install: host.config.install,
|
|
50969
51040
|
start: host.config.start,
|
|
50970
51041
|
...complete ? {} : {
|
|
@@ -51304,7 +51375,7 @@ function appendSeparator(current) {
|
|
|
51304
51375
|
return current.length === 0 || current.endsWith("\n\n") ? "" : current.endsWith("\n") ? "\n" : "\n\n";
|
|
51305
51376
|
}
|
|
51306
51377
|
async function runVisualReviewInit(context, args = {}) {
|
|
51307
|
-
const repoRoot =
|
|
51378
|
+
const repoRoot = path59.resolve(args.repoRoot ?? context.workspaceRoot);
|
|
51308
51379
|
const warnings = [];
|
|
51309
51380
|
const host = await readHostConfig(repoRoot);
|
|
51310
51381
|
if (!host.config) {
|
|
@@ -51325,7 +51396,7 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51325
51396
|
if (identity.host !== "github.com") {
|
|
51326
51397
|
throw new VisualReviewSetupError("unsupported_ci", unsupportedCiMessage(identity.host));
|
|
51327
51398
|
}
|
|
51328
|
-
const tempoDir = toPosix2(
|
|
51399
|
+
const tempoDir = toPosix2(path59.relative(repoRoot, host.config.tempoDir)) || ".";
|
|
51329
51400
|
const detected = await detectOwningPackageManager(repoRoot);
|
|
51330
51401
|
const install = classifyInstallScript(host.config.install, detected);
|
|
51331
51402
|
if (install.warning) warnings.push(install.warning);
|
|
@@ -51339,14 +51410,14 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51339
51410
|
`The default branch could not be determined (no origin/HEAD, no local main/master); the workflow assumes \`${identity.defaultBranch}\`. Fix the \`push: branches\` trigger if that is wrong.`
|
|
51340
51411
|
);
|
|
51341
51412
|
}
|
|
51342
|
-
const agentRulesTarget = args.withAgentRules ? await exists3(
|
|
51413
|
+
const agentRulesTarget = args.withAgentRules ? await exists3(path59.join(repoRoot, "CLAUDE.md")) ? "CLAUDE.md" : await exists3(path59.join(repoRoot, "AGENTS.md")) ? "AGENTS.md" : null : null;
|
|
51343
51414
|
const prTemplateRelative = ".github/PULL_REQUEST_TEMPLATE.md";
|
|
51344
51415
|
for (const relative3 of [
|
|
51345
51416
|
VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH,
|
|
51346
51417
|
...agentRulesTarget ? [agentRulesTarget] : [],
|
|
51347
51418
|
...args.withPrTemplate ? [prTemplateRelative] : []
|
|
51348
51419
|
]) {
|
|
51349
|
-
await assertWriteInsideRepo(repoRoot,
|
|
51420
|
+
await assertWriteInsideRepo(repoRoot, path59.join(repoRoot, relative3));
|
|
51350
51421
|
}
|
|
51351
51422
|
let existing = await findVisualReviewWorkflow(repoRoot);
|
|
51352
51423
|
let workflowFile = existing?.file ?? VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH;
|
|
@@ -51363,8 +51434,8 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51363
51434
|
hasPackageManagerField: await hasPackageManagerField(repoRoot),
|
|
51364
51435
|
customInstall: install.customInstall
|
|
51365
51436
|
});
|
|
51366
|
-
const target =
|
|
51367
|
-
await mkdir12(
|
|
51437
|
+
const target = path59.join(repoRoot, VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH);
|
|
51438
|
+
await mkdir12(path59.dirname(target), { recursive: true });
|
|
51368
51439
|
try {
|
|
51369
51440
|
await writeFile11(target, rendered, { encoding: "utf8", flag: "wx" });
|
|
51370
51441
|
written = true;
|
|
@@ -51389,9 +51460,9 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51389
51460
|
"with_agent_rules: neither CLAUDE.md nor AGENTS.md exists at the repo root, so no agent rules were written. Ask the user which file their agents read, create it, and re-run with with_agent_rules."
|
|
51390
51461
|
);
|
|
51391
51462
|
} else {
|
|
51392
|
-
const file =
|
|
51463
|
+
const file = path59.join(repoRoot, target);
|
|
51393
51464
|
agentRules = await queuedFileEditor.withFileLock(file, async () => {
|
|
51394
|
-
const current = await
|
|
51465
|
+
const current = await readFile28(file, "utf8");
|
|
51395
51466
|
if (current.includes(AGENT_RULES_HEADING)) {
|
|
51396
51467
|
return { file: target, written: false };
|
|
51397
51468
|
}
|
|
@@ -51406,10 +51477,10 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51406
51477
|
let prTemplate = null;
|
|
51407
51478
|
if (args.withPrTemplate) {
|
|
51408
51479
|
const relative3 = prTemplateRelative;
|
|
51409
|
-
const file =
|
|
51480
|
+
const file = path59.join(repoRoot, relative3);
|
|
51410
51481
|
prTemplate = await queuedFileEditor.withFileLock(file, async () => {
|
|
51411
51482
|
if (await exists3(file)) {
|
|
51412
|
-
const current = await
|
|
51483
|
+
const current = await readFile28(file, "utf8");
|
|
51413
51484
|
if (/^##\s+Visual review\b/im.test(current)) {
|
|
51414
51485
|
return { file: relative3, written: false };
|
|
51415
51486
|
}
|
|
@@ -51419,7 +51490,7 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51419
51490
|
);
|
|
51420
51491
|
return { file: relative3, written: true };
|
|
51421
51492
|
}
|
|
51422
|
-
await mkdir12(
|
|
51493
|
+
await mkdir12(path59.dirname(file), { recursive: true });
|
|
51423
51494
|
try {
|
|
51424
51495
|
await writeFile11(
|
|
51425
51496
|
file,
|
|
@@ -51488,9 +51559,9 @@ async function applyStoryboardVrt(options) {
|
|
|
51488
51559
|
failure2.message ?? String(error)
|
|
51489
51560
|
);
|
|
51490
51561
|
}
|
|
51491
|
-
const relativeFile = toPosix2(
|
|
51562
|
+
const relativeFile = toPosix2(path59.relative(options.workspaceRoot, canvasFile));
|
|
51492
51563
|
const outcome = await queuedFileEditor.withFileLock(canvasFile, async () => {
|
|
51493
|
-
const source = await
|
|
51564
|
+
const source = await readFile28(canvasFile, "utf8");
|
|
51494
51565
|
const parsed = parseCanvasFile(canvasFile, source);
|
|
51495
51566
|
const structural = parsed.errors.filter((error) => error.kind === "structural");
|
|
51496
51567
|
if (structural.length > 0) {
|
|
@@ -51535,9 +51606,9 @@ async function applyStoryboardVrt(options) {
|
|
|
51535
51606
|
});
|
|
51536
51607
|
const tracked = outcome.vrt !== null;
|
|
51537
51608
|
const paused = Boolean(outcome.vrt?.skip);
|
|
51538
|
-
const canvasesRoot =
|
|
51609
|
+
const canvasesRoot = path59.isAbsolute(options.canvasesDir) ? path59.resolve(options.canvasesDir) : path59.resolve(options.workspaceRoot, options.canvasesDir);
|
|
51539
51610
|
return {
|
|
51540
|
-
canvas_slug: toPosix2(
|
|
51611
|
+
canvas_slug: toPosix2(path59.relative(canvasesRoot, path59.dirname(canvasFile))),
|
|
51541
51612
|
canvas_file: relativeFile,
|
|
51542
51613
|
storyboard: options.storyboard,
|
|
51543
51614
|
tracked,
|
|
@@ -51566,12 +51637,12 @@ async function normalizeCanvasSlug(input, workspaceRoot) {
|
|
|
51566
51637
|
const value = input.trim().replace(/\\/g, "/").replace(/\/+$/, "").replace(/\/[^/]*\.canvas\.tsx$/i, "");
|
|
51567
51638
|
if (!value.includes("/")) return value;
|
|
51568
51639
|
const canvasesDir = resolveCanvasesDirSync(workspaceRoot);
|
|
51569
|
-
const absoluteCanvasesDir =
|
|
51570
|
-
const candidates =
|
|
51640
|
+
const absoluteCanvasesDir = path60.isAbsolute(canvasesDir) ? canvasesDir : path60.join(workspaceRoot, canvasesDir);
|
|
51641
|
+
const candidates = path60.isAbsolute(value) ? [value] : [path60.join(workspaceRoot, value), path60.join(absoluteCanvasesDir, value)];
|
|
51571
51642
|
for (const candidate of candidates) {
|
|
51572
51643
|
const dir = await resolveCanvasDirPath(candidate);
|
|
51573
51644
|
if (!dir) continue;
|
|
51574
|
-
const relative3 =
|
|
51645
|
+
const relative3 = path60.relative(absoluteCanvasesDir, dir).replace(/\\/g, "/");
|
|
51575
51646
|
return relative3 && !relative3.startsWith("..") ? relative3 : value;
|
|
51576
51647
|
}
|
|
51577
51648
|
return value;
|
|
@@ -52753,11 +52824,11 @@ function buildBackends(runtime, toolsets, workspace) {
|
|
|
52753
52824
|
}
|
|
52754
52825
|
|
|
52755
52826
|
// src/version.ts
|
|
52756
|
-
var CLI_VERSION = "0.0.
|
|
52827
|
+
var CLI_VERSION = "0.0.121-staging.1";
|
|
52757
52828
|
|
|
52758
52829
|
// src/canvas-hooks.ts
|
|
52759
52830
|
var import_pngjs4 = __toESM(require_png(), 1);
|
|
52760
|
-
import
|
|
52831
|
+
import path63 from "path";
|
|
52761
52832
|
import { stat as stat10 } from "fs/promises";
|
|
52762
52833
|
import { gzipSync } from "zlib";
|
|
52763
52834
|
import { anyApi as anyApi9 } from "convex/server";
|
|
@@ -52766,7 +52837,7 @@ import { anyApi as anyApi9 } from "convex/server";
|
|
|
52766
52837
|
import { createHash as createHash5, randomUUID as randomUUID5 } from "crypto";
|
|
52767
52838
|
import fs6 from "fs/promises";
|
|
52768
52839
|
import os3 from "os";
|
|
52769
|
-
import
|
|
52840
|
+
import path61 from "path";
|
|
52770
52841
|
|
|
52771
52842
|
// ../workspaces/git-worktree/non-interactive-git.ts
|
|
52772
52843
|
var NON_INTERACTIVE_GIT_CONFIG = [
|
|
@@ -52888,7 +52959,7 @@ async function checkBranchOnRemote(repoPath, branch) {
|
|
|
52888
52959
|
|
|
52889
52960
|
// ../workspaces/git-worktree/canvas-scan-cache.ts
|
|
52890
52961
|
import fs7 from "fs/promises";
|
|
52891
|
-
import
|
|
52962
|
+
import path62 from "path";
|
|
52892
52963
|
var DEFAULT_CONCURRENCY = 6;
|
|
52893
52964
|
var DEFAULT_MAX_AGE_MS = 5 * 6e4;
|
|
52894
52965
|
var Semaphore = class {
|
|
@@ -52915,14 +52986,14 @@ var sharedSemaphore = new Semaphore(DEFAULT_CONCURRENCY);
|
|
|
52915
52986
|
// src/canvas-hooks.ts
|
|
52916
52987
|
var MAX_MCP_SCREENSHOT_DIMENSION_PX = 1990;
|
|
52917
52988
|
function toPosix3(value) {
|
|
52918
|
-
return value.split(
|
|
52989
|
+
return value.split(path63.sep).join("/");
|
|
52919
52990
|
}
|
|
52920
52991
|
function normalizeSlug(input) {
|
|
52921
52992
|
return input.trim().replace(/\\/g, "/").replace(/\/+$/, "").replace(/\/[^/]*\.canvas\.tsx$/i, "");
|
|
52922
52993
|
}
|
|
52923
52994
|
async function isCanvasFolder(dir) {
|
|
52924
52995
|
try {
|
|
52925
|
-
return (await stat10(
|
|
52996
|
+
return (await stat10(path63.join(dir, "index.canvas.tsx"))).isFile();
|
|
52926
52997
|
} catch {
|
|
52927
52998
|
return false;
|
|
52928
52999
|
}
|
|
@@ -52930,18 +53001,18 @@ async function isCanvasFolder(dir) {
|
|
|
52930
53001
|
async function resolveCanvas(workspace, canvasSlug) {
|
|
52931
53002
|
const workspaceRoot = workspace.workspaceRoot;
|
|
52932
53003
|
const canvasesDir = workspace.canvasesDir;
|
|
52933
|
-
const tempoDir =
|
|
53004
|
+
const tempoDir = path63.join(workspaceRoot, "tempo");
|
|
52934
53005
|
const enumeration = await enumerateCanvasStoryboards({
|
|
52935
53006
|
tempoDir,
|
|
52936
53007
|
pagesDir: canvasesDir
|
|
52937
53008
|
});
|
|
52938
53009
|
const byFolder = /* @__PURE__ */ new Map();
|
|
52939
53010
|
for (const storyboard of enumeration.storyboards) {
|
|
52940
|
-
const folder =
|
|
53011
|
+
const folder = path63.dirname(storyboard.filePath);
|
|
52941
53012
|
let canvas = byFolder.get(folder);
|
|
52942
53013
|
if (!canvas) {
|
|
52943
53014
|
canvas = {
|
|
52944
|
-
contentPath: toPosix3(
|
|
53015
|
+
contentPath: toPosix3(path63.relative(workspaceRoot, folder)),
|
|
52945
53016
|
hostCanvasPath: storyboard.hostCanvasPath,
|
|
52946
53017
|
storyboards: []
|
|
52947
53018
|
};
|
|
@@ -52951,15 +53022,15 @@ async function resolveCanvas(workspace, canvasSlug) {
|
|
|
52951
53022
|
}
|
|
52952
53023
|
const slug = normalizeSlug(canvasSlug);
|
|
52953
53024
|
if (!slug) return { kind: "not_found" };
|
|
52954
|
-
if (slug.includes("/") ||
|
|
53025
|
+
if (slug.includes("/") || path63.isAbsolute(canvasSlug)) {
|
|
52955
53026
|
for (const [folder, canvas] of byFolder) {
|
|
52956
53027
|
const candidates = [
|
|
52957
|
-
toPosix3(
|
|
52958
|
-
toPosix3(
|
|
52959
|
-
toPosix3(
|
|
53028
|
+
toPosix3(path63.relative(canvasesDir, folder)),
|
|
53029
|
+
toPosix3(path63.relative(workspaceRoot, folder)),
|
|
53030
|
+
toPosix3(path63.relative(tempoDir, folder))
|
|
52960
53031
|
];
|
|
52961
|
-
if (
|
|
52962
|
-
if (
|
|
53032
|
+
if (path63.isAbsolute(canvasSlug)) {
|
|
53033
|
+
if (path63.resolve(canvasSlug) === folder) {
|
|
52963
53034
|
return { kind: "ok", canvas };
|
|
52964
53035
|
}
|
|
52965
53036
|
continue;
|
|
@@ -52968,29 +53039,29 @@ async function resolveCanvas(workspace, canvasSlug) {
|
|
|
52968
53039
|
}
|
|
52969
53040
|
} else {
|
|
52970
53041
|
const matches = [...byFolder.entries()].filter(
|
|
52971
|
-
([folder]) =>
|
|
53042
|
+
([folder]) => path63.basename(folder) === slug
|
|
52972
53043
|
);
|
|
52973
53044
|
if (matches.length > 1) {
|
|
52974
53045
|
return {
|
|
52975
53046
|
kind: "ambiguous",
|
|
52976
|
-
candidates: matches.map(([folder]) => toPosix3(
|
|
53047
|
+
candidates: matches.map(([folder]) => toPosix3(path63.relative(canvasesDir, folder))).sort()
|
|
52977
53048
|
};
|
|
52978
53049
|
}
|
|
52979
53050
|
if (matches.length === 1) return { kind: "ok", canvas: matches[0][1] };
|
|
52980
53051
|
}
|
|
52981
|
-
const probeDirs =
|
|
52982
|
-
|
|
52983
|
-
|
|
52984
|
-
|
|
53052
|
+
const probeDirs = path63.isAbsolute(canvasSlug) ? [path63.resolve(canvasSlug)] : [
|
|
53053
|
+
path63.join(canvasesDir, slug),
|
|
53054
|
+
path63.join(workspaceRoot, slug),
|
|
53055
|
+
path63.join(tempoDir, slug)
|
|
52985
53056
|
];
|
|
52986
53057
|
for (const dir of probeDirs) {
|
|
52987
53058
|
if (await isCanvasFolder(dir)) {
|
|
52988
53059
|
return {
|
|
52989
53060
|
kind: "ok",
|
|
52990
53061
|
canvas: {
|
|
52991
|
-
contentPath: toPosix3(
|
|
53062
|
+
contentPath: toPosix3(path63.relative(workspaceRoot, dir)),
|
|
52992
53063
|
hostCanvasPath: toPosix3(
|
|
52993
|
-
|
|
53064
|
+
path63.relative(workspaceRoot, path63.join(dir, "index.canvas.tsx"))
|
|
52994
53065
|
),
|
|
52995
53066
|
storyboards: []
|
|
52996
53067
|
}
|
|
@@ -53704,4 +53775,4 @@ unpdf/dist/index.mjs:
|
|
|
53704
53775
|
* @license Apache-2.0
|
|
53705
53776
|
*)
|
|
53706
53777
|
*/
|
|
53707
|
-
//# sourceMappingURL=serve-
|
|
53778
|
+
//# sourceMappingURL=serve-D3Q5GOTK.js.map
|