@@ -2,69 +2,71 @@ import type { SemVer } from 'semver';
2
2
import type availableGenerators from './index.mjs' ;
3
3
import type { ApiDocReleaseEntry } from '../types' ;
4
4
5
- // All available generators as an inferable type, to allow Generator interfaces
6
- // to be type complete and runtime friendly within `runGenerators`
7
- export type AvailableGenerators = typeof availableGenerators ;
5
+ declare global {
6
+ // All available generators as an inferable type, to allow Generator interfaces
7
+ // to be type complete and runtime friendly within `runGenerators`
8
+ export type AvailableGenerators = typeof availableGenerators ;
8
9
9
- // This is the runtime config passed to the API doc generators
10
- export interface GeneratorOptions {
11
- // The path used to output generated files, this is to be considered
12
- // the base path that any generator will use for generating files
13
- // This parameter accepts globs but when passed to generators will contain
14
- // the already resolved absolute path to the output folder
15
- output : string ;
10
+ // This is the runtime config passed to the API doc generators
11
+ export interface GeneratorOptions {
12
+ // The path used to output generated files, this is to be considered
13
+ // the base path that any generator will use for generating files
14
+ // This parameter accepts globs but when passed to generators will contain
15
+ // the already resolved absolute path to the output folder
16
+ output : string ;
16
17
17
- // A list of generators to be used in the API doc generation process;
18
- // This is considered a "sorted" list of generators, in the sense that
19
- // if the last entry of this list contains a generated value, we will return
20
- // the value of the last generator in the list, if any.
21
- generators : Array < keyof AvailableGenerators > ;
18
+ // A list of generators to be used in the API doc generation process;
19
+ // This is considered a "sorted" list of generators, in the sense that
20
+ // if the last entry of this list contains a generated value, we will return
21
+ // the value of the last generator in the list, if any.
22
+ generators : Array < keyof AvailableGenerators > ;
22
23
23
- // Target Node.js version for the generation of the API docs
24
- version : SemVer ;
24
+ // Target Node.js version for the generation of the API docs
25
+ version : SemVer ;
25
26
26
- // A list of all Node.js major versions and their respective release information
27
- releases : Array < ApiDocReleaseEntry > ;
28
- }
27
+ // A list of all Node.js major versions and their respective release information
28
+ releases : Array < ApiDocReleaseEntry > ;
29
+ }
29
30
30
- export interface GeneratorMetadata < I extends any , O extends any > {
31
- // The name of the Generator. Must match the Key in the AvailableGenerators
32
- name : keyof AvailableGenerators ;
31
+ export interface GeneratorMetadata < I extends any , O extends any > {
32
+ // The name of the Generator. Must match the Key in the AvailableGenerators
33
+ name : keyof AvailableGenerators ;
33
34
34
- version : string ;
35
+ version : string ;
35
36
36
- description : string ;
37
+ description : string ;
37
38
38
- /**
39
- * The immediate generator that this generator depends on.
40
- * For example, the `html` generator depends on the `react` generator.
41
- *
42
- * If a given generator has no "before" generator, it will be considered a top-level
43
- * generator, and run in parallel.
44
- *
45
- * Assume you pass to the `createGenerator`: ['json', 'html'] as the generators,
46
- * this means both the 'json' and the 'html' generators will be executed and generate their
47
- * own outputs in parallel. If the 'html' generator depends on the 'react' generator, then
48
- * the 'react' generator will be executed first, then the 'html' generator.
49
- *
50
- * But both 'json' and 'html' generators will be executed in parallel.
51
- *
52
- * If you pass `createGenerator` with ['react', 'html'], the 'react' generator will be executed first,
53
- * as it is a top level generator and then the 'html' generator would be executed after the 'react' generator.
54
- *
55
- * The 'ast' generator is the top-level parser, and if 'ast' is passed to `dependsOn`, then the generator
56
- * will be marked as a top-level generator.
57
- */
58
- dependsOn : keyof AvailableGenerators | 'ast' ;
39
+ /**
40
+ * The immediate generator that this generator depends on.
41
+ * For example, the `html` generator depends on the `react` generator.
42
+ *
43
+ * If a given generator has no "before" generator, it will be considered a top-level
44
+ * generator, and run in parallel.
45
+ *
46
+ * Assume you pass to the `createGenerator`: ['json', 'html'] as the generators,
47
+ * this means both the 'json' and the 'html' generators will be executed and generate their
48
+ * own outputs in parallel. If the 'html' generator depends on the 'react' generator, then
49
+ * the 'react' generator will be executed first, then the 'html' generator.
50
+ *
51
+ * But both 'json' and 'html' generators will be executed in parallel.
52
+ *
53
+ * If you pass `createGenerator` with ['react', 'html'], the 'react' generator will be executed first,
54
+ * as it is a top level generator and then the 'html' generator would be executed after the 'react' generator.
55
+ *
56
+ * The 'ast' generator is the top-level parser, and if 'ast' is passed to `dependsOn`, then the generator
57
+ * will be marked as a top-level generator.
58
+ */
59
+ dependsOn : keyof AvailableGenerators | 'ast' ;
59
60
60
- /**
61
- * Generators are abstract and the different generators have different sort of inputs and outputs.
62
- * For example, a MDX generator would take the raw AST and output MDX with React Components;
63
- * Whereas a JSON generator would take the raw AST and output JSON;
64
- * Then a React generator could receive either the raw AST or the MDX output and output React Components.
65
- * (depending if they support such I/O)
66
- *
67
- * Hence you can combine different generators to achieve different outputs.
68
- */
69
- generate : ( input : I , options : Partial < GeneratorOptions > ) => Promise < O > ;
61
+ /**
62
+ * Generators are abstract and the different generators have different sort of inputs and outputs.
63
+ * For example, a MDX generator would take the raw AST and output MDX with React Components;
64
+ * Whereas a JSON generator would take the raw AST and output JSON;
65
+ * Then a React generator could receive either the raw AST or the MDX output and output React Components.
66
+ * (depending if they support such I/O)
67
+ *
68
+ * Hence you can combine different generators to achieve different outputs.
69
+ */
70
+ generate : ( input : I , options : Partial < GeneratorOptions > ) => Promise < O > ;
71
+ }
70
72
}
0 commit comments