@pristine-ts/cli 1.0.440 → 2.0.1
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 +7 -0
- package/dist/lib/cjs/bin.js +15 -1
- package/dist/lib/cjs/bin.js.map +1 -1
- package/dist/lib/cjs/bootstrap/app-module-loader.js +321 -0
- package/dist/lib/cjs/bootstrap/app-module-loader.js.map +1 -0
- package/dist/lib/cjs/bootstrap/bootstrap.js +31 -0
- package/dist/lib/cjs/bootstrap/bootstrap.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest-checker.js +67 -0
- package/dist/lib/cjs/bootstrap/build-manifest-checker.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest-reader.js +44 -0
- package/dist/lib/cjs/bootstrap/build-manifest-reader.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest-staleness.enum.js +23 -0
- package/dist/lib/cjs/bootstrap/build-manifest-staleness.enum.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest-writer.js +55 -0
- package/dist/lib/cjs/bootstrap/build-manifest-writer.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-manifest.js +31 -0
- package/dist/lib/cjs/bootstrap/build-manifest.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-runner.js +44 -0
- package/dist/lib/cjs/bootstrap/build-runner.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-staleness-prompt.js +90 -0
- package/dist/lib/cjs/bootstrap/build-staleness-prompt.js.map +1 -0
- package/dist/lib/cjs/bootstrap/dynamic-importer.js +43 -0
- package/dist/lib/cjs/bootstrap/dynamic-importer.js.map +1 -0
- package/dist/lib/cjs/bootstrap/init-prompt.js +127 -0
- package/dist/lib/cjs/bootstrap/init-prompt.js.map +1 -0
- package/dist/lib/cjs/bootstrap/loaded-app-module.js +29 -0
- package/dist/lib/cjs/bootstrap/loaded-app-module.js.map +1 -0
- package/dist/lib/cjs/bootstrap/loaded-plugin.js +22 -0
- package/dist/lib/cjs/bootstrap/loaded-plugin.js.map +1 -0
- package/dist/lib/cjs/bootstrap/plugin-loader.js +149 -0
- package/dist/lib/cjs/bootstrap/plugin-loader.js.map +1 -0
- package/dist/lib/cjs/bootstrap/source-hasher.js +41 -0
- package/dist/lib/cjs/bootstrap/source-hasher.js.map +1 -0
- package/dist/lib/cjs/cli.js +94 -111
- package/dist/lib/cjs/cli.js.map +1 -1
- package/dist/lib/cjs/cli.module.js +9 -1
- package/dist/lib/cjs/cli.module.js.map +1 -1
- package/dist/lib/cjs/commands/build-alias.command.js +50 -0
- package/dist/lib/cjs/commands/build-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/build.command.js +173 -0
- package/dist/lib/cjs/commands/build.command.js.map +1 -0
- package/dist/lib/cjs/commands/commands.js +15 -0
- package/dist/lib/cjs/commands/commands.js.map +1 -1
- package/dist/lib/cjs/commands/config-print.command.js +75 -0
- package/dist/lib/cjs/commands/config-print.command.js.map +1 -0
- package/dist/lib/cjs/commands/help-alias.command.js +52 -0
- package/dist/lib/cjs/commands/help-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/help.command.js +44 -10
- package/dist/lib/cjs/commands/help.command.js.map +1 -1
- package/dist/lib/cjs/commands/info-alias.command.js +50 -0
- package/dist/lib/cjs/commands/info-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/info.command.js +162 -0
- package/dist/lib/cjs/commands/info.command.js.map +1 -0
- package/dist/lib/cjs/commands/init-alias.command.js +51 -0
- package/dist/lib/cjs/commands/init-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/init.command-options.js +53 -0
- package/dist/lib/cjs/commands/init.command-options.js.map +1 -0
- package/dist/lib/cjs/commands/init.command.js +249 -0
- package/dist/lib/cjs/commands/init.command.js.map +1 -0
- package/dist/lib/cjs/commands/list-alias.command.js +50 -0
- package/dist/lib/cjs/commands/list-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/list.command.js +7 -1
- package/dist/lib/cjs/commands/list.command.js.map +1 -1
- package/dist/lib/cjs/commands/start-alias.command.js +51 -0
- package/dist/lib/cjs/commands/start-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/start.command-options.js +34 -0
- package/dist/lib/cjs/commands/start.command-options.js.map +1 -0
- package/dist/lib/cjs/commands/start.command.js +169 -0
- package/dist/lib/cjs/commands/start.command.js.map +1 -0
- package/dist/lib/cjs/commands/verify-alias.command.js +50 -0
- package/dist/lib/cjs/commands/verify-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/verify.command.js +71 -0
- package/dist/lib/cjs/commands/verify.command.js.map +1 -0
- package/dist/lib/cjs/config/config-loader.js +136 -0
- package/dist/lib/cjs/config/config-loader.js.map +1 -0
- package/dist/lib/cjs/config/config-provenance.enum.js +15 -0
- package/dist/lib/cjs/config/config-provenance.enum.js.map +1 -0
- package/dist/lib/cjs/config/config.js +22 -0
- package/dist/lib/cjs/config/config.js.map +1 -0
- package/dist/lib/cjs/config/define-config.js +18 -0
- package/dist/lib/cjs/config/define-config.js.map +1 -0
- package/dist/lib/cjs/config/pristine-config.interface.js +3 -0
- package/dist/lib/cjs/config/pristine-config.interface.js.map +1 -0
- package/dist/lib/cjs/config/resolved-pristine-config.js +25 -0
- package/dist/lib/cjs/config/resolved-pristine-config.js.map +1 -0
- package/dist/lib/cjs/event-handlers/cli.event-handler.js +69 -48
- package/dist/lib/cjs/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/lib/esm/bin.js +15 -1
- package/dist/lib/esm/bin.js.map +1 -1
- package/dist/lib/esm/bootstrap/app-module-loader.js +315 -0
- package/dist/lib/esm/bootstrap/app-module-loader.js.map +1 -0
- package/dist/lib/esm/bootstrap/bootstrap.js +15 -0
- package/dist/lib/esm/bootstrap/bootstrap.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest-checker.js +61 -0
- package/dist/lib/esm/bootstrap/build-manifest-checker.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest-reader.js +38 -0
- package/dist/lib/esm/bootstrap/build-manifest-reader.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest-staleness.enum.js +20 -0
- package/dist/lib/esm/bootstrap/build-manifest-staleness.enum.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest-writer.js +49 -0
- package/dist/lib/esm/bootstrap/build-manifest-writer.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-manifest.js +27 -0
- package/dist/lib/esm/bootstrap/build-manifest.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-runner.js +41 -0
- package/dist/lib/esm/bootstrap/build-runner.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-staleness-prompt.js +87 -0
- package/dist/lib/esm/bootstrap/build-staleness-prompt.js.map +1 -0
- package/dist/lib/esm/bootstrap/dynamic-importer.js +40 -0
- package/dist/lib/esm/bootstrap/dynamic-importer.js.map +1 -0
- package/dist/lib/esm/bootstrap/init-prompt.js +124 -0
- package/dist/lib/esm/bootstrap/init-prompt.js.map +1 -0
- package/dist/lib/esm/bootstrap/loaded-app-module.js +25 -0
- package/dist/lib/esm/bootstrap/loaded-app-module.js.map +1 -0
- package/dist/lib/esm/bootstrap/loaded-plugin.js +18 -0
- package/dist/lib/esm/bootstrap/loaded-plugin.js.map +1 -0
- package/dist/lib/esm/bootstrap/plugin-loader.js +143 -0
- package/dist/lib/esm/bootstrap/plugin-loader.js.map +1 -0
- package/dist/lib/esm/bootstrap/source-hasher.js +35 -0
- package/dist/lib/esm/bootstrap/source-hasher.js.map +1 -0
- package/dist/lib/esm/cli.js +109 -0
- package/dist/lib/esm/cli.js.map +1 -0
- package/dist/lib/esm/cli.module.js +7 -0
- package/dist/lib/esm/cli.module.js.map +1 -1
- package/dist/lib/esm/commands/build-alias.command.js +47 -0
- package/dist/lib/esm/commands/build-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/build.command.js +167 -0
- package/dist/lib/esm/commands/build.command.js.map +1 -0
- package/dist/lib/esm/commands/commands.js +15 -0
- package/dist/lib/esm/commands/commands.js.map +1 -1
- package/dist/lib/esm/commands/config-print.command.js +69 -0
- package/dist/lib/esm/commands/config-print.command.js.map +1 -0
- package/dist/lib/esm/commands/help-alias.command.js +49 -0
- package/dist/lib/esm/commands/help-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/help.command.js +44 -10
- package/dist/lib/esm/commands/help.command.js.map +1 -1
- package/dist/lib/esm/commands/info-alias.command.js +47 -0
- package/dist/lib/esm/commands/info-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/info.command.js +156 -0
- package/dist/lib/esm/commands/info.command.js.map +1 -0
- package/dist/lib/esm/commands/init-alias.command.js +48 -0
- package/dist/lib/esm/commands/init-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/init.command-options.js +49 -0
- package/dist/lib/esm/commands/init.command-options.js.map +1 -0
- package/dist/lib/esm/commands/init.command.js +243 -0
- package/dist/lib/esm/commands/init.command.js.map +1 -0
- package/dist/lib/esm/commands/list-alias.command.js +47 -0
- package/dist/lib/esm/commands/list-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/list.command.js +8 -2
- package/dist/lib/esm/commands/list.command.js.map +1 -1
- package/dist/lib/esm/commands/start-alias.command.js +48 -0
- package/dist/lib/esm/commands/start-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/start.command-options.js +30 -0
- package/dist/lib/esm/commands/start.command-options.js.map +1 -0
- package/dist/lib/esm/commands/start.command.js +166 -0
- package/dist/lib/esm/commands/start.command.js.map +1 -0
- package/dist/lib/esm/commands/verify-alias.command.js +47 -0
- package/dist/lib/esm/commands/verify-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/verify.command.js +68 -0
- package/dist/lib/esm/commands/verify.command.js.map +1 -0
- package/dist/lib/esm/config/config-loader.js +130 -0
- package/dist/lib/esm/config/config-loader.js.map +1 -0
- package/dist/lib/esm/config/config-provenance.enum.js +12 -0
- package/dist/lib/esm/config/config-provenance.enum.js.map +1 -0
- package/dist/lib/esm/config/config.js +6 -0
- package/dist/lib/esm/config/config.js.map +1 -0
- package/dist/lib/esm/config/define-config.js +14 -0
- package/dist/lib/esm/config/define-config.js.map +1 -0
- package/dist/lib/esm/config/pristine-config.interface.js +2 -0
- package/dist/lib/esm/config/pristine-config.interface.js.map +1 -0
- package/dist/lib/esm/config/resolved-pristine-config.js +21 -0
- package/dist/lib/esm/config/resolved-pristine-config.js.map +1 -0
- package/dist/lib/esm/event-handlers/cli.event-handler.js +69 -48
- package/dist/lib/esm/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -0
- package/dist/types/bootstrap/app-module-loader.d.ts +83 -0
- package/dist/types/bootstrap/bootstrap.d.ts +14 -0
- package/dist/types/bootstrap/build-manifest-checker.d.ts +19 -0
- package/dist/types/bootstrap/build-manifest-reader.d.ts +14 -0
- package/dist/types/bootstrap/build-manifest-staleness.enum.d.ts +18 -0
- package/dist/types/bootstrap/build-manifest-writer.d.ts +19 -0
- package/dist/types/bootstrap/build-manifest.d.ts +29 -0
- package/dist/types/bootstrap/build-runner.d.ts +16 -0
- package/dist/types/bootstrap/build-staleness-prompt.d.ts +27 -0
- package/dist/types/bootstrap/dynamic-importer.d.ts +13 -0
- package/dist/types/bootstrap/init-prompt.d.ts +38 -0
- package/dist/types/bootstrap/loaded-app-module.d.ts +40 -0
- package/dist/types/bootstrap/loaded-plugin.d.ts +20 -0
- package/dist/types/bootstrap/plugin-loader.d.ts +35 -0
- package/dist/types/bootstrap/source-hasher.d.ts +15 -0
- package/dist/types/cli.d.ts +12 -0
- package/dist/types/cli.module.d.ts +3 -0
- package/dist/types/commands/build-alias.command.d.ts +15 -0
- package/dist/types/commands/build.command.d.ts +47 -0
- package/dist/types/commands/commands.d.ts +15 -0
- package/dist/types/commands/config-print.command.d.ts +18 -0
- package/dist/types/commands/help-alias.command.d.ts +17 -0
- package/dist/types/commands/help.command.d.ts +19 -1
- package/dist/types/commands/info-alias.command.d.ts +15 -0
- package/dist/types/commands/info.command.d.ts +41 -0
- package/dist/types/commands/init-alias.command.d.ts +16 -0
- package/dist/types/commands/init.command-options.d.ts +22 -0
- package/dist/types/commands/init.command.d.ts +60 -0
- package/dist/types/commands/list-alias.command.d.ts +15 -0
- package/dist/types/commands/list.command.d.ts +6 -0
- package/dist/types/commands/start-alias.command.d.ts +16 -0
- package/dist/types/commands/start.command-options.d.ts +11 -0
- package/dist/types/commands/start.command.d.ts +47 -0
- package/dist/types/commands/verify-alias.command.d.ts +15 -0
- package/dist/types/commands/verify.command.d.ts +24 -0
- package/dist/types/config/config-loader.d.ts +40 -0
- package/dist/types/config/config-provenance.enum.d.ts +10 -0
- package/dist/types/config/config.d.ts +5 -0
- package/dist/types/config/define-config.d.ts +14 -0
- package/dist/types/config/pristine-config.interface.d.ts +67 -0
- package/dist/types/config/resolved-pristine-config.d.ts +28 -0
- package/dist/types/event-handlers/cli.event-handler.d.ts +30 -3
- package/dist/types/interfaces/command.interface.d.ts +31 -3
- package/package.json +16 -13
- package/readme.md +1023 -17
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// dist/lib/cjs/bin.js
|
|
5
|
+
require("reflect-metadata");
|
|
6
|
+
require("@pristine-ts/cli").bootstrap();
|
|
7
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2Jpbi50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiIyEvdXNyL2Jpbi9lbnYgbm9kZVxuLyogZXNsaW50LWRpc2FibGUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXZhci1yZXF1aXJlcyAqL1xuLy8gVGhpcyBmaWxlIGlzIGludGVudGlvbmFsbHkgQ0pTIGByZXF1aXJlKClgIHJhdGhlciB0aGFuIEVTTSBgaW1wb3J0YC4gSXQgcnVucyB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HdvIGhhbHZlcyB3b3VsZCBlYWNoIGdldCB0aGVpciBvd24gY2xhc3MgaWRlbnRpdGllcyBhbmQgdHN5cmluZ2UncyBkZWNvcmF0b3IgbWV0YWRhdGFcbi8vIChrZXllZCBieSBjbGFzcyBpZGVudGl0eSkgd291bGQgbm90IGJlIHNoYXJlZCBcdTIwMTQgbWFuaWZlc3RpbmcgYXMgXCJUeXBlSW5mbyBub3Qga25vd24gZm9yIFhcIi5cbnJlcXVpcmUoJ0BwcmlzdGluZS10cy9jbGknKS5ib290c3RyYXAoKTsiXSwKICAibWFwcGluZ3MiOiAiOzs7O0FBU0EsUUFBUSxrQkFBa0I7QUFPMUIsUUFBUSxrQkFBa0IsRUFBRSxVQUFTOyIsCiAgIm5hbWVzIjogW10KfQo=
|
package/dist/lib/cjs/bin.js
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
4
|
+
// This file is intentionally CJS `require()` rather than ESM `import`. It runs as the bin
|
|
5
|
+
// entry compiled to dist/lib/cjs/bin.js, where (a) the load order matters (reflect-metadata
|
|
6
|
+
// MUST initialize before any decorated class is touched) and (b) static `import` cannot be
|
|
7
|
+
// reordered around package-loading side effects the way explicit require() calls can.
|
|
8
|
+
//
|
|
9
|
+
// reflect-metadata must load before any decorated class so the @injectable/@tag decorators
|
|
10
|
+
// can record their metadata against the same Reflect.metadata storage tsyringe later reads.
|
|
11
|
+
require('reflect-metadata');
|
|
12
|
+
// Load the cli via its package name (not a relative require) so this bin and the consumer's
|
|
13
|
+
// AppModule both resolve to the same physical copy of every @pristine-ts/cli class. If we
|
|
14
|
+
// loaded via `./cli.js` and the consumer's app.module.js loaded via `@pristine-ts/cli`, the
|
|
15
|
+
// two halves would each get their own class identities and tsyringe's decorator metadata
|
|
16
|
+
// (keyed by class identity) would not be shared — manifesting as "TypeInfo not known for X".
|
|
17
|
+
require('@pristine-ts/cli').bootstrap();
|
|
4
18
|
//# 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,OAAO,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,OAAO,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
12
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
13
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
15
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
16
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
17
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.AppModuleLoader = void 0;
|
|
25
|
+
const tsyringe_1 = require("tsyringe");
|
|
26
|
+
const fs_1 = __importDefault(require("fs"));
|
|
27
|
+
const path_1 = __importDefault(require("path"));
|
|
28
|
+
const url_1 = require("url");
|
|
29
|
+
const logging_1 = require("@pristine-ts/logging");
|
|
30
|
+
const file_1 = require("@pristine-ts/file");
|
|
31
|
+
const cli_module_1 = require("../cli.module");
|
|
32
|
+
const config_loader_1 = require("../config/config-loader");
|
|
33
|
+
const build_manifest_checker_1 = require("./build-manifest-checker");
|
|
34
|
+
const build_manifest_reader_1 = require("./build-manifest-reader");
|
|
35
|
+
const build_manifest_staleness_enum_1 = require("./build-manifest-staleness.enum");
|
|
36
|
+
const build_runner_1 = require("./build-runner");
|
|
37
|
+
const build_staleness_prompt_1 = require("./build-staleness-prompt");
|
|
38
|
+
const dynamic_importer_1 = require("./dynamic-importer");
|
|
39
|
+
const loaded_app_module_1 = require("./loaded-app-module");
|
|
40
|
+
const plugin_loader_1 = require("./plugin-loader");
|
|
41
|
+
/**
|
|
42
|
+
* 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`).
|
|
45
|
+
*
|
|
46
|
+
* Resolution path:
|
|
47
|
+
* 1. Read `pristine.config.{ts,js}` via `ConfigLoader`.
|
|
48
|
+
* 2. If `appModule` is configured: ensure the build is fresh (manifest check, prompt or
|
|
49
|
+
* fail on stale), then dynamically import the configured `outputPath`.
|
|
50
|
+
* 3. If anything above is missing or broken: fall back to a `CliModule`-only synthetic
|
|
51
|
+
* AppModule so built-in commands (notably `pristine init`) remain runnable. This is
|
|
52
|
+
* the only escape hatch — there is no convention scan, no package.json discovery,
|
|
53
|
+
* no cached prior selection.
|
|
54
|
+
*/
|
|
55
|
+
let AppModuleLoader = class AppModuleLoader {
|
|
56
|
+
constructor(configLoader, pluginLoader, dynamicImporter, buildManifestReader, buildManifestChecker, buildStalenessPrompt, buildRunner) {
|
|
57
|
+
this.configLoader = configLoader;
|
|
58
|
+
this.pluginLoader = pluginLoader;
|
|
59
|
+
this.dynamicImporter = dynamicImporter;
|
|
60
|
+
this.buildManifestReader = buildManifestReader;
|
|
61
|
+
this.buildManifestChecker = buildManifestChecker;
|
|
62
|
+
this.buildStalenessPrompt = buildStalenessPrompt;
|
|
63
|
+
this.buildRunner = buildRunner;
|
|
64
|
+
this.defaultExportName = "AppModule";
|
|
65
|
+
this.fallbackKeyname = "__auto_generated_app.module__";
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Resolves the consumer's AppModule and the kernel configuration the CLI should boot
|
|
69
|
+
* with. The flow has five stages, executed in order:
|
|
70
|
+
*
|
|
71
|
+
* 1. **Read the project's pristine.config.{ts,js}** — single source of truth for
|
|
72
|
+
* where the user's AppModule lives and what plugins to wire in.
|
|
73
|
+
* 2. **Check the compiled AppModule is in sync with its source** — when both
|
|
74
|
+
* `appModule.sourcePath` and `appModule.outputPath` are configured, compare the
|
|
75
|
+
* build manifest's recorded source hash against the current source. If they
|
|
76
|
+
* diverge (the user edited source but didn't rebuild), prompt to rebuild in an
|
|
77
|
+
* interactive terminal, or fail with an actionable error in CI / non-interactive
|
|
78
|
+
* contexts.
|
|
79
|
+
* 3. **Dynamically import the compiled AppModule** — load the JS file at
|
|
80
|
+
* `outputPath` and pull out the configured named export (default `AppModule`).
|
|
81
|
+
* 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
|
|
83
|
+
* threw, build a synthetic AppModule that imports just CliModule. This keeps the
|
|
84
|
+
* bin runnable so the user can run `pristine init`, `pristine help`, etc. to
|
|
85
|
+
* recover. There is no convention scan, no package.json discovery — only this
|
|
86
|
+
* one escape hatch.
|
|
87
|
+
* 5. **Wrap with config-declared plugins** — load every plugin listed in the
|
|
88
|
+
* config's `plugins` array and merge their modules into the AppModule's import
|
|
89
|
+
* graph via a synthetic outer module.
|
|
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.
|
|
94
|
+
*/
|
|
95
|
+
load() {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
var _a, _b;
|
|
98
|
+
const projectRoot = process.cwd();
|
|
99
|
+
let appModule;
|
|
100
|
+
let isLoggingModulePresent = false;
|
|
101
|
+
let resolvedPath;
|
|
102
|
+
let appModuleExportName = this.defaultExportName;
|
|
103
|
+
// ── Stage 1: read the project's pristine.config.{ts,js}. ──
|
|
104
|
+
// Walks up from cwd looking for the config file; returns an empty config object
|
|
105
|
+
// when no file is found, which lets the substitute-AppModule branch in Stage 4
|
|
106
|
+
// take over instead of erroring out.
|
|
107
|
+
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`.
|
|
110
|
+
if ((appModuleConfig === null || appModuleConfig === void 0 ? void 0 : appModuleConfig.export) !== undefined) {
|
|
111
|
+
appModuleExportName = appModuleConfig.export;
|
|
112
|
+
}
|
|
113
|
+
// ── Stage 2: check the compiled AppModule is in sync with its source. ──
|
|
114
|
+
// Only runs when both sourcePath + outputPath are configured (the canonical setup).
|
|
115
|
+
// `ensureFreshBuild` returns false when the user declined to rebuild after a
|
|
116
|
+
// staleness prompt, or when we're non-interactive and stale. In either case we
|
|
117
|
+
// substitute the CliModule-only AppModule so commands like `pristine init` and
|
|
118
|
+
// `pristine help` still work.
|
|
119
|
+
if ((appModuleConfig === null || appModuleConfig === void 0 ? void 0 : appModuleConfig.sourcePath) !== undefined && (appModuleConfig === null || appModuleConfig === void 0 ? void 0 : appModuleConfig.outputPath) !== undefined) {
|
|
120
|
+
const ensured = yield this.ensureFreshBuild(projectRoot, appModuleConfig.sourcePath, appModuleConfig.outputPath);
|
|
121
|
+
if (ensured === false) {
|
|
122
|
+
const fallback = yield this.buildFallbackAppModule(projectRoot);
|
|
123
|
+
return new loaded_app_module_1.LoadedAppModule(fallback.appModule, this.buildKernelConfiguration(fallback.isLoggingModulePresent, resolvedConfig.config.kernelConfiguration), fallback.isLoggingModulePresent, []);
|
|
124
|
+
}
|
|
125
|
+
resolvedPath = path_1.default.resolve(projectRoot, appModuleConfig.outputPath);
|
|
126
|
+
}
|
|
127
|
+
// ── Stage 3: dynamically import the AppModule (or fall through to Stage 4). ──
|
|
128
|
+
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
|
+
try {
|
|
133
|
+
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
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
// Stage 4 (the configured file is broken or missing): we don't crash — that
|
|
138
|
+
// would prevent `pristine init` from running and leave the user with no way to
|
|
139
|
+
// fix their config. Warn loudly, substitute the CliModule-only AppModule, and
|
|
140
|
+
// let the user re-run after fixing the issue.
|
|
141
|
+
process.stderr.write(`[pristine] Failed to load AppModule from '${resolvedPath}': ${error.message}\n` +
|
|
142
|
+
`[pristine] Falling back to built-in commands only. Fix your AppModule config and re-run.\n`);
|
|
143
|
+
const fallback = yield this.buildFallbackAppModule(projectRoot);
|
|
144
|
+
appModule = fallback.appModule;
|
|
145
|
+
isLoggingModulePresent = fallback.isLoggingModulePresent;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
// Stage 4 (no `appModule` block, or no config file at all): substitute the
|
|
150
|
+
// CliModule-only AppModule so the bin can still bootstrap the user's project.
|
|
151
|
+
// First-run case (`pristine init` from a fresh project) lands here.
|
|
152
|
+
const fallback = yield this.buildFallbackAppModule(projectRoot);
|
|
153
|
+
appModule = fallback.appModule;
|
|
154
|
+
isLoggingModulePresent = fallback.isLoggingModulePresent;
|
|
155
|
+
}
|
|
156
|
+
// ── Stage 5: wrap with config-declared plugins. ──
|
|
157
|
+
// Plugins declared in `pristine.config.ts` contribute additional modules (e.g.
|
|
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
|
+
// fix the offending entry.
|
|
161
|
+
let plugins = [];
|
|
162
|
+
try {
|
|
163
|
+
plugins = yield this.pluginLoader.load(resolvedConfig.config, resolvedConfig.configFilePath, projectRoot);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
process.stderr.write(`${error.message}\n`);
|
|
167
|
+
process.stderr.write("[pristine] Continuing without plugins. Fix the plugin config and re-run.\n");
|
|
168
|
+
}
|
|
169
|
+
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
|
+
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
|
+
}
|
|
178
|
+
// ── Final: assemble the kernel configuration overlay and return. ──
|
|
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);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Manifest gate. Checks whether the build manifest still describes the current source/output
|
|
188
|
+
* paths and source content. If not, prompts the user (TTY) or fails (non-TTY) with a clear
|
|
189
|
+
* explanation. On a successful inline rebuild, returns true.
|
|
190
|
+
*
|
|
191
|
+
* Returns true when the build is fresh or just got rebuilt; false when the user declined to
|
|
192
|
+
* rebuild or when non-TTY hit a stale state. Callers should treat false as "stop the load".
|
|
193
|
+
* @private
|
|
194
|
+
*/
|
|
195
|
+
ensureFreshBuild(projectRoot, sourcePath, outputPath) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
const manifest = this.buildManifestReader.read(projectRoot);
|
|
198
|
+
const staleness = this.buildManifestChecker.check(manifest, projectRoot, sourcePath, outputPath);
|
|
199
|
+
if (staleness === build_manifest_staleness_enum_1.BuildManifestStalenessEnum.Fresh) {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
// No manifest on disk → user is building with their own pipeline (raw `tsc`, esbuild,
|
|
203
|
+
// a CI step, etc.) and never invoking `pristine build`. The manifest's purpose is to
|
|
204
|
+
// detect drift between source and a Pristine-managed build; with no manifest there is
|
|
205
|
+
// nothing to compare against, so we skip the gate. We still require the configured
|
|
206
|
+
// `outputPath` to exist — otherwise there's nothing to load.
|
|
207
|
+
if (staleness === build_manifest_staleness_enum_1.BuildManifestStalenessEnum.Missing) {
|
|
208
|
+
const absoluteOutput = path_1.default.resolve(projectRoot, outputPath);
|
|
209
|
+
if (fs_1.default.existsSync(absoluteOutput)) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
// Fall through to the "stale" path below — the output is genuinely missing,
|
|
213
|
+
// which the prompt/non-TTY branches handle with the right error message.
|
|
214
|
+
}
|
|
215
|
+
const explanation = this.buildStalenessPrompt.describe(staleness);
|
|
216
|
+
if (this.buildStalenessPrompt.isInteractive() === false) {
|
|
217
|
+
process.stderr.write(`[pristine] ${explanation}\n`);
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
const shouldRebuild = yield this.buildStalenessPrompt.prompt(staleness);
|
|
221
|
+
if (shouldRebuild !== true) {
|
|
222
|
+
process.stderr.write(`[pristine] ${explanation}\n`);
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
process.stderr.write(`[pristine] Rebuilding...\n`);
|
|
226
|
+
const buildSucceeded = this.buildRunner.run();
|
|
227
|
+
if (buildSucceeded === false) {
|
|
228
|
+
process.stderr.write(`[pristine] Rebuild failed. Fix the build error and re-run.\n`);
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
// After a successful rebuild, re-check that the manifest now passes — guards against the
|
|
232
|
+
// edge case where `pristine build` ran but, for whatever reason (unconfigured paths,
|
|
233
|
+
// tsconfig mismatch), didn't write a fresh manifest.
|
|
234
|
+
const reReadManifest = this.buildManifestReader.read(projectRoot);
|
|
235
|
+
const recheckStaleness = this.buildManifestChecker.check(reReadManifest, projectRoot, sourcePath, outputPath);
|
|
236
|
+
if (recheckStaleness !== build_manifest_staleness_enum_1.BuildManifestStalenessEnum.Fresh) {
|
|
237
|
+
process.stderr.write(`[pristine] Build ran but manifest is still stale: ${this.buildStalenessPrompt.describe(recheckStaleness)}\n`);
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
return true;
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
importAppModule(absolutePath, exportName) {
|
|
244
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
+
const url = (0, url_1.pathToFileURL)(absolutePath).href;
|
|
246
|
+
const loaded = yield this.dynamicImporter.import(url);
|
|
247
|
+
if (!loaded || !loaded[exportName]) {
|
|
248
|
+
throw new Error(`[pristine] The file at '${absolutePath}' was loaded but did not export '${exportName}'. ` +
|
|
249
|
+
`Make sure your AppModule file does \`export const ${exportName}: AppModuleInterface = { ... }\`.`);
|
|
250
|
+
}
|
|
251
|
+
return loaded[exportName];
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Builds the safety-net AppModule used when no `appModule` is configured or the configured
|
|
256
|
+
* file fails to load. Scrapes any `node_modules/@pristine-ts/*` packages already installed
|
|
257
|
+
* so built-in commands they contribute (e.g. `pristine list`) are still available, then
|
|
258
|
+
* appends `CliModule` so at minimum the CLI's own commands run. This is intentionally a
|
|
259
|
+
* one-way safety net, not a discovery tier — it only fires when nothing else worked.
|
|
260
|
+
*/
|
|
261
|
+
buildFallbackAppModule(projectRoot) {
|
|
262
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
263
|
+
const pristineNodeModulesPath = path_1.default.resolve(projectRoot, "node_modules", "@pristine-ts");
|
|
264
|
+
const modules = [];
|
|
265
|
+
let isLoggingModulePresent = false;
|
|
266
|
+
if (fs_1.default.existsSync(pristineNodeModulesPath)) {
|
|
267
|
+
const directoryManager = new file_1.DirectoryManager(new file_1.FileManager());
|
|
268
|
+
const moduleFiles = yield directoryManager.list(pristineNodeModulesPath, {
|
|
269
|
+
matchType: file_1.MatchTypeEnum.Path,
|
|
270
|
+
match: /.*\/cjs\/.*\.module\.js$/,
|
|
271
|
+
types: file_1.TypesEnum.File,
|
|
272
|
+
resultType: file_1.DirectoryListResultEnum.FilePath,
|
|
273
|
+
recurse: true,
|
|
274
|
+
});
|
|
275
|
+
for (const moduleFile of moduleFiles) {
|
|
276
|
+
const module = yield this.dynamicImporter.import((0, url_1.pathToFileURL)(moduleFile).href);
|
|
277
|
+
for (const key in module) {
|
|
278
|
+
if (key === "LoggingModule")
|
|
279
|
+
isLoggingModulePresent = true;
|
|
280
|
+
if (key.endsWith("Module"))
|
|
281
|
+
modules.push(module[key]);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (modules.length === 0) {
|
|
286
|
+
modules.push(cli_module_1.CliModule);
|
|
287
|
+
}
|
|
288
|
+
return {
|
|
289
|
+
appModule: {
|
|
290
|
+
keyname: this.fallbackKeyname,
|
|
291
|
+
importModules: modules,
|
|
292
|
+
importServices: [],
|
|
293
|
+
},
|
|
294
|
+
isLoggingModulePresent,
|
|
295
|
+
};
|
|
296
|
+
});
|
|
297
|
+
}
|
|
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
|
+
};
|
|
310
|
+
exports.AppModuleLoader = AppModuleLoader;
|
|
311
|
+
exports.AppModuleLoader = AppModuleLoader = __decorate([
|
|
312
|
+
(0, tsyringe_1.injectable)(),
|
|
313
|
+
__metadata("design:paramtypes", [config_loader_1.ConfigLoader,
|
|
314
|
+
plugin_loader_1.PluginLoader,
|
|
315
|
+
dynamic_importer_1.DynamicImporter,
|
|
316
|
+
build_manifest_reader_1.BuildManifestReader,
|
|
317
|
+
build_manifest_checker_1.BuildManifestChecker,
|
|
318
|
+
build_staleness_prompt_1.BuildStalenessPrompt,
|
|
319
|
+
build_runner_1.BuildRunner])
|
|
320
|
+
], AppModuleLoader);
|
|
321
|
+
//# sourceMappingURL=app-module-loader.js.map
|
|
@@ -0,0 +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;AAGlC,kDAAwF;AACxF,4CAAmH;AACnH,8CAAwC;AACxC,2DAAqD;AACrD,qEAA8D;AAC9D,mEAA4D;AAC5D,mFAA2E;AAC3E,iDAA2C;AAC3C,qEAA8D;AAC9D,yDAAmD;AACnD,2DAAoD;AAEpD,mDAA6C;AAE7C;;;;;;;;;;;;;GAaG;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;QAChC,wBAAmB,GAAnB,mBAAmB,CAAqB;QACxC,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,yBAAoB,GAApB,oBAAoB,CAAsB;QAC1C,gBAAW,GAAX,WAAW,CAAa;QAV1B,sBAAiB,GAAW,WAAW,CAAC;QACxC,oBAAe,GAAW,+BAA+B,CAAC;IAW3E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2B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;QACJ,CAAC;KAAA;IAEO,wBAAwB,CAAC,sBAA+B,EAAE,uBAA4D;QAC5H,MAAM,aAAa,GAAgD,EAAE,CAAC;QAEtE,IAAI,sBAAsB,EAAE,CAAC;YAC3B,aAAa,CAAC,8BAAoB,GAAG,0BAA0B,CAAC,GAAG,wBAAc,CAAC,MAAM,CAAC;YACzF,aAAa,CAAC,8BAAoB,GAAG,gCAAgC,CAAC,GAAG,sBAAY,CAAC,KAAK,CAAC;QAC9F,CAAC;QAED,IAAI,uBAAuB,KAAK,SAAS,EAAE,CAAC;YAC1C,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,uBAAuB,CAAC,CAAC;QACxD,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;CACF,CAAA;AAzRY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,qBAAU,GAAE;qCAMsB,4BAAY;QACZ,4BAAY;QACT,kCAAe;QACX,2CAAmB;QAClB,6CAAoB;QACpB,6CAAoB;QAC7B,0BAAW;GAXhC,eAAe,CAyR3B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./app-module-loader"), exports);
|
|
18
|
+
__exportStar(require("./build-manifest"), exports);
|
|
19
|
+
__exportStar(require("./build-manifest-checker"), exports);
|
|
20
|
+
__exportStar(require("./build-manifest-reader"), exports);
|
|
21
|
+
__exportStar(require("./build-manifest-staleness.enum"), exports);
|
|
22
|
+
__exportStar(require("./build-manifest-writer"), exports);
|
|
23
|
+
__exportStar(require("./build-runner"), exports);
|
|
24
|
+
__exportStar(require("./build-staleness-prompt"), exports);
|
|
25
|
+
__exportStar(require("./dynamic-importer"), exports);
|
|
26
|
+
__exportStar(require("./init-prompt"), exports);
|
|
27
|
+
__exportStar(require("./loaded-app-module"), exports);
|
|
28
|
+
__exportStar(require("./loaded-plugin"), exports);
|
|
29
|
+
__exportStar(require("./plugin-loader"), exports);
|
|
30
|
+
__exportStar(require("./source-hasher"), exports);
|
|
31
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/bootstrap/bootstrap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,mDAAiC;AACjC,2DAAyC;AACzC,0DAAwC;AACxC,kEAAgD;AAChD,0DAAwC;AACxC,iDAA+B;AAC/B,2DAAyC;AACzC,qDAAmC;AACnC,gDAA8B;AAC9B,sDAAoC;AACpC,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.BuildManifestChecker = void 0;
|
|
16
|
+
const tsyringe_1 = require("tsyringe");
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const build_manifest_staleness_enum_1 = require("./build-manifest-staleness.enum");
|
|
20
|
+
const source_hasher_1 = require("./source-hasher");
|
|
21
|
+
/**
|
|
22
|
+
* Decides whether an existing `BuildManifest` still describes the current state of the
|
|
23
|
+
* project. Compares the manifest's stored paths/hash against the live config + source file
|
|
24
|
+
* + filesystem. Returns the most-specific reason the manifest is stale so the caller can
|
|
25
|
+
* render a helpful message ("source changed", "output missing", etc.) rather than a vague
|
|
26
|
+
* "stale".
|
|
27
|
+
*
|
|
28
|
+
* Order of checks matches user impact: things that mean "you definitely need to rebuild"
|
|
29
|
+
* (output missing, source content changed) come before path drift (config edited but build
|
|
30
|
+
* not yet rerun) — both are correct to flag, but the messaging differs.
|
|
31
|
+
*/
|
|
32
|
+
let BuildManifestChecker = class BuildManifestChecker {
|
|
33
|
+
constructor(sourceHasher) {
|
|
34
|
+
this.sourceHasher = sourceHasher;
|
|
35
|
+
}
|
|
36
|
+
check(manifest, projectRoot, configuredSourcePath, configuredOutputPath) {
|
|
37
|
+
if (manifest === undefined) {
|
|
38
|
+
return build_manifest_staleness_enum_1.BuildManifestStalenessEnum.Missing;
|
|
39
|
+
}
|
|
40
|
+
const absoluteConfiguredSource = path_1.default.resolve(projectRoot, configuredSourcePath);
|
|
41
|
+
const absoluteConfiguredOutput = path_1.default.resolve(projectRoot, configuredOutputPath);
|
|
42
|
+
if (manifest.appModuleSourcePath !== absoluteConfiguredSource) {
|
|
43
|
+
return build_manifest_staleness_enum_1.BuildManifestStalenessEnum.SourcePathChanged;
|
|
44
|
+
}
|
|
45
|
+
if (manifest.appModuleOutputPath !== absoluteConfiguredOutput) {
|
|
46
|
+
return build_manifest_staleness_enum_1.BuildManifestStalenessEnum.OutputPathChanged;
|
|
47
|
+
}
|
|
48
|
+
if (fs_1.default.existsSync(manifest.appModuleOutputPath) === false) {
|
|
49
|
+
return build_manifest_staleness_enum_1.BuildManifestStalenessEnum.OutputMissing;
|
|
50
|
+
}
|
|
51
|
+
if (fs_1.default.existsSync(manifest.appModuleSourcePath) === false) {
|
|
52
|
+
// Source vanished — report as content-changed since "missing" is the extreme form.
|
|
53
|
+
return build_manifest_staleness_enum_1.BuildManifestStalenessEnum.SourceContentChanged;
|
|
54
|
+
}
|
|
55
|
+
const currentHash = this.sourceHasher.hashFile(manifest.appModuleSourcePath);
|
|
56
|
+
if (currentHash !== manifest.sourceHash) {
|
|
57
|
+
return build_manifest_staleness_enum_1.BuildManifestStalenessEnum.SourceContentChanged;
|
|
58
|
+
}
|
|
59
|
+
return build_manifest_staleness_enum_1.BuildManifestStalenessEnum.Fresh;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.BuildManifestChecker = BuildManifestChecker;
|
|
63
|
+
exports.BuildManifestChecker = BuildManifestChecker = __decorate([
|
|
64
|
+
(0, tsyringe_1.injectable)(),
|
|
65
|
+
__metadata("design:paramtypes", [source_hasher_1.SourceHasher])
|
|
66
|
+
], BuildManifestChecker);
|
|
67
|
+
//# sourceMappingURL=build-manifest-checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-manifest-checker.js","s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,IAAI,WAAW,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC;YACxC,OAAO,0DAA0B,CAAC,oBAAoB,CAAC;QACzD,CAAC;QAED,OAAO,0DAA0B,CAAC,KAAK,CAAC;IAC1C,CAAC;CACF,CAAA;AAzCY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,qBAAU,GAAE;qCAEgC,4BAAY;GAD5C,oBAAoB,CAyChC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BuildManifestReader = void 0;
|
|
13
|
+
const tsyringe_1 = require("tsyringe");
|
|
14
|
+
const fs_1 = __importDefault(require("fs"));
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
const build_manifest_1 = require("./build-manifest");
|
|
17
|
+
/**
|
|
18
|
+
* Reads `<projectRoot>/.pristine/build-manifest.json` if present and returns a `BuildManifest`
|
|
19
|
+
* instance. Used by `AppModuleLoader` and `BuildManifestChecker` to inspect the last build.
|
|
20
|
+
*
|
|
21
|
+
* Returns `undefined` (not throws) when the manifest is missing — that's a normal state for
|
|
22
|
+
* fresh projects that haven't run `pristine build` yet. Genuine errors (corrupt JSON, IO
|
|
23
|
+
* failure) do throw, since silently treating those as "no manifest" would mask real problems.
|
|
24
|
+
*/
|
|
25
|
+
let BuildManifestReader = class BuildManifestReader {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.cacheDirName = ".pristine";
|
|
28
|
+
this.manifestFileName = "build-manifest.json";
|
|
29
|
+
}
|
|
30
|
+
read(projectRoot) {
|
|
31
|
+
const manifestPath = path_1.default.resolve(projectRoot, this.cacheDirName, this.manifestFileName);
|
|
32
|
+
if (fs_1.default.existsSync(manifestPath) === false) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const raw = fs_1.default.readFileSync(manifestPath, "utf8");
|
|
36
|
+
const parsed = JSON.parse(raw);
|
|
37
|
+
return new build_manifest_1.BuildManifest(parsed.appModuleSourcePath, parsed.appModuleOutputPath, parsed.sourceHash, parsed.builtAt);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.BuildManifestReader = BuildManifestReader;
|
|
41
|
+
exports.BuildManifestReader = BuildManifestReader = __decorate([
|
|
42
|
+
(0, tsyringe_1.injectable)()
|
|
43
|
+
], BuildManifestReader);
|
|
44
|
+
//# sourceMappingURL=build-manifest-reader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-manifest-reader.js","sourceRoot":"","sources":["../../../../src/bootstrap/build-manifest-reader.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AACxB,qDAA+C;AAE/C;;;;;;;GAOG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAAzB;QACY,iBAAY,GAAW,WAAW,CAAC;QACnC,qBAAgB,GAAW,qBAAqB,CAAC;IAkBpE,CAAC;IAhBC,IAAI,CAAC,WAAmB;QACtB,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACzF,IAAI,YAAE,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,KAAK,EAAE,CAAC;YAC1C,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,GAAG,GAAG,YAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE/B,OAAO,IAAI,8BAAa,CACtB,MAAM,CAAC,mBAAmB,EAC1B,MAAM,CAAC,mBAAmB,EAC1B,MAAM,CAAC,UAAU,EACjB,MAAM,CAAC,OAAO,CACf,CAAC;IACJ,CAAC;CACF,CAAA;AApBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,qBAAU,GAAE;GACA,mBAAmB,CAoB/B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildManifestStalenessEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Why a build manifest is no longer trustworthy. Returned by `BuildManifestChecker` so the
|
|
6
|
+
* caller can render an error message specific to the actual cause rather than a vague "stale".
|
|
7
|
+
*/
|
|
8
|
+
var BuildManifestStalenessEnum;
|
|
9
|
+
(function (BuildManifestStalenessEnum) {
|
|
10
|
+
/** Manifest is current — the build output matches what the config + source describe. */
|
|
11
|
+
BuildManifestStalenessEnum["Fresh"] = "fresh";
|
|
12
|
+
/** No manifest file on disk. The user hasn't run `pristine build` yet (or deleted the cache). */
|
|
13
|
+
BuildManifestStalenessEnum["Missing"] = "missing";
|
|
14
|
+
/** The configured `sourcePath` no longer matches the path stored in the manifest. */
|
|
15
|
+
BuildManifestStalenessEnum["SourcePathChanged"] = "source-path-changed";
|
|
16
|
+
/** The configured `outputPath` no longer matches the path stored in the manifest. */
|
|
17
|
+
BuildManifestStalenessEnum["OutputPathChanged"] = "output-path-changed";
|
|
18
|
+
/** The source file's content hash no longer matches what was hashed at build time. */
|
|
19
|
+
BuildManifestStalenessEnum["SourceContentChanged"] = "source-content-changed";
|
|
20
|
+
/** The compiled output file referenced by the manifest is missing from disk. */
|
|
21
|
+
BuildManifestStalenessEnum["OutputMissing"] = "output-missing";
|
|
22
|
+
})(BuildManifestStalenessEnum || (exports.BuildManifestStalenessEnum = BuildManifestStalenessEnum = {}));
|
|
23
|
+
//# sourceMappingURL=build-manifest-staleness.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-manifest-staleness.enum.js","sourceRoot":"","sources":["../../../../src/bootstrap/build-manifest-staleness.enum.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,0BAaX;AAbD,WAAY,0BAA0B;IACpC,wFAAwF;IACxF,6CAAe,CAAA;IACf,iGAAiG;IACjG,iDAAmB,CAAA;IACnB,qFAAqF;IACrF,uEAAyC,CAAA;IACzC,qFAAqF;IACrF,uEAAyC,CAAA;IACzC,sFAAsF;IACtF,6EAA+C,CAAA;IAC/C,gFAAgF;IAChF,8DAAgC,CAAA;AAClC,CAAC,EAbW,0BAA0B,0CAA1B,0BAA0B,QAarC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.BuildManifestWriter = void 0;
|
|
16
|
+
const tsyringe_1 = require("tsyringe");
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const build_manifest_1 = require("./build-manifest");
|
|
20
|
+
const source_hasher_1 = require("./source-hasher");
|
|
21
|
+
/**
|
|
22
|
+
* Writes the build manifest to `<projectRoot>/.pristine/build-manifest.json` atomically
|
|
23
|
+
* (write-then-rename) so a partial write can never poison subsequent reads. Used by
|
|
24
|
+
* `BuildCommand` after a successful compile.
|
|
25
|
+
*
|
|
26
|
+
* Atomicity matters: if `pristine build` is interrupted (Ctrl+C, OOM kill) mid-write, a
|
|
27
|
+
* half-written JSON file would make the next `pristine start` think the build was good but
|
|
28
|
+
* fail to parse the manifest. Renaming after a complete write ensures readers either see
|
|
29
|
+
* the previous manifest or the new one — never a torn one.
|
|
30
|
+
*/
|
|
31
|
+
let BuildManifestWriter = class BuildManifestWriter {
|
|
32
|
+
constructor(sourceHasher) {
|
|
33
|
+
this.sourceHasher = sourceHasher;
|
|
34
|
+
this.cacheDirName = ".pristine";
|
|
35
|
+
this.manifestFileName = "build-manifest.json";
|
|
36
|
+
}
|
|
37
|
+
write(projectRoot, sourcePath, outputPath) {
|
|
38
|
+
const absoluteSource = path_1.default.resolve(projectRoot, sourcePath);
|
|
39
|
+
const absoluteOutput = path_1.default.resolve(projectRoot, outputPath);
|
|
40
|
+
const manifest = new build_manifest_1.BuildManifest(absoluteSource, absoluteOutput, this.sourceHasher.hashFile(absoluteSource), new Date().toISOString());
|
|
41
|
+
const cacheDir = path_1.default.resolve(projectRoot, this.cacheDirName);
|
|
42
|
+
fs_1.default.mkdirSync(cacheDir, { recursive: true });
|
|
43
|
+
const finalPath = path_1.default.resolve(cacheDir, this.manifestFileName);
|
|
44
|
+
const tempPath = finalPath + ".tmp";
|
|
45
|
+
fs_1.default.writeFileSync(tempPath, JSON.stringify(manifest, null, 2), "utf8");
|
|
46
|
+
fs_1.default.renameSync(tempPath, finalPath);
|
|
47
|
+
return manifest;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.BuildManifestWriter = BuildManifestWriter;
|
|
51
|
+
exports.BuildManifestWriter = BuildManifestWriter = __decorate([
|
|
52
|
+
(0, tsyringe_1.injectable)(),
|
|
53
|
+
__metadata("design:paramtypes", [source_hasher_1.SourceHasher])
|
|
54
|
+
], BuildManifestWriter);
|
|
55
|
+
//# sourceMappingURL=build-manifest-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-manifest-writer.js","sourceRoot":"","sources":["../../../../src/bootstrap/build-manifest-writer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uCAAoC;AACpC,4CAAoB;AACpB,gDAAwB;AACxB,qDAA+C;AAC/C,mDAA6C;AAE7C;;;;;;;;;GASG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAI9B,YAA6B,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;QAHtC,iBAAY,GAAW,WAAW,CAAC;QACnC,qBAAgB,GAAW,qBAAqB,CAAC;IAGlE,CAAC;IAED,KAAK,CAAC,WAAmB,EAAE,UAAkB,EAAE,UAAkB;QAC/D,MAAM,cAAc,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAC7D,MAAM,cAAc,GAAG,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAE7D,MAAM,QAAQ,GAAG,IAAI,8BAAa,CAChC,cAAc,EACd,cAAc,EACd,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,cAAc,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