@ryanatkn/gro 0.147.1 → 0.148.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 (82) hide show
  1. package/README.md +3 -1
  2. package/dist/args.d.ts +5 -5
  3. package/dist/args.d.ts.map +1 -1
  4. package/dist/changelog.d.ts +2 -1
  5. package/dist/changelog.d.ts.map +1 -1
  6. package/dist/cli.d.ts +4 -3
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/esbuild_plugin_external_worker.d.ts +2 -2
  9. package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
  10. package/dist/esbuild_plugin_svelte.d.ts +1 -1
  11. package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
  12. package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +1 -1
  13. package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
  14. package/dist/gen.d.ts +23 -22
  15. package/dist/gen.d.ts.map +1 -1
  16. package/dist/github.d.ts +3 -1
  17. package/dist/github.d.ts.map +1 -1
  18. package/dist/gro_config.d.ts +5 -5
  19. package/dist/gro_config.d.ts.map +1 -1
  20. package/dist/gro_helpers.d.ts +1 -1
  21. package/dist/gro_helpers.d.ts.map +1 -1
  22. package/dist/gro_plugin_gen.d.ts +2 -2
  23. package/dist/gro_plugin_gen.d.ts.map +1 -1
  24. package/dist/gro_plugin_moss.d.ts +1 -1
  25. package/dist/gro_plugin_moss.d.ts.map +1 -1
  26. package/dist/gro_plugin_server.d.ts +2 -2
  27. package/dist/gro_plugin_server.d.ts.map +1 -1
  28. package/dist/input_path.d.ts +10 -10
  29. package/dist/input_path.d.ts.map +1 -1
  30. package/dist/invoke.js +2 -0
  31. package/dist/modules.d.ts +6 -5
  32. package/dist/modules.d.ts.map +1 -1
  33. package/dist/package.d.ts +0 -1
  34. package/dist/package.d.ts.map +1 -1
  35. package/dist/package.js +16 -17
  36. package/dist/package_json.d.ts +2 -2
  37. package/dist/package_json.d.ts.map +1 -1
  38. package/dist/parse_imports.d.ts +1 -1
  39. package/dist/parse_imports.d.ts.map +1 -1
  40. package/dist/plugin.d.ts +2 -2
  41. package/dist/plugin.d.ts.map +1 -1
  42. package/dist/run_gen.d.ts +1 -1
  43. package/dist/run_gen.d.ts.map +1 -1
  44. package/dist/search_fs.d.ts +3 -3
  45. package/dist/search_fs.d.ts.map +1 -1
  46. package/dist/sveltekit_config.d.ts +1 -1
  47. package/dist/sveltekit_config.d.ts.map +1 -1
  48. package/dist/sveltekit_shim_env.d.ts +1 -1
  49. package/dist/sveltekit_shim_env.d.ts.map +1 -1
  50. package/dist/task.d.ts +19 -19
  51. package/dist/task.d.ts.map +1 -1
  52. package/dist/task_logging.d.ts +1 -1
  53. package/dist/task_logging.d.ts.map +1 -1
  54. package/package.json +15 -16
  55. package/src/lib/args.ts +10 -10
  56. package/src/lib/cli.ts +3 -3
  57. package/src/lib/esbuild_plugin_external_worker.ts +2 -2
  58. package/src/lib/esbuild_plugin_svelte.ts +1 -1
  59. package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +1 -1
  60. package/src/lib/gen.ts +28 -26
  61. package/src/lib/github.ts +2 -2
  62. package/src/lib/gro_config.ts +5 -5
  63. package/src/lib/gro_helpers.ts +1 -1
  64. package/src/lib/gro_plugin_gen.ts +3 -3
  65. package/src/lib/gro_plugin_moss.ts +1 -1
  66. package/src/lib/gro_plugin_server.ts +2 -2
  67. package/src/lib/gro_plugin_sveltekit_app.ts +1 -1
  68. package/src/lib/input_path.ts +23 -23
  69. package/src/lib/invoke.ts +2 -0
  70. package/src/lib/modules.ts +8 -8
  71. package/src/lib/package.ts +16 -17
  72. package/src/lib/package_json.ts +2 -2
  73. package/src/lib/parse_imports.ts +2 -2
  74. package/src/lib/plugin.ts +4 -4
  75. package/src/lib/run_gen.ts +1 -1
  76. package/src/lib/search_fs.ts +8 -8
  77. package/src/lib/src_json.ts +1 -1
  78. package/src/lib/sveltekit_config.ts +1 -1
  79. package/src/lib/sveltekit_shim_env.ts +1 -1
  80. package/src/lib/task.ts +20 -20
  81. package/src/lib/task_logging.ts +6 -6
  82. package/src/lib/upgrade.task.ts +1 -1
