@mdfriday/foundry 26.3.4 → 26.3.5
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 +560 -500
- package/dist/index.js +1 -1
- 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;
|
|
@@ -3088,7 +3098,13 @@ var init_workspace_factory = __esm({
|
|
|
3088
3098
|
}
|
|
3089
3099
|
const hasAuthFile = await this.checkAuthFile(absolutePath);
|
|
3090
3100
|
const authentication = new Authentication(absolutePath, hasAuthFile);
|
|
3091
|
-
const workspace = new Workspace(
|
|
3101
|
+
const workspace = new Workspace(
|
|
3102
|
+
absolutePath,
|
|
3103
|
+
metadata,
|
|
3104
|
+
projects,
|
|
3105
|
+
authentication,
|
|
3106
|
+
this.fileSystemRepo || void 0
|
|
3107
|
+
);
|
|
3092
3108
|
log5.info("Workspace loaded", {
|
|
3093
3109
|
workspaceId: workspace.getId(),
|
|
3094
3110
|
name: workspace.getName(),
|
|
@@ -3100,10 +3116,12 @@ var init_workspace_factory = __esm({
|
|
|
3100
3116
|
* Check if auth file exists
|
|
3101
3117
|
*/
|
|
3102
3118
|
async checkAuthFile(workspacePath) {
|
|
3119
|
+
if (!this.fileSystemRepo) {
|
|
3120
|
+
return false;
|
|
3121
|
+
}
|
|
3103
3122
|
const authPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3104
|
-
const fs13 = await import("fs/promises");
|
|
3105
3123
|
try {
|
|
3106
|
-
await
|
|
3124
|
+
await this.fileSystemRepo.access(authPath);
|
|
3107
3125
|
return true;
|
|
3108
3126
|
} catch {
|
|
3109
3127
|
return false;
|
|
@@ -3151,7 +3169,8 @@ var init_workspace_factory = __esm({
|
|
|
3151
3169
|
absolutePath,
|
|
3152
3170
|
metadata,
|
|
3153
3171
|
/* @__PURE__ */ new Map(),
|
|
3154
|
-
authentication
|
|
3172
|
+
authentication,
|
|
3173
|
+
this.fileSystemRepo || void 0
|
|
3155
3174
|
);
|
|
3156
3175
|
log5.info("Workspace created", {
|
|
3157
3176
|
workspaceId: workspace.getId(),
|
|
@@ -3577,10 +3596,12 @@ var init_workspace_factory = __esm({
|
|
|
3577
3596
|
outputDir
|
|
3578
3597
|
);
|
|
3579
3598
|
if (snapshotName && snapshotName !== metadata.id) {
|
|
3599
|
+
if (!this.fileSystemRepo) {
|
|
3600
|
+
throw new Error("FileSystemRepository is required to update snapshot metadata");
|
|
3601
|
+
}
|
|
3580
3602
|
metadata.name = snapshotName;
|
|
3581
3603
|
const metadataPath = import_path3.default.join(project.getPath(), ".mdfriday", "snapshots", `${metadata.id}.json`);
|
|
3582
|
-
|
|
3583
|
-
await fs13.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
3604
|
+
await this.fileSystemRepo.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
3584
3605
|
}
|
|
3585
3606
|
log5.info("Snapshot created", { snapshotId, size: metadata.size, fileCount: metadata.fileCount });
|
|
3586
3607
|
return metadata;
|
|
@@ -3625,12 +3646,15 @@ var init_workspace_factory = __esm({
|
|
|
3625
3646
|
createIdentityStorage(workspace) {
|
|
3626
3647
|
const workspacePath = workspace.getPath();
|
|
3627
3648
|
const authentication = workspace.getAuthentication();
|
|
3649
|
+
const fsRepo = this.fileSystemRepo;
|
|
3650
|
+
if (!fsRepo) {
|
|
3651
|
+
throw new Error("FileSystemRepository is required for identity storage");
|
|
3652
|
+
}
|
|
3628
3653
|
return {
|
|
3629
3654
|
// 新方法:合并存储
|
|
3630
3655
|
async saveUserData(data) {
|
|
3631
3656
|
const userDataPath = import_path3.default.join(workspacePath, ".mdfriday", "user-data.json");
|
|
3632
|
-
|
|
3633
|
-
await fs13.mkdir(import_path3.default.dirname(userDataPath), { recursive: true });
|
|
3657
|
+
await fsRepo.createDirectory(import_path3.default.dirname(userDataPath), true);
|
|
3634
3658
|
const jsonData = {
|
|
3635
3659
|
serverConfig: data.serverConfig.toJSON()
|
|
3636
3660
|
};
|
|
@@ -3644,13 +3668,12 @@ var init_workspace_factory = __esm({
|
|
|
3644
3668
|
if (data.email) {
|
|
3645
3669
|
jsonData.email = data.email;
|
|
3646
3670
|
}
|
|
3647
|
-
await
|
|
3671
|
+
await fsRepo.writeFile(userDataPath, JSON.stringify(jsonData, null, 2));
|
|
3648
3672
|
},
|
|
3649
3673
|
async loadUserData() {
|
|
3650
3674
|
const userDataPath = import_path3.default.join(workspacePath, ".mdfriday", "user-data.json");
|
|
3651
|
-
const fs13 = await import("fs/promises");
|
|
3652
3675
|
try {
|
|
3653
|
-
const content = await
|
|
3676
|
+
const content = await fsRepo.readFile(userDataPath, "utf-8");
|
|
3654
3677
|
const data = JSON.parse(content);
|
|
3655
3678
|
const { Token: Token3, ServerConfig: ServerConfig2, License: License2 } = await Promise.resolve().then(() => (init_identity(), identity_exports));
|
|
3656
3679
|
const result = {};
|
|
@@ -3679,9 +3702,8 @@ var init_workspace_factory = __esm({
|
|
|
3679
3702
|
},
|
|
3680
3703
|
async clearUserData() {
|
|
3681
3704
|
const userDataPath = import_path3.default.join(workspacePath, ".mdfriday", "user-data.json");
|
|
3682
|
-
const fs13 = await import("fs/promises");
|
|
3683
3705
|
try {
|
|
3684
|
-
await
|
|
3706
|
+
await fsRepo.unlink(userDataPath);
|
|
3685
3707
|
} catch {
|
|
3686
3708
|
}
|
|
3687
3709
|
authentication.markAuthDeleted();
|
|
@@ -3689,9 +3711,8 @@ var init_workspace_factory = __esm({
|
|
|
3689
3711
|
// 保留旧方法以向后兼容
|
|
3690
3712
|
async saveToken(token) {
|
|
3691
3713
|
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));
|
|
3714
|
+
await fsRepo.createDirectory(import_path3.default.dirname(authPath), true);
|
|
3715
|
+
await fsRepo.writeFile(authPath, JSON.stringify(token.toJSON(), null, 2));
|
|
3695
3716
|
authentication.markAuthExists();
|
|
3696
3717
|
},
|
|
3697
3718
|
async loadToken() {
|
|
@@ -3700,9 +3721,8 @@ var init_workspace_factory = __esm({
|
|
|
3700
3721
|
return userData.token;
|
|
3701
3722
|
}
|
|
3702
3723
|
const authPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3703
|
-
const fs13 = await import("fs/promises");
|
|
3704
3724
|
try {
|
|
3705
|
-
const content = await
|
|
3725
|
+
const content = await fsRepo.readFile(authPath, "utf-8");
|
|
3706
3726
|
const data = JSON.parse(content);
|
|
3707
3727
|
const { Token: Token3 } = await Promise.resolve().then(() => (init_identity(), identity_exports));
|
|
3708
3728
|
return Token3.create(data.token, data.expiresAt);
|
|
@@ -3712,18 +3732,16 @@ var init_workspace_factory = __esm({
|
|
|
3712
3732
|
},
|
|
3713
3733
|
async clearToken() {
|
|
3714
3734
|
const authPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-token.json");
|
|
3715
|
-
const fs13 = await import("fs/promises");
|
|
3716
3735
|
try {
|
|
3717
|
-
await
|
|
3736
|
+
await fsRepo.unlink(authPath);
|
|
3718
3737
|
} catch {
|
|
3719
3738
|
}
|
|
3720
3739
|
authentication.markAuthDeleted();
|
|
3721
3740
|
},
|
|
3722
3741
|
async saveServerConfig(config) {
|
|
3723
3742
|
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));
|
|
3743
|
+
await fsRepo.createDirectory(import_path3.default.dirname(configPath), true);
|
|
3744
|
+
await fsRepo.writeFile(configPath, JSON.stringify(config.toJSON(), null, 2));
|
|
3727
3745
|
},
|
|
3728
3746
|
async loadServerConfig() {
|
|
3729
3747
|
const userData = await this.loadUserData();
|
|
@@ -3731,9 +3749,8 @@ var init_workspace_factory = __esm({
|
|
|
3731
3749
|
return userData.serverConfig;
|
|
3732
3750
|
}
|
|
3733
3751
|
const configPath = import_path3.default.join(workspacePath, ".mdfriday", "auth-config.json");
|
|
3734
|
-
const fs13 = await import("fs/promises");
|
|
3735
3752
|
try {
|
|
3736
|
-
const content = await
|
|
3753
|
+
const content = await fsRepo.readFile(configPath, "utf-8");
|
|
3737
3754
|
const data = JSON.parse(content);
|
|
3738
3755
|
const { ServerConfig: ServerConfig2 } = await Promise.resolve().then(() => (init_identity(), identity_exports));
|
|
3739
3756
|
return ServerConfig2.create(data.apiUrl, data.websiteUrl);
|
|
@@ -3791,11 +3808,12 @@ var init_workspace2 = __esm({
|
|
|
3791
3808
|
});
|
|
3792
3809
|
|
|
3793
3810
|
// internal/application/workspace.ts
|
|
3794
|
-
var log6, WorkspaceAppService;
|
|
3811
|
+
var import_path4, log6, WorkspaceAppService;
|
|
3795
3812
|
var init_workspace3 = __esm({
|
|
3796
3813
|
"internal/application/workspace.ts"() {
|
|
3797
3814
|
"use strict";
|
|
3798
3815
|
init_log();
|
|
3816
|
+
import_path4 = __toESM(require("path"));
|
|
3799
3817
|
log6 = getDomainLogger("workspace-app", { component: "application" });
|
|
3800
3818
|
WorkspaceAppService = class {
|
|
3801
3819
|
workspaceFactory;
|
|
@@ -3808,17 +3826,17 @@ var init_workspace3 = __esm({
|
|
|
3808
3826
|
/**
|
|
3809
3827
|
* Load workspace from path
|
|
3810
3828
|
*/
|
|
3811
|
-
async loadWorkspace(
|
|
3812
|
-
if (
|
|
3813
|
-
return this.workspaceFactory.load(
|
|
3829
|
+
async loadWorkspace(path43) {
|
|
3830
|
+
if (path43) {
|
|
3831
|
+
return this.workspaceFactory.load(path43);
|
|
3814
3832
|
}
|
|
3815
3833
|
return this.workspaceFactory.loadOrFind();
|
|
3816
3834
|
}
|
|
3817
3835
|
/**
|
|
3818
3836
|
* Create new workspace
|
|
3819
3837
|
*/
|
|
3820
|
-
async createWorkspace(
|
|
3821
|
-
return this.workspaceFactory.create(
|
|
3838
|
+
async createWorkspace(path43, options) {
|
|
3839
|
+
return this.workspaceFactory.create(path43, options);
|
|
3822
3840
|
}
|
|
3823
3841
|
/**
|
|
3824
3842
|
* Save workspace
|
|
@@ -3878,23 +3896,26 @@ var init_workspace3 = __esm({
|
|
|
3878
3896
|
project = workspace.findProject(projectNameOrPath);
|
|
3879
3897
|
if (!project) {
|
|
3880
3898
|
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) {
|
|
3899
|
+
const fsRepo = this.workspaceFactory["fileSystemRepo"];
|
|
3900
|
+
if (!fsRepo) {
|
|
3901
|
+
project = void 0;
|
|
3902
|
+
} else {
|
|
3903
|
+
const inputPath = import_path4.default.resolve(projectNameOrPath);
|
|
3904
|
+
for (const p2 of projects) {
|
|
3905
|
+
const projectPath = p2.getPath();
|
|
3906
|
+
if (inputPath.startsWith(projectPath) || projectPath === inputPath) {
|
|
3894
3907
|
project = p2;
|
|
3895
3908
|
break;
|
|
3896
3909
|
}
|
|
3897
|
-
|
|
3910
|
+
try {
|
|
3911
|
+
const realInputPath = await fsRepo.resolvePath(inputPath);
|
|
3912
|
+
const realProjectPath = await fsRepo.resolvePath(projectPath);
|
|
3913
|
+
if (realInputPath.startsWith(realProjectPath) || realProjectPath === realInputPath) {
|
|
3914
|
+
project = p2;
|
|
3915
|
+
break;
|
|
3916
|
+
}
|
|
3917
|
+
} catch (error) {
|
|
3918
|
+
}
|
|
3898
3919
|
}
|
|
3899
3920
|
}
|
|
3900
3921
|
if (!project) {
|
|
@@ -3904,21 +3925,23 @@ var init_workspace3 = __esm({
|
|
|
3904
3925
|
} else {
|
|
3905
3926
|
const cwd = process.cwd();
|
|
3906
3927
|
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)) {
|
|
3928
|
+
const fsRepo = this.workspaceFactory["fileSystemRepo"];
|
|
3929
|
+
if (fsRepo) {
|
|
3930
|
+
for (const p2 of projects) {
|
|
3931
|
+
const projectPath = p2.getPath();
|
|
3932
|
+
if (cwd.startsWith(projectPath)) {
|
|
3918
3933
|
project = p2;
|
|
3919
3934
|
break;
|
|
3920
3935
|
}
|
|
3921
|
-
|
|
3936
|
+
try {
|
|
3937
|
+
const realCwd = await fsRepo.resolvePath(cwd);
|
|
3938
|
+
const realProjectPath = await fsRepo.resolvePath(projectPath);
|
|
3939
|
+
if (realCwd.startsWith(realProjectPath)) {
|
|
3940
|
+
project = p2;
|
|
3941
|
+
break;
|
|
3942
|
+
}
|
|
3943
|
+
} catch (error) {
|
|
3944
|
+
}
|
|
3922
3945
|
}
|
|
3923
3946
|
}
|
|
3924
3947
|
if (!project && projects.length === 1) {
|
|
@@ -4400,12 +4423,12 @@ var init_identity2 = __esm({
|
|
|
4400
4423
|
});
|
|
4401
4424
|
|
|
4402
4425
|
// internal/infrastructure/persistence/node-workspace-repository.ts
|
|
4403
|
-
var import_fs2,
|
|
4426
|
+
var import_fs2, import_path5, MDFRIDAY_DIR, WORKSPACE_FILE, PROJECTS_FILE, PROJECT_FILE, CONFIG_FILE, NodeWorkspaceRepository, NodeProjectRepository;
|
|
4404
4427
|
var init_node_workspace_repository = __esm({
|
|
4405
4428
|
"internal/infrastructure/persistence/node-workspace-repository.ts"() {
|
|
4406
4429
|
"use strict";
|
|
4407
4430
|
import_fs2 = require("fs");
|
|
4408
|
-
|
|
4431
|
+
import_path5 = __toESM(require("path"));
|
|
4409
4432
|
MDFRIDAY_DIR = ".mdfriday";
|
|
4410
4433
|
WORKSPACE_FILE = "workspace.json";
|
|
4411
4434
|
PROJECTS_FILE = "projects.json";
|
|
@@ -4414,7 +4437,7 @@ var init_node_workspace_repository = __esm({
|
|
|
4414
4437
|
NodeWorkspaceRepository = class {
|
|
4415
4438
|
async isWorkspace(workspacePath) {
|
|
4416
4439
|
try {
|
|
4417
|
-
const metadataPath =
|
|
4440
|
+
const metadataPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
4418
4441
|
await import_fs2.promises.access(metadataPath);
|
|
4419
4442
|
return true;
|
|
4420
4443
|
} catch {
|
|
@@ -4422,28 +4445,28 @@ var init_node_workspace_repository = __esm({
|
|
|
4422
4445
|
}
|
|
4423
4446
|
}
|
|
4424
4447
|
async initWorkspaceStructure(workspacePath, modulesDir, projectsDir) {
|
|
4425
|
-
const mdfridayDir =
|
|
4426
|
-
const modulesDirPath =
|
|
4427
|
-
const projectsDirPath =
|
|
4448
|
+
const mdfridayDir = import_path5.default.join(workspacePath, MDFRIDAY_DIR);
|
|
4449
|
+
const modulesDirPath = import_path5.default.join(workspacePath, modulesDir);
|
|
4450
|
+
const projectsDirPath = import_path5.default.join(workspacePath, projectsDir);
|
|
4428
4451
|
await import_fs2.promises.mkdir(mdfridayDir, { recursive: true });
|
|
4429
4452
|
await import_fs2.promises.mkdir(modulesDirPath, { recursive: true });
|
|
4430
4453
|
await import_fs2.promises.mkdir(projectsDirPath, { recursive: true });
|
|
4431
4454
|
}
|
|
4432
4455
|
async saveWorkspaceMetadata(workspacePath, metadata) {
|
|
4433
|
-
const metadataPath =
|
|
4456
|
+
const metadataPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
4434
4457
|
await import_fs2.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
4435
4458
|
}
|
|
4436
4459
|
async loadWorkspaceMetadata(workspacePath) {
|
|
4437
|
-
const metadataPath =
|
|
4460
|
+
const metadataPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, WORKSPACE_FILE);
|
|
4438
4461
|
const content = await import_fs2.promises.readFile(metadataPath, "utf-8");
|
|
4439
4462
|
return JSON.parse(content);
|
|
4440
4463
|
}
|
|
4441
4464
|
async saveProjectRegistry(workspacePath, registry) {
|
|
4442
|
-
const registryPath =
|
|
4465
|
+
const registryPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, PROJECTS_FILE);
|
|
4443
4466
|
await import_fs2.promises.writeFile(registryPath, JSON.stringify(registry, null, 2));
|
|
4444
4467
|
}
|
|
4445
4468
|
async loadProjectRegistry(workspacePath) {
|
|
4446
|
-
const registryPath =
|
|
4469
|
+
const registryPath = import_path5.default.join(workspacePath, MDFRIDAY_DIR, PROJECTS_FILE);
|
|
4447
4470
|
const content = await import_fs2.promises.readFile(registryPath, "utf-8");
|
|
4448
4471
|
return JSON.parse(content);
|
|
4449
4472
|
}
|
|
@@ -4451,7 +4474,7 @@ var init_node_workspace_repository = __esm({
|
|
|
4451
4474
|
NodeProjectRepository = class {
|
|
4452
4475
|
async isProject(projectPath) {
|
|
4453
4476
|
try {
|
|
4454
|
-
const metadataPath =
|
|
4477
|
+
const metadataPath = import_path5.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
4455
4478
|
await import_fs2.promises.access(metadataPath);
|
|
4456
4479
|
return true;
|
|
4457
4480
|
} catch {
|
|
@@ -4459,26 +4482,26 @@ var init_node_workspace_repository = __esm({
|
|
|
4459
4482
|
}
|
|
4460
4483
|
}
|
|
4461
4484
|
async initProjectStructure(projectPath, contentDir, staticDir, publishDir) {
|
|
4462
|
-
const mdfridayDir =
|
|
4463
|
-
const contentDirPath =
|
|
4464
|
-
const staticDirPath =
|
|
4465
|
-
const publishDirPath =
|
|
4485
|
+
const mdfridayDir = import_path5.default.join(projectPath, MDFRIDAY_DIR);
|
|
4486
|
+
const contentDirPath = import_path5.default.join(projectPath, contentDir);
|
|
4487
|
+
const staticDirPath = import_path5.default.join(projectPath, staticDir);
|
|
4488
|
+
const publishDirPath = import_path5.default.join(projectPath, publishDir);
|
|
4466
4489
|
await import_fs2.promises.mkdir(mdfridayDir, { recursive: true });
|
|
4467
4490
|
await import_fs2.promises.mkdir(contentDirPath, { recursive: true });
|
|
4468
4491
|
await import_fs2.promises.mkdir(staticDirPath, { recursive: true });
|
|
4469
4492
|
await import_fs2.promises.mkdir(publishDirPath, { recursive: true });
|
|
4470
4493
|
}
|
|
4471
4494
|
async saveProjectMetadata(projectPath, metadata) {
|
|
4472
|
-
const metadataPath =
|
|
4495
|
+
const metadataPath = import_path5.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
4473
4496
|
await import_fs2.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
4474
4497
|
}
|
|
4475
4498
|
async loadProjectMetadata(projectPath) {
|
|
4476
|
-
const metadataPath =
|
|
4499
|
+
const metadataPath = import_path5.default.join(projectPath, MDFRIDAY_DIR, PROJECT_FILE);
|
|
4477
4500
|
const content = await import_fs2.promises.readFile(metadataPath, "utf-8");
|
|
4478
4501
|
return JSON.parse(content);
|
|
4479
4502
|
}
|
|
4480
4503
|
async saveProjectConfig(projectPath, config) {
|
|
4481
|
-
const configPath =
|
|
4504
|
+
const configPath = import_path5.default.join(projectPath, CONFIG_FILE);
|
|
4482
4505
|
await import_fs2.promises.writeFile(configPath, JSON.stringify(config, null, 2));
|
|
4483
4506
|
}
|
|
4484
4507
|
async createSampleContent(contentPath, content) {
|
|
@@ -4495,20 +4518,20 @@ var init_node_workspace_repository = __esm({
|
|
|
4495
4518
|
});
|
|
4496
4519
|
|
|
4497
4520
|
// internal/infrastructure/persistence/node-snapshot-repository.ts
|
|
4498
|
-
var import_fs3,
|
|
4521
|
+
var import_fs3, import_path6, NodeSnapshotRepository;
|
|
4499
4522
|
var init_node_snapshot_repository = __esm({
|
|
4500
4523
|
"internal/infrastructure/persistence/node-snapshot-repository.ts"() {
|
|
4501
4524
|
"use strict";
|
|
4502
4525
|
import_fs3 = require("fs");
|
|
4503
|
-
|
|
4526
|
+
import_path6 = __toESM(require("path"));
|
|
4504
4527
|
NodeSnapshotRepository = class {
|
|
4505
4528
|
/**
|
|
4506
4529
|
* Create a snapshot by copying output directory to snapshot storage
|
|
4507
4530
|
*/
|
|
4508
4531
|
async createSnapshot(projectPath, snapshotId, outputDir) {
|
|
4509
|
-
const snapshotDir =
|
|
4532
|
+
const snapshotDir = import_path6.default.join(projectPath, ".mdfriday", "snapshots");
|
|
4510
4533
|
await import_fs3.promises.mkdir(snapshotDir, { recursive: true });
|
|
4511
|
-
const storageDir =
|
|
4534
|
+
const storageDir = import_path6.default.join(snapshotDir, snapshotId);
|
|
4512
4535
|
await import_fs3.promises.mkdir(storageDir, { recursive: true });
|
|
4513
4536
|
await this.copyDirectory(outputDir, storageDir);
|
|
4514
4537
|
const size = await this.getDirectorySize(storageDir);
|
|
@@ -4518,12 +4541,12 @@ var init_node_snapshot_repository = __esm({
|
|
|
4518
4541
|
name: snapshotId,
|
|
4519
4542
|
// Will be updated by service if custom name provided
|
|
4520
4543
|
timestamp: Date.now(),
|
|
4521
|
-
outputDir:
|
|
4522
|
-
storageDir:
|
|
4544
|
+
outputDir: import_path6.default.relative(projectPath, outputDir),
|
|
4545
|
+
storageDir: import_path6.default.relative(projectPath, storageDir),
|
|
4523
4546
|
size,
|
|
4524
4547
|
fileCount
|
|
4525
4548
|
};
|
|
4526
|
-
const metadataPath =
|
|
4549
|
+
const metadataPath = import_path6.default.join(snapshotDir, `${snapshotId}.json`);
|
|
4527
4550
|
await import_fs3.promises.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
4528
4551
|
return metadata;
|
|
4529
4552
|
}
|
|
@@ -4531,7 +4554,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4531
4554
|
* List all snapshots for a project
|
|
4532
4555
|
*/
|
|
4533
4556
|
async listSnapshots(projectPath) {
|
|
4534
|
-
const snapshotDir =
|
|
4557
|
+
const snapshotDir = import_path6.default.join(projectPath, ".mdfriday", "snapshots");
|
|
4535
4558
|
try {
|
|
4536
4559
|
await import_fs3.promises.access(snapshotDir);
|
|
4537
4560
|
} catch {
|
|
@@ -4542,7 +4565,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4542
4565
|
const snapshots = [];
|
|
4543
4566
|
for (const file of jsonFiles) {
|
|
4544
4567
|
try {
|
|
4545
|
-
const content = await import_fs3.promises.readFile(
|
|
4568
|
+
const content = await import_fs3.promises.readFile(import_path6.default.join(snapshotDir, file), "utf-8");
|
|
4546
4569
|
snapshots.push(JSON.parse(content));
|
|
4547
4570
|
} catch {
|
|
4548
4571
|
}
|
|
@@ -4553,8 +4576,8 @@ var init_node_snapshot_repository = __esm({
|
|
|
4553
4576
|
* Get snapshot metadata
|
|
4554
4577
|
*/
|
|
4555
4578
|
async getSnapshot(projectPath, snapshotId) {
|
|
4556
|
-
const snapshotDir =
|
|
4557
|
-
const metadataPath =
|
|
4579
|
+
const snapshotDir = import_path6.default.join(projectPath, ".mdfriday", "snapshots");
|
|
4580
|
+
const metadataPath = import_path6.default.join(snapshotDir, `${snapshotId}.json`);
|
|
4558
4581
|
try {
|
|
4559
4582
|
const content = await import_fs3.promises.readFile(metadataPath, "utf-8");
|
|
4560
4583
|
const metadata = JSON.parse(content);
|
|
@@ -4574,7 +4597,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4574
4597
|
*/
|
|
4575
4598
|
async restoreSnapshot(projectPath, snapshotId, outputDir) {
|
|
4576
4599
|
const metadata = await this.getSnapshot(projectPath, snapshotId);
|
|
4577
|
-
const storageDir =
|
|
4600
|
+
const storageDir = import_path6.default.join(projectPath, metadata.storageDir);
|
|
4578
4601
|
try {
|
|
4579
4602
|
await import_fs3.promises.access(storageDir);
|
|
4580
4603
|
} catch {
|
|
@@ -4590,13 +4613,13 @@ var init_node_snapshot_repository = __esm({
|
|
|
4590
4613
|
* Delete a snapshot
|
|
4591
4614
|
*/
|
|
4592
4615
|
async deleteSnapshot(projectPath, snapshotId) {
|
|
4593
|
-
const snapshotDir =
|
|
4594
|
-
const metadataPath =
|
|
4616
|
+
const snapshotDir = import_path6.default.join(projectPath, ".mdfriday", "snapshots");
|
|
4617
|
+
const metadataPath = import_path6.default.join(snapshotDir, `${snapshotId}.json`);
|
|
4595
4618
|
try {
|
|
4596
4619
|
const content = await import_fs3.promises.readFile(metadataPath, "utf-8");
|
|
4597
4620
|
const metadata = JSON.parse(content);
|
|
4598
4621
|
if (metadata.storageDir) {
|
|
4599
|
-
const storageDir =
|
|
4622
|
+
const storageDir = import_path6.default.join(projectPath, metadata.storageDir);
|
|
4600
4623
|
try {
|
|
4601
4624
|
await import_fs3.promises.rm(storageDir, { recursive: true, force: true });
|
|
4602
4625
|
} catch {
|
|
@@ -4618,8 +4641,8 @@ var init_node_snapshot_repository = __esm({
|
|
|
4618
4641
|
const entries = await import_fs3.promises.readdir(src, { withFileTypes: true });
|
|
4619
4642
|
await Promise.all(
|
|
4620
4643
|
entries.map(async (entry) => {
|
|
4621
|
-
const srcPath =
|
|
4622
|
-
const destPath =
|
|
4644
|
+
const srcPath = import_path6.default.join(src, entry.name);
|
|
4645
|
+
const destPath = import_path6.default.join(dest, entry.name);
|
|
4623
4646
|
if (entry.isDirectory()) {
|
|
4624
4647
|
await this.copyDirectory(srcPath, destPath);
|
|
4625
4648
|
} else {
|
|
@@ -4635,7 +4658,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4635
4658
|
let size = 0;
|
|
4636
4659
|
const entries = await import_fs3.promises.readdir(dir2, { withFileTypes: true });
|
|
4637
4660
|
for (const entry of entries) {
|
|
4638
|
-
const entryPath =
|
|
4661
|
+
const entryPath = import_path6.default.join(dir2, entry.name);
|
|
4639
4662
|
if (entry.isDirectory()) {
|
|
4640
4663
|
size += await this.getDirectorySize(entryPath);
|
|
4641
4664
|
} else {
|
|
@@ -4652,7 +4675,7 @@ var init_node_snapshot_repository = __esm({
|
|
|
4652
4675
|
let count = 0;
|
|
4653
4676
|
const entries = await import_fs3.promises.readdir(dir2, { withFileTypes: true });
|
|
4654
4677
|
for (const entry of entries) {
|
|
4655
|
-
const entryPath =
|
|
4678
|
+
const entryPath = import_path6.default.join(dir2, entry.name);
|
|
4656
4679
|
if (entry.isDirectory()) {
|
|
4657
4680
|
count += await this.countFiles(entryPath);
|
|
4658
4681
|
} else {
|
|
@@ -4670,12 +4693,12 @@ function mapLanguageCode(code) {
|
|
|
4670
4693
|
const normalized = code.toLowerCase().trim();
|
|
4671
4694
|
return LANGUAGE_CODE_MAP[normalized] || normalized;
|
|
4672
4695
|
}
|
|
4673
|
-
var import_fs4,
|
|
4696
|
+
var import_fs4, import_path7, log8, LANGUAGE_CODE_MAP, NodeFileSystemRepository;
|
|
4674
4697
|
var init_node_file_system = __esm({
|
|
4675
4698
|
"internal/infrastructure/persistence/node-file-system.ts"() {
|
|
4676
4699
|
"use strict";
|
|
4677
4700
|
import_fs4 = require("fs");
|
|
4678
|
-
|
|
4701
|
+
import_path7 = __toESM(require("path"));
|
|
4679
4702
|
init_log();
|
|
4680
4703
|
log8 = getDomainLogger("node-fs", { component: "infrastructure" });
|
|
4681
4704
|
LANGUAGE_CODE_MAP = {
|
|
@@ -4724,7 +4747,7 @@ var init_node_file_system = __esm({
|
|
|
4724
4747
|
try {
|
|
4725
4748
|
const entries = await import_fs4.promises.readdir(dirPath, { withFileTypes: true });
|
|
4726
4749
|
return entries.map((entry) => ({
|
|
4727
|
-
path:
|
|
4750
|
+
path: import_path7.default.join(dirPath, entry.name),
|
|
4728
4751
|
name: entry.name,
|
|
4729
4752
|
isDirectory: entry.isDirectory(),
|
|
4730
4753
|
isFile: entry.isFile()
|
|
@@ -4775,7 +4798,7 @@ var init_node_file_system = __esm({
|
|
|
4775
4798
|
if (a.weight !== b.weight) {
|
|
4776
4799
|
return a.weight - b.weight;
|
|
4777
4800
|
}
|
|
4778
|
-
return
|
|
4801
|
+
return import_path7.default.basename(a.path).localeCompare(import_path7.default.basename(b.path));
|
|
4779
4802
|
});
|
|
4780
4803
|
const isStructured = contentFolders.length > 0;
|
|
4781
4804
|
log8.debug(`Scanned folder structure: ${dirPath}`, {
|
|
@@ -4919,7 +4942,7 @@ var init_node_file_system = __esm({
|
|
|
4919
4942
|
}
|
|
4920
4943
|
async copyFile(source, target) {
|
|
4921
4944
|
try {
|
|
4922
|
-
const targetDir =
|
|
4945
|
+
const targetDir = import_path7.default.dirname(target);
|
|
4923
4946
|
if (!await this.exists(targetDir)) {
|
|
4924
4947
|
await import_fs4.promises.mkdir(targetDir, { recursive: true });
|
|
4925
4948
|
}
|
|
@@ -4930,17 +4953,54 @@ var init_node_file_system = __esm({
|
|
|
4930
4953
|
throw error;
|
|
4931
4954
|
}
|
|
4932
4955
|
}
|
|
4956
|
+
async readFile(filePath, encoding = "utf-8") {
|
|
4957
|
+
try {
|
|
4958
|
+
return await import_fs4.promises.readFile(filePath, encoding);
|
|
4959
|
+
} catch (error) {
|
|
4960
|
+
log8.error(`Failed to read file: ${filePath}`, error);
|
|
4961
|
+
throw error;
|
|
4962
|
+
}
|
|
4963
|
+
}
|
|
4964
|
+
async writeFile(filePath, content, encoding = "utf-8") {
|
|
4965
|
+
try {
|
|
4966
|
+
const dir2 = import_path7.default.dirname(filePath);
|
|
4967
|
+
if (!await this.exists(dir2)) {
|
|
4968
|
+
await import_fs4.promises.mkdir(dir2, { recursive: true });
|
|
4969
|
+
}
|
|
4970
|
+
await import_fs4.promises.writeFile(filePath, content, encoding);
|
|
4971
|
+
log8.debug(`Wrote file: ${filePath}`);
|
|
4972
|
+
} catch (error) {
|
|
4973
|
+
log8.error(`Failed to write file: ${filePath}`, error);
|
|
4974
|
+
throw error;
|
|
4975
|
+
}
|
|
4976
|
+
}
|
|
4977
|
+
async unlink(filePath) {
|
|
4978
|
+
try {
|
|
4979
|
+
await import_fs4.promises.unlink(filePath);
|
|
4980
|
+
log8.debug(`Deleted file: ${filePath}`);
|
|
4981
|
+
} catch (error) {
|
|
4982
|
+
log8.error(`Failed to delete file: ${filePath}`, error);
|
|
4983
|
+
throw error;
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
async access(filePath) {
|
|
4987
|
+
try {
|
|
4988
|
+
await import_fs4.promises.access(filePath);
|
|
4989
|
+
} catch (error) {
|
|
4990
|
+
throw new Error(`Cannot access path: ${filePath}`);
|
|
4991
|
+
}
|
|
4992
|
+
}
|
|
4933
4993
|
async resolvePath(filePath) {
|
|
4934
|
-
return
|
|
4994
|
+
return import_path7.default.resolve(filePath);
|
|
4935
4995
|
}
|
|
4936
4996
|
basename(filePath) {
|
|
4937
|
-
return
|
|
4997
|
+
return import_path7.default.basename(filePath);
|
|
4938
4998
|
}
|
|
4939
4999
|
dirname(filePath) {
|
|
4940
|
-
return
|
|
5000
|
+
return import_path7.default.dirname(filePath);
|
|
4941
5001
|
}
|
|
4942
5002
|
join(...paths) {
|
|
4943
|
-
return
|
|
5003
|
+
return import_path7.default.join(...paths);
|
|
4944
5004
|
}
|
|
4945
5005
|
};
|
|
4946
5006
|
}
|
|
@@ -5154,10 +5214,10 @@ var init_publish_manifest = __esm({
|
|
|
5154
5214
|
*/
|
|
5155
5215
|
getChangedFiles(newManifest) {
|
|
5156
5216
|
const changedFiles = [];
|
|
5157
|
-
for (const [
|
|
5158
|
-
const oldEntry = this.files.get(
|
|
5217
|
+
for (const [path43, newEntry] of newManifest.files.entries()) {
|
|
5218
|
+
const oldEntry = this.files.get(path43);
|
|
5159
5219
|
if (!oldEntry || oldEntry.hash !== newEntry.hash) {
|
|
5160
|
-
changedFiles.push(
|
|
5220
|
+
changedFiles.push(path43);
|
|
5161
5221
|
}
|
|
5162
5222
|
}
|
|
5163
5223
|
return changedFiles;
|
|
@@ -5168,9 +5228,9 @@ var init_publish_manifest = __esm({
|
|
|
5168
5228
|
*/
|
|
5169
5229
|
getDeletedFiles(newManifest) {
|
|
5170
5230
|
const deletedFiles = [];
|
|
5171
|
-
for (const
|
|
5172
|
-
if (!newManifest.files.has(
|
|
5173
|
-
deletedFiles.push(
|
|
5231
|
+
for (const path43 of this.files.keys()) {
|
|
5232
|
+
if (!newManifest.files.has(path43)) {
|
|
5233
|
+
deletedFiles.push(path43);
|
|
5174
5234
|
}
|
|
5175
5235
|
}
|
|
5176
5236
|
return deletedFiles;
|
|
@@ -5180,8 +5240,8 @@ var init_publish_manifest = __esm({
|
|
|
5180
5240
|
*/
|
|
5181
5241
|
toJSON() {
|
|
5182
5242
|
const filesObj = {};
|
|
5183
|
-
for (const [
|
|
5184
|
-
filesObj[
|
|
5243
|
+
for (const [path43, entry] of this.files.entries()) {
|
|
5244
|
+
filesObj[path43] = entry;
|
|
5185
5245
|
}
|
|
5186
5246
|
return {
|
|
5187
5247
|
projectId: this.projectId,
|
|
@@ -6773,8 +6833,8 @@ var require_Client = __commonJS({
|
|
|
6773
6833
|
/**
|
|
6774
6834
|
* Set the working directory.
|
|
6775
6835
|
*/
|
|
6776
|
-
async cd(
|
|
6777
|
-
const validPath = await this.protectWhitespace(
|
|
6836
|
+
async cd(path43) {
|
|
6837
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6778
6838
|
return this.send("CWD " + validPath);
|
|
6779
6839
|
}
|
|
6780
6840
|
/**
|
|
@@ -6787,8 +6847,8 @@ var require_Client = __commonJS({
|
|
|
6787
6847
|
* Get the last modified time of a file. This is not supported by every FTP server, in which case
|
|
6788
6848
|
* calling this method will throw an exception.
|
|
6789
6849
|
*/
|
|
6790
|
-
async lastMod(
|
|
6791
|
-
const validPath = await this.protectWhitespace(
|
|
6850
|
+
async lastMod(path43) {
|
|
6851
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6792
6852
|
const res = await this.send(`MDTM ${validPath}`);
|
|
6793
6853
|
const date = res.message.slice(4);
|
|
6794
6854
|
return (0, parseListMLSD_1.parseMLSxDate)(date);
|
|
@@ -6796,8 +6856,8 @@ var require_Client = __commonJS({
|
|
|
6796
6856
|
/**
|
|
6797
6857
|
* Get the size of a file.
|
|
6798
6858
|
*/
|
|
6799
|
-
async size(
|
|
6800
|
-
const validPath = await this.protectWhitespace(
|
|
6859
|
+
async size(path43) {
|
|
6860
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6801
6861
|
const command = `SIZE ${validPath}`;
|
|
6802
6862
|
const res = await this.send(command);
|
|
6803
6863
|
const size = parseInt(res.message.slice(4), 10);
|
|
@@ -6824,8 +6884,8 @@ var require_Client = __commonJS({
|
|
|
6824
6884
|
* You can ignore FTP error return codes which won't throw an exception if e.g.
|
|
6825
6885
|
* the file doesn't exist.
|
|
6826
6886
|
*/
|
|
6827
|
-
async remove(
|
|
6828
|
-
const validPath = await this.protectWhitespace(
|
|
6887
|
+
async remove(path43, ignoreErrorCodes = false) {
|
|
6888
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6829
6889
|
if (ignoreErrorCodes) {
|
|
6830
6890
|
return this.sendIgnoringError(`DELE ${validPath}`);
|
|
6831
6891
|
}
|
|
@@ -6979,8 +7039,8 @@ var require_Client = __commonJS({
|
|
|
6979
7039
|
*
|
|
6980
7040
|
* @param [path] Path to remote file or directory.
|
|
6981
7041
|
*/
|
|
6982
|
-
async list(
|
|
6983
|
-
const validPath = await this.protectWhitespace(
|
|
7042
|
+
async list(path43 = "") {
|
|
7043
|
+
const validPath = await this.protectWhitespace(path43);
|
|
6984
7044
|
let lastError;
|
|
6985
7045
|
for (const candidate of this.availableListCommands) {
|
|
6986
7046
|
const command = validPath === "" ? candidate : `${candidate} ${validPath}`;
|
|
@@ -7150,21 +7210,21 @@ var require_Client = __commonJS({
|
|
|
7150
7210
|
/**
|
|
7151
7211
|
* Remove an empty directory, will fail if not empty.
|
|
7152
7212
|
*/
|
|
7153
|
-
async removeEmptyDir(
|
|
7154
|
-
const validPath = await this.protectWhitespace(
|
|
7213
|
+
async removeEmptyDir(path43) {
|
|
7214
|
+
const validPath = await this.protectWhitespace(path43);
|
|
7155
7215
|
return this.send(`RMD ${validPath}`);
|
|
7156
7216
|
}
|
|
7157
7217
|
/**
|
|
7158
7218
|
* FTP servers can't handle filenames that have leading whitespace. This method transforms
|
|
7159
7219
|
* a given path to fix that issue for most cases.
|
|
7160
7220
|
*/
|
|
7161
|
-
async protectWhitespace(
|
|
7162
|
-
if (!
|
|
7163
|
-
return
|
|
7221
|
+
async protectWhitespace(path43) {
|
|
7222
|
+
if (!path43.startsWith(" ")) {
|
|
7223
|
+
return path43;
|
|
7164
7224
|
}
|
|
7165
7225
|
const pwd = await this.pwd();
|
|
7166
7226
|
const absolutePathPrefix = pwd.endsWith("/") ? pwd : pwd + "/";
|
|
7167
|
-
return absolutePathPrefix +
|
|
7227
|
+
return absolutePathPrefix + path43;
|
|
7168
7228
|
}
|
|
7169
7229
|
async _exitAtCurrentDirectory(func) {
|
|
7170
7230
|
const userDir = await this.pwd();
|
|
@@ -7241,11 +7301,11 @@ var require_Client = __commonJS({
|
|
|
7241
7301
|
}
|
|
7242
7302
|
};
|
|
7243
7303
|
exports2.Client = Client2;
|
|
7244
|
-
async function ensureLocalDirectory(
|
|
7304
|
+
async function ensureLocalDirectory(path43) {
|
|
7245
7305
|
try {
|
|
7246
|
-
await fsStat(
|
|
7306
|
+
await fsStat(path43);
|
|
7247
7307
|
} catch (_a2) {
|
|
7248
|
-
await fsMkDir(
|
|
7308
|
+
await fsMkDir(path43, { recursive: true });
|
|
7249
7309
|
}
|
|
7250
7310
|
}
|
|
7251
7311
|
async function ignoreError(func) {
|
|
@@ -7308,13 +7368,13 @@ var require_dist = __commonJS({
|
|
|
7308
7368
|
});
|
|
7309
7369
|
|
|
7310
7370
|
// internal/domain/publish/value-object/ftp-publisher.ts
|
|
7311
|
-
var ftp,
|
|
7371
|
+
var ftp, import_path8, import_fs5, log10, FtpPublisher;
|
|
7312
7372
|
var init_ftp_publisher = __esm({
|
|
7313
7373
|
"internal/domain/publish/value-object/ftp-publisher.ts"() {
|
|
7314
7374
|
"use strict";
|
|
7315
7375
|
init_log();
|
|
7316
7376
|
ftp = __toESM(require_dist());
|
|
7317
|
-
|
|
7377
|
+
import_path8 = __toESM(require("path"));
|
|
7318
7378
|
import_fs5 = require("fs");
|
|
7319
7379
|
log10 = getDomainLogger("ftp-publisher", { component: "domain" });
|
|
7320
7380
|
FtpPublisher = class {
|
|
@@ -7362,10 +7422,10 @@ var init_ftp_publisher = __esm({
|
|
|
7362
7422
|
});
|
|
7363
7423
|
const createdDirs = /* @__PURE__ */ new Set();
|
|
7364
7424
|
for (const relativePath of changedFiles) {
|
|
7365
|
-
const localPath =
|
|
7425
|
+
const localPath = import_path8.default.join(sourceDir, relativePath);
|
|
7366
7426
|
const remoteFilePath = this.config.remotePath && this.config.remotePath !== "/" ? `${this.config.remotePath}/${relativePath}`.replace(/\\/g, "/") : relativePath.replace(/\\/g, "/");
|
|
7367
7427
|
try {
|
|
7368
|
-
const remoteDir =
|
|
7428
|
+
const remoteDir = import_path8.default.dirname(remoteFilePath).replace(/\\/g, "/");
|
|
7369
7429
|
if (remoteDir && remoteDir !== "." && remoteDir !== "/") {
|
|
7370
7430
|
if (!createdDirs.has(remoteDir)) {
|
|
7371
7431
|
try {
|
|
@@ -7596,12 +7656,12 @@ var init_ftp_publisher = __esm({
|
|
|
7596
7656
|
});
|
|
7597
7657
|
|
|
7598
7658
|
// internal/domain/publish/value-object/netlify-publisher.ts
|
|
7599
|
-
var
|
|
7659
|
+
var import_path9, import_fs6, log11, NetlifyPublisher;
|
|
7600
7660
|
var init_netlify_publisher = __esm({
|
|
7601
7661
|
"internal/domain/publish/value-object/netlify-publisher.ts"() {
|
|
7602
7662
|
"use strict";
|
|
7603
7663
|
init_log();
|
|
7604
|
-
|
|
7664
|
+
import_path9 = __toESM(require("path"));
|
|
7605
7665
|
import_fs6 = require("fs");
|
|
7606
7666
|
log11 = getDomainLogger("netlify-publisher", { component: "domain" });
|
|
7607
7667
|
NetlifyPublisher = class {
|
|
@@ -7863,7 +7923,7 @@ var init_netlify_publisher = __esm({
|
|
|
7863
7923
|
log11.warn(`File not found in manifest: ${filePath}`);
|
|
7864
7924
|
continue;
|
|
7865
7925
|
}
|
|
7866
|
-
const localFilePath =
|
|
7926
|
+
const localFilePath = import_path9.default.join(sourceDir, filePath);
|
|
7867
7927
|
try {
|
|
7868
7928
|
const fileContent = await import_fs6.promises.readFile(localFilePath);
|
|
7869
7929
|
await this.uploadFileWithRetry(deployId, filePath, fileContent, fileEntry.hash);
|
|
@@ -8007,12 +8067,12 @@ var mdfriday_publisher_exports = {};
|
|
|
8007
8067
|
__export(mdfriday_publisher_exports, {
|
|
8008
8068
|
MDFridayPublisher: () => MDFridayPublisher
|
|
8009
8069
|
});
|
|
8010
|
-
var
|
|
8070
|
+
var import_path10, import_fs7, log12, MDFridayPublisher;
|
|
8011
8071
|
var init_mdfriday_publisher = __esm({
|
|
8012
8072
|
"internal/domain/publish/value-object/mdfriday-publisher.ts"() {
|
|
8013
8073
|
"use strict";
|
|
8014
8074
|
init_log();
|
|
8015
|
-
|
|
8075
|
+
import_path10 = __toESM(require("path"));
|
|
8016
8076
|
import_fs7 = require("fs");
|
|
8017
8077
|
log12 = getDomainLogger("mdfriday-publisher", { component: "domain" });
|
|
8018
8078
|
MDFridayPublisher = class {
|
|
@@ -8165,7 +8225,7 @@ var init_mdfriday_publisher = __esm({
|
|
|
8165
8225
|
const addDirectoryToZip = async (dirPath, zipFolder) => {
|
|
8166
8226
|
const items = await import_fs7.promises.readdir(dirPath, { withFileTypes: true });
|
|
8167
8227
|
for (const item of items) {
|
|
8168
|
-
const itemPath =
|
|
8228
|
+
const itemPath = import_path10.default.join(dirPath, item.name);
|
|
8169
8229
|
if (item.isDirectory()) {
|
|
8170
8230
|
const subFolder = zipFolder.folder(item.name);
|
|
8171
8231
|
if (subFolder) {
|
|
@@ -8414,13 +8474,13 @@ var init_publish = __esm({
|
|
|
8414
8474
|
});
|
|
8415
8475
|
|
|
8416
8476
|
// internal/infrastructure/persistence/node-manifest-repository.ts
|
|
8417
|
-
var
|
|
8477
|
+
var import_path11, import_fs8, import_crypto, log14, NodeManifestRepository;
|
|
8418
8478
|
var init_node_manifest_repository = __esm({
|
|
8419
8479
|
"internal/infrastructure/persistence/node-manifest-repository.ts"() {
|
|
8420
8480
|
"use strict";
|
|
8421
8481
|
init_publish();
|
|
8422
8482
|
init_log();
|
|
8423
|
-
|
|
8483
|
+
import_path11 = __toESM(require("path"));
|
|
8424
8484
|
import_fs8 = require("fs");
|
|
8425
8485
|
import_crypto = __toESM(require("crypto"));
|
|
8426
8486
|
log14 = getDomainLogger("node-manifest-repo", { component: "infrastructure" });
|
|
@@ -8447,7 +8507,7 @@ var init_node_manifest_repository = __esm({
|
|
|
8447
8507
|
* Save manifest to file
|
|
8448
8508
|
*/
|
|
8449
8509
|
async saveManifest(projectPath, manifest) {
|
|
8450
|
-
const manifestDir =
|
|
8510
|
+
const manifestDir = import_path11.default.join(projectPath, ".mdfriday");
|
|
8451
8511
|
await import_fs8.promises.mkdir(manifestDir, { recursive: true });
|
|
8452
8512
|
const manifestPath = this.getManifestPath(projectPath, manifest.getPublishMethod());
|
|
8453
8513
|
await import_fs8.promises.writeFile(
|
|
@@ -8496,7 +8556,7 @@ var init_node_manifest_repository = __esm({
|
|
|
8496
8556
|
* Get manifest file path
|
|
8497
8557
|
*/
|
|
8498
8558
|
getManifestPath(projectPath, publishMethod) {
|
|
8499
|
-
return
|
|
8559
|
+
return import_path11.default.join(projectPath, ".mdfriday", `manifest-${publishMethod}.json`);
|
|
8500
8560
|
}
|
|
8501
8561
|
/**
|
|
8502
8562
|
* Recursively scan directory and collect file info
|
|
@@ -8504,8 +8564,8 @@ var init_node_manifest_repository = __esm({
|
|
|
8504
8564
|
async scanDirectory(currentPath, relativePath, files, hashAlgorithm = "md5") {
|
|
8505
8565
|
const items = await import_fs8.promises.readdir(currentPath, { withFileTypes: true });
|
|
8506
8566
|
for (const item of items) {
|
|
8507
|
-
const itemPath =
|
|
8508
|
-
const itemRelativePath = relativePath ?
|
|
8567
|
+
const itemPath = import_path11.default.join(currentPath, item.name);
|
|
8568
|
+
const itemRelativePath = relativePath ? import_path11.default.join(relativePath, item.name) : item.name;
|
|
8509
8569
|
if (item.isDirectory()) {
|
|
8510
8570
|
await this.scanDirectory(itemPath, itemRelativePath, files, hashAlgorithm);
|
|
8511
8571
|
} else if (item.isFile()) {
|
|
@@ -9435,8 +9495,8 @@ var init_module2 = __esm({
|
|
|
9435
9495
|
/**
|
|
9436
9496
|
* Find import by path
|
|
9437
9497
|
*/
|
|
9438
|
-
findImport(
|
|
9439
|
-
return this.moduleConfig.imports.find((imp) => imp.path ===
|
|
9498
|
+
findImport(path43) {
|
|
9499
|
+
return this.moduleConfig.imports.find((imp) => imp.path === path43);
|
|
9440
9500
|
}
|
|
9441
9501
|
/**
|
|
9442
9502
|
* Find mount by source
|
|
@@ -10685,11 +10745,11 @@ var init_markdown2 = __esm({
|
|
|
10685
10745
|
function newDir(workingDir, themesDir, publishDir) {
|
|
10686
10746
|
return new Dir(workingDir, themesDir, publishDir);
|
|
10687
10747
|
}
|
|
10688
|
-
var
|
|
10748
|
+
var import_path12, DEFAULT_PUBLISH_DIR, Dir;
|
|
10689
10749
|
var init_dir = __esm({
|
|
10690
10750
|
"internal/domain/config/entity/dir.ts"() {
|
|
10691
10751
|
"use strict";
|
|
10692
|
-
|
|
10752
|
+
import_path12 = __toESM(require("path"));
|
|
10693
10753
|
DEFAULT_PUBLISH_DIR = "public";
|
|
10694
10754
|
Dir = class {
|
|
10695
10755
|
workingDir;
|
|
@@ -10701,16 +10761,16 @@ var init_dir = __esm({
|
|
|
10701
10761
|
this.publishDir = publishDir;
|
|
10702
10762
|
}
|
|
10703
10763
|
getWorkingDir() {
|
|
10704
|
-
return
|
|
10764
|
+
return import_path12.default.resolve(this.workingDir);
|
|
10705
10765
|
}
|
|
10706
10766
|
getThemesDir() {
|
|
10707
|
-
return
|
|
10767
|
+
return import_path12.default.resolve(this.themesDir);
|
|
10708
10768
|
}
|
|
10709
10769
|
getThemesCacheDir() {
|
|
10710
|
-
return
|
|
10770
|
+
return import_path12.default.resolve(this.themesDir, ".cache");
|
|
10711
10771
|
}
|
|
10712
10772
|
getPublishDir() {
|
|
10713
|
-
return
|
|
10773
|
+
return import_path12.default.resolve(this.publishDir);
|
|
10714
10774
|
}
|
|
10715
10775
|
};
|
|
10716
10776
|
}
|
|
@@ -10900,12 +10960,12 @@ var init_provider = __esm({
|
|
|
10900
10960
|
});
|
|
10901
10961
|
|
|
10902
10962
|
// internal/domain/config/factory/loader.ts
|
|
10903
|
-
var
|
|
10963
|
+
var path13, NO_CONFIG_FILE_ERR_INFO, ConfigLoader;
|
|
10904
10964
|
var init_loader = __esm({
|
|
10905
10965
|
"internal/domain/config/factory/loader.ts"() {
|
|
10906
10966
|
"use strict";
|
|
10907
10967
|
init_provider();
|
|
10908
|
-
|
|
10968
|
+
path13 = __toESM(require("path"));
|
|
10909
10969
|
NO_CONFIG_FILE_ERR_INFO = "Unable to locate config file or config directory.";
|
|
10910
10970
|
ConfigLoader = class {
|
|
10911
10971
|
cfg;
|
|
@@ -10944,13 +11004,13 @@ var init_loader = __esm({
|
|
|
10944
11004
|
async loadProvider(configName) {
|
|
10945
11005
|
const baseDir = this.baseDirs.workingDir;
|
|
10946
11006
|
let baseFilename;
|
|
10947
|
-
if (
|
|
11007
|
+
if (path13.isAbsolute(configName)) {
|
|
10948
11008
|
baseFilename = configName;
|
|
10949
11009
|
} else {
|
|
10950
|
-
baseFilename =
|
|
11010
|
+
baseFilename = path13.join(baseDir, configName);
|
|
10951
11011
|
}
|
|
10952
11012
|
let filename = "";
|
|
10953
|
-
if (
|
|
11013
|
+
if (path13.extname(configName) !== "") {
|
|
10954
11014
|
const exists = await this.fileExists(baseFilename);
|
|
10955
11015
|
if (exists) {
|
|
10956
11016
|
filename = baseFilename;
|
|
@@ -11089,9 +11149,9 @@ var init_sourcedescriptor = __esm({
|
|
|
11089
11149
|
|
|
11090
11150
|
// internal/domain/config/factory/config.ts
|
|
11091
11151
|
async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir, params = {}) {
|
|
11092
|
-
const cleanWorkingDir =
|
|
11093
|
-
const cleanModulesDir =
|
|
11094
|
-
const cleanPublishDir =
|
|
11152
|
+
const cleanWorkingDir = path14.resolve(workingDir);
|
|
11153
|
+
const cleanModulesDir = path14.resolve(modulesDir);
|
|
11154
|
+
const cleanPublishDir = path14.resolve(DEFAULT_PUBLISH_DIR);
|
|
11095
11155
|
const baseDirs = {
|
|
11096
11156
|
workingDir: cleanWorkingDir,
|
|
11097
11157
|
modulesDir: cleanModulesDir,
|
|
@@ -11108,7 +11168,7 @@ async function loadConfigWithParams(fs13, configFilename, workingDir, modulesDir
|
|
|
11108
11168
|
for (const [key2, value] of Object.entries(params)) {
|
|
11109
11169
|
provider.set(key2, value);
|
|
11110
11170
|
}
|
|
11111
|
-
const absPublishDir =
|
|
11171
|
+
const absPublishDir = path14.resolve(provider.get("publishDir") || DEFAULT_PUBLISH_DIR);
|
|
11112
11172
|
await fs13.mkdirAll(absPublishDir, 511);
|
|
11113
11173
|
return newConfig(
|
|
11114
11174
|
fs13,
|
|
@@ -11131,15 +11191,15 @@ async function getCacheDir(fs13, cacheDir) {
|
|
|
11131
11191
|
return cacheDir;
|
|
11132
11192
|
}
|
|
11133
11193
|
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
11134
|
-
const defaultCacheDir =
|
|
11194
|
+
const defaultCacheDir = path14.join(homeDir, ".cache", "mdf");
|
|
11135
11195
|
try {
|
|
11136
11196
|
await fs13.mkdirAll(defaultCacheDir, 493);
|
|
11137
11197
|
return defaultCacheDir;
|
|
11138
11198
|
} catch {
|
|
11139
|
-
return
|
|
11199
|
+
return path14.join("/tmp", "hugo-cache");
|
|
11140
11200
|
}
|
|
11141
11201
|
}
|
|
11142
|
-
var
|
|
11202
|
+
var path14;
|
|
11143
11203
|
var init_config2 = __esm({
|
|
11144
11204
|
"internal/domain/config/factory/config.ts"() {
|
|
11145
11205
|
"use strict";
|
|
@@ -11154,7 +11214,7 @@ var init_config2 = __esm({
|
|
|
11154
11214
|
init_markdown2();
|
|
11155
11215
|
init_loader();
|
|
11156
11216
|
init_sourcedescriptor();
|
|
11157
|
-
|
|
11217
|
+
path14 = __toESM(require("path"));
|
|
11158
11218
|
}
|
|
11159
11219
|
});
|
|
11160
11220
|
|
|
@@ -11226,11 +11286,11 @@ function createDefaultMounts(componentFolders) {
|
|
|
11226
11286
|
(folder) => new Mount(folder, folder)
|
|
11227
11287
|
);
|
|
11228
11288
|
}
|
|
11229
|
-
var
|
|
11289
|
+
var path15, Mount;
|
|
11230
11290
|
var init_mount = __esm({
|
|
11231
11291
|
"internal/domain/module/vo/mount.ts"() {
|
|
11232
11292
|
"use strict";
|
|
11233
|
-
|
|
11293
|
+
path15 = __toESM(require("path"));
|
|
11234
11294
|
Mount = class _Mount {
|
|
11235
11295
|
constructor(sourcePath, targetPath, language2 = "") {
|
|
11236
11296
|
this.sourcePath = sourcePath;
|
|
@@ -11265,16 +11325,16 @@ var init_mount = __esm({
|
|
|
11265
11325
|
* Get component name from target path
|
|
11266
11326
|
*/
|
|
11267
11327
|
component() {
|
|
11268
|
-
const parts = this.targetPath.split(
|
|
11328
|
+
const parts = this.targetPath.split(path15.sep);
|
|
11269
11329
|
return parts[0] || "";
|
|
11270
11330
|
}
|
|
11271
11331
|
/**
|
|
11272
11332
|
* Get component and name from target path
|
|
11273
11333
|
*/
|
|
11274
11334
|
componentAndName() {
|
|
11275
|
-
const parts = this.targetPath.split(
|
|
11335
|
+
const parts = this.targetPath.split(path15.sep);
|
|
11276
11336
|
const component = parts[0] || "";
|
|
11277
|
-
const name = parts.slice(1).join(
|
|
11337
|
+
const name = parts.slice(1).join(path15.sep);
|
|
11278
11338
|
return { component, name };
|
|
11279
11339
|
}
|
|
11280
11340
|
/**
|
|
@@ -11319,12 +11379,12 @@ function newHttpClient(fs13, timeout, headers, customClient) {
|
|
|
11319
11379
|
}
|
|
11320
11380
|
return new NodeHttpClient2(fs13, timeout, headers);
|
|
11321
11381
|
}
|
|
11322
|
-
var
|
|
11382
|
+
var path16, http, https, log20, NodeHttpClient2;
|
|
11323
11383
|
var init_httpclient = __esm({
|
|
11324
11384
|
"internal/domain/module/vo/httpclient.ts"() {
|
|
11325
11385
|
"use strict";
|
|
11326
11386
|
init_type5();
|
|
11327
|
-
|
|
11387
|
+
path16 = __toESM(require("path"));
|
|
11328
11388
|
http = __toESM(require("http"));
|
|
11329
11389
|
https = __toESM(require("https"));
|
|
11330
11390
|
init_log();
|
|
@@ -11375,7 +11435,7 @@ var init_httpclient = __esm({
|
|
|
11375
11435
|
let lastProgressTime = Date.now();
|
|
11376
11436
|
let lastLoggedPercentage = -1;
|
|
11377
11437
|
try {
|
|
11378
|
-
const targetDir =
|
|
11438
|
+
const targetDir = path16.dirname(targetPath);
|
|
11379
11439
|
await this.fs.mkdirAll(targetDir, 493);
|
|
11380
11440
|
const file = await this.fs.create(targetPath);
|
|
11381
11441
|
const chunks = [];
|
|
@@ -11526,14 +11586,14 @@ function newZipExtractor(fs13, environment = "node") {
|
|
|
11526
11586
|
throw new Error(`Unsupported environment: ${environment}`);
|
|
11527
11587
|
}
|
|
11528
11588
|
}
|
|
11529
|
-
var import_jszip,
|
|
11589
|
+
var import_jszip, path17, log21, JsZipExtractor, WebZipExtractor;
|
|
11530
11590
|
var init_zipextractor = __esm({
|
|
11531
11591
|
"internal/domain/module/vo/zipextractor.ts"() {
|
|
11532
11592
|
"use strict";
|
|
11533
11593
|
init_type5();
|
|
11534
11594
|
init_log();
|
|
11535
11595
|
import_jszip = __toESM(require("jszip"));
|
|
11536
|
-
|
|
11596
|
+
path17 = __toESM(require("path"));
|
|
11537
11597
|
log21 = getDomainLogger("module", { component: "zipextractor" });
|
|
11538
11598
|
JsZipExtractor = class {
|
|
11539
11599
|
constructor(fs13) {
|
|
@@ -11607,11 +11667,11 @@ var init_zipextractor = __esm({
|
|
|
11607
11667
|
* Extract a single ZIP entry (file or directory)
|
|
11608
11668
|
*/
|
|
11609
11669
|
async extractSingleEntry(relativePath, zipEntry, targetDir) {
|
|
11610
|
-
const fullPath =
|
|
11670
|
+
const fullPath = path17.join(targetDir, relativePath);
|
|
11611
11671
|
if (zipEntry.dir) {
|
|
11612
11672
|
await this.fs.mkdirAll(fullPath, 493);
|
|
11613
11673
|
} else {
|
|
11614
|
-
const dir2 =
|
|
11674
|
+
const dir2 = path17.dirname(fullPath);
|
|
11615
11675
|
if (dir2 !== targetDir) {
|
|
11616
11676
|
await this.fs.mkdirAll(dir2, 493);
|
|
11617
11677
|
}
|
|
@@ -11667,13 +11727,13 @@ var init_zipextractor = __esm({
|
|
|
11667
11727
|
function newModuleCache(fs13, cacheDir) {
|
|
11668
11728
|
return new FsModuleCache(fs13, cacheDir);
|
|
11669
11729
|
}
|
|
11670
|
-
var
|
|
11730
|
+
var path18, log22, FsModuleCache;
|
|
11671
11731
|
var init_cache = __esm({
|
|
11672
11732
|
"internal/domain/module/vo/cache.ts"() {
|
|
11673
11733
|
"use strict";
|
|
11674
11734
|
init_type5();
|
|
11675
11735
|
init_log();
|
|
11676
|
-
|
|
11736
|
+
path18 = __toESM(require("path"));
|
|
11677
11737
|
log22 = getDomainLogger("module", { component: "cache" });
|
|
11678
11738
|
FsModuleCache = class {
|
|
11679
11739
|
constructor(fs13, cacheDir = "./module/cache") {
|
|
@@ -11769,7 +11829,7 @@ var init_cache = __esm({
|
|
|
11769
11829
|
*/
|
|
11770
11830
|
getCacheFilePath(modulePath) {
|
|
11771
11831
|
const safeFileName = modulePath.replace(/[/\\:*?"<>|]/g, "_").replace(/^_+|_+$/g, "") + ".json";
|
|
11772
|
-
return
|
|
11832
|
+
return path18.join(this.cacheDir, safeFileName);
|
|
11773
11833
|
}
|
|
11774
11834
|
/**
|
|
11775
11835
|
* Get cache directory
|
|
@@ -11786,7 +11846,7 @@ var init_cache = __esm({
|
|
|
11786
11846
|
let totalSize = 0;
|
|
11787
11847
|
for (const file of files) {
|
|
11788
11848
|
try {
|
|
11789
|
-
const filePath =
|
|
11849
|
+
const filePath = path18.join(this.cacheDir, file);
|
|
11790
11850
|
const fileInfo = await this.fs.stat(filePath);
|
|
11791
11851
|
totalSize += fileInfo.size();
|
|
11792
11852
|
} catch (error) {
|
|
@@ -11810,7 +11870,7 @@ var init_cache = __esm({
|
|
|
11810
11870
|
try {
|
|
11811
11871
|
const files = await this.listCacheFiles();
|
|
11812
11872
|
return files.map(
|
|
11813
|
-
(file) =>
|
|
11873
|
+
(file) => path18.basename(file, ".json").replace(/_/g, "/")
|
|
11814
11874
|
);
|
|
11815
11875
|
} catch (error) {
|
|
11816
11876
|
return [];
|
|
@@ -11862,13 +11922,13 @@ function newProjectModule(info) {
|
|
|
11862
11922
|
}
|
|
11863
11923
|
return projectModule;
|
|
11864
11924
|
}
|
|
11865
|
-
var
|
|
11925
|
+
var path19, Module2, ProjectModule;
|
|
11866
11926
|
var init_module3 = __esm({
|
|
11867
11927
|
"internal/domain/module/vo/module.ts"() {
|
|
11868
11928
|
"use strict";
|
|
11869
11929
|
init_type5();
|
|
11870
11930
|
init_mount();
|
|
11871
|
-
|
|
11931
|
+
path19 = __toESM(require("path"));
|
|
11872
11932
|
Module2 = class _Module {
|
|
11873
11933
|
constructor(fs13, absoluteDir, modulePath, parent = null, isProject = false) {
|
|
11874
11934
|
this.fs = fs13;
|
|
@@ -11932,7 +11992,7 @@ var init_module3 = __esm({
|
|
|
11932
11992
|
let mounts = moduleImport.mounts || [];
|
|
11933
11993
|
if (mounts.length === 0) {
|
|
11934
11994
|
for (const componentFolder of ComponentFolders) {
|
|
11935
|
-
const sourceDir =
|
|
11995
|
+
const sourceDir = path19.join(this.absoluteDir, componentFolder);
|
|
11936
11996
|
try {
|
|
11937
11997
|
const stat4 = await this.fs.stat(sourceDir);
|
|
11938
11998
|
if (stat4.isDir()) {
|
|
@@ -12083,11 +12143,11 @@ var init_module3 = __esm({
|
|
|
12083
12143
|
function newLang(modules) {
|
|
12084
12144
|
return new Lang(modules);
|
|
12085
12145
|
}
|
|
12086
|
-
var
|
|
12146
|
+
var import_path13, Lang;
|
|
12087
12147
|
var init_lang2 = __esm({
|
|
12088
12148
|
"internal/domain/module/entity/lang.ts"() {
|
|
12089
12149
|
"use strict";
|
|
12090
|
-
|
|
12150
|
+
import_path13 = __toESM(require("path"));
|
|
12091
12151
|
Lang = class {
|
|
12092
12152
|
sourceLangMap;
|
|
12093
12153
|
constructor(modules) {
|
|
@@ -12103,7 +12163,7 @@ var init_lang2 = __esm({
|
|
|
12103
12163
|
* Returns a tuple of [language, exists] to match Go's return pattern
|
|
12104
12164
|
*/
|
|
12105
12165
|
getSourceLang(source) {
|
|
12106
|
-
const lang2 = this.sourceLangMap.get(
|
|
12166
|
+
const lang2 = this.sourceLangMap.get(import_path13.default.basename(source));
|
|
12107
12167
|
if (lang2 !== void 0) {
|
|
12108
12168
|
return [lang2, true];
|
|
12109
12169
|
}
|
|
@@ -12206,7 +12266,7 @@ var init_themes = __esm({
|
|
|
12206
12266
|
function newModules(info, httpClient, zipExtractor, moduleCache) {
|
|
12207
12267
|
return new Modules(info, httpClient, zipExtractor, moduleCache);
|
|
12208
12268
|
}
|
|
12209
|
-
var import_smol_toml,
|
|
12269
|
+
var import_smol_toml, path21, log23, Modules;
|
|
12210
12270
|
var init_module4 = __esm({
|
|
12211
12271
|
"internal/domain/module/entity/module.ts"() {
|
|
12212
12272
|
"use strict";
|
|
@@ -12216,7 +12276,7 @@ var init_module4 = __esm({
|
|
|
12216
12276
|
init_themes();
|
|
12217
12277
|
init_log();
|
|
12218
12278
|
import_smol_toml = require("smol-toml");
|
|
12219
|
-
|
|
12279
|
+
path21 = __toESM(require("path"));
|
|
12220
12280
|
log23 = getDomainLogger("module", { component: "modules" });
|
|
12221
12281
|
Modules = class {
|
|
12222
12282
|
constructor(info, httpClient, zipExtractor, moduleCache) {
|
|
@@ -12371,7 +12431,7 @@ var init_module4 = __esm({
|
|
|
12371
12431
|
log23.info(`Cache version mismatch for ${moduleImport.path}: cached=${cachedMetadata.version}, requested=${effectiveVersion || "latest"}`);
|
|
12372
12432
|
}
|
|
12373
12433
|
const moduleDir = this.getModuleDir(moduleImport.path);
|
|
12374
|
-
const zipPath =
|
|
12434
|
+
const zipPath = path21.join(moduleDir, "module.zip");
|
|
12375
12435
|
const metadata = {
|
|
12376
12436
|
path: moduleImport.path,
|
|
12377
12437
|
version: moduleImport.version || "latest",
|
|
@@ -12477,7 +12537,7 @@ var init_module4 = __esm({
|
|
|
12477
12537
|
*/
|
|
12478
12538
|
getModuleDir(modulePath) {
|
|
12479
12539
|
const safeName = modulePath.replace(/[/\\:*?"<>|]/g, "_").replace(/^_+|_+$/g, "");
|
|
12480
|
-
return
|
|
12540
|
+
return path21.join(this.info.moduleDir(), safeName);
|
|
12481
12541
|
}
|
|
12482
12542
|
/**
|
|
12483
12543
|
* Get download URL for module path
|
|
@@ -12578,7 +12638,7 @@ var init_module4 = __esm({
|
|
|
12578
12638
|
*/
|
|
12579
12639
|
async parseThemeToml(module2) {
|
|
12580
12640
|
try {
|
|
12581
|
-
const themeTomlPath =
|
|
12641
|
+
const themeTomlPath = path21.join(module2.dir(), "theme.toml");
|
|
12582
12642
|
try {
|
|
12583
12643
|
const stat4 = await this.info.osFs().stat(themeTomlPath);
|
|
12584
12644
|
if (stat4.isDir()) {
|
|
@@ -12970,13 +13030,13 @@ function newFileWithMeta(file, meta, fs13) {
|
|
|
12970
13030
|
function newDirFileWithMeta(file, meta, fs13) {
|
|
12971
13031
|
return new File(file, meta, fs13, true);
|
|
12972
13032
|
}
|
|
12973
|
-
var
|
|
13033
|
+
var path22, File;
|
|
12974
13034
|
var init_file = __esm({
|
|
12975
13035
|
"internal/domain/fs/vo/file.ts"() {
|
|
12976
13036
|
"use strict";
|
|
12977
13037
|
init_filemeta();
|
|
12978
13038
|
init_fileinfo();
|
|
12979
|
-
|
|
13039
|
+
path22 = __toESM(require("path"));
|
|
12980
13040
|
File = class {
|
|
12981
13041
|
file;
|
|
12982
13042
|
fileMeta;
|
|
@@ -13070,7 +13130,7 @@ var init_file = __esm({
|
|
|
13070
13130
|
return await this.file.writeAt(buffer, offset);
|
|
13071
13131
|
}
|
|
13072
13132
|
name() {
|
|
13073
|
-
return
|
|
13133
|
+
return path22.basename(this.fileMeta.fileName());
|
|
13074
13134
|
}
|
|
13075
13135
|
async readdir(count) {
|
|
13076
13136
|
if (this.file === null) {
|
|
@@ -13192,7 +13252,7 @@ var init_dir2 = __esm({
|
|
|
13192
13252
|
function newBaseFs(fs13, roots) {
|
|
13193
13253
|
return new BaseFs(fs13, roots);
|
|
13194
13254
|
}
|
|
13195
|
-
var
|
|
13255
|
+
var path23, log26, BaseFs;
|
|
13196
13256
|
var init_basefs = __esm({
|
|
13197
13257
|
"internal/domain/fs/entity/basefs.ts"() {
|
|
13198
13258
|
"use strict";
|
|
@@ -13200,7 +13260,7 @@ var init_basefs = __esm({
|
|
|
13200
13260
|
init_fileinfo();
|
|
13201
13261
|
init_file();
|
|
13202
13262
|
init_dir2();
|
|
13203
|
-
|
|
13263
|
+
path23 = __toESM(require("path"));
|
|
13204
13264
|
init_log();
|
|
13205
13265
|
log26 = getDomainLogger("fs", { component: "basefs" });
|
|
13206
13266
|
BaseFs = class {
|
|
@@ -13223,17 +13283,17 @@ var init_basefs = __esm({
|
|
|
13223
13283
|
if (name === "") {
|
|
13224
13284
|
return root2;
|
|
13225
13285
|
}
|
|
13226
|
-
if (
|
|
13286
|
+
if (path23.isAbsolute(name)) {
|
|
13227
13287
|
if (name.startsWith(root2)) {
|
|
13228
13288
|
return name;
|
|
13229
13289
|
}
|
|
13230
|
-
return
|
|
13290
|
+
return path23.join(root2, name.substring(1));
|
|
13231
13291
|
}
|
|
13232
|
-
return
|
|
13292
|
+
return path23.join(root2, name);
|
|
13233
13293
|
}
|
|
13234
13294
|
isSameRootedPath(name) {
|
|
13235
13295
|
const root2 = this.roots[0];
|
|
13236
|
-
return name.startsWith(
|
|
13296
|
+
return name.startsWith(path23.join(root2, path23.sep)) || name === root2;
|
|
13237
13297
|
}
|
|
13238
13298
|
/**
|
|
13239
13299
|
* Stat returns file info with opener function
|
|
@@ -13319,8 +13379,8 @@ var init_basefs = __esm({
|
|
|
13319
13379
|
const absPath = this.toAbsolutePath(name);
|
|
13320
13380
|
return await this.fs.mkdir(absPath, perm);
|
|
13321
13381
|
}
|
|
13322
|
-
async mkdirAll(
|
|
13323
|
-
const absPath = this.toAbsolutePath(
|
|
13382
|
+
async mkdirAll(path43, perm) {
|
|
13383
|
+
const absPath = this.toAbsolutePath(path43);
|
|
13324
13384
|
return await this.fs.mkdirAll(absPath, perm);
|
|
13325
13385
|
}
|
|
13326
13386
|
async openFile(name, flag, perm) {
|
|
@@ -13331,8 +13391,8 @@ var init_basefs = __esm({
|
|
|
13331
13391
|
const absPath = this.toAbsolutePath(name);
|
|
13332
13392
|
return await this.fs.remove(absPath);
|
|
13333
13393
|
}
|
|
13334
|
-
async removeAll(
|
|
13335
|
-
const absPath = this.toAbsolutePath(
|
|
13394
|
+
async removeAll(path43) {
|
|
13395
|
+
const absPath = this.toAbsolutePath(path43);
|
|
13336
13396
|
return await this.fs.removeAll(absPath);
|
|
13337
13397
|
}
|
|
13338
13398
|
async rename(oldname, newname) {
|
|
@@ -13363,11 +13423,11 @@ var init_basefs = __esm({
|
|
|
13363
13423
|
function newWalkway(fs13, cb) {
|
|
13364
13424
|
return new Walkway(fs13, cb);
|
|
13365
13425
|
}
|
|
13366
|
-
var
|
|
13426
|
+
var path24, log27, Walkway;
|
|
13367
13427
|
var init_walkway = __esm({
|
|
13368
13428
|
"internal/domain/fs/vo/walkway.ts"() {
|
|
13369
13429
|
"use strict";
|
|
13370
|
-
|
|
13430
|
+
path24 = __toESM(require("path"));
|
|
13371
13431
|
init_type6();
|
|
13372
13432
|
init_fileinfo();
|
|
13373
13433
|
init_filemeta();
|
|
@@ -13494,7 +13554,7 @@ var init_walkway = __esm({
|
|
|
13494
13554
|
}
|
|
13495
13555
|
}
|
|
13496
13556
|
for (const entry of dirEntries) {
|
|
13497
|
-
const nextPath =
|
|
13557
|
+
const nextPath = path24.join(filePath, entry.name());
|
|
13498
13558
|
try {
|
|
13499
13559
|
await this.walkRecursive(nextPath, entry);
|
|
13500
13560
|
} catch (err) {
|
|
@@ -13576,9 +13636,9 @@ var init_static_copier = __esm({
|
|
|
13576
13636
|
async walkSourceFiles(sourceFs, targetDir) {
|
|
13577
13637
|
let fileCount = 0;
|
|
13578
13638
|
try {
|
|
13579
|
-
await this.walkFileSystem(sourceFs, "/", async (
|
|
13639
|
+
await this.walkFileSystem(sourceFs, "/", async (path43, isDir) => {
|
|
13580
13640
|
if (!isDir) {
|
|
13581
|
-
await this.copyFile(sourceFs,
|
|
13641
|
+
await this.copyFile(sourceFs, path43, this.toFs, targetDir);
|
|
13582
13642
|
fileCount++;
|
|
13583
13643
|
}
|
|
13584
13644
|
});
|
|
@@ -13662,8 +13722,8 @@ var init_static_copier = __esm({
|
|
|
13662
13722
|
/**
|
|
13663
13723
|
* Get directory name from path
|
|
13664
13724
|
*/
|
|
13665
|
-
dirname(
|
|
13666
|
-
const parts =
|
|
13725
|
+
dirname(path43) {
|
|
13726
|
+
const parts = path43.split("/").filter((part) => part.length > 0);
|
|
13667
13727
|
if (parts.length <= 1)
|
|
13668
13728
|
return "/";
|
|
13669
13729
|
return "/" + parts.slice(0, -1).join("/");
|
|
@@ -13676,16 +13736,16 @@ var init_static_copier = __esm({
|
|
|
13676
13736
|
async function collectFileMetaInfos(paths, fss) {
|
|
13677
13737
|
const result = /* @__PURE__ */ new Map();
|
|
13678
13738
|
let found = false;
|
|
13679
|
-
for (const
|
|
13739
|
+
for (const path43 of paths) {
|
|
13680
13740
|
for (const fs13 of fss) {
|
|
13681
13741
|
try {
|
|
13682
|
-
const fileMetaInfo = await createFileMetaInfo(
|
|
13683
|
-
result.set(
|
|
13742
|
+
const fileMetaInfo = await createFileMetaInfo(path43, fs13);
|
|
13743
|
+
result.set(path43, fileMetaInfo);
|
|
13684
13744
|
found = true;
|
|
13685
13745
|
if (found)
|
|
13686
13746
|
break;
|
|
13687
13747
|
} catch (error) {
|
|
13688
|
-
log29.error(`Failed to create FileMetaInfo for ${
|
|
13748
|
+
log29.error(`Failed to create FileMetaInfo for ${path43} with fs=${fs13}:`, error);
|
|
13689
13749
|
}
|
|
13690
13750
|
}
|
|
13691
13751
|
}
|
|
@@ -13794,8 +13854,8 @@ var init_fs = __esm({
|
|
|
13794
13854
|
/**
|
|
13795
13855
|
* Create new base path filesystem
|
|
13796
13856
|
*/
|
|
13797
|
-
newBasePathFs(source,
|
|
13798
|
-
return newBaseFs(source, [
|
|
13857
|
+
newBasePathFs(source, path43) {
|
|
13858
|
+
return newBaseFs(source, [path43]);
|
|
13799
13859
|
}
|
|
13800
13860
|
async walkPrompts(start, cb, conf) {
|
|
13801
13861
|
return await this.walk(this.prompts, start, cb, conf);
|
|
@@ -14337,11 +14397,11 @@ var init_overlayfs = __esm({
|
|
|
14337
14397
|
/**
|
|
14338
14398
|
* Create directory tree (write operation)
|
|
14339
14399
|
*/
|
|
14340
|
-
async mkdirAll(
|
|
14400
|
+
async mkdirAll(path43, perm) {
|
|
14341
14401
|
if (!this.firstWritable) {
|
|
14342
14402
|
throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
|
|
14343
14403
|
}
|
|
14344
|
-
return await this.writeFs().mkdirAll(
|
|
14404
|
+
return await this.writeFs().mkdirAll(path43, perm);
|
|
14345
14405
|
}
|
|
14346
14406
|
/**
|
|
14347
14407
|
* Open file for reading (searches all filesystems)
|
|
@@ -14400,11 +14460,11 @@ var init_overlayfs = __esm({
|
|
|
14400
14460
|
/**
|
|
14401
14461
|
* Remove directory tree (write operation)
|
|
14402
14462
|
*/
|
|
14403
|
-
async removeAll(
|
|
14463
|
+
async removeAll(path43) {
|
|
14404
14464
|
if (!this.firstWritable) {
|
|
14405
14465
|
throw new OverlayFsError("filesystem is read-only", "READ_ONLY");
|
|
14406
14466
|
}
|
|
14407
|
-
return await this.writeFs().removeAll(
|
|
14467
|
+
return await this.writeFs().removeAll(path43);
|
|
14408
14468
|
}
|
|
14409
14469
|
/**
|
|
14410
14470
|
* Rename file (write operation)
|
|
@@ -14661,13 +14721,13 @@ var init_overlayfs_factory = __esm({
|
|
|
14661
14721
|
function newFilesystemsCollector(sourceProject) {
|
|
14662
14722
|
return new FilesystemsCollector(sourceProject);
|
|
14663
14723
|
}
|
|
14664
|
-
var
|
|
14724
|
+
var path25, log31, RootMapping, FilesystemsCollector;
|
|
14665
14725
|
var init_filesystemscollector = __esm({
|
|
14666
14726
|
"internal/domain/fs/vo/filesystemscollector.ts"() {
|
|
14667
14727
|
"use strict";
|
|
14668
14728
|
init_overlayfs_factory();
|
|
14669
14729
|
init_basefs();
|
|
14670
|
-
|
|
14730
|
+
path25 = __toESM(require("path"));
|
|
14671
14731
|
init_log();
|
|
14672
14732
|
log31 = getDomainLogger("fs", { component: "filesystemscollector" });
|
|
14673
14733
|
RootMapping = class {
|
|
@@ -14722,7 +14782,7 @@ var init_filesystemscollector = __esm({
|
|
|
14722
14782
|
const fromToAssets = [];
|
|
14723
14783
|
const fromToI18n = [];
|
|
14724
14784
|
const absPathify = (inputPath) => {
|
|
14725
|
-
if (
|
|
14785
|
+
if (path25.isAbsolute(inputPath)) {
|
|
14726
14786
|
return ["", inputPath];
|
|
14727
14787
|
}
|
|
14728
14788
|
return [md.dir(), this.absPathify(md.dir(), inputPath)];
|
|
@@ -14801,7 +14861,7 @@ var init_filesystemscollector = __esm({
|
|
|
14801
14861
|
return target === "i18n" || target.startsWith("i18n/") || target.startsWith("/i18n/");
|
|
14802
14862
|
}
|
|
14803
14863
|
absPathify(baseDir, relativePath) {
|
|
14804
|
-
return
|
|
14864
|
+
return path25.resolve(baseDir, relativePath);
|
|
14805
14865
|
}
|
|
14806
14866
|
};
|
|
14807
14867
|
}
|
|
@@ -14811,12 +14871,12 @@ var init_filesystemscollector = __esm({
|
|
|
14811
14871
|
function newOsFs() {
|
|
14812
14872
|
return new OsFs();
|
|
14813
14873
|
}
|
|
14814
|
-
var fs9,
|
|
14874
|
+
var fs9, path26, log32, OsFileInfo, OsFile, OsFs;
|
|
14815
14875
|
var init_osfs = __esm({
|
|
14816
14876
|
"internal/domain/fs/vo/osfs.ts"() {
|
|
14817
14877
|
"use strict";
|
|
14818
14878
|
fs9 = __toESM(require("fs/promises"));
|
|
14819
|
-
|
|
14879
|
+
path26 = __toESM(require("path"));
|
|
14820
14880
|
init_log();
|
|
14821
14881
|
log32 = getDomainLogger("fs", { component: "osfs" });
|
|
14822
14882
|
OsFileInfo = class {
|
|
@@ -14939,7 +14999,7 @@ var init_osfs = __esm({
|
|
|
14939
14999
|
const limit = count > 0 ? Math.min(count, entries.length) : entries.length;
|
|
14940
15000
|
for (let i = 0; i < limit; i++) {
|
|
14941
15001
|
const entry = entries[i];
|
|
14942
|
-
const entryPath =
|
|
15002
|
+
const entryPath = path26.join(this.filePath, entry.name);
|
|
14943
15003
|
const stats = await fs9.stat(entryPath);
|
|
14944
15004
|
result.push(new OsFileInfo(stats, entry.name));
|
|
14945
15005
|
}
|
|
@@ -14955,7 +15015,7 @@ var init_osfs = __esm({
|
|
|
14955
15015
|
if (this.closed)
|
|
14956
15016
|
throw new Error("File is closed");
|
|
14957
15017
|
const stats = await fs9.stat(this.filePath);
|
|
14958
|
-
return new OsFileInfo(stats,
|
|
15018
|
+
return new OsFileInfo(stats, path26.basename(this.filePath));
|
|
14959
15019
|
}
|
|
14960
15020
|
async sync() {
|
|
14961
15021
|
if (this.closed)
|
|
@@ -15032,7 +15092,7 @@ var init_osfs = __esm({
|
|
|
15032
15092
|
}
|
|
15033
15093
|
async stat(name) {
|
|
15034
15094
|
const stats = await fs9.stat(name);
|
|
15035
|
-
return new OsFileInfo(stats,
|
|
15095
|
+
return new OsFileInfo(stats, path26.basename(name));
|
|
15036
15096
|
}
|
|
15037
15097
|
name() {
|
|
15038
15098
|
return "OsFs";
|
|
@@ -18404,8 +18464,8 @@ function wikilinkInlineRule(state, silent) {
|
|
|
18404
18464
|
function renderWikilinkLink(tokens, idx) {
|
|
18405
18465
|
const token = tokens[idx];
|
|
18406
18466
|
const meta = token.meta;
|
|
18407
|
-
const [
|
|
18408
|
-
const slug2 = slugifyFilePath(
|
|
18467
|
+
const [path43, _anchor] = splitAnchor(meta.url);
|
|
18468
|
+
const slug2 = slugifyFilePath(path43);
|
|
18409
18469
|
const displayText = meta.alias ?? meta.filepath;
|
|
18410
18470
|
const escapedText = escapeHtml(displayText);
|
|
18411
18471
|
return `<a class="internal" data-slug="${slug2}" data-wikilink="${escapeHtml(meta.url)}">${escapedText}</a>`;
|
|
@@ -19371,8 +19431,8 @@ var init_type10 = __esm({
|
|
|
19371
19431
|
COMPONENT_FOLDER_ASSETS: "assets",
|
|
19372
19432
|
COMPONENT_FOLDER_I18N: "i18n",
|
|
19373
19433
|
// Path normalization utility
|
|
19374
|
-
normalizePath: (
|
|
19375
|
-
let p2 =
|
|
19434
|
+
normalizePath: (path43) => {
|
|
19435
|
+
let p2 = path43.replace(/\\/g, "/");
|
|
19376
19436
|
if (p2.startsWith("//")) {
|
|
19377
19437
|
p2 = p2.substring(1);
|
|
19378
19438
|
}
|
|
@@ -19622,8 +19682,8 @@ var init_path2 = __esm({
|
|
|
19622
19682
|
if (this.components.component) {
|
|
19623
19683
|
return this.components.component;
|
|
19624
19684
|
}
|
|
19625
|
-
const
|
|
19626
|
-
const parts =
|
|
19685
|
+
const path43 = this.components.normalized;
|
|
19686
|
+
const parts = path43.split("/").filter((p2) => p2.length > 0);
|
|
19627
19687
|
if (parts.length === 0) {
|
|
19628
19688
|
return "content";
|
|
19629
19689
|
}
|
|
@@ -19951,10 +20011,10 @@ var init_path2 = __esm({
|
|
|
19951
20011
|
/**
|
|
19952
20012
|
* Create a path from string components
|
|
19953
20013
|
*/
|
|
19954
|
-
static fromString(component,
|
|
20014
|
+
static fromString(component, path43) {
|
|
19955
20015
|
const components = new PathComponentsImpl(
|
|
19956
|
-
|
|
19957
|
-
|
|
20016
|
+
path43,
|
|
20017
|
+
path43,
|
|
19958
20018
|
{ containerLow: -1, containerHigh: -1, sectionHigh: -1, identifierLanguage: -1 },
|
|
19959
20019
|
[],
|
|
19960
20020
|
0 /* File */,
|
|
@@ -19965,8 +20025,8 @@ var init_path2 = __esm({
|
|
|
19965
20025
|
/**
|
|
19966
20026
|
* Check if a path has a specific extension
|
|
19967
20027
|
*/
|
|
19968
|
-
static hasExtension(
|
|
19969
|
-
const pathExt =
|
|
20028
|
+
static hasExtension(path43, extension) {
|
|
20029
|
+
const pathExt = path43.ext();
|
|
19970
20030
|
const targetExt = extension.startsWith(".") ? extension : "." + extension;
|
|
19971
20031
|
return pathExt.toLowerCase() === targetExt.toLowerCase();
|
|
19972
20032
|
}
|
|
@@ -20024,20 +20084,20 @@ var init_pathparser = __esm({
|
|
|
20024
20084
|
/**
|
|
20025
20085
|
* Parse a path with component information
|
|
20026
20086
|
*/
|
|
20027
|
-
parse(component,
|
|
20028
|
-
let normalizedPath =
|
|
20087
|
+
parse(component, path43) {
|
|
20088
|
+
let normalizedPath = path43;
|
|
20029
20089
|
if (!normalizedPath || normalizedPath === "") {
|
|
20030
20090
|
normalizedPath = "/";
|
|
20031
20091
|
}
|
|
20032
20092
|
const normalized = this.normalizer.normalize(normalizedPath);
|
|
20033
|
-
const pathComponents = this.createPathComponents(component, normalized,
|
|
20093
|
+
const pathComponents = this.createPathComponents(component, normalized, path43);
|
|
20034
20094
|
return new Path(pathComponents);
|
|
20035
20095
|
}
|
|
20036
20096
|
/**
|
|
20037
20097
|
* Parse and return only the identity
|
|
20038
20098
|
*/
|
|
20039
|
-
parseIdentity(component,
|
|
20040
|
-
const parsed = this.parse(component,
|
|
20099
|
+
parseIdentity(component, path43) {
|
|
20100
|
+
const parsed = this.parse(component, path43);
|
|
20041
20101
|
return {
|
|
20042
20102
|
identifierBase: () => parsed.base()
|
|
20043
20103
|
};
|
|
@@ -20045,8 +20105,8 @@ var init_pathparser = __esm({
|
|
|
20045
20105
|
/**
|
|
20046
20106
|
* Parse and return base and base name without identifier
|
|
20047
20107
|
*/
|
|
20048
|
-
parseBaseAndBaseNameNoIdentifier(component,
|
|
20049
|
-
const parsed = this.parse(component,
|
|
20108
|
+
parseBaseAndBaseNameNoIdentifier(component, path43) {
|
|
20109
|
+
const parsed = this.parse(component, path43);
|
|
20050
20110
|
return [parsed.base(), parsed.baseNameNoIdentifier()];
|
|
20051
20111
|
}
|
|
20052
20112
|
/**
|
|
@@ -20175,8 +20235,8 @@ var init_pathparser = __esm({
|
|
|
20175
20235
|
this.toLowerCase = toLowerCase;
|
|
20176
20236
|
this.replaceSpaces = replaceSpaces;
|
|
20177
20237
|
}
|
|
20178
|
-
normalize(
|
|
20179
|
-
let result =
|
|
20238
|
+
normalize(path43) {
|
|
20239
|
+
let result = path43;
|
|
20180
20240
|
result = result.replace(/\\/g, "/");
|
|
20181
20241
|
if (this.toLowerCase) {
|
|
20182
20242
|
result = result.toLowerCase();
|
|
@@ -20192,8 +20252,8 @@ var init_pathparser = __esm({
|
|
|
20192
20252
|
this.toLowerCase = toLowerCase;
|
|
20193
20253
|
this.replaceSpaces = replaceSpaces;
|
|
20194
20254
|
}
|
|
20195
|
-
normalize(
|
|
20196
|
-
let result =
|
|
20255
|
+
normalize(path43) {
|
|
20256
|
+
let result = path43;
|
|
20197
20257
|
result = result.replace(/\\/g, "/");
|
|
20198
20258
|
if (this.toLowerCase) {
|
|
20199
20259
|
result = result.toLowerCase();
|
|
@@ -20213,12 +20273,12 @@ var init_pathparser = __esm({
|
|
|
20213
20273
|
const htmlExts = PATH_CONSTANTS.HTML_EXTENSIONS;
|
|
20214
20274
|
return htmlExts.includes(ext.toLowerCase());
|
|
20215
20275
|
}
|
|
20216
|
-
hasExt(
|
|
20217
|
-
for (let i =
|
|
20218
|
-
if (
|
|
20276
|
+
hasExt(path43) {
|
|
20277
|
+
for (let i = path43.length - 1; i >= 0; i--) {
|
|
20278
|
+
if (path43[i] === ".") {
|
|
20219
20279
|
return true;
|
|
20220
20280
|
}
|
|
20221
|
-
if (
|
|
20281
|
+
if (path43[i] === "/") {
|
|
20222
20282
|
return false;
|
|
20223
20283
|
}
|
|
20224
20284
|
}
|
|
@@ -20229,10 +20289,10 @@ var init_pathparser = __esm({
|
|
|
20229
20289
|
/**
|
|
20230
20290
|
* Parse a path string into basic components
|
|
20231
20291
|
*/
|
|
20232
|
-
static parseBasic(
|
|
20233
|
-
const lastSlash =
|
|
20234
|
-
const dir2 = lastSlash >= 0 ?
|
|
20235
|
-
const name = lastSlash >= 0 ?
|
|
20292
|
+
static parseBasic(path43) {
|
|
20293
|
+
const lastSlash = path43.lastIndexOf("/");
|
|
20294
|
+
const dir2 = lastSlash >= 0 ? path43.substring(0, lastSlash) : "";
|
|
20295
|
+
const name = lastSlash >= 0 ? path43.substring(lastSlash + 1) : path43;
|
|
20236
20296
|
const lastDot = name.lastIndexOf(".");
|
|
20237
20297
|
const ext = lastDot >= 0 ? name.substring(lastDot) : "";
|
|
20238
20298
|
const nameWithoutExt = lastDot >= 0 ? name.substring(0, lastDot) : name;
|
|
@@ -20247,43 +20307,43 @@ var init_pathparser = __esm({
|
|
|
20247
20307
|
/**
|
|
20248
20308
|
* Normalize a path string using basic rules
|
|
20249
20309
|
*/
|
|
20250
|
-
static normalizeBasic(
|
|
20310
|
+
static normalizeBasic(path43) {
|
|
20251
20311
|
const normalizer = new BasicPathNormalizer();
|
|
20252
|
-
return normalizer.normalize(
|
|
20312
|
+
return normalizer.normalize(path43);
|
|
20253
20313
|
}
|
|
20254
20314
|
/**
|
|
20255
20315
|
* Check if a path represents a bundle
|
|
20256
20316
|
*/
|
|
20257
|
-
static isBundle(
|
|
20258
|
-
const basic = _PathParserUtils.parseBasic(
|
|
20317
|
+
static isBundle(path43) {
|
|
20318
|
+
const basic = _PathParserUtils.parseBasic(path43);
|
|
20259
20319
|
const indexNames = PATH_CONSTANTS.INDEX_NAMES;
|
|
20260
20320
|
return indexNames.includes(basic.nameWithoutExt);
|
|
20261
20321
|
}
|
|
20262
20322
|
/**
|
|
20263
20323
|
* Extract section from path
|
|
20264
20324
|
*/
|
|
20265
|
-
static extractSection(
|
|
20266
|
-
const normalized =
|
|
20325
|
+
static extractSection(path43) {
|
|
20326
|
+
const normalized = path43.startsWith("/") ? path43.substring(1) : path43;
|
|
20267
20327
|
const firstSlash = normalized.indexOf("/");
|
|
20268
20328
|
return firstSlash >= 0 ? normalized.substring(0, firstSlash) : normalized;
|
|
20269
20329
|
}
|
|
20270
20330
|
/**
|
|
20271
20331
|
* Remove extension from path
|
|
20272
20332
|
*/
|
|
20273
|
-
static removeExtension(
|
|
20274
|
-
const lastDot =
|
|
20275
|
-
const lastSlash =
|
|
20333
|
+
static removeExtension(path43) {
|
|
20334
|
+
const lastDot = path43.lastIndexOf(".");
|
|
20335
|
+
const lastSlash = path43.lastIndexOf("/");
|
|
20276
20336
|
if (lastDot > lastSlash) {
|
|
20277
|
-
return
|
|
20337
|
+
return path43.substring(0, lastDot);
|
|
20278
20338
|
}
|
|
20279
|
-
return
|
|
20339
|
+
return path43;
|
|
20280
20340
|
}
|
|
20281
20341
|
/**
|
|
20282
20342
|
* Check if path has extension
|
|
20283
20343
|
*/
|
|
20284
|
-
static hasExtension(
|
|
20344
|
+
static hasExtension(path43) {
|
|
20285
20345
|
const checker = new DefaultFileExtensionChecker();
|
|
20286
|
-
return checker.hasExt(
|
|
20346
|
+
return checker.hasExt(path43);
|
|
20287
20347
|
}
|
|
20288
20348
|
};
|
|
20289
20349
|
}
|
|
@@ -20314,11 +20374,11 @@ var init_pathfactory = __esm({
|
|
|
20314
20374
|
/**
|
|
20315
20375
|
* Create a Path from component and path string
|
|
20316
20376
|
*/
|
|
20317
|
-
create(component,
|
|
20377
|
+
create(component, path43, config) {
|
|
20318
20378
|
if (this.pool) {
|
|
20319
20379
|
const pooledPath = this.pool.get();
|
|
20320
20380
|
}
|
|
20321
|
-
return this.processor.parse(component,
|
|
20381
|
+
return this.processor.parse(component, path43);
|
|
20322
20382
|
}
|
|
20323
20383
|
/**
|
|
20324
20384
|
* Create a Path from PathComponents
|
|
@@ -20330,12 +20390,12 @@ var init_pathfactory = __esm({
|
|
|
20330
20390
|
* Create multiple paths from an array of path strings
|
|
20331
20391
|
*/
|
|
20332
20392
|
createMany(component, paths, config) {
|
|
20333
|
-
return paths.map((
|
|
20393
|
+
return paths.map((path43) => this.create(component, path43, config));
|
|
20334
20394
|
}
|
|
20335
20395
|
/**
|
|
20336
20396
|
* Create a path with custom configuration
|
|
20337
20397
|
*/
|
|
20338
|
-
createWithConfig(component,
|
|
20398
|
+
createWithConfig(component, path43, normalizeConfig) {
|
|
20339
20399
|
const config = {};
|
|
20340
20400
|
if (normalizeConfig?.toLowerCase !== void 0) {
|
|
20341
20401
|
config.normalize = normalizeConfig.toLowerCase;
|
|
@@ -20346,7 +20406,7 @@ var init_pathfactory = __esm({
|
|
|
20346
20406
|
if (normalizeConfig?.customNormalizer !== void 0) {
|
|
20347
20407
|
config.normalizer = normalizeConfig.customNormalizer;
|
|
20348
20408
|
}
|
|
20349
|
-
return this.create(component,
|
|
20409
|
+
return this.create(component, path43, config);
|
|
20350
20410
|
}
|
|
20351
20411
|
};
|
|
20352
20412
|
DefaultPathFactory = class extends PathFactoryImpl {
|
|
@@ -20370,9 +20430,9 @@ var init_pathfactory = __esm({
|
|
|
20370
20430
|
const components = PathComponentsFactory.createEmpty();
|
|
20371
20431
|
return new Path(components);
|
|
20372
20432
|
}
|
|
20373
|
-
put(
|
|
20433
|
+
put(path43) {
|
|
20374
20434
|
if (this.pool.length < this.maxSize) {
|
|
20375
|
-
this.pool.push(
|
|
20435
|
+
this.pool.push(path43);
|
|
20376
20436
|
}
|
|
20377
20437
|
}
|
|
20378
20438
|
/**
|
|
@@ -20406,8 +20466,8 @@ var init_pathfactory = __esm({
|
|
|
20406
20466
|
/**
|
|
20407
20467
|
* Set the path
|
|
20408
20468
|
*/
|
|
20409
|
-
withPath(
|
|
20410
|
-
this.path =
|
|
20469
|
+
withPath(path43) {
|
|
20470
|
+
this.path = path43;
|
|
20411
20471
|
return this;
|
|
20412
20472
|
}
|
|
20413
20473
|
/**
|
|
@@ -20455,38 +20515,38 @@ var init_pathfactory = __esm({
|
|
|
20455
20515
|
/**
|
|
20456
20516
|
* Create a content path
|
|
20457
20517
|
*/
|
|
20458
|
-
static createContentPath(
|
|
20459
|
-
return _PathFactoryUtils.defaultFactory.create("content",
|
|
20518
|
+
static createContentPath(path43) {
|
|
20519
|
+
return _PathFactoryUtils.defaultFactory.create("content", path43);
|
|
20460
20520
|
}
|
|
20461
20521
|
/**
|
|
20462
20522
|
* Create a static resource path
|
|
20463
20523
|
*/
|
|
20464
|
-
static createStaticPath(
|
|
20465
|
-
return _PathFactoryUtils.defaultFactory.create("static",
|
|
20524
|
+
static createStaticPath(path43) {
|
|
20525
|
+
return _PathFactoryUtils.defaultFactory.create("static", path43);
|
|
20466
20526
|
}
|
|
20467
20527
|
/**
|
|
20468
20528
|
* Create a layout path
|
|
20469
20529
|
*/
|
|
20470
|
-
static createLayoutPath(
|
|
20471
|
-
return _PathFactoryUtils.defaultFactory.create("layouts",
|
|
20530
|
+
static createLayoutPath(path43) {
|
|
20531
|
+
return _PathFactoryUtils.defaultFactory.create("layouts", path43);
|
|
20472
20532
|
}
|
|
20473
20533
|
/**
|
|
20474
20534
|
* Create an archetype path
|
|
20475
20535
|
*/
|
|
20476
|
-
static createArchetypePath(
|
|
20477
|
-
return _PathFactoryUtils.defaultFactory.create("archetypes",
|
|
20536
|
+
static createArchetypePath(path43) {
|
|
20537
|
+
return _PathFactoryUtils.defaultFactory.create("archetypes", path43);
|
|
20478
20538
|
}
|
|
20479
20539
|
/**
|
|
20480
20540
|
* Create a data path
|
|
20481
20541
|
*/
|
|
20482
|
-
static createDataPath(
|
|
20483
|
-
return _PathFactoryUtils.defaultFactory.create("data",
|
|
20542
|
+
static createDataPath(path43) {
|
|
20543
|
+
return _PathFactoryUtils.defaultFactory.create("data", path43);
|
|
20484
20544
|
}
|
|
20485
20545
|
/**
|
|
20486
20546
|
* Create a theme path
|
|
20487
20547
|
*/
|
|
20488
|
-
static createThemePath(
|
|
20489
|
-
return _PathFactoryUtils.defaultFactory.create("themes",
|
|
20548
|
+
static createThemePath(path43) {
|
|
20549
|
+
return _PathFactoryUtils.defaultFactory.create("themes", path43);
|
|
20490
20550
|
}
|
|
20491
20551
|
/**
|
|
20492
20552
|
* Create paths from a configuration object
|
|
@@ -20500,7 +20560,7 @@ var init_pathfactory = __esm({
|
|
|
20500
20560
|
factoryConfig.replaceSpaces = config.replaceSpaces;
|
|
20501
20561
|
}
|
|
20502
20562
|
const factory = new PathFactoryImpl(factoryConfig);
|
|
20503
|
-
return config.paths.map((
|
|
20563
|
+
return config.paths.map((path43) => factory.create(config.component, path43));
|
|
20504
20564
|
}
|
|
20505
20565
|
/**
|
|
20506
20566
|
* Get a path builder instance
|
|
@@ -20511,9 +20571,9 @@ var init_pathfactory = __esm({
|
|
|
20511
20571
|
/**
|
|
20512
20572
|
* Create a path with pooling
|
|
20513
20573
|
*/
|
|
20514
|
-
static createWithPool(component,
|
|
20574
|
+
static createWithPool(component, path43, pool2) {
|
|
20515
20575
|
const factory = new PathFactoryImpl(void 0, pool2);
|
|
20516
|
-
return factory.create(component,
|
|
20576
|
+
return factory.create(component, path43);
|
|
20517
20577
|
}
|
|
20518
20578
|
};
|
|
20519
20579
|
}
|
|
@@ -20619,12 +20679,12 @@ var init_translator = __esm({
|
|
|
20619
20679
|
async setupTranslateFuncs(fsService) {
|
|
20620
20680
|
try {
|
|
20621
20681
|
await fsService.walkI18n("", {
|
|
20622
|
-
walkFn: async (
|
|
20623
|
-
if (!
|
|
20682
|
+
walkFn: async (path43, info) => {
|
|
20683
|
+
if (!path43.endsWith(".yaml") && !path43.endsWith(".yml")) {
|
|
20624
20684
|
return;
|
|
20625
20685
|
}
|
|
20626
20686
|
try {
|
|
20627
|
-
const normalizedPath = PATH_CONSTANTS.normalizePath(
|
|
20687
|
+
const normalizedPath = PATH_CONSTANTS.normalizePath(path43);
|
|
20628
20688
|
const filename = normalizedPath.split("/").pop() || "";
|
|
20629
20689
|
const langKey = filename.replace(/\.(yaml|yml)$/, "").toLowerCase();
|
|
20630
20690
|
const content = await this.readI18nFile(info);
|
|
@@ -20644,7 +20704,7 @@ var init_translator = __esm({
|
|
|
20644
20704
|
this.translateFuncs.set(langKey, translateFunc);
|
|
20645
20705
|
log38.info(`\u2705 Loaded i18n translations for language: ${langKey} (${translations.length} items)`);
|
|
20646
20706
|
} catch (error) {
|
|
20647
|
-
log38.error(`\u274C Failed to load i18n file ${
|
|
20707
|
+
log38.error(`\u274C Failed to load i18n file ${path43}:`, error);
|
|
20648
20708
|
}
|
|
20649
20709
|
}
|
|
20650
20710
|
}, {});
|
|
@@ -20850,13 +20910,13 @@ function isContentExt(ext) {
|
|
|
20850
20910
|
function newFileInfo2(fi) {
|
|
20851
20911
|
return FileInfo7.newFileInfo(fi);
|
|
20852
20912
|
}
|
|
20853
|
-
var crypto2,
|
|
20913
|
+
var crypto2, path27, log41, contentFileExtensions, contentFileExtensionsSet, FileInfo7;
|
|
20854
20914
|
var init_fileinfo2 = __esm({
|
|
20855
20915
|
"internal/domain/content/vo/fileinfo.ts"() {
|
|
20856
20916
|
"use strict";
|
|
20857
20917
|
init_paths();
|
|
20858
20918
|
crypto2 = __toESM(require("crypto"));
|
|
20859
|
-
|
|
20919
|
+
path27 = __toESM(require("path"));
|
|
20860
20920
|
init_log();
|
|
20861
20921
|
log41 = getDomainLogger("content", { component: "FileInfo" });
|
|
20862
20922
|
contentFileExtensions = [
|
|
@@ -20894,7 +20954,7 @@ var init_fileinfo2 = __esm({
|
|
|
20894
20954
|
relPath() {
|
|
20895
20955
|
const dir2 = this.pathInfo.dir();
|
|
20896
20956
|
const dirWithoutLeadingSlash = dir2.startsWith("/") ? dir2.substring(1) : dir2;
|
|
20897
|
-
return
|
|
20957
|
+
return path27.join(dirWithoutLeadingSlash, this.pathInfo.name());
|
|
20898
20958
|
}
|
|
20899
20959
|
section() {
|
|
20900
20960
|
return this.pathInfo.section();
|
|
@@ -20991,7 +21051,7 @@ var init_fileinfo2 = __esm({
|
|
|
20991
21051
|
if (s2 === "") {
|
|
20992
21052
|
return s2;
|
|
20993
21053
|
}
|
|
20994
|
-
return
|
|
21054
|
+
return path27.normalize(s2.substring(1) + "/");
|
|
20995
21055
|
}
|
|
20996
21056
|
determineBundleType() {
|
|
20997
21057
|
const isContent = isContentExt(this.pathInfo.ext());
|
|
@@ -21271,7 +21331,7 @@ function getParam(p2, key2, stringToLower) {
|
|
|
21271
21331
|
return v;
|
|
21272
21332
|
}
|
|
21273
21333
|
}
|
|
21274
|
-
var
|
|
21334
|
+
var import_path20, FrontMatterParserImpl;
|
|
21275
21335
|
var init_frontmatter = __esm({
|
|
21276
21336
|
"internal/domain/content/vo/frontmatter.ts"() {
|
|
21277
21337
|
"use strict";
|
|
@@ -21279,7 +21339,7 @@ var init_frontmatter = __esm({
|
|
|
21279
21339
|
init_cast2();
|
|
21280
21340
|
init_string2();
|
|
21281
21341
|
init_types3();
|
|
21282
|
-
|
|
21342
|
+
import_path20 = __toESM(require("path"));
|
|
21283
21343
|
FrontMatterParserImpl = class {
|
|
21284
21344
|
params;
|
|
21285
21345
|
langSvc;
|
|
@@ -21466,7 +21526,7 @@ var init_frontmatter = __esm({
|
|
|
21466
21526
|
organization.website = Cast.toString(orgValue.website);
|
|
21467
21527
|
}
|
|
21468
21528
|
if (orgValue.logo !== void 0 && orgValue.logo !== null) {
|
|
21469
|
-
organization.logo =
|
|
21529
|
+
organization.logo = import_path20.default.join(baseURL, Cast.toString(orgValue.logo));
|
|
21470
21530
|
}
|
|
21471
21531
|
const contact = this.parseContact(orgValue.contact);
|
|
21472
21532
|
if (contact) {
|
|
@@ -21584,7 +21644,7 @@ var init_frontmatter = __esm({
|
|
|
21584
21644
|
author.website = Cast.toString(authorValue.website);
|
|
21585
21645
|
}
|
|
21586
21646
|
if (authorValue.avatar !== void 0 && authorValue.avatar !== null) {
|
|
21587
|
-
author.avatar =
|
|
21647
|
+
author.avatar = import_path20.default.join(baseURL, Cast.toString(authorValue.avatar));
|
|
21588
21648
|
}
|
|
21589
21649
|
const contact = this.parseContact(authorValue.contact);
|
|
21590
21650
|
if (contact) {
|
|
@@ -21640,8 +21700,8 @@ var init_frontmatter = __esm({
|
|
|
21640
21700
|
* Convert path to slash preserving leading slash
|
|
21641
21701
|
* Equivalent to Go's paths.ToSlashPreserveLeading
|
|
21642
21702
|
*/
|
|
21643
|
-
toSlashPreserveLeading(
|
|
21644
|
-
return
|
|
21703
|
+
toSlashPreserveLeading(path43) {
|
|
21704
|
+
return path43.replace(/\\/g, "/");
|
|
21645
21705
|
}
|
|
21646
21706
|
};
|
|
21647
21707
|
}
|
|
@@ -22066,9 +22126,9 @@ var init_radix = __esm({
|
|
|
22066
22126
|
// from the root down to a given leaf. Where WalkPrefix walks
|
|
22067
22127
|
// all the entries *under* the given prefix, this walks the
|
|
22068
22128
|
// entries *above* the given prefix.
|
|
22069
|
-
async walkPath(
|
|
22129
|
+
async walkPath(path43, fn) {
|
|
22070
22130
|
let n = this.root;
|
|
22071
|
-
let search2 =
|
|
22131
|
+
let search2 = path43;
|
|
22072
22132
|
while (true) {
|
|
22073
22133
|
if (n.leaf !== null && await fn(n.leaf.key, n.leaf.val)) {
|
|
22074
22134
|
return;
|
|
@@ -23203,8 +23263,8 @@ var init_pagesource = __esm({
|
|
|
23203
23263
|
* 3. Handle index files (index → parent folder)
|
|
23204
23264
|
* 4. Handle _index files (Hugo-style section index)
|
|
23205
23265
|
*/
|
|
23206
|
-
pathToSlug(
|
|
23207
|
-
let slug2 =
|
|
23266
|
+
pathToSlug(path43) {
|
|
23267
|
+
let slug2 = path43.replace(/^\//, "");
|
|
23208
23268
|
slug2 = slug2.replace(/\.md$/, "");
|
|
23209
23269
|
if (slug2.endsWith("/index")) {
|
|
23210
23270
|
slug2 = slug2.replace(/\/index$/, "");
|
|
@@ -23251,17 +23311,17 @@ var init_pagesource = __esm({
|
|
|
23251
23311
|
});
|
|
23252
23312
|
|
|
23253
23313
|
// internal/domain/content/entity/pagemap.ts
|
|
23254
|
-
function addTrailingSlash(
|
|
23255
|
-
if (!
|
|
23256
|
-
|
|
23314
|
+
function addTrailingSlash(path43) {
|
|
23315
|
+
if (!path43.endsWith("/")) {
|
|
23316
|
+
path43 += "/";
|
|
23257
23317
|
}
|
|
23258
|
-
return
|
|
23318
|
+
return path43;
|
|
23259
23319
|
}
|
|
23260
|
-
function addLeadingSlash(
|
|
23261
|
-
if (!
|
|
23262
|
-
|
|
23320
|
+
function addLeadingSlash(path43) {
|
|
23321
|
+
if (!path43.startsWith("/")) {
|
|
23322
|
+
path43 = "/" + path43;
|
|
23263
23323
|
}
|
|
23264
|
-
return
|
|
23324
|
+
return path43;
|
|
23265
23325
|
}
|
|
23266
23326
|
var log43, ambiguousContentNode, ContentTreeReverseIndexMap, ContentTreeReverseIndex, pagePredicates, PageMapQueryPagesBelowPathImpl, PageMapQueryPagesInSectionImpl, PageMap;
|
|
23267
23327
|
var init_pagemap = __esm({
|
|
@@ -23314,8 +23374,8 @@ var init_pagemap = __esm({
|
|
|
23314
23374
|
path;
|
|
23315
23375
|
keyPart;
|
|
23316
23376
|
include;
|
|
23317
|
-
constructor(
|
|
23318
|
-
this.path =
|
|
23377
|
+
constructor(path43, keyPart, include = pagePredicates.shouldListLocal) {
|
|
23378
|
+
this.path = path43;
|
|
23319
23379
|
this.keyPart = keyPart;
|
|
23320
23380
|
this.include = include;
|
|
23321
23381
|
}
|
|
@@ -23327,8 +23387,8 @@ var init_pagemap = __esm({
|
|
|
23327
23387
|
recursive;
|
|
23328
23388
|
includeSelf;
|
|
23329
23389
|
index;
|
|
23330
|
-
constructor(
|
|
23331
|
-
super(
|
|
23390
|
+
constructor(path43, keyPart, recursive, includeSelf, index2, include) {
|
|
23391
|
+
super(path43, keyPart, include);
|
|
23332
23392
|
this.recursive = recursive;
|
|
23333
23393
|
this.includeSelf = includeSelf;
|
|
23334
23394
|
this.index = index2;
|
|
@@ -23696,12 +23756,12 @@ var init_pagemap = __esm({
|
|
|
23696
23756
|
/**
|
|
23697
23757
|
* Helper method to get directory from path
|
|
23698
23758
|
*/
|
|
23699
|
-
pathDir(
|
|
23700
|
-
const lastSlash =
|
|
23759
|
+
pathDir(path43) {
|
|
23760
|
+
const lastSlash = path43.lastIndexOf("/");
|
|
23701
23761
|
if (lastSlash === -1) {
|
|
23702
23762
|
return "";
|
|
23703
23763
|
}
|
|
23704
|
-
return
|
|
23764
|
+
return path43.substring(0, lastSlash);
|
|
23705
23765
|
}
|
|
23706
23766
|
};
|
|
23707
23767
|
}
|
|
@@ -23740,11 +23800,11 @@ var init_pagecollector = __esm({
|
|
|
23740
23800
|
/**
|
|
23741
23801
|
* CollectDir - exact replica of Go's collectDir method
|
|
23742
23802
|
*/
|
|
23743
|
-
async collectDir(fs13,
|
|
23803
|
+
async collectDir(fs13, path43, root2) {
|
|
23744
23804
|
try {
|
|
23745
|
-
await this.fs.walkContent(fs13,
|
|
23746
|
-
hookPre: async (dir2,
|
|
23747
|
-
const fullPath =
|
|
23805
|
+
await this.fs.walkContent(fs13, path43, {
|
|
23806
|
+
hookPre: async (dir2, path44, readdir2) => {
|
|
23807
|
+
const fullPath = path44;
|
|
23748
23808
|
if (this.processedPaths.has(fullPath)) {
|
|
23749
23809
|
log44.warn("Path already processed!", {
|
|
23750
23810
|
path: fullPath,
|
|
@@ -23775,7 +23835,7 @@ var init_pagecollector = __esm({
|
|
|
23775
23835
|
});
|
|
23776
23836
|
} catch (error) {
|
|
23777
23837
|
log44.error(`Failed to collect directory: ${error}`, {
|
|
23778
|
-
path:
|
|
23838
|
+
path: path43,
|
|
23779
23839
|
rootName: root2.name(),
|
|
23780
23840
|
rootIsDir: root2.isDir(),
|
|
23781
23841
|
stack: error.stack || "No stack trace available"
|
|
@@ -23785,7 +23845,7 @@ var init_pagecollector = __esm({
|
|
|
23785
23845
|
}
|
|
23786
23846
|
async handleBundleLeaf(dir2, bundle, inPath, readdir2) {
|
|
23787
23847
|
const bundlePath = bundle.paths();
|
|
23788
|
-
const walk = async (
|
|
23848
|
+
const walk = async (path43, info) => {
|
|
23789
23849
|
if (info.isDir()) {
|
|
23790
23850
|
return;
|
|
23791
23851
|
}
|
|
@@ -24037,10 +24097,10 @@ var init_content2 = __esm({
|
|
|
24037
24097
|
* GetPageFromPath - TypeScript equivalent of Go's PageFinder.GetPageFromPath
|
|
24038
24098
|
* This is the core content domain business logic for finding pages by path
|
|
24039
24099
|
*/
|
|
24040
|
-
getPageFromPath(langIndex,
|
|
24100
|
+
getPageFromPath(langIndex, path43) {
|
|
24041
24101
|
try {
|
|
24042
24102
|
const pathProcessor = PathDomain.createProcessor();
|
|
24043
|
-
const ps = pathProcessor.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT,
|
|
24103
|
+
const ps = pathProcessor.parse(PATH_CONSTANTS.COMPONENT_FOLDER_CONTENT, path43);
|
|
24044
24104
|
const tree = this.pageMap.treePages.shape(0, langIndex);
|
|
24045
24105
|
let node = tree.get(ps.base());
|
|
24046
24106
|
if (node) {
|
|
@@ -24051,7 +24111,7 @@ var init_content2 = __esm({
|
|
|
24051
24111
|
}
|
|
24052
24112
|
return null;
|
|
24053
24113
|
} catch (error) {
|
|
24054
|
-
log45.error(`\u274C Content.getPageFromPath error for path "${
|
|
24114
|
+
log45.error(`\u274C Content.getPageFromPath error for path "${path43}":`, error);
|
|
24055
24115
|
return null;
|
|
24056
24116
|
}
|
|
24057
24117
|
}
|
|
@@ -24858,15 +24918,15 @@ var init_scratch = __esm({
|
|
|
24858
24918
|
function sanitize(input) {
|
|
24859
24919
|
return input.replace(/[\s\t\n\r]+/g, "-").replace(/[^\w\-_]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
24860
24920
|
}
|
|
24861
|
-
function addContextRoot(root2,
|
|
24862
|
-
if (!root2 ||
|
|
24863
|
-
return
|
|
24921
|
+
function addContextRoot(root2, path43) {
|
|
24922
|
+
if (!root2 || path43.startsWith(root2)) {
|
|
24923
|
+
return path43;
|
|
24864
24924
|
}
|
|
24865
|
-
return joinPaths(root2,
|
|
24925
|
+
return joinPaths(root2, path43);
|
|
24866
24926
|
}
|
|
24867
|
-
function makePermalink(baseURL,
|
|
24927
|
+
function makePermalink(baseURL, path43) {
|
|
24868
24928
|
const base2 = baseURL.replace(/\/$/, "");
|
|
24869
|
-
const cleanPath =
|
|
24929
|
+
const cleanPath = path43.replace(/^\//, "");
|
|
24870
24930
|
const fullURL = `${base2}/${cleanPath}`;
|
|
24871
24931
|
try {
|
|
24872
24932
|
return new URL(fullURL);
|
|
@@ -24895,7 +24955,7 @@ var init_paths2 = __esm({
|
|
|
24895
24955
|
});
|
|
24896
24956
|
|
|
24897
24957
|
// internal/domain/content/entity/page.ts
|
|
24898
|
-
var
|
|
24958
|
+
var import_path21, log48, PageImpl, TaxonomyPageImpl, TermPageImpl;
|
|
24899
24959
|
var init_page = __esm({
|
|
24900
24960
|
"internal/domain/content/entity/page.ts"() {
|
|
24901
24961
|
"use strict";
|
|
@@ -24907,7 +24967,7 @@ var init_page = __esm({
|
|
|
24907
24967
|
init_paths2();
|
|
24908
24968
|
init_doctree();
|
|
24909
24969
|
init_sort();
|
|
24910
|
-
|
|
24970
|
+
import_path21 = __toESM(require("path"));
|
|
24911
24971
|
init_log();
|
|
24912
24972
|
log48 = getDomainLogger("content", { component: "page" });
|
|
24913
24973
|
PageImpl = class {
|
|
@@ -24985,8 +25045,8 @@ var init_page = __esm({
|
|
|
24985
25045
|
* 3. Handle index files (index → parent folder)
|
|
24986
25046
|
* 4. Handle _index files (Hugo-style section index)
|
|
24987
25047
|
*/
|
|
24988
|
-
pathToSlug(
|
|
24989
|
-
let slug2 =
|
|
25048
|
+
pathToSlug(path43) {
|
|
25049
|
+
let slug2 = path43.replace(/^\//, "");
|
|
24990
25050
|
slug2 = slug2.replace(/\.md$/, "");
|
|
24991
25051
|
if (slug2.endsWith("/index")) {
|
|
24992
25052
|
slug2 = slug2.replace(/\/index$/, "");
|
|
@@ -25013,7 +25073,7 @@ var init_page = __esm({
|
|
|
25013
25073
|
if (/^(https?:)?\/\//.test(src)) {
|
|
25014
25074
|
return src;
|
|
25015
25075
|
}
|
|
25016
|
-
src =
|
|
25076
|
+
src = import_path21.default.normalize(src);
|
|
25017
25077
|
src = src.replace(/\\/g, "/");
|
|
25018
25078
|
if (src.startsWith("/")) {
|
|
25019
25079
|
src = src.slice(1);
|
|
@@ -25733,12 +25793,12 @@ var init_type11 = __esm({
|
|
|
25733
25793
|
function newBaseOf() {
|
|
25734
25794
|
return new BaseOf();
|
|
25735
25795
|
}
|
|
25736
|
-
var
|
|
25796
|
+
var path30, BaseOf;
|
|
25737
25797
|
var init_baseof = __esm({
|
|
25738
25798
|
"internal/domain/template/vo/baseof.ts"() {
|
|
25739
25799
|
"use strict";
|
|
25740
25800
|
init_type11();
|
|
25741
|
-
|
|
25801
|
+
path30 = __toESM(require("path"));
|
|
25742
25802
|
BaseOf = class {
|
|
25743
25803
|
baseof = /* @__PURE__ */ new Map();
|
|
25744
25804
|
needsBaseof = /* @__PURE__ */ new Map();
|
|
@@ -25778,7 +25838,7 @@ var init_baseof = __esm({
|
|
|
25778
25838
|
* Check if path is a base template path
|
|
25779
25839
|
*/
|
|
25780
25840
|
isBaseTemplatePath(filePath) {
|
|
25781
|
-
return
|
|
25841
|
+
return path30.basename(filePath).includes(BASE_FILE_BASE);
|
|
25782
25842
|
}
|
|
25783
25843
|
/**
|
|
25784
25844
|
* Check if template needs base template
|
|
@@ -27533,8 +27593,8 @@ var init_registry = __esm({
|
|
|
27533
27593
|
}
|
|
27534
27594
|
},
|
|
27535
27595
|
// PathEscape escapes special characters in a URL path
|
|
27536
|
-
PathEscape: (
|
|
27537
|
-
return encodeURIComponent(
|
|
27596
|
+
PathEscape: (path43) => {
|
|
27597
|
+
return encodeURIComponent(path43).replace(/%2F/g, "/").replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
27538
27598
|
},
|
|
27539
27599
|
// QueryEscape escapes special characters in a URL query
|
|
27540
27600
|
QueryEscape: (query) => {
|
|
@@ -28690,11 +28750,11 @@ var init_registry = __esm({
|
|
|
28690
28750
|
}
|
|
28691
28751
|
}
|
|
28692
28752
|
}
|
|
28693
|
-
const getNestedValue = (obj,
|
|
28694
|
-
if (!
|
|
28753
|
+
const getNestedValue = (obj, path43) => {
|
|
28754
|
+
if (!path43 || path43 === "value") {
|
|
28695
28755
|
return obj;
|
|
28696
28756
|
}
|
|
28697
|
-
const keys =
|
|
28757
|
+
const keys = path43.split(".");
|
|
28698
28758
|
let current = obj;
|
|
28699
28759
|
for (const key2 of keys) {
|
|
28700
28760
|
if (current === null || current === void 0) {
|
|
@@ -29259,23 +29319,23 @@ var init_registry = __esm({
|
|
|
29259
29319
|
registerPathFunctions(funcMap) {
|
|
29260
29320
|
funcMap.set("path", () => ({
|
|
29261
29321
|
// Base returns the last element of path
|
|
29262
|
-
Base: (
|
|
29263
|
-
if (!
|
|
29322
|
+
Base: (path43) => {
|
|
29323
|
+
if (!path43)
|
|
29264
29324
|
return ".";
|
|
29265
|
-
|
|
29266
|
-
|
|
29267
|
-
if (!
|
|
29325
|
+
path43 = path43.replace(/\\/g, "/");
|
|
29326
|
+
path43 = path43.replace(/\/+$/, "");
|
|
29327
|
+
if (!path43)
|
|
29268
29328
|
return "/";
|
|
29269
|
-
const parts =
|
|
29329
|
+
const parts = path43.split("/");
|
|
29270
29330
|
return parts[parts.length - 1] || "/";
|
|
29271
29331
|
},
|
|
29272
29332
|
// Clean returns the shortest path name equivalent to path
|
|
29273
|
-
Clean: (
|
|
29274
|
-
if (!
|
|
29333
|
+
Clean: (path43) => {
|
|
29334
|
+
if (!path43)
|
|
29275
29335
|
return ".";
|
|
29276
|
-
|
|
29277
|
-
const isAbs =
|
|
29278
|
-
const parts =
|
|
29336
|
+
path43 = path43.replace(/\\/g, "/");
|
|
29337
|
+
const isAbs = path43.startsWith("/");
|
|
29338
|
+
const parts = path43.split("/").filter((p2) => p2 && p2 !== ".");
|
|
29279
29339
|
const stack = [];
|
|
29280
29340
|
for (const part of parts) {
|
|
29281
29341
|
if (part === "..") {
|
|
@@ -29288,56 +29348,56 @@ var init_registry = __esm({
|
|
|
29288
29348
|
stack.push(part);
|
|
29289
29349
|
}
|
|
29290
29350
|
}
|
|
29291
|
-
|
|
29351
|
+
path43 = stack.join("/");
|
|
29292
29352
|
if (isAbs)
|
|
29293
|
-
|
|
29294
|
-
return
|
|
29353
|
+
path43 = "/" + path43;
|
|
29354
|
+
return path43 || (isAbs ? "/" : ".");
|
|
29295
29355
|
},
|
|
29296
29356
|
// Dir returns all but the last element of path
|
|
29297
|
-
Dir: (
|
|
29298
|
-
if (!
|
|
29357
|
+
Dir: (path43) => {
|
|
29358
|
+
if (!path43)
|
|
29299
29359
|
return ".";
|
|
29300
|
-
|
|
29301
|
-
if (!
|
|
29360
|
+
path43 = path43.replace(/\/+$/, "");
|
|
29361
|
+
if (!path43)
|
|
29302
29362
|
return "/";
|
|
29303
|
-
const parts =
|
|
29363
|
+
const parts = path43.split("/");
|
|
29304
29364
|
parts.pop();
|
|
29305
29365
|
return parts.join("/") || ".";
|
|
29306
29366
|
},
|
|
29307
29367
|
// Ext returns the file name extension
|
|
29308
|
-
Ext: (
|
|
29309
|
-
const base2 =
|
|
29368
|
+
Ext: (path43) => {
|
|
29369
|
+
const base2 = path43.split("/").pop() || "";
|
|
29310
29370
|
const dot = base2.lastIndexOf(".");
|
|
29311
29371
|
if (dot === -1 || dot === 0)
|
|
29312
29372
|
return "";
|
|
29313
29373
|
return base2.substring(dot);
|
|
29314
29374
|
},
|
|
29315
29375
|
// IsAbs reports whether the path is absolute
|
|
29316
|
-
IsAbs: (
|
|
29317
|
-
return
|
|
29376
|
+
IsAbs: (path43) => {
|
|
29377
|
+
return path43.startsWith("/");
|
|
29318
29378
|
},
|
|
29319
29379
|
// Join joins any number of path elements into a single path
|
|
29320
29380
|
Join: (...elements) => {
|
|
29321
29381
|
if (elements.length === 0)
|
|
29322
29382
|
return ".";
|
|
29323
29383
|
const parts = elements.filter((e) => e).map((e) => e.replace(/^\/+|\/+$/g, ""));
|
|
29324
|
-
let
|
|
29384
|
+
let path43 = parts.join("/");
|
|
29325
29385
|
if (elements[0] && elements[0].startsWith("/")) {
|
|
29326
|
-
|
|
29386
|
+
path43 = "/" + path43;
|
|
29327
29387
|
}
|
|
29328
|
-
return
|
|
29388
|
+
return path43 || ".";
|
|
29329
29389
|
},
|
|
29330
29390
|
// Split splits path immediately following the final slash
|
|
29331
|
-
Split: (
|
|
29332
|
-
if (!
|
|
29391
|
+
Split: (path43) => {
|
|
29392
|
+
if (!path43)
|
|
29333
29393
|
return [".", ""];
|
|
29334
|
-
const lastSlash =
|
|
29394
|
+
const lastSlash = path43.lastIndexOf("/");
|
|
29335
29395
|
if (lastSlash === -1) {
|
|
29336
|
-
return ["",
|
|
29396
|
+
return ["", path43];
|
|
29337
29397
|
}
|
|
29338
29398
|
return [
|
|
29339
|
-
|
|
29340
|
-
|
|
29399
|
+
path43.substring(0, lastSlash),
|
|
29400
|
+
path43.substring(lastSlash + 1)
|
|
29341
29401
|
];
|
|
29342
29402
|
}
|
|
29343
29403
|
}));
|
|
@@ -29623,11 +29683,11 @@ var init_registry = __esm({
|
|
|
29623
29683
|
* Get nested value from object using dot notation path
|
|
29624
29684
|
* Following golang's path resolution logic
|
|
29625
29685
|
*/
|
|
29626
|
-
getNestedValue(obj,
|
|
29627
|
-
if (!obj || !
|
|
29686
|
+
getNestedValue(obj, path43) {
|
|
29687
|
+
if (!obj || !path43) {
|
|
29628
29688
|
return void 0;
|
|
29629
29689
|
}
|
|
29630
|
-
const cleanPath =
|
|
29690
|
+
const cleanPath = path43.replace(/^\\.+/, "");
|
|
29631
29691
|
const parts = cleanPath.split(".");
|
|
29632
29692
|
let current = obj;
|
|
29633
29693
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -30162,14 +30222,14 @@ var init_pagebuilder = __esm({
|
|
|
30162
30222
|
* Parse kind - exact replica of Go's parseKind method
|
|
30163
30223
|
*/
|
|
30164
30224
|
async parseKind() {
|
|
30165
|
-
const
|
|
30225
|
+
const path43 = this.source.file.paths();
|
|
30166
30226
|
let kind = "";
|
|
30167
30227
|
if (this.fm) {
|
|
30168
30228
|
kind = this.fm.kind || "";
|
|
30169
30229
|
}
|
|
30170
30230
|
if (kind === "") {
|
|
30171
30231
|
kind = getKindMain("page");
|
|
30172
|
-
const base2 =
|
|
30232
|
+
const base2 = path43.baseNoLeadingSlash();
|
|
30173
30233
|
switch (base2) {
|
|
30174
30234
|
case PAGE_HOME_BASE:
|
|
30175
30235
|
case "":
|
|
@@ -30184,9 +30244,9 @@ var init_pagebuilder = __esm({
|
|
|
30184
30244
|
default:
|
|
30185
30245
|
if (this.source.file.isBranchBundle()) {
|
|
30186
30246
|
kind = getKindMain("section");
|
|
30187
|
-
const v = this.taxonomy.getTaxonomy(
|
|
30247
|
+
const v = this.taxonomy.getTaxonomy(path43.path());
|
|
30188
30248
|
if (!this.taxonomy.isZero(v)) {
|
|
30189
|
-
if (this.taxonomy.isTaxonomyPath(
|
|
30249
|
+
if (this.taxonomy.isTaxonomyPath(path43.path())) {
|
|
30190
30250
|
kind = getKindMain("taxonomy");
|
|
30191
30251
|
} else {
|
|
30192
30252
|
kind = getKindMain("term");
|
|
@@ -30473,7 +30533,7 @@ function cleanTreeKey2(...elem) {
|
|
|
30473
30533
|
if (elem.length > 0) {
|
|
30474
30534
|
s2 = elem[0];
|
|
30475
30535
|
if (elem.length > 1) {
|
|
30476
|
-
s2 =
|
|
30536
|
+
s2 = path31.join(...elem);
|
|
30477
30537
|
}
|
|
30478
30538
|
}
|
|
30479
30539
|
s2 = s2.replace(/^[\.\/ \s]+|[\.\/ \s]+$/g, "");
|
|
@@ -30486,14 +30546,14 @@ function cleanTreeKey2(...elem) {
|
|
|
30486
30546
|
}
|
|
30487
30547
|
return s2;
|
|
30488
30548
|
}
|
|
30489
|
-
var
|
|
30549
|
+
var path31, filepath, Taxonomy2;
|
|
30490
30550
|
var init_taxonomy3 = __esm({
|
|
30491
30551
|
"internal/domain/content/entity/taxonomy.ts"() {
|
|
30492
30552
|
"use strict";
|
|
30493
30553
|
init_pagetrees();
|
|
30494
30554
|
init_fileinfo2();
|
|
30495
30555
|
init_pagesource();
|
|
30496
|
-
|
|
30556
|
+
path31 = __toESM(require("path"));
|
|
30497
30557
|
filepath = __toESM(require("path"));
|
|
30498
30558
|
Taxonomy2 = class {
|
|
30499
30559
|
views;
|
|
@@ -30524,7 +30584,7 @@ var init_taxonomy3 = __esm({
|
|
|
30524
30584
|
if (!ta) {
|
|
30525
30585
|
return false;
|
|
30526
30586
|
}
|
|
30527
|
-
return p2 ===
|
|
30587
|
+
return p2 === path31.join(this.pluralTreeKey(ta.plural()), "_index.md");
|
|
30528
30588
|
}
|
|
30529
30589
|
/**
|
|
30530
30590
|
* PluralTreeKey - exact replica of Go's PluralTreeKey method
|
|
@@ -30829,11 +30889,11 @@ var init_pager = __esm({
|
|
|
30829
30889
|
});
|
|
30830
30890
|
|
|
30831
30891
|
// internal/domain/site/entity/page.ts
|
|
30832
|
-
var
|
|
30892
|
+
var import_path22, log57, Page2;
|
|
30833
30893
|
var init_page2 = __esm({
|
|
30834
30894
|
"internal/domain/site/entity/page.ts"() {
|
|
30835
30895
|
"use strict";
|
|
30836
|
-
|
|
30896
|
+
import_path22 = __toESM(require("path"));
|
|
30837
30897
|
init_log();
|
|
30838
30898
|
init_pager();
|
|
30839
30899
|
log57 = getDomainLogger("site", { component: "page" });
|
|
@@ -30953,14 +31013,14 @@ var init_page2 = __esm({
|
|
|
30953
31013
|
} else {
|
|
30954
31014
|
prefix = this.site.getLanguage().getCurrentLanguage();
|
|
30955
31015
|
}
|
|
30956
|
-
targetFilenames.push(
|
|
31016
|
+
targetFilenames.push(import_path22.default.join(prefix, this.getPageOutput().targetFilePath()));
|
|
30957
31017
|
await this.renderAndWritePage(tmpl, targetFilenames);
|
|
30958
31018
|
const current = await this.current();
|
|
30959
31019
|
if (current) {
|
|
30960
31020
|
let currentPager = current.next();
|
|
30961
31021
|
while (currentPager) {
|
|
30962
31022
|
this.setCurrent(currentPager);
|
|
30963
|
-
const paginationTargets = [
|
|
31023
|
+
const paginationTargets = [import_path22.default.join(prefix, currentPager.url(), this.getPageOutput().targetFileBase())];
|
|
30964
31024
|
await this.renderAndWritePage(tmpl, paginationTargets);
|
|
30965
31025
|
currentPager = currentPager.next();
|
|
30966
31026
|
}
|
|
@@ -30993,7 +31053,7 @@ var init_page2 = __esm({
|
|
|
30993
31053
|
prefix = this.site.getLanguage().getCurrentLanguage();
|
|
30994
31054
|
}
|
|
30995
31055
|
let resourcePath = pageSource.path();
|
|
30996
|
-
targetFilenames.push(
|
|
31056
|
+
targetFilenames.push(import_path22.default.join(prefix, resourcePath));
|
|
30997
31057
|
let stream = null;
|
|
30998
31058
|
try {
|
|
30999
31059
|
const opener = () => pageSource.pageFile().open();
|
|
@@ -31648,11 +31708,11 @@ var init_baseurl = __esm({
|
|
|
31648
31708
|
/**
|
|
31649
31709
|
* Returns the appropriate root URL based on the path.
|
|
31650
31710
|
*/
|
|
31651
|
-
getRoot(
|
|
31711
|
+
getRoot(path43) {
|
|
31652
31712
|
if (this.isRelative) {
|
|
31653
31713
|
return this.basePath;
|
|
31654
31714
|
}
|
|
31655
|
-
if (
|
|
31715
|
+
if (path43.startsWith("/")) {
|
|
31656
31716
|
return this.withoutPath;
|
|
31657
31717
|
}
|
|
31658
31718
|
return this.withPath;
|
|
@@ -33046,8 +33106,8 @@ function assertNonEmpty(part, name) {
|
|
|
33046
33106
|
throw new Error("`" + name + "` cannot be empty");
|
|
33047
33107
|
}
|
|
33048
33108
|
}
|
|
33049
|
-
function assertPath(
|
|
33050
|
-
if (!
|
|
33109
|
+
function assertPath(path43, name) {
|
|
33110
|
+
if (!path43) {
|
|
33051
33111
|
throw new Error("Setting `" + name + "` requires `path` to be set too");
|
|
33052
33112
|
}
|
|
33053
33113
|
}
|
|
@@ -33232,13 +33292,13 @@ var init_lib4 = __esm({
|
|
|
33232
33292
|
* @returns {undefined}
|
|
33233
33293
|
* Nothing.
|
|
33234
33294
|
*/
|
|
33235
|
-
set path(
|
|
33236
|
-
if (isUrl(
|
|
33237
|
-
|
|
33295
|
+
set path(path43) {
|
|
33296
|
+
if (isUrl(path43)) {
|
|
33297
|
+
path43 = (0, import_node_url.fileURLToPath)(path43);
|
|
33238
33298
|
}
|
|
33239
|
-
assertNonEmpty(
|
|
33240
|
-
if (this.path !==
|
|
33241
|
-
this.history.push(
|
|
33299
|
+
assertNonEmpty(path43, "path");
|
|
33300
|
+
if (this.path !== path43) {
|
|
33301
|
+
this.history.push(path43);
|
|
33242
33302
|
}
|
|
33243
33303
|
}
|
|
33244
33304
|
/**
|
|
@@ -45999,7 +46059,7 @@ var init_is_absolute_url = __esm({
|
|
|
45999
46059
|
function createHtmlLinkProcessor(graph, options) {
|
|
46000
46060
|
return new HtmlLinkProcessor(graph, options);
|
|
46001
46061
|
}
|
|
46002
|
-
var
|
|
46062
|
+
var import_path24, log61, defaultOptions, HtmlLinkProcessor;
|
|
46003
46063
|
var init_html_link_processor = __esm({
|
|
46004
46064
|
"internal/domain/site/service/html-link-processor.ts"() {
|
|
46005
46065
|
"use strict";
|
|
@@ -46008,7 +46068,7 @@ var init_html_link_processor = __esm({
|
|
|
46008
46068
|
init_rehype_stringify();
|
|
46009
46069
|
init_unist_util_visit();
|
|
46010
46070
|
init_is_absolute_url();
|
|
46011
|
-
|
|
46071
|
+
import_path24 = __toESM(require("path"));
|
|
46012
46072
|
init_path3();
|
|
46013
46073
|
init_log();
|
|
46014
46074
|
log61 = getDomainLogger("site", { component: "HtmlLinkProcessor" });
|
|
@@ -46146,7 +46206,7 @@ var init_html_link_processor = __esm({
|
|
|
46146
46206
|
node.properties["data-slug"] = full;
|
|
46147
46207
|
}
|
|
46148
46208
|
if (opts.prettyLinks && isInternal && node.children.length === 1 && node.children[0].type === "text" && !node.children[0].value.startsWith("#")) {
|
|
46149
|
-
node.children[0].value =
|
|
46209
|
+
node.children[0].value = import_path24.default.basename(node.children[0].value);
|
|
46150
46210
|
}
|
|
46151
46211
|
}
|
|
46152
46212
|
if (["img", "video", "audio", "iframe"].includes(node.tagName) && node.properties && typeof node.properties.src === "string") {
|
|
@@ -47040,14 +47100,14 @@ var init_site = __esm({
|
|
|
47040
47100
|
|
|
47041
47101
|
// internal/domain/site/entity/publisher.ts
|
|
47042
47102
|
async function openFileForWriting(fs13, filename) {
|
|
47043
|
-
const cleanFilename =
|
|
47103
|
+
const cleanFilename = import_path26.default.normalize(filename);
|
|
47044
47104
|
try {
|
|
47045
47105
|
return await fs13.create(cleanFilename);
|
|
47046
47106
|
} catch (error) {
|
|
47047
47107
|
if (!isFileNotFoundError(error)) {
|
|
47048
47108
|
throw error;
|
|
47049
47109
|
}
|
|
47050
|
-
const dir2 =
|
|
47110
|
+
const dir2 = import_path26.default.dirname(cleanFilename);
|
|
47051
47111
|
await fs13.mkdirAll(dir2, 511);
|
|
47052
47112
|
return await fs13.create(cleanFilename);
|
|
47053
47113
|
}
|
|
@@ -47055,11 +47115,11 @@ async function openFileForWriting(fs13, filename) {
|
|
|
47055
47115
|
function isFileNotFoundError(error) {
|
|
47056
47116
|
return error && (error.code === "ENOENT" || error.code === "FILE_NOT_FOUND" || error.message?.includes("not found") || error.message?.includes("no such file"));
|
|
47057
47117
|
}
|
|
47058
|
-
var
|
|
47118
|
+
var import_path26, log64, Publisher, MultiWriter;
|
|
47059
47119
|
var init_publisher2 = __esm({
|
|
47060
47120
|
"internal/domain/site/entity/publisher.ts"() {
|
|
47061
47121
|
"use strict";
|
|
47062
|
-
|
|
47122
|
+
import_path26 = __toESM(require("path"));
|
|
47063
47123
|
init_log();
|
|
47064
47124
|
log64 = getDomainLogger("site", { component: "publisher" });
|
|
47065
47125
|
Publisher = class {
|
|
@@ -47920,8 +47980,8 @@ var init_menu_builder = __esm({
|
|
|
47920
47980
|
/**
|
|
47921
47981
|
* Fallback URL generation from path (used when site page conversion fails)
|
|
47922
47982
|
*/
|
|
47923
|
-
fallbackUrlFromPath(
|
|
47924
|
-
let url =
|
|
47983
|
+
fallbackUrlFromPath(path43) {
|
|
47984
|
+
let url = path43.replace(/\.md$/, "");
|
|
47925
47985
|
if (!url.startsWith("/")) {
|
|
47926
47986
|
url = "/" + url;
|
|
47927
47987
|
}
|
|
@@ -48844,11 +48904,11 @@ var init_template4 = __esm({
|
|
|
48844
48904
|
});
|
|
48845
48905
|
|
|
48846
48906
|
// internal/domain/resources/entity/publisher.ts
|
|
48847
|
-
var
|
|
48907
|
+
var path35, import_stream2, log73, Publisher2, FileWritable;
|
|
48848
48908
|
var init_publisher3 = __esm({
|
|
48849
48909
|
"internal/domain/resources/entity/publisher.ts"() {
|
|
48850
48910
|
"use strict";
|
|
48851
|
-
|
|
48911
|
+
path35 = __toESM(require("path"));
|
|
48852
48912
|
init_log();
|
|
48853
48913
|
import_stream2 = require("stream");
|
|
48854
48914
|
log73 = getDomainLogger("resources", { component: "publisher" });
|
|
@@ -48883,7 +48943,7 @@ var init_publisher3 = __esm({
|
|
|
48883
48943
|
return new FileWritable(file);
|
|
48884
48944
|
} catch (error) {
|
|
48885
48945
|
if (error.code === "ENOENT" || error.message.includes("ENOENT")) {
|
|
48886
|
-
const dir2 =
|
|
48946
|
+
const dir2 = path35.dirname(cleanFilename);
|
|
48887
48947
|
await this.pubFs.mkdirAll(dir2, 511);
|
|
48888
48948
|
const file = await this.pubFs.create(cleanFilename);
|
|
48889
48949
|
const originalClose = file.close.bind(file);
|
|
@@ -48917,14 +48977,14 @@ var init_publisher3 = __esm({
|
|
|
48917
48977
|
* TypeScript equivalent of OpenFileForWriting function from Go
|
|
48918
48978
|
*/
|
|
48919
48979
|
async openFileForWriting(filename) {
|
|
48920
|
-
const cleanFilename =
|
|
48980
|
+
const cleanFilename = path35.normalize(filename);
|
|
48921
48981
|
try {
|
|
48922
48982
|
return await this.pubFs.create(cleanFilename);
|
|
48923
48983
|
} catch (error) {
|
|
48924
48984
|
if (!this.isFileNotFoundError(error)) {
|
|
48925
48985
|
throw error;
|
|
48926
48986
|
}
|
|
48927
|
-
const dir2 =
|
|
48987
|
+
const dir2 = path35.dirname(cleanFilename);
|
|
48928
48988
|
await this.pubFs.mkdirAll(dir2, 511);
|
|
48929
48989
|
return await this.pubFs.create(cleanFilename);
|
|
48930
48990
|
}
|
|
@@ -49052,7 +49112,7 @@ var init_http2 = __esm({
|
|
|
49052
49112
|
});
|
|
49053
49113
|
|
|
49054
49114
|
// internal/domain/resources/entity/resources.ts
|
|
49055
|
-
var
|
|
49115
|
+
var path36, import_crypto4, log75, Resources;
|
|
49056
49116
|
var init_resources = __esm({
|
|
49057
49117
|
"internal/domain/resources/entity/resources.ts"() {
|
|
49058
49118
|
"use strict";
|
|
@@ -49064,7 +49124,7 @@ var init_resources = __esm({
|
|
|
49064
49124
|
init_publisher3();
|
|
49065
49125
|
init_http2();
|
|
49066
49126
|
init_type9();
|
|
49067
|
-
|
|
49127
|
+
path36 = __toESM(require("path"));
|
|
49068
49128
|
import_crypto4 = require("crypto");
|
|
49069
49129
|
init_log();
|
|
49070
49130
|
log75 = getDomainLogger("resources", { component: "resources" });
|
|
@@ -49099,7 +49159,7 @@ var init_resources = __esm({
|
|
|
49099
49159
|
* Supports caching for performance optimization
|
|
49100
49160
|
*/
|
|
49101
49161
|
async getResource(pathname) {
|
|
49102
|
-
const cleanPath =
|
|
49162
|
+
const cleanPath = path36.posix.normalize(pathname);
|
|
49103
49163
|
const cacheKey = `${cleanPath}__get`;
|
|
49104
49164
|
if (this.cache.has(cacheKey)) {
|
|
49105
49165
|
return this.cache.get(cacheKey) || null;
|
|
@@ -49128,7 +49188,7 @@ var init_resources = __esm({
|
|
|
49128
49188
|
* GetResourceWithOpener - Alternative way to get resource with custom opener
|
|
49129
49189
|
*/
|
|
49130
49190
|
async getResourceWithOpener(pathname, opener) {
|
|
49131
|
-
const cleanPath =
|
|
49191
|
+
const cleanPath = path36.posix.normalize(pathname);
|
|
49132
49192
|
const cacheKey = `${cleanPath}__get_with_opener`;
|
|
49133
49193
|
if (this.cache.has(cacheKey)) {
|
|
49134
49194
|
return this.cache.get(cacheKey) || null;
|
|
@@ -49266,7 +49326,7 @@ var init_resources = __esm({
|
|
|
49266
49326
|
*/
|
|
49267
49327
|
async buildResource(pathname, opener) {
|
|
49268
49328
|
try {
|
|
49269
|
-
const ext =
|
|
49329
|
+
const ext = path36.extname(pathname);
|
|
49270
49330
|
const mediaType = this.getMediaTypeFromExtension(ext);
|
|
49271
49331
|
const resourcePaths = ResourcePaths.newResourcePaths(pathname, this.workspace);
|
|
49272
49332
|
const resource = new ResourceImpl(
|
|
@@ -49368,11 +49428,11 @@ var init_resources = __esm({
|
|
|
49368
49428
|
});
|
|
49369
49429
|
|
|
49370
49430
|
// internal/domain/resources/valueobject/resourcepaths.ts
|
|
49371
|
-
var
|
|
49431
|
+
var path37, ResourcePaths;
|
|
49372
49432
|
var init_resourcepaths = __esm({
|
|
49373
49433
|
"internal/domain/resources/valueobject/resourcepaths.ts"() {
|
|
49374
49434
|
"use strict";
|
|
49375
|
-
|
|
49435
|
+
path37 = __toESM(require("path"));
|
|
49376
49436
|
ResourcePaths = class _ResourcePaths {
|
|
49377
49437
|
// This is the directory component for the target file or link.
|
|
49378
49438
|
dir;
|
|
@@ -49395,7 +49455,7 @@ var init_resourcepaths = __esm({
|
|
|
49395
49455
|
}
|
|
49396
49456
|
static newResourcePaths(targetPath, svc) {
|
|
49397
49457
|
const normalizedPath = targetPath.replace(/\\/g, "/");
|
|
49398
|
-
const parsedPath =
|
|
49458
|
+
const parsedPath = path37.posix.parse(normalizedPath);
|
|
49399
49459
|
let dir2 = parsedPath.dir;
|
|
49400
49460
|
if (dir2 === "/") {
|
|
49401
49461
|
dir2 = "";
|
|
@@ -49452,7 +49512,7 @@ var init_resourcepaths = __esm({
|
|
|
49452
49512
|
}
|
|
49453
49513
|
fromTargetPath(targetPath) {
|
|
49454
49514
|
const normalizedPath = targetPath.replace(/\\/g, "/");
|
|
49455
|
-
const parsedPath =
|
|
49515
|
+
const parsedPath = path37.posix.parse(normalizedPath);
|
|
49456
49516
|
let dir2 = parsedPath.dir;
|
|
49457
49517
|
if (dir2 === "/") {
|
|
49458
49518
|
dir2 = "";
|
|
@@ -49598,7 +49658,7 @@ function getDomainInstances() {
|
|
|
49598
49658
|
}
|
|
49599
49659
|
async function loadConfiguration(projDir, modulesDir) {
|
|
49600
49660
|
const osFs = newOsFs();
|
|
49601
|
-
const configFilePath =
|
|
49661
|
+
const configFilePath = import_path27.default.join(projDir, "config.json");
|
|
49602
49662
|
return await loadConfigWithParams(osFs, configFilePath, projDir, modulesDir);
|
|
49603
49663
|
}
|
|
49604
49664
|
async function createModule(config) {
|
|
@@ -49844,11 +49904,11 @@ function createSiteForSSG(config, fs13, content) {
|
|
|
49844
49904
|
searchPage: async (pages, page) => {
|
|
49845
49905
|
return [];
|
|
49846
49906
|
},
|
|
49847
|
-
getPageFromPath: async (langIndex,
|
|
49907
|
+
getPageFromPath: async (langIndex, path43) => {
|
|
49848
49908
|
try {
|
|
49849
|
-
const page = content.getPageFromPath(langIndex,
|
|
49909
|
+
const page = content.getPageFromPath(langIndex, path43);
|
|
49850
49910
|
if (!page) {
|
|
49851
|
-
log76.error(`\u26A0\uFE0F Application.getPageFromPath: content domain returned null for path: "${
|
|
49911
|
+
log76.error(`\u26A0\uFE0F Application.getPageFromPath: content domain returned null for path: "${path43}"`);
|
|
49852
49912
|
}
|
|
49853
49913
|
return page;
|
|
49854
49914
|
} catch (error) {
|
|
@@ -49856,11 +49916,11 @@ function createSiteForSSG(config, fs13, content) {
|
|
|
49856
49916
|
return null;
|
|
49857
49917
|
}
|
|
49858
49918
|
},
|
|
49859
|
-
getPageFromPathSync: (langIndex,
|
|
49919
|
+
getPageFromPathSync: (langIndex, path43) => {
|
|
49860
49920
|
try {
|
|
49861
|
-
const page = content.getPageFromPath(langIndex,
|
|
49921
|
+
const page = content.getPageFromPath(langIndex, path43);
|
|
49862
49922
|
if (!page) {
|
|
49863
|
-
log76.warn(`\u26A0\uFE0F Application.getPageFromPathSync: content domain returned null for path: ${
|
|
49923
|
+
log76.warn(`\u26A0\uFE0F Application.getPageFromPathSync: content domain returned null for path: ${path43}`);
|
|
49864
49924
|
}
|
|
49865
49925
|
return page;
|
|
49866
49926
|
} catch (error) {
|
|
@@ -49895,14 +49955,14 @@ function createSiteForSSG(config, fs13, content) {
|
|
|
49895
49955
|
},
|
|
49896
49956
|
workingDir: () => config.getProvider().getString("workingDir") || process.cwd(),
|
|
49897
49957
|
// ResourceService implementation (placeholder)
|
|
49898
|
-
getResource: async (
|
|
49958
|
+
getResource: async (path43) => {
|
|
49899
49959
|
return null;
|
|
49900
49960
|
},
|
|
49901
|
-
getResourceWithOpener: async (
|
|
49961
|
+
getResourceWithOpener: async (path43, opener) => {
|
|
49902
49962
|
return {
|
|
49903
|
-
name: () =>
|
|
49963
|
+
name: () => path43,
|
|
49904
49964
|
readSeekCloser: opener,
|
|
49905
|
-
targetPath: () =>
|
|
49965
|
+
targetPath: () => path43
|
|
49906
49966
|
};
|
|
49907
49967
|
},
|
|
49908
49968
|
// URLService implementation
|
|
@@ -50181,7 +50241,7 @@ async function collectAllPageTasks(projDir, modulesDir, markdown, onProgress, ht
|
|
|
50181
50241
|
throw new Error(`Failed to generate static site: ${message}`);
|
|
50182
50242
|
}
|
|
50183
50243
|
}
|
|
50184
|
-
var
|
|
50244
|
+
var import_path27, log76, configCache, modulesCache, fsCache, contentCache, resourcesCache, templateEngineCache, siteCache, createDomainInstances, tasks;
|
|
50185
50245
|
var init_ssg = __esm({
|
|
50186
50246
|
"internal/application/ssg.ts"() {
|
|
50187
50247
|
"use strict";
|
|
@@ -50192,7 +50252,7 @@ var init_ssg = __esm({
|
|
|
50192
50252
|
init_template3();
|
|
50193
50253
|
init_site2();
|
|
50194
50254
|
init_log();
|
|
50195
|
-
|
|
50255
|
+
import_path27 = __toESM(require("path"));
|
|
50196
50256
|
init_resources2();
|
|
50197
50257
|
log76 = getDomainLogger("ssg", { component: "application" });
|
|
50198
50258
|
createDomainInstances = (site, content, fs13, config, modules, resources) => {
|
|
@@ -50924,8 +50984,8 @@ var WorkerPoolManager = class {
|
|
|
50924
50984
|
* 初始化 Node.js Worker 池
|
|
50925
50985
|
*/
|
|
50926
50986
|
async initializeNodePool() {
|
|
50927
|
-
const
|
|
50928
|
-
const workerPath =
|
|
50987
|
+
const path43 = require("path");
|
|
50988
|
+
const workerPath = path43.join(__dirname, "worker", "worker-node.js");
|
|
50929
50989
|
log79.debug(`Initializing Node.js worker pool with path: ${workerPath}`);
|
|
50930
50990
|
this.pool = workerpool.pool(workerPath, {
|
|
50931
50991
|
minWorkers: this.workerCount,
|
|
@@ -51252,7 +51312,7 @@ async function processSSGParallel(projDir, modulesDir, markdown, onProgress, htt
|
|
|
51252
51312
|
|
|
51253
51313
|
// internal/interfaces/cli/commands/build.ts
|
|
51254
51314
|
init_log();
|
|
51255
|
-
var
|
|
51315
|
+
var import_path28 = __toESM(require("path"));
|
|
51256
51316
|
var import_fs15 = require("fs");
|
|
51257
51317
|
var log82 = getDomainLogger("build-command", { component: "cli" });
|
|
51258
51318
|
var BuildCommand = class {
|
|
@@ -51279,7 +51339,7 @@ var BuildCommand = class {
|
|
|
51279
51339
|
await project.loadConfig();
|
|
51280
51340
|
const projectRoot = project.getPath();
|
|
51281
51341
|
const modulesDir = options.modulesDir || workspace.getModulesDir();
|
|
51282
|
-
const outputDir = options.destination ?
|
|
51342
|
+
const outputDir = options.destination ? import_path28.default.resolve(projectRoot, options.destination) : await project.getPublishDir();
|
|
51283
51343
|
if (options.clean) {
|
|
51284
51344
|
await this.cleanOutputDir(outputDir);
|
|
51285
51345
|
log82.info(`Cleaned output directory: ${outputDir}`);
|
|
@@ -51288,7 +51348,7 @@ var BuildCommand = class {
|
|
|
51288
51348
|
let contentDirs = await project.getContentDirs();
|
|
51289
51349
|
if (options.contentDirs && options.contentDirs.length > 0) {
|
|
51290
51350
|
const extraDirs = options.contentDirs.map(
|
|
51291
|
-
(dir2) =>
|
|
51351
|
+
(dir2) => import_path28.default.resolve(projectRoot, dir2)
|
|
51292
51352
|
);
|
|
51293
51353
|
contentDirs = [...contentDirs, ...extraDirs];
|
|
51294
51354
|
log82.info(`Added extra content directories: ${options.contentDirs.join(", ")}`);
|
|
@@ -51369,7 +51429,7 @@ var BuildCommand = class {
|
|
|
51369
51429
|
const entries = await import_fs15.promises.readdir(outputDir);
|
|
51370
51430
|
await Promise.all(
|
|
51371
51431
|
entries.map(
|
|
51372
|
-
(entry) => import_fs15.promises.rm(
|
|
51432
|
+
(entry) => import_fs15.promises.rm(import_path28.default.join(outputDir, entry), { recursive: true, force: true })
|
|
51373
51433
|
)
|
|
51374
51434
|
);
|
|
51375
51435
|
} catch (error) {
|
|
@@ -51386,7 +51446,7 @@ init_log();
|
|
|
51386
51446
|
|
|
51387
51447
|
// pkg/web/watcher/content-file-watcher.ts
|
|
51388
51448
|
var chokidar = __toESM(require("chokidar"));
|
|
51389
|
-
var
|
|
51449
|
+
var path40 = __toESM(require("path"));
|
|
51390
51450
|
init_log();
|
|
51391
51451
|
var log83 = getDomainLogger("web", { component: "content-file-watcher" });
|
|
51392
51452
|
var ContentFileWatcher = class {
|
|
@@ -51445,7 +51505,7 @@ var ContentFileWatcher = class {
|
|
|
51445
51505
|
}
|
|
51446
51506
|
}
|
|
51447
51507
|
}
|
|
51448
|
-
const normalizedPath =
|
|
51508
|
+
const normalizedPath = path40.normalize(fp);
|
|
51449
51509
|
if (!this.isRelevantFile(normalizedPath)) {
|
|
51450
51510
|
return;
|
|
51451
51511
|
}
|
|
@@ -51463,11 +51523,11 @@ var ContentFileWatcher = class {
|
|
|
51463
51523
|
return this.isMarkdownFile(filePath) || this.isImageFile(filePath);
|
|
51464
51524
|
}
|
|
51465
51525
|
isMarkdownFile(filePath) {
|
|
51466
|
-
const ext =
|
|
51526
|
+
const ext = path40.extname(filePath).toLowerCase();
|
|
51467
51527
|
return ext === ".md" || ext === ".markdown";
|
|
51468
51528
|
}
|
|
51469
51529
|
isImageFile(filePath) {
|
|
51470
|
-
const ext =
|
|
51530
|
+
const ext = path40.extname(filePath).toLowerCase();
|
|
51471
51531
|
return [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp", ".bmp"].includes(ext);
|
|
51472
51532
|
}
|
|
51473
51533
|
scheduleBatch() {
|
|
@@ -51514,7 +51574,7 @@ var ContentFileWatcher = class {
|
|
|
51514
51574
|
|
|
51515
51575
|
// pkg/web/server/livereload-server.ts
|
|
51516
51576
|
var http3 = __toESM(require("http"));
|
|
51517
|
-
var
|
|
51577
|
+
var path41 = __toESM(require("path"));
|
|
51518
51578
|
var fs11 = __toESM(require("fs/promises"));
|
|
51519
51579
|
var import_ws = require("ws");
|
|
51520
51580
|
init_log();
|
|
@@ -51585,7 +51645,7 @@ var FoundryLiveReloadServer = class {
|
|
|
51585
51645
|
};
|
|
51586
51646
|
if (changedFiles && changedFiles.length === 1) {
|
|
51587
51647
|
const file = changedFiles[0];
|
|
51588
|
-
const ext =
|
|
51648
|
+
const ext = path41.extname(file).toLowerCase();
|
|
51589
51649
|
if (ext === ".css") {
|
|
51590
51650
|
reloadEvent.path = file;
|
|
51591
51651
|
reloadEvent.liveCSS = true;
|
|
@@ -51669,7 +51729,7 @@ var FoundryLiveReloadServer = class {
|
|
|
51669
51729
|
try {
|
|
51670
51730
|
const stats = await fs11.stat(filePath);
|
|
51671
51731
|
if (stats.isDirectory()) {
|
|
51672
|
-
const indexPath =
|
|
51732
|
+
const indexPath = path41.join(filePath, "index.html");
|
|
51673
51733
|
try {
|
|
51674
51734
|
await fs11.stat(indexPath);
|
|
51675
51735
|
filePath = indexPath;
|
|
@@ -51715,9 +51775,9 @@ var FoundryLiveReloadServer = class {
|
|
|
51715
51775
|
log84.warn("Failed to decode URL:", cleanUrl, error);
|
|
51716
51776
|
decodedUrl = cleanUrl;
|
|
51717
51777
|
}
|
|
51718
|
-
const normalizedPath =
|
|
51778
|
+
const normalizedPath = path41.normalize(decodedUrl).replace(/^(\.\.[\/\\])+/, "");
|
|
51719
51779
|
const relativePath = normalizedPath.startsWith("/") ? normalizedPath.slice(1) : normalizedPath;
|
|
51720
|
-
const resolvedPath =
|
|
51780
|
+
const resolvedPath = path41.join(this.config.publicDir, relativePath);
|
|
51721
51781
|
if (process.platform === "win32" && resolvedPath.length > 260) {
|
|
51722
51782
|
log84.warn("Path too long for Windows filesystem:", resolvedPath);
|
|
51723
51783
|
}
|
|
@@ -51730,7 +51790,7 @@ var FoundryLiveReloadServer = class {
|
|
|
51730
51790
|
return resolvedPath;
|
|
51731
51791
|
}
|
|
51732
51792
|
getContentType(filePath) {
|
|
51733
|
-
const ext =
|
|
51793
|
+
const ext = path41.extname(filePath).toLowerCase();
|
|
51734
51794
|
const mimeTypes = {
|
|
51735
51795
|
".html": "text/html; charset=utf-8",
|
|
51736
51796
|
".css": "text/css; charset=utf-8",
|
|
@@ -51824,19 +51884,19 @@ var FoundryLiveReloadServer = class {
|
|
|
51824
51884
|
shouldLiveReloadCSS(changedFiles) {
|
|
51825
51885
|
if (!changedFiles)
|
|
51826
51886
|
return false;
|
|
51827
|
-
return changedFiles.some((file) =>
|
|
51887
|
+
return changedFiles.some((file) => path41.extname(file).toLowerCase() === ".css");
|
|
51828
51888
|
}
|
|
51829
51889
|
shouldLiveReloadImages(changedFiles) {
|
|
51830
51890
|
if (!changedFiles)
|
|
51831
51891
|
return false;
|
|
51832
51892
|
const imageExts = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"];
|
|
51833
|
-
return changedFiles.some((file) => imageExts.includes(
|
|
51893
|
+
return changedFiles.some((file) => imageExts.includes(path41.extname(file).toLowerCase()));
|
|
51834
51894
|
}
|
|
51835
51895
|
};
|
|
51836
51896
|
|
|
51837
51897
|
// pkg/web/server/electron-livereload-server.ts
|
|
51838
51898
|
var http4 = __toESM(require("http"));
|
|
51839
|
-
var
|
|
51899
|
+
var path42 = __toESM(require("path"));
|
|
51840
51900
|
var fs12 = __toESM(require("fs/promises"));
|
|
51841
51901
|
init_log();
|
|
51842
51902
|
var log85 = getDomainLogger("web", { component: "electron-livereload-server" });
|
|
@@ -51853,7 +51913,7 @@ var ElectronLiveReloadServer = class {
|
|
|
51853
51913
|
enableLiveReload: config.enableLiveReload !== false,
|
|
51854
51914
|
publicDir: config.publicDir
|
|
51855
51915
|
};
|
|
51856
|
-
this.stateFilePath =
|
|
51916
|
+
this.stateFilePath = path42.join(this.config.publicDir, ".foundry-livereload-state.json");
|
|
51857
51917
|
}
|
|
51858
51918
|
async start() {
|
|
51859
51919
|
if (this.running) {
|
|
@@ -51906,7 +51966,7 @@ var ElectronLiveReloadServer = class {
|
|
|
51906
51966
|
};
|
|
51907
51967
|
if (changedFiles && changedFiles.length === 1) {
|
|
51908
51968
|
const file = changedFiles[0];
|
|
51909
|
-
const ext =
|
|
51969
|
+
const ext = path42.extname(file).toLowerCase();
|
|
51910
51970
|
if (ext === ".css" || [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"].includes(ext)) {
|
|
51911
51971
|
state.path = file;
|
|
51912
51972
|
}
|
|
@@ -51990,7 +52050,7 @@ var ElectronLiveReloadServer = class {
|
|
|
51990
52050
|
try {
|
|
51991
52051
|
const stats = await fs12.stat(filePath);
|
|
51992
52052
|
if (stats.isDirectory()) {
|
|
51993
|
-
const indexPath =
|
|
52053
|
+
const indexPath = path42.join(filePath, "index.html");
|
|
51994
52054
|
try {
|
|
51995
52055
|
await fs12.stat(indexPath);
|
|
51996
52056
|
filePath = indexPath;
|
|
@@ -52036,13 +52096,13 @@ var ElectronLiveReloadServer = class {
|
|
|
52036
52096
|
log85.warn("Failed to decode URL:", cleanUrl, error);
|
|
52037
52097
|
decodedUrl = cleanUrl;
|
|
52038
52098
|
}
|
|
52039
|
-
const normalizedPath =
|
|
52099
|
+
const normalizedPath = path42.normalize(decodedUrl).replace(/^(\.\.[\/\\])+/, "");
|
|
52040
52100
|
const relativePath = normalizedPath.startsWith("/") ? normalizedPath.slice(1) : normalizedPath;
|
|
52041
|
-
const resolvedPath =
|
|
52101
|
+
const resolvedPath = path42.join(this.config.publicDir, relativePath);
|
|
52042
52102
|
return resolvedPath;
|
|
52043
52103
|
}
|
|
52044
52104
|
getContentType(filePath) {
|
|
52045
|
-
const ext =
|
|
52105
|
+
const ext = path42.extname(filePath).toLowerCase();
|
|
52046
52106
|
const mimeTypes = {
|
|
52047
52107
|
".html": "text/html; charset=utf-8",
|
|
52048
52108
|
".css": "text/css; charset=utf-8",
|
|
@@ -52162,13 +52222,13 @@ var ElectronLiveReloadServer = class {
|
|
|
52162
52222
|
shouldLiveReloadCSS(changedFiles) {
|
|
52163
52223
|
if (!changedFiles)
|
|
52164
52224
|
return false;
|
|
52165
|
-
return changedFiles.some((file) =>
|
|
52225
|
+
return changedFiles.some((file) => path42.extname(file).toLowerCase() === ".css");
|
|
52166
52226
|
}
|
|
52167
52227
|
shouldLiveReloadImages(changedFiles) {
|
|
52168
52228
|
if (!changedFiles)
|
|
52169
52229
|
return false;
|
|
52170
52230
|
const imageExts = [".jpg", ".jpeg", ".png", ".gif", ".svg", ".webp"];
|
|
52171
|
-
return changedFiles.some((file) => imageExts.includes(
|
|
52231
|
+
return changedFiles.some((file) => imageExts.includes(path42.extname(file).toLowerCase()));
|
|
52172
52232
|
}
|
|
52173
52233
|
};
|
|
52174
52234
|
|
|
@@ -54472,7 +54532,7 @@ For more information, visit: https://help.mdfriday.com
|
|
|
54472
54532
|
* Show version
|
|
54473
54533
|
*/
|
|
54474
54534
|
showVersion() {
|
|
54475
|
-
const version = "26.3.
|
|
54535
|
+
const version = "26.3.5";
|
|
54476
54536
|
return {
|
|
54477
54537
|
success: true,
|
|
54478
54538
|
message: `MDFriday CLI v${version}`
|