@karmaniverous/stan-cli 0.11.5 → 0.11.6
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/cjs/index.js +1 -1
- package/dist/cli/stan.js +26 -6
- package/dist/mjs/index.js +1 -1
- package/package.json +1 -1
package/dist/cli/stan.js
CHANGED
|
@@ -28953,17 +28953,37 @@ const stanDirs = (cwd, stanPath) => {
|
|
|
28953
28953
|
|
|
28954
28954
|
// src/stan/run/archive/util.ts
|
|
28955
28955
|
/**
|
|
28956
|
-
* Stage imports
|
|
28957
|
-
*
|
|
28956
|
+
* Stage imports under <stanPath>/imports so both full and diff archives see the same
|
|
28957
|
+
* staged context.
|
|
28958
|
+
*
|
|
28959
|
+
* Behavior:
|
|
28960
|
+
* - Always clear the entire <stanPath>/imports directory first (best‑effort).
|
|
28961
|
+
* - Then, if a map is provided, call core.prepareImports to stage the current labels.
|
|
28962
|
+
*
|
|
28963
|
+
* Notes:
|
|
28964
|
+
* - Core's prepareImports also clears each label directory; we keep that as a
|
|
28965
|
+
* belt‑and‑suspenders for non‑CLI callers while the CLI clears the root up front
|
|
28966
|
+
* to remove labels that were dropped from config.
|
|
28967
|
+
* - All operations are best‑effort and swallow errors to avoid impacting the run.
|
|
28958
28968
|
*/
|
|
28959
28969
|
const stageImports = async (cwd, stanPath, imports) => {
|
|
28960
|
-
|
|
28961
|
-
|
|
28970
|
+
// 1) Clear the entire imports root first (best‑effort).
|
|
28971
|
+
const importsAbs = path.join(cwd, stanPath, 'imports');
|
|
28962
28972
|
try {
|
|
28963
|
-
await
|
|
28973
|
+
const entries = await readdir(importsAbs, { withFileTypes: true });
|
|
28974
|
+
await Promise.all(entries.map((e) => rm(resolve(importsAbs, e.name), { recursive: true, force: true })));
|
|
28964
28975
|
}
|
|
28965
28976
|
catch {
|
|
28966
|
-
// best‑effort;
|
|
28977
|
+
// best‑effort; root may not exist yet.
|
|
28978
|
+
}
|
|
28979
|
+
// 2) Stage current map (if any).
|
|
28980
|
+
if (imports && typeof imports === 'object') {
|
|
28981
|
+
try {
|
|
28982
|
+
await yh({ cwd, stanPath, map: imports });
|
|
28983
|
+
}
|
|
28984
|
+
catch {
|
|
28985
|
+
// best‑effort; continue without imports
|
|
28986
|
+
}
|
|
28967
28987
|
}
|
|
28968
28988
|
};
|
|
28969
28989
|
/**
|