@ahoo-wang/wow-generator 9.2.0-rc.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 (116) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +177 -0
  3. package/README.zh-CN.md +149 -0
  4. package/dist/analysis/aggregates.d.cts +21 -0
  5. package/dist/analysis/aggregates.d.ts +21 -0
  6. package/dist/analysis/analyze.d.cts +18 -0
  7. package/dist/analysis/analyze.d.ts +18 -0
  8. package/dist/analysis/apiClients.d.cts +14 -0
  9. package/dist/analysis/apiClients.d.ts +14 -0
  10. package/dist/analysis/clientNames.d.cts +55 -0
  11. package/dist/analysis/clientNames.d.ts +55 -0
  12. package/dist/analysis/model.d.cts +212 -0
  13. package/dist/analysis/model.d.ts +212 -0
  14. package/dist/analysis/modelInfo.d.cts +23 -0
  15. package/dist/analysis/modelInfo.d.ts +23 -0
  16. package/dist/analysis/models.d.cts +17 -0
  17. package/dist/analysis/models.d.ts +17 -0
  18. package/dist/api/configuration.d.cts +30 -0
  19. package/dist/api/configuration.d.ts +30 -0
  20. package/dist/api/errors.d.cts +41 -0
  21. package/dist/api/errors.d.ts +41 -0
  22. package/dist/api/logger.d.cts +61 -0
  23. package/dist/api/logger.d.ts +61 -0
  24. package/dist/api/options.d.cts +47 -0
  25. package/dist/api/options.d.ts +47 -0
  26. package/dist/cli/program.d.cts +35 -0
  27. package/dist/cli/program.d.ts +35 -0
  28. package/dist/cli/runGenerate.d.cts +65 -0
  29. package/dist/cli/runGenerate.d.ts +65 -0
  30. package/dist/cli.cjs +3 -0
  31. package/dist/cli.cjs.map +1 -0
  32. package/dist/cli.d.cts +6 -0
  33. package/dist/cli.d.ts +6 -0
  34. package/dist/cli.js +98 -0
  35. package/dist/cli.js.map +1 -0
  36. package/dist/codeGenerator-DpDTDC4o.cjs +23 -0
  37. package/dist/codeGenerator-DpDTDC4o.cjs.map +1 -0
  38. package/dist/codeGenerator-kyY9eLML.js +2583 -0
  39. package/dist/codeGenerator-kyY9eLML.js.map +1 -0
  40. package/dist/emit/importRegistry.d.cts +50 -0
  41. package/dist/emit/importRegistry.d.ts +50 -0
  42. package/dist/emit/imports.d.cts +49 -0
  43. package/dist/emit/imports.d.ts +49 -0
  44. package/dist/emit/jsdoc.d.cts +38 -0
  45. package/dist/emit/jsdoc.d.ts +38 -0
  46. package/dist/emit/moduleBuilder.d.cts +80 -0
  47. package/dist/emit/moduleBuilder.d.ts +80 -0
  48. package/dist/emitters/apiClients.d.cts +10 -0
  49. package/dist/emitters/apiClients.d.ts +10 -0
  50. package/dist/emitters/commandClients.d.cts +14 -0
  51. package/dist/emitters/commandClients.d.ts +14 -0
  52. package/dist/emitters/decorators.d.cts +83 -0
  53. package/dist/emitters/decorators.d.ts +83 -0
  54. package/dist/emitters/emit.d.cts +15 -0
  55. package/dist/emitters/emit.d.ts +15 -0
  56. package/dist/emitters/indexFiles.d.cts +12 -0
  57. package/dist/emitters/indexFiles.d.ts +12 -0
  58. package/dist/emitters/models.d.cts +77 -0
  59. package/dist/emitters/models.d.ts +77 -0
  60. package/dist/emitters/queryClients.d.cts +11 -0
  61. package/dist/emitters/queryClients.d.ts +11 -0
  62. package/dist/emitters/target.d.cts +14 -0
  63. package/dist/emitters/target.d.ts +14 -0
  64. package/dist/finalize/finalize.d.cts +16 -0
  65. package/dist/finalize/finalize.d.ts +16 -0
  66. package/dist/finalize/typeOnlyImports.d.cts +13 -0
  67. package/dist/finalize/typeOnlyImports.d.ts +13 -0
  68. package/dist/finalize/verification.d.cts +14 -0
  69. package/dist/finalize/verification.d.ts +14 -0
  70. package/dist/index.cjs +1 -0
  71. package/dist/index.d.cts +8 -0
  72. package/dist/index.d.ts +8 -0
  73. package/dist/index.js +2 -0
  74. package/dist/input/configuration.d.cts +87 -0
  75. package/dist/input/configuration.d.ts +87 -0
  76. package/dist/input/parsers.d.cts +39 -0
  77. package/dist/input/parsers.d.ts +39 -0
  78. package/dist/input/resources.d.cts +36 -0
  79. package/dist/input/resources.d.ts +36 -0
  80. package/dist/naming/modelInfo.d.cts +10 -0
  81. package/dist/naming/modelInfo.d.ts +10 -0
  82. package/dist/naming/naming.d.cts +102 -0
  83. package/dist/naming/naming.d.ts +102 -0
  84. package/dist/naming/order.d.cts +2 -0
  85. package/dist/naming/order.d.ts +2 -0
  86. package/dist/naming/paths.d.cts +27 -0
  87. package/dist/naming/paths.d.ts +27 -0
  88. package/dist/openapi/components.d.cts +55 -0
  89. package/dist/openapi/components.d.ts +55 -0
  90. package/dist/openapi/document.d.cts +25 -0
  91. package/dist/openapi/document.d.ts +25 -0
  92. package/dist/openapi/operations.d.cts +78 -0
  93. package/dist/openapi/operations.d.ts +78 -0
  94. package/dist/openapi/references.d.cts +28 -0
  95. package/dist/openapi/references.d.ts +28 -0
  96. package/dist/openapi/responses.d.cts +44 -0
  97. package/dist/openapi/responses.d.ts +44 -0
  98. package/dist/openapi/schemas.d.cts +112 -0
  99. package/dist/openapi/schemas.d.ts +112 -0
  100. package/dist/output/outputStore.d.cts +92 -0
  101. package/dist/output/outputStore.d.ts +92 -0
  102. package/dist/pipeline/codeGenerator.d.cts +61 -0
  103. package/dist/pipeline/codeGenerator.d.ts +61 -0
  104. package/dist/pipeline/seams.d.cts +29 -0
  105. package/dist/pipeline/seams.d.ts +29 -0
  106. package/dist/types/typeResolver.d.cts +124 -0
  107. package/dist/types/typeResolver.d.ts +124 -0
  108. package/dist/version.d.cts +2 -0
  109. package/dist/version.d.ts +2 -0
  110. package/dist/wow/conventions.d.cts +154 -0
  111. package/dist/wow/conventions.d.ts +154 -0
  112. package/dist/wow/model.d.cts +116 -0
  113. package/dist/wow/model.d.ts +116 -0
  114. package/dist/wow/resolveWowModel.d.cts +21 -0
  115. package/dist/wow/resolveWowModel.d.ts +21 -0
  116. package/package.json +108 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Where the generator looks for its configuration when none is named.
