docs-i18n 0.2.4 → 0.3.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.
- package/dist/{assemble-IOHQYYHI.js → assemble-7H4QCW35.js} +3 -4
- package/dist/{chunk-QSVWLTGQ.js → chunk-A3YQNPKZ.js} +1 -1
- package/dist/chunk-SKKZIV3L.js +54 -0
- package/dist/{chunk-SUIDX6IZ.js → chunk-YN4VJHCQ.js} +1 -1
- package/dist/cli.js +6 -7
- package/dist/{rescan-VB2PILB2.js → rescan-O5D3CYC2.js} +2 -3
- package/dist/{server-HUXOPTUA.js → server-XRHMURM5.js} +27 -8
- package/dist/{status-EWQEACVF.js → status-F4MYIAAY.js} +1 -2
- package/dist/{translate-F3AQFN6X.js → translate-FI4IXXOP.js} +5 -7
- package/package.json +7 -6
- package/src/admin/server/index.ts +25 -5
- package/dist/build-4EQEL4NI.js +0 -12
- package/dist/build2-3W5WMFHZ.js +0 -4901
- package/dist/chunk-3YNFMSJH.js +0 -30
- package/dist/chunk-55MBYBVK.js +0 -368
- package/dist/chunk-AKLW2MUS.js +0 -54
- package/dist/chunk-FYDB7MZX.js +0 -38944
- package/dist/chunk-O35QHRY6.js +0 -6
- package/dist/chunk-PTIH4GGE.js +0 -44
- package/dist/chunk-VKKNQBDN.js +0 -6487
- package/dist/dist-6C32URTL.js +0 -19
- package/dist/dist-HOWMMQFV.js +0 -6677
- package/dist/false-JGP4AGWN.js +0 -7
- package/dist/main-QVE5TVA3.js +0 -2505
- package/dist/node-4GLCLDJ6.js +0 -875
- package/dist/node-NUDVMOF2.js +0 -129
- package/dist/postcss-3SK7VUC2.js +0 -5886
- package/dist/postcss-import-JD46KA2Z.js +0 -458
- package/dist/prompt-BYQIwEjg-TG7DLENB.js +0 -915
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assemble
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-A3YQNPKZ.js";
|
|
4
|
+
import "./chunk-YN4VJHCQ.js";
|
|
5
5
|
import {
|
|
6
6
|
TranslationCache
|
|
7
7
|
} from "./chunk-XEOYZUHS.js";
|
|
8
8
|
import {
|
|
9
9
|
flattenSources
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-AKLW2MUS.js";
|
|
10
|
+
} from "./chunk-SKKZIV3L.js";
|
|
12
11
|
|
|
13
12
|
// src/commands/assemble.ts
|
|
14
13
|
import {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// src/config.ts
|
|
23
|
+
async function loadConfig(path) {
|
|
24
|
+
const configPath = path ?? "docs-i18n.config.ts";
|
|
25
|
+
try {
|
|
26
|
+
const mod = await import(
|
|
27
|
+
/* @vite-ignore */
|
|
28
|
+
`${process.cwd()}/${configPath}`
|
|
29
|
+
);
|
|
30
|
+
return mod.default ?? mod;
|
|
31
|
+
} catch {
|
|
32
|
+
throw new Error(`Cannot load config from ${configPath}. Create a docs-i18n.config.ts file.`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function flattenSources(config) {
|
|
36
|
+
const projects = Object.entries(config.projects);
|
|
37
|
+
const singleProject = projects.length === 1;
|
|
38
|
+
return projects.flatMap(
|
|
39
|
+
([projectId, project]) => Object.entries(project.sources).map(([version, sourcePath]) => ({
|
|
40
|
+
project: projectId,
|
|
41
|
+
version,
|
|
42
|
+
sourcePath,
|
|
43
|
+
versionKey: singleProject ? version : `${projectId}/${version}`
|
|
44
|
+
}))
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
__esm,
|
|
50
|
+
__export,
|
|
51
|
+
__toCommonJS,
|
|
52
|
+
loadConfig,
|
|
53
|
+
flattenSources
|
|
54
|
+
};
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
loadConfig
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-AKLW2MUS.js";
|
|
4
|
+
} from "./chunk-SKKZIV3L.js";
|
|
6
5
|
|
|
7
6
|
// src/cli.ts
|
|
8
7
|
var args = process.argv.slice(2);
|
|
@@ -50,7 +49,7 @@ Options:
|
|
|
50
49
|
console.error("Error: --lang is required");
|
|
51
50
|
process.exit(1);
|
|
52
51
|
}
|
|
53
|
-
const { translate } = await import("./translate-
|
|
52
|
+
const { translate } = await import("./translate-FI4IXXOP.js");
|
|
54
53
|
await translate(config, {
|
|
55
54
|
lang,
|
|
56
55
|
project: getOpt("project") || void 0,
|
|
@@ -66,7 +65,7 @@ Options:
|
|
|
66
65
|
break;
|
|
67
66
|
}
|
|
68
67
|
case "assemble": {
|
|
69
|
-
const { assembleAll } = await import("./assemble-
|
|
68
|
+
const { assembleAll } = await import("./assemble-7H4QCW35.js");
|
|
70
69
|
await assembleAll(config, {
|
|
71
70
|
project: getOpt("project") || void 0,
|
|
72
71
|
version: getOpt("version") || void 0,
|
|
@@ -75,7 +74,7 @@ Options:
|
|
|
75
74
|
break;
|
|
76
75
|
}
|
|
77
76
|
case "rescan": {
|
|
78
|
-
const { rescan } = await import("./rescan-
|
|
77
|
+
const { rescan } = await import("./rescan-O5D3CYC2.js");
|
|
79
78
|
await rescan(config, {
|
|
80
79
|
project: getOpt("project") || void 0,
|
|
81
80
|
version: getOpt("version") || void 0
|
|
@@ -83,13 +82,13 @@ Options:
|
|
|
83
82
|
break;
|
|
84
83
|
}
|
|
85
84
|
case "status": {
|
|
86
|
-
const { status } = await import("./status-
|
|
85
|
+
const { status } = await import("./status-F4MYIAAY.js");
|
|
87
86
|
await status(config, { lang: getOpt("lang") || void 0 });
|
|
88
87
|
break;
|
|
89
88
|
}
|
|
90
89
|
case "admin": {
|
|
91
90
|
const port = Number(getOpt("port", "3456"));
|
|
92
|
-
const { startAdmin } = await import("./server-
|
|
91
|
+
const { startAdmin } = await import("./server-XRHMURM5.js");
|
|
93
92
|
await startAdmin(config, port);
|
|
94
93
|
break;
|
|
95
94
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_parser,
|
|
3
3
|
parseMdx
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YN4VJHCQ.js";
|
|
5
5
|
import {
|
|
6
6
|
TranslationCache
|
|
7
7
|
} from "./chunk-XEOYZUHS.js";
|
|
8
8
|
import {
|
|
9
9
|
flattenSources
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-AKLW2MUS.js";
|
|
10
|
+
} from "./chunk-SKKZIV3L.js";
|
|
12
11
|
|
|
13
12
|
// src/commands/rescan.ts
|
|
14
13
|
import { existsSync, readdirSync, readFileSync } from "fs";
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
init_parser,
|
|
3
3
|
parseMdx
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YN4VJHCQ.js";
|
|
5
5
|
import {
|
|
6
6
|
TranslationCache
|
|
7
7
|
} from "./chunk-XEOYZUHS.js";
|
|
8
8
|
import {
|
|
9
9
|
flattenSources
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-AKLW2MUS.js";
|
|
10
|
+
} from "./chunk-SKKZIV3L.js";
|
|
12
11
|
|
|
13
12
|
// src/admin/server/index.ts
|
|
14
13
|
import { createServer } from "http";
|
|
@@ -504,7 +503,7 @@ async function startAdmin(config, port = 3456) {
|
|
|
504
503
|
const pkgRoot = resolve2(thisFile, "..", "..");
|
|
505
504
|
const adminRoot = resolve2(pkgRoot, "src", "admin");
|
|
506
505
|
try {
|
|
507
|
-
const { createServer: createViteServer } = await import("
|
|
506
|
+
const { createServer: createViteServer } = await import("vite");
|
|
508
507
|
const vite = await createViteServer({
|
|
509
508
|
root: adminRoot,
|
|
510
509
|
server: { middlewareMode: true },
|
|
@@ -539,10 +538,30 @@ async function startAdmin(config, port = 3456) {
|
|
|
539
538
|
server.listen(port, () => {
|
|
540
539
|
console.log(`\u{1F310} docs-i18n admin \u2192 http://localhost:${port}`);
|
|
541
540
|
});
|
|
542
|
-
} catch {
|
|
543
|
-
console.error("Failed to start admin UI
|
|
544
|
-
|
|
545
|
-
|
|
541
|
+
} catch (err) {
|
|
542
|
+
console.error("Failed to start admin UI with Vite:", err.message);
|
|
543
|
+
console.log("Starting API-only mode...");
|
|
544
|
+
const server = createServer(async (req, res) => {
|
|
545
|
+
const url = req.url ?? "/";
|
|
546
|
+
const headers = new Headers();
|
|
547
|
+
for (const [k, v] of Object.entries(req.headers)) {
|
|
548
|
+
if (v) headers.set(k, Array.isArray(v) ? v.join(", ") : v);
|
|
549
|
+
}
|
|
550
|
+
const body = req.method !== "GET" && req.method !== "HEAD" ? await new Promise((r) => {
|
|
551
|
+
let data = "";
|
|
552
|
+
req.on("data", (c) => {
|
|
553
|
+
data += c.toString();
|
|
554
|
+
});
|
|
555
|
+
req.on("end", () => r(data));
|
|
556
|
+
}) : void 0;
|
|
557
|
+
const webReq = new Request(`http://localhost:${port}${url}`, { method: req.method, headers, body });
|
|
558
|
+
const webRes = await app4.fetch(webReq);
|
|
559
|
+
res.writeHead(webRes.status, Object.fromEntries(webRes.headers.entries()));
|
|
560
|
+
res.end(Buffer.from(await webRes.arrayBuffer()));
|
|
561
|
+
});
|
|
562
|
+
server.listen(port, () => {
|
|
563
|
+
console.log(`\u{1F310} docs-i18n admin (API only) \u2192 http://localhost:${port}`);
|
|
564
|
+
});
|
|
546
565
|
}
|
|
547
566
|
}
|
|
548
567
|
export {
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-A3YQNPKZ.js";
|
|
2
2
|
import {
|
|
3
3
|
FRONTMATTER_TRANSLATABLE_FIELDS,
|
|
4
4
|
init_parser
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YN4VJHCQ.js";
|
|
6
6
|
import {
|
|
7
7
|
TranslationCache
|
|
8
8
|
} from "./chunk-XEOYZUHS.js";
|
|
9
|
-
import {
|
|
10
|
-
flattenSources
|
|
11
|
-
} from "./chunk-3YNFMSJH.js";
|
|
12
9
|
import {
|
|
13
10
|
__esm,
|
|
14
11
|
__export,
|
|
15
|
-
__toCommonJS
|
|
16
|
-
|
|
12
|
+
__toCommonJS,
|
|
13
|
+
flattenSources
|
|
14
|
+
} from "./chunk-SKKZIV3L.js";
|
|
17
15
|
|
|
18
16
|
// src/core/frontmatter.ts
|
|
19
17
|
var frontmatter_exports = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docs-i18n",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Universal documentation translation engine — parse, translate, cache, assemble, manage.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -27,16 +27,17 @@
|
|
|
27
27
|
"prepublishOnly": "tsup && chmod +x dist/cli.js"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@mdx-js/mdx": "^3.1.1",
|
|
31
|
-
"@tanstack/react-query": "^5.94.5",
|
|
32
30
|
"better-sqlite3": "^12.8.0",
|
|
33
31
|
"glob": "^11.0.2",
|
|
34
32
|
"hono": "^4.12.0",
|
|
35
33
|
"openai": "^5.1.1",
|
|
36
|
-
"react": "^19.2.4",
|
|
37
|
-
"react-dom": "^19.2.4",
|
|
38
34
|
"remark": "^15.0.1",
|
|
39
|
-
"yaml": "^2.8.2"
|
|
35
|
+
"yaml": "^2.8.2",
|
|
36
|
+
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
37
|
+
"@vitejs/plugin-react": "^4.0.0 || ^5.0.0 || ^6.0.0",
|
|
38
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
39
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
40
|
+
"@tanstack/react-query": "^5.0.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@biomejs/biome": "^2.0.0",
|
|
@@ -84,10 +84,30 @@ export async function startAdmin(config: DocsI18nConfig, port = 3456) {
|
|
|
84
84
|
server.listen(port, () => {
|
|
85
85
|
console.log(`🌐 docs-i18n admin → http://localhost:${port}`);
|
|
86
86
|
});
|
|
87
|
-
} catch {
|
|
88
|
-
console.error('Failed to start admin UI (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
} catch (err) {
|
|
88
|
+
console.error('Failed to start admin UI with Vite:', (err as Error).message);
|
|
89
|
+
console.log('Starting API-only mode...');
|
|
90
|
+
// Fallback: Hono on Node http server without Vite
|
|
91
|
+
const server = createServer(async (req, res) => {
|
|
92
|
+
const url = req.url ?? '/';
|
|
93
|
+
const headers = new Headers();
|
|
94
|
+
for (const [k, v] of Object.entries(req.headers)) {
|
|
95
|
+
if (v) headers.set(k, Array.isArray(v) ? v.join(', ') : v);
|
|
96
|
+
}
|
|
97
|
+
const body = req.method !== 'GET' && req.method !== 'HEAD'
|
|
98
|
+
? await new Promise<string>((r) => {
|
|
99
|
+
let data = '';
|
|
100
|
+
req.on('data', (c: Buffer) => { data += c.toString(); });
|
|
101
|
+
req.on('end', () => r(data));
|
|
102
|
+
})
|
|
103
|
+
: undefined;
|
|
104
|
+
const webReq = new Request(`http://localhost:${port}${url}`, { method: req.method, headers, body });
|
|
105
|
+
const webRes = await app.fetch(webReq);
|
|
106
|
+
res.writeHead(webRes.status, Object.fromEntries(webRes.headers.entries()));
|
|
107
|
+
res.end(Buffer.from(await webRes.arrayBuffer()));
|
|
108
|
+
});
|
|
109
|
+
server.listen(port, () => {
|
|
110
|
+
console.log(`🌐 docs-i18n admin (API only) → http://localhost:${port}`);
|
|
111
|
+
});
|
|
92
112
|
}
|
|
93
113
|
}
|
package/dist/build-4EQEL4NI.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createBuilder,
|
|
3
|
-
resolveBuildPlugins
|
|
4
|
-
} from "./chunk-FYDB7MZX.js";
|
|
5
|
-
import "./chunk-PTIH4GGE.js";
|
|
6
|
-
import "./chunk-VKKNQBDN.js";
|
|
7
|
-
import "./chunk-O35QHRY6.js";
|
|
8
|
-
import "./chunk-AKLW2MUS.js";
|
|
9
|
-
export {
|
|
10
|
-
createBuilder,
|
|
11
|
-
resolveBuildPlugins
|
|
12
|
-
};
|