@tempo-ai/visual-review 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 +1 -1
- package/dist/{chunk-BXSN22AO.js → chunk-LFAVQ3IP.js} +299 -228
- package/dist/chunk-LFAVQ3IP.js.map +1 -0
- package/dist/{cli-HEA4IYKH.js → cli-K6WGJOVH.js} +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BXSN22AO.js.map +0 -1
- /package/dist/{cli-HEA4IYKH.js.map → cli-K6WGJOVH.js.map} +0 -0
|
@@ -10,7 +10,7 @@ import { execFileSync, spawn as spawn6 } from "child_process";
|
|
|
10
10
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
11
11
|
import { mkdir as mkdir7, mkdtemp as mkdtemp2, rm as rm6, writeFile as writeFile7 } from "fs/promises";
|
|
12
12
|
import { tmpdir as tmpdir2 } from "os";
|
|
13
|
-
import
|
|
13
|
+
import path18 from "path";
|
|
14
14
|
|
|
15
15
|
// ../canvas-capture-headless/src/capture.ts
|
|
16
16
|
import { createHash } from "crypto";
|
|
@@ -1488,8 +1488,8 @@ async function startCaptureSession(options) {
|
|
|
1488
1488
|
import { PNG as PNG2 } from "pngjs";
|
|
1489
1489
|
|
|
1490
1490
|
// ../canvas-capture-headless/src/devserver.ts
|
|
1491
|
-
import { readFile as
|
|
1492
|
-
import
|
|
1491
|
+
import { readFile as readFile12 } from "fs/promises";
|
|
1492
|
+
import path16 from "path";
|
|
1493
1493
|
|
|
1494
1494
|
// ../tempo-devserver/abortable-shell-command.ts
|
|
1495
1495
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -2239,8 +2239,8 @@ function extractImporterFromLine(line) {
|
|
|
2239
2239
|
}
|
|
2240
2240
|
return null;
|
|
2241
2241
|
}
|
|
2242
|
-
function normalizeImporterPath(
|
|
2243
|
-
return
|
|
2242
|
+
function normalizeImporterPath(path19) {
|
|
2243
|
+
return path19.replace(/^\.\//, "");
|
|
2244
2244
|
}
|
|
2245
2245
|
|
|
2246
2246
|
// ../tempo-devserver/port-listener.ts
|
|
@@ -4290,6 +4290,66 @@ function missingInstallEnvironment(error) {
|
|
|
4290
4290
|
) || /cannot connect to the docker daemon/i.test(message) || /is the docker daemon running\?/i.test(message);
|
|
4291
4291
|
}
|
|
4292
4292
|
|
|
4293
|
+
// ../tempo-devserver/install-registry-env.ts
|
|
4294
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
4295
|
+
import path7 from "path";
|
|
4296
|
+
import { parseEnv } from "util";
|
|
4297
|
+
async function readOptional(file) {
|
|
4298
|
+
try {
|
|
4299
|
+
return await readFile3(file, "utf-8");
|
|
4300
|
+
} catch (error) {
|
|
4301
|
+
const code = error.code;
|
|
4302
|
+
if (code === "ENOENT" || code === "ENOTDIR") return "";
|
|
4303
|
+
throw error;
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
async function readInstallRegistryEnv(cwd, projectRoot, inheritedEnv) {
|
|
4307
|
+
const root = path7.resolve(projectRoot);
|
|
4308
|
+
const commandDir = path7.resolve(cwd);
|
|
4309
|
+
const relative2 = path7.relative(root, commandDir);
|
|
4310
|
+
if (relative2 === ".." || relative2.startsWith(`..${path7.sep}`) || path7.isAbsolute(relative2)) {
|
|
4311
|
+
return {};
|
|
4312
|
+
}
|
|
4313
|
+
const dirs = [root];
|
|
4314
|
+
if (relative2) {
|
|
4315
|
+
for (const segment of relative2.split(path7.sep)) {
|
|
4316
|
+
dirs.push(path7.join(dirs[dirs.length - 1], segment));
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
4319
|
+
const configs = await Promise.all(
|
|
4320
|
+
dirs.map((dir) => readOptional(path7.join(dir, ".npmrc")))
|
|
4321
|
+
);
|
|
4322
|
+
const keys = /* @__PURE__ */ new Set();
|
|
4323
|
+
for (const config of configs) {
|
|
4324
|
+
for (const line of config.split(/\r?\n/)) {
|
|
4325
|
+
if (/^\s*[#;]/.test(line)) continue;
|
|
4326
|
+
for (const match of line.matchAll(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g)) {
|
|
4327
|
+
keys.add(match[1]);
|
|
4328
|
+
}
|
|
4329
|
+
}
|
|
4330
|
+
}
|
|
4331
|
+
if (keys.size === 0) return {};
|
|
4332
|
+
let fileEnv = {};
|
|
4333
|
+
if ([...keys].some((key2) => inheritedEnv[key2] === void 0)) {
|
|
4334
|
+
const files = await Promise.all(
|
|
4335
|
+
dirs.flatMap(
|
|
4336
|
+
(dir) => [".env", ".env.local"].map(
|
|
4337
|
+
(name) => readOptional(path7.join(dir, name))
|
|
4338
|
+
)
|
|
4339
|
+
)
|
|
4340
|
+
);
|
|
4341
|
+
for (const contents of files) {
|
|
4342
|
+
fileEnv = { ...fileEnv, ...parseEnv(contents) };
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
return Object.fromEntries(
|
|
4346
|
+
[...keys].flatMap((key2) => {
|
|
4347
|
+
const value = inheritedEnv[key2] ?? fileEnv[key2];
|
|
4348
|
+
return value === void 0 ? [] : [[key2, value]];
|
|
4349
|
+
})
|
|
4350
|
+
);
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4293
4353
|
// ../tempo-devserver/tempo-devserver.ts
|
|
4294
4354
|
import { spawn as spawn5 } from "child_process";
|
|
4295
4355
|
import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
|
|
@@ -4299,7 +4359,7 @@ import {
|
|
|
4299
4359
|
mkdir as mkdir6,
|
|
4300
4360
|
mkdtemp,
|
|
4301
4361
|
readdir as readdir4,
|
|
4302
|
-
readFile as
|
|
4362
|
+
readFile as readFile10,
|
|
4303
4363
|
rm as rm5,
|
|
4304
4364
|
stat as stat3,
|
|
4305
4365
|
writeFile as writeFile6
|
|
@@ -4307,7 +4367,7 @@ import {
|
|
|
4307
4367
|
import { request as httpRequest } from "http";
|
|
4308
4368
|
import { createServer, connect as netConnect } from "net";
|
|
4309
4369
|
import os2 from "os";
|
|
4310
|
-
import
|
|
4370
|
+
import path14 from "path";
|
|
4311
4371
|
|
|
4312
4372
|
// ../../modules/file-watcher/provider.ts
|
|
4313
4373
|
var PROVIDER_SLOT = /* @__PURE__ */ Symbol.for("@modules/file-watcher:watch-provider");
|
|
@@ -4361,7 +4421,7 @@ function createEventKeepFilter(rootRealPath, relativePathFilters) {
|
|
|
4361
4421
|
}
|
|
4362
4422
|
|
|
4363
4423
|
// ../../modules/file-watcher/polling-backend.ts
|
|
4364
|
-
import { lstat, readdir, readFile as
|
|
4424
|
+
import { lstat, readdir, readFile as readFile4, writeFile as writeFile4 } from "fs/promises";
|
|
4365
4425
|
import { isAbsolute, join as join2, resolve } from "path";
|
|
4366
4426
|
var STAT_CONCURRENCY = 32;
|
|
4367
4427
|
var MAX_DEPTH = 64;
|
|
@@ -4402,10 +4462,10 @@ async function scanTree(realRoot, ignorePaths = []) {
|
|
|
4402
4462
|
for (let i = 0; i < pendingStats.length; i += STAT_CONCURRENCY) {
|
|
4403
4463
|
const slice = pendingStats.slice(i, i + STAT_CONCURRENCY);
|
|
4404
4464
|
await Promise.all(
|
|
4405
|
-
slice.map(async (
|
|
4465
|
+
slice.map(async (path19) => {
|
|
4406
4466
|
try {
|
|
4407
|
-
const st = await lstat(
|
|
4408
|
-
scan.set(
|
|
4467
|
+
const st = await lstat(path19);
|
|
4468
|
+
scan.set(path19, {
|
|
4409
4469
|
mtimeMs: st.mtimeMs,
|
|
4410
4470
|
size: st.size,
|
|
4411
4471
|
isDir: false
|
|
@@ -4419,16 +4479,16 @@ async function scanTree(realRoot, ignorePaths = []) {
|
|
|
4419
4479
|
}
|
|
4420
4480
|
function diffScans(previous, next) {
|
|
4421
4481
|
const events = [];
|
|
4422
|
-
for (const [
|
|
4423
|
-
const before = previous.get(
|
|
4482
|
+
for (const [path19, now] of next) {
|
|
4483
|
+
const before = previous.get(path19);
|
|
4424
4484
|
if (!before) {
|
|
4425
|
-
events.push({ path:
|
|
4485
|
+
events.push({ path: path19, type: "create" });
|
|
4426
4486
|
} else if (!now.isDir && (before.mtimeMs !== now.mtimeMs || before.size !== now.size)) {
|
|
4427
|
-
events.push({ path:
|
|
4487
|
+
events.push({ path: path19, type: "update" });
|
|
4428
4488
|
}
|
|
4429
4489
|
}
|
|
4430
|
-
for (const
|
|
4431
|
-
if (!next.has(
|
|
4490
|
+
for (const path19 of previous.keys()) {
|
|
4491
|
+
if (!next.has(path19)) events.push({ path: path19, type: "delete" });
|
|
4432
4492
|
}
|
|
4433
4493
|
return events;
|
|
4434
4494
|
}
|
|
@@ -4442,7 +4502,7 @@ async function writeScanSnapshot(snapshotPath, scan) {
|
|
|
4442
4502
|
async function readScanSnapshot(snapshotPath) {
|
|
4443
4503
|
try {
|
|
4444
4504
|
const parsed = JSON.parse(
|
|
4445
|
-
await
|
|
4505
|
+
await readFile4(snapshotPath, "utf8")
|
|
4446
4506
|
);
|
|
4447
4507
|
if (parsed?.version !== 1 || !Array.isArray(parsed.entries)) return null;
|
|
4448
4508
|
const scan = /* @__PURE__ */ new Map();
|
|
@@ -5611,8 +5671,8 @@ if (selfHot) {
|
|
|
5611
5671
|
`;
|
|
5612
5672
|
|
|
5613
5673
|
// ../tempo-devserver/canvas-registry.ts
|
|
5614
|
-
import { mkdir as mkdir4, readdir as readdir2, readFile as
|
|
5615
|
-
import
|
|
5674
|
+
import { mkdir as mkdir4, readdir as readdir2, readFile as readFile5, rm as rm3 } from "fs/promises";
|
|
5675
|
+
import path9 from "path";
|
|
5616
5676
|
|
|
5617
5677
|
// ../tempo-devserver/errors.ts
|
|
5618
5678
|
var TempoDevServerError = class extends Error {
|
|
@@ -5841,7 +5901,7 @@ var MissingRootDepsError = class extends TempoDevServerError {
|
|
|
5841
5901
|
|
|
5842
5902
|
// ../canvas-pages/page-parser.ts
|
|
5843
5903
|
import { createRequire as createRequire3 } from "module";
|
|
5844
|
-
import
|
|
5904
|
+
import path8 from "path";
|
|
5845
5905
|
import { fileURLToPath } from "url";
|
|
5846
5906
|
|
|
5847
5907
|
// ../canvas-pages/home-marker.ts
|
|
@@ -6002,7 +6062,7 @@ function parseCanvasFile(filePath, source) {
|
|
|
6002
6062
|
"name",
|
|
6003
6063
|
objectStringBindings
|
|
6004
6064
|
);
|
|
6005
|
-
const
|
|
6065
|
+
const path19 = readStringAttribute(openingElement, "path");
|
|
6006
6066
|
const backgroundColor = readResolvableStringAttribute(
|
|
6007
6067
|
openingElement,
|
|
6008
6068
|
"backgroundColor",
|
|
@@ -6021,7 +6081,7 @@ function parseCanvasFile(filePath, source) {
|
|
|
6021
6081
|
}
|
|
6022
6082
|
return {
|
|
6023
6083
|
filePath,
|
|
6024
|
-
canvasPath:
|
|
6084
|
+
canvasPath: path19?.value,
|
|
6025
6085
|
pageName: name?.value ?? fallbackPageName(filePath),
|
|
6026
6086
|
backgroundColor: backgroundColor?.value,
|
|
6027
6087
|
canvasElementSpan: toSpan(canvasElement),
|
|
@@ -6029,8 +6089,8 @@ function parseCanvasFile(filePath, source) {
|
|
|
6029
6089
|
canvasChildrenInsertionOffset: typeof canvasElement?.closingElement?.start === "number" ? canvasElement.closingElement.start : void 0,
|
|
6030
6090
|
nameSpan: name?.valueSpan,
|
|
6031
6091
|
nameAttributeSpan: name?.attributeSpan,
|
|
6032
|
-
pathSpan:
|
|
6033
|
-
pathAttributeSpan:
|
|
6092
|
+
pathSpan: path19?.valueSpan,
|
|
6093
|
+
pathAttributeSpan: path19?.attributeSpan,
|
|
6034
6094
|
backgroundColorSpan: backgroundColor?.valueSpan,
|
|
6035
6095
|
backgroundColorAttributeSpan: backgroundColor?.attributeSpan,
|
|
6036
6096
|
imports: imports.all,
|
|
@@ -6813,7 +6873,7 @@ function walk(node, visitor, seen = /* @__PURE__ */ new Set()) {
|
|
|
6813
6873
|
|
|
6814
6874
|
// ../canvas-pages/page-parser.ts
|
|
6815
6875
|
var currentModulePath = typeof __filename !== "undefined" ? __filename : fileURLToPath(import.meta.url);
|
|
6816
|
-
var currentDirectory =
|
|
6876
|
+
var currentDirectory = path8.dirname(currentModulePath);
|
|
6817
6877
|
var require2 = createRequire3(currentModulePath);
|
|
6818
6878
|
function loadParseSync() {
|
|
6819
6879
|
try {
|
|
@@ -6821,15 +6881,15 @@ function loadParseSync() {
|
|
|
6821
6881
|
return parserModule.parseSync;
|
|
6822
6882
|
} catch {
|
|
6823
6883
|
const fallbackPaths = [
|
|
6824
|
-
|
|
6884
|
+
path8.resolve(
|
|
6825
6885
|
currentDirectory,
|
|
6826
6886
|
"../../modules/file-parser/node_modules/oxc-parser"
|
|
6827
6887
|
),
|
|
6828
|
-
|
|
6888
|
+
path8.resolve(
|
|
6829
6889
|
currentDirectory,
|
|
6830
6890
|
"../../../../node_modules/.pnpm/node_modules/oxc-parser"
|
|
6831
6891
|
),
|
|
6832
|
-
|
|
6892
|
+
path8.resolve(
|
|
6833
6893
|
process.cwd(),
|
|
6834
6894
|
"../../node_modules/.pnpm/node_modules/oxc-parser"
|
|
6835
6895
|
)
|
|
@@ -7310,7 +7370,7 @@ function parsePageSource(filePath, source) {
|
|
|
7310
7370
|
if (reactCanvasPage) {
|
|
7311
7371
|
return reactCanvasPage;
|
|
7312
7372
|
}
|
|
7313
|
-
const fallbackPageName2 =
|
|
7373
|
+
const fallbackPageName2 = path8.basename(path8.dirname(filePath));
|
|
7314
7374
|
const errors = [];
|
|
7315
7375
|
const result = parseSync2(filePath, source);
|
|
7316
7376
|
const programBody = Array.isArray(result.program?.body) ? result.program.body : [];
|
|
@@ -7392,13 +7452,13 @@ function toPosixPath(value) {
|
|
|
7392
7452
|
return value.replace(/\\/g, "/");
|
|
7393
7453
|
}
|
|
7394
7454
|
function toRelativeImportSpecifier(fromDir, absolutePath) {
|
|
7395
|
-
const relativePath = toPosixPath(
|
|
7455
|
+
const relativePath = toPosixPath(path9.relative(fromDir, absolutePath));
|
|
7396
7456
|
const extensionlessPath = relativePath.replace(/\.(tsx|ts|jsx|js)$/, "");
|
|
7397
7457
|
return extensionlessPath.startsWith(".") ? extensionlessPath : `./${extensionlessPath}`;
|
|
7398
7458
|
}
|
|
7399
7459
|
async function readTextFileOptional(filePath) {
|
|
7400
7460
|
try {
|
|
7401
|
-
return await
|
|
7461
|
+
return await readFile5(filePath, "utf-8");
|
|
7402
7462
|
} catch (error) {
|
|
7403
7463
|
if (error.code === "ENOENT") {
|
|
7404
7464
|
return null;
|
|
@@ -7433,7 +7493,7 @@ async function walkPagesDir(directory, collector) {
|
|
|
7433
7493
|
throw error;
|
|
7434
7494
|
}
|
|
7435
7495
|
for (const entry of entries) {
|
|
7436
|
-
const fullPath =
|
|
7496
|
+
const fullPath = path9.join(directory, entry.name);
|
|
7437
7497
|
if (entry.isDirectory()) {
|
|
7438
7498
|
await walkPagesDir(fullPath, collector);
|
|
7439
7499
|
} else if (entry.isFile() && entry.name === CANVAS_FILE_NAME) {
|
|
@@ -7448,7 +7508,7 @@ var CanvasRegistry = class {
|
|
|
7448
7508
|
this.requestedCanvasesQueue = Promise.resolve();
|
|
7449
7509
|
this.projectRoot = projectRoot;
|
|
7450
7510
|
this.tempoRoot = tempoRoot;
|
|
7451
|
-
this.requestedCanvasesPath =
|
|
7511
|
+
this.requestedCanvasesPath = path9.join(
|
|
7452
7512
|
tempoRoot,
|
|
7453
7513
|
".tempo",
|
|
7454
7514
|
REQUESTED_CANVASES_FILE_NAME
|
|
@@ -7472,9 +7532,9 @@ var CanvasRegistry = class {
|
|
|
7472
7532
|
}
|
|
7473
7533
|
buildEntry(absolutePath) {
|
|
7474
7534
|
return {
|
|
7475
|
-
importPath: toPosixPath(
|
|
7535
|
+
importPath: toPosixPath(path9.relative(this.projectRoot, absolutePath)),
|
|
7476
7536
|
importSpecifier: toRelativeImportSpecifier(
|
|
7477
|
-
|
|
7537
|
+
path9.join(this.tempoRoot, ".tempo"),
|
|
7478
7538
|
absolutePath
|
|
7479
7539
|
)
|
|
7480
7540
|
};
|
|
@@ -7511,17 +7571,17 @@ var CanvasRegistry = class {
|
|
|
7511
7571
|
if (typeof relativePath !== "string" || relativePath.length === 0) {
|
|
7512
7572
|
return null;
|
|
7513
7573
|
}
|
|
7514
|
-
const absolutePath =
|
|
7574
|
+
const absolutePath = path9.resolve(this.projectRoot, relativePath);
|
|
7515
7575
|
const normalizedRelative = toPosixPath(
|
|
7516
|
-
|
|
7576
|
+
path9.relative(this.projectRoot, absolutePath)
|
|
7517
7577
|
);
|
|
7518
|
-
if (normalizedRelative === ".." || normalizedRelative.startsWith("../") ||
|
|
7578
|
+
if (normalizedRelative === ".." || normalizedRelative.startsWith("../") || path9.isAbsolute(normalizedRelative)) {
|
|
7519
7579
|
return null;
|
|
7520
7580
|
}
|
|
7521
7581
|
return absolutePath;
|
|
7522
7582
|
}
|
|
7523
7583
|
toRequestedPath(absolutePath) {
|
|
7524
|
-
return toPosixPath(
|
|
7584
|
+
return toPosixPath(path9.relative(this.projectRoot, absolutePath));
|
|
7525
7585
|
}
|
|
7526
7586
|
async readRequestedCanvasPaths() {
|
|
7527
7587
|
const source = await readTextFileOptional(this.requestedCanvasesPath);
|
|
@@ -7558,7 +7618,7 @@ var CanvasRegistry = class {
|
|
|
7558
7618
|
return mergedPaths;
|
|
7559
7619
|
}
|
|
7560
7620
|
async writeRequestedCanvasPaths(requestedPaths) {
|
|
7561
|
-
await mkdir4(
|
|
7621
|
+
await mkdir4(path9.dirname(this.requestedCanvasesPath), { recursive: true });
|
|
7562
7622
|
await atomicWriteText2(
|
|
7563
7623
|
this.requestedCanvasesPath,
|
|
7564
7624
|
JSON.stringify({ version: 1, canvases: requestedPaths }, null, 2)
|
|
@@ -7589,7 +7649,7 @@ var CanvasRegistry = class {
|
|
|
7589
7649
|
async canvasFileExistsWithRecheck(absolutePath) {
|
|
7590
7650
|
for (let attempt = 0; ; attempt += 1) {
|
|
7591
7651
|
try {
|
|
7592
|
-
await
|
|
7652
|
+
await readFile5(absolutePath, "utf-8");
|
|
7593
7653
|
return true;
|
|
7594
7654
|
} catch (error) {
|
|
7595
7655
|
if (error.code !== "ENOENT") {
|
|
@@ -7615,10 +7675,10 @@ var CanvasRegistry = class {
|
|
|
7615
7675
|
);
|
|
7616
7676
|
}
|
|
7617
7677
|
async ensureReactCanvasHostEntry(canvasFile) {
|
|
7618
|
-
const absolutePath =
|
|
7678
|
+
const absolutePath = path9.resolve(canvasFile);
|
|
7619
7679
|
let source;
|
|
7620
7680
|
try {
|
|
7621
|
-
source = await
|
|
7681
|
+
source = await readFile5(absolutePath, "utf-8");
|
|
7622
7682
|
} catch (error) {
|
|
7623
7683
|
if (error.code === "ENOENT") {
|
|
7624
7684
|
return null;
|
|
@@ -7692,8 +7752,8 @@ var ProcessHintSlots = class {
|
|
|
7692
7752
|
};
|
|
7693
7753
|
|
|
7694
7754
|
// ../tempo-devserver/package-manager.ts
|
|
7695
|
-
import { access, readFile as
|
|
7696
|
-
import
|
|
7755
|
+
import { access, readFile as readFile6 } from "fs/promises";
|
|
7756
|
+
import path10 from "path";
|
|
7697
7757
|
var INSTALL_COMMAND_BY_PM = {
|
|
7698
7758
|
bun: "bun install",
|
|
7699
7759
|
pnpm: "pnpm install --no-frozen-lockfile",
|
|
@@ -7720,7 +7780,7 @@ function parsePackageManagerField(value) {
|
|
|
7720
7780
|
}
|
|
7721
7781
|
async function readPackageManagerFromPackageJson(packageJsonPath) {
|
|
7722
7782
|
try {
|
|
7723
|
-
const parsed = JSON.parse(await
|
|
7783
|
+
const parsed = JSON.parse(await readFile6(packageJsonPath, "utf-8"));
|
|
7724
7784
|
return parsePackageManagerField(parsed.packageManager);
|
|
7725
7785
|
} catch {
|
|
7726
7786
|
return null;
|
|
@@ -7736,32 +7796,32 @@ var OWNERSHIP_MARKER_PRIORITY = [
|
|
|
7736
7796
|
];
|
|
7737
7797
|
async function detectPackageManagerMarkerInDir(dir) {
|
|
7738
7798
|
const fromPackageJson = await readPackageManagerFromPackageJson(
|
|
7739
|
-
|
|
7799
|
+
path10.join(dir, "package.json")
|
|
7740
7800
|
);
|
|
7741
7801
|
if (fromPackageJson) return fromPackageJson;
|
|
7742
7802
|
for (const candidate of OWNERSHIP_MARKER_PRIORITY) {
|
|
7743
|
-
if (await fileExists(
|
|
7803
|
+
if (await fileExists(path10.join(dir, candidate.file))) {
|
|
7744
7804
|
return { pm: candidate.pm };
|
|
7745
7805
|
}
|
|
7746
7806
|
}
|
|
7747
7807
|
return null;
|
|
7748
7808
|
}
|
|
7749
7809
|
async function detectOwningPackageManager(packageRoot) {
|
|
7750
|
-
const resolvedRoot =
|
|
7751
|
-
if (!await fileExists(
|
|
7810
|
+
const resolvedRoot = path10.resolve(packageRoot);
|
|
7811
|
+
if (!await fileExists(path10.join(resolvedRoot, "package.json"))) {
|
|
7752
7812
|
return null;
|
|
7753
7813
|
}
|
|
7754
|
-
for (let dir = resolvedRoot; ; dir =
|
|
7814
|
+
for (let dir = resolvedRoot; ; dir = path10.dirname(dir)) {
|
|
7755
7815
|
const pin = await detectPackageManagerMarkerInDir(dir);
|
|
7756
7816
|
if (pin) return { ...pin, installCmd: INSTALL_COMMAND_BY_PM[pin.pm] };
|
|
7757
|
-
if (
|
|
7817
|
+
if (path10.dirname(dir) === dir) break;
|
|
7758
7818
|
}
|
|
7759
7819
|
return { pm: "npm", installCmd: "npm install" };
|
|
7760
7820
|
}
|
|
7761
7821
|
|
|
7762
7822
|
// ../tempo-devserver/project-node-version.ts
|
|
7763
|
-
import { access as access2, readFile as
|
|
7764
|
-
import
|
|
7823
|
+
import { access as access2, readFile as readFile7, readdir as readdir3 } from "fs/promises";
|
|
7824
|
+
import path11 from "path";
|
|
7765
7825
|
function parseTriple(value) {
|
|
7766
7826
|
const match = value.trim().replace(/^v/i, "").match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/);
|
|
7767
7827
|
if (!match?.[1]) return null;
|
|
@@ -7892,15 +7952,15 @@ async function pathExists(candidate) {
|
|
|
7892
7952
|
async function readProjectNodeRequirement(startDir) {
|
|
7893
7953
|
const engines = [];
|
|
7894
7954
|
let versionFileSpec = null;
|
|
7895
|
-
for (let dir =
|
|
7896
|
-
const packageJson = await
|
|
7955
|
+
for (let dir = path11.resolve(startDir); ; dir = path11.dirname(dir)) {
|
|
7956
|
+
const packageJson = await readFile7(path11.join(dir, "package.json"), "utf-8").then((raw) => JSON.parse(raw)).catch(() => null);
|
|
7897
7957
|
const range = packageJson?.engines?.node;
|
|
7898
7958
|
if (typeof range === "string" && range.trim() && range.trim() !== "*") {
|
|
7899
7959
|
engines.push({ range: range.trim(), dir });
|
|
7900
7960
|
}
|
|
7901
7961
|
if (versionFileSpec === null) {
|
|
7902
7962
|
for (const file of [".nvmrc", ".node-version"]) {
|
|
7903
|
-
const raw = await
|
|
7963
|
+
const raw = await readFile7(path11.join(dir, file), "utf-8").catch(
|
|
7904
7964
|
() => null
|
|
7905
7965
|
);
|
|
7906
7966
|
const trimmed = raw?.trim();
|
|
@@ -7910,10 +7970,10 @@ async function readProjectNodeRequirement(startDir) {
|
|
|
7910
7970
|
}
|
|
7911
7971
|
}
|
|
7912
7972
|
}
|
|
7913
|
-
const atBoundary = await pathExists(
|
|
7914
|
-
BOUNDARY_LOCKFILES.map((file) => pathExists(
|
|
7973
|
+
const atBoundary = await pathExists(path11.join(dir, ".git")) || (await Promise.all(
|
|
7974
|
+
BOUNDARY_LOCKFILES.map((file) => pathExists(path11.join(dir, file)))
|
|
7915
7975
|
)).some(Boolean);
|
|
7916
|
-
if (atBoundary ||
|
|
7976
|
+
if (atBoundary || path11.dirname(dir) === dir) break;
|
|
7917
7977
|
}
|
|
7918
7978
|
return { engines, versionFileSpec };
|
|
7919
7979
|
}
|
|
@@ -7925,8 +7985,8 @@ async function discoverVersionManagerNodes(options) {
|
|
|
7925
7985
|
for (const entry of entries) {
|
|
7926
7986
|
const parsed = parseTriple(entry);
|
|
7927
7987
|
if (!parsed || parsed.precision !== 3) continue;
|
|
7928
|
-
const binDir = layout === "bin-subdir" ?
|
|
7929
|
-
const nodeBinary =
|
|
7988
|
+
const binDir = layout === "bin-subdir" ? path11.join(versionsDir, entry, "bin") : path11.join(versionsDir, entry);
|
|
7989
|
+
const nodeBinary = path11.join(
|
|
7930
7990
|
binDir,
|
|
7931
7991
|
platform === "win32" ? "node.exe" : "node"
|
|
7932
7992
|
);
|
|
@@ -7939,10 +7999,10 @@ async function discoverVersionManagerNodes(options) {
|
|
|
7939
7999
|
}
|
|
7940
8000
|
};
|
|
7941
8001
|
if (platform !== "win32") {
|
|
7942
|
-
const nvmDir = env.NVM_DIR?.trim() ||
|
|
7943
|
-
await collect(
|
|
7944
|
-
const nodenvRoot = env.NODENV_ROOT?.trim() ||
|
|
7945
|
-
await collect(
|
|
8002
|
+
const nvmDir = env.NVM_DIR?.trim() || path11.join(homeDir, ".nvm");
|
|
8003
|
+
await collect(path11.join(nvmDir, "versions", "node"), "nvm", "bin-subdir");
|
|
8004
|
+
const nodenvRoot = env.NODENV_ROOT?.trim() || path11.join(homeDir, ".nodenv");
|
|
8005
|
+
await collect(path11.join(nodenvRoot, "versions"), "nodenv", "bin-subdir");
|
|
7946
8006
|
}
|
|
7947
8007
|
if (env.NVM_HOME?.trim()) {
|
|
7948
8008
|
await collect(env.NVM_HOME.trim(), "nvm-windows", "flat");
|
|
@@ -7991,8 +8051,8 @@ function buildUnsatisfiedNodeHint(args) {
|
|
|
7991
8051
|
}
|
|
7992
8052
|
|
|
7993
8053
|
// ../tempo-devserver/sdk-upgrade-plan.ts
|
|
7994
|
-
import { access as access3, readFile as
|
|
7995
|
-
import
|
|
8054
|
+
import { access as access3, readFile as readFile8 } from "fs/promises";
|
|
8055
|
+
import path12 from "path";
|
|
7996
8056
|
var INSTALL_MARKERS = [
|
|
7997
8057
|
// Order matters, same rationale as pm-detect: a tree carrying both bun.lock
|
|
7998
8058
|
// and package-lock.json is a bun tree with a stale npm lockfile.
|
|
@@ -8054,9 +8114,9 @@ function buildCommands(pm, yarnBerry, metadataCacheDir, ignorePnpmWorkspace) {
|
|
|
8054
8114
|
}
|
|
8055
8115
|
}
|
|
8056
8116
|
async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
8057
|
-
const resolvedRoot =
|
|
8058
|
-
const declared = await
|
|
8059
|
-
|
|
8117
|
+
const resolvedRoot = path12.resolve(tempoRoot);
|
|
8118
|
+
const declared = await readFile8(
|
|
8119
|
+
path12.join(resolvedRoot, "package.json"),
|
|
8060
8120
|
"utf-8"
|
|
8061
8121
|
).then((raw) => {
|
|
8062
8122
|
const parsed = JSON.parse(raw);
|
|
@@ -8065,7 +8125,7 @@ async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
|
8065
8125
|
const owner = await findInstallOwner(resolvedRoot);
|
|
8066
8126
|
const resolvedPm = declared ?? owner?.pm ?? "npm";
|
|
8067
8127
|
const governedByAncestorWorkspace = owner !== null && owner.dir !== resolvedRoot;
|
|
8068
|
-
const hasOwnPnpmWorkspace = resolvedPm === "pnpm" && await fileExists2(
|
|
8128
|
+
const hasOwnPnpmWorkspace = resolvedPm === "pnpm" && await fileExists2(path12.join(resolvedRoot, "pnpm-workspace.yaml"));
|
|
8069
8129
|
return {
|
|
8070
8130
|
packageManager: resolvedPm,
|
|
8071
8131
|
cwd: resolvedRoot,
|
|
@@ -8079,21 +8139,21 @@ async function resolveTempoSdkUpgradePlan(tempoRoot, options = {}) {
|
|
|
8079
8139
|
};
|
|
8080
8140
|
}
|
|
8081
8141
|
async function findInstallOwner(startDir) {
|
|
8082
|
-
for (let dir = startDir; ; dir =
|
|
8142
|
+
for (let dir = startDir; ; dir = path12.dirname(dir)) {
|
|
8083
8143
|
for (const candidate of INSTALL_MARKERS) {
|
|
8084
|
-
const markerPath =
|
|
8144
|
+
const markerPath = path12.join(dir, candidate.file);
|
|
8085
8145
|
if (!await fileExists2(markerPath)) continue;
|
|
8086
8146
|
return {
|
|
8087
8147
|
dir,
|
|
8088
8148
|
pm: candidate.pm,
|
|
8089
8149
|
...candidate.pm === "yarn" ? {
|
|
8090
|
-
yarnLockContents: await
|
|
8150
|
+
yarnLockContents: await readFile8(markerPath, "utf-8").catch(
|
|
8091
8151
|
() => ""
|
|
8092
8152
|
)
|
|
8093
8153
|
} : {}
|
|
8094
8154
|
};
|
|
8095
8155
|
}
|
|
8096
|
-
if (
|
|
8156
|
+
if (path12.dirname(dir) === dir) return null;
|
|
8097
8157
|
}
|
|
8098
8158
|
}
|
|
8099
8159
|
|
|
@@ -8101,13 +8161,13 @@ async function findInstallOwner(startDir) {
|
|
|
8101
8161
|
import {
|
|
8102
8162
|
lstat as lstat3,
|
|
8103
8163
|
mkdir as mkdir5,
|
|
8104
|
-
readFile as
|
|
8164
|
+
readFile as readFile9,
|
|
8105
8165
|
realpath as realpath2,
|
|
8106
8166
|
rm as rm4,
|
|
8107
8167
|
symlink,
|
|
8108
8168
|
writeFile as writeFile5
|
|
8109
8169
|
} from "fs/promises";
|
|
8110
|
-
import
|
|
8170
|
+
import path13 from "path";
|
|
8111
8171
|
var TEMPO_SDK_SOURCE_ENV = "TEMPO_MONOREPO_SDK_SOURCE";
|
|
8112
8172
|
var LOCAL_SDK_MARKER_FILE = "local-tempo-sdk.json";
|
|
8113
8173
|
async function realpathIfPresent(filePath) {
|
|
@@ -8123,7 +8183,7 @@ async function realpathIfPresent(filePath) {
|
|
|
8123
8183
|
async function isTempoSdkRoot(candidate) {
|
|
8124
8184
|
try {
|
|
8125
8185
|
const manifest = JSON.parse(
|
|
8126
|
-
await
|
|
8186
|
+
await readFile9(path13.join(candidate, "package.json"), "utf8")
|
|
8127
8187
|
);
|
|
8128
8188
|
return manifest.name === "tempo-sdk";
|
|
8129
8189
|
} catch {
|
|
@@ -8131,10 +8191,10 @@ async function isTempoSdkRoot(candidate) {
|
|
|
8131
8191
|
}
|
|
8132
8192
|
}
|
|
8133
8193
|
async function discoverLocalSdkRoot(start) {
|
|
8134
|
-
for (let current =
|
|
8135
|
-
const candidate =
|
|
8194
|
+
for (let current = path13.resolve(start); ; current = path13.dirname(current)) {
|
|
8195
|
+
const candidate = path13.join(current, "tempo-modules", "tempo-sdk");
|
|
8136
8196
|
if (await isTempoSdkRoot(candidate)) return candidate;
|
|
8137
|
-
if (
|
|
8197
|
+
if (path13.dirname(current) === current) return null;
|
|
8138
8198
|
}
|
|
8139
8199
|
}
|
|
8140
8200
|
async function assertLocalSdkPrebuilt(localSdkRoot) {
|
|
@@ -8142,7 +8202,7 @@ async function assertLocalSdkPrebuilt(localSdkRoot) {
|
|
|
8142
8202
|
const missingOutputs = (await Promise.all(
|
|
8143
8203
|
requiredOutputs.map(async (relativePath) => ({
|
|
8144
8204
|
relativePath,
|
|
8145
|
-
present: await realpathIfPresent(
|
|
8205
|
+
present: await realpathIfPresent(path13.join(localSdkRoot, relativePath)) !== null
|
|
8146
8206
|
}))
|
|
8147
8207
|
)).filter(({ present }) => !present).map(({ relativePath }) => relativePath);
|
|
8148
8208
|
if (missingOutputs.length === 0) return;
|
|
@@ -8158,8 +8218,8 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
8158
8218
|
);
|
|
8159
8219
|
}
|
|
8160
8220
|
const mode = options.mode ?? (configuredMode === "local-prebuilt" ? configuredMode : "published");
|
|
8161
|
-
const installedSdkRoot =
|
|
8162
|
-
const markerPath =
|
|
8221
|
+
const installedSdkRoot = path13.join(tempoRoot, "node_modules", "tempo-sdk");
|
|
8222
|
+
const markerPath = path13.join(tempoRoot, ".tempo", LOCAL_SDK_MARKER_FILE);
|
|
8163
8223
|
if (mode === "local-prebuilt") {
|
|
8164
8224
|
const localSdkRoot = options.localSdkRoot ?? await discoverLocalSdkRoot(options.discoveryStart ?? process.cwd());
|
|
8165
8225
|
if (!localSdkRoot || !await isTempoSdkRoot(localSdkRoot)) {
|
|
@@ -8174,14 +8234,14 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
8174
8234
|
]);
|
|
8175
8235
|
if (resolvedInstalledSdk !== resolvedLocalSdk) {
|
|
8176
8236
|
await rm4(installedSdkRoot, { force: true, recursive: true });
|
|
8177
|
-
await mkdir5(
|
|
8237
|
+
await mkdir5(path13.dirname(installedSdkRoot), { recursive: true });
|
|
8178
8238
|
await symlink(
|
|
8179
8239
|
resolvedLocalSdk,
|
|
8180
8240
|
installedSdkRoot,
|
|
8181
8241
|
process.platform === "win32" ? "junction" : "dir"
|
|
8182
8242
|
);
|
|
8183
8243
|
}
|
|
8184
|
-
await mkdir5(
|
|
8244
|
+
await mkdir5(path13.dirname(markerPath), { recursive: true });
|
|
8185
8245
|
await writeFile5(
|
|
8186
8246
|
markerPath,
|
|
8187
8247
|
`${JSON.stringify({ localSdkRoot: resolvedLocalSdk }, null, 2)}
|
|
@@ -8189,7 +8249,7 @@ async function prepareTempoSdkDevSource(tempoRoot, options = {}) {
|
|
|
8189
8249
|
);
|
|
8190
8250
|
return { source: "local", localSdkRoot: resolvedLocalSdk };
|
|
8191
8251
|
}
|
|
8192
|
-
const marker = await
|
|
8252
|
+
const marker = await readFile9(markerPath, "utf8").then((raw) => JSON.parse(raw)).catch(() => null);
|
|
8193
8253
|
if (!marker) return { source: "published", removedLocalLink: false };
|
|
8194
8254
|
let removedLocalLink = false;
|
|
8195
8255
|
if (typeof marker.localSdkRoot === "string") {
|
|
@@ -8279,9 +8339,9 @@ var MANAGED_WATCH_OPTIONS = {
|
|
|
8279
8339
|
}
|
|
8280
8340
|
};
|
|
8281
8341
|
function resolveRuntimePaths(tempoConfigPath) {
|
|
8282
|
-
const resolvedConfigPath =
|
|
8283
|
-
const tempoRoot =
|
|
8284
|
-
const projectRoot =
|
|
8342
|
+
const resolvedConfigPath = path14.resolve(tempoConfigPath);
|
|
8343
|
+
const tempoRoot = path14.dirname(resolvedConfigPath);
|
|
8344
|
+
const projectRoot = path14.basename(tempoRoot) === TEMPO_DIR_NAME ? path14.dirname(tempoRoot) : tempoRoot;
|
|
8285
8345
|
let canvasesPath = DEFAULT_CANVASES_DIR;
|
|
8286
8346
|
try {
|
|
8287
8347
|
const raw = JSON.parse(fs.readFileSync(resolvedConfigPath, "utf-8"));
|
|
@@ -8293,20 +8353,20 @@ function resolveRuntimePaths(tempoConfigPath) {
|
|
|
8293
8353
|
return {
|
|
8294
8354
|
projectRoot,
|
|
8295
8355
|
tempoRoot,
|
|
8296
|
-
pagesDir:
|
|
8356
|
+
pagesDir: path14.resolve(tempoRoot, canvasesPath)
|
|
8297
8357
|
};
|
|
8298
8358
|
}
|
|
8299
8359
|
function isManagedDevServerPath(eventRelativePath, roots) {
|
|
8300
8360
|
const relativePath = toPosixPath(eventRelativePath);
|
|
8301
|
-
const tempoDir =
|
|
8361
|
+
const tempoDir = path14.join(roots.tempoRoot, ".tempo");
|
|
8302
8362
|
const managedRelativePaths = [
|
|
8303
8363
|
roots.tempoConfigPath,
|
|
8304
8364
|
roots.pagesDir,
|
|
8305
8365
|
...MANAGED_TEMPO_DIR_FILE_NAMES.map(
|
|
8306
|
-
(fileName) =>
|
|
8366
|
+
(fileName) => path14.join(tempoDir, fileName)
|
|
8307
8367
|
)
|
|
8308
8368
|
].map(
|
|
8309
|
-
(managedPath) => toPosixPath(
|
|
8369
|
+
(managedPath) => toPosixPath(path14.relative(roots.projectRoot, managedPath))
|
|
8310
8370
|
).filter((value) => value.length > 0 && !value.startsWith("../"));
|
|
8311
8371
|
return managedRelativePaths.some(
|
|
8312
8372
|
(managedPath) => relativePath === managedPath || relativePath.startsWith(`${managedPath}/`) || managedPath.startsWith(`${relativePath}/`)
|
|
@@ -9058,7 +9118,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9058
9118
|
this.tempoRoot = paths.tempoRoot;
|
|
9059
9119
|
this.pagesDir = paths.pagesDir;
|
|
9060
9120
|
this.commandCwd = paths.tempoRoot;
|
|
9061
|
-
this.processMarkerPath =
|
|
9121
|
+
this.processMarkerPath = path14.join(
|
|
9062
9122
|
paths.tempoRoot,
|
|
9063
9123
|
".tempo",
|
|
9064
9124
|
TEMPO_PROCESS_MARKER_FILE
|
|
@@ -9189,14 +9249,14 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9189
9249
|
void this.persistRecentExits();
|
|
9190
9250
|
}
|
|
9191
9251
|
recentExitsFilePath() {
|
|
9192
|
-
return
|
|
9252
|
+
return path14.join(this.tempoRoot, ".tempo", TEMPO_RECENT_EXITS_FILE);
|
|
9193
9253
|
}
|
|
9194
9254
|
// Fire-and-forget mirror of the exit log to disk. Best-effort: a failed write
|
|
9195
9255
|
// just means a fresh supervisor won't see this crash, which is no worse than
|
|
9196
9256
|
// before persistence existed.
|
|
9197
9257
|
async persistRecentExits() {
|
|
9198
9258
|
try {
|
|
9199
|
-
await mkdir6(
|
|
9259
|
+
await mkdir6(path14.dirname(this.recentExitsFilePath()), {
|
|
9200
9260
|
recursive: true
|
|
9201
9261
|
});
|
|
9202
9262
|
await atomicWriteText2(
|
|
@@ -9462,7 +9522,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9462
9522
|
sdkInstallReceipts.set(
|
|
9463
9523
|
root,
|
|
9464
9524
|
await pathExists2(
|
|
9465
|
-
|
|
9525
|
+
path14.join(
|
|
9466
9526
|
root,
|
|
9467
9527
|
"node_modules",
|
|
9468
9528
|
EXTERNAL_LAYOUT_INSTALL_MARKER
|
|
@@ -9476,7 +9536,8 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9476
9536
|
command,
|
|
9477
9537
|
cwd,
|
|
9478
9538
|
signal,
|
|
9479
|
-
options?.onInstallOutput
|
|
9539
|
+
options?.onInstallOutput,
|
|
9540
|
+
this.projectRoot
|
|
9480
9541
|
);
|
|
9481
9542
|
sdkCommandCompleted = true;
|
|
9482
9543
|
}
|
|
@@ -9702,7 +9763,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9702
9763
|
try {
|
|
9703
9764
|
for (const step of steps) {
|
|
9704
9765
|
throwIfLaunchAborted(signal);
|
|
9705
|
-
await runInstallStep(step, signal, onOutput);
|
|
9766
|
+
await runInstallStep(step, signal, onOutput, this.projectRoot);
|
|
9706
9767
|
}
|
|
9707
9768
|
} catch (error) {
|
|
9708
9769
|
throwIfLaunchAborted(signal);
|
|
@@ -9715,7 +9776,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9715
9776
|
);
|
|
9716
9777
|
for (const step of localSteps) {
|
|
9717
9778
|
throwIfLaunchAborted(signal);
|
|
9718
|
-
await runInstallStep(step, signal, onOutput);
|
|
9779
|
+
await runInstallStep(step, signal, onOutput, this.projectRoot);
|
|
9719
9780
|
}
|
|
9720
9781
|
}
|
|
9721
9782
|
};
|
|
@@ -9820,7 +9881,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9820
9881
|
return filterProtectedInstallSteps(steps);
|
|
9821
9882
|
}
|
|
9822
9883
|
async selectNodeRuntimeForStart() {
|
|
9823
|
-
const packageJson = await readJsonFile(
|
|
9884
|
+
const packageJson = await readJsonFile(path14.join(this.tempoRoot, "package.json"));
|
|
9824
9885
|
const viteSpec = packageJson?.dependencies?.vite ?? packageJson?.devDependencies?.vite;
|
|
9825
9886
|
const viteMajor = typeof viteSpec === "string" ? parseFirstSemverMajor(viteSpec) : null;
|
|
9826
9887
|
const requireFloor = viteMajor != null && viteMajor >= 7;
|
|
@@ -9891,7 +9952,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9891
9952
|
async readExpectedHostIdentity() {
|
|
9892
9953
|
const framework = await this.resolveStartFramework();
|
|
9893
9954
|
if (framework === "expo") return null;
|
|
9894
|
-
const noncePath =
|
|
9955
|
+
const noncePath = path14.join(this.tempoRoot, ".tempo", "workspace-nonce");
|
|
9895
9956
|
const workspaceNonce = (await readTextFileOptional(noncePath))?.trim();
|
|
9896
9957
|
if (!workspaceNonce) {
|
|
9897
9958
|
devLog("supervisor:workspace_nonce_unavailable", {
|
|
@@ -9909,7 +9970,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9909
9970
|
if (isExpoStartCommand(this.config.scripts.start)) {
|
|
9910
9971
|
return true;
|
|
9911
9972
|
}
|
|
9912
|
-
const packageJson = await readJsonFile(
|
|
9973
|
+
const packageJson = await readJsonFile(path14.join(this.tempoRoot, "package.json"));
|
|
9913
9974
|
return Boolean(
|
|
9914
9975
|
packageJson?.dependencies?.expo ?? packageJson?.devDependencies?.expo
|
|
9915
9976
|
);
|
|
@@ -9941,10 +10002,10 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9941
10002
|
* of trusted and later crashing Vite at startup.
|
|
9942
10003
|
*/
|
|
9943
10004
|
async tempoInstallReady() {
|
|
9944
|
-
const packageJsonPath =
|
|
10005
|
+
const packageJsonPath = path14.join(this.tempoRoot, "package.json");
|
|
9945
10006
|
let raw;
|
|
9946
10007
|
try {
|
|
9947
|
-
raw = await
|
|
10008
|
+
raw = await readFile10(packageJsonPath, "utf-8");
|
|
9948
10009
|
} catch {
|
|
9949
10010
|
return true;
|
|
9950
10011
|
}
|
|
@@ -9969,7 +10030,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9969
10030
|
return await installCompletedForCurrentDeps(this.tempoRoot);
|
|
9970
10031
|
}
|
|
9971
10032
|
for (const name of declared) {
|
|
9972
|
-
const depPath =
|
|
10033
|
+
const depPath = path14.join(this.tempoRoot, "node_modules", name);
|
|
9973
10034
|
try {
|
|
9974
10035
|
await access4(depPath);
|
|
9975
10036
|
} catch {
|
|
@@ -9982,7 +10043,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9982
10043
|
return await installCompletedForCurrentDeps(this.projectRoot) && await this.projectRootDepsPresentOrNotRequired();
|
|
9983
10044
|
}
|
|
9984
10045
|
async projectRootDepsPresentOrNotRequired(acceptExternalLayoutProof = true) {
|
|
9985
|
-
const rootPackageJson =
|
|
10046
|
+
const rootPackageJson = path14.join(this.projectRoot, "package.json");
|
|
9986
10047
|
const packageJson = await readJsonFile(rootPackageJson);
|
|
9987
10048
|
if (!packageJson) {
|
|
9988
10049
|
return true;
|
|
@@ -9997,7 +10058,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
9997
10058
|
}
|
|
9998
10059
|
for (const name of declared) {
|
|
9999
10060
|
try {
|
|
10000
|
-
await access4(
|
|
10061
|
+
await access4(path14.join(this.projectRoot, "node_modules", name));
|
|
10001
10062
|
} catch {
|
|
10002
10063
|
return false;
|
|
10003
10064
|
}
|
|
@@ -10023,25 +10084,25 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10023
10084
|
}
|
|
10024
10085
|
}
|
|
10025
10086
|
nextDistClaimsDir() {
|
|
10026
|
-
return
|
|
10087
|
+
return path14.join(this.tempoRoot, ".tempo", TEMPO_NEXT_CLAIMS_DIR);
|
|
10027
10088
|
}
|
|
10028
10089
|
nextDistCachePath(distDir) {
|
|
10029
|
-
return
|
|
10090
|
+
return path14.resolve(this.commandCwd, distDir);
|
|
10030
10091
|
}
|
|
10031
10092
|
nextDistClaimPath(distDir) {
|
|
10032
|
-
return
|
|
10093
|
+
return path14.join(
|
|
10033
10094
|
this.nextDistClaimsDir(),
|
|
10034
|
-
`${
|
|
10095
|
+
`${path14.basename(distDir)}.json`
|
|
10035
10096
|
);
|
|
10036
10097
|
}
|
|
10037
10098
|
async tryClaimNextDistDir(distDir) {
|
|
10038
10099
|
const cachePath = this.nextDistCachePath(distDir);
|
|
10039
10100
|
const claimPath = this.nextDistClaimPath(distDir);
|
|
10040
10101
|
await mkdir6(cachePath, { recursive: true });
|
|
10041
|
-
await writeFile6(
|
|
10102
|
+
await writeFile6(path14.join(cachePath, TEMPO_NEXT_CACHE_MARKER), "1\n", {
|
|
10042
10103
|
flag: "a"
|
|
10043
10104
|
});
|
|
10044
|
-
await mkdir6(
|
|
10105
|
+
await mkdir6(path14.dirname(claimPath), { recursive: true });
|
|
10045
10106
|
const token = randomUUID2();
|
|
10046
10107
|
const processStartedAt = await readProcessStartedAt(process.pid);
|
|
10047
10108
|
const claimText = `${JSON.stringify({
|
|
@@ -10076,7 +10137,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10076
10137
|
}
|
|
10077
10138
|
async selectSuffixedNextDistDir() {
|
|
10078
10139
|
await this.releaseNextDistDirClaim();
|
|
10079
|
-
const nextRoot =
|
|
10140
|
+
const nextRoot = path14.join(this.commandCwd, ".next");
|
|
10080
10141
|
const existing = await readdir4(nextRoot, { withFileTypes: true }).catch(
|
|
10081
10142
|
() => []
|
|
10082
10143
|
);
|
|
@@ -10085,9 +10146,9 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10085
10146
|
if (!entry.isDirectory() || !/^tempo-[a-z0-9]+$/i.test(entry.name)) {
|
|
10086
10147
|
continue;
|
|
10087
10148
|
}
|
|
10088
|
-
const cachePath =
|
|
10149
|
+
const cachePath = path14.join(nextRoot, entry.name);
|
|
10089
10150
|
try {
|
|
10090
|
-
await access4(
|
|
10151
|
+
await access4(path14.join(cachePath, TEMPO_NEXT_CACHE_MARKER));
|
|
10091
10152
|
const cacheStat = await stat3(cachePath);
|
|
10092
10153
|
reusable.push({
|
|
10093
10154
|
distDir: `.next/${entry.name}`,
|
|
@@ -10123,7 +10184,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10123
10184
|
await this.sweepNextDistDirs();
|
|
10124
10185
|
}
|
|
10125
10186
|
async sweepNextDistDirs() {
|
|
10126
|
-
const nextRoot =
|
|
10187
|
+
const nextRoot = path14.join(this.commandCwd, ".next");
|
|
10127
10188
|
const entries = await readdir4(nextRoot, { withFileTypes: true }).catch(
|
|
10128
10189
|
() => []
|
|
10129
10190
|
);
|
|
@@ -10131,7 +10192,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10131
10192
|
const unclaimedManaged = [];
|
|
10132
10193
|
for (const entry of entries) {
|
|
10133
10194
|
if (!entry.isDirectory()) continue;
|
|
10134
|
-
const cachePath =
|
|
10195
|
+
const cachePath = path14.join(nextRoot, entry.name);
|
|
10135
10196
|
if (/^tempo-sidestep-/i.test(entry.name)) {
|
|
10136
10197
|
const cacheStat2 = await stat3(cachePath).catch(() => null);
|
|
10137
10198
|
if (cacheStat2 && now - cacheStat2.mtimeMs > TEMPO_NEXT_LEGACY_CACHE_MAX_AGE_MS) {
|
|
@@ -10142,7 +10203,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10142
10203
|
}
|
|
10143
10204
|
if (!/^tempo-[a-z0-9]+$/i.test(entry.name)) continue;
|
|
10144
10205
|
try {
|
|
10145
|
-
await access4(
|
|
10206
|
+
await access4(path14.join(cachePath, TEMPO_NEXT_CACHE_MARKER));
|
|
10146
10207
|
} catch {
|
|
10147
10208
|
const cacheStat2 = await stat3(cachePath).catch(() => null);
|
|
10148
10209
|
if (cacheStat2 && now - cacheStat2.mtimeMs > TEMPO_NEXT_LEGACY_CACHE_MAX_AGE_MS) {
|
|
@@ -10172,13 +10233,13 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10172
10233
|
async ensureDevserverWatchdogScript() {
|
|
10173
10234
|
const enabled = process.env.TEMPO_DEVSERVER_WATCHDOG !== "0";
|
|
10174
10235
|
if (!enabled) return null;
|
|
10175
|
-
const watchdogPath =
|
|
10236
|
+
const watchdogPath = path14.join(
|
|
10176
10237
|
this.tempoRoot,
|
|
10177
10238
|
".tempo",
|
|
10178
10239
|
DEVSERVER_WATCHDOG_FILE_NAME
|
|
10179
10240
|
);
|
|
10180
10241
|
try {
|
|
10181
|
-
await mkdir6(
|
|
10242
|
+
await mkdir6(path14.dirname(watchdogPath), { recursive: true });
|
|
10182
10243
|
await atomicWriteText2(watchdogPath, DEVSERVER_WATCHDOG_SOURCE);
|
|
10183
10244
|
return watchdogPath;
|
|
10184
10245
|
} catch {
|
|
@@ -10198,12 +10259,12 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10198
10259
|
];
|
|
10199
10260
|
for (const configFile of nextConfigPaths) {
|
|
10200
10261
|
try {
|
|
10201
|
-
await access4(
|
|
10262
|
+
await access4(path14.join(this.tempoRoot, configFile));
|
|
10202
10263
|
return true;
|
|
10203
10264
|
} catch {
|
|
10204
10265
|
}
|
|
10205
10266
|
}
|
|
10206
|
-
const packageJson = await readJsonFile(
|
|
10267
|
+
const packageJson = await readJsonFile(path14.join(this.tempoRoot, "package.json"));
|
|
10207
10268
|
return Boolean(
|
|
10208
10269
|
packageJson?.dependencies?.next ?? packageJson?.devDependencies?.next
|
|
10209
10270
|
);
|
|
@@ -10212,7 +10273,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10212
10273
|
if (!pid || !await this.isNextTempoHost()) {
|
|
10213
10274
|
return;
|
|
10214
10275
|
}
|
|
10215
|
-
await mkdir6(
|
|
10276
|
+
await mkdir6(path14.dirname(this.processMarkerPath), { recursive: true });
|
|
10216
10277
|
await writeFile6(
|
|
10217
10278
|
this.processMarkerPath,
|
|
10218
10279
|
`${JSON.stringify(
|
|
@@ -10256,7 +10317,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10256
10317
|
async listRegisteredCanvases() {
|
|
10257
10318
|
const files = await scanCanvasFiles(this.pagesDir);
|
|
10258
10319
|
return files.map(
|
|
10259
|
-
(absolutePath) => toPosixPath(
|
|
10320
|
+
(absolutePath) => toPosixPath(path14.relative(this.projectRoot, absolutePath))
|
|
10260
10321
|
);
|
|
10261
10322
|
}
|
|
10262
10323
|
/**
|
|
@@ -10681,23 +10742,23 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10681
10742
|
// — pairs with the drift-correction reconcile (a force=false
|
|
10682
10743
|
// compare-and-write pass) which actually restores drift.
|
|
10683
10744
|
async hasManagedFileDrift() {
|
|
10684
|
-
const tempoDir =
|
|
10745
|
+
const tempoDir = path14.join(this.tempoRoot, ".tempo");
|
|
10685
10746
|
const reactCanvasEntries = await this.registry.collectReactCanvasHostEntries();
|
|
10686
10747
|
const startFramework = await this.resolveStartFramework();
|
|
10687
|
-
const wrapperPath =
|
|
10748
|
+
const wrapperPath = path14.join(tempoDir, TEMPO_HOST_FILE_NAME);
|
|
10688
10749
|
const expectedWrapper = buildTempoHostWrapper(reactCanvasEntries, {
|
|
10689
10750
|
startFramework
|
|
10690
10751
|
});
|
|
10691
10752
|
if (await readTextFileOptional(wrapperPath) !== expectedWrapper) {
|
|
10692
10753
|
return true;
|
|
10693
10754
|
}
|
|
10694
|
-
const recoveryPath =
|
|
10755
|
+
const recoveryPath = path14.join(tempoDir, CANVAS_HOST_RECOVERY_FILE_NAME);
|
|
10695
10756
|
const expectedRecovery = canvasHostRecoverySourceFor(startFramework);
|
|
10696
10757
|
if (await readTextFileOptional(recoveryPath) !== expectedRecovery) {
|
|
10697
10758
|
return true;
|
|
10698
10759
|
}
|
|
10699
10760
|
for (const staleFileName of STALE_MANAGED_CANVAS_FILES) {
|
|
10700
|
-
if (await readTextFileOptional(
|
|
10761
|
+
if (await readTextFileOptional(path14.join(tempoDir, staleFileName)) !== null) {
|
|
10701
10762
|
return true;
|
|
10702
10763
|
}
|
|
10703
10764
|
}
|
|
@@ -10718,7 +10779,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10718
10779
|
this.state.generation += 1;
|
|
10719
10780
|
}
|
|
10720
10781
|
this.state.reconcileStatus = "idle";
|
|
10721
|
-
const changedBasenames = changedFiles.map((p) =>
|
|
10782
|
+
const changedBasenames = changedFiles.map((p) => path14.basename(p));
|
|
10722
10783
|
this.recordReconcileActivity({
|
|
10723
10784
|
at: Date.now(),
|
|
10724
10785
|
reason,
|
|
@@ -10796,7 +10857,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10796
10857
|
});
|
|
10797
10858
|
if (arming) {
|
|
10798
10859
|
devLog("reconcile:managed_rewrite_backoff", {
|
|
10799
|
-
file:
|
|
10860
|
+
file: path14.basename(filePath),
|
|
10800
10861
|
consecutiveRewrites,
|
|
10801
10862
|
backoffMs: _TempoDevServer.MANAGED_REWRITE_BACKOFF_MS
|
|
10802
10863
|
});
|
|
@@ -10820,8 +10881,8 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10820
10881
|
}
|
|
10821
10882
|
async reconcileGeneratedFiles(force) {
|
|
10822
10883
|
const changedFiles = [];
|
|
10823
|
-
const tempoDir =
|
|
10824
|
-
const wrapperPath =
|
|
10884
|
+
const tempoDir = path14.join(this.tempoRoot, ".tempo");
|
|
10885
|
+
const wrapperPath = path14.join(tempoDir, TEMPO_HOST_FILE_NAME);
|
|
10825
10886
|
const reactCanvasEntries = await this.registry.collectReactCanvasHostEntries();
|
|
10826
10887
|
const startFramework = await this.resolveStartFramework();
|
|
10827
10888
|
const currentWrapper = await readTextFileOptional(wrapperPath);
|
|
@@ -10837,7 +10898,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10837
10898
|
} else {
|
|
10838
10899
|
this.noteManagedFileConverged(wrapperPath);
|
|
10839
10900
|
}
|
|
10840
|
-
const recoveryPath =
|
|
10901
|
+
const recoveryPath = path14.join(tempoDir, CANVAS_HOST_RECOVERY_FILE_NAME);
|
|
10841
10902
|
const currentRecovery = await readTextFileOptional(recoveryPath);
|
|
10842
10903
|
const nextRecovery = canvasHostRecoverySourceFor(startFramework);
|
|
10843
10904
|
if (currentRecovery !== nextRecovery) {
|
|
@@ -10854,7 +10915,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10854
10915
|
this.noteManagedFileConverged(recoveryPath);
|
|
10855
10916
|
}
|
|
10856
10917
|
for (const staleFileName of STALE_MANAGED_CANVAS_FILES) {
|
|
10857
|
-
const stalePath =
|
|
10918
|
+
const stalePath = path14.join(tempoDir, staleFileName);
|
|
10858
10919
|
if (await readTextFileOptional(stalePath) !== null) {
|
|
10859
10920
|
if (this.shouldRewriteManagedFile(stalePath, force, null)) {
|
|
10860
10921
|
await rm5(stalePath, { force: true });
|
|
@@ -10868,7 +10929,7 @@ var TempoDevServer = class _TempoDevServer {
|
|
|
10868
10929
|
return changedFiles;
|
|
10869
10930
|
}
|
|
10870
10931
|
getStatusFilePath() {
|
|
10871
|
-
return
|
|
10932
|
+
return path14.join(this.tempoRoot, ".tempo", "status.json");
|
|
10872
10933
|
}
|
|
10873
10934
|
// Restore the previous session's dependencies-install cache (distrust-
|
|
10874
10935
|
// verified again before every start — see tempoInstallReady). The persisted
|
|
@@ -11107,12 +11168,12 @@ ${directCanvasSelection}
|
|
|
11107
11168
|
`;
|
|
11108
11169
|
}
|
|
11109
11170
|
function installCompletionMarkerPath(packageRoot) {
|
|
11110
|
-
return
|
|
11171
|
+
return path14.join(packageRoot, "node_modules", ".tempo-install-complete");
|
|
11111
11172
|
}
|
|
11112
11173
|
var INSTALL_COMPLETION_MARKER_VERSION = "tempo-install-complete-v3";
|
|
11113
11174
|
var EXTERNAL_LAYOUT_INSTALL_MARKER = ".tempo-external-install-complete";
|
|
11114
11175
|
async function computeInstallCompletionKey(packageRoot) {
|
|
11115
|
-
const packageJsonPath =
|
|
11176
|
+
const packageJsonPath = path14.join(packageRoot, "package.json");
|
|
11116
11177
|
const raw = await readTextFileOptional(packageJsonPath);
|
|
11117
11178
|
if (raw == null) return null;
|
|
11118
11179
|
let dependencyInput = raw;
|
|
@@ -11138,21 +11199,21 @@ async function computeInstallCompletionKey(packageRoot) {
|
|
|
11138
11199
|
"bun.lock",
|
|
11139
11200
|
"bun.lockb"
|
|
11140
11201
|
];
|
|
11141
|
-
let current =
|
|
11202
|
+
let current = path14.resolve(packageRoot);
|
|
11142
11203
|
let lockfile = null;
|
|
11143
11204
|
while (true) {
|
|
11144
11205
|
for (const name of lockfileNames) {
|
|
11145
11206
|
try {
|
|
11146
11207
|
lockfile = {
|
|
11147
|
-
path:
|
|
11148
|
-
content: await
|
|
11208
|
+
path: path14.relative(packageRoot, path14.join(current, name)),
|
|
11209
|
+
content: await readFile10(path14.join(current, name))
|
|
11149
11210
|
};
|
|
11150
11211
|
break;
|
|
11151
11212
|
} catch {
|
|
11152
11213
|
}
|
|
11153
11214
|
}
|
|
11154
11215
|
if (lockfile) break;
|
|
11155
|
-
const parent =
|
|
11216
|
+
const parent = path14.dirname(current);
|
|
11156
11217
|
if (parent === current) break;
|
|
11157
11218
|
current = parent;
|
|
11158
11219
|
}
|
|
@@ -11173,7 +11234,7 @@ async function readInstallCompletionMarker(packageRoot) {
|
|
|
11173
11234
|
async function installCompletedForCurrentDeps(packageRoot) {
|
|
11174
11235
|
const marker = await readInstallCompletionMarker(packageRoot);
|
|
11175
11236
|
if (marker === null) {
|
|
11176
|
-
return !await pathExists2(
|
|
11237
|
+
return !await pathExists2(path14.join(packageRoot, "package.json"));
|
|
11177
11238
|
}
|
|
11178
11239
|
const key2 = await computeInstallCompletionKey(packageRoot);
|
|
11179
11240
|
if (key2 == null) {
|
|
@@ -11185,7 +11246,7 @@ async function writeInstallCompletionMarker(packageRoot) {
|
|
|
11185
11246
|
const key2 = await computeInstallCompletionKey(packageRoot);
|
|
11186
11247
|
if (key2 == null) return;
|
|
11187
11248
|
try {
|
|
11188
|
-
await mkdir6(
|
|
11249
|
+
await mkdir6(path14.join(packageRoot, "node_modules"), { recursive: true });
|
|
11189
11250
|
await writeFile6(installCompletionMarkerPath(packageRoot), key2, "utf-8");
|
|
11190
11251
|
} catch (error) {
|
|
11191
11252
|
console.warn(
|
|
@@ -11196,14 +11257,14 @@ async function writeInstallCompletionMarker(packageRoot) {
|
|
|
11196
11257
|
}
|
|
11197
11258
|
async function externalLayoutInstallCompleted(packageRoot) {
|
|
11198
11259
|
const marker = await readTextFileOptional(
|
|
11199
|
-
|
|
11260
|
+
path14.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER)
|
|
11200
11261
|
);
|
|
11201
11262
|
return marker !== null && marker === await computeInstallCompletionKey(packageRoot);
|
|
11202
11263
|
}
|
|
11203
11264
|
async function invalidateInstallCompletionMarkers(packageRoot) {
|
|
11204
11265
|
await Promise.all([
|
|
11205
11266
|
rm5(installCompletionMarkerPath(packageRoot), { force: true }),
|
|
11206
|
-
rm5(
|
|
11267
|
+
rm5(path14.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER), {
|
|
11207
11268
|
force: true
|
|
11208
11269
|
})
|
|
11209
11270
|
]);
|
|
@@ -11211,9 +11272,9 @@ async function invalidateInstallCompletionMarkers(packageRoot) {
|
|
|
11211
11272
|
async function writeExternalLayoutInstallMarker(packageRoot) {
|
|
11212
11273
|
const key2 = await computeInstallCompletionKey(packageRoot);
|
|
11213
11274
|
if (key2 == null) return;
|
|
11214
|
-
await mkdir6(
|
|
11275
|
+
await mkdir6(path14.join(packageRoot, "node_modules"), { recursive: true });
|
|
11215
11276
|
await writeFile6(
|
|
11216
|
-
|
|
11277
|
+
path14.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER),
|
|
11217
11278
|
key2,
|
|
11218
11279
|
"utf-8"
|
|
11219
11280
|
);
|
|
@@ -11224,7 +11285,7 @@ async function refreshInstallCompletionMarkers(packageRoot) {
|
|
|
11224
11285
|
return;
|
|
11225
11286
|
await writeInstallCompletionMarker(packageRoot);
|
|
11226
11287
|
if (await pathExists2(
|
|
11227
|
-
|
|
11288
|
+
path14.join(packageRoot, "node_modules", EXTERNAL_LAYOUT_INSTALL_MARKER)
|
|
11228
11289
|
)) {
|
|
11229
11290
|
await writeExternalLayoutInstallMarker(packageRoot);
|
|
11230
11291
|
}
|
|
@@ -11238,11 +11299,11 @@ async function pathExists2(filePath) {
|
|
|
11238
11299
|
}
|
|
11239
11300
|
}
|
|
11240
11301
|
async function hasPnpLoader(packageRoot) {
|
|
11241
|
-
return await pathExists2(
|
|
11302
|
+
return await pathExists2(path14.join(packageRoot, ".pnp.cjs")) || await pathExists2(path14.join(packageRoot, ".pnp.js"));
|
|
11242
11303
|
}
|
|
11243
11304
|
async function nodeModulesHasMeaningfulEntries(packageRoot) {
|
|
11244
11305
|
try {
|
|
11245
|
-
const entries = await readdir4(
|
|
11306
|
+
const entries = await readdir4(path14.join(packageRoot, "node_modules"));
|
|
11246
11307
|
return entries.some((entry) => !entry.startsWith("."));
|
|
11247
11308
|
} catch {
|
|
11248
11309
|
return false;
|
|
@@ -11279,12 +11340,12 @@ async function resolvePackageManagerCommand(pm, cwd) {
|
|
|
11279
11340
|
function protectedRootFor(cwd) {
|
|
11280
11341
|
const raw = process.env.TEMPO_DEVSERVER_PROTECTED_ROOTS;
|
|
11281
11342
|
if (!raw) return null;
|
|
11282
|
-
const protectedRoots = raw.split(
|
|
11343
|
+
const protectedRoots = raw.split(path14.delimiter).map((p) => p.trim()).filter((p) => p.length > 0).map((p) => path14.resolve(p));
|
|
11283
11344
|
if (protectedRoots.length === 0) return null;
|
|
11284
|
-
const resolved =
|
|
11345
|
+
const resolved = path14.resolve(cwd);
|
|
11285
11346
|
for (const root of protectedRoots) {
|
|
11286
|
-
const rel =
|
|
11287
|
-
if (rel === "" || !rel.startsWith("..") && !
|
|
11347
|
+
const rel = path14.relative(root, resolved);
|
|
11348
|
+
if (rel === "" || !rel.startsWith("..") && !path14.isAbsolute(rel)) {
|
|
11288
11349
|
return root;
|
|
11289
11350
|
}
|
|
11290
11351
|
}
|
|
@@ -11353,11 +11414,11 @@ function toProjectNodeEnvOption(override) {
|
|
|
11353
11414
|
};
|
|
11354
11415
|
}
|
|
11355
11416
|
function getProjectNodeUnsatisfiedHint(cwd) {
|
|
11356
|
-
const unsatisfied = projectNodeUnsatisfiedByDir.get(
|
|
11417
|
+
const unsatisfied = projectNodeUnsatisfiedByDir.get(path14.resolve(cwd));
|
|
11357
11418
|
return unsatisfied ? buildUnsatisfiedNodeHint(unsatisfied) : null;
|
|
11358
11419
|
}
|
|
11359
11420
|
async function resolveProjectNodeOverrideForDir(cwd) {
|
|
11360
|
-
const dir =
|
|
11421
|
+
const dir = path14.resolve(cwd);
|
|
11361
11422
|
const key2 = `${dir}|bundled:${isBundledNodeActivated()}`;
|
|
11362
11423
|
const cached = projectNodeOverrideCache.get(key2);
|
|
11363
11424
|
if (cached) {
|
|
@@ -11377,7 +11438,7 @@ async function resolveProjectNodeOverrideForDir(cwd) {
|
|
|
11377
11438
|
projectNodeUnsatisfiedByDir.delete(dir);
|
|
11378
11439
|
return null;
|
|
11379
11440
|
}
|
|
11380
|
-
const treePackageJson = await readJsonFile(
|
|
11441
|
+
const treePackageJson = await readJsonFile(path14.join(dir, "package.json"));
|
|
11381
11442
|
const viteSpec = treePackageJson?.dependencies?.vite ?? treePackageJson?.devDependencies?.vite;
|
|
11382
11443
|
const viteMajor = typeof viteSpec === "string" ? parseFirstSemverMajor(viteSpec) : null;
|
|
11383
11444
|
const requireFloor = viteMajor != null && viteMajor >= 7;
|
|
@@ -11613,7 +11674,7 @@ async function runInstallCommandWithLockRetry(command, cwd, runCommandFn = runSh
|
|
|
11613
11674
|
}
|
|
11614
11675
|
}
|
|
11615
11676
|
}
|
|
11616
|
-
async function runInstallStep(step, signal, onOutput) {
|
|
11677
|
+
async function runInstallStep(step, signal, onOutput, projectRoot = step.cwd) {
|
|
11617
11678
|
throwIfLaunchAborted(signal);
|
|
11618
11679
|
await Promise.all(
|
|
11619
11680
|
[
|
|
@@ -11625,7 +11686,7 @@ async function runInstallStep(step, signal, onOutput) {
|
|
|
11625
11686
|
);
|
|
11626
11687
|
throwIfLaunchAborted(signal);
|
|
11627
11688
|
if (step.cleanBeforeInstall) {
|
|
11628
|
-
await rm5(
|
|
11689
|
+
await rm5(path14.join(step.cwd, "node_modules"), {
|
|
11629
11690
|
recursive: true,
|
|
11630
11691
|
force: true
|
|
11631
11692
|
}).catch((error) => {
|
|
@@ -11640,7 +11701,7 @@ async function runInstallStep(step, signal, onOutput) {
|
|
|
11640
11701
|
await runInstallCommandWithLockRetry(
|
|
11641
11702
|
step.command,
|
|
11642
11703
|
step.cwd,
|
|
11643
|
-
(command, cwd, signal2) => runShellCommand(command, cwd, signal2, onOutput),
|
|
11704
|
+
(command, cwd, signal2) => runShellCommand(command, cwd, signal2, onOutput, projectRoot),
|
|
11644
11705
|
INSTALL_LOCK_RETRY_DELAYS_MS,
|
|
11645
11706
|
signal
|
|
11646
11707
|
);
|
|
@@ -11676,7 +11737,7 @@ async function sleepForStatusRetry(delayMs) {
|
|
|
11676
11737
|
await new Promise((resolve2) => setTimeout(resolve2, delayMs));
|
|
11677
11738
|
}
|
|
11678
11739
|
async function writeStatusTextBestEffort(statusPath, text) {
|
|
11679
|
-
await mkdir6(
|
|
11740
|
+
await mkdir6(path14.dirname(statusPath), { recursive: true });
|
|
11680
11741
|
const delays = [25, 75, 150];
|
|
11681
11742
|
let lastError = null;
|
|
11682
11743
|
for (let attempt = 0; attempt <= delays.length; attempt += 1) {
|
|
@@ -11702,15 +11763,15 @@ function augmentManagedPath(env) {
|
|
|
11702
11763
|
return env;
|
|
11703
11764
|
}
|
|
11704
11765
|
const candidates = [
|
|
11705
|
-
process.env.ProgramFiles ?
|
|
11706
|
-
process.env.APPDATA ?
|
|
11707
|
-
process.env.LOCALAPPDATA ?
|
|
11708
|
-
process.env.USERPROFILE ?
|
|
11709
|
-
process.env.USERPROFILE ?
|
|
11766
|
+
process.env.ProgramFiles ? path14.join(process.env.ProgramFiles, "nodejs") : null,
|
|
11767
|
+
process.env.APPDATA ? path14.join(process.env.APPDATA, "npm") : null,
|
|
11768
|
+
process.env.LOCALAPPDATA ? path14.join(process.env.LOCALAPPDATA, "pnpm") : null,
|
|
11769
|
+
process.env.USERPROFILE ? path14.join(process.env.USERPROFILE, ".bun", "bin") : null,
|
|
11770
|
+
process.env.USERPROFILE ? path14.join(process.env.USERPROFILE, ".volta", "bin") : null
|
|
11710
11771
|
].filter((value) => Boolean(value));
|
|
11711
11772
|
const pathKey = Object.keys(env).find((key2) => key2.toLowerCase() === "path");
|
|
11712
11773
|
const existingPath = pathKey ? env[pathKey] : env.PATH;
|
|
11713
|
-
const nextPath = [...candidates, existingPath].filter(Boolean).join(
|
|
11774
|
+
const nextPath = [...candidates, existingPath].filter(Boolean).join(path14.delimiter);
|
|
11714
11775
|
return {
|
|
11715
11776
|
...env,
|
|
11716
11777
|
[pathKey ?? "PATH"]: nextPath
|
|
@@ -12114,17 +12175,27 @@ async function runBoundedShellCommand(options) {
|
|
|
12114
12175
|
);
|
|
12115
12176
|
});
|
|
12116
12177
|
}
|
|
12117
|
-
async function runShellCommand(command, cwd, signal, onOutput) {
|
|
12178
|
+
async function runShellCommand(command, cwd, signal, onOutput, projectRoot = cwd) {
|
|
12118
12179
|
throwIfLaunchAborted(signal);
|
|
12119
12180
|
const projectNode = toProjectNodeEnvOption(
|
|
12120
12181
|
await resolveProjectNodeOverrideForDir(cwd)
|
|
12121
12182
|
);
|
|
12122
12183
|
const lifted = extractLeadingEnvAssignments(command);
|
|
12184
|
+
const registryEnv = await readInstallRegistryEnv(cwd, projectRoot, {
|
|
12185
|
+
...process.env,
|
|
12186
|
+
...lifted.env
|
|
12187
|
+
});
|
|
12123
12188
|
const result = await runAbortableShellCommand({
|
|
12124
12189
|
command: lifted.command,
|
|
12125
12190
|
cwd,
|
|
12126
12191
|
signal,
|
|
12127
|
-
env: {
|
|
12192
|
+
env: {
|
|
12193
|
+
// Restore referenced credentials (including NPM_TOKEN, otherwise
|
|
12194
|
+
// stripped with npm session state) without overriding managed flags.
|
|
12195
|
+
...registryEnv,
|
|
12196
|
+
...buildManagedCommandEnv({ projectNode }),
|
|
12197
|
+
...lifted.env
|
|
12198
|
+
},
|
|
12128
12199
|
onOutput,
|
|
12129
12200
|
idleTimeoutMs: INSTALL_IDLE_TIMEOUT_MS
|
|
12130
12201
|
});
|
|
@@ -12139,7 +12210,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
12139
12210
|
throwIfLaunchAborted(signal);
|
|
12140
12211
|
const configuredUpdateCommand = options.updateCommand?.trim();
|
|
12141
12212
|
const runCommandFn = options.runCommand ?? runShellCommand;
|
|
12142
|
-
const metadataCacheDir = configuredUpdateCommand ? null : await mkdtemp(
|
|
12213
|
+
const metadataCacheDir = configuredUpdateCommand ? null : await mkdtemp(path14.join(os2.tmpdir(), "tempo-sdk-meta-")).catch(
|
|
12143
12214
|
() => null
|
|
12144
12215
|
);
|
|
12145
12216
|
const cleanupMetadataCache = async () => {
|
|
@@ -12192,9 +12263,9 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
12192
12263
|
let updateCommandStarted = false;
|
|
12193
12264
|
let ignoredBuildScriptsAfterLink = false;
|
|
12194
12265
|
try {
|
|
12195
|
-
const packageJsonPath =
|
|
12266
|
+
const packageJsonPath = path14.join(cwd, "package.json");
|
|
12196
12267
|
const ensureSpecLatest = async () => {
|
|
12197
|
-
const raw = await
|
|
12268
|
+
const raw = await readFile10(packageJsonPath, "utf-8").catch(() => null);
|
|
12198
12269
|
if (!raw) return false;
|
|
12199
12270
|
const parsed = JSON.parse(raw);
|
|
12200
12271
|
const dependencies = parsed.dependencies && typeof parsed.dependencies === "object" && !Array.isArray(parsed.dependencies) ? parsed.dependencies : void 0;
|
|
@@ -12239,14 +12310,14 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
12239
12310
|
await ensureSpecLatest();
|
|
12240
12311
|
return { attempted: true, plan };
|
|
12241
12312
|
}
|
|
12242
|
-
const nodeModulesPath =
|
|
12243
|
-
const installedPkgPath =
|
|
12313
|
+
const nodeModulesPath = path14.join(cwd, "node_modules");
|
|
12314
|
+
const installedPkgPath = path14.join(
|
|
12244
12315
|
nodeModulesPath,
|
|
12245
12316
|
"tempo-sdk",
|
|
12246
12317
|
"package.json"
|
|
12247
12318
|
);
|
|
12248
12319
|
const [installedRaw, registryResponse] = await Promise.all([
|
|
12249
|
-
|
|
12320
|
+
readFile10(installedPkgPath, "utf-8").catch(() => null),
|
|
12250
12321
|
fetch("https://registry.npmjs.org/tempo-sdk/latest", {
|
|
12251
12322
|
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(3e3)]) : AbortSignal.timeout(3e3)
|
|
12252
12323
|
}).catch(() => null)
|
|
@@ -12291,7 +12362,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
12291
12362
|
}
|
|
12292
12363
|
throwIfLaunchAborted(signal);
|
|
12293
12364
|
await ensureSpecLatest();
|
|
12294
|
-
const upgradedRaw = await
|
|
12365
|
+
const upgradedRaw = await readFile10(installedPkgPath, "utf-8").catch(
|
|
12295
12366
|
() => null
|
|
12296
12367
|
);
|
|
12297
12368
|
const upgradedVersion = upgradedRaw ? JSON.parse(upgradedRaw).version : null;
|
|
@@ -12318,7 +12389,7 @@ async function ensureTempoSdkLatestSpec(cwd, signal, options = {}) {
|
|
|
12318
12389
|
}
|
|
12319
12390
|
async function readJsonFile(filePath) {
|
|
12320
12391
|
try {
|
|
12321
|
-
return JSON.parse(await
|
|
12392
|
+
return JSON.parse(await readFile10(filePath, "utf-8"));
|
|
12322
12393
|
} catch {
|
|
12323
12394
|
return null;
|
|
12324
12395
|
}
|
|
@@ -12413,14 +12484,14 @@ function advertisedRootBelongsToWorkspace(advertised, expected) {
|
|
|
12413
12484
|
try {
|
|
12414
12485
|
return fs.realpathSync(p);
|
|
12415
12486
|
} catch {
|
|
12416
|
-
return
|
|
12487
|
+
return path14.resolve(p);
|
|
12417
12488
|
}
|
|
12418
12489
|
};
|
|
12419
12490
|
const a = norm(advertised);
|
|
12420
12491
|
const e = norm(expected);
|
|
12421
12492
|
if (a === e) return true;
|
|
12422
|
-
const aWithSep = a.endsWith(
|
|
12423
|
-
const eWithSep = e.endsWith(
|
|
12493
|
+
const aWithSep = a.endsWith(path14.sep) ? a : `${a}${path14.sep}`;
|
|
12494
|
+
const eWithSep = e.endsWith(path14.sep) ? e : `${e}${path14.sep}`;
|
|
12424
12495
|
return a.startsWith(eWithSep) || e.startsWith(aWithSep);
|
|
12425
12496
|
}
|
|
12426
12497
|
var MAX_PROBE_RESPONSE_BYTES = 64 * 1024;
|
|
@@ -12743,12 +12814,12 @@ function sleep3(ms) {
|
|
|
12743
12814
|
}
|
|
12744
12815
|
|
|
12745
12816
|
// ../tempo-devserver/read-status.ts
|
|
12746
|
-
import { readFile as
|
|
12747
|
-
import
|
|
12817
|
+
import { readFile as readFile11 } from "fs/promises";
|
|
12818
|
+
import path15 from "path";
|
|
12748
12819
|
|
|
12749
12820
|
// ../canvas-capture-headless/src/devserver.ts
|
|
12750
12821
|
async function readTempoDevserverConfig(tempoConfigPath) {
|
|
12751
|
-
const config = JSON.parse(await
|
|
12822
|
+
const config = JSON.parse(await readFile12(tempoConfigPath, "utf-8"));
|
|
12752
12823
|
if (!config.scripts?.install || !config.scripts?.start) {
|
|
12753
12824
|
throw new Error(
|
|
12754
12825
|
`tempo.config.json at ${tempoConfigPath} must declare scripts.install and scripts.start`
|
|
@@ -12771,47 +12842,47 @@ async function readTempoDevserverConfig(tempoConfigPath) {
|
|
|
12771
12842
|
};
|
|
12772
12843
|
}
|
|
12773
12844
|
function projectRootForTempoDir(tempoDir) {
|
|
12774
|
-
const resolved =
|
|
12775
|
-
return
|
|
12845
|
+
const resolved = path16.resolve(tempoDir);
|
|
12846
|
+
return path16.basename(resolved) === "tempo" ? path16.dirname(resolved) : resolved;
|
|
12776
12847
|
}
|
|
12777
12848
|
async function resolveCanvasHostLayout(options) {
|
|
12778
|
-
const repoRoot =
|
|
12779
|
-
const candidates = options.tempoDir ? [
|
|
12780
|
-
|
|
12781
|
-
|
|
12849
|
+
const repoRoot = path16.resolve(options.repoRoot);
|
|
12850
|
+
const candidates = options.tempoDir ? [path16.join(path16.resolve(options.tempoDir), "tempo.config.json")] : [
|
|
12851
|
+
path16.join(repoRoot, "tempo", "tempo.config.json"),
|
|
12852
|
+
path16.join(repoRoot, "tempo.config.json")
|
|
12782
12853
|
];
|
|
12783
12854
|
for (const configPath of candidates) {
|
|
12784
12855
|
let parsed;
|
|
12785
12856
|
try {
|
|
12786
|
-
parsed = JSON.parse(await
|
|
12857
|
+
parsed = JSON.parse(await readFile12(configPath, "utf-8"));
|
|
12787
12858
|
} catch {
|
|
12788
12859
|
continue;
|
|
12789
12860
|
}
|
|
12790
12861
|
if (typeof parsed !== "object" || parsed === null || !("scripts" in parsed)) {
|
|
12791
12862
|
continue;
|
|
12792
12863
|
}
|
|
12793
|
-
const tempoDir2 =
|
|
12864
|
+
const tempoDir2 = path16.dirname(configPath);
|
|
12794
12865
|
const paths = parsed.paths;
|
|
12795
12866
|
const canvases = typeof paths?.canvases === "string" && paths.canvases.trim().length > 0 ? paths.canvases.trim().split("\\").join("/") : "designs";
|
|
12796
12867
|
return {
|
|
12797
12868
|
tempoDir: tempoDir2,
|
|
12798
12869
|
projectRoot: projectRootForTempoDir(tempoDir2),
|
|
12799
|
-
pagesDir:
|
|
12870
|
+
pagesDir: path16.resolve(tempoDir2, canvases),
|
|
12800
12871
|
configPath
|
|
12801
12872
|
};
|
|
12802
12873
|
}
|
|
12803
|
-
const tempoDir = options.tempoDir ?
|
|
12874
|
+
const tempoDir = options.tempoDir ? path16.resolve(options.tempoDir) : path16.join(repoRoot, "tempo");
|
|
12804
12875
|
return {
|
|
12805
12876
|
tempoDir,
|
|
12806
12877
|
projectRoot: projectRootForTempoDir(tempoDir),
|
|
12807
|
-
pagesDir:
|
|
12878
|
+
pagesDir: path16.join(tempoDir, "designs"),
|
|
12808
12879
|
configPath: null
|
|
12809
12880
|
};
|
|
12810
12881
|
}
|
|
12811
12882
|
function resolveTempoDir(options) {
|
|
12812
|
-
if (options.tempoConfigPath) return
|
|
12883
|
+
if (options.tempoConfigPath) return path16.dirname(options.tempoConfigPath);
|
|
12813
12884
|
if (options.tempoDir) return options.tempoDir;
|
|
12814
|
-
if (options.repoRoot) return
|
|
12885
|
+
if (options.repoRoot) return path16.join(options.repoRoot, "tempo");
|
|
12815
12886
|
throw new Error(
|
|
12816
12887
|
"startDevserverSession needs one of tempoDir, repoRoot, or tempoConfigPath"
|
|
12817
12888
|
);
|
|
@@ -12883,7 +12954,7 @@ async function startDevserverSession(options) {
|
|
|
12883
12954
|
const log = options.log ?? (() => {
|
|
12884
12955
|
});
|
|
12885
12956
|
const tempoDir = resolveTempoDir(options);
|
|
12886
|
-
const tempoConfigPath = options.tempoConfigPath ??
|
|
12957
|
+
const tempoConfigPath = options.tempoConfigPath ?? path16.join(tempoDir, "tempo.config.json");
|
|
12887
12958
|
const config = await readTempoDevserverConfig(tempoConfigPath);
|
|
12888
12959
|
const hostCanvasPaths = options.hostCanvasPaths ?? [];
|
|
12889
12960
|
const devServer = new TempoDevServer({
|
|
@@ -12895,7 +12966,7 @@ async function startDevserverSession(options) {
|
|
|
12895
12966
|
const projectRoot = projectRootForTempoDir(tempoDir);
|
|
12896
12967
|
for (const hostCanvasPath of hostCanvasPaths) {
|
|
12897
12968
|
await devServer.ensureCanvasRegistered(
|
|
12898
|
-
|
|
12969
|
+
path16.join(projectRoot, hostCanvasPath)
|
|
12899
12970
|
);
|
|
12900
12971
|
}
|
|
12901
12972
|
const handle = await devServer.startDevServer();
|
|
@@ -12931,13 +13002,13 @@ async function startDevserverSession(options) {
|
|
|
12931
13002
|
log(`devserver ready at ${hostUrl}`);
|
|
12932
13003
|
const registerCanvas = async (hostCanvasPath) => {
|
|
12933
13004
|
await devServer.ensureCanvasRegistered(
|
|
12934
|
-
|
|
13005
|
+
path16.join(projectRoot, hostCanvasPath)
|
|
12935
13006
|
);
|
|
12936
13007
|
await awaitCanvasRegistration({
|
|
12937
13008
|
origin,
|
|
12938
13009
|
hostCanvasPath,
|
|
12939
13010
|
reRegister: () => devServer.ensureCanvasRegistered(
|
|
12940
|
-
|
|
13011
|
+
path16.join(projectRoot, hostCanvasPath)
|
|
12941
13012
|
),
|
|
12942
13013
|
log
|
|
12943
13014
|
});
|
|
@@ -12947,7 +13018,7 @@ async function startDevserverSession(options) {
|
|
|
12947
13018
|
origin,
|
|
12948
13019
|
hostCanvasPath,
|
|
12949
13020
|
reRegister: () => devServer.ensureCanvasRegistered(
|
|
12950
|
-
|
|
13021
|
+
path16.join(projectRoot, hostCanvasPath)
|
|
12951
13022
|
),
|
|
12952
13023
|
log
|
|
12953
13024
|
});
|
|
@@ -12968,13 +13039,13 @@ async function startDevserverSession(options) {
|
|
|
12968
13039
|
}
|
|
12969
13040
|
|
|
12970
13041
|
// ../canvas-capture-headless/src/enumerate.ts
|
|
12971
|
-
import { access as access5, readFile as
|
|
12972
|
-
import
|
|
13042
|
+
import { access as access5, readFile as readFile13 } from "fs/promises";
|
|
13043
|
+
import path17 from "path";
|
|
12973
13044
|
function toPosixPath2(value) {
|
|
12974
|
-
return value.split(
|
|
13045
|
+
return value.split(path17.sep).join("/");
|
|
12975
13046
|
}
|
|
12976
13047
|
async function enumerateCanvasStoryboards(options) {
|
|
12977
|
-
const pagesDir = options.pagesDir ??
|
|
13048
|
+
const pagesDir = options.pagesDir ?? path17.join(options.tempoDir, "designs");
|
|
12978
13049
|
const projectRoot = projectRootForTempoDir(options.tempoDir);
|
|
12979
13050
|
const canvasFiles = await scanCanvasFiles(pagesDir);
|
|
12980
13051
|
const storyboards = [];
|
|
@@ -12982,7 +13053,7 @@ async function enumerateCanvasStoryboards(options) {
|
|
|
12982
13053
|
const vrtConfigErrors = [];
|
|
12983
13054
|
let totalStoryboards = 0;
|
|
12984
13055
|
for (const filePath of canvasFiles) {
|
|
12985
|
-
const source = await
|
|
13056
|
+
const source = await readFile13(filePath, "utf-8");
|
|
12986
13057
|
const parsed = parseCanvasFile(filePath, source);
|
|
12987
13058
|
const structural = parsed.errors.filter(
|
|
12988
13059
|
(error) => error.kind === "structural"
|
|
@@ -13010,9 +13081,9 @@ async function enumerateCanvasStoryboards(options) {
|
|
|
13010
13081
|
continue;
|
|
13011
13082
|
}
|
|
13012
13083
|
const canvasPath = toPosixPath2(
|
|
13013
|
-
|
|
13084
|
+
path17.relative(options.tempoDir, path17.dirname(filePath))
|
|
13014
13085
|
);
|
|
13015
|
-
const hostCanvasPath = toPosixPath2(
|
|
13086
|
+
const hostCanvasPath = toPosixPath2(path17.relative(projectRoot, filePath));
|
|
13016
13087
|
for (const storyboard of parsed.storyboards) {
|
|
13017
13088
|
totalStoryboards += 1;
|
|
13018
13089
|
if (storyboard.kind !== "component") continue;
|
|
@@ -13210,8 +13281,8 @@ var VisualReviewIngestClient = class {
|
|
|
13210
13281
|
this.lastCredentialKind = credential.kind;
|
|
13211
13282
|
return credential.kind === "oidc" ? { "x-visual-review-oidc": credential.value } : { "x-visual-review-secret": credential.value };
|
|
13212
13283
|
}
|
|
13213
|
-
async request(
|
|
13214
|
-
const response = await fetch(`${this.baseUrl}${
|
|
13284
|
+
async request(path19, init) {
|
|
13285
|
+
const response = await fetch(`${this.baseUrl}${path19}`, {
|
|
13215
13286
|
...init,
|
|
13216
13287
|
headers: {
|
|
13217
13288
|
...await this.authHeader(),
|
|
@@ -13431,14 +13502,14 @@ function parseArgs(argv) {
|
|
|
13431
13502
|
break;
|
|
13432
13503
|
// subcommand name — accepted for npx-style symmetry
|
|
13433
13504
|
case "--repo-root":
|
|
13434
|
-
args.repoRoot =
|
|
13505
|
+
args.repoRoot = path18.resolve(next());
|
|
13435
13506
|
break;
|
|
13436
13507
|
case "--tempo-dir":
|
|
13437
|
-
args.tempoDir =
|
|
13508
|
+
args.tempoDir = path18.resolve(next());
|
|
13438
13509
|
args.tempoDirExplicit = true;
|
|
13439
13510
|
break;
|
|
13440
13511
|
case "--out":
|
|
13441
|
-
args.out =
|
|
13512
|
+
args.out = path18.resolve(next());
|
|
13442
13513
|
break;
|
|
13443
13514
|
case "--upload":
|
|
13444
13515
|
args.upload = true;
|
|
@@ -13489,7 +13560,7 @@ function parseArgs(argv) {
|
|
|
13489
13560
|
throw new Error(`unknown flag ${flag}`);
|
|
13490
13561
|
}
|
|
13491
13562
|
}
|
|
13492
|
-
if (!args.tempoDir) args.tempoDir =
|
|
13563
|
+
if (!args.tempoDir) args.tempoDir = path18.join(args.repoRoot, "tempo");
|
|
13493
13564
|
if (!["pr", "main", "manual"].includes(args.trigger)) {
|
|
13494
13565
|
throw new Error(`--trigger must be pr|main|manual, got ${args.trigger}`);
|
|
13495
13566
|
}
|
|
@@ -13630,8 +13701,8 @@ function startClaimHeartbeat(options) {
|
|
|
13630
13701
|
}
|
|
13631
13702
|
function explicitTempoDirRelative(args) {
|
|
13632
13703
|
if (!args.tempoDirExplicit) return void 0;
|
|
13633
|
-
const relative2 =
|
|
13634
|
-
if (relative2.startsWith("..") ||
|
|
13704
|
+
const relative2 = path18.relative(args.repoRoot, args.tempoDir);
|
|
13705
|
+
if (relative2.startsWith("..") || path18.isAbsolute(relative2)) return void 0;
|
|
13635
13706
|
return relative2;
|
|
13636
13707
|
}
|
|
13637
13708
|
function buildBaselineCaptureArgs(input) {
|
|
@@ -13658,7 +13729,7 @@ function buildBaselineCaptureArgs(input) {
|
|
|
13658
13729
|
if (input.tempoDirRelative !== void 0) {
|
|
13659
13730
|
args.push(
|
|
13660
13731
|
"--tempo-dir",
|
|
13661
|
-
|
|
13732
|
+
path18.join(input.worktreeRoot, input.tempoDirRelative || ".")
|
|
13662
13733
|
);
|
|
13663
13734
|
}
|
|
13664
13735
|
if (input.repoKey) args.push("--repo-key", input.repoKey);
|
|
@@ -13669,9 +13740,9 @@ function buildBaselineCaptureArgs(input) {
|
|
|
13669
13740
|
}
|
|
13670
13741
|
async function runBaselineCaptureInWorktree(options) {
|
|
13671
13742
|
const tempParent = await mkdtemp2(
|
|
13672
|
-
|
|
13743
|
+
path18.join(process.env.RUNNER_TEMP || tmpdir2(), "tempo-vrt-baseline-")
|
|
13673
13744
|
);
|
|
13674
|
-
const worktreeRoot =
|
|
13745
|
+
const worktreeRoot = path18.join(tempParent, "repo");
|
|
13675
13746
|
try {
|
|
13676
13747
|
options.log(
|
|
13677
13748
|
`capturing missing baseline ${options.commitSha.slice(0, 12)} on demand`
|
|
@@ -14054,10 +14125,10 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
14054
14125
|
for (const result of captured) {
|
|
14055
14126
|
if (!result.pngBytes) continue;
|
|
14056
14127
|
const fileName = `${key(result).replace(/[^\w.-]+/g, "_")}.png`;
|
|
14057
|
-
await writeFile7(
|
|
14128
|
+
await writeFile7(path18.join(out, fileName), result.pngBytes);
|
|
14058
14129
|
}
|
|
14059
14130
|
await writeFile7(
|
|
14060
|
-
|
|
14131
|
+
path18.join(out, "manifest.json"),
|
|
14061
14132
|
JSON.stringify(manifest, null, 2)
|
|
14062
14133
|
);
|
|
14063
14134
|
});
|
|
@@ -14106,7 +14177,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
14106
14177
|
log(`status: ${finalizeResult.statusUrl}`);
|
|
14107
14178
|
if (args.out) {
|
|
14108
14179
|
await writeFile7(
|
|
14109
|
-
|
|
14180
|
+
path18.join(args.out, "run.json"),
|
|
14110
14181
|
JSON.stringify(finalizeResult, null, 2)
|
|
14111
14182
|
);
|
|
14112
14183
|
}
|
|
@@ -14173,4 +14244,4 @@ export {
|
|
|
14173
14244
|
buildBaselineCaptureArgs,
|
|
14174
14245
|
main
|
|
14175
14246
|
};
|
|
14176
|
-
//# sourceMappingURL=chunk-
|
|
14247
|
+
//# sourceMappingURL=chunk-LFAVQ3IP.js.map
|