3
+ */
4
+ export declare const DEFAULT_CONFIG_PATH = "./wow-generator.config.json";
5
+ /**
6
+ * The generator configuration, read from {@link DEFAULT_CONFIG_PATH} or the
7
+ * path `GeneratorOptions.configPath` names.
8
+ */
9
+ export interface GeneratorConfiguration {
10
+ /**
11
+ * tag name -> api client configuration
12
+ */
13
+ apiClients?: Record<string, ApiClientConfiguration>;
14
+ }
15
+ export interface ApiClientConfiguration {
16
+ /**
17
+ * The path parameters the client leaves out, because an interceptor fills
18
+ * them.
19
+ *
20
+ * Default: `['tenantId', 'ownerId']` for a Wow document (one with
21
+ * `x-wow-context-alias` or aggregates), whose CoSec interceptor fills them;
22
+ * none for any other document.
23
+ */
24
+ ignorePathParameters?: string[];
25
+ /**
26
+ * Method names by operationId, overriding the name derived from it. Use it
27
+ * when two operations of one tag derive the same name.
28
+ */
29
+ methodNames?: Record<string, string>;
30
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * What a generation failure is about, which decides the CLI's exit code.
3
+ *
4
+ * - `input`: the OpenAPI document cannot be read, fetched or parsed, or it is
5
+ * not an OpenAPI 3 document.
6
+ * - `configuration`: the generator configuration cannot be read, parsed or
7
+ * understood.
8
+ * - `specification`: the document was read, but it describes something the
9
+ * generator cannot turn into code that compiles: a dangling, cyclic or
10
+ * external reference, names that collide after normalisation, malformed Wow
11
+ * metadata.
12
+ * - `output`: the output directory cannot be written as asked: its manifest
13
+ * (`.wow-generator.json`) is corrupt, a path resolves outside it, or writing
14
+ * or deleting a file fails.
15
+ */
16
+ export type GeneratorErrorKind = 'input' | 'configuration' | 'specification' | 'output';
17
+ /**
18
+ * Exit codes of the `wow-generator` CLI. Anything the generator did not
19
+ * anticipate exits with {@link EXIT_CODES.internal}.
20
+ */
21
+ export declare const EXIT_CODES: {
22
+ readonly success: 0;
23
+ readonly internal: 1;
24
+ readonly input: 2;
25
+ readonly configuration: 3;
26
+ readonly specification: 4;
27
+ readonly output: 5;
28
+ readonly interrupted: 130;
29
+ };
30
+ /**
31
+ * A failure the user can act on. Its message is written as one line that
32
+ * names what went wrong and where; the CLI prints it without a stack trace.
33
+ */
34
+ export declare class GeneratorError extends Error {
35
+ readonly kind: GeneratorErrorKind;
36
+ constructor(kind: GeneratorErrorKind, message: string, options?: ErrorOptions);
37
+ /** The CLI exit code this failure maps to. */
38
+ get exitCode(): number;
39
+ }
40
+ /** Renders an error as the tail of a sentence. */
41
+ export declare function errorMessage(error: unknown): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * What a generation failure is about, which decides the CLI's exit code.
3
+ *
4
+ * - `input`: the OpenAPI document cannot be read, fetched or parsed, or it is
5
+ * not an OpenAPI 3 document.
6
+ * - `configuration`: the generator configuration cannot be read, parsed or
7
+ * understood.
8
+ * - `specification`: the document was read, but it describes something the
9
+ * generator cannot turn into code that compiles: a dangling, cyclic or
10
+ * external reference, names that collide after normalisation, malformed Wow
11
+ * metadata.
12
+ * - `output`: the output directory cannot be written as asked: its manifest
13
+ * (`.wow-generator.json`) is corrupt, a path resolves outside it, or writing
14
+ * or deleting a file fails.
15
+ */
16
+ export type GeneratorErrorKind = 'input' | 'configuration' | 'specification' | 'output';
17
+ /**
18
+ * Exit codes of the `wow-generator` CLI. Anything the generator did not
19
+ * anticipate exits with {@link EXIT_CODES.internal}.
20
+ */
21
+ export declare const EXIT_CODES: {
22
+ readonly success: 0;
23
+ readonly internal: 1;
24
+ readonly input: 2;
25
+ readonly configuration: 3;
26
+ readonly specification: 4;
27
+ readonly output: 5;
28
+ readonly interrupted: 130;
29
+ };
30
+ /**
31
+ * A failure the user can act on. Its message is written as one line that
32
+ * names what went wrong and where; the CLI prints it without a stack trace.
33
+ */
34
+ export declare class GeneratorError extends Error {
35
+ readonly kind: GeneratorErrorKind;
36
+ constructor(kind: GeneratorErrorKind, message: string, options?: ErrorOptions);
37
+ /** The CLI exit code this failure maps to. */
38
+ get exitCode(): number;
39
+ }
40
+ /** Renders an error as the tail of a sentence. */
41
+ export declare function errorMessage(error: unknown): string;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Where a generation reports what it does.
3
+ *
4
+ * Each method takes a message and, optionally, values to print after it, as
5
+ * `console.log` does. A run calls:
6
+ *
7
+ * - `debug` for every step and detail;
8
+ * - `info` for the outcome of the run;
9
+ * - `warn` for something it carried on past, but that the user probably did
10
+ * not intend; `GenerationResult.warnings` counts these calls;
11
+ * - `error` for a failure.
12
+ */
13
+ export interface Logger {
14
+ debug(message: string, ...params: unknown[]): void;
15
+ info(message: string, ...params: unknown[]): void;
16
+ warn(message: string, ...params: unknown[]): void;
17
+ error(message: string, ...params: unknown[]): void;
18
+ }
19
+ /**
20
+ * How much a {@link ConsoleLogger} prints.
21
+ *
22
+ * - `quiet`: warnings and errors only.
23
+ * - `normal`: also `info`, the outcome of the run.
24
+ * - `verbose`: also `debug`, every detail, with timestamps.
25
+ */
26
+ export type LogLevel = 'quiet' | 'normal' | 'verbose';
27
+ export interface ConsoleLoggerOptions {
28
+ /** Defaults to `normal`. */
29
+ readonly level?: LogLevel;
30
+ /**
31
+ * Prefix lines with symbols. Defaults to true on a TTY unless `NO_COLOR`
32
+ * is set, so CI logs and pipes stay plain.
33
+ */
34
+ readonly decorate?: boolean;
35
+ }
36
+ /**
37
+ * Console logger for the CLI.
38
+ *
39
+ * Details go to `debug`, which only `verbose` prints; the default prints the
40
+ * outcome, warnings and errors, so a warning is not lost among hundreds of
41
+ * detail lines.
42
+ */
43
+ export declare class ConsoleLogger implements Logger {
44
+ private readonly level;
45
+ private readonly decorate;
46
+ constructor(options?: ConsoleLoggerOptions);
47
+ private format;
48
+ debug(message: string, ...params: unknown[]): void;
49
+ info(message: string, ...params: unknown[]): void;
50
+ warn(message: string, ...params: unknown[]): void;
51
+ error(message: string, ...params: unknown[]): void;
52
+ }
53
+ /**
54
+ * Logger that prints nothing.
55
+ */
56
+ export declare class SilentLogger implements Logger {
57
+ debug(): void;
58
+ info(): void;
59
+ warn(): void;
60
+ error(): void;
61
+ }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Where a generation reports what it does.
3
+ *
4
+ * Each method takes a message and, optionally, values to print after it, as
5
+ * `console.log` does. A run calls:
6
+ *
7
+ * - `debug` for every step and detail;
8
+ * - `info` for the outcome of the run;
9
+ * - `warn` for something it carried on past, but that the user probably did
10
+ * not intend; `GenerationResult.warnings` counts these calls;
11
+ * - `error` for a failure.
12
+ */
13
+ export interface Logger {
14
+ debug(message: string, ...params: unknown[]): void;
15
+ info(message: string, ...params: unknown[]): void;
16
+ warn(message: string, ...params: unknown[]): void;
17
+ error(message: string, ...params: unknown[]): void;
18
+ }
19
+ /**
20
+ * How much a {@link ConsoleLogger} prints.
21
+ *
22
+ * - `quiet`: warnings and errors only.
23
+ * - `normal`: also `info`, the outcome of the run.
24
+ * - `verbose`: also `debug`, every detail, with timestamps.
25
+ */
26
+ export type LogLevel = 'quiet' | 'normal' | 'verbose';
27
+ export interface ConsoleLoggerOptions {
28
+ /** Defaults to `normal`. */
29
+ readonly level?: LogLevel;
30
+ /**
31
+ * Prefix lines with symbols. Defaults to true on a TTY unless `NO_COLOR`
32
+ * is set, so CI logs and pipes stay plain.
33
+ */
34
+ readonly decorate?: boolean;
35
+ }
36
+ /**
37
+ * Console logger for the CLI.
38
+ *
39
+ * Details go to `debug`, which only `verbose` prints; the default prints the
40
+ * outcome, warnings and errors, so a warning is not lost among hundreds of
41
+ * detail lines.
42
+ */
43
+ export declare class ConsoleLogger implements Logger {
44
+ private readonly level;
45
+ private readonly decorate;
46
+ constructor(options?: ConsoleLoggerOptions);
47
+ private format;
48
+ debug(message: string, ...params: unknown[]): void;
49
+ info(message: string, ...params: unknown[]): void;
50
+ warn(message: string, ...params: unknown[]): void;
51
+ error(message: string, ...params: unknown[]): void;
52
+ }
53
+ /**
54
+ * Logger that prints nothing.
55
+ */
56
+ export declare class SilentLogger implements Logger {
57
+ debug(): void;
58
+ info(): void;
59
+ warn(): void;
60
+ error(): void;
61
+ }
@@ -0,0 +1,47 @@
1
+ import { Logger } from './logger.cjs';
2
+ /**
3
+ * How much of each schema a generated model's doc comment carries.
4
+ *
5
+ * - `summary`: title, description, schema key, format, default, example and
6
+ * constraints.
7
+ * - `full`: the summary plus the complete JSON schema.
8
+ */
9
+ export type SchemaDocs = 'summary' | 'full';
10
+ /**
11
+ * Options of a `CodeGenerator` run.
12
+ */
13
+ export interface GeneratorOptions {
14
+ /** Path or http(s) URL of the OpenAPI 3 document. */
15
+ readonly inputPath: string;
16
+ /** Directory the generated files are written to. */
17
+ readonly outputDir: string;
18
+ /**
19
+ * Path or URL of the generator configuration. When omitted, the generator
20
+ * reads `./wow-generator.config.json` if it exists.
21
+ */
22
+ readonly configPath?: string;
23
+ /**
24
+ * The project's `tsconfig.json`. Its compiler options decide how the
25
+ * generator resolves the modules it imports while it tidies the output.
26
+ */
27
+ readonly tsConfigFilePath?: string;
28
+ /** Receives progress, warnings and errors. Defaults to a `ConsoleLogger` at the `normal` level. */
29
+ readonly logger?: Logger;
30
+ /** Request headers used when `inputPath` or `configPath` is an http(s) URL. */
31
+ readonly headers?: Record<string, string>;
32
+ /** Milliseconds before fetching an http(s) document is abandoned. Defaults to 30000. */
33
+ readonly timeoutMs?: number;
34
+ /** How much of each schema the model doc comments carry. Defaults to `summary`. */
35
+ readonly schemaDocs?: SchemaDocs;
36
+ }
37
+ /**
38
+ * What a generation produced.
39
+ */
40
+ export interface GenerationResult {
41
+ /** Absolute paths of the files written, sorted. */
42
+ readonly files: readonly string[];
43
+ /** The configuration read, or undefined when none was found. */
44
+ readonly configPath?: string;
45
+ /** How many warnings the run logged. */
46
+ readonly warnings: number;
47
+ }
@@ -0,0 +1,47 @@
1
+ import { Logger } from './logger.js';
2
+ /**
3
+ * How much of each schema a generated model's doc comment carries.
4
+ *
5
+ * - `summary`: title, description, schema key, format, default, example and
6
+ * constraints.
7
+ * - `full`: the summary plus the complete JSON schema.
8
+ */
9
+ export type SchemaDocs = 'summary' | 'full';
10
+ /**
11
+ * Options of a `CodeGenerator` run.
12
+ */
13
+ export interface GeneratorOptions {
14
+ /** Path or http(s) URL of the OpenAPI 3 document. */
15
+ readonly inputPath: string;
16
+ /** Directory the generated files are written to. */
17
+ readonly outputDir: string;
18
+ /**
19
+ * Path or URL of the generator configuration. When omitted, the generator
20
+ * reads `./wow-generator.config.json` if it exists.
21
+ */
22
+ readonly configPath?: string;
23
+ /**
24
+ * The project's `tsconfig.json`. Its compiler options decide how the
25
+ * generator resolves the modules it imports while it tidies the output.
26
+ */
27
+ readonly tsConfigFilePath?: string;
28
+ /** Receives progress, warnings and errors. Defaults to a `ConsoleLogger` at the `normal` level. */
29
+ readonly logger?: Logger;
30
+ /** Request headers used when `inputPath` or `configPath` is an http(s) URL. */
31
+ readonly headers?: Record<string, string>;
32
+ /** Milliseconds before fetching an http(s) document is abandoned. Defaults to 30000. */
33
+ readonly timeoutMs?: number;
34
+ /** How much of each schema the model doc comments carry. Defaults to `summary`. */
35
+ readonly schemaDocs?: SchemaDocs;
36
+ }
37
+ /**
38
+ * What a generation produced.
39
+ */
40
+ export interface GenerationResult {
41
+ /** Absolute paths of the files written, sorted. */
42
+ readonly files: readonly string[];
43
+ /** The configuration read, or undefined when none was found. */
44
+ readonly configPath?: string;
45
+ /** How many warnings the run logged. */
46
+ readonly warnings: number;
47
+ }
@@ -0,0 +1,35 @@
1
+ import { Command, CommanderError } from 'commander';
2
+ /** Collects the values of an option given more than once, such as `--header`. */
3
+ export declare function collect(value: string, previous?: string[]): string[];
4
+ /**
5
+ * Sets up the CLI program with all commands and options.
6
+ *
7
+ * Commander does not exit the process: a usage error (a missing required
8
+ * option, an unknown option or command, a missing argument, no command at
9
+ * all) is thrown as a `CommanderError`, which {@link runCLI} maps to an exit
10
+ * code.
11
+ *
12
+ * @param target - The program to set up; commander's global one by default.
13
+ * Settings made on it before this call, such as `configureOutput`, reach the
14
+ * `generate` command too.
15
+ * @returns The configured commander program instance
16
+ */
17
+ export declare function setupCLI(target?: Command): Command;
18
+ /**
19
+ * The exit code of a command line commander stopped at: 0 for `--help`,
20
+ * `help` and `--version`; {@link EXIT_CODES.input} for a usage error, which
21
+ * commander has already reported. A usage error is an invalid command line,
22
+ * the same category as an invalid option value such as `--timeout abc`.
23
+ */
24
+ export declare function commanderExitCode(error: CommanderError): number;
25
+ /**
26
+ * Parses the command line and runs the command it names. The `generate`
27
+ * command sets the process exit code itself; a command line commander stops
28
+ * at sets it to {@link commanderExitCode}.
29
+ *
30
+ * @param args - The arguments after the executable and script;
31
+ * `process.argv` by default
32
+ * @param target - The program to run; {@link setupCLI} on commander's global
33
+ * one by default
34
+ */
35
+ export declare function runCLI(args?: readonly string[], target?: Command): Promise<void>;
@@ -0,0 +1,35 @@
1
+ import { Command, CommanderError } from 'commander';
2
+ /** Collects the values of an option given more than once, such as `--header`. */
3
+ export declare function collect(value: string, previous?: string[]): string[];
4
+ /**
5
+ * Sets up the CLI program with all commands and options.
6
+ *
7
+ * Commander does not exit the process: a usage error (a missing required
8
+ * option, an unknown option or command, a missing argument, no command at
9
+ * all) is thrown as a `CommanderError`, which {@link runCLI} maps to an exit
10
+ * code.
11
+ *
12
+ * @param target - The program to set up; commander's global one by default.
13
+ * Settings made on it before this call, such as `configureOutput`, reach the
14
+ * `generate` command too.
15
+ * @returns The configured commander program instance
16
+ */
17
+ export declare function setupCLI(target?: Command): Command;
18
+ /**
19
+ * The exit code of a command line commander stopped at: 0 for `--help`,
20
+ * `help` and `--version`; {@link EXIT_CODES.input} for a usage error, which
21
+ * commander has already reported. A usage error is an invalid command line,
22
+ * the same category as an invalid option value such as `--timeout abc`.
23
+ */
24
+ export declare function commanderExitCode(error: CommanderError): number;
25
+ /**
26
+ * Parses the command line and runs the command it names. The `generate`
27
+ * command sets the process exit code itself; a command line commander stops
28
+ * at sets it to {@link commanderExitCode}.
29
+ *
30
+ * @param args - The arguments after the executable and script;
31
+ * `process.argv` by default
32
+ * @param target - The program to run; {@link setupCLI} on commander's global
33
+ * one by default
34
+ */
35
+ export declare function runCLI(args?: readonly string[], target?: Command): Promise<void>;
@@ -0,0 +1,65 @@
1
+ import { Logger } from '../api/logger.cjs';
2
+ import { Seams } from '../pipeline/seams.cjs';
3
+ /**
4
+ * Options of the `generate` command, as commander parses them.
5
+ */
6
+ export interface GenerateCommandOptions {
7
+ input: string;
8
+ output: string;
9
+ config?: string;
10
+ tsConfigFilePath?: string;
11
+ /** `Name: value` request headers for an http(s) input or configuration. */
12
+ header?: string[];
13
+ /** Milliseconds, as typed on the command line. */
14
+ timeout?: string;
15
+ /** `summary` or `full`. */
16
+ schemaDocs?: string;
17
+ /** Exit with a non-zero code when the run logged a warning. */
18
+ strict?: boolean;
19
+ verbose?: boolean;
20
+ quiet?: boolean;
21
+ }
22
+ /**
23
+ * Validates the input path or URL.
24
+ *
25
+ * Any file path is accepted here and checked when it is read. A URL must use
26
+ * http or https; its host is not restricted, because the generator runs on
27
+ * the developer's own machine against a document they chose, and fetching an
28
+ * intranet service's `/v3/api-docs` is the common case.
29
+ *
30
+ * @param input - Input path or URL
31
+ * @returns true if valid
32
+ */
33
+ export declare function validateInput(input: string): boolean;
34
+ /**
35
+ * Parses `Name: value` header arguments.
36
+ *
37
+ * @param headers - The raw `--header` values
38
+ * @returns The headers by name
39
+ * @throws GeneratorError of kind `input` for a value without a name
40
+ */
41
+ export declare function parseHeaders(headers?: readonly string[]): Record<string, string>;
42
+ /**
43
+ * Runs the `generate` command.
44
+ *
45
+ * @param options - The parsed command options
46
+ * @param logger - Where to report; a console logger at the level the options ask for by default
47
+ * @param seams - What the package hands the generator beyond the options;
48
+ * a run stopped by the {@link SIGNAL_SEAM} exits with
49
+ * {@link EXIT_CODES.interrupted}
50
+ * @returns The exit code: see {@link EXIT_CODES}
51
+ */
52
+ export declare function runGenerate(options: GenerateCommandOptions, logger?: Logger, seams?: Seams): Promise<number>;
53
+ /**
54
+ * Action handler for the generate command: runs it and sets the process exit
55
+ * code.
56
+ *
57
+ * Ctrl-C stops the run at its next step and exits with
58
+ * {@link EXIT_CODES.interrupted}. A run that has begun writing finishes
59
+ * writing its files, then stops: it removes no stale file and leaves the
60
+ * manifest as the last complete run wrote it, so the manifest never records
61
+ * a run that did not finish. A second Ctrl-C ends the process at once.
62
+ *
63
+ * @param options - Command options
64
+ */
65
+ export declare function generateAction(options: GenerateCommandOptions): Promise<void>;
@@ -0,0 +1,65 @@
1
+ import { Logger } from '../api/logger.js';
2
+ import { Seams } from '../pipeline/seams.js';
3
+ /**
4
+ * Options of the `generate` command, as commander parses them.
5
+ */
6
+ export interface GenerateCommandOptions {
7
+ input: string;
8
+ output: string;
9
+ config?: string;
10
+ tsConfigFilePath?: string;
11
+ /** `Name: value` request headers for an http(s) input or configuration. */
12
+ header?: string[];
13
+ /** Milliseconds, as typed on the command line. */
14
+ timeout?: string;
15
+ /** `summary` or `full`. */
16
+ schemaDocs?: string;
17
+ /** Exit with a non-zero code when the run logged a warning. */
18
+ strict?: boolean;
19
+ verbose?: boolean;
20
+ quiet?: boolean;
21
+ }
22
+ /**
23
+ * Validates the input path or URL.
24
+ *
25
+ * Any file path is accepted here and checked when it is read. A URL must use
26
+ * http or https; its host is not restricted, because the generator runs on
27
+ * the developer's own machine against a document they chose, and fetching an
28
+ * intranet service's `/v3/api-docs` is the common case.
29
+ *
30
+ * @param input - Input path or URL
31
+ * @returns true if valid
32
+ */
33
+ export declare function validateInput(input: string): boolean;
34
+ /**
35
+ * Parses `Name: value` header arguments.
36
+ *
37
+ * @param headers - The raw `--header` values
38
+ * @returns The headers by name
39
+ * @throws GeneratorError of kind `input` for a value without a name
40
+ */
41
+ export declare function parseHeaders(headers?: readonly string[]): Record<string, string>;
42
+ /**
43
+ * Runs the `generate` command.
44
+ *
45
+ * @param options - The parsed command options
46
+ * @param logger - Where to report; a console logger at the level the options ask for by default
47
+ * @param seams - What the package hands the generator beyond the options;
48
+ * a run stopped by the {@link SIGNAL_SEAM} exits with
49
+ * {@link EXIT_CODES.interrupted}
50
+ * @returns The exit code: see {@link EXIT_CODES}
51
+ */
52
+ export declare function runGenerate(options: GenerateCommandOptions, logger?: Logger, seams?: Seams): Promise<number>;
53
+ /**
54
+ * Action handler for the generate command: runs it and sets the process exit
55
+ * code.
56
+ *
57
+ * Ctrl-C stops the run at its next step and exits with
58
+ * {@link EXIT_CODES.interrupted}. A run that has begun writing finishes
59
+ * writing its files, then stops: it removes no stale file and leaves the
60
+ * manifest as the last complete run wrote it, so the manifest never records
61
+ * a run that did not finish. A second Ctrl-C ends the process at once.
62
+ *
63
+ * @param options - Command options
64
+ */
65
+ export declare function generateAction(options: GenerateCommandOptions): Promise<void>;
package/dist/cli.cjs ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./codeGenerator-DpDTDC4o.cjs");let t=require("path"),n=require("commander");var r=`9.2.0-rc.0`;function i(e){if(!e)return!1;let t;try{t=new URL(e)}catch{return!0}return/^[a-z]:$/i.test(t.protocol)?!0:t.protocol===`http:`||t.protocol===`https:`}function a(t=[]){let n={};for(let r of t){let t=r.indexOf(`:`),i=t>0?r.slice(0,t).trim():``;if(!i)throw new e.s(`input`,`Invalid --header "${r}": expected "Name: value".`);n[i]=r.slice(t+1).trim()}return n}function o(t){if(t===void 0)return;let n=Number(t);if(!Number.isInteger(n)||n<=0)throw new e.s(`input`,`Invalid --timeout "${t}": expected a positive number of milliseconds.`);return n}function s(t){if(t===void 0||t===`summary`)return`summary`;if(t===`full`)return`full`;throw new e.s(`input`,`Invalid --schema-docs "${t}": expected "summary" or "full".`)}function c(e){return e.verbose?`verbose`:e.quiet?`quiet`:`normal`}function l(t,n,r){if(n instanceof e.s)return t.error(n.message),r&&n.cause!==void 0&&t.error(`Caused by:`,n.cause),n.exitCode;let i=n instanceof Error?n.message:String(n);return t.error(`Code generation failed: ${i}`),r?t.error(``,n):t.error(`Rerun with --verbose for the stack trace, and report it at https://github.com/Ahoo-Wang/Wow/issues if the input is valid.`),e.o.internal}async function u(n,u=new e.i({level:c(n)}),d={}){if(!i(n.input))return u.error(`Invalid input "${n.input}": expected a file path or an http(s) URL.`),e.o.input;try{u.debug(`wow-generator v${r}`);let i={...d,inputPath:n.input,outputDir:n.output,configPath:n.config,tsConfigFilePath:n.tsConfigFilePath,headers:a(n.header),timeoutMs:o(n.timeout),schemaDocs:s(n.schemaDocs),logger:u},c=await new e.t(i).generate(),l=c.warnings?`, ${c.warnings} warning${c.warnings===1?``:`s`}`:``,f=c.configPath?` with ${(0,t.relative)(process.cwd(),c.configPath)||c.configPath}`:``;return u.info(`Generated ${c.files.length} files into ${n.output}${f}${l}`),n.strict&&c.warnings>0?(u.error(`--strict: the run logged ${c.warnings} warning${c.warnings===1?``:`s`}.`),e.o.specification):e.o.success}catch(t){return d[e.n]?.aborted?e.o.interrupted:l(u,t,!!n.verbose)}}async function d(t){let n=new AbortController;process.once(`SIGINT`,()=>{console.error(`Generation interrupted by user`),n.abort()}),process.exitCode=await u(t,void 0,{[e.n]:n.signal})}function f(e,t=[]){return[...t,e]}function p(t=n.program){return t.exitOverride(),t.name(`wow-generator`).description(`OpenAPI Specification TypeScript code generator for Wow`).version(r,`-v, --version`),t.command(`generate`).description(`Generate TypeScript code from OpenAPI specification`).requiredOption(`-i, --input <file>`,`Input OpenAPI specification file path or URL (http/https)`).option(`-o, --output <path>`,`Output directory path`,`src/generated`).option(`-c, --config <file>`,`Configuration file path (default: ${e.c})`).option(`-t, --ts-config-file-path <file>`,`TypeScript configuration file path`).option(`-H, --header <header>`,`Request header for an http(s) input or configuration, as "Name: value"; repeatable`,f).option(`--timeout <ms>`,`Milliseconds before fetching an http(s) input is abandoned (default: ${e.r})`).option(`--schema-docs <mode>`,`What model doc comments carry: "summary" (title, description, constraints) or "full" (also the JSON schema)`,`summary`).option(`--strict`,`Exit with code 4 when the run logs a warning`).option(`--verbose`,`Log every step, and the stack trace of a failure`).option(`--quiet`,`Log only warnings and errors`).action(d),t}function m(t){return t.exitCode===0?e.o.success:e.o.input}async function h(e,t=p()){try{e===void 0?await t.parseAsync():await t.parseAsync(e,{from:`user`})}catch(e){if(!(e instanceof n.CommanderError))throw e;process.exitCode=m(e)}}h(),exports.collect=f,exports.runCLI=h,exports.setupCLI=p;
3
+ //# sourceMappingURL=cli.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.cjs","names":["GeneratorError","EXIT_CODES","ConsoleLogger","CodeGenerator","relative","SIGNAL_SEAM","program","DEFAULT_CONFIG_PATH","DEFAULT_HTTP_TIMEOUT_MS","EXIT_CODES","CommanderError","require_codeGenerator","path","commander","VERSION","validateInput","input","url","parseHeaders","parsed","header","headers","separator","name","parseTimeout","timeout","value","parseSchemaDocs","schemaDocs","logLevel","options","reportFailure","error","logger","verbose","message","runGenerate","generatorOptions","seams","result","warnings","config","generateAction","interruption","collect","previous","setupCLI","target","commanderExitCode","runCLI","args"],"sources":["../src/version.ts","../src/cli/runGenerate.ts","../src/cli/program.ts","../src/cli.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Replaced at build time with the `version` of this package's package.json\n// (`define` in vite.config.ts, which Vitest shares), so only the version string\n// reaches dist, not the manifest with its dependencies and workspace ranges.\ndeclare const __WOW_GENERATOR_VERSION__: string;\n\n/** The version of this package, as its package.json named it at build time. */\nexport const VERSION: string = __WOW_GENERATOR_VERSION__;\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { relative } from 'path';\nimport { VERSION } from '../version';\nimport { EXIT_CODES, GeneratorError } from '../api/errors';\nimport { CodeGenerator } from '../pipeline/codeGenerator';\nimport type { Logger, LogLevel } from '../api/logger';\nimport { ConsoleLogger } from '../api/logger';\nimport type { SchemaDocs } from '../api/options';\nimport type { SeamOptions, Seams } from '../pipeline/seams';\nimport { SIGNAL_SEAM } from '../pipeline/seams';\n\n/**\n * Options of the `generate` command, as commander parses them.\n */\nexport interface GenerateCommandOptions {\n input: string;\n output: string;\n config?: string;\n tsConfigFilePath?: string;\n /** `Name: value` request headers for an http(s) input or configuration. */\n header?: string[];\n /** Milliseconds, as typed on the command line. */\n timeout?: string;\n /** `summary` or `full`. */\n schemaDocs?: string;\n /** Exit with a non-zero code when the run logged a warning. */\n strict?: boolean;\n verbose?: boolean;\n quiet?: boolean;\n}\n\n/**\n * Validates the input path or URL.\n *\n * Any file path is accepted here and checked when it is read. A URL must use\n * http or https; its host is not restricted, because the generator runs on\n * the developer's own machine against a document they chose, and fetching an\n * intranet service's `/v3/api-docs` is the common case.\n *\n * @param input - Input path or URL\n * @returns true if valid\n */\nexport function validateInput(input: string): boolean {\n if (!input) return false;\n let url: URL;\n try {\n url = new URL(input);\n } catch {\n // Not a URL: a file path, which parseOpenAPI reads.\n return true;\n }\n // A Windows path such as C:\\spec.json parses as a URL with scheme \"c:\".\n if (/^[a-z]:$/i.test(url.protocol)) return true;\n return url.protocol === 'http:' || url.protocol === 'https:';\n}\n\n/**\n * Parses `Name: value` header arguments.\n *\n * @param headers - The raw `--header` values\n * @returns The headers by name\n * @throws GeneratorError of kind `input` for a value without a name\n */\nexport function parseHeaders(\n headers: readonly string[] = [],\n): Record<string, string> {\n const parsed: Record<string, string> = {};\n for (const header of headers) {\n const separator = header.indexOf(':');\n const name = separator > 0 ? header.slice(0, separator).trim() : '';\n if (!name) {\n throw new GeneratorError(\n 'input',\n `Invalid --header \"${header}\": expected \"Name: value\".`,\n );\n }\n parsed[name] = header.slice(separator + 1).trim();\n }\n return parsed;\n}\n\nfunction parseTimeout(timeout: string | undefined): number | undefined {\n if (timeout === undefined) return undefined;\n const value = Number(timeout);\n if (!Number.isInteger(value) || value <= 0) {\n throw new GeneratorError(\n 'input',\n `Invalid --timeout \"${timeout}\": expected a positive number of milliseconds.`,\n );\n }\n return value;\n}\n\nfunction parseSchemaDocs(schemaDocs: string | undefined): SchemaDocs {\n if (schemaDocs === undefined || schemaDocs === 'summary') return 'summary';\n if (schemaDocs === 'full') return 'full';\n throw new GeneratorError(\n 'input',\n `Invalid --schema-docs \"${schemaDocs}\": expected \"summary\" or \"full\".`,\n );\n}\n\nfunction logLevel(options: GenerateCommandOptions): LogLevel {\n if (options.verbose) return 'verbose';\n if (options.quiet) return 'quiet';\n return 'normal';\n}\n\n/**\n * Reports a failure as one actionable line; the stack and the causes only\n * with `--verbose`.\n *\n * @returns The exit code the failure maps to\n */\nfunction reportFailure(\n logger: Logger,\n error: unknown,\n verbose: boolean,\n): number {\n if (error instanceof GeneratorError) {\n logger.error(error.message);\n if (verbose && error.cause !== undefined) {\n logger.error('Caused by:', error.cause);\n }\n return error.exitCode;\n }\n const message = error instanceof Error ? error.message : String(error);\n logger.error(`Code generation failed: ${message}`);\n if (verbose) {\n logger.error('', error);\n } else {\n logger.error(\n 'Rerun with --verbose for the stack trace, and report it at https://github.com/Ahoo-Wang/Wow/issues if the input is valid.',\n );\n }\n return EXIT_CODES.internal;\n}\n\n/**\n * Runs the `generate` command.\n *\n * @param options - The parsed command options\n * @param logger - Where to report; a console logger at the level the options ask for by default\n * @param seams - What the package hands the generator beyond the options;\n * a run stopped by the {@link SIGNAL_SEAM} exits with\n * {@link EXIT_CODES.interrupted}\n * @returns The exit code: see {@link EXIT_CODES}\n */\nexport async function runGenerate(\n options: GenerateCommandOptions,\n logger: Logger = new ConsoleLogger({ level: logLevel(options) }),\n seams: Seams = {},\n): Promise<number> {\n if (!validateInput(options.input)) {\n logger.error(\n `Invalid input \"${options.input}\": expected a file path or an http(s) URL.`,\n );\n return EXIT_CODES.input;\n }\n try {\n logger.debug(`wow-generator v${VERSION}`);\n const generatorOptions: SeamOptions = {\n ...seams,\n inputPath: options.input,\n outputDir: options.output,\n configPath: options.config,\n tsConfigFilePath: options.tsConfigFilePath,\n headers: parseHeaders(options.header),\n timeoutMs: parseTimeout(options.timeout),\n schemaDocs: parseSchemaDocs(options.schemaDocs),\n logger,\n };\n const result = await new CodeGenerator(generatorOptions).generate();\n const warnings = result.warnings\n ? `, ${result.warnings} warning${result.warnings === 1 ? '' : 's'}`\n : '';\n const config = result.configPath\n ? ` with ${relative(process.cwd(), result.configPath) || result.configPath}`\n : '';\n logger.info(\n `Generated ${result.files.length} files into ${options.output}${config}${warnings}`,\n );\n if (options.strict && result.warnings > 0) {\n logger.error(\n `--strict: the run logged ${result.warnings} warning${result.warnings === 1 ? '' : 's'}.`,\n );\n return EXIT_CODES.specification;\n }\n return EXIT_CODES.success;\n } catch (error) {\n if (seams[SIGNAL_SEAM]?.aborted) return EXIT_CODES.interrupted;\n return reportFailure(logger, error, !!options.verbose);\n }\n}\n\n/**\n * Action handler for the generate command: runs it and sets the process exit\n * code.\n *\n * Ctrl-C stops the run at its next step and exits with\n * {@link EXIT_CODES.interrupted}. A run that has begun writing finishes\n * writing its files, then stops: it removes no stale file and leaves the\n * manifest as the last complete run wrote it, so the manifest never records\n * a run that did not finish. A second Ctrl-C ends the process at once.\n *\n * @param options - Command options\n */\nexport async function generateAction(options: GenerateCommandOptions) {\n const interruption = new AbortController();\n process.once('SIGINT', () => {\n console.error('Generation interrupted by user');\n interruption.abort();\n });\n process.exitCode = await runGenerate(options, undefined, {\n [SIGNAL_SEAM]: interruption.signal,\n });\n}\n","/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Command } from 'commander';\nimport { CommanderError, program } from 'commander';\nimport { VERSION } from '../version';\nimport { DEFAULT_CONFIG_PATH } from '../api/configuration';\nimport { EXIT_CODES } from '../api/errors';\nimport { DEFAULT_HTTP_TIMEOUT_MS } from '../input/resources';\nimport { generateAction } from './runGenerate';\n\n/** Collects the values of an option given more than once, such as `--header`. */\nexport function collect(value: string, previous: string[] = []): string[] {\n return [...previous, value];\n}\n\n/**\n * Sets up the CLI program with all commands and options.\n *\n * Commander does not exit the process: a usage error (a missing required\n * option, an unknown option or command, a missing argument, no command at\n * all) is thrown as a `CommanderError`, which {@link runCLI} maps to an exit\n * code.\n *\n * @param target - The program to set up; commander's global one by default.\n * Settings made on it before this call, such as `configureOutput`, reach the\n * `generate` command too.\n * @returns The configured commander program instance\n */\nexport function setupCLI(target: Command = program): Command {\n // Before `command()`: a subcommand copies the exit override when it is\n // created.\n target.exitOverride();\n // compat(fetcher): package.json also installs this CLI as `fetcher-generator`, the\n // name existing scripts call; drop that bin alias in v10.\n target\n .name('wow-generator')\n .description('OpenAPI Specification TypeScript code generator for Wow')\n .version(VERSION, '-v, --version');\n\n target\n .command('generate')\n .description('Generate TypeScript code from OpenAPI specification')\n .requiredOption(\n '-i, --input <file>',\n 'Input OpenAPI specification file path or URL (http/https)',\n )\n .option('-o, --output <path>', 'Output directory path', 'src/generated')\n // No commander default: an omitted -c falls back to DEFAULT_CONFIG_PATH,\n // which may be absent, while a path the user named has to exist.\n .option(\n '-c, --config <file>',\n `Configuration file path (default: ${DEFAULT_CONFIG_PATH})`,\n )\n .option(\n '-t, --ts-config-file-path <file>',\n 'TypeScript configuration file path',\n )\n .option(\n '-H, --header <header>',\n 'Request header for an http(s) input or configuration, as \"Name: value\"; repeatable',\n collect,\n )\n .option(\n '--timeout <ms>',\n `Milliseconds before fetching an http(s) input is abandoned (default: ${DEFAULT_HTTP_TIMEOUT_MS})`,\n )\n .option(\n '--schema-docs <mode>',\n 'What model doc comments carry: \"summary\" (title, description, constraints) or \"full\" (also the JSON schema)',\n 'summary',\n )\n .option('--strict', 'Exit with code 4 when the run logs a warning')\n .option('--verbose', 'Log every step, and the stack trace of a failure')\n .option('--quiet', 'Log only warnings and errors')\n .action(generateAction);\n\n return target;\n}\n\n/**\n * The exit code of a command line commander stopped at: 0 for `--help`,\n * `help` and `--version`; {@link EXIT_CODES.input} for a usage error, which\n * commander has already reported. A usage error is an invalid command line,\n * the same category as an invalid option value such as `--timeout abc`.\n */\nexport function commanderExitCode(error: CommanderError): number {\n return error.exitCode === 0 ? EXIT_CODES.success : EXIT_CODES.input;\n}\n\n/**\n * Parses the command line and runs the command it names. The `generate`\n * command sets the process exit code itself; a command line commander stops\n * at sets it to {@link commanderExitCode}.\n *\n * @param args - The arguments after the executable and script;\n * `process.argv` by default\n * @param target - The program to run; {@link setupCLI} on commander's global\n * one by default\n */\nexport async function runCLI(\n args?: readonly string[],\n target: Command = setupCLI(),\n): Promise<void> {\n try {\n if (args === undefined) {\n await target.parseAsync();\n } else {\n await target.parseAsync(args, { from: 'user' });\n }\n } catch (error) {\n if (!(error instanceof CommanderError)) throw error;\n process.exitCode = commanderExitCode(error);\n }\n}\n","#!/usr/bin/env node\n\n/**\n * CLI entry point of wow-generator: runs the program `cli/program.ts` sets\n * up on the process's command line.\n */\n\nimport { runCLI } from './cli/program';\n\nexport { collect, runCLI, setupCLI } from './cli/program';\n\nvoid runCLI();\n"],"mappings":";gKAmBA,IAAac,EAAA,aCmCb,SAAgBC,EAAc,EAAwB,CACpD,GAAI,CAACC,EAAO,MAAO,GACnB,IAAIC,E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AAS,IAAA,GACX,MAAMH,EAAO,WAAW,EAExB,MAAMA,EAAO,WAAWG,EAAM,CAAE,KAAM,MAAO,CAAC,CAElD,OAASlB,EAAO,CACd,GAAI,EAAEA,aAAiBtB,EAAAA,gBAAiB,MAAMsB,EAC9C,QAAQ,SAAWgB,EAAkBhB,CAAK,CAC5C,CACF,CCjHKiB,EAAO"}
package/dist/cli.d.cts ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry point of wow-generator: runs the program `cli/program.ts` sets
4
+ * up on the process's command line.
5
+ */
6
+ export { collect, runCLI, setupCLI } from './cli/program.cjs';
package/dist/cli.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry point of wow-generator: runs the program `cli/program.ts` sets
4
+ * up on the process's command line.
5
+ */
6
+ export { collect, runCLI, setupCLI } from './cli/program.js';