@mdfriday/foundry 26.3.21 → 26.4.1

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/cli.js CHANGED
@@ -4599,6 +4599,7 @@ var init_identity2 = __esm({
4599
4599
  IdentityAppService = class {
4600
4600
  userFactory;
4601
4601
  currentUser = null;
4602
+ cachedServerConfig = null;
4602
4603
  constructor(options) {
4603
4604
  this.userFactory = options.userFactory;
4604
4605
  }
@@ -4606,16 +4607,22 @@ var init_identity2 = __esm({
4606
4607
  // Initialization
4607
4608
  // ============================================================================
4608
4609
  /**
4609
- * 初始化服务(加载已保存的用户)
4610
+ * 初始化服务(加载已保存的用户和服务器配置)
4610
4611
  */
4611
4612
  async initialize() {
4612
4613
  try {
4613
- this.currentUser = await this.userFactory.load();
4614
+ [this.currentUser, this.cachedServerConfig] = await Promise.all([
4615
+ this.userFactory.load(),
4616
+ this.userFactory.loadServerConfig()
4617
+ ]);
4614
4618
  if (this.currentUser) {
4615
4619
  log7.info("User session restored");
4616
4620
  } else {
4617
4621
  log7.debug("No existing user session");
4618
4622
  }
4623
+ if (this.cachedServerConfig) {
4624
+ log7.debug("Server config loaded from storage");
4625
+ }
4619
4626
  } catch (error) {
4620
4627
  log7.error("Failed to initialize identity service", error);
4621
4628
  }
@@ -4627,18 +4634,18 @@ var init_identity2 = __esm({
4627
4634
  * 用户登录
4628
4635
  */
4629
4636
  async login(email, password) {
4630
- const savedConfig = await this.userFactory.loadServerConfig();
4631
- const user = await this.userFactory.login(email, password, savedConfig || void 0);
4637
+ const user = await this.userFactory.login(email, password, this.cachedServerConfig || void 0);
4632
4638
  this.currentUser = user;
4639
+ this.cachedServerConfig = user.getServerConfig();
4633
4640
  return user;
4634
4641
  }
4635
4642
  /**
4636
4643
  * 用户注册
4637
4644
  */
4638
4645
  async register(email, password) {
4639
- const savedConfig = await this.userFactory.loadServerConfig();
4640
- const user = await this.userFactory.register(email, password, savedConfig || void 0);
4646
+ const user = await this.userFactory.register(email, password, this.cachedServerConfig || void 0);
4641
4647
  this.currentUser = user;
4648
+ this.cachedServerConfig = user.getServerConfig();
4642
4649
  return user;
4643
4650
  }
4644
4651
  /**
@@ -4682,7 +4689,7 @@ var init_identity2 = __esm({
4682
4689
  return {
4683
4690
  isAuthenticated: false,
4684
4691
  email: "",
4685
- serverUrl: ServerConfig.createDefault().getApiUrl(),
4692
+ serverUrl: this.getServerConfig().getApiUrl(),
4686
4693
  tokenExpired: true,
4687
4694
  hasToken: false,
4688
4695
  hasLicense: false,
@@ -4703,12 +4710,14 @@ var init_identity2 = __esm({
4703
4710
  // ============================================================================
4704
4711
  /**
4705
4712
  * 获取服务器配置
4713
+ *
4714
+ * 优先级:当前用户配置 > 缓存配置 > 默认配置
4706
4715
  */
4707
4716
  getServerConfig() {
4708
4717
  if (this.currentUser) {
4709
4718
  return this.currentUser.getServerConfig();
4710
4719
  }
4711
- return ServerConfig.createDefault();
4720
+ return this.cachedServerConfig || ServerConfig.createDefault();
4712
4721
  }
4713
4722
  /**
4714
4723
  * 更新服务器配置
@@ -4718,6 +4727,7 @@ var init_identity2 = __esm({
4718
4727
  this.currentUser = this.userFactory.createAnonymous();
4719
4728
  }
4720
4729
  await this.userFactory.updateServerConfig(this.currentUser, updates);
4730
+ this.cachedServerConfig = this.currentUser.getServerConfig();
4721
4731
  }
4722
4732
  // ============================================================================
4723
4733
  // License Management
@@ -4729,8 +4739,7 @@ var init_identity2 = __esm({
4729
4739
  * @returns 试用 License 信息和凭证
4730
4740
  */
4731
4741
  async requestTrial(email) {
4732
- const savedConfig = await this.userFactory.loadServerConfig();
4733
- return this.userFactory.requestTrialLicense(email, savedConfig || void 0);
4742
+ return this.userFactory.requestTrialLicense(email, this.cachedServerConfig || void 0);
4734
4743
  }
4735
4744
  /**
4736
4745
  * 使用 License Key 登录
@@ -4741,9 +4750,9 @@ var init_identity2 = __esm({
4741
4750
  * @returns 登录成功的用户
4742
4751
  */
4743
4752
  async loginWithLicense(licenseKey) {
4744
- const savedConfig = await this.userFactory.loadServerConfig();
4745
- const user = await this.userFactory.loginWithLicense(licenseKey, savedConfig || void 0);
4753
+ const user = await this.userFactory.loginWithLicense(licenseKey, this.cachedServerConfig || void 0);
4746
4754
  this.currentUser = user;
4755
+ this.cachedServerConfig = user.getServerConfig();
4747
4756
  return user;
4748
4757
  }
4749
4758
  /**
@@ -4785,9 +4794,9 @@ var init_identity2 = __esm({
4785
4794
  * @returns 登录并激活后的 User
4786
4795
  */
4787
4796
  async requestAndActivateTrial(email) {
4788
- const savedConfig = await this.userFactory.loadServerConfig();
4789
- const user = await this.userFactory.requestAndActivateTrial(email, savedConfig || void 0);
4797
+ const user = await this.userFactory.requestAndActivateTrial(email, this.cachedServerConfig || void 0);
4790
4798
  this.currentUser = user;
4799
+ this.cachedServerConfig = user.getServerConfig();
4791
4800
  return user;
4792
4801
  }
4793
4802
  /**
@@ -9165,8 +9174,8 @@ var init_node_manifest_repository = __esm({
9165
9174
  async calculateFileHash(filePath, algorithm = "md5") {
9166
9175
  return new Promise((resolve3, reject) => {
9167
9176
  const hash = import_crypto.default.createHash(algorithm);
9168
- const fs13 = require("fs");
9169
- const stream = fs13.createReadStream(filePath);
9177
+ const fs14 = require("fs");
9178
+ const stream = fs14.createReadStream(filePath);
9170
9179
  stream.on("data", (data) => hash.update(data));
9171
9180
  stream.on("end", () => resolve3(hash.digest("hex")));
9172
9181
  stream.on("error", reject);
@@ -11722,8 +11731,8 @@ var init_loader = __esm({
11722
11731
  */
11723
11732
  async fileExists(filename) {
11724
11733
  try {
11725
- const fs13 = this.sourceDescriptor.fs();
11726
- const stat4 = await fs13.stat(filename);
11734
+ const fs14 = this.sourceDescriptor.fs();
11735
+ const stat4 = await fs14.stat(filename);
11727
11736
  return !stat4.isDir();
11728
11737
  } catch {
11729
11738
  return false;
@@ -11733,8 +11742,8 @@ var init_loader = __esm({
11733
11742
  * Load configuration from file
11734
11743
  */
11735
11744
  async loadConfigFromFile(filename) {
11736
- const fs13 = this.sourceDescriptor.fs();
11737
- const file = await fs13.open(filename);
11745
+ const fs14 = this.sourceDescriptor.fs();
11746
+ const file = await fs14.open(filename);
11738
11747
  try {
11739
11748
  const buffer = new Uint8Array(1024 * 1024);
11740
11749
  const { bytesRead } = await file.read(buffer);
@@ -11753,8 +11762,8 @@ var init_loader = __esm({
11753
11762
  });
11754
11763
 
11755
11764
  // internal/domain/config/factory/sourcedescriptor.ts
11756
- function newSourceDescriptor(fs13, filename) {
11757
- return new ConfigSourceDescriptor(fs13, filename);
11765
+ function newSourceDescriptor(fs14, filename) {
11766
+ return new ConfigSourceDescriptor(fs14, filename);
11758
11767
  }
11759
11768
  var ConfigSourceDescriptor;
11760
11769
  var init_sourcedescriptor = __esm({
@@ -11763,8 +11772,8 @@ var init_sourcedescriptor = __esm({
11763
11772
  ConfigSourceDescriptor = class {
11764
11773
  fileSystem;
11765
11774
  configFilename;
11766
- constructor(fs13, filename) {
11767
- this.fileSystem = fs13;
11775
+ constructor(fs14, filename) {
11776
+ this.fileSystem = fs14;
11768
11777
  this.configFilename = filename;
11769
11778
  }
11770
11779
  fs() {
@@ -11778,7 +11787,7 @@ var init_sourcedescriptor = __esm({
11778
11787
  });
11779
11788
 
11780
11789
  // internal/domain/config/factory/config.ts
11781
- async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir, params = {}) {
11790
+ async function loadConfigWithParams(fs14, configFilename, workingDir, modulesDir, params = {}) {
11782
11791
  const cleanWorkingDir = path14.resolve(workingDir);
11783
11792
  const cleanModulesDir = path14.resolve(modulesDir);
11784
11793
  const cleanPublishDir = path14.resolve(DEFAULT_PUBLISH_DIR);
@@ -11788,9 +11797,9 @@ async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir
11788
11797
  publishDir: cleanPublishDir,
11789
11798
  cacheDir: ""
11790
11799
  };
11791
- baseDirs.cacheDir = await getCacheDir(fs13, baseDirs.cacheDir);
11800
+ baseDirs.cacheDir = await getCacheDir(fs14, baseDirs.cacheDir);
11792
11801
  const loader = new ConfigLoader(
11793
- newSourceDescriptor(fs13, configFilename),
11802
+ newSourceDescriptor(fs14, configFilename),
11794
11803
  baseDirs
11795
11804
  );
11796
11805
  try {
@@ -11799,9 +11808,9 @@ async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir
11799
11808
  provider.set(key2, value);
11800
11809
  }
11801
11810
  const absPublishDir = path14.resolve(provider.get("publishDir") || DEFAULT_PUBLISH_DIR);
11802
- await fs13.mkdirAll(absPublishDir, 511);
11811
+ await fs14.mkdirAll(absPublishDir, 511);
11803
11812
  return newConfig(
11804
- fs13,
11813
+ fs14,
11805
11814
  provider,
11806
11815
  newRoot(provider.get(""), provider.getParams("params")),
11807
11816
  newDir(baseDirs.workingDir, baseDirs.modulesDir, absPublishDir),
@@ -11816,14 +11825,14 @@ async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir
11816
11825
  loader.deleteMergeStrategies();
11817
11826
  }
11818
11827
  }
11819
- async function getCacheDir(fs13, cacheDir) {
11828
+ async function getCacheDir(fs14, cacheDir) {
11820
11829
  if (cacheDir !== "") {
11821
11830
  return cacheDir;
11822
11831
  }
11823
11832
  const homeDir = process.env.HOME || process.env.USERPROFILE || "";
11824
11833
  const defaultCacheDir = path14.join(homeDir, ".cache", "mdf");
11825
11834
  try {
11826
- await fs13.mkdirAll(defaultCacheDir, 493);
11835
+ await fs14.mkdirAll(defaultCacheDir, 493);
11827
11836
  return defaultCacheDir;
11828
11837
  } catch {
11829
11838
  return path14.join("/tmp", "hugo-cache");
@@ -12003,11 +12012,11 @@ var init_mount = __esm({
12003
12012
  });
12004
12013
 
12005
12014
  // internal/domain/module/vo/httpclient.ts
12006
- function newHttpClient(fs13, timeout, headers, customClient) {
12015
+ function newHttpClient(fs14, timeout, headers, customClient) {
12007
12016
  if (customClient) {
12008
12017
  return customClient;
12009
12018
  }
12010
- return new NodeHttpClient2(fs13, timeout, headers);
12019
+ return new NodeHttpClient2(fs14, timeout, headers);
12011
12020
  }
12012
12021
  var path16, http, https, log20, NodeHttpClient2;
12013
12022
  var init_httpclient = __esm({
@@ -12020,8 +12029,8 @@ var init_httpclient = __esm({
12020
12029
  init_log();
12021
12030
  log20 = getDomainLogger("module", { component: "httpclient" });
12022
12031
  NodeHttpClient2 = class {
12023
- constructor(fs13, timeout = 3e4, headers = {}) {
12024
- this.fs = fs13;
12032
+ constructor(fs14, timeout = 3e4, headers = {}) {
12033
+ this.fs = fs14;
12025
12034
  this.timeout = timeout;
12026
12035
  this.headers = headers;
12027
12036
  }
@@ -12206,12 +12215,12 @@ var init_httpclient = __esm({
12206
12215
  });
12207
12216
 
12208
12217
  // internal/domain/module/vo/zipextractor.ts
12209
- function newZipExtractor(fs13, environment = "node") {
12218
+ function newZipExtractor(fs14, environment = "node") {
12210
12219
  switch (environment) {
12211
12220
  case "node":
12212
- return new JsZipExtractor(fs13);
12221
+ return new JsZipExtractor(fs14);
12213
12222
  case "browser":
12214
- return new WebZipExtractor(fs13);
12223
+ return new WebZipExtractor(fs14);
12215
12224
  default:
12216
12225
  throw new Error(`Unsupported environment: ${environment}`);
12217
12226
  }
@@ -12226,8 +12235,8 @@ var init_zipextractor = __esm({
12226
12235
  path17 = __toESM(require("path"));
12227
12236
  log21 = getDomainLogger("module", { component: "zipextractor" });
12228
12237
  JsZipExtractor = class {
12229
- constructor(fs13) {
12230
- this.fs = fs13;
12238
+ constructor(fs14) {
12239
+ this.fs = fs14;
12231
12240
  }
12232
12241
  /**
12233
12242
  * Extract ZIP file to target directory
@@ -12330,8 +12339,8 @@ var init_zipextractor = __esm({
12330
12339
  }
12331
12340
  };
12332
12341
  WebZipExtractor = class {
12333
- constructor(fs13) {
12334
- this.fs = fs13;
12342
+ constructor(fs14) {
12343
+ this.fs = fs14;
12335
12344
  }
12336
12345
  async extract(zipPath, targetDir) {
12337
12346
  try {
@@ -12354,8 +12363,8 @@ var init_zipextractor = __esm({
12354
12363
  });
12355
12364
 
12356
12365
  // internal/domain/module/vo/cache.ts
12357
- function newModuleCache(fs13, cacheDir) {
12358
- return new FsModuleCache(fs13, cacheDir);
12366
+ function newModuleCache(fs14, cacheDir) {
12367
+ return new FsModuleCache(fs14, cacheDir);
12359
12368
  }
12360
12369
  var path18, log22, FsModuleCache;
12361
12370
  var init_cache = __esm({
@@ -12366,8 +12375,8 @@ var init_cache = __esm({
12366
12375
  path18 = __toESM(require("path"));
12367
12376
  log22 = getDomainLogger("module", { component: "cache" });
12368
12377
  FsModuleCache = class {
12369
- constructor(fs13, cacheDir = "./module/cache") {
12370
- this.fs = fs13;
12378
+ constructor(fs14, cacheDir = "./module/cache") {
12379
+ this.fs = fs14;
12371
12380
  this.cacheDir = cacheDir;
12372
12381
  }
12373
12382
  cacheDir;
@@ -12524,15 +12533,15 @@ var init_cache = __esm({
12524
12533
  });
12525
12534
 
12526
12535
  // internal/domain/module/vo/module.ts
12527
- function newModule2(fs13, absoluteDir, modulePath, parent) {
12528
- return new Module2(fs13, absoluteDir, modulePath, parent || null, false);
12536
+ function newModule2(fs14, absoluteDir, modulePath, parent) {
12537
+ return new Module2(fs14, absoluteDir, modulePath, parent || null, false);
12529
12538
  }
12530
12539
  function newProjectModule(info) {
12531
- const fs13 = info.osFs();
12540
+ const fs14 = info.osFs();
12532
12541
  const absoluteDir = info.projDir();
12533
12542
  const modulePath = "project-root";
12534
12543
  const defaultLanguage3 = info.defaultLanguageKey();
12535
- const module2 = new Module2(fs13, absoluteDir, modulePath, null, true);
12544
+ const module2 = new Module2(fs14, absoluteDir, modulePath, null, true);
12536
12545
  const projectModule = new ProjectModule(module2);
12537
12546
  projectModule.applyDefaultMounts();
12538
12547
  if (defaultLanguage3) {
@@ -12560,8 +12569,8 @@ var init_module3 = __esm({
12560
12569
  init_mount();
12561
12570
  path19 = __toESM(require("path"));
12562
12571
  Module2 = class _Module {
12563
- constructor(fs13, absoluteDir, modulePath, parent = null, isProject = false) {
12564
- this.fs = fs13;
12572
+ constructor(fs14, absoluteDir, modulePath, parent = null, isProject = false) {
12573
+ this.fs = fs14;
12565
12574
  this.absoluteDir = absoluteDir;
12566
12575
  this.modulePath = modulePath;
12567
12576
  this.parentModule = parent;
@@ -13654,11 +13663,11 @@ var init_fileinfo = __esm({
13654
13663
  });
13655
13664
 
13656
13665
  // internal/domain/fs/vo/file.ts
13657
- function newFileWithMeta(file, meta, fs13) {
13658
- return new File(file, meta, fs13);
13666
+ function newFileWithMeta(file, meta, fs14) {
13667
+ return new File(file, meta, fs14);
13659
13668
  }
13660
- function newDirFileWithMeta(file, meta, fs13) {
13661
- return new File(file, meta, fs13, true);
13669
+ function newDirFileWithMeta(file, meta, fs14) {
13670
+ return new File(file, meta, fs14, true);
13662
13671
  }
13663
13672
  var path22, File;
13664
13673
  var init_file = __esm({
@@ -13672,10 +13681,10 @@ var init_file = __esm({
13672
13681
  fileMeta;
13673
13682
  fs;
13674
13683
  _isDir;
13675
- constructor(file, fileMeta, fs13, isDir = false) {
13684
+ constructor(file, fileMeta, fs14, isDir = false) {
13676
13685
  this.file = file;
13677
13686
  this.fileMeta = fileMeta;
13678
- this.fs = fs13;
13687
+ this.fs = fs14;
13679
13688
  this._isDir = isDir;
13680
13689
  }
13681
13690
  /**
@@ -13803,8 +13812,8 @@ var init_file = __esm({
13803
13812
  });
13804
13813
 
13805
13814
  // internal/domain/fs/vo/dir.ts
13806
- function newDirFile(file, meta, fs13) {
13807
- const baseFile = new File(file, meta, fs13, true);
13815
+ function newDirFile(file, meta, fs14) {
13816
+ const baseFile = new File(file, meta, fs14, true);
13808
13817
  return new DirFile(baseFile);
13809
13818
  }
13810
13819
  var DirFile;
@@ -13879,8 +13888,8 @@ var init_dir2 = __esm({
13879
13888
  });
13880
13889
 
13881
13890
  // internal/domain/fs/entity/basefs.ts
13882
- function newBaseFs(fs13, roots) {
13883
- return new BaseFs(fs13, roots);
13891
+ function newBaseFs(fs14, roots) {
13892
+ return new BaseFs(fs14, roots);
13884
13893
  }
13885
13894
  var path23, log26, BaseFs;
13886
13895
  var init_basefs = __esm({
@@ -13897,8 +13906,8 @@ var init_basefs = __esm({
13897
13906
  fs;
13898
13907
  // osFs
13899
13908
  roots;
13900
- constructor(fs13, roots) {
13901
- this.fs = fs13;
13909
+ constructor(fs14, roots) {
13910
+ this.fs = fs14;
13902
13911
  this.roots = roots;
13903
13912
  }
13904
13913
  /**
@@ -14050,8 +14059,8 @@ var init_basefs = __esm({
14050
14059
  });
14051
14060
 
14052
14061
  // internal/domain/fs/vo/walkway.ts
14053
- function newWalkway(fs13, cb) {
14054
- return new Walkway(fs13, cb);
14062
+ function newWalkway(fs14, cb) {
14063
+ return new Walkway(fs14, cb);
14055
14064
  }
14056
14065
  var path24, log27, Walkway;
14057
14066
  var init_walkway = __esm({
@@ -14069,14 +14078,14 @@ var init_walkway = __esm({
14069
14078
  cb;
14070
14079
  cfg;
14071
14080
  walked = false;
14072
- constructor(fs13, cb) {
14073
- if (!fs13) {
14081
+ constructor(fs14, cb) {
14082
+ if (!fs14) {
14074
14083
  throw new Error("fs must be set");
14075
14084
  }
14076
14085
  if (!cb.walkFn) {
14077
14086
  throw new Error("walkFn must be set");
14078
14087
  }
14079
- this.fs = fs13;
14088
+ this.fs = fs14;
14080
14089
  this.cb = cb;
14081
14090
  this.root = "";
14082
14091
  this.cfg = {};
@@ -14281,9 +14290,9 @@ var init_static_copier = __esm({
14281
14290
  /**
14282
14291
  * Walk filesystem recursively
14283
14292
  */
14284
- async walkFileSystem(fs13, basePath, callback) {
14293
+ async walkFileSystem(fs14, basePath, callback) {
14285
14294
  try {
14286
- const file = await fs13.open(basePath);
14295
+ const file = await fs14.open(basePath);
14287
14296
  const fileInfo = await file.stat();
14288
14297
  if (!fileInfo.isDir()) {
14289
14298
  await file.close();
@@ -14296,7 +14305,7 @@ var init_static_copier = __esm({
14296
14305
  const fullPath = this.joinPath(basePath, entry.name());
14297
14306
  if (entry.isDir()) {
14298
14307
  await callback(fullPath, true);
14299
- await this.walkFileSystem(fs13, fullPath, callback);
14308
+ await this.walkFileSystem(fs14, fullPath, callback);
14300
14309
  } else {
14301
14310
  await callback(fullPath, false);
14302
14311
  }
@@ -14367,25 +14376,25 @@ async function collectFileMetaInfos(paths, fss) {
14367
14376
  const result = /* @__PURE__ */ new Map();
14368
14377
  let found = false;
14369
14378
  for (const path43 of paths) {
14370
- for (const fs13 of fss) {
14379
+ for (const fs14 of fss) {
14371
14380
  try {
14372
- const fileMetaInfo = await createFileMetaInfo(path43, fs13);
14381
+ const fileMetaInfo = await createFileMetaInfo(path43, fs14);
14373
14382
  result.set(path43, fileMetaInfo);
14374
14383
  found = true;
14375
14384
  if (found)
14376
14385
  break;
14377
14386
  } catch (error) {
14378
- log29.error(`Failed to create FileMetaInfo for ${path43} with fs=${fs13}:`, error);
14387
+ log29.error(`Failed to create FileMetaInfo for ${path43} with fs=${fs14}:`, error);
14379
14388
  }
14380
14389
  }
14381
14390
  }
14382
14391
  return result;
14383
14392
  }
14384
- async function createFileMetaInfo(filePath, fs13) {
14393
+ async function createFileMetaInfo(filePath, fs14) {
14385
14394
  try {
14386
- const fi = await fs13.stat(filePath);
14395
+ const fi = await fs14.stat(filePath);
14387
14396
  const meta = newFileMeta(filePath);
14388
- meta.setOpenFunc(async () => await fs13.open(filePath));
14397
+ meta.setOpenFunc(async () => await fs14.open(filePath));
14389
14398
  return newFileInfoWithMeta(fi, meta);
14390
14399
  } catch (error) {
14391
14400
  throw new Error(`Failed to stat file ${filePath}: ${error.message}`);
@@ -14496,8 +14505,8 @@ var init_fs = __esm({
14496
14505
  async walkLayouts(start, cb, conf) {
14497
14506
  return await this.walk(this.layouts, start, cb, conf);
14498
14507
  }
14499
- async walkContent(fs13, start, cb, conf) {
14500
- await this.walk(fs13, start, cb, conf);
14508
+ async walkContent(fs14, start, cb, conf) {
14509
+ await this.walk(fs14, start, cb, conf);
14501
14510
  }
14502
14511
  async walkStatics(start, cb, conf) {
14503
14512
  return await this.walk(this.statics, start, cb, conf);
@@ -14505,8 +14514,8 @@ var init_fs = __esm({
14505
14514
  async walkI18n(start, cb, conf) {
14506
14515
  return await this.walk(this.i18n, start, cb, conf);
14507
14516
  }
14508
- async walk(fs13, start, cb, conf) {
14509
- const w = newWalkway(fs13, cb);
14517
+ async walk(fs14, start, cb, conf) {
14518
+ const w = newWalkway(fs14, cb);
14510
14519
  if (start === "") {
14511
14520
  start = "/";
14512
14521
  }
@@ -14625,8 +14634,8 @@ var init_overlayoptions = __esm({
14625
14634
  /**
14626
14635
  * Check if filesystem exists in overlay
14627
14636
  */
14628
- hasFilesystem(fs13) {
14629
- return this.fss.includes(fs13);
14637
+ hasFilesystem(fs14) {
14638
+ return this.fss.includes(fs14);
14630
14639
  }
14631
14640
  /**
14632
14641
  * Get all filesystems as readonly array
@@ -14741,8 +14750,8 @@ var init_overlaydir = __esm({
14741
14750
  */
14742
14751
  async loadDirectoryEntries() {
14743
14752
  for (let i = 0; i < this.fss.length; i++) {
14744
- const fs13 = this.fss[i];
14745
- await this.readFromFilesystem(fs13, null);
14753
+ const fs14 = this.fss[i];
14754
+ await this.readFromFilesystem(fs14, null);
14746
14755
  }
14747
14756
  for (let i = 0; i < this.dirOpeners.length; i++) {
14748
14757
  const file = await this.dirOpeners[i]();
@@ -14752,12 +14761,12 @@ var init_overlaydir = __esm({
14752
14761
  /**
14753
14762
  * Read directory entries from a specific filesystem or file
14754
14763
  */
14755
- async readFromFilesystem(fs13, file) {
14764
+ async readFromFilesystem(fs14, file) {
14756
14765
  let f = file;
14757
14766
  try {
14758
- if (!f && fs13) {
14767
+ if (!f && fs14) {
14759
14768
  const fsPath = this._name === "/" ? "" : this._name;
14760
- f = await fs13.open(fsPath);
14769
+ f = await fs14.open(fsPath);
14761
14770
  }
14762
14771
  if (!f) {
14763
14772
  return;
@@ -14936,22 +14945,22 @@ var init_overlayfs = __esm({
14936
14945
  * Collect directories from all filesystems
14937
14946
  */
14938
14947
  async collectDirs(name, withFs) {
14939
- for (const fs13 of this.fss) {
14940
- await this.collectDirsRecursive(fs13, name, withFs);
14948
+ for (const fs14 of this.fss) {
14949
+ await this.collectDirsRecursive(fs14, name, withFs);
14941
14950
  }
14942
14951
  }
14943
14952
  /**
14944
14953
  * Recursively collect directories from filesystem hierarchy
14945
14954
  */
14946
- async collectDirsRecursive(fs13, name, withFs) {
14955
+ async collectDirsRecursive(fs14, name, withFs) {
14947
14956
  try {
14948
- const fi = await fs13.stat(name);
14957
+ const fi = await fs14.stat(name);
14949
14958
  if (fi.isDir()) {
14950
- withFs(fs13);
14959
+ withFs(fs14);
14951
14960
  }
14952
14961
  } catch (error) {
14953
14962
  }
14954
- const fsi = fs13;
14963
+ const fsi = fs14;
14955
14964
  if (fsi.filesystem && fsi.numFilesystems) {
14956
14965
  for (let i = 0; i < fsi.numFilesystems(); i++) {
14957
14966
  const subFs = fsi.filesystem(i);
@@ -14966,8 +14975,8 @@ var init_overlayfs = __esm({
14966
14975
  */
14967
14976
  async statInternal(name, lstatIfPossible) {
14968
14977
  for (let i = 0; i < this.fss.length; i++) {
14969
- const fs13 = this.fss[i];
14970
- const [fs22, fi, ok3, err] = await this.statRecursive(fs13, name, lstatIfPossible);
14978
+ const fs14 = this.fss[i];
14979
+ const [fs22, fi, ok3, err] = await this.statRecursive(fs14, name, lstatIfPossible);
14971
14980
  if (err === null || !this.isNotExistError(err)) {
14972
14981
  return [fs22, fi, ok3, err];
14973
14982
  }
@@ -14977,16 +14986,16 @@ var init_overlayfs = __esm({
14977
14986
  /**
14978
14987
  * Recursive stat implementation
14979
14988
  */
14980
- async statRecursive(fs13, name, lstatIfPossible) {
14989
+ async statRecursive(fs14, name, lstatIfPossible) {
14981
14990
  try {
14982
- const fi = await fs13.stat(name);
14983
- return [fs13, fi, false, null];
14991
+ const fi = await fs14.stat(name);
14992
+ return [fs14, fi, false, null];
14984
14993
  } catch (error) {
14985
14994
  if (!this.isNotExistError(error)) {
14986
- return [fs13, null, false, error];
14995
+ return [fs14, null, false, error];
14987
14996
  }
14988
14997
  }
14989
- const fsi = fs13;
14998
+ const fsi = fs14;
14990
14999
  if (fsi.filesystem && fsi.numFilesystems) {
14991
15000
  for (let i = 0; i < fsi.numFilesystems(); i++) {
14992
15001
  const subFs = fsi.filesystem(i);
@@ -15040,14 +15049,14 @@ var init_overlayfs = __esm({
15040
15049
  if (this.fss.length === 0) {
15041
15050
  throw ErrFileNotFound;
15042
15051
  }
15043
- const [fs13, fi, , err] = await this.statInternal(name, false);
15052
+ const [fs14, fi, , err] = await this.statInternal(name, false);
15044
15053
  if (err) {
15045
15054
  throw err;
15046
15055
  }
15047
15056
  if (fi.isDir()) {
15048
15057
  const dirFss = [];
15049
- await this.collectDirs(name, (fs14) => {
15050
- dirFss.push(fs14);
15058
+ await this.collectDirs(name, (fs15) => {
15059
+ dirFss.push(fs15);
15051
15060
  });
15052
15061
  if (dirFss.length === 0) {
15053
15062
  throw ErrFileNotFound;
@@ -15063,7 +15072,7 @@ var init_overlayfs = __esm({
15063
15072
  // Pass filesystems directly
15064
15073
  );
15065
15074
  }
15066
- return await fs13.open(name);
15075
+ return await fs14.open(name);
15067
15076
  }
15068
15077
  /**
15069
15078
  * Open file with flags (write operations use first filesystem)
@@ -15425,21 +15434,21 @@ var init_filesystemscollector = __esm({
15425
15434
  absFilename,
15426
15435
  base2
15427
15436
  );
15428
- const fs13 = rm2.fs(this.sourceProject);
15437
+ const fs14 = rm2.fs(this.sourceProject);
15429
15438
  if (this.isPrompts(mount.target())) {
15430
- fromToPrompt.push(fs13);
15439
+ fromToPrompt.push(fs14);
15431
15440
  } else if (this.isWorkflows(mount.target())) {
15432
- fromToWorkflow.push(fs13);
15441
+ fromToWorkflow.push(fs14);
15433
15442
  } else if (this.isContent(mount.target())) {
15434
- fromToContent.push(fs13);
15443
+ fromToContent.push(fs14);
15435
15444
  } else if (this.isLayouts(mount.target())) {
15436
- fromToLayouts.push(fs13);
15445
+ fromToLayouts.push(fs14);
15437
15446
  } else if (this.isStatics(mount.target())) {
15438
- fromToStatics.push(fs13);
15447
+ fromToStatics.push(fs14);
15439
15448
  } else if (this.isAssets(mount.target())) {
15440
- fromToAssets.push(fs13);
15449
+ fromToAssets.push(fs14);
15441
15450
  } else if (this.isI18n(mount.target())) {
15442
- fromToI18n.push(fs13);
15451
+ fromToI18n.push(fs14);
15443
15452
  }
15444
15453
  }
15445
15454
  if (fromToWorkflow.length > 0) {
@@ -15449,9 +15458,9 @@ var init_filesystemscollector = __esm({
15449
15458
  this.overlayMountsPrompt = this.overlayMountsPrompt.append(...fromToPrompt);
15450
15459
  }
15451
15460
  if (md.isProjectModule()) {
15452
- for (const fs13 of fromToContent) {
15461
+ for (const fs14 of fromToContent) {
15453
15462
  let ofs = createReadOnlyOverlayFs([]);
15454
- ofs = ofs.append(...[fs13]);
15463
+ ofs = ofs.append(...[fs14]);
15455
15464
  this.overlayMountsContent.push(ofs);
15456
15465
  }
15457
15466
  }
@@ -24410,9 +24419,9 @@ var init_pagecollector = __esm({
24410
24419
  fs;
24411
24420
  processedPaths = /* @__PURE__ */ new Set();
24412
24421
  // Track processed paths
24413
- constructor(pageMap, fs13) {
24422
+ constructor(pageMap, fs14) {
24414
24423
  this.m = pageMap;
24415
- this.fs = fs13;
24424
+ this.fs = fs14;
24416
24425
  }
24417
24426
  async collect() {
24418
24427
  try {
@@ -24430,9 +24439,9 @@ var init_pagecollector = __esm({
24430
24439
  /**
24431
24440
  * CollectDir - exact replica of Go's collectDir method
24432
24441
  */
24433
- async collectDir(fs13, path43, root2) {
24442
+ async collectDir(fs14, path43, root2) {
24434
24443
  try {
24435
- await this.fs.walkContent(fs13, path43, {
24444
+ await this.fs.walkContent(fs14, path43, {
24436
24445
  hookPre: async (dir2, path44, readdir2) => {
24437
24446
  const fullPath = path44;
24438
24447
  if (this.processedPaths.has(fullPath)) {
@@ -24529,8 +24538,8 @@ var init_content2 = __esm({
24529
24538
  pageMap;
24530
24539
  translator;
24531
24540
  pageCollected = false;
24532
- constructor(fs13, converter, pageMap, translator) {
24533
- this.fs = fs13;
24541
+ constructor(fs14, converter, pageMap, translator) {
24542
+ this.fs = fs14;
24534
24543
  this.converter = converter;
24535
24544
  this.pageMap = pageMap;
24536
24545
  this.translator = translator;
@@ -27653,8 +27662,8 @@ var init_lookup = __esm({
27653
27662
  });
27654
27663
 
27655
27664
  // internal/domain/template/entity/template.ts
27656
- function newTemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs13) {
27657
- return new TemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs13);
27665
+ function newTemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs14) {
27666
+ return new TemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs14);
27658
27667
  }
27659
27668
  var log52, TemplateEngine;
27660
27669
  var init_template = __esm({
@@ -27675,14 +27684,14 @@ var init_template = __esm({
27675
27684
  partialNamespace;
27676
27685
  shortcodeNamespace;
27677
27686
  fs;
27678
- constructor(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs13) {
27687
+ constructor(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs14) {
27679
27688
  this.executor = executor;
27680
27689
  this.lookup = lookup;
27681
27690
  this.parser = parser;
27682
27691
  this.templateNamespace = templateNamespace;
27683
27692
  this.partialNamespace = partialNamespace;
27684
27693
  this.shortcodeNamespace = shortcodeNamespace;
27685
- this.fs = fs13;
27694
+ this.fs = fs14;
27686
27695
  }
27687
27696
  /**
27688
27697
  * Mark template engine as ready
@@ -30362,9 +30371,9 @@ var init_registry = __esm({
30362
30371
  function newTemplateFactory() {
30363
30372
  return new Factory2();
30364
30373
  }
30365
- async function createTemplateEngineWithServices(fs13, services) {
30374
+ async function createTemplateEngineWithServices(fs14, services) {
30366
30375
  const factory = newTemplateFactory();
30367
- return factory.createWithServices(fs13, services);
30376
+ return factory.createWithServices(fs14, services);
30368
30377
  }
30369
30378
  var Factory2, Builder;
30370
30379
  var init_template2 = __esm({
@@ -30382,15 +30391,15 @@ var init_template2 = __esm({
30382
30391
  /**
30383
30392
  * Create template engine with file system (core functions only)
30384
30393
  */
30385
- async create(fs13) {
30386
- return this.createWithConfig(fs13, {});
30394
+ async create(fs14) {
30395
+ return this.createWithConfig(fs14, {});
30387
30396
  }
30388
30397
  /**
30389
30398
  * Create template engine with configuration
30390
30399
  */
30391
- async createWithConfig(fs13, config) {
30400
+ async createWithConfig(fs14, config) {
30392
30401
  try {
30393
- const builder = new Builder().withFs(fs13).withNamespaces(
30402
+ const builder = new Builder().withFs(fs14).withNamespaces(
30394
30403
  newRegularTemplateNamespace(),
30395
30404
  newPartialTemplateNamespace(),
30396
30405
  newShortcodeTemplateNamespace()
@@ -30414,8 +30423,8 @@ var init_template2 = __esm({
30414
30423
  * Create template engine with services
30415
30424
  * TypeScript equivalent of Go's New(fs, cfs) function
30416
30425
  */
30417
- async createWithServices(fs13, services) {
30418
- return this.createWithConfig(fs13, { services });
30426
+ async createWithServices(fs14, services) {
30427
+ return this.createWithConfig(fs14, { services });
30419
30428
  }
30420
30429
  };
30421
30430
  Builder = class {
@@ -30432,8 +30441,8 @@ var init_template2 = __esm({
30432
30441
  /**
30433
30442
  * Set file system
30434
30443
  */
30435
- withFs(fs13) {
30436
- this.fs = fs13;
30444
+ withFs(fs14) {
30445
+ this.fs = fs14;
30437
30446
  return this;
30438
30447
  }
30439
30448
  /**
@@ -47729,17 +47738,17 @@ var init_site = __esm({
47729
47738
  });
47730
47739
 
47731
47740
  // internal/domain/site/entity/publisher.ts
47732
- async function openFileForWriting(fs13, filename) {
47741
+ async function openFileForWriting(fs14, filename) {
47733
47742
  const cleanFilename = import_path26.default.normalize(filename);
47734
47743
  try {
47735
- return await fs13.create(cleanFilename);
47744
+ return await fs14.create(cleanFilename);
47736
47745
  } catch (error) {
47737
47746
  if (!isFileNotFoundError(error)) {
47738
47747
  throw error;
47739
47748
  }
47740
47749
  const dir2 = import_path26.default.dirname(cleanFilename);
47741
- await fs13.mkdirAll(dir2, 511);
47742
- return await fs13.create(cleanFilename);
47750
+ await fs14.mkdirAll(dir2, 511);
47751
+ return await fs14.create(cleanFilename);
47743
47752
  }
47744
47753
  }
47745
47754
  function isFileNotFoundError(error) {
@@ -47754,8 +47763,8 @@ var init_publisher2 = __esm({
47754
47763
  log64 = getDomainLogger("site", { component: "publisher" });
47755
47764
  Publisher = class {
47756
47765
  fs;
47757
- constructor(fs13) {
47758
- this.fs = fs13;
47766
+ constructor(fs14) {
47767
+ this.fs = fs14;
47759
47768
  }
47760
47769
  /**
47761
47770
  * PublishSource publishes content from a source buffer to files
@@ -50274,10 +50283,10 @@ __export(ssg_exports, {
50274
50283
  processSSGWithProgress: () => processSSGWithProgress,
50275
50284
  serveSSG: () => serveSSG
50276
50285
  });
50277
- function setDomainInstances(site, content, fs13, config, modules, resources, template) {
50286
+ function setDomainInstances(site, content, fs14, config, modules, resources, template) {
50278
50287
  siteCache = site;
50279
50288
  contentCache = content;
50280
- fsCache = fs13;
50289
+ fsCache = fs14;
50281
50290
  configCache = config;
50282
50291
  modulesCache = modules;
50283
50292
  resourcesCache = resources;
@@ -50345,8 +50354,8 @@ async function createContentEngine(filesystem, config, modules, markdown) {
50345
50354
  contentFs: () => {
50346
50355
  return filesystem.contentFs();
50347
50356
  },
50348
- walkContent: (fs13, start, cb, conf) => {
50349
- return filesystem.walkContent(fs13, start, cb, conf);
50357
+ walkContent: (fs14, start, cb, conf) => {
50358
+ return filesystem.walkContent(fs14, start, cb, conf);
50350
50359
  },
50351
50360
  walkI18n: (start, cb, conf) => {
50352
50361
  return filesystem.walkI18n(start, cb, conf);
@@ -50440,10 +50449,10 @@ function createCustomizedFunctions(config, site, resources) {
50440
50449
  }
50441
50450
  };
50442
50451
  }
50443
- function createResourcesEngine(config, fs13) {
50452
+ function createResourcesEngine(config, fs14) {
50444
50453
  const workspace = {
50445
- assetsFs: () => fs13.assetsFs(),
50446
- publishFs: () => fs13.publishFs(),
50454
+ assetsFs: () => fs14.assetsFs(),
50455
+ publishFs: () => fs14.publishFs(),
50447
50456
  baseUrl: () => config.getProvider().getString("baseURL") || "http://localhost",
50448
50457
  executeTemplate: async (templateName, rawContent, data) => {
50449
50458
  throw new Error("Template execution not initialized. Please call resources.setTemplateSvc() first.");
@@ -50451,10 +50460,10 @@ function createResourcesEngine(config, fs13) {
50451
50460
  };
50452
50461
  return createResources(workspace);
50453
50462
  }
50454
- async function createTemplateEngineFromFs(fs13, config, site, resources) {
50463
+ async function createTemplateEngineFromFs(fs14, config, site, resources) {
50455
50464
  const services = createCustomizedFunctions(config, site, resources);
50456
50465
  const templateFs = {
50457
- walk: fs13.walkLayouts.bind(fs13)
50466
+ walk: fs14.walkLayouts.bind(fs14)
50458
50467
  };
50459
50468
  return await createTemplateEngineWithServices(templateFs, services);
50460
50469
  }
@@ -50494,7 +50503,7 @@ async function createTemplateAdapter(templateEngine, site) {
50494
50503
  }
50495
50504
  };
50496
50505
  }
50497
- function createSiteForSSG(config, fs13, content) {
50506
+ function createSiteForSSG(config, fs14, content) {
50498
50507
  const siteServices = {
50499
50508
  // Config service methods
50500
50509
  configParams: () => config.getProvider().getParams("params"),
@@ -50575,13 +50584,13 @@ function createSiteForSSG(config, fs13, content) {
50575
50584
  generateSitemap: async () => ({ urls: [] }),
50576
50585
  // Publisher methods
50577
50586
  publishFs: () => {
50578
- return fs13.publishFs();
50587
+ return fs14.publishFs();
50579
50588
  },
50580
50589
  staticFs() {
50581
- return fs13.staticFs();
50590
+ return fs14.staticFs();
50582
50591
  },
50583
50592
  copyStaticFiles(from, to) {
50584
- return fs13.copyStatic([from], to);
50593
+ return fs14.copyStatic([from], to);
50585
50594
  },
50586
50595
  workingDir: () => config.getProvider().getString("workingDir") || process.cwd(),
50587
50596
  // ResourceService implementation (placeholder)
@@ -50885,11 +50894,11 @@ var init_ssg = __esm({
50885
50894
  import_path27 = __toESM(require("path"));
50886
50895
  init_resources2();
50887
50896
  log76 = getDomainLogger("ssg", { component: "application" });
50888
- createDomainInstances = (site, content, fs13, config, modules, resources) => {
50897
+ createDomainInstances = (site, content, fs14, config, modules, resources) => {
50889
50898
  return {
50890
50899
  site,
50891
50900
  content,
50892
- fs: fs13,
50901
+ fs: fs14,
50893
50902
  config,
50894
50903
  modules,
50895
50904
  resources
@@ -52090,18 +52099,47 @@ init_log();
52090
52099
  // pkg/web/watcher/content-file-watcher.ts
52091
52100
  var chokidar = __toESM(require("chokidar"));
52092
52101
  var path40 = __toESM(require("path"));
52102
+ var fs11 = __toESM(require("fs"));
52093
52103
  init_log();
52094
52104
  var log83 = getDomainLogger("web", { component: "content-file-watcher" });
52095
52105
  var ContentFileWatcher = class {
52096
52106
  constructor(config) {
52097
52107
  this.config = config;
52098
52108
  this.batchDelay = config.batchDelay || 500;
52109
+ if (config.isSingleFileMode !== void 0) {
52110
+ this.isSingleFileMode = config.isSingleFileMode;
52111
+ } else {
52112
+ this.isSingleFileMode = this.detectSingleFileMode(config.contentDirs);
52113
+ }
52114
+ if (this.isSingleFileMode) {
52115
+ log83.info("Single file mode detected", {
52116
+ contentDirs: config.contentDirs
52117
+ });
52118
+ }
52099
52119
  }
52100
52120
  watcher = null;
52101
52121
  eventQueue = [];
52102
52122
  batchTimer = null;
52103
52123
  batchDelay;
52104
52124
  callbacks = [];
52125
+ isSingleFileMode = false;
52126
+ /**
52127
+ * 检测是否所有路径都是单个文件
52128
+ */
52129
+ detectSingleFileMode(paths) {
52130
+ if (paths.length === 0) {
52131
+ return false;
52132
+ }
52133
+ return paths.every((p2) => {
52134
+ try {
52135
+ const stats = fs11.statSync(p2);
52136
+ return stats.isFile();
52137
+ } catch {
52138
+ const ext = path40.extname(p2).toLowerCase();
52139
+ return ext === ".md" || ext === ".markdown";
52140
+ }
52141
+ });
52142
+ }
52105
52143
  async startWatching() {
52106
52144
  if (this.watcher) {
52107
52145
  await this.stopWatching();
@@ -52137,14 +52175,30 @@ var ContentFileWatcher = class {
52137
52175
  }
52138
52176
  queueEvent(filePath, eventType) {
52139
52177
  let fp = filePath;
52140
- const { projContentDirs, contentDirs } = this.config;
52141
- for (let i = 0; i < projContentDirs.length; i++) {
52142
- const projContentDir = projContentDirs[i];
52143
- for (let j = 0; j < contentDirs.length; j++) {
52144
- const contentDir = contentDirs[j];
52145
- if (projContentDir !== contentDir && fp.startsWith(contentDir)) {
52146
- fp = projContentDir + fp.slice(contentDir.length);
52147
- break;
52178
+ if (this.isSingleFileMode) {
52179
+ const matchedIndex = this.config.contentDirs.findIndex((contentFile) => {
52180
+ return path40.normalize(filePath) === path40.normalize(contentFile);
52181
+ });
52182
+ if (matchedIndex !== -1) {
52183
+ const projContentDir = this.config.projContentDirs[matchedIndex];
52184
+ fp = path40.join(projContentDir, "index.md");
52185
+ log83.debug("Single file event mapped", {
52186
+ original: filePath,
52187
+ mapped: fp
52188
+ });
52189
+ } else {
52190
+ return;
52191
+ }
52192
+ } else {
52193
+ const { projContentDirs, contentDirs } = this.config;
52194
+ for (let i = 0; i < projContentDirs.length; i++) {
52195
+ const projContentDir = projContentDirs[i];
52196
+ for (let j = 0; j < contentDirs.length; j++) {
52197
+ const contentDir = contentDirs[j];
52198
+ if (projContentDir !== contentDir && fp.startsWith(contentDir)) {
52199
+ fp = projContentDir + fp.slice(contentDir.length);
52200
+ break;
52201
+ }
52148
52202
  }
52149
52203
  }
52150
52204
  }
@@ -52218,7 +52272,7 @@ var ContentFileWatcher = class {
52218
52272
  // pkg/web/server/livereload-server.ts
52219
52273
  var http3 = __toESM(require("http"));
52220
52274
  var path41 = __toESM(require("path"));
52221
- var fs11 = __toESM(require("fs/promises"));
52275
+ var fs12 = __toESM(require("fs/promises"));
52222
52276
  var import_ws = require("ws");
52223
52277
  init_log();
52224
52278
  var log84 = getDomainLogger("web", { component: "livereload-server" });
@@ -52370,11 +52424,11 @@ var FoundryLiveReloadServer = class {
52370
52424
  const url = req.url || "/";
52371
52425
  let filePath = this.resolveFilePath(url);
52372
52426
  try {
52373
- const stats = await fs11.stat(filePath);
52427
+ const stats = await fs12.stat(filePath);
52374
52428
  if (stats.isDirectory()) {
52375
52429
  const indexPath = path41.join(filePath, "index.html");
52376
52430
  try {
52377
- await fs11.stat(indexPath);
52431
+ await fs12.stat(indexPath);
52378
52432
  filePath = indexPath;
52379
52433
  } catch {
52380
52434
  res.statusCode = 404;
@@ -52382,7 +52436,7 @@ var FoundryLiveReloadServer = class {
52382
52436
  return;
52383
52437
  }
52384
52438
  }
52385
- let content = await fs11.readFile(filePath);
52439
+ let content = await fs12.readFile(filePath);
52386
52440
  const contentType = this.getContentType(filePath);
52387
52441
  res.setHeader("Content-Type", contentType);
52388
52442
  if (contentType.includes("text/html") && this.config.enableLiveReload) {
@@ -52540,7 +52594,7 @@ var FoundryLiveReloadServer = class {
52540
52594
  // pkg/web/server/electron-livereload-server.ts
52541
52595
  var http4 = __toESM(require("http"));
52542
52596
  var path42 = __toESM(require("path"));
52543
- var fs12 = __toESM(require("fs/promises"));
52597
+ var fs13 = __toESM(require("fs/promises"));
52544
52598
  init_log();
52545
52599
  var log85 = getDomainLogger("web", { component: "electron-livereload-server" });
52546
52600
  var ElectronLiveReloadServer = class {
@@ -52587,7 +52641,7 @@ var ElectronLiveReloadServer = class {
52587
52641
  this.httpServer = null;
52588
52642
  }
52589
52643
  try {
52590
- await fs12.unlink(this.stateFilePath);
52644
+ await fs13.unlink(this.stateFilePath);
52591
52645
  } catch (error) {
52592
52646
  }
52593
52647
  this.running = false;
@@ -52633,7 +52687,7 @@ var ElectronLiveReloadServer = class {
52633
52687
  }
52634
52688
  async writeStateFile(state) {
52635
52689
  try {
52636
- await fs12.writeFile(this.stateFilePath, JSON.stringify(state), "utf8");
52690
+ await fs13.writeFile(this.stateFilePath, JSON.stringify(state), "utf8");
52637
52691
  } catch (error) {
52638
52692
  log85.error("Failed to write LiveReload state file:", error);
52639
52693
  }
@@ -52670,7 +52724,7 @@ var ElectronLiveReloadServer = class {
52670
52724
  const url = req.url || "/";
52671
52725
  if (url.startsWith("/.foundry-livereload-state.json")) {
52672
52726
  try {
52673
- const content = await fs12.readFile(this.stateFilePath, "utf8");
52727
+ const content = await fs13.readFile(this.stateFilePath, "utf8");
52674
52728
  res.setHeader("Content-Type", "application/json; charset=utf-8");
52675
52729
  res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
52676
52730
  res.setHeader("Pragma", "no-cache");
@@ -52691,11 +52745,11 @@ var ElectronLiveReloadServer = class {
52691
52745
  }
52692
52746
  let filePath = this.resolveFilePath(url);
52693
52747
  try {
52694
- const stats = await fs12.stat(filePath);
52748
+ const stats = await fs13.stat(filePath);
52695
52749
  if (stats.isDirectory()) {
52696
52750
  const indexPath = path42.join(filePath, "index.html");
52697
52751
  try {
52698
- await fs12.stat(indexPath);
52752
+ await fs13.stat(indexPath);
52699
52753
  filePath = indexPath;
52700
52754
  } catch {
52701
52755
  res.statusCode = 404;
@@ -52703,7 +52757,7 @@ var ElectronLiveReloadServer = class {
52703
52757
  return;
52704
52758
  }
52705
52759
  }
52706
- let content = await fs12.readFile(filePath);
52760
+ let content = await fs13.readFile(filePath);
52707
52761
  const contentType = this.getContentType(filePath);
52708
52762
  res.setHeader("Content-Type", contentType);
52709
52763
  if (contentType.includes("text/html") && this.config.enableLiveReload) {
@@ -55171,7 +55225,7 @@ For more information, visit: https://help.mdfriday.com
55171
55225
  * Show version
55172
55226
  */
55173
55227
  showVersion() {
55174
- const version = "26.3.21";
55228
+ const version = "26.4.1";
55175
55229
  return {
55176
55230
  success: true,
55177
55231
  message: `MDFriday CLI v${version}`