

























@@ -7,7 +7,11 @@ import os from "node:os";
77import path from "node:path";
88import process from "node:process";
99import { pathToFileURL } from "node:url";
10-import { writeBuildStamp } from "./build-stamp.mjs";
10+import {
11+BUILD_STAMP_FILE,
12+writeBuildStamp,
13+writeRuntimePostBuildStamp,
14+} from "./lib/local-build-metadata.mjs";
1115import { resolveBuildRequirement } from "./run-node.mjs";
12161317const DEFAULTS = {
@@ -594,7 +598,7 @@ function buildRunNodeDeps(env) {
594598 spawnSync,
595599distRoot: path.join(cwd, "dist"),
596600distEntry: path.join(cwd, "dist", "/entry.js"),
597-buildStampPath: path.join(cwd, "dist", ".buildstamp"),
601+buildStampPath: path.join(cwd, "dist", BUILD_STAMP_FILE),
598602sourceRoots: ["src", "extensions"].map((sourceRoot) => ({
599603name: sourceRoot,
600604path: path.join(cwd, sourceRoot),
@@ -613,19 +617,25 @@ export function shouldRefreshBuildStampForRestoredArtifacts(params) {
613617);
614618}
615619620+export function writeBuildAndRuntimePostBuildStamps(params = {}) {
621+const cwd = params.cwd ?? process.cwd();
622+writeBuildStamp({ cwd });
623+writeRuntimePostBuildStamp({ cwd });
624+}
625+616626async function main() {
617627const options = parseArgs(process.argv.slice(2));
618628ensureDir(options.outputDir);
619629if (!options.skipBuild) {
620630runCheckedCommand("node", ["scripts/build-all.mjs", "gatewayWatch"]);
621631// The watch harness must start from a completed dist/runtime baseline.
622-// Refresh the build stamp after the gateway build finishes so run-node
623-// does not spuriously rebuild inside the bounded watch window.
624-writeBuildStamp({ cwd: process.cwd() });
632+// Refresh both stamps after the gateway build finishes so run-node does not
633+// leave stale local artifact metadata after the bounded watch window.
634+writeBuildAndRuntimePostBuildStamps();
625635} else {
626636// Restored CI artifacts can be older than the fresh checkout mtimes.
627-// Refresh only the stamp so run-node trusts the already-built dist.
628-writeBuildStamp({ cwd: process.cwd() });
637+// Refresh the local artifact stamps so run-node trusts the already-built dist.
638+writeBuildAndRuntimePostBuildStamps();
629639}
630640631641let preflightBuildRequirement = resolveBuildRequirement(buildRunNodeDeps(process.env));
@@ -636,9 +646,9 @@ async function main() {
636646})
637647) {
638648// CI's skip-build path restores a built dist artifact after checkout.
639-// Refresh the stamp so checkout mtimes for package/config files do not
649+// Refresh the stamps so checkout mtimes for package/config files do not
640650// force a duplicate build during the bounded gateway:watch window.
641-writeBuildStamp({ cwd: process.cwd() });
651+writeBuildAndRuntimePostBuildStamps();
642652preflightBuildRequirement = resolveBuildRequirement(buildRunNodeDeps(process.env));
643653}
644654if (
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。