@tempo-ai/mcp 0.0.120 → 0.0.121-staging.2
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 +2 -2
- package/dist/{call-IIIBQ5BB.js → call-7B2EECHI.js} +3 -3
- package/dist/{chunk-2P3T5CJG.js → chunk-EINSFKA4.js} +74 -49
- package/dist/chunk-EINSFKA4.js.map +1 -0
- package/dist/{chunk-NA7LS57T.js → chunk-OYRTDV3W.js} +6 -6
- package/dist/index.js +2 -2
- package/dist/{serve-5O3DTGPO.js → serve-7ODS7UPT.js} +743 -662
- package/dist/serve-7ODS7UPT.js.map +1 -0
- package/dist/{token-QSGSKGO3.js → token-A6U2CCWJ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-2P3T5CJG.js.map +0 -1
- package/dist/serve-5O3DTGPO.js.map +0 -1
- /package/dist/{call-IIIBQ5BB.js.map → call-7B2EECHI.js.map} +0 -0
- /package/dist/{chunk-NA7LS57T.js.map → chunk-OYRTDV3W.js.map} +0 -0
- /package/dist/{token-QSGSKGO3.js.map → token-A6U2CCWJ.js.map} +0 -0
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
resolveConvexUrl,
|
|
19
19
|
resolveSignInWaitMs,
|
|
20
20
|
storedAuthMatchesAccessToken
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-EINSFKA4.js";
|
|
22
22
|
import {
|
|
23
23
|
__commonJS,
|
|
24
24
|
__require,
|
|
@@ -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
|
|
@@ -16928,6 +16928,8 @@ function buildDbBackends(runtime, toolsets) {
|
|
|
16928
16928
|
import { McpServer as McpServer8 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
16929
16929
|
import { anyApi as anyApi8 } from "convex/server";
|
|
16930
16930
|
import { z as z21 } from "zod";
|
|
16931
|
+
var ORG_SELECTION_GUIDANCE = "Honor an unambiguous organization choice from the user. Otherwise infer the organization from high-confidence task context, such as a referenced existing artifact/project or a unique repository match. Before asking, call tempo_list_projects for plausible organizations and inspect their repositories. Do not ask merely because the user belongs to multiple organizations: when one clearly fits, proceed and briefly state the choice. If context is insufficient, the requested organization cannot be identified, or several choices remain plausible, ask one concise clarification. There is no default organization. Never choose by list order or assume that an organization named 'Private Projects' is a default or guarantees privacy.";
|
|
16932
|
+
var PROJECT_SELECTION_GUIDANCE = "Match the current repository against ALL repos[].sourceUrl / repos[].normalizedUrl entries, including secondary repositories. Account for equivalent SSH/HTTPS URLs and .git suffixes; a project name alone is not a repository match. repoUrl is only a compatibility alias for the first available sourceUrl. If organization ownership is unclear, inspect other plausible organizations with tempo_list_projects before asking. There is no default organization. Register a missing project only after resolving its organization from the user's request or clear task context.";
|
|
16931
16933
|
function createHostToolsServer(options) {
|
|
16932
16934
|
const convex = new AuthedConvexClient({
|
|
16933
16935
|
url: options.convexUrl,
|
|
@@ -16936,7 +16938,7 @@ function createHostToolsServer(options) {
|
|
|
16936
16938
|
const server = new McpServer8({ name: "tempo-host", version: "0.0.1" });
|
|
16937
16939
|
server.tool(
|
|
16938
16940
|
"tempo_list_orgs",
|
|
16939
|
-
|
|
16941
|
+
`List the signed-in user's Tempo organizations. Call this FIRST to get the orgId that every issues/docs/comments/agents/scripts/slack/linear tool requires. ${ORG_SELECTION_GUIDANCE}`,
|
|
16940
16942
|
{},
|
|
16941
16943
|
async () => {
|
|
16942
16944
|
const orgs = await convex.query(
|
|
@@ -16952,7 +16954,7 @@ function createHostToolsServer(options) {
|
|
|
16952
16954
|
rows.length === 0 ? {
|
|
16953
16955
|
orgs: rows,
|
|
16954
16956
|
hint: "This account belongs to no organization yet. Ask the user to run `npx -y @tempo-ai/mcp logout`, then call this tool again \u2014 the fresh sign-in link walks the account through creating its organization in the browser."
|
|
16955
|
-
} : { orgs: rows }
|
|
16957
|
+
} : { orgs: rows, hint: ORG_SELECTION_GUIDANCE }
|
|
16956
16958
|
)
|
|
16957
16959
|
}
|
|
16958
16960
|
]
|
|
@@ -16961,7 +16963,7 @@ function createHostToolsServer(options) {
|
|
|
16961
16963
|
);
|
|
16962
16964
|
server.tool(
|
|
16963
16965
|
"tempo_list_projects",
|
|
16964
|
-
|
|
16966
|
+
`List a Tempo organization's projects and their repositories. Use this to get the projectId required by the project-scoped agents/scripts tools (and canvas_share), and to resolve the organization from task context. ${PROJECT_SELECTION_GUIDANCE}`,
|
|
16965
16967
|
{ orgId: z21.string().describe("Organization id from tempo_list_orgs.") },
|
|
16966
16968
|
async (args) => {
|
|
16967
16969
|
const projects = await convex.query(anyApi8.projects.getOrgProjects, {
|
|
@@ -16972,7 +16974,12 @@ function createHostToolsServer(options) {
|
|
|
16972
16974
|
).map((project) => ({
|
|
16973
16975
|
projectId: project._id,
|
|
16974
16976
|
name: project.name,
|
|
16975
|
-
repoUrl: project.
|
|
16977
|
+
repoUrl: project.repos.find((repo) => repo.sourceUrl)?.sourceUrl,
|
|
16978
|
+
repos: project.repos.map((repo) => ({
|
|
16979
|
+
name: repo.name,
|
|
16980
|
+
sourceUrl: repo.sourceUrl,
|
|
16981
|
+
normalizedUrl: repo.normalizedUrl
|
|
16982
|
+
}))
|
|
16976
16983
|
}));
|
|
16977
16984
|
return {
|
|
16978
16985
|
content: [
|
|
@@ -16981,8 +16988,8 @@ function createHostToolsServer(options) {
|
|
|
16981
16988
|
text: JSON.stringify(
|
|
16982
16989
|
rows.length === 0 ? {
|
|
16983
16990
|
projects: rows,
|
|
16984
|
-
hint:
|
|
16985
|
-
} : { projects: rows }
|
|
16991
|
+
hint: `No visible projects were found in this organization. ${PROJECT_SELECTION_GUIDANCE} Once the organization is resolved, call tempo_register_project with its orgId and the current repo's name + git remote URL.`
|
|
16992
|
+
} : { projects: rows, hint: PROJECT_SELECTION_GUIDANCE }
|
|
16986
16993
|
)
|
|
16987
16994
|
}
|
|
16988
16995
|
]
|
|
@@ -16991,7 +16998,7 @@ function createHostToolsServer(options) {
|
|
|
16991
16998
|
);
|
|
16992
16999
|
server.tool(
|
|
16993
17000
|
"tempo_register_project",
|
|
16994
|
-
"Register a repo as a project in a Tempo organization (or return the existing project if the repo URL is already registered there \u2014 safe to call repeatedly).
|
|
17001
|
+
"Register a repo as a project in a Tempo organization (or return the existing project if the repo URL is already registered there \u2014 safe to call repeatedly). First resolve the organization from the user's request or clear task context using tempo_list_orgs / tempo_list_projects; there is no default organization. Call this when tempo_list_projects returns no repository match in that resolved organization. Returns the projectId that project-scoped tools (agents, scripts, canvas_share) require.",
|
|
16995
17002
|
{
|
|
16996
17003
|
orgId: z21.string().describe("Organization id from tempo_list_orgs."),
|
|
16997
17004
|
name: z21.string().describe("Project display name \u2014 typically the repo name."),
|
|
@@ -17001,11 +17008,14 @@ function createHostToolsServer(options) {
|
|
|
17001
17008
|
)
|
|
17002
17009
|
},
|
|
17003
17010
|
async (args) => {
|
|
17004
|
-
const projectId = await convex.mutation(
|
|
17005
|
-
|
|
17006
|
-
|
|
17007
|
-
|
|
17008
|
-
|
|
17011
|
+
const projectId = await convex.mutation(
|
|
17012
|
+
anyApi8.projects.registerProject,
|
|
17013
|
+
{
|
|
17014
|
+
organizationId: args.orgId,
|
|
17015
|
+
name: args.name,
|
|
17016
|
+
repos: [{ name: args.repoName, sourceUrl: args.repoUrl }]
|
|
17017
|
+
}
|
|
17018
|
+
);
|
|
17009
17019
|
if (!projectId) {
|
|
17010
17020
|
return {
|
|
17011
17021
|
isError: true,
|
|
@@ -17030,7 +17040,7 @@ function createHostToolsServer(options) {
|
|
|
17030
17040
|
// ../mcp-external-core/scope-params.ts
|
|
17031
17041
|
var ORG_PARAM = {
|
|
17032
17042
|
name: "orgId",
|
|
17033
|
-
description: "Tempo organization id \u2014 discover via tempo_list_orgs."
|
|
17043
|
+
description: "Tempo organization id \u2014 discover via tempo_list_orgs and resolve from the user's request or clear task context. There is no default organization."
|
|
17034
17044
|
};
|
|
17035
17045
|
var PROJECT_PARAM = {
|
|
17036
17046
|
name: "projectId",
|
|
@@ -19329,7 +19339,7 @@ ${assetLibrarySection}## Hard invariants
|
|
|
19329
19339
|
}
|
|
19330
19340
|
|
|
19331
19341
|
// ../canvas-mcp/tools.ts
|
|
19332
|
-
import
|
|
19342
|
+
import path60 from "path";
|
|
19333
19343
|
|
|
19334
19344
|
// ../asset-libraries/mcp/tools.ts
|
|
19335
19345
|
import { readFile as readFile4, writeFile } from "fs/promises";
|
|
@@ -21442,7 +21452,7 @@ function parseCanvasFile(filePath, source) {
|
|
|
21442
21452
|
"name",
|
|
21443
21453
|
objectStringBindings
|
|
21444
21454
|
);
|
|
21445
|
-
const
|
|
21455
|
+
const path64 = readStringAttribute(openingElement, "path");
|
|
21446
21456
|
const backgroundColor = readResolvableStringAttribute(
|
|
21447
21457
|
openingElement,
|
|
21448
21458
|
"backgroundColor",
|
|
@@ -21461,7 +21471,7 @@ function parseCanvasFile(filePath, source) {
|
|
|
21461
21471
|
}
|
|
21462
21472
|
return {
|
|
21463
21473
|
filePath,
|
|
21464
|
-
canvasPath:
|
|
21474
|
+
canvasPath: path64?.value,
|
|
21465
21475
|
pageName: name?.value ?? fallbackPageName(filePath),
|
|
21466
21476
|
backgroundColor: backgroundColor?.value,
|
|
21467
21477
|
canvasElementSpan: toSpan(canvasElement),
|
|
@@ -21469,8 +21479,8 @@ function parseCanvasFile(filePath, source) {
|
|
|
21469
21479
|
canvasChildrenInsertionOffset: typeof canvasElement?.closingElement?.start === "number" ? canvasElement.closingElement.start : void 0,
|
|
21470
21480
|
nameSpan: name?.valueSpan,
|
|
21471
21481
|
nameAttributeSpan: name?.attributeSpan,
|
|
21472
|
-
pathSpan:
|
|
21473
|
-
pathAttributeSpan:
|
|
21482
|
+
pathSpan: path64?.valueSpan,
|
|
21483
|
+
pathAttributeSpan: path64?.attributeSpan,
|
|
21474
21484
|
backgroundColorSpan: backgroundColor?.valueSpan,
|
|
21475
21485
|
backgroundColorAttributeSpan: backgroundColor?.attributeSpan,
|
|
21476
21486
|
imports: imports.all,
|
|
@@ -23533,7 +23543,7 @@ function registerMembershipTool(server, context, tool) {
|
|
|
23533
23543
|
}
|
|
23534
23544
|
|
|
23535
23545
|
// ../canvas-tools/commands/compute-layout.ts
|
|
23536
|
-
import
|
|
23546
|
+
import path45 from "path";
|
|
23537
23547
|
|
|
23538
23548
|
// ../canvas-pages/positioning.ts
|
|
23539
23549
|
var DEFAULT_STORYBOARD_WIDTH = 600;
|
|
@@ -24367,7 +24377,7 @@ function createQueuedFileEditor() {
|
|
|
24367
24377
|
};
|
|
24368
24378
|
return runAtIndex(0);
|
|
24369
24379
|
}
|
|
24370
|
-
async function
|
|
24380
|
+
async function readFile29(absolutePath) {
|
|
24371
24381
|
return withFileLock(absolutePath, () => readFileUnlocked(absolutePath));
|
|
24372
24382
|
}
|
|
24373
24383
|
async function readBinaryFile(absolutePath) {
|
|
@@ -24453,7 +24463,7 @@ function createQueuedFileEditor() {
|
|
|
24453
24463
|
});
|
|
24454
24464
|
}
|
|
24455
24465
|
return {
|
|
24456
|
-
readFile:
|
|
24466
|
+
readFile: readFile29,
|
|
24457
24467
|
readBinaryFile,
|
|
24458
24468
|
readFileIfExists,
|
|
24459
24469
|
writeFile: writeFile12,
|
|
@@ -24465,7 +24475,7 @@ function createQueuedFileEditor() {
|
|
|
24465
24475
|
unlinkFile,
|
|
24466
24476
|
withFileLock,
|
|
24467
24477
|
withFileLocks,
|
|
24468
|
-
readWorkspaceFile: (workspacePath, relativePath) =>
|
|
24478
|
+
readWorkspaceFile: (workspacePath, relativePath) => readFile29(resolveWorkspaceRelativePath(workspacePath, relativePath)),
|
|
24469
24479
|
readWorkspaceFileIfExists: (workspacePath, relativePath) => readFileIfExists(resolveWorkspaceRelativePath(workspacePath, relativePath)),
|
|
24470
24480
|
writeWorkspaceFile: (workspacePath, relativePath, content, expectedMtime, nextMtime) => writeFile12(
|
|
24471
24481
|
resolveWorkspaceRelativePath(workspacePath, relativePath),
|
|
@@ -25764,17 +25774,17 @@ async function ensureCanvasPageFileMigrated(pageFilePath) {
|
|
|
25764
25774
|
|
|
25765
25775
|
// ../canvas-pages/delete-storyboard.ts
|
|
25766
25776
|
import fs5 from "fs/promises";
|
|
25767
|
-
import
|
|
25777
|
+
import path34 from "path";
|
|
25768
25778
|
import ts2 from "typescript";
|
|
25769
25779
|
|
|
25770
25780
|
// ../canvas-pages/discovery.ts
|
|
25771
25781
|
import { readdir as readdir9, stat as stat7 } from "fs/promises";
|
|
25772
|
-
import
|
|
25782
|
+
import path33 from "path";
|
|
25773
25783
|
|
|
25774
25784
|
// ../tempo-project/config.ts
|
|
25775
25785
|
import { readFileSync as readFileSync2 } from "fs";
|
|
25776
|
-
import
|
|
25777
|
-
import { access as access5, mkdir as mkdir7, readFile as
|
|
25786
|
+
import path24 from "path";
|
|
25787
|
+
import { access as access5, mkdir as mkdir7, readFile as readFile17, rm as rm6, writeFile as writeFile8 } from "fs/promises";
|
|
25778
25788
|
|
|
25779
25789
|
// ../tempo-devserver/abortable-shell-command.ts
|
|
25780
25790
|
import { spawn } from "child_process";
|
|
@@ -26524,8 +26534,8 @@ function extractImporterFromLine(line) {
|
|
|
26524
26534
|
}
|
|
26525
26535
|
return null;
|
|
26526
26536
|
}
|
|
26527
|
-
function normalizeImporterPath(
|
|
26528
|
-
return
|
|
26537
|
+
function normalizeImporterPath(path64) {
|
|
26538
|
+
return path64.replace(/^\.\//, "");
|
|
26529
26539
|
}
|
|
26530
26540
|
|
|
26531
26541
|
// ../tempo-devserver/port-listener.ts
|
|
@@ -28575,6 +28585,66 @@ function missingInstallEnvironment(error) {
|
|
|
28575
28585
|
) || /cannot connect to the docker daemon/i.test(message) || /is the docker daemon running\?/i.test(message);
|
|
28576
28586
|
}
|
|
28577
28587
|
|
|
28588
|
+
// ../tempo-devserver/install-registry-env.ts
|
|
28589
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
28590
|
+
import path15 from "path";
|
|
28591
|
+
import { parseEnv } from "util";
|
|
28592
|
+
async function readOptional(file) {
|
|
28593
|
+
try {
|
|
28594
|
+
return await readFile8(file, "utf-8");
|
|
28595
|
+
} catch (error) {
|
|
28596
|
+
const code = error.code;
|
|
28597
|
+
if (code === "ENOENT" || code === "ENOTDIR") return "";
|
|
28598
|
+
throw error;
|
|
28599
|
+
}
|
|
28600
|
+
}
|
|
28601
|
+
async function readInstallRegistryEnv(cwd, projectRoot, inheritedEnv) {
|
|
28602
|
+
const root = path15.resolve(projectRoot);
|
|
28603
|
+
const commandDir = path15.resolve(cwd);
|
|
28604
|
+
const relative3 = path15.relative(root, commandDir);
|
|
28605
|
+
if (relative3 === ".." || relative3.startsWith(`..${path15.sep}`) || path15.isAbsolute(relative3)) {
|
|
28606
|
+
return {};
|
|
28607
|
+
}
|
|
28608
|
+
const dirs = [root];
|
|
28609
|
+
if (relative3) {
|
|
28610
|
+
for (const segment of relative3.split(path15.sep)) {
|
|
28611
|
+
dirs.push(path15.join(dirs[dirs.length - 1], segment));
|
|
28612
|
+
}
|
|
28613
|
+
}
|
|
28614
|
+
const configs = await Promise.all(
|
|
28615
|
+
dirs.map((dir) => readOptional(path15.join(dir, ".npmrc")))
|
|
28616
|
+
);
|
|
28617
|
+
const keys = /* @__PURE__ */ new Set();
|
|
28618
|
+
for (const config of configs) {
|
|
28619
|
+
for (const line of config.split(/\r?\n/)) {
|
|
28620
|
+
if (/^\s*[#;]/.test(line)) continue;
|
|
28621
|
+
for (const match of line.matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g)) {
|
|
28622
|
+
keys.add(match[1]);
|
|
28623
|
+
}
|
|
28624
|
+
}
|
|
28625
|
+
}
|
|
28626
|
+
if (keys.size === 0) return {};
|
|
28627
|
+
let fileEnv = {};
|
|
28628
|
+
if ([...keys].some((key) => inheritedEnv[key] === void 0)) {
|
|
28629
|
+
const files = await Promise.all(
|
|
28630
|
+
dirs.flatMap(
|
|
28631
|
+
(dir) => [".env", ".env.local"].map(
|
|
28632
|
+
(name) => readOptional(path15.join(dir, name))
|
|
28633
|
+
)
|
|
28634
|
+
)
|
|
28635
|
+
);
|
|
28636
|
+
for (const contents of files) {
|
|
28637
|
+
fileEnv = { ...fileEnv, ...parseEnv(contents) };
|
|
28638
|
+
}
|
|
28639
|
+
}
|
|
28640
|
+
return Object.fromEntries(
|
|
28641
|
+
[...keys].flatMap((key) => {
|
|
28642
|
+
const value = inheritedEnv[key] ?? fileEnv[key];
|
|
28643
|
+
return value === void 0 ? [] : [[key, value]];
|
|
28644
|
+
})
|
|
28645
|
+
);
|
|
28646
|
+
}
|
|
28647
|
+
|
|
28578
28648
|
// ../tempo-devserver/tempo-devserver.ts
|
|
28579
28649
|
import { spawn as spawn4 } from "child_process";
|
|
28580
28650
|
import { createHash as createHash3, randomUUID as randomUUID3 } from "crypto";
|
|
@@ -28584,7 +28654,7 @@ import {
|
|
|
28584
28654
|
mkdir as mkdir6,
|
|
28585
28655
|
mkdtemp,
|
|
28586
28656
|
readdir as readdir6,
|
|
28587
|
-
readFile as
|
|
28657
|
+
readFile as readFile15,
|
|
28588
28658
|
rm as rm5,
|
|
28589
28659
|
stat as stat4,
|
|
28590
28660
|
writeFile as writeFile7
|
|
@@ -28592,7 +28662,7 @@ import {
|
|
|
28592
28662
|
import { request as httpRequest } from "http";
|
|
28593
28663
|
import { createServer, connect as netConnect } from "net";
|
|
28594
28664
|
import os2 from "os";
|
|
28595
|
-
import
|
|
28665
|
+
import path21 from "path";
|
|
28596
28666
|
|
|
28597
28667
|
// ../../modules/file-watcher/provider.ts
|
|
28598
28668
|
var PROVIDER_SLOT = /* @__PURE__ */ Symbol.for("@modules/file-watcher:watch-provider");
|
|
@@ -28646,7 +28716,7 @@ function createEventKeepFilter(rootRealPath, relativePathFilters) {
|
|
|
28646
28716
|
}
|
|
28647
28717
|
|
|
28648
28718
|
// ../../modules/file-watcher/polling-backend.ts
|
|
28649
|
-
import { lstat, readdir as readdir3, readFile as
|
|
28719
|
+
import { lstat, readdir as readdir3, readFile as readFile9, writeFile as writeFile5 } from "fs/promises";
|
|
28650
28720
|
import { isAbsolute, join as join2, resolve } from "path";
|
|
28651
28721
|
var STAT_CONCURRENCY = 32;
|
|
28652
28722
|
var MAX_DEPTH = 64;
|
|
@@ -28687,10 +28757,10 @@ async function scanTree(realRoot, ignorePaths = []) {
|
|
|
28687
28757
|
for (let i = 0; i < pendingStats.length; i += STAT_CONCURRENCY) {
|
|
28688
28758
|
const slice = pendingStats.slice(i, i + STAT_CONCURRENCY);
|
|
28689
28759
|
await Promise.all(
|
|
28690
|
-
slice.map(async (
|
|
28760
|
+
slice.map(async (path64) => {
|
|
28691
28761
|
try {
|
|
28692
|
-
const st = await lstat(
|
|
28693
|
-
scan.set(
|
|
28762
|
+
const st = await lstat(path64);
|
|
28763
|
+
scan.set(path64, {
|
|
28694
28764
|
mtimeMs: st.mtimeMs,
|
|
28695
28765
|
size: st.size,
|
|
28696
28766
|
isDir: false
|
|
@@ -28704,16 +28774,16 @@ async function scanTree(realRoot, ignorePaths = []) {
|
|
|
28704
28774
|
}
|
|
28705
28775
|
function diffScans(previous, next) {
|
|
28706
28776
|
const events = [];
|
|
28707
|
-
for (const [
|
|
28708
|
-
const before = previous.get(
|
|
28777
|
+
for (const [path64, now] of next) {
|
|
28778
|
+
const before = previous.get(path64);
|
|
28709
28779
|
if (!before) {
|
|
28710
|
-
events.push({ path:
|
|
28780
|
+
events.push({ path: path64, type: "create" });
|
|
28711
28781
|
} else if (!now.isDir && (before.mtimeMs !== now.mtimeMs || before.size !== now.size)) {
|
|
28712
|
-
events.push({ path:
|
|
28782
|
+
events.push({ path: path64, type: "update" });
|
|
28713
28783
|
}
|
|
28714
28784
|
}
|
|
28715
|
-
for (const
|
|
28716
|
-
if (!next.has(
|
|
28785
|
+
for (const path64 of previous.keys()) {
|
|
28786
|
+
if (!next.has(path64)) events.push({ path: path64, type: "delete" });
|
|
28717
28787
|
}
|
|
28718
28788
|
return events;
|
|
28719
28789
|
}
|
|
@@ -28727,7 +28797,7 @@ async function writeScanSnapshot(snapshotPath, scan) {
|
|
|
28727
28797
|
async function readScanSnapshot(snapshotPath) {
|
|
28728
28798
|
try {
|
|
28729
28799
|
const parsed = JSON.parse(
|
|
28730
|
-
await
|
|
28800
|
+
await readFile9(snapshotPath, "utf8")
|
|
28731
28801
|
);
|
|
28732
28802
|
if (parsed?.version !== 1 || !Array.isArray(parsed.entries)) return null;
|
|
28733
28803
|
const scan = /* @__PURE__ */ new Map();
|
|
@@ -29896,8 +29966,8 @@ if (selfHot) {
|
|
|
29896
29966
|
`;
|
|
29897
29967
|
|
|
29898
29968
|
// ../tempo-devserver/canvas-registry.ts
|
|
29899
|
-
import { mkdir as mkdir4, readdir as readdir4, readFile as
|
|
29900
|
-
import
|
|
29969
|
+
import { mkdir as mkdir4, readdir as readdir4, readFile as readFile10, rm as rm3 } from "fs/promises";
|
|
29970
|
+
import path16 from "path";
|
|
29901
29971
|
|
|
29902
29972
|
// ../tempo-devserver/errors.ts
|
|
29903
29973
|
var TempoDevServerError = class extends Error {
|
|
@@ -30147,13 +30217,13 @@ function toPosixPath2(value) {
|
|
|
30147
30217
|
return value.replace(/\\/g, "/");
|
|
30148
30218
|
}
|
|
30149
30219
|
function toRelativeImportSpecifier(fromDir, absolutePath) {
|
|
30150
|
-
const relativePath = toPosixPath2(
|
|
30220
|
+
const relativePath = toPosixPath2(path16.relative(fromDir, absolutePath));
|
|
30151
30221
|
const extensionlessPath = relativePath.replace(/\.(tsx|ts|jsx|js)$/, "");
|
|
30152
30222
|
return extensionlessPath.startsWith(".") ? extensionlessPath : `./${extensionlessPath}`;
|
|
30153
30223
|
}
|
|
30154
30224
|
async function readTextFileOptional(filePath) {
|
|
30155
30225
|
try {
|
|
30156
|
-
return await
|
|
30226
|
+
return await readFile10(filePath, "utf-8");
|
|
30157
30227
|
} catch (error) {
|
|
30158
30228
|
if (error.code === "ENOENT") {
|
|
30159
30229
|
return null;
|
|
@@ -30188,7 +30258,7 @@ async function walkPagesDir(directory, collector) {
|
|
|
30188
30258
|
throw error;
|
|
30189
30259
|
}
|
|
30190
30260
|
for (const entry of entries) {
|
|
30191
|
-
const fullPath =
|
|
30261
|
+
const fullPath = path16.join(directory, entry.name);
|
|
30192
30262
|
if (entry.isDirectory()) {
|
|
30193
30263
|
await walkPagesDir(fullPath, collector);
|
|
30194
30264
|
} else if (entry.isFile() && entry.name === CANVAS_FILE_NAME) {
|
|
@@ -30203,7 +30273,7 @@ var CanvasRegistry = class {
|
|
|
30203
30273
|
this.requestedCanvasesQueue = Promise.resolve();
|
|
30204
30274
|
this.projectRoot = projectRoot;
|
|
30205
30275
|
this.tempoRoot = tempoRoot;
|
|
30206
|
-
this.requestedCanvasesPath =
|
|
30276
|
+
this.requestedCanvasesPath = path16.join(
|
|
30207
30277
|
tempoRoot,
|
|
30208
30278
|
".tempo",
|
|
30209
30279
|
REQUESTED_CANVASES_FILE_NAME
|
|
@@ -30227,9 +30297,9 @@ var CanvasRegistry = class {
|
|
|
30227
30297
|
}
|
|
30228
30298
|
buildEntry(absolutePath) {
|
|
30229
30299
|
return {
|
|
30230
|
-
importPath: toPosixPath2(
|
|
30300
|
+
importPath: toPosixPath2(path16.relative(this.projectRoot, absolutePath)),
|
|
30231
30301
|
importSpecifier: toRelativeImportSpecifier(
|
|
30232
|
-
|
|
30302
|
+
path16.join(this.tempoRoot, ".tempo"),
|
|
30233
30303
|
absolutePath
|
|
30234
30304
|
)
|
|
30235
30305
|
};
|
|
@@ -30266,17 +30336,17 @@ var CanvasRegistry = class {
|
|
|
30266
30336
|
if (typeof relativePath !== "string" || relativePath.length === 0) {
|
|
30267
30337
|
return null;
|
|
30268
30338
|
}
|
|
30269
|
-
const absolutePath =
|
|
30339
|
+
const absolutePath = path16.resolve(this.projectRoot, relativePath);
|
|
30270
30340
|
const normalizedRelative = toPosixPath2(
|
|
30271
|
-
|
|
30341
|
+
path16.relative(this.projectRoot, absolutePath)
|
|
30272
30342
|
);
|
|
30273
|
-
if (normalizedRelative === ".." || normalizedRelative.startsWith("../") ||
|
|
30343
|
+
if (normalizedRelative === ".." || normalizedRelative.startsWith("../") || path16.isAbsolute(normalizedRelative)) {
|
|
30274
30344
|
return null;
|
|
30275
30345
|
}
|
|
30276
30346
|
return absolutePath;
|
|
30277
30347
|
}
|
|
30278
30348
|
toRequestedPath(absolutePath) {
|
|
30279
|
-
return toPosixPath2(
|
|
30349
|
+
return toPosixPath2(path16.relative(this.projectRoot, absolutePath));
|
|
30280
30350
|
}
|
|
30281
30351
|
async readRequestedCanvasPaths() {
|
|
30282
30352
|
const source = await readTextFileOptional(this.requestedCanvasesPath);
|
|
@@ -30313,7 +30383,7 @@ var CanvasRegistry = class {
|
|
|
30313
30383
|
return mergedPaths;
|
|
30314
30384
|
}
|
|
30315
30385
|
async writeRequestedCanvasPaths(requestedPaths) {
|
|
30316
|
-
await mkdir4(
|
|
30386
|
+
await mkdir4(path16.dirname(this.requestedCanvasesPath), { recursive: true });
|
|
30317
30387
|
await atomicWriteText2(
|
|
30318
30388
|
this.requestedCanvasesPath,
|
|
30319
30389
|
JSON.stringify({ version: 1, canvases: requestedPaths }, null, 2)
|
|
@@ -30344,7 +30414,7 @@ var CanvasRegistry = class {
|
|
|
30344
30414
|
async canvasFileExistsWithRecheck(absolutePath) {
|
|
30345
30415
|
for (let attempt = 0; ; attempt += 1) {
|
|
30346
30416
|
try {
|
|
30347
|
-
await
|
|
30417
|
+
await readFile10(absolutePath, "utf-8");
|
|
30348
30418
|
return true;
|
|
30349
30419
|
} catch (error) {
|
|
30350
30420
|
if (error.code !== "ENOENT") {
|
|
@@ -30370,10 +30440,10 @@ var CanvasRegistry = class {
|
|
|
30370
30440
|
);
|
|
30371
30441
|
}
|
|
30372
30442
|
async ensureReactCanvasHostEntry(canvasFile) {
|
|
30373
|
-
const absolutePath =
|
|
30443
|
+
const absolutePath = path16.resolve(canvasFile);
|
|
30374
30444
|
let source;
|
|
30375
30445
|
try {
|
|
30376
|
-
source = await
|
|
30446
|
+
source = await readFile10(absolutePath, "utf-8");
|
|
30377
30447
|
} catch (error) {
|
|
30378
30448
|
if (error.code === "ENOENT") {
|
|
30379
30449
|
return null;
|
|
@@ -30447,8 +30517,8 @@ var ProcessHintSlots = class {
|
|
|
30447
30517
|
};
|
|
30448
30518
|
|
|
30449
30519
|
// ../tempo-devserver/package-manager.ts
|
|
30450
|
-
import { access, readFile as
|
|
30451
|
-
import
|
|
30520
|
+
import { access, readFile as readFile11 } from "fs/promises";
|
|
30521
|
+
import path17 from "path";
|
|
30452
30522
|
var LOCKFILE_PRIORITY = [
|
|
30453
30523
|
// Order matters: a project with both bun.lock and package-lock.json is
|
|
30454
30524
|
// a bun project (the package-lock.json is stale). We bias to whichever
|
|
@@ -30489,15 +30559,15 @@ function parsePackageManagerField(value) {
|
|
|
30489
30559
|
}
|
|
30490
30560
|
async function readPackageManagerFromPackageJson(packageJsonPath) {
|
|
30491
30561
|
try {
|
|
30492
|
-
const parsed = JSON.parse(await
|
|
30562
|
+
const parsed = JSON.parse(await readFile11(packageJsonPath, "utf-8"));
|
|
30493
30563
|
return parsePackageManagerField(parsed.packageManager);
|
|
30494
30564
|
} catch {
|
|
30495
30565
|
return null;
|
|
30496
30566
|
}
|
|
30497
30567
|
}
|
|
30498
30568
|
async function detectRootPackageManager(projectRoot) {
|
|
30499
|
-
const resolvedRoot =
|
|
30500
|
-
const packageJsonPath =
|
|
30569
|
+
const resolvedRoot = path17.resolve(projectRoot);
|
|
30570
|
+
const packageJsonPath = path17.join(resolvedRoot, "package.json");
|
|
30501
30571
|
if (!await fileExists(packageJsonPath)) {
|
|
30502
30572
|
return null;
|
|
30503
30573
|
}
|
|
@@ -30506,7 +30576,7 @@ async function detectRootPackageManager(projectRoot) {
|
|
|
30506
30576
|
return { ...pin, installCmd: INSTALL_COMMAND_BY_PM[pin.pm] };
|
|
30507
30577
|
}
|
|
30508
30578
|
for (const candidate of LOCKFILE_PRIORITY) {
|
|
30509
|
-
if (await fileExists(
|
|
30579
|
+
if (await fileExists(path17.join(resolvedRoot, candidate.file))) {
|
|
30510
30580
|
return { pm: candidate.pm, installCmd: candidate.installCmd };
|
|
30511
30581
|
}
|
|
30512
30582
|
}
|
|
@@ -30522,32 +30592,32 @@ var OWNERSHIP_MARKER_PRIORITY = [
|
|
|
30522
30592
|
];
|
|
30523
30593
|
async function detectPackageManagerMarkerInDir(dir) {
|
|
30524
30594
|
const fromPackageJson = await readPackageManagerFromPackageJson(
|
|
30525
|
-
|
|
30595
|
+
path17.join(dir, "package.json")
|
|
30526
30596
|
);
|
|
30527
30597
|
if (fromPackageJson) return fromPackageJson;
|
|
30528
30598
|
for (const candidate of OWNERSHIP_MARKER_PRIORITY) {
|
|
30529
|
-
if (await fileExists(
|
|
30599
|
+
if (await fileExists(path17.join(dir, candidate.file))) {
|
|
30530
30600
|
return { pm: candidate.pm };
|
|
30531
30601
|
}
|
|
30532
30602
|
}
|
|
30533
30603
|
return null;
|
|
30534
30604
|
}
|
|
30535
30605
|
async function detectOwningPackageManager(packageRoot) {
|
|
30536
|
-
const resolvedRoot =
|
|
30537
|
-
if (!await fileExists(
|
|
30606
|
+
const resolvedRoot = path17.resolve(packageRoot);
|
|
30607
|
+
if (!await fileExists(path17.join(resolvedRoot, "package.json"))) {
|
|
30538
30608
|
return null;
|
|
30539
30609
|
}
|
|
30540
|
-
for (let dir = resolvedRoot; ; dir =
|
|
30610
|
+
for (let dir = resolvedRoot; ; dir = path17.dirname(dir)) {
|
|
30541
30611
|
const pin = await detectPackageManagerMarkerInDir(dir);
|
|
30542
30612
|
if (pin) return { ...pin, installCmd: INSTALL_COMMAND_BY_PM[pin.pm] };
|
|
30543
|
-
if (
|
|
30613
|
+
if (path17.dirname(dir) === dir) break;
|
|
30544
30614
|
}
|
|
30545
30615
|
return { pm: "npm", installCmd: "npm install" };
|
|
30546
30616
|
}
|
|
30547
30617
|
|
|
30548
30618
|
// ../tempo-devserver/project-node-version.ts
|
|
30549
|
-
import { access as access2, readFile as
|
|
30550
|
-
import
|
|
30619
|
+
import { access as access2, readFile as readFile12, readdir as readdir5 } from "fs/promises";
|
|
30620
|
+
import path18 from "path";
|
|
30551
30621
|
function parseTriple(value) {
|
|
30552
30622
|
const match = value.trim().replace(/^v/i, "").match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/);
|
|
30553
30623
|
if (!match?.[1]) return null;
|
|
@@ -30678,15 +30748,15 @@ async function pathExists(candidate) {
|
|
|
30678
30748
|
async function readProjectNodeRequirement(startDir) {
|
|
30679
30749
|
const engines = [];
|
|
30680
30750
|
let versionFileSpec = null;
|
|
30681
|
-
for (let dir =
|
|
30682
|
-
const packageJson = await
|
|
30751
|
+
for (let dir = path18.resolve(startDir); ; dir = path18.dirname(dir)) {
|
|
30752
|
+
const packageJson = await readFile12(path18.join(dir, "package.json"), "utf-8").then((raw) => JSON.parse(raw)).catch(() => null);
|
|
30683
30753
|
const range = packageJson?.engines?.node;
|
|
30684
30754
|
if (typeof range === "string" && range.trim() && range.trim() !== "*") {
|
|
30685
30755
|
engines.push({ range: range.trim(), dir });
|
|
30686
30756
|
}
|
|
30687
30757
|
if (versionFileSpec === null) {
|
|
30688
30758
|
for (const file of [".nvmrc", ".node-version"]) {
|
|
30689
|
-
const raw = await
|
|
30759
|
+
const raw = await readFile12(path18.join(dir, file), "utf-8").catch(
|
|
30690
30760
|
() => null
|
|
30691
30761
|
);
|
|
30692
30762
|
const trimmed2 = raw?.trim();
|
|
@@ -30696,10 +30766,10 @@ async function readProjectNodeRequirement(startDir) {
|
|
|
30696
30766
|
}
|
|
30697
30767
|
}
|
|
30698
30768
|
}
|
|
30699
|
-
const atBoundary = await pathExists(
|
|
30700
|
-
BOUNDARY_LOCKFILES.map((file) => pathExists(
|
|
30769
|
+
const atBoundary = await pathExists(path18.join(dir, ".git")) || (await Promise.all(
|
|
30770
|
+
BOUNDARY_LOCKFILES.map((file) => pathExists(path18.join(dir, file)))
|
|
30701
30771
|
)).some(Boolean);
|
|
30702
|
-
if (atBoundary ||
|
|
30772
|
+
if (atBoundary || path18.dirname(dir) === dir) break;
|
|
30703
30773
|
}
|
|
30704
30774
|
return { engines, versionFileSpec };
|
|
30705
30775
|
}
|
|
@@ -30711,8 +30781,8 @@ async function discoverVersionManagerNodes(options) {
|
|
|
30711
30781
|
for (const entry of entries) {
|
|
30712
30782
|
const parsed = parseTriple(entry);
|
|
30713
30783
|
if (!parsed || parsed.precision !== 3) continue;
|
|
30714
|
-
const binDir = layout === "bin-subdir" ?
|
|
30715
|
-
const nodeBinary =
|
|
30784
|
+
const binDir = layout === "bin-subdir" ? path18.join(versionsDir, entry, "bin") : path18.join(versionsDir, entry);
|
|
30785
|
+
const nodeBinary = path18.join(
|
|
30716
30786
|
binDir,
|
|
30717
30787
|
platform === "win32" ? "node.exe" : "node"
|
|
30718
30788
|
);
|
|
@@ -30725,10 +30795,10 @@ async function discoverVersionManagerNodes(options) {
|
|
|
30725
30795
|
}
|
|
30726
30796
|
};
|
|
30727
30797
|
if (platform !== "win32") {
|
|
30728
|
-
const nvmDir = env.NVM_DIR?.trim() ||
|
|
30729
|
-
await collect(
|
|
30730
|
-
const nodenvRoot = env.NODENV_ROOT?.trim() ||
|
|
30731
|
-
await collect(
|
|
30798
|
+
const nvmDir = env.NVM_DIR?.trim() || path18.join(homeDir, ".nvm");
|
|
30799
|
+
await collect(path18.join(nvmDir, "versions", "node"), "nvm", "bin-subdir");
|
|
30800
|
+
const nodenvRoot = env.NODENV_ROOT?.trim() || path18.join(homeDir, ".nodenv");
|
|
30801
|
+
await collect(path18.join(nodenvRoot, "versions"), "nodenv", "bin-subdir");
|
|
30732
30802
|
}
|
|
30733
30803
|
if (env.NVM_HOME?.trim()) {
|
|
30734
30804
|
await collect(env.NVM_HOME.trim(), "nvm-windows", "flat");
|
|
@@ -30777,8 +30847,8 @@ function buildUnsatisfiedNodeHint(args) {
|
|
|
30777
30847
|
}
|
|
30778
30848
|
|
|
30779
30849
|
// ../tempo-devserver/sdk-upgrade-plan.ts
|
|
30780
|
-
import { access as access3, readFile as
|
|
30781
|
-
import
|
|
30850
|
+
import { access as access3, readFile as readFile13 } from "fs/promises";
|
|
30851
|
+
import path19 from "path";
|
|
30782
30852
|
var INSTALL_MARKERS = [
|
|
30783
30853
|
// Order matters, same rationale as pm-detect: a tree carrying both bun.lock
|
|
30784
30854
|
// and package-lock.json is a bun tree with a stale npm lockfile.
|
|
@@ -30840,9 +30910,9 @@ function buildCommands(pm, yarnBerry, metadataCacheDir, ignorePnpmWorkspace) {
|
|
|
30840
30910
|
}
|
|
30841
30911
|
}
|
|
30842
30912
|
async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
30843
|
-
const resolvedRoot =
|
|
30844
|
-
const declared = await
|
|
30845
|
-
|
|
30913
|
+
const resolvedRoot = path19.resolve(tempoRoot);
|
|
30914
|
+
const declared = await readFile13(
|
|
30915
|
+
path19.join(resolvedRoot, "package.json"),
|
|
30846
30916
|
"utf-8"
|
|
30847
30917
|
).then((raw) => {
|
|
30848
30918
|
const parsed = JSON.parse(raw);
|
|
@@ -30851,7 +30921,7 @@ async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
|
30851
30921
|
const owner = await findInstallOwner(resolvedRoot);
|
|
30852
30922
|
const resolvedPm = declared ?? owner?.pm ?? "npm";
|
|
30853
30923
|
const governedByAncestorWorkspace = owner !== null && owner.dir !== resolvedRoot;
|
|
30854
|
-
const hasOwnPnpmWorkspace = resolvedPm === "pnpm" && await fileExists2(
|
|
30924
|
+
const hasOwnPnpmWorkspace = resolvedPm === "pnpm" && await fileExists2(path19.join(resolvedRoot, "pnpm-workspace.yaml"));
|
|
30855
30925
|
return {
|
|
30856
30926
|
packageManager: resolvedPm,
|
|
30857
30927
|
cwd: resolvedRoot,
|
|
@@ -30865,21 +30935,21 @@ async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
|
30865
30935
|
};
|
|
30866
30936
|
}
|
|
30867
30937
|
async function findInstallOwner(startDir) {
|
|
30868
|
-
for (let dir = startDir; ; dir =
|
|
30938
|
+
for (let dir = startDir; ; dir = path19.dirname(dir)) {
|
|
30869
30939
|
for (const candidate of INSTALL_MARKERS) {
|
|
30870
|
-
const markerPath =
|
|
30940
|
+
const markerPath = path19.join(dir, candidate.file);
|
|
30871
30941
|
if (!await fileExists2(markerPath)) continue;
|
|
30872
30942
|
return {
|
|
30873
30943
|
dir,
|
|
30874
30944
|
pm: candidate.pm,
|
|
30875
30945
|
...candidate.pm === "yarn" ? {
|
|
30876
|
-
yarnLockContents: await
|
|
30946
|
+
yarnLockContents: await readFile13(markerPath, "utf-8").catch(
|
|
30877
30947
|
() => ""
|
|
30878
30948
|
)
|
|
30879
30949
|
} : {}
|
|
30880
30950
|
};
|
|
30881
30951
|
}
|
|
30882
|
-
if (
|
|
30952
|
+
if (path19.dirname(dir) === dir) return null;
|
|
30883
30953
|
}
|
|
30884
30954
|
}
|
|
30885
30955
|
|
|
@@ -30887,13 +30957,13 @@ async function findInstallOwner(startDir) {
|
|
|
30887
30957
|
import {
|
|
30888
30958
|
lstat as lstat3,
|
|
30889
30959
|
mkdir as mkdir5,
|
|
30890
|
-
readFile as
|
|
30960
|
+
readFile as readFile14,
|
|
30891
30961
|
realpath as realpath2,
|
|
30892
30962
|
rm as rm4,
|
|
30893
30963
|
symlink,
|
|
30894
30964
|
writeFile as writeFile6
|
|
30895
30965
|
} from "fs/promises";
|
|
30896
|
-
import
|
|
30966
|
+
import path20 from "path";
|
|
30897
30967
|
var TEMPO_SDK_SOURCE_ENV = "TEMPO_MONOREPO_SDK_SOURCE";
|
|
30898
30968
|
var LOCAL_SDK_MARKER_FILE = "local-tempo-sdk.json";
|
|
30899
30969
|
async function realpathIfPresent(filePath) {
|
|
@@ -30909,7 +30979,7 @@ async function realpathIfPresent(filePath) {
|
|
|
30909
30979
|
async function isTempoSdkRoot(candidate) {
|
|
30910
30980
|
try {
|
|
30911
30981
|
const manifest = JSON.parse(
|
|
30912
|
-
await
|
|
30982
|
+
await readFile14(path20.join(candidate, "package.json"), "utf8")
|
|
30913
30983
|
);
|
|
30914
30984
|
return manifest.name === "tempo-sdk";
|
|
30915
30985
|
} catch {
|
|
@@ -30917,10 +30987,10 @@ async function isTempoSdkRoot(candidate) {
|
|
|
30917
30987
|
}
|
|
30918
30988
|
}
|
|
30919
30989
|
async function discoverLocalSdkRoot(start) {
|
|
30920
|
-
for (let current =
|
|
30921
|
-
const candidate =
|
|
30990
|
+
for (let current = path20.resolve(start); ; current = path20.dirname(current)) {
|
|
30991
|
+
const candidate = path20.join(current, "tempo-modules", "tempo-sdk");
|
|
30922
30992
|
if (await isTempoSdkRoot(candidate)) return candidate;
|
|
30923
|
-
if (
|
|
30993
|
+
if (path20.dirname(current) === current) return null;
|
|
30924
30994
|
}
|
|
30925
30995
|
}
|
|
30926
30996
|
async function assertLocalSdkPrebuilt(localSdkRoot) {
|
|
@@ -30928,7 +30998,7 @@ async function assertLocalSdkPrebuilt(localSdkRoot) {
|
|
|
30928
30998
|
const missingOutputs = (await Promise.all(
|
|
30929
30999
|
requiredOutputs.map(async (relativePath) => ({
|
|
30930
31000
|
relativePath,
|
|
30931
|
-
present: await realpathIfPresent(
|
|
31001
|
+
present: await realpathIfPresent(path20.join(localSdkRoot, relativePath)) !== null
|
|
30932
31002
|
}))
|
|
30933
31003
|
)).filter(({ present }) => !present).map(({ relativePath }) => relativePath);
|
|
30934
31004
|
if (missingOutputs.length === 0) return;
|
|
@@ -30944,8 +31014,8 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
30944
31014
|
);
|
|
30945
31015
|
}
|
|
30946
31016
|
const mode = options.mode ?? (configuredMode === "local-prebuilt" ? configuredMode : "published");
|
|
30947
|
-
const installedSdkRoot =
|
|
30948
|
-
const markerPath =
|
|
31017
|
+
const installedSdkRoot = path20.join(tempoRoot, "node_modules", "tempo-sdk");
|
|
31018
|
+
const markerPath = path20.join(tempoRoot, ".tempo", LOCAL_SDK_MARKER_FILE);
|
|
30949
31019
|
if (mode === "local-prebuilt") {
|
|
30950
31020
|
const localSdkRoot = options.localSdkRoot ?? await discoverLocalSdkRoot(options.discoveryStart ?? process.cwd());
|
|
30951
31021
|
if (!localSdkRoot || !await isTempoSdkRoot(localSdkRoot)) {
|
|
@@ -30960,14 +31030,14 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
30960
31030
|
]);
|
|
30961
31031
|
if (resolvedInstalledSdk !== resolvedLocalSdk) {
|
|
30962
31032
|
await rm4(installedSdkRoot, { force: true, recursive: true });
|
|
30963
|
-
await mkdir5(
|
|
31033
|
+
await mkdir5(path20.dirname(installedSdkRoot), { recursive: true });
|
|
30964
31034
|
await symlink(
|
|
30965
31035
|
resolvedLocalSdk,
|
|
30966
31036
|
installedSdkRoot,
|
|
30967
31037
|
process.platform === "win32" ? "junction" : "dir"
|
|
30968
31038
|
);
|
|
30969
31039
|
}
|
|
30970
|
-
await mkdir5(
|
|
31040
|
+
await mkdir5(path20.dirname(markerPath), { recursive: true });
|
|
30971
31041
|
await writeFile6(
|
|
30972
31042
|
markerPath,
|
|
30973
31043
|
`${JSON.stringify({ localSdkRoot: resolvedLocalSdk }, null, 2)}
|
|
@@ -30975,7 +31045,7 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
30975
31045
|
);
|
|
30976
31046
|
return { source: "local", localSdkRoot: resolvedLocalSdk };
|
|
30977
31047
|
}
|
|
30978
|
-
const marker = await
|
|
31048
|
+
const marker = await readFile14(markerPath, "utf8").then((raw) => JSON.parse(raw)).catch(() => null);
|
|
30979
31049
|
if (!marker) return { source: "published", removedLocalLink: false };
|
|
30980
31050
|
let removedLocalLink = false;
|
|
30981
31051
|
if (typeof marker.localSdkRoot === "string") {
|
|
@@ -31065,9 +31135,9 @@ var MANAGED_WATCH_OPTIONS = {
|
|
|
31065
31135
|
}
|
|
31066
31136
|
};
|
|
31067
31137
|
function resolveRuntimePaths(tempoConfigPath) {
|
|
31068
|
-
const resolvedConfigPath =
|
|
31069
|
-
const tempoRoot =
|
|
31070
|
-
const projectRoot =
|
|
31138
|
+
const resolvedConfigPath = path21.resolve(tempoConfigPath);
|
|
31139
|
+
const tempoRoot = path21.dirname(resolvedConfigPath);
|
|
31140
|
+
const projectRoot = path21.basename(tempoRoot) === TEMPO_DIR_NAME ? path21.dirname(tempoRoot) : tempoRoot;
|
|
31071
31141
|
let canvasesPath = DEFAULT_CANVASES_DIR2;
|
|
31072
31142
|
try {
|
|
31073
31143
|
const raw = JSON.parse(fs3.readFileSync(resolvedConfigPath, "utf-8"));
|
|
@@ -31079,20 +31149,20 @@ function resolveRuntimePaths(tempoConfigPath) {
|
|
|
31079
31149
|
return {
|
|
31080
31150
|
projectRoot,
|
|
31081
31151
|
tempoRoot,
|
|
31082
|
-
pagesDir:
|
|
31152
|
+
pagesDir: path21.resolve(tempoRoot, canvasesPath)
|
|
31083
31153
|
};
|
|
31084
31154
|
}
|
|
31085
31155
|
function isManagedDevServerPath(eventRelativePath, roots) {
|
|
31086
31156
|
const relativePath = toPosixPath2(eventRelativePath);
|
|
31087
|
-
const tempoDir =
|
|
31157
|
+
const tempoDir = path21.join(roots.tempoRoot, ".tempo");
|
|
31088
31158
|
const managedRelativePaths = [
|
|
31089
31159
|
roots.tempoConfigPath,
|
|
31090
31160
|
roots.pagesDir,
|
|
31091
31161
|
...MANAGED_TEMPO_DIR_FILE_NAMES.map(
|
|
31092
|
-
(fileName) =>
|
|
31162
|
+
(fileName) => path21.join(tempoDir, fileName)
|
|
31093
31163
|
)
|
|
31094
31164
|
].map(
|
|
31095
|
-
(managedPath) => toPosixPath2(
|
|
31165
|
+
(managedPath) => toPosixPath2(path21.relative(roots.projectRoot, managedPath))
|
|
31096
31166
|
).filter((value) => value.length > 0 && !value.startsWith("../"));
|
|
31097
31167
|
return managedRelativePaths.some(
|
|
31098
31168
|
(managedPath) => relativePath === managedPath || relativePath.startsWith(`${managedPath}/`) || managedPath.startsWith(`${relativePath}/`)
|
|
@@ -31844,7 +31914,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
31844
31914
|
this.tempoRoot = paths.tempoRoot;
|
|
31845
31915
|
this.pagesDir = paths.pagesDir;
|
|
31846
31916
|
this.commandCwd = paths.tempoRoot;
|
|
31847
|
-
this.processMarkerPath =
|
|
31917
|
+
this.processMarkerPath = path21.join(
|
|
31848
31918
|
paths.tempoRoot,
|
|
31849
31919
|
".tempo",
|
|
31850
31920
|
TEMPO_PROCESS_MARKER_FILE
|
|
@@ -31975,14 +32045,14 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
31975
32045
|
void this.persistRecentExits();
|
|
31976
32046
|
}
|
|
31977
32047
|
recentExitsFilePath() {
|
|
31978
|
-
return
|
|
32048
|
+
return path21.join(this.tempoRoot, ".tempo", TEMPO_RECENT_EXITS_FILE);
|
|
31979
32049
|
}
|
|
31980
32050
|
// Fire-and-forget mirror of the exit log to disk. Best-effort: a failed write
|
|
31981
32051
|
// just means a fresh supervisor won't see this crash, which is no worse than
|
|
31982
32052
|
// before persistence existed.
|
|
31983
32053
|
async persistRecentExits() {
|
|
31984
32054
|
try {
|
|
31985
|
-
await mkdir6(
|
|
32055
|
+
await mkdir6(path21.dirname(this.recentExitsFilePath()), {
|
|
31986
32056
|
recursive: true
|
|
31987
32057
|
});
|
|
31988
32058
|
await atomicWriteText2(
|
|
@@ -32248,7 +32318,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32248
32318
|
sdkInstallReceipts.set(
|
|
32249
32319
|
root,
|
|
32250
32320
|
await pathExists2(
|
|
32251
|
-
|
|
32321
|
+
path21.join(
|
|
32252
32322
|
root,
|
|
32253
32323
|
"node_modules",
|
|
32254
32324
|
EXTERNAL_LAYOUT_INSTALL_MARKER
|
|
@@ -32262,7 +32332,8 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32262
32332
|
command,
|
|
32263
32333
|
cwd,
|
|
32264
32334
|
signal,
|
|
32265
|
-
options?.onInstallOutput
|
|
32335
|
+
options?.onInstallOutput,
|
|
32336
|
+
this.projectRoot
|
|
32266
32337
|
);
|
|
32267
32338
|
sdkCommandCompleted = true;
|
|
32268
32339
|
}
|
|
@@ -32488,7 +32559,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32488
32559
|
try {
|
|
32489
32560
|
for (const step of steps) {
|
|
32490
32561
|
throwIfLaunchAborted(signal);
|
|
32491
|
-
await runInstallStep(step, signal, onOutput);
|
|
32562
|
+
await runInstallStep(step, signal, onOutput, this.projectRoot);
|
|
32492
32563
|
}
|
|
32493
32564
|
} catch (error) {
|
|
32494
32565
|
throwIfLaunchAborted(signal);
|
|
@@ -32501,7 +32572,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32501
32572
|
);
|
|
32502
32573
|
for (const step of localSteps) {
|
|
32503
32574
|
throwIfLaunchAborted(signal);
|
|
32504
|
-
await runInstallStep(step, signal, onOutput);
|
|
32575
|
+
await runInstallStep(step, signal, onOutput, this.projectRoot);
|
|
32505
32576
|
}
|
|
32506
32577
|
}
|
|
32507
32578
|
};
|
|
@@ -32606,7 +32677,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32606
32677
|
return filterProtectedInstallSteps(steps);
|
|
32607
32678
|
}
|
|
32608
32679
|
async selectNodeRuntimeForStart() {
|
|
32609
|
-
const packageJson = await readJsonFile(
|
|
32680
|
+
const packageJson = await readJsonFile(path21.join(this.tempoRoot, "package.json"));
|
|
32610
32681
|
const viteSpec = packageJson?.dependencies?.vite ?? packageJson?.devDependencies?.vite;
|
|
32611
32682
|
const viteMajor = typeof viteSpec === "string" ? parseFirstSemverMajor(viteSpec) : null;
|
|
32612
32683
|
const requireFloor = viteMajor != null && viteMajor >= 7;
|
|
@@ -32677,7 +32748,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32677
32748
|
async readExpectedHostIdentity() {
|
|
32678
32749
|
const framework = await this.resolveStartFramework();
|
|
32679
32750
|
if (framework === "expo") return null;
|
|
32680
|
-
const noncePath =
|
|
32751
|
+
const noncePath = path21.join(this.tempoRoot, ".tempo", "workspace-nonce");
|
|
32681
32752
|
const workspaceNonce = (await readTextFileOptional(noncePath))?.trim();
|
|
32682
32753
|
if (!workspaceNonce) {
|
|
32683
32754
|
devLog("supervisor:workspace_nonce_unavailable", {
|
|
@@ -32695,7 +32766,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32695
32766
|
if (isExpoStartCommand(this.config.scripts.start)) {
|
|
32696
32767
|
return true;
|
|
32697
32768
|
}
|
|
32698
|
-
const packageJson = await readJsonFile(
|
|
32769
|
+
const packageJson = await readJsonFile(path21.join(this.tempoRoot, "package.json"));
|
|
32699
32770
|
return Boolean(
|
|
32700
32771
|
packageJson?.dependencies?.expo ?? packageJson?.devDependencies?.expo
|
|
32701
32772
|
);
|
|
@@ -32727,10 +32798,10 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32727
32798
|
* of trusted and later crashing Vite at startup.
|
|
32728
32799
|
*/
|
|
32729
32800
|
async tempoInstallReady() {
|
|
32730
|
-
const packageJsonPath =
|
|
32801
|
+
const packageJsonPath = path21.join(this.tempoRoot, "package.json");
|
|
32731
32802
|
let raw;
|
|
32732
32803
|
try {
|
|
32733
|
-
raw = await
|
|
32804
|
+
raw = await readFile15(packageJsonPath, "utf-8");
|
|
32734
32805
|
} catch {
|
|
32735
32806
|
return true;
|
|
32736
32807
|
}
|
|
@@ -32755,7 +32826,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32755
32826
|
return await installCompletedForCurrentDeps(this.tempoRoot);
|
|
32756
32827
|
}
|
|
32757
32828
|
for (const name of declared) {
|
|
32758
|
-
const depPath =
|
|
32829
|
+
const depPath = path21.join(this.tempoRoot, "node_modules", name);
|
|
32759
32830
|
try {
|
|
32760
32831
|
await access4(depPath);
|
|
32761
32832
|
} catch {
|
|
@@ -32768,7 +32839,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32768
32839
|
return await installCompletedForCurrentDeps(this.projectRoot) && await this.projectRootDepsPresentOrNotRequired();
|
|
32769
32840
|
}
|
|
32770
32841
|
async projectRootDepsPresentOrNotRequired(acceptExternalLayoutProof = true) {
|
|
32771
|
-
const rootPackageJson =
|
|
32842
|
+
const rootPackageJson = path21.join(this.projectRoot, "package.json");
|
|
32772
32843
|
const packageJson = await readJsonFile(rootPackageJson);
|
|
32773
32844
|
if (!packageJson) {
|
|
32774
32845
|
return true;
|
|
@@ -32783,7 +32854,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32783
32854
|
}
|
|
32784
32855
|
for (const name of declared) {
|
|
32785
32856
|
try {
|
|
32786
|
-
await access4(
|
|
32857
|
+
await access4(path21.join(this.projectRoot, "node_modules", name));
|
|
32787
32858
|
} catch {
|
|
32788
32859
|
return false;
|
|
32789
32860
|
}
|
|
@@ -32809,25 +32880,25 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32809
32880
|
}
|
|
32810
32881
|
}
|
|
32811
32882
|
nextDistClaimsDir() {
|
|
32812
|
-
return
|
|
32883
|
+
return path21.join(this.tempoRoot, ".tempo", TEMPO_NEXT_CLAIMS_DIR);
|
|
32813
32884
|
}
|
|
32814
32885
|
nextDistCachePath(distDir) {
|
|
32815
|
-
return
|
|
32886
|
+
return path21.resolve(this.commandCwd, distDir);
|
|
32816
32887
|
}
|
|
32817
32888
|
nextDistClaimPath(distDir) {
|
|
32818
|
-
return
|
|
32889
|
+
return path21.join(
|
|
32819
32890
|
this.nextDistClaimsDir(),
|
|
32820
|
-
`${
|
|
32891
|
+
`${path21.basename(distDir)}.json`
|
|
32821
32892
|
);
|
|
32822
32893
|
}
|
|
32823
32894
|
async tryClaimNextDistDir(distDir) {
|
|
32824
32895
|
const cachePath = this.nextDistCachePath(distDir);
|
|
32825
32896
|
const claimPath = this.nextDistClaimPath(distDir);
|
|
32826
32897
|
await mkdir6(cachePath, { recursive: true });
|
|
32827
|
-
await writeFile7(
|
|
32898
|
+
await writeFile7(path21.join(cachePath, TEMPO_NEXT_CACHE_MARKER), "1\n", {
|
|
32828
32899
|
flag: "a"
|
|
32829
32900
|
});
|
|
32830
|
-
await mkdir6(
|
|
32901
|
+
await mkdir6(path21.dirname(claimPath), { recursive: true });
|
|
32831
32902
|
const token = randomUUID3();
|
|
32832
32903
|
const processStartedAt = await readProcessStartedAt(process.pid);
|
|
32833
32904
|
const claimText = `${JSON.stringify({
|
|
@@ -32862,7 +32933,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32862
32933
|
}
|
|
32863
32934
|
async selectSuffixedNextDistDir() {
|
|
32864
32935
|
await this.releaseNextDistDirClaim();
|
|
32865
|
-
const nextRoot =
|
|
32936
|
+
const nextRoot = path21.join(this.commandCwd, ".next");
|
|
32866
32937
|
const existing = await readdir6(nextRoot, { withFileTypes: true }).catch(
|
|
32867
32938
|
() => []
|
|
32868
32939
|
);
|
|
@@ -32871,9 +32942,9 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32871
32942
|
if (!entry.isDirectory() || !/^tempo-[a-z0-9]+$/i.test(entry.name)) {
|
|
32872
32943
|
continue;
|
|
32873
32944
|
}
|
|
32874
|
-
const cachePath =
|
|
32945
|
+
const cachePath = path21.join(nextRoot, entry.name);
|
|
32875
32946
|
try {
|
|
32876
|
-
await access4(
|
|
32947
|
+
await access4(path21.join(cachePath, TEMPO_NEXT_CACHE_MARKER));
|
|
32877
32948
|
const cacheStat = await stat4(cachePath);
|
|
32878
32949
|
reusable.push({
|
|
32879
32950
|
distDir: `.next/${entry.name}`,
|
|
@@ -32909,7 +32980,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32909
32980
|
await this.sweepNextDistDirs();
|
|
32910
32981
|
}
|
|
32911
32982
|
async sweepNextDistDirs() {
|
|
32912
|
-
const nextRoot =
|
|
32983
|
+
const nextRoot = path21.join(this.commandCwd, ".next");
|
|
32913
32984
|
const entries = await readdir6(nextRoot, { withFileTypes: true }).catch(
|
|
32914
32985
|
() => []
|
|
32915
32986
|
);
|
|
@@ -32917,7 +32988,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32917
32988
|
const unclaimedManaged = [];
|
|
32918
32989
|
for (const entry of entries) {
|
|
32919
32990
|
if (!entry.isDirectory()) continue;
|
|
32920
|
-
const cachePath =
|
|
32991
|
+
const cachePath = path21.join(nextRoot, entry.name);
|
|
32921
32992
|
if (/^tempo-sidestep-/i.test(entry.name)) {
|
|
32922
32993
|
const cacheStat2 = await stat4(cachePath).catch(() => null);
|
|
32923
32994
|
if (cacheStat2 && now - cacheStat2.mtimeMs > TEMPO_NEXT_LEGACY_CACHE_MAX_AGE_MS) {
|
|
@@ -32928,7 +32999,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32928
32999
|
}
|
|
32929
33000
|
if (!/^tempo-[a-z0-9]+$/i.test(entry.name)) continue;
|
|
32930
33001
|
try {
|
|
32931
|
-
await access4(
|
|
33002
|
+
await access4(path21.join(cachePath, TEMPO_NEXT_CACHE_MARKER));
|
|
32932
33003
|
} catch {
|
|
32933
33004
|
const cacheStat2 = await stat4(cachePath).catch(() => null);
|
|
32934
33005
|
if (cacheStat2 && now - cacheStat2.mtimeMs > TEMPO_NEXT_LEGACY_CACHE_MAX_AGE_MS) {
|
|
@@ -32958,13 +33029,13 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32958
33029
|
async ensureDevserverWatchdogScript() {
|
|
32959
33030
|
const enabled = process.env.TEMPO_DEVSERVER_WATCHDOG !== "0";
|
|
32960
33031
|
if (!enabled) return null;
|
|
32961
|
-
const watchdogPath =
|
|
33032
|
+
const watchdogPath = path21.join(
|
|
32962
33033
|
this.tempoRoot,
|
|
32963
33034
|
".tempo",
|
|
32964
33035
|
DEVSERVER_WATCHDOG_FILE_NAME
|
|
32965
33036
|
);
|
|
32966
33037
|
try {
|
|
32967
|
-
await mkdir6(
|
|
33038
|
+
await mkdir6(path21.dirname(watchdogPath), { recursive: true });
|
|
32968
33039
|
await atomicWriteText2(watchdogPath, DEVSERVER_WATCHDOG_SOURCE);
|
|
32969
33040
|
return watchdogPath;
|
|
32970
33041
|
} catch {
|
|
@@ -32984,12 +33055,12 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32984
33055
|
];
|
|
32985
33056
|
for (const configFile of nextConfigPaths) {
|
|
32986
33057
|
try {
|
|
32987
|
-
await access4(
|
|
33058
|
+
await access4(path21.join(this.tempoRoot, configFile));
|
|
32988
33059
|
return true;
|
|
32989
33060
|
} catch {
|
|
32990
33061
|
}
|
|
32991
33062
|
}
|
|
32992
|
-
const packageJson = await readJsonFile(
|
|
33063
|
+
const packageJson = await readJsonFile(path21.join(this.tempoRoot, "package.json"));
|
|
32993
33064
|
return Boolean(
|
|
32994
33065
|
packageJson?.dependencies?.next ?? packageJson?.devDependencies?.next
|
|
32995
33066
|
);
|
|
@@ -32998,7 +33069,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
32998
33069
|
if (!pid || !await this.isNextTempoHost()) {
|
|
32999
33070
|
return;
|
|
33000
33071
|
}
|
|
33001
|
-
await mkdir6(
|
|
33072
|
+
await mkdir6(path21.dirname(this.processMarkerPath), { recursive: true });
|
|
33002
33073
|
await writeFile7(
|
|
33003
33074
|
this.processMarkerPath,
|
|
33004
33075
|
`${JSON.stringify(
|
|
@@ -33042,7 +33113,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33042
33113
|
async listRegisteredCanvases() {
|
|
33043
33114
|
const files = await scanCanvasFiles(this.pagesDir);
|
|
33044
33115
|
return files.map(
|
|
33045
|
-
(absolutePath) => toPosixPath2(
|
|
33116
|
+
(absolutePath) => toPosixPath2(path21.relative(this.projectRoot, absolutePath))
|
|
33046
33117
|
);
|
|
33047
33118
|
}
|
|
33048
33119
|
/**
|
|
@@ -33467,23 +33538,23 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33467
33538
|
// — pairs with the drift-correction reconcile (a force=false
|
|
33468
33539
|
// compare-and-write pass) which actually restores drift.
|
|
33469
33540
|
async hasManagedFileDrift() {
|
|
33470
|
-
const tempoDir =
|
|
33541
|
+
const tempoDir = path21.join(this.tempoRoot, ".tempo");
|
|
33471
33542
|
const reactCanvasEntries = await this.registry.collectReactCanvasHostEntries();
|
|
33472
33543
|
const startFramework = await this.resolveStartFramework();
|
|
33473
|
-
const wrapperPath =
|
|
33544
|
+
const wrapperPath = path21.join(tempoDir, TEMPO_HOST_FILE_NAME);
|
|
33474
33545
|
const expectedWrapper = buildTempoHostWrapper(reactCanvasEntries, {
|
|
33475
33546
|
startFramework
|
|
33476
33547
|
});
|
|
33477
33548
|
if (await readTextFileOptional(wrapperPath) !== expectedWrapper) {
|
|
33478
33549
|
return true;
|
|
33479
33550
|
}
|
|
33480
|
-
const recoveryPath =
|
|
33551
|
+
const recoveryPath = path21.join(tempoDir, CANVAS_HOST_RECOVERY_FILE_NAME);
|
|
33481
33552
|
const expectedRecovery = canvasHostRecoverySourceFor(startFramework);
|
|
33482
33553
|
if (await readTextFileOptional(recoveryPath) !== expectedRecovery) {
|
|
33483
33554
|
return true;
|
|
33484
33555
|
}
|
|
33485
33556
|
for (const staleFileName of STALE_MANAGED_CANVAS_FILES) {
|
|
33486
|
-
if (await readTextFileOptional(
|
|
33557
|
+
if (await readTextFileOptional(path21.join(tempoDir, staleFileName)) !== null) {
|
|
33487
33558
|
return true;
|
|
33488
33559
|
}
|
|
33489
33560
|
}
|
|
@@ -33504,7 +33575,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33504
33575
|
this.state.generation += 1;
|
|
33505
33576
|
}
|
|
33506
33577
|
this.state.reconcileStatus = "idle";
|
|
33507
|
-
const changedBasenames = changedFiles.map((p2) =>
|
|
33578
|
+
const changedBasenames = changedFiles.map((p2) => path21.basename(p2));
|
|
33508
33579
|
this.recordReconcileActivity({
|
|
33509
33580
|
at: Date.now(),
|
|
33510
33581
|
reason,
|
|
@@ -33582,7 +33653,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33582
33653
|
});
|
|
33583
33654
|
if (arming) {
|
|
33584
33655
|
devLog("reconcile:managed_rewrite_backoff", {
|
|
33585
|
-
file:
|
|
33656
|
+
file: path21.basename(filePath),
|
|
33586
33657
|
consecutiveRewrites,
|
|
33587
33658
|
backoffMs: _TempoDevServer.MANAGED_REWRITE_BACKOFF_MS
|
|
33588
33659
|
});
|
|
@@ -33606,8 +33677,8 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33606
33677
|
}
|
|
33607
33678
|
async reconcileGeneratedFiles(force) {
|
|
33608
33679
|
const changedFiles = [];
|
|
33609
|
-
const tempoDir =
|
|
33610
|
-
const wrapperPath =
|
|
33680
|
+
const tempoDir = path21.join(this.tempoRoot, ".tempo");
|
|
33681
|
+
const wrapperPath = path21.join(tempoDir, TEMPO_HOST_FILE_NAME);
|
|
33611
33682
|
const reactCanvasEntries = await this.registry.collectReactCanvasHostEntries();
|
|
33612
33683
|
const startFramework = await this.resolveStartFramework();
|
|
33613
33684
|
const currentWrapper = await readTextFileOptional(wrapperPath);
|
|
@@ -33623,7 +33694,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33623
33694
|
} else {
|
|
33624
33695
|
this.noteManagedFileConverged(wrapperPath);
|
|
33625
33696
|
}
|
|
33626
|
-
const recoveryPath =
|
|
33697
|
+
const recoveryPath = path21.join(tempoDir, CANVAS_HOST_RECOVERY_FILE_NAME);
|
|
33627
33698
|
const currentRecovery = await readTextFileOptional(recoveryPath);
|
|
33628
33699
|
const nextRecovery = canvasHostRecoverySourceFor(startFramework);
|
|
33629
33700
|
if (currentRecovery !== nextRecovery) {
|
|
@@ -33640,7 +33711,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33640
33711
|
this.noteManagedFileConverged(recoveryPath);
|
|
33641
33712
|
}
|
|
33642
33713
|
for (const staleFileName of STALE_MANAGED_CANVAS_FILES) {
|
|
33643
|
-
const stalePath =
|
|
33714
|
+
const stalePath = path21.join(tempoDir, staleFileName);
|
|
33644
33715
|
if (await readTextFileOptional(stalePath) !== null) {
|
|
33645
33716
|
if (this.shouldRewriteManagedFile(stalePath, force, null)) {
|
|
33646
33717
|
await rm5(stalePath, { force: true });
|
|
@@ -33654,7 +33725,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
33654
33725
|
return changedFiles;
|
|
33655
33726
|
}
|
|
33656
33727
|
getStatusFilePath() {
|
|
33657
|
-
return
|
|
33728
|
+
return path21.join(this.tempoRoot, ".tempo", "status.json");
|
|
33658
33729
|
}
|
|
33659
33730
|
// Restore the previous session's dependencies-install cache (distrust-
|
|
33660
33731
|
// verified again before every start — see tempoInstallReady). The persisted
|
|
@@ -33893,12 +33964,12 @@ ${directCanvasSelection}
|
|
|
33893
33964
|
`;
|
|
33894
33965
|
}
|
|
33895
33966
|
function installCompletionMarkerPath(packageRoot) {
|
|
33896
|
-
return
|
|
33967
|
+
return path21.join(packageRoot, "node_modules", ".tempo-install-complete");
|
|
33897
33968
|
}
|
|
33898
33969
|
var INSTALL_COMPLETION_MARKER_VERSION = "tempo-install-complete-v3";
|
|
33899
33970
|
var EXTERNAL_LAYOUT_INSTALL_MARKER = ".tempo-external-install-complete";
|
|
33900
33971
|
async function computeInstallCompletionKey(packageRoot) {
|
|
33901
|
-
const packageJsonPath =
|
|
33972
|
+
const packageJsonPath = path21.join(packageRoot, "package.json");
|
|
33902
33973
|
const raw = await readTextFileOptional(packageJsonPath);
|
|
33903
33974
|
if (raw == null) return null;
|
|
33904
33975
|
let dependencyInput = raw;
|
|
@@ -33924,21 +33995,21 @@ async function computeInstallCompletionKey(packageRoot) {
|
|
|
33924
33995
|
"bun.lock",
|
|
33925
33996
|
"bun.lockb"
|
|
33926
33997
|
];
|
|
33927
|
-
let current =
|
|
33998
|
+
let current = path21.resolve(packageRoot);
|
|
33928
33999
|
let lockfile = null;
|
|
33929
34000
|
while (true) {
|
|
33930
34001
|
for (const name of lockfileNames) {
|
|
33931
34002
|
try {
|
|
33932
34003
|
lockfile = {
|
|
33933
|
-
path:
|
|
33934
|
-
content: await
|
|
34004
|
+
path: path21.relative(packageRoot, path21.join(current, name)),
|
|
34005
|
+
content: await readFile15(path21.join(current, name))
|
|
33935
34006
|
};
|
|
33936
34007
|
break;
|
|
33937
34008
|
} catch {
|
|
33938
34009
|
}
|
|
33939
34010
|
}
|
|
33940
34011
|
if (lockfile) break;
|
|
33941
|
-
const parent =
|
|
34012
|
+
const parent = path21.dirname(current);
|
|
33942
34013
|
if (parent === current) break;
|
|
33943
34014
|
current = parent;
|
|
33944
34015
|
}
|
|
@@ -33959,7 +34030,7 @@ async function readInstallCompletionMarker(packageRoot) {
|
|
|
33959
34030
|
async function installCompletedForCurrentDeps(packageRoot) {
|
|
33960
34031
|
const marker = await readInstallCompletionMarker(packageRoot);
|
|
33961
34032
|
if (marker === null) {
|
|
33962
|
-
return !await pathExists2(
|
|
34033
|
+
return !await pathExists2(path21.join(packageRoot, "package.json"));
|
|
33963
34034
|
}
|
|
33964
34035
|
const key = await computeInstallCompletionKey(packageRoot);
|
|
33965
34036
|
if (key == null) {
|
|
@@ -33971,7 +34042,7 @@ async function writeInstallCompletionMarker(packageRoot) {
|
|
|
33971
34042
|
const key = await computeInstallCompletionKey(packageRoot);
|
|
33972
34043
|
if (key == null) return;
|
|
33973
34044
|
try {
|
|
33974
|
-
await mkdir6(
|
|
34045
|
+
await mkdir6(path21.join(packageRoot, "node_modules"), { recursive: true });
|
|
33975
34046
|
await writeFile7(installCompletionMarkerPath(packageRoot), key, "utf-8");
|
|
33976
34047
|
} catch (error) {
|
|
33977
34048
|
console.warn(
|
|
@@ -33982,14 +34053,14 @@ async function writeInstallCompletionMarker(packageRoot) {
|
|
|
33982
34053
|
}
|
|
33983
34054
|
async function externalLayoutInstallCompleted(packageRoot) {
|
|
33984
34055
|
const marker = await readTextFileOptional(
|
|
33985
|
-
|
|
34056
|
+
path21.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER)
|
|
33986
34057
|
);
|
|
33987
34058
|
return marker !== null && marker === await computeInstallCompletionKey(packageRoot);
|
|
33988
34059
|
}
|
|
33989
34060
|
async function invalidateInstallCompletionMarkers(packageRoot) {
|
|
33990
34061
|
await Promise.all([
|
|
33991
34062
|
rm5(installCompletionMarkerPath(packageRoot), { force: true }),
|
|
33992
|
-
rm5(
|
|
34063
|
+
rm5(path21.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER), {
|
|
33993
34064
|
force: true
|
|
33994
34065
|
})
|
|
33995
34066
|
]);
|
|
@@ -33997,9 +34068,9 @@ async function invalidateInstallCompletionMarkers(packageRoot) {
|
|
|
33997
34068
|
async function writeExternalLayoutInstallMarker(packageRoot) {
|
|
33998
34069
|
const key = await computeInstallCompletionKey(packageRoot);
|
|
33999
34070
|
if (key == null) return;
|
|
34000
|
-
await mkdir6(
|
|
34071
|
+
await mkdir6(path21.join(packageRoot, "node_modules"), { recursive: true });
|
|
34001
34072
|
await writeFile7(
|
|
34002
|
-
|
|
34073
|
+
path21.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER),
|
|
34003
34074
|
key,
|
|
34004
34075
|
"utf-8"
|
|
34005
34076
|
);
|
|
@@ -34010,7 +34081,7 @@ async function refreshInstallCompletionMarkers(packageRoot) {
|
|
|
34010
34081
|
return;
|
|
34011
34082
|
await writeInstallCompletionMarker(packageRoot);
|
|
34012
34083
|
if (await pathExists2(
|
|
34013
|
-
|
|
34084
|
+
path21.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER)
|
|
34014
34085
|
)) {
|
|
34015
34086
|
await writeExternalLayoutInstallMarker(packageRoot);
|
|
34016
34087
|
}
|
|
@@ -34024,11 +34095,11 @@ async function pathExists2(filePath) {
|
|
|
34024
34095
|
}
|
|
34025
34096
|
}
|
|
34026
34097
|
async function hasPnpLoader(packageRoot) {
|
|
34027
|
-
return await pathExists2(
|
|
34098
|
+
return await pathExists2(path21.join(packageRoot, ".pnp.cjs")) || await pathExists2(path21.join(packageRoot, ".pnp.js"));
|
|
34028
34099
|
}
|
|
34029
34100
|
async function nodeModulesHasMeaningfulEntries(packageRoot) {
|
|
34030
34101
|
try {
|
|
34031
|
-
const entries = await readdir6(
|
|
34102
|
+
const entries = await readdir6(path21.join(packageRoot, "node_modules"));
|
|
34032
34103
|
return entries.some((entry) => !entry.startsWith("."));
|
|
34033
34104
|
} catch {
|
|
34034
34105
|
return false;
|
|
@@ -34065,12 +34136,12 @@ async function resolvePackageManagerCommand(pm, cwd) {
|
|
|
34065
34136
|
function protectedRootFor(cwd) {
|
|
34066
34137
|
const raw = process.env.TEMPO_DEVSERVER_PROTECTED_ROOTS;
|
|
34067
34138
|
if (!raw) return null;
|
|
34068
|
-
const protectedRoots = raw.split(
|
|
34139
|
+
const protectedRoots = raw.split(path21.delimiter).map((p2) => p2.trim()).filter((p2) => p2.length > 0).map((p2) => path21.resolve(p2));
|
|
34069
34140
|
if (protectedRoots.length === 0) return null;
|
|
34070
|
-
const resolved =
|
|
34141
|
+
const resolved = path21.resolve(cwd);
|
|
34071
34142
|
for (const root of protectedRoots) {
|
|
34072
|
-
const rel =
|
|
34073
|
-
if (rel === "" || !rel.startsWith("..") && !
|
|
34143
|
+
const rel = path21.relative(root, resolved);
|
|
34144
|
+
if (rel === "" || !rel.startsWith("..") && !path21.isAbsolute(rel)) {
|
|
34074
34145
|
return root;
|
|
34075
34146
|
}
|
|
34076
34147
|
}
|
|
@@ -34139,11 +34210,11 @@ function toProjectNodeEnvOption(override) {
|
|
|
34139
34210
|
};
|
|
34140
34211
|
}
|
|
34141
34212
|
function getProjectNodeUnsatisfiedHint(cwd) {
|
|
34142
|
-
const unsatisfied = projectNodeUnsatisfiedByDir.get(
|
|
34213
|
+
const unsatisfied = projectNodeUnsatisfiedByDir.get(path21.resolve(cwd));
|
|
34143
34214
|
return unsatisfied ? buildUnsatisfiedNodeHint(unsatisfied) : null;
|
|
34144
34215
|
}
|
|
34145
34216
|
async function resolveProjectNodeOverrideForDir(cwd) {
|
|
34146
|
-
const dir =
|
|
34217
|
+
const dir = path21.resolve(cwd);
|
|
34147
34218
|
const key = `${dir}|bundled:${isBundledNodeActivated()}`;
|
|
34148
34219
|
const cached = projectNodeOverrideCache.get(key);
|
|
34149
34220
|
if (cached) {
|
|
@@ -34163,7 +34234,7 @@ async function resolveProjectNodeOverrideForDir(cwd) {
|
|
|
34163
34234
|
projectNodeUnsatisfiedByDir.delete(dir);
|
|
34164
34235
|
return null;
|
|
34165
34236
|
}
|
|
34166
|
-
const treePackageJson = await readJsonFile(
|
|
34237
|
+
const treePackageJson = await readJsonFile(path21.join(dir, "package.json"));
|
|
34167
34238
|
const viteSpec = treePackageJson?.dependencies?.vite ?? treePackageJson?.devDependencies?.vite;
|
|
34168
34239
|
const viteMajor = typeof viteSpec === "string" ? parseFirstSemverMajor(viteSpec) : null;
|
|
34169
34240
|
const requireFloor = viteMajor != null && viteMajor >= 7;
|
|
@@ -34399,7 +34470,7 @@ async function runInstallCommandWithLockRetry(command, cwd, runCommandFn = runSh
|
|
|
34399
34470
|
}
|
|
34400
34471
|
}
|
|
34401
34472
|
}
|
|
34402
|
-
async function runInstallStep(step, signal, onOutput) {
|
|
34473
|
+
async function runInstallStep(step, signal, onOutput, projectRoot = step.cwd) {
|
|
34403
34474
|
throwIfLaunchAborted(signal);
|
|
34404
34475
|
await Promise.all(
|
|
34405
34476
|
[
|
|
@@ -34411,7 +34482,7 @@ async function runInstallStep(step, signal, onOutput) {
|
|
|
34411
34482
|
);
|
|
34412
34483
|
throwIfLaunchAborted(signal);
|
|
34413
34484
|
if (step.cleanBeforeInstall) {
|
|
34414
|
-
await rm5(
|
|
34485
|
+
await rm5(path21.join(step.cwd, "node_modules"), {
|
|
34415
34486
|
recursive: true,
|
|
34416
34487
|
force: true
|
|
34417
34488
|
}).catch((error) => {
|
|
@@ -34426,7 +34497,7 @@ async function runInstallStep(step, signal, onOutput) {
|
|
|
34426
34497
|
await runInstallCommandWithLockRetry(
|
|
34427
34498
|
step.command,
|
|
34428
34499
|
step.cwd,
|
|
34429
|
-
(command, cwd, signal2) => runShellCommand(command, cwd, signal2, onOutput),
|
|
34500
|
+
(command, cwd, signal2) => runShellCommand(command, cwd, signal2, onOutput, projectRoot),
|
|
34430
34501
|
INSTALL_LOCK_RETRY_DELAYS_MS,
|
|
34431
34502
|
signal
|
|
34432
34503
|
);
|
|
@@ -34462,7 +34533,7 @@ async function sleepForStatusRetry(delayMs) {
|
|
|
34462
34533
|
await new Promise((resolve2) => setTimeout(resolve2, delayMs));
|
|
34463
34534
|
}
|
|
34464
34535
|
async function writeStatusTextBestEffort(statusPath, text) {
|
|
34465
|
-
await mkdir6(
|
|
34536
|
+
await mkdir6(path21.dirname(statusPath), { recursive: true });
|
|
34466
34537
|
const delays = [25, 75, 150];
|
|
34467
34538
|
let lastError = null;
|
|
34468
34539
|
for (let attempt = 0; attempt <= delays.length; attempt += 1) {
|
|
@@ -34488,15 +34559,15 @@ function augmentManagedPath(env) {
|
|
|
34488
34559
|
return env;
|
|
34489
34560
|
}
|
|
34490
34561
|
const candidates = [
|
|
34491
|
-
process.env.ProgramFiles ?
|
|
34492
|
-
process.env.APPDATA ?
|
|
34493
|
-
process.env.LOCALAPPDATA ?
|
|
34494
|
-
process.env.USERPROFILE ?
|
|
34495
|
-
process.env.USERPROFILE ?
|
|
34562
|
+
process.env.ProgramFiles ? path21.join(process.env.ProgramFiles, "nodejs") : null,
|
|
34563
|
+
process.env.APPDATA ? path21.join(process.env.APPDATA, "npm") : null,
|
|
34564
|
+
process.env.LOCALAPPDATA ? path21.join(process.env.LOCALAPPDATA, "pnpm") : null,
|
|
34565
|
+
process.env.USERPROFILE ? path21.join(process.env.USERPROFILE, ".bun", "bin") : null,
|
|
34566
|
+
process.env.USERPROFILE ? path21.join(process.env.USERPROFILE, ".volta", "bin") : null
|
|
34496
34567
|
].filter((value) => Boolean(value));
|
|
34497
34568
|
const pathKey = Object.keys(env).find((key) => key.toLowerCase() === "path");
|
|
34498
34569
|
const existingPath = pathKey ? env[pathKey] : env.PATH;
|
|
34499
|
-
const nextPath = [...candidates, existingPath].filter(Boolean).join(
|
|
34570
|
+
const nextPath = [...candidates, existingPath].filter(Boolean).join(path21.delimiter);
|
|
34500
34571
|
return {
|
|
34501
34572
|
...env,
|
|
34502
34573
|
[pathKey ?? "PATH"]: nextPath
|
|
@@ -34900,17 +34971,27 @@ async function runBoundedShellCommand(options) {
|
|
|
34900
34971
|
);
|
|
34901
34972
|
});
|
|
34902
34973
|
}
|
|
34903
|
-
async function runShellCommand(command, cwd, signal, onOutput) {
|
|
34974
|
+
async function runShellCommand(command, cwd, signal, onOutput, projectRoot = cwd) {
|
|
34904
34975
|
throwIfLaunchAborted(signal);
|
|
34905
34976
|
const projectNode = toProjectNodeEnvOption(
|
|
34906
34977
|
await resolveProjectNodeOverrideForDir(cwd)
|
|
34907
34978
|
);
|
|
34908
34979
|
const lifted = extractLeadingEnvAssignments(command);
|
|
34980
|
+
const registryEnv = await readInstallRegistryEnv(cwd, projectRoot, {
|
|
34981
|
+
...process.env,
|
|
34982
|
+
...lifted.env
|
|
34983
|
+
});
|
|
34909
34984
|
const result = await runAbortableShellCommand({
|
|
34910
34985
|
command: lifted.command,
|
|
34911
34986
|
cwd,
|
|
34912
34987
|
signal,
|
|
34913
|
-
env: {
|
|
34988
|
+
env: {
|
|
34989
|
+
// Restore referenced credentials (including NPM_TOKEN, otherwise
|
|
34990
|
+
// stripped with npm session state) without overriding managed flags.
|
|
34991
|
+
...registryEnv,
|
|
34992
|
+
...buildManagedCommandEnv({ projectNode }),
|
|
34993
|
+
...lifted.env
|
|
34994
|
+
},
|
|
34914
34995
|
onOutput,
|
|
34915
34996
|
idleTimeoutMs: INSTALL_IDLE_TIMEOUT_MS
|
|
34916
34997
|
});
|
|
@@ -34925,7 +35006,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
34925
35006
|
throwIfLaunchAborted(signal);
|
|
34926
35007
|
const configuredUpdateCommand = options.updateCommand?.trim();
|
|
34927
35008
|
const runCommandFn = options.runCommand ?? runShellCommand;
|
|
34928
|
-
const metadataCacheDir = configuredUpdateCommand ? null : await mkdtemp(
|
|
35009
|
+
const metadataCacheDir = configuredUpdateCommand ? null : await mkdtemp(path21.join(os2.tmpdir(), "tempo-sdk-meta-")).catch(
|
|
34929
35010
|
() => null
|
|
34930
35011
|
);
|
|
34931
35012
|
const cleanupMetadataCache = async () => {
|
|
@@ -34978,9 +35059,9 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
34978
35059
|
let updateCommandStarted = false;
|
|
34979
35060
|
let ignoredBuildScriptsAfterLink = false;
|
|
34980
35061
|
try {
|
|
34981
|
-
const packageJsonPath =
|
|
35062
|
+
const packageJsonPath = path21.join(cwd, "package.json");
|
|
34982
35063
|
const ensureSpecLatest = async () => {
|
|
34983
|
-
const raw = await
|
|
35064
|
+
const raw = await readFile15(packageJsonPath, "utf-8").catch(() => null);
|
|
34984
35065
|
if (!raw) return false;
|
|
34985
35066
|
const parsed = JSON.parse(raw);
|
|
34986
35067
|
const dependencies = parsed.dependencies && typeof parsed.dependencies === "object" && !Array.isArray(parsed.dependencies) ? parsed.dependencies : void 0;
|
|
@@ -35025,14 +35106,14 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
35025
35106
|
await ensureSpecLatest();
|
|
35026
35107
|
return { attempted: true, plan };
|
|
35027
35108
|
}
|
|
35028
|
-
const nodeModulesPath =
|
|
35029
|
-
const installedPkgPath =
|
|
35109
|
+
const nodeModulesPath = path21.join(cwd, "node_modules");
|
|
35110
|
+
const installedPkgPath = path21.join(
|
|
35030
35111
|
nodeModulesPath,
|
|
35031
35112
|
"tempo-sdk",
|
|
35032
35113
|
"package.json"
|
|
35033
35114
|
);
|
|
35034
35115
|
const [installedRaw, registryResponse] = await Promise.all([
|
|
35035
|
-
|
|
35116
|
+
readFile15(installedPkgPath, "utf-8").catch(() => null),
|
|
35036
35117
|
fetch("https://registry.npmjs.org/tempo-sdk/latest", {
|
|
35037
35118
|
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(3e3)]) : AbortSignal.timeout(3e3)
|
|
35038
35119
|
}).catch(() => null)
|
|
@@ -35077,7 +35158,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
35077
35158
|
}
|
|
35078
35159
|
throwIfLaunchAborted(signal);
|
|
35079
35160
|
await ensureSpecLatest();
|
|
35080
|
-
const upgradedRaw = await
|
|
35161
|
+
const upgradedRaw = await readFile15(installedPkgPath, "utf-8").catch(
|
|
35081
35162
|
() => null
|
|
35082
35163
|
);
|
|
35083
35164
|
const upgradedVersion = upgradedRaw ? JSON.parse(upgradedRaw).version : null;
|
|
@@ -35104,7 +35185,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
35104
35185
|
}
|
|
35105
35186
|
async function readJsonFile(filePath) {
|
|
35106
35187
|
try {
|
|
35107
|
-
return JSON.parse(await
|
|
35188
|
+
return JSON.parse(await readFile15(filePath, "utf-8"));
|
|
35108
35189
|
} catch {
|
|
35109
35190
|
return null;
|
|
35110
35191
|
}
|
|
@@ -35199,14 +35280,14 @@ function advertisedRootBelongsToWorkspace(advertised, expected) {
|
|
|
35199
35280
|
try {
|
|
35200
35281
|
return fs3.realpathSync(p2);
|
|
35201
35282
|
} catch {
|
|
35202
|
-
return
|
|
35283
|
+
return path21.resolve(p2);
|
|
35203
35284
|
}
|
|
35204
35285
|
};
|
|
35205
35286
|
const a = norm(advertised);
|
|
35206
35287
|
const e = norm(expected);
|
|
35207
35288
|
if (a === e) return true;
|
|
35208
|
-
const aWithSep = a.endsWith(
|
|
35209
|
-
const eWithSep = e.endsWith(
|
|
35289
|
+
const aWithSep = a.endsWith(path21.sep) ? a : `${a}${path21.sep}`;
|
|
35290
|
+
const eWithSep = e.endsWith(path21.sep) ? e : `${e}${path21.sep}`;
|
|
35210
35291
|
return a.startsWith(eWithSep) || e.startsWith(aWithSep);
|
|
35211
35292
|
}
|
|
35212
35293
|
var MAX_PROBE_RESPONSE_BYTES = 64 * 1024;
|
|
@@ -35529,13 +35610,13 @@ function sleep3(ms) {
|
|
|
35529
35610
|
}
|
|
35530
35611
|
|
|
35531
35612
|
// ../tempo-devserver/read-status.ts
|
|
35532
|
-
import { readFile as
|
|
35533
|
-
import
|
|
35613
|
+
import { readFile as readFile16 } from "fs/promises";
|
|
35614
|
+
import path22 from "path";
|
|
35534
35615
|
async function readDevServerStatus(tempoRoot) {
|
|
35535
|
-
const statusPath =
|
|
35616
|
+
const statusPath = path22.join(tempoRoot, ".tempo", "status.json");
|
|
35536
35617
|
let raw;
|
|
35537
35618
|
try {
|
|
35538
|
-
raw = await
|
|
35619
|
+
raw = await readFile16(statusPath, "utf-8");
|
|
35539
35620
|
} catch {
|
|
35540
35621
|
return { dependenciesInstalled: false, devserverUrl: null };
|
|
35541
35622
|
}
|
|
@@ -35558,7 +35639,7 @@ function buildInstallScript(rootInstallCmd) {
|
|
|
35558
35639
|
}
|
|
35559
35640
|
|
|
35560
35641
|
// ../tempo-project/canvas-zones.ts
|
|
35561
|
-
import
|
|
35642
|
+
import path23 from "path";
|
|
35562
35643
|
var DESIGN_SYSTEM_ZONE_DIR = "design-system";
|
|
35563
35644
|
var LIBRARIES_ZONE_DIR = "libraries";
|
|
35564
35645
|
var FREEFORM_CANVASES_DIR = "canvases";
|
|
@@ -35585,7 +35666,7 @@ function isStrictZone(zone) {
|
|
|
35585
35666
|
return zone.kind !== "freeform";
|
|
35586
35667
|
}
|
|
35587
35668
|
async function resolveFreeformCanvasesDir(canvasesRoot) {
|
|
35588
|
-
return
|
|
35669
|
+
return path23.join(canvasesRoot, FREEFORM_CANVASES_DIR);
|
|
35589
35670
|
}
|
|
35590
35671
|
|
|
35591
35672
|
// ../tempo-project/config.ts
|
|
@@ -35977,7 +36058,7 @@ async function buildRepairConfig(projectRoot, rawConfig) {
|
|
|
35977
36058
|
};
|
|
35978
36059
|
}
|
|
35979
36060
|
async function ensureValidTempoConfigFile(projectRoot) {
|
|
35980
|
-
const normalizedRoot =
|
|
36061
|
+
const normalizedRoot = path24.resolve(projectRoot);
|
|
35981
36062
|
const configPath = await findTempoConfigPath(normalizedRoot);
|
|
35982
36063
|
if (!configPath) {
|
|
35983
36064
|
return {
|
|
@@ -35997,19 +36078,19 @@ async function ensureValidTempoConfigFile(projectRoot) {
|
|
|
35997
36078
|
const repairError = error instanceof Error ? error.message : String(error);
|
|
35998
36079
|
let rawConfig = null;
|
|
35999
36080
|
try {
|
|
36000
|
-
const raw = await
|
|
36081
|
+
const raw = await readFile17(configPath, "utf-8");
|
|
36001
36082
|
const parsed = JSON.parse(raw);
|
|
36002
36083
|
rawConfig = isObjectRecord(parsed) ? parsed : null;
|
|
36003
36084
|
} catch {
|
|
36004
36085
|
}
|
|
36005
|
-
const canonicalConfigDir =
|
|
36006
|
-
const configDir =
|
|
36007
|
-
if (
|
|
36086
|
+
const canonicalConfigDir = path24.join(normalizedRoot, TEMPO_DIR_NAME2);
|
|
36087
|
+
const configDir = path24.dirname(configPath) === normalizedRoot ? canonicalConfigDir : path24.dirname(configPath);
|
|
36088
|
+
if (path24.dirname(configPath) === normalizedRoot) {
|
|
36008
36089
|
await rm6(configPath, { force: true });
|
|
36009
36090
|
}
|
|
36010
36091
|
const repaired = await buildRepairConfig(normalizedRoot, rawConfig);
|
|
36011
36092
|
await writeTempoConfigFile(configDir, repaired);
|
|
36012
|
-
const wroteConfigPath =
|
|
36093
|
+
const wroteConfigPath = path24.join(configDir, TEMPO_CONFIG_FILE);
|
|
36013
36094
|
devLog("tempo-config:schema-repaired", {
|
|
36014
36095
|
projectRoot: normalizedRoot,
|
|
36015
36096
|
previousConfigPath: configPath,
|
|
@@ -36025,8 +36106,8 @@ async function ensureValidTempoConfigFile(projectRoot) {
|
|
|
36025
36106
|
}
|
|
36026
36107
|
}
|
|
36027
36108
|
async function findTempoConfigPath(projectRoot) {
|
|
36028
|
-
const legacyRootPath =
|
|
36029
|
-
const canonicalPath2 =
|
|
36109
|
+
const legacyRootPath = path24.join(projectRoot, TEMPO_CONFIG_FILE);
|
|
36110
|
+
const canonicalPath2 = path24.join(
|
|
36030
36111
|
projectRoot,
|
|
36031
36112
|
TEMPO_DIR_NAME2,
|
|
36032
36113
|
TEMPO_CONFIG_FILE
|
|
@@ -36042,7 +36123,7 @@ async function findTempoConfigPath(projectRoot) {
|
|
|
36042
36123
|
async function isForeignRootConfig(configPath) {
|
|
36043
36124
|
let parsed;
|
|
36044
36125
|
try {
|
|
36045
|
-
parsed = JSON.parse(await
|
|
36126
|
+
parsed = JSON.parse(await readFile17(configPath, "utf-8"));
|
|
36046
36127
|
} catch {
|
|
36047
36128
|
return false;
|
|
36048
36129
|
}
|
|
@@ -36051,7 +36132,7 @@ async function isForeignRootConfig(configPath) {
|
|
|
36051
36132
|
async function parseConfigAt(configPath) {
|
|
36052
36133
|
let rawContents;
|
|
36053
36134
|
try {
|
|
36054
|
-
rawContents = await
|
|
36135
|
+
rawContents = await readFile17(configPath, "utf-8");
|
|
36055
36136
|
} catch (error) {
|
|
36056
36137
|
throw new ConfigInvalidError(
|
|
36057
36138
|
configPath,
|
|
@@ -36078,10 +36159,10 @@ async function parseConfigAt(configPath) {
|
|
|
36078
36159
|
}
|
|
36079
36160
|
}
|
|
36080
36161
|
async function tempoConfigExists(projectRoot) {
|
|
36081
|
-
return await findTempoConfigPath(
|
|
36162
|
+
return await findTempoConfigPath(path24.resolve(projectRoot)) !== null;
|
|
36082
36163
|
}
|
|
36083
36164
|
async function writeTempoConfigFile(configDir, config) {
|
|
36084
|
-
const configPath =
|
|
36165
|
+
const configPath = path24.join(configDir, TEMPO_CONFIG_FILE);
|
|
36085
36166
|
const normalized = validateTempoConfigFile(config);
|
|
36086
36167
|
const rendered = {};
|
|
36087
36168
|
if (normalized.paths) {
|
|
@@ -36150,10 +36231,10 @@ function buildExpoTempoConfig(opts) {
|
|
|
36150
36231
|
};
|
|
36151
36232
|
}
|
|
36152
36233
|
function resolveCanvasesDirSync(projectRoot) {
|
|
36153
|
-
const normalizedRoot =
|
|
36234
|
+
const normalizedRoot = path24.resolve(projectRoot);
|
|
36154
36235
|
const candidates = [
|
|
36155
|
-
|
|
36156
|
-
|
|
36236
|
+
path24.join(normalizedRoot, TEMPO_DIR_NAME2, TEMPO_CONFIG_FILE),
|
|
36237
|
+
path24.join(normalizedRoot, TEMPO_CONFIG_FILE)
|
|
36157
36238
|
];
|
|
36158
36239
|
for (const configPath of candidates) {
|
|
36159
36240
|
let parsed;
|
|
@@ -36165,21 +36246,21 @@ function resolveCanvasesDirSync(projectRoot) {
|
|
|
36165
36246
|
if (!isObjectRecord(parsed) || !("scripts" in parsed)) continue;
|
|
36166
36247
|
const paths = isObjectRecord(parsed.paths) ? parsed.paths : void 0;
|
|
36167
36248
|
const canvases = typeof paths?.canvases === "string" && paths.canvases.trim().length > 0 ? toPosixPath4(paths.canvases.trim()) : NEW_PROJECT_CANVASES_PATH;
|
|
36168
|
-
return
|
|
36249
|
+
return path24.resolve(path24.dirname(configPath), canvases);
|
|
36169
36250
|
}
|
|
36170
|
-
return
|
|
36251
|
+
return path24.join(normalizedRoot, TEMPO_DIR_NAME2, "designs");
|
|
36171
36252
|
}
|
|
36172
36253
|
async function resolveTempoConfig(projectRoot) {
|
|
36173
|
-
const normalizedProjectRoot =
|
|
36254
|
+
const normalizedProjectRoot = path24.resolve(projectRoot);
|
|
36174
36255
|
const configPath = await findTempoConfigPath(normalizedProjectRoot);
|
|
36175
36256
|
if (!configPath) {
|
|
36176
36257
|
throw new ConfigMissingError(normalizedProjectRoot);
|
|
36177
36258
|
}
|
|
36178
36259
|
const config = await parseConfigAt(configPath);
|
|
36179
|
-
const tempoRoot =
|
|
36180
|
-
const relativeTempoRoot =
|
|
36260
|
+
const tempoRoot = path24.dirname(configPath);
|
|
36261
|
+
const relativeTempoRoot = path24.relative(normalizedProjectRoot, tempoRoot);
|
|
36181
36262
|
const rootRel = relativeTempoRoot === "" ? "." : `./${toPosixPath4(relativeTempoRoot)}`;
|
|
36182
|
-
const pagesDir =
|
|
36263
|
+
const pagesDir = path24.resolve(
|
|
36183
36264
|
tempoRoot,
|
|
36184
36265
|
config.paths?.canvases ?? NEW_PROJECT_CANVASES_PATH
|
|
36185
36266
|
);
|
|
@@ -36214,9 +36295,9 @@ async function resolveTempoConfig(projectRoot) {
|
|
|
36214
36295
|
rootRel,
|
|
36215
36296
|
tempoRoot,
|
|
36216
36297
|
pagesDir,
|
|
36217
|
-
packageJsonPath:
|
|
36218
|
-
viteConfigPath:
|
|
36219
|
-
tsconfigPath:
|
|
36298
|
+
packageJsonPath: path24.join(tempoRoot, "package.json"),
|
|
36299
|
+
viteConfigPath: path24.join(tempoRoot, "vite.config.ts"),
|
|
36300
|
+
tsconfigPath: path24.join(tempoRoot, "tsconfig.json"),
|
|
36220
36301
|
tempoHostUrl: config.urls?.tempoHost ?? null,
|
|
36221
36302
|
appUrl: activeApp.url,
|
|
36222
36303
|
scripts: {
|
|
@@ -36232,12 +36313,12 @@ async function resolveTempoConfig(projectRoot) {
|
|
|
36232
36313
|
}
|
|
36233
36314
|
|
|
36234
36315
|
// ../tempo-project/git.ts
|
|
36235
|
-
import
|
|
36316
|
+
import path26 from "path";
|
|
36236
36317
|
import { access as access6 } from "fs/promises";
|
|
36237
36318
|
|
|
36238
36319
|
// ../workspaces/meta-repo/meta-repo.ts
|
|
36239
36320
|
import fs4 from "fs/promises";
|
|
36240
|
-
import
|
|
36321
|
+
import path25 from "path";
|
|
36241
36322
|
|
|
36242
36323
|
// ../../node_modules/.pnpm/simple-git@3.32.3/node_modules/simple-git/dist/esm/index.js
|
|
36243
36324
|
var import_file_exists = __toESM(require_dist(), 1);
|
|
@@ -36276,8 +36357,8 @@ function pathspec(...paths) {
|
|
|
36276
36357
|
cache.set(key, paths);
|
|
36277
36358
|
return key;
|
|
36278
36359
|
}
|
|
36279
|
-
function isPathSpec(
|
|
36280
|
-
return
|
|
36360
|
+
function isPathSpec(path64) {
|
|
36361
|
+
return path64 instanceof String && cache.has(path64);
|
|
36281
36362
|
}
|
|
36282
36363
|
function toPaths(pathSpec) {
|
|
36283
36364
|
return cache.get(pathSpec) || [];
|
|
@@ -36366,8 +36447,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
|
36366
36447
|
function forEachLineWithContent(input, callback) {
|
|
36367
36448
|
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
36368
36449
|
}
|
|
36369
|
-
function folderExists(
|
|
36370
|
-
return (0, import_file_exists.exists)(
|
|
36450
|
+
function folderExists(path64) {
|
|
36451
|
+
return (0, import_file_exists.exists)(path64, import_file_exists.FOLDER);
|
|
36371
36452
|
}
|
|
36372
36453
|
function append(target, item) {
|
|
36373
36454
|
if (Array.isArray(target)) {
|
|
@@ -36771,8 +36852,8 @@ function checkIsRepoRootTask() {
|
|
|
36771
36852
|
commands,
|
|
36772
36853
|
format: "utf-8",
|
|
36773
36854
|
onError,
|
|
36774
|
-
parser(
|
|
36775
|
-
return /^\.(git)?$/.test(
|
|
36855
|
+
parser(path64) {
|
|
36856
|
+
return /^\.(git)?$/.test(path64.trim());
|
|
36776
36857
|
}
|
|
36777
36858
|
};
|
|
36778
36859
|
}
|
|
@@ -37206,11 +37287,11 @@ function parseGrep(grep) {
|
|
|
37206
37287
|
const paths = /* @__PURE__ */ new Set();
|
|
37207
37288
|
const results = {};
|
|
37208
37289
|
forEachLineWithContent(grep, (input) => {
|
|
37209
|
-
const [
|
|
37210
|
-
paths.add(
|
|
37211
|
-
(results[
|
|
37290
|
+
const [path64, line, preview] = input.split(NULL);
|
|
37291
|
+
paths.add(path64);
|
|
37292
|
+
(results[path64] = results[path64] || []).push({
|
|
37212
37293
|
line: asNumber(line),
|
|
37213
|
-
path:
|
|
37294
|
+
path: path64,
|
|
37214
37295
|
preview
|
|
37215
37296
|
});
|
|
37216
37297
|
});
|
|
@@ -37975,14 +38056,14 @@ var init_hash_object = __esm({
|
|
|
37975
38056
|
init_task();
|
|
37976
38057
|
}
|
|
37977
38058
|
});
|
|
37978
|
-
function parseInit(bare,
|
|
38059
|
+
function parseInit(bare, path64, text) {
|
|
37979
38060
|
const response = String(text).trim();
|
|
37980
38061
|
let result;
|
|
37981
38062
|
if (result = initResponseRegex.exec(response)) {
|
|
37982
|
-
return new InitSummary(bare,
|
|
38063
|
+
return new InitSummary(bare, path64, false, result[1]);
|
|
37983
38064
|
}
|
|
37984
38065
|
if (result = reInitResponseRegex.exec(response)) {
|
|
37985
|
-
return new InitSummary(bare,
|
|
38066
|
+
return new InitSummary(bare, path64, true, result[1]);
|
|
37986
38067
|
}
|
|
37987
38068
|
let gitDir = "";
|
|
37988
38069
|
const tokens = response.split(" ");
|
|
@@ -37993,7 +38074,7 @@ function parseInit(bare, path63, text) {
|
|
|
37993
38074
|
break;
|
|
37994
38075
|
}
|
|
37995
38076
|
}
|
|
37996
|
-
return new InitSummary(bare,
|
|
38077
|
+
return new InitSummary(bare, path64, /^re/i.test(response), gitDir);
|
|
37997
38078
|
}
|
|
37998
38079
|
var InitSummary;
|
|
37999
38080
|
var initResponseRegex;
|
|
@@ -38002,9 +38083,9 @@ var init_InitSummary = __esm({
|
|
|
38002
38083
|
"src/lib/responses/InitSummary.ts"() {
|
|
38003
38084
|
"use strict";
|
|
38004
38085
|
InitSummary = class {
|
|
38005
|
-
constructor(bare,
|
|
38086
|
+
constructor(bare, path64, existing, gitDir) {
|
|
38006
38087
|
this.bare = bare;
|
|
38007
|
-
this.path =
|
|
38088
|
+
this.path = path64;
|
|
38008
38089
|
this.existing = existing;
|
|
38009
38090
|
this.gitDir = gitDir;
|
|
38010
38091
|
}
|
|
@@ -38016,7 +38097,7 @@ var init_InitSummary = __esm({
|
|
|
38016
38097
|
function hasBareCommand(command) {
|
|
38017
38098
|
return command.includes(bareCommand);
|
|
38018
38099
|
}
|
|
38019
|
-
function initTask(bare = false,
|
|
38100
|
+
function initTask(bare = false, path64, customArgs) {
|
|
38020
38101
|
const commands = ["init", ...customArgs];
|
|
38021
38102
|
if (bare && !hasBareCommand(commands)) {
|
|
38022
38103
|
commands.splice(1, 0, bareCommand);
|
|
@@ -38025,7 +38106,7 @@ function initTask(bare = false, path63, customArgs) {
|
|
|
38025
38106
|
commands,
|
|
38026
38107
|
format: "utf-8",
|
|
38027
38108
|
parser(text) {
|
|
38028
|
-
return parseInit(commands.includes("--bare"),
|
|
38109
|
+
return parseInit(commands.includes("--bare"), path64, text);
|
|
38029
38110
|
}
|
|
38030
38111
|
};
|
|
38031
38112
|
}
|
|
@@ -38841,12 +38922,12 @@ var init_FileStatusSummary = __esm({
|
|
|
38841
38922
|
"use strict";
|
|
38842
38923
|
fromPathRegex = /^(.+)\0(.+)$/;
|
|
38843
38924
|
FileStatusSummary = class {
|
|
38844
|
-
constructor(
|
|
38845
|
-
this.path =
|
|
38925
|
+
constructor(path64, index, working_dir) {
|
|
38926
|
+
this.path = path64;
|
|
38846
38927
|
this.index = index;
|
|
38847
38928
|
this.working_dir = working_dir;
|
|
38848
38929
|
if (index === "R" || working_dir === "R") {
|
|
38849
|
-
const detail = fromPathRegex.exec(
|
|
38930
|
+
const detail = fromPathRegex.exec(path64) || [null, path64, path64];
|
|
38850
38931
|
this.from = detail[2] || "";
|
|
38851
38932
|
this.path = detail[1] || "";
|
|
38852
38933
|
}
|
|
@@ -38877,14 +38958,14 @@ function splitLine(result, lineStr) {
|
|
|
38877
38958
|
default:
|
|
38878
38959
|
return;
|
|
38879
38960
|
}
|
|
38880
|
-
function data(index, workingDir,
|
|
38961
|
+
function data(index, workingDir, path64) {
|
|
38881
38962
|
const raw = `${index}${workingDir}`;
|
|
38882
38963
|
const handler = parsers6.get(raw);
|
|
38883
38964
|
if (handler) {
|
|
38884
|
-
handler(result,
|
|
38965
|
+
handler(result, path64);
|
|
38885
38966
|
}
|
|
38886
38967
|
if (raw !== "##" && raw !== "!!") {
|
|
38887
|
-
result.files.push(new FileStatusSummary(
|
|
38968
|
+
result.files.push(new FileStatusSummary(path64, index, workingDir));
|
|
38888
38969
|
}
|
|
38889
38970
|
}
|
|
38890
38971
|
}
|
|
@@ -39193,9 +39274,9 @@ var init_simple_git_api = __esm({
|
|
|
39193
39274
|
next
|
|
39194
39275
|
);
|
|
39195
39276
|
}
|
|
39196
|
-
hashObject(
|
|
39277
|
+
hashObject(path64, write2) {
|
|
39197
39278
|
return this._runTask(
|
|
39198
|
-
hashObjectTask(
|
|
39279
|
+
hashObjectTask(path64, write2 === true),
|
|
39199
39280
|
trailingFunctionArgument(arguments)
|
|
39200
39281
|
);
|
|
39201
39282
|
}
|
|
@@ -39548,8 +39629,8 @@ var init_branch = __esm({
|
|
|
39548
39629
|
}
|
|
39549
39630
|
});
|
|
39550
39631
|
function toPath(input) {
|
|
39551
|
-
const
|
|
39552
|
-
return
|
|
39632
|
+
const path64 = input.trim().replace(/^["']|["']$/g, "");
|
|
39633
|
+
return path64 && normalize(path64);
|
|
39553
39634
|
}
|
|
39554
39635
|
var parseCheckIgnore;
|
|
39555
39636
|
var init_CheckIgnore = __esm({
|
|
@@ -39863,8 +39944,8 @@ __export(sub_module_exports, {
|
|
|
39863
39944
|
subModuleTask: () => subModuleTask,
|
|
39864
39945
|
updateSubModuleTask: () => updateSubModuleTask
|
|
39865
39946
|
});
|
|
39866
|
-
function addSubModuleTask(repo,
|
|
39867
|
-
return subModuleTask(["add", repo,
|
|
39947
|
+
function addSubModuleTask(repo, path64) {
|
|
39948
|
+
return subModuleTask(["add", repo, path64]);
|
|
39868
39949
|
}
|
|
39869
39950
|
function initSubModuleTask(customArgs) {
|
|
39870
39951
|
return subModuleTask(["init", ...customArgs]);
|
|
@@ -40197,8 +40278,8 @@ var require_git = __commonJS2({
|
|
|
40197
40278
|
}
|
|
40198
40279
|
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
40199
40280
|
};
|
|
40200
|
-
Git2.prototype.submoduleAdd = function(repo,
|
|
40201
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
40281
|
+
Git2.prototype.submoduleAdd = function(repo, path64, then) {
|
|
40282
|
+
return this._runTask(addSubModuleTask2(repo, path64), trailingFunctionArgument2(arguments));
|
|
40202
40283
|
};
|
|
40203
40284
|
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
40204
40285
|
return this._runTask(
|
|
@@ -40808,7 +40889,7 @@ async function pathExists4(targetPath) {
|
|
|
40808
40889
|
}
|
|
40809
40890
|
}
|
|
40810
40891
|
async function ensureGitRepo(repoPath) {
|
|
40811
|
-
const gitDir =
|
|
40892
|
+
const gitDir = path25.join(repoPath, ".git");
|
|
40812
40893
|
await fs4.mkdir(repoPath, { recursive: true });
|
|
40813
40894
|
const git = simpleGit(repoPath);
|
|
40814
40895
|
let isWorkTree = false;
|
|
@@ -40866,7 +40947,7 @@ function describeGitFailure(err) {
|
|
|
40866
40947
|
return msg || "Git failed for an unknown reason.";
|
|
40867
40948
|
}
|
|
40868
40949
|
async function ensureTempoGitRepo(projectRoot) {
|
|
40869
|
-
const gitDir =
|
|
40950
|
+
const gitDir = path26.join(projectRoot, ".git");
|
|
40870
40951
|
const hadGit = await pathExists5(gitDir);
|
|
40871
40952
|
try {
|
|
40872
40953
|
await ensureGitRepo(projectRoot);
|
|
@@ -40884,8 +40965,8 @@ async function ensureTempoGitRepo(projectRoot) {
|
|
|
40884
40965
|
}
|
|
40885
40966
|
|
|
40886
40967
|
// ../tempo-project/ignores.ts
|
|
40887
|
-
import
|
|
40888
|
-
import { access as access7, lstat as lstat4, mkdir as mkdir8, readFile as
|
|
40968
|
+
import path27 from "path";
|
|
40969
|
+
import { access as access7, lstat as lstat4, mkdir as mkdir8, readFile as readFile18, writeFile as writeFile9 } from "fs/promises";
|
|
40889
40970
|
async function pathExists6(targetPath) {
|
|
40890
40971
|
try {
|
|
40891
40972
|
await access7(targetPath);
|
|
@@ -40904,17 +40985,17 @@ function getIgnorePrefix(config) {
|
|
|
40904
40985
|
return `${config.rootRel.replace(/^\.\//, "").replace(/\/+$/, "")}/`;
|
|
40905
40986
|
}
|
|
40906
40987
|
async function resolveGitDir(projectRoot) {
|
|
40907
|
-
const dotGit =
|
|
40988
|
+
const dotGit = path27.join(projectRoot, ".git");
|
|
40908
40989
|
try {
|
|
40909
40990
|
const stat11 = await lstat4(dotGit);
|
|
40910
40991
|
if (stat11.isDirectory()) {
|
|
40911
40992
|
return dotGit;
|
|
40912
40993
|
}
|
|
40913
|
-
const content = await
|
|
40994
|
+
const content = await readFile18(dotGit, "utf-8");
|
|
40914
40995
|
const match = content.match(/^gitdir:\s*(.+)$/m);
|
|
40915
40996
|
if (!match) return null;
|
|
40916
40997
|
const gitdir = match[1].trim();
|
|
40917
|
-
return
|
|
40998
|
+
return path27.isAbsolute(gitdir) ? gitdir : path27.resolve(projectRoot, gitdir);
|
|
40918
40999
|
} catch {
|
|
40919
41000
|
return null;
|
|
40920
41001
|
}
|
|
@@ -40962,10 +41043,10 @@ var TEMPO_FOLDER_GITIGNORE_ENTRIES = [
|
|
|
40962
41043
|
".DS_Store"
|
|
40963
41044
|
];
|
|
40964
41045
|
function getTempoFolderGitignorePath(config) {
|
|
40965
|
-
return
|
|
41046
|
+
return path27.join(config.tempoRoot, ".gitignore");
|
|
40966
41047
|
}
|
|
40967
41048
|
async function ensureTextFileEntries(filePath, entriesToEnsure) {
|
|
40968
|
-
const existingRaw = await pathExists6(filePath) ? await
|
|
41049
|
+
const existingRaw = await pathExists6(filePath) ? await readFile18(filePath, "utf-8") : "";
|
|
40969
41050
|
const existingEntries = existingRaw.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
|
|
40970
41051
|
const existingSet = new Set(existingEntries);
|
|
40971
41052
|
let changed = false;
|
|
@@ -40980,7 +41061,7 @@ async function ensureTextFileEntries(filePath, entriesToEnsure) {
|
|
|
40980
41061
|
if (!changed && await pathExists6(filePath)) {
|
|
40981
41062
|
return false;
|
|
40982
41063
|
}
|
|
40983
|
-
await mkdir8(
|
|
41064
|
+
await mkdir8(path27.dirname(filePath), { recursive: true });
|
|
40984
41065
|
const body = existingEntries.length > 0 ? `${existingEntries.join("\n")}
|
|
40985
41066
|
` : "";
|
|
40986
41067
|
await writeFile9(filePath, body, "utf-8");
|
|
@@ -40988,12 +41069,12 @@ async function ensureTextFileEntries(filePath, entriesToEnsure) {
|
|
|
40988
41069
|
}
|
|
40989
41070
|
async function ensureTempoIgnoreEntries(config) {
|
|
40990
41071
|
const entries = getIgnoreEntries(config);
|
|
40991
|
-
const gitignorePath =
|
|
41072
|
+
const gitignorePath = path27.join(config.projectRoot, ".gitignore");
|
|
40992
41073
|
const updatedGitignore = await ensureTextFileEntries(gitignorePath, entries);
|
|
40993
41074
|
let updatedGitExclude = false;
|
|
40994
41075
|
const gitDir = await resolveGitDir(config.projectRoot);
|
|
40995
41076
|
if (gitDir) {
|
|
40996
|
-
const gitExcludePath =
|
|
41077
|
+
const gitExcludePath = path27.join(gitDir, "info", "exclude");
|
|
40997
41078
|
updatedGitExclude = await ensureTextFileEntries(gitExcludePath, entries);
|
|
40998
41079
|
}
|
|
40999
41080
|
const updatedTempoFolderGitignore = await ensureTextFileEntries(
|
|
@@ -41013,14 +41094,14 @@ import {
|
|
|
41013
41094
|
access as access8,
|
|
41014
41095
|
mkdir as mkdir9,
|
|
41015
41096
|
readdir as readdir7,
|
|
41016
|
-
readFile as
|
|
41097
|
+
readFile as readFile19,
|
|
41017
41098
|
rename as rename4,
|
|
41018
41099
|
stat as stat5,
|
|
41019
41100
|
unlink as unlink2,
|
|
41020
41101
|
writeFile as writeFile10
|
|
41021
41102
|
} from "fs/promises";
|
|
41022
41103
|
import { createRequire as createRequire4 } from "module";
|
|
41023
|
-
import
|
|
41104
|
+
import path28 from "path";
|
|
41024
41105
|
|
|
41025
41106
|
// ../tempo-project/ui-framework.ts
|
|
41026
41107
|
function resolveAppUiFramework(configured) {
|
|
@@ -41089,7 +41170,7 @@ var REQUIRED_SCRIPTS = {
|
|
|
41089
41170
|
build: "vite build",
|
|
41090
41171
|
preview: "vite preview --host 127.0.0.1"
|
|
41091
41172
|
};
|
|
41092
|
-
var TEMPO_WORKSPACE_NONCE_RELATIVE_PATH =
|
|
41173
|
+
var TEMPO_WORKSPACE_NONCE_RELATIVE_PATH = path28.join(
|
|
41093
41174
|
".tempo",
|
|
41094
41175
|
"workspace-nonce"
|
|
41095
41176
|
);
|
|
@@ -41317,8 +41398,8 @@ function buildExpoAppJson(config) {
|
|
|
41317
41398
|
return `${JSON.stringify(
|
|
41318
41399
|
{
|
|
41319
41400
|
expo: {
|
|
41320
|
-
name: `${
|
|
41321
|
-
slug: sanitizePackageName(`${
|
|
41401
|
+
name: `${path28.basename(config.projectRoot)} Tempo`,
|
|
41402
|
+
slug: sanitizePackageName(`${path28.basename(config.projectRoot)}-tempo`),
|
|
41322
41403
|
platforms: ["web"],
|
|
41323
41404
|
web: {
|
|
41324
41405
|
bundler: "metro"
|
|
@@ -41681,7 +41762,7 @@ async function shouldImportExpoMetroRuntime(config) {
|
|
|
41681
41762
|
}
|
|
41682
41763
|
for (const fromDir of [config.tempoRoot, config.projectRoot]) {
|
|
41683
41764
|
const requireFromProject = createRequire4(
|
|
41684
|
-
|
|
41765
|
+
path28.join(fromDir, "__tempo_expo_runtime_resolve__.cjs")
|
|
41685
41766
|
);
|
|
41686
41767
|
try {
|
|
41687
41768
|
requireFromProject.resolve("@expo/metro-runtime");
|
|
@@ -41692,7 +41773,7 @@ async function shouldImportExpoMetroRuntime(config) {
|
|
|
41692
41773
|
return false;
|
|
41693
41774
|
}
|
|
41694
41775
|
async function collectExpoWebShims(config) {
|
|
41695
|
-
const shimDir =
|
|
41776
|
+
const shimDir = path28.join(config.projectRoot, "web-shims");
|
|
41696
41777
|
let entries;
|
|
41697
41778
|
try {
|
|
41698
41779
|
entries = await readdir7(shimDir, { withFileTypes: true });
|
|
@@ -41709,7 +41790,7 @@ async function collectExpoWebShims(config) {
|
|
|
41709
41790
|
module: moduleName,
|
|
41710
41791
|
targetRelToTempo: `${toPosixRelativePath(
|
|
41711
41792
|
config.tempoRoot,
|
|
41712
|
-
|
|
41793
|
+
path28.join(shimDir, entry.name)
|
|
41713
41794
|
)}`
|
|
41714
41795
|
});
|
|
41715
41796
|
}
|
|
@@ -41820,7 +41901,7 @@ var NEXT_TAILWIND_V3_POSTCSS_CONFIG_MJS = `export default {
|
|
|
41820
41901
|
`;
|
|
41821
41902
|
async function readTextFileOptional2(filePath) {
|
|
41822
41903
|
try {
|
|
41823
|
-
return await
|
|
41904
|
+
return await readFile19(filePath, "utf-8");
|
|
41824
41905
|
} catch (error) {
|
|
41825
41906
|
if (error.code === "ENOENT") {
|
|
41826
41907
|
return null;
|
|
@@ -41829,8 +41910,8 @@ async function readTextFileOptional2(filePath) {
|
|
|
41829
41910
|
}
|
|
41830
41911
|
}
|
|
41831
41912
|
async function ensureTempoWorkspaceNonce(tempoRoot) {
|
|
41832
|
-
const noncePath =
|
|
41833
|
-
await mkdir9(
|
|
41913
|
+
const noncePath = path28.join(tempoRoot, TEMPO_WORKSPACE_NONCE_RELATIVE_PATH);
|
|
41914
|
+
await mkdir9(path28.dirname(noncePath), { recursive: true });
|
|
41834
41915
|
const existing = (await readTextFileOptional2(noncePath))?.trim();
|
|
41835
41916
|
if (existing) return existing;
|
|
41836
41917
|
const nonce = randomUUID4();
|
|
@@ -41908,8 +41989,8 @@ async function pathIsDirectory(targetPath) {
|
|
|
41908
41989
|
}
|
|
41909
41990
|
}
|
|
41910
41991
|
function isInsidePath(parentPath, childPath) {
|
|
41911
|
-
const relativePath =
|
|
41912
|
-
return relativePath === "" || !relativePath.startsWith("..") && !
|
|
41992
|
+
const relativePath = path28.relative(parentPath, childPath);
|
|
41993
|
+
return relativePath === "" || !relativePath.startsWith("..") && !path28.isAbsolute(relativePath);
|
|
41913
41994
|
}
|
|
41914
41995
|
function cleanLocalSpecifier(specifier) {
|
|
41915
41996
|
const trimmed2 = specifier.trim();
|
|
@@ -41922,19 +42003,19 @@ function resolveDeclaredProjectPath(projectRoot, specifier) {
|
|
|
41922
42003
|
const clean = cleanLocalSpecifier(specifier);
|
|
41923
42004
|
if (!clean) return null;
|
|
41924
42005
|
if (clean.startsWith("/")) {
|
|
41925
|
-
return
|
|
42006
|
+
return path28.resolve(projectRoot, clean.slice(1));
|
|
41926
42007
|
}
|
|
41927
42008
|
if (clean.startsWith("./") || clean.startsWith("../")) {
|
|
41928
|
-
return
|
|
42009
|
+
return path28.resolve(projectRoot, clean);
|
|
41929
42010
|
}
|
|
41930
42011
|
if (clean.startsWith("@/")) {
|
|
41931
|
-
return
|
|
42012
|
+
return path28.resolve(projectRoot, "src", clean.slice(2));
|
|
41932
42013
|
}
|
|
41933
42014
|
if (clean.startsWith("~/")) {
|
|
41934
|
-
return
|
|
42015
|
+
return path28.resolve(projectRoot, clean.slice(2));
|
|
41935
42016
|
}
|
|
41936
42017
|
if (/^(?:src|app|styles|components|packages|lib|pages)\//.test(clean)) {
|
|
41937
|
-
return
|
|
42018
|
+
return path28.resolve(projectRoot, clean);
|
|
41938
42019
|
}
|
|
41939
42020
|
return null;
|
|
41940
42021
|
}
|
|
@@ -41942,18 +42023,18 @@ function resolveImportCandidates(projectRoot, importerPath, specifier) {
|
|
|
41942
42023
|
const clean = cleanLocalSpecifier(specifier);
|
|
41943
42024
|
if (!clean) return [];
|
|
41944
42025
|
if (clean.startsWith("./") || clean.startsWith("../")) {
|
|
41945
|
-
return [
|
|
42026
|
+
return [path28.resolve(path28.dirname(importerPath), clean)];
|
|
41946
42027
|
}
|
|
41947
42028
|
if (clean.startsWith("/")) {
|
|
41948
|
-
return [
|
|
42029
|
+
return [path28.resolve(projectRoot, clean.slice(1))];
|
|
41949
42030
|
}
|
|
41950
42031
|
if (clean.startsWith("@/")) {
|
|
41951
|
-
const rootRelative =
|
|
41952
|
-
const srcRelative =
|
|
42032
|
+
const rootRelative = path28.resolve(projectRoot, clean.slice(2));
|
|
42033
|
+
const srcRelative = path28.resolve(projectRoot, "src", clean.slice(2));
|
|
41953
42034
|
return [srcRelative, rootRelative];
|
|
41954
42035
|
}
|
|
41955
42036
|
if (clean.startsWith("~/")) {
|
|
41956
|
-
return [
|
|
42037
|
+
return [path28.resolve(projectRoot, clean.slice(2))];
|
|
41957
42038
|
}
|
|
41958
42039
|
return [];
|
|
41959
42040
|
}
|
|
@@ -42105,14 +42186,14 @@ function inferTailwindMajorVersion(options) {
|
|
|
42105
42186
|
}
|
|
42106
42187
|
async function addExistingUserFile(set, config, filePath) {
|
|
42107
42188
|
if (!filePath) return;
|
|
42108
|
-
const normalized =
|
|
42189
|
+
const normalized = path28.resolve(filePath);
|
|
42109
42190
|
if (!isInsidePath(config.projectRoot, normalized)) return;
|
|
42110
42191
|
if (isInsidePath(config.tempoRoot, normalized)) return;
|
|
42111
42192
|
if (!await pathIsFile(normalized)) return;
|
|
42112
42193
|
set.add(normalized);
|
|
42113
42194
|
}
|
|
42114
42195
|
async function addExistingUserDirectory(set, config, dirPath) {
|
|
42115
|
-
const normalized =
|
|
42196
|
+
const normalized = path28.resolve(dirPath);
|
|
42116
42197
|
if (!isInsidePath(config.projectRoot, normalized)) return;
|
|
42117
42198
|
if (isInsidePath(config.tempoRoot, normalized)) return;
|
|
42118
42199
|
if (!await pathIsDirectory(normalized)) return;
|
|
@@ -42153,7 +42234,7 @@ async function collectNextLayoutFiles(projectRoot) {
|
|
|
42153
42234
|
"src/app/layout.jsx",
|
|
42154
42235
|
"src/app/layout.ts",
|
|
42155
42236
|
"src/app/layout.js"
|
|
42156
|
-
].map((relativePath) =>
|
|
42237
|
+
].map((relativePath) => path28.join(projectRoot, relativePath));
|
|
42157
42238
|
const result = /* @__PURE__ */ new Set();
|
|
42158
42239
|
for (const candidate of exactCandidates) {
|
|
42159
42240
|
if (await pathIsFile(candidate)) {
|
|
@@ -42161,8 +42242,8 @@ async function collectNextLayoutFiles(projectRoot) {
|
|
|
42161
42242
|
}
|
|
42162
42243
|
}
|
|
42163
42244
|
for (const root of [
|
|
42164
|
-
|
|
42165
|
-
|
|
42245
|
+
path28.join(projectRoot, "app"),
|
|
42246
|
+
path28.join(projectRoot, "src", "app")
|
|
42166
42247
|
]) {
|
|
42167
42248
|
await collectNamedFiles(root, /^layout\.(?:tsx|jsx|ts|js)$/, 3, result);
|
|
42168
42249
|
}
|
|
@@ -42177,7 +42258,7 @@ async function collectNamedFiles(dirPath, fileNamePattern, maxDepth, result) {
|
|
|
42177
42258
|
return;
|
|
42178
42259
|
}
|
|
42179
42260
|
for (const entry of entries) {
|
|
42180
|
-
const entryPath =
|
|
42261
|
+
const entryPath = path28.join(dirPath, entry.name);
|
|
42181
42262
|
if (entry.isFile() && fileNamePattern.test(entry.name)) {
|
|
42182
42263
|
result.add(entryPath);
|
|
42183
42264
|
} else if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules" && entry.name !== ".next") {
|
|
@@ -42189,13 +42270,13 @@ async function discoverProjectStyleContext(config, framework) {
|
|
|
42189
42270
|
const cssFiles = /* @__PURE__ */ new Set();
|
|
42190
42271
|
const tailwindConfigCandidates = /* @__PURE__ */ new Set();
|
|
42191
42272
|
const projectPackageVersions = readPackageDependencyVersions(
|
|
42192
|
-
await readJsonObjectOptional(
|
|
42273
|
+
await readJsonObjectOptional(path28.join(config.projectRoot, "package.json"))
|
|
42193
42274
|
);
|
|
42194
42275
|
const tempoPackageVersions = readPackageDependencyVersions(
|
|
42195
42276
|
await readJsonObjectOptional(config.packageJsonPath)
|
|
42196
42277
|
);
|
|
42197
42278
|
const componentsJson = await readJsonObjectOptional(
|
|
42198
|
-
|
|
42279
|
+
path28.join(config.projectRoot, "components.json")
|
|
42199
42280
|
);
|
|
42200
42281
|
const declaredCssPath = getNestedString(componentsJson, ["tailwind", "css"]);
|
|
42201
42282
|
const declaredConfigPath = getNestedString(componentsJson, [
|
|
@@ -42231,7 +42312,7 @@ async function discoverProjectStyleContext(config, framework) {
|
|
|
42231
42312
|
await addCssImportsFromSourceFile(
|
|
42232
42313
|
cssFiles,
|
|
42233
42314
|
config,
|
|
42234
|
-
|
|
42315
|
+
path28.join(config.projectRoot, appPath)
|
|
42235
42316
|
);
|
|
42236
42317
|
}
|
|
42237
42318
|
} else {
|
|
@@ -42256,36 +42337,36 @@ async function discoverProjectStyleContext(config, framework) {
|
|
|
42256
42337
|
await addCssImportsFromSourceFile(
|
|
42257
42338
|
cssFiles,
|
|
42258
42339
|
config,
|
|
42259
|
-
|
|
42340
|
+
path28.join(config.projectRoot, entryPath)
|
|
42260
42341
|
);
|
|
42261
42342
|
}
|
|
42262
42343
|
await addCssLinksFromHtmlFile(
|
|
42263
42344
|
cssFiles,
|
|
42264
42345
|
config,
|
|
42265
|
-
|
|
42346
|
+
path28.join(config.projectRoot, "index.html")
|
|
42266
42347
|
);
|
|
42267
42348
|
await addCssLinksFromHtmlFile(
|
|
42268
42349
|
cssFiles,
|
|
42269
42350
|
config,
|
|
42270
|
-
|
|
42351
|
+
path28.join(config.projectRoot, "client", "index.html")
|
|
42271
42352
|
);
|
|
42272
42353
|
}
|
|
42273
42354
|
for (const candidate of COMMON_CSS_CANDIDATES) {
|
|
42274
42355
|
await addExistingUserFile(
|
|
42275
42356
|
cssFiles,
|
|
42276
42357
|
config,
|
|
42277
|
-
|
|
42358
|
+
path28.join(config.projectRoot, candidate)
|
|
42278
42359
|
);
|
|
42279
42360
|
}
|
|
42280
42361
|
for (const candidate of TAILWIND_CONFIG_CANDIDATES) {
|
|
42281
|
-
tailwindConfigCandidates.add(
|
|
42362
|
+
tailwindConfigCandidates.add(path28.join(config.projectRoot, candidate));
|
|
42282
42363
|
}
|
|
42283
42364
|
const sourceDirs = /* @__PURE__ */ new Set();
|
|
42284
42365
|
for (const candidate of COMMON_SOURCE_DIR_CANDIDATES) {
|
|
42285
42366
|
await addExistingUserDirectory(
|
|
42286
42367
|
sourceDirs,
|
|
42287
42368
|
config,
|
|
42288
|
-
|
|
42369
|
+
path28.join(config.projectRoot, candidate)
|
|
42289
42370
|
);
|
|
42290
42371
|
}
|
|
42291
42372
|
sourceDirs.add(config.pagesDir);
|
|
@@ -42332,7 +42413,7 @@ async function discoverNextFontSetup(config, layoutFiles) {
|
|
|
42332
42413
|
const setup = extractNextFontSetup(
|
|
42333
42414
|
source,
|
|
42334
42415
|
layoutPath,
|
|
42335
|
-
|
|
42416
|
+
path28.join(config.tempoRoot, "app", "layout.tsx")
|
|
42336
42417
|
);
|
|
42337
42418
|
if (setup) return setup;
|
|
42338
42419
|
}
|
|
@@ -42373,8 +42454,8 @@ function extractNextFontSetup(source, sourceLayoutPath, targetLayoutPath) {
|
|
|
42373
42454
|
declarations.push(
|
|
42374
42455
|
rewriteLocalFontPaths(
|
|
42375
42456
|
declaration,
|
|
42376
|
-
|
|
42377
|
-
|
|
42457
|
+
path28.dirname(sourceLayoutPath),
|
|
42458
|
+
path28.dirname(targetLayoutPath)
|
|
42378
42459
|
)
|
|
42379
42460
|
);
|
|
42380
42461
|
}
|
|
@@ -42445,7 +42526,7 @@ function rewriteLocalFontPaths(declaration, sourceDir, targetDir) {
|
|
|
42445
42526
|
return declaration.replace(
|
|
42446
42527
|
/(\b(?:src|path)\s*:\s*)(["'])(\.{1,2}\/[^"']+)\2/g,
|
|
42447
42528
|
(_match, prefix, quote, relativeFontPath) => {
|
|
42448
|
-
const absoluteFontPath =
|
|
42529
|
+
const absoluteFontPath = path28.resolve(sourceDir, relativeFontPath);
|
|
42449
42530
|
return `${prefix}${quote}${toCssRelativePath(
|
|
42450
42531
|
targetDir,
|
|
42451
42532
|
absoluteFontPath
|
|
@@ -42589,7 +42670,7 @@ ${userCss}
|
|
|
42589
42670
|
}
|
|
42590
42671
|
}
|
|
42591
42672
|
async function reconcileLegacyTempoIndexCss(tempoRoot) {
|
|
42592
|
-
const indexCssPath =
|
|
42673
|
+
const indexCssPath = path28.join(tempoRoot, "index.css");
|
|
42593
42674
|
const current = await readTextFileOptional2(indexCssPath);
|
|
42594
42675
|
if (current === null) return;
|
|
42595
42676
|
const userCss = extractUserCssOutsideTempoBlock(current, "");
|
|
@@ -42600,7 +42681,7 @@ async function reconcileLegacyTempoIndexCss(tempoRoot) {
|
|
|
42600
42681
|
}
|
|
42601
42682
|
}
|
|
42602
42683
|
async function ensureNextLayoutFile(config, styleContext) {
|
|
42603
|
-
const layoutPath =
|
|
42684
|
+
const layoutPath = path28.join(config.tempoRoot, "app", "layout.tsx");
|
|
42604
42685
|
const desired = buildNextLayoutTsx(styleContext.nextFontSetup);
|
|
42605
42686
|
const current = await readTextFileOptional2(layoutPath);
|
|
42606
42687
|
if (current === null || isTempoGeneratedNextLayout(current)) {
|
|
@@ -42699,7 +42780,7 @@ function buildTailwindV3HostConfig(config, styleContext) {
|
|
|
42699
42780
|
);
|
|
42700
42781
|
const userConfigDirFromTempo = toPosixRelativePath(
|
|
42701
42782
|
config.tempoRoot,
|
|
42702
|
-
|
|
42783
|
+
path28.dirname(styleContext.tailwindConfigPath)
|
|
42703
42784
|
);
|
|
42704
42785
|
return `${TAILWIND_V3_HOST_CONFIG_MARKER}
|
|
42705
42786
|
import type { Config } from "tailwindcss";
|
|
@@ -42751,26 +42832,26 @@ export default config;
|
|
|
42751
42832
|
async function seedHomeCanvas(config) {
|
|
42752
42833
|
const freeformDir = await resolveFreeformCanvasesDir(config.pagesDir);
|
|
42753
42834
|
await writeFileIfMissing(
|
|
42754
|
-
|
|
42835
|
+
path28.join(freeformDir, "home", "index.canvas.tsx"),
|
|
42755
42836
|
TEMPLATE_HOME_CANVAS_INDEX_TSX
|
|
42756
42837
|
);
|
|
42757
42838
|
}
|
|
42758
42839
|
async function seedZoneDirectories(config) {
|
|
42759
42840
|
const freeformDir = await resolveFreeformCanvasesDir(config.pagesDir);
|
|
42760
|
-
if (
|
|
42841
|
+
if (path28.resolve(freeformDir) === path28.resolve(config.pagesDir)) {
|
|
42761
42842
|
return;
|
|
42762
42843
|
}
|
|
42763
42844
|
await mkdir9(freeformDir, { recursive: true });
|
|
42764
|
-
await mkdir9(
|
|
42845
|
+
await mkdir9(path28.join(config.pagesDir, DESIGN_SYSTEM_ZONE_DIR), {
|
|
42765
42846
|
recursive: true
|
|
42766
42847
|
});
|
|
42767
|
-
await mkdir9(
|
|
42848
|
+
await mkdir9(path28.join(config.pagesDir, LIBRARIES_ZONE_DIR), {
|
|
42768
42849
|
recursive: true
|
|
42769
42850
|
});
|
|
42770
42851
|
}
|
|
42771
42852
|
async function seedSharedControls(config) {
|
|
42772
42853
|
await writeFileIfMissing(
|
|
42773
|
-
|
|
42854
|
+
path28.join(config.tempoRoot, "controls.ts"),
|
|
42774
42855
|
`// Optional controls for existing components whose source should stay untouched.
|
|
42775
42856
|
// New components always keep defineControls in their own file.
|
|
42776
42857
|
// For existing components, honor the user/repo preference; fully integrated apps
|
|
@@ -42795,7 +42876,7 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42795
42876
|
const metroRuntime = await shouldImportExpoMetroRuntime(config);
|
|
42796
42877
|
const webShims = await collectExpoWebShims(config);
|
|
42797
42878
|
await reconcileGeneratedTextFile(
|
|
42798
|
-
|
|
42879
|
+
path28.join(config.tempoRoot, "index.js"),
|
|
42799
42880
|
buildExpoIndexJs({
|
|
42800
42881
|
nativewind: styleTooling.nativewind,
|
|
42801
42882
|
metroRuntime
|
|
@@ -42804,35 +42885,35 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42804
42885
|
);
|
|
42805
42886
|
if (styleTooling.nativewind) {
|
|
42806
42887
|
await reconcileGeneratedTextFile(
|
|
42807
|
-
|
|
42888
|
+
path28.join(config.tempoRoot, "tailwind.config.js"),
|
|
42808
42889
|
buildExpoNativeWindTailwindConfig(config),
|
|
42809
42890
|
isTempoOwnedExpoTailwindConfig
|
|
42810
42891
|
);
|
|
42811
42892
|
await writeFileIfMissing(
|
|
42812
|
-
|
|
42893
|
+
path28.join(config.tempoRoot, "global.css"),
|
|
42813
42894
|
EXPO_NATIVEWIND_GLOBAL_CSS
|
|
42814
42895
|
);
|
|
42815
42896
|
}
|
|
42816
42897
|
await reconcileGeneratedTextFile(
|
|
42817
|
-
|
|
42898
|
+
path28.join(config.tempoRoot, "App.tsx"),
|
|
42818
42899
|
EXPO_APP_TSX,
|
|
42819
42900
|
isOverwriteableExpoAppTsx
|
|
42820
42901
|
);
|
|
42821
42902
|
await writeFileIfMissing(
|
|
42822
|
-
|
|
42903
|
+
path28.join(config.tempoRoot, "public", "index.html"),
|
|
42823
42904
|
buildExpoPublicIndexHtml(config)
|
|
42824
42905
|
);
|
|
42825
42906
|
await writeFileIfMissing(
|
|
42826
|
-
|
|
42907
|
+
path28.join(config.tempoRoot, "app.json"),
|
|
42827
42908
|
buildExpoAppJson(config)
|
|
42828
42909
|
);
|
|
42829
42910
|
await reconcileGeneratedTextFile(
|
|
42830
|
-
|
|
42911
|
+
path28.join(config.tempoRoot, "babel.config.js"),
|
|
42831
42912
|
buildExpoBabelConfig({ nativewind: styleTooling.nativewind }),
|
|
42832
42913
|
isTempoOwnedExpoBabelConfig
|
|
42833
42914
|
);
|
|
42834
42915
|
await reconcileGeneratedTextFile(
|
|
42835
|
-
|
|
42916
|
+
path28.join(config.tempoRoot, "metro.config.js"),
|
|
42836
42917
|
buildExpoMetroConfig(metroAliases, {
|
|
42837
42918
|
nativewind: styleTooling.nativewind,
|
|
42838
42919
|
svgTransformer: styleTooling.svgTransformer,
|
|
@@ -42841,16 +42922,16 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42841
42922
|
isTempoOwnedExpoMetroConfig
|
|
42842
42923
|
);
|
|
42843
42924
|
await reconcileGeneratedTsconfig(
|
|
42844
|
-
|
|
42925
|
+
path28.join(config.tempoRoot, "tsconfig.json"),
|
|
42845
42926
|
buildExpoTsconfigFile(config, aliasPaths),
|
|
42846
42927
|
isTempoOwnedExpoTsconfig
|
|
42847
42928
|
);
|
|
42848
42929
|
await writeFileIfMissing(
|
|
42849
|
-
|
|
42930
|
+
path28.join(config.tempoRoot, "expo-env.d.ts"),
|
|
42850
42931
|
'/// <reference types="expo/types" />\n'
|
|
42851
42932
|
);
|
|
42852
42933
|
await writeFileIfMissing(
|
|
42853
|
-
|
|
42934
|
+
path28.join(config.tempoRoot, ".tempo-storybook-stub.js"),
|
|
42854
42935
|
EXPO_STORYBOOK_STUB
|
|
42855
42936
|
);
|
|
42856
42937
|
return;
|
|
@@ -42859,18 +42940,18 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42859
42940
|
if (framework === "nextjs") {
|
|
42860
42941
|
await ensureNextLayoutFile(config, styleContext);
|
|
42861
42942
|
await writeFileIfMissing(
|
|
42862
|
-
|
|
42943
|
+
path28.join(config.tempoRoot, "app", "page.tsx"),
|
|
42863
42944
|
NEXT_PAGE_TSX
|
|
42864
42945
|
);
|
|
42865
42946
|
await writeFileIfMissing(
|
|
42866
|
-
|
|
42947
|
+
path28.join(config.tempoRoot, "app", "tempo-host", "page.tsx"),
|
|
42867
42948
|
NEXT_TEMPO_HOST_PAGE_TSX
|
|
42868
42949
|
);
|
|
42869
42950
|
await writeFileIfMissing(
|
|
42870
|
-
|
|
42951
|
+
path28.join(config.tempoRoot, "app", "%5F%5Ftempo", "identity", "route.ts"),
|
|
42871
42952
|
NEXT_TEMPO_IDENTITY_ROUTE_TS
|
|
42872
42953
|
);
|
|
42873
|
-
const legacyIdentityRoutePath =
|
|
42954
|
+
const legacyIdentityRoutePath = path28.join(
|
|
42874
42955
|
config.tempoRoot,
|
|
42875
42956
|
"app",
|
|
42876
42957
|
"tempo-host",
|
|
@@ -42881,24 +42962,24 @@ async function ensureProjectScaffold(config, framework = "vite") {
|
|
|
42881
42962
|
await unlink2(legacyIdentityRoutePath);
|
|
42882
42963
|
}
|
|
42883
42964
|
await writeManagedTempoGlobalsCss(
|
|
42884
|
-
|
|
42885
|
-
buildTempoGlobalsCss(
|
|
42965
|
+
path28.join(config.tempoRoot, "app", "globals.css"),
|
|
42966
|
+
buildTempoGlobalsCss(path28.join(config.tempoRoot, "app"), styleContext)
|
|
42886
42967
|
);
|
|
42887
42968
|
return;
|
|
42888
42969
|
}
|
|
42889
42970
|
await writeFileIfMissing(
|
|
42890
|
-
|
|
42971
|
+
path28.join(config.tempoRoot, "index.html"),
|
|
42891
42972
|
TEMPO_INDEX_HTML
|
|
42892
42973
|
);
|
|
42893
42974
|
await writeFileIfMissing(
|
|
42894
|
-
|
|
42975
|
+
path28.join(config.tempoRoot, "main.tsx"),
|
|
42895
42976
|
TEMPO_MAIN_TSX
|
|
42896
42977
|
);
|
|
42897
42978
|
await ensureViteMainImportsGlobalsCss(
|
|
42898
|
-
|
|
42979
|
+
path28.join(config.tempoRoot, "main.tsx")
|
|
42899
42980
|
);
|
|
42900
42981
|
await writeManagedTempoGlobalsCss(
|
|
42901
|
-
|
|
42982
|
+
path28.join(config.tempoRoot, "globals.css"),
|
|
42902
42983
|
buildTempoGlobalsCss(config.tempoRoot, styleContext)
|
|
42903
42984
|
);
|
|
42904
42985
|
await reconcileLegacyTempoIndexCss(config.tempoRoot);
|
|
@@ -42926,7 +43007,7 @@ function collectDependencyNames(pkg) {
|
|
|
42926
43007
|
return names;
|
|
42927
43008
|
}
|
|
42928
43009
|
async function isAppPackageDir(dir) {
|
|
42929
|
-
const pkg = await readJsonObjectOptional(
|
|
43010
|
+
const pkg = await readJsonObjectOptional(path28.join(dir, "package.json"));
|
|
42930
43011
|
if (!pkg) return false;
|
|
42931
43012
|
const deps = collectDependencyNames(pkg);
|
|
42932
43013
|
return APP_FRAMEWORK_DEPS.some((name) => deps.has(name));
|
|
@@ -42938,20 +43019,20 @@ async function findAppPackageSubdirs(config) {
|
|
|
42938
43019
|
} catch {
|
|
42939
43020
|
return [];
|
|
42940
43021
|
}
|
|
42941
|
-
const resolvedTempoRoot =
|
|
43022
|
+
const resolvedTempoRoot = path28.resolve(config.tempoRoot);
|
|
42942
43023
|
const found = [];
|
|
42943
43024
|
for (const entry of entries) {
|
|
42944
43025
|
if (!entry.isDirectory()) continue;
|
|
42945
43026
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) continue;
|
|
42946
|
-
const subdir =
|
|
42947
|
-
if (
|
|
43027
|
+
const subdir = path28.join(config.projectRoot, entry.name);
|
|
43028
|
+
if (path28.resolve(subdir) === resolvedTempoRoot) continue;
|
|
42948
43029
|
if (await isAppPackageDir(subdir)) found.push(subdir);
|
|
42949
43030
|
}
|
|
42950
43031
|
return found;
|
|
42951
43032
|
}
|
|
42952
43033
|
async function resolveAppRoot(config) {
|
|
42953
43034
|
if (config.appDir && config.appDir !== ".") {
|
|
42954
|
-
const explicit =
|
|
43035
|
+
const explicit = path28.resolve(config.projectRoot, config.appDir);
|
|
42955
43036
|
if (await pathIsDirectory(explicit)) {
|
|
42956
43037
|
return { appRoot: explicit, warning: null };
|
|
42957
43038
|
}
|
|
@@ -42970,7 +43051,7 @@ async function resolveAppRoot(config) {
|
|
|
42970
43051
|
if (candidates.length > 1) {
|
|
42971
43052
|
return {
|
|
42972
43053
|
appRoot: config.projectRoot,
|
|
42973
|
-
warning: `Found multiple app directories (${candidates.map((c) =>
|
|
43054
|
+
warning: `Found multiple app directories (${candidates.map((c) => path28.basename(c)).join(
|
|
42974
43055
|
", "
|
|
42975
43056
|
)}); set "appDir" in tempo.config.json to pick one. Using the project root.`
|
|
42976
43057
|
};
|
|
@@ -42992,7 +43073,7 @@ async function ensureProjectSetupFiles(config, framework = "vite", options = {})
|
|
|
42992
43073
|
);
|
|
42993
43074
|
}
|
|
42994
43075
|
for (const rootDir of /* @__PURE__ */ new Set([config.projectRoot, appRoot])) {
|
|
42995
|
-
const rootPackageJsonPath =
|
|
43076
|
+
const rootPackageJsonPath = path28.join(rootDir, "package.json");
|
|
42996
43077
|
const healed = await healUnsatisfiableTempoSdkPins(rootPackageJsonPath);
|
|
42997
43078
|
if (healed.length > 0) {
|
|
42998
43079
|
console.warn(
|
|
@@ -43012,14 +43093,14 @@ async function ensureProjectSetupFiles(config, framework = "vite", options = {})
|
|
|
43012
43093
|
createIfMissing: createPackageJsonIfMissing
|
|
43013
43094
|
});
|
|
43014
43095
|
await ensureNextTsconfigFile(appConfig);
|
|
43015
|
-
const hostNextConfigPath =
|
|
43096
|
+
const hostNextConfigPath = path28.join(config.tempoRoot, "next.config.mjs");
|
|
43016
43097
|
await writeFileIfMissing(
|
|
43017
43098
|
hostNextConfigPath,
|
|
43018
43099
|
buildNextConfigFile(await collectAppTranspilePackages(appConfig))
|
|
43019
43100
|
);
|
|
43020
43101
|
await healNextConfigTracingRoot(hostNextConfigPath);
|
|
43021
43102
|
await ensureNextPostcssConfigFile(
|
|
43022
|
-
|
|
43103
|
+
path28.join(config.tempoRoot, "postcss.config.mjs"),
|
|
43023
43104
|
styleContext
|
|
43024
43105
|
);
|
|
43025
43106
|
if (styleContext.tailwindMajor === 3) {
|
|
@@ -43047,7 +43128,7 @@ var SVELTE_CONFIG_BASENAMES = [
|
|
|
43047
43128
|
];
|
|
43048
43129
|
async function findSvelteConfigFile(appRoot) {
|
|
43049
43130
|
for (const basename3 of SVELTE_CONFIG_BASENAMES) {
|
|
43050
|
-
const candidate =
|
|
43131
|
+
const candidate = path28.join(appRoot, basename3);
|
|
43051
43132
|
if (await pathExists7(candidate)) return candidate;
|
|
43052
43133
|
}
|
|
43053
43134
|
return null;
|
|
@@ -43080,7 +43161,7 @@ export default {
|
|
|
43080
43161
|
};
|
|
43081
43162
|
`;
|
|
43082
43163
|
await atomicWriteText(
|
|
43083
|
-
|
|
43164
|
+
path28.join(config.tempoRoot, "svelte.config.mjs"),
|
|
43084
43165
|
desired
|
|
43085
43166
|
);
|
|
43086
43167
|
}
|
|
@@ -43096,10 +43177,10 @@ function isTempoOwnedTailwindV3HostConfig(source) {
|
|
|
43096
43177
|
return source.includes("Tempo-owned Tailwind v3 config for the canvas host");
|
|
43097
43178
|
}
|
|
43098
43179
|
async function ensureTailwindV3HostConfigFile(config, styleContext) {
|
|
43099
|
-
const targetPath =
|
|
43180
|
+
const targetPath = path28.join(config.tempoRoot, "tailwind.config.ts");
|
|
43100
43181
|
const desired = buildTailwindV3HostConfig(config, styleContext);
|
|
43101
43182
|
for (const basename3 of TAILWIND_V3_HOST_CONFIG_BASENAMES) {
|
|
43102
|
-
const existingPath =
|
|
43183
|
+
const existingPath = path28.join(config.tempoRoot, basename3);
|
|
43103
43184
|
const source = await readTextFileOptional2(existingPath);
|
|
43104
43185
|
if (source === null) continue;
|
|
43105
43186
|
if (existingPath === targetPath && isTempoOwnedTailwindV3HostConfig(source)) {
|
|
@@ -43371,7 +43452,7 @@ async function detectProjectFramework(config) {
|
|
|
43371
43452
|
return "vite";
|
|
43372
43453
|
}
|
|
43373
43454
|
async function readRootPackageDeps(dir) {
|
|
43374
|
-
const filePath =
|
|
43455
|
+
const filePath = path28.join(dir, "package.json");
|
|
43375
43456
|
const contents = await readTextFileOptional2(filePath);
|
|
43376
43457
|
if (!contents) return {};
|
|
43377
43458
|
let parsed;
|
|
@@ -43387,7 +43468,7 @@ async function readRootPackageDeps(dir) {
|
|
|
43387
43468
|
}
|
|
43388
43469
|
async function anyFileExists(dir, names) {
|
|
43389
43470
|
for (const name of names) {
|
|
43390
|
-
if (await pathExists7(
|
|
43471
|
+
if (await pathExists7(path28.join(dir, name))) return true;
|
|
43391
43472
|
}
|
|
43392
43473
|
return false;
|
|
43393
43474
|
}
|
|
@@ -43453,19 +43534,19 @@ async function healFrameworkMismatch(config, detectedFramework, options = {}) {
|
|
|
43453
43534
|
}
|
|
43454
43535
|
const ts7 = options.now ?? Date.now();
|
|
43455
43536
|
const backupDirName = `.tempo-backup-${previousFramework}-${ts7}`;
|
|
43456
|
-
const backupPath =
|
|
43537
|
+
const backupPath = path28.join(config.tempoRoot, backupDirName);
|
|
43457
43538
|
const filesToMove = [
|
|
43458
43539
|
...FRAMEWORK_DISTINCTIVE_FILES[previousFramework],
|
|
43459
43540
|
...HEAL_PACKAGE_FILES
|
|
43460
43541
|
];
|
|
43461
43542
|
let movedAny = false;
|
|
43462
43543
|
for (const name of filesToMove) {
|
|
43463
|
-
const from =
|
|
43544
|
+
const from = path28.join(config.tempoRoot, name);
|
|
43464
43545
|
if (!await pathExists7(from)) continue;
|
|
43465
43546
|
if (!movedAny) {
|
|
43466
43547
|
await mkdir9(backupPath, { recursive: true });
|
|
43467
43548
|
}
|
|
43468
|
-
await rename4(from,
|
|
43549
|
+
await rename4(from, path28.join(backupPath, name));
|
|
43469
43550
|
movedAny = true;
|
|
43470
43551
|
}
|
|
43471
43552
|
if (!movedAny) {
|
|
@@ -43502,7 +43583,7 @@ async function rescueWronglyBackedUpFiles(config) {
|
|
|
43502
43583
|
"tsconfig.json",
|
|
43503
43584
|
"globals.css"
|
|
43504
43585
|
]);
|
|
43505
|
-
const backupDir =
|
|
43586
|
+
const backupDir = path28.join(config.tempoRoot, topEntry.name);
|
|
43506
43587
|
let backupEntries;
|
|
43507
43588
|
try {
|
|
43508
43589
|
backupEntries = await readdir7(backupDir, { withFileTypes: true });
|
|
@@ -43511,10 +43592,10 @@ async function rescueWronglyBackedUpFiles(config) {
|
|
|
43511
43592
|
}
|
|
43512
43593
|
for (const fileEntry of backupEntries) {
|
|
43513
43594
|
if (expectedMoves.has(fileEntry.name)) continue;
|
|
43514
|
-
const restoreTarget =
|
|
43595
|
+
const restoreTarget = path28.join(config.tempoRoot, fileEntry.name);
|
|
43515
43596
|
if (await pathExists7(restoreTarget)) continue;
|
|
43516
43597
|
try {
|
|
43517
|
-
await rename4(
|
|
43598
|
+
await rename4(path28.join(backupDir, fileEntry.name), restoreTarget);
|
|
43518
43599
|
restored.push(fileEntry.name);
|
|
43519
43600
|
} catch {
|
|
43520
43601
|
}
|
|
@@ -43678,7 +43759,7 @@ function withUserReactMajorAdopted(managed, userReactVersions) {
|
|
|
43678
43759
|
function buildTempoOwnedPackage(currentContent, config, styleContext, userReactVersions = {}, userSvelteVersions = {}, uiFramework = "react") {
|
|
43679
43760
|
const parsedCurrent = currentContent ? parsePackageJson(config.packageJsonPath, currentContent) : {};
|
|
43680
43761
|
const projectName = sanitizePackageName(
|
|
43681
|
-
`${
|
|
43762
|
+
`${path28.basename(config.projectRoot)}-tempo`
|
|
43682
43763
|
);
|
|
43683
43764
|
const currentDevDependencies = toStringRecord(parsedCurrent.devDependencies);
|
|
43684
43765
|
const currentDependencies = toStringRecord(parsedCurrent.dependencies);
|
|
@@ -43756,7 +43837,7 @@ function withCompatibleVersionsPreserved(managed, current) {
|
|
|
43756
43837
|
function buildNextTempoOwnedPackage(currentContent, config, styleContext) {
|
|
43757
43838
|
const parsedCurrent = currentContent ? parsePackageJson(config.packageJsonPath, currentContent) : {};
|
|
43758
43839
|
const projectName = sanitizePackageName(
|
|
43759
|
-
`${
|
|
43840
|
+
`${path28.basename(config.projectRoot)}-tempo`
|
|
43760
43841
|
);
|
|
43761
43842
|
const currentScripts = toStringRecord(parsedCurrent.scripts);
|
|
43762
43843
|
const dependencies = toStringRecord(parsedCurrent.dependencies);
|
|
@@ -43800,7 +43881,7 @@ function buildNextTempoOwnedPackage(currentContent, config, styleContext) {
|
|
|
43800
43881
|
`;
|
|
43801
43882
|
}
|
|
43802
43883
|
async function readUserExpoVersions(projectRoot) {
|
|
43803
|
-
const rootPath =
|
|
43884
|
+
const rootPath = path28.join(projectRoot, "package.json");
|
|
43804
43885
|
const contents = await readTextFileOptional2(rootPath);
|
|
43805
43886
|
if (!contents) return {};
|
|
43806
43887
|
let parsed;
|
|
@@ -43820,7 +43901,7 @@ async function readUserExpoVersions(projectRoot) {
|
|
|
43820
43901
|
return out;
|
|
43821
43902
|
}
|
|
43822
43903
|
async function readUserReactVersions(projectRoot) {
|
|
43823
|
-
const rootPath =
|
|
43904
|
+
const rootPath = path28.join(projectRoot, "package.json");
|
|
43824
43905
|
const contents = await readTextFileOptional2(rootPath);
|
|
43825
43906
|
if (!contents) return {};
|
|
43826
43907
|
let parsed;
|
|
@@ -43840,7 +43921,7 @@ async function readUserReactVersions(projectRoot) {
|
|
|
43840
43921
|
return out;
|
|
43841
43922
|
}
|
|
43842
43923
|
async function readUserSvelteVersions(projectRoot) {
|
|
43843
|
-
const rootPath =
|
|
43924
|
+
const rootPath = path28.join(projectRoot, "package.json");
|
|
43844
43925
|
const contents = await readTextFileOptional2(rootPath);
|
|
43845
43926
|
if (!contents) return {};
|
|
43846
43927
|
let parsed;
|
|
@@ -43863,7 +43944,7 @@ async function readUserSvelteVersions(projectRoot) {
|
|
|
43863
43944
|
function buildExpoTempoOwnedPackage(currentContent, config, userExpoVersions = {}) {
|
|
43864
43945
|
const parsedCurrent = currentContent ? parsePackageJson(config.packageJsonPath, currentContent) : {};
|
|
43865
43946
|
const projectName = sanitizePackageName(
|
|
43866
|
-
`${
|
|
43947
|
+
`${path28.basename(config.projectRoot)}-tempo`
|
|
43867
43948
|
);
|
|
43868
43949
|
const currentScripts = toStringRecord(parsedCurrent.scripts);
|
|
43869
43950
|
const dependencies = toStringRecord(parsedCurrent.dependencies);
|
|
@@ -44005,12 +44086,12 @@ function normalizePathsRecord(raw) {
|
|
|
44005
44086
|
return out;
|
|
44006
44087
|
}
|
|
44007
44088
|
function resolveReferencePath(baseDir, refPath) {
|
|
44008
|
-
const resolved =
|
|
44009
|
-
return refPath.endsWith(".json") ? resolved :
|
|
44089
|
+
const resolved = path28.resolve(baseDir, refPath);
|
|
44090
|
+
return refPath.endsWith(".json") ? resolved : path28.join(resolved, "tsconfig.json");
|
|
44010
44091
|
}
|
|
44011
44092
|
async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
44012
44093
|
if (depth > 8) return null;
|
|
44013
|
-
const normalized =
|
|
44094
|
+
const normalized = path28.resolve(tsconfigPath);
|
|
44014
44095
|
if (seen.has(normalized)) return null;
|
|
44015
44096
|
seen.add(normalized);
|
|
44016
44097
|
const raw = await readTextFileOptional2(normalized);
|
|
@@ -44026,7 +44107,7 @@ async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
|
44026
44107
|
const paths = normalizePathsRecord(rawPaths);
|
|
44027
44108
|
if (Object.keys(paths).length > 0) {
|
|
44028
44109
|
const baseUrl = typeof compilerOptions?.baseUrl === "string" ? compilerOptions.baseUrl : ".";
|
|
44029
|
-
return { configDir:
|
|
44110
|
+
return { configDir: path28.dirname(normalized), baseUrl, paths };
|
|
44030
44111
|
}
|
|
44031
44112
|
}
|
|
44032
44113
|
const references = Array.isArray(obj.references) ? obj.references : [];
|
|
@@ -44035,7 +44116,7 @@ async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
|
44035
44116
|
const refPath = ref.path;
|
|
44036
44117
|
if (typeof refPath !== "string") continue;
|
|
44037
44118
|
const found = await readTsconfigPathsFrom(
|
|
44038
|
-
resolveReferencePath(
|
|
44119
|
+
resolveReferencePath(path28.dirname(normalized), refPath),
|
|
44039
44120
|
depth + 1,
|
|
44040
44121
|
seen
|
|
44041
44122
|
);
|
|
@@ -44044,7 +44125,7 @@ async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
|
44044
44125
|
const extendsEntries = Array.isArray(obj.extends) ? obj.extends : typeof obj.extends === "string" ? [obj.extends] : [];
|
|
44045
44126
|
for (const entry of [...extendsEntries].reverse()) {
|
|
44046
44127
|
if (typeof entry !== "string") continue;
|
|
44047
|
-
const extPath = resolveExtendsConfigPath(
|
|
44128
|
+
const extPath = resolveExtendsConfigPath(path28.dirname(normalized), entry);
|
|
44048
44129
|
if (extPath === null) continue;
|
|
44049
44130
|
const found = await readTsconfigPathsFrom(extPath, depth + 1, seen);
|
|
44050
44131
|
if (found) return found;
|
|
@@ -44053,10 +44134,10 @@ async function readTsconfigPathsFrom(tsconfigPath, depth, seen) {
|
|
|
44053
44134
|
}
|
|
44054
44135
|
function resolveExtendsConfigPath(fromDir, ext) {
|
|
44055
44136
|
if (ext.startsWith("./") || ext.startsWith("../")) {
|
|
44056
|
-
return ext.endsWith(".json") ?
|
|
44137
|
+
return ext.endsWith(".json") ? path28.resolve(fromDir, ext) : path28.resolve(fromDir, `${ext}.json`);
|
|
44057
44138
|
}
|
|
44058
44139
|
const requireFromConfig = createRequire4(
|
|
44059
|
-
|
|
44140
|
+
path28.join(fromDir, "__tempo_tsconfig_resolve__.cjs")
|
|
44060
44141
|
);
|
|
44061
44142
|
const candidates = ext.endsWith(".json") ? [ext] : [ext, `${ext}/tsconfig.json`];
|
|
44062
44143
|
for (const candidate of candidates) {
|
|
@@ -44069,12 +44150,12 @@ function resolveExtendsConfigPath(fromDir, ext) {
|
|
|
44069
44150
|
return null;
|
|
44070
44151
|
}
|
|
44071
44152
|
function rebaseAliasTarget(configDir, baseUrl, target, tempoRoot) {
|
|
44072
|
-
const absTarget =
|
|
44153
|
+
const absTarget = path28.resolve(configDir, baseUrl, target);
|
|
44073
44154
|
return toPosixRelativePath(tempoRoot, absTarget);
|
|
44074
44155
|
}
|
|
44075
44156
|
async function collectHostAliasPaths(config) {
|
|
44076
44157
|
for (const configName of ["tsconfig.json", "jsconfig.json"]) {
|
|
44077
|
-
const appConfigPath =
|
|
44158
|
+
const appConfigPath = path28.join(config.projectRoot, configName);
|
|
44078
44159
|
const appConfigRaw = await readTextFileOptional2(appConfigPath);
|
|
44079
44160
|
if (appConfigRaw === null) continue;
|
|
44080
44161
|
if (parseJsonc(appConfigRaw) === null) {
|
|
@@ -44190,7 +44271,7 @@ function buildNextTsconfigIncludes(config) {
|
|
|
44190
44271
|
];
|
|
44191
44272
|
const parentSrc = toPosixRelativePath(
|
|
44192
44273
|
config.tempoRoot,
|
|
44193
|
-
|
|
44274
|
+
path28.join(config.projectRoot, "src")
|
|
44194
44275
|
);
|
|
44195
44276
|
const pages = toPosixRelativePath(config.tempoRoot, config.pagesDir);
|
|
44196
44277
|
for (const includePath of [`${parentSrc}/**/*`, `${pages}/**/*`]) {
|
|
@@ -44261,7 +44342,7 @@ function buildExpoTsconfigFile(config, appAliasPaths = {}) {
|
|
|
44261
44342
|
...EXPO_HOST_TSCONFIG_INCLUDE_PREFIX,
|
|
44262
44343
|
toPosixRelativePath(
|
|
44263
44344
|
config.tempoRoot,
|
|
44264
|
-
|
|
44345
|
+
path28.join(config.projectRoot, "src")
|
|
44265
44346
|
) + "/**/*",
|
|
44266
44347
|
toPosixRelativePath(config.tempoRoot, config.pagesDir) + "/**/*"
|
|
44267
44348
|
];
|
|
@@ -44361,7 +44442,7 @@ var NEXT_CONFIG_FILENAMES = [
|
|
|
44361
44442
|
];
|
|
44362
44443
|
async function findNextConfigInDir(dir) {
|
|
44363
44444
|
for (const name of NEXT_CONFIG_FILENAMES) {
|
|
44364
|
-
const candidate =
|
|
44445
|
+
const candidate = path28.join(dir, name);
|
|
44365
44446
|
if (await pathIsFile(candidate)) return candidate;
|
|
44366
44447
|
}
|
|
44367
44448
|
return null;
|
|
@@ -44382,7 +44463,7 @@ async function collectAppTranspilePackages(config) {
|
|
|
44382
44463
|
return extractTranspilePackagesFromSource(source);
|
|
44383
44464
|
}
|
|
44384
44465
|
function toPosixRelativePath(from, to) {
|
|
44385
|
-
const relativePath =
|
|
44466
|
+
const relativePath = path28.relative(from, to);
|
|
44386
44467
|
if (relativePath === "") {
|
|
44387
44468
|
return ".";
|
|
44388
44469
|
}
|
|
@@ -44396,7 +44477,7 @@ function toCssRelativePath(from, to) {
|
|
|
44396
44477
|
return `./${relativePath}`;
|
|
44397
44478
|
}
|
|
44398
44479
|
function toRelativeAllowPath(config) {
|
|
44399
|
-
const relativePath =
|
|
44480
|
+
const relativePath = path28.relative(config.tempoRoot, config.projectRoot);
|
|
44400
44481
|
if (relativePath === "") {
|
|
44401
44482
|
return ".";
|
|
44402
44483
|
}
|
|
@@ -44539,7 +44620,7 @@ function sanitizePackageName(value) {
|
|
|
44539
44620
|
|
|
44540
44621
|
// ../tempo-project/migrate-legacy-layout.ts
|
|
44541
44622
|
import { access as access9, mkdir as mkdir10, rm as rm7 } from "fs/promises";
|
|
44542
|
-
import
|
|
44623
|
+
import path29 from "path";
|
|
44543
44624
|
var TEMPO_DIR_NAME3 = "tempo";
|
|
44544
44625
|
var TEMPO_CONFIG_FILE2 = "tempo.config.json";
|
|
44545
44626
|
var NO_MIGRATION_REPORT = {
|
|
@@ -44562,12 +44643,12 @@ async function writeCanonicalDefaultConfig(options) {
|
|
|
44562
44643
|
options.tempoRoot,
|
|
44563
44644
|
buildDefaultTempoConfig({ installScript })
|
|
44564
44645
|
);
|
|
44565
|
-
return
|
|
44646
|
+
return path29.join(options.tempoRoot, TEMPO_CONFIG_FILE2);
|
|
44566
44647
|
}
|
|
44567
44648
|
async function migrateLegacyRootLayout(projectRoot) {
|
|
44568
|
-
const resolvedRoot =
|
|
44569
|
-
const legacyConfigCandidate =
|
|
44570
|
-
const canonicalConfigCandidate =
|
|
44649
|
+
const resolvedRoot = path29.resolve(projectRoot);
|
|
44650
|
+
const legacyConfigCandidate = path29.join(resolvedRoot, TEMPO_CONFIG_FILE2);
|
|
44651
|
+
const canonicalConfigCandidate = path29.join(
|
|
44571
44652
|
resolvedRoot,
|
|
44572
44653
|
TEMPO_DIR_NAME3,
|
|
44573
44654
|
TEMPO_CONFIG_FILE2
|
|
@@ -44587,7 +44668,7 @@ async function migrateLegacyRootLayout(projectRoot) {
|
|
|
44587
44668
|
autoCleanedLegacyConfigPath: legacyConfigCandidate
|
|
44588
44669
|
};
|
|
44589
44670
|
}
|
|
44590
|
-
const tempoRoot =
|
|
44671
|
+
const tempoRoot = path29.join(resolvedRoot, TEMPO_DIR_NAME3);
|
|
44591
44672
|
await mkdir10(tempoRoot, { recursive: true });
|
|
44592
44673
|
const createdCanonicalConfigPath = await writeCanonicalDefaultConfig({
|
|
44593
44674
|
projectRoot: resolvedRoot,
|
|
@@ -44609,14 +44690,14 @@ async function migrateLegacyRootLayout(projectRoot) {
|
|
|
44609
44690
|
}
|
|
44610
44691
|
|
|
44611
44692
|
// ../tempo-project/mirror-user-canvas-deps.ts
|
|
44612
|
-
import { readFile as
|
|
44693
|
+
import { readFile as readFile20, realpath as realpath3 } from "fs/promises";
|
|
44613
44694
|
import { createRequire as createRequire5 } from "module";
|
|
44614
|
-
import
|
|
44695
|
+
import path30 from "path";
|
|
44615
44696
|
|
|
44616
44697
|
// ../tempo-project/install-app-dep-roots.ts
|
|
44617
44698
|
import { spawn as spawn6 } from "child_process";
|
|
44618
44699
|
import { access as access10 } from "fs/promises";
|
|
44619
|
-
import
|
|
44700
|
+
import path31 from "path";
|
|
44620
44701
|
var {
|
|
44621
44702
|
error: abortError,
|
|
44622
44703
|
throwIfAborted,
|
|
@@ -44624,13 +44705,13 @@ var {
|
|
|
44624
44705
|
} = abortableWait("Dependency installation was cancelled");
|
|
44625
44706
|
|
|
44626
44707
|
// ../tempo-project/tempo-project.ts
|
|
44627
|
-
import
|
|
44708
|
+
import path32 from "path";
|
|
44628
44709
|
|
|
44629
44710
|
// ../../modules/project-config/analyze.ts
|
|
44630
44711
|
import { relative as relative2 } from "path";
|
|
44631
44712
|
|
|
44632
44713
|
// ../../modules/project-config/discover.ts
|
|
44633
|
-
import { access as access12, readdir as readdir8, readFile as
|
|
44714
|
+
import { access as access12, readdir as readdir8, readFile as readFile22 } from "fs/promises";
|
|
44634
44715
|
import { basename as basename2, join as join6 } from "path";
|
|
44635
44716
|
|
|
44636
44717
|
// ../../modules/project-config/nextjs.ts
|
|
@@ -44647,17 +44728,17 @@ var APP_LAYOUT_CANDIDATES = [
|
|
|
44647
44728
|
"src/app/layout.js"
|
|
44648
44729
|
];
|
|
44649
44730
|
var PAGES_DIRECTORY_CANDIDATES = ["pages", "src/pages"];
|
|
44650
|
-
async function fileExists3(
|
|
44731
|
+
async function fileExists3(path64) {
|
|
44651
44732
|
try {
|
|
44652
|
-
await access11(
|
|
44733
|
+
await access11(path64);
|
|
44653
44734
|
return true;
|
|
44654
44735
|
} catch {
|
|
44655
44736
|
return false;
|
|
44656
44737
|
}
|
|
44657
44738
|
}
|
|
44658
|
-
async function directoryExists(
|
|
44739
|
+
async function directoryExists(path64) {
|
|
44659
44740
|
try {
|
|
44660
|
-
const stats = await stat6(
|
|
44741
|
+
const stats = await stat6(path64);
|
|
44661
44742
|
return stats.isDirectory();
|
|
44662
44743
|
} catch {
|
|
44663
44744
|
return false;
|
|
@@ -44734,7 +44815,7 @@ async function detectFramework(projectPath, packageJson) {
|
|
|
44734
44815
|
}
|
|
44735
44816
|
|
|
44736
44817
|
// ../../modules/project-config/package-json.ts
|
|
44737
|
-
import { readFile as
|
|
44818
|
+
import { readFile as readFile21 } from "fs/promises";
|
|
44738
44819
|
import { join as join5 } from "path";
|
|
44739
44820
|
function toStringRecord2(value) {
|
|
44740
44821
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -44750,7 +44831,7 @@ async function readPackageJson(projectPath) {
|
|
|
44750
44831
|
const packageJsonPath = join5(projectPath, "package.json");
|
|
44751
44832
|
let rawContents;
|
|
44752
44833
|
try {
|
|
44753
|
-
rawContents = await
|
|
44834
|
+
rawContents = await readFile21(packageJsonPath, "utf8");
|
|
44754
44835
|
} catch (error) {
|
|
44755
44836
|
const message = error instanceof Error ? error.message : "Unknown read error";
|
|
44756
44837
|
throw new Error(
|
|
@@ -44794,9 +44875,9 @@ var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
|
44794
44875
|
]);
|
|
44795
44876
|
var DEFAULT_SCAN_ROOTS = ["apps", "packages"];
|
|
44796
44877
|
var MAX_SCAN_DEPTH = 8;
|
|
44797
|
-
async function pathExists9(
|
|
44878
|
+
async function pathExists9(path64) {
|
|
44798
44879
|
try {
|
|
44799
|
-
await access12(
|
|
44880
|
+
await access12(path64);
|
|
44800
44881
|
return true;
|
|
44801
44882
|
} catch {
|
|
44802
44883
|
return false;
|
|
@@ -44839,7 +44920,7 @@ async function readWorkspaceBaseDirs(projectPath) {
|
|
|
44839
44920
|
if (!await pathExists9(packageJsonPath)) {
|
|
44840
44921
|
return [];
|
|
44841
44922
|
}
|
|
44842
|
-
const packageJsonContents = await
|
|
44923
|
+
const packageJsonContents = await readFile22(packageJsonPath, "utf8");
|
|
44843
44924
|
const patterns = extractWorkspacePatterns(packageJsonContents);
|
|
44844
44925
|
return patterns.map(normalizeWorkspaceBaseDir);
|
|
44845
44926
|
}
|
|
@@ -44931,9 +45012,9 @@ var LOCK_FILE_PRIORITY = [
|
|
|
44931
45012
|
packageManager: PackageManager.NPM
|
|
44932
45013
|
}
|
|
44933
45014
|
];
|
|
44934
|
-
async function fileExists4(
|
|
45015
|
+
async function fileExists4(path64) {
|
|
44935
45016
|
try {
|
|
44936
|
-
await access13(
|
|
45017
|
+
await access13(path64);
|
|
44937
45018
|
return true;
|
|
44938
45019
|
} catch {
|
|
44939
45020
|
return false;
|
|
@@ -44976,7 +45057,7 @@ async function detectPackageManager(projectPath, packageJson) {
|
|
|
44976
45057
|
}
|
|
44977
45058
|
|
|
44978
45059
|
// ../../modules/project-config/vite.ts
|
|
44979
|
-
import { access as access14, readFile as
|
|
45060
|
+
import { access as access14, readFile as readFile23 } from "fs/promises";
|
|
44980
45061
|
import { join as join8, normalize as normalize2 } from "path";
|
|
44981
45062
|
var VITE_CONFIG_FILES = [
|
|
44982
45063
|
"vite.config.ts",
|
|
@@ -44984,9 +45065,9 @@ var VITE_CONFIG_FILES = [
|
|
|
44984
45065
|
"vite.config.mjs",
|
|
44985
45066
|
"vite.config.mts"
|
|
44986
45067
|
];
|
|
44987
|
-
async function fileExists5(
|
|
45068
|
+
async function fileExists5(path64) {
|
|
44988
45069
|
try {
|
|
44989
|
-
await access14(
|
|
45070
|
+
await access14(path64);
|
|
44990
45071
|
return true;
|
|
44991
45072
|
} catch {
|
|
44992
45073
|
return false;
|
|
@@ -45006,7 +45087,7 @@ async function readViteConfig(projectPath) {
|
|
|
45006
45087
|
for (const configFileName of VITE_CONFIG_FILES) {
|
|
45007
45088
|
const configPath = join8(projectPath, configFileName);
|
|
45008
45089
|
if (await fileExists5(configPath)) {
|
|
45009
|
-
return await
|
|
45090
|
+
return await readFile23(configPath, "utf8");
|
|
45010
45091
|
}
|
|
45011
45092
|
}
|
|
45012
45093
|
return null;
|
|
@@ -45263,7 +45344,7 @@ var TempoProject = class _TempoProject {
|
|
|
45263
45344
|
this.devserver = null;
|
|
45264
45345
|
this.devserverConfig = null;
|
|
45265
45346
|
this.initializePromise = null;
|
|
45266
|
-
this.projectRoot =
|
|
45347
|
+
this.projectRoot = path32.resolve(projectRoot);
|
|
45267
45348
|
}
|
|
45268
45349
|
static async open(projectRoot) {
|
|
45269
45350
|
const normalizedRoot = typeof projectRoot === "string" ? projectRoot : projectRoot.projectRoot;
|
|
@@ -45456,7 +45537,7 @@ var TempoProject = class _TempoProject {
|
|
|
45456
45537
|
const gitResult = await ensureTempoGitRepo(this.projectRoot);
|
|
45457
45538
|
const createdConfig = await ensureTempoConfigFile(
|
|
45458
45539
|
this.projectRoot,
|
|
45459
|
-
|
|
45540
|
+
path32.join(this.projectRoot, TEMPO_DIR_NAME2),
|
|
45460
45541
|
buildDefaultTempoConfig()
|
|
45461
45542
|
);
|
|
45462
45543
|
const config = await this.getResolvedConfig();
|
|
@@ -45489,7 +45570,7 @@ var TempoProject = class _TempoProject {
|
|
|
45489
45570
|
const requestedFramework = options.framework;
|
|
45490
45571
|
const createdConfig = await ensureTempoConfigFile(
|
|
45491
45572
|
this.projectRoot,
|
|
45492
|
-
|
|
45573
|
+
path32.join(this.projectRoot, TEMPO_DIR_NAME2),
|
|
45493
45574
|
requestedFramework === "expo" ? buildExpoTempoConfig({ installScript }) : buildDefaultTempoConfig({ installScript })
|
|
45494
45575
|
);
|
|
45495
45576
|
await ensureValidTempoConfigFile(this.projectRoot);
|
|
@@ -45551,12 +45632,12 @@ async function findPageFilesInPagesRoot(pagesRoot) {
|
|
|
45551
45632
|
return [];
|
|
45552
45633
|
}
|
|
45553
45634
|
const pageFiles2 = [];
|
|
45554
|
-
const pageFilePath =
|
|
45635
|
+
const pageFilePath = path33.join(dirPath, PAGE_FILE_NAME);
|
|
45555
45636
|
if (await pathExists10(pageFilePath)) {
|
|
45556
45637
|
pageFiles2.push(pageFilePath);
|
|
45557
45638
|
}
|
|
45558
45639
|
const nestedPageFiles = await Promise.all(
|
|
45559
|
-
entries.filter((entry) => entry.isDirectory()).map((entry) => walkDirectories(
|
|
45640
|
+
entries.filter((entry) => entry.isDirectory()).map((entry) => walkDirectories(path33.join(dirPath, entry.name)))
|
|
45560
45641
|
);
|
|
45561
45642
|
return [...pageFiles2, ...nestedPageFiles.flat()];
|
|
45562
45643
|
}
|
|
@@ -45567,7 +45648,7 @@ async function resolveCanvasesRoot(repoRoot) {
|
|
|
45567
45648
|
try {
|
|
45568
45649
|
return (await resolveTempoConfig(repoRoot)).pagesDir;
|
|
45569
45650
|
} catch {
|
|
45570
|
-
return
|
|
45651
|
+
return path33.join(repoRoot, "tempo", "designs");
|
|
45571
45652
|
}
|
|
45572
45653
|
}
|
|
45573
45654
|
async function findPageFilesInRepo(repoRoot) {
|
|
@@ -45580,7 +45661,7 @@ async function listPageInfosInRepo(options) {
|
|
|
45580
45661
|
const parsed = await parsePageFile(filePath);
|
|
45581
45662
|
return {
|
|
45582
45663
|
filePath,
|
|
45583
|
-
pageDir:
|
|
45664
|
+
pageDir: path33.dirname(filePath),
|
|
45584
45665
|
repoName: options.repoName,
|
|
45585
45666
|
pageName: parsed.pageName,
|
|
45586
45667
|
storyboardNames: parsed.storyboards.map(
|
|
@@ -45600,7 +45681,7 @@ async function listPageInfosInRepo(options) {
|
|
|
45600
45681
|
|
|
45601
45682
|
// ../canvas-pages/resolve-canvas-path.ts
|
|
45602
45683
|
import { readdir as readdir10, stat as stat8 } from "fs/promises";
|
|
45603
|
-
import
|
|
45684
|
+
import path35 from "path";
|
|
45604
45685
|
var PAGE_FILE_NAME2 = "index.canvas.tsx";
|
|
45605
45686
|
var CANVAS_FILE_SUFFIX = ".canvas.tsx";
|
|
45606
45687
|
async function statSafe(targetPath) {
|
|
@@ -45612,19 +45693,19 @@ async function statSafe(targetPath) {
|
|
|
45612
45693
|
}
|
|
45613
45694
|
}
|
|
45614
45695
|
async function resolveCanvasFilePath(candidate) {
|
|
45615
|
-
const abs =
|
|
45696
|
+
const abs = path35.resolve(candidate);
|
|
45616
45697
|
const info = await statSafe(abs);
|
|
45617
45698
|
if (!info) return null;
|
|
45618
45699
|
let dir;
|
|
45619
45700
|
if (info.isFile) {
|
|
45620
45701
|
if (abs.endsWith(CANVAS_FILE_SUFFIX)) return abs;
|
|
45621
|
-
dir =
|
|
45702
|
+
dir = path35.dirname(abs);
|
|
45622
45703
|
} else if (info.isDirectory) {
|
|
45623
45704
|
dir = abs;
|
|
45624
45705
|
} else {
|
|
45625
45706
|
return null;
|
|
45626
45707
|
}
|
|
45627
|
-
const indexFile =
|
|
45708
|
+
const indexFile = path35.join(dir, PAGE_FILE_NAME2);
|
|
45628
45709
|
if (await statSafe(indexFile)) return indexFile;
|
|
45629
45710
|
let entries;
|
|
45630
45711
|
try {
|
|
@@ -45636,19 +45717,19 @@ async function resolveCanvasFilePath(candidate) {
|
|
|
45636
45717
|
(entry) => entry.isFile() && entry.name.endsWith(CANVAS_FILE_SUFFIX)
|
|
45637
45718
|
);
|
|
45638
45719
|
if (canvasFiles.length === 1) {
|
|
45639
|
-
return
|
|
45720
|
+
return path35.join(dir, canvasFiles[0].name);
|
|
45640
45721
|
}
|
|
45641
45722
|
return null;
|
|
45642
45723
|
}
|
|
45643
45724
|
async function resolveCanvasDirPath(candidate) {
|
|
45644
45725
|
const file = await resolveCanvasFilePath(candidate);
|
|
45645
|
-
return file ?
|
|
45726
|
+
return file ? path35.dirname(file) : null;
|
|
45646
45727
|
}
|
|
45647
45728
|
|
|
45648
45729
|
// ../canvas-pages/page-tools.ts
|
|
45649
45730
|
import { execFile as execFile3 } from "child_process";
|
|
45650
|
-
import { access as access15, mkdir as mkdir11, readFile as
|
|
45651
|
-
import
|
|
45731
|
+
import { access as access15, mkdir as mkdir11, readFile as readFile24, rm as rm8 } from "fs/promises";
|
|
45732
|
+
import path36 from "path";
|
|
45652
45733
|
import { promisify as promisify3 } from "util";
|
|
45653
45734
|
var execFileAsync3 = promisify3(execFile3);
|
|
45654
45735
|
async function pathExists11(targetPath) {
|
|
@@ -45708,7 +45789,7 @@ function buildInitSummary(options) {
|
|
|
45708
45789
|
};
|
|
45709
45790
|
}
|
|
45710
45791
|
function notInitializedMessage(projectRoot) {
|
|
45711
|
-
return `Project is not initialized for Tempo canvases: no tempo.config.json found in ${projectRoot} or ${
|
|
45792
|
+
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
45793
|
}
|
|
45713
45794
|
async function useProject(projectRoot, provided, framework, fn) {
|
|
45714
45795
|
if (provided) {
|
|
@@ -45737,7 +45818,7 @@ async function useExistingProject(projectRoot, provided, fn) {
|
|
|
45737
45818
|
}
|
|
45738
45819
|
}
|
|
45739
45820
|
async function initializePagesSupport(options) {
|
|
45740
|
-
const projectRoot =
|
|
45821
|
+
const projectRoot = path36.resolve(options.projectRoot);
|
|
45741
45822
|
return useProject(
|
|
45742
45823
|
projectRoot,
|
|
45743
45824
|
options.project,
|
|
@@ -45769,12 +45850,12 @@ function resolveCanvasLocalStubPath(importPath, pageDir, uiFramework) {
|
|
|
45769
45850
|
if (!importPath.startsWith("./") && !importPath.startsWith("../")) {
|
|
45770
45851
|
return null;
|
|
45771
45852
|
}
|
|
45772
|
-
const resolved =
|
|
45773
|
-
const relToPageDir =
|
|
45774
|
-
if (relToPageDir.startsWith("..") ||
|
|
45853
|
+
const resolved = path36.resolve(pageDir, importPath);
|
|
45854
|
+
const relToPageDir = path36.relative(pageDir, resolved);
|
|
45855
|
+
if (relToPageDir.startsWith("..") || path36.isAbsolute(relToPageDir)) {
|
|
45775
45856
|
return null;
|
|
45776
45857
|
}
|
|
45777
|
-
const ext =
|
|
45858
|
+
const ext = path36.extname(resolved);
|
|
45778
45859
|
if (ext === ".tsx" || ext === ".ts" || ext === ".jsx" || ext === ".js" || ext === ".svelte") {
|
|
45779
45860
|
return resolved;
|
|
45780
45861
|
}
|
|
@@ -45808,7 +45889,7 @@ async function scaffoldCanvasLocalStubs(storyboards, pageDir, uiFramework) {
|
|
|
45808
45889
|
);
|
|
45809
45890
|
if (!stubPath) continue;
|
|
45810
45891
|
if (await pathExists11(stubPath)) continue;
|
|
45811
|
-
await mkdir11(
|
|
45892
|
+
await mkdir11(path36.dirname(stubPath), { recursive: true });
|
|
45812
45893
|
await queuedFileEditor.writeFile(
|
|
45813
45894
|
stubPath,
|
|
45814
45895
|
canvasLocalStubContent(
|
|
@@ -45822,7 +45903,7 @@ async function scaffoldCanvasLocalStubs(storyboards, pageDir, uiFramework) {
|
|
|
45822
45903
|
return written;
|
|
45823
45904
|
}
|
|
45824
45905
|
async function markCanvasAsHome(filePath) {
|
|
45825
|
-
const source = await
|
|
45906
|
+
const source = await readFile24(filePath, "utf-8");
|
|
45826
45907
|
if (sourceHasHomeMarker(source)) return false;
|
|
45827
45908
|
const updated = `${HOME_CANVAS_MARKER_LINE}
|
|
45828
45909
|
${source}`;
|
|
@@ -45830,14 +45911,14 @@ ${source}`;
|
|
|
45830
45911
|
return true;
|
|
45831
45912
|
}
|
|
45832
45913
|
async function unmarkCanvasAsHome(filePath) {
|
|
45833
|
-
const source = await
|
|
45914
|
+
const source = await readFile24(filePath, "utf-8");
|
|
45834
45915
|
if (!sourceHasHomeMarker(source)) return false;
|
|
45835
45916
|
const updated = source.split("\n").filter((line) => !line.includes(HOME_CANVAS_MARKER)).join("\n");
|
|
45836
45917
|
await queuedFileEditor.writeFile(filePath, updated);
|
|
45837
45918
|
return true;
|
|
45838
45919
|
}
|
|
45839
45920
|
async function createPage(options) {
|
|
45840
|
-
const projectRoot =
|
|
45921
|
+
const projectRoot = path36.resolve(options.projectRoot);
|
|
45841
45922
|
const pageName = options.pageName?.trim();
|
|
45842
45923
|
if (!pageName) {
|
|
45843
45924
|
throw new Error("pageName is required");
|
|
@@ -45861,11 +45942,11 @@ async function createPage(options) {
|
|
|
45861
45942
|
);
|
|
45862
45943
|
}
|
|
45863
45944
|
const slugSegments = pageSlug.split("/");
|
|
45864
|
-
const pageDir = slugSegments.length > 1 ?
|
|
45945
|
+
const pageDir = slugSegments.length > 1 ? path36.join(resolvedConfig.pagesDir, ...slugSegments) : path36.join(
|
|
45865
45946
|
await resolveFreeformCanvasesDir(resolvedConfig.pagesDir),
|
|
45866
45947
|
pageSlug
|
|
45867
45948
|
);
|
|
45868
|
-
const pageFile =
|
|
45949
|
+
const pageFile = path36.join(pageDir, "index.canvas.tsx");
|
|
45869
45950
|
if (await pathExists11(pageFile)) {
|
|
45870
45951
|
throw new Error(`Canvas already exists: ${pageFile}`);
|
|
45871
45952
|
}
|
|
@@ -45917,14 +45998,14 @@ async function createPage(options) {
|
|
|
45917
45998
|
}
|
|
45918
45999
|
|
|
45919
46000
|
// ../canvas-pages/pages/validate-page.ts
|
|
45920
|
-
import
|
|
46001
|
+
import path42 from "path";
|
|
45921
46002
|
|
|
45922
46003
|
// ../../modules/typescript/workspace-service.ts
|
|
45923
46004
|
import { realpathSync as realpathSync2, statSync as statSync3 } from "fs";
|
|
45924
|
-
import
|
|
46005
|
+
import path37 from "path";
|
|
45925
46006
|
import ts3 from "typescript";
|
|
45926
46007
|
function canonicalPath(input) {
|
|
45927
|
-
const resolved =
|
|
46008
|
+
const resolved = path37.resolve(input);
|
|
45928
46009
|
try {
|
|
45929
46010
|
return realpathSync2.native(resolved);
|
|
45930
46011
|
} catch {
|
|
@@ -45943,7 +46024,7 @@ function compareProjectPriority(left, right) {
|
|
|
45943
46024
|
return left.id.localeCompare(right.id);
|
|
45944
46025
|
}
|
|
45945
46026
|
function isWithinRoot(filePath, rootDir) {
|
|
45946
|
-
return filePath === rootDir || filePath.startsWith(`${rootDir}${
|
|
46027
|
+
return filePath === rootDir || filePath.startsWith(`${rootDir}${path37.sep}`);
|
|
45947
46028
|
}
|
|
45948
46029
|
function loadProject(descriptor) {
|
|
45949
46030
|
const id = descriptor.id.trim();
|
|
@@ -45964,7 +46045,7 @@ function loadProject(descriptor) {
|
|
|
45964
46045
|
const parsed = ts3.parseJsonConfigFileContent(
|
|
45965
46046
|
readResult.config,
|
|
45966
46047
|
ts3.sys,
|
|
45967
|
-
|
|
46048
|
+
path37.dirname(tsconfigPath)
|
|
45968
46049
|
);
|
|
45969
46050
|
if (parsed.errors.length > 0) {
|
|
45970
46051
|
const message = parsed.errors.map(
|
|
@@ -46159,7 +46240,7 @@ import ts6 from "typescript";
|
|
|
46159
46240
|
|
|
46160
46241
|
// ../canvas-pages/pages/validate-service-cache.ts
|
|
46161
46242
|
import { statSync as statSync4 } from "fs";
|
|
46162
|
-
import
|
|
46243
|
+
import path38 from "path";
|
|
46163
46244
|
function fingerprintsEqual(a, b2) {
|
|
46164
46245
|
return a.tsconfig === b2.tsconfig && a.packageJson === b2.packageJson && a.tempoPackageJson === b2.tempoPackageJson;
|
|
46165
46246
|
}
|
|
@@ -46168,9 +46249,9 @@ function createValidateServiceCache(deps) {
|
|
|
46168
46249
|
function fingerprint(projectRoot, tsconfigPath) {
|
|
46169
46250
|
return {
|
|
46170
46251
|
tsconfig: deps.statMtimeMs(tsconfigPath),
|
|
46171
|
-
packageJson: deps.statMtimeMs(
|
|
46252
|
+
packageJson: deps.statMtimeMs(path38.join(projectRoot, "package.json")),
|
|
46172
46253
|
tempoPackageJson: deps.statMtimeMs(
|
|
46173
|
-
|
|
46254
|
+
path38.join(projectRoot, "tempo", "package.json")
|
|
46174
46255
|
)
|
|
46175
46256
|
};
|
|
46176
46257
|
}
|
|
@@ -46186,8 +46267,8 @@ function createValidateServiceCache(deps) {
|
|
|
46186
46267
|
}
|
|
46187
46268
|
return {
|
|
46188
46269
|
get(projectRoot, tsconfigPath) {
|
|
46189
|
-
const resolvedProjectRoot =
|
|
46190
|
-
const resolvedTsconfigPath =
|
|
46270
|
+
const resolvedProjectRoot = path38.resolve(projectRoot);
|
|
46271
|
+
const resolvedTsconfigPath = path38.resolve(tsconfigPath);
|
|
46191
46272
|
const key = `${resolvedProjectRoot}::${resolvedTsconfigPath}`;
|
|
46192
46273
|
const existing = entries.get(key);
|
|
46193
46274
|
if (existing) {
|
|
@@ -46205,7 +46286,7 @@ function createValidateServiceCache(deps) {
|
|
|
46205
46286
|
return entry.service;
|
|
46206
46287
|
},
|
|
46207
46288
|
evict(projectRoot, tsconfigPath) {
|
|
46208
|
-
const key = `${
|
|
46289
|
+
const key = `${path38.resolve(projectRoot)}::${path38.resolve(tsconfigPath)}`;
|
|
46209
46290
|
const entry = entries.get(key);
|
|
46210
46291
|
if (!entry) return;
|
|
46211
46292
|
entries.delete(key);
|
|
@@ -46237,11 +46318,11 @@ var defaultValidateServiceCache = createValidateServiceCache({
|
|
|
46237
46318
|
});
|
|
46238
46319
|
|
|
46239
46320
|
// ../canvas-pages/pages/dependency-checker.ts
|
|
46240
|
-
import
|
|
46321
|
+
import path40 from "path";
|
|
46241
46322
|
|
|
46242
46323
|
// ../canvas-pages/pages/package-root.ts
|
|
46243
46324
|
import { access as access16 } from "fs/promises";
|
|
46244
|
-
import
|
|
46325
|
+
import path39 from "path";
|
|
46245
46326
|
async function exists2(filePath) {
|
|
46246
46327
|
try {
|
|
46247
46328
|
await access16(filePath);
|
|
@@ -46251,16 +46332,16 @@ async function exists2(filePath) {
|
|
|
46251
46332
|
}
|
|
46252
46333
|
}
|
|
46253
46334
|
function importerResolutionDirs(importerFile, boundaryRoot) {
|
|
46254
|
-
const stop =
|
|
46335
|
+
const stop = path39.resolve(boundaryRoot);
|
|
46255
46336
|
const dirs = [];
|
|
46256
|
-
let dir =
|
|
46337
|
+
let dir = path39.dirname(path39.resolve(importerFile));
|
|
46257
46338
|
while (true) {
|
|
46258
46339
|
dirs.push(dir);
|
|
46259
46340
|
if (dir === stop) break;
|
|
46260
|
-
const parent =
|
|
46341
|
+
const parent = path39.dirname(dir);
|
|
46261
46342
|
if (parent === dir) break;
|
|
46262
|
-
const rel =
|
|
46263
|
-
if (rel.startsWith("..") ||
|
|
46343
|
+
const rel = path39.relative(stop, parent);
|
|
46344
|
+
if (rel.startsWith("..") || path39.isAbsolute(rel)) break;
|
|
46264
46345
|
dir = parent;
|
|
46265
46346
|
}
|
|
46266
46347
|
return dirs;
|
|
@@ -46268,7 +46349,7 @@ function importerResolutionDirs(importerFile, boundaryRoot) {
|
|
|
46268
46349
|
async function packageResolvesFromImporter(packageName, importerFile, boundaryRoot) {
|
|
46269
46350
|
const segments = packageName.split("/");
|
|
46270
46351
|
for (const dir of importerResolutionDirs(importerFile, boundaryRoot)) {
|
|
46271
|
-
if (await exists2(
|
|
46352
|
+
if (await exists2(path39.join(dir, "node_modules", ...segments, "package.json"))) {
|
|
46272
46353
|
return true;
|
|
46273
46354
|
}
|
|
46274
46355
|
}
|
|
@@ -46276,13 +46357,13 @@ async function packageResolvesFromImporter(packageName, importerFile, boundaryRo
|
|
|
46276
46357
|
}
|
|
46277
46358
|
async function findNearestPackageRoot(importerFile, boundaryRoot) {
|
|
46278
46359
|
for (const dir of importerResolutionDirs(importerFile, boundaryRoot)) {
|
|
46279
|
-
if (await exists2(
|
|
46360
|
+
if (await exists2(path39.join(dir, "package.json"))) return dir;
|
|
46280
46361
|
}
|
|
46281
46362
|
return null;
|
|
46282
46363
|
}
|
|
46283
46364
|
function repoRootForCanvasWalk(projectRoot) {
|
|
46284
|
-
const resolved =
|
|
46285
|
-
return
|
|
46365
|
+
const resolved = path39.resolve(projectRoot);
|
|
46366
|
+
return path39.basename(resolved) === "tempo" ? path39.dirname(resolved) : resolved;
|
|
46286
46367
|
}
|
|
46287
46368
|
|
|
46288
46369
|
// ../canvas-pages/pages/dependency-checker.ts
|
|
@@ -46299,13 +46380,13 @@ async function readDepsSafe(dir) {
|
|
|
46299
46380
|
}
|
|
46300
46381
|
}
|
|
46301
46382
|
async function checkDependencies(npmPackages, projectRoot, _tempoPackageDir) {
|
|
46302
|
-
const resolvedProjectRoot =
|
|
46383
|
+
const resolvedProjectRoot = path40.resolve(projectRoot);
|
|
46303
46384
|
const repoRoot = repoRootForCanvasWalk(resolvedProjectRoot);
|
|
46304
46385
|
const fallbackDeps = await readDepsSafe(resolvedProjectRoot);
|
|
46305
46386
|
const issues = [];
|
|
46306
46387
|
for (const [packageName, requiredByFile] of npmPackages) {
|
|
46307
46388
|
if (EXCLUDED_PACKAGES.has(packageName)) continue;
|
|
46308
|
-
const importerFile =
|
|
46389
|
+
const importerFile = path40.resolve(resolvedProjectRoot, requiredByFile);
|
|
46309
46390
|
if (await packageResolvesFromImporter(packageName, importerFile, repoRoot)) {
|
|
46310
46391
|
continue;
|
|
46311
46392
|
}
|
|
@@ -46314,14 +46395,14 @@ async function checkDependencies(npmPackages, projectRoot, _tempoPackageDir) {
|
|
|
46314
46395
|
const declaredVersion = ownerDeps[packageName] ?? fallbackDeps[packageName];
|
|
46315
46396
|
const declarationRoot = ownerDeps[packageName] ? ownerRoot : fallbackDeps[packageName] ? resolvedProjectRoot : null;
|
|
46316
46397
|
const version = declaredVersion && isInstallableVersion(declaredVersion) ? declaredVersion : "latest";
|
|
46317
|
-
const ownerPackageJsonRel = ownerRoot ?
|
|
46398
|
+
const ownerPackageJsonRel = ownerRoot ? path40.relative(repoRoot, path40.join(ownerRoot, "package.json")) || "package.json" : "package.json";
|
|
46318
46399
|
issues.push({
|
|
46319
46400
|
kind: "missing_package",
|
|
46320
46401
|
package_name: packageName,
|
|
46321
46402
|
version,
|
|
46322
46403
|
required_by: requiredByFile,
|
|
46323
|
-
package_root: ownerRoot ?
|
|
46324
|
-
declared_in: declarationRoot ?
|
|
46404
|
+
package_root: ownerRoot ? path40.relative(repoRoot, ownerRoot) || "." : void 0,
|
|
46405
|
+
declared_in: declarationRoot ? path40.relative(repoRoot, path40.join(declarationRoot, "package.json")) || "package.json" : void 0,
|
|
46325
46406
|
fix: declaredVersion ? `Install dependencies for ${ownerPackageJsonRel} (already declares "${packageName}")` : `Add "${packageName}": "${version}" to ${ownerPackageJsonRel} dependencies`
|
|
46326
46407
|
});
|
|
46327
46408
|
}
|
|
@@ -46333,7 +46414,7 @@ import ts5 from "typescript";
|
|
|
46333
46414
|
|
|
46334
46415
|
// ../canvas-pages/pages/import-walker.ts
|
|
46335
46416
|
import { isBuiltin } from "module";
|
|
46336
|
-
import
|
|
46417
|
+
import path41 from "path";
|
|
46337
46418
|
import ts4 from "typescript";
|
|
46338
46419
|
function isServerComponentOnlySpecifier(specifier) {
|
|
46339
46420
|
const cleaned = specifier.split("?")[0].split("#")[0];
|
|
@@ -46434,18 +46515,18 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46434
46515
|
const serverOnlyImports = /* @__PURE__ */ new Map();
|
|
46435
46516
|
const canonicalProjectRoot = ts4.sys.realpath?.(projectRoot) ?? projectRoot;
|
|
46436
46517
|
const repoRoot = repoRootForCanvasWalk(canonicalProjectRoot);
|
|
46437
|
-
const primaryConfigPath = primaryTsconfigPath ?
|
|
46518
|
+
const primaryConfigPath = primaryTsconfigPath ? path41.resolve(primaryTsconfigPath) : null;
|
|
46438
46519
|
const queue = [entryFile];
|
|
46439
46520
|
const configPathByDir = /* @__PURE__ */ new Map();
|
|
46440
46521
|
const optionsByConfig = /* @__PURE__ */ new Map();
|
|
46441
46522
|
const viteAliasKeysByDir = /* @__PURE__ */ new Map();
|
|
46442
46523
|
function nearestConfigPath(dir) {
|
|
46443
46524
|
for (const candidateDir of importerResolutionDirs(
|
|
46444
|
-
|
|
46525
|
+
path41.join(dir, "__probe__"),
|
|
46445
46526
|
repoRoot
|
|
46446
46527
|
)) {
|
|
46447
46528
|
for (const name of ["tsconfig.json", "jsconfig.json"]) {
|
|
46448
|
-
const candidate =
|
|
46529
|
+
const candidate = path41.join(candidateDir, name);
|
|
46449
46530
|
if (moduleResolutionHost.fileExists(candidate)) return candidate;
|
|
46450
46531
|
}
|
|
46451
46532
|
}
|
|
@@ -46456,7 +46537,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46456
46537
|
}
|
|
46457
46538
|
function resolveConfigOptions(configPath, depth, seen) {
|
|
46458
46539
|
if (depth > 8) return null;
|
|
46459
|
-
const normalized =
|
|
46540
|
+
const normalized = path41.resolve(configPath);
|
|
46460
46541
|
if (seen.has(normalized)) return null;
|
|
46461
46542
|
seen.add(normalized);
|
|
46462
46543
|
const read2 = ts4.readConfigFile(normalized, ts4.sys.readFile);
|
|
@@ -46464,7 +46545,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46464
46545
|
const parsed = ts4.parseJsonConfigFileContent(
|
|
46465
46546
|
read2.config,
|
|
46466
46547
|
ts4.sys,
|
|
46467
|
-
|
|
46548
|
+
path41.dirname(normalized),
|
|
46468
46549
|
void 0,
|
|
46469
46550
|
normalized
|
|
46470
46551
|
);
|
|
@@ -46474,15 +46555,15 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46474
46555
|
if (!ref || typeof ref !== "object") continue;
|
|
46475
46556
|
const refPath = ref.path;
|
|
46476
46557
|
if (typeof refPath !== "string") continue;
|
|
46477
|
-
const resolved =
|
|
46478
|
-
const refConfig = refPath.endsWith(".json") ? resolved :
|
|
46558
|
+
const resolved = path41.resolve(path41.dirname(normalized), refPath);
|
|
46559
|
+
const refConfig = refPath.endsWith(".json") ? resolved : path41.join(resolved, "tsconfig.json");
|
|
46479
46560
|
const found = resolveConfigOptions(refConfig, depth + 1, seen);
|
|
46480
46561
|
if (found && hasAliasOptions(found)) return found;
|
|
46481
46562
|
}
|
|
46482
46563
|
return parsed.options;
|
|
46483
46564
|
}
|
|
46484
46565
|
function importerConfig(importerFile) {
|
|
46485
|
-
const dir =
|
|
46566
|
+
const dir = path41.dirname(importerFile);
|
|
46486
46567
|
let configPath = configPathByDir.get(dir);
|
|
46487
46568
|
if (configPath === void 0) {
|
|
46488
46569
|
configPath = nearestConfigPath(dir);
|
|
@@ -46497,7 +46578,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46497
46578
|
return options ? { configPath, options } : null;
|
|
46498
46579
|
}
|
|
46499
46580
|
function nearestViteAliasKeys(importerFile) {
|
|
46500
|
-
const dir =
|
|
46581
|
+
const dir = path41.dirname(importerFile);
|
|
46501
46582
|
let keys = viteAliasKeysByDir.get(dir);
|
|
46502
46583
|
if (keys !== void 0) return keys;
|
|
46503
46584
|
keys = /* @__PURE__ */ new Set();
|
|
@@ -46512,7 +46593,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46512
46593
|
"vite.config.mjs",
|
|
46513
46594
|
"vite.config.cjs"
|
|
46514
46595
|
]) {
|
|
46515
|
-
const candidate =
|
|
46596
|
+
const candidate = path41.join(candidateDir, name);
|
|
46516
46597
|
if (!moduleResolutionHost.fileExists(candidate)) continue;
|
|
46517
46598
|
const source = ts4.sys.readFile(candidate);
|
|
46518
46599
|
if (source !== void 0) keys = extractViteAliasKeys(source);
|
|
@@ -46547,7 +46628,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46547
46628
|
if (isServerComponentOnlySpecifier(specifier) && !serverOnlyImports.has(specifier)) {
|
|
46548
46629
|
serverOnlyImports.set(
|
|
46549
46630
|
specifier,
|
|
46550
|
-
|
|
46631
|
+
path41.relative(canonicalProjectRoot, canonical)
|
|
46551
46632
|
);
|
|
46552
46633
|
}
|
|
46553
46634
|
let resolvedModule2 = importer && importer.configPath !== primaryConfigPath ? ts4.resolveModuleName(
|
|
@@ -46569,7 +46650,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46569
46650
|
if (packageName && !npmPackages.has(packageName) && !matchesViteAlias(specifier, canonical)) {
|
|
46570
46651
|
npmPackages.set(
|
|
46571
46652
|
packageName,
|
|
46572
|
-
|
|
46653
|
+
path41.relative(canonicalProjectRoot, canonical)
|
|
46573
46654
|
);
|
|
46574
46655
|
}
|
|
46575
46656
|
continue;
|
|
@@ -46579,7 +46660,7 @@ function walkImports(entryFile, compilerOptions, moduleResolutionHost, projectRo
|
|
|
46579
46660
|
if (packageName && !npmPackages.has(packageName)) {
|
|
46580
46661
|
npmPackages.set(
|
|
46581
46662
|
packageName,
|
|
46582
|
-
|
|
46663
|
+
path41.relative(canonicalProjectRoot, canonical)
|
|
46583
46664
|
);
|
|
46584
46665
|
}
|
|
46585
46666
|
} else {
|
|
@@ -46734,9 +46815,9 @@ function getCanvasFormatIssues(file, source, parsed) {
|
|
|
46734
46815
|
return issues;
|
|
46735
46816
|
}
|
|
46736
46817
|
async function validatePage(pageFile, projectRoot, config) {
|
|
46737
|
-
const resolvedPageFile =
|
|
46738
|
-
const resolvedProjectRoot =
|
|
46739
|
-
const tsconfigPath = config?.tsconfigPath ??
|
|
46818
|
+
const resolvedPageFile = path42.resolve(pageFile);
|
|
46819
|
+
const resolvedProjectRoot = path42.resolve(projectRoot);
|
|
46820
|
+
const tsconfigPath = config?.tsconfigPath ?? path42.join(resolvedProjectRoot, "tsconfig.json");
|
|
46740
46821
|
const readResult = ts6.readConfigFile(tsconfigPath, ts6.sys.readFile);
|
|
46741
46822
|
if (readResult.error) {
|
|
46742
46823
|
const errorText = ts6.flattenDiagnosticMessageText(
|
|
@@ -46839,7 +46920,7 @@ async function validatePage(pageFile, projectRoot, config) {
|
|
|
46839
46920
|
|
|
46840
46921
|
// ../canvas-pages/pages/validate-host.ts
|
|
46841
46922
|
import { access as access17 } from "fs/promises";
|
|
46842
|
-
import
|
|
46923
|
+
import path43 from "path";
|
|
46843
46924
|
var DOCS_HINT = "Refer to get_guide({ topic: 'tempo-canvas-instructions' }) for details on setting up the canvas infrastructure.";
|
|
46844
46925
|
async function pathExists12(targetPath) {
|
|
46845
46926
|
try {
|
|
@@ -46862,7 +46943,7 @@ async function isUrlReachable(url) {
|
|
|
46862
46943
|
}
|
|
46863
46944
|
async function validateHost(config) {
|
|
46864
46945
|
const issues = [];
|
|
46865
|
-
const tempoSdkPath =
|
|
46946
|
+
const tempoSdkPath = path43.join(config.tempoRoot, "node_modules", "tempo-sdk");
|
|
46866
46947
|
if (!await pathExists12(tempoSdkPath)) {
|
|
46867
46948
|
issues.push({
|
|
46868
46949
|
kind: "host_setup_issue",
|
|
@@ -46894,7 +46975,7 @@ async function validateHost(config) {
|
|
|
46894
46975
|
|
|
46895
46976
|
// ../canvas-tools/commands/utils.ts
|
|
46896
46977
|
import { readdir as readdir11, stat as stat9 } from "fs/promises";
|
|
46897
|
-
import
|
|
46978
|
+
import path44 from "path";
|
|
46898
46979
|
async function pathExists13(targetPath) {
|
|
46899
46980
|
try {
|
|
46900
46981
|
await stat9(targetPath);
|
|
@@ -46907,7 +46988,7 @@ async function listFilesRecursively(directoryPath) {
|
|
|
46907
46988
|
const entries = await readdir11(directoryPath, { withFileTypes: true });
|
|
46908
46989
|
const files = [];
|
|
46909
46990
|
for (const entry of entries) {
|
|
46910
|
-
const absolutePath =
|
|
46991
|
+
const absolutePath = path44.join(directoryPath, entry.name);
|
|
46911
46992
|
if (entry.isDirectory()) {
|
|
46912
46993
|
files.push(...await listFilesRecursively(absolutePath));
|
|
46913
46994
|
continue;
|
|
@@ -46925,7 +47006,7 @@ async function runComputeLayoutCommand(args) {
|
|
|
46925
47006
|
}
|
|
46926
47007
|
let existingRects = [];
|
|
46927
47008
|
if (args.canvas_file) {
|
|
46928
|
-
const pageFilePath = await resolveCanvasFilePath(args.canvas_file) ??
|
|
47009
|
+
const pageFilePath = await resolveCanvasFilePath(args.canvas_file) ?? path45.resolve(args.canvas_file);
|
|
46929
47010
|
if (!await pathExists13(pageFilePath)) {
|
|
46930
47011
|
throw new Error(`Canvas file not found: ${pageFilePath}`);
|
|
46931
47012
|
}
|
|
@@ -46955,9 +47036,9 @@ async function runComputeLayoutCommand(args) {
|
|
|
46955
47036
|
}
|
|
46956
47037
|
|
|
46957
47038
|
// ../canvas-tools/commands/create-page.ts
|
|
46958
|
-
import
|
|
47039
|
+
import path46 from "path";
|
|
46959
47040
|
async function runCreatePageCommand(args) {
|
|
46960
|
-
const projectRoot =
|
|
47041
|
+
const projectRoot = path46.resolve(args.repo_root);
|
|
46961
47042
|
const pageName = args.canvas_name;
|
|
46962
47043
|
const storyboards = (args.storyboards ?? []).map(
|
|
46963
47044
|
(storyboard) => ({
|
|
@@ -46993,13 +47074,13 @@ async function runCreatePageCommand(args) {
|
|
|
46993
47074
|
|
|
46994
47075
|
// ../canvas-tools/commands/delete-page.ts
|
|
46995
47076
|
import { rm as rm9 } from "fs/promises";
|
|
46996
|
-
import
|
|
47077
|
+
import path47 from "path";
|
|
46997
47078
|
async function runDeletePageCommand(args) {
|
|
46998
|
-
const pageDir = await resolveCanvasDirPath(args.canvas_dir) ??
|
|
47079
|
+
const pageDir = await resolveCanvasDirPath(args.canvas_dir) ?? path47.resolve(args.canvas_dir);
|
|
46999
47080
|
if (!await pathExists13(pageDir)) {
|
|
47000
47081
|
throw new Error(`Directory not found: ${pageDir}`);
|
|
47001
47082
|
}
|
|
47002
|
-
const pageFilePath =
|
|
47083
|
+
const pageFilePath = path47.join(pageDir, "index.canvas.tsx");
|
|
47003
47084
|
if (!await pathExists13(pageFilePath)) {
|
|
47004
47085
|
throw new Error(
|
|
47005
47086
|
`Not a canvas folder: ${pageDir} (missing index.canvas.tsx)`
|
|
@@ -47014,9 +47095,9 @@ async function runDeletePageCommand(args) {
|
|
|
47014
47095
|
}
|
|
47015
47096
|
|
|
47016
47097
|
// ../canvas-tools/commands/list-pages.ts
|
|
47017
|
-
import
|
|
47098
|
+
import path48 from "path";
|
|
47018
47099
|
async function runListPagesCommand(args) {
|
|
47019
|
-
const workspaceRoot =
|
|
47100
|
+
const workspaceRoot = path48.resolve(args.workspace_root);
|
|
47020
47101
|
if (!await pathExists13(workspaceRoot)) {
|
|
47021
47102
|
throw new Error(`Workspace root does not exist: ${workspaceRoot}`);
|
|
47022
47103
|
}
|
|
@@ -47025,7 +47106,7 @@ async function runListPagesCommand(args) {
|
|
|
47025
47106
|
args.repo_names.map((repoName) => repoName.trim()).filter((repoName) => repoName.length > 0)
|
|
47026
47107
|
)
|
|
47027
47108
|
).map((repoName) => ({
|
|
47028
|
-
repoRoot:
|
|
47109
|
+
repoRoot: path48.join(workspaceRoot, repoName),
|
|
47029
47110
|
repoName
|
|
47030
47111
|
})) : [{ repoRoot: workspaceRoot, repoName: "" }];
|
|
47031
47112
|
const pages = [];
|
|
@@ -47052,10 +47133,10 @@ async function runListPagesCommand(args) {
|
|
|
47052
47133
|
}
|
|
47053
47134
|
|
|
47054
47135
|
// ../canvas-tools/commands/migrate-canvas.ts
|
|
47055
|
-
import
|
|
47136
|
+
import path49 from "path";
|
|
47056
47137
|
async function runMigrateCanvasCommand(args) {
|
|
47057
|
-
const projectRoot =
|
|
47058
|
-
const candidate =
|
|
47138
|
+
const projectRoot = path49.resolve(args.repo_root);
|
|
47139
|
+
const candidate = path49.isAbsolute(args.canvas_file) ? args.canvas_file : path49.join(projectRoot, args.canvas_file);
|
|
47059
47140
|
const canvasFile = await resolveCanvasFilePath(candidate);
|
|
47060
47141
|
if (!canvasFile) {
|
|
47061
47142
|
throw new Error(
|
|
@@ -47071,10 +47152,10 @@ async function runMigrateCanvasCommand(args) {
|
|
|
47071
47152
|
}
|
|
47072
47153
|
|
|
47073
47154
|
// ../canvas-tools/commands/set-home.ts
|
|
47074
|
-
import
|
|
47155
|
+
import path50 from "path";
|
|
47075
47156
|
async function runSetHomeCanvasCommand(args) {
|
|
47076
|
-
const projectRoot =
|
|
47077
|
-
const candidate =
|
|
47157
|
+
const projectRoot = path50.resolve(args.repo_root);
|
|
47158
|
+
const candidate = path50.isAbsolute(args.canvas_dir) ? args.canvas_dir : path50.join(projectRoot, args.canvas_dir);
|
|
47078
47159
|
const canvasFile = await resolveCanvasFilePath(candidate);
|
|
47079
47160
|
if (!canvasFile) {
|
|
47080
47161
|
throw new Error(
|
|
@@ -47095,7 +47176,7 @@ async function runSetHomeCanvasCommand(args) {
|
|
|
47095
47176
|
}
|
|
47096
47177
|
const newlyMarked = await markCanvasAsHome(canvasFile);
|
|
47097
47178
|
return {
|
|
47098
|
-
canvas_dir:
|
|
47179
|
+
canvas_dir: path50.dirname(canvasFile),
|
|
47099
47180
|
canvas_file: canvasFile,
|
|
47100
47181
|
repo_root: projectRoot,
|
|
47101
47182
|
newly_marked: newlyMarked,
|
|
@@ -47104,7 +47185,7 @@ async function runSetHomeCanvasCommand(args) {
|
|
|
47104
47185
|
}
|
|
47105
47186
|
|
|
47106
47187
|
// ../canvas-tools/commands/validate-page.ts
|
|
47107
|
-
import
|
|
47188
|
+
import path51 from "path";
|
|
47108
47189
|
var DOCS_HINT2 = "Refer to get_guide({ topic: 'tempo-canvas-instructions' }) for details on setting up the canvas infrastructure.";
|
|
47109
47190
|
function formatIssueAsString(issue) {
|
|
47110
47191
|
switch (issue.kind) {
|
|
@@ -47123,8 +47204,8 @@ function formatIssueAsString(issue) {
|
|
|
47123
47204
|
}
|
|
47124
47205
|
}
|
|
47125
47206
|
async function runValidatePageCommand(args, options) {
|
|
47126
|
-
const pageFile = await resolveCanvasFilePath(args.canvas_file) ??
|
|
47127
|
-
const projectRoot =
|
|
47207
|
+
const pageFile = await resolveCanvasFilePath(args.canvas_file) ?? path51.resolve(args.canvas_file);
|
|
47208
|
+
const projectRoot = path51.resolve(args.repo_root);
|
|
47128
47209
|
let resolvedConfig;
|
|
47129
47210
|
try {
|
|
47130
47211
|
resolvedConfig = await resolveTempoConfig(projectRoot);
|
|
@@ -47132,7 +47213,7 @@ async function runValidatePageCommand(args, options) {
|
|
|
47132
47213
|
const configIssue = {
|
|
47133
47214
|
kind: "host_setup_issue",
|
|
47134
47215
|
check: "config_invalid",
|
|
47135
|
-
file:
|
|
47216
|
+
file: path51.join(projectRoot, "tempo.config.json"),
|
|
47136
47217
|
message: "tempo.config.json is missing or invalid.",
|
|
47137
47218
|
fix: `Create or fix tempo.config.json in the project root. ${DOCS_HINT2}`
|
|
47138
47219
|
};
|
|
@@ -47149,7 +47230,7 @@ async function runValidatePageCommand(args, options) {
|
|
|
47149
47230
|
});
|
|
47150
47231
|
const config = {
|
|
47151
47232
|
tsconfigPath: resolvedConfig.tsconfigPath,
|
|
47152
|
-
tempoPackageDir:
|
|
47233
|
+
tempoPackageDir: path51.dirname(resolvedConfig.packageJsonPath),
|
|
47153
47234
|
reuseTypeCheckService: options?.reuseTypeCheckService
|
|
47154
47235
|
};
|
|
47155
47236
|
const pageResult = await validatePage(pageFile, projectRoot, config);
|
|
@@ -47162,7 +47243,7 @@ async function runValidatePageCommand(args, options) {
|
|
|
47162
47243
|
}
|
|
47163
47244
|
|
|
47164
47245
|
// ../canvas-tools/commands/init.ts
|
|
47165
|
-
import
|
|
47246
|
+
import path52 from "path";
|
|
47166
47247
|
function toInitCommandResult(framework, initResult) {
|
|
47167
47248
|
return {
|
|
47168
47249
|
framework,
|
|
@@ -47174,7 +47255,7 @@ function toInitCommandResult(framework, initResult) {
|
|
|
47174
47255
|
}
|
|
47175
47256
|
async function runInitCommand(args) {
|
|
47176
47257
|
const framework = args.framework ?? "vite";
|
|
47177
|
-
const projectRoot =
|
|
47258
|
+
const projectRoot = path52.resolve(args.repo_root);
|
|
47178
47259
|
const initResult = await initializePagesSupport({ projectRoot, framework });
|
|
47179
47260
|
return toInitCommandResult(framework, initResult);
|
|
47180
47261
|
}
|
|
@@ -47276,10 +47357,10 @@ async function verifyAppInstrumentation(status) {
|
|
|
47276
47357
|
}
|
|
47277
47358
|
|
|
47278
47359
|
// ../canvas-mcp/canvas-validation.ts
|
|
47279
|
-
import
|
|
47360
|
+
import path54 from "path";
|
|
47280
47361
|
|
|
47281
47362
|
// ../canvas-mcp/asset-validation.ts
|
|
47282
|
-
import
|
|
47363
|
+
import path53 from "path";
|
|
47283
47364
|
import { readFileSync as readFileSync3 } from "fs";
|
|
47284
47365
|
var FIXES = {
|
|
47285
47366
|
duplicate_asset_declaration: "Keep one defineAsset beside the component. Existing canvas-owned declarations are also supported, but must not duplicate it.",
|
|
@@ -47291,11 +47372,11 @@ function formatAssetDeclarationIssue(issue) {
|
|
|
47291
47372
|
return `${issue.file} - ${issue.message}. Fix: ${issue.fix}`;
|
|
47292
47373
|
}
|
|
47293
47374
|
async function collectAssetDeclarationIssues(options) {
|
|
47294
|
-
const canvasFileAbs =
|
|
47295
|
-
const looksLikeFile = /\.[cm]?[jt]sx?$/i.test(
|
|
47375
|
+
const canvasFileAbs = path53.isAbsolute(options.canvasFile) ? options.canvasFile : path53.join(options.workspaceRoot, options.canvasFile);
|
|
47376
|
+
const looksLikeFile = /\.[cm]?[jt]sx?$/i.test(path53.basename(canvasFileAbs));
|
|
47296
47377
|
const canvasFolderRel = normalizeWorkspaceRelativePath(
|
|
47297
47378
|
options.workspaceRoot,
|
|
47298
|
-
looksLikeFile ?
|
|
47379
|
+
looksLikeFile ? path53.dirname(canvasFileAbs) : canvasFileAbs
|
|
47299
47380
|
);
|
|
47300
47381
|
const inCanvasFolder = (fileRel) => fileRel === canvasFolderRel || fileRel.startsWith(`${canvasFolderRel}/`);
|
|
47301
47382
|
const index = await loadWorkspaceAssetIndex({
|
|
@@ -47303,14 +47384,14 @@ async function collectAssetDeclarationIssues(options) {
|
|
|
47303
47384
|
canvasesDir: options.canvasesDir
|
|
47304
47385
|
});
|
|
47305
47386
|
const referenced = /* @__PURE__ */ new Set();
|
|
47306
|
-
const
|
|
47387
|
+
const readFile29 = (file) => {
|
|
47307
47388
|
try {
|
|
47308
|
-
return readFileSync3(
|
|
47389
|
+
return readFileSync3(path53.join(options.workspaceRoot, file), "utf8");
|
|
47309
47390
|
} catch {
|
|
47310
47391
|
return null;
|
|
47311
47392
|
}
|
|
47312
47393
|
};
|
|
47313
|
-
const canvasSource =
|
|
47394
|
+
const canvasSource = readFile29(`${canvasFolderRel}/index.canvas.tsx`);
|
|
47314
47395
|
if (canvasSource) {
|
|
47315
47396
|
const { program } = parseAssetProgram(
|
|
47316
47397
|
`${canvasFolderRel}/index.canvas.tsx`,
|
|
@@ -47322,7 +47403,7 @@ async function collectAssetDeclarationIssues(options) {
|
|
|
47322
47403
|
).referenceableImports.values()) {
|
|
47323
47404
|
const identityPath = imported.importSpecifier.startsWith(".") ? resolveRelativeImport(canvasFolderRel, imported.importSpecifier) : `pkg:${imported.importSpecifier}`;
|
|
47324
47405
|
const identity = resolveComponentIdentity(
|
|
47325
|
-
{ readFile:
|
|
47406
|
+
{ readFile: readFile29 },
|
|
47326
47407
|
identityPath,
|
|
47327
47408
|
imported.importedName,
|
|
47328
47409
|
`${canvasFolderRel}/index.canvas.tsx`
|
|
@@ -47365,7 +47446,7 @@ async function collectAssetDeclarationIssues(options) {
|
|
|
47365
47446
|
}
|
|
47366
47447
|
const canvasesDirRel = normalizeWorkspaceRelativePath(
|
|
47367
47448
|
options.workspaceRoot,
|
|
47368
|
-
|
|
47449
|
+
path53.resolve(options.workspaceRoot, options.canvasesDir)
|
|
47369
47450
|
);
|
|
47370
47451
|
const underCanvasesRoot = canvasFolderRel === canvasesDirRel || canvasFolderRel.startsWith(`${canvasesDirRel}/`);
|
|
47371
47452
|
const zone = underCanvasesRoot ? classifyCanvasZone(canvasFolderRel.slice(canvasesDirRel.length + 1)) : null;
|
|
@@ -47392,7 +47473,7 @@ async function collectAssetDeclarationIssues(options) {
|
|
|
47392
47473
|
// ../canvas-mcp/canvas-validation.ts
|
|
47393
47474
|
async function runCanvasValidation(args, options) {
|
|
47394
47475
|
if (args.validation_kind === "page-dependencies") {
|
|
47395
|
-
const result = await (options?.validatePageDependencies ?? ((pageFile, projectRoot) => validatePage(pageFile, projectRoot, { skipTypeCheck: true })))(
|
|
47476
|
+
const result = await (options?.validatePageDependencies ?? ((pageFile, projectRoot) => validatePage(pageFile, projectRoot, { skipTypeCheck: true })))(path54.resolve(args.canvas_file), path54.resolve(args.repo_root));
|
|
47396
47477
|
return {
|
|
47397
47478
|
valid: result.valid,
|
|
47398
47479
|
issues: result.issues,
|
|
@@ -47405,8 +47486,8 @@ async function runCanvasValidation(args, options) {
|
|
|
47405
47486
|
if (args.assets_enabled === false) {
|
|
47406
47487
|
return pageResult;
|
|
47407
47488
|
}
|
|
47408
|
-
const workspaceRoot =
|
|
47409
|
-
const canvasesDir = args.canvases_dir ??
|
|
47489
|
+
const workspaceRoot = path54.resolve(args.workspace_root ?? args.repo_root);
|
|
47490
|
+
const canvasesDir = args.canvases_dir ?? path54.join(workspaceRoot, "tempo", "designs");
|
|
47410
47491
|
const assetIssues = await collectAssetDeclarationIssues({
|
|
47411
47492
|
workspaceRoot,
|
|
47412
47493
|
canvasesDir,
|
|
@@ -47427,8 +47508,8 @@ async function runCanvasValidation(args, options) {
|
|
|
47427
47508
|
}
|
|
47428
47509
|
|
|
47429
47510
|
// ../canvas-mcp/storyboard-stability.ts
|
|
47430
|
-
import { readFile as
|
|
47431
|
-
import
|
|
47511
|
+
import { readFile as readFile25, realpath as realpath4 } from "fs/promises";
|
|
47512
|
+
import path55 from "path";
|
|
47432
47513
|
|
|
47433
47514
|
// ../../node_modules/.pnpm/pixelmatch@7.1.0/node_modules/pixelmatch/index.js
|
|
47434
47515
|
function pixelmatch(img1, img2, output, width, height, options = {}) {
|
|
@@ -47601,11 +47682,11 @@ function toPosix(value) {
|
|
|
47601
47682
|
return value.replace(/\\/g, "/");
|
|
47602
47683
|
}
|
|
47603
47684
|
function absoluteCanvasesRoot(workspaceRoot, canvasesDir) {
|
|
47604
|
-
return
|
|
47685
|
+
return path55.isAbsolute(canvasesDir) ? path55.resolve(canvasesDir) : path55.resolve(workspaceRoot, canvasesDir);
|
|
47605
47686
|
}
|
|
47606
47687
|
function isInsideRoot(root, target) {
|
|
47607
|
-
const relative3 =
|
|
47608
|
-
return relative3 === "" || !relative3.startsWith("..") && !
|
|
47688
|
+
const relative3 = path55.relative(root, target);
|
|
47689
|
+
return relative3 === "" || !relative3.startsWith("..") && !path55.isAbsolute(relative3);
|
|
47609
47690
|
}
|
|
47610
47691
|
async function isInsideRootForReal(root, file) {
|
|
47611
47692
|
try {
|
|
@@ -47625,7 +47706,7 @@ async function resolveCanvasFile(options) {
|
|
|
47625
47706
|
);
|
|
47626
47707
|
const identifier = options.canvasSlug;
|
|
47627
47708
|
const resolved = /* @__PURE__ */ new Set();
|
|
47628
|
-
const candidate =
|
|
47709
|
+
const candidate = path55.resolve(canvasesRoot, identifier);
|
|
47629
47710
|
const direct = isInsideRoot(canvasesRoot, candidate) ? await resolveCanvasFilePath(candidate) : null;
|
|
47630
47711
|
if (direct && await isInsideRootForReal(canvasesRoot, direct)) {
|
|
47631
47712
|
resolved.add(direct);
|
|
@@ -47633,7 +47714,7 @@ async function resolveCanvasFile(options) {
|
|
|
47633
47714
|
if (resolved.size === 0 && !identifier.includes("/")) {
|
|
47634
47715
|
const files = await findPageFilesInPagesRoot(canvasesRoot);
|
|
47635
47716
|
for (const file of files) {
|
|
47636
|
-
if (
|
|
47717
|
+
if (path55.basename(path55.dirname(file)) === identifier && await isInsideRootForReal(canvasesRoot, file)) {
|
|
47637
47718
|
resolved.add(file);
|
|
47638
47719
|
}
|
|
47639
47720
|
}
|
|
@@ -47645,7 +47726,7 @@ async function resolveCanvasFile(options) {
|
|
|
47645
47726
|
);
|
|
47646
47727
|
}
|
|
47647
47728
|
if (resolved.size > 1) {
|
|
47648
|
-
const candidates = [...resolved].map((file) => toPosix(
|
|
47729
|
+
const candidates = [...resolved].map((file) => toPosix(path55.relative(canvasesRoot, path55.dirname(file)))).sort();
|
|
47649
47730
|
throw new StoryboardStabilityTargetError(
|
|
47650
47731
|
"ambiguous_canvas_slug",
|
|
47651
47732
|
`"${options.canvasSlug}" names ${candidates.length} canvases: ${candidates.join(", ")}. Pass the full canvases-root-relative path.`
|
|
@@ -47662,7 +47743,7 @@ async function resolveCanvasFile(options) {
|
|
|
47662
47743
|
}
|
|
47663
47744
|
async function resolveTestedStoryboard(options) {
|
|
47664
47745
|
const canvasFile = await resolveCanvasFile(options);
|
|
47665
|
-
const source = await
|
|
47746
|
+
const source = await readFile25(canvasFile, "utf8");
|
|
47666
47747
|
const parsed = parsePageSource(canvasFile, source);
|
|
47667
47748
|
const storyboard = parsed.storyboards.find(
|
|
47668
47749
|
(candidate) => candidate.storyboardKey === options.storyboard || candidate.exportName === options.storyboard
|
|
@@ -47671,7 +47752,7 @@ async function resolveTestedStoryboard(options) {
|
|
|
47671
47752
|
const available = parsed.storyboards.map((candidate) => candidate.storyboardKey ?? candidate.exportName).join(", ");
|
|
47672
47753
|
throw new StoryboardStabilityTargetError(
|
|
47673
47754
|
"storyboard_not_found",
|
|
47674
|
-
`Storyboard "${options.storyboard}" was not found in ${toPosix(
|
|
47755
|
+
`Storyboard "${options.storyboard}" was not found in ${toPosix(path55.relative(options.workspaceRoot, canvasFile))}.${available ? ` Available storyboards: ${available}.` : ""}`
|
|
47675
47756
|
);
|
|
47676
47757
|
}
|
|
47677
47758
|
if (storyboard.error) {
|
|
@@ -47709,11 +47790,11 @@ async function resolveTestedStoryboard(options) {
|
|
|
47709
47790
|
);
|
|
47710
47791
|
}
|
|
47711
47792
|
return {
|
|
47712
|
-
canvasFile: toPosix(
|
|
47793
|
+
canvasFile: toPosix(path55.relative(options.workspaceRoot, canvasFile)),
|
|
47713
47794
|
canvasSlug: toPosix(
|
|
47714
|
-
|
|
47795
|
+
path55.relative(
|
|
47715
47796
|
absoluteCanvasesRoot(options.workspaceRoot, options.canvasesDir),
|
|
47716
|
-
|
|
47797
|
+
path55.dirname(canvasFile)
|
|
47717
47798
|
)
|
|
47718
47799
|
),
|
|
47719
47800
|
storyboardId: storyboard.storyboardKey ?? storyboard.exportName,
|
|
@@ -48002,11 +48083,11 @@ import {
|
|
|
48002
48083
|
access as access19,
|
|
48003
48084
|
mkdir as mkdir12,
|
|
48004
48085
|
readdir as readdir12,
|
|
48005
|
-
readFile as
|
|
48086
|
+
readFile as readFile28,
|
|
48006
48087
|
realpath as realpath5,
|
|
48007
48088
|
writeFile as writeFile11
|
|
48008
48089
|
} from "fs/promises";
|
|
48009
|
-
import
|
|
48090
|
+
import path59 from "path";
|
|
48010
48091
|
import { promisify as promisify4 } from "util";
|
|
48011
48092
|
|
|
48012
48093
|
// ../canvas-capture-headless/src/capture.ts
|
|
@@ -48404,7 +48485,7 @@ async function settlePage(page, targetSelector, options = {}) {
|
|
|
48404
48485
|
// ../canvas-capture-headless/src/ensure-chromium.ts
|
|
48405
48486
|
import { spawn as spawn7 } from "child_process";
|
|
48406
48487
|
import { createRequire as createRequire6 } from "module";
|
|
48407
|
-
import
|
|
48488
|
+
import path56 from "path";
|
|
48408
48489
|
var INSTALL_TIMEOUT_MS = 8 * 60 * 1e3;
|
|
48409
48490
|
function isMissingBrowserError(err) {
|
|
48410
48491
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -48415,8 +48496,8 @@ function autoInstallDisabled() {
|
|
|
48415
48496
|
}
|
|
48416
48497
|
async function installChromium(log, spawnImpl = spawn7) {
|
|
48417
48498
|
const require3 = createRequire6(import.meta.url);
|
|
48418
|
-
const cliPath =
|
|
48419
|
-
|
|
48499
|
+
const cliPath = path56.join(
|
|
48500
|
+
path56.dirname(require3.resolve("playwright/package.json")),
|
|
48420
48501
|
"cli.js"
|
|
48421
48502
|
);
|
|
48422
48503
|
await new Promise((resolve2, reject) => {
|
|
@@ -49582,10 +49663,10 @@ function compositeStoryboardPngs(images, options = {}) {
|
|
|
49582
49663
|
}
|
|
49583
49664
|
|
|
49584
49665
|
// ../canvas-capture-headless/src/devserver.ts
|
|
49585
|
-
import { readFile as
|
|
49586
|
-
import
|
|
49666
|
+
import { readFile as readFile26 } from "fs/promises";
|
|
49667
|
+
import path57 from "path";
|
|
49587
49668
|
async function readTempoDevserverConfig(tempoConfigPath) {
|
|
49588
|
-
const config = JSON.parse(await
|
|
49669
|
+
const config = JSON.parse(await readFile26(tempoConfigPath, "utf-8"));
|
|
49589
49670
|
if (!config.scripts?.install || !config.scripts?.start) {
|
|
49590
49671
|
throw new Error(
|
|
49591
49672
|
`tempo.config.json at ${tempoConfigPath} must declare scripts.install and scripts.start`
|
|
@@ -49608,47 +49689,47 @@ async function readTempoDevserverConfig(tempoConfigPath) {
|
|
|
49608
49689
|
};
|
|
49609
49690
|
}
|
|
49610
49691
|
function projectRootForTempoDir(tempoDir) {
|
|
49611
|
-
const resolved =
|
|
49612
|
-
return
|
|
49692
|
+
const resolved = path57.resolve(tempoDir);
|
|
49693
|
+
return path57.basename(resolved) === "tempo" ? path57.dirname(resolved) : resolved;
|
|
49613
49694
|
}
|
|
49614
49695
|
async function resolveCanvasHostLayout(options) {
|
|
49615
|
-
const repoRoot =
|
|
49616
|
-
const candidates = options.tempoDir ? [
|
|
49617
|
-
|
|
49618
|
-
|
|
49696
|
+
const repoRoot = path57.resolve(options.repoRoot);
|
|
49697
|
+
const candidates = options.tempoDir ? [path57.join(path57.resolve(options.tempoDir), "tempo.config.json")] : [
|
|
49698
|
+
path57.join(repoRoot, "tempo", "tempo.config.json"),
|
|
49699
|
+
path57.join(repoRoot, "tempo.config.json")
|
|
49619
49700
|
];
|
|
49620
49701
|
for (const configPath of candidates) {
|
|
49621
49702
|
let parsed;
|
|
49622
49703
|
try {
|
|
49623
|
-
parsed = JSON.parse(await
|
|
49704
|
+
parsed = JSON.parse(await readFile26(configPath, "utf-8"));
|
|
49624
49705
|
} catch {
|
|
49625
49706
|
continue;
|
|
49626
49707
|
}
|
|
49627
49708
|
if (typeof parsed !== "object" || parsed === null || !("scripts" in parsed)) {
|
|
49628
49709
|
continue;
|
|
49629
49710
|
}
|
|
49630
|
-
const tempoDir2 =
|
|
49711
|
+
const tempoDir2 = path57.dirname(configPath);
|
|
49631
49712
|
const paths = parsed.paths;
|
|
49632
49713
|
const canvases = typeof paths?.canvases === "string" && paths.canvases.trim().length > 0 ? paths.canvases.trim().split("\\").join("/") : "designs";
|
|
49633
49714
|
return {
|
|
49634
49715
|
tempoDir: tempoDir2,
|
|
49635
49716
|
projectRoot: projectRootForTempoDir(tempoDir2),
|
|
49636
|
-
pagesDir:
|
|
49717
|
+
pagesDir: path57.resolve(tempoDir2, canvases),
|
|
49637
49718
|
configPath
|
|
49638
49719
|
};
|
|
49639
49720
|
}
|
|
49640
|
-
const tempoDir = options.tempoDir ?
|
|
49721
|
+
const tempoDir = options.tempoDir ? path57.resolve(options.tempoDir) : path57.join(repoRoot, "tempo");
|
|
49641
49722
|
return {
|
|
49642
49723
|
tempoDir,
|
|
49643
49724
|
projectRoot: projectRootForTempoDir(tempoDir),
|
|
49644
|
-
pagesDir:
|
|
49725
|
+
pagesDir: path57.join(tempoDir, "designs"),
|
|
49645
49726
|
configPath: null
|
|
49646
49727
|
};
|
|
49647
49728
|
}
|
|
49648
49729
|
function resolveTempoDir(options) {
|
|
49649
|
-
if (options.tempoConfigPath) return
|
|
49730
|
+
if (options.tempoConfigPath) return path57.dirname(options.tempoConfigPath);
|
|
49650
49731
|
if (options.tempoDir) return options.tempoDir;
|
|
49651
|
-
if (options.repoRoot) return
|
|
49732
|
+
if (options.repoRoot) return path57.join(options.repoRoot, "tempo");
|
|
49652
49733
|
throw new Error(
|
|
49653
49734
|
"startDevserverSession needs one of tempoDir, repoRoot, or tempoConfigPath"
|
|
49654
49735
|
);
|
|
@@ -49707,7 +49788,7 @@ async function startDevserverSession(options) {
|
|
|
49707
49788
|
const log = options.log ?? (() => {
|
|
49708
49789
|
});
|
|
49709
49790
|
const tempoDir = resolveTempoDir(options);
|
|
49710
|
-
const tempoConfigPath = options.tempoConfigPath ??
|
|
49791
|
+
const tempoConfigPath = options.tempoConfigPath ?? path57.join(tempoDir, "tempo.config.json");
|
|
49711
49792
|
const config = await readTempoDevserverConfig(tempoConfigPath);
|
|
49712
49793
|
const hostCanvasPaths = options.hostCanvasPaths ?? [];
|
|
49713
49794
|
const devServer = new TempoDevServer({
|
|
@@ -49719,7 +49800,7 @@ async function startDevserverSession(options) {
|
|
|
49719
49800
|
const projectRoot = projectRootForTempoDir(tempoDir);
|
|
49720
49801
|
for (const hostCanvasPath of hostCanvasPaths) {
|
|
49721
49802
|
await devServer.ensureCanvasRegistered(
|
|
49722
|
-
|
|
49803
|
+
path57.join(projectRoot, hostCanvasPath)
|
|
49723
49804
|
);
|
|
49724
49805
|
}
|
|
49725
49806
|
const handle = await devServer.startDevServer();
|
|
@@ -49755,13 +49836,13 @@ async function startDevserverSession(options) {
|
|
|
49755
49836
|
log(`devserver ready at ${hostUrl}`);
|
|
49756
49837
|
const registerCanvas = async (hostCanvasPath) => {
|
|
49757
49838
|
await devServer.ensureCanvasRegistered(
|
|
49758
|
-
|
|
49839
|
+
path57.join(projectRoot, hostCanvasPath)
|
|
49759
49840
|
);
|
|
49760
49841
|
await awaitCanvasRegistration({
|
|
49761
49842
|
origin,
|
|
49762
49843
|
hostCanvasPath,
|
|
49763
49844
|
reRegister: () => devServer.ensureCanvasRegistered(
|
|
49764
|
-
|
|
49845
|
+
path57.join(projectRoot, hostCanvasPath)
|
|
49765
49846
|
),
|
|
49766
49847
|
log
|
|
49767
49848
|
});
|
|
@@ -49771,7 +49852,7 @@ async function startDevserverSession(options) {
|
|
|
49771
49852
|
origin,
|
|
49772
49853
|
hostCanvasPath,
|
|
49773
49854
|
reRegister: () => devServer.ensureCanvasRegistered(
|
|
49774
|
-
|
|
49855
|
+
path57.join(projectRoot, hostCanvasPath)
|
|
49775
49856
|
),
|
|
49776
49857
|
log
|
|
49777
49858
|
});
|
|
@@ -49792,13 +49873,13 @@ async function startDevserverSession(options) {
|
|
|
49792
49873
|
}
|
|
49793
49874
|
|
|
49794
49875
|
// ../canvas-capture-headless/src/enumerate.ts
|
|
49795
|
-
import { access as access18, readFile as
|
|
49796
|
-
import
|
|
49876
|
+
import { access as access18, readFile as readFile27 } from "fs/promises";
|
|
49877
|
+
import path58 from "path";
|
|
49797
49878
|
function toPosixPath7(value) {
|
|
49798
|
-
return value.split(
|
|
49879
|
+
return value.split(path58.sep).join("/");
|
|
49799
49880
|
}
|
|
49800
49881
|
async function enumerateCanvasStoryboards(options) {
|
|
49801
|
-
const pagesDir = options.pagesDir ??
|
|
49882
|
+
const pagesDir = options.pagesDir ?? path58.join(options.tempoDir, "designs");
|
|
49802
49883
|
const projectRoot = projectRootForTempoDir(options.tempoDir);
|
|
49803
49884
|
const canvasFiles = await scanCanvasFiles(pagesDir);
|
|
49804
49885
|
const storyboards = [];
|
|
@@ -49806,7 +49887,7 @@ async function enumerateCanvasStoryboards(options) {
|
|
|
49806
49887
|
const vrtConfigErrors = [];
|
|
49807
49888
|
let totalStoryboards = 0;
|
|
49808
49889
|
for (const filePath of canvasFiles) {
|
|
49809
|
-
const source = await
|
|
49890
|
+
const source = await readFile27(filePath, "utf-8");
|
|
49810
49891
|
const parsed = parseCanvasFile(filePath, source);
|
|
49811
49892
|
const structural = parsed.errors.filter(
|
|
49812
49893
|
(error) => error.kind === "structural"
|
|
@@ -49834,9 +49915,9 @@ async function enumerateCanvasStoryboards(options) {
|
|
|
49834
49915
|
continue;
|
|
49835
49916
|
}
|
|
49836
49917
|
const canvasPath = toPosixPath7(
|
|
49837
|
-
|
|
49918
|
+
path58.relative(options.tempoDir, path58.dirname(filePath))
|
|
49838
49919
|
);
|
|
49839
|
-
const hostCanvasPath = toPosixPath7(
|
|
49920
|
+
const hostCanvasPath = toPosixPath7(path58.relative(projectRoot, filePath));
|
|
49840
49921
|
for (const storyboard of parsed.storyboards) {
|
|
49841
49922
|
totalStoryboards += 1;
|
|
49842
49923
|
if (storyboard.kind !== "component") continue;
|
|
@@ -49944,19 +50025,19 @@ function normalizeRepoUrl2(url) {
|
|
|
49944
50025
|
const sshMatch = cleaned.match(sshShorthand);
|
|
49945
50026
|
if (sshMatch) {
|
|
49946
50027
|
const host = sshMatch[1];
|
|
49947
|
-
const
|
|
49948
|
-
return finalize2(host,
|
|
50028
|
+
const path64 = sshMatch[2];
|
|
50029
|
+
return finalize2(host, path64);
|
|
49949
50030
|
}
|
|
49950
50031
|
const protocolMatch = cleaned.match(/^[\w+.-]+:\/\/(?:[^@]+@)?([\w.-]+)\/([\w./-]+)$/);
|
|
49951
50032
|
if (protocolMatch) {
|
|
49952
50033
|
const host = protocolMatch[1];
|
|
49953
|
-
const
|
|
49954
|
-
return finalize2(host,
|
|
50034
|
+
const path64 = protocolMatch[2];
|
|
50035
|
+
return finalize2(host, path64);
|
|
49955
50036
|
}
|
|
49956
50037
|
return null;
|
|
49957
50038
|
}
|
|
49958
|
-
function finalize2(host,
|
|
49959
|
-
let cleaned =
|
|
50039
|
+
function finalize2(host, path64) {
|
|
50040
|
+
let cleaned = path64.replace(/\.git$/, "");
|
|
49960
50041
|
cleaned = cleaned.replace(/^\/+|\/+$/g, "");
|
|
49961
50042
|
if (!cleaned) return null;
|
|
49962
50043
|
return `${host}/${cleaned}`.toLowerCase();
|
|
@@ -50568,18 +50649,18 @@ async function exists3(target) {
|
|
|
50568
50649
|
}
|
|
50569
50650
|
async function assertWriteInsideRepo(repoRoot, target) {
|
|
50570
50651
|
const realRoot = await realpath5(repoRoot);
|
|
50571
|
-
let probe =
|
|
50652
|
+
let probe = path59.resolve(target);
|
|
50572
50653
|
while (!await exists3(probe)) {
|
|
50573
|
-
const parent =
|
|
50654
|
+
const parent = path59.dirname(probe);
|
|
50574
50655
|
if (parent === probe) break;
|
|
50575
50656
|
probe = parent;
|
|
50576
50657
|
}
|
|
50577
50658
|
const realProbe = await realpath5(probe);
|
|
50578
|
-
const relative3 =
|
|
50579
|
-
if (relative3.startsWith("..") ||
|
|
50659
|
+
const relative3 = path59.relative(realRoot, realProbe);
|
|
50660
|
+
if (relative3.startsWith("..") || path59.isAbsolute(relative3)) {
|
|
50580
50661
|
throw new VisualReviewSetupError(
|
|
50581
50662
|
"path_outside_repo",
|
|
50582
|
-
`${toPosix2(
|
|
50663
|
+
`${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
50664
|
);
|
|
50584
50665
|
}
|
|
50585
50666
|
}
|
|
@@ -50680,17 +50761,17 @@ async function readHostConfig(repoRoot) {
|
|
|
50680
50761
|
}
|
|
50681
50762
|
}
|
|
50682
50763
|
async function enumerateTrackedStoryboards2(options) {
|
|
50683
|
-
const repoRoot =
|
|
50764
|
+
const repoRoot = path59.resolve(options.workspaceRoot);
|
|
50684
50765
|
const { tempoDir, pagesDir, projectRoot } = await resolveCanvasHostLayout({
|
|
50685
50766
|
repoRoot,
|
|
50686
50767
|
tempoDir: options.tempoDir
|
|
50687
50768
|
});
|
|
50688
50769
|
const result = await enumerateTrackedStoryboards({ tempoDir, pagesDir });
|
|
50689
50770
|
const summarize2 = (board) => {
|
|
50690
|
-
const absolute =
|
|
50771
|
+
const absolute = path59.resolve(projectRoot, board.hostCanvasPath);
|
|
50691
50772
|
return {
|
|
50692
|
-
canvas_slug: toPosix2(
|
|
50693
|
-
canvas_file: toPosix2(
|
|
50773
|
+
canvas_slug: toPosix2(path59.relative(pagesDir, path59.dirname(absolute))),
|
|
50774
|
+
canvas_file: toPosix2(path59.relative(repoRoot, absolute)),
|
|
50694
50775
|
storyboard: board.storyboardId,
|
|
50695
50776
|
name: board.name ?? null,
|
|
50696
50777
|
threshold: board.threshold ?? null,
|
|
@@ -50703,27 +50784,27 @@ async function enumerateTrackedStoryboards2(options) {
|
|
|
50703
50784
|
total_canvases: result.totalCanvases,
|
|
50704
50785
|
total_storyboards: result.totalStoryboards,
|
|
50705
50786
|
errors: result.errors.map((error) => ({
|
|
50706
|
-
file: toPosix2(
|
|
50787
|
+
file: toPosix2(path59.relative(repoRoot, error.filePath)),
|
|
50707
50788
|
message: error.message
|
|
50708
50789
|
}))
|
|
50709
50790
|
};
|
|
50710
50791
|
}
|
|
50711
50792
|
async function findVisualReviewWorkflow(repoRoot) {
|
|
50712
|
-
const workflowsDir =
|
|
50793
|
+
const workflowsDir = path59.join(repoRoot, ".github", "workflows");
|
|
50713
50794
|
if (!await exists3(workflowsDir)) return null;
|
|
50714
|
-
const canonical =
|
|
50795
|
+
const canonical = path59.join(repoRoot, VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH);
|
|
50715
50796
|
if (await exists3(canonical)) {
|
|
50716
50797
|
return {
|
|
50717
50798
|
file: VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH,
|
|
50718
|
-
content: await
|
|
50799
|
+
content: await readFile28(canonical, "utf8")
|
|
50719
50800
|
};
|
|
50720
50801
|
}
|
|
50721
50802
|
const entries = (await readdir12(workflowsDir)).filter((name) => /\.ya?ml$/i.test(name)).sort();
|
|
50722
50803
|
for (const name of entries) {
|
|
50723
|
-
const file =
|
|
50724
|
-
const content = await
|
|
50804
|
+
const file = path59.join(workflowsDir, name);
|
|
50805
|
+
const content = await readFile28(file, "utf8");
|
|
50725
50806
|
if (content.includes("@tempo-ai/visual-review") || content.includes(`context=${VISUAL_REVIEW_STATUS_CONTEXT2}`)) {
|
|
50726
|
-
return { file: toPosix2(
|
|
50807
|
+
return { file: toPosix2(path59.relative(repoRoot, file)), content };
|
|
50727
50808
|
}
|
|
50728
50809
|
}
|
|
50729
50810
|
return null;
|
|
@@ -50739,13 +50820,13 @@ var OTHER_CI_MARKERS = [
|
|
|
50739
50820
|
async function classifyCiProvider(identity) {
|
|
50740
50821
|
const otherCi = [];
|
|
50741
50822
|
for (const marker of OTHER_CI_MARKERS) {
|
|
50742
|
-
if (await exists3(
|
|
50823
|
+
if (await exists3(path59.join(identity.repoRoot, marker))) otherCi.push(marker);
|
|
50743
50824
|
}
|
|
50744
50825
|
return {
|
|
50745
50826
|
provider: identity.host === "github.com" ? "github-actions" : identity.host ? "unsupported" : "unknown",
|
|
50746
50827
|
host: identity.host,
|
|
50747
50828
|
workflows_dir_exists: await exists3(
|
|
50748
|
-
|
|
50829
|
+
path59.join(identity.repoRoot, ".github", "workflows")
|
|
50749
50830
|
),
|
|
50750
50831
|
other_ci_configs: otherCi
|
|
50751
50832
|
};
|
|
@@ -50802,14 +50883,14 @@ var LOCKFILES_BY_PM = {
|
|
|
50802
50883
|
};
|
|
50803
50884
|
async function findLockfile(repoRoot, pm) {
|
|
50804
50885
|
for (const name of LOCKFILES_BY_PM[pm]) {
|
|
50805
|
-
if (await exists3(
|
|
50886
|
+
if (await exists3(path59.join(repoRoot, name))) return name;
|
|
50806
50887
|
}
|
|
50807
50888
|
return null;
|
|
50808
50889
|
}
|
|
50809
50890
|
async function hasPackageManagerField(repoRoot) {
|
|
50810
50891
|
try {
|
|
50811
50892
|
const parsed = JSON.parse(
|
|
50812
|
-
await
|
|
50893
|
+
await readFile28(path59.join(repoRoot, "package.json"), "utf8")
|
|
50813
50894
|
);
|
|
50814
50895
|
return typeof parsed.packageManager === "string" && parsed.packageManager.trim() !== "";
|
|
50815
50896
|
} catch {
|
|
@@ -50942,7 +51023,7 @@ async function safeCheck(id, run) {
|
|
|
50942
51023
|
}
|
|
50943
51024
|
}
|
|
50944
51025
|
async function runVisualReviewDoctor(context, args = {}) {
|
|
50945
|
-
const repoRoot =
|
|
51026
|
+
const repoRoot = path59.resolve(args.repoRoot ?? context.workspaceRoot);
|
|
50946
51027
|
const identity = await resolveRepoIdentity(repoRoot, {
|
|
50947
51028
|
githubApi: context.githubApi
|
|
50948
51029
|
});
|
|
@@ -50963,8 +51044,8 @@ async function runVisualReviewDoctor(context, args = {}) {
|
|
|
50963
51044
|
return {
|
|
50964
51045
|
id: "canvas_host",
|
|
50965
51046
|
ok: complete,
|
|
50966
|
-
tempo_dir: toPosix2(
|
|
50967
|
-
canvases_dir: toPosix2(
|
|
51047
|
+
tempo_dir: toPosix2(path59.relative(repoRoot, host.config.tempoDir)) || ".",
|
|
51048
|
+
canvases_dir: toPosix2(path59.relative(repoRoot, host.config.pagesDir)),
|
|
50968
51049
|
install: host.config.install,
|
|
50969
51050
|
start: host.config.start,
|
|
50970
51051
|
...complete ? {} : {
|
|
@@ -51304,7 +51385,7 @@ function appendSeparator(current) {
|
|
|
51304
51385
|
return current.length === 0 || current.endsWith("\n\n") ? "" : current.endsWith("\n") ? "\n" : "\n\n";
|
|
51305
51386
|
}
|
|
51306
51387
|
async function runVisualReviewInit(context, args = {}) {
|
|
51307
|
-
const repoRoot =
|
|
51388
|
+
const repoRoot = path59.resolve(args.repoRoot ?? context.workspaceRoot);
|
|
51308
51389
|
const warnings = [];
|
|
51309
51390
|
const host = await readHostConfig(repoRoot);
|
|
51310
51391
|
if (!host.config) {
|
|
@@ -51325,7 +51406,7 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51325
51406
|
if (identity.host !== "github.com") {
|
|
51326
51407
|
throw new VisualReviewSetupError("unsupported_ci", unsupportedCiMessage(identity.host));
|
|
51327
51408
|
}
|
|
51328
|
-
const tempoDir = toPosix2(
|
|
51409
|
+
const tempoDir = toPosix2(path59.relative(repoRoot, host.config.tempoDir)) || ".";
|
|
51329
51410
|
const detected = await detectOwningPackageManager(repoRoot);
|
|
51330
51411
|
const install = classifyInstallScript(host.config.install, detected);
|
|
51331
51412
|
if (install.warning) warnings.push(install.warning);
|
|
@@ -51339,14 +51420,14 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51339
51420
|
`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
51421
|
);
|
|
51341
51422
|
}
|
|
51342
|
-
const agentRulesTarget = args.withAgentRules ? await exists3(
|
|
51423
|
+
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
51424
|
const prTemplateRelative = ".github/PULL_REQUEST_TEMPLATE.md";
|
|
51344
51425
|
for (const relative3 of [
|
|
51345
51426
|
VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH,
|
|
51346
51427
|
...agentRulesTarget ? [agentRulesTarget] : [],
|
|
51347
51428
|
...args.withPrTemplate ? [prTemplateRelative] : []
|
|
51348
51429
|
]) {
|
|
51349
|
-
await assertWriteInsideRepo(repoRoot,
|
|
51430
|
+
await assertWriteInsideRepo(repoRoot, path59.join(repoRoot, relative3));
|
|
51350
51431
|
}
|
|
51351
51432
|
let existing = await findVisualReviewWorkflow(repoRoot);
|
|
51352
51433
|
let workflowFile = existing?.file ?? VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH;
|
|
@@ -51363,8 +51444,8 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51363
51444
|
hasPackageManagerField: await hasPackageManagerField(repoRoot),
|
|
51364
51445
|
customInstall: install.customInstall
|
|
51365
51446
|
});
|
|
51366
|
-
const target =
|
|
51367
|
-
await mkdir12(
|
|
51447
|
+
const target = path59.join(repoRoot, VISUAL_REVIEW_WORKFLOW_RELATIVE_PATH);
|
|
51448
|
+
await mkdir12(path59.dirname(target), { recursive: true });
|
|
51368
51449
|
try {
|
|
51369
51450
|
await writeFile11(target, rendered, { encoding: "utf8", flag: "wx" });
|
|
51370
51451
|
written = true;
|
|
@@ -51389,9 +51470,9 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51389
51470
|
"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
51471
|
);
|
|
51391
51472
|
} else {
|
|
51392
|
-
const file =
|
|
51473
|
+
const file = path59.join(repoRoot, target);
|
|
51393
51474
|
agentRules = await queuedFileEditor.withFileLock(file, async () => {
|
|
51394
|
-
const current = await
|
|
51475
|
+
const current = await readFile28(file, "utf8");
|
|
51395
51476
|
if (current.includes(AGENT_RULES_HEADING)) {
|
|
51396
51477
|
return { file: target, written: false };
|
|
51397
51478
|
}
|
|
@@ -51406,10 +51487,10 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51406
51487
|
let prTemplate = null;
|
|
51407
51488
|
if (args.withPrTemplate) {
|
|
51408
51489
|
const relative3 = prTemplateRelative;
|
|
51409
|
-
const file =
|
|
51490
|
+
const file = path59.join(repoRoot, relative3);
|
|
51410
51491
|
prTemplate = await queuedFileEditor.withFileLock(file, async () => {
|
|
51411
51492
|
if (await exists3(file)) {
|
|
51412
|
-
const current = await
|
|
51493
|
+
const current = await readFile28(file, "utf8");
|
|
51413
51494
|
if (/^##\s+Visual review\b/im.test(current)) {
|
|
51414
51495
|
return { file: relative3, written: false };
|
|
51415
51496
|
}
|
|
@@ -51419,7 +51500,7 @@ async function runVisualReviewInit(context, args = {}) {
|
|
|
51419
51500
|
);
|
|
51420
51501
|
return { file: relative3, written: true };
|
|
51421
51502
|
}
|
|
51422
|
-
await mkdir12(
|
|
51503
|
+
await mkdir12(path59.dirname(file), { recursive: true });
|
|
51423
51504
|
try {
|
|
51424
51505
|
await writeFile11(
|
|
51425
51506
|
file,
|
|
@@ -51488,9 +51569,9 @@ async function applyStoryboardVrt(options) {
|
|
|
51488
51569
|
failure2.message ?? String(error)
|
|
51489
51570
|
);
|
|
51490
51571
|
}
|
|
51491
|
-
const relativeFile = toPosix2(
|
|
51572
|
+
const relativeFile = toPosix2(path59.relative(options.workspaceRoot, canvasFile));
|
|
51492
51573
|
const outcome = await queuedFileEditor.withFileLock(canvasFile, async () => {
|
|
51493
|
-
const source = await
|
|
51574
|
+
const source = await readFile28(canvasFile, "utf8");
|
|
51494
51575
|
const parsed = parseCanvasFile(canvasFile, source);
|
|
51495
51576
|
const structural = parsed.errors.filter((error) => error.kind === "structural");
|
|
51496
51577
|
if (structural.length > 0) {
|
|
@@ -51535,9 +51616,9 @@ async function applyStoryboardVrt(options) {
|
|
|
51535
51616
|
});
|
|
51536
51617
|
const tracked = outcome.vrt !== null;
|
|
51537
51618
|
const paused = Boolean(outcome.vrt?.skip);
|
|
51538
|
-
const canvasesRoot =
|
|
51619
|
+
const canvasesRoot = path59.isAbsolute(options.canvasesDir) ? path59.resolve(options.canvasesDir) : path59.resolve(options.workspaceRoot, options.canvasesDir);
|
|
51539
51620
|
return {
|
|
51540
|
-
canvas_slug: toPosix2(
|
|
51621
|
+
canvas_slug: toPosix2(path59.relative(canvasesRoot, path59.dirname(canvasFile))),
|
|
51541
51622
|
canvas_file: relativeFile,
|
|
51542
51623
|
storyboard: options.storyboard,
|
|
51543
51624
|
tracked,
|
|
@@ -51566,12 +51647,12 @@ async function normalizeCanvasSlug(input, workspaceRoot) {
|
|
|
51566
51647
|
const value = input.trim().replace(/\\/g, "/").replace(/\/+$/, "").replace(/\/[^/]*\.canvas\.tsx$/i, "");
|
|
51567
51648
|
if (!value.includes("/")) return value;
|
|
51568
51649
|
const canvasesDir = resolveCanvasesDirSync(workspaceRoot);
|
|
51569
|
-
const absoluteCanvasesDir =
|
|
51570
|
-
const candidates =
|
|
51650
|
+
const absoluteCanvasesDir = path60.isAbsolute(canvasesDir) ? canvasesDir : path60.join(workspaceRoot, canvasesDir);
|
|
51651
|
+
const candidates = path60.isAbsolute(value) ? [value] : [path60.join(workspaceRoot, value), path60.join(absoluteCanvasesDir, value)];
|
|
51571
51652
|
for (const candidate of candidates) {
|
|
51572
51653
|
const dir = await resolveCanvasDirPath(candidate);
|
|
51573
51654
|
if (!dir) continue;
|
|
51574
|
-
const relative3 =
|
|
51655
|
+
const relative3 = path60.relative(absoluteCanvasesDir, dir).replace(/\\/g, "/");
|
|
51575
51656
|
return relative3 && !relative3.startsWith("..") ? relative3 : value;
|
|
51576
51657
|
}
|
|
51577
51658
|
return value;
|
|
@@ -52753,11 +52834,11 @@ function buildBackends(runtime, toolsets, workspace) {
|
|
|
52753
52834
|
}
|
|
52754
52835
|
|
|
52755
52836
|
// src/version.ts
|
|
52756
|
-
var CLI_VERSION = "0.0.
|
|
52837
|
+
var CLI_VERSION = "0.0.121-staging.2";
|
|
52757
52838
|
|
|
52758
52839
|
// src/canvas-hooks.ts
|
|
52759
52840
|
var import_pngjs4 = __toESM(require_png(), 1);
|
|
52760
|
-
import
|
|
52841
|
+
import path63 from "path";
|
|
52761
52842
|
import { stat as stat10 } from "fs/promises";
|
|
52762
52843
|
import { gzipSync } from "zlib";
|
|
52763
52844
|
import { anyApi as anyApi9 } from "convex/server";
|
|
@@ -52766,7 +52847,7 @@ import { anyApi as anyApi9 } from "convex/server";
|
|
|
52766
52847
|
import { createHash as createHash5, randomUUID as randomUUID5 } from "crypto";
|
|
52767
52848
|
import fs6 from "fs/promises";
|
|
52768
52849
|
import os3 from "os";
|
|
52769
|
-
import
|
|
52850
|
+
import path61 from "path";
|
|
52770
52851
|
|
|
52771
52852
|
// ../workspaces/git-worktree/non-interactive-git.ts
|
|
52772
52853
|
var NON_INTERACTIVE_GIT_CONFIG = [
|
|
@@ -52888,7 +52969,7 @@ async function checkBranchOnRemote(repoPath, branch) {
|
|
|
52888
52969
|
|
|
52889
52970
|
// ../workspaces/git-worktree/canvas-scan-cache.ts
|
|
52890
52971
|
import fs7 from "fs/promises";
|
|
52891
|
-
import
|
|
52972
|
+
import path62 from "path";
|
|
52892
52973
|
var DEFAULT_CONCURRENCY = 6;
|
|
52893
52974
|
var DEFAULT_MAX_AGE_MS = 5 * 6e4;
|
|
52894
52975
|
var Semaphore = class {
|
|
@@ -52915,14 +52996,14 @@ var sharedSemaphore = new Semaphore(DEFAULT_CONCURRENCY);
|
|
|
52915
52996
|
// src/canvas-hooks.ts
|
|
52916
52997
|
var MAX_MCP_SCREENSHOT_DIMENSION_PX = 1990;
|
|
52917
52998
|
function toPosix3(value) {
|
|
52918
|
-
return value.split(
|
|
52999
|
+
return value.split(path63.sep).join("/");
|
|
52919
53000
|
}
|
|
52920
53001
|
function normalizeSlug(input) {
|
|
52921
53002
|
return input.trim().replace(/\\/g, "/").replace(/\/+$/, "").replace(/\/[^/]*\.canvas\.tsx$/i, "");
|
|
52922
53003
|
}
|
|
52923
53004
|
async function isCanvasFolder(dir) {
|
|
52924
53005
|
try {
|
|
52925
|
-
return (await stat10(
|
|
53006
|
+
return (await stat10(path63.join(dir, "index.canvas.tsx"))).isFile();
|
|
52926
53007
|
} catch {
|
|
52927
53008
|
return false;
|
|
52928
53009
|
}
|
|
@@ -52930,18 +53011,18 @@ async function isCanvasFolder(dir) {
|
|
|
52930
53011
|
async function resolveCanvas(workspace, canvasSlug) {
|
|
52931
53012
|
const workspaceRoot = workspace.workspaceRoot;
|
|
52932
53013
|
const canvasesDir = workspace.canvasesDir;
|
|
52933
|
-
const tempoDir =
|
|
53014
|
+
const tempoDir = path63.join(workspaceRoot, "tempo");
|
|
52934
53015
|
const enumeration = await enumerateCanvasStoryboards({
|
|
52935
53016
|
tempoDir,
|
|
52936
53017
|
pagesDir: canvasesDir
|
|
52937
53018
|
});
|
|
52938
53019
|
const byFolder = /* @__PURE__ */ new Map();
|
|
52939
53020
|
for (const storyboard of enumeration.storyboards) {
|
|
52940
|
-
const folder =
|
|
53021
|
+
const folder = path63.dirname(storyboard.filePath);
|
|
52941
53022
|
let canvas = byFolder.get(folder);
|
|
52942
53023
|
if (!canvas) {
|
|
52943
53024
|
canvas = {
|
|
52944
|
-
contentPath: toPosix3(
|
|
53025
|
+
contentPath: toPosix3(path63.relative(workspaceRoot, folder)),
|
|
52945
53026
|
hostCanvasPath: storyboard.hostCanvasPath,
|
|
52946
53027
|
storyboards: []
|
|
52947
53028
|
};
|
|
@@ -52951,15 +53032,15 @@ async function resolveCanvas(workspace, canvasSlug) {
|
|
|
52951
53032
|
}
|
|
52952
53033
|
const slug = normalizeSlug(canvasSlug);
|
|
52953
53034
|
if (!slug) return { kind: "not_found" };
|
|
52954
|
-
if (slug.includes("/") ||
|
|
53035
|
+
if (slug.includes("/") || path63.isAbsolute(canvasSlug)) {
|
|
52955
53036
|
for (const [folder, canvas] of byFolder) {
|
|
52956
53037
|
const candidates = [
|
|
52957
|
-
toPosix3(
|
|
52958
|
-
toPosix3(
|
|
52959
|
-
toPosix3(
|
|
53038
|
+
toPosix3(path63.relative(canvasesDir, folder)),
|
|
53039
|
+
toPosix3(path63.relative(workspaceRoot, folder)),
|
|
53040
|
+
toPosix3(path63.relative(tempoDir, folder))
|
|
52960
53041
|
];
|
|
52961
|
-
if (
|
|
52962
|
-
if (
|
|
53042
|
+
if (path63.isAbsolute(canvasSlug)) {
|
|
53043
|
+
if (path63.resolve(canvasSlug) === folder) {
|
|
52963
53044
|
return { kind: "ok", canvas };
|
|
52964
53045
|
}
|
|
52965
53046
|
continue;
|
|
@@ -52968,29 +53049,29 @@ async function resolveCanvas(workspace, canvasSlug) {
|
|
|
52968
53049
|
}
|
|
52969
53050
|
} else {
|
|
52970
53051
|
const matches = [...byFolder.entries()].filter(
|
|
52971
|
-
([folder]) =>
|
|
53052
|
+
([folder]) => path63.basename(folder) === slug
|
|
52972
53053
|
);
|
|
52973
53054
|
if (matches.length > 1) {
|
|
52974
53055
|
return {
|
|
52975
53056
|
kind: "ambiguous",
|
|
52976
|
-
candidates: matches.map(([folder]) => toPosix3(
|
|
53057
|
+
candidates: matches.map(([folder]) => toPosix3(path63.relative(canvasesDir, folder))).sort()
|
|
52977
53058
|
};
|
|
52978
53059
|
}
|
|
52979
53060
|
if (matches.length === 1) return { kind: "ok", canvas: matches[0][1] };
|
|
52980
53061
|
}
|
|
52981
|
-
const probeDirs =
|
|
52982
|
-
|
|
52983
|
-
|
|
52984
|
-
|
|
53062
|
+
const probeDirs = path63.isAbsolute(canvasSlug) ? [path63.resolve(canvasSlug)] : [
|
|
53063
|
+
path63.join(canvasesDir, slug),
|
|
53064
|
+
path63.join(workspaceRoot, slug),
|
|
53065
|
+
path63.join(tempoDir, slug)
|
|
52985
53066
|
];
|
|
52986
53067
|
for (const dir of probeDirs) {
|
|
52987
53068
|
if (await isCanvasFolder(dir)) {
|
|
52988
53069
|
return {
|
|
52989
53070
|
kind: "ok",
|
|
52990
53071
|
canvas: {
|
|
52991
|
-
contentPath: toPosix3(
|
|
53072
|
+
contentPath: toPosix3(path63.relative(workspaceRoot, dir)),
|
|
52992
53073
|
hostCanvasPath: toPosix3(
|
|
52993
|
-
|
|
53074
|
+
path63.relative(workspaceRoot, path63.join(dir, "index.canvas.tsx"))
|
|
52994
53075
|
),
|
|
52995
53076
|
storyboards: []
|
|
52996
53077
|
}
|
|
@@ -53704,4 +53785,4 @@ unpdf/dist/index.mjs:
|
|
|
53704
53785
|
* @license Apache-2.0
|
|
53705
53786
|
*)
|
|
53706
53787
|
*/
|
|
53707
|
-
//# sourceMappingURL=serve-
|
|
53788
|
+
//# sourceMappingURL=serve-7ODS7UPT.js.map
|