@ts-ioc-container/bundler 7.0.0 → 8.0.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.
Files changed (59) hide show
  1. package/AGENTS.md +2 -2
  2. package/cjm/app.js +14 -4
  3. package/cjm/cli/usage.js +2 -1
  4. package/cjm/features/{build → bundle}/BuildModule.js +6 -4
  5. package/cjm/features/{build/BuildController.js → bundle/BundleController.js} +30 -16
  6. package/cjm/features/{build/services/BundleBuilder.js → bundle/services/BundleService.js} +25 -41
  7. package/cjm/features/bundle/services/BundleView.js +58 -0
  8. package/cjm/index.js +20 -21
  9. package/cjm/schema/ticConfigSchema.js +1 -1
  10. package/cjm/services/ConsoleLogger.js +3 -0
  11. package/package.json +1 -1
  12. package/typings/app.d.ts +22 -4
  13. package/typings/cli/usage.d.ts.map +1 -1
  14. package/typings/features/{build → bundle}/BuildConfig.d.ts +4 -4
  15. package/typings/features/bundle/BuildConfig.d.ts.map +1 -0
  16. package/typings/features/bundle/BuildModule.d.ts.map +1 -0
  17. package/typings/features/{build/BuildController.d.ts → bundle/BundleController.d.ts} +10 -7
  18. package/typings/features/bundle/BundleController.d.ts.map +1 -0
  19. package/typings/features/bundle/domain/ImportPaths.d.ts.map +1 -0
  20. package/typings/features/bundle/domain/glob.d.ts.map +1 -0
  21. package/typings/features/bundle/domain/scan.d.ts.map +1 -0
  22. package/typings/features/bundle/domain/tokenCollisions.d.ts.map +1 -0
  23. package/typings/features/bundle/domain/tsconfig.d.ts.map +1 -0
  24. package/typings/features/bundle/services/BundleService.d.ts +39 -0
  25. package/typings/features/bundle/services/BundleService.d.ts.map +1 -0
  26. package/typings/features/bundle/services/BundleView.d.ts +33 -0
  27. package/typings/features/bundle/services/BundleView.d.ts.map +1 -0
  28. package/typings/features/{build → bundle}/services/TicConfigService.d.ts +5 -5
  29. package/typings/features/bundle/services/TicConfigService.d.ts.map +1 -0
  30. package/typings/index.d.ts +12 -12
  31. package/typings/services/ConsoleLogger.d.ts +4 -1
  32. package/typings/services/ConsoleLogger.d.ts.map +1 -1
  33. package/cjm/features/build/domain/emit.js +0 -34
  34. package/typings/features/build/BuildConfig.d.ts.map +0 -1
  35. package/typings/features/build/BuildController.d.ts.map +0 -1
  36. package/typings/features/build/BuildModule.d.ts.map +0 -1
  37. package/typings/features/build/domain/ImportPaths.d.ts.map +0 -1
  38. package/typings/features/build/domain/emit.d.ts +0 -36
  39. package/typings/features/build/domain/emit.d.ts.map +0 -1
  40. package/typings/features/build/domain/glob.d.ts.map +0 -1
  41. package/typings/features/build/domain/scan.d.ts.map +0 -1
  42. package/typings/features/build/domain/tokenCollisions.d.ts.map +0 -1
  43. package/typings/features/build/domain/tsconfig.d.ts.map +0 -1
  44. package/typings/features/build/services/BundleBuilder.d.ts +0 -64
  45. package/typings/features/build/services/BundleBuilder.d.ts.map +0 -1
  46. package/typings/features/build/services/TicConfigService.d.ts.map +0 -1
  47. /package/cjm/features/{build → bundle}/BuildConfig.js +0 -0
  48. /package/cjm/features/{build → bundle}/domain/ImportPaths.js +0 -0
  49. /package/cjm/features/{build → bundle}/domain/glob.js +0 -0
  50. /package/cjm/features/{build → bundle}/domain/scan.js +0 -0
  51. /package/cjm/features/{build → bundle}/domain/tokenCollisions.js +0 -0
  52. /package/cjm/features/{build → bundle}/domain/tsconfig.js +0 -0
  53. /package/cjm/features/{build → bundle}/services/TicConfigService.js +0 -0
  54. /package/typings/features/{build → bundle}/BuildModule.d.ts +0 -0
  55. /package/typings/features/{build → bundle}/domain/ImportPaths.d.ts +0 -0
  56. /package/typings/features/{build → bundle}/domain/glob.d.ts +0 -0
  57. /package/typings/features/{build → bundle}/domain/scan.d.ts +0 -0
  58. /package/typings/features/{build → bundle}/domain/tokenCollisions.d.ts +0 -0
  59. /package/typings/features/{build → bundle}/domain/tsconfig.d.ts +0 -0
