@bun-native/runtime 0.33.11 → 0.34.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/README.md +1 -1
- package/bun-native-source.json +6 -6
- package/package.json +2 -2
- package/src/index.ts +16 -0
package/README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
Bun Native host process lifecycle and bridge runtime.
|
|
4
4
|
|
|
5
|
-
Part of [Bun Native](https://github.com/AndrewM-F/bun-native), an experimental developer preview. Version 0.
|
|
5
|
+
Part of [Bun Native](https://github.com/AndrewM-F/bun-native), an experimental developer preview. Version 0.34.0 was built from [2796520d7849](https://github.com/AndrewM-F/bun-native/tree/2796520d7849194bc215b58a617be820e3bf4505) and published from GitHub Actions with npm provenance. Use the Bun revision pinned in that commit's toolchain.json. Start with the [getting-started guide](https://github.com/AndrewM-F/bun-native/blob/2796520d7849194bc215b58a617be820e3bf4505/docs/getting-started.md); `bun-native host install` fetches the matching release host. The license notice is in LICENSE.
|
package/bun-native-source.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"commit": "
|
|
4
|
-
"tree": "
|
|
3
|
+
"commit": "2796520d7849194bc215b58a617be820e3bf4505",
|
|
4
|
+
"tree": "56d2f4303a50de6bb95ff296d1bb780a11f129a9",
|
|
5
5
|
"files": {
|
|
6
6
|
"package.json": {
|
|
7
|
-
"bytes":
|
|
8
|
-
"sha256": "
|
|
7
|
+
"bytes": 2259,
|
|
8
|
+
"sha256": "0713bd75afb84a486a0042aa34fa0dae28d70f4d742110465ae0e15dff0538df"
|
|
9
9
|
},
|
|
10
10
|
"packages/runtime/package.json": {
|
|
11
11
|
"bytes": 195,
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"sha256": "0c93ad077ad4cfcdf32a8092da1aff6cdc0f65322feadf538768439d67b11e06"
|
|
17
17
|
},
|
|
18
18
|
"packages/runtime/src/index.ts": {
|
|
19
|
-
"bytes":
|
|
20
|
-
"sha256": "
|
|
19
|
+
"bytes": 33329,
|
|
20
|
+
"sha256": "40424b22775f91bde9e70932b2845840c9936d04aa335afb124191b22ca0d8bd"
|
|
21
21
|
},
|
|
22
22
|
"packages/runtime/src/installation.ts": {
|
|
23
23
|
"bytes": 1871,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bun-native/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"exports": "./src/index.ts",
|
|
16
16
|
"description": "Bun Native host process lifecycle and bridge runtime.",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@bun-native/protocol": "0.
|
|
18
|
+
"@bun-native/protocol": "0.34.0"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
package/src/index.ts
CHANGED
|
@@ -349,6 +349,18 @@ const MAX_QUEUED_EVENTS = 128
|
|
|
349
349
|
*/
|
|
350
350
|
export class NativeHost implements AsyncIterable<HostEvent> {
|
|
351
351
|
readonly exited: Promise<number>
|
|
352
|
+
/**
|
|
353
|
+
* In-process launch milestones, in milliseconds on the `performance` clock of
|
|
354
|
+
* the launching process (#678): when `launch` was entered, when the host
|
|
355
|
+
* process had been spawned, and when it acknowledged the protocol handshake.
|
|
356
|
+
* `hi` minus `lo` is the phase duration; `createApplication` adds no work of
|
|
357
|
+
* its own beyond these. Instrumentation only — nothing waits on it.
|
|
358
|
+
*/
|
|
359
|
+
readonly launchPhases: { entryMs: number; spawnedMs: number; helloMs: number } = {
|
|
360
|
+
entryMs: 0,
|
|
361
|
+
spawnedMs: 0,
|
|
362
|
+
helloMs: 0,
|
|
363
|
+
}
|
|
352
364
|
private readonly process: Bun.Subprocess<'pipe', 'pipe', 'pipe'>
|
|
353
365
|
private readonly stdout: ReadableStreamDefaultReader<Uint8Array>
|
|
354
366
|
private readonly stderr: ReadableStreamDefaultReader<Uint8Array>
|
|
@@ -407,6 +419,7 @@ export class NativeHost implements AsyncIterable<HostEvent> {
|
|
|
407
419
|
// (or closed stdin), so the host runs in its own session on POSIX.
|
|
408
420
|
detached: process.platform !== 'win32',
|
|
409
421
|
})
|
|
422
|
+
this.launchPhases.spawnedMs = performance.now()
|
|
410
423
|
this.stdout = this.process.stdout.getReader()
|
|
411
424
|
this.stderr = this.process.stderr.getReader()
|
|
412
425
|
this.exited = this.process.exited
|
|
@@ -427,10 +440,13 @@ export class NativeHost implements AsyncIterable<HostEvent> {
|
|
|
427
440
|
throw new TypeError(
|
|
428
441
|
'Native service arguments are reserved for the explicit permissions option'
|
|
429
442
|
)
|
|
443
|
+
const entryMs = performance.now()
|
|
430
444
|
const host = new NativeHost(options, policy)
|
|
445
|
+
host.launchPhases.entryMs = entryMs
|
|
431
446
|
try {
|
|
432
447
|
await host.request({ type: 'hello', protocol: PROTOCOL_VERSION })
|
|
433
448
|
if (!host.ready) throw new ProtocolError('Host acknowledged hello before protocol readiness')
|
|
449
|
+
host.launchPhases.helloMs = performance.now()
|
|
434
450
|
host.phase = 'running'
|
|
435
451
|
return host
|
|
436
452
|
} catch (error) {
|