@spfn/core 0.1.0-alpha.83 → 0.1.0-alpha.84
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/codegen/index.d.ts +5 -0
- package/dist/codegen/index.js +15 -11
- package/dist/codegen/index.js.map +1 -1
- package/dist/events/index.d.ts +183 -0
- package/dist/events/index.js +77 -0
- package/dist/events/index.js.map +1 -0
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/server/index.js +14 -2
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -1
package/dist/codegen/index.d.ts
CHANGED
|
@@ -27,7 +27,12 @@ declare class CodegenOrchestrator {
|
|
|
27
27
|
private readonly debug;
|
|
28
28
|
private isGenerating;
|
|
29
29
|
private pendingRegenerations;
|
|
30
|
+
private watcher?;
|
|
30
31
|
constructor(options: OrchestratorOptions);
|
|
32
|
+
/**
|
|
33
|
+
* Close watcher and cleanup resources
|
|
34
|
+
*/
|
|
35
|
+
close(): Promise<void>;
|
|
31
36
|
/**
|
|
32
37
|
* Check if generator should run for given trigger
|
|
33
38
|
*/
|
package/dist/codegen/index.js
CHANGED
|
@@ -675,11 +675,24 @@ var CodegenOrchestrator = class {
|
|
|
675
675
|
debug;
|
|
676
676
|
isGenerating = false;
|
|
677
677
|
pendingRegenerations = /* @__PURE__ */ new Set();
|
|
678
|
+
watcher;
|
|
678
679
|
constructor(options) {
|
|
679
680
|
this.generators = options.generators;
|
|
680
681
|
this.cwd = options.cwd ?? process.cwd();
|
|
681
682
|
this.debug = options.debug ?? false;
|
|
682
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* Close watcher and cleanup resources
|
|
686
|
+
*/
|
|
687
|
+
async close() {
|
|
688
|
+
if (this.watcher) {
|
|
689
|
+
if (this.debug) {
|
|
690
|
+
orchestratorLogger.info("Closing watcher");
|
|
691
|
+
}
|
|
692
|
+
await this.watcher.close();
|
|
693
|
+
this.watcher = void 0;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
683
696
|
/**
|
|
684
697
|
* Check if generator should run for given trigger
|
|
685
698
|
*/
|
|
@@ -748,7 +761,7 @@ var CodegenOrchestrator = class {
|
|
|
748
761
|
cwd: this.cwd
|
|
749
762
|
});
|
|
750
763
|
}
|
|
751
|
-
|
|
764
|
+
this.watcher = watch(watchDirs, {
|
|
752
765
|
ignored: /(^|[\/\\])\../,
|
|
753
766
|
// ignore dotfiles
|
|
754
767
|
persistent: true,
|
|
@@ -805,16 +818,7 @@ var CodegenOrchestrator = class {
|
|
|
805
818
|
await handleChange(next, "change");
|
|
806
819
|
}
|
|
807
820
|
};
|
|
808
|
-
watcher.on("add", (path) => handleChange(path, "add")).on("change", (path) => handleChange(path, "change")).on("unlink", (path) => handleChange(path, "unlink"));
|
|
809
|
-
process.on("SIGINT", () => {
|
|
810
|
-
if (this.debug) {
|
|
811
|
-
orchestratorLogger.info("Shutting down watch mode");
|
|
812
|
-
}
|
|
813
|
-
watcher.close();
|
|
814
|
-
process.exit(0);
|
|
815
|
-
});
|
|
816
|
-
await new Promise(() => {
|
|
817
|
-
});
|
|
821
|
+
this.watcher.on("add", (path) => handleChange(path, "add")).on("change", (path) => handleChange(path, "change")).on("unlink", (path) => handleChange(path, "unlink"));
|
|
818
822
|
}
|
|
819
823
|
};
|
|
820
824
|
var scannerLogger = logger.child("contract-scanner");
|