@mdfriday/foundry 26.4.7 → 26.4.9
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 +804 -792
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/domain/workspace/entity/project.d.ts +3 -1
- package/dist/internal/domain/workspace/entity/workspace.d.ts +1 -1
- package/dist/internal/domain/workspace/factory/workspace-factory.d.ts +1 -1
- package/dist/internal/domain/workspace/repository/file-system.d.ts +11 -0
- package/dist/internal/domain/workspace/repository/index.d.ts +1 -0
- package/dist/internal/infrastructure/persistence/node-file-system.d.ts +11 -0
- package/dist/internal/interfaces/obsidian/index.d.ts +2 -0
- package/dist/internal/interfaces/obsidian/mobile.d.ts +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -624,11 +624,10 @@ var init_log = __esm({
|
|
|
624
624
|
});
|
|
625
625
|
|
|
626
626
|
// internal/domain/workspace/entity/workspace.ts
|
|
627
|
-
var
|
|
627
|
+
var log, Workspace;
|
|
628
628
|
var init_workspace = __esm({
|
|
629
629
|
"internal/domain/workspace/entity/workspace.ts"() {
|
|
630
630
|
"use strict";
|
|
631
|
-
import_path = __toESM(require("path"));
|
|
632
631
|
init_log();
|
|
633
632
|
log = getDomainLogger("workspace", { component: "domain" });
|
|
634
633
|
Workspace = class {
|
|
@@ -637,12 +636,16 @@ var init_workspace = __esm({
|
|
|
637
636
|
projects;
|
|
638
637
|
authentication;
|
|
639
638
|
fileSystemRepo;
|
|
639
|
+
// 必需
|
|
640
640
|
constructor(rootPath, metadata, projects, authentication, fileSystemRepo) {
|
|
641
641
|
this.rootPath = rootPath;
|
|
642
642
|
this.metadata = metadata;
|
|
643
643
|
this.projects = projects;
|
|
644
644
|
this.authentication = authentication;
|
|
645
645
|
this.fileSystemRepo = fileSystemRepo;
|
|
646
|
+
if (!this.fileSystemRepo) {
|
|
647
|
+
throw new Error("FileSystemRepository is required for Workspace");
|
|
648
|
+
}
|
|
646
649
|
}
|
|
647
650
|
// ============================================================================
|
|
648
651
|
// Basic Getters
|
|
@@ -675,13 +678,13 @@ var init_workspace = __esm({
|
|
|
675
678
|
* Get modules directory path
|
|
676
679
|
*/
|
|
677
680
|
getModulesDir() {
|
|
678
|
-
return
|
|
681
|
+
return this.fileSystemRepo.join(this.rootPath, this.metadata.paths.modules);
|
|
679
682
|
}
|
|
680
683
|
/**
|
|
681
684
|
* Get projects directory path
|
|
682
685
|
*/
|
|
683
686
|
getProjectsDir() {
|
|
684
|
-
return
|
|
687
|
+
return this.fileSystemRepo.join(this.rootPath, this.metadata.paths.projects);
|
|
685
688
|
}
|
|
686
689
|
// ============================================================================
|
|
687
690
|
// Metadata Management
|
|
@@ -777,7 +780,7 @@ var init_workspace = __esm({
|
|
|
777
780
|
for (const project of this.projects.values()) {
|
|
778
781
|
const metadata = project.getMetadata();
|
|
779
782
|
const projectPath = project.getPath();
|
|
780
|
-
const relativePath =
|
|
783
|
+
const relativePath = this.fileSystemRepo.relative(this.getProjectsDir(), projectPath);
|
|
781
784
|
projectEntries.push({
|
|
782
785
|
id: metadata.id,
|
|
783
786
|
name: metadata.name,
|
|
@@ -815,15 +818,12 @@ var init_workspace = __esm({
|
|
|
815
818
|
* Get workspace configuration file path
|
|
816
819
|
*/
|
|
817
820
|
getConfigPath() {
|
|
818
|
-
return
|
|
821
|
+
return this.fileSystemRepo.join(this.rootPath, ".mdfriday", "config.json");
|
|
819
822
|
}
|
|
820
823
|
/**
|
|
821
824
|
* Get configuration value by key (supports nested keys with dot notation)
|
|
822
825
|
*/
|
|
823
826
|
async getConfig(key2) {
|
|
824
|
-
if (!this.fileSystemRepo) {
|
|
825
|
-
throw new Error("FileSystemRepository is required for config operations");
|
|
826
|
-
}
|
|
827
827
|
const configPath = this.getConfigPath();
|
|
828
828
|
try {
|
|
829
829
|
const content = await this.fileSystemRepo.readFile(configPath, "utf-8");
|
|
@@ -840,9 +840,6 @@ var init_workspace = __esm({
|
|
|
840
840
|
* Get all workspace configuration
|
|
841
841
|
*/
|
|
842
842
|
async getAllConfig() {
|
|
843
|
-
if (!this.fileSystemRepo) {
|
|
844
|
-
throw new Error("FileSystemRepository is required for config operations");
|
|
845
|
-
}
|
|
846
843
|
const configPath = this.getConfigPath();
|
|
847
844
|
try {
|
|
848
845
|
const content = await this.fileSystemRepo.readFile(configPath, "utf-8");
|
|
@@ -858,11 +855,8 @@ var init_workspace = __esm({
|
|
|
858
855
|
* Set configuration value (supports nested keys with dot notation)
|
|
859
856
|
*/
|
|
860
857
|
async setConfig(key2, value) {
|
|
861
|
-
if (!this.fileSystemRepo) {
|
|
862
|
-
throw new Error("FileSystemRepository is required for config operations");
|
|
863
|
-
}
|
|
864
858
|
const configPath = this.getConfigPath();
|
|
865
|
-
const configDir =
|
|
859
|
+
const configDir = this.fileSystemRepo.dirname(configPath);
|
|
866
860
|
await this.fileSystemRepo.createDirectory(configDir, true);
|
|
867
861
|
let config = {};
|
|
868
862
|
try {
|
|
@@ -881,9 +875,6 @@ var init_workspace = __esm({
|
|
|
881
875
|
* Unset configuration value (supports nested keys with dot notation)
|
|
882
876
|
*/
|
|
883
877
|
async unsetConfig(key2) {
|
|
884
|
-
if (!this.fileSystemRepo) {
|
|
885
|
-
throw new Error("FileSystemRepository is required for config operations");
|
|
886
|
-
}
|
|
887
878
|
const configPath = this.getConfigPath();
|
|
888
879
|
try {
|
|
889
880
|
const content = await this.fileSystemRepo.readFile(configPath, "utf-8");
|
|
@@ -966,21 +957,25 @@ var init_workspace = __esm({
|
|
|
966
957
|
});
|
|
967
958
|
|
|
968
959
|
// internal/domain/workspace/entity/project.ts
|
|
969
|
-
var
|
|
960
|
+
var log2, Project;
|
|
970
961
|
var init_project = __esm({
|
|
971
962
|
"internal/domain/workspace/entity/project.ts"() {
|
|
972
963
|
"use strict";
|
|
973
964
|
init_log();
|
|
974
|
-
import_path2 = __toESM(require("path"));
|
|
975
|
-
import_fs = require("fs");
|
|
976
965
|
log2 = getDomainLogger("project", { component: "domain" });
|
|
977
966
|
Project = class {
|
|
978
967
|
metadata;
|
|
979
968
|
projectPath;
|
|
980
969
|
config = null;
|
|
981
|
-
|
|
970
|
+
fileSystemRepo;
|
|
971
|
+
// 必需
|
|
972
|
+
constructor(projectPath, metadata, fileSystemRepo) {
|
|
982
973
|
this.projectPath = projectPath;
|
|
983
974
|
this.metadata = metadata;
|
|
975
|
+
this.fileSystemRepo = fileSystemRepo;
|
|
976
|
+
if (!this.fileSystemRepo) {
|
|
977
|
+
throw new Error("FileSystemRepository is required for Project");
|
|
978
|
+
}
|
|
984
979
|
}
|
|
985
980
|
/**
|
|
986
981
|
* Get project path
|
|
@@ -1052,8 +1047,8 @@ var init_project = __esm({
|
|
|
1052
1047
|
return this.config;
|
|
1053
1048
|
}
|
|
1054
1049
|
try {
|
|
1055
|
-
const configPath =
|
|
1056
|
-
const content = await
|
|
1050
|
+
const configPath = this.fileSystemRepo.join(this.projectPath, "config.json");
|
|
1051
|
+
const content = await this.fileSystemRepo.readFile(configPath, "utf-8");
|
|
1057
1052
|
this.config = JSON.parse(content);
|
|
1058
1053
|
return this.config;
|
|
1059
1054
|
} catch (error) {
|
|
@@ -1080,11 +1075,11 @@ var init_project = __esm({
|
|
|
1080
1075
|
const config = await this.loadConfig();
|
|
1081
1076
|
const contentDirs = [];
|
|
1082
1077
|
const mainContentDir = config.contentDir || "content";
|
|
1083
|
-
contentDirs.push(
|
|
1078
|
+
contentDirs.push(this.fileSystemRepo.join(this.projectPath, mainContentDir));
|
|
1084
1079
|
if (config.languages) {
|
|
1085
1080
|
for (const [lang2, langConfig] of Object.entries(config.languages)) {
|
|
1086
1081
|
if (langConfig.contentDir && langConfig.contentDir !== mainContentDir) {
|
|
1087
|
-
contentDirs.push(
|
|
1082
|
+
contentDirs.push(this.fileSystemRepo.join(this.projectPath, langConfig.contentDir));
|
|
1088
1083
|
}
|
|
1089
1084
|
}
|
|
1090
1085
|
}
|
|
@@ -1097,14 +1092,14 @@ var init_project = __esm({
|
|
|
1097
1092
|
async getPublishDir() {
|
|
1098
1093
|
const config = await this.loadConfig();
|
|
1099
1094
|
const publishDir = config.publishDir || "public";
|
|
1100
|
-
return
|
|
1095
|
+
return this.fileSystemRepo.join(this.projectPath, publishDir);
|
|
1101
1096
|
}
|
|
1102
1097
|
/**
|
|
1103
1098
|
* Get static directory
|
|
1104
1099
|
* Returns absolute path
|
|
1105
1100
|
*/
|
|
1106
1101
|
getStaticDir() {
|
|
1107
|
-
return
|
|
1102
|
+
return this.fileSystemRepo.join(this.projectPath, "static");
|
|
1108
1103
|
}
|
|
1109
1104
|
/**
|
|
1110
1105
|
* Get default content language
|
|
@@ -1130,7 +1125,7 @@ var init_project = __esm({
|
|
|
1130
1125
|
* Get project configuration file path
|
|
1131
1126
|
*/
|
|
1132
1127
|
getConfigPath() {
|
|
1133
|
-
return
|
|
1128
|
+
return this.fileSystemRepo.join(this.projectPath, "config.json");
|
|
1134
1129
|
}
|
|
1135
1130
|
/**
|
|
1136
1131
|
* Get configuration value by key (supports nested keys with dot notation)
|
|
@@ -1185,7 +1180,7 @@ var init_project = __esm({
|
|
|
1185
1180
|
throw new Error("Configuration not loaded. Call loadConfig() first.");
|
|
1186
1181
|
}
|
|
1187
1182
|
const configPath = this.getConfigPath();
|
|
1188
|
-
await
|
|
1183
|
+
await this.fileSystemRepo.writeFile(configPath, JSON.stringify(this.config, null, 2), "utf-8");
|
|
1189
1184
|
log2.debug(`Project config saved: ${configPath}`, { projectName: this.metadata.name });
|
|
1190
1185
|
}
|
|
1191
1186
|
// Helper methods for nested key access
|
|
@@ -1254,7 +1249,7 @@ var init_project = __esm({
|
|
|
1254
1249
|
* Get snapshots directory path
|
|
1255
1250
|
*/
|
|
1256
1251
|
getSnapshotsDir() {
|
|
1257
|
-
return
|
|
1252
|
+
return this.fileSystemRepo.join(this.projectPath, ".mdfriday", "snapshots");
|
|
1258
1253
|
}
|
|
1259
1254
|
// ============================================================================
|
|
1260
1255
|
// Source Folder Links Management
|
|
@@ -1371,8 +1366,8 @@ var init_project = __esm({
|
|
|
1371
1366
|
async setBaseURL(baseURL) {
|
|
1372
1367
|
const config = await this.loadConfig();
|
|
1373
1368
|
config.baseURL = baseURL;
|
|
1374
|
-
const configPath =
|
|
1375
|
-
await
|
|
1369
|
+
const configPath = this.fileSystemRepo.join(this.projectPath, "config.json");
|
|
1370
|
+
await this.fileSystemRepo.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
1376
1371
|
this.config = config;
|
|
1377
1372
|
}
|
|
1378
1373
|
/**
|
|
@@ -3404,7 +3399,7 @@ function generateProjectId(name) {
|
|
|
3404
3399
|
const slug2 = name.toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
|
3405
3400
|
return `${slug2}-${Date.now().toString(36)}`;
|
|
3406
3401
|
}
|
|
3407
|
-
var
|
|
3402
|
+
var log5, defaultLanguage, WorkspaceFactory;
|
|
3408
3403
|
var init_workspace_factory = __esm({
|
|
3409
3404
|
"internal/domain/workspace/factory/workspace-factory.ts"() {
|
|
3410
3405
|
"use strict";
|
|
@@ -3414,7 +3409,6 @@ var init_workspace_factory = __esm({
|
|
|
3414
3409
|
init_workspace_metadata();
|
|
3415
3410
|
init_project_metadata();
|
|
3416
3411
|
init_folder_structure();
|
|
3417
|
-
import_path3 = __toESM(require("path"));
|
|
3418
3412
|
init_log();
|
|
3419
3413
|
log5 = getDomainLogger("workspace-factory", { component: "domain" });
|
|
3420
3414
|
defaultLanguage = "en";
|
|
@@ -3423,11 +3417,15 @@ var init_workspace_factory = __esm({
|
|
|
3423
3417
|
projectRepo;
|
|
3424
3418
|
snapshotRepo;
|
|
3425
3419
|
fileSystemRepo;
|
|
3420
|
+
// 不再可选
|
|
3426
3421
|
constructor(options) {
|
|
3427
3422
|
this.workspaceRepo = options.workspaceRepo;
|
|
3428
3423
|
this.projectRepo = options.projectRepo;
|
|
3429
3424
|
this.snapshotRepo = options.snapshotRepo;
|
|
3430
|
-
this.fileSystemRepo = options.fileSystemRepo
|
|
3425
|
+
this.fileSystemRepo = options.fileSystemRepo;
|
|
3426
|
+
if (!this.fileSystemRepo) {
|
|
3427
|
+
throw new Error("FileSystemRepository is required");
|
|
3428
|
+
}
|
|
3431
3429
|
}
|
|
3432
3430
|
// ============================================================================
|
|
3433
3431
|
// Load Workspace (Aggregate Root)
|
|
@@ -3437,7 +3435,7 @@ var init_workspace_factory = __esm({
|
|
|
3437
3435
|
* Returns fully constructed Workspace aggregate root with all Project entities
|
|
3438
3436
|
*/
|
|
3439
3437
|
async load(rootPath) {
|
|
3440
|
-
const absolutePath =
|
|
3438
|
+
const absolutePath = this.fileSystemRepo.resolvePathSync(rootPath);
|
|
3441
3439
|
log5.info("Loading workspace", { path: absolutePath });
|
|
3442
3440
|
const metadataData = await this.workspaceRepo.loadWorkspaceMetadata(absolutePath);
|
|
3443
3441
|
const metadata = WorkspaceMetadata.create(metadataData);
|
|
@@ -3447,7 +3445,7 @@ var init_workspace_factory = __esm({
|
|
|
3447
3445
|
try {
|
|
3448
3446
|
const projectMetadataData = await this.projectRepo.loadProjectMetadata(entry.absolutePath);
|
|
3449
3447
|
const projectMetadata = ProjectMetadata.create(projectMetadataData);
|
|
3450
|
-
const project = new Project(entry.absolutePath, projectMetadata);
|
|
3448
|
+
const project = new Project(entry.absolutePath, projectMetadata, this.fileSystemRepo);
|
|
3451
3449
|
projects.set(entry.id, project);
|
|
3452
3450
|
log5.debug("Project loaded", { projectId: entry.id, name: entry.name });
|
|
3453
3451
|
} catch (error) {
|
|
@@ -3465,7 +3463,7 @@ var init_workspace_factory = __esm({
|
|
|
3465
3463
|
metadata,
|
|
3466
3464
|
projects,
|
|
3467
3465
|
authentication,
|
|
3468
|
-
this.fileSystemRepo
|
|
3466
|
+
this.fileSystemRepo
|
|
3469
3467
|
);
|
|
3470
3468
|
log5.info("Workspace loaded", {
|
|
3471
3469
|
workspaceId: workspace.getId(),
|
|
@@ -3478,10 +3476,7 @@ var init_workspace_factory = __esm({
|
|
|
3478
3476
|
* Check if auth file exists
|
|
3479
3477
|
*/
|
|
3480
3478
|
async checkAuthFile(workspacePath) {
|
|
3481
|
-
|
|
3482
|
-
return false;
|
|
3483
|
-
}
|
|
3484
|
-
const authPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3479
|
+
const authPath = this.fileSystemRepo.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3485
3480
|
try {
|
|
3486
3481
|
await this.fileSystemRepo.access(authPath);
|
|
3487
3482
|
return true;
|
|
@@ -3496,7 +3491,7 @@ var init_workspace_factory = __esm({
|
|
|
3496
3491
|
* Create a new workspace
|
|
3497
3492
|
*/
|
|
3498
3493
|
async create(rootPath, options = {}) {
|
|
3499
|
-
const absolutePath =
|
|
3494
|
+
const absolutePath = this.fileSystemRepo.resolvePathSync(rootPath);
|
|
3500
3495
|
log5.info("Creating workspace", { path: absolutePath });
|
|
3501
3496
|
if (await this.workspaceRepo.isWorkspace(absolutePath)) {
|
|
3502
3497
|
throw new Error(`Workspace already exists at ${absolutePath}`);
|
|
@@ -3508,7 +3503,7 @@ var init_workspace_factory = __esm({
|
|
|
3508
3503
|
const metadata = WorkspaceMetadata.create({
|
|
3509
3504
|
version: "1.0",
|
|
3510
3505
|
id: generateWorkspaceId(),
|
|
3511
|
-
name: options.name ||
|
|
3506
|
+
name: options.name || this.fileSystemRepo.basename(absolutePath),
|
|
3512
3507
|
createdAt: now,
|
|
3513
3508
|
updatedAt: now,
|
|
3514
3509
|
paths: {
|
|
@@ -3526,24 +3521,22 @@ var init_workspace_factory = __esm({
|
|
|
3526
3521
|
};
|
|
3527
3522
|
await this.workspaceRepo.saveWorkspaceMetadata(absolutePath, metadata.toJSON());
|
|
3528
3523
|
await this.workspaceRepo.saveProjectRegistry(absolutePath, emptyRegistry);
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
});
|
|
3539
|
-
}
|
|
3524
|
+
const mdfridayDir = this.fileSystemRepo.join(absolutePath, ".mdfriday");
|
|
3525
|
+
const configPath = this.fileSystemRepo.join(mdfridayDir, "config.json");
|
|
3526
|
+
await this.fileSystemRepo.writeFile(configPath, "{}", "utf-8");
|
|
3527
|
+
const userDataPath = this.fileSystemRepo.join(mdfridayDir, "user-data.json");
|
|
3528
|
+
await this.fileSystemRepo.writeFile(userDataPath, "{}", "utf-8");
|
|
3529
|
+
log5.debug("Initialized configuration files", {
|
|
3530
|
+
configPath,
|
|
3531
|
+
userDataPath
|
|
3532
|
+
});
|
|
3540
3533
|
const authentication = new Authentication(absolutePath, false);
|
|
3541
3534
|
const workspace = new Workspace(
|
|
3542
3535
|
absolutePath,
|
|
3543
3536
|
metadata,
|
|
3544
3537
|
/* @__PURE__ */ new Map(),
|
|
3545
3538
|
authentication,
|
|
3546
|
-
this.fileSystemRepo
|
|
3539
|
+
this.fileSystemRepo
|
|
3547
3540
|
);
|
|
3548
3541
|
log5.info("Workspace created", {
|
|
3549
3542
|
workspaceId: workspace.getId(),
|
|
@@ -3587,13 +3580,14 @@ var init_workspace_factory = __esm({
|
|
|
3587
3580
|
* Find workspace root by searching up the directory tree
|
|
3588
3581
|
*/
|
|
3589
3582
|
async findWorkspaceRoot(startPath) {
|
|
3590
|
-
let currentPath =
|
|
3591
|
-
const
|
|
3583
|
+
let currentPath = this.fileSystemRepo.resolvePathSync(startPath);
|
|
3584
|
+
const pathInfo = this.fileSystemRepo.parsePath(currentPath);
|
|
3585
|
+
const root2 = pathInfo.root;
|
|
3592
3586
|
while (currentPath !== root2) {
|
|
3593
3587
|
if (await this.workspaceRepo.isWorkspace(currentPath)) {
|
|
3594
3588
|
return currentPath;
|
|
3595
3589
|
}
|
|
3596
|
-
currentPath =
|
|
3590
|
+
currentPath = this.fileSystemRepo.dirname(currentPath);
|
|
3597
3591
|
}
|
|
3598
3592
|
return null;
|
|
3599
3593
|
}
|
|
@@ -3601,7 +3595,7 @@ var init_workspace_factory = __esm({
|
|
|
3601
3595
|
* Check if a path is a workspace
|
|
3602
3596
|
*/
|
|
3603
3597
|
async isWorkspace(workspacePath) {
|
|
3604
|
-
const absolutePath =
|
|
3598
|
+
const absolutePath = this.fileSystemRepo.resolvePathSync(workspacePath);
|
|
3605
3599
|
return this.workspaceRepo.isWorkspace(absolutePath);
|
|
3606
3600
|
}
|
|
3607
3601
|
/**
|
|
@@ -3623,7 +3617,7 @@ var init_workspace_factory = __esm({
|
|
|
3623
3617
|
*/
|
|
3624
3618
|
async createProject(workspace, name, options = {}) {
|
|
3625
3619
|
const projectId = generateProjectId(name);
|
|
3626
|
-
const projectPath =
|
|
3620
|
+
const projectPath = this.fileSystemRepo.join(workspace.getProjectsDir(), name);
|
|
3627
3621
|
log5.info("Creating project", { projectId, name, path: projectPath });
|
|
3628
3622
|
if (workspace.findProject(name)) {
|
|
3629
3623
|
throw new Error(`Project ${name} already exists`);
|
|
@@ -3659,9 +3653,9 @@ var init_workspace_factory = __esm({
|
|
|
3659
3653
|
};
|
|
3660
3654
|
await this.projectRepo.saveProjectMetadata(projectPath, projectMetadata.toJSON());
|
|
3661
3655
|
await this.projectRepo.saveProjectConfig(projectPath, config);
|
|
3662
|
-
const sampleContentPath =
|
|
3656
|
+
const sampleContentPath = this.fileSystemRepo.join(projectPath, contentDir, "index.md");
|
|
3663
3657
|
await this.projectRepo.createSampleContent(sampleContentPath, this.createSampleContent());
|
|
3664
|
-
const project = new Project(projectPath, projectMetadata);
|
|
3658
|
+
const project = new Project(projectPath, projectMetadata, this.fileSystemRepo);
|
|
3665
3659
|
workspace.addProject(project);
|
|
3666
3660
|
await this.save(workspace);
|
|
3667
3661
|
log5.info("Project created", { projectId, name });
|
|
@@ -3699,7 +3693,7 @@ var init_workspace_factory = __esm({
|
|
|
3699
3693
|
throw new Error("FileSystemRepository is required to create project from folder");
|
|
3700
3694
|
}
|
|
3701
3695
|
const projectId = generateProjectId(name);
|
|
3702
|
-
const projectPath =
|
|
3696
|
+
const projectPath = this.fileSystemRepo.join(workspace.getProjectsDir(), name);
|
|
3703
3697
|
log5.info("Creating project from folder", {
|
|
3704
3698
|
projectId,
|
|
3705
3699
|
name,
|
|
@@ -3738,7 +3732,7 @@ var init_workspace_factory = __esm({
|
|
|
3738
3732
|
const contentLinks = [];
|
|
3739
3733
|
const contentLinksMetadata = [];
|
|
3740
3734
|
for (const contentFolder of finalFolderStructure.getContentFolders()) {
|
|
3741
|
-
const targetDir = contentFolder.weight === 0 ?
|
|
3735
|
+
const targetDir = contentFolder.weight === 0 ? this.fileSystemRepo.join(projectPath, "content") : this.fileSystemRepo.join(projectPath, `content.${contentFolder.languageCode}`);
|
|
3742
3736
|
contentLinks.push({
|
|
3743
3737
|
source: contentFolder.path,
|
|
3744
3738
|
target: targetDir
|
|
@@ -3754,7 +3748,7 @@ var init_workspace_factory = __esm({
|
|
|
3754
3748
|
const staticFolder = finalFolderStructure.getStaticFolder();
|
|
3755
3749
|
contentLinks.push({
|
|
3756
3750
|
source: staticFolder.path,
|
|
3757
|
-
target:
|
|
3751
|
+
target: this.fileSystemRepo.join(projectPath, "static")
|
|
3758
3752
|
});
|
|
3759
3753
|
staticLinkMetadata = { sourcePath: staticFolder.path };
|
|
3760
3754
|
}
|
|
@@ -3799,7 +3793,7 @@ var init_workspace_factory = __esm({
|
|
|
3799
3793
|
}
|
|
3800
3794
|
await this.projectRepo.saveProjectMetadata(projectPath, projectMetadata.toJSON());
|
|
3801
3795
|
await this.projectRepo.saveProjectConfig(projectPath, config);
|
|
3802
|
-
const project = new Project(projectPath, projectMetadata);
|
|
3796
|
+
const project = new Project(projectPath, projectMetadata, this.fileSystemRepo);
|
|
3803
3797
|
workspace.addProject(project);
|
|
3804
3798
|
await this.save(workspace);
|
|
3805
3799
|
log5.info("Project created from folder", {
|
|
@@ -3821,7 +3815,7 @@ var init_workspace_factory = __esm({
|
|
|
3821
3815
|
throw new Error("FileSystemRepository is required to create project from file");
|
|
3822
3816
|
}
|
|
3823
3817
|
const projectId = generateProjectId(name);
|
|
3824
|
-
const projectPath =
|
|
3818
|
+
const projectPath = this.fileSystemRepo.join(workspace.getProjectsDir(), name);
|
|
3825
3819
|
log5.info("Creating project from file", {
|
|
3826
3820
|
projectId,
|
|
3827
3821
|
name,
|
|
@@ -3845,8 +3839,8 @@ var init_workspace_factory = __esm({
|
|
|
3845
3839
|
"static",
|
|
3846
3840
|
"public"
|
|
3847
3841
|
);
|
|
3848
|
-
const contentDir =
|
|
3849
|
-
const targetFilePath =
|
|
3842
|
+
const contentDir = this.fileSystemRepo.join(projectPath, "content");
|
|
3843
|
+
const targetFilePath = this.fileSystemRepo.join(contentDir, "index.md");
|
|
3850
3844
|
let useSymlink = false;
|
|
3851
3845
|
let fileLink = null;
|
|
3852
3846
|
try {
|
|
@@ -3899,7 +3893,7 @@ var init_workspace_factory = __esm({
|
|
|
3899
3893
|
};
|
|
3900
3894
|
await this.projectRepo.saveProjectMetadata(projectPath, projectMetadata.toJSON());
|
|
3901
3895
|
await this.projectRepo.saveProjectConfig(projectPath, config);
|
|
3902
|
-
const project = new Project(projectPath, projectMetadata);
|
|
3896
|
+
const project = new Project(projectPath, projectMetadata, this.fileSystemRepo);
|
|
3903
3897
|
workspace.addProject(project);
|
|
3904
3898
|
await this.save(workspace);
|
|
3905
3899
|
log5.info("Project created from file", {
|
|
@@ -3917,14 +3911,14 @@ var init_workspace_factory = __esm({
|
|
|
3917
3911
|
* Load a single project by path
|
|
3918
3912
|
*/
|
|
3919
3913
|
async loadProject(projectPath) {
|
|
3920
|
-
const absolutePath =
|
|
3914
|
+
const absolutePath = this.fileSystemRepo.resolvePathSync(projectPath);
|
|
3921
3915
|
if (!await this.projectRepo.isProject(absolutePath)) {
|
|
3922
3916
|
throw new Error(`No project found at ${absolutePath}`);
|
|
3923
3917
|
}
|
|
3924
3918
|
const metadataData = await this.projectRepo.loadProjectMetadata(absolutePath);
|
|
3925
3919
|
const { ProjectMetadata: ProjectMetadataVO } = await Promise.resolve().then(() => (init_project_metadata(), project_metadata_exports));
|
|
3926
3920
|
const metadata = ProjectMetadataVO.create(metadataData);
|
|
3927
|
-
return new Project(absolutePath, metadata);
|
|
3921
|
+
return new Project(absolutePath, metadata, this.fileSystemRepo);
|
|
3928
3922
|
}
|
|
3929
3923
|
/**
|
|
3930
3924
|
* Save a single project
|
|
@@ -3942,13 +3936,13 @@ var init_workspace_factory = __esm({
|
|
|
3942
3936
|
* Find project root from current directory
|
|
3943
3937
|
*/
|
|
3944
3938
|
async findProjectRoot(startPath) {
|
|
3945
|
-
let currentPath =
|
|
3946
|
-
const root2 =
|
|
3939
|
+
let currentPath = this.fileSystemRepo.resolvePathSync(startPath);
|
|
3940
|
+
const root2 = this.fileSystemRepo.parsePath(currentPath).root;
|
|
3947
3941
|
while (currentPath !== root2) {
|
|
3948
3942
|
if (await this.projectRepo.isProject(currentPath)) {
|
|
3949
3943
|
return currentPath;
|
|
3950
3944
|
}
|
|
3951
|
-
currentPath =
|
|
3945
|
+
currentPath = this.fileSystemRepo.dirname(currentPath);
|
|
3952
3946
|
}
|
|
3953
3947
|
return null;
|
|
3954
3948
|
}
|
|
@@ -3974,7 +3968,7 @@ var init_workspace_factory = __esm({
|
|
|
3974
3968
|
throw new Error("FileSystemRepository is required to update snapshot metadata");
|
|
3975
3969
|
}
|
|
3976
3970
|
metadata.name = snapshotName;
|
|
3977
|
-
const metadataPath =
|
|
3971
|
+
const metadataPath = this.fileSystemRepo.join(project.getPath(), ".mdfriday", "snapshots", `${metadata.id}.json`);
|
|
3978
3972
|
await this.fileSystemRepo.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
3979
3973
|
}
|
|
3980
3974
|
log5.info("Snapshot created", { snapshotId, size: metadata.size, fileCount: metadata.fileCount });
|
|
@@ -4027,8 +4021,8 @@ var init_workspace_factory = __esm({
|
|
|
4027
4021
|
return {
|
|
4028
4022
|
// 新方法:合并存储
|
|
4029
4023
|
async saveUserData(data) {
|
|
4030
|
-
const userDataPath =
|
|
4031
|
-
await fsRepo.createDirectory(
|
|
4024
|
+
const userDataPath = fsRepo.join(workspacePath, ".mdfriday", "user-data.json");
|
|
4025
|
+
await fsRepo.createDirectory(fsRepo.dirname(userDataPath), true);
|
|
4032
4026
|
const jsonData = {};
|
|
4033
4027
|
if (data.serverConfig) {
|
|
4034
4028
|
jsonData.serverConfig = data.serverConfig.toJSON();
|
|
@@ -4049,7 +4043,7 @@ var init_workspace_factory = __esm({
|
|
|
4049
4043
|
await fsRepo.writeFile(userDataPath, JSON.stringify(jsonData, null, 2));
|
|
4050
4044
|
},
|
|
4051
4045
|
async loadUserData() {
|
|
4052
|
-
const userDataPath =
|
|
4046
|
+
const userDataPath = fsRepo.join(workspacePath, ".mdfriday", "user-data.json");
|
|
4053
4047
|
try {
|
|
4054
4048
|
const content = await fsRepo.readFile(userDataPath, "utf-8");
|
|
4055
4049
|
const data = JSON.parse(content);
|
|
@@ -4084,7 +4078,7 @@ var init_workspace_factory = __esm({
|
|
|
4084
4078
|
}
|
|
4085
4079
|
},
|
|
4086
4080
|
async clearUserData() {
|
|
4087
|
-
const userDataPath =
|
|
4081
|
+
const userDataPath = fsRepo.join(workspacePath, ".mdfriday", "user-data.json");
|
|
4088
4082
|
try {
|
|
4089
4083
|
await fsRepo.unlink(userDataPath);
|
|
4090
4084
|
} catch {
|
|
@@ -4093,8 +4087,8 @@ var init_workspace_factory = __esm({
|
|
|
4093
4087
|
},
|
|
4094
4088
|
// 保留旧方法以向后兼容
|
|
4095
4089
|
async saveToken(token) {
|
|
4096
|
-
const authPath =
|
|
4097
|
-
await fsRepo.createDirectory(
|
|
4090
|
+
const authPath = fsRepo.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
4091
|
+
await fsRepo.createDirectory(fsRepo.dirname(authPath), true);
|
|
4098
4092
|
await fsRepo.writeFile(authPath, JSON.stringify(token.toJSON(), null, 2));
|
|
4099
4093
|
authentication.markAuthExists();
|
|
4100
4094
|
},
|
|
@@ -4103,7 +4097,7 @@ var init_workspace_factory = __esm({
|
|
|
4103
4097
|
if (userData?.token) {
|
|
4104
4098
|
return userData.token;
|
|
4105
4099
|
}
|
|
4106
|
-
const authPath =
|
|
4100
|
+
const authPath = fsRepo.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
4107
4101
|
try {
|
|
4108
4102
|
const content = await fsRepo.readFile(authPath, "utf-8");
|
|
4109
4103
|
const data = JSON.parse(content);
|
|
@@ -4114,7 +4108,7 @@ var init_workspace_factory = __esm({
|
|
|
4114
4108
|
}
|
|
4115
4109
|
},
|
|
4116
4110
|
async clearToken() {
|
|
4117
|
-
const authPath =
|
|
4111
|
+
const authPath = fsRepo.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
4118
4112
|
try {
|
|
4119
4113
|
await fsRepo.unlink(authPath);
|
|
4120
4114
|
} catch {
|
|
@@ -4122,8 +4116,8 @@ var init_workspace_factory = __esm({
|
|
|
4122
4116
|
authentication.markAuthDeleted();
|
|
4123
4117
|
},
|
|
4124
4118
|
async saveServerConfig(config) {
|
|
4125
|
-
const configPath =
|
|
4126
|
-
await fsRepo.createDirectory(
|
|
4119
|
+
const configPath = fsRepo.join(workspacePath, ".mdfriday", "auth-config.json");
|
|
4120
|
+
await fsRepo.createDirectory(fsRepo.dirname(configPath), true);
|
|
4127
4121
|
await fsRepo.writeFile(configPath, JSON.stringify(config.toJSON(), null, 2));
|
|
4128
4122
|
},
|
|
4129
4123
|
async loadServerConfig() {
|
|
@@ -4131,7 +4125,7 @@ var init_workspace_factory = __esm({
|
|
|
4131
4125
|
if (userData?.serverConfig) {
|
|
4132
4126
|
return userData.serverConfig;
|
|
4133
4127
|
}
|
|
4134
|
-
const configPath =
|
|
4128
|
+
const configPath = fsRepo.join(workspacePath, ".mdfriday", "auth-config.json");
|
|
4135
4129
|
try {
|
|
4136
4130
|
const content = await fsRepo.readFile(configPath, "utf-8");
|
|
4137
4131
|
const data = JSON.parse(content);
|
|
@@ -4161,7 +4155,7 @@ var init_workspace_factory = __esm({
|
|
|
4161
4155
|
const baseURL = await project.getBaseURL();
|
|
4162
4156
|
const pathInfo = project.parseBaseURLPath(baseURL);
|
|
4163
4157
|
const projectRoot = project.getPath();
|
|
4164
|
-
const publicDir =
|
|
4158
|
+
const publicDir = this.fileSystemRepo.join(projectRoot, "public");
|
|
4165
4159
|
if (pathInfo.isRoot) {
|
|
4166
4160
|
log5.debug("baseURL is root, no structure needed");
|
|
4167
4161
|
return {
|
|
@@ -4176,13 +4170,13 @@ var init_workspace_factory = __esm({
|
|
|
4176
4170
|
});
|
|
4177
4171
|
let currentDir = publicDir;
|
|
4178
4172
|
for (const dirName of pathInfo.parentParts) {
|
|
4179
|
-
currentDir =
|
|
4173
|
+
currentDir = this.fileSystemRepo.join(currentDir, dirName);
|
|
4180
4174
|
if (!await this.fileSystemRepo.exists(currentDir)) {
|
|
4181
4175
|
await this.fileSystemRepo.createDirectory(currentDir, false);
|
|
4182
4176
|
log5.debug(`Created parent directory: ${dirName}`);
|
|
4183
4177
|
}
|
|
4184
4178
|
}
|
|
4185
|
-
const symlinkPath =
|
|
4179
|
+
const symlinkPath = this.fileSystemRepo.join(currentDir, pathInfo.finalDirName);
|
|
4186
4180
|
if (await this.fileSystemRepo.exists(symlinkPath)) {
|
|
4187
4181
|
await this.fileSystemRepo.remove(symlinkPath, true);
|
|
4188
4182
|
log5.debug(`Removed existing symlink: ${symlinkPath}`);
|
|
@@ -4230,12 +4224,12 @@ var init_workspace_factory = __esm({
|
|
|
4230
4224
|
return;
|
|
4231
4225
|
}
|
|
4232
4226
|
const projectRoot = project.getPath();
|
|
4233
|
-
const publicDir =
|
|
4227
|
+
const publicDir = this.fileSystemRepo.join(projectRoot, "public");
|
|
4234
4228
|
log5.info("Cleaning baseURL structure in public/", {
|
|
4235
4229
|
pathParts: structureInfo.pathParts
|
|
4236
4230
|
});
|
|
4237
4231
|
for (let i = structureInfo.pathParts.length; i > 0; i--) {
|
|
4238
|
-
const targetPath =
|
|
4232
|
+
const targetPath = this.fileSystemRepo.join(
|
|
4239
4233
|
publicDir,
|
|
4240
4234
|
...structureInfo.pathParts.slice(0, i)
|
|
4241
4235
|
);
|
|
@@ -4244,7 +4238,7 @@ var init_workspace_factory = __esm({
|
|
|
4244
4238
|
log5.debug(`Removed: ${structureInfo.pathParts.slice(0, i).join("/")}`);
|
|
4245
4239
|
}
|
|
4246
4240
|
if (i > 1) {
|
|
4247
|
-
const parentPath =
|
|
4241
|
+
const parentPath = this.fileSystemRepo.join(
|
|
4248
4242
|
publicDir,
|
|
4249
4243
|
...structureInfo.pathParts.slice(0, i - 1)
|
|
4250
4244
|
);
|
|
@@ -4286,7 +4280,7 @@ var init_workspace_factory = __esm({
|
|
|
4286
4280
|
};
|
|
4287
4281
|
}
|
|
4288
4282
|
return {
|
|
4289
|
-
serverRoot:
|
|
4283
|
+
serverRoot: this.fileSystemRepo.join(project.getPath(), "public"),
|
|
4290
4284
|
baseURL: currentBaseURL,
|
|
4291
4285
|
recreated: false
|
|
4292
4286
|
};
|
|
@@ -4363,12 +4357,12 @@ var init_workspace2 = __esm({
|
|
|
4363
4357
|
});
|
|
4364
4358
|
|
|
4365
4359
|
// internal/application/workspace.ts
|
|
4366
|
-
var
|
|
4360
|
+
var import_path, log6, WorkspaceAppService;
|
|
4367
4361
|
var init_workspace3 = __esm({
|
|
4368
4362
|
"internal/application/workspace.ts"() {
|
|
4369
4363
|
"use strict";
|
|
4370
4364
|
init_log();
|
|
4371
|
-
|
|
4365
|
+
import_path = __toESM(require("path"));
|
|
4372
4366
|
log6 = getDomainLogger("workspace-app", { component: "application" });
|
|
4373
4367
|
WorkspaceAppService = class {
|
|
4374
4368
|
workspaceFactory;
|
|
@@ -4381,17 +4375,17 @@ var init_workspace3 = __esm({
|
|
|
4381
4375
|
/**
|
|
4382
4376
|
* Load workspace from path
|
|
4383
4377
|
*/
|
|
4384
|
-
async loadWorkspace(
|
|
4385
|
-
if (
|
|
4386
|
-
return this.workspaceFactory.load(
|
|
4378
|
+
async loadWorkspace(path40) {
|
|
4379
|
+
if (path40) {
|
|
4380
|
+
return this.workspaceFactory.load(path40);
|
|
4387
4381
|
}
|
|
4388
4382
|
return this.workspaceFactory.loadOrFind();
|
|
4389
4383
|
}
|
|
4390
4384
|
/**
|
|
4391
4385
|
* Create new workspace
|
|
4392
4386
|
*/
|
|
4393
|
-
async createWorkspace(
|
|
4394
|
-
return this.workspaceFactory.create(
|
|
4387
|
+
async createWorkspace(path40, options) {
|
|
4388
|
+
return this.workspaceFactory.create(path40, options);
|
|
4395
4389
|
}
|
|
4396
4390
|
/**
|
|
4397
4391
|
* Save workspace
|
|
@@ -4455,7 +4449,7 @@ var init_workspace3 = __esm({
|
|
|
4455
4449
|
if (!fsRepo) {
|
|
4456
4450
|
project = void 0;
|
|
4457
4451
|
} else {
|
|
4458
|
-
const inputPath =
|
|
4452
|
+
const inputPath = import_path.default.resolve(projectNameOrPath);
|
|
4459
4453
|
for (const p2 of projects) {
|
|
4460
4454
|
const projectPath = p2.getPath();
|
|
4461
4455
|
if (inputPath.startsWith(projectPath) || projectPath === inputPath) {
|
|
@@ -5037,12 +5031,12 @@ var init_identity2 = __esm({
|
|
|
5037
5031
|
});
|
|
5038
5032
|
|
|
5039
5033
|
// internal/infrastructure/persistence/node-workspace-repository.ts
|
|
5040
|
-
var
|
|
5034
|
+
var import_fs, import_path2, MDFRIDAY_DIR, WORKSPACE_FILE, PROJECTS_FILE, PROJECT_FILE, CONFIG_FILE, NodeWorkspaceRepository, NodeProjectRepository;
|
|
5041
5035
|
var init_node_workspace_repository = __esm({
|
|
5042
5036
|
"internal/infrastructure/persistence/node-workspace-repository.ts"() {
|
|
5043
5037
|
"use strict";
|
|
5044
|
-
|
|
5045
|
-
|
|
5038
|
+
import_fs = require("fs");
|
|
5039
|
+
import_path2 = __toESM(require("path"));
|
|
5046
5040
|
MDFRIDAY_DIR = ".mdfriday";
|
|
5047
5041
|
WORKSPACE_FILE = "workspace.json";
|
|
5048
5042
|
PROJECTS_FILE = "projects.json";
|
|
@@ -5051,102 +5045,102 @@ var init_node_workspace_repository = __esm({
|
|
|
5051
5045
|
NodeWorkspaceRepository = class {
|
|
5052
5046
|
async isWorkspace(workspacePath) {
|
|
5053
5047
|
try {
|
|
5054
|
-
const metadataPath =
|
|
5055
|
-
await
|
|
5048
|
+
const metadataPath = import_path2.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
5049
|
+
await import_fs.promises.access(metadataPath);
|
|
5056
5050
|
return true;
|
|
5057
5051
|
} catch {
|
|
5058
5052
|
return false;
|
|
5059
5053
|
}
|
|
5060
5054
|
}
|
|
5061
5055
|
async initWorkspaceStructure(workspacePath, modulesDir, projectsDir) {
|
|
5062
|
-
const mdfridayDir =
|
|
5063
|
-
const modulesDirPath =
|
|
5064
|
-
const projectsDirPath =
|
|
5065
|
-
await
|
|
5066
|
-
await
|
|
5067
|
-
await
|
|
5056
|
+
const mdfridayDir = import_path2.default.join(workspacePath, MDFRIDAY_DIR);
|
|
5057
|
+
const modulesDirPath = import_path2.default.join(workspacePath, modulesDir);
|
|
5058
|
+
const projectsDirPath = import_path2.default.join(workspacePath, projectsDir);
|
|
5059
|
+
await import_fs.promises.mkdir(mdfridayDir, { recursive: true });
|
|
5060
|
+
await import_fs.promises.mkdir(modulesDirPath, { recursive: true });
|
|
5061
|
+
await import_fs.promises.mkdir(projectsDirPath, { recursive: true });
|
|
5068
5062
|
}
|
|
5069
5063
|
async saveWorkspaceMetadata(workspacePath, metadata) {
|
|
5070
|
-
const metadataPath =
|
|
5071
|
-
await
|
|
5064
|
+
const metadataPath = import_path2.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
5065
|
+
await import_fs.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
5072
5066
|
}
|
|
5073
5067
|
async loadWorkspaceMetadata(workspacePath) {
|
|
5074
|
-
const metadataPath =
|
|
5075
|
-
const content = await
|
|
5068
|
+
const metadataPath = import_path2.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
5069
|
+
const content = await import_fs.promises.readFile(metadataPath, "utf-8");
|
|
5076
5070
|
return JSON.parse(content);
|
|
5077
5071
|
}
|
|
5078
5072
|
async saveProjectRegistry(workspacePath, registry) {
|
|
5079
|
-
const registryPath =
|
|
5080
|
-
await
|
|
5073
|
+
const registryPath = import_path2.default.join(workspacePath, MDFRIDAY_DIR, PROJECTS_FILE);
|
|
5074
|
+
await import_fs.promises.writeFile(registryPath, JSON.stringify(registry, null, 2));
|
|
5081
5075
|
}
|
|
5082
5076
|
async loadProjectRegistry(workspacePath) {
|
|
5083
|
-
const registryPath =
|
|
5084
|
-
const content = await
|
|
5077
|
+
const registryPath = import_path2.default.join(workspacePath, MDFRIDAY_DIR, PROJECTS_FILE);
|
|
5078
|
+
const content = await import_fs.promises.readFile(registryPath, "utf-8");
|
|
5085
5079
|
return JSON.parse(content);
|
|
5086
5080
|
}
|
|
5087
5081
|
};
|
|
5088
5082
|
NodeProjectRepository = class {
|
|
5089
5083
|
async isProject(projectPath) {
|
|
5090
5084
|
try {
|
|
5091
|
-
const metadataPath =
|
|
5092
|
-
await
|
|
5085
|
+
const metadataPath = import_path2.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
5086
|
+
await import_fs.promises.access(metadataPath);
|
|
5093
5087
|
return true;
|
|
5094
5088
|
} catch {
|
|
5095
5089
|
return false;
|
|
5096
5090
|
}
|
|
5097
5091
|
}
|
|
5098
5092
|
async initProjectStructure(projectPath, contentDir, staticDir, publishDir) {
|
|
5099
|
-
const mdfridayDir =
|
|
5100
|
-
const contentDirPath =
|
|
5101
|
-
const staticDirPath =
|
|
5102
|
-
const publishDirPath =
|
|
5103
|
-
await
|
|
5104
|
-
await
|
|
5105
|
-
await
|
|
5106
|
-
await
|
|
5093
|
+
const mdfridayDir = import_path2.default.join(projectPath, MDFRIDAY_DIR);
|
|
5094
|
+
const contentDirPath = import_path2.default.join(projectPath, contentDir);
|
|
5095
|
+
const staticDirPath = import_path2.default.join(projectPath, staticDir);
|
|
5096
|
+
const publishDirPath = import_path2.default.join(projectPath, publishDir);
|
|
5097
|
+
await import_fs.promises.mkdir(mdfridayDir, { recursive: true });
|
|
5098
|
+
await import_fs.promises.mkdir(contentDirPath, { recursive: true });
|
|
5099
|
+
await import_fs.promises.mkdir(staticDirPath, { recursive: true });
|
|
5100
|
+
await import_fs.promises.mkdir(publishDirPath, { recursive: true });
|
|
5107
5101
|
}
|
|
5108
5102
|
async saveProjectMetadata(projectPath, metadata) {
|
|
5109
|
-
const metadataPath =
|
|
5110
|
-
await
|
|
5103
|
+
const metadataPath = import_path2.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
5104
|
+
await import_fs.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
5111
5105
|
}
|
|
5112
5106
|
async loadProjectMetadata(projectPath) {
|
|
5113
|
-
const metadataPath =
|
|
5114
|
-
const content = await
|
|
5107
|
+
const metadataPath = import_path2.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
5108
|
+
const content = await import_fs.promises.readFile(metadataPath, "utf-8");
|
|
5115
5109
|
return JSON.parse(content);
|
|
5116
5110
|
}
|
|
5117
5111
|
async saveProjectConfig(projectPath, config) {
|
|
5118
|
-
const configPath =
|
|
5119
|
-
await
|
|
5112
|
+
const configPath = import_path2.default.join(projectPath, CONFIG_FILE);
|
|
5113
|
+
await import_fs.promises.writeFile(configPath, JSON.stringify(config, null, 2));
|
|
5120
5114
|
}
|
|
5121
5115
|
async createSampleContent(contentPath, content) {
|
|
5122
|
-
await
|
|
5116
|
+
await import_fs.promises.writeFile(contentPath, content);
|
|
5123
5117
|
}
|
|
5124
5118
|
async deleteProjectFiles(projectPath) {
|
|
5125
|
-
await
|
|
5119
|
+
await import_fs.promises.rm(projectPath, { recursive: true, force: true });
|
|
5126
5120
|
}
|
|
5127
5121
|
async deleteProjectDirectory(projectPath) {
|
|
5128
|
-
await
|
|
5122
|
+
await import_fs.promises.rm(projectPath, { recursive: true, force: true });
|
|
5129
5123
|
}
|
|
5130
5124
|
};
|
|
5131
5125
|
}
|
|
5132
5126
|
});
|
|
5133
5127
|
|
|
5134
5128
|
// internal/infrastructure/persistence/node-snapshot-repository.ts
|
|
5135
|
-
var
|
|
5129
|
+
var import_fs2, import_path3, NodeSnapshotRepository;
|
|
5136
5130
|
var init_node_snapshot_repository = __esm({
|
|
5137
5131
|
"internal/infrastructure/persistence/node-snapshot-repository.ts"() {
|
|
5138
5132
|
"use strict";
|
|
5139
|
-
|
|
5140
|
-
|
|
5133
|
+
import_fs2 = require("fs");
|
|
5134
|
+
import_path3 = __toESM(require("path"));
|
|
5141
5135
|
NodeSnapshotRepository = class {
|
|
5142
5136
|
/**
|
|
5143
5137
|
* Create a snapshot by copying output directory to snapshot storage
|
|
5144
5138
|
*/
|
|
5145
5139
|
async createSnapshot(projectPath, snapshotId, outputDir) {
|
|
5146
|
-
const snapshotDir =
|
|
5147
|
-
await
|
|
5148
|
-
const storageDir =
|
|
5149
|
-
await
|
|
5140
|
+
const snapshotDir = import_path3.default.join(projectPath, ".mdfriday", "snapshots");
|
|
5141
|
+
await import_fs2.promises.mkdir(snapshotDir, { recursive: true });
|
|
5142
|
+
const storageDir = import_path3.default.join(snapshotDir, snapshotId);
|
|
5143
|
+
await import_fs2.promises.mkdir(storageDir, { recursive: true });
|
|
5150
5144
|
await this.copyDirectory(outputDir, storageDir);
|
|
5151
5145
|
const size = await this.getDirectorySize(storageDir);
|
|
5152
5146
|
const fileCount = await this.countFiles(storageDir);
|
|
@@ -5155,31 +5149,31 @@ var init_node_snapshot_repository = __esm({
|
|
|
5155
5149
|
name: snapshotId,
|
|
5156
5150
|
// Will be updated by service if custom name provided
|
|
5157
5151
|
timestamp: Date.now(),
|
|
5158
|
-
outputDir:
|
|
5159
|
-
storageDir:
|
|
5152
|
+
outputDir: import_path3.default.relative(projectPath, outputDir),
|
|
5153
|
+
storageDir: import_path3.default.relative(projectPath, storageDir),
|
|
5160
5154
|
size,
|
|
5161
5155
|
fileCount
|
|
5162
5156
|
};
|
|
5163
|
-
const metadataPath =
|
|
5164
|
-
await
|
|
5157
|
+
const metadataPath = import_path3.default.join(snapshotDir, `${snapshotId}.json`);
|
|
5158
|
+
await import_fs2.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
5165
5159
|
return metadata;
|
|
5166
5160
|
}
|
|
5167
5161
|
/**
|
|
5168
5162
|
* List all snapshots for a project
|
|
5169
5163
|
*/
|
|
5170
5164
|
async listSnapshots(projectPath) {
|
|
5171
|
-
const snapshotDir =
|
|
5165
|
+
const snapshotDir = import_path3.default.join(projectPath, ".mdfriday", "snapshots");
|
|
5172
5166
|
try {
|
|
5173
|
-
await
|
|
5167
|
+
await import_fs2.promises.access(snapshotDir);
|
|
5174
5168
|
} catch {
|
|
5175
5169
|
return [];
|
|
5176
5170
|
}
|
|
5177
|
-
const entries = await
|
|
5171
|
+
const entries = await import_fs2.promises.readdir(snapshotDir);
|
|
5178
5172
|
const jsonFiles = entries.filter((f) => f.endsWith(".json"));
|
|
5179
5173
|
const snapshots = [];
|
|
5180
5174
|
for (const file of jsonFiles) {
|
|
5181
5175
|
try {
|
|
5182
|
-
const content = await
|
|
5176
|
+
const content = await import_fs2.promises.readFile(import_path3.default.join(snapshotDir, file), "utf-8");
|
|
5183
5177
|
snapshots.push(JSON.parse(content));
|
|
5184
5178
|
} catch {
|
|
5185
5179
|
}
|
|
@@ -5190,10 +5184,10 @@ var init_node_snapshot_repository = __esm({
|
|
|
5190
5184
|
* Get snapshot metadata
|
|
5191
5185
|
*/
|
|
5192
5186
|
async getSnapshot(projectPath, snapshotId) {
|
|
5193
|
-
const snapshotDir =
|
|
5194
|
-
const metadataPath =
|
|
5187
|
+
const snapshotDir = import_path3.default.join(projectPath, ".mdfriday", "snapshots");
|
|
5188
|
+
const metadataPath = import_path3.default.join(snapshotDir, `${snapshotId}.json`);
|
|
5195
5189
|
try {
|
|
5196
|
-
const content = await
|
|
5190
|
+
const content = await import_fs2.promises.readFile(metadataPath, "utf-8");
|
|
5197
5191
|
const metadata = JSON.parse(content);
|
|
5198
5192
|
if (!metadata.storageDir) {
|
|
5199
5193
|
throw new Error("This is a legacy metadata-only snapshot and cannot be restored");
|
|
@@ -5211,14 +5205,14 @@ var init_node_snapshot_repository = __esm({
|
|
|
5211
5205
|
*/
|
|
5212
5206
|
async restoreSnapshot(projectPath, snapshotId, outputDir) {
|
|
5213
5207
|
const metadata = await this.getSnapshot(projectPath, snapshotId);
|
|
5214
|
-
const storageDir =
|
|
5208
|
+
const storageDir = import_path3.default.join(projectPath, metadata.storageDir);
|
|
5215
5209
|
try {
|
|
5216
|
-
await
|
|
5210
|
+
await import_fs2.promises.access(storageDir);
|
|
5217
5211
|
} catch {
|
|
5218
5212
|
throw new Error(`Snapshot storage not found: ${snapshotId}`);
|
|
5219
5213
|
}
|
|
5220
5214
|
try {
|
|
5221
|
-
await
|
|
5215
|
+
await import_fs2.promises.rm(outputDir, { recursive: true, force: true });
|
|
5222
5216
|
} catch {
|
|
5223
5217
|
}
|
|
5224
5218
|
await this.copyDirectory(storageDir, outputDir);
|
|
@@ -5227,19 +5221,19 @@ var init_node_snapshot_repository = __esm({
|
|
|
5227
5221
|
* Delete a snapshot
|
|
5228
5222
|
*/
|
|
5229
5223
|
async deleteSnapshot(projectPath, snapshotId) {
|
|
5230
|
-
const snapshotDir =
|
|
5231
|
-
const metadataPath =
|
|
5224
|
+
const snapshotDir = import_path3.default.join(projectPath, ".mdfriday", "snapshots");
|
|
5225
|
+
const metadataPath = import_path3.default.join(snapshotDir, `${snapshotId}.json`);
|
|
5232
5226
|
try {
|
|
5233
|
-
const content = await
|
|
5227
|
+
const content = await import_fs2.promises.readFile(metadataPath, "utf-8");
|
|
5234
5228
|
const metadata = JSON.parse(content);
|
|
5235
5229
|
if (metadata.storageDir) {
|
|
5236
|
-
const storageDir =
|
|
5230
|
+
const storageDir = import_path3.default.join(projectPath, metadata.storageDir);
|
|
5237
5231
|
try {
|
|
5238
|
-
await
|
|
5232
|
+
await import_fs2.promises.rm(storageDir, { recursive: true, force: true });
|
|
5239
5233
|
} catch {
|
|
5240
5234
|
}
|
|
5241
5235
|
}
|
|
5242
|
-
await
|
|
5236
|
+
await import_fs2.promises.rm(metadataPath, { force: true });
|
|
5243
5237
|
} catch (error) {
|
|
5244
5238
|
if (error.code === "ENOENT") {
|
|
5245
5239
|
throw new Error(`Snapshot not found: ${snapshotId}`);
|
|
@@ -5251,16 +5245,16 @@ var init_node_snapshot_repository = __esm({
|
|
|
5251
5245
|
* Copy directory recursively
|
|
5252
5246
|
*/
|
|
5253
5247
|
async copyDirectory(src, dest) {
|
|
5254
|
-
await
|
|
5255
|
-
const entries = await
|
|
5248
|
+
await import_fs2.promises.mkdir(dest, { recursive: true });
|
|
5249
|
+
const entries = await import_fs2.promises.readdir(src, { withFileTypes: true });
|
|
5256
5250
|
await Promise.all(
|
|
5257
5251
|
entries.map(async (entry) => {
|
|
5258
|
-
const srcPath =
|
|
5259
|
-
const destPath =
|
|
5252
|
+
const srcPath = import_path3.default.join(src, entry.name);
|
|
5253
|
+
const destPath = import_path3.default.join(dest, entry.name);
|
|
5260
5254
|
if (entry.isDirectory()) {
|
|
5261
5255
|
await this.copyDirectory(srcPath, destPath);
|
|
5262
5256
|
} else {
|
|
5263
|
-
await
|
|
5257
|
+
await import_fs2.promises.copyFile(srcPath, destPath);
|
|
5264
5258
|
}
|
|
5265
5259
|
})
|
|
5266
5260
|
);
|
|
@@ -5270,13 +5264,13 @@ var init_node_snapshot_repository = __esm({
|
|
|
5270
5264
|
*/
|
|
5271
5265
|
async getDirectorySize(dir2) {
|
|
5272
5266
|
let size = 0;
|
|
5273
|
-
const entries = await
|
|
5267
|
+
const entries = await import_fs2.promises.readdir(dir2, { withFileTypes: true });
|
|
5274
5268
|
for (const entry of entries) {
|
|
5275
|
-
const entryPath =
|
|
5269
|
+
const entryPath = import_path3.default.join(dir2, entry.name);
|
|
5276
5270
|
if (entry.isDirectory()) {
|
|
5277
5271
|
size += await this.getDirectorySize(entryPath);
|
|
5278
5272
|
} else {
|
|
5279
|
-
const stats = await
|
|
5273
|
+
const stats = await import_fs2.promises.stat(entryPath);
|
|
5280
5274
|
size += stats.size;
|
|
5281
5275
|
}
|
|
5282
5276
|
}
|
|
@@ -5287,9 +5281,9 @@ var init_node_snapshot_repository = __esm({
|
|
|
5287
5281
|
*/
|
|
5288
5282
|
async countFiles(dir2) {
|
|
5289
5283
|
let count = 0;
|
|
5290
|
-
const entries = await
|
|
5284
|
+
const entries = await import_fs2.promises.readdir(dir2, { withFileTypes: true });
|
|
5291
5285
|
for (const entry of entries) {
|
|
5292
|
-
const entryPath =
|
|
5286
|
+
const entryPath = import_path3.default.join(dir2, entry.name);
|
|
5293
5287
|
if (entry.isDirectory()) {
|
|
5294
5288
|
count += await this.countFiles(entryPath);
|
|
5295
5289
|
} else {
|
|
@@ -5307,12 +5301,12 @@ function mapLanguageCode(code) {
|
|
|
5307
5301
|
const normalized = code.toLowerCase().trim();
|
|
5308
5302
|
return LANGUAGE_CODE_MAP[normalized] || normalized;
|
|
5309
5303
|
}
|
|
5310
|
-
var
|
|
5304
|
+
var import_fs3, import_path4, log8, LANGUAGE_CODE_MAP, NodeFileSystemRepository;
|
|
5311
5305
|
var init_node_file_system = __esm({
|
|
5312
5306
|
"internal/infrastructure/persistence/node-file-system.ts"() {
|
|
5313
5307
|
"use strict";
|
|
5314
|
-
|
|
5315
|
-
|
|
5308
|
+
import_fs3 = require("fs");
|
|
5309
|
+
import_path4 = __toESM(require("path"));
|
|
5316
5310
|
init_log();
|
|
5317
5311
|
log8 = getDomainLogger("node-fs", { component: "infrastructure" });
|
|
5318
5312
|
LANGUAGE_CODE_MAP = {
|
|
@@ -5335,7 +5329,7 @@ var init_node_file_system = __esm({
|
|
|
5335
5329
|
NodeFileSystemRepository = class {
|
|
5336
5330
|
async exists(filePath) {
|
|
5337
5331
|
try {
|
|
5338
|
-
await
|
|
5332
|
+
await import_fs3.promises.access(filePath);
|
|
5339
5333
|
return true;
|
|
5340
5334
|
} catch {
|
|
5341
5335
|
return false;
|
|
@@ -5343,7 +5337,7 @@ var init_node_file_system = __esm({
|
|
|
5343
5337
|
}
|
|
5344
5338
|
async isDirectory(filePath) {
|
|
5345
5339
|
try {
|
|
5346
|
-
const stats = await
|
|
5340
|
+
const stats = await import_fs3.promises.stat(filePath);
|
|
5347
5341
|
return stats.isDirectory();
|
|
5348
5342
|
} catch {
|
|
5349
5343
|
return false;
|
|
@@ -5351,7 +5345,7 @@ var init_node_file_system = __esm({
|
|
|
5351
5345
|
}
|
|
5352
5346
|
async isFile(filePath) {
|
|
5353
5347
|
try {
|
|
5354
|
-
const stats = await
|
|
5348
|
+
const stats = await import_fs3.promises.stat(filePath);
|
|
5355
5349
|
return stats.isFile();
|
|
5356
5350
|
} catch {
|
|
5357
5351
|
return false;
|
|
@@ -5359,9 +5353,9 @@ var init_node_file_system = __esm({
|
|
|
5359
5353
|
}
|
|
5360
5354
|
async readDirectory(dirPath) {
|
|
5361
5355
|
try {
|
|
5362
|
-
const entries = await
|
|
5356
|
+
const entries = await import_fs3.promises.readdir(dirPath, { withFileTypes: true });
|
|
5363
5357
|
return entries.map((entry) => ({
|
|
5364
|
-
path:
|
|
5358
|
+
path: import_path4.default.join(dirPath, entry.name),
|
|
5365
5359
|
name: entry.name,
|
|
5366
5360
|
isDirectory: entry.isDirectory(),
|
|
5367
5361
|
isFile: entry.isFile()
|
|
@@ -5412,7 +5406,7 @@ var init_node_file_system = __esm({
|
|
|
5412
5406
|
if (a.weight !== b.weight) {
|
|
5413
5407
|
return a.weight - b.weight;
|
|
5414
5408
|
}
|
|
5415
|
-
return
|
|
5409
|
+
return import_path4.default.basename(a.path).localeCompare(import_path4.default.basename(b.path));
|
|
5416
5410
|
});
|
|
5417
5411
|
const isStructured = contentFolders.length > 0;
|
|
5418
5412
|
log8.debug(`Scanned folder structure: ${dirPath}`, {
|
|
@@ -5453,20 +5447,20 @@ var init_node_file_system = __esm({
|
|
|
5453
5447
|
}
|
|
5454
5448
|
const targetDir = this.dirname(target);
|
|
5455
5449
|
await this.createDirectory(targetDir, true);
|
|
5456
|
-
const stats = await
|
|
5450
|
+
const stats = await import_fs3.promises.stat(source);
|
|
5457
5451
|
const isFile = stats.isFile();
|
|
5458
5452
|
const isWindows = process.platform === "win32";
|
|
5459
5453
|
if (isFile) {
|
|
5460
5454
|
if (isWindows) {
|
|
5461
|
-
await
|
|
5455
|
+
await import_fs3.promises.symlink(source, target, "file");
|
|
5462
5456
|
} else {
|
|
5463
|
-
await
|
|
5457
|
+
await import_fs3.promises.symlink(source, target);
|
|
5464
5458
|
}
|
|
5465
5459
|
} else {
|
|
5466
5460
|
if (isWindows) {
|
|
5467
|
-
await
|
|
5461
|
+
await import_fs3.promises.symlink(source, target, "junction");
|
|
5468
5462
|
} else {
|
|
5469
|
-
await
|
|
5463
|
+
await import_fs3.promises.symlink(source, target, "dir");
|
|
5470
5464
|
}
|
|
5471
5465
|
}
|
|
5472
5466
|
log8.debug(`Created symlink: ${target} -> ${source}`);
|
|
@@ -5492,7 +5486,7 @@ var init_node_file_system = __esm({
|
|
|
5492
5486
|
async removeSymlink(filePath) {
|
|
5493
5487
|
try {
|
|
5494
5488
|
if (await this.isSymlink(filePath)) {
|
|
5495
|
-
await
|
|
5489
|
+
await import_fs3.promises.unlink(filePath);
|
|
5496
5490
|
log8.debug(`Removed symlink: ${filePath}`);
|
|
5497
5491
|
}
|
|
5498
5492
|
} catch (error) {
|
|
@@ -5502,7 +5496,7 @@ var init_node_file_system = __esm({
|
|
|
5502
5496
|
}
|
|
5503
5497
|
async isSymlink(filePath) {
|
|
5504
5498
|
try {
|
|
5505
|
-
const stats = await
|
|
5499
|
+
const stats = await import_fs3.promises.lstat(filePath);
|
|
5506
5500
|
return stats.isSymbolicLink();
|
|
5507
5501
|
} catch {
|
|
5508
5502
|
return false;
|
|
@@ -5510,7 +5504,7 @@ var init_node_file_system = __esm({
|
|
|
5510
5504
|
}
|
|
5511
5505
|
async readSymlink(filePath) {
|
|
5512
5506
|
try {
|
|
5513
|
-
return await
|
|
5507
|
+
return await import_fs3.promises.readlink(filePath);
|
|
5514
5508
|
} catch (error) {
|
|
5515
5509
|
log8.error(`Failed to read symlink: ${filePath}`, error);
|
|
5516
5510
|
throw error;
|
|
@@ -5518,7 +5512,7 @@ var init_node_file_system = __esm({
|
|
|
5518
5512
|
}
|
|
5519
5513
|
async createDirectory(dirPath, recursive = false) {
|
|
5520
5514
|
try {
|
|
5521
|
-
await
|
|
5515
|
+
await import_fs3.promises.mkdir(dirPath, { recursive });
|
|
5522
5516
|
log8.debug(`Created directory: ${dirPath}`);
|
|
5523
5517
|
} catch (error) {
|
|
5524
5518
|
log8.error(`Failed to create directory: ${dirPath}`, error);
|
|
@@ -5527,11 +5521,11 @@ var init_node_file_system = __esm({
|
|
|
5527
5521
|
}
|
|
5528
5522
|
async remove(filePath, recursive = false) {
|
|
5529
5523
|
try {
|
|
5530
|
-
const stats = await
|
|
5524
|
+
const stats = await import_fs3.promises.lstat(filePath);
|
|
5531
5525
|
if (stats.isDirectory()) {
|
|
5532
|
-
await
|
|
5526
|
+
await import_fs3.promises.rm(filePath, { recursive, force: true });
|
|
5533
5527
|
} else {
|
|
5534
|
-
await
|
|
5528
|
+
await import_fs3.promises.unlink(filePath);
|
|
5535
5529
|
}
|
|
5536
5530
|
log8.debug(`Removed: ${filePath}`);
|
|
5537
5531
|
} catch (error) {
|
|
@@ -5541,7 +5535,7 @@ var init_node_file_system = __esm({
|
|
|
5541
5535
|
}
|
|
5542
5536
|
async stat(filePath) {
|
|
5543
5537
|
try {
|
|
5544
|
-
const stats = await
|
|
5538
|
+
const stats = await import_fs3.promises.stat(filePath);
|
|
5545
5539
|
return {
|
|
5546
5540
|
isFile: () => stats.isFile(),
|
|
5547
5541
|
isDirectory: () => stats.isDirectory(),
|
|
@@ -5556,11 +5550,11 @@ var init_node_file_system = __esm({
|
|
|
5556
5550
|
}
|
|
5557
5551
|
async copyFile(source, target) {
|
|
5558
5552
|
try {
|
|
5559
|
-
const targetDir =
|
|
5553
|
+
const targetDir = import_path4.default.dirname(target);
|
|
5560
5554
|
if (!await this.exists(targetDir)) {
|
|
5561
|
-
await
|
|
5555
|
+
await import_fs3.promises.mkdir(targetDir, { recursive: true });
|
|
5562
5556
|
}
|
|
5563
|
-
await
|
|
5557
|
+
await import_fs3.promises.copyFile(source, target);
|
|
5564
5558
|
log8.debug(`Copied file: ${source} -> ${target}`);
|
|
5565
5559
|
} catch (error) {
|
|
5566
5560
|
log8.error(`Failed to copy file: ${source} -> ${target}`, error);
|
|
@@ -5569,7 +5563,7 @@ var init_node_file_system = __esm({
|
|
|
5569
5563
|
}
|
|
5570
5564
|
async readFile(filePath, encoding = "utf-8") {
|
|
5571
5565
|
try {
|
|
5572
|
-
return await
|
|
5566
|
+
return await import_fs3.promises.readFile(filePath, encoding);
|
|
5573
5567
|
} catch (error) {
|
|
5574
5568
|
log8.error(`Failed to read file: ${filePath}`, error);
|
|
5575
5569
|
throw error;
|
|
@@ -5577,11 +5571,11 @@ var init_node_file_system = __esm({
|
|
|
5577
5571
|
}
|
|
5578
5572
|
async writeFile(filePath, content, encoding = "utf-8") {
|
|
5579
5573
|
try {
|
|
5580
|
-
const dir2 =
|
|
5574
|
+
const dir2 = import_path4.default.dirname(filePath);
|
|
5581
5575
|
if (!await this.exists(dir2)) {
|
|
5582
|
-
await
|
|
5576
|
+
await import_fs3.promises.mkdir(dir2, { recursive: true });
|
|
5583
5577
|
}
|
|
5584
|
-
await
|
|
5578
|
+
await import_fs3.promises.writeFile(filePath, content, encoding);
|
|
5585
5579
|
log8.debug(`Wrote file: ${filePath}`);
|
|
5586
5580
|
} catch (error) {
|
|
5587
5581
|
log8.error(`Failed to write file: ${filePath}`, error);
|
|
@@ -5590,7 +5584,7 @@ var init_node_file_system = __esm({
|
|
|
5590
5584
|
}
|
|
5591
5585
|
async unlink(filePath) {
|
|
5592
5586
|
try {
|
|
5593
|
-
await
|
|
5587
|
+
await import_fs3.promises.unlink(filePath);
|
|
5594
5588
|
log8.debug(`Deleted file: ${filePath}`);
|
|
5595
5589
|
} catch (error) {
|
|
5596
5590
|
log8.error(`Failed to delete file: ${filePath}`, error);
|
|
@@ -5599,22 +5593,40 @@ var init_node_file_system = __esm({
|
|
|
5599
5593
|
}
|
|
5600
5594
|
async access(filePath) {
|
|
5601
5595
|
try {
|
|
5602
|
-
await
|
|
5596
|
+
await import_fs3.promises.access(filePath);
|
|
5603
5597
|
} catch (error) {
|
|
5604
5598
|
throw new Error(`Cannot access path: ${filePath}`);
|
|
5605
5599
|
}
|
|
5606
5600
|
}
|
|
5607
5601
|
async resolvePath(filePath) {
|
|
5608
|
-
return
|
|
5602
|
+
return import_path4.default.resolve(filePath);
|
|
5609
5603
|
}
|
|
5610
5604
|
basename(filePath) {
|
|
5611
|
-
return
|
|
5605
|
+
return import_path4.default.basename(filePath);
|
|
5612
5606
|
}
|
|
5613
5607
|
dirname(filePath) {
|
|
5614
|
-
return
|
|
5608
|
+
return import_path4.default.dirname(filePath);
|
|
5615
5609
|
}
|
|
5616
5610
|
join(...paths) {
|
|
5617
|
-
return
|
|
5611
|
+
return import_path4.default.join(...paths);
|
|
5612
|
+
}
|
|
5613
|
+
// ============================================================================
|
|
5614
|
+
// Path Operations (Sync)
|
|
5615
|
+
// ============================================================================
|
|
5616
|
+
resolvePathSync(...paths) {
|
|
5617
|
+
return import_path4.default.resolve(...paths);
|
|
5618
|
+
}
|
|
5619
|
+
relative(from, to) {
|
|
5620
|
+
return import_path4.default.relative(from, to);
|
|
5621
|
+
}
|
|
5622
|
+
parsePath(filePath) {
|
|
5623
|
+
return import_path4.default.parse(filePath);
|
|
5624
|
+
}
|
|
5625
|
+
normalize(filePath) {
|
|
5626
|
+
return import_path4.default.normalize(filePath);
|
|
5627
|
+
}
|
|
5628
|
+
isAbsolute(filePath) {
|
|
5629
|
+
return import_path4.default.isAbsolute(filePath);
|
|
5618
5630
|
}
|
|
5619
5631
|
};
|
|
5620
5632
|
}
|
|
@@ -5828,10 +5840,10 @@ var init_publish_manifest = __esm({
|
|
|
5828
5840
|
*/
|
|
5829
5841
|
getChangedFiles(newManifest) {
|
|
5830
5842
|
const changedFiles = [];
|
|
5831
|
-
for (const [
|
|
5832
|
-
const oldEntry = this.files.get(
|
|
5843
|
+
for (const [path40, newEntry] of newManifest.files.entries()) {
|
|
5844
|
+
const oldEntry = this.files.get(path40);
|
|
5833
5845
|
if (!oldEntry || oldEntry.hash !== newEntry.hash) {
|
|
5834
|
-
changedFiles.push(
|
|
5846
|
+
changedFiles.push(path40);
|
|
5835
5847
|
}
|
|
5836
5848
|
}
|
|
5837
5849
|
return changedFiles;
|
|
@@ -5842,9 +5854,9 @@ var init_publish_manifest = __esm({
|
|
|
5842
5854
|
*/
|
|
5843
5855
|
getDeletedFiles(newManifest) {
|
|
5844
5856
|
const deletedFiles = [];
|
|
5845
|
-
for (const
|
|
5846
|
-
if (!newManifest.files.has(
|
|
5847
|
-
deletedFiles.push(
|
|
5857
|
+
for (const path40 of this.files.keys()) {
|
|
5858
|
+
if (!newManifest.files.has(path40)) {
|
|
5859
|
+
deletedFiles.push(path40);
|
|
5848
5860
|
}
|
|
5849
5861
|
}
|
|
5850
5862
|
return deletedFiles;
|
|
@@ -5854,8 +5866,8 @@ var init_publish_manifest = __esm({
|
|
|
5854
5866
|
*/
|
|
5855
5867
|
toJSON() {
|
|
5856
5868
|
const filesObj = {};
|
|
5857
|
-
for (const [
|
|
5858
|
-
filesObj[
|
|
5869
|
+
for (const [path40, entry] of this.files.entries()) {
|
|
5870
|
+
filesObj[path40] = entry;
|
|
5859
5871
|
}
|
|
5860
5872
|
return {
|
|
5861
5873
|
projectId: this.projectId,
|
|
@@ -7447,8 +7459,8 @@ var require_Client = __commonJS({
|
|
|
7447
7459
|
/**
|
|
7448
7460
|
* Set the working directory.
|
|
7449
7461
|
*/
|
|
7450
|
-
async cd(
|
|
7451
|
-
const validPath = await this.protectWhitespace(
|
|
7462
|
+
async cd(path40) {
|
|
7463
|
+
const validPath = await this.protectWhitespace(path40);
|
|
7452
7464
|
return this.send("CWD " + validPath);
|
|
7453
7465
|
}
|
|
7454
7466
|
/**
|
|
@@ -7461,8 +7473,8 @@ var require_Client = __commonJS({
|
|
|
7461
7473
|
* Get the last modified time of a file. This is not supported by every FTP server, in which case
|
|
7462
7474
|
* calling this method will throw an exception.
|
|
7463
7475
|
*/
|
|
7464
|
-
async lastMod(
|
|
7465
|
-
const validPath = await this.protectWhitespace(
|
|
7476
|
+
async lastMod(path40) {
|
|
7477
|
+
const validPath = await this.protectWhitespace(path40);
|
|
7466
7478
|
const res = await this.send(`MDTM ${validPath}`);
|
|
7467
7479
|
const date = res.message.slice(4);
|
|
7468
7480
|
return (0, parseListMLSD_1.parseMLSxDate)(date);
|
|
@@ -7470,8 +7482,8 @@ var require_Client = __commonJS({
|
|
|
7470
7482
|
/**
|
|
7471
7483
|
* Get the size of a file.
|
|
7472
7484
|
*/
|
|
7473
|
-
async size(
|
|
7474
|
-
const validPath = await this.protectWhitespace(
|
|
7485
|
+
async size(path40) {
|
|
7486
|
+
const validPath = await this.protectWhitespace(path40);
|
|
7475
7487
|
const command = `SIZE ${validPath}`;
|
|
7476
7488
|
const res = await this.send(command);
|
|
7477
7489
|
const size = parseInt(res.message.slice(4), 10);
|
|
@@ -7498,8 +7510,8 @@ var require_Client = __commonJS({
|
|
|
7498
7510
|
* You can ignore FTP error return codes which won't throw an exception if e.g.
|
|
7499
7511
|
* the file doesn't exist.
|
|
7500
7512
|
*/
|
|
7501
|
-
async remove(
|
|
7502
|
-
const validPath = await this.protectWhitespace(
|
|
7513
|
+
async remove(path40, ignoreErrorCodes = false) {
|
|
7514
|
+
const validPath = await this.protectWhitespace(path40);
|
|
7503
7515
|
if (ignoreErrorCodes) {
|
|
7504
7516
|
return this.sendIgnoringError(`DELE ${validPath}`);
|
|
7505
7517
|
}
|
|
@@ -7653,8 +7665,8 @@ var require_Client = __commonJS({
|
|
|
7653
7665
|
*
|
|
7654
7666
|
* @param [path] Path to remote file or directory.
|
|
7655
7667
|
*/
|
|
7656
|
-
async list(
|
|
7657
|
-
const validPath = await this.protectWhitespace(
|
|
7668
|
+
async list(path40 = "") {
|
|
7669
|
+
const validPath = await this.protectWhitespace(path40);
|
|
7658
7670
|
let lastError;
|
|
7659
7671
|
for (const candidate of this.availableListCommands) {
|
|
7660
7672
|
const command = validPath === "" ? candidate : `${candidate} ${validPath}`;
|
|
@@ -7824,21 +7836,21 @@ var require_Client = __commonJS({
|
|
|
7824
7836
|
/**
|
|
7825
7837
|
* Remove an empty directory, will fail if not empty.
|
|
7826
7838
|
*/
|
|
7827
|
-
async removeEmptyDir(
|
|
7828
|
-
const validPath = await this.protectWhitespace(
|
|
7839
|
+
async removeEmptyDir(path40) {
|
|
7840
|
+
const validPath = await this.protectWhitespace(path40);
|
|
7829
7841
|
return this.send(`RMD ${validPath}`);
|
|
7830
7842
|
}
|
|
7831
7843
|
/**
|
|
7832
7844
|
* FTP servers can't handle filenames that have leading whitespace. This method transforms
|
|
7833
7845
|
* a given path to fix that issue for most cases.
|
|
7834
7846
|
*/
|
|
7835
|
-
async protectWhitespace(
|
|
7836
|
-
if (!
|
|
7837
|
-
return
|
|
7847
|
+
async protectWhitespace(path40) {
|
|
7848
|
+
if (!path40.startsWith(" ")) {
|
|
7849
|
+
return path40;
|
|
7838
7850
|
}
|
|
7839
7851
|
const pwd = await this.pwd();
|
|
7840
7852
|
const absolutePathPrefix = pwd.endsWith("/") ? pwd : pwd + "/";
|
|
7841
|
-
return absolutePathPrefix +
|
|
7853
|
+
return absolutePathPrefix + path40;
|
|
7842
7854
|
}
|
|
7843
7855
|
async _exitAtCurrentDirectory(func) {
|
|
7844
7856
|
const userDir = await this.pwd();
|
|
@@ -7915,11 +7927,11 @@ var require_Client = __commonJS({
|
|
|
7915
7927
|
}
|
|
7916
7928
|
};
|
|
7917
7929
|
exports2.Client = Client2;
|
|
7918
|
-
async function ensureLocalDirectory(
|
|
7930
|
+
async function ensureLocalDirectory(path40) {
|
|
7919
7931
|
try {
|
|
7920
|
-
await fsStat(
|
|
7932
|
+
await fsStat(path40);
|
|
7921
7933
|
} catch (_a2) {
|
|
7922
|
-
await fsMkDir(
|
|
7934
|
+
await fsMkDir(path40, { recursive: true });
|
|
7923
7935
|
}
|
|
7924
7936
|
}
|
|
7925
7937
|
async function ignoreError(func) {
|
|
@@ -7982,14 +7994,14 @@ var require_dist = __commonJS({
|
|
|
7982
7994
|
});
|
|
7983
7995
|
|
|
7984
7996
|
// internal/domain/publish/value-object/ftp-publisher.ts
|
|
7985
|
-
var ftp,
|
|
7997
|
+
var ftp, import_path5, import_fs4, log10, FtpPublisher;
|
|
7986
7998
|
var init_ftp_publisher = __esm({
|
|
7987
7999
|
"internal/domain/publish/value-object/ftp-publisher.ts"() {
|
|
7988
8000
|
"use strict";
|
|
7989
8001
|
init_log();
|
|
7990
8002
|
ftp = __toESM(require_dist());
|
|
7991
|
-
|
|
7992
|
-
|
|
8003
|
+
import_path5 = __toESM(require("path"));
|
|
8004
|
+
import_fs4 = require("fs");
|
|
7993
8005
|
log10 = getDomainLogger("ftp-publisher", { component: "domain" });
|
|
7994
8006
|
FtpPublisher = class {
|
|
7995
8007
|
constructor(config, manifestRepo, projectId, projectPath) {
|
|
@@ -8036,10 +8048,10 @@ var init_ftp_publisher = __esm({
|
|
|
8036
8048
|
});
|
|
8037
8049
|
const createdDirs = /* @__PURE__ */ new Set();
|
|
8038
8050
|
for (const relativePath of changedFiles) {
|
|
8039
|
-
const localPath =
|
|
8051
|
+
const localPath = import_path5.default.join(sourceDir, relativePath);
|
|
8040
8052
|
const remoteFilePath = this.config.remotePath && this.config.remotePath !== "/" ? `${this.config.remotePath}/${relativePath}`.replace(/\\/g, "/") : relativePath.replace(/\\/g, "/");
|
|
8041
8053
|
try {
|
|
8042
|
-
const remoteDir =
|
|
8054
|
+
const remoteDir = import_path5.default.dirname(remoteFilePath).replace(/\\/g, "/");
|
|
8043
8055
|
if (remoteDir && remoteDir !== "." && remoteDir !== "/") {
|
|
8044
8056
|
if (!createdDirs.has(remoteDir)) {
|
|
8045
8057
|
try {
|
|
@@ -8052,7 +8064,7 @@ var init_ftp_publisher = __esm({
|
|
|
8052
8064
|
}
|
|
8053
8065
|
}
|
|
8054
8066
|
await this.uploadFileWithRetry(client, localPath, remoteFilePath, relativePath, 2);
|
|
8055
|
-
const stats = await
|
|
8067
|
+
const stats = await import_fs4.promises.stat(localPath);
|
|
8056
8068
|
bytesTransferred += stats.size;
|
|
8057
8069
|
filesUploaded++;
|
|
8058
8070
|
completedFiles++;
|
|
@@ -8270,13 +8282,13 @@ var init_ftp_publisher = __esm({
|
|
|
8270
8282
|
});
|
|
8271
8283
|
|
|
8272
8284
|
// internal/domain/publish/value-object/netlify-publisher.ts
|
|
8273
|
-
var
|
|
8285
|
+
var import_path6, import_fs5, log11, NetlifyPublisher;
|
|
8274
8286
|
var init_netlify_publisher = __esm({
|
|
8275
8287
|
"internal/domain/publish/value-object/netlify-publisher.ts"() {
|
|
8276
8288
|
"use strict";
|
|
8277
8289
|
init_log();
|
|
8278
|
-
|
|
8279
|
-
|
|
8290
|
+
import_path6 = __toESM(require("path"));
|
|
8291
|
+
import_fs5 = require("fs");
|
|
8280
8292
|
log11 = getDomainLogger("netlify-publisher", { component: "domain" });
|
|
8281
8293
|
NetlifyPublisher = class {
|
|
8282
8294
|
constructor(config, manifestRepo, httpClient, projectId, projectPath) {
|
|
@@ -8537,9 +8549,9 @@ var init_netlify_publisher = __esm({
|
|
|
8537
8549
|
log11.warn(`File not found in manifest: ${filePath}`);
|
|
8538
8550
|
continue;
|
|
8539
8551
|
}
|
|
8540
|
-
const localFilePath =
|
|
8552
|
+
const localFilePath = import_path6.default.join(sourceDir, filePath);
|
|
8541
8553
|
try {
|
|
8542
|
-
const fileContent = await
|
|
8554
|
+
const fileContent = await import_fs5.promises.readFile(localFilePath);
|
|
8543
8555
|
await this.uploadFileWithRetry(deployId, filePath, fileContent, fileEntry.hash);
|
|
8544
8556
|
filesUploaded++;
|
|
8545
8557
|
bytesTransferred += fileEntry.size;
|
|
@@ -8681,13 +8693,13 @@ var mdfriday_publisher_exports = {};
|
|
|
8681
8693
|
__export(mdfriday_publisher_exports, {
|
|
8682
8694
|
MDFridayPublisher: () => MDFridayPublisher
|
|
8683
8695
|
});
|
|
8684
|
-
var
|
|
8696
|
+
var import_path7, import_fs6, log12, MDFridayPublisher;
|
|
8685
8697
|
var init_mdfriday_publisher = __esm({
|
|
8686
8698
|
"internal/domain/publish/value-object/mdfriday-publisher.ts"() {
|
|
8687
8699
|
"use strict";
|
|
8688
8700
|
init_log();
|
|
8689
|
-
|
|
8690
|
-
|
|
8701
|
+
import_path7 = __toESM(require("path"));
|
|
8702
|
+
import_fs6 = require("fs");
|
|
8691
8703
|
log12 = getDomainLogger("mdfriday-publisher", { component: "domain" });
|
|
8692
8704
|
MDFridayPublisher = class {
|
|
8693
8705
|
constructor(config, manifestRepo, httpClient, projectId, projectPath) {
|
|
@@ -8904,9 +8916,9 @@ var init_mdfriday_publisher = __esm({
|
|
|
8904
8916
|
const zip = new JSZip2();
|
|
8905
8917
|
log12.debug(`Creating incremental ZIP with ${filesToInclude.length} files`);
|
|
8906
8918
|
for (const relativePath of filesToInclude) {
|
|
8907
|
-
const filePath =
|
|
8919
|
+
const filePath = import_path7.default.join(sourceDir, relativePath);
|
|
8908
8920
|
try {
|
|
8909
|
-
const fileContent = await
|
|
8921
|
+
const fileContent = await import_fs6.promises.readFile(filePath);
|
|
8910
8922
|
zip.file(relativePath, new Uint8Array(fileContent));
|
|
8911
8923
|
} catch (error) {
|
|
8912
8924
|
log12.error(`Failed to add file to ZIP: ${relativePath}`, error);
|
|
@@ -8926,16 +8938,16 @@ var init_mdfriday_publisher = __esm({
|
|
|
8926
8938
|
const JSZip2 = require("jszip");
|
|
8927
8939
|
const zip = new JSZip2();
|
|
8928
8940
|
const addDirectoryToZip = async (dirPath, zipFolder) => {
|
|
8929
|
-
const items = await
|
|
8941
|
+
const items = await import_fs6.promises.readdir(dirPath, { withFileTypes: true });
|
|
8930
8942
|
for (const item of items) {
|
|
8931
|
-
const itemPath =
|
|
8943
|
+
const itemPath = import_path7.default.join(dirPath, item.name);
|
|
8932
8944
|
if (item.isDirectory()) {
|
|
8933
8945
|
const subFolder = zipFolder.folder(item.name);
|
|
8934
8946
|
if (subFolder) {
|
|
8935
8947
|
await addDirectoryToZip(itemPath, subFolder);
|
|
8936
8948
|
}
|
|
8937
8949
|
} else if (item.isFile()) {
|
|
8938
|
-
const fileContent = await
|
|
8950
|
+
const fileContent = await import_fs6.promises.readFile(itemPath);
|
|
8939
8951
|
zipFolder.file(item.name, new Uint8Array(fileContent));
|
|
8940
8952
|
}
|
|
8941
8953
|
}
|
|
@@ -9027,10 +9039,10 @@ var init_mdfriday_publisher = __esm({
|
|
|
9027
9039
|
/**
|
|
9028
9040
|
* Build multipart form data for upload
|
|
9029
9041
|
*/
|
|
9030
|
-
buildFormData(zipContent, projectName,
|
|
9042
|
+
buildFormData(zipContent, projectName, path40, deploymentType) {
|
|
9031
9043
|
return {
|
|
9032
9044
|
type: deploymentType,
|
|
9033
|
-
path:
|
|
9045
|
+
path: path40,
|
|
9034
9046
|
id: "-1",
|
|
9035
9047
|
// NEW_ID
|
|
9036
9048
|
name: projectName,
|
|
@@ -9186,14 +9198,14 @@ var init_publish = __esm({
|
|
|
9186
9198
|
});
|
|
9187
9199
|
|
|
9188
9200
|
// internal/infrastructure/persistence/node-manifest-repository.ts
|
|
9189
|
-
var
|
|
9201
|
+
var import_path8, import_fs7, import_crypto, log14, NodeManifestRepository;
|
|
9190
9202
|
var init_node_manifest_repository = __esm({
|
|
9191
9203
|
"internal/infrastructure/persistence/node-manifest-repository.ts"() {
|
|
9192
9204
|
"use strict";
|
|
9193
9205
|
init_publish();
|
|
9194
9206
|
init_log();
|
|
9195
|
-
|
|
9196
|
-
|
|
9207
|
+
import_path8 = __toESM(require("path"));
|
|
9208
|
+
import_fs7 = require("fs");
|
|
9197
9209
|
import_crypto = __toESM(require("crypto"));
|
|
9198
9210
|
log14 = getDomainLogger("node-manifest-repo", { component: "infrastructure" });
|
|
9199
9211
|
NodeManifestRepository = class {
|
|
@@ -9203,7 +9215,7 @@ var init_node_manifest_repository = __esm({
|
|
|
9203
9215
|
async loadManifest(projectPath, publishMethod, suffix) {
|
|
9204
9216
|
const manifestPath = this.getManifestPath(projectPath, publishMethod, suffix);
|
|
9205
9217
|
try {
|
|
9206
|
-
const content = await
|
|
9218
|
+
const content = await import_fs7.promises.readFile(manifestPath, "utf-8");
|
|
9207
9219
|
const json = JSON.parse(content);
|
|
9208
9220
|
return PublishManifest.fromJSON(json);
|
|
9209
9221
|
} catch (error) {
|
|
@@ -9219,14 +9231,14 @@ var init_node_manifest_repository = __esm({
|
|
|
9219
9231
|
* Save manifest to file
|
|
9220
9232
|
*/
|
|
9221
9233
|
async saveManifest(projectPath, manifest, suffix) {
|
|
9222
|
-
const manifestDir =
|
|
9223
|
-
await
|
|
9234
|
+
const manifestDir = import_path8.default.join(projectPath, ".mdfriday");
|
|
9235
|
+
await import_fs7.promises.mkdir(manifestDir, { recursive: true });
|
|
9224
9236
|
const manifestPath = this.getManifestPath(
|
|
9225
9237
|
projectPath,
|
|
9226
9238
|
manifest.getPublishMethod(),
|
|
9227
9239
|
suffix
|
|
9228
9240
|
);
|
|
9229
|
-
await
|
|
9241
|
+
await import_fs7.promises.writeFile(
|
|
9230
9242
|
manifestPath,
|
|
9231
9243
|
JSON.stringify(manifest.toJSON(), null, 2),
|
|
9232
9244
|
"utf-8"
|
|
@@ -9255,7 +9267,7 @@ var init_node_manifest_repository = __esm({
|
|
|
9255
9267
|
async deleteManifest(projectPath, publishMethod, suffix) {
|
|
9256
9268
|
const manifestPath = this.getManifestPath(projectPath, publishMethod, suffix);
|
|
9257
9269
|
try {
|
|
9258
|
-
await
|
|
9270
|
+
await import_fs7.promises.unlink(manifestPath);
|
|
9259
9271
|
log14.debug(`Manifest deleted: ${manifestPath}`);
|
|
9260
9272
|
return true;
|
|
9261
9273
|
} catch (error) {
|
|
@@ -9278,20 +9290,20 @@ var init_node_manifest_repository = __esm({
|
|
|
9278
9290
|
*/
|
|
9279
9291
|
getManifestPath(projectPath, publishMethod, suffix) {
|
|
9280
9292
|
const filename = suffix ? `manifest-${publishMethod}-${suffix}.json` : `manifest-${publishMethod}.json`;
|
|
9281
|
-
return
|
|
9293
|
+
return import_path8.default.join(projectPath, ".mdfriday", filename);
|
|
9282
9294
|
}
|
|
9283
9295
|
/**
|
|
9284
9296
|
* Recursively scan directory and collect file info
|
|
9285
9297
|
*/
|
|
9286
9298
|
async scanDirectory(currentPath, relativePath, files, hashAlgorithm = "md5") {
|
|
9287
|
-
const items = await
|
|
9299
|
+
const items = await import_fs7.promises.readdir(currentPath, { withFileTypes: true });
|
|
9288
9300
|
for (const item of items) {
|
|
9289
|
-
const itemPath =
|
|
9290
|
-
const itemRelativePath = relativePath ?
|
|
9301
|
+
const itemPath = import_path8.default.join(currentPath, item.name);
|
|
9302
|
+
const itemRelativePath = relativePath ? import_path8.default.join(relativePath, item.name) : item.name;
|
|
9291
9303
|
if (item.isDirectory()) {
|
|
9292
9304
|
await this.scanDirectory(itemPath, itemRelativePath, files, hashAlgorithm);
|
|
9293
9305
|
} else if (item.isFile()) {
|
|
9294
|
-
const stats = await
|
|
9306
|
+
const stats = await import_fs7.promises.stat(itemPath);
|
|
9295
9307
|
const hash = await this.calculateFileHash(itemPath, hashAlgorithm);
|
|
9296
9308
|
const normalizedPath = itemRelativePath.replace(/\\/g, "/");
|
|
9297
9309
|
files.set(normalizedPath, {
|
|
@@ -9309,8 +9321,8 @@ var init_node_manifest_repository = __esm({
|
|
|
9309
9321
|
async calculateFileHash(filePath, algorithm = "md5") {
|
|
9310
9322
|
return new Promise((resolve3, reject) => {
|
|
9311
9323
|
const hash = import_crypto.default.createHash(algorithm);
|
|
9312
|
-
const
|
|
9313
|
-
const stream =
|
|
9324
|
+
const fs13 = require("fs");
|
|
9325
|
+
const stream = fs13.createReadStream(filePath);
|
|
9314
9326
|
stream.on("data", (data) => hash.update(data));
|
|
9315
9327
|
stream.on("end", () => resolve3(hash.digest("hex")));
|
|
9316
9328
|
stream.on("error", reject);
|
|
@@ -10269,8 +10281,8 @@ var init_module2 = __esm({
|
|
|
10269
10281
|
/**
|
|
10270
10282
|
* Find import by path
|
|
10271
10283
|
*/
|
|
10272
|
-
findImport(
|
|
10273
|
-
return this.moduleConfig.imports.find((imp) => imp.path ===
|
|
10284
|
+
findImport(path40) {
|
|
10285
|
+
return this.moduleConfig.imports.find((imp) => imp.path === path40);
|
|
10274
10286
|
}
|
|
10275
10287
|
/**
|
|
10276
10288
|
* Find mount by source
|
|
@@ -11519,11 +11531,11 @@ var init_markdown2 = __esm({
|
|
|
11519
11531
|
function newDir(workingDir, themesDir, publishDir) {
|
|
11520
11532
|
return new Dir(workingDir, themesDir, publishDir);
|
|
11521
11533
|
}
|
|
11522
|
-
var
|
|
11534
|
+
var import_path9, DEFAULT_PUBLISH_DIR, Dir;
|
|
11523
11535
|
var init_dir = __esm({
|
|
11524
11536
|
"internal/domain/config/entity/dir.ts"() {
|
|
11525
11537
|
"use strict";
|
|
11526
|
-
|
|
11538
|
+
import_path9 = __toESM(require("path"));
|
|
11527
11539
|
DEFAULT_PUBLISH_DIR = "public";
|
|
11528
11540
|
Dir = class {
|
|
11529
11541
|
workingDir;
|
|
@@ -11535,16 +11547,16 @@ var init_dir = __esm({
|
|
|
11535
11547
|
this.publishDir = publishDir;
|
|
11536
11548
|
}
|
|
11537
11549
|
getWorkingDir() {
|
|
11538
|
-
return
|
|
11550
|
+
return import_path9.default.resolve(this.workingDir);
|
|
11539
11551
|
}
|
|
11540
11552
|
getThemesDir() {
|
|
11541
|
-
return
|
|
11553
|
+
return import_path9.default.resolve(this.themesDir);
|
|
11542
11554
|
}
|
|
11543
11555
|
getThemesCacheDir() {
|
|
11544
|
-
return
|
|
11556
|
+
return import_path9.default.resolve(this.themesDir, ".cache");
|
|
11545
11557
|
}
|
|
11546
11558
|
getPublishDir() {
|
|
11547
|
-
return
|
|
11559
|
+
return import_path9.default.resolve(this.publishDir);
|
|
11548
11560
|
}
|
|
11549
11561
|
};
|
|
11550
11562
|
}
|
|
@@ -11734,12 +11746,12 @@ var init_provider = __esm({
|
|
|
11734
11746
|
});
|
|
11735
11747
|
|
|
11736
11748
|
// internal/domain/config/factory/loader.ts
|
|
11737
|
-
var
|
|
11749
|
+
var path10, NO_CONFIG_FILE_ERR_INFO, ConfigLoader;
|
|
11738
11750
|
var init_loader = __esm({
|
|
11739
11751
|
"internal/domain/config/factory/loader.ts"() {
|
|
11740
11752
|
"use strict";
|
|
11741
11753
|
init_provider();
|
|
11742
|
-
|
|
11754
|
+
path10 = __toESM(require("path"));
|
|
11743
11755
|
NO_CONFIG_FILE_ERR_INFO = "Unable to locate config file or config directory.";
|
|
11744
11756
|
ConfigLoader = class {
|
|
11745
11757
|
cfg;
|
|
@@ -11778,13 +11790,13 @@ var init_loader = __esm({
|
|
|
11778
11790
|
async loadProvider(configName) {
|
|
11779
11791
|
const baseDir = this.baseDirs.workingDir;
|
|
11780
11792
|
let baseFilename;
|
|
11781
|
-
if (
|
|
11793
|
+
if (path10.isAbsolute(configName)) {
|
|
11782
11794
|
baseFilename = configName;
|
|
11783
11795
|
} else {
|
|
11784
|
-
baseFilename =
|
|
11796
|
+
baseFilename = path10.join(baseDir, configName);
|
|
11785
11797
|
}
|
|
11786
11798
|
let filename = "";
|
|
11787
|
-
if (
|
|
11799
|
+
if (path10.extname(configName) !== "") {
|
|
11788
11800
|
const exists = await this.fileExists(baseFilename);
|
|
11789
11801
|
if (exists) {
|
|
11790
11802
|
filename = baseFilename;
|
|
@@ -11866,8 +11878,8 @@ var init_loader = __esm({
|
|
|
11866
11878
|
*/
|
|
11867
11879
|
async fileExists(filename) {
|
|
11868
11880
|
try {
|
|
11869
|
-
const
|
|
11870
|
-
const stat4 = await
|
|
11881
|
+
const fs13 = this.sourceDescriptor.fs();
|
|
11882
|
+
const stat4 = await fs13.stat(filename);
|
|
11871
11883
|
return !stat4.isDir();
|
|
11872
11884
|
} catch {
|
|
11873
11885
|
return false;
|
|
@@ -11877,8 +11889,8 @@ var init_loader = __esm({
|
|
|
11877
11889
|
* Load configuration from file
|
|
11878
11890
|
*/
|
|
11879
11891
|
async loadConfigFromFile(filename) {
|
|
11880
|
-
const
|
|
11881
|
-
const file = await
|
|
11892
|
+
const fs13 = this.sourceDescriptor.fs();
|
|
11893
|
+
const file = await fs13.open(filename);
|
|
11882
11894
|
try {
|
|
11883
11895
|
const buffer = new Uint8Array(1024 * 1024);
|
|
11884
11896
|
const { bytesRead } = await file.read(buffer);
|
|
@@ -11897,8 +11909,8 @@ var init_loader = __esm({
|
|
|
11897
11909
|
});
|
|
11898
11910
|
|
|
11899
11911
|
// internal/domain/config/factory/sourcedescriptor.ts
|
|
11900
|
-
function newSourceDescriptor(
|
|
11901
|
-
return new ConfigSourceDescriptor(
|
|
11912
|
+
function newSourceDescriptor(fs13, filename) {
|
|
11913
|
+
return new ConfigSourceDescriptor(fs13, filename);
|
|
11902
11914
|
}
|
|
11903
11915
|
var ConfigSourceDescriptor;
|
|
11904
11916
|
var init_sourcedescriptor = __esm({
|
|
@@ -11907,8 +11919,8 @@ var init_sourcedescriptor = __esm({
|
|
|
11907
11919
|
ConfigSourceDescriptor = class {
|
|
11908
11920
|
fileSystem;
|
|
11909
11921
|
configFilename;
|
|
11910
|
-
constructor(
|
|
11911
|
-
this.fileSystem =
|
|
11922
|
+
constructor(fs13, filename) {
|
|
11923
|
+
this.fileSystem = fs13;
|
|
11912
11924
|
this.configFilename = filename;
|
|
11913
11925
|
}
|
|
11914
11926
|
fs() {
|
|
@@ -11922,19 +11934,19 @@ var init_sourcedescriptor = __esm({
|
|
|
11922
11934
|
});
|
|
11923
11935
|
|
|
11924
11936
|
// internal/domain/config/factory/config.ts
|
|
11925
|
-
async function loadConfigWithParams(
|
|
11926
|
-
const cleanWorkingDir =
|
|
11927
|
-
const cleanModulesDir =
|
|
11928
|
-
const cleanPublishDir =
|
|
11937
|
+
async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir, params = {}) {
|
|
11938
|
+
const cleanWorkingDir = path11.resolve(workingDir);
|
|
11939
|
+
const cleanModulesDir = path11.resolve(modulesDir);
|
|
11940
|
+
const cleanPublishDir = path11.resolve(DEFAULT_PUBLISH_DIR);
|
|
11929
11941
|
const baseDirs = {
|
|
11930
11942
|
workingDir: cleanWorkingDir,
|
|
11931
11943
|
modulesDir: cleanModulesDir,
|
|
11932
11944
|
publishDir: cleanPublishDir,
|
|
11933
11945
|
cacheDir: ""
|
|
11934
11946
|
};
|
|
11935
|
-
baseDirs.cacheDir = await getCacheDir(
|
|
11947
|
+
baseDirs.cacheDir = await getCacheDir(fs13, baseDirs.cacheDir);
|
|
11936
11948
|
const loader = new ConfigLoader(
|
|
11937
|
-
newSourceDescriptor(
|
|
11949
|
+
newSourceDescriptor(fs13, configFilename),
|
|
11938
11950
|
baseDirs
|
|
11939
11951
|
);
|
|
11940
11952
|
try {
|
|
@@ -11942,10 +11954,10 @@ async function loadConfigWithParams(fs14, configFilename, workingDir, modulesDir
|
|
|
11942
11954
|
for (const [key2, value] of Object.entries(params)) {
|
|
11943
11955
|
provider.set(key2, value);
|
|
11944
11956
|
}
|
|
11945
|
-
const absPublishDir =
|
|
11946
|
-
await
|
|
11957
|
+
const absPublishDir = path11.resolve(provider.get("publishDir") || DEFAULT_PUBLISH_DIR);
|
|
11958
|
+
await fs13.mkdirAll(absPublishDir, 511);
|
|
11947
11959
|
return newConfig(
|
|
11948
|
-
|
|
11960
|
+
fs13,
|
|
11949
11961
|
provider,
|
|
11950
11962
|
newRoot(provider.get(""), provider.getParams("params")),
|
|
11951
11963
|
newDir(baseDirs.workingDir, baseDirs.modulesDir, absPublishDir),
|
|
@@ -11960,20 +11972,20 @@ async function loadConfigWithParams(fs14, configFilename, workingDir, modulesDir
|
|
|
11960
11972
|
loader.deleteMergeStrategies();
|
|
11961
11973
|
}
|
|
11962
11974
|
}
|
|
11963
|
-
async function getCacheDir(
|
|
11975
|
+
async function getCacheDir(fs13, cacheDir) {
|
|
11964
11976
|
if (cacheDir !== "") {
|
|
11965
11977
|
return cacheDir;
|
|
11966
11978
|
}
|
|
11967
11979
|
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
11968
|
-
const defaultCacheDir =
|
|
11980
|
+
const defaultCacheDir = path11.join(homeDir, ".cache", "mdf");
|
|
11969
11981
|
try {
|
|
11970
|
-
await
|
|
11982
|
+
await fs13.mkdirAll(defaultCacheDir, 493);
|
|
11971
11983
|
return defaultCacheDir;
|
|
11972
11984
|
} catch {
|
|
11973
|
-
return
|
|
11985
|
+
return path11.join("/tmp", "hugo-cache");
|
|
11974
11986
|
}
|
|
11975
11987
|
}
|
|
11976
|
-
var
|
|
11988
|
+
var path11;
|
|
11977
11989
|
var init_config2 = __esm({
|
|
11978
11990
|
"internal/domain/config/factory/config.ts"() {
|
|
11979
11991
|
"use strict";
|
|
@@ -11988,7 +12000,7 @@ var init_config2 = __esm({
|
|
|
11988
12000
|
init_markdown2();
|
|
11989
12001
|
init_loader();
|
|
11990
12002
|
init_sourcedescriptor();
|
|
11991
|
-
|
|
12003
|
+
path11 = __toESM(require("path"));
|
|
11992
12004
|
}
|
|
11993
12005
|
});
|
|
11994
12006
|
|
|
@@ -12060,11 +12072,11 @@ function createDefaultMounts(componentFolders) {
|
|
|
12060
12072
|
(folder) => new Mount(folder, folder)
|
|
12061
12073
|
);
|
|
12062
12074
|
}
|
|
12063
|
-
var
|
|
12075
|
+
var path12, Mount;
|
|
12064
12076
|
var init_mount = __esm({
|
|
12065
12077
|
"internal/domain/module/vo/mount.ts"() {
|
|
12066
12078
|
"use strict";
|
|
12067
|
-
|
|
12079
|
+
path12 = __toESM(require("path"));
|
|
12068
12080
|
Mount = class _Mount {
|
|
12069
12081
|
constructor(sourcePath, targetPath, language2 = "") {
|
|
12070
12082
|
this.sourcePath = sourcePath;
|
|
@@ -12099,16 +12111,16 @@ var init_mount = __esm({
|
|
|
12099
12111
|
* Get component name from target path
|
|
12100
12112
|
*/
|
|
12101
12113
|
component() {
|
|
12102
|
-
const parts = this.targetPath.split(
|
|
12114
|
+
const parts = this.targetPath.split(path12.sep);
|
|
12103
12115
|
return parts[0] || "";
|
|
12104
12116
|
}
|
|
12105
12117
|
/**
|
|
12106
12118
|
* Get component and name from target path
|
|
12107
12119
|
*/
|
|
12108
12120
|
componentAndName() {
|
|
12109
|
-
const parts = this.targetPath.split(
|
|
12121
|
+
const parts = this.targetPath.split(path12.sep);
|
|
12110
12122
|
const component = parts[0] || "";
|
|
12111
|
-
const name = parts.slice(1).join(
|
|
12123
|
+
const name = parts.slice(1).join(path12.sep);
|
|
12112
12124
|
return { component, name };
|
|
12113
12125
|
}
|
|
12114
12126
|
/**
|
|
@@ -12147,25 +12159,25 @@ var init_mount = __esm({
|
|
|
12147
12159
|
});
|
|
12148
12160
|
|
|
12149
12161
|
// internal/domain/module/vo/httpclient.ts
|
|
12150
|
-
function newHttpClient(
|
|
12162
|
+
function newHttpClient(fs13, timeout, headers, customClient) {
|
|
12151
12163
|
if (customClient) {
|
|
12152
12164
|
return customClient;
|
|
12153
12165
|
}
|
|
12154
|
-
return new NodeHttpClient2(
|
|
12166
|
+
return new NodeHttpClient2(fs13, timeout, headers);
|
|
12155
12167
|
}
|
|
12156
|
-
var
|
|
12168
|
+
var path13, http, https, log20, NodeHttpClient2;
|
|
12157
12169
|
var init_httpclient = __esm({
|
|
12158
12170
|
"internal/domain/module/vo/httpclient.ts"() {
|
|
12159
12171
|
"use strict";
|
|
12160
12172
|
init_type5();
|
|
12161
|
-
|
|
12173
|
+
path13 = __toESM(require("path"));
|
|
12162
12174
|
http = __toESM(require("http"));
|
|
12163
12175
|
https = __toESM(require("https"));
|
|
12164
12176
|
init_log();
|
|
12165
12177
|
log20 = getDomainLogger("module", { component: "httpclient" });
|
|
12166
12178
|
NodeHttpClient2 = class {
|
|
12167
|
-
constructor(
|
|
12168
|
-
this.fs =
|
|
12179
|
+
constructor(fs13, timeout = 3e4, headers = {}) {
|
|
12180
|
+
this.fs = fs13;
|
|
12169
12181
|
this.timeout = timeout;
|
|
12170
12182
|
this.headers = headers;
|
|
12171
12183
|
}
|
|
@@ -12209,7 +12221,7 @@ var init_httpclient = __esm({
|
|
|
12209
12221
|
let lastProgressTime = Date.now();
|
|
12210
12222
|
let lastLoggedPercentage = -1;
|
|
12211
12223
|
try {
|
|
12212
|
-
const targetDir =
|
|
12224
|
+
const targetDir = path13.dirname(targetPath);
|
|
12213
12225
|
await this.fs.mkdirAll(targetDir, 493);
|
|
12214
12226
|
const file = await this.fs.create(targetPath);
|
|
12215
12227
|
const chunks = [];
|
|
@@ -12350,28 +12362,28 @@ var init_httpclient = __esm({
|
|
|
12350
12362
|
});
|
|
12351
12363
|
|
|
12352
12364
|
// internal/domain/module/vo/zipextractor.ts
|
|
12353
|
-
function newZipExtractor(
|
|
12365
|
+
function newZipExtractor(fs13, environment = "node") {
|
|
12354
12366
|
switch (environment) {
|
|
12355
12367
|
case "node":
|
|
12356
|
-
return new JsZipExtractor(
|
|
12368
|
+
return new JsZipExtractor(fs13);
|
|
12357
12369
|
case "browser":
|
|
12358
|
-
return new WebZipExtractor(
|
|
12370
|
+
return new WebZipExtractor(fs13);
|
|
12359
12371
|
default:
|
|
12360
12372
|
throw new Error(`Unsupported environment: ${environment}`);
|
|
12361
12373
|
}
|
|
12362
12374
|
}
|
|
12363
|
-
var import_jszip,
|
|
12375
|
+
var import_jszip, path14, log21, JsZipExtractor, WebZipExtractor;
|
|
12364
12376
|
var init_zipextractor = __esm({
|
|
12365
12377
|
"internal/domain/module/vo/zipextractor.ts"() {
|
|
12366
12378
|
"use strict";
|
|
12367
12379
|
init_type5();
|
|
12368
12380
|
init_log();
|
|
12369
12381
|
import_jszip = __toESM(require("jszip"));
|
|
12370
|
-
|
|
12382
|
+
path14 = __toESM(require("path"));
|
|
12371
12383
|
log21 = getDomainLogger("module", { component: "zipextractor" });
|
|
12372
12384
|
JsZipExtractor = class {
|
|
12373
|
-
constructor(
|
|
12374
|
-
this.fs =
|
|
12385
|
+
constructor(fs13) {
|
|
12386
|
+
this.fs = fs13;
|
|
12375
12387
|
}
|
|
12376
12388
|
/**
|
|
12377
12389
|
* Extract ZIP file to target directory
|
|
@@ -12441,11 +12453,11 @@ var init_zipextractor = __esm({
|
|
|
12441
12453
|
* Extract a single ZIP entry (file or directory)
|
|
12442
12454
|
*/
|
|
12443
12455
|
async extractSingleEntry(relativePath, zipEntry, targetDir) {
|
|
12444
|
-
const fullPath =
|
|
12456
|
+
const fullPath = path14.join(targetDir, relativePath);
|
|
12445
12457
|
if (zipEntry.dir) {
|
|
12446
12458
|
await this.fs.mkdirAll(fullPath, 493);
|
|
12447
12459
|
} else {
|
|
12448
|
-
const dir2 =
|
|
12460
|
+
const dir2 = path14.dirname(fullPath);
|
|
12449
12461
|
if (dir2 !== targetDir) {
|
|
12450
12462
|
await this.fs.mkdirAll(dir2, 493);
|
|
12451
12463
|
}
|
|
@@ -12474,8 +12486,8 @@ var init_zipextractor = __esm({
|
|
|
12474
12486
|
}
|
|
12475
12487
|
};
|
|
12476
12488
|
WebZipExtractor = class {
|
|
12477
|
-
constructor(
|
|
12478
|
-
this.fs =
|
|
12489
|
+
constructor(fs13) {
|
|
12490
|
+
this.fs = fs13;
|
|
12479
12491
|
}
|
|
12480
12492
|
async extract(zipPath, targetDir) {
|
|
12481
12493
|
try {
|
|
@@ -12498,20 +12510,20 @@ var init_zipextractor = __esm({
|
|
|
12498
12510
|
});
|
|
12499
12511
|
|
|
12500
12512
|
// internal/domain/module/vo/cache.ts
|
|
12501
|
-
function newModuleCache(
|
|
12502
|
-
return new FsModuleCache(
|
|
12513
|
+
function newModuleCache(fs13, cacheDir) {
|
|
12514
|
+
return new FsModuleCache(fs13, cacheDir);
|
|
12503
12515
|
}
|
|
12504
|
-
var
|
|
12516
|
+
var path15, log22, FsModuleCache;
|
|
12505
12517
|
var init_cache = __esm({
|
|
12506
12518
|
"internal/domain/module/vo/cache.ts"() {
|
|
12507
12519
|
"use strict";
|
|
12508
12520
|
init_type5();
|
|
12509
12521
|
init_log();
|
|
12510
|
-
|
|
12522
|
+
path15 = __toESM(require("path"));
|
|
12511
12523
|
log22 = getDomainLogger("module", { component: "cache" });
|
|
12512
12524
|
FsModuleCache = class {
|
|
12513
|
-
constructor(
|
|
12514
|
-
this.fs =
|
|
12525
|
+
constructor(fs13, cacheDir = "./module/cache") {
|
|
12526
|
+
this.fs = fs13;
|
|
12515
12527
|
this.cacheDir = cacheDir;
|
|
12516
12528
|
}
|
|
12517
12529
|
cacheDir;
|
|
@@ -12603,7 +12615,7 @@ var init_cache = __esm({
|
|
|
12603
12615
|
*/
|
|
12604
12616
|
getCacheFilePath(modulePath) {
|
|
12605
12617
|
const safeFileName = modulePath.replace(/[/\\:*?"<>|]/g, "_").replace(/^_+|_+$/g, "") + ".json";
|
|
12606
|
-
return
|
|
12618
|
+
return path15.join(this.cacheDir, safeFileName);
|
|
12607
12619
|
}
|
|
12608
12620
|
/**
|
|
12609
12621
|
* Get cache directory
|
|
@@ -12620,7 +12632,7 @@ var init_cache = __esm({
|
|
|
12620
12632
|
let totalSize = 0;
|
|
12621
12633
|
for (const file of files) {
|
|
12622
12634
|
try {
|
|
12623
|
-
const filePath =
|
|
12635
|
+
const filePath = path15.join(this.cacheDir, file);
|
|
12624
12636
|
const fileInfo = await this.fs.stat(filePath);
|
|
12625
12637
|
totalSize += fileInfo.size();
|
|
12626
12638
|
} catch (error) {
|
|
@@ -12644,7 +12656,7 @@ var init_cache = __esm({
|
|
|
12644
12656
|
try {
|
|
12645
12657
|
const files = await this.listCacheFiles();
|
|
12646
12658
|
return files.map(
|
|
12647
|
-
(file) =>
|
|
12659
|
+
(file) => path15.basename(file, ".json").replace(/_/g, "/")
|
|
12648
12660
|
);
|
|
12649
12661
|
} catch (error) {
|
|
12650
12662
|
return [];
|
|
@@ -12668,15 +12680,15 @@ var init_cache = __esm({
|
|
|
12668
12680
|
});
|
|
12669
12681
|
|
|
12670
12682
|
// internal/domain/module/vo/module.ts
|
|
12671
|
-
function newModule2(
|
|
12672
|
-
return new Module2(
|
|
12683
|
+
function newModule2(fs13, absoluteDir, modulePath, parent) {
|
|
12684
|
+
return new Module2(fs13, absoluteDir, modulePath, parent || null, false);
|
|
12673
12685
|
}
|
|
12674
12686
|
function newProjectModule(info) {
|
|
12675
|
-
const
|
|
12687
|
+
const fs13 = info.osFs();
|
|
12676
12688
|
const absoluteDir = info.projDir();
|
|
12677
12689
|
const modulePath = "project-root";
|
|
12678
12690
|
const defaultLanguage3 = info.defaultLanguageKey();
|
|
12679
|
-
const module2 = new Module2(
|
|
12691
|
+
const module2 = new Module2(fs13, absoluteDir, modulePath, null, true);
|
|
12680
12692
|
const projectModule = new ProjectModule(module2);
|
|
12681
12693
|
projectModule.applyDefaultMounts();
|
|
12682
12694
|
if (defaultLanguage3) {
|
|
@@ -12696,16 +12708,16 @@ function newProjectModule(info) {
|
|
|
12696
12708
|
}
|
|
12697
12709
|
return projectModule;
|
|
12698
12710
|
}
|
|
12699
|
-
var
|
|
12711
|
+
var path16, Module2, ProjectModule;
|
|
12700
12712
|
var init_module3 = __esm({
|
|
12701
12713
|
"internal/domain/module/vo/module.ts"() {
|
|
12702
12714
|
"use strict";
|
|
12703
12715
|
init_type5();
|
|
12704
12716
|
init_mount();
|
|
12705
|
-
|
|
12717
|
+
path16 = __toESM(require("path"));
|
|
12706
12718
|
Module2 = class _Module {
|
|
12707
|
-
constructor(
|
|
12708
|
-
this.fs =
|
|
12719
|
+
constructor(fs13, absoluteDir, modulePath, parent = null, isProject = false) {
|
|
12720
|
+
this.fs = fs13;
|
|
12709
12721
|
this.absoluteDir = absoluteDir;
|
|
12710
12722
|
this.modulePath = modulePath;
|
|
12711
12723
|
this.parentModule = parent;
|
|
@@ -12766,7 +12778,7 @@ var init_module3 = __esm({
|
|
|
12766
12778
|
let mounts = moduleImport.mounts || [];
|
|
12767
12779
|
if (mounts.length === 0) {
|
|
12768
12780
|
for (const componentFolder of ComponentFolders) {
|
|
12769
|
-
const sourceDir =
|
|
12781
|
+
const sourceDir = path16.join(this.absoluteDir, componentFolder);
|
|
12770
12782
|
try {
|
|
12771
12783
|
const stat4 = await this.fs.stat(sourceDir);
|
|
12772
12784
|
if (stat4.isDir()) {
|
|
@@ -12917,11 +12929,11 @@ var init_module3 = __esm({
|
|
|
12917
12929
|
function newLang(modules) {
|
|
12918
12930
|
return new Lang(modules);
|
|
12919
12931
|
}
|
|
12920
|
-
var
|
|
12932
|
+
var import_path10, Lang;
|
|
12921
12933
|
var init_lang2 = __esm({
|
|
12922
12934
|
"internal/domain/module/entity/lang.ts"() {
|
|
12923
12935
|
"use strict";
|
|
12924
|
-
|
|
12936
|
+
import_path10 = __toESM(require("path"));
|
|
12925
12937
|
Lang = class {
|
|
12926
12938
|
sourceLangMap;
|
|
12927
12939
|
constructor(modules) {
|
|
@@ -12937,7 +12949,7 @@ var init_lang2 = __esm({
|
|
|
12937
12949
|
* Returns a tuple of [language, exists] to match Go's return pattern
|
|
12938
12950
|
*/
|
|
12939
12951
|
getSourceLang(source) {
|
|
12940
|
-
const lang2 = this.sourceLangMap.get(
|
|
12952
|
+
const lang2 = this.sourceLangMap.get(import_path10.default.basename(source));
|
|
12941
12953
|
if (lang2 !== void 0) {
|
|
12942
12954
|
return [lang2, true];
|
|
12943
12955
|
}
|
|
@@ -13040,7 +13052,7 @@ var init_themes = __esm({
|
|
|
13040
13052
|
function newModules(info, httpClient, zipExtractor, moduleCache) {
|
|
13041
13053
|
return new Modules(info, httpClient, zipExtractor, moduleCache);
|
|
13042
13054
|
}
|
|
13043
|
-
var import_smol_toml,
|
|
13055
|
+
var import_smol_toml, path18, log23, Modules;
|
|
13044
13056
|
var init_module4 = __esm({
|
|
13045
13057
|
"internal/domain/module/entity/module.ts"() {
|
|
13046
13058
|
"use strict";
|
|
@@ -13050,7 +13062,7 @@ var init_module4 = __esm({
|
|
|
13050
13062
|
init_themes();
|
|
13051
13063
|
init_log();
|
|
13052
13064
|
import_smol_toml = require("smol-toml");
|
|
13053
|
-
|
|
13065
|
+
path18 = __toESM(require("path"));
|
|
13054
13066
|
log23 = getDomainLogger("module", { component: "modules" });
|
|
13055
13067
|
Modules = class {
|
|
13056
13068
|
constructor(info, httpClient, zipExtractor, moduleCache) {
|
|
@@ -13205,7 +13217,7 @@ var init_module4 = __esm({
|
|
|
13205
13217
|
log23.info(`Cache version mismatch for ${moduleImport.path}: cached=${cachedMetadata.version}, requested=${effectiveVersion || "latest"}`);
|
|
13206
13218
|
}
|
|
13207
13219
|
const moduleDir = this.getModuleDir(moduleImport.path);
|
|
13208
|
-
const zipPath =
|
|
13220
|
+
const zipPath = path18.join(moduleDir, "module.zip");
|
|
13209
13221
|
const metadata = {
|
|
13210
13222
|
path: moduleImport.path,
|
|
13211
13223
|
version: moduleImport.version || "latest",
|
|
@@ -13311,7 +13323,7 @@ var init_module4 = __esm({
|
|
|
13311
13323
|
*/
|
|
13312
13324
|
getModuleDir(modulePath) {
|
|
13313
13325
|
const safeName = modulePath.replace(/[/\\:*?"<>|]/g, "_").replace(/^_+|_+$/g, "");
|
|
13314
|
-
return
|
|
13326
|
+
return path18.join(this.info.moduleDir(), safeName);
|
|
13315
13327
|
}
|
|
13316
13328
|
/**
|
|
13317
13329
|
* Get download URL for module path
|
|
@@ -13412,7 +13424,7 @@ var init_module4 = __esm({
|
|
|
13412
13424
|
*/
|
|
13413
13425
|
async parseThemeToml(module2) {
|
|
13414
13426
|
try {
|
|
13415
|
-
const themeTomlPath =
|
|
13427
|
+
const themeTomlPath = path18.join(module2.dir(), "theme.toml");
|
|
13416
13428
|
try {
|
|
13417
13429
|
const stat4 = await this.info.osFs().stat(themeTomlPath);
|
|
13418
13430
|
if (stat4.isDir()) {
|
|
@@ -13798,28 +13810,28 @@ var init_fileinfo = __esm({
|
|
|
13798
13810
|
});
|
|
13799
13811
|
|
|
13800
13812
|
// internal/domain/fs/vo/file.ts
|
|
13801
|
-
function newFileWithMeta(file, meta,
|
|
13802
|
-
return new File(file, meta,
|
|
13813
|
+
function newFileWithMeta(file, meta, fs13) {
|
|
13814
|
+
return new File(file, meta, fs13);
|
|
13803
13815
|
}
|
|
13804
|
-
function newDirFileWithMeta(file, meta,
|
|
13805
|
-
return new File(file, meta,
|
|
13816
|
+
function newDirFileWithMeta(file, meta, fs13) {
|
|
13817
|
+
return new File(file, meta, fs13, true);
|
|
13806
13818
|
}
|
|
13807
|
-
var
|
|
13819
|
+
var path19, File;
|
|
13808
13820
|
var init_file = __esm({
|
|
13809
13821
|
"internal/domain/fs/vo/file.ts"() {
|
|
13810
13822
|
"use strict";
|
|
13811
13823
|
init_filemeta();
|
|
13812
13824
|
init_fileinfo();
|
|
13813
|
-
|
|
13825
|
+
path19 = __toESM(require("path"));
|
|
13814
13826
|
File = class {
|
|
13815
13827
|
file;
|
|
13816
13828
|
fileMeta;
|
|
13817
13829
|
fs;
|
|
13818
13830
|
_isDir;
|
|
13819
|
-
constructor(file, fileMeta,
|
|
13831
|
+
constructor(file, fileMeta, fs13, isDir = false) {
|
|
13820
13832
|
this.file = file;
|
|
13821
13833
|
this.fileMeta = fileMeta;
|
|
13822
|
-
this.fs =
|
|
13834
|
+
this.fs = fs13;
|
|
13823
13835
|
this._isDir = isDir;
|
|
13824
13836
|
}
|
|
13825
13837
|
/**
|
|
@@ -13904,7 +13916,7 @@ var init_file = __esm({
|
|
|
13904
13916
|
return await this.file.writeAt(buffer, offset);
|
|
13905
13917
|
}
|
|
13906
13918
|
name() {
|
|
13907
|
-
return
|
|
13919
|
+
return path19.basename(this.fileMeta.fileName());
|
|
13908
13920
|
}
|
|
13909
13921
|
async readdir(count) {
|
|
13910
13922
|
if (this.file === null) {
|
|
@@ -13947,8 +13959,8 @@ var init_file = __esm({
|
|
|
13947
13959
|
});
|
|
13948
13960
|
|
|
13949
13961
|
// internal/domain/fs/vo/dir.ts
|
|
13950
|
-
function newDirFile(file, meta,
|
|
13951
|
-
const baseFile = new File(file, meta,
|
|
13962
|
+
function newDirFile(file, meta, fs13) {
|
|
13963
|
+
const baseFile = new File(file, meta, fs13, true);
|
|
13952
13964
|
return new DirFile(baseFile);
|
|
13953
13965
|
}
|
|
13954
13966
|
var DirFile;
|
|
@@ -14023,10 +14035,10 @@ var init_dir2 = __esm({
|
|
|
14023
14035
|
});
|
|
14024
14036
|
|
|
14025
14037
|
// internal/domain/fs/entity/basefs.ts
|
|
14026
|
-
function newBaseFs(
|
|
14027
|
-
return new BaseFs(
|
|
14038
|
+
function newBaseFs(fs13, roots) {
|
|
14039
|
+
return new BaseFs(fs13, roots);
|
|
14028
14040
|
}
|
|
14029
|
-
var
|
|
14041
|
+
var path20, log26, BaseFs;
|
|
14030
14042
|
var init_basefs = __esm({
|
|
14031
14043
|
"internal/domain/fs/entity/basefs.ts"() {
|
|
14032
14044
|
"use strict";
|
|
@@ -14034,15 +14046,15 @@ var init_basefs = __esm({
|
|
|
14034
14046
|
init_fileinfo();
|
|
14035
14047
|
init_file();
|
|
14036
14048
|
init_dir2();
|
|
14037
|
-
|
|
14049
|
+
path20 = __toESM(require("path"));
|
|
14038
14050
|
init_log();
|
|
14039
14051
|
log26 = getDomainLogger("fs", { component: "basefs" });
|
|
14040
14052
|
BaseFs = class {
|
|
14041
14053
|
fs;
|
|
14042
14054
|
// osFs
|
|
14043
14055
|
roots;
|
|
14044
|
-
constructor(
|
|
14045
|
-
this.fs =
|
|
14056
|
+
constructor(fs13, roots) {
|
|
14057
|
+
this.fs = fs13;
|
|
14046
14058
|
this.roots = roots;
|
|
14047
14059
|
}
|
|
14048
14060
|
/**
|
|
@@ -14057,17 +14069,17 @@ var init_basefs = __esm({
|
|
|
14057
14069
|
if (name === "") {
|
|
14058
14070
|
return root2;
|
|
14059
14071
|
}
|
|
14060
|
-
if (
|
|
14072
|
+
if (path20.isAbsolute(name)) {
|
|
14061
14073
|
if (name.startsWith(root2)) {
|
|
14062
14074
|
return name;
|
|
14063
14075
|
}
|
|
14064
|
-
return
|
|
14076
|
+
return path20.join(root2, name.substring(1));
|
|
14065
14077
|
}
|
|
14066
|
-
return
|
|
14078
|
+
return path20.join(root2, name);
|
|
14067
14079
|
}
|
|
14068
14080
|
isSameRootedPath(name) {
|
|
14069
14081
|
const root2 = this.roots[0];
|
|
14070
|
-
return name.startsWith(
|
|
14082
|
+
return name.startsWith(path20.join(root2, path20.sep)) || name === root2;
|
|
14071
14083
|
}
|
|
14072
14084
|
/**
|
|
14073
14085
|
* Stat returns file info with opener function
|
|
@@ -14153,8 +14165,8 @@ var init_basefs = __esm({
|
|
|
14153
14165
|
const absPath = this.toAbsolutePath(name);
|
|
14154
14166
|
return await this.fs.mkdir(absPath, perm);
|
|
14155
14167
|
}
|
|
14156
|
-
async mkdirAll(
|
|
14157
|
-
const absPath = this.toAbsolutePath(
|
|
14168
|
+
async mkdirAll(path40, perm) {
|
|
14169
|
+
const absPath = this.toAbsolutePath(path40);
|
|
14158
14170
|
return await this.fs.mkdirAll(absPath, perm);
|
|
14159
14171
|
}
|
|
14160
14172
|
async openFile(name, flag, perm) {
|
|
@@ -14165,8 +14177,8 @@ var init_basefs = __esm({
|
|
|
14165
14177
|
const absPath = this.toAbsolutePath(name);
|
|
14166
14178
|
return await this.fs.remove(absPath);
|
|
14167
14179
|
}
|
|
14168
|
-
async removeAll(
|
|
14169
|
-
const absPath = this.toAbsolutePath(
|
|
14180
|
+
async removeAll(path40) {
|
|
14181
|
+
const absPath = this.toAbsolutePath(path40);
|
|
14170
14182
|
return await this.fs.removeAll(absPath);
|
|
14171
14183
|
}
|
|
14172
14184
|
async rename(oldname, newname) {
|
|
@@ -14194,14 +14206,14 @@ var init_basefs = __esm({
|
|
|
14194
14206
|
});
|
|
14195
14207
|
|
|
14196
14208
|
// internal/domain/fs/vo/walkway.ts
|
|
14197
|
-
function newWalkway(
|
|
14198
|
-
return new Walkway(
|
|
14209
|
+
function newWalkway(fs13, cb) {
|
|
14210
|
+
return new Walkway(fs13, cb);
|
|
14199
14211
|
}
|
|
14200
|
-
var
|
|
14212
|
+
var path21, log27, Walkway;
|
|
14201
14213
|
var init_walkway = __esm({
|
|
14202
14214
|
"internal/domain/fs/vo/walkway.ts"() {
|
|
14203
14215
|
"use strict";
|
|
14204
|
-
|
|
14216
|
+
path21 = __toESM(require("path"));
|
|
14205
14217
|
init_type6();
|
|
14206
14218
|
init_fileinfo();
|
|
14207
14219
|
init_filemeta();
|
|
@@ -14213,14 +14225,14 @@ var init_walkway = __esm({
|
|
|
14213
14225
|
cb;
|
|
14214
14226
|
cfg;
|
|
14215
14227
|
walked = false;
|
|
14216
|
-
constructor(
|
|
14217
|
-
if (!
|
|
14228
|
+
constructor(fs13, cb) {
|
|
14229
|
+
if (!fs13) {
|
|
14218
14230
|
throw new Error("fs must be set");
|
|
14219
14231
|
}
|
|
14220
14232
|
if (!cb.walkFn) {
|
|
14221
14233
|
throw new Error("walkFn must be set");
|
|
14222
14234
|
}
|
|
14223
|
-
this.fs =
|
|
14235
|
+
this.fs = fs13;
|
|
14224
14236
|
this.cb = cb;
|
|
14225
14237
|
this.root = "";
|
|
14226
14238
|
this.cfg = {};
|
|
@@ -14328,7 +14340,7 @@ var init_walkway = __esm({
|
|
|
14328
14340
|
}
|
|
14329
14341
|
}
|
|
14330
14342
|
for (const entry of dirEntries) {
|
|
14331
|
-
const nextPath =
|
|
14343
|
+
const nextPath = path21.join(filePath, entry.name());
|
|
14332
14344
|
try {
|
|
14333
14345
|
await this.walkRecursive(nextPath, entry);
|
|
14334
14346
|
} catch (err) {
|
|
@@ -14410,9 +14422,9 @@ var init_static_copier = __esm({
|
|
|
14410
14422
|
async walkSourceFiles(sourceFs, targetDir) {
|
|
14411
14423
|
let fileCount = 0;
|
|
14412
14424
|
try {
|
|
14413
|
-
await this.walkFileSystem(sourceFs, "/", async (
|
|
14425
|
+
await this.walkFileSystem(sourceFs, "/", async (path40, isDir) => {
|
|
14414
14426
|
if (!isDir) {
|
|
14415
|
-
await this.copyFile(sourceFs,
|
|
14427
|
+
await this.copyFile(sourceFs, path40, this.toFs, targetDir);
|
|
14416
14428
|
fileCount++;
|
|
14417
14429
|
}
|
|
14418
14430
|
});
|
|
@@ -14425,9 +14437,9 @@ var init_static_copier = __esm({
|
|
|
14425
14437
|
/**
|
|
14426
14438
|
* Walk filesystem recursively
|
|
14427
14439
|
*/
|
|
14428
|
-
async walkFileSystem(
|
|
14440
|
+
async walkFileSystem(fs13, basePath, callback) {
|
|
14429
14441
|
try {
|
|
14430
|
-
const file = await
|
|
14442
|
+
const file = await fs13.open(basePath);
|
|
14431
14443
|
const fileInfo = await file.stat();
|
|
14432
14444
|
if (!fileInfo.isDir()) {
|
|
14433
14445
|
await file.close();
|
|
@@ -14440,7 +14452,7 @@ var init_static_copier = __esm({
|
|
|
14440
14452
|
const fullPath = this.joinPath(basePath, entry.name());
|
|
14441
14453
|
if (entry.isDir()) {
|
|
14442
14454
|
await callback(fullPath, true);
|
|
14443
|
-
await this.walkFileSystem(
|
|
14455
|
+
await this.walkFileSystem(fs13, fullPath, callback);
|
|
14444
14456
|
} else {
|
|
14445
14457
|
await callback(fullPath, false);
|
|
14446
14458
|
}
|
|
@@ -14496,8 +14508,8 @@ var init_static_copier = __esm({
|
|
|
14496
14508
|
/**
|
|
14497
14509
|
* Get directory name from path
|
|
14498
14510
|
*/
|
|
14499
|
-
dirname(
|
|
14500
|
-
const parts =
|
|
14511
|
+
dirname(path40) {
|
|
14512
|
+
const parts = path40.split("/").filter((part) => part.length > 0);
|
|
14501
14513
|
if (parts.length <= 1)
|
|
14502
14514
|
return "/";
|
|
14503
14515
|
return "/" + parts.slice(0, -1).join("/");
|
|
@@ -14510,26 +14522,26 @@ var init_static_copier = __esm({
|
|
|
14510
14522
|
async function collectFileMetaInfos(paths, fss) {
|
|
14511
14523
|
const result = /* @__PURE__ */ new Map();
|
|
14512
14524
|
let found = false;
|
|
14513
|
-
for (const
|
|
14514
|
-
for (const
|
|
14525
|
+
for (const path40 of paths) {
|
|
14526
|
+
for (const fs13 of fss) {
|
|
14515
14527
|
try {
|
|
14516
|
-
const fileMetaInfo = await createFileMetaInfo(
|
|
14517
|
-
result.set(
|
|
14528
|
+
const fileMetaInfo = await createFileMetaInfo(path40, fs13);
|
|
14529
|
+
result.set(path40, fileMetaInfo);
|
|
14518
14530
|
found = true;
|
|
14519
14531
|
if (found)
|
|
14520
14532
|
break;
|
|
14521
14533
|
} catch (error) {
|
|
14522
|
-
log29.error(`Failed to create FileMetaInfo for ${
|
|
14534
|
+
log29.error(`Failed to create FileMetaInfo for ${path40} with fs=${fs13}:`, error);
|
|
14523
14535
|
}
|
|
14524
14536
|
}
|
|
14525
14537
|
}
|
|
14526
14538
|
return result;
|
|
14527
14539
|
}
|
|
14528
|
-
async function createFileMetaInfo(filePath,
|
|
14540
|
+
async function createFileMetaInfo(filePath, fs13) {
|
|
14529
14541
|
try {
|
|
14530
|
-
const fi = await
|
|
14542
|
+
const fi = await fs13.stat(filePath);
|
|
14531
14543
|
const meta = newFileMeta(filePath);
|
|
14532
|
-
meta.setOpenFunc(async () => await
|
|
14544
|
+
meta.setOpenFunc(async () => await fs13.open(filePath));
|
|
14533
14545
|
return newFileInfoWithMeta(fi, meta);
|
|
14534
14546
|
} catch (error) {
|
|
14535
14547
|
throw new Error(`Failed to stat file ${filePath}: ${error.message}`);
|
|
@@ -14628,8 +14640,8 @@ var init_fs = __esm({
|
|
|
14628
14640
|
/**
|
|
14629
14641
|
* Create new base path filesystem
|
|
14630
14642
|
*/
|
|
14631
|
-
newBasePathFs(source,
|
|
14632
|
-
return newBaseFs(source, [
|
|
14643
|
+
newBasePathFs(source, path40) {
|
|
14644
|
+
return newBaseFs(source, [path40]);
|
|
14633
14645
|
}
|
|
14634
14646
|
async walkPrompts(start, cb, conf) {
|
|
14635
14647
|
return await this.walk(this.prompts, start, cb, conf);
|
|
@@ -14640,8 +14652,8 @@ var init_fs = __esm({
|
|
|
14640
14652
|
async walkLayouts(start, cb, conf) {
|
|
14641
14653
|
return await this.walk(this.layouts, start, cb, conf);
|
|
14642
14654
|
}
|
|
14643
|
-
async walkContent(
|
|
14644
|
-
await this.walk(
|
|
14655
|
+
async walkContent(fs13, start, cb, conf) {
|
|
14656
|
+
await this.walk(fs13, start, cb, conf);
|
|
14645
14657
|
}
|
|
14646
14658
|
async walkStatics(start, cb, conf) {
|
|
14647
14659
|
return await this.walk(this.statics, start, cb, conf);
|
|
@@ -14649,8 +14661,8 @@ var init_fs = __esm({
|
|
|
14649
14661
|
async walkI18n(start, cb, conf) {
|
|
14650
14662
|
return await this.walk(this.i18n, start, cb, conf);
|
|
14651
14663
|
}
|
|
14652
|
-
async walk(
|
|
14653
|
-
const w = newWalkway(
|
|
14664
|
+
async walk(fs13, start, cb, conf) {
|
|
14665
|
+
const w = newWalkway(fs13, cb);
|
|
14654
14666
|
if (start === "") {
|
|
14655
14667
|
start = "/";
|
|
14656
14668
|
}
|
|
@@ -14769,8 +14781,8 @@ var init_overlayoptions = __esm({
|
|
|
14769
14781
|
/**
|
|
14770
14782
|
* Check if filesystem exists in overlay
|
|
14771
14783
|
*/
|
|
14772
|
-
hasFilesystem(
|
|
14773
|
-
return this.fss.includes(
|
|
14784
|
+
hasFilesystem(fs13) {
|
|
14785
|
+
return this.fss.includes(fs13);
|
|
14774
14786
|
}
|
|
14775
14787
|
/**
|
|
14776
14788
|
* Get all filesystems as readonly array
|
|
@@ -14885,8 +14897,8 @@ var init_overlaydir = __esm({
|
|
|
14885
14897
|
*/
|
|
14886
14898
|
async loadDirectoryEntries() {
|
|
14887
14899
|
for (let i = 0; i < this.fss.length; i++) {
|
|
14888
|
-
const
|
|
14889
|
-
await this.readFromFilesystem(
|
|
14900
|
+
const fs13 = this.fss[i];
|
|
14901
|
+
await this.readFromFilesystem(fs13, null);
|
|
14890
14902
|
}
|
|
14891
14903
|
for (let i = 0; i < this.dirOpeners.length; i++) {
|
|
14892
14904
|
const file = await this.dirOpeners[i]();
|
|
@@ -14896,12 +14908,12 @@ var init_overlaydir = __esm({
|
|
|
14896
14908
|
/**
|
|
14897
14909
|
* Read directory entries from a specific filesystem or file
|
|
14898
14910
|
*/
|
|
14899
|
-
async readFromFilesystem(
|
|
14911
|
+
async readFromFilesystem(fs13, file) {
|
|
14900
14912
|
let f = file;
|
|
14901
14913
|
try {
|
|
14902
|
-
if (!f &&
|
|
14914
|
+
if (!f && fs13) {
|
|
14903
14915
|
const fsPath = this._name === "/" ? "" : this._name;
|
|
14904
|
-
f = await
|
|
14916
|
+
f = await fs13.open(fsPath);
|
|
14905
14917
|
}
|
|
14906
14918
|
if (!f) {
|
|
14907
14919
|
return;
|
|
@@ -15080,22 +15092,22 @@ var init_overlayfs = __esm({
|
|
|
15080
15092
|
* Collect directories from all filesystems
|
|
15081
15093
|
*/
|
|
15082
15094
|
async collectDirs(name, withFs) {
|
|
15083
|
-
for (const
|
|
15084
|
-
await this.collectDirsRecursive(
|
|
15095
|
+
for (const fs13 of this.fss) {
|
|
15096
|
+
await this.collectDirsRecursive(fs13, name, withFs);
|
|
15085
15097
|
}
|
|
15086
15098
|
}
|
|
15087
15099
|
/**
|
|
15088
15100
|
* Recursively collect directories from filesystem hierarchy
|
|
15089
15101
|
*/
|
|
15090
|
-
async collectDirsRecursive(
|
|
15102
|
+
async collectDirsRecursive(fs13, name, withFs) {
|
|
15091
15103
|
try {
|
|
15092
|
-
const fi = await
|
|
15104
|
+
const fi = await fs13.stat(name);
|
|
15093
15105
|
if (fi.isDir()) {
|
|
15094
|
-
withFs(
|
|
15106
|
+
withFs(fs13);
|
|
15095
15107
|
}
|
|
15096
15108
|
} catch (error) {
|
|
15097
15109
|
}
|
|
15098
|
-
const fsi =
|
|
15110
|
+
const fsi = fs13;
|
|
15099
15111
|
if (fsi.filesystem && fsi.numFilesystems) {
|
|
15100
15112
|
for (let i = 0; i < fsi.numFilesystems(); i++) {
|
|
15101
15113
|
const subFs = fsi.filesystem(i);
|
|
@@ -15110,8 +15122,8 @@ var init_overlayfs = __esm({
|
|
|
15110
15122
|
*/
|
|
15111
15123
|
async statInternal(name, lstatIfPossible) {
|
|
15112
15124
|
for (let i = 0; i < this.fss.length; i++) {
|
|
15113
|
-
const
|
|
15114
|
-
const [fs22, fi, ok3, err] = await this.statRecursive(
|
|
15125
|
+
const fs13 = this.fss[i];
|
|
15126
|
+
const [fs22, fi, ok3, err] = await this.statRecursive(fs13, name, lstatIfPossible);
|
|
15115
15127
|
if (err === null || !this.isNotExistError(err)) {
|
|
15116
15128
|
return [fs22, fi, ok3, err];
|
|
15117
15129
|
}
|
|
@@ -15121,16 +15133,16 @@ var init_overlayfs = __esm({
|
|
|
15121
15133
|
/**
|
|
15122
15134
|
* Recursive stat implementation
|
|
15123
15135
|
*/
|
|
15124
|
-
async statRecursive(
|
|
15136
|
+
async statRecursive(fs13, name, lstatIfPossible) {
|
|
15125
15137
|
try {
|
|
15126
|
-
const fi = await
|
|
15127
|
-
return [
|
|
15138
|
+
const fi = await fs13.stat(name);
|
|
15139
|
+
return [fs13, fi, false, null];
|
|
15128
15140
|
} catch (error) {
|
|
15129
15141
|
if (!this.isNotExistError(error)) {
|
|
15130
|
-
return [
|
|
15142
|
+
return [fs13, null, false, error];
|
|
15131
15143
|
}
|
|
15132
15144
|
}
|
|
15133
|
-
const fsi =
|
|
15145
|
+
const fsi = fs13;
|
|
15134
15146
|
if (fsi.filesystem && fsi.numFilesystems) {
|
|
15135
15147
|
for (let i = 0; i < fsi.numFilesystems(); i++) {
|
|
15136
15148
|
const subFs = fsi.filesystem(i);
|
|
@@ -15171,11 +15183,11 @@ var init_overlayfs = __esm({
|
|
|
15171
15183
|
/**
|
|
15172
15184
|
* Create directory tree (write operation)
|
|
15173
15185
|
*/
|
|
15174
|
-
async mkdirAll(
|
|
15186
|
+
async mkdirAll(path40, perm) {
|
|
15175
15187
|
if (!this.firstWritable) {
|
|
15176
15188
|
throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
|
|
15177
15189
|
}
|
|
15178
|
-
return await this.writeFs().mkdirAll(
|
|
15190
|
+
return await this.writeFs().mkdirAll(path40, perm);
|
|
15179
15191
|
}
|
|
15180
15192
|
/**
|
|
15181
15193
|
* Open file for reading (searches all filesystems)
|
|
@@ -15184,14 +15196,14 @@ var init_overlayfs = __esm({
|
|
|
15184
15196
|
if (this.fss.length === 0) {
|
|
15185
15197
|
throw ErrFileNotFound;
|
|
15186
15198
|
}
|
|
15187
|
-
const [
|
|
15199
|
+
const [fs13, fi, , err] = await this.statInternal(name, false);
|
|
15188
15200
|
if (err) {
|
|
15189
15201
|
throw err;
|
|
15190
15202
|
}
|
|
15191
15203
|
if (fi.isDir()) {
|
|
15192
15204
|
const dirFss = [];
|
|
15193
|
-
await this.collectDirs(name, (
|
|
15194
|
-
dirFss.push(
|
|
15205
|
+
await this.collectDirs(name, (fs14) => {
|
|
15206
|
+
dirFss.push(fs14);
|
|
15195
15207
|
});
|
|
15196
15208
|
if (dirFss.length === 0) {
|
|
15197
15209
|
throw ErrFileNotFound;
|
|
@@ -15207,7 +15219,7 @@ var init_overlayfs = __esm({
|
|
|
15207
15219
|
// Pass filesystems directly
|
|
15208
15220
|
);
|
|
15209
15221
|
}
|
|
15210
|
-
return await
|
|
15222
|
+
return await fs13.open(name);
|
|
15211
15223
|
}
|
|
15212
15224
|
/**
|
|
15213
15225
|
* Open file with flags (write operations use first filesystem)
|
|
@@ -15234,11 +15246,11 @@ var init_overlayfs = __esm({
|
|
|
15234
15246
|
/**
|
|
15235
15247
|
* Remove directory tree (write operation)
|
|
15236
15248
|
*/
|
|
15237
|
-
async removeAll(
|
|
15249
|
+
async removeAll(path40) {
|
|
15238
15250
|
if (!this.firstWritable) {
|
|
15239
15251
|
throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
|
|
15240
15252
|
}
|
|
15241
|
-
return await this.writeFs().removeAll(
|
|
15253
|
+
return await this.writeFs().removeAll(path40);
|
|
15242
15254
|
}
|
|
15243
15255
|
/**
|
|
15244
15256
|
* Rename file (write operation)
|
|
@@ -15495,13 +15507,13 @@ var init_overlayfs_factory = __esm({
|
|
|
15495
15507
|
function newFilesystemsCollector(sourceProject) {
|
|
15496
15508
|
return new FilesystemsCollector(sourceProject);
|
|
15497
15509
|
}
|
|
15498
|
-
var
|
|
15510
|
+
var path22, log31, RootMapping, FilesystemsCollector;
|
|
15499
15511
|
var init_filesystemscollector = __esm({
|
|
15500
15512
|
"internal/domain/fs/vo/filesystemscollector.ts"() {
|
|
15501
15513
|
"use strict";
|
|
15502
15514
|
init_overlayfs_factory();
|
|
15503
15515
|
init_basefs();
|
|
15504
|
-
|
|
15516
|
+
path22 = __toESM(require("path"));
|
|
15505
15517
|
init_log();
|
|
15506
15518
|
log31 = getDomainLogger("fs", { component: "filesystemscollector" });
|
|
15507
15519
|
RootMapping = class {
|
|
@@ -15556,7 +15568,7 @@ var init_filesystemscollector = __esm({
|
|
|
15556
15568
|
const fromToAssets = [];
|
|
15557
15569
|
const fromToI18n = [];
|
|
15558
15570
|
const absPathify = (inputPath) => {
|
|
15559
|
-
if (
|
|
15571
|
+
if (path22.isAbsolute(inputPath)) {
|
|
15560
15572
|
return ["", inputPath];
|
|
15561
15573
|
}
|
|
15562
15574
|
return [md.dir(), this.absPathify(md.dir(), inputPath)];
|
|
@@ -15569,21 +15581,21 @@ var init_filesystemscollector = __esm({
|
|
|
15569
15581
|
absFilename,
|
|
15570
15582
|
base2
|
|
15571
15583
|
);
|
|
15572
|
-
const
|
|
15584
|
+
const fs13 = rm2.fs(this.sourceProject);
|
|
15573
15585
|
if (this.isPrompts(mount.target())) {
|
|
15574
|
-
fromToPrompt.push(
|
|
15586
|
+
fromToPrompt.push(fs13);
|
|
15575
15587
|
} else if (this.isWorkflows(mount.target())) {
|
|
15576
|
-
fromToWorkflow.push(
|
|
15588
|
+
fromToWorkflow.push(fs13);
|
|
15577
15589
|
} else if (this.isContent(mount.target())) {
|
|
15578
|
-
fromToContent.push(
|
|
15590
|
+
fromToContent.push(fs13);
|
|
15579
15591
|
} else if (this.isLayouts(mount.target())) {
|
|
15580
|
-
fromToLayouts.push(
|
|
15592
|
+
fromToLayouts.push(fs13);
|
|
15581
15593
|
} else if (this.isStatics(mount.target())) {
|
|
15582
|
-
fromToStatics.push(
|
|
15594
|
+
fromToStatics.push(fs13);
|
|
15583
15595
|
} else if (this.isAssets(mount.target())) {
|
|
15584
|
-
fromToAssets.push(
|
|
15596
|
+
fromToAssets.push(fs13);
|
|
15585
15597
|
} else if (this.isI18n(mount.target())) {
|
|
15586
|
-
fromToI18n.push(
|
|
15598
|
+
fromToI18n.push(fs13);
|
|
15587
15599
|
}
|
|
15588
15600
|
}
|
|
15589
15601
|
if (fromToWorkflow.length > 0) {
|
|
@@ -15593,9 +15605,9 @@ var init_filesystemscollector = __esm({
|
|
|
15593
15605
|
this.overlayMountsPrompt = this.overlayMountsPrompt.append(...fromToPrompt);
|
|
15594
15606
|
}
|
|
15595
15607
|
if (md.isProjectModule()) {
|
|
15596
|
-
for (const
|
|
15608
|
+
for (const fs13 of fromToContent) {
|
|
15597
15609
|
let ofs = createReadOnlyOverlayFs([]);
|
|
15598
|
-
ofs = ofs.append(...[
|
|
15610
|
+
ofs = ofs.append(...[fs13]);
|
|
15599
15611
|
this.overlayMountsContent.push(ofs);
|
|
15600
15612
|
}
|
|
15601
15613
|
}
|
|
@@ -15635,7 +15647,7 @@ var init_filesystemscollector = __esm({
|
|
|
15635
15647
|
return target === "i18n" || target.startsWith("i18n/") || target.startsWith("/i18n/");
|
|
15636
15648
|
}
|
|
15637
15649
|
absPathify(baseDir, relativePath) {
|
|
15638
|
-
return
|
|
15650
|
+
return path22.resolve(baseDir, relativePath);
|
|
15639
15651
|
}
|
|
15640
15652
|
};
|
|
15641
15653
|
}
|
|
@@ -15645,12 +15657,12 @@ var init_filesystemscollector = __esm({
|
|
|
15645
15657
|
function newOsFs() {
|
|
15646
15658
|
return new OsFs();
|
|
15647
15659
|
}
|
|
15648
|
-
var
|
|
15660
|
+
var fs8, path23, log32, OsFileInfo, OsFile, OsFs;
|
|
15649
15661
|
var init_osfs = __esm({
|
|
15650
15662
|
"internal/domain/fs/vo/osfs.ts"() {
|
|
15651
15663
|
"use strict";
|
|
15652
|
-
|
|
15653
|
-
|
|
15664
|
+
fs8 = __toESM(require("fs/promises"));
|
|
15665
|
+
path23 = __toESM(require("path"));
|
|
15654
15666
|
init_log();
|
|
15655
15667
|
log32 = getDomainLogger("fs", { component: "osfs" });
|
|
15656
15668
|
OsFileInfo = class {
|
|
@@ -15687,7 +15699,7 @@ var init_osfs = __esm({
|
|
|
15687
15699
|
position = 0;
|
|
15688
15700
|
async ensureOpen() {
|
|
15689
15701
|
if (!this.handle && !this.closed) {
|
|
15690
|
-
this.handle = await
|
|
15702
|
+
this.handle = await fs8.open(this.filePath, this.flags);
|
|
15691
15703
|
}
|
|
15692
15704
|
}
|
|
15693
15705
|
async close() {
|
|
@@ -15768,13 +15780,13 @@ var init_osfs = __esm({
|
|
|
15768
15780
|
async readdir(count) {
|
|
15769
15781
|
if (this.closed)
|
|
15770
15782
|
throw new Error("File is closed");
|
|
15771
|
-
const entries = await
|
|
15783
|
+
const entries = await fs8.readdir(this.filePath, { withFileTypes: true });
|
|
15772
15784
|
const result = [];
|
|
15773
15785
|
const limit = count > 0 ? Math.min(count, entries.length) : entries.length;
|
|
15774
15786
|
for (let i = 0; i < limit; i++) {
|
|
15775
15787
|
const entry = entries[i];
|
|
15776
|
-
const entryPath =
|
|
15777
|
-
const stats = await
|
|
15788
|
+
const entryPath = path23.join(this.filePath, entry.name);
|
|
15789
|
+
const stats = await fs8.stat(entryPath);
|
|
15778
15790
|
result.push(new OsFileInfo(stats, entry.name));
|
|
15779
15791
|
}
|
|
15780
15792
|
return result;
|
|
@@ -15782,14 +15794,14 @@ var init_osfs = __esm({
|
|
|
15782
15794
|
async readdirnames(n) {
|
|
15783
15795
|
if (this.closed)
|
|
15784
15796
|
throw new Error("File is closed");
|
|
15785
|
-
const entries = await
|
|
15797
|
+
const entries = await fs8.readdir(this.filePath);
|
|
15786
15798
|
return n > 0 ? entries.slice(0, n) : entries;
|
|
15787
15799
|
}
|
|
15788
15800
|
async stat() {
|
|
15789
15801
|
if (this.closed)
|
|
15790
15802
|
throw new Error("File is closed");
|
|
15791
|
-
const stats = await
|
|
15792
|
-
return new OsFileInfo(stats,
|
|
15803
|
+
const stats = await fs8.stat(this.filePath);
|
|
15804
|
+
return new OsFileInfo(stats, path23.basename(this.filePath));
|
|
15793
15805
|
}
|
|
15794
15806
|
async sync() {
|
|
15795
15807
|
if (this.closed)
|
|
@@ -15818,18 +15830,18 @@ var init_osfs = __esm({
|
|
|
15818
15830
|
};
|
|
15819
15831
|
OsFs = class {
|
|
15820
15832
|
async create(name) {
|
|
15821
|
-
await
|
|
15833
|
+
await fs8.writeFile(name, "");
|
|
15822
15834
|
return new OsFile(name, "w+");
|
|
15823
15835
|
}
|
|
15824
15836
|
async mkdir(name, perm) {
|
|
15825
|
-
await
|
|
15837
|
+
await fs8.mkdir(name, { mode: perm });
|
|
15826
15838
|
}
|
|
15827
15839
|
async mkdirAll(dirPath, perm) {
|
|
15828
|
-
await
|
|
15840
|
+
await fs8.mkdir(dirPath, { mode: perm, recursive: true });
|
|
15829
15841
|
}
|
|
15830
15842
|
async open(name) {
|
|
15831
|
-
await
|
|
15832
|
-
const stats = await
|
|
15843
|
+
await fs8.access(name);
|
|
15844
|
+
const stats = await fs8.stat(name);
|
|
15833
15845
|
if (stats.isDirectory()) {
|
|
15834
15846
|
return new OsFile(name, "r");
|
|
15835
15847
|
} else {
|
|
@@ -15851,34 +15863,34 @@ var init_osfs = __esm({
|
|
|
15851
15863
|
return new OsFile(name, flags);
|
|
15852
15864
|
}
|
|
15853
15865
|
async remove(name) {
|
|
15854
|
-
const stats = await
|
|
15866
|
+
const stats = await fs8.stat(name);
|
|
15855
15867
|
if (stats.isDirectory()) {
|
|
15856
|
-
await
|
|
15868
|
+
await fs8.rmdir(name);
|
|
15857
15869
|
} else {
|
|
15858
|
-
await
|
|
15870
|
+
await fs8.unlink(name);
|
|
15859
15871
|
}
|
|
15860
15872
|
}
|
|
15861
15873
|
async removeAll(dirPath) {
|
|
15862
|
-
await
|
|
15874
|
+
await fs8.rm(dirPath, { recursive: true, force: true });
|
|
15863
15875
|
}
|
|
15864
15876
|
async rename(oldname, newname) {
|
|
15865
|
-
await
|
|
15877
|
+
await fs8.rename(oldname, newname);
|
|
15866
15878
|
}
|
|
15867
15879
|
async stat(name) {
|
|
15868
|
-
const stats = await
|
|
15869
|
-
return new OsFileInfo(stats,
|
|
15880
|
+
const stats = await fs8.stat(name);
|
|
15881
|
+
return new OsFileInfo(stats, path23.basename(name));
|
|
15870
15882
|
}
|
|
15871
15883
|
name() {
|
|
15872
15884
|
return "OsFs";
|
|
15873
15885
|
}
|
|
15874
15886
|
async chmod(name, mode) {
|
|
15875
|
-
await
|
|
15887
|
+
await fs8.chmod(name, mode);
|
|
15876
15888
|
}
|
|
15877
15889
|
async chown(name, uid, gid) {
|
|
15878
|
-
await
|
|
15890
|
+
await fs8.chown(name, uid, gid);
|
|
15879
15891
|
}
|
|
15880
15892
|
async chtimes(name, atime, mtime) {
|
|
15881
|
-
await
|
|
15893
|
+
await fs8.utimes(name, atime, mtime);
|
|
15882
15894
|
}
|
|
15883
15895
|
};
|
|
15884
15896
|
}
|
|
@@ -19238,8 +19250,8 @@ function wikilinkInlineRule(state, silent) {
|
|
|
19238
19250
|
function renderWikilinkLink(tokens, idx) {
|
|
19239
19251
|
const token = tokens[idx];
|
|
19240
19252
|
const meta = token.meta;
|
|
19241
|
-
const [
|
|
19242
|
-
const slug2 = slugifyFilePath(
|
|
19253
|
+
const [path40, _anchor] = splitAnchor(meta.url);
|
|
19254
|
+
const slug2 = slugifyFilePath(path40);
|
|
19243
19255
|
const displayText = meta.alias ?? meta.filepath;
|
|
19244
19256
|
const escapedText = escapeHtml(displayText);
|
|
19245
19257
|
return `<a class="internal" data-slug="${slug2}" data-wikilink="${escapeHtml(meta.url)}">${escapedText}</a>`;
|
|
@@ -20205,8 +20217,8 @@ var init_type10 = __esm({
|
|
|
20205
20217
|
COMPONENT_FOLDER_ASSETS: "assets",
|
|
20206
20218
|
COMPONENT_FOLDER_I18N: "i18n",
|
|
20207
20219
|
// Path normalization utility
|
|
20208
|
-
normalizePath: (
|
|
20209
|
-
let p2 =
|
|
20220
|
+
normalizePath: (path40) => {
|
|
20221
|
+
let p2 = path40.replace(/\\/g, "/");
|
|
20210
20222
|
if (p2.startsWith("//")) {
|
|
20211
20223
|
p2 = p2.substring(1);
|
|
20212
20224
|
}
|
|
@@ -20456,8 +20468,8 @@ var init_path2 = __esm({
|
|
|
20456
20468
|
if (this.components.component) {
|
|
20457
20469
|
return this.components.component;
|
|
20458
20470
|
}
|
|
20459
|
-
const
|
|
20460
|
-
const parts =
|
|
20471
|
+
const path40 = this.components.normalized;
|
|
20472
|
+
const parts = path40.split("/").filter((p2) => p2.length > 0);
|
|
20461
20473
|
if (parts.length === 0) {
|
|
20462
20474
|
return "content";
|
|
20463
20475
|
}
|
|
@@ -20785,10 +20797,10 @@ var init_path2 = __esm({
|
|
|
20785
20797
|
/**
|
|
20786
20798
|
* Create a path from string components
|
|
20787
20799
|
*/
|
|
20788
|
-
static fromString(component,
|
|
20800
|
+
static fromString(component, path40) {
|
|
20789
20801
|
const components = new PathComponentsImpl(
|
|
20790
|
-
|
|
20791
|
-
|
|
20802
|
+
path40,
|
|
20803
|
+
path40,
|
|
20792
20804
|
{ containerLow: -1, containerHigh: -1, sectionHigh: -1, identifierLanguage: -1 },
|
|
20793
20805
|
[],
|
|
20794
20806
|
0 /* File */,
|
|
@@ -20799,8 +20811,8 @@ var init_path2 = __esm({
|
|
|
20799
20811
|
/**
|
|
20800
20812
|
* Check if a path has a specific extension
|
|
20801
20813
|
*/
|
|
20802
|
-
static hasExtension(
|
|
20803
|
-
const pathExt =
|
|
20814
|
+
static hasExtension(path40, extension) {
|
|
20815
|
+
const pathExt = path40.ext();
|
|
20804
20816
|
const targetExt = extension.startsWith(".") ? extension : "." + extension;
|
|
20805
20817
|
return pathExt.toLowerCase() === targetExt.toLowerCase();
|
|
20806
20818
|
}
|
|
@@ -20858,20 +20870,20 @@ var init_pathparser = __esm({
|
|
|
20858
20870
|
/**
|
|
20859
20871
|
* Parse a path with component information
|
|
20860
20872
|
*/
|
|
20861
|
-
parse(component,
|
|
20862
|
-
let normalizedPath =
|
|
20873
|
+
parse(component, path40) {
|
|
20874
|
+
let normalizedPath = path40;
|
|
20863
20875
|
if (!normalizedPath || normalizedPath === "") {
|
|
20864
20876
|
normalizedPath = "/";
|
|
20865
20877
|
}
|
|
20866
20878
|
const normalized = this.normalizer.normalize(normalizedPath);
|
|
20867
|
-
const pathComponents = this.createPathComponents(component, normalized,
|
|
20879
|
+
const pathComponents = this.createPathComponents(component, normalized, path40);
|
|
20868
20880
|
return new Path(pathComponents);
|
|
20869
20881
|
}
|
|
20870
20882
|
/**
|
|
20871
20883
|
* Parse and return only the identity
|
|
20872
20884
|
*/
|
|
20873
|
-
parseIdentity(component,
|
|
20874
|
-
const parsed = this.parse(component,
|
|
20885
|
+
parseIdentity(component, path40) {
|
|
20886
|
+
const parsed = this.parse(component, path40);
|
|
20875
20887
|
return {
|
|
20876
20888
|
identifierBase: () => parsed.base()
|
|
20877
20889
|
};
|
|
@@ -20879,8 +20891,8 @@ var init_pathparser = __esm({
|
|
|
20879
20891
|
/**
|
|
20880
20892
|
* Parse and return base and base name without identifier
|
|
20881
20893
|
*/
|
|
20882
|
-
parseBaseAndBaseNameNoIdentifier(component,
|
|
20883
|
-
const parsed = this.parse(component,
|
|
20894
|
+
parseBaseAndBaseNameNoIdentifier(component, path40) {
|
|
20895
|
+
const parsed = this.parse(component, path40);
|
|
20884
20896
|
return [parsed.base(), parsed.baseNameNoIdentifier()];
|
|
20885
20897
|
}
|
|
20886
20898
|
/**
|
|
@@ -21009,8 +21021,8 @@ var init_pathparser = __esm({
|
|
|
21009
21021
|
this.toLowerCase = toLowerCase;
|
|
21010
21022
|
this.replaceSpaces = replaceSpaces;
|
|
21011
21023
|
}
|
|
21012
|
-
normalize(
|
|
21013
|
-
let result =
|
|
21024
|
+
normalize(path40) {
|
|
21025
|
+
let result = path40;
|
|
21014
21026
|
result = result.replace(/\\/g, "/");
|
|
21015
21027
|
if (this.toLowerCase) {
|
|
21016
21028
|
result = result.toLowerCase();
|
|
@@ -21026,8 +21038,8 @@ var init_pathparser = __esm({
|
|
|
21026
21038
|
this.toLowerCase = toLowerCase;
|
|
21027
21039
|
this.replaceSpaces = replaceSpaces;
|
|
21028
21040
|
}
|
|
21029
|
-
normalize(
|
|
21030
|
-
let result =
|
|
21041
|
+
normalize(path40) {
|
|
21042
|
+
let result = path40;
|
|
21031
21043
|
result = result.replace(/\\/g, "/");
|
|
21032
21044
|
if (this.toLowerCase) {
|
|
21033
21045
|
result = result.toLowerCase();
|
|
@@ -21047,12 +21059,12 @@ var init_pathparser = __esm({
|
|
|
21047
21059
|
const htmlExts = PATH_CONSTANTS.HTML_EXTENSIONS;
|
|
21048
21060
|
return htmlExts.includes(ext.toLowerCase());
|
|
21049
21061
|
}
|
|
21050
|
-
hasExt(
|
|
21051
|
-
for (let i =
|
|
21052
|
-
if (
|
|
21062
|
+
hasExt(path40) {
|
|
21063
|
+
for (let i = path40.length - 1; i >= 0; i--) {
|
|
21064
|
+
if (path40[i] === ".") {
|
|
21053
21065
|
return true;
|
|
21054
21066
|
}
|
|
21055
|
-
if (
|
|
21067
|
+
if (path40[i] === "/") {
|
|
21056
21068
|
return false;
|
|
21057
21069
|
}
|
|
21058
21070
|
}
|
|
@@ -21063,10 +21075,10 @@ var init_pathparser = __esm({
|
|
|
21063
21075
|
/**
|
|
21064
21076
|
* Parse a path string into basic components
|
|
21065
21077
|
*/
|
|
21066
|
-
static parseBasic(
|
|
21067
|
-
const lastSlash =
|
|
21068
|
-
const dir2 = lastSlash >= 0 ?
|
|
21069
|
-
const name = lastSlash >= 0 ?
|
|
21078
|
+
static parseBasic(path40) {
|
|
21079
|
+
const lastSlash = path40.lastIndexOf("/");
|
|
21080
|
+
const dir2 = lastSlash >= 0 ? path40.substring(0, lastSlash) : "";
|
|
21081
|
+
const name = lastSlash >= 0 ? path40.substring(lastSlash + 1) : path40;
|
|
21070
21082
|
const lastDot = name.lastIndexOf(".");
|
|
21071
21083
|
const ext = lastDot >= 0 ? name.substring(lastDot) : "";
|
|
21072
21084
|
const nameWithoutExt = lastDot >= 0 ? name.substring(0, lastDot) : name;
|
|
@@ -21081,43 +21093,43 @@ var init_pathparser = __esm({
|
|
|
21081
21093
|
/**
|
|
21082
21094
|
* Normalize a path string using basic rules
|
|
21083
21095
|
*/
|
|
21084
|
-
static normalizeBasic(
|
|
21096
|
+
static normalizeBasic(path40) {
|
|
21085
21097
|
const normalizer = new BasicPathNormalizer();
|
|
21086
|
-
return normalizer.normalize(
|
|
21098
|
+
return normalizer.normalize(path40);
|
|
21087
21099
|
}
|
|
21088
21100
|
/**
|
|
21089
21101
|
* Check if a path represents a bundle
|
|
21090
21102
|
*/
|
|
21091
|
-
static isBundle(
|
|
21092
|
-
const basic = _PathParserUtils.parseBasic(
|
|
21103
|
+
static isBundle(path40) {
|
|
21104
|
+
const basic = _PathParserUtils.parseBasic(path40);
|
|
21093
21105
|
const indexNames = PATH_CONSTANTS.INDEX_NAMES;
|
|
21094
21106
|
return indexNames.includes(basic.nameWithoutExt);
|
|
21095
21107
|
}
|
|
21096
21108
|
/**
|
|
21097
21109
|
* Extract section from path
|
|
21098
21110
|
*/
|
|
21099
|
-
static extractSection(
|
|
21100
|
-
const normalized =
|
|
21111
|
+
static extractSection(path40) {
|
|
21112
|
+
const normalized = path40.startsWith("/") ? path40.substring(1) : path40;
|
|
21101
21113
|
const firstSlash = normalized.indexOf("/");
|
|
21102
21114
|
return firstSlash >= 0 ? normalized.substring(0, firstSlash) : normalized;
|
|
21103
21115
|
}
|
|
21104
21116
|
/**
|
|
21105
21117
|
* Remove extension from path
|
|
21106
21118
|
*/
|
|
21107
|
-
static removeExtension(
|
|
21108
|
-
const lastDot =
|
|
21109
|
-
const lastSlash =
|
|
21119
|
+
static removeExtension(path40) {
|
|
21120
|
+
const lastDot = path40.lastIndexOf(".");
|
|
21121
|
+
const lastSlash = path40.lastIndexOf("/");
|
|
21110
21122
|
if (lastDot > lastSlash) {
|
|
21111
|
-
return
|
|
21123
|
+
return path40.substring(0, lastDot);
|
|
21112
21124
|
}
|
|
21113
|
-
return
|
|
21125
|
+
return path40;
|
|
21114
21126
|
}
|
|
21115
21127
|
/**
|
|
21116
21128
|
* Check if path has extension
|
|
21117
21129
|
*/
|
|
21118
|
-
static hasExtension(
|
|
21130
|
+
static hasExtension(path40) {
|
|
21119
21131
|
const checker = new DefaultFileExtensionChecker();
|
|
21120
|
-
return checker.hasExt(
|
|
21132
|
+
return checker.hasExt(path40);
|
|
21121
21133
|
}
|
|
21122
21134
|
};
|
|
21123
21135
|
}
|
|
@@ -21148,11 +21160,11 @@ var init_pathfactory = __esm({
|
|
|
21148
21160
|
/**
|
|
21149
21161
|
* Create a Path from component and path string
|
|
21150
21162
|
*/
|
|
21151
|
-
create(component,
|
|
21163
|
+
create(component, path40, config) {
|
|
21152
21164
|
if (this.pool) {
|
|
21153
21165
|
const pooledPath = this.pool.get();
|
|
21154
21166
|
}
|
|
21155
|
-
return this.processor.parse(component,
|
|
21167
|
+
return this.processor.parse(component, path40);
|
|
21156
21168
|
}
|
|
21157
21169
|
/**
|
|
21158
21170
|
* Create a Path from PathComponents
|
|
@@ -21164,12 +21176,12 @@ var init_pathfactory = __esm({
|
|
|
21164
21176
|
* Create multiple paths from an array of path strings
|
|
21165
21177
|
*/
|
|
21166
21178
|
createMany(component, paths, config) {
|
|
21167
|
-
return paths.map((
|
|
21179
|
+
return paths.map((path40) => this.create(component, path40, config));
|
|
21168
21180
|
}
|
|
21169
21181
|
/**
|
|
21170
21182
|
* Create a path with custom configuration
|
|
21171
21183
|
*/
|
|
21172
|
-
createWithConfig(component,
|
|
21184
|
+
createWithConfig(component, path40, normalizeConfig) {
|
|
21173
21185
|
const config = {};
|
|
21174
21186
|
if (normalizeConfig?.toLowerCase !== void 0) {
|
|
21175
21187
|
config.normalize = normalizeConfig.toLowerCase;
|
|
@@ -21180,7 +21192,7 @@ var init_pathfactory = __esm({
|
|
|
21180
21192
|
if (normalizeConfig?.customNormalizer !== void 0) {
|
|
21181
21193
|
config.normalizer = normalizeConfig.customNormalizer;
|
|
21182
21194
|
}
|
|
21183
|
-
return this.create(component,
|
|
21195
|
+
return this.create(component, path40, config);
|
|
21184
21196
|
}
|
|
21185
21197
|
};
|
|
21186
21198
|
DefaultPathFactory = class extends PathFactoryImpl {
|
|
@@ -21204,9 +21216,9 @@ var init_pathfactory = __esm({
|
|
|
21204
21216
|
const components = PathComponentsFactory.createEmpty();
|
|
21205
21217
|
return new Path(components);
|
|
21206
21218
|
}
|
|
21207
|
-
put(
|
|
21219
|
+
put(path40) {
|
|
21208
21220
|
if (this.pool.length < this.maxSize) {
|
|
21209
|
-
this.pool.push(
|
|
21221
|
+
this.pool.push(path40);
|
|
21210
21222
|
}
|
|
21211
21223
|
}
|
|
21212
21224
|
/**
|
|
@@ -21240,8 +21252,8 @@ var init_pathfactory = __esm({
|
|
|
21240
21252
|
/**
|
|
21241
21253
|
* Set the path
|
|
21242
21254
|
*/
|
|
21243
|
-
withPath(
|
|
21244
|
-
this.path =
|
|
21255
|
+
withPath(path40) {
|
|
21256
|
+
this.path = path40;
|
|
21245
21257
|
return this;
|
|
21246
21258
|
}
|
|
21247
21259
|
/**
|
|
@@ -21289,38 +21301,38 @@ var init_pathfactory = __esm({
|
|
|
21289
21301
|
/**
|
|
21290
21302
|
* Create a content path
|
|
21291
21303
|
*/
|
|
21292
|
-
static createContentPath(
|
|
21293
|
-
return _PathFactoryUtils.defaultFactory.create("content",
|
|
21304
|
+
static createContentPath(path40) {
|
|
21305
|
+
return _PathFactoryUtils.defaultFactory.create("content", path40);
|
|
21294
21306
|
}
|
|
21295
21307
|
/**
|
|
21296
21308
|
* Create a static resource path
|
|
21297
21309
|
*/
|
|
21298
|
-
static createStaticPath(
|
|
21299
|
-
return _PathFactoryUtils.defaultFactory.create("static",
|
|
21310
|
+
static createStaticPath(path40) {
|
|
21311
|
+
return _PathFactoryUtils.defaultFactory.create("static", path40);
|
|
21300
21312
|
}
|
|
21301
21313
|
/**
|
|
21302
21314
|
* Create a layout path
|
|
21303
21315
|
*/
|
|
21304
|
-
static createLayoutPath(
|
|
21305
|
-
return _PathFactoryUtils.defaultFactory.create("layouts",
|
|
21316
|
+
static createLayoutPath(path40) {
|
|
21317
|
+
return _PathFactoryUtils.defaultFactory.create("layouts", path40);
|
|
21306
21318
|
}
|
|
21307
21319
|
/**
|
|
21308
21320
|
* Create an archetype path
|
|
21309
21321
|
*/
|
|
21310
|
-
static createArchetypePath(
|
|
21311
|
-
return _PathFactoryUtils.defaultFactory.create("archetypes",
|
|
21322
|
+
static createArchetypePath(path40) {
|
|
21323
|
+
return _PathFactoryUtils.defaultFactory.create("archetypes", path40);
|
|
21312
21324
|
}
|
|
21313
21325
|
/**
|
|
21314
21326
|
* Create a data path
|
|
21315
21327
|
*/
|
|
21316
|
-
static createDataPath(
|
|
21317
|
-
return _PathFactoryUtils.defaultFactory.create("data",
|
|
21328
|
+
static createDataPath(path40) {
|
|
21329
|
+
return _PathFactoryUtils.defaultFactory.create("data", path40);
|
|
21318
21330
|
}
|
|
21319
21331
|
/**
|
|
21320
21332
|
* Create a theme path
|
|
21321
21333
|
*/
|
|
21322
|
-
static createThemePath(
|
|
21323
|
-
return _PathFactoryUtils.defaultFactory.create("themes",
|
|
21334
|
+
static createThemePath(path40) {
|
|
21335
|
+
return _PathFactoryUtils.defaultFactory.create("themes", path40);
|
|
21324
21336
|
}
|
|
21325
21337
|
/**
|
|
21326
21338
|
* Create paths from a configuration object
|
|
@@ -21334,7 +21346,7 @@ var init_pathfactory = __esm({
|
|
|
21334
21346
|
factoryConfig.replaceSpaces = config.replaceSpaces;
|
|
21335
21347
|
}
|
|
21336
21348
|
const factory = new PathFactoryImpl(factoryConfig);
|
|
21337
|
-
return config.paths.map((
|
|
21349
|
+
return config.paths.map((path40) => factory.create(config.component, path40));
|
|
21338
21350
|
}
|
|
21339
21351
|
/**
|
|
21340
21352
|
* Get a path builder instance
|
|
@@ -21345,9 +21357,9 @@ var init_pathfactory = __esm({
|
|
|
21345
21357
|
/**
|
|
21346
21358
|
* Create a path with pooling
|
|
21347
21359
|
*/
|
|
21348
|
-
static createWithPool(component,
|
|
21360
|
+
static createWithPool(component, path40, pool2) {
|
|
21349
21361
|
const factory = new PathFactoryImpl(void 0, pool2);
|
|
21350
|
-
return factory.create(component,
|
|
21362
|
+
return factory.create(component, path40);
|
|
21351
21363
|
}
|
|
21352
21364
|
};
|
|
21353
21365
|
}
|
|
@@ -21453,12 +21465,12 @@ var init_translator = __esm({
|
|
|
21453
21465
|
async setupTranslateFuncs(fsService) {
|
|
21454
21466
|
try {
|
|
21455
21467
|
await fsService.walkI18n("", {
|
|
21456
|
-
walkFn: async (
|
|
21457
|
-
if (!
|
|
21468
|
+
walkFn: async (path40, info) => {
|
|
21469
|
+
if (!path40.endsWith(".yaml") && !path40.endsWith(".yml")) {
|
|
21458
21470
|
return;
|
|
21459
21471
|
}
|
|
21460
21472
|
try {
|
|
21461
|
-
const normalizedPath = PATH_CONSTANTS.normalizePath(
|
|
21473
|
+
const normalizedPath = PATH_CONSTANTS.normalizePath(path40);
|
|
21462
21474
|
const filename = normalizedPath.split("/").pop() || "";
|
|
21463
21475
|
const langKey = filename.replace(/\.(yaml|yml)$/, "").toLowerCase();
|
|
21464
21476
|
const content = await this.readI18nFile(info);
|
|
@@ -21478,7 +21490,7 @@ var init_translator = __esm({
|
|
|
21478
21490
|
this.translateFuncs.set(langKey, translateFunc);
|
|
21479
21491
|
log38.info(`\u2705 Loaded i18n translations for language: ${langKey} (${translations.length} items)`);
|
|
21480
21492
|
} catch (error) {
|
|
21481
|
-
log38.error(`\u274C Failed to load i18n file ${
|
|
21493
|
+
log38.error(`\u274C Failed to load i18n file ${path40}:`, error);
|
|
21482
21494
|
}
|
|
21483
21495
|
}
|
|
21484
21496
|
}, {});
|
|
@@ -21684,13 +21696,13 @@ function isContentExt(ext) {
|
|
|
21684
21696
|
function newFileInfo2(fi) {
|
|
21685
21697
|
return FileInfo7.newFileInfo(fi);
|
|
21686
21698
|
}
|
|
21687
|
-
var crypto2,
|
|
21699
|
+
var crypto2, path24, log41, contentFileExtensions, contentFileExtensionsSet, FileInfo7;
|
|
21688
21700
|
var init_fileinfo2 = __esm({
|
|
21689
21701
|
"internal/domain/content/vo/fileinfo.ts"() {
|
|
21690
21702
|
"use strict";
|
|
21691
21703
|
init_paths();
|
|
21692
21704
|
crypto2 = __toESM(require("crypto"));
|
|
21693
|
-
|
|
21705
|
+
path24 = __toESM(require("path"));
|
|
21694
21706
|
init_log();
|
|
21695
21707
|
log41 = getDomainLogger("content", { component: "FileInfo" });
|
|
21696
21708
|
contentFileExtensions = [
|
|
@@ -21728,7 +21740,7 @@ var init_fileinfo2 = __esm({
|
|
|
21728
21740
|
relPath() {
|
|
21729
21741
|
const dir2 = this.pathInfo.dir();
|
|
21730
21742
|
const dirWithoutLeadingSlash = dir2.startsWith("/") ? dir2.substring(1) : dir2;
|
|
21731
|
-
return
|
|
21743
|
+
return path24.join(dirWithoutLeadingSlash, this.pathInfo.name());
|
|
21732
21744
|
}
|
|
21733
21745
|
section() {
|
|
21734
21746
|
return this.pathInfo.section();
|
|
@@ -21825,7 +21837,7 @@ var init_fileinfo2 = __esm({
|
|
|
21825
21837
|
if (s2 === "") {
|
|
21826
21838
|
return s2;
|
|
21827
21839
|
}
|
|
21828
|
-
return
|
|
21840
|
+
return path24.normalize(s2.substring(1) + "/");
|
|
21829
21841
|
}
|
|
21830
21842
|
determineBundleType() {
|
|
21831
21843
|
const isContent = isContentExt(this.pathInfo.ext());
|
|
@@ -22105,7 +22117,7 @@ function getParam(p2, key2, stringToLower) {
|
|
|
22105
22117
|
return v;
|
|
22106
22118
|
}
|
|
22107
22119
|
}
|
|
22108
|
-
var
|
|
22120
|
+
var import_path17, FrontMatterParserImpl;
|
|
22109
22121
|
var init_frontmatter = __esm({
|
|
22110
22122
|
"internal/domain/content/vo/frontmatter.ts"() {
|
|
22111
22123
|
"use strict";
|
|
@@ -22113,7 +22125,7 @@ var init_frontmatter = __esm({
|
|
|
22113
22125
|
init_cast2();
|
|
22114
22126
|
init_string2();
|
|
22115
22127
|
init_types3();
|
|
22116
|
-
|
|
22128
|
+
import_path17 = __toESM(require("path"));
|
|
22117
22129
|
FrontMatterParserImpl = class {
|
|
22118
22130
|
params;
|
|
22119
22131
|
langSvc;
|
|
@@ -22300,7 +22312,7 @@ var init_frontmatter = __esm({
|
|
|
22300
22312
|
organization.website = Cast.toString(orgValue.website);
|
|
22301
22313
|
}
|
|
22302
22314
|
if (orgValue.logo !== void 0 && orgValue.logo !== null) {
|
|
22303
|
-
organization.logo =
|
|
22315
|
+
organization.logo = import_path17.default.join(baseURL, Cast.toString(orgValue.logo));
|
|
22304
22316
|
}
|
|
22305
22317
|
const contact = this.parseContact(orgValue.contact);
|
|
22306
22318
|
if (contact) {
|
|
@@ -22418,7 +22430,7 @@ var init_frontmatter = __esm({
|
|
|
22418
22430
|
author.website = Cast.toString(authorValue.website);
|
|
22419
22431
|
}
|
|
22420
22432
|
if (authorValue.avatar !== void 0 && authorValue.avatar !== null) {
|
|
22421
|
-
author.avatar =
|
|
22433
|
+
author.avatar = import_path17.default.join(baseURL, Cast.toString(authorValue.avatar));
|
|
22422
22434
|
}
|
|
22423
22435
|
const contact = this.parseContact(authorValue.contact);
|
|
22424
22436
|
if (contact) {
|
|
@@ -22474,8 +22486,8 @@ var init_frontmatter = __esm({
|
|
|
22474
22486
|
* Convert path to slash preserving leading slash
|
|
22475
22487
|
* Equivalent to Go's paths.ToSlashPreserveLeading
|
|
22476
22488
|
*/
|
|
22477
|
-
toSlashPreserveLeading(
|
|
22478
|
-
return
|
|
22489
|
+
toSlashPreserveLeading(path40) {
|
|
22490
|
+
return path40.replace(/\\/g, "/");
|
|
22479
22491
|
}
|
|
22480
22492
|
};
|
|
22481
22493
|
}
|
|
@@ -22900,9 +22912,9 @@ var init_radix = __esm({
|
|
|
22900
22912
|
// from the root down to a given leaf. Where WalkPrefix walks
|
|
22901
22913
|
// all the entries *under* the given prefix, this walks the
|
|
22902
22914
|
// entries *above* the given prefix.
|
|
22903
|
-
async walkPath(
|
|
22915
|
+
async walkPath(path40, fn) {
|
|
22904
22916
|
let n = this.root;
|
|
22905
|
-
let search2 =
|
|
22917
|
+
let search2 = path40;
|
|
22906
22918
|
while (true) {
|
|
22907
22919
|
if (n.leaf !== null && await fn(n.leaf.key, n.leaf.val)) {
|
|
22908
22920
|
return;
|
|
@@ -24037,8 +24049,8 @@ var init_pagesource = __esm({
|
|
|
24037
24049
|
* 3. Handle index files (index → parent folder)
|
|
24038
24050
|
* 4. Handle _index files (Hugo-style section index)
|
|
24039
24051
|
*/
|
|
24040
|
-
pathToSlug(
|
|
24041
|
-
let slug2 =
|
|
24052
|
+
pathToSlug(path40) {
|
|
24053
|
+
let slug2 = path40.replace(/^\//, "");
|
|
24042
24054
|
slug2 = slug2.replace(/\.md$/, "");
|
|
24043
24055
|
if (slug2.endsWith("/index")) {
|
|
24044
24056
|
slug2 = slug2.replace(/\/index$/, "");
|
|
@@ -24085,17 +24097,17 @@ var init_pagesource = __esm({
|
|
|
24085
24097
|
});
|
|
24086
24098
|
|
|
24087
24099
|
// internal/domain/content/entity/pagemap.ts
|
|
24088
|
-
function addTrailingSlash(
|
|
24089
|
-
if (!
|
|
24090
|
-
|
|
24100
|
+
function addTrailingSlash(path40) {
|
|
24101
|
+
if (!path40.endsWith("/")) {
|
|
24102
|
+
path40 += "/";
|
|
24091
24103
|
}
|
|
24092
|
-
return
|
|
24104
|
+
return path40;
|
|
24093
24105
|
}
|
|
24094
|
-
function addLeadingSlash(
|
|
24095
|
-
if (!
|
|
24096
|
-
|
|
24106
|
+
function addLeadingSlash(path40) {
|
|
24107
|
+
if (!path40.startsWith("/")) {
|
|
24108
|
+
path40 = "/" + path40;
|
|
24097
24109
|
}
|
|
24098
|
-
return
|
|
24110
|
+
return path40;
|
|
24099
24111
|
}
|
|
24100
24112
|
var log43, ambiguousContentNode, ContentTreeReverseIndexMap, ContentTreeReverseIndex, pagePredicates, PageMapQueryPagesBelowPathImpl, PageMapQueryPagesInSectionImpl, PageMap;
|
|
24101
24113
|
var init_pagemap = __esm({
|
|
@@ -24148,8 +24160,8 @@ var init_pagemap = __esm({
|
|
|
24148
24160
|
path;
|
|
24149
24161
|
keyPart;
|
|
24150
24162
|
include;
|
|
24151
|
-
constructor(
|
|
24152
|
-
this.path =
|
|
24163
|
+
constructor(path40, keyPart, include = pagePredicates.shouldListLocal) {
|
|
24164
|
+
this.path = path40;
|
|
24153
24165
|
this.keyPart = keyPart;
|
|
24154
24166
|
this.include = include;
|
|
24155
24167
|
}
|
|
@@ -24161,8 +24173,8 @@ var init_pagemap = __esm({
|
|
|
24161
24173
|
recursive;
|
|
24162
24174
|
includeSelf;
|
|
24163
24175
|
index;
|
|
24164
|
-
constructor(
|
|
24165
|
-
super(
|
|
24176
|
+
constructor(path40, keyPart, recursive, includeSelf, index2, include) {
|
|
24177
|
+
super(path40, keyPart, include);
|
|
24166
24178
|
this.recursive = recursive;
|
|
24167
24179
|
this.includeSelf = includeSelf;
|
|
24168
24180
|
this.index = index2;
|
|
@@ -24530,12 +24542,12 @@ var init_pagemap = __esm({
|
|
|
24530
24542
|
/**
|
|
24531
24543
|
* Helper method to get directory from path
|
|
24532
24544
|
*/
|
|
24533
|
-
pathDir(
|
|
24534
|
-
const lastSlash =
|
|
24545
|
+
pathDir(path40) {
|
|
24546
|
+
const lastSlash = path40.lastIndexOf("/");
|
|
24535
24547
|
if (lastSlash === -1) {
|
|
24536
24548
|
return "";
|
|
24537
24549
|
}
|
|
24538
|
-
return
|
|
24550
|
+
return path40.substring(0, lastSlash);
|
|
24539
24551
|
}
|
|
24540
24552
|
};
|
|
24541
24553
|
}
|
|
@@ -24554,9 +24566,9 @@ var init_pagecollector = __esm({
|
|
|
24554
24566
|
fs;
|
|
24555
24567
|
processedPaths = /* @__PURE__ */ new Set();
|
|
24556
24568
|
// Track processed paths
|
|
24557
|
-
constructor(pageMap,
|
|
24569
|
+
constructor(pageMap, fs13) {
|
|
24558
24570
|
this.m = pageMap;
|
|
24559
|
-
this.fs =
|
|
24571
|
+
this.fs = fs13;
|
|
24560
24572
|
}
|
|
24561
24573
|
async collect() {
|
|
24562
24574
|
try {
|
|
@@ -24574,11 +24586,11 @@ var init_pagecollector = __esm({
|
|
|
24574
24586
|
/**
|
|
24575
24587
|
* CollectDir - exact replica of Go's collectDir method
|
|
24576
24588
|
*/
|
|
24577
|
-
async collectDir(
|
|
24589
|
+
async collectDir(fs13, path40, root2) {
|
|
24578
24590
|
try {
|
|
24579
|
-
await this.fs.walkContent(
|
|
24580
|
-
hookPre: async (dir2,
|
|
24581
|
-
const fullPath =
|
|
24591
|
+
await this.fs.walkContent(fs13, path40, {
|
|
24592
|
+
hookPre: async (dir2, path41, readdir2) => {
|
|
24593
|
+
const fullPath = path41;
|
|
24582
24594
|
if (this.processedPaths.has(fullPath)) {
|
|
24583
24595
|
log44.warn("Path already processed!", {
|
|
24584
24596
|
path: fullPath,
|
|
@@ -24609,7 +24621,7 @@ var init_pagecollector = __esm({
|
|
|
24609
24621
|
});
|
|
24610
24622
|
} catch (error) {
|
|
24611
24623
|
log44.error(`Failed to collect directory: ${error}`, {
|
|
24612
|
-
path:
|
|
24624
|
+
path: path40,
|
|
24613
24625
|
rootName: root2.name(),
|
|
24614
24626
|
rootIsDir: root2.isDir(),
|
|
24615
24627
|
stack: error.stack || "No stack trace available"
|
|
@@ -24619,7 +24631,7 @@ var init_pagecollector = __esm({
|
|
|
24619
24631
|
}
|
|
24620
24632
|
async handleBundleLeaf(dir2, bundle, inPath, readdir2) {
|
|
24621
24633
|
const bundlePath = bundle.paths();
|
|
24622
|
-
const walk = async (
|
|
24634
|
+
const walk = async (path40, info) => {
|
|
24623
24635
|
if (info.isDir()) {
|
|
24624
24636
|
return;
|
|
24625
24637
|
}
|
|
@@ -24673,8 +24685,8 @@ var init_content2 = __esm({
|
|
|
24673
24685
|
pageMap;
|
|
24674
24686
|
translator;
|
|
24675
24687
|
pageCollected = false;
|
|
24676
|
-
constructor(
|
|
24677
|
-
this.fs =
|
|
24688
|
+
constructor(fs13, converter, pageMap, translator) {
|
|
24689
|
+
this.fs = fs13;
|
|
24678
24690
|
this.converter = converter;
|
|
24679
24691
|
this.pageMap = pageMap;
|
|
24680
24692
|
this.translator = translator;
|
|
@@ -24871,10 +24883,10 @@ var init_content2 = __esm({
|
|
|
24871
24883
|
* GetPageFromPath - TypeScript equivalent of Go's PageFinder.GetPageFromPath
|
|
24872
24884
|
* This is the core content domain business logic for finding pages by path
|
|
24873
24885
|
*/
|
|
24874
|
-
getPageFromPath(langIndex,
|
|
24886
|
+
getPageFromPath(langIndex, path40) {
|
|
24875
24887
|
try {
|
|
24876
24888
|
const pathProcessor = PathDomain.createProcessor();
|
|
24877
|
-
const ps = pathProcessor.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT,
|
|
24889
|
+
const ps = pathProcessor.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT, path40);
|
|
24878
24890
|
const tree = this.pageMap.treePages.shape(0, langIndex);
|
|
24879
24891
|
let node = tree.get(ps.base());
|
|
24880
24892
|
if (node) {
|
|
@@ -24885,7 +24897,7 @@ var init_content2 = __esm({
|
|
|
24885
24897
|
}
|
|
24886
24898
|
return null;
|
|
24887
24899
|
} catch (error) {
|
|
24888
|
-
log45.error(`\u274C Content.getPageFromPath error for path "${
|
|
24900
|
+
log45.error(`\u274C Content.getPageFromPath error for path "${path40}":`, error);
|
|
24889
24901
|
return null;
|
|
24890
24902
|
}
|
|
24891
24903
|
}
|
|
@@ -25692,15 +25704,15 @@ var init_scratch = __esm({
|
|
|
25692
25704
|
function sanitize(input) {
|
|
25693
25705
|
return input.replace(/[\s\t\n\r]+/g, "-").replace(/[^\w\-_]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
25694
25706
|
}
|
|
25695
|
-
function addContextRoot(root2,
|
|
25696
|
-
if (!root2 ||
|
|
25697
|
-
return
|
|
25707
|
+
function addContextRoot(root2, path40) {
|
|
25708
|
+
if (!root2 || path40.startsWith(root2)) {
|
|
25709
|
+
return path40;
|
|
25698
25710
|
}
|
|
25699
|
-
return joinPaths(root2,
|
|
25711
|
+
return joinPaths(root2, path40);
|
|
25700
25712
|
}
|
|
25701
|
-
function makePermalink(baseURL,
|
|
25713
|
+
function makePermalink(baseURL, path40) {
|
|
25702
25714
|
const base2 = baseURL.replace(/\/$/, "");
|
|
25703
|
-
const cleanPath =
|
|
25715
|
+
const cleanPath = path40.replace(/^\//, "");
|
|
25704
25716
|
const fullURL = `${base2}/${cleanPath}`;
|
|
25705
25717
|
try {
|
|
25706
25718
|
return new URL(fullURL);
|
|
@@ -25729,7 +25741,7 @@ var init_paths2 = __esm({
|
|
|
25729
25741
|
});
|
|
25730
25742
|
|
|
25731
25743
|
// internal/domain/content/entity/page.ts
|
|
25732
|
-
var
|
|
25744
|
+
var import_path18, log48, PageImpl, TaxonomyPageImpl, TermPageImpl;
|
|
25733
25745
|
var init_page = __esm({
|
|
25734
25746
|
"internal/domain/content/entity/page.ts"() {
|
|
25735
25747
|
"use strict";
|
|
@@ -25741,7 +25753,7 @@ var init_page = __esm({
|
|
|
25741
25753
|
init_paths2();
|
|
25742
25754
|
init_doctree();
|
|
25743
25755
|
init_sort();
|
|
25744
|
-
|
|
25756
|
+
import_path18 = __toESM(require("path"));
|
|
25745
25757
|
init_log();
|
|
25746
25758
|
log48 = getDomainLogger("content", { component: "page" });
|
|
25747
25759
|
PageImpl = class {
|
|
@@ -25819,8 +25831,8 @@ var init_page = __esm({
|
|
|
25819
25831
|
* 3. Handle index files (index → parent folder)
|
|
25820
25832
|
* 4. Handle _index files (Hugo-style section index)
|
|
25821
25833
|
*/
|
|
25822
|
-
pathToSlug(
|
|
25823
|
-
let slug2 =
|
|
25834
|
+
pathToSlug(path40) {
|
|
25835
|
+
let slug2 = path40.replace(/^\//, "");
|
|
25824
25836
|
slug2 = slug2.replace(/\.md$/, "");
|
|
25825
25837
|
if (slug2.endsWith("/index")) {
|
|
25826
25838
|
slug2 = slug2.replace(/\/index$/, "");
|
|
@@ -25847,7 +25859,7 @@ var init_page = __esm({
|
|
|
25847
25859
|
if (/^(https?:)?\/\//.test(src)) {
|
|
25848
25860
|
return src;
|
|
25849
25861
|
}
|
|
25850
|
-
src =
|
|
25862
|
+
src = import_path18.default.normalize(src);
|
|
25851
25863
|
src = src.replace(/\\/g, "/");
|
|
25852
25864
|
if (src.startsWith("/")) {
|
|
25853
25865
|
src = src.slice(1);
|
|
@@ -26567,12 +26579,12 @@ var init_type11 = __esm({
|
|
|
26567
26579
|
function newBaseOf() {
|
|
26568
26580
|
return new BaseOf();
|
|
26569
26581
|
}
|
|
26570
|
-
var
|
|
26582
|
+
var path27, BaseOf;
|
|
26571
26583
|
var init_baseof = __esm({
|
|
26572
26584
|
"internal/domain/template/vo/baseof.ts"() {
|
|
26573
26585
|
"use strict";
|
|
26574
26586
|
init_type11();
|
|
26575
|
-
|
|
26587
|
+
path27 = __toESM(require("path"));
|
|
26576
26588
|
BaseOf = class {
|
|
26577
26589
|
baseof = /* @__PURE__ */ new Map();
|
|
26578
26590
|
needsBaseof = /* @__PURE__ */ new Map();
|
|
@@ -26612,7 +26624,7 @@ var init_baseof = __esm({
|
|
|
26612
26624
|
* Check if path is a base template path
|
|
26613
26625
|
*/
|
|
26614
26626
|
isBaseTemplatePath(filePath) {
|
|
26615
|
-
return
|
|
26627
|
+
return path27.basename(filePath).includes(BASE_FILE_BASE);
|
|
26616
26628
|
}
|
|
26617
26629
|
/**
|
|
26618
26630
|
* Check if template needs base template
|
|
@@ -27797,8 +27809,8 @@ var init_lookup = __esm({
|
|
|
27797
27809
|
});
|
|
27798
27810
|
|
|
27799
27811
|
// internal/domain/template/entity/template.ts
|
|
27800
|
-
function newTemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace,
|
|
27801
|
-
return new TemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace,
|
|
27812
|
+
function newTemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs13) {
|
|
27813
|
+
return new TemplateEngine(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs13);
|
|
27802
27814
|
}
|
|
27803
27815
|
var log52, TemplateEngine;
|
|
27804
27816
|
var init_template = __esm({
|
|
@@ -27819,14 +27831,14 @@ var init_template = __esm({
|
|
|
27819
27831
|
partialNamespace;
|
|
27820
27832
|
shortcodeNamespace;
|
|
27821
27833
|
fs;
|
|
27822
|
-
constructor(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace,
|
|
27834
|
+
constructor(executor, lookup, parser, templateNamespace, partialNamespace, shortcodeNamespace, fs13) {
|
|
27823
27835
|
this.executor = executor;
|
|
27824
27836
|
this.lookup = lookup;
|
|
27825
27837
|
this.parser = parser;
|
|
27826
27838
|
this.templateNamespace = templateNamespace;
|
|
27827
27839
|
this.partialNamespace = partialNamespace;
|
|
27828
27840
|
this.shortcodeNamespace = shortcodeNamespace;
|
|
27829
|
-
this.fs =
|
|
27841
|
+
this.fs = fs13;
|
|
27830
27842
|
}
|
|
27831
27843
|
/**
|
|
27832
27844
|
* Mark template engine as ready
|
|
@@ -28367,8 +28379,8 @@ var init_registry = __esm({
|
|
|
28367
28379
|
}
|
|
28368
28380
|
},
|
|
28369
28381
|
// PathEscape escapes special characters in a URL path
|
|
28370
|
-
PathEscape: (
|
|
28371
|
-
return encodeURIComponent(
|
|
28382
|
+
PathEscape: (path40) => {
|
|
28383
|
+
return encodeURIComponent(path40).replace(/%2F/g, "/").replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
28372
28384
|
},
|
|
28373
28385
|
// QueryEscape escapes special characters in a URL query
|
|
28374
28386
|
QueryEscape: (query) => {
|
|
@@ -29524,11 +29536,11 @@ var init_registry = __esm({
|
|
|
29524
29536
|
}
|
|
29525
29537
|
}
|
|
29526
29538
|
}
|
|
29527
|
-
const getNestedValue = (obj,
|
|
29528
|
-
if (!
|
|
29539
|
+
const getNestedValue = (obj, path40) => {
|
|
29540
|
+
if (!path40 || path40 === "value") {
|
|
29529
29541
|
return obj;
|
|
29530
29542
|
}
|
|
29531
|
-
const keys =
|
|
29543
|
+
const keys = path40.split(".");
|
|
29532
29544
|
let current = obj;
|
|
29533
29545
|
for (const key2 of keys) {
|
|
29534
29546
|
if (current === null || current === void 0) {
|
|
@@ -30093,23 +30105,23 @@ var init_registry = __esm({
|
|
|
30093
30105
|
registerPathFunctions(funcMap) {
|
|
30094
30106
|
funcMap.set("path", () => ({
|
|
30095
30107
|
// Base returns the last element of path
|
|
30096
|
-
Base: (
|
|
30097
|
-
if (!
|
|
30108
|
+
Base: (path40) => {
|
|
30109
|
+
if (!path40)
|
|
30098
30110
|
return ".";
|
|
30099
|
-
|
|
30100
|
-
|
|
30101
|
-
if (!
|
|
30111
|
+
path40 = path40.replace(/\\/g, "/");
|
|
30112
|
+
path40 = path40.replace(/\/+$/, "");
|
|
30113
|
+
if (!path40)
|
|
30102
30114
|
return "/";
|
|
30103
|
-
const parts =
|
|
30115
|
+
const parts = path40.split("/");
|
|
30104
30116
|
return parts[parts.length - 1] || "/";
|
|
30105
30117
|
},
|
|
30106
30118
|
// Clean returns the shortest path name equivalent to path
|
|
30107
|
-
Clean: (
|
|
30108
|
-
if (!
|
|
30119
|
+
Clean: (path40) => {
|
|
30120
|
+
if (!path40)
|
|
30109
30121
|
return ".";
|
|
30110
|
-
|
|
30111
|
-
const isAbs =
|
|
30112
|
-
const parts =
|
|
30122
|
+
path40 = path40.replace(/\\/g, "/");
|
|
30123
|
+
const isAbs = path40.startsWith("/");
|
|
30124
|
+
const parts = path40.split("/").filter((p2) => p2 && p2 !== ".");
|
|
30113
30125
|
const stack = [];
|
|
30114
30126
|
for (const part of parts) {
|
|
30115
30127
|
if (part === "..") {
|
|
@@ -30122,56 +30134,56 @@ var init_registry = __esm({
|
|
|
30122
30134
|
stack.push(part);
|
|
30123
30135
|
}
|
|
30124
30136
|
}
|
|
30125
|
-
|
|
30137
|
+
path40 = stack.join("/");
|
|
30126
30138
|
if (isAbs)
|
|
30127
|
-
|
|
30128
|
-
return
|
|
30139
|
+
path40 = "/" + path40;
|
|
30140
|
+
return path40 || (isAbs ? "/" : ".");
|
|
30129
30141
|
},
|
|
30130
30142
|
// Dir returns all but the last element of path
|
|
30131
|
-
Dir: (
|
|
30132
|
-
if (!
|
|
30143
|
+
Dir: (path40) => {
|
|
30144
|
+
if (!path40)
|
|
30133
30145
|
return ".";
|
|
30134
|
-
|
|
30135
|
-
if (!
|
|
30146
|
+
path40 = path40.replace(/\/+$/, "");
|
|
30147
|
+
if (!path40)
|
|
30136
30148
|
return "/";
|
|
30137
|
-
const parts =
|
|
30149
|
+
const parts = path40.split("/");
|
|
30138
30150
|
parts.pop();
|
|
30139
30151
|
return parts.join("/") || ".";
|
|
30140
30152
|
},
|
|
30141
30153
|
// Ext returns the file name extension
|
|
30142
|
-
Ext: (
|
|
30143
|
-
const base2 =
|
|
30154
|
+
Ext: (path40) => {
|
|
30155
|
+
const base2 = path40.split("/").pop() || "";
|
|
30144
30156
|
const dot = base2.lastIndexOf(".");
|
|
30145
30157
|
if (dot === -1 || dot === 0)
|
|
30146
30158
|
return "";
|
|
30147
30159
|
return base2.substring(dot);
|
|
30148
30160
|
},
|
|
30149
30161
|
// IsAbs reports whether the path is absolute
|
|
30150
|
-
IsAbs: (
|
|
30151
|
-
return
|
|
30162
|
+
IsAbs: (path40) => {
|
|
30163
|
+
return path40.startsWith("/");
|
|
30152
30164
|
},
|
|
30153
30165
|
// Join joins any number of path elements into a single path
|
|
30154
30166
|
Join: (...elements) => {
|
|
30155
30167
|
if (elements.length === 0)
|
|
30156
30168
|
return ".";
|
|
30157
30169
|
const parts = elements.filter((e) => e).map((e) => e.replace(/^\/+|\/+$/g, ""));
|
|
30158
|
-
let
|
|
30170
|
+
let path40 = parts.join("/");
|
|
30159
30171
|
if (elements[0] && elements[0].startsWith("/")) {
|
|
30160
|
-
|
|
30172
|
+
path40 = "/" + path40;
|
|
30161
30173
|
}
|
|
30162
|
-
return
|
|
30174
|
+
return path40 || ".";
|
|
30163
30175
|
},
|
|
30164
30176
|
// Split splits path immediately following the final slash
|
|
30165
|
-
Split: (
|
|
30166
|
-
if (!
|
|
30177
|
+
Split: (path40) => {
|
|
30178
|
+
if (!path40)
|
|
30167
30179
|
return [".", ""];
|
|
30168
|
-
const lastSlash =
|
|
30180
|
+
const lastSlash = path40.lastIndexOf("/");
|
|
30169
30181
|
if (lastSlash === -1) {
|
|
30170
|
-
return ["",
|
|
30182
|
+
return ["", path40];
|
|
30171
30183
|
}
|
|
30172
30184
|
return [
|
|
30173
|
-
|
|
30174
|
-
|
|
30185
|
+
path40.substring(0, lastSlash),
|
|
30186
|
+
path40.substring(lastSlash + 1)
|
|
30175
30187
|
];
|
|
30176
30188
|
}
|
|
30177
30189
|
}));
|
|
@@ -30457,11 +30469,11 @@ var init_registry = __esm({
|
|
|
30457
30469
|
* Get nested value from object using dot notation path
|
|
30458
30470
|
* Following golang's path resolution logic
|
|
30459
30471
|
*/
|
|
30460
|
-
getNestedValue(obj,
|
|
30461
|
-
if (!obj || !
|
|
30472
|
+
getNestedValue(obj, path40) {
|
|
30473
|
+
if (!obj || !path40) {
|
|
30462
30474
|
return void 0;
|
|
30463
30475
|
}
|
|
30464
|
-
const cleanPath =
|
|
30476
|
+
const cleanPath = path40.replace(/^\\.+/, "");
|
|
30465
30477
|
const parts = cleanPath.split(".");
|
|
30466
30478
|
let current = obj;
|
|
30467
30479
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -30506,9 +30518,9 @@ var init_registry = __esm({
|
|
|
30506
30518
|
function newTemplateFactory() {
|
|
30507
30519
|
return new Factory2();
|
|
30508
30520
|
}
|
|
30509
|
-
async function createTemplateEngineWithServices(
|
|
30521
|
+
async function createTemplateEngineWithServices(fs13, services) {
|
|
30510
30522
|
const factory = newTemplateFactory();
|
|
30511
|
-
return factory.createWithServices(
|
|
30523
|
+
return factory.createWithServices(fs13, services);
|
|
30512
30524
|
}
|
|
30513
30525
|
var Factory2, Builder;
|
|
30514
30526
|
var init_template2 = __esm({
|
|
@@ -30526,15 +30538,15 @@ var init_template2 = __esm({
|
|
|
30526
30538
|
/**
|
|
30527
30539
|
* Create template engine with file system (core functions only)
|
|
30528
30540
|
*/
|
|
30529
|
-
async create(
|
|
30530
|
-
return this.createWithConfig(
|
|
30541
|
+
async create(fs13) {
|
|
30542
|
+
return this.createWithConfig(fs13, {});
|
|
30531
30543
|
}
|
|
30532
30544
|
/**
|
|
30533
30545
|
* Create template engine with configuration
|
|
30534
30546
|
*/
|
|
30535
|
-
async createWithConfig(
|
|
30547
|
+
async createWithConfig(fs13, config) {
|
|
30536
30548
|
try {
|
|
30537
|
-
const builder = new Builder().withFs(
|
|
30549
|
+
const builder = new Builder().withFs(fs13).withNamespaces(
|
|
30538
30550
|
newRegularTemplateNamespace(),
|
|
30539
30551
|
newPartialTemplateNamespace(),
|
|
30540
30552
|
newShortcodeTemplateNamespace()
|
|
@@ -30558,8 +30570,8 @@ var init_template2 = __esm({
|
|
|
30558
30570
|
* Create template engine with services
|
|
30559
30571
|
* TypeScript equivalent of Go's New(fs, cfs) function
|
|
30560
30572
|
*/
|
|
30561
|
-
async createWithServices(
|
|
30562
|
-
return this.createWithConfig(
|
|
30573
|
+
async createWithServices(fs13, services) {
|
|
30574
|
+
return this.createWithConfig(fs13, { services });
|
|
30563
30575
|
}
|
|
30564
30576
|
};
|
|
30565
30577
|
Builder = class {
|
|
@@ -30576,8 +30588,8 @@ var init_template2 = __esm({
|
|
|
30576
30588
|
/**
|
|
30577
30589
|
* Set file system
|
|
30578
30590
|
*/
|
|
30579
|
-
withFs(
|
|
30580
|
-
this.fs =
|
|
30591
|
+
withFs(fs13) {
|
|
30592
|
+
this.fs = fs13;
|
|
30581
30593
|
return this;
|
|
30582
30594
|
}
|
|
30583
30595
|
/**
|
|
@@ -30996,14 +31008,14 @@ var init_pagebuilder = __esm({
|
|
|
30996
31008
|
* Parse kind - exact replica of Go's parseKind method
|
|
30997
31009
|
*/
|
|
30998
31010
|
async parseKind() {
|
|
30999
|
-
const
|
|
31011
|
+
const path40 = this.source.file.paths();
|
|
31000
31012
|
let kind = "";
|
|
31001
31013
|
if (this.fm) {
|
|
31002
31014
|
kind = this.fm.kind || "";
|
|
31003
31015
|
}
|
|
31004
31016
|
if (kind === "") {
|
|
31005
31017
|
kind = getKindMain("page");
|
|
31006
|
-
const base2 =
|
|
31018
|
+
const base2 = path40.baseNoLeadingSlash();
|
|
31007
31019
|
switch (base2) {
|
|
31008
31020
|
case PAGE_HOME_BASE:
|
|
31009
31021
|
case "":
|
|
@@ -31018,9 +31030,9 @@ var init_pagebuilder = __esm({
|
|
|
31018
31030
|
default:
|
|
31019
31031
|
if (this.source.file.isBranchBundle()) {
|
|
31020
31032
|
kind = getKindMain("section");
|
|
31021
|
-
const v = this.taxonomy.getTaxonomy(
|
|
31033
|
+
const v = this.taxonomy.getTaxonomy(path40.path());
|
|
31022
31034
|
if (!this.taxonomy.isZero(v)) {
|
|
31023
|
-
if (this.taxonomy.isTaxonomyPath(
|
|
31035
|
+
if (this.taxonomy.isTaxonomyPath(path40.path())) {
|
|
31024
31036
|
kind = getKindMain("taxonomy");
|
|
31025
31037
|
} else {
|
|
31026
31038
|
kind = getKindMain("term");
|
|
@@ -31307,7 +31319,7 @@ function cleanTreeKey2(...elem) {
|
|
|
31307
31319
|
if (elem.length > 0) {
|
|
31308
31320
|
s2 = elem[0];
|
|
31309
31321
|
if (elem.length > 1) {
|
|
31310
|
-
s2 =
|
|
31322
|
+
s2 = path28.join(...elem);
|
|
31311
31323
|
}
|
|
31312
31324
|
}
|
|
31313
31325
|
s2 = s2.replace(/^[\.\/ \s]+|[\.\/ \s]+$/g, "");
|
|
@@ -31320,14 +31332,14 @@ function cleanTreeKey2(...elem) {
|
|
|
31320
31332
|
}
|
|
31321
31333
|
return s2;
|
|
31322
31334
|
}
|
|
31323
|
-
var
|
|
31335
|
+
var path28, filepath, Taxonomy2;
|
|
31324
31336
|
var init_taxonomy3 = __esm({
|
|
31325
31337
|
"internal/domain/content/entity/taxonomy.ts"() {
|
|
31326
31338
|
"use strict";
|
|
31327
31339
|
init_pagetrees();
|
|
31328
31340
|
init_fileinfo2();
|
|
31329
31341
|
init_pagesource();
|
|
31330
|
-
|
|
31342
|
+
path28 = __toESM(require("path"));
|
|
31331
31343
|
filepath = __toESM(require("path"));
|
|
31332
31344
|
Taxonomy2 = class {
|
|
31333
31345
|
views;
|
|
@@ -31358,7 +31370,7 @@ var init_taxonomy3 = __esm({
|
|
|
31358
31370
|
if (!ta) {
|
|
31359
31371
|
return false;
|
|
31360
31372
|
}
|
|
31361
|
-
return p2 ===
|
|
31373
|
+
return p2 === path28.join(this.pluralTreeKey(ta.plural()), "_index.md");
|
|
31362
31374
|
}
|
|
31363
31375
|
/**
|
|
31364
31376
|
* PluralTreeKey - exact replica of Go's PluralTreeKey method
|
|
@@ -31663,11 +31675,11 @@ var init_pager = __esm({
|
|
|
31663
31675
|
});
|
|
31664
31676
|
|
|
31665
31677
|
// internal/domain/site/entity/page.ts
|
|
31666
|
-
var
|
|
31678
|
+
var import_path19, log57, Page2;
|
|
31667
31679
|
var init_page2 = __esm({
|
|
31668
31680
|
"internal/domain/site/entity/page.ts"() {
|
|
31669
31681
|
"use strict";
|
|
31670
|
-
|
|
31682
|
+
import_path19 = __toESM(require("path"));
|
|
31671
31683
|
init_log();
|
|
31672
31684
|
init_pager();
|
|
31673
31685
|
log57 = getDomainLogger("site", { component: "page" });
|
|
@@ -31787,14 +31799,14 @@ var init_page2 = __esm({
|
|
|
31787
31799
|
} else {
|
|
31788
31800
|
prefix = this.site.getLanguage().getCurrentLanguage();
|
|
31789
31801
|
}
|
|
31790
|
-
targetFilenames.push(
|
|
31802
|
+
targetFilenames.push(import_path19.default.join(prefix, this.getPageOutput().targetFilePath()));
|
|
31791
31803
|
await this.renderAndWritePage(tmpl, targetFilenames);
|
|
31792
31804
|
const current = await this.current();
|
|
31793
31805
|
if (current) {
|
|
31794
31806
|
let currentPager = current.next();
|
|
31795
31807
|
while (currentPager) {
|
|
31796
31808
|
this.setCurrent(currentPager);
|
|
31797
|
-
const paginationTargets = [
|
|
31809
|
+
const paginationTargets = [import_path19.default.join(prefix, currentPager.url(), this.getPageOutput().targetFileBase())];
|
|
31798
31810
|
await this.renderAndWritePage(tmpl, paginationTargets);
|
|
31799
31811
|
currentPager = currentPager.next();
|
|
31800
31812
|
}
|
|
@@ -31827,7 +31839,7 @@ var init_page2 = __esm({
|
|
|
31827
31839
|
prefix = this.site.getLanguage().getCurrentLanguage();
|
|
31828
31840
|
}
|
|
31829
31841
|
let resourcePath = pageSource.path();
|
|
31830
|
-
targetFilenames.push(
|
|
31842
|
+
targetFilenames.push(import_path19.default.join(prefix, resourcePath));
|
|
31831
31843
|
let stream = null;
|
|
31832
31844
|
try {
|
|
31833
31845
|
const opener = () => pageSource.pageFile().open();
|
|
@@ -32482,11 +32494,11 @@ var init_baseurl = __esm({
|
|
|
32482
32494
|
/**
|
|
32483
32495
|
* Returns the appropriate root URL based on the path.
|
|
32484
32496
|
*/
|
|
32485
|
-
getRoot(
|
|
32497
|
+
getRoot(path40) {
|
|
32486
32498
|
if (this.isRelative) {
|
|
32487
32499
|
return this.basePath;
|
|
32488
32500
|
}
|
|
32489
|
-
if (
|
|
32501
|
+
if (path40.startsWith("/")) {
|
|
32490
32502
|
return this.withoutPath;
|
|
32491
32503
|
}
|
|
32492
32504
|
return this.withPath;
|
|
@@ -33880,8 +33892,8 @@ function assertNonEmpty(part, name) {
|
|
|
33880
33892
|
throw new Error("`" + name + "` cannot be empty");
|
|
33881
33893
|
}
|
|
33882
33894
|
}
|
|
33883
|
-
function assertPath(
|
|
33884
|
-
if (!
|
|
33895
|
+
function assertPath(path40, name) {
|
|
33896
|
+
if (!path40) {
|
|
33885
33897
|
throw new Error("Setting `" + name + "` requires `path` to be set too");
|
|
33886
33898
|
}
|
|
33887
33899
|
}
|
|
@@ -34066,13 +34078,13 @@ var init_lib4 = __esm({
|
|
|
34066
34078
|
* @returns {undefined}
|
|
34067
34079
|
* Nothing.
|
|
34068
34080
|
*/
|
|
34069
|
-
set path(
|
|
34070
|
-
if (isUrl(
|
|
34071
|
-
|
|
34081
|
+
set path(path40) {
|
|
34082
|
+
if (isUrl(path40)) {
|
|
34083
|
+
path40 = (0, import_node_url.fileURLToPath)(path40);
|
|
34072
34084
|
}
|
|
34073
|
-
assertNonEmpty(
|
|
34074
|
-
if (this.path !==
|
|
34075
|
-
this.history.push(
|
|
34085
|
+
assertNonEmpty(path40, "path");
|
|
34086
|
+
if (this.path !== path40) {
|
|
34087
|
+
this.history.push(path40);
|
|
34076
34088
|
}
|
|
34077
34089
|
}
|
|
34078
34090
|
/**
|
|
@@ -46833,7 +46845,7 @@ var init_is_absolute_url = __esm({
|
|
|
46833
46845
|
function createHtmlLinkProcessor(graph, options) {
|
|
46834
46846
|
return new HtmlLinkProcessor(graph, options);
|
|
46835
46847
|
}
|
|
46836
|
-
var
|
|
46848
|
+
var import_path21, log61, defaultOptions, HtmlLinkProcessor;
|
|
46837
46849
|
var init_html_link_processor = __esm({
|
|
46838
46850
|
"internal/domain/site/service/html-link-processor.ts"() {
|
|
46839
46851
|
"use strict";
|
|
@@ -46842,7 +46854,7 @@ var init_html_link_processor = __esm({
|
|
|
46842
46854
|
init_rehype_stringify();
|
|
46843
46855
|
init_unist_util_visit();
|
|
46844
46856
|
init_is_absolute_url();
|
|
46845
|
-
|
|
46857
|
+
import_path21 = __toESM(require("path"));
|
|
46846
46858
|
init_path3();
|
|
46847
46859
|
init_log();
|
|
46848
46860
|
log61 = getDomainLogger("site", { component: "HtmlLinkProcessor" });
|
|
@@ -46980,7 +46992,7 @@ var init_html_link_processor = __esm({
|
|
|
46980
46992
|
node.properties["data-slug"] = full;
|
|
46981
46993
|
}
|
|
46982
46994
|
if (opts.prettyLinks && isInternal && node.children.length === 1 && node.children[0].type === "text" && !node.children[0].value.startsWith("#")) {
|
|
46983
|
-
node.children[0].value =
|
|
46995
|
+
node.children[0].value = import_path21.default.basename(node.children[0].value);
|
|
46984
46996
|
}
|
|
46985
46997
|
}
|
|
46986
46998
|
if (["img", "video", "audio", "iframe"].includes(node.tagName) && node.properties && typeof node.properties.src === "string") {
|
|
@@ -47873,33 +47885,33 @@ var init_site = __esm({
|
|
|
47873
47885
|
});
|
|
47874
47886
|
|
|
47875
47887
|
// internal/domain/site/entity/publisher.ts
|
|
47876
|
-
async function openFileForWriting(
|
|
47877
|
-
const cleanFilename =
|
|
47888
|
+
async function openFileForWriting(fs13, filename) {
|
|
47889
|
+
const cleanFilename = import_path23.default.normalize(filename);
|
|
47878
47890
|
try {
|
|
47879
|
-
return await
|
|
47891
|
+
return await fs13.create(cleanFilename);
|
|
47880
47892
|
} catch (error) {
|
|
47881
47893
|
if (!isFileNotFoundError(error)) {
|
|
47882
47894
|
throw error;
|
|
47883
47895
|
}
|
|
47884
|
-
const dir2 =
|
|
47885
|
-
await
|
|
47886
|
-
return await
|
|
47896
|
+
const dir2 = import_path23.default.dirname(cleanFilename);
|
|
47897
|
+
await fs13.mkdirAll(dir2, 511);
|
|
47898
|
+
return await fs13.create(cleanFilename);
|
|
47887
47899
|
}
|
|
47888
47900
|
}
|
|
47889
47901
|
function isFileNotFoundError(error) {
|
|
47890
47902
|
return error && (error.code === "ENOENT" || error.code === "FILE_NOT_FOUND" || error.message?.includes("not found") || error.message?.includes("no such file"));
|
|
47891
47903
|
}
|
|
47892
|
-
var
|
|
47904
|
+
var import_path23, log64, Publisher, MultiWriter;
|
|
47893
47905
|
var init_publisher2 = __esm({
|
|
47894
47906
|
"internal/domain/site/entity/publisher.ts"() {
|
|
47895
47907
|
"use strict";
|
|
47896
|
-
|
|
47908
|
+
import_path23 = __toESM(require("path"));
|
|
47897
47909
|
init_log();
|
|
47898
47910
|
log64 = getDomainLogger("site", { component: "publisher" });
|
|
47899
47911
|
Publisher = class {
|
|
47900
47912
|
fs;
|
|
47901
|
-
constructor(
|
|
47902
|
-
this.fs =
|
|
47913
|
+
constructor(fs13) {
|
|
47914
|
+
this.fs = fs13;
|
|
47903
47915
|
}
|
|
47904
47916
|
/**
|
|
47905
47917
|
* PublishSource publishes content from a source buffer to files
|
|
@@ -48754,8 +48766,8 @@ var init_menu_builder = __esm({
|
|
|
48754
48766
|
/**
|
|
48755
48767
|
* Fallback URL generation from path (used when site page conversion fails)
|
|
48756
48768
|
*/
|
|
48757
|
-
fallbackUrlFromPath(
|
|
48758
|
-
let url =
|
|
48769
|
+
fallbackUrlFromPath(path40) {
|
|
48770
|
+
let url = path40.replace(/\.md$/, "");
|
|
48759
48771
|
if (!url.startsWith("/")) {
|
|
48760
48772
|
url = "/" + url;
|
|
48761
48773
|
}
|
|
@@ -49678,11 +49690,11 @@ var init_template4 = __esm({
|
|
|
49678
49690
|
});
|
|
49679
49691
|
|
|
49680
49692
|
// internal/domain/resources/entity/publisher.ts
|
|
49681
|
-
var
|
|
49693
|
+
var path32, import_stream2, log73, Publisher2, FileWritable;
|
|
49682
49694
|
var init_publisher3 = __esm({
|
|
49683
49695
|
"internal/domain/resources/entity/publisher.ts"() {
|
|
49684
49696
|
"use strict";
|
|
49685
|
-
|
|
49697
|
+
path32 = __toESM(require("path"));
|
|
49686
49698
|
init_log();
|
|
49687
49699
|
import_stream2 = require("stream");
|
|
49688
49700
|
log73 = getDomainLogger("resources", { component: "publisher" });
|
|
@@ -49717,7 +49729,7 @@ var init_publisher3 = __esm({
|
|
|
49717
49729
|
return new FileWritable(file);
|
|
49718
49730
|
} catch (error) {
|
|
49719
49731
|
if (error.code === "ENOENT" || error.message.includes("ENOENT")) {
|
|
49720
|
-
const dir2 =
|
|
49732
|
+
const dir2 = path32.dirname(cleanFilename);
|
|
49721
49733
|
await this.pubFs.mkdirAll(dir2, 511);
|
|
49722
49734
|
const file = await this.pubFs.create(cleanFilename);
|
|
49723
49735
|
const originalClose = file.close.bind(file);
|
|
@@ -49751,14 +49763,14 @@ var init_publisher3 = __esm({
|
|
|
49751
49763
|
* TypeScript equivalent of OpenFileForWriting function from Go
|
|
49752
49764
|
*/
|
|
49753
49765
|
async openFileForWriting(filename) {
|
|
49754
|
-
const cleanFilename =
|
|
49766
|
+
const cleanFilename = path32.normalize(filename);
|
|
49755
49767
|
try {
|
|
49756
49768
|
return await this.pubFs.create(cleanFilename);
|
|
49757
49769
|
} catch (error) {
|
|
49758
49770
|
if (!this.isFileNotFoundError(error)) {
|
|
49759
49771
|
throw error;
|
|
49760
49772
|
}
|
|
49761
|
-
const dir2 =
|
|
49773
|
+
const dir2 = path32.dirname(cleanFilename);
|
|
49762
49774
|
await this.pubFs.mkdirAll(dir2, 511);
|
|
49763
49775
|
return await this.pubFs.create(cleanFilename);
|
|
49764
49776
|
}
|
|
@@ -49886,7 +49898,7 @@ var init_http2 = __esm({
|
|
|
49886
49898
|
});
|
|
49887
49899
|
|
|
49888
49900
|
// internal/domain/resources/entity/resources.ts
|
|
49889
|
-
var
|
|
49901
|
+
var path33, import_crypto4, log75, Resources;
|
|
49890
49902
|
var init_resources = __esm({
|
|
49891
49903
|
"internal/domain/resources/entity/resources.ts"() {
|
|
49892
49904
|
"use strict";
|
|
@@ -49898,7 +49910,7 @@ var init_resources = __esm({
|
|
|
49898
49910
|
init_publisher3();
|
|
49899
49911
|
init_http2();
|
|
49900
49912
|
init_type9();
|
|
49901
|
-
|
|
49913
|
+
path33 = __toESM(require("path"));
|
|
49902
49914
|
import_crypto4 = require("crypto");
|
|
49903
49915
|
init_log();
|
|
49904
49916
|
log75 = getDomainLogger("resources", { component: "resources" });
|
|
@@ -49933,7 +49945,7 @@ var init_resources = __esm({
|
|
|
49933
49945
|
* Supports caching for performance optimization
|
|
49934
49946
|
*/
|
|
49935
49947
|
async getResource(pathname) {
|
|
49936
|
-
const cleanPath =
|
|
49948
|
+
const cleanPath = path33.posix.normalize(pathname);
|
|
49937
49949
|
const cacheKey = `${cleanPath}__get`;
|
|
49938
49950
|
if (this.cache.has(cacheKey)) {
|
|
49939
49951
|
return this.cache.get(cacheKey) || null;
|
|
@@ -49962,7 +49974,7 @@ var init_resources = __esm({
|
|
|
49962
49974
|
* GetResourceWithOpener - Alternative way to get resource with custom opener
|
|
49963
49975
|
*/
|
|
49964
49976
|
async getResourceWithOpener(pathname, opener) {
|
|
49965
|
-
const cleanPath =
|
|
49977
|
+
const cleanPath = path33.posix.normalize(pathname);
|
|
49966
49978
|
const cacheKey = `${cleanPath}__get_with_opener`;
|
|
49967
49979
|
if (this.cache.has(cacheKey)) {
|
|
49968
49980
|
return this.cache.get(cacheKey) || null;
|
|
@@ -50100,7 +50112,7 @@ var init_resources = __esm({
|
|
|
50100
50112
|
*/
|
|
50101
50113
|
async buildResource(pathname, opener) {
|
|
50102
50114
|
try {
|
|
50103
|
-
const ext =
|
|
50115
|
+
const ext = path33.extname(pathname);
|
|
50104
50116
|
const mediaType = this.getMediaTypeFromExtension(ext);
|
|
50105
50117
|
const resourcePaths = ResourcePaths.newResourcePaths(pathname, this.workspace);
|
|
50106
50118
|
const resource = new ResourceImpl(
|
|
@@ -50202,11 +50214,11 @@ var init_resources = __esm({
|
|
|
50202
50214
|
});
|
|
50203
50215
|
|
|
50204
50216
|
// internal/domain/resources/valueobject/resourcepaths.ts
|
|
50205
|
-
var
|
|
50217
|
+
var path34, ResourcePaths;
|
|
50206
50218
|
var init_resourcepaths = __esm({
|
|
50207
50219
|
"internal/domain/resources/valueobject/resourcepaths.ts"() {
|
|
50208
50220
|
"use strict";
|
|
50209
|
-
|
|
50221
|
+
path34 = __toESM(require("path"));
|
|
50210
50222
|
ResourcePaths = class _ResourcePaths {
|
|
50211
50223
|
// This is the directory component for the target file or link.
|
|
50212
50224
|
dir;
|
|
@@ -50229,7 +50241,7 @@ var init_resourcepaths = __esm({
|
|
|
50229
50241
|
}
|
|
50230
50242
|
static newResourcePaths(targetPath, svc) {
|
|
50231
50243
|
const normalizedPath = targetPath.replace(/\\/g, "/");
|
|
50232
|
-
const parsedPath =
|
|
50244
|
+
const parsedPath = path34.posix.parse(normalizedPath);
|
|
50233
50245
|
let dir2 = parsedPath.dir;
|
|
50234
50246
|
if (dir2 === "/") {
|
|
50235
50247
|
dir2 = "";
|
|
@@ -50286,7 +50298,7 @@ var init_resourcepaths = __esm({
|
|
|
50286
50298
|
}
|
|
50287
50299
|
fromTargetPath(targetPath) {
|
|
50288
50300
|
const normalizedPath = targetPath.replace(/\\/g, "/");
|
|
50289
|
-
const parsedPath =
|
|
50301
|
+
const parsedPath = path34.posix.parse(normalizedPath);
|
|
50290
50302
|
let dir2 = parsedPath.dir;
|
|
50291
50303
|
if (dir2 === "/") {
|
|
50292
50304
|
dir2 = "";
|
|
@@ -50418,10 +50430,10 @@ __export(ssg_exports, {
|
|
|
50418
50430
|
processSSGWithProgress: () => processSSGWithProgress,
|
|
50419
50431
|
serveSSG: () => serveSSG
|
|
50420
50432
|
});
|
|
50421
|
-
function setDomainInstances(site, content,
|
|
50433
|
+
function setDomainInstances(site, content, fs13, config, modules, resources, template) {
|
|
50422
50434
|
siteCache = site;
|
|
50423
50435
|
contentCache = content;
|
|
50424
|
-
fsCache =
|
|
50436
|
+
fsCache = fs13;
|
|
50425
50437
|
configCache = config;
|
|
50426
50438
|
modulesCache = modules;
|
|
50427
50439
|
resourcesCache = resources;
|
|
@@ -50432,7 +50444,7 @@ function getDomainInstances() {
|
|
|
50432
50444
|
}
|
|
50433
50445
|
async function loadConfiguration(projDir, modulesDir) {
|
|
50434
50446
|
const osFs = newOsFs();
|
|
50435
|
-
const configFilePath =
|
|
50447
|
+
const configFilePath = import_path24.default.join(projDir, "config.json");
|
|
50436
50448
|
return await loadConfigWithParams(osFs, configFilePath, projDir, modulesDir);
|
|
50437
50449
|
}
|
|
50438
50450
|
async function createModule(config) {
|
|
@@ -50489,8 +50501,8 @@ async function createContentEngine(filesystem, config, modules, markdown) {
|
|
|
50489
50501
|
contentFs: () => {
|
|
50490
50502
|
return filesystem.contentFs();
|
|
50491
50503
|
},
|
|
50492
|
-
walkContent: (
|
|
50493
|
-
return filesystem.walkContent(
|
|
50504
|
+
walkContent: (fs13, start, cb, conf) => {
|
|
50505
|
+
return filesystem.walkContent(fs13, start, cb, conf);
|
|
50494
50506
|
},
|
|
50495
50507
|
walkI18n: (start, cb, conf) => {
|
|
50496
50508
|
return filesystem.walkI18n(start, cb, conf);
|
|
@@ -50584,10 +50596,10 @@ function createCustomizedFunctions(config, site, resources) {
|
|
|
50584
50596
|
}
|
|
50585
50597
|
};
|
|
50586
50598
|
}
|
|
50587
|
-
function createResourcesEngine(config,
|
|
50599
|
+
function createResourcesEngine(config, fs13) {
|
|
50588
50600
|
const workspace = {
|
|
50589
|
-
assetsFs: () =>
|
|
50590
|
-
publishFs: () =>
|
|
50601
|
+
assetsFs: () => fs13.assetsFs(),
|
|
50602
|
+
publishFs: () => fs13.publishFs(),
|
|
50591
50603
|
baseUrl: () => config.getProvider().getString("baseURL") || "http://localhost",
|
|
50592
50604
|
executeTemplate: async (templateName, rawContent, data) => {
|
|
50593
50605
|
throw new Error("Template execution not initialized. Please call resources.setTemplateSvc() first.");
|
|
@@ -50595,10 +50607,10 @@ function createResourcesEngine(config, fs14) {
|
|
|
50595
50607
|
};
|
|
50596
50608
|
return createResources(workspace);
|
|
50597
50609
|
}
|
|
50598
|
-
async function createTemplateEngineFromFs(
|
|
50610
|
+
async function createTemplateEngineFromFs(fs13, config, site, resources) {
|
|
50599
50611
|
const services = createCustomizedFunctions(config, site, resources);
|
|
50600
50612
|
const templateFs = {
|
|
50601
|
-
walk:
|
|
50613
|
+
walk: fs13.walkLayouts.bind(fs13)
|
|
50602
50614
|
};
|
|
50603
50615
|
return await createTemplateEngineWithServices(templateFs, services);
|
|
50604
50616
|
}
|
|
@@ -50638,7 +50650,7 @@ async function createTemplateAdapter(templateEngine, site) {
|
|
|
50638
50650
|
}
|
|
50639
50651
|
};
|
|
50640
50652
|
}
|
|
50641
|
-
function createSiteForSSG(config,
|
|
50653
|
+
function createSiteForSSG(config, fs13, content) {
|
|
50642
50654
|
const siteServices = {
|
|
50643
50655
|
// Config service methods
|
|
50644
50656
|
configParams: () => config.getProvider().getParams("params"),
|
|
@@ -50678,11 +50690,11 @@ function createSiteForSSG(config, fs14, content) {
|
|
|
50678
50690
|
searchPage: async (pages, page) => {
|
|
50679
50691
|
return [];
|
|
50680
50692
|
},
|
|
50681
|
-
getPageFromPath: async (langIndex,
|
|
50693
|
+
getPageFromPath: async (langIndex, path40) => {
|
|
50682
50694
|
try {
|
|
50683
|
-
const page = content.getPageFromPath(langIndex,
|
|
50695
|
+
const page = content.getPageFromPath(langIndex, path40);
|
|
50684
50696
|
if (!page) {
|
|
50685
|
-
log76.error(`\u26A0\uFE0F Application.getPageFromPath: content domain returned null for path: "${
|
|
50697
|
+
log76.error(`\u26A0\uFE0F Application.getPageFromPath: content domain returned null for path: "${path40}"`);
|
|
50686
50698
|
}
|
|
50687
50699
|
return page;
|
|
50688
50700
|
} catch (error) {
|
|
@@ -50690,11 +50702,11 @@ function createSiteForSSG(config, fs14, content) {
|
|
|
50690
50702
|
return null;
|
|
50691
50703
|
}
|
|
50692
50704
|
},
|
|
50693
|
-
getPageFromPathSync: (langIndex,
|
|
50705
|
+
getPageFromPathSync: (langIndex, path40) => {
|
|
50694
50706
|
try {
|
|
50695
|
-
const page = content.getPageFromPath(langIndex,
|
|
50707
|
+
const page = content.getPageFromPath(langIndex, path40);
|
|
50696
50708
|
if (!page) {
|
|
50697
|
-
log76.warn(`\u26A0\uFE0F Application.getPageFromPathSync: content domain returned null for path: ${
|
|
50709
|
+
log76.warn(`\u26A0\uFE0F Application.getPageFromPathSync: content domain returned null for path: ${path40}`);
|
|
50698
50710
|
}
|
|
50699
50711
|
return page;
|
|
50700
50712
|
} catch (error) {
|
|
@@ -50719,24 +50731,24 @@ function createSiteForSSG(config, fs14, content) {
|
|
|
50719
50731
|
generateSitemap: async () => ({ urls: [] }),
|
|
50720
50732
|
// Publisher methods
|
|
50721
50733
|
publishFs: () => {
|
|
50722
|
-
return
|
|
50734
|
+
return fs13.publishFs();
|
|
50723
50735
|
},
|
|
50724
50736
|
staticFs() {
|
|
50725
|
-
return
|
|
50737
|
+
return fs13.staticFs();
|
|
50726
50738
|
},
|
|
50727
50739
|
copyStaticFiles(from, to) {
|
|
50728
|
-
return
|
|
50740
|
+
return fs13.copyStatic([from], to);
|
|
50729
50741
|
},
|
|
50730
50742
|
workingDir: () => config.getProvider().getString("workingDir") || process.cwd(),
|
|
50731
50743
|
// ResourceService implementation (placeholder)
|
|
50732
|
-
getResource: async (
|
|
50744
|
+
getResource: async (path40) => {
|
|
50733
50745
|
return null;
|
|
50734
50746
|
},
|
|
50735
|
-
getResourceWithOpener: async (
|
|
50747
|
+
getResourceWithOpener: async (path40, opener) => {
|
|
50736
50748
|
return {
|
|
50737
|
-
name: () =>
|
|
50749
|
+
name: () => path40,
|
|
50738
50750
|
readSeekCloser: opener,
|
|
50739
|
-
targetPath: () =>
|
|
50751
|
+
targetPath: () => path40
|
|
50740
50752
|
};
|
|
50741
50753
|
},
|
|
50742
50754
|
// URLService implementation
|
|
@@ -51015,7 +51027,7 @@ async function collectAllPageTasks(projDir, modulesDir, markdown, onProgress, ht
|
|
|
51015
51027
|
throw new Error(`Failed to generate static site: ${message}`);
|
|
51016
51028
|
}
|
|
51017
51029
|
}
|
|
51018
|
-
var
|
|
51030
|
+
var import_path24, log76, configCache, modulesCache, fsCache, contentCache, resourcesCache, templateEngineCache, siteCache, createDomainInstances, tasks;
|
|
51019
51031
|
var init_ssg = __esm({
|
|
51020
51032
|
"internal/application/ssg.ts"() {
|
|
51021
51033
|
"use strict";
|
|
@@ -51026,14 +51038,14 @@ var init_ssg = __esm({
|
|
|
51026
51038
|
init_template3();
|
|
51027
51039
|
init_site2();
|
|
51028
51040
|
init_log();
|
|
51029
|
-
|
|
51041
|
+
import_path24 = __toESM(require("path"));
|
|
51030
51042
|
init_resources2();
|
|
51031
51043
|
log76 = getDomainLogger("ssg", { component: "application" });
|
|
51032
|
-
createDomainInstances = (site, content,
|
|
51044
|
+
createDomainInstances = (site, content, fs13, config, modules, resources) => {
|
|
51033
51045
|
return {
|
|
51034
51046
|
site,
|
|
51035
51047
|
content,
|
|
51036
|
-
fs:
|
|
51048
|
+
fs: fs13,
|
|
51037
51049
|
config,
|
|
51038
51050
|
modules,
|
|
51039
51051
|
resources
|
|
@@ -51762,8 +51774,8 @@ var WorkerPoolManager = class {
|
|
|
51762
51774
|
* 初始化 Node.js Worker 池
|
|
51763
51775
|
*/
|
|
51764
51776
|
async initializeNodePool() {
|
|
51765
|
-
const
|
|
51766
|
-
const workerPath =
|
|
51777
|
+
const path40 = require("path");
|
|
51778
|
+
const workerPath = path40.join(__dirname, "worker", "worker-node.js");
|
|
51767
51779
|
log79.debug(`Initializing Node.js worker pool with path: ${workerPath}`);
|
|
51768
51780
|
this.pool = workerpool.pool(workerPath, {
|
|
51769
51781
|
minWorkers: this.workerCount,
|
|
@@ -52090,8 +52102,8 @@ async function processSSGParallel(projDir, modulesDir, markdown, onProgress, htt
|
|
|
52090
52102
|
|
|
52091
52103
|
// internal/interfaces/cli/commands/build.ts
|
|
52092
52104
|
init_log();
|
|
52093
|
-
var
|
|
52094
|
-
var
|
|
52105
|
+
var import_path25 = __toESM(require("path"));
|
|
52106
|
+
var import_fs14 = require("fs");
|
|
52095
52107
|
var log82 = getDomainLogger("build-command", { component: "cli" });
|
|
52096
52108
|
var BuildCommand = class {
|
|
52097
52109
|
constructor(workspaceAppService) {
|
|
@@ -52117,7 +52129,7 @@ var BuildCommand = class {
|
|
|
52117
52129
|
await project.loadConfig();
|
|
52118
52130
|
const projectRoot = project.getPath();
|
|
52119
52131
|
const modulesDir = options.modulesDir || workspace.getModulesDir();
|
|
52120
|
-
const outputDir = options.destination ?
|
|
52132
|
+
const outputDir = options.destination ? import_path25.default.resolve(projectRoot, options.destination) : await project.getPublishDir();
|
|
52121
52133
|
if (options.clean) {
|
|
52122
52134
|
await this.cleanOutputDir(outputDir);
|
|
52123
52135
|
log82.info(`Cleaned output directory: ${outputDir}`);
|
|
@@ -52126,7 +52138,7 @@ var BuildCommand = class {
|
|
|
52126
52138
|
let contentDirs = await project.getContentDirs();
|
|
52127
52139
|
if (options.contentDirs && options.contentDirs.length > 0) {
|
|
52128
52140
|
const extraDirs = options.contentDirs.map(
|
|
52129
|
-
(dir2) =>
|
|
52141
|
+
(dir2) => import_path25.default.resolve(projectRoot, dir2)
|
|
52130
52142
|
);
|
|
52131
52143
|
contentDirs = [...contentDirs, ...extraDirs];
|
|
52132
52144
|
log82.info(`Added extra content directories: ${options.contentDirs.join(", ")}`);
|
|
@@ -52212,11 +52224,11 @@ var BuildCommand = class {
|
|
|
52212
52224
|
*/
|
|
52213
52225
|
async cleanOutputDir(outputDir) {
|
|
52214
52226
|
try {
|
|
52215
|
-
await
|
|
52216
|
-
const entries = await
|
|
52227
|
+
await import_fs14.promises.access(outputDir);
|
|
52228
|
+
const entries = await import_fs14.promises.readdir(outputDir);
|
|
52217
52229
|
await Promise.all(
|
|
52218
52230
|
entries.map(
|
|
52219
|
-
(entry) =>
|
|
52231
|
+
(entry) => import_fs14.promises.rm(import_path25.default.join(outputDir, entry), { recursive: true, force: true })
|
|
52220
52232
|
)
|
|
52221
52233
|
);
|
|
52222
52234
|
} catch (error) {
|
|
@@ -52233,8 +52245,8 @@ init_log();
|
|
|
52233
52245
|
|
|
52234
52246
|
// pkg/web/watcher/content-file-watcher.ts
|
|
52235
52247
|
var chokidar = __toESM(require("chokidar"));
|
|
52236
|
-
var
|
|
52237
|
-
var
|
|
52248
|
+
var path37 = __toESM(require("path"));
|
|
52249
|
+
var fs10 = __toESM(require("fs"));
|
|
52238
52250
|
init_log();
|
|
52239
52251
|
var log83 = getDomainLogger("web", { component: "content-file-watcher" });
|
|
52240
52252
|
var ContentFileWatcher = class {
|
|
@@ -52267,10 +52279,10 @@ var ContentFileWatcher = class {
|
|
|
52267
52279
|
}
|
|
52268
52280
|
return paths.every((p2) => {
|
|
52269
52281
|
try {
|
|
52270
|
-
const stats =
|
|
52282
|
+
const stats = fs10.statSync(p2);
|
|
52271
52283
|
return stats.isFile();
|
|
52272
52284
|
} catch {
|
|
52273
|
-
const ext =
|
|
52285
|
+
const ext = path37.extname(p2).toLowerCase();
|
|
52274
52286
|
return ext === ".md" || ext === ".markdown";
|
|
52275
52287
|
}
|
|
52276
52288
|
});
|
|
@@ -52312,11 +52324,11 @@ var ContentFileWatcher = class {
|
|
|
52312
52324
|
let fp = filePath;
|
|
52313
52325
|
if (this.isSingleFileMode) {
|
|
52314
52326
|
const matchedIndex = this.config.contentDirs.findIndex((contentFile) => {
|
|
52315
|
-
return
|
|
52327
|
+
return path37.normalize(filePath) === path37.normalize(contentFile);
|
|
52316
52328
|
});
|
|
52317
52329
|
if (matchedIndex !== -1) {
|
|
52318
52330
|
const projContentDir = this.config.projContentDirs[matchedIndex];
|
|
52319
|
-
fp =
|
|
52331
|
+
fp = path37.join(projContentDir, "index.md");
|
|
52320
52332
|
log83.debug("Single file event mapped", {
|
|
52321
52333
|
original: filePath,
|
|
52322
52334
|
mapped: fp
|
|
@@ -52337,7 +52349,7 @@ var ContentFileWatcher = class {
|
|
|
52337
52349
|
}
|
|
52338
52350
|
}
|
|
52339
52351
|
}
|
|
52340
|
-
const normalizedPath =
|
|
52352
|
+
const normalizedPath = path37.normalize(fp);
|
|
52341
52353
|
if (!this.isRelevantFile(normalizedPath)) {
|
|
52342
52354
|
return;
|
|
52343
52355
|
}
|
|
@@ -52355,11 +52367,11 @@ var ContentFileWatcher = class {
|
|
|
52355
52367
|
return this.isMarkdownFile(filePath) || this.isImageFile(filePath);
|
|
52356
52368
|
}
|
|
52357
52369
|
isMarkdownFile(filePath) {
|
|
52358
|
-
const ext =
|
|
52370
|
+
const ext = path37.extname(filePath).toLowerCase();
|
|
52359
52371
|
return ext === ".md" || ext === ".markdown";
|
|
52360
52372
|
}
|
|
52361
52373
|
isImageFile(filePath) {
|
|
52362
|
-
const ext =
|
|
52374
|
+
const ext = path37.extname(filePath).toLowerCase();
|
|
52363
52375
|
return [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp", ".bmp"].includes(ext);
|
|
52364
52376
|
}
|
|
52365
52377
|
scheduleBatch() {
|
|
@@ -52406,8 +52418,8 @@ var ContentFileWatcher = class {
|
|
|
52406
52418
|
|
|
52407
52419
|
// pkg/web/server/livereload-server.ts
|
|
52408
52420
|
var http3 = __toESM(require("http"));
|
|
52409
|
-
var
|
|
52410
|
-
var
|
|
52421
|
+
var path38 = __toESM(require("path"));
|
|
52422
|
+
var fs11 = __toESM(require("fs/promises"));
|
|
52411
52423
|
var import_ws = require("ws");
|
|
52412
52424
|
init_log();
|
|
52413
52425
|
var log84 = getDomainLogger("web", { component: "livereload-server" });
|
|
@@ -52477,7 +52489,7 @@ var FoundryLiveReloadServer = class {
|
|
|
52477
52489
|
};
|
|
52478
52490
|
if (changedFiles && changedFiles.length === 1) {
|
|
52479
52491
|
const file = changedFiles[0];
|
|
52480
|
-
const ext =
|
|
52492
|
+
const ext = path38.extname(file).toLowerCase();
|
|
52481
52493
|
if (ext === ".css") {
|
|
52482
52494
|
reloadEvent.path = file;
|
|
52483
52495
|
reloadEvent.liveCSS = true;
|
|
@@ -52559,11 +52571,11 @@ var FoundryLiveReloadServer = class {
|
|
|
52559
52571
|
const url = req.url || "/";
|
|
52560
52572
|
let filePath = this.resolveFilePath(url);
|
|
52561
52573
|
try {
|
|
52562
|
-
const stats = await
|
|
52574
|
+
const stats = await fs11.stat(filePath);
|
|
52563
52575
|
if (stats.isDirectory()) {
|
|
52564
|
-
const indexPath =
|
|
52576
|
+
const indexPath = path38.join(filePath, "index.html");
|
|
52565
52577
|
try {
|
|
52566
|
-
await
|
|
52578
|
+
await fs11.stat(indexPath);
|
|
52567
52579
|
filePath = indexPath;
|
|
52568
52580
|
} catch {
|
|
52569
52581
|
res.statusCode = 404;
|
|
@@ -52571,7 +52583,7 @@ var FoundryLiveReloadServer = class {
|
|
|
52571
52583
|
return;
|
|
52572
52584
|
}
|
|
52573
52585
|
}
|
|
52574
|
-
let content = await
|
|
52586
|
+
let content = await fs11.readFile(filePath);
|
|
52575
52587
|
const contentType = this.getContentType(filePath);
|
|
52576
52588
|
res.setHeader("Content-Type", contentType);
|
|
52577
52589
|
if (contentType.includes("text/html") && this.config.enableLiveReload) {
|
|
@@ -52607,9 +52619,9 @@ var FoundryLiveReloadServer = class {
|
|
|
52607
52619
|
log84.warn("Failed to decode URL:", cleanUrl, error);
|
|
52608
52620
|
decodedUrl = cleanUrl;
|
|
52609
52621
|
}
|
|
52610
|
-
const normalizedPath =
|
|
52622
|
+
const normalizedPath = path38.normalize(decodedUrl).replace(/^(\.\.[\/\\])+/, "");
|
|
52611
52623
|
const relativePath = normalizedPath.startsWith("/") ? normalizedPath.slice(1) : normalizedPath;
|
|
52612
|
-
const resolvedPath =
|
|
52624
|
+
const resolvedPath = path38.join(this.config.publicDir, relativePath);
|
|
52613
52625
|
if (process.platform === "win32" && resolvedPath.length > 260) {
|
|
52614
52626
|
log84.warn("Path too long for Windows filesystem:", resolvedPath);
|
|
52615
52627
|
}
|
|
@@ -52622,7 +52634,7 @@ var FoundryLiveReloadServer = class {
|
|
|
52622
52634
|
return resolvedPath;
|
|
52623
52635
|
}
|
|
52624
52636
|
getContentType(filePath) {
|
|
52625
|
-
const ext =
|
|
52637
|
+
const ext = path38.extname(filePath).toLowerCase();
|
|
52626
52638
|
const mimeTypes = {
|
|
52627
52639
|
".html": "text/html; charset=utf-8",
|
|
52628
52640
|
".css": "text/css; charset=utf-8",
|
|
@@ -52716,20 +52728,20 @@ var FoundryLiveReloadServer = class {
|
|
|
52716
52728
|
shouldLiveReloadCSS(changedFiles) {
|
|
52717
52729
|
if (!changedFiles)
|
|
52718
52730
|
return false;
|
|
52719
|
-
return changedFiles.some((file) =>
|
|
52731
|
+
return changedFiles.some((file) => path38.extname(file).toLowerCase() === ".css");
|
|
52720
52732
|
}
|
|
52721
52733
|
shouldLiveReloadImages(changedFiles) {
|
|
52722
52734
|
if (!changedFiles)
|
|
52723
52735
|
return false;
|
|
52724
52736
|
const imageExts = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"];
|
|
52725
|
-
return changedFiles.some((file) => imageExts.includes(
|
|
52737
|
+
return changedFiles.some((file) => imageExts.includes(path38.extname(file).toLowerCase()));
|
|
52726
52738
|
}
|
|
52727
52739
|
};
|
|
52728
52740
|
|
|
52729
52741
|
// pkg/web/server/electron-livereload-server.ts
|
|
52730
52742
|
var http4 = __toESM(require("http"));
|
|
52731
|
-
var
|
|
52732
|
-
var
|
|
52743
|
+
var path39 = __toESM(require("path"));
|
|
52744
|
+
var fs12 = __toESM(require("fs/promises"));
|
|
52733
52745
|
init_log();
|
|
52734
52746
|
var log85 = getDomainLogger("web", { component: "electron-livereload-server" });
|
|
52735
52747
|
var ElectronLiveReloadServer = class {
|
|
@@ -52745,7 +52757,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52745
52757
|
enableLiveReload: config.enableLiveReload !== false,
|
|
52746
52758
|
publicDir: config.publicDir
|
|
52747
52759
|
};
|
|
52748
|
-
this.stateFilePath =
|
|
52760
|
+
this.stateFilePath = path39.join(this.config.publicDir, ".foundry-livereload-state.json");
|
|
52749
52761
|
}
|
|
52750
52762
|
async start() {
|
|
52751
52763
|
if (this.running) {
|
|
@@ -52776,7 +52788,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52776
52788
|
this.httpServer = null;
|
|
52777
52789
|
}
|
|
52778
52790
|
try {
|
|
52779
|
-
await
|
|
52791
|
+
await fs12.unlink(this.stateFilePath);
|
|
52780
52792
|
} catch (error) {
|
|
52781
52793
|
}
|
|
52782
52794
|
this.running = false;
|
|
@@ -52798,7 +52810,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52798
52810
|
};
|
|
52799
52811
|
if (changedFiles && changedFiles.length === 1) {
|
|
52800
52812
|
const file = changedFiles[0];
|
|
52801
|
-
const ext =
|
|
52813
|
+
const ext = path39.extname(file).toLowerCase();
|
|
52802
52814
|
if (ext === ".css" || [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"].includes(ext)) {
|
|
52803
52815
|
state.path = file;
|
|
52804
52816
|
}
|
|
@@ -52822,7 +52834,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52822
52834
|
}
|
|
52823
52835
|
async writeStateFile(state) {
|
|
52824
52836
|
try {
|
|
52825
|
-
await
|
|
52837
|
+
await fs12.writeFile(this.stateFilePath, JSON.stringify(state), "utf8");
|
|
52826
52838
|
} catch (error) {
|
|
52827
52839
|
log85.error("Failed to write LiveReload state file:", error);
|
|
52828
52840
|
}
|
|
@@ -52859,7 +52871,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52859
52871
|
const url = req.url || "/";
|
|
52860
52872
|
if (url.startsWith("/.foundry-livereload-state.json")) {
|
|
52861
52873
|
try {
|
|
52862
|
-
const content = await
|
|
52874
|
+
const content = await fs12.readFile(this.stateFilePath, "utf8");
|
|
52863
52875
|
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
|
52864
52876
|
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
|
52865
52877
|
res.setHeader("Pragma", "no-cache");
|
|
@@ -52880,11 +52892,11 @@ var ElectronLiveReloadServer = class {
|
|
|
52880
52892
|
}
|
|
52881
52893
|
let filePath = this.resolveFilePath(url);
|
|
52882
52894
|
try {
|
|
52883
|
-
const stats = await
|
|
52895
|
+
const stats = await fs12.stat(filePath);
|
|
52884
52896
|
if (stats.isDirectory()) {
|
|
52885
|
-
const indexPath =
|
|
52897
|
+
const indexPath = path39.join(filePath, "index.html");
|
|
52886
52898
|
try {
|
|
52887
|
-
await
|
|
52899
|
+
await fs12.stat(indexPath);
|
|
52888
52900
|
filePath = indexPath;
|
|
52889
52901
|
} catch {
|
|
52890
52902
|
res.statusCode = 404;
|
|
@@ -52892,7 +52904,7 @@ var ElectronLiveReloadServer = class {
|
|
|
52892
52904
|
return;
|
|
52893
52905
|
}
|
|
52894
52906
|
}
|
|
52895
|
-
let content = await
|
|
52907
|
+
let content = await fs12.readFile(filePath);
|
|
52896
52908
|
const contentType = this.getContentType(filePath);
|
|
52897
52909
|
res.setHeader("Content-Type", contentType);
|
|
52898
52910
|
if (contentType.includes("text/html") && this.config.enableLiveReload) {
|
|
@@ -52928,13 +52940,13 @@ var ElectronLiveReloadServer = class {
|
|
|
52928
52940
|
log85.warn("Failed to decode URL:", cleanUrl, error);
|
|
52929
52941
|
decodedUrl = cleanUrl;
|
|
52930
52942
|
}
|
|
52931
|
-
const normalizedPath =
|
|
52943
|
+
const normalizedPath = path39.normalize(decodedUrl).replace(/^(\.\.[\/\\])+/, "");
|
|
52932
52944
|
const relativePath = normalizedPath.startsWith("/") ? normalizedPath.slice(1) : normalizedPath;
|
|
52933
|
-
const resolvedPath =
|
|
52945
|
+
const resolvedPath = path39.join(this.config.publicDir, relativePath);
|
|
52934
52946
|
return resolvedPath;
|
|
52935
52947
|
}
|
|
52936
52948
|
getContentType(filePath) {
|
|
52937
|
-
const ext =
|
|
52949
|
+
const ext = path39.extname(filePath).toLowerCase();
|
|
52938
52950
|
const mimeTypes = {
|
|
52939
52951
|
".html": "text/html; charset=utf-8",
|
|
52940
52952
|
".css": "text/css; charset=utf-8",
|
|
@@ -53054,13 +53066,13 @@ var ElectronLiveReloadServer = class {
|
|
|
53054
53066
|
shouldLiveReloadCSS(changedFiles) {
|
|
53055
53067
|
if (!changedFiles)
|
|
53056
53068
|
return false;
|
|
53057
|
-
return changedFiles.some((file) =>
|
|
53069
|
+
return changedFiles.some((file) => path39.extname(file).toLowerCase() === ".css");
|
|
53058
53070
|
}
|
|
53059
53071
|
shouldLiveReloadImages(changedFiles) {
|
|
53060
53072
|
if (!changedFiles)
|
|
53061
53073
|
return false;
|
|
53062
53074
|
const imageExts = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"];
|
|
53063
|
-
return changedFiles.some((file) => imageExts.includes(
|
|
53075
|
+
return changedFiles.some((file) => imageExts.includes(path39.extname(file).toLowerCase()));
|
|
53064
53076
|
}
|
|
53065
53077
|
};
|
|
53066
53078
|
|
|
@@ -55360,7 +55372,7 @@ For more information, visit: https://help.mdfriday.com
|
|
|
55360
55372
|
* Show version
|
|
55361
55373
|
*/
|
|
55362
55374
|
showVersion() {
|
|
55363
|
-
const version = "26.4.
|
|
55375
|
+
const version = "26.4.9";
|
|
55364
55376
|
return {
|
|
55365
55377
|
success: true,
|
|
55366
55378
|
message: `MDFriday CLI v${version}`
|