Microsoft Foundry: drop unrelated Windows staging diff

Restore the bundled runtime staging script to upstream so this PR stays focused on the Microsoft Foundry provider and does not carry an unrelated Windows symlink fallback change.
This commit is contained in:
haxudev 2026-03-21 09:29:10 +08:00
parent 3d2524a8c3
commit e2f156246c

View File

@ -7,32 +7,13 @@ function symlinkType() {
return process.platform === "win32" ? "junction" : "dir";
}
function shouldFallbackToWindowsFileLink(error, type) {
return (
process.platform === "win32" &&
type !== symlinkType() &&
error &&
typeof error === "object" &&
"code" in error &&
(error.code === "EPERM" || error.code === "EACCES")
);
}
function relativeSymlinkTarget(sourcePath, targetPath) {
const relativeTarget = path.relative(path.dirname(targetPath), sourcePath);
return relativeTarget || ".";
}
function symlinkPath(sourcePath, targetPath, type) {
try {
fs.symlinkSync(relativeSymlinkTarget(sourcePath, targetPath), targetPath, type);
} catch (error) {
if (shouldFallbackToWindowsFileLink(error, type)) {
fs.linkSync(sourcePath, targetPath);
return;
}
throw error;
}
fs.symlinkSync(relativeSymlinkTarget(sourcePath, targetPath), targetPath, type);
}
function shouldWrapRuntimeJsFile(sourcePath) {