package/AGENTS.md CHANGED
@@ -81,8 +81,8 @@ IContainerModule`, applied with `container.useModule(new AppBundle())`.
81
81
  `@onDefault(invoke)` action (a word in the action position that names no
82
82
  declared action is the default action's argument: `tic build <config>`), which parses its own options with
83
83
  `@inject(pipe(commandArgs, parseOptions(spec), validate(SCHEMA)))`. Work lives in
84
- services behind tokens (`IBundleBuilderKey`, `ITicConfigServiceKey`, …); pure
85
- logic in `lib/features/build/domain/`. A new command is a controller plus a module.
84
+ services behind tokens (`IBundleServiceKey`, `ITicConfigServiceKey`, …); pure
85
+ logic in `lib/features/bundle/domain/`. A new command is a controller plus a module.
86
86
  - The config schema is `BUNDLE_CONFIG_SCHEMA` (zod); `tic.schema.json` is generated
87
87
  from its per-file variant `BUNDLE_CONFIG_FILE_SCHEMA` with `pnpm run generate:schema`
88
88
  — never edit it by hand.
package/cjm/app.js CHANGED
@@ -1,16 +1,20 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.createContainer = createContainer;
4
7
  exports.run = run;
5
8
  exports.build = build;
6
9
  exports.loadConfig = loadConfig;
7
10
  require("reflect-metadata");
11
+ const node_path_1 = __importDefault(require("node:path"));
8
12
  const ts_ioc_container_1 = require("ts-ioc-container");
9
13
  const Application_1 = require("./cli/Application");
10
14
  const CliIo_1 = require("./domain/CliIo");
11
- const BuildModule_1 = require("./features/build/BuildModule");
12
- const TicConfigService_1 = require("./features/build/services/TicConfigService");
13
- const BundleBuilder_1 = require("./features/build/services/BundleBuilder");
15
+ const BuildModule_1 = require("./features/bundle/BuildModule");
16
+ const TicConfigService_1 = require("./features/bundle/services/TicConfigService");
17
+ const BundleService_1 = require("./features/bundle/services/BundleService");
14
18
  const HelpModule_1 = require("./features/help/HelpModule");
15
19
  const CommonModule_1 = require("./modules/CommonModule");
16
20
  function createContainer(io = (0, CliIo_1.processIo)()) {
@@ -32,7 +36,13 @@ function run(argv, io = (0, CliIo_1.processIo)()) {
32
36
  return Application_1.Application.bootstrap(createContainer(io)).run(...argv);
33
37
  }
34
38
  function build({ cwd = process.cwd(), ...request }) {
35
- return withContainer({ ...(0, CliIo_1.processIo)(), cwd }, (container) => BundleBuilder_1.IBundleBuilderKey.resolve(container).build(request));
39
+ return withContainer({ ...(0, CliIo_1.processIo)(), cwd }, (container) => {
40
+ const configService = TicConfigService_1.ITicConfigServiceKey.resolve(container);
41
+ const config = 'text' in request
42
+ ? configService.parse(request.text, cwd)
43
+ : configService.load([request.config].flat().map((file) => node_path_1.default.resolve(cwd, file)));
44
+ return BundleService_1.IBundleServiceKey.resolve(container).bundle(config);
45
+ });
36
46
  }
37
47
  function loadConfig(files) {
38
48
  return withContainer((0, CliIo_1.processIo)(), (container) => TicConfigService_1.ITicConfigServiceKey.resolve(container).load(files));
package/cjm/cli/usage.js CHANGED
@@ -16,7 +16,8 @@ exports.USAGE = [
16
16
  ' -h, --help show this help',
17
17
  ' -v, --version show the version',
18
18
  '',
19
- 'The bundle goes to stdout and warnings to stderr; saving it is up to you:',
19
+ 'The bundle goes to stdout; the files in it and warnings to stderr.',
20
+ 'Saving it is up to you:',
20
21
  ' tic build app.bundle.json > src/di/app.bundle.ts',
21
22
  ' tic build common.bundle.yml prod.bundle.yml > src/di/prod.bundle.ts # merged left to right',
22
23
  ' cat app.bundle.yml | tic build > src/di/app.bundle.ts # config from stdin (must set name)',
@@ -2,14 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BuildModule = void 0;
4
4
  const ts_ioc_container_1 = require("ts-ioc-container");
5
- const BuildController_1 = require("./BuildController");
6
- const BundleBuilder_1 = require("./services/BundleBuilder");
5
+ const BundleController_1 = require("./BundleController");
6
+ const BundleService_1 = require("./services/BundleService");
7
+ const BundleView_1 = require("./services/BundleView");
7
8
  const TicConfigService_1 = require("./services/TicConfigService");
8
9
  class BuildModule {
9
10
  applyTo(container) {
10
11
  container
11
- .addRegistration(ts_ioc_container_1.Registration.fromClass(BuildController_1.BuildController))
12
- .addRegistration(ts_ioc_container_1.Registration.fromClass(BundleBuilder_1.BundleBuilder))
12
+ .addRegistration(ts_ioc_container_1.Registration.fromClass(BundleController_1.BundleController))
13
+ .addRegistration(ts_ioc_container_1.Registration.fromClass(BundleService_1.BundleService))
14
+ .addRegistration(ts_ioc_container_1.Registration.fromClass(BundleView_1.BundleView))
13
15
  .addRegistration(ts_ioc_container_1.Registration.fromClass(TicConfigService_1.TicConfigService));
14
16
  }
15
17
  }
@@ -11,8 +11,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
14
17
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.BuildController = exports.BUILD_OPTIONS = void 0;
18
+ exports.BundleController = exports.BUILD_OPTIONS = void 0;
19
+ const node_path_1 = __importDefault(require("node:path"));
16
20
  const ts_ioc_container_1 = require("ts-ioc-container");
17
21
  const zod_1 = require("zod");
18
22
  const cli_1 = require("../../cli");
@@ -21,7 +25,9 @@ const DomainException_1 = require("../../exceptions/DomainException");
21
25
  const ConsoleLogger_1 = require("../../services/ConsoleLogger");
22
26
  const OutputService_1 = require("../../services/OutputService");
23
27
  const BuildConfig_1 = require("./BuildConfig");
24
- const BundleBuilder_1 = require("./services/BundleBuilder");
28
+ const glob_1 = require("./domain/glob");
29
+ const BundleService_1 = require("./services/BundleService");
30
+ const TicConfigService_1 = require("./services/TicConfigService");
25
31
  exports.BUILD_OPTIONS = zod_1.z.object({ positionals: zod_1.z.array(zod_1.z.string().min(1)) }).transform(({ positionals }, ctx) => {
26
32
  if (positionals.length > 1 && positionals.includes(BuildConfig_1.STDIN)) {
27
33
  ctx.addIssue({
@@ -34,22 +40,29 @@ exports.BUILD_OPTIONS = zod_1.z.object({ positionals: zod_1.z.array(zod_1.z.stri
34
40
  return { configs: positionals.length > 0 ? positionals : [BuildConfig_1.STDIN] };
35
41
  });
36
42
  const buildArgs = (0, cli_1.parseOptions)({}, { positionals: true });
37
- let BuildController = class BuildController {
43
+ let BundleController = class BundleController {
38
44
  io;
39
- builder;
45
+ configService;
46
+ bundleService;
40
47
  output;
41
48
  logger;
42
- constructor(io, builder, output, logger) {
49
+ constructor(io, configService, bundleService, output, logger) {
43
50
  this.io = io;
44
- this.builder = builder;
51
+ this.configService = configService;
52
+ this.bundleService = bundleService;
45
53
  this.output = output;
46
54
  this.logger = logger;
47
55
  }
48
- build({ configs }) {
56
+ bundle({ configs }) {
49
57
  const stdin = configs[0] === BuildConfig_1.STDIN;
50
58
  const label = stdin ? '<stdin>' : configs.join(' + ');
51
59
  try {
52
- const { content, warnings } = this.builder.build(stdin ? { text: this.stdin() } : { config: configs });
60
+ const config = stdin
61
+ ? this.configService.parse(this.stdin(), this.io.cwd)
62
+ : this.configService.load(configs.map((file) => node_path_1.default.resolve(this.io.cwd, file)));
63
+ const { content, files, warnings } = this.bundleService.bundle(config);
64
+ for (const file of files)
65
+ this.logger.info((0, glob_1.toPosix)(node_path_1.default.relative(this.io.cwd, file)));
53
66
  for (const warning of warnings)
54
67
  this.logger.warn(`${label}: ${warning}`);
55
68
  this.output.write(content.replace(/\n$/, ''));
@@ -68,19 +81,20 @@ let BuildController = class BuildController {
68
81
  return text;
69
82
  }
70
83
  };
71
- exports.BuildController = BuildController;
84
+ exports.BundleController = BundleController;
72
85
  __decorate([
73
86
  (0, cli_1.onDefault)(ts_ioc_container_1.invoke),
74
87
  __param(0, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.pipe)(cli_1.commandArgs, buildArgs, (0, cli_1.validate)(exports.BUILD_OPTIONS)))),
75
88
  __metadata("design:type", Function),
76
89
  __metadata("design:paramtypes", [Object]),
77
90
  __metadata("design:returntype", void 0)
78
- ], BuildController.prototype, "build", null);
79
- exports.BuildController = BuildController = __decorate([
91
+ ], BundleController.prototype, "bundle", null);
92
+ exports.BundleController = BundleController = __decorate([
80
93
  (0, ts_ioc_container_1.register)('build'),
81
94
  __param(0, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(CliIo_1.CliIoKey))),
82
- __param(1, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(BundleBuilder_1.IBundleBuilderKey))),
83
- __param(2, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(OutputService_1.IOutputServiceKey))),
84
- __param(3, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(ConsoleLogger_1.ILoggerKey))),
85
- __metadata("design:paramtypes", [Object, Object, Object, Object])
86
- ], BuildController);
95
+ __param(1, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(TicConfigService_1.ITicConfigServiceKey))),
96
+ __param(2, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(BundleService_1.IBundleServiceKey))),
97
+ __param(3, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(OutputService_1.IOutputServiceKey))),
98
+ __param(4, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(ConsoleLogger_1.ILoggerKey))),
99
+ __metadata("design:paramtypes", [Object, Object, Object, Object, Object])
100
+ ], BundleController);
@@ -15,45 +15,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  return (mod && mod.__esModule) ? mod : { "default": mod };
16
16
  };
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.BundleBuilder = exports.IBundleBuilderKey = void 0;
18
+ exports.BundleService = exports.IBundleServiceKey = void 0;
19
19
  const node_path_1 = __importDefault(require("node:path"));
20
20
  const ts_ioc_container_1 = require("ts-ioc-container");
21
- const GlobalConfig_1 = require("../../../domain/GlobalConfig");
22
- const HandlebarsRenderService_1 = require("../../../services/HandlebarsRenderService");
23
21
  const NodeFileSystemService_1 = require("../../../services/NodeFileSystemService");
24
22
  const DomainException_1 = require("../../../exceptions/DomainException");
25
- const TicConfigService_1 = require("./TicConfigService");
26
- const emit_1 = require("../domain/emit");
23
+ const BundleView_1 = require("./BundleView");
27
24
  const glob_1 = require("../domain/glob");
28
25
  const scan_1 = require("../domain/scan");
29
26
  const tokenCollisions_1 = require("../domain/tokenCollisions");
30
27
  const tsconfig_1 = require("../domain/tsconfig");
31
- exports.IBundleBuilderKey = new ts_ioc_container_1.SingleToken('IBundleBuilder');
32
- let BundleBuilder = class BundleBuilder {
33
- cwd;
34
- configs;
28
+ exports.IBundleServiceKey = new ts_ioc_container_1.SingleToken('IBundleService');
29
+ let BundleService = class BundleService {
35
30
  fs;
36
- renderer;
37
- constructor(cwd, configs, fs, renderer) {
38
- this.cwd = cwd;
39
- this.configs = configs;
31
+ view;
32
+ constructor(fs, view) {
40
33
  this.fs = fs;
41
- this.renderer = renderer;
34
+ this.view = view;
42
35
  }
43
- build(request) {
44
- const resolved = 'text' in request
45
- ? this.configs.parse(request.text, this.cwd)
46
- : this.configs.load([request.config].flat().map((file) => node_path_1.default.resolve(this.cwd, file)));
47
- const { content, registrations, warnings } = this.generate(resolved);
48
- return {
49
- config: 'text' in request ? undefined : resolved.file,
50
- bundle: resolved.bundleClassName,
51
- registrations,
52
- content,
53
- warnings: [...resolved.warnings, ...warnings],
54
- };
55
- }
56
- generate(config) {
36
+ bundle(config) {
57
37
  const paths = (0, tsconfig_1.loadImportPaths)(config.tsconfig, config.importExtension);
58
38
  const relative = (file) => (0, glob_1.toPosix)(node_path_1.default.relative(config.dir, file));
59
39
  const exclude = config.paths.exclude.flatMap((glob) => paths.resolveGlob(glob, config.dir)).map(glob_1.globToRegExp);
@@ -71,7 +51,7 @@ let BundleBuilder = class BundleBuilder {
71
51
  .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))
72
52
  .flatMap((file) => {
73
53
  const text = this.fs.readFile(file);
74
- return text.startsWith(emit_1.GENERATED_HEADER) ? [] : (0, scan_1.findClasses)(file, config.match, text);
54
+ return text.startsWith(BundleView_1.GENERATED_HEADER) ? [] : (0, scan_1.findClasses)(file, config.match, text);
75
55
  })
76
56
  .map((cls) => ({ ...cls, specifier: paths.specifier(cls.file) }));
77
57
  const uncovered = [...new Set(classes.filter((cls) => cls.specifier === undefined).map((cls) => cls.file))];
@@ -79,20 +59,24 @@ let BundleBuilder = class BundleBuilder {
79
59
  throw new DomainException_1.TicConfigError(`no tsconfig paths alias covers ${uncovered.map((file) => (0, glob_1.toPosix)(node_path_1.default.relative(config.dir, file))).join(', ')}; ` +
80
60
  `the bundle goes to stdout, so every import is written through an alias — add a "paths" entry to ${(0, glob_1.toPosix)(node_path_1.default.relative(config.dir, config.tsconfig.file))}`);
81
61
  }
82
- const content = this.renderer.render(emit_1.BUNDLE_PROTOCOL, (0, emit_1.bundleView)({
62
+ const content = this.view.render({
83
63
  name: config.bundleClassName,
84
64
  paths: config.paths.include,
85
65
  classes: classes.map((cls) => ({ ...cls, specifier: cls.specifier })),
86
- }));
87
- return { content, registrations: classes.length, warnings: (0, tokenCollisions_1.tokenCollisions)(classes) };
66
+ });
67
+ return {
68
+ bundle: config.bundleClassName,
69
+ registrations: classes.length,
70
+ files: [...new Set(classes.map((cls) => cls.file))],
71
+ content,
72
+ warnings: [...config.warnings, ...(0, tokenCollisions_1.tokenCollisions)(classes)],
73
+ };
88
74
  }
89
75
  };
90
- exports.BundleBuilder = BundleBuilder;
91
- exports.BundleBuilder = BundleBuilder = __decorate([
92
- (0, ts_ioc_container_1.register)(exports.IBundleBuilderKey),
93
- __param(0, (0, ts_ioc_container_1.inject)((0, GlobalConfig_1.globalConfig)('cwd'))),
94
- __param(1, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(TicConfigService_1.ITicConfigServiceKey))),
95
- __param(2, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(NodeFileSystemService_1.IFileSystemServiceKey))),
96
- __param(3, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(HandlebarsRenderService_1.IRenderServiceKey))),
97
- __metadata("design:paramtypes", [String, Object, Object, Object])
98
- ], BundleBuilder);
76
+ exports.BundleService = BundleService;
77
+ exports.BundleService = BundleService = __decorate([
78
+ (0, ts_ioc_container_1.register)(exports.IBundleServiceKey),
79
+ __param(0, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(NodeFileSystemService_1.IFileSystemServiceKey))),
80
+ __param(1, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(BundleView_1.IBundleViewKey))),
81
+ __metadata("design:paramtypes", [Object, Object])
82
+ ], BundleService);
@@ -0,0 +1,58 @@
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 __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.BundleView = exports.IBundleViewKey = exports.GENERATED_HEADER = void 0;
16
+ const ts_ioc_container_1 = require("ts-ioc-container");
17
+ const HandlebarsRenderService_1 = require("../../../services/HandlebarsRenderService");
18
+ exports.GENERATED_HEADER = '// Generated by `tic build`';
19
+ const BUNDLE_PROTOCOL = 'Bundle.ts.hbs';
20
+ const RUNTIME_IMPORTS = ['IContainer', 'IContainerModule', 'Registration'];
21
+ exports.IBundleViewKey = new ts_ioc_container_1.SingleToken('IBundleView');
22
+ let BundleView = class BundleView {
23
+ renderer;
24
+ constructor(renderer) {
25
+ this.renderer = renderer;
26
+ }
27
+ render(input) {
28
+ return this.renderer.render(BUNDLE_PROTOCOL, toData(input));
29
+ }
30
+ };
31
+ exports.BundleView = BundleView;
32
+ exports.BundleView = BundleView = __decorate([
33
+ (0, ts_ioc_container_1.register)(exports.IBundleViewKey),
34
+ __param(0, (0, ts_ioc_container_1.inject)((0, ts_ioc_container_1.by)(HandlebarsRenderService_1.IRenderServiceKey))),
35
+ __metadata("design:paramtypes", [Object])
36
+ ], BundleView);
37
+ function toData({ name, paths, classes }) {
38
+ const taken = new Set([...RUNTIME_IMPORTS, 'container', name]);
39
+ const uniqueName = (wanted) => {
40
+ let candidate = wanted;
41
+ for (let n = 2; taken.has(candidate); n++)
42
+ candidate = `${wanted}_${n}`;
43
+ taken.add(candidate);
44
+ return candidate;
45
+ };
46
+ const byFile = new Map();
47
+ const bindings = classes.map((cls) => {
48
+ const binding = uniqueName(cls.localName);
49
+ const entry = byFile.get(cls.file) ?? { specifier: cls.specifier, named: [] };
50
+ byFile.set(cls.file, entry);
51
+ if (cls.exportName === 'default')
52
+ entry.defaultName = binding;
53
+ else
54
+ entry.named.push(binding === cls.exportName ? binding : `${cls.exportName} as ${binding}`);
55
+ return binding;
56
+ });
57
+ return { paths, name, imports: [...byFile.values()], registrations: bindings };
58
+ }
package/cjm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IOutputServiceKey = exports.CommonModule = exports.HelpModule = exports.globToRegExp = exports.tokenCollisions = exports.GENERATED_HEADER = exports.BUNDLE_PROTOCOL = exports.bundleView = exports.emitBundle = exports.listSourceFiles = exports.isSourceFile = exports.findClasses = exports.loadImportPaths = exports.ImportPaths = exports.ticConfigJsonSchema = exports.toClassName = exports.DEFAULT_DECORATORS = exports.DEFAULT_EXCLUDE = exports.DEFAULT_TSCONFIG = exports.configFormat = exports.STDIN = exports.CONFIG_FILE_SUFFIXES = exports.parseConfig = exports.mergeConfigs = exports.BUNDLE_CONFIG_FILE_SCHEMA = exports.BUNDLE_CONFIG_SCHEMA = exports.resolveConfig = exports.ITicConfigServiceKey = exports.TicConfigService = exports.IBundleBuilderKey = exports.BundleBuilder = exports.BUILD_OPTIONS = exports.BuildController = exports.BuildModule = exports.USAGE = exports.IErrorHandlerKey = exports.validate = exports.parseOptions = exports.commandArgs = exports.DEFAULT_ACTION = exports.onDefault = exports.action = exports.Application = exports.globalConfig = exports.GlobalConfigKey = exports.CliIoKey = exports.createContainer = exports.loadConfig = exports.run = exports.build = void 0;
4
- exports.ExceptionHandler = exports.UsageError = exports.UnknownActionError = exports.UnknownCommandError = exports.MissingCommandError = exports.NamespaceNotFoundError = exports.TicConfigError = exports.TicError = exports.renderProtocol = exports.HandlebarsRenderService = exports.IRenderServiceKey = exports.NodeFileSystemService = exports.IFileSystemServiceKey = exports.ConsoleLogger = exports.ILoggerKey = exports.StdOutputService = void 0;
3
+ exports.StdOutputService = exports.IOutputServiceKey = exports.CommonModule = exports.HelpModule = exports.globToRegExp = exports.tokenCollisions = exports.GENERATED_HEADER = exports.IBundleViewKey = exports.BundleView = exports.listSourceFiles = exports.isSourceFile = exports.findClasses = exports.loadImportPaths = exports.ImportPaths = exports.ticConfigJsonSchema = exports.toClassName = exports.DEFAULT_DECORATORS = exports.DEFAULT_EXCLUDE = exports.DEFAULT_TSCONFIG = exports.configFormat = exports.STDIN = exports.CONFIG_FILE_SUFFIXES = exports.parseConfig = exports.mergeConfigs = exports.BUNDLE_CONFIG_FILE_SCHEMA = exports.BUNDLE_CONFIG_SCHEMA = exports.resolveConfig = exports.ITicConfigServiceKey = exports.TicConfigService = exports.IBundleServiceKey = exports.BundleService = exports.BUILD_OPTIONS = exports.BundleController = exports.BuildModule = exports.USAGE = exports.IErrorHandlerKey = exports.validate = exports.parseOptions = exports.commandArgs = exports.DEFAULT_ACTION = exports.onDefault = exports.action = exports.Application = exports.globalConfig = exports.GlobalConfigKey = exports.CliIoKey = exports.createContainer = exports.loadConfig = exports.run = exports.build = void 0;
4
+ exports.ExceptionHandler = exports.UsageError = exports.UnknownActionError = exports.UnknownCommandError = exports.MissingCommandError = exports.NamespaceNotFoundError = exports.TicConfigError = exports.TicError = exports.renderProtocol = exports.HandlebarsRenderService = exports.IRenderServiceKey = exports.NodeFileSystemService = exports.IFileSystemServiceKey = exports.ConsoleLogger = exports.ILoggerKey = void 0;
5
5
  var app_1 = require("./app");
6
6
  Object.defineProperty(exports, "build", { enumerable: true, get: function () { return app_1.build; } });
7
7
  Object.defineProperty(exports, "run", { enumerable: true, get: function () { return app_1.run; } });
@@ -22,18 +22,18 @@ Object.defineProperty(exports, "parseOptions", { enumerable: true, get: function
22
22
  Object.defineProperty(exports, "validate", { enumerable: true, get: function () { return cli_1.validate; } });
23
23
  Object.defineProperty(exports, "IErrorHandlerKey", { enumerable: true, get: function () { return cli_1.IErrorHandlerKey; } });
24
24
  Object.defineProperty(exports, "USAGE", { enumerable: true, get: function () { return cli_1.USAGE; } });
25
- var BuildModule_1 = require("./features/build/BuildModule");
25
+ var BuildModule_1 = require("./features/bundle/BuildModule");
26
26
  Object.defineProperty(exports, "BuildModule", { enumerable: true, get: function () { return BuildModule_1.BuildModule; } });
27
- var BuildController_1 = require("./features/build/BuildController");
28
- Object.defineProperty(exports, "BuildController", { enumerable: true, get: function () { return BuildController_1.BuildController; } });
29
- Object.defineProperty(exports, "BUILD_OPTIONS", { enumerable: true, get: function () { return BuildController_1.BUILD_OPTIONS; } });
30
- var BundleBuilder_1 = require("./features/build/services/BundleBuilder");
31
- Object.defineProperty(exports, "BundleBuilder", { enumerable: true, get: function () { return BundleBuilder_1.BundleBuilder; } });
32
- Object.defineProperty(exports, "IBundleBuilderKey", { enumerable: true, get: function () { return BundleBuilder_1.IBundleBuilderKey; } });
33
- var TicConfigService_1 = require("./features/build/services/TicConfigService");
27
+ var BundleController_1 = require("./features/bundle/BundleController");
28
+ Object.defineProperty(exports, "BundleController", { enumerable: true, get: function () { return BundleController_1.BundleController; } });
29
+ Object.defineProperty(exports, "BUILD_OPTIONS", { enumerable: true, get: function () { return BundleController_1.BUILD_OPTIONS; } });
30
+ var BundleService_1 = require("./features/bundle/services/BundleService");
31
+ Object.defineProperty(exports, "BundleService", { enumerable: true, get: function () { return BundleService_1.BundleService; } });
32
+ Object.defineProperty(exports, "IBundleServiceKey", { enumerable: true, get: function () { return BundleService_1.IBundleServiceKey; } });
33
+ var TicConfigService_1 = require("./features/bundle/services/TicConfigService");
34
34
  Object.defineProperty(exports, "TicConfigService", { enumerable: true, get: function () { return TicConfigService_1.TicConfigService; } });
35
35
  Object.defineProperty(exports, "ITicConfigServiceKey", { enumerable: true, get: function () { return TicConfigService_1.ITicConfigServiceKey; } });
36
- var BuildConfig_1 = require("./features/build/BuildConfig");
36
+ var BuildConfig_1 = require("./features/bundle/BuildConfig");
37
37
  Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return BuildConfig_1.resolveConfig; } });
38
38
  Object.defineProperty(exports, "BUNDLE_CONFIG_SCHEMA", { enumerable: true, get: function () { return BuildConfig_1.BUNDLE_CONFIG_SCHEMA; } });
39
39
  Object.defineProperty(exports, "BUNDLE_CONFIG_FILE_SCHEMA", { enumerable: true, get: function () { return BuildConfig_1.BUNDLE_CONFIG_FILE_SCHEMA; } });
@@ -48,22 +48,21 @@ Object.defineProperty(exports, "DEFAULT_DECORATORS", { enumerable: true, get: fu
48
48
  Object.defineProperty(exports, "toClassName", { enumerable: true, get: function () { return BuildConfig_1.toClassName; } });
49
49
  var ticConfigSchema_1 = require("./schema/ticConfigSchema");
50
50
  Object.defineProperty(exports, "ticConfigJsonSchema", { enumerable: true, get: function () { return ticConfigSchema_1.ticConfigJsonSchema; } });
51
- var ImportPaths_1 = require("./features/build/domain/ImportPaths");
51
+ var ImportPaths_1 = require("./features/bundle/domain/ImportPaths");
52
52
  Object.defineProperty(exports, "ImportPaths", { enumerable: true, get: function () { return ImportPaths_1.ImportPaths; } });
53
- var tsconfig_1 = require("./features/build/domain/tsconfig");
53
+ var tsconfig_1 = require("./features/bundle/domain/tsconfig");
54
54
  Object.defineProperty(exports, "loadImportPaths", { enumerable: true, get: function () { return tsconfig_1.loadImportPaths; } });
55
- var scan_1 = require("./features/build/domain/scan");
55
+ var scan_1 = require("./features/bundle/domain/scan");
56
56
  Object.defineProperty(exports, "findClasses", { enumerable: true, get: function () { return scan_1.findClasses; } });
57
57
  Object.defineProperty(exports, "isSourceFile", { enumerable: true, get: function () { return scan_1.isSourceFile; } });
58
58
  Object.defineProperty(exports, "listSourceFiles", { enumerable: true, get: function () { return scan_1.listSourceFiles; } });
59
- var emit_1 = require("./features/build/domain/emit");
60
- Object.defineProperty(exports, "emitBundle", { enumerable: true, get: function () { return emit_1.emitBundle; } });
61
- Object.defineProperty(exports, "bundleView", { enumerable: true, get: function () { return emit_1.bundleView; } });
62
- Object.defineProperty(exports, "BUNDLE_PROTOCOL", { enumerable: true, get: function () { return emit_1.BUNDLE_PROTOCOL; } });
63
- Object.defineProperty(exports, "GENERATED_HEADER", { enumerable: true, get: function () { return emit_1.GENERATED_HEADER; } });
64
- var tokenCollisions_1 = require("./features/build/domain/tokenCollisions");
59
+ var BundleView_1 = require("./features/bundle/services/BundleView");
60
+ Object.defineProperty(exports, "BundleView", { enumerable: true, get: function () { return BundleView_1.BundleView; } });
61
+ Object.defineProperty(exports, "IBundleViewKey", { enumerable: true, get: function () { return BundleView_1.IBundleViewKey; } });
62
+ Object.defineProperty(exports, "GENERATED_HEADER", { enumerable: true, get: function () { return BundleView_1.GENERATED_HEADER; } });
63
+ var tokenCollisions_1 = require("./features/bundle/domain/tokenCollisions");
65
64
  Object.defineProperty(exports, "tokenCollisions", { enumerable: true, get: function () { return tokenCollisions_1.tokenCollisions; } });
66
- var glob_1 = require("./features/build/domain/glob");
65
+ var glob_1 = require("./features/bundle/domain/glob");
67
66
  Object.defineProperty(exports, "globToRegExp", { enumerable: true, get: function () { return glob_1.globToRegExp; } });
68
67
  var HelpModule_1 = require("./features/help/HelpModule");
69
68
  Object.defineProperty(exports, "HelpModule", { enumerable: true, get: function () { return HelpModule_1.HelpModule; } });
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ticConfigJsonSchema = ticConfigJsonSchema;
4
4
  const zod_1 = require("zod");
5
- const BuildConfig_1 = require("../features/build/BuildConfig");
5
+ const BuildConfig_1 = require("../features/bundle/BuildConfig");
6
6
  function ticConfigJsonSchema() {
7
7
  const schema = zod_1.z.toJSONSchema(BuildConfig_1.BUNDLE_CONFIG_FILE_SCHEMA, {
8
8
  io: 'input',
@@ -21,6 +21,9 @@ let ConsoleLogger = class ConsoleLogger {
21
21
  constructor(io) {
22
22
  this.io = io;
23
23
  }
24
+ info(message) {
25
+ this.io.stderr(message);
26
+ }
24
27
  warn(message) {
25
28
  this.io.stderr(`tic: warning: ${message}`);
26
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-ioc-container/bundler",
3
- "version": "7.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "Bundles your dependencies into a single container module for ts-ioc-container: the `tic` CLI scans folders (by path or tsconfig alias) and generates one typed bundle that registers every class — `container.useModule(new AppBundle())`.",
5
5
  "publishConfig": {
6
6
  "access": "public",
package/typings/app.d.ts CHANGED
@@ -1,8 +1,26 @@
1
1
  import 'reflect-metadata';
2
2
  import { type IContainer } from 'ts-ioc-container';
3
3
  import { type CliIo } from './domain/CliIo.js';
4
- import { type ResolvedConfig } from './features/build/BuildConfig.js';
5
- import { type BuildOptions, type BuildResult } from './features/build/services/BundleBuilder.js';
4
+ import { type BundleConfig } from './features/bundle/BuildConfig.js';
5
+ import { type Bundle } from './features/bundle/services/BundleService.js';
6
+ /** What one build does. Paths resolve against the run's working directory. */
7
+ export type BundleRequest = {
8
+ /**
9
+ * Path of the config file — `*.json`, `*.yaml` or `*.yml` — relative to the working directory;
10
+ * or of several in one folder, merged left to right into one bundle.
11
+ */
12
+ config: string | string[];
13
+ } | {
14
+ /**
15
+ * The config as text, e.g. read from stdin: YAML or JSON. Its relative paths resolve
16
+ * against the working directory, and it must set `name`.
17
+ */
18
+ text: string;
19
+ };
20
+ export type BuildOptions = BundleRequest & {
21
+ /** Default `process.cwd()`. */
22
+ cwd?: string;
23
+ };
6
24
  /** The composition root: one container per run, holding every module of the CLI. */
7
25
  export declare function createContainer(io?: CliIo): IContainer;
8
26
  /** Runs the `tic` CLI and returns its exit code; output goes through `io`. */
@@ -14,12 +32,12 @@ export declare function run(argv: string[], io?: CliIo): number;
14
32
  * @throws {TicConfigError} when a config file is missing or unreadable, several are in different folders, the config or its tsconfig is invalid, the bundle has no name, or no tsconfig paths alias covers a selected class's file.
15
33
  * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
16
34
  */
17
- export declare function build({ cwd, ...request }: BuildOptions): BuildResult;
35
+ export declare function build({ cwd, ...request }: BuildOptions): Bundle;
18
36
  /**
19
37
  * Reads and validates a config file: JSON for `.json`, YAML for `.yaml` / `.yml`. Given several
20
38
  * in one folder, it merges them left to right, as `tic build a.bundle.yml b.bundle.yml` does.
21
39
  *
22
40
  * @throws {TicConfigError} when a file is missing, has another extension, cannot be parsed, or does not match the config shape; when several files are in different folders.
23
41
  */
24
- export declare function loadConfig(files: string | string[]): ResolvedConfig;
42
+ export declare function loadConfig(files: string | string[]): BundleConfig;
25
43
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../lib/cli/usage.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,QAoBN,CAAC"}
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../lib/cli/usage.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK,QAqBN,CAAC"}
@@ -66,7 +66,7 @@ export interface ResolvedClassSelector {
66
66
  * `tic build common.bundle.yml prod.bundle.yml` merges several into one, left to right
67
67
  * (see {@link mergeConfigs}).
68
68
  */
69
- export interface BundleConfig {
69
+ export interface BundleConfigFile {
70
70
  $schema?: string;
71
71
  /**
72
72
  * The bundle's name: letters, digits, `-` and `_`, starting with a letter. Default: the
@@ -100,8 +100,8 @@ export declare const DEFAULT_TSCONFIG = "./tsconfig.json";
100
100
  /** What `match.decorators` requires when omitted: the library's own `@register`. */
101
101
  export declare const DEFAULT_DECORATORS: string[];
102
102
  export declare const DEFAULT_EXCLUDE: string[];
103
- /** A {@link BundleConfig} whose defaults are filled in and whose paths are absolute. */
104
- export interface ResolvedConfig {
103
+ /** A {@link BundleConfigFile} whose defaults are filled in and whose paths are absolute. */
104
+ export interface BundleConfig {
105
105
  /** The config file itself. */
106
106
  file: string;
107
107
  /** Its folder: what the config's relative paths resolve against. */
@@ -211,5 +211,5 @@ export declare function mergeConfigs(configs: {
211
211
  *
212
212
  * @throws {TicConfigError} when the content does not match the config shape, or names no bundle; the message names the field.
213
213
  */
214
- export declare function resolveConfig(content: unknown, file: string): ResolvedConfig;
214
+ export declare function resolveConfig(content: unknown, file: string): BundleConfig;
215
215
  //# sourceMappingURL=BuildConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BuildConfig.d.ts","sourceRoot":"","sources":["../../../lib/features/bundle/BuildConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,0DAA0D;AAC1D,MAAM,WAAW,oBAAoB;IACnC,qDAAqD;IACrD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,iHAAiH;IACjH,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,iGAAiG;AACjG,MAAM,MAAM,UA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ildModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAM7F,qBAAa,WAAY,YAAW,gBAAgB;IAClD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;CAOrC"}
@@ -2,7 +2,8 @@ import { z } from 'zod';
2
2
  import { type CliIo } from '../../domain/CliIo.js';
3
3
  import { type ILogger } from '../../services/ConsoleLogger.js';
4
4
  import { type IOutputService } from '../../services/OutputService.js';
5
- import { type IBundleBuilder } from './services/BundleBuilder.js';
5
+ import { type IBundleService } from './services/BundleService.js';
6
+ import { type ITicConfigService } from './services/TicConfigService.js';
6
7
  export declare const BUILD_OPTIONS: z.ZodPipe<z.ZodObject<{
7
8
  positionals: z.ZodArray<z.ZodString>;
8
9
  }, z.core.$strip>, z.ZodTransform<{
@@ -15,28 +16,30 @@ export type BuildCliOptions = z.output<typeof BUILD_OPTIONS>;
15
16
  * `tic build [<config>... | -]`: the bundle goes to stdout; several configs are merged left to right
16
17
  * into one, and without a config file the config comes from stdin.
17
18
  */
18
- export declare class BuildController {
19
+ export declare class BundleController {
19
20
  private readonly io;
20
- private readonly builder;
21
+ private readonly configService;
22
+ private readonly bundleService;
21
23
  private readonly output;
22
24
  private readonly logger;
23
- constructor(io: CliIo, builder: IBundleBuilder, output: IOutputService, logger: ILogger);
25
+ constructor(io: CliIo, configService: ITicConfigService, bundleService: IBundleService, output: IOutputService, logger: ILogger);
24
26
  /**
25
27
  * Builds the bundle the config file `<config>` describes — several merged left to right
26
28
  * into one, or without one (or with `-`), the config piped into stdin — and prints it to
27
29
  * stdout. Saving it is the shell's job: `tic build app.bundle.json > src/di/app.bundle.ts`,
28
30
  * `tic build common.bundle.yml prod.bundle.yml > src/di/prod.bundle.ts`,
29
31
  * `cat app.bundle.yml | tic build > out.ts`.
30
- * Warnings go to stderr, so they never end up in the bundle; an error names the configs.
32
+ * The files in the bundle, one path per line relative to the working directory, and warnings
33
+ * go to stderr, so they never end up in the bundle; an error names the configs.
31
34
  *
32
35
  * @throws {UsageError} when an option is unknown, `-` is given with config files, or the config should come from stdin and nothing is piped in.
33
36
  * @throws {TicConfigError} when a config file is missing or unreadable, several are in different folders, the config or its tsconfig is invalid, the bundle has no name, or no tsconfig paths alias covers a selected class's file.
34
37
  * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
35
38
  */
36
- build({ configs }: BuildCliOptions): void;
39
+ bundle({ configs }: BuildCliOptions): void;
37
40
  /**
38
41
  * @throws {UsageError} when nothing is piped into stdin.
39
42
  */
40
43
  private stdin;
41
44
  }
42
- //# sourceMappingURL=BuildController.d.ts.map
45
+ //# sourceMappingURL=BundleController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BundleController.d.ts","sourceRoot":"","sources":["../../../lib/features/bundle/BundleController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,8BAA8B,CAAC;AAGtF,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,0BAA0B,CAAC;AAClF,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,6BAA6B,CAAC;AAE3F,eAAO,MAAM,aAAa;;;;;;GAWxB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAI7D;;;GAGG;AACH,qBACa,gBAAgB;IAEH,OAAO,CAAC,QAAQ,CAAC,EAAE;IACP,OAAO,CAAC,QAAQ,CAAC,aAAa;IACjC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAC9B,OAAO,CAAC,QA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
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../../lib/features/bundle/domain/glob.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBjD;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAAoC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../../lib/features/bundle/domain/scan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;OAIG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;;OAIG;IACH,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CACpD;AAKD,8EAA8E;AAC9E,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAAiE,CAAC;AAE9G,mHAAmH;AACnH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,EAAE,CAc5F;AA2BD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,SAA6B,GAChC,eAAe,EAAE,CAkFnB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokenCollisions.d.ts","sourceRoot":"","sources":["../../../../lib/features/bundle/domain/tokenCollisions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAmBpE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig.d.ts","sourceRoot":"","sources":["../../../../lib/features/bundle/domain/tsconfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW,CAapH"}
@@ -0,0 +1,39 @@
1
+ import { SingleToken } from 'ts-ioc-container';
2
+ import { type IFileSystemService } from '../../../services/NodeFileSystemService.js';
3
+ import type { BundleConfig } from '../BuildConfig.js';
4
+ import { type IBundleView } from './BundleView.js';
5
+ export interface Bundle {
6
+ /** Name of the generated class. */
7
+ bundle: string;
8
+ registrations: number;
9
+ /** Absolute paths of the files the bundle imports from, sorted. */
10
+ files: string[];
11
+ /** The generated bundle. Nothing is written: saving it is the caller's job (`tic build app.bundle.json > src/di/app.bundle.ts`). */
12
+ content: string;
13
+ /**
14
+ * Non-fatal problems found while building, e.g. a `paths.exclude` that drops a default
15
+ * test glob or two selected classes passing the same decorator token.
16
+ */
17
+ warnings: string[];
18
+ }
19
+ export interface IBundleService {
20
+ /**
21
+ * Generates the bundle a resolved config describes and returns it; nothing is written.
22
+ *
23
+ * @throws {TicConfigError} when the tsconfig is missing or invalid, or no tsconfig paths alias covers a selected class's file.
24
+ * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
25
+ */
26
+ bundle(config: BundleConfig): Bundle;
27
+ }
28
+ export declare const IBundleServiceKey: SingleToken<IBundleService>;
29
+ export declare class BundleService implements IBundleService {
30
+ private readonly fs;
31
+ private readonly view;
32
+ constructor(fs: IFileSystemService, view: IBundleView);
33
+ /**
34
+ * @throws {TicConfigError} when the tsconfig is missing or invalid, or no tsconfig paths alias covers a selected class's file.
35
+ * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
36
+ */
37
+ bundle(config: BundleConfig): Bundle;
38
+ }
39
+ //# sourceMappingURL=BundleService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BundleService.d.ts","sourceRoot":"","sources":["../../../../lib/features/bundle/services/BundleService.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,yCAAyC,CAAC;AAEzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAoB,KAAK,WAAW,EAAkB,MAAM,cAAc,CAAC;AAMlF,MAAM,WAAW,MAAM;IACrB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,oIAAoI;IACpI,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC;CACtC;AAED,eAAO,MAAM,iBAAiB,6BAAoD,CAAC;AAEnF,qBACa,aAAc,YAAW,cAAc;IAEb,OAAO,CAAC,QAAQ,CAAC,EAAE;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADG,EAAE,EAAE,kBAAkB,EAC7B,IAAI,EAAE,WAAW;IAGhE;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;CA6CrC"}
@@ -0,0 +1,33 @@
1
+ import { SingleToken } from 'ts-ioc-container';
2
+ import { type IRenderService } from '../../../services/HandlebarsRenderService.js';
3
+ import type { DiscoveredClass } from '../domain/scan.js';
4
+ export interface BundleViewInput {
5
+ /** Name of the generated class. */
6
+ name: string;
7
+ /** Shown in the header: the folders scanned. */
8
+ paths: string[];
9
+ classes: (DiscoveredClass & {
10
+ specifier: string;
11
+ })[];
12
+ }
13
+ /** The first line of every generated bundle; marks it as output, never input. */
14
+ export declare const GENERATED_HEADER = "// Generated by `tic build`";
15
+ /** Turns the selected classes into the generated bundle's source. */
16
+ export interface IBundleView {
17
+ /**
18
+ * Renders the generated bundle — static imports, and the bundle registering each selected class.
19
+ *
20
+ * @throws {Error} when the bundle protocol is not registered.
21
+ */
22
+ render(input: BundleViewInput): string;
23
+ }
24
+ export declare const IBundleViewKey: SingleToken<IBundleView>;
25
+ export declare class BundleView implements IBundleView {
26
+ private readonly renderer;
27
+ constructor(renderer: IRenderService);
28
+ /**
29
+ * @throws {Error} when the bundle protocol is not registered.
30
+ */
31
+ render(input: BundleViewInput): string;
32
+ }
33
+ //# sourceMappingURL=BundleView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BundleView.d.ts","sourceRoot":"","sources":["../../../../lib/features/bundle/services/BundleView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,2CAA2C,CAAC;AACnG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CACtD;AAED,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,gCAAgC,CAAC;AAe9D,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAAC;CACxC;AAED,eAAO,MAAM,cAAc,0BAA8C,CAAC;AAE1E,qBACa,UAAW,YAAW,WAAW;IACD,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,cAAc;IAEpF;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM;CAGvC"}
@@ -1,6 +1,6 @@
1
1
  import { SingleToken } from 'ts-ioc-container';
2
2
  import { type IFileSystemService } from '../../../services/NodeFileSystemService.js';
3
- import { type ResolvedConfig } from '../BuildConfig.js';
3
+ import { type BundleConfig } from '../BuildConfig.js';
4
4
  export interface ITicConfigService {
5
5
  /**
6
6
  * Reads and validates a config file: JSON for `.json`, YAML for `.yaml` / `.yml`. Given several,
@@ -9,7 +9,7 @@ export interface ITicConfigService {
9
9
  *
10
10
  * @throws {TicConfigError} when a file is missing, has another extension, cannot be parsed, or does not match the config shape; when several files are in different folders.
11
11
  */
12
- load(files: string | string[]): ResolvedConfig;
12
+ load(files: string | string[]): BundleConfig;
13
13
  /**
14
14
  * Validates config text from somewhere other than a file — stdin, say. It is parsed as YAML,
15
15
  * which JSON is a subset of; its relative paths resolve against `dir`, and it has no file
@@ -17,7 +17,7 @@ export interface ITicConfigService {
17
17
  *
18
18
  * @throws {TicConfigError} when the text cannot be parsed, does not match the config shape, or has no `name`.
19
19
  */
20
- parse(text: string, dir: string): ResolvedConfig;
20
+ parse(text: string, dir: string): BundleConfig;
21
21
  }
22
22
  export declare const ITicConfigServiceKey: SingleToken<ITicConfigService>;
23
23
  export declare class TicConfigService implements ITicConfigService {
@@ -26,11 +26,11 @@ export declare class TicConfigService implements ITicConfigService {
26
26
  /**
27
27
  * @throws {TicConfigError} when a file is missing, has another extension, cannot be parsed, or does not match the config shape; when several files are in different folders.
28
28
  */
29
- load(files: string | string[]): ResolvedConfig;
29
+ load(files: string | string[]): BundleConfig;
30
30
  /**
31
31
  * @throws {TicConfigError} when the text cannot be parsed, does not match the config shape, or has no `name`.
32
32
  */
33
- parse(text: string, dir: string): ResolvedConfig;
33
+ parse(text: string, dir: string): BundleConfig;
34
34
  /**
35
35
  * @throws {TicConfigError} when the file is missing, has another extension, or cannot be parsed.
36
36
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TicConfigService.d.ts","sourceRoot":"","sources":["../../../../lib/features/bundle/services/TicConfigService.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,yCAAyC,CAAC;AACzG,OAAO,EAA2C,KAAK,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AAElH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY,CAAC;IAE7C;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAChD;AAED,eAAO,MAAM,oBAAoB,gCAA0D,CAAC;AAE5F,qBACa,gBAAiB,YAAW,iBAAiB;IACT,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,kBAAkB;IAEtF;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY;IAiB5C;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY;IAI9C;;OAEG;IACH,OAAO,CAAC,IAAI;CAMb"}
@@ -1,19 +1,19 @@
1
- export { build, run, loadConfig, createContainer } from './app.js';
1
+ export { build, run, loadConfig, createContainer, type BundleRequest, type BuildOptions } from './app.js';
2
2
  export { type CliIo, CliIoKey } from './domain/CliIo.js';
3
3
  export { type GlobalConfig, GlobalConfigKey, globalConfig } from './domain/GlobalConfig.js';
4
4
  export { Application, action, onDefault, DEFAULT_ACTION, commandArgs, parseOptions, validate, type IErrorHandler, IErrorHandlerKey, USAGE, } from './cli.js';
5
- export { BuildModule } from './features/build/BuildModule.js';
6
- export { BuildController, BUILD_OPTIONS, type BuildCliOptions } from './features/build/BuildController.js';
7
- export { BundleBuilder, IBundleBuilderKey, type IBundleBuilder, type BuildRequest, type BuildOptions, type BuildResult, } from './features/build/services/BundleBuilder.js';
8
- export { TicConfigService, ITicConfigServiceKey, type ITicConfigService, } from './features/build/services/TicConfigService.js';
9
- export { resolveConfig, BUNDLE_CONFIG_SCHEMA, BUNDLE_CONFIG_FILE_SCHEMA, mergeConfigs, parseConfig, CONFIG_FILE_SUFFIXES, STDIN, configFormat, DEFAULT_TSCONFIG, DEFAULT_EXCLUDE, DEFAULT_DECORATORS, toClassName, type BundleConfig, type ClassSelector, type ExportKind, type ResolvedClassSelector, type PathSelector, type ResolvedPathSelector, type ResolvedConfig, type ConfigFormat, } from './features/build/BuildConfig.js';
5
+ export { BuildModule } from './features/bundle/BuildModule.js';
6
+ export { BundleController, BUILD_OPTIONS, type BuildCliOptions } from './features/bundle/BundleController.js';
7
+ export { BundleService, IBundleServiceKey, type IBundleService, type Bundle, } from './features/bundle/services/BundleService.js';
8
+ export { TicConfigService, ITicConfigServiceKey, type ITicConfigService, } from './features/bundle/services/TicConfigService.js';
9
+ export { resolveConfig, BUNDLE_CONFIG_SCHEMA, BUNDLE_CONFIG_FILE_SCHEMA, mergeConfigs, parseConfig, CONFIG_FILE_SUFFIXES, STDIN, configFormat, DEFAULT_TSCONFIG, DEFAULT_EXCLUDE, DEFAULT_DECORATORS, toClassName, type BundleConfigFile, type ClassSelector, type ExportKind, type ResolvedClassSelector, type PathSelector, type ResolvedPathSelector, type BundleConfig, type ConfigFormat, } from './features/bundle/BuildConfig.js';
10
10
  export { ticConfigJsonSchema } from './schema/ticConfigSchema.js';
11
- export { ImportPaths } from './features/build/domain/ImportPaths.js';
12
- export { loadImportPaths } from './features/build/domain/tsconfig.js';
13
- export { findClasses, isSourceFile, listSourceFiles, type DiscoveredClass } from './features/build/domain/scan.js';
14
- export { emitBundle, bundleView, BUNDLE_PROTOCOL, GENERATED_HEADER, type EmitInput, type BundleView, } from './features/build/domain/emit.js';
15
- export { tokenCollisions } from './features/build/domain/tokenCollisions.js';
16
- export { globToRegExp } from './features/build/domain/glob.js';
11
+ export { ImportPaths } from './features/bundle/domain/ImportPaths.js';
12
+ export { loadImportPaths } from './features/bundle/domain/tsconfig.js';
13
+ export { findClasses, isSourceFile, listSourceFiles, type DiscoveredClass } from './features/bundle/domain/scan.js';
14
+ export { BundleView, IBundleViewKey, type IBundleView, type BundleViewInput, GENERATED_HEADER, } from './features/bundle/services/BundleView.js';
15
+ export { tokenCollisions } from './features/bundle/domain/tokenCollisions.js';
16
+ export { globToRegExp } from './features/bundle/domain/glob.js';
17
17
  export { HelpModule } from './features/help/HelpModule.js';
18
18
  export { CommonModule } from './modules/CommonModule.js';
19
19
  export { type IOutputService, IOutputServiceKey, StdOutputService } from './services/OutputService.js';
@@ -2,9 +2,11 @@ import { SingleToken } from 'ts-ioc-container';
2
2
  import { type CliIo } from '../domain/CliIo.js';
3
3
  /**
4
4
  * Diagnostics, kept off stdout so a command's output stays machine-readable.
5
- * Every line is prefixed with `tic:`.
5
+ * Warnings and errors are prefixed with `tic:`.
6
6
  */
7
7
  export interface ILogger {
8
+ /** Progress, printed as is: `<message>`. */
9
+ info(message: string): void;
8
10
  /** A non-fatal problem: `tic: warning: <message>`. */
9
11
  warn(message: string): void;
10
12
  /** A fatal problem: `tic: <message>`. */
@@ -14,6 +16,7 @@ export declare const ILoggerKey: SingleToken<ILogger>;
14
16
  export declare class ConsoleLogger implements ILogger {
15
17
  private readonly io;
16
18
  constructor(io: CliIo);
19
+ info(message: string): void;
17
20
  warn(message: string): void;
18
21
  error(message: string): void;
19
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../lib/services/ConsoleLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,iBAAiB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,sDAAsD;IACtD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,yCAAyC;IACzC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,UAAU,sBAAsC,CAAC;AAE9D,qBACa,aAAc,YAAW,OAAO;IACT,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,KAAK;IAE5D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG7B"}
1
+ {"version":3,"file":"ConsoleLogger.d.ts","sourceRoot":"","sources":["../../lib/services/ConsoleLogger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,iBAAiB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,4CAA4C;IAC5C,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,sDAAsD;IACtD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,yCAAyC;IACzC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,UAAU,sBAAsC,CAAC;AAE9D,qBACa,aAAc,YAAW,OAAO;IACT,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,KAAK;IAE5D,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG7B"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BUNDLE_PROTOCOL = exports.GENERATED_HEADER = void 0;
4
- exports.bundleView = bundleView;
5
- exports.emitBundle = emitBundle;
6
- const HandlebarsRenderService_1 = require("../../../services/HandlebarsRenderService");
7
- exports.GENERATED_HEADER = '// Generated by `tic build`';
8
- exports.BUNDLE_PROTOCOL = 'Bundle.ts.hbs';
9
- const RUNTIME_IMPORTS = ['IContainer', 'IContainerModule', 'Registration'];
10
- function bundleView({ name, paths, classes }) {
11
- const taken = new Set([...RUNTIME_IMPORTS, 'container', name]);
12
- const uniqueName = (wanted) => {
13
- let candidate = wanted;
14
- for (let n = 2; taken.has(candidate); n++)
15
- candidate = `${wanted}_${n}`;
16
- taken.add(candidate);
17
- return candidate;
18
- };
19
- const byFile = new Map();
20
- const bindings = classes.map((cls) => {
21
- const binding = uniqueName(cls.localName);
22
- const entry = byFile.get(cls.file) ?? { specifier: cls.specifier, named: [] };
23
- byFile.set(cls.file, entry);
24
- if (cls.exportName === 'default')
25
- entry.defaultName = binding;
26
- else
27
- entry.named.push(binding === cls.exportName ? binding : `${cls.exportName} as ${binding}`);
28
- return binding;
29
- });
30
- return { paths, name, imports: [...byFile.values()], registrations: bindings };
31
- }
32
- function emitBundle(input) {
33
- return (0, HandlebarsRenderService_1.renderProtocol)(exports.BUNDLE_PROTOCOL, bundleView(input));
34
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildConfig.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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,MAAM,GAAG,MAAM,CAGhD;AA6BD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,EAAE,GAAG,OAAO,CAMnF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,cAAc,CAwB5E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildController.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,KAAK,EAAY,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,8BAA8B,CAAC;AAEtF,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,0BAA0B,CAAC;AAElF,eAAO,MAAM,aAAa;;;;;;GAWxB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC;AAI7D;;;GAGG;AACH,qBACa,eAAe;IAEF,OAAO,CAAC,QAAQ,CAAC,EAAE;IACV,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHR,EAAE,EAAE,KAAK,EACA,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,cAAc,EAC7B,MAAM,EAAE,OAAO;IAG1D;;;;;;;;;;;OAWG;IAEH,KAAK,CAAgE,EAAE,OAAO,EAAE,EAAE,eAAe,GAAG,IAAI;IAcxG;;OAEG;IACH,OAAO,CAAC,KAAK;CAOd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"BuildModule.d.ts","sourceRoot":"","sources":["../../../lib/features/build/BuildModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAqB,MAAM,kBAAkB,CAAC;AAK7F,qBAAa,WAAY,YAAW,gBAAgB;IAClD,OAAO,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;CAMrC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ImportPaths.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/ImportPaths.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAaD;;;GAGG;AACH,qBAAa,WAAW;IAmBpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAnB5B;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW;gBAczF,OAAO,EAAE,KAAK,EAAE,EACxB,SAAS,EAAE,MAAM;IAG5B;;;;OAIG;IACH,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAa5D;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE;IAOpD;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAK3C,OAAO,CAAC,SAAS;IAWjB,8GAA8G;IAC9G,OAAO,CAAC,YAAY;IAYpB,yGAAyG;IACzG,OAAO,CAAC,UAAU;CAanB"}
@@ -1,36 +0,0 @@
1
- import type { DiscoveredClass } from './scan.js';
2
- export interface EmitInput {
3
- /** Name of the generated class. */
4
- name: string;
5
- /** Shown in the header: the folders scanned. */
6
- paths: string[];
7
- classes: (DiscoveredClass & {
8
- specifier: string;
9
- })[];
10
- }
11
- /** The first line of every generated bundle; marks it as output, never input. */
12
- export declare const GENERATED_HEADER = "// Generated by `tic build`";
13
- /** What `protocols/Bundle.ts.hbs` renders. */
14
- export interface BundleView {
15
- paths: string[];
16
- name: string;
17
- imports: {
18
- specifier: string;
19
- defaultName?: string;
20
- named: string[];
21
- }[];
22
- registrations: string[];
23
- }
24
- /** The protocol a bundle is rendered from. */
25
- export declare const BUNDLE_PROTOCOL = "Bundle.ts.hbs";
26
- /**
27
- * Prepares the data the bundle protocol renders: unique local names, and one import
28
- * per file in file order.
29
- */
30
- export declare function bundleView({ name, paths, classes }: EmitInput): BundleView;
31
- /**
32
- * Renders the generated bundle — static imports, and the bundle registering each selected class —
33
- * from its protocol, `protocols/Bundle.ts.hbs`.
34
- */
35
- export declare function emitBundle(input: EmitInput): string;
36
- //# sourceMappingURL=emit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/emit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,WAAW,SAAS;IACxB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC,eAAe,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;CACtD;AAED,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,gCAAgC,CAAC;AAE9D,8CAA8C;AAC9C,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IACxE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,8CAA8C;AAC9C,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAI/C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,SAAS,GAAG,UAAU,CAsB1E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAEnD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/glob.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiBjD;AAED,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,KAAG,MAAoC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/scan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;IAClB,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,iEAAiE;IACjE,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB;;;;OAIG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;;OAIG;IACH,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CACpD;AAKD,8EAA8E;AAC9E,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAAiE,CAAC;AAE9G,mHAAmH;AACnH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,EAAE,CAc5F;AA2BD;;;GAGG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,qBAAqB,EAC/B,IAAI,SAA6B,GAChC,eAAe,EAAE,CAkFnB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tokenCollisions.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/tokenCollisions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAmBpE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tsconfig.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/tsconfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW,CAapH"}
@@ -1,64 +0,0 @@
1
- import { SingleToken } from 'ts-ioc-container';
2
- import { type IRenderService } from '../../../services/HandlebarsRenderService.js';
3
- import { type IFileSystemService } from '../../../services/NodeFileSystemService.js';
4
- import { type ITicConfigService } from './TicConfigService.js';
5
- /** What one build does. Paths resolve against the run's working directory. */
6
- export type BuildRequest = {
7
- /**
8
- * Path of the config file — `*.json`, `*.yaml` or `*.yml` — relative to the working directory;
9
- * or of several in one folder, merged left to right into one bundle.
10
- */
11
- config: string | string[];
12
- } | {
13
- /**
14
- * The config as text, e.g. read from stdin: YAML or JSON. Its relative paths resolve
15
- * against the working directory, and it must set `name`.
16
- */
17
- text: string;
18
- };
19
- export type BuildOptions = BuildRequest & {
20
- /** Default `process.cwd()`. */
21
- cwd?: string;
22
- };
23
- export interface BuildResult {
24
- /** Absolute path of the config file that was built — of several merged, the last; `undefined` for config text. */
25
- config?: string;
26
- /** Name of the generated class. */
27
- bundle: string;
28
- registrations: number;
29
- /** The generated bundle. Nothing is written: saving it is the caller's job (`tic build app.bundle.json > src/di/app.bundle.ts`). */
30
- content: string;
31
- /**
32
- * Non-fatal problems found while building, e.g. a `paths.exclude` that drops a default
33
- * test glob or two selected classes passing the same decorator token.
34
- */
35
- warnings: string[];
36
- }
37
- export interface IBundleBuilder {
38
- /**
39
- * Generates the bundle a config describes and returns it; nothing is written.
40
- *
41
- * @throws {TicConfigError} when a config file is missing or unreadable, several are in different folders, the config or its tsconfig is invalid, the bundle has no name, or no tsconfig paths alias covers a selected class's file.
42
- * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
43
- */
44
- build(request: BuildRequest): BuildResult;
45
- }
46
- export declare const IBundleBuilderKey: SingleToken<IBundleBuilder>;
47
- export declare class BundleBuilder implements IBundleBuilder {
48
- private readonly cwd;
49
- private readonly configs;
50
- private readonly fs;
51
- private readonly renderer;
52
- constructor(cwd: string, configs: ITicConfigService, fs: IFileSystemService, renderer: IRenderService);
53
- /**
54
- * @throws {TicConfigError} when a config file is missing or unreadable, several are in different folders, the config or its tsconfig is invalid, the bundle has no name, or no tsconfig paths alias covers a selected class's file.
55
- * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
56
- */
57
- build(request: BuildRequest): BuildResult;
58
- /**
59
- * @throws {TicConfigError} when the tsconfig is missing or invalid, or no tsconfig paths alias covers a selected class's file.
60
- * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
61
- */
62
- private generate;
63
- }
64
- //# sourceMappingURL=BundleBuilder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BundleBuilder.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/services/BundleBuilder.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,2CAA2C,CAAC;AACnG,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,yCAAyC,CAAC;AAGzG,OAAO,EAAE,KAAK,iBAAiB,EAAwB,MAAM,oBAAoB,CAAC;AAOlF,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GACpB;IACE;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC3B,GACD;IACE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IACxC,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,kHAAkH;IAClH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,oIAAoI;IACpI,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW,CAAC;CAC3C;AAED,eAAO,MAAM,iBAAiB,6BAAoD,CAAC;AAEnF,qBACa,aAAc,YAAW,cAAc;IAEnB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACf,OAAO,CAAC,QAAQ,CAAC,OAAO;IACvB,OAAO,CAAC,QAAQ,CAAC,EAAE;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAHV,GAAG,EAAE,MAAM,EACN,OAAO,EAAE,iBAAiB,EACzB,EAAE,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,cAAc;IAG1E;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW;IAezC;;;OAGG;IACH,OAAO,CAAC,QAAQ;CA0CjB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"TicConfigService.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/services/TicConfigService.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAErE,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,yCAAyC,CAAC;AACzG,OAAO,EAA2C,KAAK,cAAc,EAAwB,MAAM,gBAAgB,CAAC;AAEpH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc,CAAC;IAE/C;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc,CAAC;CAClD;AAED,eAAO,MAAM,oBAAoB,gCAA0D,CAAC;AAE5F,qBACa,gBAAiB,YAAW,iBAAiB;IACT,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,kBAAkB;IAEtF;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,cAAc;IAiB9C;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc;IAIhD;;OAEG;IACH,OAAO,CAAC,IAAI;CAMb"}
File without changes
File without changes
File without changes