@btravstack/core 0.3.0 → 0.5.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/dist/index.cjs +3 -14
- package/dist/index.mjs +3 -14
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ pnpm add @btravstack/core @btravstack/config @btravstack/di unthrown
|
|
|
16
16
|
|
|
17
17
|
`@btravstack/config`, `@btravstack/di` and `unthrown` are **peer
|
|
18
18
|
dependencies** — install all four. The kernel itself depends on `node:`
|
|
19
|
-
builtins only. Node `>=
|
|
19
|
+
builtins only. Node `>=22`.
|
|
20
20
|
|
|
21
21
|
## A worked example
|
|
22
22
|
|
package/dist/index.cjs
CHANGED
|
@@ -128,17 +128,6 @@ const whenAborted = (signal) => signal.aborted ? (0, unthrown.OkAsync)() : (0, u
|
|
|
128
128
|
signal.addEventListener("abort", () => resolve(), { once: true });
|
|
129
129
|
}));
|
|
130
130
|
//#endregion
|
|
131
|
-
//#region src/deferred.ts
|
|
132
|
-
const createDeferred = () => {
|
|
133
|
-
let resolve;
|
|
134
|
-
return {
|
|
135
|
-
promise: new Promise((r) => {
|
|
136
|
-
resolve = r;
|
|
137
|
-
}),
|
|
138
|
-
resolve
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
//#endregion
|
|
142
131
|
//#region src/drain.ts
|
|
143
132
|
const drainApp = (args) => {
|
|
144
133
|
args.onUnready();
|
|
@@ -334,7 +323,7 @@ const start = (module, options = {}) => {
|
|
|
334
323
|
if (phase === "exited") emit({ type: "exited" });
|
|
335
324
|
});
|
|
336
325
|
const registry = createUnitRegistry();
|
|
337
|
-
const shutdown =
|
|
326
|
+
const shutdown = Promise.withResolvers();
|
|
338
327
|
const teardownErrors = [];
|
|
339
328
|
const startedAt = clock.now();
|
|
340
329
|
const preDrainDelayMs = options.preDrainDelayMs ?? 5e3;
|
|
@@ -370,8 +359,8 @@ const start = (module, options = {}) => {
|
|
|
370
359
|
requestShutdown("uncaught");
|
|
371
360
|
});
|
|
372
361
|
let disposeProbes = () => {};
|
|
373
|
-
const probeBound =
|
|
374
|
-
const runtimePublished =
|
|
362
|
+
const probeBound = Promise.withResolvers();
|
|
363
|
+
const runtimePublished = Promise.withResolvers();
|
|
375
364
|
emit({ type: "building" });
|
|
376
365
|
const probesOptions = options.probes === void 0 ? _btravstack_config.Config.port("PROBE_PORT", { default: 9e3 }).parse(env["PROBE_PORT"]).map((port) => ({ port })).mapErrCases((matcher) => matcher.with(unthrown.P.tag("ConfigFieldInvalid"), ({ reason }) => new RuntimeStartFailed({
|
|
377
366
|
runtime: "probes",
|
package/dist/index.mjs
CHANGED
|
@@ -127,17 +127,6 @@ const whenAborted = (signal) => signal.aborted ? OkAsync() : fromSafePromise(new
|
|
|
127
127
|
signal.addEventListener("abort", () => resolve(), { once: true });
|
|
128
128
|
}));
|
|
129
129
|
//#endregion
|
|
130
|
-
//#region src/deferred.ts
|
|
131
|
-
const createDeferred = () => {
|
|
132
|
-
let resolve;
|
|
133
|
-
return {
|
|
134
|
-
promise: new Promise((r) => {
|
|
135
|
-
resolve = r;
|
|
136
|
-
}),
|
|
137
|
-
resolve
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
//#endregion
|
|
141
130
|
//#region src/drain.ts
|
|
142
131
|
const drainApp = (args) => {
|
|
143
132
|
args.onUnready();
|
|
@@ -333,7 +322,7 @@ const start = (module, options = {}) => {
|
|
|
333
322
|
if (phase === "exited") emit({ type: "exited" });
|
|
334
323
|
});
|
|
335
324
|
const registry = createUnitRegistry();
|
|
336
|
-
const shutdown =
|
|
325
|
+
const shutdown = Promise.withResolvers();
|
|
337
326
|
const teardownErrors = [];
|
|
338
327
|
const startedAt = clock.now();
|
|
339
328
|
const preDrainDelayMs = options.preDrainDelayMs ?? 5e3;
|
|
@@ -369,8 +358,8 @@ const start = (module, options = {}) => {
|
|
|
369
358
|
requestShutdown("uncaught");
|
|
370
359
|
});
|
|
371
360
|
let disposeProbes = () => {};
|
|
372
|
-
const probeBound =
|
|
373
|
-
const runtimePublished =
|
|
361
|
+
const probeBound = Promise.withResolvers();
|
|
362
|
+
const runtimePublished = Promise.withResolvers();
|
|
374
363
|
emit({ type: "building" });
|
|
375
364
|
const probesOptions = options.probes === void 0 ? Config.port("PROBE_PORT", { default: 9e3 }).parse(env["PROBE_PORT"]).map((port) => ({ port })).mapErrCases((matcher) => matcher.with(P.tag("ConfigFieldInvalid"), ({ reason }) => new RuntimeStartFailed({
|
|
376
365
|
runtime: "probes",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "The application kernel: boot a di module into a running process, and stop it without losing work",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"application",
|
|
@@ -53,16 +53,16 @@
|
|
|
53
53
|
"typescript": "7.0.2",
|
|
54
54
|
"unthrown": "5.7.0",
|
|
55
55
|
"vitest": "4.1.11",
|
|
56
|
-
"@btravstack/config": "0.
|
|
57
|
-
"@btravstack/di": "0.
|
|
56
|
+
"@btravstack/config": "0.5.0",
|
|
57
|
+
"@btravstack/di": "0.5.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"unthrown": "^5.0.0",
|
|
61
|
-
"@btravstack/config": "^0.
|
|
62
|
-
"@btravstack/di": "^0.
|
|
61
|
+
"@btravstack/config": "^0.5.0",
|
|
62
|
+
"@btravstack/di": "^0.5.0"
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
|
65
|
-
"node": ">=
|
|
65
|
+
"node": ">=22"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsdown src/index.ts --format cjs,esm --dts --clean --tsconfig tsconfig.build.json",
|