@quantform/core 0.7.0-beta.31 → 0.7.0-beta.33
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/cli/dev.js
CHANGED
|
@@ -21,7 +21,7 @@ function default_1(name, options) {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
const script = new script_1.Script(name, [(0, use_execution_mode_1.paperExecutionMode)({ recording: false })]);
|
|
24
|
-
const output = yield script.
|
|
24
|
+
const output = yield script.run();
|
|
25
25
|
console.log(output);
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../src/cli/internal/script.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../src/cli/internal/script.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAU,MAAM,aAAa,CAAC;AAIjD,qBAAa,MAAM;IAEf,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBADZ,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,UAAU,EAAE;IAGvC,GAAG;CAyBV"}
|
|
@@ -43,12 +43,15 @@ class Script {
|
|
|
43
43
|
this.name = name;
|
|
44
44
|
this.dependencies = dependencies;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
run() {
|
|
47
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
48
|
const script = yield Promise.resolve(`${(0, path_1.join)((0, workspace_1.buildDirectory)(), this.name)}`).then(s => __importStar(require(s)));
|
|
49
49
|
const module = new module_1.Module([...(0, core_1.core)(), ...script.onInstall(), ...this.dependencies]);
|
|
50
50
|
const { act } = yield module.awake();
|
|
51
|
-
return yield act(() =>
|
|
51
|
+
return yield act(() => {
|
|
52
|
+
process.stdin.resume();
|
|
53
|
+
return (0, rxjs_1.firstValueFrom)((0, rxjs_1.merge)(script.onAwake().pipe((0, rxjs_1.last)()), (0, rxjs_1.fromEvent)(process, 'exit'), (0, rxjs_1.fromEvent)(process, 'SIGINT'), (0, rxjs_1.fromEvent)(process, 'SIGUSR1'), (0, rxjs_1.fromEvent)(process, 'SIGUSR2'), (0, rxjs_1.fromEvent)(process, 'uncaughtException')).pipe((0, rxjs_1.take)(1), (0, rxjs_1.switchMap)(it => { var _a; return (_a = script.onExit()) !== null && _a !== void 0 ? _a : (0, rxjs_1.of)(it); }), (0, rxjs_1.finalize)(() => process.exit(0))));
|
|
54
|
+
});
|
|
52
55
|
});
|
|
53
56
|
}
|
|
54
57
|
}
|
package/package.json
CHANGED
package/src/cli/dev.ts
CHANGED
|
@@ -9,7 +9,7 @@ export default async function (name: string, options: any) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
const script = new Script(name, [paperExecutionMode({ recording: false })]);
|
|
12
|
-
const output = await script.
|
|
12
|
+
const output = await script.run();
|
|
13
13
|
|
|
14
14
|
console.log(output);
|
|
15
15
|
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { join } from 'path';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
finalize,
|
|
4
|
+
firstValueFrom,
|
|
5
|
+
fromEvent,
|
|
6
|
+
last,
|
|
7
|
+
merge,
|
|
8
|
+
of,
|
|
9
|
+
switchMap,
|
|
10
|
+
take
|
|
11
|
+
} from 'rxjs';
|
|
3
12
|
|
|
4
13
|
import { core } from '@lib/core';
|
|
5
14
|
import { Dependency, Module } from '@lib/module';
|
|
@@ -12,12 +21,29 @@ export class Script {
|
|
|
12
21
|
private readonly dependencies: Dependency[]
|
|
13
22
|
) {}
|
|
14
23
|
|
|
15
|
-
async
|
|
24
|
+
async run() {
|
|
16
25
|
const script = await import(join(buildDirectory(), this.name));
|
|
17
26
|
const module = new Module([...core(), ...script.onInstall(), ...this.dependencies]);
|
|
18
27
|
|
|
19
28
|
const { act } = await module.awake();
|
|
20
29
|
|
|
21
|
-
return await act(() =>
|
|
30
|
+
return await act(() => {
|
|
31
|
+
process.stdin.resume();
|
|
32
|
+
|
|
33
|
+
return firstValueFrom(
|
|
34
|
+
merge(
|
|
35
|
+
script.onAwake().pipe(last()),
|
|
36
|
+
fromEvent(process, 'exit'),
|
|
37
|
+
fromEvent(process, 'SIGINT'),
|
|
38
|
+
fromEvent(process, 'SIGUSR1'),
|
|
39
|
+
fromEvent(process, 'SIGUSR2'),
|
|
40
|
+
fromEvent(process, 'uncaughtException')
|
|
41
|
+
).pipe(
|
|
42
|
+
take(1),
|
|
43
|
+
switchMap(it => script.onExit() ?? of(it)),
|
|
44
|
+
finalize(() => process.exit(0))
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
});
|
|
22
48
|
}
|
|
23
49
|
}
|