package/src/lib/gen.ts CHANGED
@@ -28,7 +28,7 @@ export const is_gen_path = (path: string): boolean => path.includes(GEN_FILE_PAT
28
28
 
29
29
  export interface Gen_Result {
30
30
  origin_id: Path_Id;
31
- files: Gen_File[];
31
+ files: Array<Gen_File>;
32
32
  }
33
33
  export interface Gen_File {
34
34
  id: Path_Id;
@@ -52,7 +52,7 @@ export interface Gen_Context {
52
52
  log: Logger;
53
53
  }
54
54
  // TODO consider other return data - metadata? effects? non-file build artifacts?
55
- export type Raw_Gen_Result = string | Raw_Gen_File | null | Raw_Gen_Result[];
55
+ export type Raw_Gen_Result = string | Raw_Gen_File | null | Array<Raw_Gen_Result>;
56
56
  export interface Raw_Gen_File {
57
57
  content: string;
58
58
  // Defaults to file name without the `.gen`, and can be a relative path.
@@ -67,9 +67,9 @@ export const Gen_Config = z.object({
67
67
  export type Gen_Config = z.infer<typeof Gen_Config>;
68
68
 
69
69
  export interface Gen_Results {
70
- results: Genfile_Module_Result[];
71
- successes: Genfile_Module_Result_Success[];
72
- failures: Genfile_Module_Result_Failure[];
70
+ results: Array<Genfile_Module_Result>;
71
+ successes: Array<Genfile_Module_Result_Success>;
72
+ failures: Array<Genfile_Module_Result_Failure>;
73
73
  input_count: number;
74
74
  output_count: number;
75
75
  elapsed: number;
@@ -78,7 +78,7 @@ export type Genfile_Module_Result = Genfile_Module_Result_Success | Genfile_Modu
78
78
  export interface Genfile_Module_Result_Success {
79
79
  ok: true;
80
80
  id: Path_Id;
81
- files: Gen_File[];
81
+ files: Array<Gen_File>;
82
82
  elapsed: number;
83
83
  }
84
84
  export interface Genfile_Module_Result_Failure {
@@ -96,7 +96,7 @@ export const to_gen_result = (origin_id: Path_Id, raw_result: Raw_Gen_Result): G
96
96
  };
97
97
  };
98
98
 
99
- const to_gen_files = (origin_id: Path_Id, raw_result: Raw_Gen_Result): Gen_File[] => {
99
+ const to_gen_files = (origin_id: Path_Id, raw_result: Raw_Gen_Result): Array<Gen_File> => {
100
100
  if (raw_result === null) {
101
101
  return [];
102
102
  } else if (typeof raw_result === 'string') {
@@ -147,7 +147,7 @@ export const to_output_file_name = (filename: string): string => {
147
147
  `Invalid gen file name - only one additional extension is allowed to follow '${GEN_FILE_PATTERN}' in '${filename}'`,
148
148
  );
149
149
  }
150
- const final_parts: string[] = [];
150
+ const final_parts: Array<string> = [];
151
151
  const has_different_ext = gen_pattern_index === parts.length - 3;
152
152
  const length = has_different_ext ? parts.length - 1 : parts.length;
153
153
  for (let i = 0; i < length; i++) {
@@ -158,7 +158,7 @@ export const to_output_file_name = (filename: string): string => {
158
158
  return final_parts.join('.');
159
159
  };
160
160
 
161
- const validate_gen_files = (files: Gen_File[]) => {
161
+ const validate_gen_files = (files: Array<Gen_File>) => {
162
162
  const ids = new Set();
163
163
  for (const file of files) {
164
164
  if (ids.has(file.id)) {
@@ -182,7 +182,9 @@ export type Analyzed_Gen_Result =
182
182
  has_changed: true;
183
183
  };
184
184
 
185
- export const analyze_gen_results = (gen_results: Gen_Results): Promise<Analyzed_Gen_Result[]> =>
185
+ export const analyze_gen_results = (
186
+ gen_results: Gen_Results,
187
+ ): Promise<Array<Analyzed_Gen_Result>> =>
186
188
  Promise.all(
187
189
  gen_results.successes
188
190
  .map((result) => result.files.map((file) => analyze_gen_result(file)))
@@ -209,7 +211,7 @@ export const analyze_gen_result = async (file: Gen_File): Promise<Analyzed_Gen_R
209
211
 
210
212
  export const write_gen_results = async (
211
213
  gen_results: Gen_Results,
212
- analyzed_gen_results: Analyzed_Gen_Result[],
214
+ analyzed_gen_results: Array<Analyzed_Gen_Result>,
213
215
  log: Logger,
214
216
  ): Promise<void> => {
215
217
  await Promise.all(
@@ -236,38 +238,38 @@ export const write_gen_results = async (
236
238
  };
237
239
 
238
240
  export interface Found_Genfiles {
239
- resolved_input_files: Resolved_Input_File[];
240
- resolved_input_files_by_root_dir: Map<Path_Id, Resolved_Input_File[]>;
241
- resolved_input_paths: Resolved_Input_Path[];
241
+ resolved_input_files: Array<Resolved_Input_File>;
242
+ resolved_input_files_by_root_dir: Map<Path_Id, Array<Resolved_Input_File>>;
243
+ resolved_input_paths: Array<Resolved_Input_Path>;
242
244
  }
243
245
 
244
246
  export type Find_Genfiles_Result = Result<{value: Found_Genfiles}, Find_Genfiles_Failure>;
245
247
  export type Find_Genfiles_Failure =
246
248
  | {
247
249
  type: 'unmapped_input_paths';
248
- unmapped_input_paths: Input_Path[];
249
- resolved_input_paths: Resolved_Input_Path[];
250
- reasons: string[];
250
+ unmapped_input_paths: Array<Input_Path>;
251
+ resolved_input_paths: Array<Resolved_Input_Path>;
252
+ reasons: Array<string>;
251
253
  }
252
254
  | {
253
255
  type: 'input_directories_with_no_files';
254
- input_directories_with_no_files: Input_Path[];
255
- resolved_input_files: Resolved_Input_File[];
256
- resolved_input_files_by_root_dir: Map<Path_Id, Resolved_Input_File[]>;
257
- resolved_input_paths: Resolved_Input_Path[];
258
- reasons: string[];
256
+ input_directories_with_no_files: Array<Input_Path>;
257
+ resolved_input_files: Array<Resolved_Input_File>;
258
+ resolved_input_files_by_root_dir: Map<Path_Id, Array<Resolved_Input_File>>;
259
+ resolved_input_paths: Array<Resolved_Input_Path>;
260
+ reasons: Array<string>;
259
261
  };
260
262
 
261
263
  /**
262
264
  * Finds modules from input paths. (see `src/lib/input_path.ts` for more)
263
265
  */
264
266
  export const find_genfiles = (
265
- input_paths: Input_Path[],
266
- root_dirs: Path_Id[],
267
+ input_paths: Array<Input_Path>,
268
+ root_dirs: Array<Path_Id>,
267
269
  config: Gro_Config,
268
270
  timings?: Timings,
269
271
  ): Find_Genfiles_Result => {
270
- const extensions: string[] = [GEN_FILE_PATTERN];
272
+ const extensions: Array<string> = [GEN_FILE_PATTERN];
271
273
 
272
274
  // Check which extension variation works - if it's a directory, prefer others first!
273
275
  const timing_to_resolve_input_paths = timings?.start('resolve input paths');
@@ -334,7 +336,7 @@ export interface Genfile_Module {
334
336
  export type Genfile_Module_Meta = Module_Meta<Genfile_Module>;
335
337
 
336
338
  export interface Loaded_Genfiles {
337
- modules: Genfile_Module_Meta[];
339
+ modules: Array<Genfile_Module_Meta>;
338
340
  found_genfiles: Found_Genfiles;
339
341
  }
340
342
 
package/src/lib/github.ts CHANGED
@@ -30,12 +30,12 @@ export const github_fetch_commit_prs = async (
30
30
  log?: Logger,
31
31
  cache?: Fetch_Value_Cache,
32
32
  api_version?: string,
33
- ): Promise<Github_Pull_Request[] | null> => {
33
+ ): Promise<Array<Github_Pull_Request> | null> => {
34
34
  const headers = api_version ? new Headers({'x-github-api-version': api_version}) : undefined;
35
35
  const url = `https://api.github.com/repos/${owner}/${repo}/commits/${commit_sha}/pulls`;
36
36
  const fetched = await fetch_value(url, {
37
37
  request: {headers},
38
- parse: (v: any[]) => v.map((p) => Github_Pull_Request.parse(p)),
38
+ parse: (v: Array<any>) => v.map((p) => Github_Pull_Request.parse(p)),
39
39
  token,
40
40
  cache,
41
41
  return_early_from_cache: true,
@@ -21,7 +21,7 @@ import type {Path_Filter, Path_Id} from './path.js';
21
21
  * This is exposed to users in places like tasks and genfiles.
22
22
  * @see https://github.com/ryanatkn/gro/blob/main/src/docs/config.md
23
23
  */
24
- export interface Gro_Config {
24
+ export interface Gro_Config extends Raw_Gro_Config {
25
25
  /**
26
26
  * @see https://github.com/ryanatkn/gro/blob/main/src/docs/plugin.md
27
27
  */
@@ -36,12 +36,12 @@ export interface Gro_Config {
36
36
  * The root directories to search for tasks given implicit relative input paths.
37
37
  * Defaults to `./src/lib`, then the cwd, then the Gro package dist.
38
38
  */
39
- task_root_dirs: Path_Id[];
39
+ task_root_dirs: Array<Path_Id>;
40
40
  /**
41
41
  * When searching the filsystem for tasks and genfiles,
42
42
  * directories and files are included if they pass all of these filters.
43
43
  */
44
- search_filters: Path_Filter[];
44
+ search_filters: Array<Path_Filter>;
45
45
  /**
46
46
  * The CLI to use that's compatible with `node`.
47
47
  */
@@ -60,8 +60,8 @@ export interface Gro_Config {
60
60
  export interface Raw_Gro_Config {
61
61
  plugins?: Create_Config_Plugins;
62
62
  map_package_json?: Map_Package_Json | null;
63
- task_root_dirs?: string[];
64
- search_filters?: Path_Filter | Path_Filter[] | null;
63
+ task_root_dirs?: Array<string>;
64
+ search_filters?: Path_Filter | Array<Path_Filter> | null;
65
65
  js_cli?: string;
66
66
  pm_cli?: string;
67
67
  }
@@ -83,7 +83,7 @@ export const resolve_gro_module_path = (path = ''): string => {
83
83
  export const spawn_with_loader = (
84
84
  loader_path: string,
85
85
  invoke_path: string,
86
- argv: string[],
86
+ argv: Array<string>,
87
87
  js_cli = JS_CLI_DEFAULT, // TODO source from config when possible
88
88
  ): Promise<Spawn_Result> => {
89
89
  const args = [
@@ -17,8 +17,8 @@ export interface Task_Args extends Args {
17
17
  }
18
18
 
19
19
  export interface Gro_Plugin_Gen_Options {
20
- input_paths?: string[];
21
- root_dirs?: string[];
20
+ input_paths?: Array<string>;
21
+ root_dirs?: Array<string>;
22
22
  flush_debounce_delay?: number;
23
23
  }
24
24
 
@@ -46,7 +46,7 @@ export const gro_plugin_gen = ({
46
46
  },
47
47
  {delay: flush_debounce_delay},
48
48
  );
49
- const gen = (files: string[] = []) => spawn_cli('gro', ['gen', ...files]);
49
+ const gen = (files: Array<string> = []) => spawn_cli('gro', ['gen', ...files]);
50
50
 
51
51
  let cleanup: Cleanup_Watch | undefined;
52
52
 
@@ -22,7 +22,7 @@ export interface Task_Args extends Args {
22
22
  }
23
23
 
24
24
  export interface Gro_Plugin_Moss_Options {
25
- include_classes?: string[] | Set<string> | null;
25
+ include_classes?: Array<string> | Set<string> | null;
26
26
  outfile?: string;
27
27
  filter_file?: File_Filter | null;
28
28
  flush_debounce_delay?: number;
@@ -37,7 +37,7 @@ export interface Gro_Plugin_Server_Options {
37
37
  /**
38
38
  * same as esbuild's `entryPoints`
39
39
  */
40
- entry_points?: string[];
40
+ entry_points?: Array<string>;
41
41
  /**
42
42
  * @default cwd
43
43
  */
@@ -51,7 +51,7 @@ export interface Gro_Plugin_Server_Options {
51
51
  /**
52
52
  * @default SvelteKit's `.env`, `.env.development`, and `.env.production`
53
53
  */
54
- env_files?: string[];
54
+ env_files?: Array<string>;
55
55
  /**
56
56
  * @default process.env
57
57
  */
@@ -109,7 +109,7 @@ export const gro_plugin_sveltekit_app = ({
109
109
  // copy files to `static` before building, in such a way
110
110
  // that's non-destructive to existing files and dirs and easy to clean up
111
111
  const {assets_path} = default_sveltekit_config;
112
- const cleanups: Cleanup[] = [
112
+ const cleanups: Array<Cleanup> = [
113
113
  serialized_package_json
114
114
  ? create_temporarily(
115
115
  join(assets_path, '.well-known/package.json'),
@@ -41,9 +41,9 @@ export const to_input_path = (
41
41
  };
42
42
 
43
43
  export const to_input_paths = (
44
- raw_input_paths: Raw_Input_Path[],
44
+ raw_input_paths: Array<Raw_Input_Path>,
45
45
  root_path?: string, // TODO @many isn't passed in anywhere, maybe hoist to `invoke_task` and others
46
- ): Input_Path[] => raw_input_paths.map((p) => to_input_path(p, root_path));
46
+ ): Array<Input_Path> => raw_input_paths.map((p) => to_input_path(p, root_path));
47
47
 
48
48
  export interface Possible_Path {
49
49
  id: Path_Id;
@@ -57,9 +57,9 @@ export interface Possible_Path {
57
57
  */
58
58
  export const get_possible_paths = (
59
59
  input_path: Input_Path,
60
- root_dirs: Path_Id[],
61
- extensions: string[],
62
- ): Possible_Path[] => {
60
+ root_dirs: Array<Path_Id>,
61
+ extensions: Array<string>,
62
+ ): Array<Possible_Path> => {
63
63
  const possible_paths: Set<Possible_Path> = new Set();
64
64
 
65
65
  const add_possible_paths = (path: string, root_dir: Path_Id) => {
@@ -113,9 +113,9 @@ export interface Resolved_Input_File {
113
113
  }
114
114
 
115
115
  export interface Resolved_Input_Paths {
116
- resolved_input_paths: Resolved_Input_Path[];
117
- possible_paths_by_input_path: Map<Input_Path, Possible_Path[]>;
118
- unmapped_input_paths: Input_Path[];
116
+ resolved_input_paths: Array<Resolved_Input_Path>;
117
+ possible_paths_by_input_path: Map<Input_Path, Array<Possible_Path>>;
118
+ unmapped_input_paths: Array<Input_Path>;
119
119
  }
120
120
 
121
121
  /**
@@ -124,13 +124,13 @@ export interface Resolved_Input_Paths {
124
124
  * If none is found for an input path, it's added to `unmapped_input_paths`.
125
125
  */
126
126
  export const resolve_input_paths = (
127
- input_paths: Input_Path[],
128
- root_dirs: Path_Id[],
129
- extensions: string[],
127
+ input_paths: Array<Input_Path>,
128
+ root_dirs: Array<Path_Id>,
129
+ extensions: Array<string>,
130
130
  ): Resolved_Input_Paths => {
131
- const resolved_input_paths: Resolved_Input_Path[] = [];
132
- const possible_paths_by_input_path: Map<Input_Path, Possible_Path[]> = new Map();
133
- const unmapped_input_paths: Input_Path[] = [];
131
+ const resolved_input_paths: Array<Resolved_Input_Path> = [];
132
+ const possible_paths_by_input_path: Map<Input_Path, Array<Possible_Path>> = new Map();
133
+ const unmapped_input_paths: Array<Input_Path> = [];
134
134
  for (const input_path of input_paths) {
135
135
  let found_file: [Path_Info, Possible_Path] | null = null;
136
136
  let found_dirs: Array<[Path_Info, Possible_Path]> | null = null;
@@ -177,9 +177,9 @@ export const resolve_input_paths = (
177
177
  };
178
178
 
179
179
  export interface Resolved_Input_Files {
180
- resolved_input_files: Resolved_Input_File[];
181
- resolved_input_files_by_root_dir: Map<Path_Id, Resolved_Input_File[]>;
182
- input_directories_with_no_files: Input_Path[];
180
+ resolved_input_files: Array<Resolved_Input_File>;
181
+ resolved_input_files_by_root_dir: Map<Path_Id, Array<Resolved_Input_File>>;
182
+ input_directories_with_no_files: Array<Input_Path>;
183
183
  }
184
184
 
185
185
  /**
@@ -187,10 +187,10 @@ export interface Resolved_Input_Files {
187
187
  * De-dupes source ids.
188
188
  */
189
189
  export const resolve_input_files = (
190
- resolved_input_paths: Resolved_Input_Path[],
191
- search: (dir: string) => Resolved_Path[] = search_fs,
190
+ resolved_input_paths: Array<Resolved_Input_Path>,
191
+ search: (dir: string) => Array<Resolved_Path> = search_fs,
192
192
  ): Resolved_Input_Files => {
193
- const resolved_input_files: Resolved_Input_File[] = [];
193
+ const resolved_input_files: Array<Resolved_Input_File> = [];
194
194
  // Add all input paths initially, and remove each when resolved to a file.
195
195
  const existing_path_ids: Set<Path_Id> = new Set();
196
196
 
@@ -208,7 +208,7 @@ export const resolve_input_files = (
208
208
  // Handle input paths that resolve to directories.
209
209
  const files = search(id);
210
210
  if (!files.length) continue;
211
- const path_ids: Path_Id[] = [];
211
+ const path_ids: Array<Path_Id> = [];
212
212
  for (const {path, is_directory} of files) {
213
213
  if (is_directory) continue;
214
214
  const path_id = join(id, path);
@@ -219,7 +219,7 @@ export const resolve_input_files = (
219
219
  handle_found(input_path, path_id);
220
220
  }
221
221
  if (!path_ids.length) continue;
222
- const resolved_input_files_for_input_path: Resolved_Input_File[] = [];
222
+ const resolved_input_files_for_input_path: Array<Resolved_Input_File> = [];
223
223
  for (const path_id of path_ids) {
224
224
  const resolved_input_file: Resolved_Input_File = {
225
225
  id: path_id,
@@ -249,7 +249,7 @@ export const resolve_input_files = (
249
249
  map.set(root_dir, [resolved_input_file]);
250
250
  }
251
251
  return map;
252
- }, new Map<Path_Id, Resolved_Input_File[]>()),
252
+ }, new Map<Path_Id, Array<Resolved_Input_File>>()),
253
253
  input_directories_with_no_files: remaining.map((r) => r.input_path),
254
254
  };
255
255
  };
package/src/lib/invoke.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import {attach_process_error_handlers} from '@ryanatkn/belt/process.js';
2
2
  import {configure_log_colors} from '@ryanatkn/belt/log.js';
3
+ import {set_colors} from '@ryanatkn/belt/print.js';
3
4
  import {styleText} from 'node:util';
4
5
 
5
6
  import {invoke_task} from './invoke_task.js';
@@ -25,6 +26,7 @@ attach_process_error_handlers(
25
26
  );
26
27
 
27
28
  configure_log_colors(styleText);
29
+ set_colors(styleText);
28
30
 
29
31
  await sveltekit_sync_if_obviously_needed();
30
32
 
@@ -44,15 +44,15 @@ export const load_module = async <T_Module extends Record<string, any>>(
44
44
 
45
45
  export interface Load_Modules_Failure<T_Module_Meta extends Module_Meta> {
46
46
  type: 'load_module_failures';
47
- load_module_failures: Load_Module_Failure[];
48
- reasons: string[];
47
+ load_module_failures: Array<Load_Module_Failure>;
48
+ reasons: Array<string>;
49
49
  // still return the modules and timings, deferring to the caller
50
- modules: T_Module_Meta[];
50
+ modules: Array<T_Module_Meta>;
51
51
  }
52
52
 
53
53
  export type Load_Modules_Result<T_Module_Meta extends Module_Meta> = Result<
54
54
  {
55
- modules: T_Module_Meta[];
55
+ modules: Array<T_Module_Meta>;
56
56
  },
57
57
  Load_Modules_Failure<T_Module_Meta>
58
58
  >;
@@ -62,15 +62,15 @@ export const load_modules = async <
62
62
  T_Module extends Record<string, any>,
63
63
  T_Module_Meta extends Module_Meta<T_Module>,
64
64
  >(
65
- resolved_input_files: Resolved_Input_File[],
65
+ resolved_input_files: Array<Resolved_Input_File>,
66
66
  validate: (mod: any) => mod is T_Module,
67
67
  map_module_meta: (resolved_input_file: Resolved_Input_File, mod: T_Module) => T_Module_Meta,
68
68
  timings?: Timings,
69
69
  ): Promise<Load_Modules_Result<T_Module_Meta>> => {
70
70
  const timing_to_load_modules = timings?.start('load modules');
71
- const modules: T_Module_Meta[] = [];
72
- const load_module_failures: Load_Module_Failure[] = [];
73
- const reasons: string[] = [];
71
+ const modules: Array<T_Module_Meta> = [];
72
+ const load_module_failures: Array<Load_Module_Failure> = [];
73
+ const reasons: Array<string> = [];
74
74
  for (const resolved_input_file of resolved_input_files.values()) {
75
75
  const {id, input_path} = resolved_input_file;
76
76
  const result = await load_module(id, validate); // eslint-disable-line no-await-in-loop
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.js';
5
5
 
6
6
  export const package_json = {
7
7
  name: '@ryanatkn/gro',
8
- version: '0.147.1',
8
+ version: '0.148.0',
9
9
  description: 'task runner and toolkit extending SvelteKit',
10
10
  motto: 'generate, run, optimize',
11
11
  glyph: '🌰',
@@ -44,14 +44,14 @@ export const package_json = {
44
44
  'typescript',
45
45
  ],
46
46
  dependencies: {
47
- '@ryanatkn/belt': '^0.26.1',
47
+ '@ryanatkn/belt': '^0.29.0',
48
48
  chokidar: '^4.0.1',
49
49
  dotenv: '^16.4.5',
50
50
  'esm-env': '^1.1.4',
51
51
  mri: '^1.2.0',
52
- 'oxc-parser': '^0.34.0',
52
+ 'oxc-parser': '^0.36.0',
53
53
  prettier: '^3.3.3',
54
- 'prettier-plugin-svelte': '^3.2.7',
54
+ 'prettier-plugin-svelte': '^3.2.8',
55
55
  'ts-morph': '^24.0.0',
56
56
  tslib: '^2.8.1',
57
57
  zod: '^3.23.8',
@@ -60,22 +60,21 @@ export const package_json = {
60
60
  devDependencies: {
61
61
  '@changesets/changelog-git': '^0.2.0',
62
62
  '@changesets/types': '^6.0.0',
63
- '@ryanatkn/eslint-config': '^0.5.6',
64
- '@ryanatkn/fuz': '^0.130.3',
63
+ '@ryanatkn/eslint-config': '^0.6.0',
64
+ '@ryanatkn/fuz': '^0.131.1',
65
65
  '@ryanatkn/moss': '^0.20.2',
66
66
  '@sveltejs/adapter-static': '^3.0.6',
67
- '@sveltejs/kit': '^2.7.4',
67
+ '@sveltejs/kit': '^2.9.0',
68
68
  '@sveltejs/package': '^2.3.7',
69
- '@sveltejs/vite-plugin-svelte': '^4.0.0',
70
- '@types/fs-extra': '^11.0.4',
71
- '@types/node': '^22.8.6',
69
+ '@sveltejs/vite-plugin-svelte': '^4.0.1',
70
+ '@types/node': '^22.9.1',
72
71
  esbuild: '^0.21.5',
73
- eslint: '^9.14.0',
74
- 'eslint-plugin-svelte': '^2.46.0',
75
- svelte: '^5.1.9',
76
- 'svelte-check': '^4.0.5',
77
- typescript: '^5.6.3',
78
- 'typescript-eslint': '^8.12.2',
72
+ eslint: '^9.16.0',
73
+ 'eslint-plugin-svelte': '^2.46.1',
74
+ svelte: '^5.8.1',
75
+ 'svelte-check': '^4.1.1',
76
+ typescript: '^5.7.2',
77
+ 'typescript-eslint': '^8.17.0',
79
78
  uvu: '^0.5.6',
80
79
  },
81
80
  prettier: {
@@ -266,7 +265,7 @@ export const package_json = {
266
265
 
267
266
  export const src_json = {
268
267
  name: '@ryanatkn/gro',
269
- version: '0.147.1',
268
+ version: '0.148.0',
270
269
  modules: {
271
270
  '.': {
272
271
  path: 'index.ts',
@@ -250,7 +250,7 @@ export const update_package_json = async (
250
250
 
251
251
  const is_index = (path: string): boolean => path === 'index.ts' || path === 'index.js';
252
252
 
253
- export const to_package_exports = (paths: string[]): Package_Json_Exports => {
253
+ export const to_package_exports = (paths: Array<string>): Package_Json_Exports => {
254
254
  const sorted = paths
255
255
  .slice()
256
256
  .sort((a, b) => (is_index(a) ? -1 : is_index(b) ? 1 : a.localeCompare(b)));
@@ -360,7 +360,7 @@ export interface Package_Json_Dep {
360
360
  version: string;
361
361
  }
362
362
 
363
- export const extract_deps = (package_json: Package_Json): Package_Json_Dep[] => {
363
+ export const extract_deps = (package_json: Package_Json): Array<Package_Json_Dep> => {
364
364
  const deps_by_name: Map<string, Package_Json_Dep> = new Map();
365
365
  // Earlier versions override later ones, so peer deps goes last.
366
366
  const add_deps = (deps: Record<string, string> | undefined) => {
@@ -13,8 +13,8 @@ export const parse_imports = (
13
13
  id: Path_Id,
14
14
  contents: string,
15
15
  ignore_types = true,
16
- ): Import_Specifier[] => {
17
- const specifiers: string[] = [];
16
+ ): Array<Import_Specifier> => {
17
+ const specifiers: Array<string> = [];
18
18
 
19
19
  const is_svelte = SVELTE_MATCHER.test(id);
20
20
 
package/src/lib/plugin.ts CHANGED
@@ -24,7 +24,7 @@ export class Plugins<T_Plugin_Context extends Plugin_Context> {
24
24
  /* prefer `Plugins.create` to the constructor */
25
25
  constructor(
26
26
  private ctx: T_Plugin_Context,
27
- private instances: Plugin[],
27
+ private instances: Array<Plugin>,
28
28
  ) {}
29
29
 
30
30
  static async create<T_Plugin_Context extends Plugin_Context>(
@@ -32,7 +32,7 @@ export class Plugins<T_Plugin_Context extends Plugin_Context> {
32
32
  ): Promise<Plugins<T_Plugin_Context>> {
33
33
  const {timings} = ctx;
34
34
  const timing_to_create = timings.start('plugins.create');
35
- const instances: Plugin[] = await ctx.config.plugins(ctx);
35
+ const instances: Array<Plugin> = await ctx.config.plugins(ctx);
36
36
  const plugins = new Plugins(ctx, instances);
37
37
  timing_to_create();
38
38
  return plugins;
@@ -91,10 +91,10 @@ export class Plugins<T_Plugin_Context extends Plugin_Context> {
91
91
  * @returns `plugins` with `new_plugin` at the index of the plugin with `name`
92
92
  */
93
93
  export const replace_plugin = (
94
- plugins: Plugin[],
94
+ plugins: Array<Plugin>,
95
95
  new_plugin: Plugin,
96
96
  name = new_plugin.name,
97
- ): Plugin[] => {
97
+ ): Array<Plugin> => {
98
98
  const index = plugins.findIndex((p) => p.name === name);
99
99
  if (index === -1) throw Error('Failed to find plugin to replace: ' + name);
100
100
  const replaced = plugins.slice();
@@ -19,7 +19,7 @@ import {default_sveltekit_config} from './sveltekit_config.js';
19
19
  export const GEN_NO_PROD_MESSAGE = 'gen runs only during development';
20
20
 
21
21
  export const run_gen = async (
22
- gen_modules: Genfile_Module_Meta[],
22
+ gen_modules: Array<Genfile_Module_Meta>,
23
23
  config: Gro_Config,
24
24
  log: Logger,
25
25
  timings: Timings,
@@ -10,11 +10,11 @@ export interface Search_Fs_Options {
10
10
  /**
11
11
  * One or more filter functions, any of which can short-circuit the search by returning `false`.
12
12
  */
13
- filter?: Path_Filter | Path_Filter[];
13
+ filter?: Path_Filter | Array<Path_Filter>;
14
14
  /**
15
15
  * One or more file filter functions. Every filter must pass for a file to be included.
16
16
  */
17
- file_filter?: File_Filter | File_Filter[];
17
+ file_filter?: File_Filter | Array<File_Filter>;
18
18
  /**
19
19
  * Pass `null` or `false` to speed things up at the cost of volatile ordering.
20
20
  */
@@ -32,7 +32,7 @@ export interface Search_Fs_Options {
32
32
  export const search_fs = (
33
33
  dir: string,
34
34
  options: Search_Fs_Options = EMPTY_OBJECT,
35
- ): Resolved_Path[] => {
35
+ ): Array<Resolved_Path> => {
36
36
  const {
37
37
  filter,
38
38
  file_filter,
@@ -52,7 +52,7 @@ export const search_fs = (
52
52
 
53
53
  if (!existsSync(final_dir)) return [];
54
54
 
55
- const paths: Resolved_Path[] = [];
55
+ const paths: Array<Resolved_Path> = [];
56
56
  crawl(final_dir, paths, filters, file_filters, include_directories, null);
57
57
 
58
58
  return sort ? paths.sort(typeof sort === 'boolean' ? default_sort : sort) : paths;
@@ -62,12 +62,12 @@ const default_sort = (a: Resolved_Path, b: Resolved_Path): number => a.path.loca
62
62
 
63
63
  const crawl = (
64
64
  dir: string,
65
- paths: Resolved_Path[],
66
- filters: Path_Filter[] | undefined,
67
- file_filter: File_Filter[] | undefined,
65
+ paths: Array<Resolved_Path>,
66
+ filters: Array<Path_Filter> | undefined,
67
+ file_filter: Array<File_Filter> | undefined,
68
68
  include_directories: boolean,
69
69
  base_dir: string | null,
70
- ): Resolved_Path[] => {
70
+ ): Array<Resolved_Path> => {
71
71
  // This sync version is significantly faster than using the `fs/promises` version -
72
72
  // it doesn't parallelize but that's not the common case in Gro.
73
73
  const dirents = readdirSync(dir, {withFileTypes: true});
@@ -88,7 +88,7 @@ export const to_src_modules = (
88
88
  );
89
89
  }
90
90
 
91
- const declarations: Src_Module_Declaration[] = [];
91
+ const declarations: Array<Src_Module_Declaration> = [];
92
92
 
93
93
  const source_file = project.getSourceFile(source_file_id);
94
94
  if (source_file) {
@@ -58,7 +58,7 @@ export interface Parsed_Sveltekit_Config {
58
58
  public_prefix: string | undefined;
59
59
  svelte_compile_options: CompileOptions;
60
60
  svelte_compile_module_options: ModuleCompileOptions;
61
- svelte_preprocessors: PreprocessorGroup | PreprocessorGroup[] | undefined;
61
+ svelte_preprocessors: PreprocessorGroup | Array<PreprocessorGroup> | undefined;
62
62
  }
63
63
 
64
64
  // TODO currently incomplete and hack - maybe rethink
@@ -12,7 +12,7 @@ export const render_env_shim_module = (
12
12
  public_prefix = 'PUBLIC_',
13
13
  private_prefix = '',
14
14
  env_dir?: string,
15
- env_files?: string[],
15
+ env_files?: Array<string>,
16
16
  ambient_env?: Record<string, string | undefined>,
17
17
  ): string => {
18
18
  const env = load_env(