@ryanatkn/gro 0.176.0 → 0.177.1

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 (211) hide show
  1. package/dist/args.d.ts +5 -5
  2. package/dist/args.d.ts.map +1 -1
  3. package/dist/build.task.d.ts.map +1 -1
  4. package/dist/build.task.js +2 -2
  5. package/dist/build_cache.d.ts +12 -12
  6. package/dist/build_cache.d.ts.map +1 -1
  7. package/dist/build_cache.js +4 -4
  8. package/dist/changelog.d.ts +2 -2
  9. package/dist/changelog.d.ts.map +1 -1
  10. package/dist/changelog.js +1 -1
  11. package/dist/changeset.task.d.ts.map +1 -1
  12. package/dist/changeset.task.js +9 -9
  13. package/dist/changeset_helpers.d.ts +4 -4
  14. package/dist/changeset_helpers.d.ts.map +1 -1
  15. package/dist/changeset_helpers.js +2 -2
  16. package/dist/check.task.d.ts.map +1 -1
  17. package/dist/check.task.js +3 -3
  18. package/dist/clean.task.js +2 -2
  19. package/dist/cli.d.ts +6 -6
  20. package/dist/cli.d.ts.map +1 -1
  21. package/dist/commit.task.js +2 -2
  22. package/dist/deploy.task.d.ts.map +1 -1
  23. package/dist/deploy.task.js +13 -13
  24. package/dist/dev.task.d.ts +2 -2
  25. package/dist/dev.task.d.ts.map +1 -1
  26. package/dist/disknode.d.ts +4 -4
  27. package/dist/disknode.d.ts.map +1 -1
  28. package/dist/esbuild_helpers.d.ts +2 -2
  29. package/dist/esbuild_helpers.d.ts.map +1 -1
  30. package/dist/esbuild_plugin_external_worker.d.ts +5 -5
  31. package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
  32. package/dist/esbuild_plugin_svelte.d.ts +4 -4
  33. package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
  34. package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts +2 -2
  35. package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +1 -1
  36. package/dist/esbuild_plugin_sveltekit_shim_app.d.ts +5 -5
  37. package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -1
  38. package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +2 -2
  39. package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
  40. package/dist/filer.d.ts +15 -15
  41. package/dist/filer.d.ts.map +1 -1
  42. package/dist/filer.js +2 -2
  43. package/dist/format.task.d.ts.map +1 -1
  44. package/dist/format.task.js +2 -2
  45. package/dist/format_directory.d.ts +2 -2
  46. package/dist/format_directory.d.ts.map +1 -1
  47. package/dist/gen.d.ts +73 -73
  48. package/dist/gen.d.ts.map +1 -1
  49. package/dist/gen.js +1 -1
  50. package/dist/gen.task.d.ts.map +1 -1
  51. package/dist/gen.task.js +8 -8
  52. package/dist/gen_helpers.d.ts +4 -4
  53. package/dist/gen_helpers.d.ts.map +1 -1
  54. package/dist/gen_helpers.js +1 -1
  55. package/dist/github.d.ts +4 -4
  56. package/dist/github.d.ts.map +1 -1
  57. package/dist/github.js +3 -3
  58. package/dist/gro.config.default.d.ts +2 -2
  59. package/dist/gro.config.default.d.ts.map +1 -1
  60. package/dist/gro_config.d.ts +25 -25
  61. package/dist/gro_config.d.ts.map +1 -1
  62. package/dist/gro_config.js +2 -2
  63. package/dist/gro_helpers.d.ts +2 -2
  64. package/dist/gro_helpers.d.ts.map +1 -1
  65. package/dist/gro_plugin_gen.d.ts +3 -3
  66. package/dist/gro_plugin_gen.d.ts.map +1 -1
  67. package/dist/gro_plugin_gen.js +2 -2
  68. package/dist/gro_plugin_server.d.ts +7 -7
  69. package/dist/gro_plugin_server.d.ts.map +1 -1
  70. package/dist/gro_plugin_sveltekit_app.d.ts +10 -10
  71. package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
  72. package/dist/gro_plugin_sveltekit_app.js +2 -2
  73. package/dist/gro_plugin_sveltekit_library.d.ts +4 -4
  74. package/dist/gro_plugin_sveltekit_library.d.ts.map +1 -1
  75. package/dist/gro_plugin_sveltekit_library.js +2 -2
  76. package/dist/index.d.ts +3 -3
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +1 -1
  79. package/dist/input_path.d.ts +30 -30
  80. package/dist/input_path.d.ts.map +1 -1
  81. package/dist/input_path.js +2 -2
  82. package/dist/invoke.js +1 -1
  83. package/dist/invoke_task.d.ts +3 -3
  84. package/dist/invoke_task.d.ts.map +1 -1
  85. package/dist/invoke_task.js +4 -4
  86. package/dist/lint.task.d.ts.map +1 -1
  87. package/dist/lint.task.js +2 -2
  88. package/dist/modules.d.ts +20 -20
  89. package/dist/modules.d.ts.map +1 -1
  90. package/dist/modules.js +2 -2
  91. package/dist/package_json.d.ts +16 -16
  92. package/dist/package_json.d.ts.map +1 -1
  93. package/dist/package_json.js +6 -6
  94. package/dist/parse_exports.d.ts +7 -7
  95. package/dist/parse_exports.d.ts.map +1 -1
  96. package/dist/parse_exports.js +3 -3
  97. package/dist/parse_exports_context.d.ts +3 -3
  98. package/dist/parse_exports_context.d.ts.map +1 -1
  99. package/dist/parse_exports_context.js +1 -1
  100. package/dist/parse_imports.d.ts +3 -3
  101. package/dist/parse_imports.d.ts.map +1 -1
  102. package/dist/parse_imports.js +2 -2
  103. package/dist/paths.d.ts +6 -6
  104. package/dist/paths.d.ts.map +1 -1
  105. package/dist/plugin.d.ts +13 -13
  106. package/dist/plugin.d.ts.map +1 -1
  107. package/dist/plugin.js +1 -1
  108. package/dist/publish.task.d.ts.map +1 -1
  109. package/dist/publish.task.js +12 -12
  110. package/dist/reinstall.task.d.ts.map +1 -1
  111. package/dist/reinstall.task.js +4 -4
  112. package/dist/resolve_specifier.d.ts +4 -4
  113. package/dist/resolve_specifier.d.ts.map +1 -1
  114. package/dist/run.task.d.ts.map +1 -1
  115. package/dist/run.task.js +9 -6
  116. package/dist/run_gen.d.ts +4 -4
  117. package/dist/run_gen.d.ts.map +1 -1
  118. package/dist/run_task.d.ts +4 -4
  119. package/dist/run_task.d.ts.map +1 -1
  120. package/dist/run_task.js +3 -3
  121. package/dist/search_fs.d.ts +6 -6
  122. package/dist/search_fs.d.ts.map +1 -1
  123. package/dist/src_json.d.ts +6 -6
  124. package/dist/src_json.d.ts.map +1 -1
  125. package/dist/src_json.js +3 -3
  126. package/dist/svelte_config.d.ts +3 -3
  127. package/dist/svelte_config.d.ts.map +1 -1
  128. package/dist/sveltekit_helpers.d.ts +5 -5
  129. package/dist/sveltekit_helpers.d.ts.map +1 -1
  130. package/dist/sveltekit_helpers.js +5 -5
  131. package/dist/sveltekit_shim_app.d.ts +2 -2
  132. package/dist/sveltekit_shim_app.d.ts.map +1 -1
  133. package/dist/sync.task.d.ts.map +1 -1
  134. package/dist/sync.task.js +2 -2
  135. package/dist/task.d.ts +54 -54
  136. package/dist/task.d.ts.map +1 -1
  137. package/dist/task.js +3 -3
  138. package/dist/task_logging.d.ts +3 -3
  139. package/dist/task_logging.d.ts.map +1 -1
  140. package/dist/test.task.d.ts.map +1 -1
  141. package/dist/test.task.js +4 -4
  142. package/dist/typecheck.task.d.ts.map +1 -1
  143. package/dist/typecheck.task.js +4 -4
  144. package/dist/upgrade.task.d.ts.map +1 -1
  145. package/dist/upgrade.task.js +5 -5
  146. package/dist/watch_dir.d.ts +10 -10
  147. package/dist/watch_dir.d.ts.map +1 -1
  148. package/package.json +3 -3
  149. package/src/lib/args.ts +9 -9
  150. package/src/lib/build.task.ts +2 -2
  151. package/src/lib/build_cache.ts +18 -18
  152. package/src/lib/changelog.ts +10 -10
  153. package/src/lib/changeset.task.ts +16 -16
  154. package/src/lib/changeset_helpers.ts +4 -4
  155. package/src/lib/check.task.ts +3 -3
  156. package/src/lib/clean.task.ts +2 -2
  157. package/src/lib/cli.ts +7 -7
  158. package/src/lib/commit.task.ts +2 -2
  159. package/src/lib/deploy.task.ts +15 -15
  160. package/src/lib/dev.task.ts +2 -2
  161. package/src/lib/disknode.ts +4 -4
  162. package/src/lib/esbuild_helpers.ts +2 -2
  163. package/src/lib/esbuild_plugin_external_worker.ts +7 -7
  164. package/src/lib/esbuild_plugin_svelte.ts +4 -4
  165. package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +2 -2
  166. package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +5 -5
  167. package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +2 -2
  168. package/src/lib/filer.ts +35 -35
  169. package/src/lib/format.task.ts +2 -2
  170. package/src/lib/format_directory.ts +2 -2
  171. package/src/lib/gen.task.ts +19 -19
  172. package/src/lib/gen.ts +85 -85
  173. package/src/lib/gen_helpers.ts +17 -17
  174. package/src/lib/github.ts +6 -6
  175. package/src/lib/gro.config.default.ts +2 -2
  176. package/src/lib/gro_config.ts +28 -28
  177. package/src/lib/gro_helpers.ts +2 -2
  178. package/src/lib/gro_plugin_gen.ts +5 -5
  179. package/src/lib/gro_plugin_server.ts +8 -8
  180. package/src/lib/gro_plugin_sveltekit_app.ts +15 -15
  181. package/src/lib/gro_plugin_sveltekit_library.ts +6 -6
  182. package/src/lib/index.ts +3 -3
  183. package/src/lib/input_path.ts +56 -56
  184. package/src/lib/invoke.ts +2 -2
  185. package/src/lib/invoke_task.ts +7 -7
  186. package/src/lib/lint.task.ts +2 -2
  187. package/src/lib/modules.ts +31 -31
  188. package/src/lib/package_json.ts +27 -27
  189. package/src/lib/parse_exports.ts +15 -15
  190. package/src/lib/parse_exports_context.ts +9 -9
  191. package/src/lib/parse_imports.ts +6 -6
  192. package/src/lib/paths.ts +6 -6
  193. package/src/lib/plugin.ts +17 -17
  194. package/src/lib/publish.task.ts +13 -13
  195. package/src/lib/reinstall.task.ts +4 -4
  196. package/src/lib/resolve_specifier.ts +5 -5
  197. package/src/lib/run.task.ts +10 -6
  198. package/src/lib/run_gen.ts +14 -14
  199. package/src/lib/run_task.ts +8 -8
  200. package/src/lib/search_fs.ts +13 -13
  201. package/src/lib/src_json.ts +13 -13
  202. package/src/lib/svelte_config.ts +2 -2
  203. package/src/lib/sveltekit_helpers.ts +12 -12
  204. package/src/lib/sveltekit_shim_app.ts +3 -3
  205. package/src/lib/sync.task.ts +2 -2
  206. package/src/lib/task.ts +63 -63
  207. package/src/lib/task_logging.ts +11 -11
  208. package/src/lib/test.task.ts +4 -4
  209. package/src/lib/typecheck.task.ts +4 -4
  210. package/src/lib/upgrade.task.ts +7 -7
  211. package/src/lib/watch_dir.ts +10 -10
