@mdfriday/foundry 26.3.22 → 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
|
@@ -9174,8 +9174,8 @@ var init_node_manifest_repository = __esm({
|
|
|
9174
9174
|
async calculateFileHash(filePath, algorithm = "md5") {
|
|
9175
9175
|
return new Promise((resolve3, reject) => {
|
|
9176
9176
|
const hash = import_crypto.default.createHash(algorithm);
|
|
9177
|
-
const
|
|
9178
|
-
const stream =
|
|
9177
|
+
const fs14 = require("fs");
|
|
9178
|
+
const stream = fs14.createReadStream(filePath);
|
|
9179
9179
|
stream.on("data", (data) => hash.update(data));
|
|
9180
9180
|
stream.on("end", () => resolve3(hash.digest("hex")));
|
|
9181
9181
|
stream.on("error", reject);
|
|
@@ -11731,8 +11731,8 @@ var init_loader = __esm({
|
|
|
11731
11731
|
*/
|
|
11732
11732
|
async fileExists(filename) {
|
|
11733
11733
|
try {
|
|
11734
|
-
const
|
|
11735
|
-
const stat4 = await
|
|
11734
|
+
const fs14 = this.sourceDescriptor.fs();
|
|
11735
|
+
const stat4 = await fs14.stat(filename);
|
|
11736
11736
|
return !stat4.isDir();
|
|
11737
11737
|
} catch {
|
|
11738
11738
|
return false;
|
|
@@ -11742,8 +11742,8 @@ var init_loader = __esm({
|
|
|
11742
11742
|
* Load configuration from file
|
|
11743
11743
|
*/
|
|
11744
11744
|
async loadConfigFromFile(filename) {
|
|
11745
|
-
const
|
|
11746
|
-
const file = await
|
|
11745
|
+
const fs14 = this.sourceDescriptor.fs();
|
|
11746
|
+
const file = await fs14.open(filename);
|
|
11747
11747
|
try {
|
|
11748
11748
|
const buffer = new Uint8Array(1024 * 1024);
|
|
11749
11749
|
const { bytesRead } = await file.read(buffer);
|
|
@@ -11762,8 +11762,8 @@ var init_loader = __esm({
|
|
|
11762
11762
|
});
|
|
11763
11763
|
|
|
11764
11764
|
// internal/domain/config/factory/sourcedescriptor.ts
|
|
11765
|
-
function newSourceDescriptor(
|
|
11766
|
-
return new ConfigSourceDescriptor(
|
|
11765
|
+
function newSourceDescriptor(fs14, filename) {
|
|
11766
|
+
return new ConfigSourceDescriptor(fs14, filename);
|
|
11767
11767
|
}
|
|
11768
11768
|
var ConfigSourceDescriptor;
|
|
11769
11769
|
var init_sourcedescriptor = __esm({
|
|
@@ -11772,8 +11772,8 @@ var init_sourcedescriptor = __esm({
|
|
|
11772
11772
|
ConfigSourceDescriptor = class {
|
|
11773
11773
|
fileSystem;
|
|
11774
11774
|
configFilename;
|
|
11775
|
-
constructor(
|
|
11776
|
-
this.fileSystem =
|
|
11775
|
+
constructor(fs14, filename) {
|
|
11776
|
+
this.fileSystem = fs14;
|
|
11777
11777
|
this.configFilename = filename;
|
|
11778
11778
|
}
|
|
11779
11779
|
fs() {
|
|
@@ -11787,7 +11787,7 @@ var init_sourcedescriptor = __esm({
|
|
|
11787
11787
|
});
|
|
11788
11788
|
|
|
11789
11789
|
// internal/domain/config/factory/config.ts
|
|
11790
|
-
async function loadConfigWithParams(
|
|
11790
|
+
async function loadConfigWithParams(fs14, configFilename, workingDir, modulesDir, params = {}) {
|
|
11791
11791
|
const cleanWorkingDir = path14.resolve(workingDir);
|
|
11792
11792
|
const cleanModulesDir = path14.resolve(modulesDir);
|
|
11793
11793
|
const cleanPublishDir = path14.resolve(DEFAULT_PUBLISH_DIR);
|
|
@@ -11797,9 +11797,9 @@ async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir
|
|
|
11797
11797
|
publishDir: cleanPublishDir,
|
|
11798
11798
|
cacheDir: ""
|
|
11799
11799
|
};
|
|
11800
|
-
baseDirs.cacheDir = await getCacheDir(
|
|
11800
|
+
baseDirs.cacheDir = await getCacheDir(fs14, baseDirs.cacheDir);
|
|
11801
11801
|
const loader = new ConfigLoader(
|
|
11802
|
-
newSourceDescriptor(
|
|
11802
|
+
newSourceDescriptor(fs14, configFilename),
|
|
11803
11803
|
baseDirs
|
|
11804
11804
|
);
|
|
11805
11805
|
try {
|
|
@@ -11808,9 +11808,9 @@ async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir
|
|
|
11808
11808
|
provider.set(key2, value);
|
|
11809
11809
|
}
|
|
11810
11810
|
const absPublishDir = path14.resolve(provider.get("publishDir") || DEFAULT_PUBLISH_DIR);
|
|
11811
|
-
await
|
|
11811
|
+
await fs14.mkdirAll(absPublishDir, 511);
|
|
11812
11812
|
return newConfig(
|
|
11813
|
-
|
|
11813
|
+
fs14,
|
|
11814
11814
|
provider,
|
|
11815
11815
|
newRoot(provider.get(""), provider.getParams("params")),
|
|
11816
11816
|
newDir(baseDirs.workingDir, baseDirs.modulesDir, absPublishDir),
|
|
@@ -11825,14 +11825,14 @@ async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir
|
|
|
11825
11825
|
loader.deleteMergeStrategies();
|
|
11826
11826
|
}
|
|
11827
11827
|
}
|
|
11828
|
-
async function getCacheDir(
|
|
11828
|
+
async function getCacheDir(fs14, cacheDir) {
|
|
11829
11829
|
if (cacheDir !== "") {
|
|
11830
11830
|
return cacheDir;
|
|
11831
11831
|
}
|
|
11832
11832
|
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
11833
11833
|
const defaultCacheDir = path14.join(homeDir, ".cache", "mdf");
|
|
11834
11834
|
try {
|
|
11835
|
-
await
|
|
11835
|
+
await fs14.mkdirAll(defaultCacheDir, 493);
|
|
11836
11836
|
return defaultCacheDir;
|
|
11837
11837
|
} catch {
|
|
11838
11838
|
return path14.join("/tmp", "hugo-cache");
|
|
@@ -12012,11 +12012,11 @@ var init_mount = __esm({
|
|
|
12012
12012
|
});
|
|
12013
12013
|
|
|
12014
12014
|
// internal/domain/module/vo/httpclient.ts
|
|
12015
|
-
function newHttpClient(
|
|
12015
|
+
function newHttpClient(fs14, timeout, headers, customClient) {
|
|
12016
12016
|
if (customClient) {
|
|
12017
12017
|
return customClient;
|
|
12018
12018
|
}
|
|
12019
|
-
return new NodeHttpClient2(
|
|
12019
|
+
return new NodeHttpClient2(fs14, timeout, headers);
|
|
12020
12020
|
}
|
|
12021
12021
|
var path16, http, https, log20, NodeHttpClient2;
|
|
12022
12022
|
var init_httpclient = __esm({
|
|
@@ -12029,8 +12029,8 @@ var init_httpclient = __esm({
|
|
|
12029
12029
|
init_log();
|
|
12030
12030
|
log20 = getDomainLogger("module", { component: "httpclient" });
|
|
12031
12031
|
NodeHttpClient2 = class {
|
|
12032
|
-
constructor(
|
|
12033
|
-
this.fs =
|
|
12032
|
+
constructor(fs14, timeout = 3e4, headers = {}) {
|
|
12033
|
+
this.fs = fs14;
|
|
12034
12034
|
this.timeout = timeout;
|
|
12035
12035
|
this.headers = headers;
|
|
12036
12036
|
}
|
|
@@ -12215,12 +12215,12 @@ var init_httpclient = __esm({
|
|
|
12215
12215
|
});
|
|
12216
12216
|
|
|
12217
12217
|
// internal/domain/module/vo/zipextractor.ts
|
|
12218
|
-
function newZipExtractor(
|
|
12218
|
+
function newZipExtractor(fs14, environment = "node") {
|
|
12219
12219
|
switch (environment) {
|
|
12220
12220
|
case "node":
|
|
12221
|
-
return new JsZipExtractor(
|
|
12221
|
+
return new JsZipExtractor(fs14);
|
|
12222
12222
|
case "browser":
|
|
12223
|
-
return new WebZipExtractor(
|
|
12223
|
+
return new WebZipExtractor(fs14);
|
|
12224
12224
|
default:
|
|
12225
12225
|
throw new Error(`Unsupported environment: ${environment}`);
|
|
12226
12226
|
}
|
|
@@ -12235,8 +12235,8 @@ var init_zipextractor = __esm({
|
|
|
12235
12235
|
path17 = __toESM(require("path"));
|
|
12236
12236
|
log21 = getDomainLogger("module", { component: "zipextractor" });
|
|
12237
12237
|
JsZipExtractor = class {
|
|
12238
|
-
constructor(
|
|
12239
|
-
this.fs =
|
|
12238
|
+
constructor(fs14) {
|
|
12239
|
+
this.fs = fs14;
|
|
12240
12240
|
}
|
|
12241
12241
|
/**
|
|
12242
12242
|
* Extract ZIP file to target directory
|
|
@@ -12339,8 +12339,8 @@ var init_zipextractor = __esm({
|
|
|
12339
12339
|
}
|
|
12340
12340
|
};
|
|
12341
12341
|
WebZipExtractor = class {
|
|
12342
|
-
constructor(
|
|
12343
|
-
this.fs =
|
|
12342
|
+
constructor(fs14) {
|
|
12343
|
+
this.fs = fs14;
|
|
12344
12344
|
}
|
|
12345
12345
|
async extract(zipPath, targetDir) {
|
|
12346
12346
|
try {
|
|
@@ -12363,8 +12363,8 @@ var init_zipextractor = __esm({
|
|
|
12363
12363
|
});
|
|
12364
12364
|
|
|
12365
12365
|
// internal/domain/module/vo/cache.ts
|
|
12366
|
-
function newModuleCache(
|
|
12367
|
-
return new FsModuleCache(
|
|
12366
|
+
function newModuleCache(fs14, cacheDir) {
|
|
12367
|
+
return new FsModuleCache(fs14, cacheDir);
|
|
12368
12368
|
}
|
|
12369
12369
|
var path18, log22, FsModuleCache;
|
|
12370
12370
|
var init_cache = __esm({
|
|
@@ -12375,8 +12375,8 @@ var init_cache = __esm({
|
|
|
12375
12375
|
path18 = __toESM(require("path"));
|
|
12376
12376
|
log22 = getDomainLogger("module", { component: "cache" });
|
|
12377
12377
|
FsModuleCache = class {
|
|
12378
|
-
constructor(
|
|
12379
|
-
this.fs =
|
|
12378
|
+
constructor(fs14, cacheDir = "./module/cache") {
|
|
12379
|
+
this.fs = fs14;
|
|
12380
12380
|
this.cacheDir = cacheDir;
|
|
12381
12381
|
}
|
|
12382
12382
|
cacheDir;
|
|
@@ -12533,15 +12533,15 @@ var init_cache = __esm({
|
|
|
12533
12533
|
});
|
|
12534
12534
|
|
|
12535
12535
|
// internal/domain/module/vo/module.ts
|
|
12536
|
-
function newModule2(
|
|
12537
|
-
return new Module2(
|
|
12536
|
+
function newModule2(fs14, absoluteDir, modulePath, parent) {
|
|
12537
|
+
return new Module2(fs14, absoluteDir, modulePath, parent || null, false);
|
|
12538
12538
|
}
|
|
12539
12539
|
function newProjectModule(info) {
|
|
12540
|
-
const
|
|
12540
|
+
const fs14 = info.osFs();
|
|
12541
12541
|
const absoluteDir = info.projDir();
|
|
12542
12542
|
const modulePath = "project-root";
|
|
12543
12543
|
const defaultLanguage3 = info.defaultLanguageKey();
|
|
12544
|
-
const module2 = new Module2(
|
|
12544
|
+
const module2 = new Module2(fs14, absoluteDir, modulePath, null, true);
|
|
12545
12545
|
const projectModule = new ProjectModule(module2);
|
|
12546
12546
|
projectModule.applyDefaultMounts();
|
|
12547
12547
|
if (defaultLanguage3) {
|
|
@@ -12569,8 +12569,8 @@ var init_module3 = __esm({
|
|
|
12569
12569
|
init_mount();
|
|
12570
12570
|
path19 = __toESM(require("path"));
|
|
12571
12571
|
Module2 = class _Module {
|
|
12572
|
-
constructor(
|
|
12573
|
-
this.fs =
|
|
12572
|
+
constructor(fs14, absoluteDir, modulePath, parent = null, isProject = false) {
|
|
12573
|
+
this.fs = fs14;
|
|
12574
12574
|
this.absoluteDir = absoluteDir;
|
|
12575
12575
|
this.modulePath = modulePath;
|
|
12576
12576
|
this.parentModule = parent;
|
|
@@ -13663,11 +13663,11 @@ var init_fileinfo = __esm({
|
|
|
13663
13663
|
});
|
|
13664
13664
|
|
|
13665
13665
|
// internal/domain/fs/vo/file.ts
|
|
13666
|
-
function newFileWithMeta(file, meta,
|
|
13667
|
-
return new File(file, meta,
|
|
13666
|
+
function newFileWithMeta(file, meta, fs14) {
|
|
13667
|
+
return new File(file, meta, fs14);
|
|
13668
13668
|
}
|
|
13669
|
-
function newDirFileWithMeta(file, meta,
|
|
13670
|
-
return new File(file, meta,
|
|
13669
|
+
function newDirFileWithMeta(file, meta, fs14) {
|
|
13670
|
+
return new File(file, meta, fs14, true);
|
|
13671
13671
|
}
|
|
13672
13672
|
var path22, File;
|
|
13673
13673
|
var init_file = __esm({
|
|
@@ -13681,10 +13681,10 @@ var init_file = __esm({
|
|
|
13681
13681
|
fileMeta;
|
|
13682
13682
|
fs;
|
|
13683
13683
|
_isDir;
|
|
13684
|
-
constructor(file, fileMeta,
|
|
13684
|
+
constructor(file, fileMeta, fs14, isDir = false) {
|
|
13685
13685
|
this.file = file;
|
|
13686
13686
|
this.fileMeta = fileMeta;
|
|
13687
|
-
this.fs =
|
|
13687
|
+
this.fs = fs14;
|
|
13688
13688
|
this._isDir = isDir;
|
|
13689
13689
|
}
|
|
13690
13690
|
/**
|
|
@@ -13812,8 +13812,8 @@ var init_file = __esm({
|
|
|
13812
13812
|
});
|
|
13813
13813
|
|
|
13814
13814
|
// internal/domain/fs/vo/dir.ts
|
|
13815
|
-
function newDirFile(file, meta,
|
|
13816
|
-
const baseFile = new File(file, meta,
|
|
13815
|
+
function newDirFile(file, meta, fs14) {
|
|
13816
|
+
const baseFile = new File(file, meta, fs14, true);
|
|
13817
13817
|
return new DirFile(baseFile);
|
|
13818
13818
|
}
|
|
13819
13819
|
var DirFile;
|
|
@@ -13888,8 +13888,8 @@ var init_dir2 = __esm({
|
|
|
13888
13888
|
});
|
|
13889
13889
|
|
|
13890
13890
|
// internal/domain/fs/entity/basefs.ts
|
|
13891
|
-
function newBaseFs(
|
|
13892
|
-
return new BaseFs(
|
|
13891
|
+
function newBaseFs(fs14, roots) {
|
|
13892
|
+
return new BaseFs(fs14, roots);
|
|
13893
13893
|
}
|
|
13894
13894
|
var path23, log26, BaseFs;
|
|
13895
13895
|
var init_basefs = __esm({
|
|
@@ -13906,8 +13906,8 @@ var init_basefs = __esm({
|
|
|
13906
13906
|
fs;
|
|
13907
13907
|
// osFs
|
|
13908
13908
|
roots;
|
|
13909
|
-
constructor(
|
|
13910
|
-
this.fs =
|
|
13909
|
+
constructor(fs14, roots) {
|
|
13910
|
+
this.fs = fs14;
|
|
13911
13911
|
this.roots = roots;
|
|
13912
13912
|
}
|
|
13913
13913
|
/**
|
|
@@ -14059,8 +14059,8 @@ var init_basefs = __esm({
|
|
|
14059
14059
|
});
|
|
14060
14060
|
|
|
14061
14061
|
// internal/domain/fs/vo/walkway.ts
|
|
14062
|
-
function newWalkway(
|
|
14063
|
-
return new Walkway(
|
|
14062
|
+
function newWalkway(fs14, cb) {
|
|
14063
|
+
return new Walkway(fs14, cb);
|
|
14064
14064
|
}
|
|
14065
14065
|
var path24, log27, Walkway;
|
|
14066
14066
|
var init_walkway = __esm({
|
|
@@ -14078,14 +14078,14 @@ var init_walkway = __esm({
|
|
|
14078
14078
|
cb;
|
|
14079
14079
|
cfg;
|
|
14080
14080
|
walked = false;
|
|
14081
|
-
constructor(
|
|
14082
|
-
if (!
|
|
14081
|
+
constructor(fs14, cb) {
|
|
14082
|
+
if (!fs14) {
|
|
14083
14083
|
throw new Error("fs must be set");
|
|
14084
14084
|
}
|
|
14085
14085
|
if (!cb.walkFn) {
|
|
14086
14086
|
throw new Error("walkFn must be set");
|
|
14087
14087
|
}
|
|
14088
|
-
this.fs =
|
|
14088
|
+
this.fs = fs14;
|
|
14089
14089
|
this.cb = cb;
|
|
14090
14090
|
this.root = "";
|
|
14091
14091
|
this.cfg = {};
|
|
@@ -14290,9 +14290,9 @@ var init_static_copier = __esm({
|
|
|
14290
14290
|
/**
|
|
14291
14291
|
* Walk filesystem recursively
|
|
14292
14292
|
*/
|
|
14293
|
-
async walkFileSystem(
|
|
14293
|
+
async walkFileSystem(fs14, basePath, callback) {
|
|
14294
14294
|
try {
|
|
14295
|
-
const file = await
|
|
14295
|
+
const file = await fs14.open(basePath);
|
|
14296
14296
|
const fileInfo = await file.stat();
|
|
14297
14297
|
if (!fileInfo.isDir()) {
|
|
14298
14298
|
await file.close();
|
|
@@ -14305,7 +14305,7 @@ var init_static_copier = __esm({
|
|
|
14305
14305
|
const fullPath = this.joinPath(basePath, entry.name());
|
|
14306
14306
|
if (entry.isDir()) {
|
|
14307
14307
|
await callback(fullPath, true);
|
|
14308
|
-
await this.walkFileSystem(
|
|
14308
|
+
await this.walkFileSystem(fs14, fullPath, callback);
|
|
14309
14309
|
} else {
|
|
14310
14310
|
await callback(fullPath, false);
|
|
14311
14311
|
}
|
|
@@ -14376,25 +14376,25 @@ async function collectFileMetaInfos(paths, fss) {
|
|
|
14376
14376
|
const result = /* @__PURE__ */ new Map();
|
|
14377
14377
|
let found = false;
|
|
14378
14378
|
for (const path43 of paths) {
|
|
14379
|
-
for (const
|
|
14379
|
+
for (const fs14 of fss) {
|
|
14380
14380
|
try {
|
|
14381
|
-
const fileMetaInfo = await createFileMetaInfo(path43,
|
|
14381
|
+
const fileMetaInfo = await createFileMetaInfo(path43, fs14);
|
|
14382
14382
|
result.set(path43, fileMetaInfo);
|
|
14383
14383
|
found = true;
|
|
14384
14384
|
if (found)
|
|
14385
14385
|
break;
|
|
14386
14386
|
} catch (error) {
|
|
14387
|
-
log29.error(`Failed to create FileMetaInfo for ${path43} with fs=${
|
|
14387
|
+
log29.error(`Failed to create FileMetaInfo for ${path43} with fs=${fs14}:`, error);
|
|
14388
14388
|
}
|
|
14389
14389
|
}
|
|
14390
14390
|
}
|
|
14391
14391
|
return result;
|
|
14392
14392
|
}
|
|
14393
|
-
async function createFileMetaInfo(filePath,
|
|
14393
|
+
async function createFileMetaInfo(filePath, fs14) {
|
|
14394
14394
|
try {
|
|
14395
|
-
const fi = await
|
|
14395
|
+
const fi = await fs14.stat(filePath);
|
|
14396
14396
|
const meta = newFileMeta(filePath);
|
|
14397
|
-
meta.setOpenFunc(async () => await
|
|
14397
|
+
meta.setOpenFunc(async () => await fs14.open(filePath));
|
|
14398
14398
|
return newFileInfoWithMeta(fi, meta);
|
|
14399
14399
|
} catch (error) {
|
|
14400
14400
|
throw new Error(`Failed to stat file ${filePath}: ${error.message}`);
|
|
@@ -14505,8 +14505,8 @@ var init_fs = __esm({
|
|
|
14505
14505
|
async walkLayouts(start, cb, conf) {
|
|
14506
14506
|
return await this.walk(this.layouts, start, cb, conf);
|
|
14507
14507
|
}
|
|
14508
|
-
async walkContent(
|
|
14509
|
-
await this.walk(
|
|
14508
|
+
async walkContent(fs14, start, cb, conf) {
|
|
14509
|
+
await this.walk(fs14, start, cb, conf);
|
|
14510
14510
|
}
|
|
14511
14511
|
async walkStatics(start, cb, conf) {
|
|
14512
14512
|
return await this.walk(this.statics, start, cb, conf);
|
|
@@ -14514,8 +14514,8 @@ var init_fs = __esm({
|
|
|
14514
14514
|
async walkI18n(start, cb, conf) {
|
|
14515
14515
|
return await this.walk(this.i18n, start, cb, conf);
|
|
14516
14516
|
}
|
|
14517
|
-
async walk(
|
|
14518
|
-
const w = newWalkway(
|
|
14517
|
+
async walk(fs14, start, cb, conf) {
|
|
14518
|
+
const w = newWalkway(fs14, cb);
|
|
14519
14519
|
if (start === "") {
|
|
14520
14520
|
start = "/";
|
|
14521
14521
|
}
|
|
@@ -14634,8 +14634,8 @@ var init_overlayoptions = __esm({
|
|
|
14634
14634
|
/**
|
|
14635
14635
|
* Check if filesystem exists in overlay
|
|
14636
14636
|
*/
|
|
14637
|
-
hasFilesystem(
|
|
14638
|
-
return this.fss.includes(
|
|
14637
|
+
hasFilesystem(fs14) {
|
|
14638
|
+
return this.fss.includes(fs14);
|
|
14639
14639
|
}
|
|
14640
14640
|
/**
|
|
14641
14641
|
* Get all filesystems as readonly array
|
|
@@ -14750,8 +14750,8 @@ var init_overlaydir = __esm({
|
|
|
14750
14750
|
*/
|
|
14751
14751
|
async loadDirectoryEntries() {
|
|
14752
14752
|
for (let i = 0; i < this.fss.length; i++) {
|
|
14753
|
-
const
|
|
14754
|
-
await this.readFromFilesystem(
|
|
14753
|
+
const fs14 = this.fss[i];
|
|
14754
|
+
await this.readFromFilesystem(fs14, null);
|
|
14755
14755
|
}
|
|
14756
14756
|
for (let i = 0; i < this.dirOpeners.length; i++) {
|
|
14757
14757
|
const file = await this.dirOpeners[i]();
|
|
@@ -14761,12 +14761,12 @@ var init_overlaydir = __esm({
|
|
|
14761
14761
|
/**
|
|
14762
14762
|
* Read directory entries from a specific filesystem or file
|
|
14763
14763
|
*/
|
|
14764
|
-
async readFromFilesystem(
|
|
14764
|
+
async readFromFilesystem(fs14, file) {
|
|
14765
14765
|
let f = file;
|
|
14766
14766
|
try {
|
|
14767
|
-
if (!f &&
|
|
14767
|
+
if (!f && fs14) {
|
|
14768
14768
|
const fsPath = this._name === "/" ? "" : this._name;
|
|
14769
|
-
f = await
|
|
14769
|
+
f = await fs14.open(fsPath);
|
|
14770
14770
|
}
|
|
14771
14771
|
if (!f) {
|
|
14772
14772
|
return;
|
|
@@ -14945,22 +14945,22 @@ var init_overlayfs = __esm({
|
|
|
14945
14945
|
* Collect directories from all filesystems
|
|
14946
14946
|
*/
|
|
14947
14947
|
async collectDirs(name, withFs) {
|
|
14948
|
-
for (const
|
|
14949
|
-
await this.collectDirsRecursive(
|
|
14948
|
+
for (const fs14 of this.fss) {
|
|
14949
|
+
await this.collectDirsRecursive(fs14, name, withFs);
|
|
14950
14950
|
}
|
|
14951
14951
|
}
|
|
14952
14952
|
/**
|
|
14953
14953
|
* Recursively collect directories from filesystem hierarchy
|
|
14954
14954
|
*/
|
|
14955
|
-
async collectDirsRecursive(
|
|
14955
|
+
async collectDirsRecursive(fs14, name, withFs) {
|
|
14956
14956
|
try {
|
|
14957
|
-
const fi = await
|
|
14957
|
+
const fi = await fs14.stat(name);
|
|
14958
14958
|
if (fi.isDir()) {
|
|
14959
|
-
withFs(
|
|
14959
|
+
withFs(fs14);
|
|
14960
14960
|
}
|
|
14961
14961
|
} catch (error) {
|
|
14962
14962
|
}
|
|
14963
|
-
const fsi =
|
|
14963
|
+
const fsi = fs14;
|
|
14964
14964
|
if (fsi.filesystem && fsi.numFilesystems) {
|
|
14965
14965
|
for (let i = 0; i < fsi.numFilesystems(); i++) {
|
|
14966
14966
|
const subFs = fsi.filesystem(i);
|
|
@@ -14975,8 +14975,8 @@ var init_overlayfs = __esm({
|
|
|
14975
14975
|
*/
|
|
14976
14976
|
async statInternal(name, lstatIfPossible) {
|
|
14977
14977
|
for (let i = 0; i < this.fss.length; i++) {
|
|
14978
|
-
const
|
|
14979
|
-
const [fs22, fi, ok3, err] = await this.statRecursive(
|
|
14978
|
+
const fs14 = this.fss[i];
|
|
14979
|
+
const [fs22, fi, ok3, err] = await this.statRecursive(fs14, name, lstatIfPossible);
|
|
14980
14980
|
if (err === null || !this.isNotExistError(err)) {
|
|
14981
14981
|
return [fs22, fi, ok3, err];
|
|
14982
14982
|
}
|
|
@@ -14986,16 +14986,16 @@ var init_overlayfs = __esm({
|
|
|
14986
14986
|
/**
|
|
14987
14987
|
* Recursive stat implementation
|
|
14988
14988
|
*/
|
|
14989
|
-
async statRecursive(
|
|
14989
|
+
async statRecursive(fs14, name, lstatIfPossible) {
|
|
14990
14990
|
try {
|
|
14991
|
-
const fi = await
|
|
14992
|
-
return [
|
|
14991
|
+
const fi = await fs14.stat(name);
|
|
14992
|
+
return [fs14, fi, false, null];
|
|
14993
14993
|
} catch (error) {
|
|
14994
14994
|
if (!this.isNotExistError(error)) {
|
|
14995
|
-
return [
|
|
14995
|
+
return [fs14, null, false, error];
|
|
14996
14996
|
}
|
|
14997
14997
|
}
|
|
14998
|
-
const fsi =
|
|
14998
|
+
const fsi = fs14;
|
|
14999
14999
|
if (fsi.filesystem && fsi.numFilesystems) {
|
|
15000
15000
|
for (let i = 0; i < fsi.numFilesystems(); i++) {
|
|
15001
15001
|
const subFs = fsi.filesystem(i);
|
|
@@ -15049,14 +15049,14 @@ var init_overlayfs = __esm({
|
|
|
15049
15049
|
if (this.fss.length === 0) {
|
|
15050
15050
|
throw ErrFileNotFound;
|
|
15051
15051
|
}
|
|
15052
|
-
const [
|
|
15052
|
+
const [fs14, fi, , err] = await this.statInternal(name, false);
|
|
15053
15053
|
if (err) {
|
|
15054
15054
|
throw err;
|
|
15055
15055
|
}
|
|
15056
15056
|
if (fi.isDir()) {
|
|
15057
15057
|
const dirFss = [];
|
|
15058
|
-
await this.collectDirs(name, (
|
|
15059
|
-
dirFss.push(
|
|
15058
|
+
await this.collectDirs(name, (fs15) => {
|
|
15059
|
+
dirFss.push(fs15);
|
|
15060
15060
|
});
|
|
15061
15061
|
if (dirFss.length === 0) {
|
|
15062
15062
|
throw ErrFileNotFound;
|
|
@@ -15072,7 +15072,7 @@ var init_overlayfs = __esm({
|
|
|
15072
15072
|
// Pass filesystems directly
|
|
15073
15073
|
);
|
|
15074
15074
|
}
|
|
15075
|
-
return await
|
|
15075
|
+
return await fs14.open(name);
|
|
15076
15076
|
}
|
|
15077
15077
|
/**
|
|
15078
15078
|
* Open file with flags (write operations use first filesystem)
|
|
@@ -15434,21 +15434,21 @@ var init_filesystemscollector = __esm({
|
|
|
15434
15434
|
absFilename,
|
|
15435
15435
|
base2
|
|
15436
15436
|
);
|
|
15437
|
-
const
|
|
15437
|
+
const fs14 = rm2.fs(this.sourceProject);
|
|
15438
15438
|
if (this.isPrompts(mount.target())) {
|
|
15439
|
-
fromToPrompt.push(
|
|
15439
|
+
fromToPrompt.push(fs14);
|
|
15440
15440
|
} else if (this.isWorkflows(mount.target())) {
|
|
15441
|
-
fromToWorkflow.push(
|
|
15441
|
+
fromToWorkflow.push(fs14);
|
|
15442
15442
|
} else if (this.isContent(mount.target())) {
|
|
15443
|
-
fromToContent.push(
|
|
15443
|
+
fromToContent.push(fs14);
|
|
15444
15444
|
} else if (this.isLayouts(mount.target())) {
|
|
15445
|
-
fromToLayouts.push(
|
|
15445
|
+
fromToLayouts.push(fs14);
|
|
15446
15446
|
} else if (this.isStatics(mount.target())) {
|
|
15447
|
-
fromToStatics.push(
|
|
15447
|
+
fromToStatics.push(fs14);
|
|
15448
15448
|
} else if (this.isAssets(mount.target())) {
|
|
15449
|
-
fromToAssets.push(
|
|
15449
|
+
fromToAssets.push(fs14);
|
|
15450
15450
|
} else if (this.isI18n(mount.target())) {
|
|
15451
|
-
fromToI18n.push(
|
|
15451
|
+
fromToI18n.push(fs14);
|
|
15452
15452
|
}
|
|
15453
15453
|
}
|
|
15454
15454
|
if (fromToWorkflow.length > 0) {
|
|
@@ -15458,9 +15458,9 @@ var init_filesystemscollector = __esm({
|
|
|
15458
15458
|
this.overlayMountsPrompt = this.overlayMountsPrompt.append(...fromToPrompt);
|
|
15459
15459
|
}
|
|
15460
15460
|
if (md.isProjectModule()) {
|
|
15461
|
-
for (const
|
|
15461
|
+
for (const fs14 of fromToContent) {
|
|
15462
15462
|
let ofs = createReadOnlyOverlayFs([]);
|
|
15463
|
-
ofs = ofs.append(...[
|
|
15463
|
+
ofs = ofs.append(...[fs14]);
|
|
15464
15464
|
this.overlayMountsContent.push(ofs);
|
|
15465
15465
|
}
|
|
15466
15466
|
}
|
|
@@ -24419,9 +24419,9 @@ var init_pagecollector = __esm({
|
|
|
24419
24419
|
fs;
|
|
24420
24420
|
processedPaths = /* @__PURE__ */ new Set();
|
|
24421
24421
|
// Track processed paths
|
|
24422
|
-
constructor(pageMap,
|
|
24422
|
+
constructor(pageMap, fs14) {
|
|
24423
24423
|
this.m = pageMap;
|
|
24424
|
-
this.fs =
|
|
24424
|
+
this.fs = fs14;
|
|
24425
24425
|
}
|
|
24426
24426
|
async collect() {
|
|
24427
24427
|
try {
|
|
@@ -24439,9 +24439,9 @@ var init_pagecollector = __esm({
|
|
|
24439
24439
|
/**
|
|
24440
24440
|
* CollectDir - exact replica of Go's collectDir method
|
|
24441
24441
|
*/
|
|
24442
|
-
async collectDir(
|
|
24442
|
+
async collectDir(fs14, path43, root2) {
|
|
24443
24443
|
try {
|
|
24444
|
-
await this.fs.walkContent(
|
|
24444
|
+
await this.fs.walkContent(fs14, path43, {
|
|
24445
24445
|
hookPre: async (dir2, path44, readdir2) => {
|
|
24446
24446
|
const fullPath = path44;
|
|
24447
24447
|
if (this.processedPaths.has(fullPath)) {
|
|
@@ -24538,8 +24538,8 @@ var init_content2 = __esm({
|
|
|
24538
24538
|
pageMap;
|
|
24539
24539
|
translator;
|
|
24540
24540
|
pageCollected = false;
|
|
24541
|
-
constructor(
|
|
24542
|
-
this.fs =
|
|
24541
|
+
constructor(fs14, converter, pageMap, translator) {
|
|
24542
|
+
this.fs = fs14;
|
|
24543
24543
|
this.converter = converter;
|
|
24544
24544
|
this.pageMap = pageMap;
|
|
24545
24545
|
this.translator = translator;
|
|
@@ -27662,8 +27662,8 @@ var init_lookup = __esm({
|
|
|
27662
27662
|
});
|
|
27663
27663
|
|
|
27664
27664
|
// internal/domain/template/entity/template.ts
|
|
27665
|
-
function newTemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace,
|
|
27666
|
-
return new TemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace,
|
|
27665
|
+
function newTemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs14) {
|
|
27666
|
+
return new TemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs14);
|
|
27667
27667
|
}
|
|
27668
27668
|
var log52, TemplateEngine;
|
|
27669
27669
|
var init_template = __esm({
|
|
@@ -27684,14 +27684,14 @@ var init_template = __esm({
|
|
|
27684
27684
|
partialNamespace;
|
|
27685
27685
|
shortcodeNamespace;
|
|
27686
27686
|
fs;
|
|
27687
|
-
constructor(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace,
|
|
27687
|
+
constructor(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs14) {
|
|
27688
27688
|
this.executor = executor;
|
|
27689
27689
|
this.lookup = lookup;
|
|
27690
27690
|
this.parser = parser;
|
|
27691
27691
|
this.templateNamespace = templateNamespace;
|
|
27692
27692
|
this.partialNamespace = partialNamespace;
|
|
27693
27693
|
this.shortcodeNamespace = shortcodeNamespace;
|
|
27694
|
-
this.fs =
|
|
27694
|
+
this.fs = fs14;
|
|
27695
27695
|
}
|
|
27696
27696
|
/**
|
|
27697
27697
|
* Mark template engine as ready
|
|
@@ -30371,9 +30371,9 @@ var init_registry = __esm({
|
|
|
30371
30371
|
function newTemplateFactory() {
|
|
30372
30372
|
return new Factory2();
|
|
30373
30373
|
}
|
|
30374
|
-
async function createTemplateEngineWithServices(
|
|
30374
|
+
async function createTemplateEngineWithServices(fs14, services) {
|
|
30375
30375
|
const factory = newTemplateFactory();
|
|
30376
|
-
return factory.createWithServices(
|
|
30376
|
+
return factory.createWithServices(fs14, services);
|
|
30377
30377
|
}
|
|
30378
30378
|
var Factory2, Builder;
|
|
30379
30379
|
var init_template2 = __esm({
|
|
@@ -30391,15 +30391,15 @@ var init_template2 = __esm({
|
|
|
30391
30391
|
/**
|
|
30392
30392
|
* Create template engine with file system (core functions only)
|
|
30393
30393
|
*/
|
|
30394
|
-
async create(
|
|
30395
|
-
return this.createWithConfig(
|
|
30394
|
+
async create(fs14) {
|
|
30395
|
+
return this.createWithConfig(fs14, {});
|
|
30396
30396
|
}
|
|
30397
30397
|
/**
|
|
30398
30398
|
* Create template engine with configuration
|
|
30399
30399
|
*/
|
|
30400
|
-
async createWithConfig(
|
|
30400
|
+
async createWithConfig(fs14, config) {
|
|
30401
30401
|
try {
|
|
30402
|
-
const builder = new Builder().withFs(
|
|
30402
|
+
const builder = new Builder().withFs(fs14).withNamespaces(
|
|
30403
30403
|
newRegularTemplateNamespace(),
|
|
30404
30404
|
newPartialTemplateNamespace(),
|
|
30405
30405
|
newShortcodeTemplateNamespace()
|
|
@@ -30423,8 +30423,8 @@ var init_template2 = __esm({
|
|
|
30423
30423
|
* Create template engine with services
|
|
30424
30424
|
* TypeScript equivalent of Go's New(fs, cfs) function
|
|
30425
30425
|
*/
|
|
30426
|
-
async createWithServices(
|
|
30427
|
-
return this.createWithConfig(
|
|
30426
|
+
async createWithServices(fs14, services) {
|
|
30427
|
+
return this.createWithConfig(fs14, { services });
|
|
30428
30428
|
}
|
|
30429
30429
|
};
|
|
30430
30430
|
Builder = class {
|
|
@@ -30441,8 +30441,8 @@ var init_template2 = __esm({
|
|
|
30441
30441
|
/**
|
|
30442
30442
|
* Set file system
|
|
30443
30443
|
*/
|
|
30444
|
-
withFs(
|
|
30445
|
-
this.fs =
|
|
30444
|
+
withFs(fs14) {
|
|
30445
|
+
this.fs = fs14;
|
|
30446
30446
|
return this;
|
|
30447
30447
|
}
|
|
30448
30448
|
/**
|
|
@@ -47738,17 +47738,17 @@ var init_site = __esm({
|
|
|
47738
47738
|
});
|
|
47739
47739
|
|
|
47740
47740
|
// internal/domain/site/entity/publisher.ts
|
|
47741
|
-
async function openFileForWriting(
|
|
47741
|
+
async function openFileForWriting(fs14, filename) {
|
|
47742
47742
|
const cleanFilename = import_path26.default.normalize(filename);
|
|
47743
47743
|
try {
|
|
47744
|
-
return await
|
|
47744
|
+
return await fs14.create(cleanFilename);
|
|
47745
47745
|
} catch (error) {
|
|
47746
47746
|
if (!isFileNotFoundError(error)) {
|
|
47747
47747
|
throw error;
|
|
47748
47748
|
}
|
|
47749
47749
|
const dir2 = import_path26.default.dirname(cleanFilename);
|
|
47750
|
-
await
|
|
47751
|
-
return await
|
|
47750
|
+
await fs14.mkdirAll(dir2, 511);
|
|
47751
|
+
return await fs14.create(cleanFilename);
|
|
47752
47752
|
}
|
|
47753
47753
|
}
|
|
47754
47754
|
function isFileNotFoundError(error) {
|
|
@@ -47763,8 +47763,8 @@ var init_publisher2 = __esm({
|
|
|
47763
47763
|
log64 = getDomainLogger("site", { component: "publisher" });
|
|
47764
47764
|
Publisher = class {
|
|
47765
47765
|
fs;
|
|
47766
|
-
constructor(
|
|
47767
|
-
this.fs =
|
|
47766
|
+
constructor(fs14) {
|
|
47767
|
+
this.fs = fs14;
|
|
47768
47768
|
}
|
|
47769
47769
|
/**
|
|
47770
47770
|
* PublishSource publishes content from a source buffer to files
|
|
@@ -50283,10 +50283,10 @@ __export(ssg_exports, {
|
|
|
50283
50283
|
processSSGWithProgress: () => processSSGWithProgress,
|
|
50284
50284
|
serveSSG: () => serveSSG
|
|
50285
50285
|
});
|
|
50286
|
-
function setDomainInstances(site, content,
|
|
50286
|
+
function setDomainInstances(site, content, fs14, config, modules, resources, template) {
|
|
50287
50287
|
siteCache = site;
|
|
50288
50288
|
contentCache = content;
|
|
50289
|
-
fsCache =
|
|
50289
|
+
fsCache = fs14;
|
|
50290
50290
|
configCache = config;
|
|
50291
50291
|
modulesCache = modules;
|
|
50292
50292
|
resourcesCache = resources;
|
|
@@ -50354,8 +50354,8 @@ async function createContentEngine(filesystem, config, modules, markdown) {
|
|
|
50354
50354
|
contentFs: () => {
|
|
50355
50355
|
return filesystem.contentFs();
|
|
50356
50356
|
},
|
|
50357
|
-
walkContent: (
|
|
50358
|
-
return filesystem.walkContent(
|
|
50357
|
+
walkContent: (fs14, start, cb, conf) => {
|
|
50358
|
+
return filesystem.walkContent(fs14, start, cb, conf);
|
|
50359
50359
|
},
|
|
50360
50360
|
walkI18n: (start, cb, conf) => {
|
|
50361
50361
|
return filesystem.walkI18n(start, cb, conf);
|
|
@@ -50449,10 +50449,10 @@ function createCustomizedFunctions(config, site, resources) {
|
|
|
50449
50449
|
}
|
|
50450
50450
|
};
|
|
50451
50451
|
}
|
|
50452
|
-
function createResourcesEngine(config,
|
|
50452
|
+
function createResourcesEngine(config, fs14) {
|
|
50453
50453
|
const workspace = {
|
|
50454
|
-
assetsFs: () =>
|
|
50455
|
-
publishFs: () =>
|
|
50454
|
+
assetsFs: () => fs14.assetsFs(),
|
|
50455
|
+
publishFs: () => fs14.publishFs(),
|
|
50456
50456
|
baseUrl: () => config.getProvider().getString("baseURL") || "http://localhost",
|
|
50457
50457
|
executeTemplate: async (templateName, rawContent, data) => {
|
|
50458
50458
|
throw new Error("Template execution not initialized. Please call resources.setTemplateSvc() first.");
|
|
@@ -50460,10 +50460,10 @@ function createResourcesEngine(config, fs13) {
|
|
|
50460
50460
|
};
|
|
50461
50461
|
return createResources(workspace);
|
|
50462
50462
|
}
|
|
50463
|
-
async function createTemplateEngineFromFs(
|
|
50463
|
+
async function createTemplateEngineFromFs(fs14, config, site, resources) {
|
|
50464
50464
|
const services = createCustomizedFunctions(config, site, resources);
|
|
50465
50465
|
const templateFs = {
|
|
50466
|
-
walk:
|
|
50466
|
+
walk: fs14.walkLayouts.bind(fs14)
|
|
50467
50467
|
};
|
|
50468
50468
|
return await createTemplateEngineWithServices(templateFs, services);
|
|
50469
50469
|
}
|
|
@@ -50503,7 +50503,7 @@ async function createTemplateAdapter(templateEngine, site) {
|
|
|
50503
50503
|
}
|
|
50504
50504
|
};
|
|
50505
50505
|
}
|
|
50506
|
-
function createSiteForSSG(config,
|
|
50506
|
+
function createSiteForSSG(config, fs14, content) {
|
|
50507
50507
|
const siteServices = {
|
|
50508
50508
|
// Config service methods
|
|
50509
50509
|
configParams: () => config.getProvider().getParams("params"),
|
|
@@ -50584,13 +50584,13 @@ function createSiteForSSG(config, fs13, content) {
|
|
|
50584
50584
|
generateSitemap: async () => ({ urls: [] }),
|
|
50585
50585
|
// Publisher methods
|
|
50586
50586
|
publishFs: () => {
|
|
50587
|
-
return
|
|
50587
|
+
return fs14.publishFs();
|
|
50588
50588
|
},
|
|
50589
50589
|
staticFs() {
|
|
50590
|
-
return
|
|
50590
|
+
return fs14.staticFs();
|
|
50591
50591
|
},
|
|
50592
50592
|
copyStaticFiles(from, to) {
|
|
50593
|
-
return
|
|
50593
|
+
return fs14.copyStatic([from], to);
|
|
50594
50594
|
},
|
|
50595
50595
|
workingDir: () => config.getProvider().getString("workingDir") || process.cwd(),
|
|
50596
50596
|
// ResourceService implementation (placeholder)
|
|
@@ -50894,11 +50894,11 @@ var init_ssg = __esm({
|
|
|
50894
50894
|
import_path27 = __toESM(require("path"));
|
|
50895
50895
|
init_resources2();
|
|
50896
50896
|
log76 = getDomainLogger("ssg", { component: "application" });
|
|
50897
|
-
createDomainInstances = (site, content,
|
|
50897
|
+
createDomainInstances = (site, content, fs14, config, modules, resources) => {
|
|
50898
50898
|
return {
|
|
50899
50899
|
site,
|
|
50900
50900
|
content,
|
|
50901
|
-
fs:
|
|
50901
|
+
fs: fs14,
|
|
50902
50902
|
config,
|
|
50903
50903
|
modules,
|
|
50904
50904
|
resources
|
|
@@ -52099,18 +52099,47 @@ init_log();
|
|
|
52099
52099
|
// pkg/web/watcher/content-file-watcher.ts
|
|
52100
52100
|
var chokidar = __toESM(require("chokidar"));
|
|
52101
52101
|
var path40 = __toESM(require("path"));
|
|
52102
|
+
var fs11 = __toESM(require("fs"));
|
|
52102
52103
|
init_log();
|
|
52103
52104
|
var log83 = getDomainLogger("web", { component: "content-file-watcher" });
|
|
52104
52105
|
var ContentFileWatcher = class {
|
|
52105
52106
|
constructor(config) {
|
|
52106
52107
|
this.config = config;
|
|
52107
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
|
+
}
|
|
52108
52119
|
}
|
|
52109
52120
|
watcher = null;
|
|
52110
52121
|
eventQueue = [];
|
|
52111
52122
|
batchTimer = null;
|
|
52112
52123
|
batchDelay;
|
|
52113
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
|
+
}
|
|
52114
52143
|
async startWatching() {
|
|
52115
52144
|
if (this.watcher) {
|
|
52116
52145
|
await this.stopWatching();
|
|
@@ -52146,14 +52175,30 @@ var ContentFileWatcher = class {
|
|
|
52146
52175
|
}
|
|
52147
52176
|
queueEvent(filePath, eventType) {
|
|
52148
52177
|
let fp = filePath;
|
|
52149
|
-
|
|
52150
|
-
|
|
52151
|
-
|
|
52152
|
-
|
|
52153
|
-
|
|
52154
|
-
|
|
52155
|
-
|
|
52156
|
-
|
|
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
|
+
}
|
|
52157
52202
|
}
|
|
52158
52203
|
}
|
|
52159
52204
|
}
|
|
@@ -52227,7 +52272,7 @@ var ContentFileWatcher = class {
|
|
|
52227
52272
|
// pkg/web/server/livereload-server.ts
|
|
52228
52273
|
var http3 = __toESM(require("http"));
|
|
52229
52274
|
var path41 = __toESM(require("path"));
|
|
52230
|
-
var
|
|
52275
|
+
var fs12 = __toESM(require("fs/promises"));
|
|
52231
52276
|
var import_ws = require("ws");
|
|
52232
52277
|
init_log();
|
|
52233
52278
|
var log84 = getDomainLogger("web", { component: "livereload-server" });
|
|
@@ -52379,11 +52424,11 @@ var FoundryLiveReloadServer = class {
|
|
|
52379
52424
|
const url = req.url || "/";
|
|
52380
52425
|
let filePath = this.resolveFilePath(url);
|
|
52381
52426
|
try {
|
|
52382
|
-
const stats = await
|
|
52427
|
+
const stats = await fs12.stat(filePath);
|
|
52383
52428
|
if (stats.isDirectory()) {
|
|
52384
52429
|
const indexPath = path41.join(filePath, "index.html");
|
|
52385
52430
|
try {
|
|
52386
|
-
await
|
|
52431
|
+
await fs12.stat(indexPath);
|
|
52387
52432
|
filePath = indexPath;
|
|
52388
52433
|
} catch {
|
|
52389
52434
|
res.statusCode = 404;
|
|
@@ -52391,7 +52436,7 @@ var FoundryLiveReloadServer = class {
|
|
|
52391
52436
|
return;
|
|
52392
52437
|
}
|
|
52393
52438
|
}
|
|
52394
|
-
let content = await
|
|
52439
|
+
let content = await fs12.readFile(filePath);
|
|
52395
52440
|
const contentType = this.getContentType(filePath);
|
|
52396
52441
|
res.setHeader("Content-Type", contentType);
|
|
52397
52442
|
if (contentType.includes("text/html") && this.config.enableLiveReload) {
|
|
@@ -52549,7 +52594,7 @@ var FoundryLiveReloadServer = class {
|
|
|
52549
52594
|
// pkg/web/server/electron-livereload-server.ts
|
|
52550
52595
|
var http4 = __toESM(require("http"));
|
|
52551
52596
|
var path42 = __toESM(require("path"));
|
|
52552
|
-
var
|
|
52597
|
+
var fs13 = __toESM(require("fs/promises"));
|
|
52553
52598
|
init_log();
|
|
52554
52599
|
var log85 = getDomainLogger("web", { component: "electron-livereload-server" });
|
|
52555
52600
|
var ElectronLiveReloadServer = class {
|
|
@@ -52596,7 +52641,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52596
52641
|
this.httpServer = null;
|
|
52597
52642
|
}
|
|
52598
52643
|
try {
|
|
52599
|
-
await
|
|
52644
|
+
await fs13.unlink(this.stateFilePath);
|
|
52600
52645
|
} catch (error) {
|
|
52601
52646
|
}
|
|
52602
52647
|
this.running = false;
|
|
@@ -52642,7 +52687,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52642
52687
|
}
|
|
52643
52688
|
async writeStateFile(state) {
|
|
52644
52689
|
try {
|
|
52645
|
-
await
|
|
52690
|
+
await fs13.writeFile(this.stateFilePath, JSON.stringify(state), "utf8");
|
|
52646
52691
|
} catch (error) {
|
|
52647
52692
|
log85.error("Failed to write LiveReload state file:", error);
|
|
52648
52693
|
}
|
|
@@ -52679,7 +52724,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52679
52724
|
const url = req.url || "/";
|
|
52680
52725
|
if (url.startsWith("/.foundry-livereload-state.json")) {
|
|
52681
52726
|
try {
|
|
52682
|
-
const content = await
|
|
52727
|
+
const content = await fs13.readFile(this.stateFilePath, "utf8");
|
|
52683
52728
|
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
52684
52729
|
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
52685
52730
|
res.setHeader("Pragma", "no-cache");
|
|
@@ -52700,11 +52745,11 @@ var ElectronLiveReloadServer = class {
|
|
|
52700
52745
|
}
|
|
52701
52746
|
let filePath = this.resolveFilePath(url);
|
|
52702
52747
|
try {
|
|
52703
|
-
const stats = await
|
|
52748
|
+
const stats = await fs13.stat(filePath);
|
|
52704
52749
|
if (stats.isDirectory()) {
|
|
52705
52750
|
const indexPath = path42.join(filePath, "index.html");
|
|
52706
52751
|
try {
|
|
52707
|
-
await
|
|
52752
|
+
await fs13.stat(indexPath);
|
|
52708
52753
|
filePath = indexPath;
|
|
52709
52754
|
} catch {
|
|
52710
52755
|
res.statusCode = 404;
|
|
@@ -52712,7 +52757,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52712
52757
|
return;
|
|
52713
52758
|
}
|
|
52714
52759
|
}
|
|
52715
|
-
let content = await
|
|
52760
|
+
let content = await fs13.readFile(filePath);
|
|
52716
52761
|
const contentType = this.getContentType(filePath);
|
|
52717
52762
|
res.setHeader("Content-Type", contentType);
|
|
52718
52763
|
if (contentType.includes("text/html") && this.config.enableLiveReload) {
|
|
@@ -55180,7 +55225,7 @@ For more information, visit: https://help.mdfriday.com
|
|
|
55180
55225
|
* Show version
|
|
55181
55226
|
*/
|
|
55182
55227
|
showVersion() {
|
|
55183
|
-
const version = "26.
|
|
55228
|
+
const version = "26.4.1";
|
|
55184
55229
|
return {
|
|
55185
55230
|
success: true,
|
|
55186
55231
|
message: `MDFriday CLI v${version}`
|