@threadedstack/wmd 0.1.76 → 0.1.79
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/bin/run.js +2 -2
- package/index.d.ts +3 -1
- package/index.js +11 -1
- package/package.json +8 -8
package/bin/run.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The wmd, wmdd and wmd-relay commands of @threadedstack/wmd (bin/<name>.js): runs the program of that name from the
|
|
2
2
|
// platform package with the same arguments, stdin, stdout and stderr, and ends with its exit code (or its signal).
|
|
3
3
|
import { spawn } from 'node:child_process'
|
|
4
|
-
import { binPath } from '../index.js'
|
|
4
|
+
import { binPath, childEnv } from '../index.js'
|
|
5
5
|
|
|
6
6
|
export function run(name) {
|
|
7
7
|
let file
|
|
@@ -11,7 +11,7 @@ export function run(name) {
|
|
|
11
11
|
console.error(e.message)
|
|
12
12
|
process.exit(1)
|
|
13
13
|
}
|
|
14
|
-
const child = spawn(file, process.argv.slice(2), { stdio: 'inherit' })
|
|
14
|
+
const child = spawn(file, process.argv.slice(2), { stdio: 'inherit', env: childEnv() })
|
|
15
15
|
// the terminal sends ^C to the whole process group; other signals are passed on
|
|
16
16
|
for (const sig of ['SIGTERM', 'SIGHUP', 'SIGQUIT', 'SIGUSR1', 'SIGUSR2']) process.on(sig, () => child.kill(sig))
|
|
17
17
|
process.on('SIGINT', () => {})
|
package/index.d.ts
CHANGED
|
@@ -15,7 +15,9 @@ export declare function hostLibc(
|
|
|
15
15
|
export declare function platformPackage(platform?: string, arch?: string, libc?: 'glibc' | 'musl' | null): string
|
|
16
16
|
/** The bin folder of this machine's platform package (or of the given platform's). */
|
|
17
17
|
export declare function binDir(platform?: string, arch?: string, libc?: 'glibc' | 'musl' | null): string
|
|
18
|
+
/** The environment the launcher gives a program: env, with WMD_NODE set to the node that runs the launcher when that is Node 24 or newer and env has no WMD_NODE (it runs containers of arm64 images). */
|
|
19
|
+
export declare function childEnv(env?: NodeJS.ProcessEnv, nodeVersion?: string, execPath?: string): NodeJS.ProcessEnv
|
|
18
20
|
/** The path of one program (wmd, wmdd, wmd-run, wmd-relay, wmd-exe-stub, wmd-fixtures-gen, bootlock.sh). */
|
|
19
21
|
export declare function binPath(name?: string): string
|
|
20
|
-
/** The guest files folder of arch (default: this cpu's): arm64 has Image and
|
|
22
|
+
/** The guest files folder of arch (default: this cpu's): arm64 has Image, Image-4k and the files of the unk kernel (unk-kernel.wasm, unk-host.tar.gz, unk-upper.kwsparse.gz), amd64 has bzImage. */
|
|
21
23
|
export declare function guestDir(arch?: string): string
|
package/index.js
CHANGED
|
@@ -72,6 +72,16 @@ export function binDir(platform = process.platform, arch = process.arch, libc =
|
|
|
72
72
|
return join(dirname(pkg), 'bin')
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The environment of the program the launcher runs. Containers of arm64 images run on the unk kernel where Node 24 or newer is (D-733), and the node that
|
|
77
|
+
* runs this launcher may be one the program's PATH does not have: a program started without a WMD_NODE of its own is given this one (the daemon that
|
|
78
|
+
* `wmd setup` installs keeps it).
|
|
79
|
+
*/
|
|
80
|
+
export function childEnv(env = process.env, nodeVersion = process.versions.node, execPath = process.execPath) {
|
|
81
|
+
if (env.WMD_NODE || Number.parseInt(nodeVersion, 10) < 24) return env
|
|
82
|
+
return { ...env, WMD_NODE: execPath }
|
|
83
|
+
}
|
|
84
|
+
|
|
75
85
|
/** The path of one program (see PROGRAMS), executable. */
|
|
76
86
|
export function binPath(name = 'wmd') {
|
|
77
87
|
if (!PROGRAMS.includes(name)) throw new Error(`wmd: ${name} is not one of ${PROGRAMS.join(', ')}`)
|
|
@@ -82,7 +92,7 @@ export function binPath(name = 'wmd') {
|
|
|
82
92
|
return p
|
|
83
93
|
}
|
|
84
94
|
|
|
85
|
-
/** The guest files folder for arch: arm64 has vm.wasm, Image, Image-4k, initramfs.cpio.gz, features, config; amd64 has vm.wasm, bzImage, initramfs.cpio.gz, features, config. */
|
|
95
|
+
/** The guest files folder for arch: arm64 has vm.wasm, Image, Image-4k, initramfs.cpio.gz, features, config and the unk kernel's files (unk-kernel.wasm, unk-host.tar.gz, unk-upper.kwsparse.gz); amd64 has vm.wasm, bzImage, initramfs.cpio.gz, features, config. */
|
|
86
96
|
export function guestDir(arch = hostGuestArch()) {
|
|
87
97
|
const d = join(binDir(), 'guest', arch)
|
|
88
98
|
if (!existsSync(d)) throw new Error(`wmd: this build has no ${arch} guest (${d})`)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threadedstack/wmd",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.79",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/threadedstack/wmd-releases",
|
|
6
6
|
"repository": {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"description": "wmd: a Docker Engine API compatible daemon and CLI that runs Linux containers in WebAssembly",
|
|
11
11
|
"wmd": {
|
|
12
|
-
"tag": "v0.1.
|
|
13
|
-
"commit": "
|
|
12
|
+
"tag": "v0.1.79",
|
|
13
|
+
"commit": "57076d6edff2e99e4c4d431b1bcbdfb95f4c252f"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"node": ">=18"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@threadedstack/wmd-darwin-arm64": "0.1.
|
|
39
|
-
"@threadedstack/wmd-linux-arm64": "0.1.
|
|
40
|
-
"@threadedstack/wmd-linux-x64": "0.1.
|
|
41
|
-
"@threadedstack/wmd-linux-arm64-musl": "0.1.
|
|
42
|
-
"@threadedstack/wmd-linux-x64-musl": "0.1.
|
|
38
|
+
"@threadedstack/wmd-darwin-arm64": "0.1.79",
|
|
39
|
+
"@threadedstack/wmd-linux-arm64": "0.1.79",
|
|
40
|
+
"@threadedstack/wmd-linux-x64": "0.1.79",
|
|
41
|
+
"@threadedstack/wmd-linux-arm64-musl": "0.1.79",
|
|
42
|
+
"@threadedstack/wmd-linux-x64-musl": "0.1.79"
|
|
43
43
|
}
|
|
44
44
|
}
|