@@ -1,6 +1,6 @@
1
1
  import {EMPTY_OBJECT} from '@ryanatkn/belt/object.js';
2
2
  import {throttle} from '@ryanatkn/belt/throttle.js';
3
- import {Unreachable_Error} from '@ryanatkn/belt/error.js';
3
+ import {UnreachableError} from '@ryanatkn/belt/error.js';
4
4
 
5
5
  import type {Plugin} from './plugin.ts';
6
6
  import type {Args} from './args.ts';
@@ -16,11 +16,11 @@ const FLUSH_DEBOUNCE_DELAY = 500;
16
16
  // await invoke_task('gen', {_: files, bust_cache: true});
17
17
  const gen = (files: Array<string> = []) => spawn_cli('gro', ['gen', ...files]);
18
18
 
19
- export interface Task_Args extends Args {
19
+ export interface TaskArgs extends Args {
20
20
  watch?: boolean;
21
21
  }
22
22
 
23
- export interface Gro_Plugin_Gen_Options {
23
+ export interface GroPluginGenOptions {
24
24
  input_paths?: Array<string>;
25
25
  root_dirs?: Array<string>;
26
26
  flush_debounce_delay?: number;
@@ -30,7 +30,7 @@ export const gro_plugin_gen = ({
30
30
  input_paths = [paths.source],
31
31
  root_dirs = [paths.source],
32
32
  flush_debounce_delay = FLUSH_DEBOUNCE_DELAY,
33
- }: Gro_Plugin_Gen_Options = EMPTY_OBJECT): Plugin => {
33
+ }: GroPluginGenOptions = EMPTY_OBJECT): Plugin => {
34
34
  const queued_files: Set<string> = new Set();
35
35
 
36
36
  let cleanup_watch: (() => void) | undefined;
@@ -135,7 +135,7 @@ export const gro_plugin_gen = ({
135
135
  break;
136
136
  }
137
137
  default:
138
- throw new Unreachable_Error(change.type);
138
+ throw new UnreachableError(change.type);
139
139
  }
140
140
  });
141
141
  },
