@fenglimg/fabric-shared 2.3.0-rc.2 → 2.3.0-rc.4

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.
@@ -192,8 +192,20 @@ var globalConfigSchema = z.object({
192
192
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
193
193
  import { homedir } from "os";
194
194
  import { join } from "path";
195
+ function isTestRuntime() {
196
+ return process.env.VITEST !== void 0 || process.env.VITEST_WORKER_ID !== void 0;
197
+ }
195
198
  function resolveGlobalRoot() {
196
- return join(process.env.FABRIC_HOME ?? homedir(), ".fabric");
199
+ const fabricHome = process.env.FABRIC_HOME;
200
+ if (fabricHome !== void 0 && fabricHome !== "") {
201
+ return join(fabricHome, ".fabric");
202
+ }
203
+ if (isTestRuntime()) {
204
+ throw new Error(
205
+ "resolveGlobalRoot(): FABRIC_HOME must be set under the test runner \u2014 refusing to fall back to the real home dir (~/.fabric). Repoint process.env.FABRIC_HOME to an isolated temp dir in beforeEach (see plan-context.test.ts for the pattern)."
206
+ );
207
+ }
208
+ return join(homedir(), ".fabric");
197
209
  }
198
210
  function globalConfigPath(globalRoot = resolveGlobalRoot()) {
199
211
  return join(globalRoot, "fabric-global.json");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveGlobalLocale
3
- } from "./chunk-ANUDBQBK.js";
3
+ } from "./chunk-ASS2KBB7.js";
4
4
 
5
5
  // src/templates/bootstrap-canonical.ts
6
6
  var BOOTSTRAP_MARKER_BEGIN = "<!-- fabric:bootstrap:begin -->";