@ts-ioc-container/bundler 3.0.0 → 4.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 (54) hide show
  1. package/AGENTS.md +45 -40
  2. package/README.md +181 -129
  3. package/cjm/app.js +2 -2
  4. package/cjm/cli/Application.js +4 -5
  5. package/cjm/cli/options.js +4 -2
  6. package/cjm/cli/usage.js +11 -8
  7. package/cjm/domain/CliIo.js +7 -1
  8. package/cjm/exceptions/DomainException.js +7 -7
  9. package/cjm/features/build/BuildConfig.js +108 -59
  10. package/cjm/features/build/BuildController.js +36 -46
  11. package/cjm/features/build/domain/ImportPaths.js +30 -8
  12. package/cjm/features/build/domain/emit.js +2 -2
  13. package/cjm/features/build/domain/scan.js +20 -4
  14. package/cjm/features/build/domain/tokenCollisions.js +1 -1
  15. package/cjm/features/build/domain/tsconfig.js +10 -35
  16. package/cjm/features/build/services/BundleBuilder.js +36 -29
  17. package/cjm/features/build/services/TicConfigService.js +10 -31
  18. package/cjm/index.js +9 -10
  19. package/cjm/schema/ticConfigSchema.js +5 -1
  20. package/package.json +2 -2
  21. package/tic.schema.json +117 -73
  22. package/tpl/index.cjs +15 -15
  23. package/typings/app.d.ts +7 -6
  24. package/typings/cli/Application.d.ts.map +1 -1
  25. package/typings/cli/options.d.ts +7 -1
  26. package/typings/cli/options.d.ts.map +1 -1
  27. package/typings/cli/usage.d.ts.map +1 -1
  28. package/typings/domain/CliIo.d.ts +2 -0
  29. package/typings/domain/CliIo.d.ts.map +1 -1
  30. package/typings/domain/GlobalConfig.d.ts +1 -1
  31. package/typings/domain/GlobalConfig.d.ts.map +1 -1
  32. package/typings/exceptions/DomainException.d.ts +4 -4
  33. package/typings/exceptions/DomainException.d.ts.map +1 -1
  34. package/typings/features/build/BuildConfig.d.ts +107 -94
  35. package/typings/features/build/BuildConfig.d.ts.map +1 -1
  36. package/typings/features/build/BuildController.d.ts +23 -17
  37. package/typings/features/build/BuildController.d.ts.map +1 -1
  38. package/typings/features/build/domain/ImportPaths.d.ts +15 -4
  39. package/typings/features/build/domain/ImportPaths.d.ts.map +1 -1
  40. package/typings/features/build/domain/emit.d.ts +4 -4
  41. package/typings/features/build/domain/emit.d.ts.map +1 -1
  42. package/typings/features/build/domain/scan.d.ts +2 -0
  43. package/typings/features/build/domain/scan.d.ts.map +1 -1
  44. package/typings/features/build/domain/tsconfig.d.ts +9 -16
  45. package/typings/features/build/domain/tsconfig.d.ts.map +1 -1
  46. package/typings/features/build/services/BundleBuilder.d.ts +25 -29
  47. package/typings/features/build/services/BundleBuilder.d.ts.map +1 -1
  48. package/typings/features/build/services/TicConfigService.d.ts +11 -15
  49. package/typings/features/build/services/TicConfigService.d.ts.map +1 -1
  50. package/typings/index.d.ts +6 -7
  51. package/typings/schema/ticConfigSchema.d.ts.map +1 -1
  52. package/cjm/features/build/domain/configFiles.js +0 -35
  53. package/typings/features/build/domain/configFiles.d.ts +0 -13
  54. package/typings/features/build/domain/configFiles.d.ts.map +0 -1
@@ -3,48 +3,42 @@ import { type IRenderService } from '../../../services/HandlebarsRenderService.j
3
3
  import { type IFileSystemService } from '../../../services/NodeFileSystemService.js';