@@ -1,4 +1,4 @@
1
- import {spawn_restartable_process, type Restartable_Process} from '@ryanatkn/belt/process.js';
1
+ import {spawn_restartable_process, type RestartableProcess} from '@ryanatkn/belt/process.js';
2
2
  import * as esbuild from 'esbuild';
3
3
  import type {Config as SvelteConfig} from '@sveltejs/kit';
4
4
  import {join, resolve} from 'node:path';
@@ -7,7 +7,7 @@ import {strip_before, strip_end} from '@ryanatkn/belt/string.js';
7
7
  import type {Result} from '@ryanatkn/belt/result.js';
8
8
  import {fs_exists} from '@ryanatkn/belt/fs.js';
9
9
  import {throttle} from '@ryanatkn/belt/throttle.js';
10
- import type {Path_Id} from '@ryanatkn/belt/path.js';
10
+ import type {PathId} from '@ryanatkn/belt/path.js';
11
11
 
12
12
  import type {Plugin} from './plugin.ts';
13
13
  import {base_path_to_path_id, LIB_DIRNAME, paths} from './paths.ts';
@@ -34,7 +34,7 @@ export const has_server = async (
34
34
  return {ok: true};
35
35
  };
36
36
 
37
- export interface Gro_Plugin_Server_Options {
37
+ export interface GroPluginServerOptions {
38
38
  /**
39
39
  * same as esbuild's `entryPoints`
40
40
  */
@@ -48,7 +48,7 @@ export interface Gro_Plugin_Server_Options {
48
48
  * Decoupling this from plugin creation allows it to be created generically,
49
49
  * so the build and dev tasks can be the source of truth for `dev`.
50
50
  */
51
- outpaths?: Create_Outpaths;
51
+ outpaths?: CreateOutpaths;
52
52
  /**
53
53
  * @default ```SvelteKit's `.env`, `.env.development`, and `.env.production````
54
54
  */
@@ -104,7 +104,7 @@ export interface Outpaths {
104
104
  outname: string;
105
105
  }
106
106
 
107
- export type Create_Outpaths = (dev: boolean) => Outpaths;
107
+ export type CreateOutpaths = (dev: boolean) => Outpaths;
108
108
 
109
109
  export const gro_plugin_server = ({
110
110
  entry_points = [SERVER_SOURCE_ID],
@@ -122,11 +122,11 @@ export const gro_plugin_server = ({
122
122
  rebuild_throttle_delay = 1000,
123
123
  cli_command,
124
124
  run, // `dev` default is not available in this scope
125
- }: Gro_Plugin_Server_Options = {}): Plugin => {
125
+ }: GroPluginServerOptions = {}): Plugin => {
126
126
  let build_ctx: esbuild.BuildContext | undefined;
127
127
  let cleanup_watch: (() => void) | undefined;
128
- let server_process: Restartable_Process | undefined;
129
- let deps: Set<Path_Id> | undefined;
128
+ let server_process: RestartableProcess | undefined;
129
+ let deps: Set<PathId> | undefined;
130
130
 
131
131
  return {
132
132
  name: 'gro_plugin_server',
@@ -1,4 +1,4 @@
1
- import type {Spawned_Process} from '@ryanatkn/belt/process.js';
1
+ import type {SpawnedProcess} from '@ryanatkn/belt/process.js';
2
2
  import {cpSync, mkdirSync, rmSync, writeFileSync, existsSync} from 'node:fs';
3
3
  import {dirname, join} from 'node:path';
4
4
 
@@ -6,49 +6,49 @@ import type {Plugin} from './plugin.ts';
6
6
  import {serialize_args, to_forwarded_args} from './args.ts';
7
7
  import {
8
8
  serialize_package_json,
9
- type Package_Json_Mapper,
9
+ type PackageJsonMapper,
10
10
  load_package_json,
11
11
  } from './package_json.ts';
12
- import {Task_Error} from './task.ts';
12
+ import {TaskError} from './task.ts';
13
13
  import {find_cli, spawn_cli, spawn_cli_process} from './cli.ts';
14
- import {type Src_Json_Mapper, src_json_serialize, src_json_create} from './src_json.ts';
14
+ import {type SrcJsonMapper, src_json_serialize, src_json_create} from './src_json.ts';
15
15
  import {EXPORTS_EXCLUDER_DEFAULT} from './gro_config.ts';
16
16
  import {default_svelte_config} from './svelte_config.ts';
17
17
  import {SOURCE_DIRNAME, VITE_CLI} from './constants.ts';
18
18
 
19
- export interface Gro_Plugin_Sveltekit_App_Options {
19
+ export interface GroPluginSveltekitAppOptions {
20
20
  /**
21
21
  * Used for finalizing a SvelteKit build like adding a `.nojekyll` file for GitHub Pages.
22
22
  * @default 'github_pages'
23
23
  */
24
- host_target?: Host_Target;
24
+ host_target?: HostTarget;
25
25
 
26
26
  /**
27
27
  * If truthy, adds `/.well-known/package.json` to the static output.
28
28
  * If a function, maps the value.
29
29
  */
30
- well_known_package_json?: boolean | Package_Json_Mapper;
30
+ well_known_package_json?: boolean | PackageJsonMapper;
31
31
 
32
32
  /**
33
33
  * If truthy, adds `/.well-known/src.json` and `/.well-known/src/` to the static output.
34
34
  * If a function, maps the value.
35
35
  */
36
- well_known_src_json?: boolean | Src_Json_Mapper;
36
+ well_known_src_json?: boolean | SrcJsonMapper;
37
37
 
38
38
  /**
39
39
  * If truthy, copies `src/` to `/.well-known/src/` to the static output.
40
40
  * Pass a function to customize which files get copied.
41
41
  */
42
- well_known_src_files?: boolean | Copy_File_Filter;
42
+ well_known_src_files?: boolean | CopyFileFilter;
43
43
  /**
44
44
  * The Vite CLI to use.
45
45
  */
46
46
  vite_cli?: string;
47
47
  }
48
48
 
49
- export type Host_Target = 'github_pages' | 'static' | 'node';
49
+ export type HostTarget = 'github_pages' | 'static' | 'node';
50
50
 
51
- export type Copy_File_Filter = (file_path: string) => boolean;
51
+ export type CopyFileFilter = (file_path: string) => boolean;
52
52
 
53
53
  export const gro_plugin_sveltekit_app = ({
54
54
  host_target = 'github_pages',
@@ -56,8 +56,8 @@ export const gro_plugin_sveltekit_app = ({
56
56
  well_known_src_json,
57
57
  well_known_src_files,
58
58
  vite_cli = VITE_CLI,
59
- }: Gro_Plugin_Sveltekit_App_Options = {}): Plugin => {
60
- let sveltekit_process: Spawned_Process | undefined = undefined;
59
+ }: GroPluginSveltekitAppOptions = {}): Plugin => {
60
+ let sveltekit_process: SpawnedProcess | undefined = undefined;
61
61
  return {
62
62
  name: 'gro_plugin_sveltekit_app',
63
63
  setup: async ({dev, watch, log, config}) => {
@@ -149,7 +149,7 @@ export const gro_plugin_sveltekit_app = ({
149
149
  const serialized_args = ['build', ...serialize_args(to_forwarded_args(vite_cli))];
150
150
  const spawned = await spawn_cli(found_vite_cli, serialized_args, log);
151
151
  if (!spawned?.ok) {
152
- throw new Task_Error(`${vite_cli} build failed with exit code ${spawned?.code}`);
152
+ throw new TaskError(`${vite_cli} build failed with exit code ${spawned?.code}`);
153
153
  }
154
154
  } catch (err) {
155
155
  cleanup();
@@ -175,7 +175,7 @@ const copy_temporarily = (
175
175
  source_path: string,
176
176
  dest_dir: string,
177
177
  dest_base_dir = '',
178
- filter?: Copy_File_Filter,
178
+ filter?: CopyFileFilter,
179
179
  ): Cleanup => {
180
180
  const path = join(dest_dir, dest_base_dir, source_path);
181
181
  const dir = dirname(path);
@@ -1,17 +1,17 @@
1
1
  import {print_spawn_result, spawn} from '@ryanatkn/belt/process.js';
2
2
 
3
3
  import type {Plugin} from './plugin.ts';
4
- import {Task_Error} from './task.ts';
4
+ import {TaskError} from './task.ts';
5
5
  import {load_package_json} from './package_json.ts';
6
- import {run_svelte_package, type Svelte_Package_Options} from './sveltekit_helpers.ts';
6
+ import {run_svelte_package, type SveltePackageOptions} from './sveltekit_helpers.ts';
7
7
  import {SVELTE_PACKAGE_CLI} from './constants.ts';
8
8
 
9
- export interface Gro_Plugin_Sveltekit_Library_Options {
9
+ export interface GroPluginSveltekitLibraryOptions {
10
10
  /**
11
11
  * The options passed to the SvelteKit packaging CLI.
12
12
  * @see https://kit.svelte.dev/docs/packaging#options
13
13
  */
14
- svelte_package_options?: Svelte_Package_Options;
14
+ svelte_package_options?: SveltePackageOptions;
15
15
  /**
16
16
  * The SvelteKit packaging CLI to use. Defaults to `svelte-package`.
17
17
  * @see https://kit.svelte.dev/docs/packaging
@@ -22,7 +22,7 @@ export interface Gro_Plugin_Sveltekit_Library_Options {
22
22
  export const gro_plugin_sveltekit_library = ({
23
23
  svelte_package_options,
24
24
  svelte_package_cli = SVELTE_PACKAGE_CLI,
25
- }: Gro_Plugin_Sveltekit_Library_Options = {}): Plugin => {
25
+ }: GroPluginSveltekitLibraryOptions = {}): Plugin => {
26
26
  const package_json = load_package_json();
27
27
 
28
28
  return {
@@ -52,7 +52,7 @@ export const gro_plugin_sveltekit_library = ({
52
52
  log.info(`linking`);
53
53
  const link_result = await spawn(config.pm_cli, ['link', '-f']); // TODO don't use `-f` unless necessary or at all?
54
54
  if (!link_result.ok) {
55
- throw new Task_Error(`Failed to link. ${print_spawn_result(link_result)}`);
55
+ throw new TaskError(`Failed to link. ${print_spawn_result(link_result)}`);
56
56
  }
57
57
  timing_to_link();
58
58
  }
package/src/lib/index.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /** @nodocs */
2
- export type {Gro_Config, Create_Gro_Config, Raw_Gro_Config} from './gro_config.ts';
2
+ export type {GroConfig, CreateGroConfig, RawGroConfig} from './gro_config.ts';
3
3
  /** @nodocs */
4
4
  export {type Plugin, replace_plugin} from './plugin.ts';
5
5
  /** @nodocs */
6
- export type {Gen, Gen_Context} from './gen.ts';
6
+ export type {Gen, GenContext} from './gen.ts';
7
7
  /** @nodocs */
8
- export {type Task, type Task_Context, Task_Error} from './task.ts';
8
+ export {type Task, type TaskContext, TaskError} from './task.ts';
@@ -3,18 +3,18 @@ import {existsSync, statSync} from 'node:fs';
3
3
  import {strip_start} from '@ryanatkn/belt/string.js';
4
4
  import {z} from 'zod';
5
5
  import type {Flavored} from '@ryanatkn/belt/types.js';
6
- import type {Path_Info, Path_Id, Resolved_Path} from '@ryanatkn/belt/path.js';
6
+ import type {PathInfo, PathId, ResolvedPath} from '@ryanatkn/belt/path.js';
7
7
 
8
8
  import {GRO_PACKAGE_DIR, GRO_DIST_DIR} from './paths.ts';
9
9
  import {search_fs} from './search_fs.ts';
10
10
  import {TASK_FILE_SUFFIX_JS} from './task.ts';
11
11
 
12
12
  // TODO Flavored doesn't work when used in schemas, use Zod brand instead? problem is ergonomics
13
- export const Input_Path = z.string();
14
- export type Input_Path = Flavored<z.infer<typeof Input_Path>, 'Input_Path'>;
13
+ export const InputPath = z.string();
14
+ export type InputPath = Flavored<z.infer<typeof InputPath>, 'InputPath'>;
15
15
 
16
- export const Raw_Input_Path = z.string();
17
- export type Raw_Input_Path = Flavored<z.infer<typeof Raw_Input_Path>, 'Raw_Input_Path'>;
16
+ export const RawInputPath = z.string();
17
+ export type RawInputPath = Flavored<z.infer<typeof RawInputPath>, 'RawInputPath'>;
18
18
 
19
19
  /**
20
20
  * Raw input paths are paths that users provide to Gro to reference files for tasks and gen.
@@ -29,26 +29,26 @@ export type Raw_Input_Path = Flavored<z.infer<typeof Raw_Input_Path>, 'Raw_Input
29
29
  * Thus, input paths are either absolute or implicitly relative.
30
30
  */
31
31
  export const to_input_path = (
32
- raw_input_path: Raw_Input_Path,
32
+ raw_input_path: RawInputPath,
33
33
  root_path = process.cwd(), // TODO @many isn't passed in anywhere, maybe hoist to `invoke_task` and others
34
- ): Input_Path => {
34
+ ): InputPath => {
35
35
  if (raw_input_path.startsWith(GRO_PACKAGE_DIR)) {
36
36
  return GRO_DIST_DIR + strip_start(raw_input_path, GRO_PACKAGE_DIR);
37
37
  } else if (raw_input_path[0] === '.') {
38
38
  return resolve(root_path, raw_input_path);
39
39
  }
40
- return raw_input_path as Input_Path;
40
+ return raw_input_path as InputPath;
41
41
  };
42
42
 
43
43
  export const to_input_paths = (
44
- raw_input_paths: Array<Raw_Input_Path>,
44
+ raw_input_paths: Array<RawInputPath>,
45
45
  root_path?: string, // TODO @many isn't passed in anywhere, maybe hoist to `invoke_task` and others
46
- ): Array<Input_Path> => raw_input_paths.map((p) => to_input_path(p, root_path));
46
+ ): Array<InputPath> => raw_input_paths.map((p) => to_input_path(p, root_path));
47
47
 
48
- export interface Possible_Path {
49
- id: Path_Id;
50
- input_path: Input_Path;
51
- root_dir: Path_Id;
48
+ export interface PossiblePath {
49
+ id: PathId;
50
+ input_path: InputPath;
51
+ root_dir: PathId;
52
52
  }
53
53
 
54
54
  /**
@@ -56,24 +56,24 @@ export interface Possible_Path {
56
56
  * duplicating each under `root_dirs`, without checking the filesystem.
57
57
  */
58
58
  export const get_possible_paths = (
59
- input_path: Input_Path,
60
- root_dirs: Array<Path_Id>,
59
+ input_path: InputPath,
60
+ root_dirs: Array<PathId>,
61
61
  extensions: Array<string>,
62
- ): Array<Possible_Path> => {
63
- const possible_paths: Set<Possible_Path> = new Set();
62
+ ): Array<PossiblePath> => {
63
+ const possible_paths: Set<PossiblePath> = new Set();
64
64
 
65
- const add_possible_paths = (path: string, root_dir: Path_Id) => {
65
+ const add_possible_paths = (path: string, root_dir: PathId) => {
66
66
  // Specifically for paths to the Gro package dist, optimize by only looking for `.task.js`.
67
67
  if (path.startsWith(GRO_DIST_DIR)) {
68
68
  possible_paths.add({
69
69
  id: (path.endsWith('/') || path.endsWith(TASK_FILE_SUFFIX_JS)
70
70
  ? path
71
- : path + TASK_FILE_SUFFIX_JS) as Path_Id,
71
+ : path + TASK_FILE_SUFFIX_JS) as PathId,
72
72
  input_path,
73
73
  root_dir,
74
74
  });
75
75
  } else {
76
- possible_paths.add({id: path as Path_Id, input_path, root_dir});
76
+ possible_paths.add({id: path as PathId, input_path, root_dir});
77
77
  if (!path.endsWith('/') && !extensions.some((e) => path.endsWith(e))) {
78
78
  for (const extension of extensions) {
79
79
  possible_paths.add({id: path + extension, input_path, root_dir});
@@ -99,23 +99,23 @@ export const get_possible_paths = (
99
99
  return Array.from(possible_paths);
100
100
  };
101
101
 
102
- export interface Resolved_Input_Path {
103
- input_path: Input_Path;
104
- id: Path_Id;
102
+ export interface ResolvedInputPath {
103
+ input_path: InputPath;
104
+ id: PathId;
105
105
  is_directory: boolean;
106
- root_dir: Path_Id;
106
+ root_dir: PathId;
107
107
  }
108
108
 
109
- export interface Resolved_Input_File {
110
- id: Path_Id;
111
- input_path: Input_Path;
112
- resolved_input_path: Resolved_Input_Path;
109
+ export interface ResolvedInputFile {
110
+ id: PathId;
111
+ input_path: InputPath;
112
+ resolved_input_path: ResolvedInputPath;
113
113
  }
114
114
 
115
- export interface Resolved_Input_Paths {
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>;
115
+ export interface ResolvedInputPaths {
116
+ resolved_input_paths: Array<ResolvedInputPath>;
117
+ possible_paths_by_input_path: Map<InputPath, Array<PossiblePath>>;
118
+ unmapped_input_paths: Array<InputPath>;
119
119
  }
120
120
 
121
121
  /**
@@ -124,16 +124,16 @@ 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: Array<Input_Path>,
128
- root_dirs: Array<Path_Id>,
127
+ input_paths: Array<InputPath>,
128
+ root_dirs: Array<PathId>,
129
129
  extensions: Array<string>,
130
- ): Resolved_Input_Paths => {
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> = [];
130
+ ): ResolvedInputPaths => {
131
+ const resolved_input_paths: Array<ResolvedInputPath> = [];
132
+ const possible_paths_by_input_path: Map<InputPath, Array<PossiblePath>> = new Map();
133
+ const unmapped_input_paths: Array<InputPath> = [];
134
134
  for (const input_path of input_paths) {
135
- let found_file: [Path_Info, Possible_Path] | null = null;
136
- let found_dirs: Array<[Path_Info, Possible_Path]> | null = null;
135
+ let found_file: [PathInfo, PossiblePath] | null = null;
136
+ let found_dirs: Array<[PathInfo, PossiblePath]> | null = null;
137
137
  const possible_paths = get_possible_paths(input_path, root_dirs, extensions);
138
138
  possible_paths_by_input_path.set(input_path, possible_paths);
139
139
 
@@ -176,10 +176,10 @@ export const resolve_input_paths = (
176
176
  };
177
177
  };
178
178
 
179
- export interface Resolved_Input_Files {
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>;
179
+ export interface ResolvedInputFiles {
180
+ resolved_input_files: Array<ResolvedInputFile>;
181
+ resolved_input_files_by_root_dir: Map<PathId, Array<ResolvedInputFile>>;
182
+ input_directories_with_no_files: Array<InputPath>;
183
183
  }
184
184
 
185
185
  /**
@@ -187,15 +187,15 @@ export interface Resolved_Input_Files {
187
187
  * De-dupes source ids.
188
188
  */
189
189
  export const resolve_input_files = (
190
- resolved_input_paths: Array<Resolved_Input_Path>,
191
- search: (dir: string) => Array<Resolved_Path> = search_fs,
192
- ): Resolved_Input_Files => {
193
- const resolved_input_files: Array<Resolved_Input_File> = [];
190
+ resolved_input_paths: Array<ResolvedInputPath>,
191
+ search: (dir: string) => Array<ResolvedPath> = search_fs,
192
+ ): ResolvedInputFiles => {
193
+ const resolved_input_files: Array<ResolvedInputFile> = [];
194
194
  // Add all input paths initially, and remove each when resolved to a file.
195
- const existing_path_ids: Set<Path_Id> = new Set();
195
+ const existing_path_ids: Set<PathId> = new Set();
196
196
 
197
197
  let remaining = resolved_input_paths.slice();
198
- const handle_found = (input_path: Input_Path, id: Path_Id) => {
198
+ const handle_found = (input_path: InputPath, id: PathId) => {
199
199
  remaining = remaining.filter(
200
200
  (r) => !(r.id === id || r.input_path === input_path || r.input_path === id), // `r.input_path === id` may be unnecessary
201
201
  );
@@ -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: Array<Path_Id> = [];
211
+ const path_ids: Array<PathId> = [];
212
212
  for (const {path, is_directory} of files) {
213
213
  if (is_directory) continue;
214
214
  const path_id = join(id, path);
@@ -219,9 +219,9 @@ 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: Array<Resolved_Input_File> = [];
222
+ const resolved_input_files_for_input_path: Array<ResolvedInputFile> = [];
223
223
  for (const path_id of path_ids) {
224
- const resolved_input_file: Resolved_Input_File = {
224
+ const resolved_input_file: ResolvedInputFile = {
225
225
  id: path_id,
226
226
  input_path,
227
227
  resolved_input_path,
@@ -233,7 +233,7 @@ export const resolve_input_files = (
233
233
  if (!existing_path_ids.has(id)) {
234
234
  // Handle input paths that resolve to files.
235
235
  existing_path_ids.add(id);
236
- const resolved_input_file: Resolved_Input_File = {id, input_path, resolved_input_path};
236
+ const resolved_input_file: ResolvedInputFile = {id, input_path, resolved_input_path};
237
237
  resolved_input_files.push(resolved_input_file);
238
238
  }
239
239
  handle_found(input_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, Array<Resolved_Input_File>>()),
252
+ }, new Map<PathId, Array<ResolvedInputFile>>()),
253
253
  input_directories_with_no_files: remaining.map((r) => r.input_path),
254
254
  };
255
255
  };
package/src/lib/invoke.ts CHANGED
@@ -19,8 +19,8 @@ and the rest of the args are forwarded to the task's `run` function.
19
19
 
20
20
  // handle uncaught errors
21
21
  attach_process_error_handlers(
22
- (err) => (err.constructor.name === 'Task_Error' ? 'Task_Error' : null),
23
- (err) => (err.constructor.name === 'Silent_Error' ? '' : null),
22
+ (err) => (err.constructor.name === 'TaskError' ? 'TaskError' : null),
23
+ (err) => (err.constructor.name === 'SilentError' ? '' : null),
24
24
  );
25
25
 
26
26
  if (!process.env.NO_COLOR) {
@@ -5,11 +5,11 @@ import {Logger} from '@ryanatkn/belt/log.js';
5
5
 
6
6
  import {to_forwarded_args, type Args} from './args.ts';
7
7
  import {run_task} from './run_task.ts';
8
- import {to_input_path, Raw_Input_Path} from './input_path.ts';
9
- import {find_tasks, load_tasks, Silent_Error} from './task.ts';
8
+ import {to_input_path, RawInputPath} from './input_path.ts';
9
+ import {find_tasks, load_tasks, SilentError} from './task.ts';
10
10
  import {load_gro_package_json} from './package_json.ts';
11
11
  import {log_tasks, log_error_reasons} from './task_logging.ts';
12
- import type {Gro_Config} from './gro_config.ts';
12
+ import type {GroConfig} from './gro_config.ts';
13
13
  import {Filer} from './filer.ts';
14
14
 
15
15
  /**
@@ -35,9 +35,9 @@ import {Filer} from './filer.ts';
35
35
  * @param initial_timings - The timings to use for the top-level task, `null` for composed tasks.
36
36
  */
37
37
  export const invoke_task = async (
38
- task_name: Raw_Input_Path,
38
+ task_name: RawInputPath,
39
39
  args: Args | undefined,
40
- config: Gro_Config,
40
+ config: GroConfig,
41
41
  initial_filer?: Filer,
42
42
  initial_timings?: Timings | null,
43
43
  parent_log?: Logger,
@@ -84,7 +84,7 @@ export const invoke_task = async (
84
84
  const found = find_tasks([input_path], task_root_dirs, config);
85
85
  if (!found.ok) {
86
86
  log_error_reasons(log, found.reasons);
87
- throw new Silent_Error();
87
+ throw new SilentError();
88
88
  }
89
89
 
90
90
  // Found a match either in the current working directory or Gro's directory.
@@ -95,7 +95,7 @@ export const invoke_task = async (
95
95
  const loaded = await load_tasks(found_tasks);
96
96
  if (!loaded.ok) {
97
97
  log_error_reasons(log, loaded.reasons);
98
- throw new Silent_Error();
98
+ throw new SilentError();
99
99
  }
100
100
  const loaded_tasks = loaded.value;
101
101
 
@@ -1,7 +1,7 @@
1
1
  import {print_spawn_result} from '@ryanatkn/belt/process.js';
2
2
  import {z} from 'zod';
3
3
 
4
- import {Task_Error, type Task} from './task.ts';
4
+ import {TaskError, type Task} from './task.ts';
5
5
  import {serialize_args, to_forwarded_args} from './args.ts';
6
6
  import {find_cli, spawn_cli} from './cli.ts';
7
7
 
@@ -32,7 +32,7 @@ export const task: Task<Args> = {
32
32
  const serialized_args = serialize_args(forwarded_args);
33
33
  const eslintResult = await spawn_cli(found_eslint_cli, serialized_args, log);
34
34
  if (!eslintResult?.ok) {
35
- throw new Task_Error(`ESLint found some problems. ${print_spawn_result(eslintResult!)}`);
35
+ throw new TaskError(`ESLint found some problems. ${print_spawn_result(eslintResult!)}`);
36
36
  }
37
37
  },
38
38
  };
@@ -1,37 +1,37 @@
1
1
  import type {Timings} from '@ryanatkn/belt/timings.js';
2
- import {Unreachable_Error} from '@ryanatkn/belt/error.js';
2
+ import {UnreachableError} from '@ryanatkn/belt/error.js';
3
3
  import type {Result} from '@ryanatkn/belt/result.js';
4
4
  import {print_error} from '@ryanatkn/belt/print.js';
5
5
  import {pathToFileURL} from 'node:url';
6
- import type {Path_Id} from '@ryanatkn/belt/path.js';
6
+ import type {PathId} from '@ryanatkn/belt/path.js';
7
7
 
8
- import type {Resolved_Input_File} from './input_path.ts';
8
+ import type {ResolvedInputFile} from './input_path.ts';
9
9
  import {print_path} from './paths.ts';
10
10
 
11
- export interface Module_Meta<T_Module extends Record<string, any> = Record<string, any>> {
12
- id: Path_Id;
13
- mod: T_Module;
11
+ export interface ModuleMeta<TModule extends Record<string, any> = Record<string, any>> {
12
+ id: PathId;
13
+ mod: TModule;
14
14
  }
15
15
 
16
- export type Load_Module_Result<T_Module> = Result<
17
- {id: Path_Id; mod: T_Module},
18
- Load_Module_Failure
16
+ export type LoadModuleResult<TModule> = Result<
17
+ {id: PathId; mod: TModule},
18
+ LoadModuleFailure
19
19
  >;
20
- export type Load_Module_Failure =
21
- | {ok: false; type: 'failed_import'; id: Path_Id; error: Error}
20
+ export type LoadModuleFailure =
21
+ | {ok: false; type: 'failed_import'; id: PathId; error: Error}
22
22
  | {
23
23
  ok: false;
24
24
  type: 'failed_validation';
25
- id: Path_Id;
25
+ id: PathId;
26
26
  mod: Record<string, any>;
27
27
  validation: string;
28
28
  };
29
29
 
30
- export const load_module = async <T_Module extends Record<string, any>>(
31
- id: Path_Id,
32
- validate?: (mod: Record<string, any>) => mod is T_Module,
30
+ export const load_module = async <TModule extends Record<string, any>>(
31
+ id: PathId,
32
+ validate?: (mod: Record<string, any>) => mod is TModule,
33
33
  bust_cache?: boolean,
34
- ): Promise<Load_Module_Result<T_Module>> => {
34
+ ): Promise<LoadModuleResult<TModule>> => {
35
35
  let mod;
36
36
  try {
37
37
  let import_path = id;
@@ -50,34 +50,34 @@ export const load_module = async <T_Module extends Record<string, any>>(
50
50
  return {ok: true, id, mod};
51
51
  };
52
52
 
53
- export interface Load_Modules_Failure<T_Module_Meta extends Module_Meta> {
53
+ export interface LoadModulesFailure<TModuleMeta extends ModuleMeta> {
54
54
  type: 'load_module_failures';
55
- load_module_failures: Array<Load_Module_Failure>;
55
+ load_module_failures: Array<LoadModuleFailure>;
56
56
  reasons: Array<string>;
57
57
  // still return the modules and timings, deferring to the caller
58
- modules: Array<T_Module_Meta>;
58
+ modules: Array<TModuleMeta>;
59
59
  }
60
60
 
61
- export type Load_Modules_Result<T_Module_Meta extends Module_Meta> = Result<
61
+ export type LoadModulesResult<TModuleMeta extends ModuleMeta> = Result<
62
62
  {
63
- modules: Array<T_Module_Meta>;
63
+ modules: Array<TModuleMeta>;
64
64
  },
65
- Load_Modules_Failure<T_Module_Meta>
65
+ LoadModulesFailure<TModuleMeta>
66
66
  >;
67
67
 
68
68
  // TODO parallelize and sort afterwards
69
69
  export const load_modules = async <
70
- T_Module extends Record<string, any>,
71
- T_Module_Meta extends Module_Meta<T_Module>,
70
+ TModule extends Record<string, any>,
71
+ TModuleMeta extends ModuleMeta<TModule>,
72
72
  >(
73
- resolved_input_files: Array<Resolved_Input_File>,
74
- validate: (mod: any) => mod is T_Module,
75
- map_module_meta: (resolved_input_file: Resolved_Input_File, mod: T_Module) => T_Module_Meta,
73
+ resolved_input_files: Array<ResolvedInputFile>,
74
+ validate: (mod: any) => mod is TModule,
75
+ map_module_meta: (resolved_input_file: ResolvedInputFile, mod: TModule) => TModuleMeta,
76
76
  timings?: Timings,
77
- ): Promise<Load_Modules_Result<T_Module_Meta>> => {
77
+ ): Promise<LoadModulesResult<TModuleMeta>> => {
78
78
  const timing_to_load_modules = timings?.start('load modules');
79
- const modules: Array<T_Module_Meta> = [];
80
- const load_module_failures: Array<Load_Module_Failure> = [];
79
+ const modules: Array<TModuleMeta> = [];
80
+ const load_module_failures: Array<LoadModuleFailure> = [];
81
81
  const reasons: Array<string> = [];
82
82
  for (const resolved_input_file of resolved_input_files.values()) {
83
83
  const {id, input_path} = resolved_input_file;
@@ -100,7 +100,7 @@ export const load_modules = async <
100
100
  break;
101
101
  }
102
102
  default:
103
- throw new Unreachable_Error(result);
103
+ throw new UnreachableError(result);
104
104
  }
105
105
  }
106
106
  }