docs-i18n 0.2.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docs-i18n",
3
- "version": "0.2.3",
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,18 +27,21 @@
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",
30
+ "better-sqlite3": "^12.8.0",
32
31
  "glob": "^11.0.2",
33
32
  "hono": "^4.12.0",
34
33
  "openai": "^5.1.1",
35
- "react": "^19.2.4",
36
- "react-dom": "^19.2.4",
37
34
  "remark": "^15.0.1",
38
- "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"
39
41
  },
40
42
  "devDependencies": {
41
43
  "@biomejs/biome": "^2.0.0",
44
+ "@types/better-sqlite3": "^7.6.13",
42
45
  "@types/bun": "^1.3.11",
43
46
  "@types/node": "^22.0.0",
44
47
  "@types/react": "^19.2.14",
@@ -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 (vite not available). API-only mode.');
89
- // Fallback: just run Hono without Vite
90
- const server = Bun.serve({ port, fetch: app.fetch });
91
- console.log(`🌐 docs-i18n admin (API only) http://localhost:${port}`);
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
  }