@kurajs/cli 0.0.3 → 0.0.4
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 +6 -1
- package/package.json +9 -5
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
// and never reads the filesystem (Workers-safe; mirrors June's app/_content.ts freeze).
|
|
7
7
|
// A content hash short-circuits re-embedding when nothing changed (cheap to run pre-dev).
|
|
8
8
|
import { buildIndex } from "@kurajs/docs/search";
|
|
9
|
-
import { transformers } from "@kurajs/transformers";
|
|
10
9
|
import fs from "node:fs";
|
|
11
10
|
import path from "node:path";
|
|
12
11
|
import crypto from "node:crypto";
|
|
@@ -73,6 +72,12 @@ async function cmdIndex() {
|
|
|
73
72
|
const localeTag = locales.size ? ` (+${variants.length} variants across ${locales.size} locales)` : "";
|
|
74
73
|
console.log(`kura index: embedding ${DOCS.length} docs${localeTag} (model ${model})…`);
|
|
75
74
|
const t0 = Date.now();
|
|
75
|
+
// Lazy import: only the embed path needs the ML stack, so --no-embed sites never load it
|
|
76
|
+
// (and never install @kurajs/transformers — it's an optional peer).
|
|
77
|
+
const { transformers } = await import("@kurajs/transformers").catch(() => {
|
|
78
|
+
console.error("kura index: embedding needs @kurajs/transformers — install it, or use --no-embed.");
|
|
79
|
+
return process.exit(1);
|
|
80
|
+
});
|
|
76
81
|
const bytes = await buildIndex({ entries: allEntries, embedder: transformers({ model }) });
|
|
77
82
|
const b64 = Buffer.from(bytes).toString("base64");
|
|
78
83
|
fs.writeFileSync(indexTs, stamp +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurajs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Kura CLI — build the docs search index (kura index).",
|
|
6
6
|
"bin": {
|
|
@@ -15,14 +15,18 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@kurajs/core": "^0.0.1",
|
|
18
|
-
"@kurajs/docs": "^0.0.3"
|
|
19
|
-
"@kurajs/transformers": "^0.0.1"
|
|
18
|
+
"@kurajs/docs": "^0.0.3"
|
|
20
19
|
},
|
|
21
20
|
"peerDependencies": {
|
|
22
|
-
"@
|
|
21
|
+
"@kurajs/transformers": "^0.0.1"
|
|
22
|
+
},
|
|
23
|
+
"peerDependenciesMeta": {
|
|
24
|
+
"@kurajs/transformers": {
|
|
25
|
+
"optional": true
|
|
26
|
+
}
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
|
-
"@
|
|
29
|
+
"@kurajs/transformers": "*",
|
|
26
30
|
"typescript": "^5.7.0"
|
|
27
31
|
},
|
|
28
32
|
"author": "Lawrence Lin",
|