@btravstack/core 0.39.0 → 0.40.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/dist/index.cjs +17 -1
- package/dist/index.mjs +17 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -745,6 +745,7 @@ const start = (module, options = {}) => {
|
|
|
745
745
|
return abandoned().map(({ reason, drain }) => reportOf(reason, drain, "stop"));
|
|
746
746
|
};
|
|
747
747
|
const abandoningBuild = Promise.withResolvers();
|
|
748
|
+
let abandonedBuildReason;
|
|
748
749
|
const buildAbandoned = () => (0, unthrown.fromSafePromise)(abandoningBuild.promise).map((reason) => {
|
|
749
750
|
emit({
|
|
750
751
|
type: "stoppedWaiting",
|
|
@@ -757,7 +758,10 @@ const start = (module, options = {}) => {
|
|
|
757
758
|
});
|
|
758
759
|
const abandonBuild = (reason) => {
|
|
759
760
|
const phase = tracker.current();
|
|
760
|
-
if (phase === "building" || phase === "starting" || reason === "uncaught" && startupFailing)
|
|
761
|
+
if (phase === "building" || phase === "starting" || reason === "uncaught" && startupFailing) {
|
|
762
|
+
abandonedBuildReason = reason;
|
|
763
|
+
abandoningBuild.resolve(reason);
|
|
764
|
+
}
|
|
761
765
|
};
|
|
762
766
|
emit({ type: "building" });
|
|
763
767
|
const probesOptions = kernelConfig.map(({ probePort, probeHost }) => options.probes === false ? false : {
|
|
@@ -829,6 +833,10 @@ const start = (module, options = {}) => {
|
|
|
829
833
|
});
|
|
830
834
|
};
|
|
831
835
|
const serve = (ctx) => {
|
|
836
|
+
if (abandonedBuildReason !== void 0) return (0, unthrown.OkAsync)({
|
|
837
|
+
reason: abandonedBuildReason,
|
|
838
|
+
drain: void 0
|
|
839
|
+
});
|
|
832
840
|
tracker.advanceTo("starting");
|
|
833
841
|
const runtime = ctx.get(RuntimePort);
|
|
834
842
|
runtimeName = runtime.name;
|
|
@@ -890,6 +898,14 @@ const start = (module, options = {}) => {
|
|
|
890
898
|
run
|
|
891
899
|
};
|
|
892
900
|
return runtime.start(host).flatMap((serving) => {
|
|
901
|
+
if (abandonedBuildReason !== void 0) {
|
|
902
|
+
registry.abortAll();
|
|
903
|
+
const reason = abandonedBuildReason;
|
|
904
|
+
return serving.stop().map(() => ({
|
|
905
|
+
reason,
|
|
906
|
+
drain: void 0
|
|
907
|
+
}));
|
|
908
|
+
}
|
|
893
909
|
servingInfo = serving.info;
|
|
894
910
|
tracker.advanceTo("serving");
|
|
895
911
|
runtimePublished.resolve(serving.info);
|
package/dist/index.mjs
CHANGED
|
@@ -744,6 +744,7 @@ const start = (module, options = {}) => {
|
|
|
744
744
|
return abandoned().map(({ reason, drain }) => reportOf(reason, drain, "stop"));
|
|
745
745
|
};
|
|
746
746
|
const abandoningBuild = Promise.withResolvers();
|
|
747
|
+
let abandonedBuildReason;
|
|
747
748
|
const buildAbandoned = () => fromSafePromise(abandoningBuild.promise).map((reason) => {
|
|
748
749
|
emit({
|
|
749
750
|
type: "stoppedWaiting",
|
|
@@ -756,7 +757,10 @@ const start = (module, options = {}) => {
|
|
|
756
757
|
});
|
|
757
758
|
const abandonBuild = (reason) => {
|
|
758
759
|
const phase = tracker.current();
|
|
759
|
-
if (phase === "building" || phase === "starting" || reason === "uncaught" && startupFailing)
|
|
760
|
+
if (phase === "building" || phase === "starting" || reason === "uncaught" && startupFailing) {
|
|
761
|
+
abandonedBuildReason = reason;
|
|
762
|
+
abandoningBuild.resolve(reason);
|
|
763
|
+
}
|
|
760
764
|
};
|
|
761
765
|
emit({ type: "building" });
|
|
762
766
|
const probesOptions = kernelConfig.map(({ probePort, probeHost }) => options.probes === false ? false : {
|
|
@@ -828,6 +832,10 @@ const start = (module, options = {}) => {
|
|
|
828
832
|
});
|
|
829
833
|
};
|
|
830
834
|
const serve = (ctx) => {
|
|
835
|
+
if (abandonedBuildReason !== void 0) return OkAsync({
|
|
836
|
+
reason: abandonedBuildReason,
|
|
837
|
+
drain: void 0
|
|
838
|
+
});
|
|
831
839
|
tracker.advanceTo("starting");
|
|
832
840
|
const runtime = ctx.get(RuntimePort);
|
|
833
841
|
runtimeName = runtime.name;
|
|
@@ -889,6 +897,14 @@ const start = (module, options = {}) => {
|
|
|
889
897
|
run
|
|
890
898
|
};
|
|
891
899
|
return runtime.start(host).flatMap((serving) => {
|
|
900
|
+
if (abandonedBuildReason !== void 0) {
|
|
901
|
+
registry.abortAll();
|
|
902
|
+
const reason = abandonedBuildReason;
|
|
903
|
+
return serving.stop().map(() => ({
|
|
904
|
+
reason,
|
|
905
|
+
drain: void 0
|
|
906
|
+
}));
|
|
907
|
+
}
|
|
892
908
|
servingInfo = serving.info;
|
|
893
909
|
tracker.advanceTo("serving");
|
|
894
910
|
runtimePublished.resolve(serving.info);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.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",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"./package.json": "./package.json"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@btravstack/config": "0.
|
|
49
|
-
"@btravstack/di": "0.
|
|
48
|
+
"@btravstack/config": "0.40.0",
|
|
49
|
+
"@btravstack/di": "0.40.0",
|
|
50
50
|
"@btravstack/tsconfig": "0.4.0",
|
|
51
51
|
"@stryker-mutator/core": "10.0.0",
|
|
52
52
|
"@stryker-mutator/vitest-runner": "10.0.0",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"vitest": "5.0.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@btravstack/config": "^0.
|
|
64
|
-
"@btravstack/di": "^0.
|
|
63
|
+
"@btravstack/config": "^0.40.0",
|
|
64
|
+
"@btravstack/di": "^0.40.0",
|
|
65
65
|
"unthrown": "^5.0.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|