@ox-content/vite-plugin 2.9.0 → 2.10.0

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.
@@ -0,0 +1,186 @@
1
+ #!/usr/bin/env node
2
+ const require_chunk = require("./chunk.cjs");
3
+ const require_vitepress = require("./vitepress.cjs");
4
+ let node_path = require("node:path");
5
+ node_path = require_chunk.__toESM(node_path);
6
+ let node_url = require("node:url");
7
+ let node_fs_promises = require("node:fs/promises");
8
+ //#region src/vitepress-cli-runtime.ts
9
+ const DEFAULT_CONFIG_FILES = [
10
+ ".vitepress/config.ts",
11
+ ".vitepress/config.mts",
12
+ ".vitepress/config.js",
13
+ ".vitepress/config.mjs",
14
+ ".vitepress/config.cts",
15
+ ".vitepress/config.cjs"
16
+ ];
17
+ const textEncoder = new TextEncoder();
18
+ async function runVitePressMigrationCli(runtime = createVitePressMigrationCliRuntime()) {
19
+ const args = parseVitePressMigrationCliArgs(runtime.argv);
20
+ if (args.help) {
21
+ await runtime.writeStdout(helpText());
22
+ return;
23
+ }
24
+ const cwd = runtime.cwd();
25
+ const source = require_vitepress.generateVitePressMigrationConfig(await loadVitePressConfig(await resolveConfigPath(args.configPath, cwd), cwd, runtime.name), {
26
+ ...args.srcDir ? { srcDir: args.srcDir } : {},
27
+ ...args.outDir ? { outDir: args.outDir } : {}
28
+ });
29
+ if (!args.out) {
30
+ await runtime.writeStdout(source);
31
+ return;
32
+ }
33
+ const outPath = resolvePath(cwd, args.out);
34
+ if (!args.force && await fileExists(outPath)) throw new Error(`Refusing to overwrite existing file: ${outPath}. Pass --force to overwrite.`);
35
+ await (0, node_fs_promises.mkdir)(node_path.dirname(outPath), { recursive: true });
36
+ await (0, node_fs_promises.writeFile)(outPath, source);
37
+ await runtime.writeStdout(`Wrote ${node_path.relative(cwd, outPath) || outPath}\n`);
38
+ }
39
+ function createVitePressMigrationCliRuntime() {
40
+ const globals = globalThis;
41
+ const deno = globals.Deno;
42
+ const process = globals.process;
43
+ if (deno) return {
44
+ name: "deno",
45
+ argv: deno.args,
46
+ cwd: () => deno.cwd(),
47
+ writeStdout: async (value) => {
48
+ await deno.stdout.write(textEncoder.encode(value));
49
+ },
50
+ writeStderr: async (value) => {
51
+ await deno.stderr.write(textEncoder.encode(value));
52
+ },
53
+ setExitCode: (code) => {
54
+ deno.exit(code);
55
+ }
56
+ };
57
+ if (!process) throw new Error("Could not detect a supported JavaScript runtime.");
58
+ return {
59
+ name: globals.Bun ? "bun" : "node",
60
+ argv: process.argv.slice(2),
61
+ cwd: () => process.cwd(),
62
+ writeStdout: (value) => {
63
+ process.stdout.write(value);
64
+ },
65
+ writeStderr: (value) => {
66
+ process.stderr.write(value);
67
+ },
68
+ setExitCode: (code) => {
69
+ process.exitCode = code;
70
+ }
71
+ };
72
+ }
73
+ function parseVitePressMigrationCliArgs(argv) {
74
+ const options = {
75
+ force: false,
76
+ help: false
77
+ };
78
+ for (let index = 0; index < argv.length; index += 1) {
79
+ const arg = argv[index];
80
+ if (arg === "--help" || arg === "-h") {
81
+ options.help = true;
82
+ continue;
83
+ }
84
+ if (arg === "--force" || arg === "-f") {
85
+ options.force = true;
86
+ continue;
87
+ }
88
+ if (arg === "--out" || arg === "-o") {
89
+ options.out = readOptionValue(argv, ++index, arg);
90
+ continue;
91
+ }
92
+ if (arg === "--src-dir") {
93
+ options.srcDir = readOptionValue(argv, ++index, arg);
94
+ continue;
95
+ }
96
+ if (arg === "--out-dir") {
97
+ options.outDir = readOptionValue(argv, ++index, arg);
98
+ continue;
99
+ }
100
+ if (arg.startsWith("-")) throw new Error(`Unknown option: ${arg}`);
101
+ if (options.configPath) throw new Error(`Unexpected positional argument: ${arg}`);
102
+ options.configPath = arg;
103
+ }
104
+ return options;
105
+ }
106
+ function readOptionValue(argv, index, option) {
107
+ const value = argv[index];
108
+ if (!value || value.startsWith("-")) throw new Error(`Missing value for ${option}`);
109
+ return value;
110
+ }
111
+ async function resolveConfigPath(configPath, cwd) {
112
+ if (configPath) return resolvePath(cwd, configPath);
113
+ for (const candidate of DEFAULT_CONFIG_FILES) {
114
+ const resolved = resolvePath(cwd, candidate);
115
+ if (await fileExists(resolved)) return resolved;
116
+ }
117
+ throw new Error(`Could not find a VitePress config. Pass one explicitly, e.g. ${DEFAULT_CONFIG_FILES[0]}`);
118
+ }
119
+ async function loadVitePressConfig(configPath, cwd, runtime) {
120
+ const loaders = runtime === "deno" || runtime === "bun" ? [loadConfigByNativeImport, loadConfigWithVite] : [loadConfigWithVite, loadConfigByNativeImport];
121
+ const errors = [];
122
+ for (const load of loaders) try {
123
+ return await load(configPath, cwd);
124
+ } catch (error) {
125
+ errors.push(error instanceof Error ? error.message : String(error));
126
+ }
127
+ throw new Error(`Could not load VitePress config: ${configPath}\n${errors.map((error) => `- ${error}`).join("\n")}`);
128
+ }
129
+ async function loadConfigWithVite(configPath, cwd) {
130
+ return normalizeLoadedConfig((await (await import("vite")).loadConfigFromFile(createConfigEnv(), configPath, cwd, "silent"))?.config, configPath);
131
+ }
132
+ async function loadConfigByNativeImport(configPath) {
133
+ const url = (0, node_url.pathToFileURL)(configPath);
134
+ url.searchParams.set("mtime", String(Date.now()));
135
+ const module = await import(url.href);
136
+ return normalizeLoadedConfig(module.default ?? module, configPath);
137
+ }
138
+ async function normalizeLoadedConfig(value, configPath) {
139
+ const config = typeof value === "function" ? await value(createConfigEnv()) : await value;
140
+ if (!config || typeof config !== "object" || Array.isArray(config)) throw new Error(`VitePress config did not export an object: ${configPath}`);
141
+ return config;
142
+ }
143
+ async function fileExists(filePath) {
144
+ try {
145
+ await (0, node_fs_promises.access)(filePath);
146
+ return true;
147
+ } catch {
148
+ return false;
149
+ }
150
+ }
151
+ function createConfigEnv() {
152
+ return {
153
+ command: "build",
154
+ mode: "production",
155
+ isSsrBuild: false,
156
+ isPreview: false
157
+ };
158
+ }
159
+ function resolvePath(cwd, value) {
160
+ return node_path.isAbsolute(value) ? node_path.normalize(value) : node_path.resolve(cwd, value);
161
+ }
162
+ function helpText() {
163
+ return `ox-content-migrate-vitepress [config]
164
+
165
+ Generate an editable ox-content options object from a VitePress config.
166
+
167
+ Options:
168
+ -o, --out <file> Write the generated TypeScript module to a file.
169
+ --src-dir <dir> Add/override the ox-content srcDir option.
170
+ --out-dir <dir> Add/override the ox-content outDir option.
171
+ -f, --force Overwrite --out when the file already exists.
172
+ -h, --help Show this help.
173
+
174
+ When --out is omitted, the generated module is printed to stdout.
175
+ `;
176
+ }
177
+ //#endregion
178
+ //#region src/vitepress-cli.ts
179
+ const runtime = createVitePressMigrationCliRuntime();
180
+ runVitePressMigrationCli(runtime).catch(async (error) => {
181
+ await runtime.writeStderr(`${error instanceof Error ? error.message : String(error)}\n`);
182
+ runtime.setExitCode(1);
183
+ });
184
+ //#endregion
185
+
186
+ //# sourceMappingURL=vitepress-cli.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitepress-cli.cjs","names":["generateVitePressMigrationConfig","path"],"sources":["../src/vitepress-cli-runtime.ts","../src/vitepress-cli.ts"],"sourcesContent":["import { access, mkdir, writeFile } from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { OxContentOptions } from \"./types\";\nimport { generateVitePressMigrationConfig, type VitePressConfig } from \"./vitepress\";\n\ninterface RuntimeGlobals {\n Deno?: {\n args: string[];\n cwd(): string;\n exit(code?: number): never;\n stderr: {\n write(data: Uint8Array): Promise<number>;\n };\n stdout: {\n write(data: Uint8Array): Promise<number>;\n };\n };\n Bun?: unknown;\n process?: NodeJS.Process;\n}\n\nexport type VitePressMigrationCliRuntimeName = \"node\" | \"deno\" | \"bun\";\n\nexport interface VitePressMigrationCliRuntime {\n name: VitePressMigrationCliRuntimeName;\n argv: string[];\n cwd(): string;\n writeStdout(value: string): void | Promise<void>;\n writeStderr(value: string): void | Promise<void>;\n setExitCode(code: number): void;\n}\n\ninterface CliOptions {\n configPath?: string;\n out?: string;\n srcDir?: string;\n outDir?: string;\n force: boolean;\n help: boolean;\n}\n\ninterface ConfigEnv {\n command: \"build\" | \"serve\";\n mode: string;\n isSsrBuild: boolean;\n isPreview: boolean;\n}\n\nconst DEFAULT_CONFIG_FILES = [\n \".vitepress/config.ts\",\n \".vitepress/config.mts\",\n \".vitepress/config.js\",\n \".vitepress/config.mjs\",\n \".vitepress/config.cts\",\n \".vitepress/config.cjs\",\n];\n\nconst textEncoder = new TextEncoder();\n\nexport async function runVitePressMigrationCli(\n runtime = createVitePressMigrationCliRuntime(),\n): Promise<void> {\n const args = parseVitePressMigrationCliArgs(runtime.argv);\n\n if (args.help) {\n await runtime.writeStdout(helpText());\n return;\n }\n\n const cwd = runtime.cwd();\n const configPath = await resolveConfigPath(args.configPath, cwd);\n const config = await loadVitePressConfig(configPath, cwd, runtime.name);\n const overrides: OxContentOptions = {\n ...(args.srcDir ? { srcDir: args.srcDir } : {}),\n ...(args.outDir ? { outDir: args.outDir } : {}),\n };\n const source = generateVitePressMigrationConfig(config, overrides);\n\n if (!args.out) {\n await runtime.writeStdout(source);\n return;\n }\n\n const outPath = resolvePath(cwd, args.out);\n if (!args.force && (await fileExists(outPath))) {\n throw new Error(`Refusing to overwrite existing file: ${outPath}. Pass --force to overwrite.`);\n }\n\n await mkdir(path.dirname(outPath), { recursive: true });\n await writeFile(outPath, source);\n await runtime.writeStdout(`Wrote ${path.relative(cwd, outPath) || outPath}\\n`);\n}\n\nexport function createVitePressMigrationCliRuntime(): VitePressMigrationCliRuntime {\n const globals = globalThis as typeof globalThis & RuntimeGlobals;\n const deno = globals.Deno;\n const process = globals.process;\n\n if (deno) {\n return {\n name: \"deno\",\n argv: deno.args,\n cwd: () => deno.cwd(),\n writeStdout: async (value) => {\n await deno.stdout.write(textEncoder.encode(value));\n },\n writeStderr: async (value) => {\n await deno.stderr.write(textEncoder.encode(value));\n },\n setExitCode: (code) => {\n deno.exit(code);\n },\n };\n }\n\n if (!process) {\n throw new Error(\"Could not detect a supported JavaScript runtime.\");\n }\n\n return {\n name: globals.Bun ? \"bun\" : \"node\",\n argv: process.argv.slice(2),\n cwd: () => process.cwd(),\n writeStdout: (value) => {\n process.stdout.write(value);\n },\n writeStderr: (value) => {\n process.stderr.write(value);\n },\n setExitCode: (code) => {\n process.exitCode = code;\n },\n };\n}\n\nexport function parseVitePressMigrationCliArgs(argv: string[]): CliOptions {\n const options: CliOptions = {\n force: false,\n help: false,\n };\n\n for (let index = 0; index < argv.length; index += 1) {\n const arg = argv[index];\n\n if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n continue;\n }\n\n if (arg === \"--force\" || arg === \"-f\") {\n options.force = true;\n continue;\n }\n\n if (arg === \"--out\" || arg === \"-o\") {\n options.out = readOptionValue(argv, ++index, arg);\n continue;\n }\n\n if (arg === \"--src-dir\") {\n options.srcDir = readOptionValue(argv, ++index, arg);\n continue;\n }\n\n if (arg === \"--out-dir\") {\n options.outDir = readOptionValue(argv, ++index, arg);\n continue;\n }\n\n if (arg.startsWith(\"-\")) {\n throw new Error(`Unknown option: ${arg}`);\n }\n\n if (options.configPath) {\n throw new Error(`Unexpected positional argument: ${arg}`);\n }\n\n options.configPath = arg;\n }\n\n return options;\n}\n\nfunction readOptionValue(argv: string[], index: number, option: string): string {\n const value = argv[index];\n if (!value || value.startsWith(\"-\")) {\n throw new Error(`Missing value for ${option}`);\n }\n return value;\n}\n\nasync function resolveConfigPath(configPath: string | undefined, cwd: string): Promise<string> {\n if (configPath) {\n return resolvePath(cwd, configPath);\n }\n\n for (const candidate of DEFAULT_CONFIG_FILES) {\n const resolved = resolvePath(cwd, candidate);\n if (await fileExists(resolved)) {\n return resolved;\n }\n }\n\n throw new Error(\n `Could not find a VitePress config. Pass one explicitly, e.g. ${DEFAULT_CONFIG_FILES[0]}`,\n );\n}\n\nasync function loadVitePressConfig(\n configPath: string,\n cwd: string,\n runtime: VitePressMigrationCliRuntimeName,\n): Promise<VitePressConfig> {\n const loaders =\n runtime === \"deno\" || runtime === \"bun\"\n ? [loadConfigByNativeImport, loadConfigWithVite]\n : [loadConfigWithVite, loadConfigByNativeImport];\n const errors: string[] = [];\n\n for (const load of loaders) {\n try {\n return await load(configPath, cwd);\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n }\n }\n\n throw new Error(\n `Could not load VitePress config: ${configPath}\\n${errors.map((error) => `- ${error}`).join(\"\\n\")}`,\n );\n}\n\nasync function loadConfigWithVite(configPath: string, cwd: string): Promise<VitePressConfig> {\n const vite = (await import(\"vite\")) as {\n loadConfigFromFile(\n env: ConfigEnv,\n configFile?: string,\n configRoot?: string,\n logLevel?: \"silent\",\n ): Promise<{ config: unknown } | null>;\n };\n const loaded = await vite.loadConfigFromFile(createConfigEnv(), configPath, cwd, \"silent\");\n\n return normalizeLoadedConfig(loaded?.config, configPath);\n}\n\nasync function loadConfigByNativeImport(configPath: string): Promise<VitePressConfig> {\n const url = pathToFileURL(configPath);\n url.searchParams.set(\"mtime\", String(Date.now()));\n const module = (await import(url.href)) as { default?: unknown };\n\n return normalizeLoadedConfig(module.default ?? module, configPath);\n}\n\nasync function normalizeLoadedConfig(value: unknown, configPath: string): Promise<VitePressConfig> {\n const config = typeof value === \"function\" ? await value(createConfigEnv()) : await value;\n\n if (!config || typeof config !== \"object\" || Array.isArray(config)) {\n throw new Error(`VitePress config did not export an object: ${configPath}`);\n }\n\n return config as VitePressConfig;\n}\n\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction createConfigEnv(): ConfigEnv {\n return {\n command: \"build\",\n mode: \"production\",\n isSsrBuild: false,\n isPreview: false,\n };\n}\n\nfunction resolvePath(cwd: string, value: string): string {\n return path.isAbsolute(value) ? path.normalize(value) : path.resolve(cwd, value);\n}\n\nfunction helpText(): string {\n return `ox-content-migrate-vitepress [config]\n\nGenerate an editable ox-content options object from a VitePress config.\n\nOptions:\n -o, --out <file> Write the generated TypeScript module to a file.\n --src-dir <dir> Add/override the ox-content srcDir option.\n --out-dir <dir> Add/override the ox-content outDir option.\n -f, --force Overwrite --out when the file already exists.\n -h, --help Show this help.\n\nWhen --out is omitted, the generated module is printed to stdout.\n`;\n}\n","#!/usr/bin/env node\nimport {\n createVitePressMigrationCliRuntime,\n runVitePressMigrationCli,\n} from \"./vitepress-cli-runtime\";\n\nconst runtime = createVitePressMigrationCliRuntime();\n\nrunVitePressMigrationCli(runtime).catch(async (error) => {\n await runtime.writeStderr(`${error instanceof Error ? error.message : String(error)}\\n`);\n runtime.setExitCode(1);\n});\n"],"mappings":";;;;;;;;AAiDA,MAAM,uBAAuB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,cAAc,IAAI,aAAa;AAErC,eAAsB,yBACpB,UAAU,oCAAoC,EAC/B;CACf,MAAM,OAAO,+BAA+B,QAAQ,KAAK;AAEzD,KAAI,KAAK,MAAM;AACb,QAAM,QAAQ,YAAY,UAAU,CAAC;AACrC;;CAGF,MAAM,MAAM,QAAQ,KAAK;CAOzB,MAAM,SAASA,kBAAAA,iCALA,MAAM,oBADF,MAAM,kBAAkB,KAAK,YAAY,IAAI,EACX,KAAK,QAAQ,KAAK,EACnC;EAClC,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE;EAC9C,GAAI,KAAK,SAAS,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE;EAC/C,CACiE;AAElE,KAAI,CAAC,KAAK,KAAK;AACb,QAAM,QAAQ,YAAY,OAAO;AACjC;;CAGF,MAAM,UAAU,YAAY,KAAK,KAAK,IAAI;AAC1C,KAAI,CAAC,KAAK,SAAU,MAAM,WAAW,QAAQ,CAC3C,OAAM,IAAI,MAAM,wCAAwC,QAAQ,8BAA8B;AAGhG,QAAA,GAAA,iBAAA,OAAYC,UAAK,QAAQ,QAAQ,EAAE,EAAE,WAAW,MAAM,CAAC;AACvD,QAAA,GAAA,iBAAA,WAAgB,SAAS,OAAO;AAChC,OAAM,QAAQ,YAAY,SAASA,UAAK,SAAS,KAAK,QA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C,KAAI,aAAa,IAAI,SAAS,OAAO,KAAK,KAAK,CAAC,CAAC;CACjD,MAAM,SAAU,MAAM,OAAO,IAAI;AAEjC,QAAO,sBAAsB,OAAO,WAAW,QAAQ,WAAW;;AAGpE,eAAe,sBAAsB,OAAgB,YAA8C;CACjG,MAAM,SAAS,OAAO,UAAU,aAAa,MAAM,MAAM,iBAAiB,CAAC,GAAG,MAAM;AAEpF,KAAI,CAAC,UAAU,OAAO,WAAW,YAAY,MAAM,QAAQ,OAAO,CAChE,OAAM,IAAI,MAAM,8CAA8C,aAAa;AAG7E,QAAO;;AAGT,eAAe,WAAW,UAAoC;AAC5D,KAAI;AACF,SAAA,GAAA,iBAAA,QAAa,SAAS;AACtB,SAAO;SACD;AACN,SAAO;;;AAIX,SAAS,kBAA6B;AACpC,QAAO;EACL,SAAS;EACT,MAAM;EACN,YAAY;EACZ,WAAW;EACZ;;AAGH,SAAS,YAAY,KAAa,OAAuB;AACvD,QAAOA,UAAK,WAAW,MAAM,GAAGA,UAAK,UAAU,MAAM,GAAGA,UAAK,QAAQ,KAAK,MAAM;;AAGlF,SAAS,WAAmB;AAC1B,QAAO;;;;;;;;;;;;;;;;AC1RT,MAAM,UAAU,oCAAoC;AAEpD,yBAAyB,QAAQ,CAAC,MAAM,OAAO,UAAU;AACvD,OAAM,QAAQ,YAAY,GAAG,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC,IAAI;AACxF,SAAQ,YAAY,EAAE;EACtB"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,185 @@
1
+ #!/usr/bin/env node
2
+ import { i as generateVitePressMigrationConfig } from "./vitepress.mjs";
3
+ import * as path from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ import { access, mkdir, writeFile } from "node:fs/promises";
6
+ //#region src/vitepress-cli-runtime.ts
7
+ const DEFAULT_CONFIG_FILES = [
8
+ ".vitepress/config.ts",
9
+ ".vitepress/config.mts",
10
+ ".vitepress/config.js",
11
+ ".vitepress/config.mjs",
12
+ ".vitepress/config.cts",
13
+ ".vitepress/config.cjs"
14
+ ];
15
+ const textEncoder = new TextEncoder();
16
+ async function runVitePressMigrationCli(runtime = createVitePressMigrationCliRuntime()) {
17
+ const args = parseVitePressMigrationCliArgs(runtime.argv);
18
+ if (args.help) {
19
+ await runtime.writeStdout(helpText());
20
+ return;
21
+ }
22
+ const cwd = runtime.cwd();
23
+ const source = generateVitePressMigrationConfig(await loadVitePressConfig(await resolveConfigPath(args.configPath, cwd), cwd, runtime.name), {
24
+ ...args.srcDir ? { srcDir: args.srcDir } : {},
25
+ ...args.outDir ? { outDir: args.outDir } : {}
26
+ });
27
+ if (!args.out) {
28
+ await runtime.writeStdout(source);
29
+ return;
30
+ }
31
+ const outPath = resolvePath(cwd, args.out);
32
+ if (!args.force && await fileExists(outPath)) throw new Error(`Refusing to overwrite existing file: ${outPath}. Pass --force to overwrite.`);
33
+ await mkdir(path.dirname(outPath), { recursive: true });
34
+ await writeFile(outPath, source);
35
+ await runtime.writeStdout(`Wrote ${path.relative(cwd, outPath) || outPath}\n`);
36
+ }
37
+ function createVitePressMigrationCliRuntime() {
38
+ const globals = globalThis;
39
+ const deno = globals.Deno;
40
+ const process = globals.process;
41
+ if (deno) return {
42
+ name: "deno",
43
+ argv: deno.args,
44
+ cwd: () => deno.cwd(),
45
+ writeStdout: async (value) => {
46
+ await deno.stdout.write(textEncoder.encode(value));
47
+ },
48
+ writeStderr: async (value) => {
49
+ await deno.stderr.write(textEncoder.encode(value));
50
+ },
51
+ setExitCode: (code) => {
52
+ deno.exit(code);
53
+ }
54
+ };
55
+ if (!process) throw new Error("Could not detect a supported JavaScript runtime.");
56
+ return {
57
+ name: globals.Bun ? "bun" : "node",
58
+ argv: process.argv.slice(2),
59
+ cwd: () => process.cwd(),
60
+ writeStdout: (value) => {
61
+ process.stdout.write(value);
62
+ },
63
+ writeStderr: (value) => {
64
+ process.stderr.write(value);
65
+ },
66
+ setExitCode: (code) => {
67
+ process.exitCode = code;
68
+ }
69
+ };
70
+ }
71
+ function parseVitePressMigrationCliArgs(argv) {
72
+ const options = {
73
+ force: false,
74
+ help: false
75
+ };
76
+ for (let index = 0; index < argv.length; index += 1) {
77
+ const arg = argv[index];
78
+ if (arg === "--help" || arg === "-h") {
79
+ options.help = true;
80
+ continue;
81
+ }
82
+ if (arg === "--force" || arg === "-f") {
83
+ options.force = true;
84
+ continue;
85
+ }
86
+ if (arg === "--out" || arg === "-o") {
87
+ options.out = readOptionValue(argv, ++index, arg);
88
+ continue;
89
+ }
90
+ if (arg === "--src-dir") {
91
+ options.srcDir = readOptionValue(argv, ++index, arg);
92
+ continue;
93
+ }
94
+ if (arg === "--out-dir") {
95
+ options.outDir = readOptionValue(argv, ++index, arg);
96
+ continue;
97
+ }
98
+ if (arg.startsWith("-")) throw new Error(`Unknown option: ${arg}`);
99
+ if (options.configPath) throw new Error(`Unexpected positional argument: ${arg}`);
100
+ options.configPath = arg;
101
+ }
102
+ return options;
103
+ }
104
+ function readOptionValue(argv, index, option) {
105
+ const value = argv[index];
106
+ if (!value || value.startsWith("-")) throw new Error(`Missing value for ${option}`);
107
+ return value;
108
+ }
109
+ async function resolveConfigPath(configPath, cwd) {
110
+ if (configPath) return resolvePath(cwd, configPath);
111
+ for (const candidate of DEFAULT_CONFIG_FILES) {
112
+ const resolved = resolvePath(cwd, candidate);
113
+ if (await fileExists(resolved)) return resolved;
114
+ }
115
+ throw new Error(`Could not find a VitePress config. Pass one explicitly, e.g. ${DEFAULT_CONFIG_FILES[0]}`);
116
+ }
117
+ async function loadVitePressConfig(configPath, cwd, runtime) {
118
+ const loaders = runtime === "deno" || runtime === "bun" ? [loadConfigByNativeImport, loadConfigWithVite] : [loadConfigWithVite, loadConfigByNativeImport];
119
+ const errors = [];
120
+ for (const load of loaders) try {
121
+ return await load(configPath, cwd);
122
+ } catch (error) {
123
+ errors.push(error instanceof Error ? error.message : String(error));
124
+ }
125
+ throw new Error(`Could not load VitePress config: ${configPath}\n${errors.map((error) => `- ${error}`).join("\n")}`);
126
+ }
127
+ async function loadConfigWithVite(configPath, cwd) {
128
+ return normalizeLoadedConfig((await (await import("vite")).loadConfigFromFile(createConfigEnv(), configPath, cwd, "silent"))?.config, configPath);
129
+ }
130
+ async function loadConfigByNativeImport(configPath) {
131
+ const url = pathToFileURL(configPath);
132
+ url.searchParams.set("mtime", String(Date.now()));
133
+ const module = await import(url.href);
134
+ return normalizeLoadedConfig(module.default ?? module, configPath);
135
+ }
136
+ async function normalizeLoadedConfig(value, configPath) {
137
+ const config = typeof value === "function" ? await value(createConfigEnv()) : await value;
138
+ if (!config || typeof config !== "object" || Array.isArray(config)) throw new Error(`VitePress config did not export an object: ${configPath}`);
139
+ return config;
140
+ }
141
+ async function fileExists(filePath) {
142
+ try {
143
+ await access(filePath);
144
+ return true;
145
+ } catch {
146
+ return false;
147
+ }
148
+ }
149
+ function createConfigEnv() {
150
+ return {
151
+ command: "build",
152
+ mode: "production",
153
+ isSsrBuild: false,
154
+ isPreview: false
155
+ };
156
+ }
157
+ function resolvePath(cwd, value) {
158
+ return path.isAbsolute(value) ? path.normalize(value) : path.resolve(cwd, value);
159
+ }
160
+ function helpText() {
161
+ return `ox-content-migrate-vitepress [config]
162
+
163
+ Generate an editable ox-content options object from a VitePress config.
164
+
165
+ Options:
166
+ -o, --out <file> Write the generated TypeScript module to a file.
167
+ --src-dir <dir> Add/override the ox-content srcDir option.
168
+ --out-dir <dir> Add/override the ox-content outDir option.
169
+ -f, --force Overwrite --out when the file already exists.
170
+ -h, --help Show this help.
171
+
172
+ When --out is omitted, the generated module is printed to stdout.
173
+ `;
174
+ }
175
+ //#endregion
176
+ //#region src/vitepress-cli.ts
177
+ const runtime = createVitePressMigrationCliRuntime();
178
+ runVitePressMigrationCli(runtime).catch(async (error) => {
179
+ await runtime.writeStderr(`${error instanceof Error ? error.message : String(error)}\n`);
180
+ runtime.setExitCode(1);
181
+ });
182
+ //#endregion
183
+ export {};
184
+
185
+ //# sourceMappingURL=vitepress-cli.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitepress-cli.mjs","names":[],"sources":["../src/vitepress-cli-runtime.ts","../src/vitepress-cli.ts"],"sourcesContent":["import { access, mkdir, writeFile } from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport type { OxContentOptions } from \"./types\";\nimport { generateVitePressMigrationConfig, type VitePressConfig } from \"./vitepress\";\n\ninterface RuntimeGlobals {\n Deno?: {\n args: string[];\n cwd(): string;\n exit(code?: number): never;\n stderr: {\n write(data: Uint8Array): Promise<number>;\n };\n stdout: {\n write(data: Uint8Array): Promise<number>;\n };\n };\n Bun?: unknown;\n process?: NodeJS.Process;\n}\n\nexport type VitePressMigrationCliRuntimeName = \"node\" | \"deno\" | \"bun\";\n\nexport interface VitePressMigrationCliRuntime {\n name: VitePressMigrationCliRuntimeName;\n argv: string[];\n cwd(): string;\n writeStdout(value: string): void | Promise<void>;\n writeStderr(value: string): void | Promise<void>;\n setExitCode(code: number): void;\n}\n\ninterface CliOptions {\n configPath?: string;\n out?: string;\n srcDir?: string;\n outDir?: string;\n force: boolean;\n help: boolean;\n}\n\ninterface ConfigEnv {\n command: \"build\" | \"serve\";\n mode: string;\n isSsrBuild: boolean;\n isPreview: boolean;\n}\n\nconst DEFAULT_CONFIG_FILES = [\n \".vitepress/config.ts\",\n \".vitepress/config.mts\",\n \".vitepress/config.js\",\n \".vitepress/config.mjs\",\n \".vitepress/config.cts\",\n \".vitepress/config.cjs\",\n];\n\nconst textEncoder = new TextEncoder();\n\nexport async function runVitePressMigrationCli(\n runtime = createVitePressMigrationCliRuntime(),\n): Promise<void> {\n const args = parseVitePressMigrationCliArgs(runtime.argv);\n\n if (args.help) {\n await runtime.writeStdout(helpText());\n return;\n }\n\n const cwd = runtime.cwd();\n const configPath = await resolveConfigPath(args.configPath, cwd);\n const config = await loadVitePressConfig(configPath, cwd, runtime.name);\n const overrides: OxContentOptions = {\n ...(args.srcDir ? { srcDir: args.srcDir } : {}),\n ...(args.outDir ? { outDir: args.outDir } : {}),\n };\n const source = generateVitePressMigrationConfig(config, overrides);\n\n if (!args.out) {\n await runtime.writeStdout(source);\n return;\n }\n\n const outPath = resolvePath(cwd, args.out);\n if (!args.force && (await fileExists(outPath))) {\n throw new Error(`Refusing to overwrite existing file: ${outPath}. Pass --force to overwrite.`);\n }\n\n await mkdir(path.dirname(outPath), { recursive: true });\n await writeFile(outPath, source);\n await runtime.writeStdout(`Wrote ${path.relative(cwd, outPath) || outPath}\\n`);\n}\n\nexport function createVitePressMigrationCliRuntime(): VitePressMigrationCliRuntime {\n const globals = globalThis as typeof globalThis & RuntimeGlobals;\n const deno = globals.Deno;\n const process = globals.process;\n\n if (deno) {\n return {\n name: \"deno\",\n argv: deno.args,\n cwd: () => deno.cwd(),\n writeStdout: async (value) => {\n await deno.stdout.write(textEncoder.encode(value));\n },\n writeStderr: async (value) => {\n await deno.stderr.write(textEncoder.encode(value));\n },\n setExitCode: (code) => {\n deno.exit(code);\n },\n };\n }\n\n if (!process) {\n throw new Error(\"Could not detect a supported JavaScript runtime.\");\n }\n\n return {\n name: globals.Bun ? \"bun\" : \"node\",\n argv: process.argv.slice(2),\n cwd: () => process.cwd(),\n writeStdout: (value) => {\n process.stdout.write(value);\n },\n writeStderr: (value) => {\n process.stderr.write(value);\n },\n setExitCode: (code) => {\n process.exitCode = code;\n },\n };\n}\n\nexport function parseVitePressMigrationCliArgs(argv: string[]): CliOptions {\n const options: CliOptions = {\n force: false,\n help: false,\n };\n\n for (let index = 0; index < argv.length; index += 1) {\n const arg = argv[index];\n\n if (arg === \"--help\" || arg === \"-h\") {\n options.help = true;\n continue;\n }\n\n if (arg === \"--force\" || arg === \"-f\") {\n options.force = true;\n continue;\n }\n\n if (arg === \"--out\" || arg === \"-o\") {\n options.out = readOptionValue(argv, ++index, arg);\n continue;\n }\n\n if (arg === \"--src-dir\") {\n options.srcDir = readOptionValue(argv, ++index, arg);\n continue;\n }\n\n if (arg === \"--out-dir\") {\n options.outDir = readOptionValue(argv, ++index, arg);\n continue;\n }\n\n if (arg.startsWith(\"-\")) {\n throw new Error(`Unknown option: ${arg}`);\n }\n\n if (options.configPath) {\n throw new Error(`Unexpected positional argument: ${arg}`);\n }\n\n options.configPath = arg;\n }\n\n return options;\n}\n\nfunction readOptionValue(argv: string[], index: number, option: string): string {\n const value = argv[index];\n if (!value || value.startsWith(\"-\")) {\n throw new Error(`Missing value for ${option}`);\n }\n return value;\n}\n\nasync function resolveConfigPath(configPath: string | undefined, cwd: string): Promise<string> {\n if (configPath) {\n return resolvePath(cwd, configPath);\n }\n\n for (const candidate of DEFAULT_CONFIG_FILES) {\n const resolved = resolvePath(cwd, candidate);\n if (await fileExists(resolved)) {\n return resolved;\n }\n }\n\n throw new Error(\n `Could not find a VitePress config. Pass one explicitly, e.g. ${DEFAULT_CONFIG_FILES[0]}`,\n );\n}\n\nasync function loadVitePressConfig(\n configPath: string,\n cwd: string,\n runtime: VitePressMigrationCliRuntimeName,\n): Promise<VitePressConfig> {\n const loaders =\n runtime === \"deno\" || runtime === \"bun\"\n ? [loadConfigByNativeImport, loadConfigWithVite]\n : [loadConfigWithVite, loadConfigByNativeImport];\n const errors: string[] = [];\n\n for (const load of loaders) {\n try {\n return await load(configPath, cwd);\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n }\n }\n\n throw new Error(\n `Could not load VitePress config: ${configPath}\\n${errors.map((error) => `- ${error}`).join(\"\\n\")}`,\n );\n}\n\nasync function loadConfigWithVite(configPath: string, cwd: string): Promise<VitePressConfig> {\n const vite = (await import(\"vite\")) as {\n loadConfigFromFile(\n env: ConfigEnv,\n configFile?: string,\n configRoot?: string,\n logLevel?: \"silent\",\n ): Promise<{ config: unknown } | null>;\n };\n const loaded = await vite.loadConfigFromFile(createConfigEnv(), configPath, cwd, \"silent\");\n\n return normalizeLoadedConfig(loaded?.config, configPath);\n}\n\nasync function loadConfigByNativeImport(configPath: string): Promise<VitePressConfig> {\n const url = pathToFileURL(configPath);\n url.searchParams.set(\"mtime\", String(Date.now()));\n const module = (await import(url.href)) as { default?: unknown };\n\n return normalizeLoadedConfig(module.default ?? module, configPath);\n}\n\nasync function normalizeLoadedConfig(value: unknown, configPath: string): Promise<VitePressConfig> {\n const config = typeof value === \"function\" ? await value(createConfigEnv()) : await value;\n\n if (!config || typeof config !== \"object\" || Array.isArray(config)) {\n throw new Error(`VitePress config did not export an object: ${configPath}`);\n }\n\n return config as VitePressConfig;\n}\n\nasync function fileExists(filePath: string): Promise<boolean> {\n try {\n await access(filePath);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction createConfigEnv(): ConfigEnv {\n return {\n command: \"build\",\n mode: \"production\",\n isSsrBuild: false,\n isPreview: false,\n };\n}\n\nfunction resolvePath(cwd: string, value: string): string {\n return path.isAbsolute(value) ? path.normalize(value) : path.resolve(cwd, value);\n}\n\nfunction helpText(): string {\n return `ox-content-migrate-vitepress [config]\n\nGenerate an editable ox-content options object from a VitePress config.\n\nOptions:\n -o, --out <file> Write the generated TypeScript module to a file.\n --src-dir <dir> Add/override the ox-content srcDir option.\n --out-dir <dir> Add/override the ox-content outDir option.\n -f, --force Overwrite --out when the file already exists.\n -h, --help Show this help.\n\nWhen --out is omitted, the generated module is printed to stdout.\n`;\n}\n","#!/usr/bin/env node\nimport {\n createVitePressMigrationCliRuntime,\n runVitePressMigrationCli,\n} from \"./vitepress-cli-runtime\";\n\nconst runtime = createVitePressMigrationCliRuntime();\n\nrunVitePressMigrationCli(runtime).catch(async (error) => {\n await runtime.writeStderr(`${error instanceof Error ? error.message : String(error)}\\n`);\n runtime.setExitCode(1);\n});\n"],"mappings":";;;;;;AAiDA,MAAM,uBAAuB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,cAAc,IAAI,aAAa;AAErC,eAAsB,yBACpB,UAAU,oCAAoC,EAC/B;CACf,MAAM,OAAO,+BAA+B,QAAQ,KAAK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