@pristine-ts/cli 2.0.3 → 2.0.5
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/bin/pristine.cjs +6 -2
- package/dist/lib/cjs/bin.js +18 -1
- package/dist/lib/cjs/bin.js.map +1 -1
- package/dist/lib/cjs/bootstrap/app-module-loader.js +40 -78
- package/dist/lib/cjs/bootstrap/app-module-loader.js.map +1 -1
- package/dist/lib/cjs/bootstrap/loaded-app-module.js +9 -13
- package/dist/lib/cjs/bootstrap/loaded-app-module.js.map +1 -1
- package/dist/lib/cjs/bootstrap/plugin-loader.js +3 -3
- package/dist/lib/cjs/bootstrap/plugin-loader.js.map +1 -1
- package/dist/lib/cjs/cli.js +173 -80
- package/dist/lib/cjs/cli.js.map +1 -1
- package/dist/lib/cjs/cli.module.js +24 -8
- package/dist/lib/cjs/cli.module.js.map +1 -1
- package/dist/lib/cjs/commands/build-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/build.command.js +9 -10
- package/dist/lib/cjs/commands/build.command.js.map +1 -1
- package/dist/lib/cjs/commands/config-print.command.js +1 -2
- package/dist/lib/cjs/commands/config-print.command.js.map +1 -1
- package/dist/lib/cjs/commands/help-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/help.command.js +6 -2
- package/dist/lib/cjs/commands/help.command.js.map +1 -1
- package/dist/lib/cjs/commands/info-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/info.command.js +7 -8
- package/dist/lib/cjs/commands/info.command.js.map +1 -1
- package/dist/lib/cjs/commands/init-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/init.command.js +13 -12
- package/dist/lib/cjs/commands/init.command.js.map +1 -1
- package/dist/lib/cjs/commands/list-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/list.command.js +8 -2
- package/dist/lib/cjs/commands/list.command.js.map +1 -1
- package/dist/lib/cjs/commands/start-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/start.command.js +3 -4
- package/dist/lib/cjs/commands/start.command.js.map +1 -1
- package/dist/lib/cjs/commands/verify-alias.command.js.map +1 -1
- package/dist/lib/cjs/commands/verify.command.js +3 -4
- package/dist/lib/cjs/commands/verify.command.js.map +1 -1
- package/dist/lib/cjs/config/resolved-pristine-config.js +2 -3
- package/dist/lib/cjs/config/resolved-pristine-config.js.map +1 -1
- package/dist/lib/cjs/errors/cli-error-code.enum.js +17 -0
- package/dist/lib/cjs/errors/cli-error-code.enum.js.map +1 -0
- package/dist/lib/cjs/errors/command-not-found.error.js +11 -12
- package/dist/lib/cjs/errors/command-not-found.error.js.map +1 -1
- package/dist/lib/cjs/errors/errors.js +1 -0
- package/dist/lib/cjs/errors/errors.js.map +1 -1
- package/dist/lib/cjs/event-handlers/cli.event-handler.js +28 -20
- package/dist/lib/cjs/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/cjs/reporters/cli-error.reporter.js +121 -0
- package/dist/lib/cjs/reporters/cli-error.reporter.js.map +1 -0
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/cjs/types/command-event-response.type.js.map +1 -1
- package/dist/lib/esm/bin.js +18 -1
- package/dist/lib/esm/bin.js.map +1 -1
- package/dist/lib/esm/bootstrap/app-module-loader.js +40 -78
- package/dist/lib/esm/bootstrap/app-module-loader.js.map +1 -1
- package/dist/lib/esm/bootstrap/loaded-app-module.js +9 -13
- package/dist/lib/esm/bootstrap/loaded-app-module.js.map +1 -1
- package/dist/lib/esm/bootstrap/plugin-loader.js +3 -3
- package/dist/lib/esm/bootstrap/plugin-loader.js.map +1 -1
- package/dist/lib/esm/cli.js +172 -79
- package/dist/lib/esm/cli.js.map +1 -1
- package/dist/lib/esm/cli.module.js +24 -8
- package/dist/lib/esm/cli.module.js.map +1 -1
- package/dist/lib/esm/commands/build-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/build.command.js +10 -11
- package/dist/lib/esm/commands/build.command.js.map +1 -1
- package/dist/lib/esm/commands/config-print.command.js +2 -3
- package/dist/lib/esm/commands/config-print.command.js.map +1 -1
- package/dist/lib/esm/commands/help-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/help.command.js +7 -3
- package/dist/lib/esm/commands/help.command.js.map +1 -1
- package/dist/lib/esm/commands/info-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/info.command.js +8 -9
- package/dist/lib/esm/commands/info.command.js.map +1 -1
- package/dist/lib/esm/commands/init-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/init.command.js +14 -13
- package/dist/lib/esm/commands/init.command.js.map +1 -1
- package/dist/lib/esm/commands/list-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/list.command.js +9 -3
- package/dist/lib/esm/commands/list.command.js.map +1 -1
- package/dist/lib/esm/commands/start-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/start.command.js +4 -5
- package/dist/lib/esm/commands/start.command.js.map +1 -1
- package/dist/lib/esm/commands/verify-alias.command.js.map +1 -1
- package/dist/lib/esm/commands/verify.command.js +4 -5
- package/dist/lib/esm/commands/verify.command.js.map +1 -1
- package/dist/lib/esm/config/resolved-pristine-config.js +2 -3
- package/dist/lib/esm/config/resolved-pristine-config.js.map +1 -1
- package/dist/lib/esm/errors/cli-error-code.enum.js +14 -0
- package/dist/lib/esm/errors/cli-error-code.enum.js.map +1 -0
- package/dist/lib/esm/errors/command-not-found.error.js +12 -13
- package/dist/lib/esm/errors/command-not-found.error.js.map +1 -1
- package/dist/lib/esm/errors/errors.js +1 -0
- package/dist/lib/esm/errors/errors.js.map +1 -1
- package/dist/lib/esm/event-handlers/cli.event-handler.js +29 -21
- package/dist/lib/esm/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/esm/reporters/cli-error.reporter.js +118 -0
- package/dist/lib/esm/reporters/cli-error.reporter.js.map +1 -0
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/esm/types/command-event-response.type.js.map +1 -1
- package/dist/types/bin.d.ts +1 -0
- package/dist/types/bootstrap/app-module-loader.d.ts +24 -25
- package/dist/types/bootstrap/loaded-app-module.d.ts +12 -26
- package/dist/types/bootstrap/plugin-loader.d.ts +1 -1
- package/dist/types/cli.d.ts +69 -9
- package/dist/types/cli.module.d.ts +2 -2
- package/dist/types/commands/build-alias.command.d.ts +2 -2
- package/dist/types/commands/build.command.d.ts +2 -2
- package/dist/types/commands/config-print.command.d.ts +2 -2
- package/dist/types/commands/help-alias.command.d.ts +2 -2
- package/dist/types/commands/help.command.d.ts +2 -2
- package/dist/types/commands/info-alias.command.d.ts +2 -2
- package/dist/types/commands/info.command.d.ts +2 -2
- package/dist/types/commands/init-alias.command.d.ts +2 -2
- package/dist/types/commands/init.command.d.ts +2 -2
- package/dist/types/commands/list-alias.command.d.ts +2 -2
- package/dist/types/commands/list.command.d.ts +2 -2
- package/dist/types/commands/start-alias.command.d.ts +2 -2
- package/dist/types/commands/start.command.d.ts +2 -2
- package/dist/types/commands/verify-alias.command.d.ts +2 -2
- package/dist/types/commands/verify.command.d.ts +2 -2
- package/dist/types/config/pristine-config.interface.d.ts +38 -12
- package/dist/types/config/resolved-pristine-config.d.ts +4 -6
- package/dist/types/errors/cli-error-code.enum.d.ts +12 -0
- package/dist/types/errors/command-not-found.error.d.ts +8 -7
- package/dist/types/errors/errors.d.ts +1 -0
- package/dist/types/event-handlers/cli.event-handler.d.ts +4 -19
- package/dist/types/interfaces/command.interface.d.ts +2 -2
- package/dist/types/reporters/cli-error.reporter.d.ts +45 -0
- package/dist/types/types/command-event-response.type.d.ts +2 -2
- package/package.json +9 -9
- package/dist/lib/cjs/enums/enums.js +0 -18
- package/dist/lib/cjs/enums/enums.js.map +0 -1
- package/dist/lib/cjs/enums/exit-code.enum.js +0 -9
- package/dist/lib/cjs/enums/exit-code.enum.js.map +0 -1
- package/dist/lib/esm/enums/enums.js +0 -2
- package/dist/lib/esm/enums/enums.js.map +0 -1
- package/dist/lib/esm/enums/exit-code.enum.js +0 -6
- package/dist/lib/esm/enums/exit-code.enum.js.map +0 -1
- package/dist/types/enums/enums.d.ts +0 -1
- package/dist/types/enums/exit-code.enum.d.ts +0 -4
package/dist/bin/pristine.cjs
CHANGED
|
@@ -3,5 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
// dist/lib/cjs/bin.js
|
|
5
5
|
require("reflect-metadata");
|
|
6
|
-
require("@pristine-ts/cli")
|
|
7
|
-
|
|
6
|
+
var { Cli } = require("@pristine-ts/cli");
|
|
7
|
+
new Cli().bootstrap().then((exitCode) => process.exit(exitCode)).catch((error) => {
|
|
8
|
+
console.error(error);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2Jpbi50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiIyEvdXNyL2Jpbi9lbnYgbm9kZVxuLyogZXNsaW50LWRpc2FibGUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXZhci1yZXF1aXJlcyAqL1xuLy8gVGhpcyBmaWxlIGlzIGludGVudGlvbmFsbHkgQ0pTIGByZXF1aXJlKClgIHJhdGhlciB0aGFuIEVTTSBgaW1wb3J0YC4gSXQgcnVucyBhcyB0aGUgYmluXG4vLyBlbnRyeSBjb21waWxlZCB0byBkaXN0L2xpYi9janMvYmluLmpzLCB3aGVyZSAoYSkgdGhlIGxvYWQgb3JkZXIgbWF0dGVycyAocmVmbGVjdC1tZXRhZGF0YVxuLy8gTVVTVCBpbml0aWFsaXplIGJlZm9yZSBhbnkgZGVjb3JhdGVkIGNsYXNzIGlzIHRvdWNoZWQpIGFuZCAoYikgc3RhdGljIGBpbXBvcnRgIGNhbm5vdCBiZVxuLy8gcmVvcmRlcmVkIGFyb3VuZCBwYWNrYWdlLWxvYWRpbmcgc2lkZSBlZmZlY3RzIHRoZSB3YXkgZXhwbGljaXQgcmVxdWlyZSgpIGNhbGxzIGNhbi5cbi8vXG4vL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xpKCkuYm9vdHN0cmFwKClcbiAgLnRoZW4oKGV4aXRDb2RlOiBudW1iZXIpID0+IHByb2Nlc3MuZXhpdChleGl0Q29kZSkpXG4gIC5jYXRjaCgoZXJyb3I6IHVua25vd24pID0+IHtcbiAgICBjb25zb2xlLmVycm9yKGVycm9yKTtcbiAgICBwcm9jZXNzLmV4aXQoMSk7XG4gIH0pO1xuIl0sCiAgIm1hcHBpbmdzIjogIjs7OztBQVNBLFFBQVEsa0JBQWtCO0FBTzFCLElBQU0sRUFBQyxJQUFHLElBQUksUUFBUSxrQkFBa0I7QUFheEMsSUFBSSxJQUFHLEVBQUcsVUFBUyxFQUNoQixLQUFLLENBQUMsYUFBcUIsUUFBUSxLQUFLLFFBQVEsQ0FBQyxFQUNqRCxNQUFNLENBQUMsVUFBa0I7QUFDeEIsVUFBUSxNQUFNLEtBQUs7QUFDbkIsVUFBUSxLQUFLLENBQUM7QUFDaEIsQ0FBQzsiLAogICJuYW1lcyI6IFtdCn0K
|
package/dist/lib/cjs/bin.js
CHANGED
|
@@ -14,5 +14,22 @@ require('reflect-metadata');
|
|
|
14
14
|
// loaded via `./cli.js` and the consumer's app.module.js loaded via `@pristine-ts/cli`, the
|
|
15
15
|
// two halves would each get their own class identities and tsyringe's decorator metadata
|
|
16
16
|
// (keyed by class identity) would not be shared — manifesting as "TypeInfo not known for X".
|
|
17
|
-
require('@pristine-ts/cli')
|
|
17
|
+
const { Cli } = require('@pristine-ts/cli');
|
|
18
|
+
// `Cli.bootstrap()` is fully self-contained: it handles its own errors, builds the right
|
|
19
|
+
// `EnvironmentManager` from the loaded `pristine.config.ts` (or defaults to production when
|
|
20
|
+
// the config itself couldn't load), and returns the exit code. The bin's only job is to
|
|
21
|
+
// exit with that code. No `process.env` reads, no extra catch handler — everything flows
|
|
22
|
+
// through the kernel's configuration system.
|
|
23
|
+
//
|
|
24
|
+
// `bootstrap()` is designed to be total — every throw funnels through `reportFatalError`.
|
|
25
|
+
// This `.catch` is a last-resort safety net for the pathological case where the fallback
|
|
26
|
+
// reporter itself throws (invalid `pristine.environment` string, reporter constructor
|
|
27
|
+
// failure, etc.). Without it, such a throw becomes an unhandled rejection and Node dumps
|
|
28
|
+
// the raw stack to stderr, bypassing any sanitization.
|
|
29
|
+
new Cli().bootstrap()
|
|
30
|
+
.then((exitCode) => process.exit(exitCode))
|
|
31
|
+
.catch((error) => {
|
|
32
|
+
console.error(error);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
});
|
|
18
35
|
//# sourceMappingURL=bin.js.map
|
package/dist/lib/cjs/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../src/bin.ts"],"names":[],"mappings":";;AACA,uDAAuD;AACvD,0FAA0F;AAC1F,4FAA4F;AAC5F,2FAA2F;AAC3F,sFAAsF;AACtF,EAAE;AACF,2FAA2F;AAC3F,4FAA4F;AAC5F,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE5B,4FAA4F;AAC5F,0FAA0F;AAC1F,4FAA4F;AAC5F,yFAAyF;AACzF,6FAA6F;AAC7F,OAAO,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../src/bin.ts"],"names":[],"mappings":";;AACA,uDAAuD;AACvD,0FAA0F;AAC1F,4FAA4F;AAC5F,2FAA2F;AAC3F,sFAAsF;AACtF,EAAE;AACF,2FAA2F;AAC3F,4FAA4F;AAC5F,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE5B,4FAA4F;AAC5F,0FAA0F;AAC1F,4FAA4F;AAC5F,yFAAyF;AACzF,6FAA6F;AAC7F,MAAM,EAAC,GAAG,EAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE1C,yFAAyF;AACzF,4FAA4F;AAC5F,wFAAwF;AACxF,yFAAyF;AACzF,6CAA6C;AAC7C,EAAE;AACF,0FAA0F;AAC1F,yFAAyF;AACzF,sFAAsF;AACtF,yFAAyF;AACzF,uDAAuD;AACvD,IAAI,GAAG,EAAE,CAAC,SAAS,EAAE;KAClB,IAAI,CAAC,CAAC,QAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;KAClD,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -26,7 +26,6 @@ const tsyringe_1 = require("tsyringe");
|
|
|
26
26
|
const fs_1 = __importDefault(require("fs"));
|
|
27
27
|
const path_1 = __importDefault(require("path"));
|
|
28
28
|
const url_1 = require("url");
|
|
29
|
-
const logging_1 = require("@pristine-ts/logging");
|
|
30
29
|
const file_1 = require("@pristine-ts/file");
|
|
31
30
|
const cli_module_1 = require("../cli.module");
|
|
32
31
|
const config_loader_1 = require("../config/config-loader");
|
|
@@ -40,17 +39,21 @@ const loaded_app_module_1 = require("./loaded-app-module");
|
|
|
40
39
|
const plugin_loader_1 = require("./plugin-loader");
|
|
41
40
|
/**
|
|
42
41
|
* Resolves the consumer's AppModule. The contract is intentionally narrow: there is
|
|
43
|
-
* exactly one supported way to specify the module — `appModule.sourcePath` +
|
|
44
|
-
* `appModule.outputPath` in `pristine.config.ts` (or `pristine.config.js`).
|
|
42
|
+
* exactly one supported way to specify the module — `cli.appModule.sourcePath` +
|
|
43
|
+
* `cli.appModule.outputPath` in `pristine.config.ts` (or `pristine.config.js`).
|
|
45
44
|
*
|
|
46
45
|
* Resolution path:
|
|
47
46
|
* 1. Read `pristine.config.{ts,js}` via `ConfigLoader`.
|
|
48
|
-
* 2. If `appModule` is configured: ensure the build is fresh (manifest check, prompt
|
|
49
|
-
* fail on stale), then dynamically import the configured `outputPath`.
|
|
47
|
+
* 2. If `cli.appModule` is configured: ensure the build is fresh (manifest check, prompt
|
|
48
|
+
* or fail on stale), then dynamically import the configured `outputPath`.
|
|
50
49
|
* 3. If anything above is missing or broken: fall back to a `CliModule`-only synthetic
|
|
51
50
|
* AppModule so built-in commands (notably `pristine init`) remain runnable. This is
|
|
52
51
|
* the only escape hatch — there is no convention scan, no package.json discovery,
|
|
53
52
|
* no cached prior selection.
|
|
53
|
+
*
|
|
54
|
+
* **Does not read the `config:` block.** Runtime configuration values are read directly
|
|
55
|
+
* by `ConfigurationManager` during kernel boot. This class is concerned only with
|
|
56
|
+
* module-graph assembly.
|
|
54
57
|
*/
|
|
55
58
|
let AppModuleLoader = class AppModuleLoader {
|
|
56
59
|
constructor(configLoader, pluginLoader, dynamicImporter, buildManifestReader, buildManifestChecker, buildStalenessPrompt, buildRunner) {
|
|
@@ -65,39 +68,33 @@ let AppModuleLoader = class AppModuleLoader {
|
|
|
65
68
|
this.fallbackKeyname = "__auto_generated_app.module__";
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
68
|
-
* Resolves the consumer's AppModule
|
|
69
|
-
* with. The flow has five stages, executed in order:
|
|
71
|
+
* Resolves the consumer's AppModule for the CLI. The flow has five stages:
|
|
70
72
|
*
|
|
71
73
|
* 1. **Read the project's pristine.config.{ts,js}** — single source of truth for
|
|
72
74
|
* where the user's AppModule lives and what plugins to wire in.
|
|
73
75
|
* 2. **Check the compiled AppModule is in sync with its source** — when both
|
|
74
|
-
* `appModule.sourcePath` and `appModule.outputPath` are configured,
|
|
75
|
-
* build manifest's recorded source hash against the current source.
|
|
76
|
-
* diverge (the user edited source but didn't rebuild), prompt to rebuild
|
|
77
|
-
* interactive terminal, or fail with an actionable error in CI /
|
|
78
|
-
* contexts.
|
|
76
|
+
* `cli.appModule.sourcePath` and `cli.appModule.outputPath` are configured,
|
|
77
|
+
* compare the build manifest's recorded source hash against the current source.
|
|
78
|
+
* If they diverge (the user edited source but didn't rebuild), prompt to rebuild
|
|
79
|
+
* in an interactive terminal, or fail with an actionable error in CI /
|
|
80
|
+
* non-interactive contexts.
|
|
79
81
|
* 3. **Dynamically import the compiled AppModule** — load the JS file at
|
|
80
82
|
* `outputPath` and pull out the configured named export (default `AppModule`).
|
|
81
83
|
* 4. **Substitute a CliModule-only AppModule when nothing else worked** — when
|
|
82
|
-
* there is no config file, no `appModule` block in the config, or the import
|
|
84
|
+
* there is no config file, no `cli.appModule` block in the config, or the import
|
|
83
85
|
* threw, build a synthetic AppModule that imports just CliModule. This keeps the
|
|
84
86
|
* bin runnable so the user can run `pristine init`, `pristine help`, etc. to
|
|
85
87
|
* recover. There is no convention scan, no package.json discovery — only this
|
|
86
88
|
* one escape hatch.
|
|
87
|
-
* 5. **Wrap with config-declared plugins** — load every plugin listed in
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* Final output: a `LoadedAppModule` carrying the (possibly wrapped) AppModule, the
|
|
92
|
-
* kernel configuration overlay, the logging-module-present flag, and the loaded
|
|
93
|
-
* plugin list.
|
|
89
|
+
* 5. **Wrap with config-declared plugins** — load every plugin listed in
|
|
90
|
+
* `cli.plugins` and merge their modules into the AppModule's import graph via a
|
|
91
|
+
* synthetic outer module.
|
|
94
92
|
*/
|
|
95
93
|
load() {
|
|
96
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
var _a
|
|
95
|
+
var _a;
|
|
98
96
|
const projectRoot = process.cwd();
|
|
99
97
|
let appModule;
|
|
100
|
-
let isLoggingModulePresent = false;
|
|
101
98
|
let resolvedPath;
|
|
102
99
|
let appModuleExportName = this.defaultExportName;
|
|
103
100
|
// ── Stage 1: read the project's pristine.config.{ts,js}. ──
|
|
@@ -105,8 +102,8 @@ let AppModuleLoader = class AppModuleLoader {
|
|
|
105
102
|
// when no file is found, which lets the substitute-AppModule branch in Stage 4
|
|
106
103
|
// take over instead of erroring out.
|
|
107
104
|
const resolvedConfig = yield this.configLoader.load({ startDir: projectRoot });
|
|
108
|
-
const appModuleConfig = resolvedConfig.config.appModule;
|
|
109
|
-
// Honor `appModule.export` for projects whose AppModule isn't named `AppModule`.
|
|
105
|
+
const appModuleConfig = (_a = resolvedConfig.config.cli) === null || _a === void 0 ? void 0 : _a.appModule;
|
|
106
|
+
// Honor `cli.appModule.export` for projects whose AppModule isn't named `AppModule`.
|
|
110
107
|
if ((appModuleConfig === null || appModuleConfig === void 0 ? void 0 : appModuleConfig.export) !== undefined) {
|
|
111
108
|
appModuleExportName = appModuleConfig.export;
|
|
112
109
|
}
|
|
@@ -119,19 +116,15 @@ let AppModuleLoader = class AppModuleLoader {
|
|
|
119
116
|
if ((appModuleConfig === null || appModuleConfig === void 0 ? void 0 : appModuleConfig.sourcePath) !== undefined && (appModuleConfig === null || appModuleConfig === void 0 ? void 0 : appModuleConfig.outputPath) !== undefined) {
|
|
120
117
|
const ensured = yield this.ensureFreshBuild(projectRoot, appModuleConfig.sourcePath, appModuleConfig.outputPath);
|
|
121
118
|
if (ensured === false) {
|
|
122
|
-
const
|
|
123
|
-
return new loaded_app_module_1.LoadedAppModule(
|
|
119
|
+
const fallbackAppModule = yield this.buildFallbackAppModule(projectRoot);
|
|
120
|
+
return new loaded_app_module_1.LoadedAppModule(fallbackAppModule, []);
|
|
124
121
|
}
|
|
125
122
|
resolvedPath = path_1.default.resolve(projectRoot, appModuleConfig.outputPath);
|
|
126
123
|
}
|
|
127
124
|
// ── Stage 3: dynamically import the AppModule (or fall through to Stage 4). ──
|
|
128
125
|
if (resolvedPath !== undefined) {
|
|
129
|
-
// Stage 3: dynamic import. The compiled output is a regular JS module; we pull
|
|
130
|
-
// out the named export and detect LoggingModule presence so Stage 5 can decide
|
|
131
|
-
// whether to install the CLI's default console-logger configuration overlay.
|
|
132
126
|
try {
|
|
133
127
|
appModule = yield this.importAppModule(resolvedPath, appModuleExportName);
|
|
134
|
-
isLoggingModulePresent = ((_a = appModule.importModules) !== null && _a !== void 0 ? _a : []).find(m => m.keyname === logging_1.LoggingModuleKeyname) !== undefined;
|
|
135
128
|
}
|
|
136
129
|
catch (error) {
|
|
137
130
|
// Stage 4 (the configured file is broken or missing): we don't crash — that
|
|
@@ -140,24 +133,20 @@ let AppModuleLoader = class AppModuleLoader {
|
|
|
140
133
|
// let the user re-run after fixing the issue.
|
|
141
134
|
process.stderr.write(`[pristine] Failed to load AppModule from '${resolvedPath}': ${error.message}\n` +
|
|
142
135
|
`[pristine] Falling back to built-in commands only. Fix your AppModule config and re-run.\n`);
|
|
143
|
-
|
|
144
|
-
appModule = fallback.appModule;
|
|
145
|
-
isLoggingModulePresent = fallback.isLoggingModulePresent;
|
|
136
|
+
appModule = yield this.buildFallbackAppModule(projectRoot);
|
|
146
137
|
}
|
|
147
138
|
}
|
|
148
139
|
else {
|
|
149
|
-
// Stage 4 (no `appModule` block, or no config file at all): substitute the
|
|
140
|
+
// Stage 4 (no `cli.appModule` block, or no config file at all): substitute the
|
|
150
141
|
// CliModule-only AppModule so the bin can still bootstrap the user's project.
|
|
151
142
|
// First-run case (`pristine init` from a fresh project) lands here.
|
|
152
|
-
|
|
153
|
-
appModule = fallback.appModule;
|
|
154
|
-
isLoggingModulePresent = fallback.isLoggingModulePresent;
|
|
143
|
+
appModule = yield this.buildFallbackAppModule(projectRoot);
|
|
155
144
|
}
|
|
156
145
|
// ── Stage 5: wrap with config-declared plugins. ──
|
|
157
|
-
// Plugins declared in `pristine.config.ts` contribute additional modules
|
|
158
|
-
// tooling-only modules the user doesn't want polluting their runtime AppModule).
|
|
159
|
-
// A failing plugin warns but doesn't abort — the bin stays usable so the user can
|
|
160
|
-
//
|
|
146
|
+
// Plugins declared in `pristine.config.ts:cli.plugins` contribute additional modules
|
|
147
|
+
// (e.g. tooling-only modules the user doesn't want polluting their runtime AppModule).
|
|
148
|
+
// A failing plugin warns but doesn't abort — the bin stays usable so the user can fix
|
|
149
|
+
// the offending entry.
|
|
161
150
|
let plugins = [];
|
|
162
151
|
try {
|
|
163
152
|
plugins = yield this.pluginLoader.load(resolvedConfig.config, resolvedConfig.configFilePath, projectRoot);
|
|
@@ -167,20 +156,9 @@ let AppModuleLoader = class AppModuleLoader {
|
|
|
167
156
|
process.stderr.write("[pristine] Continuing without plugins. Fix the plugin config and re-run.\n");
|
|
168
157
|
}
|
|
169
158
|
if (plugins.length > 0) {
|
|
170
|
-
// Wrap the AppModule with a synthetic outer module that imports both the user's
|
|
171
|
-
// module and every plugin. Re-detect logging because a plugin could have brought
|
|
172
|
-
// it in.
|
|
173
159
|
appModule = this.pluginLoader.wrap(appModule, plugins);
|
|
174
|
-
if (isLoggingModulePresent === false) {
|
|
175
|
-
isLoggingModulePresent = ((_b = appModule.importModules) !== null && _b !== void 0 ? _b : []).find(m => m.keyname === logging_1.LoggingModuleKeyname) !== undefined;
|
|
176
|
-
}
|
|
177
160
|
}
|
|
178
|
-
|
|
179
|
-
// The CLI installs sensible defaults for LoggingModule (simple output mode,
|
|
180
|
-
// error-level threshold) when LoggingModule is present, then layers the user's
|
|
181
|
-
// `kernelConfiguration` on top so they can override anything they want.
|
|
182
|
-
const configuration = this.buildKernelConfiguration(isLoggingModulePresent, resolvedConfig.config.kernelConfiguration);
|
|
183
|
-
return new loaded_app_module_1.LoadedAppModule(appModule, configuration, isLoggingModulePresent, plugins);
|
|
161
|
+
return new loaded_app_module_1.LoadedAppModule(appModule, plugins);
|
|
184
162
|
});
|
|
185
163
|
}
|
|
186
164
|
/**
|
|
@@ -252,17 +230,17 @@ let AppModuleLoader = class AppModuleLoader {
|
|
|
252
230
|
});
|
|
253
231
|
}
|
|
254
232
|
/**
|
|
255
|
-
* Builds the safety-net AppModule used when no `appModule` is configured or the
|
|
256
|
-
* file fails to load. Scrapes any `node_modules/@pristine-ts/*` packages
|
|
257
|
-
* so built-in commands they contribute (e.g. `pristine list`) are
|
|
258
|
-
* appends `CliModule` so at minimum the CLI's own commands run.
|
|
259
|
-
* one-way safety net, not a discovery tier — it only fires
|
|
233
|
+
* Builds the safety-net AppModule used when no `cli.appModule` is configured or the
|
|
234
|
+
* configured file fails to load. Scrapes any `node_modules/@pristine-ts/*` packages
|
|
235
|
+
* already installed so built-in commands they contribute (e.g. `pristine list`) are
|
|
236
|
+
* still available, then appends `CliModule` so at minimum the CLI's own commands run.
|
|
237
|
+
* This is intentionally a one-way safety net, not a discovery tier — it only fires
|
|
238
|
+
* when nothing else worked.
|
|
260
239
|
*/
|
|
261
240
|
buildFallbackAppModule(projectRoot) {
|
|
262
241
|
return __awaiter(this, void 0, void 0, function* () {
|
|
263
242
|
const pristineNodeModulesPath = path_1.default.resolve(projectRoot, "node_modules", "@pristine-ts");
|
|
264
243
|
const modules = [];
|
|
265
|
-
let isLoggingModulePresent = false;
|
|
266
244
|
if (fs_1.default.existsSync(pristineNodeModulesPath)) {
|
|
267
245
|
const directoryManager = new file_1.DirectoryManager(new file_1.FileManager());
|
|
268
246
|
const moduleFiles = yield directoryManager.list(pristineNodeModulesPath, {
|
|
@@ -275,8 +253,6 @@ let AppModuleLoader = class AppModuleLoader {
|
|
|
275
253
|
for (const moduleFile of moduleFiles) {
|
|
276
254
|
const module = yield this.dynamicImporter.import((0, url_1.pathToFileURL)(moduleFile).href);
|
|
277
255
|
for (const key in module) {
|
|
278
|
-
if (key === "LoggingModule")
|
|
279
|
-
isLoggingModulePresent = true;
|
|
280
256
|
if (key.endsWith("Module"))
|
|
281
257
|
modules.push(module[key]);
|
|
282
258
|
}
|
|
@@ -286,26 +262,12 @@ let AppModuleLoader = class AppModuleLoader {
|
|
|
286
262
|
modules.push(cli_module_1.CliModule);
|
|
287
263
|
}
|
|
288
264
|
return {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
importServices: [],
|
|
293
|
-
},
|
|
294
|
-
isLoggingModulePresent,
|
|
265
|
+
keyname: this.fallbackKeyname,
|
|
266
|
+
importModules: modules,
|
|
267
|
+
importServices: [],
|
|
295
268
|
};
|
|
296
269
|
});
|
|
297
270
|
}
|
|
298
|
-
buildKernelConfiguration(isLoggingModulePresent, userKernelConfiguration) {
|
|
299
|
-
const configuration = {};
|
|
300
|
-
if (isLoggingModulePresent) {
|
|
301
|
-
configuration[logging_1.LoggingModuleKeyname + ".consoleLoggerOutputMode"] = logging_1.OutputModeEnum.Simple;
|
|
302
|
-
configuration[logging_1.LoggingModuleKeyname + ".logSeverityLevelConfiguration"] = logging_1.SeverityEnum.Error;
|
|
303
|
-
}
|
|
304
|
-
if (userKernelConfiguration !== undefined) {
|
|
305
|
-
Object.assign(configuration, userKernelConfiguration);
|
|
306
|
-
}
|
|
307
|
-
return configuration;
|
|
308
|
-
}
|
|
309
271
|
};
|
|
310
272
|
exports.AppModuleLoader = AppModuleLoader;
|
|
311
273
|
exports.AppModuleLoader = AppModuleLoader = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-module-loader.js","sourceRoot":"","sources":["../../../../src/bootstrap/app-module-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AACxB,6BAAkC;
|
|
1
|
+
{"version":3,"file":"app-module-loader.js","sourceRoot":"","sources":["../../../../src/bootstrap/app-module-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AACxB,6BAAkC;AAElC,4CAAmH;AACnH,8CAAwC;AACxC,2DAAqD;AACrD,qEAA8D;AAC9D,mEAA4D;AAC5D,mFAA2E;AAC3E,iDAA2C;AAC3C,qEAA8D;AAC9D,yDAAmD;AACnD,2DAAoD;AAEpD,mDAA6C;AAE7C;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IAI1B,YACmB,YAA0B,EAC1B,YAA0B,EAC1B,eAAgC,EAChC,mBAAwC,EACxC,oBAA0C,EAC1C,oBAA0C,EAC1C,WAAwB;QANxB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,oBAAe,GAAf,eAAe,CAAiB;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AAM,CAAC,GAAG,CAAC,CAAC,CAAC;oBACxD,CAAC;gBACH,CAAC;YACH,CAAC;YAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,IAAI,CAAC,sBAAS,CAAC,CAAC;YAC1B,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,eAAe;gBAC7B,aAAa,EAAE,OAAO;gBACtB,cAAc,EAAE,EAAE;aACnB,CAAC;QACJ,CAAC;KAAA;CACF,CAAA;AAxOY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,qBAAU,GAAE;qCAMsB,4BAAY;QACZ,4BAAY;QACT,kCAAe;QACX,2CAAmB;QAClB,6CAAoB;QACpB,6CAAoB;QAC7B,0BAAW;GAXhC,eAAe,CAwO3B"}
|
|
@@ -2,26 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LoadedAppModule = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* The fully-resolved AppModule
|
|
5
|
+
* The fully-resolved AppModule and the plugin list that the CLI uses to boot the kernel.
|
|
6
6
|
* Returned by `AppModuleLoader.load()`.
|
|
7
|
+
*
|
|
8
|
+
* **No `configuration` field.** Runtime configuration values from `pristine.config.ts:config`
|
|
9
|
+
* are read directly by `ConfigurationManager` during kernel boot, not pre-loaded by the
|
|
10
|
+
* CLI. The CLI is responsible only for module-graph assembly.
|
|
7
11
|
*/
|
|
8
12
|
class LoadedAppModule {
|
|
9
|
-
constructor(appModule,
|
|
13
|
+
constructor(appModule,
|
|
10
14
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
isLoggingModulePresent,
|
|
16
|
-
/**
|
|
17
|
-
* Plugins loaded from `pristine.config.ts`'s `plugins` array. Empty when no plugins are
|
|
18
|
-
* declared. Carried through so commands like `pristine info` can show what's contributing
|
|
19
|
-
* extra modules to the runtime.
|
|
15
|
+
* Plugins loaded from `pristine.config.ts:cli.plugins`. Empty when no plugins are
|
|
16
|
+
* declared. Carried through so commands like `pristine info` can show what's
|
|
17
|
+
* contributing extra modules to the runtime.
|
|
20
18
|
*/
|
|
21
19
|
plugins) {
|
|
22
20
|
this.appModule = appModule;
|
|
23
|
-
this.configuration = configuration;
|
|
24
|
-
this.isLoggingModulePresent = isLoggingModulePresent;
|
|
25
21
|
this.plugins = plugins;
|
|
26
22
|
}
|
|
27
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaded-app-module.js","sourceRoot":"","sources":["../../../../src/bootstrap/loaded-app-module.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"loaded-app-module.js","sourceRoot":"","sources":["../../../../src/bootstrap/loaded-app-module.ts"],"names":[],"mappings":";;;AAGA;;;;;;;GAOG;AACH,MAAa,eAAe;IAC1B,YACkB,SAA6B;IAC7C;;;;OAIG;IACa,OAAuB;QANvB,cAAS,GAAT,SAAS,CAAoB;QAM7B,YAAO,GAAP,OAAO,CAAgB;IAEzC,CAAC;CACF;AAXD,0CAWC"}
|
|
@@ -29,7 +29,7 @@ const url_1 = require("url");
|
|
|
29
29
|
const dynamic_importer_1 = require("./dynamic-importer");
|
|
30
30
|
const loaded_plugin_1 = require("./loaded-plugin");
|
|
31
31
|
/**
|
|
32
|
-
* Resolves and loads every plugin declared in `config.plugins`. Plugin packages are resolved
|
|
32
|
+
* Resolves and loads every plugin declared in `config.cli.plugins`. Plugin packages are resolved
|
|
33
33
|
* from the **consumer's project**, not from the CLI's install location — a plugin lives in
|
|
34
34
|
* the consumer's `node_modules`, not in `@pristine-ts/cli/node_modules`. Without
|
|
35
35
|
* `createRequire` pinned to the project location, `import("@my-org/plugin")` would walk up
|
|
@@ -45,8 +45,8 @@ let PluginLoader = class PluginLoader {
|
|
|
45
45
|
}
|
|
46
46
|
load(config, configFilePath, projectRoot) {
|
|
47
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
var _a;
|
|
49
|
-
const plugins = (_a = config.plugins) !== null &&
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const plugins = (_b = (_a = config.cli) === null || _a === void 0 ? void 0 : _a.plugins) !== null && _b !== void 0 ? _b : [];
|
|
50
50
|
if (plugins.length === 0) {
|
|
51
51
|
return [];
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../../../src/bootstrap/plugin-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,mCAAqC;AACrC,gDAAwB;AACxB,6BAAkC;AAGlC,yDAAmD;AACnD,mDAA6C;AAE7C;;;;;;;;;;GAUG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAC7D,CAAC;IAEK,IAAI,CAAC,MAAsB,EAAE,cAAkC,EAAE,WAAmB;;;YACxF,MAAM,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../../../../src/bootstrap/plugin-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,mCAAqC;AACrC,gDAAwB;AACxB,6BAAkC;AAGlC,yDAAmD;AACnD,mDAA6C;AAE7C;;;;;;;;;;GAUG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,YAA6B,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAC7D,CAAC;IAEK,IAAI,CAAC,MAAsB,EAAE,cAAkC,EAAE,WAAmB;;;YACxF,MAAM,OAAO,GAAG,MAAA,MAAA,MAAM,CAAC,GAAG,0CAAE,OAAO,mCAAI,EAAE,CAAC;YAC1C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CA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