@chronoter/main 0.1.9 → 0.1.11
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 +26 -10
- package/dist/index.js +25 -9
- package/dist/server/client/main.css +0 -3
- package/dist/server/client/main.js +137 -1543
- package/package.json +1 -1
- package/README.npm.md +0 -3
package/dist/cli.js
CHANGED
|
@@ -824,7 +824,7 @@ var ConfigError = class _ConfigError extends Error {
|
|
|
824
824
|
}
|
|
825
825
|
};
|
|
826
826
|
var siteConfigSchema = z.object({
|
|
827
|
-
title: z.string().min(1, "site.title
|
|
827
|
+
title: z.string().min(1, "site.title must not be empty").optional(),
|
|
828
828
|
description: z.string().optional(),
|
|
829
829
|
baseUrl: z.string().url("site.baseUrl must be a valid URL").optional()
|
|
830
830
|
});
|
|
@@ -840,7 +840,7 @@ var themeConfigSchema = z.object({
|
|
|
840
840
|
logo: z.string().optional()
|
|
841
841
|
});
|
|
842
842
|
var chronoterConfigSchema = z.object({
|
|
843
|
-
site: siteConfigSchema,
|
|
843
|
+
site: siteConfigSchema.optional(),
|
|
844
844
|
navigation: z.array(navigationItemSchema).optional(),
|
|
845
845
|
docsDir: z.string().min(1, "docsDir must not be empty").optional(),
|
|
846
846
|
outDir: z.string().optional(),
|
|
@@ -850,6 +850,10 @@ var chronoterConfigSchema = z.object({
|
|
|
850
850
|
|
|
851
851
|
// src/core/config/defaults.ts
|
|
852
852
|
var defaultConfig = {
|
|
853
|
+
site: {
|
|
854
|
+
title: "Chronoter Documentation"
|
|
855
|
+
// デフォルトタイトル
|
|
856
|
+
},
|
|
853
857
|
docsDir: ".",
|
|
854
858
|
// デフォルトはルートディレクトリ
|
|
855
859
|
theme: {
|
|
@@ -858,9 +862,12 @@ var defaultConfig = {
|
|
|
858
862
|
}
|
|
859
863
|
};
|
|
860
864
|
var mergeWithDefaults = (userConfig) => {
|
|
861
|
-
const site = userConfig.site;
|
|
862
865
|
return {
|
|
863
|
-
site
|
|
866
|
+
site: {
|
|
867
|
+
title: userConfig.site?.title ?? defaultConfig.site.title,
|
|
868
|
+
description: userConfig.site?.description,
|
|
869
|
+
baseUrl: userConfig.site?.baseUrl
|
|
870
|
+
},
|
|
864
871
|
docsDir: userConfig.docsDir ?? defaultConfig.docsDir,
|
|
865
872
|
navigation: userConfig.navigation,
|
|
866
873
|
theme: {
|
|
@@ -896,10 +903,7 @@ var ConfigLoader = class {
|
|
|
896
903
|
return this.validate(parsedConfig);
|
|
897
904
|
} catch (error) {
|
|
898
905
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
899
|
-
|
|
900
|
-
`Config file not found: ${configPath}
|
|
901
|
-
Please create a chronoter.config.json file.`
|
|
902
|
-
);
|
|
906
|
+
return defaultConfig;
|
|
903
907
|
}
|
|
904
908
|
if (error instanceof ConfigError) {
|
|
905
909
|
throw error;
|
|
@@ -1015,10 +1019,22 @@ var createViteConfig = (config, options = {}) => {
|
|
|
1015
1019
|
);
|
|
1016
1020
|
}
|
|
1017
1021
|
},
|
|
1018
|
-
//
|
|
1022
|
+
// ビルド済みクライアントファイル配信プラグイン
|
|
1019
1023
|
// npmパッケージとして使用時、/server/client/ へのリクエストをdist内のファイルから配信
|
|
1020
1024
|
{
|
|
1021
1025
|
name: "chronoter-built-client",
|
|
1026
|
+
// Viteのモジュール解決フック: /server/client/main.js を解決
|
|
1027
|
+
// transformIndexHtml がHTMLを解析する際にモジュール解決を試みるため必要
|
|
1028
|
+
resolveId(id) {
|
|
1029
|
+
if (id === "/server/client/main.js" || id === "/server/client/main.css") {
|
|
1030
|
+
const fileName = id.replace("/server/client/", "");
|
|
1031
|
+
const clientFilePath = resolve(__dirname2, "server/client", fileName);
|
|
1032
|
+
if (existsSync(clientFilePath)) {
|
|
1033
|
+
return clientFilePath;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
return null;
|
|
1037
|
+
},
|
|
1022
1038
|
configureServer(server) {
|
|
1023
1039
|
server.middlewares.use((req, res, next) => {
|
|
1024
1040
|
const url = req.url || "";
|
|
@@ -1649,7 +1665,7 @@ var runVersionCheck = async (packageName, currentVersion) => {
|
|
|
1649
1665
|
|
|
1650
1666
|
// src/cli/index.ts
|
|
1651
1667
|
var PACKAGE_NAME = "chronoter";
|
|
1652
|
-
var CURRENT_VERSION = "0.1.
|
|
1668
|
+
var CURRENT_VERSION = "0.1.11";
|
|
1653
1669
|
var createCliProgram = () => {
|
|
1654
1670
|
const program = new Command();
|
|
1655
1671
|
program.name("chronoter").description("Chronoter - MDX-based documentation site generator").version(CURRENT_VERSION);
|
package/dist/index.js
CHANGED
|
@@ -819,7 +819,7 @@ var ConfigError = class _ConfigError extends Error {
|
|
|
819
819
|
}
|
|
820
820
|
};
|
|
821
821
|
var siteConfigSchema = z.object({
|
|
822
|
-
title: z.string().min(1, "site.title
|
|
822
|
+
title: z.string().min(1, "site.title must not be empty").optional(),
|
|
823
823
|
description: z.string().optional(),
|
|
824
824
|
baseUrl: z.string().url("site.baseUrl must be a valid URL").optional()
|
|
825
825
|
});
|
|
@@ -835,7 +835,7 @@ var themeConfigSchema = z.object({
|
|
|
835
835
|
logo: z.string().optional()
|
|
836
836
|
});
|
|
837
837
|
var chronoterConfigSchema = z.object({
|
|
838
|
-
site: siteConfigSchema,
|
|
838
|
+
site: siteConfigSchema.optional(),
|
|
839
839
|
navigation: z.array(navigationItemSchema).optional(),
|
|
840
840
|
docsDir: z.string().min(1, "docsDir must not be empty").optional(),
|
|
841
841
|
outDir: z.string().optional(),
|
|
@@ -845,6 +845,10 @@ var chronoterConfigSchema = z.object({
|
|
|
845
845
|
|
|
846
846
|
// src/core/config/defaults.ts
|
|
847
847
|
var defaultConfig = {
|
|
848
|
+
site: {
|
|
849
|
+
title: "Chronoter Documentation"
|
|
850
|
+
// デフォルトタイトル
|
|
851
|
+
},
|
|
848
852
|
docsDir: ".",
|
|
849
853
|
// デフォルトはルートディレクトリ
|
|
850
854
|
theme: {
|
|
@@ -853,9 +857,12 @@ var defaultConfig = {
|
|
|
853
857
|
}
|
|
854
858
|
};
|
|
855
859
|
var mergeWithDefaults = (userConfig) => {
|
|
856
|
-
const site = userConfig.site;
|
|
857
860
|
return {
|
|
858
|
-
site
|
|
861
|
+
site: {
|
|
862
|
+
title: userConfig.site?.title ?? defaultConfig.site.title,
|
|
863
|
+
description: userConfig.site?.description,
|
|
864
|
+
baseUrl: userConfig.site?.baseUrl
|
|
865
|
+
},
|
|
859
866
|
docsDir: userConfig.docsDir ?? defaultConfig.docsDir,
|
|
860
867
|
navigation: userConfig.navigation,
|
|
861
868
|
theme: {
|
|
@@ -891,10 +898,7 @@ var ConfigLoader = class {
|
|
|
891
898
|
return this.validate(parsedConfig);
|
|
892
899
|
} catch (error) {
|
|
893
900
|
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
894
|
-
|
|
895
|
-
`Config file not found: ${configPath}
|
|
896
|
-
Please create a chronoter.config.json file.`
|
|
897
|
-
);
|
|
901
|
+
return defaultConfig;
|
|
898
902
|
}
|
|
899
903
|
if (error instanceof ConfigError) {
|
|
900
904
|
throw error;
|
|
@@ -1010,10 +1014,22 @@ var createViteConfig = (config, options = {}) => {
|
|
|
1010
1014
|
);
|
|
1011
1015
|
}
|
|
1012
1016
|
},
|
|
1013
|
-
//
|
|
1017
|
+
// ビルド済みクライアントファイル配信プラグイン
|
|
1014
1018
|
// npmパッケージとして使用時、/server/client/ へのリクエストをdist内のファイルから配信
|
|
1015
1019
|
{
|
|
1016
1020
|
name: "chronoter-built-client",
|
|
1021
|
+
// Viteのモジュール解決フック: /server/client/main.js を解決
|
|
1022
|
+
// transformIndexHtml がHTMLを解析する際にモジュール解決を試みるため必要
|
|
1023
|
+
resolveId(id) {
|
|
1024
|
+
if (id === "/server/client/main.js" || id === "/server/client/main.css") {
|
|
1025
|
+
const fileName = id.replace("/server/client/", "");
|
|
1026
|
+
const clientFilePath = resolve(__dirname2, "server/client", fileName);
|
|
1027
|
+
if (existsSync(clientFilePath)) {
|
|
1028
|
+
return clientFilePath;
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
return null;
|
|
1032
|
+
},
|
|
1017
1033
|
configureServer(server) {
|
|
1018
1034
|
server.middlewares.use((req, res, next) => {
|
|
1019
1035
|
const url = req.url || "";
|