@mdfriday/foundry 26.3.4 → 26.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +581 -502
- package/dist/index.js +1 -1
- package/dist/internal/domain/workspace/entity/project.d.ts +1 -0
- package/dist/internal/domain/workspace/entity/workspace.d.ts +3 -1
- package/dist/internal/domain/workspace/repository/file-system.d.ts +4 -0
- package/dist/internal/infrastructure/persistence/node-file-system.d.ts +4 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -631,11 +631,13 @@ var init_workspace = __esm({
|
|
|
631
631
|
metadata;
|
|
632
632
|
projects;
|
|
633
633
|
authentication;
|
|
634
|
-
|
|
634
|
+
fileSystemRepo;
|
|
635
|
+
constructor(rootPath, metadata, projects, authentication, fileSystemRepo) {
|
|
635
636
|
this.rootPath = rootPath;
|
|
636
637
|
this.metadata = metadata;
|
|
637
638
|
this.projects = projects;
|
|
638
639
|
this.authentication = authentication;
|
|
640
|
+
this.fileSystemRepo = fileSystemRepo;
|
|
639
641
|
}
|
|
640
642
|
// ============================================================================
|
|
641
643
|
// Basic Getters
|
|
@@ -814,14 +816,16 @@ var init_workspace = __esm({
|
|
|
814
816
|
* Get configuration value by key (supports nested keys with dot notation)
|
|
815
817
|
*/
|
|
816
818
|
async getConfig(key2) {
|
|
817
|
-
|
|
819
|
+
if (!this.fileSystemRepo) {
|
|
820
|
+
throw new Error("FileSystemRepository is required for config operations");
|
|
821
|
+
}
|
|
818
822
|
const configPath = this.getConfigPath();
|
|
819
823
|
try {
|
|
820
|
-
const content = await
|
|
824
|
+
const content = await this.fileSystemRepo.readFile(configPath, "utf-8");
|
|
821
825
|
const config = JSON.parse(content);
|
|
822
826
|
return this.getNestedValue(config, key2);
|
|
823
827
|
} catch (error) {
|
|
824
|
-
if (error.
|
|
828
|
+
if (error.message?.includes("Cannot access path")) {
|
|
825
829
|
return void 0;
|
|
826
830
|
}
|
|
827
831
|
throw error;
|
|
@@ -831,13 +835,15 @@ var init_workspace = __esm({
|
|
|
831
835
|
* Get all workspace configuration
|
|
832
836
|
*/
|
|
833
837
|
async getAllConfig() {
|
|
834
|
-
|
|
838
|
+
if (!this.fileSystemRepo) {
|
|
839
|
+
throw new Error("FileSystemRepository is required for config operations");
|
|
840
|
+
}
|
|
835
841
|
const configPath = this.getConfigPath();
|
|
836
842
|
try {
|
|
837
|
-
const content = await
|
|
843
|
+
const content = await this.fileSystemRepo.readFile(configPath, "utf-8");
|
|
838
844
|
return JSON.parse(content);
|
|
839
845
|
} catch (error) {
|
|
840
|
-
if (error.
|
|
846
|
+
if (error.message?.includes("Cannot access path")) {
|
|
841
847
|
return {};
|
|
842
848
|
}
|
|
843
849
|
throw error;
|
|
@@ -847,40 +853,44 @@ var init_workspace = __esm({
|
|
|
847
853
|
* Set configuration value (supports nested keys with dot notation)
|
|
848
854
|
*/
|
|
849
855
|
async setConfig(key2, value) {
|
|
850
|
-
|
|
856
|
+
if (!this.fileSystemRepo) {
|
|
857
|
+
throw new Error("FileSystemRepository is required for config operations");
|
|
858
|
+
}
|
|
851
859
|
const configPath = this.getConfigPath();
|
|
852
860
|
const configDir = import_path.default.dirname(configPath);
|
|
853
|
-
await
|
|
861
|
+
await this.fileSystemRepo.createDirectory(configDir, true);
|
|
854
862
|
let config = {};
|
|
855
863
|
try {
|
|
856
|
-
const content = await
|
|
864
|
+
const content = await this.fileSystemRepo.readFile(configPath, "utf-8");
|
|
857
865
|
config = JSON.parse(content);
|
|
858
866
|
} catch (error) {
|
|
859
|
-
if (error.
|
|
867
|
+
if (!error.message?.includes("Cannot access path")) {
|
|
860
868
|
throw error;
|
|
861
869
|
}
|
|
862
870
|
}
|
|
863
871
|
this.setNestedValue(config, key2, value);
|
|
864
|
-
await
|
|
872
|
+
await this.fileSystemRepo.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
865
873
|
log.debug(`Workspace config updated: ${key2}`, { workspaceId: this.getId() });
|
|
866
874
|
}
|
|
867
875
|
/**
|
|
868
876
|
* Unset configuration value (supports nested keys with dot notation)
|
|
869
877
|
*/
|
|
870
878
|
async unsetConfig(key2) {
|
|
871
|
-
|
|
879
|
+
if (!this.fileSystemRepo) {
|
|
880
|
+
throw new Error("FileSystemRepository is required for config operations");
|
|
881
|
+
}
|
|
872
882
|
const configPath = this.getConfigPath();
|
|
873
883
|
try {
|
|
874
|
-
const content = await
|
|
884
|
+
const content = await this.fileSystemRepo.readFile(configPath, "utf-8");
|
|
875
885
|
const config = JSON.parse(content);
|
|
876
886
|
const deleted = this.deleteNestedValue(config, key2);
|
|
877
887
|
if (deleted) {
|
|
878
|
-
await
|
|
888
|
+
await this.fileSystemRepo.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
|
|
879
889
|
log.debug(`Workspace config deleted: ${key2}`, { workspaceId: this.getId() });
|
|
880
890
|
}
|
|
881
891
|
return deleted;
|
|
882
892
|
} catch (error) {
|
|
883
|
-
if (error.
|
|
893
|
+
if (error.message?.includes("Cannot access path")) {
|
|
884
894
|
return false;
|
|
885
895
|
}
|
|
886
896
|
throw error;
|
|
@@ -1309,6 +1319,24 @@ var init_project = __esm({
|
|
|
1309
1319
|
isLinkedProject() {
|
|
1310
1320
|
return this.hasSourceLinks();
|
|
1311
1321
|
}
|
|
1322
|
+
/**
|
|
1323
|
+
* 获取所有链接的源路径(包括 fileLink 和 contentLinks)
|
|
1324
|
+
* Returns absolute paths to original source files/folders
|
|
1325
|
+
*/
|
|
1326
|
+
getLinkDirs() {
|
|
1327
|
+
const linkDirs = [];
|
|
1328
|
+
const fileLink = this.getFileLink();
|
|
1329
|
+
if (fileLink) {
|
|
1330
|
+
linkDirs.push(fileLink.sourcePath);
|
|
1331
|
+
}
|
|
1332
|
+
const contentLinks = this.getContentLinks();
|
|
1333
|
+
for (const link of contentLinks) {
|
|
1334
|
+
if (!linkDirs.includes(link.sourcePath)) {
|
|
1335
|
+
linkDirs.push(link.sourcePath);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
return linkDirs;
|
|
1339
|
+
}
|
|
1312
1340
|
};
|
|
1313
1341
|
}
|
|
1314
1342
|
});
|
|
@@ -3088,7 +3116,13 @@ var init_workspace_factory = __esm({
|
|
|
3088
3116
|
}
|
|
3089
3117
|
const hasAuthFile = await this.checkAuthFile(absolutePath);
|
|
3090
3118
|
const authentication = new Authentication(absolutePath, hasAuthFile);
|
|
3091
|
-
const workspace = new Workspace(
|
|
3119
|
+
const workspace = new Workspace(
|
|
3120
|
+
absolutePath,
|
|
3121
|
+
metadata,
|
|
3122
|
+
projects,
|
|
3123
|
+
authentication,
|
|
3124
|
+
this.fileSystemRepo || void 0
|
|
3125
|
+
);
|
|
3092
3126
|
log5.info("Workspace loaded", {
|
|
3093
3127
|
workspaceId: workspace.getId(),
|
|
3094
3128
|
name: workspace.getName(),
|
|
@@ -3100,10 +3134,12 @@ var init_workspace_factory = __esm({
|
|
|
3100
3134
|
* Check if auth file exists
|
|
3101
3135
|
*/
|
|
3102
3136
|
async checkAuthFile(workspacePath) {
|
|
3137
|
+
if (!this.fileSystemRepo) {
|
|
3138
|
+
return false;
|
|
3139
|
+
}
|
|
3103
3140
|
const authPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3104
|
-
const fs13 = await import("fs/promises");
|
|
3105
3141
|
try {
|
|
3106
|
-
await
|
|
3142
|
+
await this.fileSystemRepo.access(authPath);
|
|
3107
3143
|
return true;
|
|
3108
3144
|
} catch {
|
|
3109
3145
|
return false;
|
|
@@ -3151,7 +3187,8 @@ var init_workspace_factory = __esm({
|
|
|
3151
3187
|
absolutePath,
|
|
3152
3188
|
metadata,
|
|
3153
3189
|
/* @__PURE__ */ new Map(),
|
|
3154
|
-
authentication
|
|
3190
|
+
authentication,
|
|
3191
|
+
this.fileSystemRepo || void 0
|
|
3155
3192
|
);
|
|
3156
3193
|
log5.info("Workspace created", {
|
|
3157
3194
|
workspaceId: workspace.getId(),
|
|
@@ -3577,10 +3614,12 @@ var init_workspace_factory = __esm({
|
|
|
3577
3614
|
outputDir
|
|
3578
3615
|
);
|
|
3579
3616
|
if (snapshotName && snapshotName !== metadata.id) {
|
|
3617
|
+
if (!this.fileSystemRepo) {
|
|
3618
|
+
throw new Error("FileSystemRepository is required to update snapshot metadata");
|
|
3619
|
+
}
|
|
3580
3620
|
metadata.name = snapshotName;
|
|
3581
3621
|
const metadataPath = import_path3.default.join(project.getPath(), ".mdfriday", "snapshots", `${metadata.id}.json`);
|
|
3582
|
-
|
|
3583
|
-
await fs13.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
3622
|
+
await this.fileSystemRepo.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
3584
3623
|
}
|
|
3585
3624
|
log5.info("Snapshot created", { snapshotId, size: metadata.size, fileCount: metadata.fileCount });
|
|
3586
3625
|
return metadata;
|
|
@@ -3625,12 +3664,15 @@ var init_workspace_factory = __esm({
|
|
|
3625
3664
|
createIdentityStorage(workspace) {
|
|
3626
3665
|
const workspacePath = workspace.getPath();
|
|
3627
3666
|
const authentication = workspace.getAuthentication();
|
|
3667
|
+
const fsRepo = this.fileSystemRepo;
|
|
3668
|
+
if (!fsRepo) {
|
|
3669
|
+
throw new Error("FileSystemRepository is required for identity storage");
|
|
3670
|
+
}
|
|
3628
3671
|
return {
|
|
3629
3672
|
// 新方法:合并存储
|
|
3630
3673
|
async saveUserData(data) {
|
|
3631
3674
|
const userDataPath = import_path3.default.join(workspacePath, ".mdfriday", "user-data.json");
|
|
3632
|
-
|
|
3633
|
-
await fs13.mkdir(import_path3.default.dirname(userDataPath), { recursive: true });
|
|
3675
|
+
await fsRepo.createDirectory(import_path3.default.dirname(userDataPath), true);
|
|
3634
3676
|
const jsonData = {
|
|
3635
3677
|
serverConfig: data.serverConfig.toJSON()
|
|
3636
3678
|
};
|
|
@@ -3644,13 +3686,12 @@ var init_workspace_factory = __esm({
|
|
|
3644
3686
|
if (data.email) {
|
|
3645
3687
|
jsonData.email = data.email;
|
|
3646
3688
|
}
|
|
3647
|
-
await
|
|
3689
|
+
await fsRepo.writeFile(userDataPath, JSON.stringify(jsonData, null, 2));
|
|
3648
3690
|
},
|
|
3649
3691
|
async loadUserData() {
|
|
3650
3692
|
const userDataPath = import_path3.default.join(workspacePath, ".mdfriday", "user-data.json");
|
|
3651
|
-
const fs13 = await import("fs/promises");
|
|
3652
3693
|
try {
|
|
3653
|
-
const content = await
|
|
3694
|
+
const content = await fsRepo.readFile(userDataPath, "utf-8");
|
|
3654
3695
|
const data = JSON.parse(content);
|
|
3655
3696
|
const { Token: Token3, ServerConfig: ServerConfig2, License: License2 } = await Promise.resolve().then(() => (init_identity(), identity_exports));
|
|
3656
3697
|
const result = {};
|
|
@@ -3679,9 +3720,8 @@ var init_workspace_factory = __esm({
|
|
|
3679
3720
|
},
|
|
3680
3721
|
async clearUserData() {
|
|
3681
3722
|
const userDataPath = import_path3.default.join(workspacePath, ".mdfriday", "user-data.json");
|
|
3682
|
-
const fs13 = await import("fs/promises");
|
|
3683
3723
|
try {
|
|
3684
|
-
await
|
|
3724
|
+
await fsRepo.unlink(userDataPath);
|
|
3685
3725
|
} catch {
|
|
3686
3726
|
}
|
|
3687
3727
|
authentication.markAuthDeleted();
|
|
@@ -3689,9 +3729,8 @@ var init_workspace_factory = __esm({
|
|
|
3689
3729
|
// 保留旧方法以向后兼容
|
|
3690
3730
|
async saveToken(token) {
|
|
3691
3731
|
const authPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3692
|
-
|
|
3693
|
-
await
|
|
3694
|
-
await fs13.writeFile(authPath, JSON.stringify(token.toJSON(), null, 2));
|
|
3732
|
+
await fsRepo.createDirectory(import_path3.default.dirname(authPath), true);
|
|
3733
|
+
await fsRepo.writeFile(authPath, JSON.stringify(token.toJSON(), null, 2));
|
|
3695
3734
|
authentication.markAuthExists();
|
|
3696
3735
|
},
|
|
3697
3736
|
async loadToken() {
|
|
@@ -3700,9 +3739,8 @@ var init_workspace_factory = __esm({
|
|
|
3700
3739
|
return userData.token;
|
|
3701
3740
|
}
|
|
3702
3741
|
const authPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3703
|
-
const fs13 = await import("fs/promises");
|
|
3704
3742
|
try {
|
|
3705
|
-
const content = await
|
|
3743
|
+
const content = await fsRepo.readFile(authPath, "utf-8");
|
|
3706
3744
|
const data = JSON.parse(content);
|
|
3707
3745
|
const { Token: Token3 } = await Promise.resolve().then(() => (init_identity(), identity_exports));
|
|
3708
3746
|
return Token3.create(data.token, data.expiresAt);
|
|
@@ -3712,18 +3750,16 @@ var init_workspace_factory = __esm({
|
|
|
3712
3750
|
},
|
|
3713
3751
|
async clearToken() {
|
|
3714
3752
|
const authPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3715
|
-
const fs13 = await import("fs/promises");
|
|
3716
3753
|
try {
|
|
3717
|
-
await
|
|
3754
|
+
await fsRepo.unlink(authPath);
|
|
3718
3755
|
} catch {
|
|
3719
3756
|
}
|
|
3720
3757
|
authentication.markAuthDeleted();
|
|
3721
3758
|
},
|
|
3722
3759
|
async saveServerConfig(config) {
|
|
3723
3760
|
const configPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-config.json");
|
|
3724
|
-
|
|
3725
|
-
await
|
|
3726
|
-
await fs13.writeFile(configPath, JSON.stringify(config.toJSON(), null, 2));
|
|
3761
|
+
await fsRepo.createDirectory(import_path3.default.dirname(configPath), true);
|
|
3762
|
+
await fsRepo.writeFile(configPath, JSON.stringify(config.toJSON(), null, 2));
|
|
3727
3763
|
},
|
|
3728
3764
|
async loadServerConfig() {
|
|
3729
3765
|
const userData = await this.loadUserData();
|
|
@@ -3731,9 +3767,8 @@ var init_workspace_factory = __esm({
|
|
|
3731
3767
|
return userData.serverConfig;
|
|
3732
3768
|
}
|
|
3733
3769
|
const configPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-config.json");
|
|
3734
|
-
const fs13 = await import("fs/promises");
|
|
3735
3770
|
try {
|
|
3736
|
-
const content = await
|
|
3771
|
+
const content = await fsRepo.readFile(configPath, "utf-8");
|
|
3737
3772
|
const data = JSON.parse(content);
|
|
3738
3773
|
const { ServerConfig: ServerConfig2 } = await Promise.resolve().then(() => (init_identity(), identity_exports));
|
|
3739
3774
|
return ServerConfig2.create(data.apiUrl, data.websiteUrl);
|
|
@@ -3791,11 +3826,12 @@ var init_workspace2 = __esm({
|
|
|
3791
3826
|
});
|
|
3792
3827
|
|
|
3793
3828
|
// internal/application/workspace.ts
|
|
3794
|
-
var log6, WorkspaceAppService;
|
|
3829
|
+
var import_path4, log6, WorkspaceAppService;
|
|
3795
3830
|
var init_workspace3 = __esm({
|
|
3796
3831
|
"internal/application/workspace.ts"() {
|
|
3797
3832
|
"use strict";
|
|
3798
3833
|
init_log();
|
|
3834
|
+
import_path4 = __toESM(require("path"));
|
|
3799
3835
|
log6 = getDomainLogger("workspace-app", { component: "application" });
|
|
3800
3836
|
WorkspaceAppService = class {
|
|
3801
3837
|
workspaceFactory;
|
|
@@ -3808,17 +3844,17 @@ var init_workspace3 = __esm({
|
|
|
3808
3844
|
/**
|
|
3809
3845
|
* Load workspace from path
|
|
3810
3846
|
*/
|
|
3811
|
-
async loadWorkspace(
|
|
3812
|
-
if (
|
|
3813
|
-
return this.workspaceFactory.load(
|
|
3847
|
+
async loadWorkspace(path43) {
|
|
3848
|
+
if (path43) {
|
|
3849
|
+
return this.workspaceFactory.load(path43);
|
|
3814
3850
|
}
|
|
3815
3851
|
return this.workspaceFactory.loadOrFind();
|
|
3816
3852
|
}
|
|
3817
3853
|
/**
|
|
3818
3854
|
* Create new workspace
|
|
3819
3855
|
*/
|
|
3820
|
-
async createWorkspace(
|
|
3821
|
-
return this.workspaceFactory.create(
|
|
3856
|
+
async createWorkspace(path43, options) {
|
|
3857
|
+
return this.workspaceFactory.create(path43, options);
|
|
3822
3858
|
}
|
|
3823
3859
|
/**
|
|
3824
3860
|
* Save workspace
|
|
@@ -3878,23 +3914,26 @@ var init_workspace3 = __esm({
|
|
|
3878
3914
|
project = workspace.findProject(projectNameOrPath);
|
|
3879
3915
|
if (!project) {
|
|
3880
3916
|
const projects = workspace.getProjects();
|
|
3881
|
-
const
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
const
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
}
|
|
3890
|
-
try {
|
|
3891
|
-
const realInputPath = await fs13.realpath(inputPath);
|
|
3892
|
-
const realProjectPath = await fs13.realpath(projectPath);
|
|
3893
|
-
if (realInputPath.startsWith(realProjectPath) || realProjectPath === realInputPath) {
|
|
3917
|
+
const fsRepo = this.workspaceFactory["fileSystemRepo"];
|
|
3918
|
+
if (!fsRepo) {
|
|
3919
|
+
project = void 0;
|
|
3920
|
+
} else {
|
|
3921
|
+
const inputPath = import_path4.default.resolve(projectNameOrPath);
|
|
3922
|
+
for (const p2 of projects) {
|
|
3923
|
+
const projectPath = p2.getPath();
|
|
3924
|
+
if (inputPath.startsWith(projectPath) || projectPath === inputPath) {
|
|
3894
3925
|
project = p2;
|
|
3895
3926
|
break;
|
|
3896
3927
|
}
|
|
3897
|
-
|
|
3928
|
+
try {
|
|
3929
|
+
const realInputPath = await fsRepo.resolvePath(inputPath);
|
|
3930
|
+
const realProjectPath = await fsRepo.resolvePath(projectPath);
|
|
3931
|
+
if (realInputPath.startsWith(realProjectPath) || realProjectPath === realInputPath) {
|
|
3932
|
+
project = p2;
|
|
3933
|
+
break;
|
|
3934
|
+
}
|
|
3935
|
+
} catch (error) {
|
|
3936
|
+
}
|
|
3898
3937
|
}
|
|
3899
3938
|
}
|
|
3900
3939
|
if (!project) {
|
|
@@ -3904,21 +3943,23 @@ var init_workspace3 = __esm({
|
|
|
3904
3943
|
} else {
|
|
3905
3944
|
const cwd = process.cwd();
|
|
3906
3945
|
const projects = workspace.getProjects();
|
|
3907
|
-
const
|
|
3908
|
-
|
|
3909
|
-
const
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
break;
|
|
3913
|
-
}
|
|
3914
|
-
try {
|
|
3915
|
-
const realCwd = await fs13.realpath(cwd);
|
|
3916
|
-
const realProjectPath = await fs13.realpath(projectPath);
|
|
3917
|
-
if (realCwd.startsWith(realProjectPath)) {
|
|
3946
|
+
const fsRepo = this.workspaceFactory["fileSystemRepo"];
|
|
3947
|
+
if (fsRepo) {
|
|
3948
|
+
for (const p2 of projects) {
|
|
3949
|
+
const projectPath = p2.getPath();
|
|
3950
|
+
if (cwd.startsWith(projectPath)) {
|
|
3918
3951
|
project = p2;
|
|
3919
3952
|
break;
|
|
3920
3953
|
}
|
|
3921
|
-
|
|
3954
|
+
try {
|
|
3955
|
+
const realCwd = await fsRepo.resolvePath(cwd);
|
|
3956
|
+
const realProjectPath = await fsRepo.resolvePath(projectPath);
|
|
3957
|
+
if (realCwd.startsWith(realProjectPath)) {
|
|
3958
|
+
project = p2;
|
|
3959
|
+
break;
|
|
3960
|
+
}
|
|
3961
|
+
} catch (error) {
|
|
3962
|
+
}
|
|
3922
3963
|
}
|
|
3923
3964
|
}
|
|
3924
3965
|
if (!project && projects.length === 1) {
|
|
@@ -4400,12 +4441,12 @@ var init_identity2 = __esm({
|
|
|
4400
4441
|
});
|
|
4401
4442
|
|
|
4402
4443
|
// internal/infrastructure/persistence/node-workspace-repository.ts
|
|
4403
|
-
var import_fs2,
|
|
4444
|
+
var import_fs2, import_path5, MDFRIDAY_DIR, WORKSPACE_FILE, PROJECTS_FILE, PROJECT_FILE, CONFIG_FILE, NodeWorkspaceRepository, NodeProjectRepository;
|
|
4404
4445
|
var init_node_workspace_repository = __esm({
|
|
4405
4446
|
"internal/infrastructure/persistence/node-workspace-repository.ts"() {
|
|
4406
4447
|
"use strict";
|
|
4407
4448
|
import_fs2 = require("fs");
|
|
4408
|
-
|
|
4449
|
+
import_path5 = __toESM(require("path"));
|
|
4409
4450
|
MDFRIDAY_DIR = ".mdfriday";
|
|
4410
4451
|
WORKSPACE_FILE = "workspace.json";
|
|
4411
4452
|
PROJECTS_FILE = "projects.json";
|
|
@@ -4414,7 +4455,7 @@ var init_node_workspace_repository = __esm({
|
|
|
4414
4455
|
NodeWorkspaceRepository = class {
|
|
4415
4456
|
async isWorkspace(workspacePath) {
|
|
4416
4457
|
try {
|
|
4417
|
-
const metadataPath =
|
|
4458
|
+
const metadataPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
4418
4459
|
await import_fs2.promises.access(metadataPath);
|
|
4419
4460
|
return true;
|
|
4420
4461
|
} catch {
|
|
@@ -4422,28 +4463,28 @@ var init_node_workspace_repository = __esm({
|
|
|
4422
4463
|
}
|
|
4423
4464
|
}
|
|
4424
4465
|
async initWorkspaceStructure(workspacePath, modulesDir, projectsDir) {
|
|
4425
|
-
const mdfridayDir =
|
|
4426
|
-
const modulesDirPath =
|
|
4427
|
-
const projectsDirPath =
|
|
4466
|
+
const mdfridayDir = import_path5.default.join(workspacePath, MDFRIDAY_DIR);
|
|
4467
|
+
const modulesDirPath = import_path5.default.join(workspacePath, modulesDir);
|
|
4468
|
+
const projectsDirPath = import_path5.default.join(workspacePath, projectsDir);
|
|
4428
4469
|
await import_fs2.promises.mkdir(mdfridayDir, { recursive: true });
|
|
4429
4470
|
await import_fs2.promises.mkdir(modulesDirPath, { recursive: true });
|
|
4430
4471
|
await import_fs2.promises.mkdir(projectsDirPath, { recursive: true });
|
|
4431
4472
|
}
|
|
4432
4473
|
async saveWorkspaceMetadata(workspacePath, metadata) {
|
|
4433
|
-
const metadataPath =
|
|
4474
|
+
const metadataPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
4434
4475
|
await import_fs2.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
4435
4476
|
}
|
|
4436
4477
|
async loadWorkspaceMetadata(workspacePath) {
|
|
4437
|
-
const metadataPath =
|
|
4478
|
+
const metadataPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
4438
4479
|
const content = await import_fs2.promises.readFile(metadataPath, "utf-8");
|
|
4439
4480
|
return JSON.parse(content);
|
|
4440
4481
|
}
|
|
4441
4482
|
async saveProjectRegistry(workspacePath, registry) {
|
|
4442
|
-
const registryPath =
|
|
4483
|
+
const registryPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, PROJECTS_FILE);
|
|
4443
4484
|
await import_fs2.promises.writeFile(registryPath, JSON.stringify(registry, null, 2));
|
|
4444
4485
|
}
|
|
4445
4486
|
async loadProjectRegistry(workspacePath) {
|
|
4446
|
-
const registryPath =
|
|
4487
|
+
const registryPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, PROJECTS_FILE);
|
|
4447
4488
|
const content = await import_fs2.promises.readFile(registryPath, "utf-8");
|
|
4448
4489
|
return JSON.parse(content);
|
|
4449
4490
|
}
|
|
@@ -4451,7 +4492,7 @@ var init_node_workspace_repository = __esm({
|
|
|
4451
4492
|
NodeProjectRepository = class {
|
|
4452
4493
|
async isProject(projectPath) {
|
|
4453
4494
|
try {
|
|
4454
|
-
const metadataPath =
|
|
4495
|
+
const metadataPath = import_path5.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
4455
4496
|
await import_fs2.promises.access(metadataPath);
|
|
4456
4497
|
return true;
|
|
4457
4498
|
} catch {
|
|
@@ -4459,26 +4500,26 @@ var init_node_workspace_repository = __esm({
|
|
|
4459
4500
|
}
|
|
4460
4501
|
}
|
|
4461
4502
|
async initProjectStructure(projectPath, contentDir, staticDir, publishDir) {
|
|
4462
|
-
const mdfridayDir =
|
|
4463
|
-
const contentDirPath =
|
|
4464
|
-
const staticDirPath =
|
|
4465
|
-
const publishDirPath =
|
|
4503
|
+
const mdfridayDir = import_path5.default.join(projectPath, MDFRIDAY_DIR);
|
|
4504
|
+
const contentDirPath = import_path5.default.join(projectPath, contentDir);
|
|
4505
|
+
const staticDirPath = import_path5.default.join(projectPath, staticDir);
|
|
4506
|
+
const publishDirPath = import_path5.default.join(projectPath, publishDir);
|
|
4466
4507
|
await import_fs2.promises.mkdir(mdfridayDir, { recursive: true });
|
|
4467
4508
|
await import_fs2.promises.mkdir(contentDirPath, { recursive: true });
|
|
4468
4509
|
await import_fs2.promises.mkdir(staticDirPath, { recursive: true });
|
|
4469
4510
|
await import_fs2.promises.mkdir(publishDirPath, { recursive: true });
|
|
4470
4511
|
}
|
|
4471
4512
|
async saveProjectMetadata(projectPath, metadata) {
|
|
4472
|
-
const metadataPath =
|
|
4513
|
+
const metadataPath = import_path5.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
4473
4514
|
await import_fs2.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
4474
4515
|
}
|
|
4475
4516
|
async loadProjectMetadata(projectPath) {
|
|
4476
|
-
const metadataPath =
|
|
4517
|
+
const metadataPath = import_path5.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
4477
4518
|
const content = await import_fs2.promises.readFile(metadataPath, "utf-8");
|
|
4478
4519
|
return JSON.parse(content);
|
|
4479
4520
|
}
|
|
4480
4521
|
async saveProjectConfig(projectPath, config) {
|
|
4481
|
-
const configPath =
|
|
4522
|
+
const configPath = import_path5.default.join(projectPath, CONFIG_FILE);
|
|
4482
4523
|
await import_fs2.promises.writeFile(configPath, JSON.stringify(config, null, 2));
|
|
4483
4524
|
}
|
|
4484
4525
|
async createSampleContent(contentPath, content) {
|
|
@@ -4495,20 +4536,20 @@ var init_node_workspace_repository = __esm({
|
|
|
4495
4536
|
});
|
|
4496
4537
|
|
|
4497
4538
|
// internal/infrastructure/persistence/node-snapshot-repository.ts
|
|
4498
|
-
var import_fs3,
|
|
4539
|
+
var import_fs3, import_path6, NodeSnapshotRepository;
|
|
4499
4540
|
var init_node_snapshot_repository = __esm({
|
|
4500
4541
|
"internal/infrastructure/persistence/node-snapshot-repository.ts"() {
|
|
4501
4542
|
"use strict";
|
|
4502
4543
|
import_fs3 = require("fs");
|
|
4503
|
-
|
|
4544
|
+
import_path6 = __toESM(require("path"));
|
|
4504
4545
|
NodeSnapshotRepository = class {
|
|
4505
4546
|
/**
|
|
4506
4547
|
* Create a snapshot by copying output directory to snapshot storage
|
|
4507
4548
|
*/
|
|
4508
4549
|
async createSnapshot(projectPath, snapshotId, outputDir) {
|
|
4509
|
-
const snapshotDir =
|
|
4550
|
+
const snapshotDir = import_path6.default.join(projectPath, ".mdfriday", "snapshots");
|
|
4510
4551
|
await import_fs3.promises.mkdir(snapshotDir, { recursive: true });
|
|
4511
|
-
const storageDir =
|
|
4552
|
+
const storageDir = import_path6.default.join(snapshotDir, snapshotId);
|
|
4512
4553
|
await import_fs3.promises.mkdir(storageDir, { recursive: true });
|
|
4513
4554
|
await this.copyDirectory(outputDir, storageDir);
|
|
4514
4555
|
const size = await this.getDirectorySize(storageDir);
|
|
@@ -4518,12 +4559,12 @@ var init_node_snapshot_repository = __esm({
|
|
|
4518
4559
|
name: snapshotId,
|
|
4519
4560
|
// Will be updated by service if custom name provided
|
|
4520
4561
|
timestamp: Date.now(),
|
|
4521
|
-
outputDir:
|
|
4522
|
-
storageDir:
|
|
4562
|
+
outputDir: import_path6.default.relative(projectPath, outputDir),
|
|
4563
|
+
storageDir: import_path6.default.relative(projectPath, storageDir),
|
|
4523
4564
|
size,
|
|
4524
4565
|
fileCount
|
|
4525
4566
|
};
|
|
4526
|
-
const metadataPath =
|
|
4567
|
+
const metadataPath = import_path6.default.join(snapshotDir, `${snapshotId}.json`);
|
|
4527
4568
|
await import_fs3.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
4528
4569
|
return metadata;
|
|
4529
4570
|
}
|
|
@@ -4531,7 +4572,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4531
4572
|
* List all snapshots for a project
|
|
4532
4573
|
*/
|
|
4533
4574
|
async listSnapshots(projectPath) {
|
|
4534
|
-
const snapshotDir =
|
|
4575
|
+
const snapshotDir = import_path6.default.join(projectPath, ".mdfriday", "snapshots");
|
|
4535
4576
|
try {
|
|
4536
4577
|
await import_fs3.promises.access(snapshotDir);
|
|
4537
4578
|
} catch {
|
|
@@ -4542,7 +4583,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4542
4583
|
const snapshots = [];
|
|
4543
4584
|
for (const file of jsonFiles) {
|
|
4544
4585
|
try {
|
|
4545
|
-
const content = await import_fs3.promises.readFile(
|
|
4586
|
+
const content = await import_fs3.promises.readFile(import_path6.default.join(snapshotDir, file), "utf-8");
|
|
4546
4587
|
snapshots.push(JSON.parse(content));
|
|
4547
4588
|
} catch {
|
|
4548
4589
|
}
|
|
@@ -4553,8 +4594,8 @@ var init_node_snapshot_repository = __esm({
|
|
|
4553
4594
|
* Get snapshot metadata
|
|
4554
4595
|
*/
|
|
4555
4596
|
async getSnapshot(projectPath, snapshotId) {
|
|
4556
|
-
const snapshotDir =
|
|
4557
|
-
const metadataPath =
|
|
4597
|
+
const snapshotDir = import_path6.default.join(projectPath, ".mdfriday", "snapshots");
|
|
4598
|
+
const metadataPath = import_path6.default.join(snapshotDir, `${snapshotId}.json`);
|
|
4558
4599
|
try {
|
|
4559
4600
|
const content = await import_fs3.promises.readFile(metadataPath, "utf-8");
|
|
4560
4601
|
const metadata = JSON.parse(content);
|
|
@@ -4574,7 +4615,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4574
4615
|
*/
|
|
4575
4616
|
async restoreSnapshot(projectPath, snapshotId, outputDir) {
|
|
4576
4617
|
const metadata = await this.getSnapshot(projectPath, snapshotId);
|
|
4577
|
-
const storageDir =
|
|
4618
|
+
const storageDir = import_path6.default.join(projectPath, metadata.storageDir);
|
|
4578
4619
|
try {
|
|
4579
4620
|
await import_fs3.promises.access(storageDir);
|
|
4580
4621
|
} catch {
|
|
@@ -4590,13 +4631,13 @@ var init_node_snapshot_repository = __esm({
|
|
|
4590
4631
|
* Delete a snapshot
|
|
4591
4632
|
*/
|
|
4592
4633
|
async deleteSnapshot(projectPath, snapshotId) {
|
|
4593
|
-
const snapshotDir =
|
|
4594
|
-
const metadataPath =
|
|
4634
|
+
const snapshotDir = import_path6.default.join(projectPath, ".mdfriday", "snapshots");
|
|
4635
|
+
const metadataPath = import_path6.default.join(snapshotDir, `${snapshotId}.json`);
|
|
4595
4636
|
try {
|
|
4596
4637
|
const content = await import_fs3.promises.readFile(metadataPath, "utf-8");
|
|
4597
4638
|
const metadata = JSON.parse(content);
|
|
4598
4639
|
if (metadata.storageDir) {
|
|
4599
|
-
const storageDir =
|
|
4640
|
+
const storageDir = import_path6.default.join(projectPath, metadata.storageDir);
|
|
4600
4641
|
try {
|
|
4601
4642
|
await import_fs3.promises.rm(storageDir, { recursive: true, force: true });
|
|
4602
4643
|
} catch {
|
|
@@ -4618,8 +4659,8 @@ var init_node_snapshot_repository = __esm({
|
|
|
4618
4659
|
const entries = await import_fs3.promises.readdir(src, { withFileTypes: true });
|
|
4619
4660
|
await Promise.all(
|
|
4620
4661
|
entries.map(async (entry) => {
|
|
4621
|
-
const srcPath =
|
|
4622
|
-
const destPath =
|
|
4662
|
+
const srcPath = import_path6.default.join(src, entry.name);
|
|
4663
|
+
const destPath = import_path6.default.join(dest, entry.name);
|
|
4623
4664
|
if (entry.isDirectory()) {
|
|
4624
4665
|
await this.copyDirectory(srcPath, destPath);
|
|
4625
4666
|
} else {
|
|
@@ -4635,7 +4676,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4635
4676
|
let size = 0;
|
|
4636
4677
|
const entries = await import_fs3.promises.readdir(dir2, { withFileTypes: true });
|
|
4637
4678
|
for (const entry of entries) {
|
|
4638
|
-
const entryPath =
|
|
4679
|
+
const entryPath = import_path6.default.join(dir2, entry.name);
|
|
4639
4680
|
if (entry.isDirectory()) {
|
|
4640
4681
|
size += await this.getDirectorySize(entryPath);
|
|
4641
4682
|
} else {
|
|
@@ -4652,7 +4693,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4652
4693
|
let count = 0;
|
|
4653
4694
|
const entries = await import_fs3.promises.readdir(dir2, { withFileTypes: true });
|
|
4654
4695
|
for (const entry of entries) {
|
|
4655
|
-
const entryPath =
|
|
4696
|
+
const entryPath = import_path6.default.join(dir2, entry.name);
|
|
4656
4697
|
if (entry.isDirectory()) {
|
|
4657
4698
|
count += await this.countFiles(entryPath);
|
|
4658
4699
|
} else {
|
|
@@ -4670,12 +4711,12 @@ function mapLanguageCode(code) {
|
|
|
4670
4711
|
const normalized = code.toLowerCase().trim();
|
|
4671
4712
|
return LANGUAGE_CODE_MAP[normalized] || normalized;
|
|
4672
4713
|
}
|
|
4673
|
-
var import_fs4,
|
|
4714
|
+
var import_fs4, import_path7, log8, LANGUAGE_CODE_MAP, NodeFileSystemRepository;
|
|
4674
4715
|
var init_node_file_system = __esm({
|
|
4675
4716
|
"internal/infrastructure/persistence/node-file-system.ts"() {
|
|
4676
4717
|
"use strict";
|
|
4677
4718
|
import_fs4 = require("fs");
|
|
4678
|
-
|
|
4719
|
+
import_path7 = __toESM(require("path"));
|
|
4679
4720
|
init_log();
|
|
4680
4721
|
log8 = getDomainLogger("node-fs", { component: "infrastructure" });
|
|
4681
4722
|
LANGUAGE_CODE_MAP = {
|
|
@@ -4724,7 +4765,7 @@ var init_node_file_system = __esm({
|
|
|
4724
4765
|
try {
|
|
4725
4766
|
const entries = await import_fs4.promises.readdir(dirPath, { withFileTypes: true });
|
|
4726
4767
|
return entries.map((entry) => ({
|
|
4727
|
-
path:
|
|
4768
|
+
path: import_path7.default.join(dirPath, entry.name),
|
|
4728
4769
|
name: entry.name,
|
|
4729
4770
|
isDirectory: entry.isDirectory(),
|
|
4730
4771
|
isFile: entry.isFile()
|
|
@@ -4775,7 +4816,7 @@ var init_node_file_system = __esm({
|
|
|
4775
4816
|
if (a.weight !== b.weight) {
|
|
4776
4817
|
return a.weight - b.weight;
|
|
4777
4818
|
}
|
|
4778
|
-
return
|
|
4819
|
+
return import_path7.default.basename(a.path).localeCompare(import_path7.default.basename(b.path));
|
|
4779
4820
|
});
|
|
4780
4821
|
const isStructured = contentFolders.length > 0;
|
|
4781
4822
|
log8.debug(`Scanned folder structure: ${dirPath}`, {
|
|
@@ -4919,7 +4960,7 @@ var init_node_file_system = __esm({
|
|
|
4919
4960
|
}
|
|
4920
4961
|
async copyFile(source, target) {
|
|
4921
4962
|
try {
|
|
4922
|
-
const targetDir =
|
|
4963
|
+
const targetDir = import_path7.default.dirname(target);
|
|
4923
4964
|
if (!await this.exists(targetDir)) {
|
|
4924
4965
|
await import_fs4.promises.mkdir(targetDir, { recursive: true });
|
|
4925
4966
|
}
|
|
@@ -4930,17 +4971,54 @@ var init_node_file_system = __esm({
|
|
|
4930
4971
|
throw error;
|
|
4931
4972
|
}
|
|
4932
4973
|
}
|
|
4974
|
+
async readFile(filePath, encoding = "utf-8") {
|
|
4975
|
+
try {
|
|
4976
|
+
return await import_fs4.promises.readFile(filePath, encoding);
|
|
4977
|
+
} catch (error) {
|
|
4978
|
+
log8.error(`Failed to read file: ${filePath}`, error);
|
|
4979
|
+
throw error;
|
|
4980
|
+
}
|
|
4981
|
+
}
|
|
4982
|
+
async writeFile(filePath, content, encoding = "utf-8") {
|
|
4983
|
+
try {
|
|
4984
|
+
const dir2 = import_path7.default.dirname(filePath);
|
|
4985
|
+
if (!await this.exists(dir2)) {
|
|
4986
|
+
await import_fs4.promises.mkdir(dir2, { recursive: true });
|
|
4987
|
+
}
|
|
4988
|
+
await import_fs4.promises.writeFile(filePath, content, encoding);
|
|
4989
|
+
log8.debug(`Wrote file: ${filePath}`);
|
|
4990
|
+
} catch (error) {
|
|
4991
|
+
log8.error(`Failed to write file: ${filePath}`, error);
|
|
4992
|
+
throw error;
|
|
4993
|
+
}
|
|
4994
|
+
}
|
|
4995
|
+
async unlink(filePath) {
|
|
4996
|
+
try {
|
|
4997
|
+
await import_fs4.promises.unlink(filePath);
|
|
4998
|
+
log8.debug(`Deleted file: ${filePath}`);
|
|
4999
|
+
} catch (error) {
|
|
5000
|
+
log8.error(`Failed to delete file: ${filePath}`, error);
|
|
5001
|
+
throw error;
|
|
5002
|
+
}
|
|
5003
|
+
}
|
|
5004
|
+
async access(filePath) {
|
|
5005
|
+
try {
|
|
5006
|
+
await import_fs4.promises.access(filePath);
|
|
5007
|
+
} catch (error) {
|
|
5008
|
+
throw new Error(`Cannot access path: ${filePath}`);
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
4933
5011
|
async resolvePath(filePath) {
|
|
4934
|
-
return
|
|
5012
|
+
return import_path7.default.resolve(filePath);
|
|
4935
5013
|
}
|
|
4936
5014
|
basename(filePath) {
|
|
4937
|
-
return
|
|
5015
|
+
return import_path7.default.basename(filePath);
|
|
4938
5016
|
}
|
|
4939
5017
|
dirname(filePath) {
|
|
4940
|
-
return
|
|
5018
|
+
return import_path7.default.dirname(filePath);
|
|
4941
5019
|
}
|
|
4942
5020
|
join(...paths) {
|
|
4943
|
-
return
|
|
5021
|
+
return import_path7.default.join(...paths);
|
|
4944
5022
|
}
|
|
4945
5023
|
};
|
|
4946
5024
|
}
|
|
@@ -5154,10 +5232,10 @@ var init_publish_manifest = __esm({
|
|
|
5154
5232
|
*/
|
|
5155
5233
|
getChangedFiles(newManifest) {
|
|
5156
5234
|
const changedFiles = [];
|
|
5157
|
-
for (const [
|
|
5158
|
-
const oldEntry = this.files.get(
|
|
5235
|
+
for (const [path43, newEntry] of newManifest.files.entries()) {
|
|
5236
|
+
const oldEntry = this.files.get(path43);
|
|
5159
5237
|
if (!oldEntry || oldEntry.hash !== newEntry.hash) {
|
|
5160
|
-
changedFiles.push(
|
|
5238
|
+
changedFiles.push(path43);
|
|
5161
5239
|
}
|
|
5162
5240
|
}
|
|
5163
5241
|
return changedFiles;
|
|
@@ -5168,9 +5246,9 @@ var init_publish_manifest = __esm({
|
|
|
5168
5246
|
*/
|
|
5169
5247
|
getDeletedFiles(newManifest) {
|
|
5170
5248
|
const deletedFiles = [];
|
|
5171
|
-
for (const
|
|
5172
|
-
if (!newManifest.files.has(
|
|
5173
|
-
deletedFiles.push(
|
|
5249
|
+
for (const path43 of this.files.keys()) {
|
|
5250
|
+
if (!newManifest.files.has(path43)) {
|
|
5251
|
+
deletedFiles.push(path43);
|
|
5174
5252
|
}
|
|
5175
5253
|
}
|
|
5176
5254
|
return deletedFiles;
|
|
@@ -5180,8 +5258,8 @@ var init_publish_manifest = __esm({
|
|
|
5180
5258
|
*/
|
|
5181
5259
|
toJSON() {
|
|
5182
5260
|
const filesObj = {};
|
|
5183
|
-
for (const [
|
|
5184
|
-
filesObj[
|
|
5261
|
+
for (const [path43, entry] of this.files.entries()) {
|
|
5262
|
+
filesObj[path43] = entry;
|
|
5185
5263
|
}
|
|
5186
5264
|
return {
|
|
5187
5265
|
projectId: this.projectId,
|
|
@@ -6773,8 +6851,8 @@ var require_Client = __commonJS({
|
|
|
6773
6851
|
/**
|
|
6774
6852
|
* Set the working directory.
|
|
6775
6853
|
*/
|
|
6776
|
-
async cd(
|
|
6777
|
-
const validPath = await this.protectWhitespace(
|
|
6854
|
+
async cd(path43) {
|
|
6855
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6778
6856
|
return this.send("CWD " + validPath);
|
|
6779
6857
|
}
|
|
6780
6858
|
/**
|
|
@@ -6787,8 +6865,8 @@ var require_Client = __commonJS({
|
|
|
6787
6865
|
* Get the last modified time of a file. This is not supported by every FTP server, in which case
|
|
6788
6866
|
* calling this method will throw an exception.
|
|
6789
6867
|
*/
|
|
6790
|
-
async lastMod(
|
|
6791
|
-
const validPath = await this.protectWhitespace(
|
|
6868
|
+
async lastMod(path43) {
|
|
6869
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6792
6870
|
const res = await this.send(`MDTM ${validPath}`);
|
|
6793
6871
|
const date = res.message.slice(4);
|
|
6794
6872
|
return (0, parseListMLSD_1.parseMLSxDate)(date);
|
|
@@ -6796,8 +6874,8 @@ var require_Client = __commonJS({
|
|
|
6796
6874
|
/**
|
|
6797
6875
|
* Get the size of a file.
|
|
6798
6876
|
*/
|
|
6799
|
-
async size(
|
|
6800
|
-
const validPath = await this.protectWhitespace(
|
|
6877
|
+
async size(path43) {
|
|
6878
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6801
6879
|
const command = `SIZE ${validPath}`;
|
|
6802
6880
|
const res = await this.send(command);
|
|
6803
6881
|
const size = parseInt(res.message.slice(4), 10);
|
|
@@ -6824,8 +6902,8 @@ var require_Client = __commonJS({
|
|
|
6824
6902
|
* You can ignore FTP error return codes which won't throw an exception if e.g.
|
|
6825
6903
|
* the file doesn't exist.
|
|
6826
6904
|
*/
|
|
6827
|
-
async remove(
|
|
6828
|
-
const validPath = await this.protectWhitespace(
|
|
6905
|
+
async remove(path43, ignoreErrorCodes = false) {
|
|
6906
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6829
6907
|
if (ignoreErrorCodes) {
|
|
6830
6908
|
return this.sendIgnoringError(`DELE ${validPath}`);
|
|
6831
6909
|
}
|
|
@@ -6979,8 +7057,8 @@ var require_Client = __commonJS({
|
|
|
6979
7057
|
*
|
|
6980
7058
|
* @param [path] Path to remote file or directory.
|
|
6981
7059
|
*/
|
|
6982
|
-
async list(
|
|
6983
|
-
const validPath = await this.protectWhitespace(
|
|
7060
|
+
async list(path43 = "") {
|
|
7061
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6984
7062
|
let lastError;
|
|
6985
7063
|
for (const candidate of this.availableListCommands) {
|
|
6986
7064
|
const command = validPath === "" ? candidate : `${candidate} ${validPath}`;
|
|
@@ -7150,21 +7228,21 @@ var require_Client = __commonJS({
|
|
|
7150
7228
|
/**
|
|
7151
7229
|
* Remove an empty directory, will fail if not empty.
|
|
7152
7230
|
*/
|
|
7153
|
-
async removeEmptyDir(
|
|
7154
|
-
const validPath = await this.protectWhitespace(
|
|
7231
|
+
async removeEmptyDir(path43) {
|
|
7232
|
+
const validPath = await this.protectWhitespace(path43);
|
|
7155
7233
|
return this.send(`RMD ${validPath}`);
|
|
7156
7234
|
}
|
|
7157
7235
|
/**
|
|
7158
7236
|
* FTP servers can't handle filenames that have leading whitespace. This method transforms
|
|
7159
7237
|
* a given path to fix that issue for most cases.
|
|
7160
7238
|
*/
|
|
7161
|
-
async protectWhitespace(
|
|
7162
|
-
if (!
|
|
7163
|
-
return
|
|
7239
|
+
async protectWhitespace(path43) {
|
|
7240
|
+
if (!path43.startsWith(" ")) {
|
|
7241
|
+
return path43;
|
|
7164
7242
|
}
|
|
7165
7243
|
const pwd = await this.pwd();
|
|
7166
7244
|
const absolutePathPrefix = pwd.endsWith("/") ? pwd : pwd + "/";
|
|
7167
|
-
return absolutePathPrefix +
|
|
7245
|
+
return absolutePathPrefix + path43;
|
|
7168
7246
|
}
|
|
7169
7247
|
async _exitAtCurrentDirectory(func) {
|
|
7170
7248
|
const userDir = await this.pwd();
|
|
@@ -7241,11 +7319,11 @@ var require_Client = __commonJS({
|
|
|
7241
7319
|
}
|
|
7242
7320
|
};
|
|
7243
7321
|
exports2.Client = Client2;
|
|
7244
|
-
async function ensureLocalDirectory(
|
|
7322
|
+
async function ensureLocalDirectory(path43) {
|
|
7245
7323
|
try {
|
|
7246
|
-
await fsStat(
|
|
7324
|
+
await fsStat(path43);
|
|
7247
7325
|
} catch (_a2) {
|
|
7248
|
-
await fsMkDir(
|
|
7326
|
+
await fsMkDir(path43, { recursive: true });
|
|
7249
7327
|
}
|
|
7250
7328
|
}
|
|
7251
7329
|
async function ignoreError(func) {
|
|
@@ -7308,13 +7386,13 @@ var require_dist = __commonJS({
|
|
|
7308
7386
|
});
|
|
7309
7387
|
|
|
7310
7388
|
// internal/domain/publish/value-object/ftp-publisher.ts
|
|
7311
|
-
var ftp,
|
|
7389
|
+
var ftp, import_path8, import_fs5, log10, FtpPublisher;
|
|
7312
7390
|
var init_ftp_publisher = __esm({
|
|
7313
7391
|
"internal/domain/publish/value-object/ftp-publisher.ts"() {
|
|
7314
7392
|
"use strict";
|
|
7315
7393
|
init_log();
|
|
7316
7394
|
ftp = __toESM(require_dist());
|
|
7317
|
-
|
|
7395
|
+
import_path8 = __toESM(require("path"));
|
|
7318
7396
|
import_fs5 = require("fs");
|
|
7319
7397
|
log10 = getDomainLogger("ftp-publisher", { component: "domain" });
|
|
7320
7398
|
FtpPublisher = class {
|
|
@@ -7362,10 +7440,10 @@ var init_ftp_publisher = __esm({
|
|
|
7362
7440
|
});
|
|
7363
7441
|
const createdDirs = /* @__PURE__ */ new Set();
|
|
7364
7442
|
for (const relativePath of changedFiles) {
|
|
7365
|
-
const localPath =
|
|
7443
|
+
const localPath = import_path8.default.join(sourceDir, relativePath);
|
|
7366
7444
|
const remoteFilePath = this.config.remotePath && this.config.remotePath !== "/" ? `${this.config.remotePath}/${relativePath}`.replace(/\\/g, "/") : relativePath.replace(/\\/g, "/");
|
|
7367
7445
|
try {
|
|
7368
|
-
const remoteDir =
|
|
7446
|
+
const remoteDir = import_path8.default.dirname(remoteFilePath).replace(/\\/g, "/");
|
|
7369
7447
|
if (remoteDir && remoteDir !== "." && remoteDir !== "/") {
|
|
7370
7448
|
if (!createdDirs.has(remoteDir)) {
|
|
7371
7449
|
try {
|
|
@@ -7596,12 +7674,12 @@ var init_ftp_publisher = __esm({
|
|
|
7596
7674
|
});
|
|
7597
7675
|
|
|
7598
7676
|
// internal/domain/publish/value-object/netlify-publisher.ts
|
|
7599
|
-
var
|
|
7677
|
+
var import_path9, import_fs6, log11, NetlifyPublisher;
|
|
7600
7678
|
var init_netlify_publisher = __esm({
|
|
7601
7679
|
"internal/domain/publish/value-object/netlify-publisher.ts"() {
|
|
7602
7680
|
"use strict";
|
|
7603
7681
|
init_log();
|
|
7604
|
-
|
|
7682
|
+
import_path9 = __toESM(require("path"));
|
|
7605
7683
|
import_fs6 = require("fs");
|
|
7606
7684
|
log11 = getDomainLogger("netlify-publisher", { component: "domain" });
|
|
7607
7685
|
NetlifyPublisher = class {
|
|
@@ -7863,7 +7941,7 @@ var init_netlify_publisher = __esm({
|
|
|
7863
7941
|
log11.warn(`File not found in manifest: ${filePath}`);
|
|
7864
7942
|
continue;
|
|
7865
7943
|
}
|
|
7866
|
-
const localFilePath =
|
|
7944
|
+
const localFilePath = import_path9.default.join(sourceDir, filePath);
|
|
7867
7945
|
try {
|
|
7868
7946
|
const fileContent = await import_fs6.promises.readFile(localFilePath);
|
|
7869
7947
|
await this.uploadFileWithRetry(deployId, filePath, fileContent, fileEntry.hash);
|
|
@@ -8007,12 +8085,12 @@ var mdfriday_publisher_exports = {};
|
|
|
8007
8085
|
__export(mdfriday_publisher_exports, {
|
|
8008
8086
|
MDFridayPublisher: () => MDFridayPublisher
|
|
8009
8087
|
});
|
|
8010
|
-
var
|
|
8088
|
+
var import_path10, import_fs7, log12, MDFridayPublisher;
|
|
8011
8089
|
var init_mdfriday_publisher = __esm({
|
|
8012
8090
|
"internal/domain/publish/value-object/mdfriday-publisher.ts"() {
|
|
8013
8091
|
"use strict";
|
|
8014
8092
|
init_log();
|
|
8015
|
-
|
|
8093
|
+
import_path10 = __toESM(require("path"));
|
|
8016
8094
|
import_fs7 = require("fs");
|
|
8017
8095
|
log12 = getDomainLogger("mdfriday-publisher", { component: "domain" });
|
|
8018
8096
|
MDFridayPublisher = class {
|
|
@@ -8165,7 +8243,7 @@ var init_mdfriday_publisher = __esm({
|
|
|
8165
8243
|
const addDirectoryToZip = async (dirPath, zipFolder) => {
|
|
8166
8244
|
const items = await import_fs7.promises.readdir(dirPath, { withFileTypes: true });
|
|
8167
8245
|
for (const item of items) {
|
|
8168
|
-
const itemPath =
|
|
8246
|
+
const itemPath = import_path10.default.join(dirPath, item.name);
|
|
8169
8247
|
if (item.isDirectory()) {
|
|
8170
8248
|
const subFolder = zipFolder.folder(item.name);
|
|
8171
8249
|
if (subFolder) {
|
|
@@ -8414,13 +8492,13 @@ var init_publish = __esm({
|
|
|
8414
8492
|
});
|
|
8415
8493
|
|
|
8416
8494
|
// internal/infrastructure/persistence/node-manifest-repository.ts
|
|
8417
|
-
var
|
|
8495
|
+
var import_path11, import_fs8, import_crypto, log14, NodeManifestRepository;
|
|
8418
8496
|
var init_node_manifest_repository = __esm({
|
|
8419
8497
|
"internal/infrastructure/persistence/node-manifest-repository.ts"() {
|
|
8420
8498
|
"use strict";
|
|
8421
8499
|
init_publish();
|
|
8422
8500
|
init_log();
|
|
8423
|
-
|
|
8501
|
+
import_path11 = __toESM(require("path"));
|
|
8424
8502
|
import_fs8 = require("fs");
|
|
8425
8503
|
import_crypto = __toESM(require("crypto"));
|
|
8426
8504
|
log14 = getDomainLogger("node-manifest-repo", { component: "infrastructure" });
|
|
@@ -8447,7 +8525,7 @@ var init_node_manifest_repository = __esm({
|
|
|
8447
8525
|
* Save manifest to file
|
|
8448
8526
|
*/
|
|
8449
8527
|
async saveManifest(projectPath, manifest) {
|
|
8450
|
-
const manifestDir =
|
|
8528
|
+
const manifestDir = import_path11.default.join(projectPath, ".mdfriday");
|
|
8451
8529
|
await import_fs8.promises.mkdir(manifestDir, { recursive: true });
|
|
8452
8530
|
const manifestPath = this.getManifestPath(projectPath, manifest.getPublishMethod());
|
|
8453
8531
|
await import_fs8.promises.writeFile(
|
|
@@ -8496,7 +8574,7 @@ var init_node_manifest_repository = __esm({
|
|
|
8496
8574
|
* Get manifest file path
|
|
8497
8575
|
*/
|
|
8498
8576
|
getManifestPath(projectPath, publishMethod) {
|
|
8499
|
-
return
|
|
8577
|
+
return import_path11.default.join(projectPath, ".mdfriday", `manifest-${publishMethod}.json`);
|
|
8500
8578
|
}
|
|
8501
8579
|
/**
|
|
8502
8580
|
* Recursively scan directory and collect file info
|
|
@@ -8504,8 +8582,8 @@ var init_node_manifest_repository = __esm({
|
|
|
8504
8582
|
async scanDirectory(currentPath, relativePath, files, hashAlgorithm = "md5") {
|
|
8505
8583
|
const items = await import_fs8.promises.readdir(currentPath, { withFileTypes: true });
|
|
8506
8584
|
for (const item of items) {
|
|
8507
|
-
const itemPath =
|
|
8508
|
-
const itemRelativePath = relativePath ?
|
|
8585
|
+
const itemPath = import_path11.default.join(currentPath, item.name);
|
|
8586
|
+
const itemRelativePath = relativePath ? import_path11.default.join(relativePath, item.name) : item.name;
|
|
8509
8587
|
if (item.isDirectory()) {
|
|
8510
8588
|
await this.scanDirectory(itemPath, itemRelativePath, files, hashAlgorithm);
|
|
8511
8589
|
} else if (item.isFile()) {
|
|
@@ -9435,8 +9513,8 @@ var init_module2 = __esm({
|
|
|
9435
9513
|
/**
|
|
9436
9514
|
* Find import by path
|
|
9437
9515
|
*/
|
|
9438
|
-
findImport(
|
|
9439
|
-
return this.moduleConfig.imports.find((imp) => imp.path ===
|
|
9516
|
+
findImport(path43) {
|
|
9517
|
+
return this.moduleConfig.imports.find((imp) => imp.path === path43);
|
|
9440
9518
|
}
|
|
9441
9519
|
/**
|
|
9442
9520
|
* Find mount by source
|
|
@@ -10685,11 +10763,11 @@ var init_markdown2 = __esm({
|
|
|
10685
10763
|
function newDir(workingDir, themesDir, publishDir) {
|
|
10686
10764
|
return new Dir(workingDir, themesDir, publishDir);
|
|
10687
10765
|
}
|
|
10688
|
-
var
|
|
10766
|
+
var import_path12, DEFAULT_PUBLISH_DIR, Dir;
|
|
10689
10767
|
var init_dir = __esm({
|
|
10690
10768
|
"internal/domain/config/entity/dir.ts"() {
|
|
10691
10769
|
"use strict";
|
|
10692
|
-
|
|
10770
|
+
import_path12 = __toESM(require("path"));
|
|
10693
10771
|
DEFAULT_PUBLISH_DIR = "public";
|
|
10694
10772
|
Dir = class {
|
|
10695
10773
|
workingDir;
|
|
@@ -10701,16 +10779,16 @@ var init_dir = __esm({
|
|
|
10701
10779
|
this.publishDir = publishDir;
|
|
10702
10780
|
}
|
|
10703
10781
|
getWorkingDir() {
|
|
10704
|
-
return
|
|
10782
|
+
return import_path12.default.resolve(this.workingDir);
|
|
10705
10783
|
}
|
|
10706
10784
|
getThemesDir() {
|
|
10707
|
-
return
|
|
10785
|
+
return import_path12.default.resolve(this.themesDir);
|
|
10708
10786
|
}
|
|
10709
10787
|
getThemesCacheDir() {
|
|
10710
|
-
return
|
|
10788
|
+
return import_path12.default.resolve(this.themesDir, ".cache");
|
|
10711
10789
|
}
|
|
10712
10790
|
getPublishDir() {
|
|
10713
|
-
return
|
|
10791
|
+
return import_path12.default.resolve(this.publishDir);
|
|
10714
10792
|
}
|
|
10715
10793
|
};
|
|
10716
10794
|
}
|
|
@@ -10900,12 +10978,12 @@ var init_provider = __esm({
|
|
|
10900
10978
|
});
|
|
10901
10979
|
|
|
10902
10980
|
// internal/domain/config/factory/loader.ts
|
|
10903
|
-
var
|
|
10981
|
+
var path13, NO_CONFIG_FILE_ERR_INFO, ConfigLoader;
|
|
10904
10982
|
var init_loader = __esm({
|
|
10905
10983
|
"internal/domain/config/factory/loader.ts"() {
|
|
10906
10984
|
"use strict";
|
|
10907
10985
|
init_provider();
|
|
10908
|
-
|
|
10986
|
+
path13 = __toESM(require("path"));
|
|
10909
10987
|
NO_CONFIG_FILE_ERR_INFO = "Unable to locate config file or config directory.";
|
|
10910
10988
|
ConfigLoader = class {
|
|
10911
10989
|
cfg;
|
|
@@ -10944,13 +11022,13 @@ var init_loader = __esm({
|
|
|
10944
11022
|
async loadProvider(configName) {
|
|
10945
11023
|
const baseDir = this.baseDirs.workingDir;
|
|
10946
11024
|
let baseFilename;
|
|
10947
|
-
if (
|
|
11025
|
+
if (path13.isAbsolute(configName)) {
|
|
10948
11026
|
baseFilename = configName;
|
|
10949
11027
|
} else {
|
|
10950
|
-
baseFilename =
|
|
11028
|
+
baseFilename = path13.join(baseDir, configName);
|
|
10951
11029
|
}
|
|
10952
11030
|
let filename = "";
|
|
10953
|
-
if (
|
|
11031
|
+
if (path13.extname(configName) !== "") {
|
|
10954
11032
|
const exists = await this.fileExists(baseFilename);
|
|
10955
11033
|
if (exists) {
|
|
10956
11034
|
filename = baseFilename;
|
|
@@ -11089,9 +11167,9 @@ var init_sourcedescriptor = __esm({
|
|
|
11089
11167
|
|
|
11090
11168
|
// internal/domain/config/factory/config.ts
|
|
11091
11169
|
async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir, params = {}) {
|
|
11092
|
-
const cleanWorkingDir =
|
|
11093
|
-
const cleanModulesDir =
|
|
11094
|
-
const cleanPublishDir =
|
|
11170
|
+
const cleanWorkingDir = path14.resolve(workingDir);
|
|
11171
|
+
const cleanModulesDir = path14.resolve(modulesDir);
|
|
11172
|
+
const cleanPublishDir = path14.resolve(DEFAULT_PUBLISH_DIR);
|
|
11095
11173
|
const baseDirs = {
|
|
11096
11174
|
workingDir: cleanWorkingDir,
|
|
11097
11175
|
modulesDir: cleanModulesDir,
|
|
@@ -11108,7 +11186,7 @@ async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir
|
|
|
11108
11186
|
for (const [key2, value] of Object.entries(params)) {
|
|
11109
11187
|
provider.set(key2, value);
|
|
11110
11188
|
}
|
|
11111
|
-
const absPublishDir =
|
|
11189
|
+
const absPublishDir = path14.resolve(provider.get("publishDir") || DEFAULT_PUBLISH_DIR);
|
|
11112
11190
|
await fs13.mkdirAll(absPublishDir, 511);
|
|
11113
11191
|
return newConfig(
|
|
11114
11192
|
fs13,
|
|
@@ -11131,15 +11209,15 @@ async function getCacheDir(fs13, cacheDir) {
|
|
|
11131
11209
|
return cacheDir;
|
|
11132
11210
|
}
|
|
11133
11211
|
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
11134
|
-
const defaultCacheDir =
|
|
11212
|
+
const defaultCacheDir = path14.join(homeDir, ".cache", "mdf");
|
|
11135
11213
|
try {
|
|
11136
11214
|
await fs13.mkdirAll(defaultCacheDir, 493);
|
|
11137
11215
|
return defaultCacheDir;
|
|
11138
11216
|
} catch {
|
|
11139
|
-
return
|
|
11217
|
+
return path14.join("/tmp", "hugo-cache");
|
|
11140
11218
|
}
|
|
11141
11219
|
}
|
|
11142
|
-
var
|
|
11220
|
+
var path14;
|
|
11143
11221
|
var init_config2 = __esm({
|
|
11144
11222
|
"internal/domain/config/factory/config.ts"() {
|
|
11145
11223
|
"use strict";
|
|
@@ -11154,7 +11232,7 @@ var init_config2 = __esm({
|
|
|
11154
11232
|
init_markdown2();
|
|
11155
11233
|
init_loader();
|
|
11156
11234
|
init_sourcedescriptor();
|
|
11157
|
-
|
|
11235
|
+
path14 = __toESM(require("path"));
|
|
11158
11236
|
}
|
|
11159
11237
|
});
|
|
11160
11238
|
|
|
@@ -11226,11 +11304,11 @@ function createDefaultMounts(componentFolders) {
|
|
|
11226
11304
|
(folder) => new Mount(folder, folder)
|
|
11227
11305
|
);
|
|
11228
11306
|
}
|
|
11229
|
-
var
|
|
11307
|
+
var path15, Mount;
|
|
11230
11308
|
var init_mount = __esm({
|
|
11231
11309
|
"internal/domain/module/vo/mount.ts"() {
|
|
11232
11310
|
"use strict";
|
|
11233
|
-
|
|
11311
|
+
path15 = __toESM(require("path"));
|
|
11234
11312
|
Mount = class _Mount {
|
|
11235
11313
|
constructor(sourcePath, targetPath, language2 = "") {
|
|
11236
11314
|
this.sourcePath = sourcePath;
|
|
@@ -11265,16 +11343,16 @@ var init_mount = __esm({
|
|
|
11265
11343
|
* Get component name from target path
|
|
11266
11344
|
*/
|
|
11267
11345
|
component() {
|
|
11268
|
-
const parts = this.targetPath.split(
|
|
11346
|
+
const parts = this.targetPath.split(path15.sep);
|
|
11269
11347
|
return parts[0] || "";
|
|
11270
11348
|
}
|
|
11271
11349
|
/**
|
|
11272
11350
|
* Get component and name from target path
|
|
11273
11351
|
*/
|
|
11274
11352
|
componentAndName() {
|
|
11275
|
-
const parts = this.targetPath.split(
|
|
11353
|
+
const parts = this.targetPath.split(path15.sep);
|
|
11276
11354
|
const component = parts[0] || "";
|
|
11277
|
-
const name = parts.slice(1).join(
|
|
11355
|
+
const name = parts.slice(1).join(path15.sep);
|
|
11278
11356
|
return { component, name };
|
|
11279
11357
|
}
|
|
11280
11358
|
/**
|
|
@@ -11319,12 +11397,12 @@ function newHttpClient(fs13, timeout, headers, customClient) {
|
|
|
11319
11397
|
}
|
|
11320
11398
|
return new NodeHttpClient2(fs13, timeout, headers);
|
|
11321
11399
|
}
|
|
11322
|
-
var
|
|
11400
|
+
var path16, http, https, log20, NodeHttpClient2;
|
|
11323
11401
|
var init_httpclient = __esm({
|
|
11324
11402
|
"internal/domain/module/vo/httpclient.ts"() {
|
|
11325
11403
|
"use strict";
|
|
11326
11404
|
init_type5();
|
|
11327
|
-
|
|
11405
|
+
path16 = __toESM(require("path"));
|
|
11328
11406
|
http = __toESM(require("http"));
|
|
11329
11407
|
https = __toESM(require("https"));
|
|
11330
11408
|
init_log();
|
|
@@ -11375,7 +11453,7 @@ var init_httpclient = __esm({
|
|
|
11375
11453
|
let lastProgressTime = Date.now();
|
|
11376
11454
|
let lastLoggedPercentage = -1;
|
|
11377
11455
|
try {
|
|
11378
|
-
const targetDir =
|
|
11456
|
+
const targetDir = path16.dirname(targetPath);
|
|
11379
11457
|
await this.fs.mkdirAll(targetDir, 493);
|
|
11380
11458
|
const file = await this.fs.create(targetPath);
|
|
11381
11459
|
const chunks = [];
|
|
@@ -11526,14 +11604,14 @@ function newZipExtractor(fs13, environment = "node") {
|
|
|
11526
11604
|
throw new Error(`Unsupported environment: ${environment}`);
|
|
11527
11605
|
}
|
|
11528
11606
|
}
|
|
11529
|
-
var import_jszip,
|
|
11607
|
+
var import_jszip, path17, log21, JsZipExtractor, WebZipExtractor;
|
|
11530
11608
|
var init_zipextractor = __esm({
|
|
11531
11609
|
"internal/domain/module/vo/zipextractor.ts"() {
|
|
11532
11610
|
"use strict";
|
|
11533
11611
|
init_type5();
|
|
11534
11612
|
init_log();
|
|
11535
11613
|
import_jszip = __toESM(require("jszip"));
|
|
11536
|
-
|
|
11614
|
+
path17 = __toESM(require("path"));
|
|
11537
11615
|
log21 = getDomainLogger("module", { component: "zipextractor" });
|
|
11538
11616
|
JsZipExtractor = class {
|
|
11539
11617
|
constructor(fs13) {
|
|
@@ -11607,11 +11685,11 @@ var init_zipextractor = __esm({
|
|
|
11607
11685
|
* Extract a single ZIP entry (file or directory)
|
|
11608
11686
|
*/
|
|
11609
11687
|
async extractSingleEntry(relativePath, zipEntry, targetDir) {
|
|
11610
|
-
const fullPath =
|
|
11688
|
+
const fullPath = path17.join(targetDir, relativePath);
|
|
11611
11689
|
if (zipEntry.dir) {
|
|
11612
11690
|
await this.fs.mkdirAll(fullPath, 493);
|
|
11613
11691
|
} else {
|
|
11614
|
-
const dir2 =
|
|
11692
|
+
const dir2 = path17.dirname(fullPath);
|
|
11615
11693
|
if (dir2 !== targetDir) {
|
|
11616
11694
|
await this.fs.mkdirAll(dir2, 493);
|
|
11617
11695
|
}
|
|
@@ -11667,13 +11745,13 @@ var init_zipextractor = __esm({
|
|
|
11667
11745
|
function newModuleCache(fs13, cacheDir) {
|
|
11668
11746
|
return new FsModuleCache(fs13, cacheDir);
|
|
11669
11747
|
}
|
|
11670
|
-
var
|
|
11748
|
+
var path18, log22, FsModuleCache;
|
|
11671
11749
|
var init_cache = __esm({
|
|
11672
11750
|
"internal/domain/module/vo/cache.ts"() {
|
|
11673
11751
|
"use strict";
|
|
11674
11752
|
init_type5();
|
|
11675
11753
|
init_log();
|
|
11676
|
-
|
|
11754
|
+
path18 = __toESM(require("path"));
|
|
11677
11755
|
log22 = getDomainLogger("module", { component: "cache" });
|
|
11678
11756
|
FsModuleCache = class {
|
|
11679
11757
|
constructor(fs13, cacheDir = "./module/cache") {
|
|
@@ -11769,7 +11847,7 @@ var init_cache = __esm({
|
|
|
11769
11847
|
*/
|
|
11770
11848
|
getCacheFilePath(modulePath) {
|
|
11771
11849
|
const safeFileName = modulePath.replace(/[/\\:*?"<>|]/g, "_").replace(/^_+|_+$/g, "") + ".json";
|
|
11772
|
-
return
|
|
11850
|
+
return path18.join(this.cacheDir, safeFileName);
|
|
11773
11851
|
}
|
|
11774
11852
|
/**
|
|
11775
11853
|
* Get cache directory
|
|
@@ -11786,7 +11864,7 @@ var init_cache = __esm({
|
|
|
11786
11864
|
let totalSize = 0;
|
|
11787
11865
|
for (const file of files) {
|
|
11788
11866
|
try {
|
|
11789
|
-
const filePath =
|
|
11867
|
+
const filePath = path18.join(this.cacheDir, file);
|
|
11790
11868
|
const fileInfo = await this.fs.stat(filePath);
|
|
11791
11869
|
totalSize += fileInfo.size();
|
|
11792
11870
|
} catch (error) {
|
|
@@ -11810,7 +11888,7 @@ var init_cache = __esm({
|
|
|
11810
11888
|
try {
|
|
11811
11889
|
const files = await this.listCacheFiles();
|
|
11812
11890
|
return files.map(
|
|
11813
|
-
(file) =>
|
|
11891
|
+
(file) => path18.basename(file, ".json").replace(/_/g, "/")
|
|
11814
11892
|
);
|
|
11815
11893
|
} catch (error) {
|
|
11816
11894
|
return [];
|
|
@@ -11862,13 +11940,13 @@ function newProjectModule(info) {
|
|
|
11862
11940
|
}
|
|
11863
11941
|
return projectModule;
|
|
11864
11942
|
}
|
|
11865
|
-
var
|
|
11943
|
+
var path19, Module2, ProjectModule;
|
|
11866
11944
|
var init_module3 = __esm({
|
|
11867
11945
|
"internal/domain/module/vo/module.ts"() {
|
|
11868
11946
|
"use strict";
|
|
11869
11947
|
init_type5();
|
|
11870
11948
|
init_mount();
|
|
11871
|
-
|
|
11949
|
+
path19 = __toESM(require("path"));
|
|
11872
11950
|
Module2 = class _Module {
|
|
11873
11951
|
constructor(fs13, absoluteDir, modulePath, parent = null, isProject = false) {
|
|
11874
11952
|
this.fs = fs13;
|
|
@@ -11932,7 +12010,7 @@ var init_module3 = __esm({
|
|
|
11932
12010
|
let mounts = moduleImport.mounts || [];
|
|
11933
12011
|
if (mounts.length === 0) {
|
|
11934
12012
|
for (const componentFolder of ComponentFolders) {
|
|
11935
|
-
const sourceDir =
|
|
12013
|
+
const sourceDir = path19.join(this.absoluteDir, componentFolder);
|
|
11936
12014
|
try {
|
|
11937
12015
|
const stat4 = await this.fs.stat(sourceDir);
|
|
11938
12016
|
if (stat4.isDir()) {
|
|
@@ -12083,11 +12161,11 @@ var init_module3 = __esm({
|
|
|
12083
12161
|
function newLang(modules) {
|
|
12084
12162
|
return new Lang(modules);
|
|
12085
12163
|
}
|
|
12086
|
-
var
|
|
12164
|
+
var import_path13, Lang;
|
|
12087
12165
|
var init_lang2 = __esm({
|
|
12088
12166
|
"internal/domain/module/entity/lang.ts"() {
|
|
12089
12167
|
"use strict";
|
|
12090
|
-
|
|
12168
|
+
import_path13 = __toESM(require("path"));
|
|
12091
12169
|
Lang = class {
|
|
12092
12170
|
sourceLangMap;
|
|
12093
12171
|
constructor(modules) {
|
|
@@ -12103,7 +12181,7 @@ var init_lang2 = __esm({
|
|
|
12103
12181
|
* Returns a tuple of [language, exists] to match Go's return pattern
|
|
12104
12182
|
*/
|
|
12105
12183
|
getSourceLang(source) {
|
|
12106
|
-
const lang2 = this.sourceLangMap.get(
|
|
12184
|
+
const lang2 = this.sourceLangMap.get(import_path13.default.basename(source));
|
|
12107
12185
|
if (lang2 !== void 0) {
|
|
12108
12186
|
return [lang2, true];
|
|
12109
12187
|
}
|
|
@@ -12206,7 +12284,7 @@ var init_themes = __esm({
|
|
|
12206
12284
|
function newModules(info, httpClient, zipExtractor, moduleCache) {
|
|
12207
12285
|
return new Modules(info, httpClient, zipExtractor, moduleCache);
|
|
12208
12286
|
}
|
|
12209
|
-
var import_smol_toml,
|
|
12287
|
+
var import_smol_toml, path21, log23, Modules;
|
|
12210
12288
|
var init_module4 = __esm({
|
|
12211
12289
|
"internal/domain/module/entity/module.ts"() {
|
|
12212
12290
|
"use strict";
|
|
@@ -12216,7 +12294,7 @@ var init_module4 = __esm({
|
|
|
12216
12294
|
init_themes();
|
|
12217
12295
|
init_log();
|
|
12218
12296
|
import_smol_toml = require("smol-toml");
|
|
12219
|
-
|
|
12297
|
+
path21 = __toESM(require("path"));
|
|
12220
12298
|
log23 = getDomainLogger("module", { component: "modules" });
|
|
12221
12299
|
Modules = class {
|
|
12222
12300
|
constructor(info, httpClient, zipExtractor, moduleCache) {
|
|
@@ -12371,7 +12449,7 @@ var init_module4 = __esm({
|
|
|
12371
12449
|
log23.info(`Cache version mismatch for ${moduleImport.path}: cached=${cachedMetadata.version}, requested=${effectiveVersion || "latest"}`);
|
|
12372
12450
|
}
|
|
12373
12451
|
const moduleDir = this.getModuleDir(moduleImport.path);
|
|
12374
|
-
const zipPath =
|
|
12452
|
+
const zipPath = path21.join(moduleDir, "module.zip");
|
|
12375
12453
|
const metadata = {
|
|
12376
12454
|
path: moduleImport.path,
|
|
12377
12455
|
version: moduleImport.version || "latest",
|
|
@@ -12477,7 +12555,7 @@ var init_module4 = __esm({
|
|
|
12477
12555
|
*/
|
|
12478
12556
|
getModuleDir(modulePath) {
|
|
12479
12557
|
const safeName = modulePath.replace(/[/\\:*?"<>|]/g, "_").replace(/^_+|_+$/g, "");
|
|
12480
|
-
return
|
|
12558
|
+
return path21.join(this.info.moduleDir(), safeName);
|
|
12481
12559
|
}
|
|
12482
12560
|
/**
|
|
12483
12561
|
* Get download URL for module path
|
|
@@ -12578,7 +12656,7 @@ var init_module4 = __esm({
|
|
|
12578
12656
|
*/
|
|
12579
12657
|
async parseThemeToml(module2) {
|
|
12580
12658
|
try {
|
|
12581
|
-
const themeTomlPath =
|
|
12659
|
+
const themeTomlPath = path21.join(module2.dir(), "theme.toml");
|
|
12582
12660
|
try {
|
|
12583
12661
|
const stat4 = await this.info.osFs().stat(themeTomlPath);
|
|
12584
12662
|
if (stat4.isDir()) {
|
|
@@ -12970,13 +13048,13 @@ function newFileWithMeta(file, meta, fs13) {
|
|
|
12970
13048
|
function newDirFileWithMeta(file, meta, fs13) {
|
|
12971
13049
|
return new File(file, meta, fs13, true);
|
|
12972
13050
|
}
|
|
12973
|
-
var
|
|
13051
|
+
var path22, File;
|
|
12974
13052
|
var init_file = __esm({
|
|
12975
13053
|
"internal/domain/fs/vo/file.ts"() {
|
|
12976
13054
|
"use strict";
|
|
12977
13055
|
init_filemeta();
|
|
12978
13056
|
init_fileinfo();
|
|
12979
|
-
|
|
13057
|
+
path22 = __toESM(require("path"));
|
|
12980
13058
|
File = class {
|
|
12981
13059
|
file;
|
|
12982
13060
|
fileMeta;
|
|
@@ -13070,7 +13148,7 @@ var init_file = __esm({
|
|
|
13070
13148
|
return await this.file.writeAt(buffer, offset);
|
|
13071
13149
|
}
|
|
13072
13150
|
name() {
|
|
13073
|
-
return
|
|
13151
|
+
return path22.basename(this.fileMeta.fileName());
|
|
13074
13152
|
}
|
|
13075
13153
|
async readdir(count) {
|
|
13076
13154
|
if (this.file === null) {
|
|
@@ -13192,7 +13270,7 @@ var init_dir2 = __esm({
|
|
|
13192
13270
|
function newBaseFs(fs13, roots) {
|
|
13193
13271
|
return new BaseFs(fs13, roots);
|
|
13194
13272
|
}
|
|
13195
|
-
var
|
|
13273
|
+
var path23, log26, BaseFs;
|
|
13196
13274
|
var init_basefs = __esm({
|
|
13197
13275
|
"internal/domain/fs/entity/basefs.ts"() {
|
|
13198
13276
|
"use strict";
|
|
@@ -13200,7 +13278,7 @@ var init_basefs = __esm({
|
|
|
13200
13278
|
init_fileinfo();
|
|
13201
13279
|
init_file();
|
|
13202
13280
|
init_dir2();
|
|
13203
|
-
|
|
13281
|
+
path23 = __toESM(require("path"));
|
|
13204
13282
|
init_log();
|
|
13205
13283
|
log26 = getDomainLogger("fs", { component: "basefs" });
|
|
13206
13284
|
BaseFs = class {
|
|
@@ -13223,17 +13301,17 @@ var init_basefs = __esm({
|
|
|
13223
13301
|
if (name === "") {
|
|
13224
13302
|
return root2;
|
|
13225
13303
|
}
|
|
13226
|
-
if (
|
|
13304
|
+
if (path23.isAbsolute(name)) {
|
|
13227
13305
|
if (name.startsWith(root2)) {
|
|
13228
13306
|
return name;
|
|
13229
13307
|
}
|
|
13230
|
-
return
|
|
13308
|
+
return path23.join(root2, name.substring(1));
|
|
13231
13309
|
}
|
|
13232
|
-
return
|
|
13310
|
+
return path23.join(root2, name);
|
|
13233
13311
|
}
|
|
13234
13312
|
isSameRootedPath(name) {
|
|
13235
13313
|
const root2 = this.roots[0];
|
|
13236
|
-
return name.startsWith(
|
|
13314
|
+
return name.startsWith(path23.join(root2, path23.sep)) || name === root2;
|
|
13237
13315
|
}
|
|
13238
13316
|
/**
|
|
13239
13317
|
* Stat returns file info with opener function
|
|
@@ -13319,8 +13397,8 @@ var init_basefs = __esm({
|
|
|
13319
13397
|
const absPath = this.toAbsolutePath(name);
|
|
13320
13398
|
return await this.fs.mkdir(absPath, perm);
|
|
13321
13399
|
}
|
|
13322
|
-
async mkdirAll(
|
|
13323
|
-
const absPath = this.toAbsolutePath(
|
|
13400
|
+
async mkdirAll(path43, perm) {
|
|
13401
|
+
const absPath = this.toAbsolutePath(path43);
|
|
13324
13402
|
return await this.fs.mkdirAll(absPath, perm);
|
|
13325
13403
|
}
|
|
13326
13404
|
async openFile(name, flag, perm) {
|
|
@@ -13331,8 +13409,8 @@ var init_basefs = __esm({
|
|
|
13331
13409
|
const absPath = this.toAbsolutePath(name);
|
|
13332
13410
|
return await this.fs.remove(absPath);
|
|
13333
13411
|
}
|
|
13334
|
-
async removeAll(
|
|
13335
|
-
const absPath = this.toAbsolutePath(
|
|
13412
|
+
async removeAll(path43) {
|
|
13413
|
+
const absPath = this.toAbsolutePath(path43);
|
|
13336
13414
|
return await this.fs.removeAll(absPath);
|
|
13337
13415
|
}
|
|
13338
13416
|
async rename(oldname, newname) {
|
|
@@ -13363,11 +13441,11 @@ var init_basefs = __esm({
|
|
|
13363
13441
|
function newWalkway(fs13, cb) {
|
|
13364
13442
|
return new Walkway(fs13, cb);
|
|
13365
13443
|
}
|
|
13366
|
-
var
|
|
13444
|
+
var path24, log27, Walkway;
|
|
13367
13445
|
var init_walkway = __esm({
|
|
13368
13446
|
"internal/domain/fs/vo/walkway.ts"() {
|
|
13369
13447
|
"use strict";
|
|
13370
|
-
|
|
13448
|
+
path24 = __toESM(require("path"));
|
|
13371
13449
|
init_type6();
|
|
13372
13450
|
init_fileinfo();
|
|
13373
13451
|
init_filemeta();
|
|
@@ -13494,7 +13572,7 @@ var init_walkway = __esm({
|
|
|
13494
13572
|
}
|
|
13495
13573
|
}
|
|
13496
13574
|
for (const entry of dirEntries) {
|
|
13497
|
-
const nextPath =
|
|
13575
|
+
const nextPath = path24.join(filePath, entry.name());
|
|
13498
13576
|
try {
|
|
13499
13577
|
await this.walkRecursive(nextPath, entry);
|
|
13500
13578
|
} catch (err) {
|
|
@@ -13576,9 +13654,9 @@ var init_static_copier = __esm({
|
|
|
13576
13654
|
async walkSourceFiles(sourceFs, targetDir) {
|
|
13577
13655
|
let fileCount = 0;
|
|
13578
13656
|
try {
|
|
13579
|
-
await this.walkFileSystem(sourceFs, "/", async (
|
|
13657
|
+
await this.walkFileSystem(sourceFs, "/", async (path43, isDir) => {
|
|
13580
13658
|
if (!isDir) {
|
|
13581
|
-
await this.copyFile(sourceFs,
|
|
13659
|
+
await this.copyFile(sourceFs, path43, this.toFs, targetDir);
|
|
13582
13660
|
fileCount++;
|
|
13583
13661
|
}
|
|
13584
13662
|
});
|
|
@@ -13662,8 +13740,8 @@ var init_static_copier = __esm({
|
|
|
13662
13740
|
/**
|
|
13663
13741
|
* Get directory name from path
|
|
13664
13742
|
*/
|
|
13665
|
-
dirname(
|
|
13666
|
-
const parts =
|
|
13743
|
+
dirname(path43) {
|
|
13744
|
+
const parts = path43.split("/").filter((part) => part.length > 0);
|
|
13667
13745
|
if (parts.length <= 1)
|
|
13668
13746
|
return "/";
|
|
13669
13747
|
return "/" + parts.slice(0, -1).join("/");
|
|
@@ -13676,16 +13754,16 @@ var init_static_copier = __esm({
|
|
|
13676
13754
|
async function collectFileMetaInfos(paths, fss) {
|
|
13677
13755
|
const result = /* @__PURE__ */ new Map();
|
|
13678
13756
|
let found = false;
|
|
13679
|
-
for (const
|
|
13757
|
+
for (const path43 of paths) {
|
|
13680
13758
|
for (const fs13 of fss) {
|
|
13681
13759
|
try {
|
|
13682
|
-
const fileMetaInfo = await createFileMetaInfo(
|
|
13683
|
-
result.set(
|
|
13760
|
+
const fileMetaInfo = await createFileMetaInfo(path43, fs13);
|
|
13761
|
+
result.set(path43, fileMetaInfo);
|
|
13684
13762
|
found = true;
|
|
13685
13763
|
if (found)
|
|
13686
13764
|
break;
|
|
13687
13765
|
} catch (error) {
|
|
13688
|
-
log29.error(`Failed to create FileMetaInfo for ${
|
|
13766
|
+
log29.error(`Failed to create FileMetaInfo for ${path43} with fs=${fs13}:`, error);
|
|
13689
13767
|
}
|
|
13690
13768
|
}
|
|
13691
13769
|
}
|
|
@@ -13794,8 +13872,8 @@ var init_fs = __esm({
|
|
|
13794
13872
|
/**
|
|
13795
13873
|
* Create new base path filesystem
|
|
13796
13874
|
*/
|
|
13797
|
-
newBasePathFs(source,
|
|
13798
|
-
return newBaseFs(source, [
|
|
13875
|
+
newBasePathFs(source, path43) {
|
|
13876
|
+
return newBaseFs(source, [path43]);
|
|
13799
13877
|
}
|
|
13800
13878
|
async walkPrompts(start, cb, conf) {
|
|
13801
13879
|
return await this.walk(this.prompts, start, cb, conf);
|
|
@@ -14337,11 +14415,11 @@ var init_overlayfs = __esm({
|
|
|
14337
14415
|
/**
|
|
14338
14416
|
* Create directory tree (write operation)
|
|
14339
14417
|
*/
|
|
14340
|
-
async mkdirAll(
|
|
14418
|
+
async mkdirAll(path43, perm) {
|
|
14341
14419
|
if (!this.firstWritable) {
|
|
14342
14420
|
throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
|
|
14343
14421
|
}
|
|
14344
|
-
return await this.writeFs().mkdirAll(
|
|
14422
|
+
return await this.writeFs().mkdirAll(path43, perm);
|
|
14345
14423
|
}
|
|
14346
14424
|
/**
|
|
14347
14425
|
* Open file for reading (searches all filesystems)
|
|
@@ -14400,11 +14478,11 @@ var init_overlayfs = __esm({
|
|
|
14400
14478
|
/**
|
|
14401
14479
|
* Remove directory tree (write operation)
|
|
14402
14480
|
*/
|
|
14403
|
-
async removeAll(
|
|
14481
|
+
async removeAll(path43) {
|
|
14404
14482
|
if (!this.firstWritable) {
|
|
14405
14483
|
throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
|
|
14406
14484
|
}
|
|
14407
|
-
return await this.writeFs().removeAll(
|
|
14485
|
+
return await this.writeFs().removeAll(path43);
|
|
14408
14486
|
}
|
|
14409
14487
|
/**
|
|
14410
14488
|
* Rename file (write operation)
|
|
@@ -14661,13 +14739,13 @@ var init_overlayfs_factory = __esm({
|
|
|
14661
14739
|
function newFilesystemsCollector(sourceProject) {
|
|
14662
14740
|
return new FilesystemsCollector(sourceProject);
|
|
14663
14741
|
}
|
|
14664
|
-
var
|
|
14742
|
+
var path25, log31, RootMapping, FilesystemsCollector;
|
|
14665
14743
|
var init_filesystemscollector = __esm({
|
|
14666
14744
|
"internal/domain/fs/vo/filesystemscollector.ts"() {
|
|
14667
14745
|
"use strict";
|
|
14668
14746
|
init_overlayfs_factory();
|
|
14669
14747
|
init_basefs();
|
|
14670
|
-
|
|
14748
|
+
path25 = __toESM(require("path"));
|
|
14671
14749
|
init_log();
|
|
14672
14750
|
log31 = getDomainLogger("fs", { component: "filesystemscollector" });
|
|
14673
14751
|
RootMapping = class {
|
|
@@ -14722,7 +14800,7 @@ var init_filesystemscollector = __esm({
|
|
|
14722
14800
|
const fromToAssets = [];
|
|
14723
14801
|
const fromToI18n = [];
|
|
14724
14802
|
const absPathify = (inputPath) => {
|
|
14725
|
-
if (
|
|
14803
|
+
if (path25.isAbsolute(inputPath)) {
|
|
14726
14804
|
return ["", inputPath];
|
|
14727
14805
|
}
|
|
14728
14806
|
return [md.dir(), this.absPathify(md.dir(), inputPath)];
|
|
@@ -14801,7 +14879,7 @@ var init_filesystemscollector = __esm({
|
|
|
14801
14879
|
return target === "i18n" || target.startsWith("i18n/") || target.startsWith("/i18n/");
|
|
14802
14880
|
}
|
|
14803
14881
|
absPathify(baseDir, relativePath) {
|
|
14804
|
-
return
|
|
14882
|
+
return path25.resolve(baseDir, relativePath);
|
|
14805
14883
|
}
|
|
14806
14884
|
};
|
|
14807
14885
|
}
|
|
@@ -14811,12 +14889,12 @@ var init_filesystemscollector = __esm({
|
|
|
14811
14889
|
function newOsFs() {
|
|
14812
14890
|
return new OsFs();
|
|
14813
14891
|
}
|
|
14814
|
-
var fs9,
|
|
14892
|
+
var fs9, path26, log32, OsFileInfo, OsFile, OsFs;
|
|
14815
14893
|
var init_osfs = __esm({
|
|
14816
14894
|
"internal/domain/fs/vo/osfs.ts"() {
|
|
14817
14895
|
"use strict";
|
|
14818
14896
|
fs9 = __toESM(require("fs/promises"));
|
|
14819
|
-
|
|
14897
|
+
path26 = __toESM(require("path"));
|
|
14820
14898
|
init_log();
|
|
14821
14899
|
log32 = getDomainLogger("fs", { component: "osfs" });
|
|
14822
14900
|
OsFileInfo = class {
|
|
@@ -14939,7 +15017,7 @@ var init_osfs = __esm({
|
|
|
14939
15017
|
const limit = count > 0 ? Math.min(count, entries.length) : entries.length;
|
|
14940
15018
|
for (let i = 0; i < limit; i++) {
|
|
14941
15019
|
const entry = entries[i];
|
|
14942
|
-
const entryPath =
|
|
15020
|
+
const entryPath = path26.join(this.filePath, entry.name);
|
|
14943
15021
|
const stats = await fs9.stat(entryPath);
|
|
14944
15022
|
result.push(new OsFileInfo(stats, entry.name));
|
|
14945
15023
|
}
|
|
@@ -14955,7 +15033,7 @@ var init_osfs = __esm({
|
|
|
14955
15033
|
if (this.closed)
|
|
14956
15034
|
throw new Error("File is closed");
|
|
14957
15035
|
const stats = await fs9.stat(this.filePath);
|
|
14958
|
-
return new OsFileInfo(stats,
|
|
15036
|
+
return new OsFileInfo(stats, path26.basename(this.filePath));
|
|
14959
15037
|
}
|
|
14960
15038
|
async sync() {
|
|
14961
15039
|
if (this.closed)
|
|
@@ -15032,7 +15110,7 @@ var init_osfs = __esm({
|
|
|
15032
15110
|
}
|
|
15033
15111
|
async stat(name) {
|
|
15034
15112
|
const stats = await fs9.stat(name);
|
|
15035
|
-
return new OsFileInfo(stats,
|
|
15113
|
+
return new OsFileInfo(stats, path26.basename(name));
|
|
15036
15114
|
}
|
|
15037
15115
|
name() {
|
|
15038
15116
|
return "OsFs";
|
|
@@ -18404,8 +18482,8 @@ function wikilinkInlineRule(state, silent) {
|
|
|
18404
18482
|
function renderWikilinkLink(tokens, idx) {
|
|
18405
18483
|
const token = tokens[idx];
|
|
18406
18484
|
const meta = token.meta;
|
|
18407
|
-
const [
|
|
18408
|
-
const slug2 = slugifyFilePath(
|
|
18485
|
+
const [path43, _anchor] = splitAnchor(meta.url);
|
|
18486
|
+
const slug2 = slugifyFilePath(path43);
|
|
18409
18487
|
const displayText = meta.alias ?? meta.filepath;
|
|
18410
18488
|
const escapedText = escapeHtml(displayText);
|
|
18411
18489
|
return `<a class="internal" data-slug="${slug2}" data-wikilink="${escapeHtml(meta.url)}">${escapedText}</a>`;
|
|
@@ -19371,8 +19449,8 @@ var init_type10 = __esm({
|
|
|
19371
19449
|
COMPONENT_FOLDER_ASSETS: "assets",
|
|
19372
19450
|
COMPONENT_FOLDER_I18N: "i18n",
|
|
19373
19451
|
// Path normalization utility
|
|
19374
|
-
normalizePath: (
|
|
19375
|
-
let p2 =
|
|
19452
|
+
normalizePath: (path43) => {
|
|
19453
|
+
let p2 = path43.replace(/\\/g, "/");
|
|
19376
19454
|
if (p2.startsWith("//")) {
|
|
19377
19455
|
p2 = p2.substring(1);
|
|
19378
19456
|
}
|
|
@@ -19622,8 +19700,8 @@ var init_path2 = __esm({
|
|
|
19622
19700
|
if (this.components.component) {
|
|
19623
19701
|
return this.components.component;
|
|
19624
19702
|
}
|
|
19625
|
-
const
|
|
19626
|
-
const parts =
|
|
19703
|
+
const path43 = this.components.normalized;
|
|
19704
|
+
const parts = path43.split("/").filter((p2) => p2.length > 0);
|
|
19627
19705
|
if (parts.length === 0) {
|
|
19628
19706
|
return "content";
|
|
19629
19707
|
}
|
|
@@ -19951,10 +20029,10 @@ var init_path2 = __esm({
|
|
|
19951
20029
|
/**
|
|
19952
20030
|
* Create a path from string components
|
|
19953
20031
|
*/
|
|
19954
|
-
static fromString(component,
|
|
20032
|
+
static fromString(component, path43) {
|
|
19955
20033
|
const components = new PathComponentsImpl(
|
|
19956
|
-
|
|
19957
|
-
|
|
20034
|
+
path43,
|
|
20035
|
+
path43,
|
|
19958
20036
|
{ containerLow: -1, containerHigh: -1, sectionHigh: -1, identifierLanguage: -1 },
|
|
19959
20037
|
[],
|
|
19960
20038
|
0 /* File */,
|
|
@@ -19965,8 +20043,8 @@ var init_path2 = __esm({
|
|
|
19965
20043
|
/**
|
|
19966
20044
|
* Check if a path has a specific extension
|
|
19967
20045
|
*/
|
|
19968
|
-
static hasExtension(
|
|
19969
|
-
const pathExt =
|
|
20046
|
+
static hasExtension(path43, extension) {
|
|
20047
|
+
const pathExt = path43.ext();
|
|
19970
20048
|
const targetExt = extension.startsWith(".") ? extension : "." + extension;
|
|
19971
20049
|
return pathExt.toLowerCase() === targetExt.toLowerCase();
|
|
19972
20050
|
}
|
|
@@ -20024,20 +20102,20 @@ var init_pathparser = __esm({
|
|
|
20024
20102
|
/**
|
|
20025
20103
|
* Parse a path with component information
|
|
20026
20104
|
*/
|
|
20027
|
-
parse(component,
|
|
20028
|
-
let normalizedPath =
|
|
20105
|
+
parse(component, path43) {
|
|
20106
|
+
let normalizedPath = path43;
|
|
20029
20107
|
if (!normalizedPath || normalizedPath === "") {
|
|
20030
20108
|
normalizedPath = "/";
|
|
20031
20109
|
}
|
|
20032
20110
|
const normalized = this.normalizer.normalize(normalizedPath);
|
|
20033
|
-
const pathComponents = this.createPathComponents(component, normalized,
|
|
20111
|
+
const pathComponents = this.createPathComponents(component, normalized, path43);
|
|
20034
20112
|
return new Path(pathComponents);
|
|
20035
20113
|
}
|
|
20036
20114
|
/**
|
|
20037
20115
|
* Parse and return only the identity
|
|
20038
20116
|
*/
|
|
20039
|
-
parseIdentity(component,
|
|
20040
|
-
const parsed = this.parse(component,
|
|
20117
|
+
parseIdentity(component, path43) {
|
|
20118
|
+
const parsed = this.parse(component, path43);
|
|
20041
20119
|
return {
|
|
20042
20120
|
identifierBase: () => parsed.base()
|
|
20043
20121
|
};
|
|
@@ -20045,8 +20123,8 @@ var init_pathparser = __esm({
|
|
|
20045
20123
|
/**
|
|
20046
20124
|
* Parse and return base and base name without identifier
|
|
20047
20125
|
*/
|
|
20048
|
-
parseBaseAndBaseNameNoIdentifier(component,
|
|
20049
|
-
const parsed = this.parse(component,
|
|
20126
|
+
parseBaseAndBaseNameNoIdentifier(component, path43) {
|
|
20127
|
+
const parsed = this.parse(component, path43);
|
|
20050
20128
|
return [parsed.base(), parsed.baseNameNoIdentifier()];
|
|
20051
20129
|
}
|
|
20052
20130
|
/**
|
|
@@ -20175,8 +20253,8 @@ var init_pathparser = __esm({
|
|
|
20175
20253
|
this.toLowerCase = toLowerCase;
|
|
20176
20254
|
this.replaceSpaces = replaceSpaces;
|
|
20177
20255
|
}
|
|
20178
|
-
normalize(
|
|
20179
|
-
let result =
|
|
20256
|
+
normalize(path43) {
|
|
20257
|
+
let result = path43;
|
|
20180
20258
|
result = result.replace(/\\/g, "/");
|
|
20181
20259
|
if (this.toLowerCase) {
|
|
20182
20260
|
result = result.toLowerCase();
|
|
@@ -20192,8 +20270,8 @@ var init_pathparser = __esm({
|
|
|
20192
20270
|
this.toLowerCase = toLowerCase;
|
|
20193
20271
|
this.replaceSpaces = replaceSpaces;
|
|
20194
20272
|
}
|
|
20195
|
-
normalize(
|
|
20196
|
-
let result =
|
|
20273
|
+
normalize(path43) {
|
|
20274
|
+
let result = path43;
|
|
20197
20275
|
result = result.replace(/\\/g, "/");
|
|
20198
20276
|
if (this.toLowerCase) {
|
|
20199
20277
|
result = result.toLowerCase();
|
|
@@ -20213,12 +20291,12 @@ var init_pathparser = __esm({
|
|
|
20213
20291
|
const htmlExts = PATH_CONSTANTS.HTML_EXTENSIONS;
|
|
20214
20292
|
return htmlExts.includes(ext.toLowerCase());
|
|
20215
20293
|
}
|
|
20216
|
-
hasExt(
|
|
20217
|
-
for (let i =
|
|
20218
|
-
if (
|
|
20294
|
+
hasExt(path43) {
|
|
20295
|
+
for (let i = path43.length - 1; i >= 0; i--) {
|
|
20296
|
+
if (path43[i] === ".") {
|
|
20219
20297
|
return true;
|
|
20220
20298
|
}
|
|
20221
|
-
if (
|
|
20299
|
+
if (path43[i] === "/") {
|
|
20222
20300
|
return false;
|
|
20223
20301
|
}
|
|
20224
20302
|
}
|
|
@@ -20229,10 +20307,10 @@ var init_pathparser = __esm({
|
|
|
20229
20307
|
/**
|
|
20230
20308
|
* Parse a path string into basic components
|
|
20231
20309
|
*/
|
|
20232
|
-
static parseBasic(
|
|
20233
|
-
const lastSlash =
|
|
20234
|
-
const dir2 = lastSlash >= 0 ?
|
|
20235
|
-
const name = lastSlash >= 0 ?
|
|
20310
|
+
static parseBasic(path43) {
|
|
20311
|
+
const lastSlash = path43.lastIndexOf("/");
|
|
20312
|
+
const dir2 = lastSlash >= 0 ? path43.substring(0, lastSlash) : "";
|
|
20313
|
+
const name = lastSlash >= 0 ? path43.substring(lastSlash + 1) : path43;
|
|
20236
20314
|
const lastDot = name.lastIndexOf(".");
|
|
20237
20315
|
const ext = lastDot >= 0 ? name.substring(lastDot) : "";
|
|
20238
20316
|
const nameWithoutExt = lastDot >= 0 ? name.substring(0, lastDot) : name;
|
|
@@ -20247,43 +20325,43 @@ var init_pathparser = __esm({
|
|
|
20247
20325
|
/**
|
|
20248
20326
|
* Normalize a path string using basic rules
|
|
20249
20327
|
*/
|
|
20250
|
-
static normalizeBasic(
|
|
20328
|
+
static normalizeBasic(path43) {
|
|
20251
20329
|
const normalizer = new BasicPathNormalizer();
|
|
20252
|
-
return normalizer.normalize(
|
|
20330
|
+
return normalizer.normalize(path43);
|
|
20253
20331
|
}
|
|
20254
20332
|
/**
|
|
20255
20333
|
* Check if a path represents a bundle
|
|
20256
20334
|
*/
|
|
20257
|
-
static isBundle(
|
|
20258
|
-
const basic = _PathParserUtils.parseBasic(
|
|
20335
|
+
static isBundle(path43) {
|
|
20336
|
+
const basic = _PathParserUtils.parseBasic(path43);
|
|
20259
20337
|
const indexNames = PATH_CONSTANTS.INDEX_NAMES;
|
|
20260
20338
|
return indexNames.includes(basic.nameWithoutExt);
|
|
20261
20339
|
}
|
|
20262
20340
|
/**
|
|
20263
20341
|
* Extract section from path
|
|
20264
20342
|
*/
|
|
20265
|
-
static extractSection(
|
|
20266
|
-
const normalized =
|
|
20343
|
+
static extractSection(path43) {
|
|
20344
|
+
const normalized = path43.startsWith("/") ? path43.substring(1) : path43;
|
|
20267
20345
|
const firstSlash = normalized.indexOf("/");
|
|
20268
20346
|
return firstSlash >= 0 ? normalized.substring(0, firstSlash) : normalized;
|
|
20269
20347
|
}
|
|
20270
20348
|
/**
|
|
20271
20349
|
* Remove extension from path
|
|
20272
20350
|
*/
|
|
20273
|
-
static removeExtension(
|
|
20274
|
-
const lastDot =
|
|
20275
|
-
const lastSlash =
|
|
20351
|
+
static removeExtension(path43) {
|
|
20352
|
+
const lastDot = path43.lastIndexOf(".");
|
|
20353
|
+
const lastSlash = path43.lastIndexOf("/");
|
|
20276
20354
|
if (lastDot > lastSlash) {
|
|
20277
|
-
return
|
|
20355
|
+
return path43.substring(0, lastDot);
|
|
20278
20356
|
}
|
|
20279
|
-
return
|
|
20357
|
+
return path43;
|
|
20280
20358
|
}
|
|
20281
20359
|
/**
|
|
20282
20360
|
* Check if path has extension
|
|
20283
20361
|
*/
|
|
20284
|
-
static hasExtension(
|
|
20362
|
+
static hasExtension(path43) {
|
|
20285
20363
|
const checker = new DefaultFileExtensionChecker();
|
|
20286
|
-
return checker.hasExt(
|
|
20364
|
+
return checker.hasExt(path43);
|
|
20287
20365
|
}
|
|
20288
20366
|
};
|
|
20289
20367
|
}
|
|
@@ -20314,11 +20392,11 @@ var init_pathfactory = __esm({
|
|
|
20314
20392
|
/**
|
|
20315
20393
|
* Create a Path from component and path string
|
|
20316
20394
|
*/
|
|
20317
|
-
create(component,
|
|
20395
|
+
create(component, path43, config) {
|
|
20318
20396
|
if (this.pool) {
|
|
20319
20397
|
const pooledPath = this.pool.get();
|
|
20320
20398
|
}
|
|
20321
|
-
return this.processor.parse(component,
|
|
20399
|
+
return this.processor.parse(component, path43);
|
|
20322
20400
|
}
|
|
20323
20401
|
/**
|
|
20324
20402
|
* Create a Path from PathComponents
|
|
@@ -20330,12 +20408,12 @@ var init_pathfactory = __esm({
|
|
|
20330
20408
|
* Create multiple paths from an array of path strings
|
|
20331
20409
|
*/
|
|
20332
20410
|
createMany(component, paths, config) {
|
|
20333
|
-
return paths.map((
|
|
20411
|
+
return paths.map((path43) => this.create(component, path43, config));
|
|
20334
20412
|
}
|
|
20335
20413
|
/**
|
|
20336
20414
|
* Create a path with custom configuration
|
|
20337
20415
|
*/
|
|
20338
|
-
createWithConfig(component,
|
|
20416
|
+
createWithConfig(component, path43, normalizeConfig) {
|
|
20339
20417
|
const config = {};
|
|
20340
20418
|
if (normalizeConfig?.toLowerCase !== void 0) {
|
|
20341
20419
|
config.normalize = normalizeConfig.toLowerCase;
|
|
@@ -20346,7 +20424,7 @@ var init_pathfactory = __esm({
|
|
|
20346
20424
|
if (normalizeConfig?.customNormalizer !== void 0) {
|
|
20347
20425
|
config.normalizer = normalizeConfig.customNormalizer;
|
|
20348
20426
|
}
|
|
20349
|
-
return this.create(component,
|
|
20427
|
+
return this.create(component, path43, config);
|
|
20350
20428
|
}
|
|
20351
20429
|
};
|
|
20352
20430
|
DefaultPathFactory = class extends PathFactoryImpl {
|
|
@@ -20370,9 +20448,9 @@ var init_pathfactory = __esm({
|
|
|
20370
20448
|
const components = PathComponentsFactory.createEmpty();
|
|
20371
20449
|
return new Path(components);
|
|
20372
20450
|
}
|
|
20373
|
-
put(
|
|
20451
|
+
put(path43) {
|
|
20374
20452
|
if (this.pool.length < this.maxSize) {
|
|
20375
|
-
this.pool.push(
|
|
20453
|
+
this.pool.push(path43);
|
|
20376
20454
|
}
|
|
20377
20455
|
}
|
|
20378
20456
|
/**
|
|
@@ -20406,8 +20484,8 @@ var init_pathfactory = __esm({
|
|
|
20406
20484
|
/**
|
|
20407
20485
|
* Set the path
|
|
20408
20486
|
*/
|
|
20409
|
-
withPath(
|
|
20410
|
-
this.path =
|
|
20487
|
+
withPath(path43) {
|
|
20488
|
+
this.path = path43;
|
|
20411
20489
|
return this;
|
|
20412
20490
|
}
|
|
20413
20491
|
/**
|
|
@@ -20455,38 +20533,38 @@ var init_pathfactory = __esm({
|
|
|
20455
20533
|
/**
|
|
20456
20534
|
* Create a content path
|
|
20457
20535
|
*/
|
|
20458
|
-
static createContentPath(
|
|
20459
|
-
return _PathFactoryUtils.defaultFactory.create("content",
|
|
20536
|
+
static createContentPath(path43) {
|
|
20537
|
+
return _PathFactoryUtils.defaultFactory.create("content", path43);
|
|
20460
20538
|
}
|
|
20461
20539
|
/**
|
|
20462
20540
|
* Create a static resource path
|
|
20463
20541
|
*/
|
|
20464
|
-
static createStaticPath(
|
|
20465
|
-
return _PathFactoryUtils.defaultFactory.create("static",
|
|
20542
|
+
static createStaticPath(path43) {
|
|
20543
|
+
return _PathFactoryUtils.defaultFactory.create("static", path43);
|
|
20466
20544
|
}
|
|
20467
20545
|
/**
|
|
20468
20546
|
* Create a layout path
|
|
20469
20547
|
*/
|
|
20470
|
-
static createLayoutPath(
|
|
20471
|
-
return _PathFactoryUtils.defaultFactory.create("layouts",
|
|
20548
|
+
static createLayoutPath(path43) {
|
|
20549
|
+
return _PathFactoryUtils.defaultFactory.create("layouts", path43);
|
|
20472
20550
|
}
|
|
20473
20551
|
/**
|
|
20474
20552
|
* Create an archetype path
|
|
20475
20553
|
*/
|
|
20476
|
-
static createArchetypePath(
|
|
20477
|
-
return _PathFactoryUtils.defaultFactory.create("archetypes",
|
|
20554
|
+
static createArchetypePath(path43) {
|
|
20555
|
+
return _PathFactoryUtils.defaultFactory.create("archetypes", path43);
|
|
20478
20556
|
}
|
|
20479
20557
|
/**
|
|
20480
20558
|
* Create a data path
|
|
20481
20559
|
*/
|
|
20482
|
-
static createDataPath(
|
|
20483
|
-
return _PathFactoryUtils.defaultFactory.create("data",
|
|
20560
|
+
static createDataPath(path43) {
|
|
20561
|
+
return _PathFactoryUtils.defaultFactory.create("data", path43);
|
|
20484
20562
|
}
|
|
20485
20563
|
/**
|
|
20486
20564
|
* Create a theme path
|
|
20487
20565
|
*/
|
|
20488
|
-
static createThemePath(
|
|
20489
|
-
return _PathFactoryUtils.defaultFactory.create("themes",
|
|
20566
|
+
static createThemePath(path43) {
|
|
20567
|
+
return _PathFactoryUtils.defaultFactory.create("themes", path43);
|
|
20490
20568
|
}
|
|
20491
20569
|
/**
|
|
20492
20570
|
* Create paths from a configuration object
|
|
@@ -20500,7 +20578,7 @@ var init_pathfactory = __esm({
|
|
|
20500
20578
|
factoryConfig.replaceSpaces = config.replaceSpaces;
|
|
20501
20579
|
}
|
|
20502
20580
|
const factory = new PathFactoryImpl(factoryConfig);
|
|
20503
|
-
return config.paths.map((
|
|
20581
|
+
return config.paths.map((path43) => factory.create(config.component, path43));
|
|
20504
20582
|
}
|
|
20505
20583
|
/**
|
|
20506
20584
|
* Get a path builder instance
|
|
@@ -20511,9 +20589,9 @@ var init_pathfactory = __esm({
|
|
|
20511
20589
|
/**
|
|
20512
20590
|
* Create a path with pooling
|
|
20513
20591
|
*/
|
|
20514
|
-
static createWithPool(component,
|
|
20592
|
+
static createWithPool(component, path43, pool2) {
|
|
20515
20593
|
const factory = new PathFactoryImpl(void 0, pool2);
|
|
20516
|
-
return factory.create(component,
|
|
20594
|
+
return factory.create(component, path43);
|
|
20517
20595
|
}
|
|
20518
20596
|
};
|
|
20519
20597
|
}
|
|
@@ -20619,12 +20697,12 @@ var init_translator = __esm({
|
|
|
20619
20697
|
async setupTranslateFuncs(fsService) {
|
|
20620
20698
|
try {
|
|
20621
20699
|
await fsService.walkI18n("", {
|
|
20622
|
-
walkFn: async (
|
|
20623
|
-
if (!
|
|
20700
|
+
walkFn: async (path43, info) => {
|
|
20701
|
+
if (!path43.endsWith(".yaml") && !path43.endsWith(".yml")) {
|
|
20624
20702
|
return;
|
|
20625
20703
|
}
|
|
20626
20704
|
try {
|
|
20627
|
-
const normalizedPath = PATH_CONSTANTS.normalizePath(
|
|
20705
|
+
const normalizedPath = PATH_CONSTANTS.normalizePath(path43);
|
|
20628
20706
|
const filename = normalizedPath.split("/").pop() || "";
|
|
20629
20707
|
const langKey = filename.replace(/\.(yaml|yml)$/, "").toLowerCase();
|
|
20630
20708
|
const content = await this.readI18nFile(info);
|
|
@@ -20644,7 +20722,7 @@ var init_translator = __esm({
|
|
|
20644
20722
|
this.translateFuncs.set(langKey, translateFunc);
|
|
20645
20723
|
log38.info(`\u2705 Loaded i18n translations for language: ${langKey} (${translations.length} items)`);
|
|
20646
20724
|
} catch (error) {
|
|
20647
|
-
log38.error(`\u274C Failed to load i18n file ${
|
|
20725
|
+
log38.error(`\u274C Failed to load i18n file ${path43}:`, error);
|
|
20648
20726
|
}
|
|
20649
20727
|
}
|
|
20650
20728
|
}, {});
|
|
@@ -20850,13 +20928,13 @@ function isContentExt(ext) {
|
|
|
20850
20928
|
function newFileInfo2(fi) {
|
|
20851
20929
|
return FileInfo7.newFileInfo(fi);
|
|
20852
20930
|
}
|
|
20853
|
-
var crypto2,
|
|
20931
|
+
var crypto2, path27, log41, contentFileExtensions, contentFileExtensionsSet, FileInfo7;
|
|
20854
20932
|
var init_fileinfo2 = __esm({
|
|
20855
20933
|
"internal/domain/content/vo/fileinfo.ts"() {
|
|
20856
20934
|
"use strict";
|
|
20857
20935
|
init_paths();
|
|
20858
20936
|
crypto2 = __toESM(require("crypto"));
|
|
20859
|
-
|
|
20937
|
+
path27 = __toESM(require("path"));
|
|
20860
20938
|
init_log();
|
|
20861
20939
|
log41 = getDomainLogger("content", { component: "FileInfo" });
|
|
20862
20940
|
contentFileExtensions = [
|
|
@@ -20894,7 +20972,7 @@ var init_fileinfo2 = __esm({
|
|
|
20894
20972
|
relPath() {
|
|
20895
20973
|
const dir2 = this.pathInfo.dir();
|
|
20896
20974
|
const dirWithoutLeadingSlash = dir2.startsWith("/") ? dir2.substring(1) : dir2;
|
|
20897
|
-
return
|
|
20975
|
+
return path27.join(dirWithoutLeadingSlash, this.pathInfo.name());
|
|
20898
20976
|
}
|
|
20899
20977
|
section() {
|
|
20900
20978
|
return this.pathInfo.section();
|
|
@@ -20991,7 +21069,7 @@ var init_fileinfo2 = __esm({
|
|
|
20991
21069
|
if (s2 === "") {
|
|
20992
21070
|
return s2;
|
|
20993
21071
|
}
|
|
20994
|
-
return
|
|
21072
|
+
return path27.normalize(s2.substring(1) + "/");
|
|
20995
21073
|
}
|
|
20996
21074
|
determineBundleType() {
|
|
20997
21075
|
const isContent = isContentExt(this.pathInfo.ext());
|
|
@@ -21271,7 +21349,7 @@ function getParam(p2, key2, stringToLower) {
|
|
|
21271
21349
|
return v;
|
|
21272
21350
|
}
|
|
21273
21351
|
}
|
|
21274
|
-
var
|
|
21352
|
+
var import_path20, FrontMatterParserImpl;
|
|
21275
21353
|
var init_frontmatter = __esm({
|
|
21276
21354
|
"internal/domain/content/vo/frontmatter.ts"() {
|
|
21277
21355
|
"use strict";
|
|
@@ -21279,7 +21357,7 @@ var init_frontmatter = __esm({
|
|
|
21279
21357
|
init_cast2();
|
|
21280
21358
|
init_string2();
|
|
21281
21359
|
init_types3();
|
|
21282
|
-
|
|
21360
|
+
import_path20 = __toESM(require("path"));
|
|
21283
21361
|
FrontMatterParserImpl = class {
|
|
21284
21362
|
params;
|
|
21285
21363
|
langSvc;
|
|
@@ -21466,7 +21544,7 @@ var init_frontmatter = __esm({
|
|
|
21466
21544
|
organization.website = Cast.toString(orgValue.website);
|
|
21467
21545
|
}
|
|
21468
21546
|
if (orgValue.logo !== void 0 && orgValue.logo !== null) {
|
|
21469
|
-
organization.logo =
|
|
21547
|
+
organization.logo = import_path20.default.join(baseURL, Cast.toString(orgValue.logo));
|
|
21470
21548
|
}
|
|
21471
21549
|
const contact = this.parseContact(orgValue.contact);
|
|
21472
21550
|
if (contact) {
|
|
@@ -21584,7 +21662,7 @@ var init_frontmatter = __esm({
|
|
|
21584
21662
|
author.website = Cast.toString(authorValue.website);
|
|
21585
21663
|
}
|
|
21586
21664
|
if (authorValue.avatar !== void 0 && authorValue.avatar !== null) {
|
|
21587
|
-
author.avatar =
|
|
21665
|
+
author.avatar = import_path20.default.join(baseURL, Cast.toString(authorValue.avatar));
|
|
21588
21666
|
}
|
|
21589
21667
|
const contact = this.parseContact(authorValue.contact);
|
|
21590
21668
|
if (contact) {
|
|
@@ -21640,8 +21718,8 @@ var init_frontmatter = __esm({
|
|
|
21640
21718
|
* Convert path to slash preserving leading slash
|
|
21641
21719
|
* Equivalent to Go's paths.ToSlashPreserveLeading
|
|
21642
21720
|
*/
|
|
21643
|
-
toSlashPreserveLeading(
|
|
21644
|
-
return
|
|
21721
|
+
toSlashPreserveLeading(path43) {
|
|
21722
|
+
return path43.replace(/\\/g, "/");
|
|
21645
21723
|
}
|
|
21646
21724
|
};
|
|
21647
21725
|
}
|
|
@@ -22066,9 +22144,9 @@ var init_radix = __esm({
|
|
|
22066
22144
|
// from the root down to a given leaf. Where WalkPrefix walks
|
|
22067
22145
|
// all the entries *under* the given prefix, this walks the
|
|
22068
22146
|
// entries *above* the given prefix.
|
|
22069
|
-
async walkPath(
|
|
22147
|
+
async walkPath(path43, fn) {
|
|
22070
22148
|
let n = this.root;
|
|
22071
|
-
let search2 =
|
|
22149
|
+
let search2 = path43;
|
|
22072
22150
|
while (true) {
|
|
22073
22151
|
if (n.leaf !== null && await fn(n.leaf.key, n.leaf.val)) {
|
|
22074
22152
|
return;
|
|
@@ -23203,8 +23281,8 @@ var init_pagesource = __esm({
|
|
|
23203
23281
|
* 3. Handle index files (index → parent folder)
|
|
23204
23282
|
* 4. Handle _index files (Hugo-style section index)
|
|
23205
23283
|
*/
|
|
23206
|
-
pathToSlug(
|
|
23207
|
-
let slug2 =
|
|
23284
|
+
pathToSlug(path43) {
|
|
23285
|
+
let slug2 = path43.replace(/^\//, "");
|
|
23208
23286
|
slug2 = slug2.replace(/\.md$/, "");
|
|
23209
23287
|
if (slug2.endsWith("/index")) {
|
|
23210
23288
|
slug2 = slug2.replace(/\/index$/, "");
|
|
@@ -23251,17 +23329,17 @@ var init_pagesource = __esm({
|
|
|
23251
23329
|
});
|
|
23252
23330
|
|
|
23253
23331
|
// internal/domain/content/entity/pagemap.ts
|
|
23254
|
-
function addTrailingSlash(
|
|
23255
|
-
if (!
|
|
23256
|
-
|
|
23332
|
+
function addTrailingSlash(path43) {
|
|
23333
|
+
if (!path43.endsWith("/")) {
|
|
23334
|
+
path43 += "/";
|
|
23257
23335
|
}
|
|
23258
|
-
return
|
|
23336
|
+
return path43;
|
|
23259
23337
|
}
|
|
23260
|
-
function addLeadingSlash(
|
|
23261
|
-
if (!
|
|
23262
|
-
|
|
23338
|
+
function addLeadingSlash(path43) {
|
|
23339
|
+
if (!path43.startsWith("/")) {
|
|
23340
|
+
path43 = "/" + path43;
|
|
23263
23341
|
}
|
|
23264
|
-
return
|
|
23342
|
+
return path43;
|
|
23265
23343
|
}
|
|
23266
23344
|
var log43, ambiguousContentNode, ContentTreeReverseIndexMap, ContentTreeReverseIndex, pagePredicates, PageMapQueryPagesBelowPathImpl, PageMapQueryPagesInSectionImpl, PageMap;
|
|
23267
23345
|
var init_pagemap = __esm({
|
|
@@ -23314,8 +23392,8 @@ var init_pagemap = __esm({
|
|
|
23314
23392
|
path;
|
|
23315
23393
|
keyPart;
|
|
23316
23394
|
include;
|
|
23317
|
-
constructor(
|
|
23318
|
-
this.path =
|
|
23395
|
+
constructor(path43, keyPart, include = pagePredicates.shouldListLocal) {
|
|
23396
|
+
this.path = path43;
|
|
23319
23397
|
this.keyPart = keyPart;
|
|
23320
23398
|
this.include = include;
|
|
23321
23399
|
}
|
|
@@ -23327,8 +23405,8 @@ var init_pagemap = __esm({
|
|
|
23327
23405
|
recursive;
|
|
23328
23406
|
includeSelf;
|
|
23329
23407
|
index;
|
|
23330
|
-
constructor(
|
|
23331
|
-
super(
|
|
23408
|
+
constructor(path43, keyPart, recursive, includeSelf, index2, include) {
|
|
23409
|
+
super(path43, keyPart, include);
|
|
23332
23410
|
this.recursive = recursive;
|
|
23333
23411
|
this.includeSelf = includeSelf;
|
|
23334
23412
|
this.index = index2;
|
|
@@ -23696,12 +23774,12 @@ var init_pagemap = __esm({
|
|
|
23696
23774
|
/**
|
|
23697
23775
|
* Helper method to get directory from path
|
|
23698
23776
|
*/
|
|
23699
|
-
pathDir(
|
|
23700
|
-
const lastSlash =
|
|
23777
|
+
pathDir(path43) {
|
|
23778
|
+
const lastSlash = path43.lastIndexOf("/");
|
|
23701
23779
|
if (lastSlash === -1) {
|
|
23702
23780
|
return "";
|
|
23703
23781
|
}
|
|
23704
|
-
return
|
|
23782
|
+
return path43.substring(0, lastSlash);
|
|
23705
23783
|
}
|
|
23706
23784
|
};
|
|
23707
23785
|
}
|
|
@@ -23740,11 +23818,11 @@ var init_pagecollector = __esm({
|
|
|
23740
23818
|
/**
|
|
23741
23819
|
* CollectDir - exact replica of Go's collectDir method
|
|
23742
23820
|
*/
|
|
23743
|
-
async collectDir(fs13,
|
|
23821
|
+
async collectDir(fs13, path43, root2) {
|
|
23744
23822
|
try {
|
|
23745
|
-
await this.fs.walkContent(fs13,
|
|
23746
|
-
hookPre: async (dir2,
|
|
23747
|
-
const fullPath =
|
|
23823
|
+
await this.fs.walkContent(fs13, path43, {
|
|
23824
|
+
hookPre: async (dir2, path44, readdir2) => {
|
|
23825
|
+
const fullPath = path44;
|
|
23748
23826
|
if (this.processedPaths.has(fullPath)) {
|
|
23749
23827
|
log44.warn("Path already processed!", {
|
|
23750
23828
|
path: fullPath,
|
|
@@ -23775,7 +23853,7 @@ var init_pagecollector = __esm({
|
|
|
23775
23853
|
});
|
|
23776
23854
|
} catch (error) {
|
|
23777
23855
|
log44.error(`Failed to collect directory: ${error}`, {
|
|
23778
|
-
path:
|
|
23856
|
+
path: path43,
|
|
23779
23857
|
rootName: root2.name(),
|
|
23780
23858
|
rootIsDir: root2.isDir(),
|
|
23781
23859
|
stack: error.stack || "No stack trace available"
|
|
@@ -23785,7 +23863,7 @@ var init_pagecollector = __esm({
|
|
|
23785
23863
|
}
|
|
23786
23864
|
async handleBundleLeaf(dir2, bundle, inPath, readdir2) {
|
|
23787
23865
|
const bundlePath = bundle.paths();
|
|
23788
|
-
const walk = async (
|
|
23866
|
+
const walk = async (path43, info) => {
|
|
23789
23867
|
if (info.isDir()) {
|
|
23790
23868
|
return;
|
|
23791
23869
|
}
|
|
@@ -24037,10 +24115,10 @@ var init_content2 = __esm({
|
|
|
24037
24115
|
* GetPageFromPath - TypeScript equivalent of Go's PageFinder.GetPageFromPath
|
|
24038
24116
|
* This is the core content domain business logic for finding pages by path
|
|
24039
24117
|
*/
|
|
24040
|
-
getPageFromPath(langIndex,
|
|
24118
|
+
getPageFromPath(langIndex, path43) {
|
|
24041
24119
|
try {
|
|
24042
24120
|
const pathProcessor = PathDomain.createProcessor();
|
|
24043
|
-
const ps = pathProcessor.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT,
|
|
24121
|
+
const ps = pathProcessor.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT, path43);
|
|
24044
24122
|
const tree = this.pageMap.treePages.shape(0, langIndex);
|
|
24045
24123
|
let node = tree.get(ps.base());
|
|
24046
24124
|
if (node) {
|
|
@@ -24051,7 +24129,7 @@ var init_content2 = __esm({
|
|
|
24051
24129
|
}
|
|
24052
24130
|
return null;
|
|
24053
24131
|
} catch (error) {
|
|
24054
|
-
log45.error(`\u274C Content.getPageFromPath error for path "${
|
|
24132
|
+
log45.error(`\u274C Content.getPageFromPath error for path "${path43}":`, error);
|
|
24055
24133
|
return null;
|
|
24056
24134
|
}
|
|
24057
24135
|
}
|
|
@@ -24858,15 +24936,15 @@ var init_scratch = __esm({
|
|
|
24858
24936
|
function sanitize(input) {
|
|
24859
24937
|
return input.replace(/[\s\t\n\r]+/g, "-").replace(/[^\w\-_]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
24860
24938
|
}
|
|
24861
|
-
function addContextRoot(root2,
|
|
24862
|
-
if (!root2 ||
|
|
24863
|
-
return
|
|
24939
|
+
function addContextRoot(root2, path43) {
|
|
24940
|
+
if (!root2 || path43.startsWith(root2)) {
|
|
24941
|
+
return path43;
|
|
24864
24942
|
}
|
|
24865
|
-
return joinPaths(root2,
|
|
24943
|
+
return joinPaths(root2, path43);
|
|
24866
24944
|
}
|
|
24867
|
-
function makePermalink(baseURL,
|
|
24945
|
+
function makePermalink(baseURL, path43) {
|
|
24868
24946
|
const base2 = baseURL.replace(/\/$/, "");
|
|
24869
|
-
const cleanPath =
|
|
24947
|
+
const cleanPath = path43.replace(/^\//, "");
|
|
24870
24948
|
const fullURL = `${base2}/${cleanPath}`;
|
|
24871
24949
|
try {
|
|
24872
24950
|
return new URL(fullURL);
|
|
@@ -24895,7 +24973,7 @@ var init_paths2 = __esm({
|
|
|
24895
24973
|
});
|
|
24896
24974
|
|
|
24897
24975
|
// internal/domain/content/entity/page.ts
|
|
24898
|
-
var
|
|
24976
|
+
var import_path21, log48, PageImpl, TaxonomyPageImpl, TermPageImpl;
|
|
24899
24977
|
var init_page = __esm({
|
|
24900
24978
|
"internal/domain/content/entity/page.ts"() {
|
|
24901
24979
|
"use strict";
|
|
@@ -24907,7 +24985,7 @@ var init_page = __esm({
|
|
|
24907
24985
|
init_paths2();
|
|
24908
24986
|
init_doctree();
|
|
24909
24987
|
init_sort();
|
|
24910
|
-
|
|
24988
|
+
import_path21 = __toESM(require("path"));
|
|
24911
24989
|
init_log();
|
|
24912
24990
|
log48 = getDomainLogger("content", { component: "page" });
|
|
24913
24991
|
PageImpl = class {
|
|
@@ -24985,8 +25063,8 @@ var init_page = __esm({
|
|
|
24985
25063
|
* 3. Handle index files (index → parent folder)
|
|
24986
25064
|
* 4. Handle _index files (Hugo-style section index)
|
|
24987
25065
|
*/
|
|
24988
|
-
pathToSlug(
|
|
24989
|
-
let slug2 =
|
|
25066
|
+
pathToSlug(path43) {
|
|
25067
|
+
let slug2 = path43.replace(/^\//, "");
|
|
24990
25068
|
slug2 = slug2.replace(/\.md$/, "");
|
|
24991
25069
|
if (slug2.endsWith("/index")) {
|
|
24992
25070
|
slug2 = slug2.replace(/\/index$/, "");
|
|
@@ -25013,7 +25091,7 @@ var init_page = __esm({
|
|
|
25013
25091
|
if (/^(https?:)?\/\//.test(src)) {
|
|
25014
25092
|
return src;
|
|
25015
25093
|
}
|
|
25016
|
-
src =
|
|
25094
|
+
src = import_path21.default.normalize(src);
|
|
25017
25095
|
src = src.replace(/\\/g, "/");
|
|
25018
25096
|
if (src.startsWith("/")) {
|
|
25019
25097
|
src = src.slice(1);
|
|
@@ -25733,12 +25811,12 @@ var init_type11 = __esm({
|
|
|
25733
25811
|
function newBaseOf() {
|
|
25734
25812
|
return new BaseOf();
|
|
25735
25813
|
}
|
|
25736
|
-
var
|
|
25814
|
+
var path30, BaseOf;
|
|
25737
25815
|
var init_baseof = __esm({
|
|
25738
25816
|
"internal/domain/template/vo/baseof.ts"() {
|
|
25739
25817
|
"use strict";
|
|
25740
25818
|
init_type11();
|
|
25741
|
-
|
|
25819
|
+
path30 = __toESM(require("path"));
|
|
25742
25820
|
BaseOf = class {
|
|
25743
25821
|
baseof = /* @__PURE__ */ new Map();
|
|
25744
25822
|
needsBaseof = /* @__PURE__ */ new Map();
|
|
@@ -25778,7 +25856,7 @@ var init_baseof = __esm({
|
|
|
25778
25856
|
* Check if path is a base template path
|
|
25779
25857
|
*/
|
|
25780
25858
|
isBaseTemplatePath(filePath) {
|
|
25781
|
-
return
|
|
25859
|
+
return path30.basename(filePath).includes(BASE_FILE_BASE);
|
|
25782
25860
|
}
|
|
25783
25861
|
/**
|
|
25784
25862
|
* Check if template needs base template
|
|
@@ -27533,8 +27611,8 @@ var init_registry = __esm({
|
|
|
27533
27611
|
}
|
|
27534
27612
|
},
|
|
27535
27613
|
// PathEscape escapes special characters in a URL path
|
|
27536
|
-
PathEscape: (
|
|
27537
|
-
return encodeURIComponent(
|
|
27614
|
+
PathEscape: (path43) => {
|
|
27615
|
+
return encodeURIComponent(path43).replace(/%2F/g, "/").replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
27538
27616
|
},
|
|
27539
27617
|
// QueryEscape escapes special characters in a URL query
|
|
27540
27618
|
QueryEscape: (query) => {
|
|
@@ -28690,11 +28768,11 @@ var init_registry = __esm({
|
|
|
28690
28768
|
}
|
|
28691
28769
|
}
|
|
28692
28770
|
}
|
|
28693
|
-
const getNestedValue = (obj,
|
|
28694
|
-
if (!
|
|
28771
|
+
const getNestedValue = (obj, path43) => {
|
|
28772
|
+
if (!path43 || path43 === "value") {
|
|
28695
28773
|
return obj;
|
|
28696
28774
|
}
|
|
28697
|
-
const keys =
|
|
28775
|
+
const keys = path43.split(".");
|
|
28698
28776
|
let current = obj;
|
|
28699
28777
|
for (const key2 of keys) {
|
|
28700
28778
|
if (current === null || current === void 0) {
|
|
@@ -29259,23 +29337,23 @@ var init_registry = __esm({
|
|
|
29259
29337
|
registerPathFunctions(funcMap) {
|
|
29260
29338
|
funcMap.set("path", () => ({
|
|
29261
29339
|
// Base returns the last element of path
|
|
29262
|
-
Base: (
|
|
29263
|
-
if (!
|
|
29340
|
+
Base: (path43) => {
|
|
29341
|
+
if (!path43)
|
|
29264
29342
|
return ".";
|
|
29265
|
-
|
|
29266
|
-
|
|
29267
|
-
if (!
|
|
29343
|
+
path43 = path43.replace(/\\/g, "/");
|
|
29344
|
+
path43 = path43.replace(/\/+$/, "");
|
|
29345
|
+
if (!path43)
|
|
29268
29346
|
return "/";
|
|
29269
|
-
const parts =
|
|
29347
|
+
const parts = path43.split("/");
|
|
29270
29348
|
return parts[parts.length - 1] || "/";
|
|
29271
29349
|
},
|
|
29272
29350
|
// Clean returns the shortest path name equivalent to path
|
|
29273
|
-
Clean: (
|
|
29274
|
-
if (!
|
|
29351
|
+
Clean: (path43) => {
|
|
29352
|
+
if (!path43)
|
|
29275
29353
|
return ".";
|
|
29276
|
-
|
|
29277
|
-
const isAbs =
|
|
29278
|
-
const parts =
|
|
29354
|
+
path43 = path43.replace(/\\/g, "/");
|
|
29355
|
+
const isAbs = path43.startsWith("/");
|
|
29356
|
+
const parts = path43.split("/").filter((p2) => p2 && p2 !== ".");
|
|
29279
29357
|
const stack = [];
|
|
29280
29358
|
for (const part of parts) {
|
|
29281
29359
|
if (part === "..") {
|
|
@@ -29288,56 +29366,56 @@ var init_registry = __esm({
|
|
|
29288
29366
|
stack.push(part);
|
|
29289
29367
|
}
|
|
29290
29368
|
}
|
|
29291
|
-
|
|
29369
|
+
path43 = stack.join("/");
|
|
29292
29370
|
if (isAbs)
|
|
29293
|
-
|
|
29294
|
-
return
|
|
29371
|
+
path43 = "/" + path43;
|
|
29372
|
+
return path43 || (isAbs ? "/" : ".");
|
|
29295
29373
|
},
|
|
29296
29374
|
// Dir returns all but the last element of path
|
|
29297
|
-
Dir: (
|
|
29298
|
-
if (!
|
|
29375
|
+
Dir: (path43) => {
|
|
29376
|
+
if (!path43)
|
|
29299
29377
|
return ".";
|
|
29300
|
-
|
|
29301
|
-
if (!
|
|
29378
|
+
path43 = path43.replace(/\/+$/, "");
|
|
29379
|
+
if (!path43)
|
|
29302
29380
|
return "/";
|
|
29303
|
-
const parts =
|
|
29381
|
+
const parts = path43.split("/");
|
|
29304
29382
|
parts.pop();
|
|
29305
29383
|
return parts.join("/") || ".";
|
|
29306
29384
|
},
|
|
29307
29385
|
// Ext returns the file name extension
|
|
29308
|
-
Ext: (
|
|
29309
|
-
const base2 =
|
|
29386
|
+
Ext: (path43) => {
|
|
29387
|
+
const base2 = path43.split("/").pop() || "";
|
|
29310
29388
|
const dot = base2.lastIndexOf(".");
|
|
29311
29389
|
if (dot === -1 || dot === 0)
|
|
29312
29390
|
return "";
|
|
29313
29391
|
return base2.substring(dot);
|
|
29314
29392
|
},
|
|
29315
29393
|
// IsAbs reports whether the path is absolute
|
|
29316
|
-
IsAbs: (
|
|
29317
|
-
return
|
|
29394
|
+
IsAbs: (path43) => {
|
|
29395
|
+
return path43.startsWith("/");
|
|
29318
29396
|
},
|
|
29319
29397
|
// Join joins any number of path elements into a single path
|
|
29320
29398
|
Join: (...elements) => {
|
|
29321
29399
|
if (elements.length === 0)
|
|
29322
29400
|
return ".";
|
|
29323
29401
|
const parts = elements.filter((e) => e).map((e) => e.replace(/^\/+|\/+$/g, ""));
|
|
29324
|
-
let
|
|
29402
|
+
let path43 = parts.join("/");
|
|
29325
29403
|
if (elements[0] && elements[0].startsWith("/")) {
|
|
29326
|
-
|
|
29404
|
+
path43 = "/" + path43;
|
|
29327
29405
|
}
|
|
29328
|
-
return
|
|
29406
|
+
return path43 || ".";
|
|
29329
29407
|
},
|
|
29330
29408
|
// Split splits path immediately following the final slash
|
|
29331
|
-
Split: (
|
|
29332
|
-
if (!
|
|
29409
|
+
Split: (path43) => {
|
|
29410
|
+
if (!path43)
|
|
29333
29411
|
return [".", ""];
|
|
29334
|
-
const lastSlash =
|
|
29412
|
+
const lastSlash = path43.lastIndexOf("/");
|
|
29335
29413
|
if (lastSlash === -1) {
|
|
29336
|
-
return ["",
|
|
29414
|
+
return ["", path43];
|
|
29337
29415
|
}
|
|
29338
29416
|
return [
|
|
29339
|
-
|
|
29340
|
-
|
|
29417
|
+
path43.substring(0, lastSlash),
|
|
29418
|
+
path43.substring(lastSlash + 1)
|
|
29341
29419
|
];
|
|
29342
29420
|
}
|
|
29343
29421
|
}));
|
|
@@ -29623,11 +29701,11 @@ var init_registry = __esm({
|
|
|
29623
29701
|
* Get nested value from object using dot notation path
|
|
29624
29702
|
* Following golang's path resolution logic
|
|
29625
29703
|
*/
|
|
29626
|
-
getNestedValue(obj,
|
|
29627
|
-
if (!obj || !
|
|
29704
|
+
getNestedValue(obj, path43) {
|
|
29705
|
+
if (!obj || !path43) {
|
|
29628
29706
|
return void 0;
|
|
29629
29707
|
}
|
|
29630
|
-
const cleanPath =
|
|
29708
|
+
const cleanPath = path43.replace(/^\\.+/, "");
|
|
29631
29709
|
const parts = cleanPath.split(".");
|
|
29632
29710
|
let current = obj;
|
|
29633
29711
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -30162,14 +30240,14 @@ var init_pagebuilder = __esm({
|
|
|
30162
30240
|
* Parse kind - exact replica of Go's parseKind method
|
|
30163
30241
|
*/
|
|
30164
30242
|
async parseKind() {
|
|
30165
|
-
const
|
|
30243
|
+
const path43 = this.source.file.paths();
|
|
30166
30244
|
let kind = "";
|
|
30167
30245
|
if (this.fm) {
|
|
30168
30246
|
kind = this.fm.kind || "";
|
|
30169
30247
|
}
|
|
30170
30248
|
if (kind === "") {
|
|
30171
30249
|
kind = getKindMain("page");
|
|
30172
|
-
const base2 =
|
|
30250
|
+
const base2 = path43.baseNoLeadingSlash();
|
|
30173
30251
|
switch (base2) {
|
|
30174
30252
|
case PAGE_HOME_BASE:
|
|
30175
30253
|
case "":
|
|
@@ -30184,9 +30262,9 @@ var init_pagebuilder = __esm({
|
|
|
30184
30262
|
default:
|
|
30185
30263
|
if (this.source.file.isBranchBundle()) {
|
|
30186
30264
|
kind = getKindMain("section");
|
|
30187
|
-
const v = this.taxonomy.getTaxonomy(
|
|
30265
|
+
const v = this.taxonomy.getTaxonomy(path43.path());
|
|
30188
30266
|
if (!this.taxonomy.isZero(v)) {
|
|
30189
|
-
if (this.taxonomy.isTaxonomyPath(
|
|
30267
|
+
if (this.taxonomy.isTaxonomyPath(path43.path())) {
|
|
30190
30268
|
kind = getKindMain("taxonomy");
|
|
30191
30269
|
} else {
|
|
30192
30270
|
kind = getKindMain("term");
|
|
@@ -30473,7 +30551,7 @@ function cleanTreeKey2(...elem) {
|
|
|
30473
30551
|
if (elem.length > 0) {
|
|
30474
30552
|
s2 = elem[0];
|
|
30475
30553
|
if (elem.length > 1) {
|
|
30476
|
-
s2 =
|
|
30554
|
+
s2 = path31.join(...elem);
|
|
30477
30555
|
}
|
|
30478
30556
|
}
|
|
30479
30557
|
s2 = s2.replace(/^[\.\/ \s]+|[\.\/ \s]+$/g, "");
|
|
@@ -30486,14 +30564,14 @@ function cleanTreeKey2(...elem) {
|
|
|
30486
30564
|
}
|
|
30487
30565
|
return s2;
|
|
30488
30566
|
}
|
|
30489
|
-
var
|
|
30567
|
+
var path31, filepath, Taxonomy2;
|
|
30490
30568
|
var init_taxonomy3 = __esm({
|
|
30491
30569
|
"internal/domain/content/entity/taxonomy.ts"() {
|
|
30492
30570
|
"use strict";
|
|
30493
30571
|
init_pagetrees();
|
|
30494
30572
|
init_fileinfo2();
|
|
30495
30573
|
init_pagesource();
|
|
30496
|
-
|
|
30574
|
+
path31 = __toESM(require("path"));
|
|
30497
30575
|
filepath = __toESM(require("path"));
|
|
30498
30576
|
Taxonomy2 = class {
|
|
30499
30577
|
views;
|
|
@@ -30524,7 +30602,7 @@ var init_taxonomy3 = __esm({
|
|
|
30524
30602
|
if (!ta) {
|
|
30525
30603
|
return false;
|
|
30526
30604
|
}
|
|
30527
|
-
return p2 ===
|
|
30605
|
+
return p2 === path31.join(this.pluralTreeKey(ta.plural()), "_index.md");
|
|
30528
30606
|
}
|
|
30529
30607
|
/**
|
|
30530
30608
|
* PluralTreeKey - exact replica of Go's PluralTreeKey method
|
|
@@ -30829,11 +30907,11 @@ var init_pager = __esm({
|
|
|
30829
30907
|
});
|
|
30830
30908
|
|
|
30831
30909
|
// internal/domain/site/entity/page.ts
|
|
30832
|
-
var
|
|
30910
|
+
var import_path22, log57, Page2;
|
|
30833
30911
|
var init_page2 = __esm({
|
|
30834
30912
|
"internal/domain/site/entity/page.ts"() {
|
|
30835
30913
|
"use strict";
|
|
30836
|
-
|
|
30914
|
+
import_path22 = __toESM(require("path"));
|
|
30837
30915
|
init_log();
|
|
30838
30916
|
init_pager();
|
|
30839
30917
|
log57 = getDomainLogger("site", { component: "page" });
|
|
@@ -30953,14 +31031,14 @@ var init_page2 = __esm({
|
|
|
30953
31031
|
} else {
|
|
30954
31032
|
prefix = this.site.getLanguage().getCurrentLanguage();
|
|
30955
31033
|
}
|
|
30956
|
-
targetFilenames.push(
|
|
31034
|
+
targetFilenames.push(import_path22.default.join(prefix, this.getPageOutput().targetFilePath()));
|
|
30957
31035
|
await this.renderAndWritePage(tmpl, targetFilenames);
|
|
30958
31036
|
const current = await this.current();
|
|
30959
31037
|
if (current) {
|
|
30960
31038
|
let currentPager = current.next();
|
|
30961
31039
|
while (currentPager) {
|
|
30962
31040
|
this.setCurrent(currentPager);
|
|
30963
|
-
const paginationTargets = [
|
|
31041
|
+
const paginationTargets = [import_path22.default.join(prefix, currentPager.url(), this.getPageOutput().targetFileBase())];
|
|
30964
31042
|
await this.renderAndWritePage(tmpl, paginationTargets);
|
|
30965
31043
|
currentPager = currentPager.next();
|
|
30966
31044
|
}
|
|
@@ -30993,7 +31071,7 @@ var init_page2 = __esm({
|
|
|
30993
31071
|
prefix = this.site.getLanguage().getCurrentLanguage();
|
|
30994
31072
|
}
|
|
30995
31073
|
let resourcePath = pageSource.path();
|
|
30996
|
-
targetFilenames.push(
|
|
31074
|
+
targetFilenames.push(import_path22.default.join(prefix, resourcePath));
|
|
30997
31075
|
let stream = null;
|
|
30998
31076
|
try {
|
|
30999
31077
|
const opener = () => pageSource.pageFile().open();
|
|
@@ -31648,11 +31726,11 @@ var init_baseurl = __esm({
|
|
|
31648
31726
|
/**
|
|
31649
31727
|
* Returns the appropriate root URL based on the path.
|
|
31650
31728
|
*/
|
|
31651
|
-
getRoot(
|
|
31729
|
+
getRoot(path43) {
|
|
31652
31730
|
if (this.isRelative) {
|
|
31653
31731
|
return this.basePath;
|
|
31654
31732
|
}
|
|
31655
|
-
if (
|
|
31733
|
+
if (path43.startsWith("/")) {
|
|
31656
31734
|
return this.withoutPath;
|
|
31657
31735
|
}
|
|
31658
31736
|
return this.withPath;
|
|
@@ -33046,8 +33124,8 @@ function assertNonEmpty(part, name) {
|
|
|
33046
33124
|
throw new Error("`" + name + "` cannot be empty");
|
|
33047
33125
|
}
|
|
33048
33126
|
}
|
|
33049
|
-
function assertPath(
|
|
33050
|
-
if (!
|
|
33127
|
+
function assertPath(path43, name) {
|
|
33128
|
+
if (!path43) {
|
|
33051
33129
|
throw new Error("Setting `" + name + "` requires `path` to be set too");
|
|
33052
33130
|
}
|
|
33053
33131
|
}
|
|
@@ -33232,13 +33310,13 @@ var init_lib4 = __esm({
|
|
|
33232
33310
|
* @returns {undefined}
|
|
33233
33311
|
* Nothing.
|
|
33234
33312
|
*/
|
|
33235
|
-
set path(
|
|
33236
|
-
if (isUrl(
|
|
33237
|
-
|
|
33313
|
+
set path(path43) {
|
|
33314
|
+
if (isUrl(path43)) {
|
|
33315
|
+
path43 = (0, import_node_url.fileURLToPath)(path43);
|
|
33238
33316
|
}
|
|
33239
|
-
assertNonEmpty(
|
|
33240
|
-
if (this.path !==
|
|
33241
|
-
this.history.push(
|
|
33317
|
+
assertNonEmpty(path43, "path");
|
|
33318
|
+
if (this.path !== path43) {
|
|
33319
|
+
this.history.push(path43);
|
|
33242
33320
|
}
|
|
33243
33321
|
}
|
|
33244
33322
|
/**
|
|
@@ -45999,7 +46077,7 @@ var init_is_absolute_url = __esm({
|
|
|
45999
46077
|
function createHtmlLinkProcessor(graph, options) {
|
|
46000
46078
|
return new HtmlLinkProcessor(graph, options);
|
|
46001
46079
|
}
|
|
46002
|
-
var
|
|
46080
|
+
var import_path24, log61, defaultOptions, HtmlLinkProcessor;
|
|
46003
46081
|
var init_html_link_processor = __esm({
|
|
46004
46082
|
"internal/domain/site/service/html-link-processor.ts"() {
|
|
46005
46083
|
"use strict";
|
|
@@ -46008,7 +46086,7 @@ var init_html_link_processor = __esm({
|
|
|
46008
46086
|
init_rehype_stringify();
|
|
46009
46087
|
init_unist_util_visit();
|
|
46010
46088
|
init_is_absolute_url();
|
|
46011
|
-
|
|
46089
|
+
import_path24 = __toESM(require("path"));
|
|
46012
46090
|
init_path3();
|
|
46013
46091
|
init_log();
|
|
46014
46092
|
log61 = getDomainLogger("site", { component: "HtmlLinkProcessor" });
|
|
@@ -46146,7 +46224,7 @@ var init_html_link_processor = __esm({
|
|
|
46146
46224
|
node.properties["data-slug"] = full;
|
|
46147
46225
|
}
|
|
46148
46226
|
if (opts.prettyLinks && isInternal && node.children.length === 1 && node.children[0].type === "text" && !node.children[0].value.startsWith("#")) {
|
|
46149
|
-
node.children[0].value =
|
|
46227
|
+
node.children[0].value = import_path24.default.basename(node.children[0].value);
|
|
46150
46228
|
}
|
|
46151
46229
|
}
|
|
46152
46230
|
if (["img", "video", "audio", "iframe"].includes(node.tagName) && node.properties && typeof node.properties.src === "string") {
|
|
@@ -47040,14 +47118,14 @@ var init_site = __esm({
|
|
|
47040
47118
|
|
|
47041
47119
|
// internal/domain/site/entity/publisher.ts
|
|
47042
47120
|
async function openFileForWriting(fs13, filename) {
|
|
47043
|
-
const cleanFilename =
|
|
47121
|
+
const cleanFilename = import_path26.default.normalize(filename);
|
|
47044
47122
|
try {
|
|
47045
47123
|
return await fs13.create(cleanFilename);
|
|
47046
47124
|
} catch (error) {
|
|
47047
47125
|
if (!isFileNotFoundError(error)) {
|
|
47048
47126
|
throw error;
|
|
47049
47127
|
}
|
|
47050
|
-
const dir2 =
|
|
47128
|
+
const dir2 = import_path26.default.dirname(cleanFilename);
|
|
47051
47129
|
await fs13.mkdirAll(dir2, 511);
|
|
47052
47130
|
return await fs13.create(cleanFilename);
|
|
47053
47131
|
}
|
|
@@ -47055,11 +47133,11 @@ async function openFileForWriting(fs13, filename) {
|
|
|
47055
47133
|
function isFileNotFoundError(error) {
|
|
47056
47134
|
return error && (error.code === "ENOENT" || error.code === "FILE_NOT_FOUND" || error.message?.includes("not found") || error.message?.includes("no such file"));
|
|
47057
47135
|
}
|
|
47058
|
-
var
|
|
47136
|
+
var import_path26, log64, Publisher, MultiWriter;
|
|
47059
47137
|
var init_publisher2 = __esm({
|
|
47060
47138
|
"internal/domain/site/entity/publisher.ts"() {
|
|
47061
47139
|
"use strict";
|
|
47062
|
-
|
|
47140
|
+
import_path26 = __toESM(require("path"));
|
|
47063
47141
|
init_log();
|
|
47064
47142
|
log64 = getDomainLogger("site", { component: "publisher" });
|
|
47065
47143
|
Publisher = class {
|
|
@@ -47920,8 +47998,8 @@ var init_menu_builder = __esm({
|
|
|
47920
47998
|
/**
|
|
47921
47999
|
* Fallback URL generation from path (used when site page conversion fails)
|
|
47922
48000
|
*/
|
|
47923
|
-
fallbackUrlFromPath(
|
|
47924
|
-
let url =
|
|
48001
|
+
fallbackUrlFromPath(path43) {
|
|
48002
|
+
let url = path43.replace(/\.md$/, "");
|
|
47925
48003
|
if (!url.startsWith("/")) {
|
|
47926
48004
|
url = "/" + url;
|
|
47927
48005
|
}
|
|
@@ -48844,11 +48922,11 @@ var init_template4 = __esm({
|
|
|
48844
48922
|
});
|
|
48845
48923
|
|
|
48846
48924
|
// internal/domain/resources/entity/publisher.ts
|
|
48847
|
-
var
|
|
48925
|
+
var path35, import_stream2, log73, Publisher2, FileWritable;
|
|
48848
48926
|
var init_publisher3 = __esm({
|
|
48849
48927
|
"internal/domain/resources/entity/publisher.ts"() {
|
|
48850
48928
|
"use strict";
|
|
48851
|
-
|
|
48929
|
+
path35 = __toESM(require("path"));
|
|
48852
48930
|
init_log();
|
|
48853
48931
|
import_stream2 = require("stream");
|
|
48854
48932
|
log73 = getDomainLogger("resources", { component: "publisher" });
|
|
@@ -48883,7 +48961,7 @@ var init_publisher3 = __esm({
|
|
|
48883
48961
|
return new FileWritable(file);
|
|
48884
48962
|
} catch (error) {
|
|
48885
48963
|
if (error.code === "ENOENT" || error.message.includes("ENOENT")) {
|
|
48886
|
-
const dir2 =
|
|
48964
|
+
const dir2 = path35.dirname(cleanFilename);
|
|
48887
48965
|
await this.pubFs.mkdirAll(dir2, 511);
|
|
48888
48966
|
const file = await this.pubFs.create(cleanFilename);
|
|
48889
48967
|
const originalClose = file.close.bind(file);
|
|
@@ -48917,14 +48995,14 @@ var init_publisher3 = __esm({
|
|
|
48917
48995
|
* TypeScript equivalent of OpenFileForWriting function from Go
|
|
48918
48996
|
*/
|
|
48919
48997
|
async openFileForWriting(filename) {
|
|
48920
|
-
const cleanFilename =
|
|
48998
|
+
const cleanFilename = path35.normalize(filename);
|
|
48921
48999
|
try {
|
|
48922
49000
|
return await this.pubFs.create(cleanFilename);
|
|
48923
49001
|
} catch (error) {
|
|
48924
49002
|
if (!this.isFileNotFoundError(error)) {
|
|
48925
49003
|
throw error;
|
|
48926
49004
|
}
|
|
48927
|
-
const dir2 =
|
|
49005
|
+
const dir2 = path35.dirname(cleanFilename);
|
|
48928
49006
|
await this.pubFs.mkdirAll(dir2, 511);
|
|
48929
49007
|
return await this.pubFs.create(cleanFilename);
|
|
48930
49008
|
}
|
|
@@ -49052,7 +49130,7 @@ var init_http2 = __esm({
|
|
|
49052
49130
|
});
|
|
49053
49131
|
|
|
49054
49132
|
// internal/domain/resources/entity/resources.ts
|
|
49055
|
-
var
|
|
49133
|
+
var path36, import_crypto4, log75, Resources;
|
|
49056
49134
|
var init_resources = __esm({
|
|
49057
49135
|
"internal/domain/resources/entity/resources.ts"() {
|
|
49058
49136
|
"use strict";
|
|
@@ -49064,7 +49142,7 @@ var init_resources = __esm({
|
|
|
49064
49142
|
init_publisher3();
|
|
49065
49143
|
init_http2();
|
|
49066
49144
|
init_type9();
|
|
49067
|
-
|
|
49145
|
+
path36 = __toESM(require("path"));
|
|
49068
49146
|
import_crypto4 = require("crypto");
|
|
49069
49147
|
init_log();
|
|
49070
49148
|
log75 = getDomainLogger("resources", { component: "resources" });
|
|
@@ -49099,7 +49177,7 @@ var init_resources = __esm({
|
|
|
49099
49177
|
* Supports caching for performance optimization
|
|
49100
49178
|
*/
|
|
49101
49179
|
async getResource(pathname) {
|
|
49102
|
-
const cleanPath =
|
|
49180
|
+
const cleanPath = path36.posix.normalize(pathname);
|
|
49103
49181
|
const cacheKey = `${cleanPath}__get`;
|
|
49104
49182
|
if (this.cache.has(cacheKey)) {
|
|
49105
49183
|
return this.cache.get(cacheKey) || null;
|
|
@@ -49128,7 +49206,7 @@ var init_resources = __esm({
|
|
|
49128
49206
|
* GetResourceWithOpener - Alternative way to get resource with custom opener
|
|
49129
49207
|
*/
|
|
49130
49208
|
async getResourceWithOpener(pathname, opener) {
|
|
49131
|
-
const cleanPath =
|
|
49209
|
+
const cleanPath = path36.posix.normalize(pathname);
|
|
49132
49210
|
const cacheKey = `${cleanPath}__get_with_opener`;
|
|
49133
49211
|
if (this.cache.has(cacheKey)) {
|
|
49134
49212
|
return this.cache.get(cacheKey) || null;
|
|
@@ -49266,7 +49344,7 @@ var init_resources = __esm({
|
|
|
49266
49344
|
*/
|
|
49267
49345
|
async buildResource(pathname, opener) {
|
|
49268
49346
|
try {
|
|
49269
|
-
const ext =
|
|
49347
|
+
const ext = path36.extname(pathname);
|
|
49270
49348
|
const mediaType = this.getMediaTypeFromExtension(ext);
|
|
49271
49349
|
const resourcePaths = ResourcePaths.newResourcePaths(pathname, this.workspace);
|
|
49272
49350
|
const resource = new ResourceImpl(
|
|
@@ -49368,11 +49446,11 @@ var init_resources = __esm({
|
|
|
49368
49446
|
});
|
|
49369
49447
|
|
|
49370
49448
|
// internal/domain/resources/valueobject/resourcepaths.ts
|
|
49371
|
-
var
|
|
49449
|
+
var path37, ResourcePaths;
|
|
49372
49450
|
var init_resourcepaths = __esm({
|
|
49373
49451
|
"internal/domain/resources/valueobject/resourcepaths.ts"() {
|
|
49374
49452
|
"use strict";
|
|
49375
|
-
|
|
49453
|
+
path37 = __toESM(require("path"));
|
|
49376
49454
|
ResourcePaths = class _ResourcePaths {
|
|
49377
49455
|
// This is the directory component for the target file or link.
|
|
49378
49456
|
dir;
|
|
@@ -49395,7 +49473,7 @@ var init_resourcepaths = __esm({
|
|
|
49395
49473
|
}
|
|
49396
49474
|
static newResourcePaths(targetPath, svc) {
|
|
49397
49475
|
const normalizedPath = targetPath.replace(/\\/g, "/");
|
|
49398
|
-
const parsedPath =
|
|
49476
|
+
const parsedPath = path37.posix.parse(normalizedPath);
|
|
49399
49477
|
let dir2 = parsedPath.dir;
|
|
49400
49478
|
if (dir2 === "/") {
|
|
49401
49479
|
dir2 = "";
|
|
@@ -49452,7 +49530,7 @@ var init_resourcepaths = __esm({
|
|
|
49452
49530
|
}
|
|
49453
49531
|
fromTargetPath(targetPath) {
|
|
49454
49532
|
const normalizedPath = targetPath.replace(/\\/g, "/");
|
|
49455
|
-
const parsedPath =
|
|
49533
|
+
const parsedPath = path37.posix.parse(normalizedPath);
|
|
49456
49534
|
let dir2 = parsedPath.dir;
|
|
49457
49535
|
if (dir2 === "/") {
|
|
49458
49536
|
dir2 = "";
|
|
@@ -49598,7 +49676,7 @@ function getDomainInstances() {
|
|
|
49598
49676
|
}
|
|
49599
49677
|
async function loadConfiguration(projDir, modulesDir) {
|
|
49600
49678
|
const osFs = newOsFs();
|
|
49601
|
-
const configFilePath =
|
|
49679
|
+
const configFilePath = import_path27.default.join(projDir, "config.json");
|
|
49602
49680
|
return await loadConfigWithParams(osFs, configFilePath, projDir, modulesDir);
|
|
49603
49681
|
}
|
|
49604
49682
|
async function createModule(config) {
|
|
@@ -49844,11 +49922,11 @@ function createSiteForSSG(config, fs13, content) {
|
|
|
49844
49922
|
searchPage: async (pages, page) => {
|
|
49845
49923
|
return [];
|
|
49846
49924
|
},
|
|
49847
|
-
getPageFromPath: async (langIndex,
|
|
49925
|
+
getPageFromPath: async (langIndex, path43) => {
|
|
49848
49926
|
try {
|
|
49849
|
-
const page = content.getPageFromPath(langIndex,
|
|
49927
|
+
const page = content.getPageFromPath(langIndex, path43);
|
|
49850
49928
|
if (!page) {
|
|
49851
|
-
log76.error(`\u26A0\uFE0F Application.getPageFromPath: content domain returned null for path: "${
|
|
49929
|
+
log76.error(`\u26A0\uFE0F Application.getPageFromPath: content domain returned null for path: "${path43}"`);
|
|
49852
49930
|
}
|
|
49853
49931
|
return page;
|
|
49854
49932
|
} catch (error) {
|
|
@@ -49856,11 +49934,11 @@ function createSiteForSSG(config, fs13, content) {
|
|
|
49856
49934
|
return null;
|
|
49857
49935
|
}
|
|
49858
49936
|
},
|
|
49859
|
-
getPageFromPathSync: (langIndex,
|
|
49937
|
+
getPageFromPathSync: (langIndex, path43) => {
|
|
49860
49938
|
try {
|
|
49861
|
-
const page = content.getPageFromPath(langIndex,
|
|
49939
|
+
const page = content.getPageFromPath(langIndex, path43);
|
|
49862
49940
|
if (!page) {
|
|
49863
|
-
log76.warn(`\u26A0\uFE0F Application.getPageFromPathSync: content domain returned null for path: ${
|
|
49941
|
+
log76.warn(`\u26A0\uFE0F Application.getPageFromPathSync: content domain returned null for path: ${path43}`);
|
|
49864
49942
|
}
|
|
49865
49943
|
return page;
|
|
49866
49944
|
} catch (error) {
|
|
@@ -49895,14 +49973,14 @@ function createSiteForSSG(config, fs13, content) {
|
|
|
49895
49973
|
},
|
|
49896
49974
|
workingDir: () => config.getProvider().getString("workingDir") || process.cwd(),
|
|
49897
49975
|
// ResourceService implementation (placeholder)
|
|
49898
|
-
getResource: async (
|
|
49976
|
+
getResource: async (path43) => {
|
|
49899
49977
|
return null;
|
|
49900
49978
|
},
|
|
49901
|
-
getResourceWithOpener: async (
|
|
49979
|
+
getResourceWithOpener: async (path43, opener) => {
|
|
49902
49980
|
return {
|
|
49903
|
-
name: () =>
|
|
49981
|
+
name: () => path43,
|
|
49904
49982
|
readSeekCloser: opener,
|
|
49905
|
-
targetPath: () =>
|
|
49983
|
+
targetPath: () => path43
|
|
49906
49984
|
};
|
|
49907
49985
|
},
|
|
49908
49986
|
// URLService implementation
|
|
@@ -50181,7 +50259,7 @@ async function collectAllPageTasks(projDir, modulesDir, markdown, onProgress, ht
|
|
|
50181
50259
|
throw new Error(`Failed to generate static site: ${message}`);
|
|
50182
50260
|
}
|
|
50183
50261
|
}
|
|
50184
|
-
var
|
|
50262
|
+
var import_path27, log76, configCache, modulesCache, fsCache, contentCache, resourcesCache, templateEngineCache, siteCache, createDomainInstances, tasks;
|
|
50185
50263
|
var init_ssg = __esm({
|
|
50186
50264
|
"internal/application/ssg.ts"() {
|
|
50187
50265
|
"use strict";
|
|
@@ -50192,7 +50270,7 @@ var init_ssg = __esm({
|
|
|
50192
50270
|
init_template3();
|
|
50193
50271
|
init_site2();
|
|
50194
50272
|
init_log();
|
|
50195
|
-
|
|
50273
|
+
import_path27 = __toESM(require("path"));
|
|
50196
50274
|
init_resources2();
|
|
50197
50275
|
log76 = getDomainLogger("ssg", { component: "application" });
|
|
50198
50276
|
createDomainInstances = (site, content, fs13, config, modules, resources) => {
|
|
@@ -50924,8 +51002,8 @@ var WorkerPoolManager = class {
|
|
|
50924
51002
|
* 初始化 Node.js Worker 池
|
|
50925
51003
|
*/
|
|
50926
51004
|
async initializeNodePool() {
|
|
50927
|
-
const
|
|
50928
|
-
const workerPath =
|
|
51005
|
+
const path43 = require("path");
|
|
51006
|
+
const workerPath = path43.join(__dirname, "worker", "worker-node.js");
|
|
50929
51007
|
log79.debug(`Initializing Node.js worker pool with path: ${workerPath}`);
|
|
50930
51008
|
this.pool = workerpool.pool(workerPath, {
|
|
50931
51009
|
minWorkers: this.workerCount,
|
|
@@ -51252,7 +51330,7 @@ async function processSSGParallel(projDir, modulesDir, markdown, onProgress, htt
|
|
|
51252
51330
|
|
|
51253
51331
|
// internal/interfaces/cli/commands/build.ts
|
|
51254
51332
|
init_log();
|
|
51255
|
-
var
|
|
51333
|
+
var import_path28 = __toESM(require("path"));
|
|
51256
51334
|
var import_fs15 = require("fs");
|
|
51257
51335
|
var log82 = getDomainLogger("build-command", { component: "cli" });
|
|
51258
51336
|
var BuildCommand = class {
|
|
@@ -51279,7 +51357,7 @@ var BuildCommand = class {
|
|
|
51279
51357
|
await project.loadConfig();
|
|
51280
51358
|
const projectRoot = project.getPath();
|
|
51281
51359
|
const modulesDir = options.modulesDir || workspace.getModulesDir();
|
|
51282
|
-
const outputDir = options.destination ?
|
|
51360
|
+
const outputDir = options.destination ? import_path28.default.resolve(projectRoot, options.destination) : await project.getPublishDir();
|
|
51283
51361
|
if (options.clean) {
|
|
51284
51362
|
await this.cleanOutputDir(outputDir);
|
|
51285
51363
|
log82.info(`Cleaned output directory: ${outputDir}`);
|
|
@@ -51288,7 +51366,7 @@ var BuildCommand = class {
|
|
|
51288
51366
|
let contentDirs = await project.getContentDirs();
|
|
51289
51367
|
if (options.contentDirs && options.contentDirs.length > 0) {
|
|
51290
51368
|
const extraDirs = options.contentDirs.map(
|
|
51291
|
-
(dir2) =>
|
|
51369
|
+
(dir2) => import_path28.default.resolve(projectRoot, dir2)
|
|
51292
51370
|
);
|
|
51293
51371
|
contentDirs = [...contentDirs, ...extraDirs];
|
|
51294
51372
|
log82.info(`Added extra content directories: ${options.contentDirs.join(", ")}`);
|
|
@@ -51369,7 +51447,7 @@ var BuildCommand = class {
|
|
|
51369
51447
|
const entries = await import_fs15.promises.readdir(outputDir);
|
|
51370
51448
|
await Promise.all(
|
|
51371
51449
|
entries.map(
|
|
51372
|
-
(entry) => import_fs15.promises.rm(
|
|
51450
|
+
(entry) => import_fs15.promises.rm(import_path28.default.join(outputDir, entry), { recursive: true, force: true })
|
|
51373
51451
|
)
|
|
51374
51452
|
);
|
|
51375
51453
|
} catch (error) {
|
|
@@ -51386,7 +51464,7 @@ init_log();
|
|
|
51386
51464
|
|
|
51387
51465
|
// pkg/web/watcher/content-file-watcher.ts
|
|
51388
51466
|
var chokidar = __toESM(require("chokidar"));
|
|
51389
|
-
var
|
|
51467
|
+
var path40 = __toESM(require("path"));
|
|
51390
51468
|
init_log();
|
|
51391
51469
|
var log83 = getDomainLogger("web", { component: "content-file-watcher" });
|
|
51392
51470
|
var ContentFileWatcher = class {
|
|
@@ -51445,7 +51523,7 @@ var ContentFileWatcher = class {
|
|
|
51445
51523
|
}
|
|
51446
51524
|
}
|
|
51447
51525
|
}
|
|
51448
|
-
const normalizedPath =
|
|
51526
|
+
const normalizedPath = path40.normalize(fp);
|
|
51449
51527
|
if (!this.isRelevantFile(normalizedPath)) {
|
|
51450
51528
|
return;
|
|
51451
51529
|
}
|
|
@@ -51463,11 +51541,11 @@ var ContentFileWatcher = class {
|
|
|
51463
51541
|
return this.isMarkdownFile(filePath) || this.isImageFile(filePath);
|
|
51464
51542
|
}
|
|
51465
51543
|
isMarkdownFile(filePath) {
|
|
51466
|
-
const ext =
|
|
51544
|
+
const ext = path40.extname(filePath).toLowerCase();
|
|
51467
51545
|
return ext === ".md" || ext === ".markdown";
|
|
51468
51546
|
}
|
|
51469
51547
|
isImageFile(filePath) {
|
|
51470
|
-
const ext =
|
|
51548
|
+
const ext = path40.extname(filePath).toLowerCase();
|
|
51471
51549
|
return [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp", ".bmp"].includes(ext);
|
|
51472
51550
|
}
|
|
51473
51551
|
scheduleBatch() {
|
|
@@ -51514,7 +51592,7 @@ var ContentFileWatcher = class {
|
|
|
51514
51592
|
|
|
51515
51593
|
// pkg/web/server/livereload-server.ts
|
|
51516
51594
|
var http3 = __toESM(require("http"));
|
|
51517
|
-
var
|
|
51595
|
+
var path41 = __toESM(require("path"));
|
|
51518
51596
|
var fs11 = __toESM(require("fs/promises"));
|
|
51519
51597
|
var import_ws = require("ws");
|
|
51520
51598
|
init_log();
|
|
@@ -51585,7 +51663,7 @@ var FoundryLiveReloadServer = class {
|
|
|
51585
51663
|
};
|
|
51586
51664
|
if (changedFiles && changedFiles.length === 1) {
|
|
51587
51665
|
const file = changedFiles[0];
|
|
51588
|
-
const ext =
|
|
51666
|
+
const ext = path41.extname(file).toLowerCase();
|
|
51589
51667
|
if (ext === ".css") {
|
|
51590
51668
|
reloadEvent.path = file;
|
|
51591
51669
|
reloadEvent.liveCSS = true;
|
|
@@ -51669,7 +51747,7 @@ var FoundryLiveReloadServer = class {
|
|
|
51669
51747
|
try {
|
|
51670
51748
|
const stats = await fs11.stat(filePath);
|
|
51671
51749
|
if (stats.isDirectory()) {
|
|
51672
|
-
const indexPath =
|
|
51750
|
+
const indexPath = path41.join(filePath, "index.html");
|
|
51673
51751
|
try {
|
|
51674
51752
|
await fs11.stat(indexPath);
|
|
51675
51753
|
filePath = indexPath;
|
|
@@ -51715,9 +51793,9 @@ var FoundryLiveReloadServer = class {
|
|
|
51715
51793
|
log84.warn("Failed to decode URL:", cleanUrl, error);
|
|
51716
51794
|
decodedUrl = cleanUrl;
|
|
51717
51795
|
}
|
|
51718
|
-
const normalizedPath =
|
|
51796
|
+
const normalizedPath = path41.normalize(decodedUrl).replace(/^(\.\.[\/\\])+/, "");
|
|
51719
51797
|
const relativePath = normalizedPath.startsWith("/") ? normalizedPath.slice(1) : normalizedPath;
|
|
51720
|
-
const resolvedPath =
|
|
51798
|
+
const resolvedPath = path41.join(this.config.publicDir, relativePath);
|
|
51721
51799
|
if (process.platform === "win32" && resolvedPath.length > 260) {
|
|
51722
51800
|
log84.warn("Path too long for Windows filesystem:", resolvedPath);
|
|
51723
51801
|
}
|
|
@@ -51730,7 +51808,7 @@ var FoundryLiveReloadServer = class {
|
|
|
51730
51808
|
return resolvedPath;
|
|
51731
51809
|
}
|
|
51732
51810
|
getContentType(filePath) {
|
|
51733
|
-
const ext =
|
|
51811
|
+
const ext = path41.extname(filePath).toLowerCase();
|
|
51734
51812
|
const mimeTypes = {
|
|
51735
51813
|
".html": "text/html; charset=utf-8",
|
|
51736
51814
|
".css": "text/css; charset=utf-8",
|
|
@@ -51824,19 +51902,19 @@ var FoundryLiveReloadServer = class {
|
|
|
51824
51902
|
shouldLiveReloadCSS(changedFiles) {
|
|
51825
51903
|
if (!changedFiles)
|
|
51826
51904
|
return false;
|
|
51827
|
-
return changedFiles.some((file) =>
|
|
51905
|
+
return changedFiles.some((file) => path41.extname(file).toLowerCase() === ".css");
|
|
51828
51906
|
}
|
|
51829
51907
|
shouldLiveReloadImages(changedFiles) {
|
|
51830
51908
|
if (!changedFiles)
|
|
51831
51909
|
return false;
|
|
51832
51910
|
const imageExts = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"];
|
|
51833
|
-
return changedFiles.some((file) => imageExts.includes(
|
|
51911
|
+
return changedFiles.some((file) => imageExts.includes(path41.extname(file).toLowerCase()));
|
|
51834
51912
|
}
|
|
51835
51913
|
};
|
|
51836
51914
|
|
|
51837
51915
|
// pkg/web/server/electron-livereload-server.ts
|
|
51838
51916
|
var http4 = __toESM(require("http"));
|
|
51839
|
-
var
|
|
51917
|
+
var path42 = __toESM(require("path"));
|
|
51840
51918
|
var fs12 = __toESM(require("fs/promises"));
|
|
51841
51919
|
init_log();
|
|
51842
51920
|
var log85 = getDomainLogger("web", { component: "electron-livereload-server" });
|
|
@@ -51853,7 +51931,7 @@ var ElectronLiveReloadServer = class {
|
|
|
51853
51931
|
enableLiveReload: config.enableLiveReload !== false,
|
|
51854
51932
|
publicDir: config.publicDir
|
|
51855
51933
|
};
|
|
51856
|
-
this.stateFilePath =
|
|
51934
|
+
this.stateFilePath = path42.join(this.config.publicDir, ".foundry-livereload-state.json");
|
|
51857
51935
|
}
|
|
51858
51936
|
async start() {
|
|
51859
51937
|
if (this.running) {
|
|
@@ -51906,7 +51984,7 @@ var ElectronLiveReloadServer = class {
|
|
|
51906
51984
|
};
|
|
51907
51985
|
if (changedFiles && changedFiles.length === 1) {
|
|
51908
51986
|
const file = changedFiles[0];
|
|
51909
|
-
const ext =
|
|
51987
|
+
const ext = path42.extname(file).toLowerCase();
|
|
51910
51988
|
if (ext === ".css" || [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"].includes(ext)) {
|
|
51911
51989
|
state.path = file;
|
|
51912
51990
|
}
|
|
@@ -51990,7 +52068,7 @@ var ElectronLiveReloadServer = class {
|
|
|
51990
52068
|
try {
|
|
51991
52069
|
const stats = await fs12.stat(filePath);
|
|
51992
52070
|
if (stats.isDirectory()) {
|
|
51993
|
-
const indexPath =
|
|
52071
|
+
const indexPath = path42.join(filePath, "index.html");
|
|
51994
52072
|
try {
|
|
51995
52073
|
await fs12.stat(indexPath);
|
|
51996
52074
|
filePath = indexPath;
|
|
@@ -52036,13 +52114,13 @@ var ElectronLiveReloadServer = class {
|
|
|
52036
52114
|
log85.warn("Failed to decode URL:", cleanUrl, error);
|
|
52037
52115
|
decodedUrl = cleanUrl;
|
|
52038
52116
|
}
|
|
52039
|
-
const normalizedPath =
|
|
52117
|
+
const normalizedPath = path42.normalize(decodedUrl).replace(/^(\.\.[\/\\])+/, "");
|
|
52040
52118
|
const relativePath = normalizedPath.startsWith("/") ? normalizedPath.slice(1) : normalizedPath;
|
|
52041
|
-
const resolvedPath =
|
|
52119
|
+
const resolvedPath = path42.join(this.config.publicDir, relativePath);
|
|
52042
52120
|
return resolvedPath;
|
|
52043
52121
|
}
|
|
52044
52122
|
getContentType(filePath) {
|
|
52045
|
-
const ext =
|
|
52123
|
+
const ext = path42.extname(filePath).toLowerCase();
|
|
52046
52124
|
const mimeTypes = {
|
|
52047
52125
|
".html": "text/html; charset=utf-8",
|
|
52048
52126
|
".css": "text/css; charset=utf-8",
|
|
@@ -52162,13 +52240,13 @@ var ElectronLiveReloadServer = class {
|
|
|
52162
52240
|
shouldLiveReloadCSS(changedFiles) {
|
|
52163
52241
|
if (!changedFiles)
|
|
52164
52242
|
return false;
|
|
52165
|
-
return changedFiles.some((file) =>
|
|
52243
|
+
return changedFiles.some((file) => path42.extname(file).toLowerCase() === ".css");
|
|
52166
52244
|
}
|
|
52167
52245
|
shouldLiveReloadImages(changedFiles) {
|
|
52168
52246
|
if (!changedFiles)
|
|
52169
52247
|
return false;
|
|
52170
52248
|
const imageExts = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"];
|
|
52171
|
-
return changedFiles.some((file) => imageExts.includes(
|
|
52249
|
+
return changedFiles.some((file) => imageExts.includes(path42.extname(file).toLowerCase()));
|
|
52172
52250
|
}
|
|
52173
52251
|
};
|
|
52174
52252
|
|
|
@@ -52493,7 +52571,8 @@ var ServeCommand = class {
|
|
|
52493
52571
|
const host = options.host || "localhost";
|
|
52494
52572
|
const livereloadPort = options.livereloadPort || 35729;
|
|
52495
52573
|
const enableLivereload = options.livereload !== false;
|
|
52496
|
-
const
|
|
52574
|
+
const projContentDirs = await project.getContentDirs();
|
|
52575
|
+
const contentDirs = project.getLinkDirs();
|
|
52497
52576
|
const modulesDir = workspace.getModulesDir();
|
|
52498
52577
|
const publicDir = await project.getPublishDir();
|
|
52499
52578
|
const projectRoot = project.getPath();
|
|
@@ -52501,7 +52580,7 @@ var ServeCommand = class {
|
|
|
52501
52580
|
projDir: projectRoot,
|
|
52502
52581
|
modulesDir,
|
|
52503
52582
|
contentDirs,
|
|
52504
|
-
projContentDirs
|
|
52583
|
+
projContentDirs,
|
|
52505
52584
|
publicDir,
|
|
52506
52585
|
enableWatching: true,
|
|
52507
52586
|
batchDelay: 300,
|
|
@@ -54472,7 +54551,7 @@ For more information, visit: https://help.mdfriday.com
|
|
|
54472
54551
|
* Show version
|
|
54473
54552
|
*/
|
|
54474
54553
|
showVersion() {
|
|
54475
|
-
const version = "26.3.
|
|
54554
|
+
const version = "26.3.6";
|
|
54476
54555
|
return {
|
|
54477
54556
|
success: true,
|
|
54478
54557
|
message: `MDFriday CLI v${version}`
|