@optique/discover 1.2.0-dev.2167 → 1.2.0-dev.2179

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.
@@ -0,0 +1,136 @@
1
+ //#region src/generator.d.ts
2
+ /**
3
+ * A command module file included in generated discovery output.
4
+ *
5
+ * @since 1.2.0
6
+ */
7
+ interface GeneratedCommandModuleFile {
8
+ /**
9
+ * Absolute path to the command module file.
10
+ */
11
+ readonly filePath: string;
12
+ /**
13
+ * Module specifier used by the generated import declaration.
14
+ *
15
+ * Paths containing URL-significant characters use percent-encoded
16
+ * relative specifiers so generated modules stay relocatable.
17
+ */
18
+ readonly importSpecifier: string;
19
+ /**
20
+ * Module map key passed to `commandsFromModules()`.
21
+ */
22
+ readonly modulePath: string;
23
+ /**
24
+ * Namespace import identifier used in the generated module.
25
+ */
26
+ readonly identifier: string;
27
+ }
28
+ /**
29
+ * Options for generating a static command module.
30
+ *
31
+ * @since 1.2.0
32
+ */
33
+ interface GenerateCommandsModuleOptions {
34
+ /**
35
+ * Directory containing command modules.
36
+ */
37
+ readonly dir: string | URL;
38
+ /**
39
+ * Path to the module that will be generated.
40
+ */
41
+ readonly outputFile: string | URL;
42
+ /**
43
+ * Module map base path passed to `commandsFromModules()`.
44
+ *
45
+ * By default, this is the command directory path relative to the generated
46
+ * module's containing directory.
47
+ */
48
+ readonly base?: string;
49
+ /**
50
+ * Module suffixes to include.
51
+ *
52
+ * @default Runtime-aware extension defaults from {@link getDefaultExtensions}
53
+ */
54
+ readonly extensions?: readonly string[];
55
+ /**
56
+ * Entry file name passed to `commandsFromModules()`. Pass `false` to
57
+ * disable entry-file mapping.
58
+ */
59
+ readonly entryFileName?: string | false;
60
+ }
61
+ /**
62
+ * Result of generating a static command module.
63
+ *
64
+ * @since 1.2.0
65
+ */
66
+ interface GeneratedCommandsModule {
67
+ /**
68
+ * Generated TypeScript source code.
69
+ */
70
+ readonly code: string;
71
+ /**
72
+ * Command module files included in the generated module.
73
+ */
74
+ readonly files: readonly GeneratedCommandModuleFile[];
75
+ }
76
+ /**
77
+ * Options for watching and regenerating a static command module.
78
+ *
79
+ * @since 1.2.0
80
+ */
81
+ interface WatchCommandsModuleOptions extends GenerateCommandsModuleOptions {
82
+ /**
83
+ * Polling interval in milliseconds.
84
+ *
85
+ * @default `250`
86
+ */
87
+ readonly intervalMs?: number;
88
+ /**
89
+ * Abort signal used to stop watching.
90
+ */
91
+ readonly signal?: AbortSignal;
92
+ /**
93
+ * Callback invoked after each regeneration.
94
+ */
95
+ readonly onGenerate?: (result: GeneratedCommandsModule) => void;
96
+ /**
97
+ * Callback invoked when generation fails during watching.
98
+ *
99
+ * @since 1.2.0
100
+ */
101
+ readonly onError?: (error: unknown) => void;
102
+ }
103
+ /**
104
+ * Generates a TypeScript module that exports command entries.
105
+ *
106
+ * @param options Generation options.
107
+ * @returns The generated source code and command module metadata.
108
+ * @throws {TypeError} If options are invalid or no command modules are found.
109
+ * @since 1.2.0
110
+ */
111
+ declare function generateCommandsModule(options: GenerateCommandsModuleOptions): Promise<GeneratedCommandsModule>;
112
+ /**
113
+ * Writes a generated command module to disk.
114
+ *
115
+ * @param options Generation options.
116
+ * @returns The generated source code and command module metadata.
117
+ * @throws {TypeError} If options are invalid or no command modules are found.
118
+ * @throws {Error} If the generated module cannot be written.
119
+ * @since 1.2.0
120
+ */
121
+ declare function writeCommandsModule(options: GenerateCommandsModuleOptions): Promise<GeneratedCommandsModule>;
122
+ /**
123
+ * Watches the command file set and rewrites the generated module when it
124
+ * changes.
125
+ *
126
+ * Content-only edits do not trigger regeneration because they do not change
127
+ * the static module map.
128
+ *
129
+ * @param options Watch options.
130
+ * @returns A promise that resolves when the watch signal is aborted.
131
+ * @throws {TypeError} If options are invalid.
132
+ * @since 1.2.0
133
+ */
134
+ declare function watchCommandsModule(options: WatchCommandsModuleOptions): Promise<void>;
135
+ //#endregion
136
+ export { GenerateCommandsModuleOptions, GeneratedCommandModuleFile, GeneratedCommandsModule, WatchCommandsModuleOptions, generateCommandsModule, watchCommandsModule, writeCommandsModule };
@@ -0,0 +1,136 @@
1
+ //#region src/generator.d.ts
2
+ /**
3
+ * A command module file included in generated discovery output.
4
+ *
5
+ * @since 1.2.0
6
+ */
7
+ interface GeneratedCommandModuleFile {
8
+ /**
9
+ * Absolute path to the command module file.
10
+ */
11
+ readonly filePath: string;
12
+ /**
13
+ * Module specifier used by the generated import declaration.
14
+ *
15
+ * Paths containing URL-significant characters use percent-encoded
16
+ * relative specifiers so generated modules stay relocatable.
17
+ */
18
+ readonly importSpecifier: string;
19
+ /**
20
+ * Module map key passed to `commandsFromModules()`.
21
+ */
22
+ readonly modulePath: string;
23
+ /**
24
+ * Namespace import identifier used in the generated module.
25
+ */
26
+ readonly identifier: string;
27
+ }
28
+ /**
29
+ * Options for generating a static command module.
30
+ *
31
+ * @since 1.2.0
32
+ */
33
+ interface GenerateCommandsModuleOptions {
34
+ /**
35
+ * Directory containing command modules.
36
+ */
37
+ readonly dir: string | URL;
38
+ /**
39
+ * Path to the module that will be generated.
40
+ */
41
+ readonly outputFile: string | URL;
42
+ /**
43
+ * Module map base path passed to `commandsFromModules()`.
44
+ *
45
+ * By default, this is the command directory path relative to the generated
46
+ * module's containing directory.
47
+ */
48
+ readonly base?: string;
49
+ /**
50
+ * Module suffixes to include.
51
+ *
52
+ * @default Runtime-aware extension defaults from {@link getDefaultExtensions}
53
+ */
54
+ readonly extensions?: readonly string[];
55
+ /**
56
+ * Entry file name passed to `commandsFromModules()`. Pass `false` to
57
+ * disable entry-file mapping.
58
+ */
59
+ readonly entryFileName?: string | false;
60
+ }
61
+ /**
62
+ * Result of generating a static command module.
63
+ *
64
+ * @since 1.2.0
65
+ */
66
+ interface GeneratedCommandsModule {
67
+ /**
68
+ * Generated TypeScript source code.
69
+ */
70
+ readonly code: string;
71
+ /**
72
+ * Command module files included in the generated module.
73
+ */
74
+ readonly files: readonly GeneratedCommandModuleFile[];
75
+ }
76
+ /**
77
+ * Options for watching and regenerating a static command module.
78
+ *
79
+ * @since 1.2.0
80
+ */
81
+ interface WatchCommandsModuleOptions extends GenerateCommandsModuleOptions {
82
+ /**
83
+ * Polling interval in milliseconds.
84
+ *
85
+ * @default `250`
86
+ */
87
+ readonly intervalMs?: number;
88
+ /**
89
+ * Abort signal used to stop watching.
90
+ */
91
+ readonly signal?: AbortSignal;
92
+ /**
93
+ * Callback invoked after each regeneration.
94
+ */
95
+ readonly onGenerate?: (result: GeneratedCommandsModule) => void;
96
+ /**
97
+ * Callback invoked when generation fails during watching.
98
+ *
99
+ * @since 1.2.0
100
+ */
101
+ readonly onError?: (error: unknown) => void;
102
+ }
103
+ /**
104
+ * Generates a TypeScript module that exports command entries.
105
+ *
106
+ * @param options Generation options.
107
+ * @returns The generated source code and command module metadata.
108
+ * @throws {TypeError} If options are invalid or no command modules are found.
109
+ * @since 1.2.0
110
+ */
111
+ declare function generateCommandsModule(options: GenerateCommandsModuleOptions): Promise<GeneratedCommandsModule>;
112
+ /**
113
+ * Writes a generated command module to disk.
114
+ *
115
+ * @param options Generation options.
116
+ * @returns The generated source code and command module metadata.
117
+ * @throws {TypeError} If options are invalid or no command modules are found.
118
+ * @throws {Error} If the generated module cannot be written.
119
+ * @since 1.2.0
120
+ */
121
+ declare function writeCommandsModule(options: GenerateCommandsModuleOptions): Promise<GeneratedCommandsModule>;
122
+ /**
123
+ * Watches the command file set and rewrites the generated module when it
124
+ * changes.
125
+ *
126
+ * Content-only edits do not trigger regeneration because they do not change
127
+ * the static module map.
128
+ *
129
+ * @param options Watch options.
130
+ * @returns A promise that resolves when the watch signal is aborted.
131
+ * @throws {TypeError} If options are invalid.
132
+ * @since 1.2.0
133
+ */
134
+ declare function watchCommandsModule(options: WatchCommandsModuleOptions): Promise<void>;
135
+ //#endregion
136
+ export { GenerateCommandsModuleOptions, GeneratedCommandModuleFile, GeneratedCommandsModule, WatchCommandsModuleOptions, generateCommandsModule, watchCommandsModule, writeCommandsModule };
@@ -0,0 +1,5 @@
1
+ import "./command-DO5zgkvS.js";
2
+ import "./src-Ci75oZo-.js";
3
+ import { generateCommandsModule, watchCommandsModule, writeCommandsModule } from "./generator-C12pIuFe.js";
4
+
5
+ export { generateCommandsModule, watchCommandsModule, writeCommandsModule };