@kensio/yulin 1.6.1 → 1.7.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 +72 -0
- package/dist/cli/sim-cli.d.ts +20 -0
- package/dist/cli/sim-cli.d.ts.map +1 -0
- package/dist/cli/sim-cli.js +42 -0
- package/dist/cli/sim-cli.js.map +1 -0
- package/dist/cli/watch/sim-watch-arguments.d.ts +30 -0
- package/dist/cli/watch/sim-watch-arguments.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-arguments.js +67 -0
- package/dist/cli/watch/sim-watch-arguments.js.map +1 -0
- package/dist/cli/watch/sim-watch-child-environment.d.ts +30 -0
- package/dist/cli/watch/sim-watch-child-environment.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-child-environment.js +51 -0
- package/dist/cli/watch/sim-watch-child-environment.js.map +1 -0
- package/dist/cli/watch/sim-watch-child-message.d.ts +19 -0
- package/dist/cli/watch/sim-watch-child-message.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-child-message.js +42 -0
- package/dist/cli/watch/sim-watch-child-message.js.map +1 -0
- package/dist/cli/watch/sim-watch-child-process.d.ts +22 -0
- package/dist/cli/watch/sim-watch-child-process.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-child-process.js +33 -0
- package/dist/cli/watch/sim-watch-child-process.js.map +1 -0
- package/dist/cli/watch/sim-watch-child-shutdown.d.ts +28 -0
- package/dist/cli/watch/sim-watch-child-shutdown.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-child-shutdown.js +59 -0
- package/dist/cli/watch/sim-watch-child-shutdown.js.map +1 -0
- package/dist/cli/watch/sim-watch-child.d.ts +42 -0
- package/dist/cli/watch/sim-watch-child.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-child.js +62 -0
- package/dist/cli/watch/sim-watch-child.js.map +1 -0
- package/dist/cli/watch/sim-watch-command.d.ts +22 -0
- package/dist/cli/watch/sim-watch-command.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-command.js +41 -0
- package/dist/cli/watch/sim-watch-command.js.map +1 -0
- package/dist/cli/watch/sim-watch-event-path.d.ts +27 -0
- package/dist/cli/watch/sim-watch-event-path.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-event-path.js +48 -0
- package/dist/cli/watch/sim-watch-event-path.js.map +1 -0
- package/dist/cli/watch/sim-watch-ignore.d.ts +15 -0
- package/dist/cli/watch/sim-watch-ignore.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-ignore.js +64 -0
- package/dist/cli/watch/sim-watch-ignore.js.map +1 -0
- package/dist/cli/watch/sim-watch-loop-guard.d.ts +35 -0
- package/dist/cli/watch/sim-watch-loop-guard.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-loop-guard.js +51 -0
- package/dist/cli/watch/sim-watch-loop-guard.js.map +1 -0
- package/dist/cli/watch/sim-watch-reporter.d.ts +38 -0
- package/dist/cli/watch/sim-watch-reporter.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-reporter.js +65 -0
- package/dist/cli/watch/sim-watch-reporter.js.map +1 -0
- package/dist/cli/watch/sim-watch-restarts.d.ts +30 -0
- package/dist/cli/watch/sim-watch-restarts.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-restarts.js +62 -0
- package/dist/cli/watch/sim-watch-restarts.js.map +1 -0
- package/dist/cli/watch/sim-watch-supervisor.d.ts +52 -0
- package/dist/cli/watch/sim-watch-supervisor.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-supervisor.js +127 -0
- package/dist/cli/watch/sim-watch-supervisor.js.map +1 -0
- package/dist/cli/watch/sim-watch-watcher.d.ts +69 -0
- package/dist/cli/watch/sim-watch-watcher.d.ts.map +1 -0
- package/dist/cli/watch/sim-watch-watcher.js +144 -0
- package/dist/cli/watch/sim-watch-watcher.js.map +1 -0
- package/dist/cli/yulin.d.ts +3 -0
- package/dist/cli/yulin.d.ts.map +1 -0
- package/dist/cli/yulin.js +14 -0
- package/dist/cli/yulin.js.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-client.d.ts +32 -0
- package/dist/serve/http/live-reload/sim-live-reload-client.d.ts.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-client.js +55 -0
- package/dist/serve/http/live-reload/sim-live-reload-client.js.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-injectable.d.ts +47 -0
- package/dist/serve/http/live-reload/sim-live-reload-injectable.d.ts.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-injectable.js +86 -0
- package/dist/serve/http/live-reload/sim-live-reload-injectable.js.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-injector.d.ts +22 -0
- package/dist/serve/http/live-reload/sim-live-reload-injector.d.ts.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-injector.js +72 -0
- package/dist/serve/http/live-reload/sim-live-reload-injector.js.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-report.d.ts +18 -0
- package/dist/serve/http/live-reload/sim-live-reload-report.d.ts.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-report.js +27 -0
- package/dist/serve/http/live-reload/sim-live-reload-report.js.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-script.d.ts +20 -0
- package/dist/serve/http/live-reload/sim-live-reload-script.d.ts.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload-script.js +45 -0
- package/dist/serve/http/live-reload/sim-live-reload-script.js.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload.config.d.ts +12 -0
- package/dist/serve/http/live-reload/sim-live-reload.config.d.ts.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload.config.js +19 -0
- package/dist/serve/http/live-reload/sim-live-reload.config.js.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload.d.ts +52 -0
- package/dist/serve/http/live-reload/sim-live-reload.d.ts.map +1 -0
- package/dist/serve/http/live-reload/sim-live-reload.js +82 -0
- package/dist/serve/http/live-reload/sim-live-reload.js.map +1 -0
- package/dist/serve/http/live-reload/sim-local-live-reload.d.ts +42 -0
- package/dist/serve/http/live-reload/sim-local-live-reload.d.ts.map +1 -0
- package/dist/serve/http/live-reload/sim-local-live-reload.js +60 -0
- package/dist/serve/http/live-reload/sim-local-live-reload.js.map +1 -0
- package/dist/serve/http/local-server/node-server-port-binder.d.ts +39 -0
- package/dist/serve/http/local-server/node-server-port-binder.d.ts.map +1 -0
- package/dist/serve/http/local-server/node-server-port-binder.js +71 -0
- package/dist/serve/http/local-server/node-server-port-binder.js.map +1 -0
- package/dist/serve/http/local-server/node-server-port.d.ts +10 -0
- package/dist/serve/http/local-server/node-server-port.d.ts.map +1 -0
- package/dist/serve/http/local-server/node-server-port.js +19 -0
- package/dist/serve/http/local-server/node-server-port.js.map +1 -0
- package/dist/serve/http/local-server/sim-aws-local-port.error.d.ts +13 -0
- package/dist/serve/http/local-server/sim-aws-local-port.error.d.ts.map +1 -0
- package/dist/serve/http/local-server/sim-aws-local-port.error.js +16 -0
- package/dist/serve/http/local-server/sim-aws-local-port.error.js.map +1 -0
- package/dist/serve/http/local-server/sim-aws-local-request-handler.d.ts +14 -1
- package/dist/serve/http/local-server/sim-aws-local-request-handler.d.ts.map +1 -1
- package/dist/serve/http/local-server/sim-aws-local-request-handler.js +20 -2
- package/dist/serve/http/local-server/sim-aws-local-request-handler.js.map +1 -1
- package/dist/serve/http/local-server/sim-aws-local-server.d.ts +23 -0
- package/dist/serve/http/local-server/sim-aws-local-server.d.ts.map +1 -1
- package/dist/serve/http/local-server/sim-aws-local-server.js +41 -16
- package/dist/serve/http/local-server/sim-aws-local-server.js.map +1 -1
- package/dist/serve/http/local-server/sim-aws-local.config.d.ts +2 -0
- package/dist/serve/http/local-server/sim-aws-local.config.d.ts.map +1 -1
- package/dist/serve/http/local-server/sim-aws-local.config.js +6 -0
- package/dist/serve/http/local-server/sim-aws-local.config.js.map +1 -1
- package/dist/serve/index.d.ts +3 -0
- package/dist/serve/index.d.ts.map +1 -1
- package/dist/serve/index.js +3 -0
- package/dist/serve/index.js.map +1 -1
- package/dist/service/cloudformation/authorize/sim-cloudformation-authorization.d.ts +44 -0
- package/dist/service/cloudformation/authorize/sim-cloudformation-authorization.d.ts.map +1 -0
- package/dist/service/cloudformation/authorize/sim-cloudformation-authorization.js +53 -0
- package/dist/service/cloudformation/authorize/sim-cloudformation-authorization.js.map +1 -0
- package/dist/service/cloudformation/command/update-stack/update-stack.handler.d.ts +7 -0
- package/dist/service/cloudformation/command/update-stack/update-stack.handler.d.ts.map +1 -1
- package/dist/service/cloudformation/command/update-stack/update-stack.handler.js +3 -1
- package/dist/service/cloudformation/command/update-stack/update-stack.handler.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts +19 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js +40 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-deployer.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-deployment.d.ts +10 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-deployment.d.ts.map +1 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-deployment.js +14 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-deployment.js.map +1 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.d.ts +11 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.d.ts.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.js +5 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-loader.js.map +1 -1
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-updater.d.ts +49 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-updater.d.ts.map +1 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-updater.js +59 -0
- package/dist/service/cloudformation/deploy/sim-cfn-template-file-updater.js.map +1 -0
- package/dist/service/cloudformation/index.d.ts +1 -0
- package/dist/service/cloudformation/index.d.ts.map +1 -1
- package/dist/service/cloudformation/sim-cloudformation.d.ts +30 -5
- package/dist/service/cloudformation/sim-cloudformation.d.ts.map +1 -1
- package/dist/service/cloudformation/sim-cloudformation.js +45 -14
- package/dist/service/cloudformation/sim-cloudformation.js.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.d.ts +10 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.d.ts.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.js +12 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack-resource-operations.js.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts +14 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.d.ts.map +1 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.js +10 -1
- package/dist/service/cloudformation/stack/sim-cfn-stack.js.map +1 -1
- package/dist/service/cloudformation/stack/update/sim-cfn-stack-updater.d.ts +8 -0
- package/dist/service/cloudformation/stack/update/sim-cfn-stack-updater.d.ts.map +1 -1
- package/dist/service/cloudformation/stack/update/sim-cfn-stack-updater.js +9 -1
- package/dist/service/cloudformation/stack/update/sim-cfn-stack-updater.js.map +1 -1
- package/dist/service/cloudformation/watch/sim-cfn-template-file-events.d.ts +30 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-events.d.ts.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-events.js +51 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-events.js.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-watch.d.ts +39 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-watch.d.ts.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-watch.js +73 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-watch.js.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-watches.d.ts +46 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-watches.d.ts.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-watches.js +0 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-file-watches.js.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch-report.d.ts +25 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch-report.d.ts.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch-report.js +35 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch-report.js.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch-update.d.ts +44 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch-update.d.ts.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch-update.js +75 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch-update.js.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch.type.d.ts +30 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch.type.d.ts.map +1 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch.type.js +2 -0
- package/dist/service/cloudformation/watch/sim-cfn-template-watch.type.js.map +1 -0
- package/dist/service/s3/bucket/sim-s3-bucket-access.d.ts +4 -0
- package/dist/service/s3/bucket/sim-s3-bucket-access.d.ts.map +1 -1
- package/dist/service/s3/bucket/sim-s3-bucket-access.js +6 -0
- package/dist/service/s3/bucket/sim-s3-bucket-access.js.map +1 -1
- package/dist/watch/sim-watch-runtime.d.ts +76 -0
- package/dist/watch/sim-watch-runtime.d.ts.map +1 -0
- package/dist/watch/sim-watch-runtime.js +124 -0
- package/dist/watch/sim-watch-runtime.js.map +1 -0
- package/dist/watch/sim-watch-settle.d.ts +32 -0
- package/dist/watch/sim-watch-settle.d.ts.map +1 -0
- package/dist/watch/sim-watch-settle.js +43 -0
- package/dist/watch/sim-watch-settle.js.map +1 -0
- package/dist/watch/sim-watch.config.d.ts +22 -0
- package/dist/watch/sim-watch.config.d.ts.map +1 -0
- package/dist/watch/sim-watch.config.js +39 -0
- package/dist/watch/sim-watch.config.js.map +1 -0
- package/package.json +4 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-template-file-watches.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/watch/sim-cfn-template-file-watches.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,6CAA6C,EAAE,MAAM,2CAA2C,CAAC;AAC/G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAG7F,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAEvF,UAAU,mCAAmC;IAC3C,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC;CAC9C;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwC;IAEhE,YAAY,UAAU,EAAE,mCAAmC,EAE1D;IAED;;OAEG;IACH,YAAY,CACV,UAAU,EAAE,6CAA6C,GACxD,IAAI,CAMN;IAED;;OAEG;IACH,GAAG,CACD,UAAU,EAAE,6CAA6C,EACzD,OAAO,EAAE,8BAA8B,GACtC,IAAI,CAsBN;IAED;;;;;OAKG;IACH,KAAK,IAAI,SAAS,MAAM,EAAE,CAIzB;IAED;;OAEG;IACH,OAAO,IAAI,IAAI,CAMd;IAED,OAAO,CAAC,MAAM;CAIf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-template-file-watches.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/watch/sim-cfn-template-file-watches.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAO/E;;;;;;;;;;;;GAYG;AAC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,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;SACzE,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,OAAO;QACL,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAEO,MAAM,CAAC,aAAqB;QAClC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;QAC/C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;CACF;AAOD;;;;;;GAMG;AACH,SAAS,QAAQ,CAAC,YAAoB,EAAE,SAA6B;IACnE,OAAO,GAAG,YAAY,IAAI,SAAS,IAAI,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CACnB,KAA2D;IAE3D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QAC3C,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Says why a watched template could not be applied.
|
|
3
|
+
*
|
|
4
|
+
* A failed update leaves the Stack where the update got to, and the process
|
|
5
|
+
* serving it still up, which is the reason to update in place rather than
|
|
6
|
+
* restart. That is only useful if the reason it failed is somewhere the person
|
|
7
|
+
* who saved the file will see it.
|
|
8
|
+
*
|
|
9
|
+
* It goes to the console because the simulator has no logger of its own, the
|
|
10
|
+
* same as every other warning it raises.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SimCfnTemplateWatchReport {
|
|
13
|
+
/**
|
|
14
|
+
* Report an update the changed template file did not survive.
|
|
15
|
+
*/
|
|
16
|
+
failed(templatePath: string, error: Error): void;
|
|
17
|
+
/**
|
|
18
|
+
* Report a callback the watch was given that threw.
|
|
19
|
+
*
|
|
20
|
+
* Said separately from a failed update, because what went wrong is whatever
|
|
21
|
+
* was meant to happen about the update rather than the update itself.
|
|
22
|
+
*/
|
|
23
|
+
listenerFailed(templatePath: string, listener: string, error: Error): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=sim-cfn-template-watch-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-template-watch-report.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/watch/sim-cfn-template-watch-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,yBAAyB;IACpC;;OAEG;IACH,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAQ/C;IAED;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAMzE;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Says why a watched template could not be applied.
|
|
3
|
+
*
|
|
4
|
+
* A failed update leaves the Stack where the update got to, and the process
|
|
5
|
+
* serving it still up, which is the reason to update in place rather than
|
|
6
|
+
* restart. That is only useful if the reason it failed is somewhere the person
|
|
7
|
+
* who saved the file will see it.
|
|
8
|
+
*
|
|
9
|
+
* It goes to the console because the simulator has no logger of its own, the
|
|
10
|
+
* same as every other warning it raises.
|
|
11
|
+
*/
|
|
12
|
+
export class SimCfnTemplateWatchReport {
|
|
13
|
+
/**
|
|
14
|
+
* Report an update the changed template file did not survive.
|
|
15
|
+
*/
|
|
16
|
+
failed(templatePath, error) {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.warn(`Simulated CloudFormation could not apply the changed template ` +
|
|
19
|
+
`${templatePath}: ${error.message}. The Stack is left where the ` +
|
|
20
|
+
`update got to, since there is no rollback to the template it was ` +
|
|
21
|
+
`deployed from.`);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Report a callback the watch was given that threw.
|
|
25
|
+
*
|
|
26
|
+
* Said separately from a failed update, because what went wrong is whatever
|
|
27
|
+
* was meant to happen about the update rather than the update itself.
|
|
28
|
+
*/
|
|
29
|
+
listenerFailed(templatePath, listener, error) {
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
|
+
console.warn(`Simulated CloudFormation ran the ${listener} callback for the watched ` +
|
|
32
|
+
`template ${templatePath}, and it threw: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=sim-cfn-template-watch-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-template-watch-report.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/watch/sim-cfn-template-watch-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,yBAAyB;IACpC;;OAEG;IACH,MAAM,CAAC,YAAoB,EAAE,KAAY;QACvC,sCAAsC;QACtC,OAAO,CAAC,IAAI,CACV,gEAAgE;YAC9D,GAAG,YAAY,KAAK,KAAK,CAAC,OAAO,gCAAgC;YACjE,mEAAmE;YACnE,gBAAgB,CACnB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,YAAoB,EAAE,QAAgB,EAAE,KAAY;QACjE,sCAAsC;QACtC,OAAO,CAAC,IAAI,CACV,oCAAoC,QAAQ,4BAA4B;YACtE,YAAY,YAAY,mBAAmB,KAAK,CAAC,OAAO,EAAE,CAC7D,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SimCloudFormationDeployTemplateFileProperties } from "../deploy/sim-cfn-template-file-loader.js";
|
|
2
|
+
import type { SimCfnTemplateFileUpdating } from "../deploy/sim-cfn-template-file-updater.js";
|
|
3
|
+
import { SimCfnTemplateWatchReport } from "./sim-cfn-template-watch-report.js";
|
|
4
|
+
import type { SimCfnTemplateFileWatchOptions } from "./sim-cfn-template-watch.type.js";
|
|
5
|
+
interface SimCfnTemplateWatchUpdateProperties {
|
|
6
|
+
readonly templatePath: string;
|
|
7
|
+
readonly deployment: SimCloudFormationDeployTemplateFileProperties;
|
|
8
|
+
readonly updater: SimCfnTemplateFileUpdating;
|
|
9
|
+
readonly options: SimCfnTemplateFileWatchOptions;
|
|
10
|
+
readonly report?: SimCfnTemplateWatchReport | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One application of a changed template file, and what to make of how it went.
|
|
14
|
+
*
|
|
15
|
+
* Three things can come of a save, and only one of them is an update. A file
|
|
16
|
+
* written without being changed is refused by the Stack and is a no-op here,
|
|
17
|
+
* since a template is written far more often than it is changed. An update that
|
|
18
|
+
* failed is reported and left there: the Stack keeps the Resources it had, and
|
|
19
|
+
* a browser looking at them is not told anything changed, because nothing did.
|
|
20
|
+
*
|
|
21
|
+
* Nothing thrown gets past this, because the watch applies changes one after
|
|
22
|
+
* another and a rejection would stop it applying any more.
|
|
23
|
+
*/
|
|
24
|
+
export declare class SimCfnTemplateWatchUpdate {
|
|
25
|
+
private readonly properties;
|
|
26
|
+
private readonly report;
|
|
27
|
+
constructor(properties: SimCfnTemplateWatchUpdateProperties);
|
|
28
|
+
/**
|
|
29
|
+
* Apply the template file to its Stack, and answer for the result.
|
|
30
|
+
*/
|
|
31
|
+
apply(): Promise<void>;
|
|
32
|
+
private refused;
|
|
33
|
+
private updated;
|
|
34
|
+
/**
|
|
35
|
+
* Run a callback the watch was given, without letting it break the watch.
|
|
36
|
+
*
|
|
37
|
+
* A callback that throws is the caller's own code failing, and it says so
|
|
38
|
+
* rather than being passed on: a throw from here would go on to be the
|
|
39
|
+
* rejection that stops every save after it being applied.
|
|
40
|
+
*/
|
|
41
|
+
private notify;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=sim-cfn-template-watch-update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-template-watch-update.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/watch/sim-cfn-template-watch-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6CAA6C,EAAE,MAAM,2CAA2C,CAAC;AAC/G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAEvF,UAAU,mCAAmC;IAC3C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,6CAA6C,CAAC;IACnE,QAAQ,CAAC,OAAO,EAAE,0BAA0B,CAAC;IAC7C,QAAQ,CAAC,OAAO,EAAE,8BAA8B,CAAC;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,yBAAyB,GAAG,SAAS,CAAC;CACzD;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAsC;IACjE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IAEnD,YAAY,UAAU,EAAE,mCAAmC,EAG1D;IAED;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAY3B;IAED,OAAO,CAAC,OAAO;IAkBf,OAAO,CAAC,OAAO;IAIf;;;;;;OAMG;IACH,OAAO,CAAC,MAAM;CAWf"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { simCfnNoUpdatesMessage } from "../stack/update/sim-cfn-stack-updater.js";
|
|
2
|
+
import { SimCfnTemplateWatchReport } from "./sim-cfn-template-watch-report.js";
|
|
3
|
+
/**
|
|
4
|
+
* One application of a changed template file, and what to make of how it went.
|
|
5
|
+
*
|
|
6
|
+
* Three things can come of a save, and only one of them is an update. A file
|
|
7
|
+
* written without being changed is refused by the Stack and is a no-op here,
|
|
8
|
+
* since a template is written far more often than it is changed. An update that
|
|
9
|
+
* failed is reported and left there: the Stack keeps the Resources it had, and
|
|
10
|
+
* a browser looking at them is not told anything changed, because nothing did.
|
|
11
|
+
*
|
|
12
|
+
* Nothing thrown gets past this, because the watch applies changes one after
|
|
13
|
+
* another and a rejection would stop it applying any more.
|
|
14
|
+
*/
|
|
15
|
+
export class SimCfnTemplateWatchUpdate {
|
|
16
|
+
properties;
|
|
17
|
+
report;
|
|
18
|
+
constructor(properties) {
|
|
19
|
+
this.properties = properties;
|
|
20
|
+
this.report = properties.report ?? new SimCfnTemplateWatchReport();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Apply the template file to its Stack, and answer for the result.
|
|
24
|
+
*/
|
|
25
|
+
async apply() {
|
|
26
|
+
const { deployment, updater } = this.properties;
|
|
27
|
+
try {
|
|
28
|
+
await updater.update(deployment);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
this.refused(watchUpdateError(error));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.updated();
|
|
35
|
+
}
|
|
36
|
+
refused(error) {
|
|
37
|
+
if (error.message === simCfnNoUpdatesMessage) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const { templatePath, options } = this.properties;
|
|
41
|
+
if (options.onFailed === undefined) {
|
|
42
|
+
this.report.failed(templatePath, error);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.notify("onFailed", () => {
|
|
46
|
+
options.onFailed?.(error);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
updated() {
|
|
50
|
+
this.notify("onUpdated", this.properties.options.onUpdated);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Run a callback the watch was given, without letting it break the watch.
|
|
54
|
+
*
|
|
55
|
+
* A callback that throws is the caller's own code failing, and it says so
|
|
56
|
+
* rather than being passed on: a throw from here would go on to be the
|
|
57
|
+
* rejection that stops every save after it being applied.
|
|
58
|
+
*/
|
|
59
|
+
notify(listener, run) {
|
|
60
|
+
try {
|
|
61
|
+
run?.();
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
this.report.listenerFailed(this.properties.templatePath, listener, watchUpdateError(error));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function watchUpdateError(error) {
|
|
69
|
+
if (error instanceof Error) {
|
|
70
|
+
return error;
|
|
71
|
+
}
|
|
72
|
+
/* v8 ignore next -- redundant fallback */
|
|
73
|
+
return new Error(String(error));
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=sim-cfn-template-watch-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-template-watch-update.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/watch/sim-cfn-template-watch-update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAW/E;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,yBAAyB;IACnB,UAAU,CAAsC;IAChD,MAAM,CAA4B;IAEnD,YAAY,UAA+C;QACzD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,IAAI,yBAAyB,EAAE,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,UAAU,C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AAO,KAAK,CAAC;IACf,CAAC;IAED,0CAA0C;IAC1C,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What to do about a deployed template file that changes.
|
|
3
|
+
*/
|
|
4
|
+
export interface SimCfnTemplateFileWatchOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Run once the Stack has finished being updated from the changed file.
|
|
7
|
+
*
|
|
8
|
+
* This is where a served page gets reloaded, with `srv.reload()`. It runs
|
|
9
|
+
* when the update is complete rather than when the write lands, so a browser
|
|
10
|
+
* reloads onto the Resources the new template asked for.
|
|
11
|
+
*/
|
|
12
|
+
readonly onUpdated?: (() => void) | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Handle an update the changed template did not survive.
|
|
15
|
+
*
|
|
16
|
+
* The Stack is left where the update got to either way, since there is no
|
|
17
|
+
* rollback. Without this the reason goes to the console, so a failure is not
|
|
18
|
+
* silent; with it, the reason is yours to deal with and nothing is written.
|
|
19
|
+
*/
|
|
20
|
+
readonly onFailed?: ((error: Error) => void) | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* How long the writes have to stop for before the file counts as changed, in
|
|
23
|
+
* milliseconds.
|
|
24
|
+
*
|
|
25
|
+
* One save is several writes, so a wait is what makes one save one update.
|
|
26
|
+
* The default suits an editor saving a file and a `cdk synth` writing one.
|
|
27
|
+
*/
|
|
28
|
+
readonly settleMs?: number | undefined;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=sim-cfn-template-watch.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-template-watch.type.d.ts","sourceRoot":"","sources":["../../../../src/service/cloudformation/watch/sim-cfn-template-watch.type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAE9C;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAEzD;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-cfn-template-watch.type.js","sourceRoot":"","sources":["../../../../src/service/cloudformation/watch/sim-cfn-template-watch.type.ts"],"names":[],"mappings":""}
|
|
@@ -30,6 +30,10 @@ export declare class SimS3BucketAccess {
|
|
|
30
30
|
websiteUrl(bucketName: SimS3BucketName | string): URL;
|
|
31
31
|
/**
|
|
32
32
|
* Have a Bucket use a local filesystem directory for storage.
|
|
33
|
+
*
|
|
34
|
+
* The directory is named to a `yulin watch` supervisor, so editing a file the
|
|
35
|
+
* Bucket serves restarts the process without the directory having been listed
|
|
36
|
+
* anywhere. Nothing happens outside watch mode.
|
|
33
37
|
*/
|
|
34
38
|
mountFilesystem(bucketName: SimS3BucketName | string, directoryPath: string): void;
|
|
35
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-s3-bucket-access.d.ts","sourceRoot":"","sources":["../../../../src/service/s3/bucket/sim-s3-bucket-access.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAG1F,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-s3-bucket-access.d.ts","sourceRoot":"","sources":["../../../../src/service/s3/bucket/sim-s3-bucket-access.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAG1F,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGvE,UAAU,2BAA2B;IACnC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAC5D,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;CACvD;AAED;;;;;;;GAOG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4C;IACpE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA2B;IAE9D,YAAY,UAAU,EAAE,2BAA2B,EAGlD;IAED;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM,GAAG,WAAW,CAK1D;IAED;;OAEG;IACH,GAAG,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM,GAAG,GAAG,CAK7C;IAED;;OAEG;IACH,UAAU,CAAC,UAAU,EAAE,eAAe,GAAG,MAAM,GAAG,GAAG,CAEpD;IAED;;;;;;OAMG;IACH,eAAe,CACb,UAAU,EAAE,eAAe,GAAG,MAAM,EACpC,aAAa,EAAE,MAAM,GACpB,IAAI,CAKN;CACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { assertDefined } from "../../../util/type-guard/defined.js";
|
|
2
2
|
import { FilesystemS3BucketStorage } from "../storage/filesystem/s3-filesystem-storage.js";
|
|
3
3
|
import { simS3BucketUrl } from "./sim-s3-endpoint-url.js";
|
|
4
|
+
import { simWatch } from "../../../watch/sim-watch-runtime.js";
|
|
4
5
|
/**
|
|
5
6
|
* Reaching a Bucket in one simulated S3 scope by name.
|
|
6
7
|
*
|
|
@@ -38,9 +39,14 @@ export class SimS3BucketAccess {
|
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Have a Bucket use a local filesystem directory for storage.
|
|
42
|
+
*
|
|
43
|
+
* The directory is named to a `yulin watch` supervisor, so editing a file the
|
|
44
|
+
* Bucket serves restarts the process without the directory having been listed
|
|
45
|
+
* anywhere. Nothing happens outside watch mode.
|
|
41
46
|
*/
|
|
42
47
|
mountFilesystem(bucketName, directoryPath) {
|
|
43
48
|
this.required(bucketName).configureSimStorage(new FilesystemS3BucketStorage({ directoryPath }));
|
|
49
|
+
simWatch.reportPath(directoryPath);
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
//# sourceMappingURL=sim-s3-bucket-access.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sim-s3-bucket-access.js","sourceRoot":"","sources":["../../../../src/service/s3/bucket/sim-s3-bucket-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"sim-s3-bucket-access.js","sourceRoot":"","sources":["../../../../src/service/s3/bucket/sim-s3-bucket-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAO/D;;;;;;;GAOG;AACH,MAAM,OAAO,iBAAiB;IACX,OAAO,CAA4C;IACnD,kBAAkB,CAA2B;IAE9D,YAAY,UAAuC;QACjD,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAClC,IAAI,CAAC,kBAAkB,GAAG,UAAU,CAAC,kBAAkB,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,UAAoC;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAA6B,CAAC,CAAC;QAC/D,aAAa,CAAC,MAAM,EAAE,uBAAuB,UAAU,EAAE,CAAC,CAAC;QAE3D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,UAAoC;QACtC,OAAO,cAAc,CACnB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,UAAU,EACpC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CACnC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,UAAoC;QAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,aAAa,EAAE,CAAC;IACnD,CAAC;IAED;;;;;;OAMG;IACH,eAAe,CACb,UAAoC,EACpC,aAAqB;QAErB,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,mBAAmB,CAC3C,IAAI,yBAAyB,CAAC,EAAE,aAAa,EAAE,CAAC,CACjD,CAAC;QACF,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
type SimWatchStoppingListener = () => void;
|
|
2
|
+
type SimWatchMessageListener = (message: unknown) => void;
|
|
3
|
+
/**
|
|
4
|
+
* The part of the running process this needs, so a test can stand in for it
|
|
5
|
+
* without touching the process its own test runner is talking over.
|
|
6
|
+
*/
|
|
7
|
+
export interface SimWatchProcess {
|
|
8
|
+
readonly env: NodeJS.ProcessEnv;
|
|
9
|
+
readonly send?: ((message: unknown) => boolean) | undefined;
|
|
10
|
+
on(event: "message", listener: SimWatchMessageListener): unknown;
|
|
11
|
+
off(event: "message", listener: SimWatchMessageListener): unknown;
|
|
12
|
+
}
|
|
13
|
+
interface SimWatchRuntimeProperties {
|
|
14
|
+
readonly host?: SimWatchProcess;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The half of watch mode that lives in the supervised process.
|
|
18
|
+
*
|
|
19
|
+
* It is inert unless `yulin watch` started this process, so nothing here
|
|
20
|
+
* changes what a test run or an ordinary script does. Under a supervisor it
|
|
21
|
+
* does two things: it names the paths Yulin is reading, so the supervisor can
|
|
22
|
+
* watch them without the user listing paths Yulin is already holding, and it
|
|
23
|
+
* passes on the warning that a restart is coming, so a served page hears about
|
|
24
|
+
* it before the connection goes.
|
|
25
|
+
*/
|
|
26
|
+
export declare class SimWatchRuntime {
|
|
27
|
+
private readonly host;
|
|
28
|
+
private readonly stoppingListeners;
|
|
29
|
+
private listening;
|
|
30
|
+
private readonly onMessage;
|
|
31
|
+
constructor(properties?: SimWatchRuntimeProperties);
|
|
32
|
+
/**
|
|
33
|
+
* Whether a `yulin watch` supervisor started this process.
|
|
34
|
+
*/
|
|
35
|
+
supervised(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Name a path the supervisor should watch, such as a directory mounted into a
|
|
38
|
+
* Bucket or a synthesized template being deployed.
|
|
39
|
+
*
|
|
40
|
+
* Best effort by design. Nothing depends on the message arriving, and a
|
|
41
|
+
* process with no supervisor drops it.
|
|
42
|
+
*/
|
|
43
|
+
reportPath(reportedPath: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Name a path this process is watching itself, and answering without needing
|
|
46
|
+
* a restart, such as a deployed template being updated in place.
|
|
47
|
+
*
|
|
48
|
+
* The supervisor leaves it alone from then on. Being told that a path is
|
|
49
|
+
* handled here is more specific than any rule the supervisor has about which
|
|
50
|
+
* paths are worth restarting for, so it wins over having reported the same
|
|
51
|
+
* path for watching.
|
|
52
|
+
*
|
|
53
|
+
* Best effort, as reportPath is: a process with no supervisor drops it.
|
|
54
|
+
*/
|
|
55
|
+
reportHeldPath(heldPath: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Run something when the supervisor says this process is about to restart.
|
|
58
|
+
*/
|
|
59
|
+
onStopping(listener: SimWatchStoppingListener): void;
|
|
60
|
+
/**
|
|
61
|
+
* Stop running something on a restart.
|
|
62
|
+
*/
|
|
63
|
+
offStopping(listener: SimWatchStoppingListener): void;
|
|
64
|
+
private listen;
|
|
65
|
+
private unlisten;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The watch runtime for this process.
|
|
69
|
+
*
|
|
70
|
+
* One per process rather than one per `SimAws`, because it is about the process
|
|
71
|
+
* a supervisor started, not about any one simulated environment. Several
|
|
72
|
+
* simulations in the same process all report to the same supervisor.
|
|
73
|
+
*/
|
|
74
|
+
export declare const simWatch: SimWatchRuntime;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=sim-watch-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-watch-runtime.d.ts","sourceRoot":"","sources":["../../src/watch/sim-watch-runtime.ts"],"names":[],"mappings":"AAGA,KAAK,wBAAwB,GAAG,MAAM,IAAI,CAAC;AAC3C,KAAK,uBAAuB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAC5D,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,uBAAuB,GAAG,OAAO,CAAC;IACjE,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,uBAAuB,GAAG,OAAO,CAAC;CACnE;AAED,UAAU,yBAAyB;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAuC;IACzE,OAAO,CAAC,SAAS,CAAS;IAE1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAYxB;IAEF,YAAY,UAAU,GAAE,yBAA8B,EAGrD;IAED;;OAEG;IACH,UAAU,IAAI,OAAO,CAMpB;IAED;;;;;;OAMG;IACH,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CASrC;IAED;;;;;;;;;;OAUG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CASrC;IAED;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,wBAAwB,GAAG,IAAI,CAOnD;IAED;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,wBAAwB,GAAG,IAAI,CAMpD;IAED,OAAO,CAAC,MAAM;IASd,OAAO,CAAC,QAAQ;CAQjB;AAWD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,iBAAwB,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { simWatchConfig, simWatchMessages } from "./sim-watch.config.js";
|
|
3
|
+
/**
|
|
4
|
+
* The half of watch mode that lives in the supervised process.
|
|
5
|
+
*
|
|
6
|
+
* It is inert unless `yulin watch` started this process, so nothing here
|
|
7
|
+
* changes what a test run or an ordinary script does. Under a supervisor it
|
|
8
|
+
* does two things: it names the paths Yulin is reading, so the supervisor can
|
|
9
|
+
* watch them without the user listing paths Yulin is already holding, and it
|
|
10
|
+
* passes on the warning that a restart is coming, so a served page hears about
|
|
11
|
+
* it before the connection goes.
|
|
12
|
+
*/
|
|
13
|
+
export class SimWatchRuntime {
|
|
14
|
+
host;
|
|
15
|
+
stoppingListeners = new Set();
|
|
16
|
+
listening = false;
|
|
17
|
+
onMessage = (message) => {
|
|
18
|
+
if (!isStoppingMessage(message)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
for (const listener of this.stoppingListeners) {
|
|
22
|
+
listener();
|
|
23
|
+
}
|
|
24
|
+
// The supervisor waits for this before killing the process, so whatever the
|
|
25
|
+
// listeners wrote has left this end first.
|
|
26
|
+
this.host.send?.({ type: simWatchMessages.stopped });
|
|
27
|
+
};
|
|
28
|
+
constructor(properties = {}) {
|
|
29
|
+
const { host = process } = properties;
|
|
30
|
+
this.host = host;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Whether a `yulin watch` supervisor started this process.
|
|
34
|
+
*/
|
|
35
|
+
supervised() {
|
|
36
|
+
return (this.host.env[simWatchConfig.environmentVariableName] ===
|
|
37
|
+
simWatchConfig.environmentVariableValue &&
|
|
38
|
+
typeof this.host.send === "function");
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Name a path the supervisor should watch, such as a directory mounted into a
|
|
42
|
+
* Bucket or a synthesized template being deployed.
|
|
43
|
+
*
|
|
44
|
+
* Best effort by design. Nothing depends on the message arriving, and a
|
|
45
|
+
* process with no supervisor drops it.
|
|
46
|
+
*/
|
|
47
|
+
reportPath(reportedPath) {
|
|
48
|
+
if (!this.supervised()) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.host.send?.({
|
|
52
|
+
type: simWatchMessages.path,
|
|
53
|
+
path: path.resolve(reportedPath),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Name a path this process is watching itself, and answering without needing
|
|
58
|
+
* a restart, such as a deployed template being updated in place.
|
|
59
|
+
*
|
|
60
|
+
* The supervisor leaves it alone from then on. Being told that a path is
|
|
61
|
+
* handled here is more specific than any rule the supervisor has about which
|
|
62
|
+
* paths are worth restarting for, so it wins over having reported the same
|
|
63
|
+
* path for watching.
|
|
64
|
+
*
|
|
65
|
+
* Best effort, as reportPath is: a process with no supervisor drops it.
|
|
66
|
+
*/
|
|
67
|
+
reportHeldPath(heldPath) {
|
|
68
|
+
if (!this.supervised()) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.host.send?.({
|
|
72
|
+
type: simWatchMessages.heldPath,
|
|
73
|
+
path: path.resolve(heldPath),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Run something when the supervisor says this process is about to restart.
|
|
78
|
+
*/
|
|
79
|
+
onStopping(listener) {
|
|
80
|
+
if (!this.supervised()) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
this.stoppingListeners.add(listener);
|
|
84
|
+
this.listen();
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Stop running something on a restart.
|
|
88
|
+
*/
|
|
89
|
+
offStopping(listener) {
|
|
90
|
+
this.stoppingListeners.delete(listener);
|
|
91
|
+
if (this.stoppingListeners.size === 0) {
|
|
92
|
+
this.unlisten();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
listen() {
|
|
96
|
+
if (this.listening) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this.listening = true;
|
|
100
|
+
this.host.on("message", this.onMessage);
|
|
101
|
+
}
|
|
102
|
+
unlisten() {
|
|
103
|
+
if (!this.listening) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.listening = false;
|
|
107
|
+
this.host.off("message", this.onMessage);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function isStoppingMessage(message) {
|
|
111
|
+
return (typeof message === "object" &&
|
|
112
|
+
message !== null &&
|
|
113
|
+
"type" in message &&
|
|
114
|
+
message.type === simWatchMessages.stopping);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The watch runtime for this process.
|
|
118
|
+
*
|
|
119
|
+
* One per process rather than one per `SimAws`, because it is about the process
|
|
120
|
+
* a supervisor started, not about any one simulated environment. Several
|
|
121
|
+
* simulations in the same process all report to the same supervisor.
|
|
122
|
+
*/
|
|
123
|
+
export const simWatch = new SimWatchRuntime();
|
|
124
|
+
//# sourceMappingURL=sim-watch-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-watch-runtime.js","sourceRoot":"","sources":["../../src/watch/sim-watch-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE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AI;QAChB,MAAM,IAAI,OAAO;QACjB,OAAO,CAAC,IAAI,KAAK,gBAAgB,CAAC,QAAQ,CAC3C,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
interface SimWatchSettleProperties {
|
|
2
|
+
readonly settleMs: number;
|
|
3
|
+
readonly onSettled: (changedPath: string) => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Turns a burst of writes into one change.
|
|
7
|
+
*
|
|
8
|
+
* Saving one file in an editor is several filesystem events: a temporary file
|
|
9
|
+
* written, renamed over the original, and often the directory touched as well.
|
|
10
|
+
* Acting on each of those would be several restarts, or several Stack updates,
|
|
11
|
+
* for one save, so the changes are held until they stop arriving.
|
|
12
|
+
*
|
|
13
|
+
* The path reported is the first of the burst, which is the one that actually
|
|
14
|
+
* changed rather than whatever the editor did around it.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SimWatchSettle {
|
|
17
|
+
private readonly settleMs;
|
|
18
|
+
private readonly onSettled;
|
|
19
|
+
private pendingPath;
|
|
20
|
+
private timer;
|
|
21
|
+
constructor(properties: SimWatchSettleProperties);
|
|
22
|
+
/**
|
|
23
|
+
* Note a change, and wait to see whether more are coming.
|
|
24
|
+
*/
|
|
25
|
+
record(changedPath: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Drop anything waiting, for a watcher that is shutting down.
|
|
28
|
+
*/
|
|
29
|
+
cancel(): void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=sim-watch-settle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-watch-settle.d.ts","sourceRoot":"","sources":["../../src/watch/sim-watch-settle.ts"],"names":[],"mappings":"AAAA,UAAU,wBAAwB;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED;;;;;;;;;;GAUG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgC;IAC1D,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,KAAK,CAA6B;IAE1C,YAAY,UAAU,EAAE,wBAAwB,EAI/C;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAShC;IAED;;OAEG;IACH,MAAM,IAAI,IAAI,CAIb;CACF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a burst of writes into one change.
|
|
3
|
+
*
|
|
4
|
+
* Saving one file in an editor is several filesystem events: a temporary file
|
|
5
|
+
* written, renamed over the original, and often the directory touched as well.
|
|
6
|
+
* Acting on each of those would be several restarts, or several Stack updates,
|
|
7
|
+
* for one save, so the changes are held until they stop arriving.
|
|
8
|
+
*
|
|
9
|
+
* The path reported is the first of the burst, which is the one that actually
|
|
10
|
+
* changed rather than whatever the editor did around it.
|
|
11
|
+
*/
|
|
12
|
+
export class SimWatchSettle {
|
|
13
|
+
settleMs;
|
|
14
|
+
onSettled;
|
|
15
|
+
pendingPath;
|
|
16
|
+
timer;
|
|
17
|
+
constructor(properties) {
|
|
18
|
+
const { settleMs, onSettled } = properties;
|
|
19
|
+
this.settleMs = settleMs;
|
|
20
|
+
this.onSettled = onSettled;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Note a change, and wait to see whether more are coming.
|
|
24
|
+
*/
|
|
25
|
+
record(changedPath) {
|
|
26
|
+
this.pendingPath ??= changedPath;
|
|
27
|
+
const burstPath = this.pendingPath;
|
|
28
|
+
clearTimeout(this.timer);
|
|
29
|
+
this.timer = setTimeout(() => {
|
|
30
|
+
this.pendingPath = undefined;
|
|
31
|
+
this.onSettled(burstPath);
|
|
32
|
+
}, this.settleMs);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Drop anything waiting, for a watcher that is shutting down.
|
|
36
|
+
*/
|
|
37
|
+
cancel() {
|
|
38
|
+
clearTimeout(this.timer);
|
|
39
|
+
this.timer = undefined;
|
|
40
|
+
this.pendingPath = undefined;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=sim-watch-settle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-watch-settle.js","sourceRoot":"","sources":["../../src/watch/sim-watch-settle.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,cAAc;IACR,QAAQ,CAAS;IACjB,SAAS,CAAgC;IAClD,WAAW,CAAqB;IAChC,KAAK,CAA6B;IAE1C,YAAY,UAAoC;QAC9C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,WAAmB;QACxB,IAAI,CAAC,WAAW,KAAK,WAAW,CAAC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC;QAEnC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC3B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;YAC7B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration shared by `yulin watch` and the process it supervises.
|
|
3
|
+
*/
|
|
4
|
+
export declare const simWatchConfig: {
|
|
5
|
+
environmentVariableName: string;
|
|
6
|
+
environmentVariableValue: string;
|
|
7
|
+
settleMs: number;
|
|
8
|
+
stoppingMs: number;
|
|
9
|
+
exitMs: number;
|
|
10
|
+
selfInflictedMs: number;
|
|
11
|
+
loopRestarts: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The messages the supervisor and the supervised process send each other.
|
|
15
|
+
*/
|
|
16
|
+
export declare const simWatchMessages: {
|
|
17
|
+
readonly path: "yulin:watch-path";
|
|
18
|
+
readonly heldPath: "yulin:watch-held-path";
|
|
19
|
+
readonly stopping: "yulin:watch-stopping";
|
|
20
|
+
readonly stopped: "yulin:watch-stopped";
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=sim-watch.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-watch.config.d.ts","sourceRoot":"","sources":["../../src/watch/sim-watch.config.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,cAAc;IAIzB,uBAAuB;IACvB,wBAAwB;IAGxB,QAAQ;IAIR,UAAU;IAEV,MAAM;IAGN,eAAe;IAEf,YAAY;CACb,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB;aAE3B,IAAI,EAAE,kBAAkB;aAGxB,QAAQ,EAAE,uBAAuB;aAEjC,QAAQ,EAAE,sBAAsB;aAEhC,OAAO,EAAE,qBAAqB;CACtB,CAAC"}
|