@ryanatkn/gro 0.162.2 → 0.164.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.
- package/dist/filer.d.ts +10 -4
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +149 -61
- package/dist/gen.d.ts +6 -1
- package/dist/gen.d.ts.map +1 -1
- package/dist/gen.task.d.ts.map +1 -1
- package/dist/gen.task.js +10 -4
- package/dist/gro_plugin_gen.js +2 -2
- package/dist/invoke_task.d.ts.map +1 -1
- package/dist/invoke_task.js +13 -6
- package/dist/package.d.ts.map +1 -1
- package/dist/package.js +14 -13
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +2 -0
- package/dist/run_gen.d.ts +3 -1
- package/dist/run_gen.d.ts.map +1 -1
- package/dist/run_gen.js +5 -2
- package/dist/sveltekit_shim_app_paths.d.ts +2 -1
- package/dist/sveltekit_shim_app_paths.d.ts.map +1 -1
- package/dist/sveltekit_shim_app_paths.js +2 -1
- package/dist/task.d.ts +2 -1
- package/dist/task.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/lib/filer.ts +161 -65
- package/src/lib/gen.task.ts +24 -4
- package/src/lib/gen.ts +7 -1
- package/src/lib/gro_plugin_gen.ts +4 -4
- package/src/lib/invoke_task.ts +13 -5
- package/src/lib/package.ts +14 -13
- package/src/lib/package_json.ts +3 -0
- package/src/lib/run_gen.ts +8 -1
- package/src/lib/sveltekit_shim_app_paths.ts +7 -2
- package/src/lib/task.ts +3 -1
package/dist/filer.d.ts
CHANGED
|
@@ -4,8 +4,7 @@ import type { Package_Json } from '@ryanatkn/belt/package_json.js';
|
|
|
4
4
|
import type { File_Filter, Path_Id } from './path.ts';
|
|
5
5
|
import { watch_dir, type Watcher_Change, type Watch_Dir_Options } from './watch_dir.ts';
|
|
6
6
|
import type { Disknode } from './disknode.ts';
|
|
7
|
-
export type
|
|
8
|
-
export type On_Filer_Change = (change: Watcher_Change, source_file: Disknode) => void;
|
|
7
|
+
export type On_Filer_Change = (change: Watcher_Change, disknode: Disknode) => void;
|
|
9
8
|
export interface Filer_Options {
|
|
10
9
|
watch_dir?: typeof watch_dir;
|
|
11
10
|
watch_dir_options?: Partial<Omit_Strict<Watch_Dir_Options, 'on_change'>>;
|
|
@@ -17,10 +16,17 @@ export declare class Filer {
|
|
|
17
16
|
readonly root_dir: Path_Id;
|
|
18
17
|
readonly files: Map<Path_Id, Disknode>;
|
|
19
18
|
constructor(options?: Filer_Options);
|
|
19
|
+
get inited(): boolean;
|
|
20
20
|
get_by_id: (id: Path_Id) => Disknode | undefined;
|
|
21
21
|
get_or_create: (id: Path_Id) => Disknode;
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Initialize the filer to populate files without watching.
|
|
24
|
+
* Safe to call multiple times - subsequent calls are no-ops.
|
|
25
|
+
* Used by gen files to access the file graph.
|
|
26
|
+
*/
|
|
27
|
+
init(): Promise<void>;
|
|
28
|
+
watch(listener: On_Filer_Change): Promise<() => void>;
|
|
23
29
|
close(): Promise<void>;
|
|
24
30
|
}
|
|
25
|
-
export declare const filter_dependents: (
|
|
31
|
+
export declare const filter_dependents: (disknode: Disknode, get_by_id: (id: Path_Id) => Disknode | undefined, filter?: File_Filter, results?: Set<string>, searched?: Set<string>, log?: Logger) => Set<string>;
|
|
26
32
|
//# sourceMappingURL=filer.d.ts.map
|
package/dist/filer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/filer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/filer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAIzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uB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AO,KAAK,QAAQ,GAAG,SAAS,EAChD,SAAS,WAAW,EACpB,UAAS,GAAG,CAAC,MAAM,CAAa,EAChC,WAAU,GAAG,CAAC,MAAM,CAAa,EACjC,MAAM,MAAM,KACV,GAAG,CAAC,MAAM,CAkBZ,CAAC"}
|
package/dist/filer.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { EMPTY_OBJECT } from '@ryanatkn/belt/object.js';
|
|
2
2
|
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
3
3
|
import { dirname, resolve } from 'node:path';
|
|
4
|
-
import { wait } from '@ryanatkn/belt/async.js';
|
|
5
4
|
import { isBuiltin } from 'node:module';
|
|
6
5
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
6
|
import { Unreachable_Error } from '@ryanatkn/belt/error.js';
|
|
@@ -15,10 +14,15 @@ import { SVELTEKIT_GLOBAL_SPECIFIER } from "./constants.js";
|
|
|
15
14
|
const aliases = Object.entries(default_svelte_config.alias);
|
|
16
15
|
export class Filer {
|
|
17
16
|
root_dir;
|
|
17
|
+
// TODO rename everything to `disknode`
|
|
18
18
|
files = new Map();
|
|
19
19
|
#watch_dir;
|
|
20
20
|
#watch_dir_options;
|
|
21
21
|
#log;
|
|
22
|
+
#listeners = new Set();
|
|
23
|
+
#watching;
|
|
24
|
+
#initing;
|
|
25
|
+
#closing;
|
|
22
26
|
constructor(options = EMPTY_OBJECT) {
|
|
23
27
|
this.#watch_dir = options.watch_dir ?? watch_dir;
|
|
24
28
|
this.#watch_dir_options = options.watch_dir_options ?? EMPTY_OBJECT;
|
|
@@ -29,9 +33,9 @@ export class Filer {
|
|
|
29
33
|
// package.json/gro.config.ts/tsconfig.json/svelte.config.js/vite.config.ts to invalidate everything
|
|
30
34
|
this.#log = options.log;
|
|
31
35
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
get inited() {
|
|
37
|
+
return this.#watching !== undefined;
|
|
38
|
+
}
|
|
35
39
|
get_by_id = (id) => {
|
|
36
40
|
return this.files.get(id);
|
|
37
41
|
};
|
|
@@ -55,6 +59,111 @@ export class Filer {
|
|
|
55
59
|
}
|
|
56
60
|
return file;
|
|
57
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Initialize the filer to populate files without watching.
|
|
64
|
+
* Safe to call multiple times - subsequent calls are no-ops.
|
|
65
|
+
* Used by gen files to access the file graph.
|
|
66
|
+
*/
|
|
67
|
+
async init() {
|
|
68
|
+
// if already initing, return the existing promise
|
|
69
|
+
if (this.#initing)
|
|
70
|
+
return this.#initing;
|
|
71
|
+
// if already initialized, just ensure ready
|
|
72
|
+
if (this.#watching) {
|
|
73
|
+
return this.#watching.init();
|
|
74
|
+
}
|
|
75
|
+
// start new initialization
|
|
76
|
+
this.#initing = this.#init();
|
|
77
|
+
try {
|
|
78
|
+
await this.#initing;
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
// use shared cleanup logic
|
|
82
|
+
this.#cleanup();
|
|
83
|
+
throw err;
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
this.#initing = undefined;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async #init() {
|
|
90
|
+
const watcher = this.#watch_dir({
|
|
91
|
+
...this.#watch_dir_options,
|
|
92
|
+
dir: this.root_dir,
|
|
93
|
+
on_change: this.#on_change,
|
|
94
|
+
});
|
|
95
|
+
try {
|
|
96
|
+
await watcher.init();
|
|
97
|
+
// check if close() was called during init
|
|
98
|
+
if (this.#closing) {
|
|
99
|
+
await watcher.close();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
// only set after successful init and not closing
|
|
103
|
+
this.#watching = watcher;
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
// clean up watcher on error, but don't let close error mask init error
|
|
107
|
+
try {
|
|
108
|
+
await watcher.close();
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// ignore close errors - init error is more important
|
|
112
|
+
}
|
|
113
|
+
throw err;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async watch(listener) {
|
|
117
|
+
await this.#add_listener(listener);
|
|
118
|
+
return () => {
|
|
119
|
+
this.#remove_listener(listener);
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Internal cleanup of all state - can be called safely from anywhere
|
|
124
|
+
*/
|
|
125
|
+
#cleanup() {
|
|
126
|
+
this.#listeners.clear();
|
|
127
|
+
this.files.clear();
|
|
128
|
+
this.#watching = undefined;
|
|
129
|
+
// #initing is handled in finally block of init()
|
|
130
|
+
}
|
|
131
|
+
close() {
|
|
132
|
+
// if already closing, return existing promise
|
|
133
|
+
if (this.#closing)
|
|
134
|
+
return this.#closing;
|
|
135
|
+
// if already closed and not initing, nothing to do
|
|
136
|
+
if (!this.#watching && !this.#initing)
|
|
137
|
+
return Promise.resolve();
|
|
138
|
+
// start new close operation
|
|
139
|
+
const closing = this.#close();
|
|
140
|
+
this.#closing = closing;
|
|
141
|
+
// Clean up after completion, but don't change the returned promise
|
|
142
|
+
// Use void to ensure we don't accidentally return the .then() promise
|
|
143
|
+
void closing.then(() => {
|
|
144
|
+
this.#closing = undefined;
|
|
145
|
+
}, () => {
|
|
146
|
+
this.#closing = undefined;
|
|
147
|
+
});
|
|
148
|
+
return this.#closing;
|
|
149
|
+
}
|
|
150
|
+
async #close() {
|
|
151
|
+
// wait for any pending initialization to complete
|
|
152
|
+
if (this.#initing) {
|
|
153
|
+
try {
|
|
154
|
+
await this.#initing;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
// ignore errors during close
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// close watcher if it exists
|
|
161
|
+
if (this.#watching) {
|
|
162
|
+
await this.#watching.close();
|
|
163
|
+
}
|
|
164
|
+
// clean up all state
|
|
165
|
+
this.#cleanup();
|
|
166
|
+
}
|
|
58
167
|
#update(id) {
|
|
59
168
|
const file = this.get_or_create(id);
|
|
60
169
|
const stats = existsSync(id) ? statSync(id) : null;
|
|
@@ -112,96 +221,75 @@ export class Filer {
|
|
|
112
221
|
if (!file)
|
|
113
222
|
return null; // this is safe because the object would exist if any other file referenced it as a dependency or dependent
|
|
114
223
|
file.contents = null; // clear contents in case it gets re-added later, we want the change to be detected
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
found = true;
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (!found)
|
|
224
|
+
file.dependencies.clear();
|
|
225
|
+
// keep the file in memory if other files still depend on it
|
|
226
|
+
if (file.dependents.size === 0) {
|
|
123
227
|
this.files.delete(id);
|
|
228
|
+
}
|
|
124
229
|
return file;
|
|
125
230
|
}
|
|
126
231
|
#sync_listener_with_files(listener) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
232
|
+
for (const disknode of this.files.values()) {
|
|
233
|
+
try {
|
|
234
|
+
listener({ type: 'add', path: disknode.id, is_directory: false }, disknode);
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
this.#log?.error('[filer] Listener error during sync:', err);
|
|
238
|
+
}
|
|
131
239
|
}
|
|
132
240
|
}
|
|
133
|
-
#notify_change(change,
|
|
134
|
-
if (!this.#ready)
|
|
135
|
-
return;
|
|
241
|
+
#notify_change(change, disknode) {
|
|
136
242
|
for (const listener of this.#listeners) {
|
|
137
|
-
|
|
243
|
+
try {
|
|
244
|
+
listener(change, disknode);
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
this.#log?.error('[filer] Listener error during change notification:', err);
|
|
248
|
+
}
|
|
138
249
|
}
|
|
139
250
|
}
|
|
140
251
|
async #add_listener(listener) {
|
|
141
252
|
this.#listeners.add(listener);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
await wait(); // wait a tick to ensure the `this.#ready` value is updated below first
|
|
146
|
-
this.#sync_listener_with_files(listener);
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
this.#watching = this.#watch_dir({
|
|
150
|
-
...this.#watch_dir_options,
|
|
151
|
-
dir: this.root_dir,
|
|
152
|
-
on_change: this.#on_change,
|
|
153
|
-
});
|
|
154
|
-
await this.#watching.init();
|
|
155
|
-
this.#ready = true;
|
|
253
|
+
// ensure initialized
|
|
254
|
+
await this.init();
|
|
255
|
+
// notify of existing files
|
|
156
256
|
this.#sync_listener_with_files(listener);
|
|
157
257
|
}
|
|
158
|
-
|
|
258
|
+
#remove_listener(listener) {
|
|
159
259
|
this.#listeners.delete(listener);
|
|
160
|
-
|
|
161
|
-
await this.close(); // TODO is this right? should `watch` be async?
|
|
162
|
-
}
|
|
260
|
+
// keep watching active even with no listeners, only close() tears down
|
|
163
261
|
}
|
|
164
262
|
#on_change = (change) => {
|
|
263
|
+
if (this.#closing)
|
|
264
|
+
return; // ignore changes during close
|
|
165
265
|
if (change.is_directory)
|
|
166
266
|
return; // TODO manage directories?
|
|
167
|
-
let
|
|
267
|
+
let disknode;
|
|
168
268
|
switch (change.type) {
|
|
169
269
|
case 'add':
|
|
170
270
|
case 'update': {
|
|
171
|
-
|
|
271
|
+
disknode = this.#update(change.path);
|
|
172
272
|
break;
|
|
173
273
|
}
|
|
174
274
|
case 'delete': {
|
|
175
|
-
|
|
275
|
+
disknode = this.#remove(change.path);
|
|
176
276
|
break;
|
|
177
277
|
}
|
|
178
278
|
default:
|
|
179
279
|
throw new Unreachable_Error(change.type);
|
|
180
280
|
}
|
|
181
|
-
if (
|
|
182
|
-
this.#notify_change(change,
|
|
281
|
+
if (disknode && this.#listeners.size > 0) {
|
|
282
|
+
this.#notify_change(change, disknode);
|
|
183
283
|
}
|
|
184
284
|
};
|
|
185
|
-
async watch(listener) {
|
|
186
|
-
await this.#add_listener(listener);
|
|
187
|
-
return () => this.#remove_listener(listener);
|
|
188
|
-
}
|
|
189
|
-
async close() {
|
|
190
|
-
this.#ready = false;
|
|
191
|
-
this.#listeners.clear();
|
|
192
|
-
if (this.#watching) {
|
|
193
|
-
await this.#watching.close();
|
|
194
|
-
this.#watching = undefined;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
285
|
#is_external(id) {
|
|
198
286
|
const { filter } = this.#watch_dir_options;
|
|
199
287
|
return !id.startsWith(this.root_dir + '/') || (!!filter && !filter(id, false));
|
|
200
288
|
}
|
|
201
289
|
}
|
|
202
290
|
// TODO maybe `Disknode` class?
|
|
203
|
-
export const filter_dependents = (
|
|
204
|
-
const { dependents } =
|
|
291
|
+
export const filter_dependents = (disknode, get_by_id, filter, results = new Set(), searched = new Set(), log) => {
|
|
292
|
+
const { dependents } = disknode;
|
|
205
293
|
for (const dependent_id of dependents.keys()) {
|
|
206
294
|
if (searched.has(dependent_id))
|
|
207
295
|
continue;
|
|
@@ -209,12 +297,12 @@ export const filter_dependents = (source_file, get_by_id, filter, results = new
|
|
|
209
297
|
if (!filter || filter(dependent_id)) {
|
|
210
298
|
results.add(dependent_id);
|
|
211
299
|
}
|
|
212
|
-
const
|
|
213
|
-
if (!
|
|
214
|
-
log?.warn(`[filer.filter_dependents] dependent source file ${dependent_id} not found for ${
|
|
300
|
+
const dependent_disknode = get_by_id(dependent_id);
|
|
301
|
+
if (!dependent_disknode) {
|
|
302
|
+
log?.warn(`[filer.filter_dependents] dependent source file ${dependent_id} not found for ${disknode.id}`);
|
|
215
303
|
continue;
|
|
216
304
|
}
|
|
217
|
-
filter_dependents(
|
|
305
|
+
filter_dependents(dependent_disknode, get_by_id, filter, results, searched);
|
|
218
306
|
}
|
|
219
307
|
return results;
|
|
220
308
|
};
|
package/dist/gen.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ import type { Gro_Config } from './gro_config.ts';
|
|
|
6
6
|
import type { Parsed_Svelte_Config } from './svelte_config.ts';
|
|
7
7
|
import { type Load_Modules_Failure, type Module_Meta } from './modules.ts';
|
|
8
8
|
import { Input_Path, type Resolved_Input_File, type Resolved_Input_Path } from './input_path.ts';
|
|
9
|
+
import type { Filer } from './filer.ts';
|
|
10
|
+
import type { Invoke_Task } from './task.ts';
|
|
9
11
|
export declare const GEN_FILE_PATTERN_TEXT = "gen";
|
|
10
12
|
export declare const GEN_FILE_PATTERN: string;
|
|
11
13
|
export declare const is_gen_path: (path: string) => boolean;
|
|
@@ -23,6 +25,10 @@ export type Gen = (ctx: Gen_Context) => Raw_Gen_Result | Promise<Raw_Gen_Result>
|
|
|
23
25
|
export interface Gen_Context {
|
|
24
26
|
config: Gro_Config;
|
|
25
27
|
svelte_config: Parsed_Svelte_Config;
|
|
28
|
+
filer: Filer;
|
|
29
|
+
log: Logger;
|
|
30
|
+
timings: Timings;
|
|
31
|
+
invoke_task: Invoke_Task;
|
|
26
32
|
/**
|
|
27
33
|
* Same as `import.meta.url` but in path form.
|
|
28
34
|
*/
|
|
@@ -31,7 +37,6 @@ export interface Gen_Context {
|
|
|
31
37
|
* The `origin_id` relative to the root dir.
|
|
32
38
|
*/
|
|
33
39
|
origin_path: string;
|
|
34
|
-
log: Logger;
|
|
35
40
|
}
|
|
36
41
|
export type Raw_Gen_Result = string | Raw_Gen_File | null | Array<Raw_Gen_Result>;
|
|
37
42
|
export interface Raw_Gen_File {
|
package/dist/gen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAGlD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AAKvD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAC7D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AEF,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,GAAG,IAAI,cACxC,CAAC"}
|
package/dist/gen.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gen.task.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAgBhD,eAAO,MAAM,IAAI;;;;kBAaf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"gen.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gen.task.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAgBhD,eAAO,MAAM,IAAI;;;;kBAaf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAqH3B,CAAC"}
|
package/dist/gen.task.js
CHANGED
|
@@ -24,12 +24,10 @@ export const Args = z.strictObject({
|
|
|
24
24
|
.meta({ description: 'exit with a nonzero code if any files need to be generated' })
|
|
25
25
|
.default(false),
|
|
26
26
|
});
|
|
27
|
-
// TODO test - especially making sure nothing gets genned
|
|
28
|
-
// if there's any validation or import errors
|
|
29
27
|
export const task = {
|
|
30
28
|
summary: 'run code generation scripts',
|
|
31
29
|
Args,
|
|
32
|
-
run: async ({ args, log, timings, config }) => {
|
|
30
|
+
run: async ({ args, filer, log, timings, config, invoke_task }) => {
|
|
33
31
|
const { _: raw_input_paths, root_dirs, check } = args;
|
|
34
32
|
const input_paths = to_input_paths(raw_input_paths);
|
|
35
33
|
// load all of the gen modules
|
|
@@ -55,7 +53,7 @@ export const task = {
|
|
|
55
53
|
const loaded_genfiles = loaded.value;
|
|
56
54
|
// run `gen` on each of the modules
|
|
57
55
|
const timing_to_generate_code = timings.start('generate code'); // TODO this ignores `gen_results.elapsed` - should it return `Timings` instead?
|
|
58
|
-
const gen_results = await run_gen(loaded_genfiles.modules, config, log, timings, format_file);
|
|
56
|
+
const gen_results = await run_gen(loaded_genfiles.modules, config, filer, log, timings, invoke_task, format_file);
|
|
59
57
|
timing_to_generate_code();
|
|
60
58
|
const fail_count = gen_results.failures.length;
|
|
61
59
|
const analyzed_gen_results = await analyze_gen_results(gen_results);
|
|
@@ -72,6 +70,14 @@ export const task = {
|
|
|
72
70
|
continue;
|
|
73
71
|
has_unexpected_changes = true;
|
|
74
72
|
log.error(st('red', `Generated file ${print_path(analyzed.file.id)} via ${print_path(analyzed.file.origin_id)} ${analyzed.is_new ? 'is new' : 'has changed'}.`));
|
|
73
|
+
// DEBUG HACK: Show current vs changed content
|
|
74
|
+
if (!analyzed.is_new) {
|
|
75
|
+
log.info(`\n=== CURRENT CONTENT (${print_path(analyzed.file.id)}) ===\n${analyzed.existing_content}\n=== END CURRENT ===`);
|
|
76
|
+
log.info(`\n=== CHANGED CONTENT (${print_path(analyzed.file.id)}) ===\n${analyzed.file.content}\n=== END CHANGED ===`);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
log.info(`\n=== NEW FILE CONTENT (${print_path(analyzed.file.id)}) ===\n${analyzed.file.content}\n=== END NEW ===`);
|
|
80
|
+
}
|
|
75
81
|
}
|
|
76
82
|
if (has_unexpected_changes) {
|
|
77
83
|
throw new Task_Error('Failed gen check. Some generated files have unexpectedly changed.' +
|
package/dist/gro_plugin_gen.js
CHANGED
|
@@ -72,9 +72,9 @@ export const gro_plugin_gen = ({ input_paths = [paths.source], root_dirs = [path
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
},
|
|
75
|
-
teardown:
|
|
75
|
+
teardown: () => {
|
|
76
76
|
if (cleanup_watch) {
|
|
77
|
-
|
|
77
|
+
cleanup_watch();
|
|
78
78
|
cleanup_watch = undefined;
|
|
79
79
|
}
|
|
80
80
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke_task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/invoke_task.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,OAAO,EAAC,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAoB,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAgB,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAI9D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GACvB,WAAW,cAAc,EACzB,MAAM,IAAI,GAAG,SAAS,EACtB,QAAQ,UAAU,EAClB,gBAAgB,KAAK,EACrB,kBAAkB,OAAO,GAAG,IAAI,KAC9B,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"invoke_task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/invoke_task.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,OAAO,EAAC,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EAAoB,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAgB,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAI9D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GACvB,WAAW,cAAc,EACzB,MAAM,IAAI,GAAG,SAAS,EACtB,QAAQ,UAAU,EAClB,gBAAgB,KAAK,EACrB,kBAAkB,OAAO,GAAG,IAAI,KAC9B,OAAO,CAAC,IAAI,CAwFd,CAAC"}
|
package/dist/invoke_task.js
CHANGED
|
@@ -34,12 +34,19 @@ import { Filer } from "./filer.js";
|
|
|
34
34
|
export const invoke_task = async (task_name, args, config, initial_filer, initial_timings) => {
|
|
35
35
|
const log = new System_Logger(print_log_label(task_name || 'gro'));
|
|
36
36
|
log.info('invoking', task_name ? st('cyan', task_name) : 'gro');
|
|
37
|
+
// track if we created the filer
|
|
38
|
+
const owns_filer = !initial_filer;
|
|
37
39
|
const filer = initial_filer ?? new Filer({ log });
|
|
40
|
+
const owns_timings = !initial_timings;
|
|
38
41
|
const timings = initial_timings ?? new Timings();
|
|
39
42
|
const total_timing = create_stopwatch();
|
|
40
|
-
const finish = () => {
|
|
41
|
-
if
|
|
42
|
-
|
|
43
|
+
const finish = async () => {
|
|
44
|
+
// cleanup filer only if we created it and it was initialized
|
|
45
|
+
if (owns_filer && filer.inited) {
|
|
46
|
+
await filer.close();
|
|
47
|
+
}
|
|
48
|
+
if (owns_timings)
|
|
49
|
+
return; // kinda weird, print timings only for the top-level task
|
|
43
50
|
print_timings(timings, log);
|
|
44
51
|
log.info(`🕒 ${print_ms(total_timing())}`);
|
|
45
52
|
};
|
|
@@ -47,7 +54,7 @@ export const invoke_task = async (task_name, args, config, initial_filer, initia
|
|
|
47
54
|
if (!task_name && (args?.version || args?.v)) {
|
|
48
55
|
const gro_package_json = load_gro_package_json();
|
|
49
56
|
log.info(`${st('gray', 'v')}${st('cyan', gro_package_json.version)}`);
|
|
50
|
-
finish();
|
|
57
|
+
await finish();
|
|
51
58
|
return;
|
|
52
59
|
}
|
|
53
60
|
// Resolve the input path for the provided task name.
|
|
@@ -73,7 +80,7 @@ export const invoke_task = async (task_name, args, config, initial_filer, initia
|
|
|
73
80
|
if (resolved_input_files.length > 1 || resolved_input_files[0].resolved_input_path.is_directory) {
|
|
74
81
|
// The input path matches a directory. Log the tasks but don't run them.
|
|
75
82
|
log_tasks(log, loaded_tasks);
|
|
76
|
-
finish();
|
|
83
|
+
await finish();
|
|
77
84
|
return;
|
|
78
85
|
}
|
|
79
86
|
// The input path matches a file that's presumable a task, so load and run it.
|
|
@@ -90,5 +97,5 @@ export const invoke_task = async (task_name, args, config, initial_filer, initia
|
|
|
90
97
|
throw result.error;
|
|
91
98
|
}
|
|
92
99
|
log.info(`✓ ${st('cyan', task.name)}`);
|
|
93
|
-
finish();
|
|
100
|
+
await finish();
|
|
94
101
|
};
|
package/dist/package.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,4BAA4B,CAAC;AAEzD,eAAO,MAAM,YAAY,EAAE,YAyQnB,CAAC;AAET,eAAO,MAAM,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,4BAA4B,CAAC;AAEzD,eAAO,MAAM,YAAY,EAAE,YAyQnB,CAAC;AAET,eAAO,MAAM,QAAQ,EAAE,QAuwBf,CAAC"}
|
package/dist/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// generated by src/lib/package.gen.ts
|
|
2
2
|
export const package_json = {
|
|
3
3
|
name: '@ryanatkn/gro',
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.164.0',
|
|
5
5
|
description: 'task runner and toolkit extending SvelteKit',
|
|
6
6
|
motto: 'generate, run, optimize',
|
|
7
7
|
glyph: '🌰',
|
|
@@ -41,15 +41,15 @@ export const package_json = {
|
|
|
41
41
|
dependencies: {
|
|
42
42
|
'@ryanatkn/belt': '^0.34.1',
|
|
43
43
|
chokidar: '^4.0.3',
|
|
44
|
-
dotenv: '^17.2.
|
|
44
|
+
dotenv: '^17.2.2',
|
|
45
45
|
'esm-env': '^1.2.2',
|
|
46
46
|
mri: '^1.2.0',
|
|
47
|
-
'oxc-parser': '^0.
|
|
47
|
+
'oxc-parser': '^0.87.0',
|
|
48
48
|
prettier: '^3.6.2',
|
|
49
49
|
'prettier-plugin-svelte': '^3.4.0',
|
|
50
50
|
'ts-blank-space': '^0.6.2',
|
|
51
51
|
tslib: '^2.8.1',
|
|
52
|
-
zod: '^4.1.
|
|
52
|
+
zod: '^4.1.5',
|
|
53
53
|
},
|
|
54
54
|
peerDependencies: {
|
|
55
55
|
'@sveltejs/kit': '^2',
|
|
@@ -67,17 +67,17 @@ export const package_json = {
|
|
|
67
67
|
'@ryanatkn/fuz': '^0.145.0',
|
|
68
68
|
'@ryanatkn/moss': '^0.32.0',
|
|
69
69
|
'@sveltejs/adapter-static': '^3.0.9',
|
|
70
|
-
'@sveltejs/kit': '^2.
|
|
70
|
+
'@sveltejs/kit': '^2.37.1',
|
|
71
71
|
'@sveltejs/package': '^2.5.0',
|
|
72
|
-
'@sveltejs/vite-plugin-svelte': '^6.1.
|
|
73
|
-
'@types/node': '^24.3.
|
|
72
|
+
'@sveltejs/vite-plugin-svelte': '^6.1.4',
|
|
73
|
+
'@types/node': '^24.3.1',
|
|
74
74
|
esbuild: '^0.25.9',
|
|
75
|
-
eslint: '^9.
|
|
76
|
-
'eslint-plugin-svelte': '^3.
|
|
77
|
-
svelte: '^5.38.
|
|
75
|
+
eslint: '^9.35.0',
|
|
76
|
+
'eslint-plugin-svelte': '^3.12.2',
|
|
77
|
+
svelte: '^5.38.7',
|
|
78
78
|
'svelte-check': '^4.3.1',
|
|
79
79
|
typescript: '^5.9.2',
|
|
80
|
-
'typescript-eslint': '^8.
|
|
80
|
+
'typescript-eslint': '^8.42.0',
|
|
81
81
|
vitest: '^3.2.4',
|
|
82
82
|
},
|
|
83
83
|
prettier: {
|
|
@@ -266,7 +266,7 @@ export const package_json = {
|
|
|
266
266
|
};
|
|
267
267
|
export const src_json = {
|
|
268
268
|
name: '@ryanatkn/gro',
|
|
269
|
-
version: '0.
|
|
269
|
+
version: '0.164.0',
|
|
270
270
|
modules: {
|
|
271
271
|
'.': {
|
|
272
272
|
path: 'index.ts',
|
|
@@ -489,7 +489,6 @@ export const src_json = {
|
|
|
489
489
|
'./filer.js': {
|
|
490
490
|
path: 'filer.ts',
|
|
491
491
|
declarations: [
|
|
492
|
-
{ name: 'Cleanup_Watch', kind: 'type' },
|
|
493
492
|
{ name: 'On_Filer_Change', kind: 'type' },
|
|
494
493
|
{ name: 'Filer_Options', kind: 'type' },
|
|
495
494
|
{ name: 'Filer', kind: 'class' },
|
|
@@ -930,6 +929,7 @@ export const src_json = {
|
|
|
930
929
|
{ name: 'base', kind: 'variable' },
|
|
931
930
|
{ name: 'resolve', kind: 'function' },
|
|
932
931
|
{ name: 'resolveRoute', kind: 'function' },
|
|
932
|
+
{ name: 'asset', kind: 'function' },
|
|
933
933
|
],
|
|
934
934
|
},
|
|
935
935
|
'./sveltekit_shim_app_state.js': {
|
|
@@ -974,6 +974,7 @@ export const src_json = {
|
|
|
974
974
|
declarations: [
|
|
975
975
|
{ name: 'Task', kind: 'type' },
|
|
976
976
|
{ name: 'Task_Context', kind: 'type' },
|
|
977
|
+
{ name: 'Invoke_Task', kind: 'type' },
|
|
977
978
|
{ name: 'TASK_FILE_SUFFIX_TS', kind: 'variable' },
|
|
978
979
|
{ name: 'TASK_FILE_SUFFIX_JS', kind: 'variable' },
|
|
979
980
|
{ name: 'TASK_FILE_SUFFIXES', kind: 'variable' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package_json.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package_json.ts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AC1B,cAAc,YAAY,KACxB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG,SAgBlC,CAAC;AA8BF,eAAO,MAAM,OAAO,GACnB,UAAU,MAAM,EAChB,eAAc,YAAkC,KAC9C,OAGyC,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,YAAY,GAAI,cAAc,YAAY,KAAG,KAAK,CAAC,gBAAgB,CAe/E,CAAC"}
|
package/dist/package_json.js
CHANGED
|
@@ -76,6 +76,8 @@ export const update_package_json = async (update, dir = paths.root, write = true
|
|
|
76
76
|
return { package_json: updated, changed: true };
|
|
77
77
|
};
|
|
78
78
|
const is_index = (path) => path === 'index.ts' || path === 'index.js';
|
|
79
|
+
// TODO support subpath patterns as the main concise way to do things
|
|
80
|
+
// https://nodejs.org/api/packages.html#subpath-patterns
|
|
79
81
|
export const to_package_exports = (paths) => {
|
|
80
82
|
const sorted = paths
|
|
81
83
|
.slice()
|
package/dist/run_gen.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { Logger } from '@ryanatkn/belt/log.js';
|
|
|
3
3
|
import { type Gen_Results, type Genfile_Module_Meta } from './gen.ts';
|
|
4
4
|
import type { format_file as base_format_file } from './format_file.ts';
|
|
5
5
|
import type { Gro_Config } from './gro_config.ts';
|
|
6
|
+
import type { Filer } from './filer.ts';
|
|
7
|
+
import type { Invoke_Task } from './task.ts';
|
|
6
8
|
export declare const GEN_NO_PROD_MESSAGE = "gen runs only during development";
|
|
7
|
-
export declare const run_gen: (gen_modules: Array<Genfile_Module_Meta>, config: Gro_Config, log: Logger, timings: Timings, format_file?: typeof base_format_file) => Promise<Gen_Results>;
|
|
9
|
+
export declare const run_gen: (gen_modules: Array<Genfile_Module_Meta>, config: Gro_Config, filer: Filer, log: Logger, timings: Timings, invoke_task: Invoke_Task, format_file?: typeof base_format_file) => Promise<Gen_Results>;
|
|
8
10
|
//# sourceMappingURL=run_gen.d.ts.map
|
package/dist/run_gen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run_gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,EACN,KAAK,WAAW,EAGhB,KAAK,mBAAmB,EAGxB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,WAAW,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"run_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run_gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,EACN,KAAK,WAAW,EAGhB,KAAK,mBAAmB,EAGxB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,WAAW,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAE3C,eAAO,MAAM,mBAAmB,qCAAqC,CAAC;AAEtE,eAAO,MAAM,OAAO,GACnB,aAAa,KAAK,CAAC,mBAAmB,CAAC,EACvC,QAAQ,UAAU,EAClB,OAAO,KAAK,EACZ,KAAK,MAAM,EACX,SAAS,OAAO,EAChB,aAAa,WAAW,EACxB,cAAc,OAAO,gBAAgB,KACnC,OAAO,CAAC,WAAW,CAwErB,CAAC"}
|
package/dist/run_gen.js
CHANGED
|
@@ -4,7 +4,7 @@ import { to_gen_result, } from "./gen.js";
|
|
|
4
4
|
import { print_path, to_root_path } from "./paths.js";
|
|
5
5
|
import { default_svelte_config } from "./svelte_config.js";
|
|
6
6
|
export const GEN_NO_PROD_MESSAGE = 'gen runs only during development';
|
|
7
|
-
export const run_gen = async (gen_modules, config, log, timings, format_file) => {
|
|
7
|
+
export const run_gen = async (gen_modules, config, filer, log, timings, invoke_task, format_file) => {
|
|
8
8
|
let input_count = 0;
|
|
9
9
|
let output_count = 0;
|
|
10
10
|
const timing_for_run_gen = timings.start('run_gen');
|
|
@@ -16,9 +16,12 @@ export const run_gen = async (gen_modules, config, log, timings, format_file) =>
|
|
|
16
16
|
const gen_ctx = {
|
|
17
17
|
config,
|
|
18
18
|
svelte_config: default_svelte_config,
|
|
19
|
+
filer,
|
|
20
|
+
log,
|
|
21
|
+
timings,
|
|
22
|
+
invoke_task,
|
|
19
23
|
origin_id: id,
|
|
20
24
|
origin_path: to_root_path(id),
|
|
21
|
-
log,
|
|
22
25
|
};
|
|
23
26
|
let raw_gen_result;
|
|
24
27
|
try {
|