4
4
  import { type ITicConfigService } from './TicConfigService.js';
5
5
  /** What one build does. Paths resolve against the run's working directory. */
6
- export interface BuildRequest {
6
+ export type BuildRequest = {
7
+ /** Path of the config file — `*.json`, `*.yaml` or `*.yml` — relative to the working directory. */
8
+ config: string;
9
+ } | {
7
10
  /**
8
- * Path of the `*.bundle.json` to build, relative to the working directory. Omitted: build
9
- * from the `tsconfig.json` of the package the working directory is in (see `findPackageRoot`),
10
- * every setting at its default.
11
+ * The config as text, e.g. read from stdin: YAML or JSON. Its relative paths resolve
12
+ * against the working directory, and it must set `name`.
11
13
  */
12
- config?: string;
13
- /** Compare instead of writing: outputs that would change are reported `stale`. */
14
- check?: boolean;
15
- }
16
- export interface BuildOptions extends BuildRequest {
14
+ text: string;
15
+ };
16
+ export type BuildOptions = BuildRequest & {
17
17
  /** Default `process.cwd()`. */
18
18
  cwd?: string;
19
- }
20
- /** `written` / `unchanged` after a build; `stale` / `unchanged` after a check. */
21
- export type OutputStatus = 'written' | 'unchanged' | 'stale';
22
- export interface OutputResult {
23
- /** Absolute path of the generated file. */
24
- file: string;
19
+ };
20
+ export interface BuildResult {
21
+ /** Absolute path of the config file that was built; `undefined` for config text. */
22
+ config?: string;
25
23
  /** Name of the generated class. */
26
24
  bundle: string;
27
- status: OutputStatus;
28
25
  registrations: number;
26
+ /** The generated bundle. Nothing is written: saving it is the caller's job (`tic build app.bundle.json > src/di/app.bundle.ts`). */
29
27
  content: string;
30
- }
31
- export interface BuildResult {
32
- /** Absolute path of the config that was built. */
33
- config: string;
34
- output: OutputResult;
35
28
  /**
36
- * Non-fatal problems found while building, e.g. two selected classes passing the same
37
- * decorator token.
29
+ * Non-fatal problems found while building, e.g. a `glob.exclude` that drops a default
30
+ * test glob or two selected classes passing the same decorator token.
38
31
  */
39
32
  warnings: string[];
40
33
  }
41
34
  export interface IBundleBuilder {
42
35
  /**
43
- * Generates the bundle a config describes. Nothing is written unless generation succeeds.
36
+ * Generates the bundle a config describes and returns it; nothing is written.
44
37
  *
45
- * @throws {TicConfigError} when the config or the tsconfig it extends is missing or invalid.
38
+ * @throws {TicConfigError} when the config file is missing or unreadable, the config or its tsconfig is invalid, the bundle has no name, or no tsconfig paths alias covers a selected class's file.
39
+ * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
46
40
  */
47
- build(request?: BuildRequest): BuildResult;
41
+ build(request: BuildRequest): BuildResult;
48
42
  }
49
43
  export declare const IBundleBuilderKey: SingleToken<IBundleBuilder>;
50
44
  export declare class BundleBuilder implements IBundleBuilder {
@@ -54,11 +48,13 @@ export declare class BundleBuilder implements IBundleBuilder {
54
48
  private readonly renderer;
55
49
  constructor(cwd: string, configs: ITicConfigService, fs: IFileSystemService, renderer: IRenderService);
56
50
  /**
57
- * @throws {TicConfigError} when the config or the tsconfig it extends is missing or invalid.
51
+ * @throws {TicConfigError} when the config file is missing or unreadable, the config or its tsconfig is invalid, the bundle has no name, or no tsconfig paths alias covers a selected class's file.
52
+ * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
58
53
  */
59
- build({ config, check }?: BuildRequest): BuildResult;
54
+ build(request: BuildRequest): BuildResult;
60
55
  /**
61
- * @throws {TicConfigError} when the config or the tsconfig it extends is missing or invalid.
56
+ * @throws {TicConfigError} when the tsconfig is missing or invalid, or no tsconfig paths alias covers a selected class's file.
57
+ * @throws {NamespaceNotFoundError} when a path is neither a folder nor a tsconfig paths alias of one.
62
58
  */
63
59
  private generate;
64
60
  }
@@ -1 +1 @@
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;AAQzG,OAAO,EAAE,KAAK,iBAAiB,EAAuC,MAAM,oBAAoB,CAAC;AAIjG,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,kFAAkF;AAClF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;IACrB;;;OAGG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CAC5C;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;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,KAAa,EAAE,GAAE,YAAiB,GAAG,WAAW;IAiBhE;;OAEG;IACH,OAAO,CAAC,QAAQ;CA8BjB"}
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,mGAAmG;IACnG,MAAM,EAAE,MAAM,CAAC;CAChB,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,oFAAoF;IACpF,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;CA2CjB"}
@@ -1,37 +1,33 @@
1
1
  import { SingleToken } from 'ts-ioc-container';
2
2
  import { type IFileSystemService } from '../../../services/NodeFileSystemService.js';
3
3
  import { type ResolvedConfig } from '../BuildConfig.js';
4
- /** The tsconfig a build without a config file extends. */
5
- export declare const TSCONFIG_FILE = "tsconfig.json";
6
4
  export interface ITicConfigService {
7
5
  /**
8
- * Reads and validates a `*.bundle.json`, `*.bundle.yaml` or `*.bundle.yml`.
6
+ * Reads and validates a config file: JSON for `.json`, YAML for `.yaml` / `.yml`.
9
7
  *
10
- * @throws {TicConfigError} when the file is missing, cannot be parsed, or does not match the config shape.
8
+ * @throws {TicConfigError} when the file is missing, has another extension, cannot be parsed, or does not match the config shape.
11
9
  */
12
10
  load(file: string): ResolvedConfig;
13
11
  /**
14
- * The configs to build, as absolute paths: the ones named (relative to the working
15
- * directory), else every `*.bundle.{json,yaml,yml}` at the root of the package the working
16
- * directory is in, else `[undefined]` — one build from that package's `tsconfig.json`
17
- * with default settings. Never looks past the package into a workspace root.
12
+ * Validates config text from somewhere other than a file — stdin, say. It is parsed as YAML,
13
+ * which JSON is a subset of; its relative paths resolve against `dir`, and it has no file
14
+ * name to take the bundle name from, so it must set `name`.
18
15
  *
19
- * @throws {TicConfigError} when none is named and the package has neither a config nor a `tsconfig.json`, or one bundle is described in two formats.
16
+ * @throws {TicConfigError} when the text cannot be parsed, does not match the config shape, or has no `name`.
20
17
  */
21
- discover(named: string[]): (string | undefined)[];
18
+ parse(text: string, dir: string): ResolvedConfig;
22
19
  }
23
20
  export declare const ITicConfigServiceKey: SingleToken<ITicConfigService>;
24
21
  export declare class TicConfigService implements ITicConfigService {
25
- private readonly cwd;
26
22
  private readonly fs;
27
- constructor(cwd: string, fs: IFileSystemService);
23
+ constructor(fs: IFileSystemService);
28
24
  /**
29
- * @throws {TicConfigError} when the file is missing, cannot be parsed, or does not match the config shape.
25
+ * @throws {TicConfigError} when the file is missing, has another extension, cannot be parsed, or does not match the config shape.
30
26
  */
31
27
  load(file: string): ResolvedConfig;
32
28
  /**
33
- * @throws {TicConfigError} when none is named and the package has neither a config nor a `tsconfig.json`, or one bundle is described in two formats.
29
+ * @throws {TicConfigError} when the text cannot be parsed, does not match the config shape, or has no `name`.
34
30
  */
35
- discover(named: string[]): (string | undefined)[];
31
+ parse(text: string, dir: string): ResolvedConfig;
36
32
  }
37
33
  //# sourceMappingURL=TicConfigService.d.ts.map
@@ -1 +1 @@
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;AAIrE,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,yCAAyC,CAAC;AACzG,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AAGpE,0DAA0D;AAC1D,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC;IAEnC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CACnD;AAED,eAAO,MAAM,oBAAoB,gCAA0D,CAAC;AAE5F,qBACa,gBAAiB,YAAW,iBAAiB;IAEzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACd,OAAO,CAAC,QAAQ,CAAC,EAAE;gBADR,GAAG,EAAE,MAAM,EACL,EAAE,EAAE,kBAAkB;IAG5E;;OAEG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc;IAKlC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;CAQlD"}
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,EAA6B,KAAK,cAAc,EAAwB,MAAM,gBAAgB,CAAC;AAEtG,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC;IAEnC;;;;;;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,IAAI,EAAE,MAAM,GAAG,cAAc;IAOlC;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,cAAc;CAGjD"}
@@ -4,14 +4,13 @@ export { type GlobalConfig, GlobalConfigKey, globalConfig } from './domain/Globa
4
4
  export { Application, action, onDefault, DEFAULT_ACTION, commandArgs, parseOptions, validate, type IErrorHandler, IErrorHandlerKey, USAGE, } from './cli.js';
5
5
  export { BuildModule } from './features/build/BuildModule.js';
6
6
  export { BuildController, BUILD_OPTIONS, type BuildCliOptions } from './features/build/BuildController.js';
7
- export { BundleBuilder, IBundleBuilderKey, type IBundleBuilder, type BuildRequest, type BuildOptions, type BuildResult, type OutputResult, type OutputStatus, } from './features/build/services/BundleBuilder.js';
8
- export { TicConfigService, ITicConfigServiceKey, TSCONFIG_FILE, type ITicConfigService, } from './features/build/services/TicConfigService.js';
9
- export { resolveConfig, BUNDLE_CONFIG_SCHEMA, CONFIG_FILE_SUFFIXES, DEFAULT_EXTENDS, DEFAULT_EXCLUDE, DEFAULT_BUNDLE_NAME, DEFAULT_DECORATORS, toClassName, type BundleConfig, type BundleCompilerOptions, type ClassSelector, type ExportKind, type ResolvedClassSelector, type ResolvedConfig, type TsconfigOverrides, } from './features/build/BuildConfig.js';
10
- export { findConfigFiles, findPackageRoot } from './features/build/domain/configFiles.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, parseConfig, CONFIG_FILE_SUFFIXES, STDIN, configFormat, DEFAULT_TSCONFIG, DEFAULT_EXCLUDE, DEFAULT_DECORATORS, toClassName, type BundleConfig, type PathConfig, type ClassSelector, type ExportKind, type ResolvedClassSelector, type GlobSelector, type ResolvedGlobSelector, type ResolvedConfig, type ConfigFormat, } from './features/build/BuildConfig.js';
11
10
  export { ticConfigJsonSchema } from './schema/ticConfigSchema.js';
12
11
  export { ImportPaths } from './features/build/domain/ImportPaths.js';
13
- export { loadTsconfig, type CompiledTsconfig } from './features/build/domain/tsconfig.js';
14
- export { findClasses, isSourceFile, type DiscoveredClass } from './features/build/domain/scan.js';
12
+ export { loadImportPaths } from './features/build/domain/tsconfig.js';
13
+ export { findClasses, isSourceFile, listSourceFiles, type DiscoveredClass } from './features/build/domain/scan.js';
15
14
  export { emitBundle, bundleView, BUNDLE_PROTOCOL, GENERATED_HEADER, type EmitInput, type BundleView, } from './features/build/domain/emit.js';
16
15
  export { tokenCollisions } from './features/build/domain/tokenCollisions.js';
17
16
  export { globToRegExp } from './features/build/domain/glob.js';
@@ -21,6 +20,6 @@ export { type IOutputService, IOutputServiceKey, StdOutputService } from './serv
21
20
  export { type ILogger, ILoggerKey, ConsoleLogger } from './services/ConsoleLogger.js';
22
21
  export { type IFileSystemService, IFileSystemServiceKey, NodeFileSystemService, } from './services/NodeFileSystemService.js';
23
22
  export { type IRenderService, IRenderServiceKey, HandlebarsRenderService, renderProtocol, } from './services/HandlebarsRenderService.js';
24
- export { TicError, TicConfigError, MissingCommandError, UnknownCommandError, UnknownActionError, UsageError, StaleBundlesError, } from './exceptions/DomainException.js';
23
+ export { TicError, TicConfigError, NamespaceNotFoundError, MissingCommandError, UnknownCommandError, UnknownActionError, UsageError, } from './exceptions/DomainException.js';
25
24
  export { ExceptionHandler } from './exceptions/ExceptionHandler.js';
26
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ticConfigSchema.d.ts","sourceRoot":"","sources":["../../lib/schema/ticConfigSchema.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgB7D"}
1
+ {"version":3,"file":"ticConfigSchema.d.ts","sourceRoot":"","sources":["../../lib/schema/ticConfigSchema.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB7D"}
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.findPackageRoot = findPackageRoot;
7
- exports.findConfigFiles = findConfigFiles;
8
- const node_fs_1 = require("node:fs");
9
- const node_path_1 = __importDefault(require("node:path"));
10
- const DomainException_1 = require("../../../exceptions/DomainException");
11
- const BuildConfig_1 = require("../BuildConfig");
12
- function findPackageRoot(dir) {
13
- const start = node_path_1.default.resolve(dir);
14
- for (let current = start;; current = node_path_1.default.dirname(current)) {
15
- if ((0, node_fs_1.existsSync)(node_path_1.default.join(current, 'package.json')))
16
- return current;
17
- if (node_path_1.default.dirname(current) === current)
18
- return start;
19
- }
20
- }
21
- function findConfigFiles(dir) {
22
- const files = (0, node_fs_1.readdirSync)(dir, { withFileTypes: true })
23
- .filter((entry) => entry.isFile() && (0, BuildConfig_1.configSuffix)(entry.name) !== undefined)
24
- .map((entry) => entry.name)
25
- .sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
26
- const byStem = new Map();
27
- for (const file of files) {
28
- const stem = file.slice(0, -(0, BuildConfig_1.configSuffix)(file).length);
29
- const other = byStem.get(stem);
30
- if (other)
31
- throw new DomainException_1.TicConfigError(`${other} and ${file} describe the same bundle; keep one`);
32
- byStem.set(stem, file);
33
- }
34
- return files.map((file) => node_path_1.default.join(dir, file));
35
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * The root of the package `dir` belongs to: the nearest folder, `dir` or above, with a
3
- * `package.json` — the project root in a single-package project, the package in a
4
- * monorepo. `dir` itself when no folder above has one.
5
- */
6
- export declare function findPackageRoot(dir: string): string;
7
- /**
8
- * The `*.bundle.{json,yaml,yml}` configs in `dir` (not its sub-folders), sorted by name.
9
- *
10
- * @throws {TicConfigError} when one bundle is described in two formats, e.g. `app.bundle.json` and `app.bundle.yaml`.
11
- */
12
- export declare function findConfigFiles(dir: string): string[];
13
- //# sourceMappingURL=configFiles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configFiles.d.ts","sourceRoot":"","sources":["../../../../lib/features/build/domain/configFiles.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAarD"}