@rakay-technology/kraft 0.7.4 → 0.7.5
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/README.md +1 -11
- package/dist/bare-JM3EX7S4.js +27 -0
- package/dist/{chunk-EW4PHKB2.js → chunk-2UQFOUSZ.js} +8 -8
- package/dist/{chunk-WYNM7L22.js → chunk-2Y62WP2D.js} +2 -2
- package/dist/{chunk-N4OALTFK.js → chunk-3RCXJZJD.js} +1 -1
- package/dist/{chunk-PZVKPCKE.js → chunk-4UITBYUK.js} +5 -5
- package/dist/{chunk-DM3PKWDC.js → chunk-7UKBMDUF.js} +9 -9
- package/dist/{chunk-MNV2QFHW.js → chunk-BN23UUSF.js} +1 -1
- package/dist/{chunk-I2TOOF2A.js → chunk-CO6FAYLO.js} +1 -1
- package/dist/{chunk-AJ4QZLZ2.js → chunk-DFVWR6JM.js} +2 -2
- package/dist/{chunk-S3QBGGVP.js → chunk-DI54Y66N.js} +3 -3
- package/dist/{chunk-HMJUFZK7.js → chunk-DJNKEVZ7.js} +1 -1
- package/dist/{chunk-XVKUFMIB.js → chunk-HFOE2IXZ.js} +1 -1
- package/dist/{chunk-RFOBMHQ7.js → chunk-JK7KKBXI.js} +4 -4
- package/dist/{chunk-XGCG4MD5.js → chunk-K24SBFI2.js} +1 -1
- package/dist/{chunk-TAML5WMA.js → chunk-MC4X55BW.js} +3 -3
- package/dist/chunk-ND23EK7Y.js +81645 -0
- package/dist/{chunk-YZUKHG3S.js → chunk-PCOTSRS4.js} +3 -3
- package/dist/{chunk-MOLPYPVH.js → chunk-SPKRI7MF.js} +6 -6
- package/dist/{chunk-JSCZT76F.js → chunk-TCB6MMZZ.js} +10 -8
- package/dist/{chunk-PNNXWA2A.js → chunk-TSDJJP6M.js} +227 -100
- package/dist/{chunk-THTEUDBC.js → chunk-TVURAFJ5.js} +13 -13
- package/dist/{chunk-Y7PVJUXJ.js → chunk-VFPLICBX.js} +6 -6
- package/dist/{chunk-BQMFIXHI.js → chunk-XBGSR22I.js} +5 -5
- package/dist/{chunk-OFXBNFNL.js → chunk-YY5DEAZI.js} +2 -2
- package/dist/{chunk-PNRPKRJU.js → chunk-ZNVAHQRY.js} +6 -6
- package/dist/{chunk-YRSZPVMB.js → chunk-ZQJU5CTZ.js} +1 -1
- package/dist/{detect-676SNZK4.js → detect-N4HFQZ6Y.js} +4 -4
- package/dist/{docker-GOT3Q7DJ.js → docker-DU7JA2AK.js} +8 -8
- package/dist/{docker-edge-executor-VO6JHHW2.js → docker-edge-executor-MPIPQHNF.js} +7 -7
- package/dist/{edge-import-NFCHIW7G.js → edge-import-YDPEIQDU.js} +22 -22
- package/dist/{edge-preflight-QUJ757C6.js → edge-preflight-TT2777R5.js} +13 -13
- package/dist/{ensure-container-edge-Q7IZXHGM.js → ensure-container-edge-T5WRCJSE.js} +11 -11
- package/dist/{executor-GKXKN52K.js → executor-ZWF2J7GS.js} +6 -6
- package/dist/{host-channel-preflight-Z6HYSPKO.js → host-channel-preflight-625L6RNO.js} +22 -22
- package/dist/index.js +310 -86
- package/dist/{local-executor-OMMDKXCM.js → local-executor-W3O5HDLM.js} +3 -3
- package/dist/{nginx-VITTWZZU.js → nginx-XLDZIG4E.js} +9 -9
- package/dist/node-bootstrap.js +66 -32
- package/dist/{openresty-lua-6I3Z6PEQ.js → openresty-lua-ZNE6IBYU.js} +7 -7
- package/dist/{privilege-UQAI2HV4.js → privilege-IMARWVU2.js} +5 -5
- package/dist/server/index.js +58785 -770
- package/dist/{setup-JWKZIECM.js → setup-I3MTOIPW.js} +12 -12
- package/dist/{ssh-client-NWQVRCV7.js → ssh-client-LOCZTEUC.js} +2 -2
- package/dist/{up-P5DMQ5YO.js → up-G7ASYVWR.js} +25 -25
- package/package.json +1 -1
- package/dist/bare-HL2GUYE2.js +0 -27
- package/dist/chunk-PVOWHIND.js +0 -26781
|
@@ -4,9 +4,9 @@ import { createRequire as __ospCreateRequire } from "node:module";
|
|
|
4
4
|
const require = __ospCreateRequire(import.meta.url);
|
|
5
5
|
import {
|
|
6
6
|
LocalExecutor
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-HFOE2IXZ.js";
|
|
8
|
+
import "./chunk-BN23UUSF.js";
|
|
9
|
+
import "./chunk-ND23EK7Y.js";
|
|
10
10
|
import "./chunk-PXKCZB2I.js";
|
|
11
11
|
export {
|
|
12
12
|
LocalExecutor
|
|
@@ -14,18 +14,18 @@ import {
|
|
|
14
14
|
renderProxyOptions,
|
|
15
15
|
renderProxyTlsOptions,
|
|
16
16
|
summarizeCertbotFailure
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VFPLICBX.js";
|
|
18
18
|
import "./chunk-I3DPMTSF.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-PCOTSRS4.js";
|
|
20
20
|
import "./chunk-ZVFS4LUA.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-XBGSR22I.js";
|
|
22
|
+
import "./chunk-2Y62WP2D.js";
|
|
23
|
+
import "./chunk-3RCXJZJD.js";
|
|
24
|
+
import "./chunk-ZQJU5CTZ.js";
|
|
25
|
+
import "./chunk-YY5DEAZI.js";
|
|
26
26
|
import "./chunk-3CJLKL6E.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
27
|
+
import "./chunk-BN23UUSF.js";
|
|
28
|
+
import "./chunk-ND23EK7Y.js";
|
|
29
29
|
import "./chunk-PXKCZB2I.js";
|
|
30
30
|
export {
|
|
31
31
|
MANAGED_STATIC_BASE,
|
package/dist/node-bootstrap.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
// src/node-bootstrap.ts
|
|
2
2
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
3
|
-
import { existsSync as
|
|
4
|
-
import { join as
|
|
3
|
+
import { existsSync as existsSync3 } from "fs";
|
|
4
|
+
import { join as join5 } from "path";
|
|
5
5
|
import { createInterface } from "readline";
|
|
6
6
|
|
|
7
7
|
// src/lib/node-runtime.ts
|
|
8
8
|
import { execFileSync, spawnSync } from "child_process";
|
|
9
9
|
import {
|
|
10
10
|
chmodSync,
|
|
11
|
-
existsSync,
|
|
11
|
+
existsSync as existsSync2,
|
|
12
12
|
lstatSync,
|
|
13
|
-
mkdirSync as
|
|
14
|
-
rmSync,
|
|
13
|
+
mkdirSync as mkdirSync3,
|
|
14
|
+
rmSync as rmSync2,
|
|
15
15
|
symlinkSync,
|
|
16
|
-
writeFileSync
|
|
16
|
+
writeFileSync as writeFileSync2
|
|
17
17
|
} from "fs";
|
|
18
|
-
import { join as
|
|
18
|
+
import { join as join4 } from "path";
|
|
19
19
|
|
|
20
20
|
// src/lib/cache.ts
|
|
21
21
|
import { createHash } from "crypto";
|
|
22
|
-
import { createReadStream, createWriteStream, mkdirSync } from "fs";
|
|
23
|
-
import { dirname, join as
|
|
22
|
+
import { createReadStream, createWriteStream, mkdirSync as mkdirSync2 } from "fs";
|
|
23
|
+
import { dirname, join as join3 } from "path";
|
|
24
24
|
|
|
25
25
|
// src/lib/paths.ts
|
|
26
26
|
import { homedir } from "os";
|
|
@@ -33,13 +33,47 @@ var LOG_DIR = join(OS_DIR, "logs");
|
|
|
33
33
|
var AUTH_SECRET_FILE = join(OS_DIR, "auth-secret");
|
|
34
34
|
var INTERNAL_TOKEN_FILE = join(OS_DIR, "internal-token");
|
|
35
35
|
|
|
36
|
+
// src/lib/github-auth.ts
|
|
37
|
+
import {
|
|
38
|
+
mkdirSync,
|
|
39
|
+
readFileSync,
|
|
40
|
+
rmSync,
|
|
41
|
+
writeFileSync
|
|
42
|
+
} from "fs";
|
|
43
|
+
import { homedir as homedir2 } from "os";
|
|
44
|
+
import { join as join2 } from "path";
|
|
45
|
+
var GITHUB_TOKEN_FILENAME = ".github-token";
|
|
46
|
+
function githubTokenFile(dir = OS_DIR) {
|
|
47
|
+
return join2(dir, GITHUB_TOKEN_FILENAME);
|
|
48
|
+
}
|
|
49
|
+
function envGithubToken() {
|
|
50
|
+
return process.env.GITHUB_TOKEN?.trim() || process.env.GH_TOKEN?.trim() || void 0;
|
|
51
|
+
}
|
|
52
|
+
function readStoredGithubToken(dir = OS_DIR) {
|
|
53
|
+
try {
|
|
54
|
+
const raw = readFileSync(githubTokenFile(dir), "utf8").trim();
|
|
55
|
+
return raw || null;
|
|
56
|
+
} catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function githubToken(dir = OS_DIR) {
|
|
61
|
+
return envGithubToken() ?? readStoredGithubToken(dir) ?? void 0;
|
|
62
|
+
}
|
|
63
|
+
function githubAuthHeaders(dir) {
|
|
64
|
+
const token = dir === void 0 ? githubToken() : githubToken(dir);
|
|
65
|
+
return token ? { Authorization: `Bearer ${token}` } : {};
|
|
66
|
+
}
|
|
67
|
+
|
|
36
68
|
// src/lib/cache.ts
|
|
37
|
-
var CACHE_DIR =
|
|
38
|
-
var RELEASES_DIR =
|
|
69
|
+
var CACHE_DIR = join3(OS_DIR, "cache");
|
|
70
|
+
var RELEASES_DIR = join3(CACHE_DIR, "releases");
|
|
39
71
|
async function downloadToFile(url, dest, onProgress) {
|
|
40
|
-
const res = await fetch(url, {
|
|
72
|
+
const res = await fetch(url, {
|
|
73
|
+
headers: { "User-Agent": "kraft-cli", ...githubAuthHeaders() }
|
|
74
|
+
});
|
|
41
75
|
if (!res.ok || !res.body) throw new Error(`HTTP ${res.status} for ${url}`);
|
|
42
|
-
|
|
76
|
+
mkdirSync2(dirname(dest), { recursive: true });
|
|
43
77
|
const total = Number(res.headers.get("content-length")) || 0;
|
|
44
78
|
const hash = createHash("sha256");
|
|
45
79
|
const file = createWriteStream(dest);
|
|
@@ -69,10 +103,10 @@ async function downloadToFile(url, dest, onProgress) {
|
|
|
69
103
|
// src/lib/node-runtime.ts
|
|
70
104
|
var NODE_MAJOR = 22;
|
|
71
105
|
var NODE_DIST = "https://nodejs.org/dist";
|
|
72
|
-
var RUNTIME_DIR =
|
|
73
|
-
var RUNTIME_CURRENT =
|
|
74
|
-
var BIN_DIR =
|
|
75
|
-
var LAUNCHER_PATH =
|
|
106
|
+
var RUNTIME_DIR = join4(OS_DIR, "runtime");
|
|
107
|
+
var RUNTIME_CURRENT = join4(RUNTIME_DIR, "current");
|
|
108
|
+
var BIN_DIR = join4(OS_DIR, "bin");
|
|
109
|
+
var LAUNCHER_PATH = join4(BIN_DIR, "kraft");
|
|
76
110
|
var LAUNCHER_SH = `#!/bin/sh
|
|
77
111
|
# Kraft CLI launcher \u2014 runs the tarball-installed CLI under Node.
|
|
78
112
|
# Managed by scripts/install.sh and \`kraft update\`; manual edits are overwritten.
|
|
@@ -125,7 +159,7 @@ function majorOf(bin) {
|
|
|
125
159
|
}
|
|
126
160
|
function repoint(link, target) {
|
|
127
161
|
try {
|
|
128
|
-
if (lstatSync(link))
|
|
162
|
+
if (lstatSync(link)) rmSync2(link, { recursive: true, force: true });
|
|
129
163
|
} catch {
|
|
130
164
|
}
|
|
131
165
|
symlinkSync(target, link);
|
|
@@ -149,8 +183,8 @@ async function fetchVendoredNode(onLog) {
|
|
|
149
183
|
const os = nodeDistOs();
|
|
150
184
|
const arch = nodeDistArch();
|
|
151
185
|
const name = `node-${ver}-${os}-${arch}.tar.gz`;
|
|
152
|
-
|
|
153
|
-
const tarball =
|
|
186
|
+
mkdirSync3(RUNTIME_DIR, { recursive: true });
|
|
187
|
+
const tarball = join4(RUNTIME_DIR, name);
|
|
154
188
|
onLog?.(`Fetching Node ${ver} (${os}-${arch}) from nodejs.org\u2026`);
|
|
155
189
|
const { sha256 } = await downloadToFile(
|
|
156
190
|
`${NODE_DIST}/${ver}/${name}`,
|
|
@@ -161,22 +195,22 @@ async function fetchVendoredNode(onLog) {
|
|
|
161
195
|
signal: AbortSignal.timeout(15e3)
|
|
162
196
|
});
|
|
163
197
|
if (!shaRes.ok) {
|
|
164
|
-
|
|
198
|
+
rmSync2(tarball, { force: true });
|
|
165
199
|
throw new Error(`Node checksum list fetch failed: HTTP ${shaRes.status}`);
|
|
166
200
|
}
|
|
167
201
|
const expected = (await shaRes.text()).split("\n").map((l) => l.trim()).find((l) => l.endsWith(` ${name}`) || l.endsWith(` ${name}`))?.split(/\s+/)[0]?.toLowerCase();
|
|
168
202
|
if (!expected) {
|
|
169
|
-
|
|
203
|
+
rmSync2(tarball, { force: true });
|
|
170
204
|
throw new Error(`No checksum for ${name} in SHASUMS256.txt`);
|
|
171
205
|
}
|
|
172
206
|
if (expected !== sha256) {
|
|
173
|
-
|
|
207
|
+
rmSync2(tarball, { force: true });
|
|
174
208
|
throw new Error(
|
|
175
209
|
`Node download checksum mismatch (expected ${expected}, got ${sha256}).`
|
|
176
210
|
);
|
|
177
211
|
}
|
|
178
|
-
const unpacked =
|
|
179
|
-
|
|
212
|
+
const unpacked = join4(RUNTIME_DIR, `node-${ver}-${os}-${arch}`);
|
|
213
|
+
rmSync2(unpacked, { recursive: true, force: true });
|
|
180
214
|
const untar = spawnSync("tar", ["-xzf", tarball, "-C", RUNTIME_DIR], {
|
|
181
215
|
stdio: "inherit"
|
|
182
216
|
});
|
|
@@ -184,9 +218,9 @@ async function fetchVendoredNode(onLog) {
|
|
|
184
218
|
throw new Error(
|
|
185
219
|
"Failed to extract the Node runtime (is `tar` available?)."
|
|
186
220
|
);
|
|
187
|
-
|
|
188
|
-
const nodeBin =
|
|
189
|
-
if (!
|
|
221
|
+
rmSync2(tarball, { force: true });
|
|
222
|
+
const nodeBin = join4(unpacked, "bin", "node");
|
|
223
|
+
if (!existsSync2(nodeBin))
|
|
190
224
|
throw new Error(
|
|
191
225
|
`Node unpacked but ${nodeBin} is missing (unexpected layout).`
|
|
192
226
|
);
|
|
@@ -196,8 +230,8 @@ async function fetchVendoredNode(onLog) {
|
|
|
196
230
|
async function ensureNodeRuntime(onLog) {
|
|
197
231
|
if ((majorOf("node") ?? 0) >= NODE_MAJOR)
|
|
198
232
|
return { node: "node", source: "system" };
|
|
199
|
-
const existing =
|
|
200
|
-
if (
|
|
233
|
+
const existing = join4(RUNTIME_CURRENT, "bin", "node");
|
|
234
|
+
if (existsSync2(existing) && (majorOf(existing) ?? 0) >= NODE_MAJOR) {
|
|
201
235
|
return { node: existing, source: "vendored" };
|
|
202
236
|
}
|
|
203
237
|
return { node: await fetchVendoredNode(onLog), source: "vendored" };
|
|
@@ -206,7 +240,7 @@ async function ensureNodeRuntime(onLog) {
|
|
|
206
240
|
// src/node-bootstrap.ts
|
|
207
241
|
var NODE_REEXEC_ENV = "KRAFT_NODE_REEXEC";
|
|
208
242
|
var VENDOR_ENV = "KRAFT_VENDOR_NODE";
|
|
209
|
-
var vendoredNode = () =>
|
|
243
|
+
var vendoredNode = () => join5(OS_DIR, "runtime", "current", "bin", "node");
|
|
210
244
|
function majorOf2(bin) {
|
|
211
245
|
const out = spawnSync2(
|
|
212
246
|
bin,
|
|
@@ -239,7 +273,7 @@ function ask(question) {
|
|
|
239
273
|
}
|
|
240
274
|
async function recoverOldNode(opts) {
|
|
241
275
|
const existing = vendoredNode();
|
|
242
|
-
if (
|
|
276
|
+
if (existsSync3(existing) && majorOf2(existing) >= NODE_MAJOR) {
|
|
243
277
|
return reexec(existing, opts.cliPath);
|
|
244
278
|
}
|
|
245
279
|
if (!opts.offerDownload) return { handled: false };
|
|
@@ -40,14 +40,14 @@ import {
|
|
|
40
40
|
ensureOpenRestyConfig,
|
|
41
41
|
luaSourceAvailable,
|
|
42
42
|
parseNginxVersion
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
43
|
+
} from "./chunk-XBGSR22I.js";
|
|
44
|
+
import "./chunk-2Y62WP2D.js";
|
|
45
|
+
import "./chunk-3RCXJZJD.js";
|
|
46
|
+
import "./chunk-ZQJU5CTZ.js";
|
|
47
|
+
import "./chunk-YY5DEAZI.js";
|
|
48
48
|
import "./chunk-3CJLKL6E.js";
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-BN23UUSF.js";
|
|
50
|
+
import "./chunk-ND23EK7Y.js";
|
|
51
51
|
import "./chunk-PXKCZB2I.js";
|
|
52
52
|
export {
|
|
53
53
|
ACME_CHALLENGE_LOCATION,
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
privilegedExecutor,
|
|
7
7
|
rootChecked,
|
|
8
8
|
rootOrDegrade
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-DI54Y66N.js";
|
|
10
|
+
import "./chunk-ZQJU5CTZ.js";
|
|
11
|
+
import "./chunk-YY5DEAZI.js";
|
|
12
12
|
import "./chunk-3CJLKL6E.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-BN23UUSF.js";
|
|
14
|
+
import "./chunk-ND23EK7Y.js";
|
|
15
15
|
import "./chunk-PXKCZB2I.js";
|
|
16
16
|
export {
|
|
17
17
|
privilegedExecutor,
|