@ryanatkn/gro 0.175.0 → 0.177.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 (212) 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 +5 -1
  115. package/dist/run.task.d.ts.map +1 -1
  116. package/dist/run.task.js +25 -15
  117. package/dist/run_gen.d.ts +4 -4
  118. package/dist/run_gen.d.ts.map +1 -1
  119. package/dist/run_task.d.ts +4 -4
  120. package/dist/run_task.d.ts.map +1 -1
  121. package/dist/run_task.js +3 -3
  122. package/dist/search_fs.d.ts +6 -6
  123. package/dist/search_fs.d.ts.map +1 -1
  124. package/dist/src_json.d.ts +6 -6
  125. package/dist/src_json.d.ts.map +1 -1
  126. package/dist/src_json.js +3 -3
  127. package/dist/svelte_config.d.ts +3 -3
  128. package/dist/svelte_config.d.ts.map +1 -1
  129. package/dist/sveltekit_helpers.d.ts +5 -5
  130. package/dist/sveltekit_helpers.d.ts.map +1 -1
  131. package/dist/sveltekit_helpers.js +5 -5
  132. package/dist/sveltekit_shim_app.d.ts +2 -2
  133. package/dist/sveltekit_shim_app.d.ts.map +1 -1
  134. package/dist/sync.task.d.ts.map +1 -1
  135. package/dist/sync.task.js +2 -2
  136. package/dist/task.d.ts +54 -54
  137. package/dist/task.d.ts.map +1 -1
  138. package/dist/task.js +3 -3
  139. package/dist/task_logging.d.ts +3 -3
  140. package/dist/task_logging.d.ts.map +1 -1
  141. package/dist/test.task.d.ts.map +1 -1
  142. package/dist/test.task.js +4 -4
  143. package/dist/typecheck.task.d.ts.map +1 -1
  144. package/dist/typecheck.task.js +4 -4
  145. package/dist/upgrade.task.d.ts.map +1 -1
  146. package/dist/upgrade.task.js +5 -5
  147. package/dist/watch_dir.d.ts +10 -10
  148. package/dist/watch_dir.d.ts.map +1 -1
  149. package/package.json +3 -3
  150. package/src/lib/args.ts +9 -9
  151. package/src/lib/build.task.ts +2 -2
  152. package/src/lib/build_cache.ts +18 -18
  153. package/src/lib/changelog.ts +10 -10
  154. package/src/lib/changeset.task.ts +16 -16
  155. package/src/lib/changeset_helpers.ts +4 -4
  156. package/src/lib/check.task.ts +3 -3
  157. package/src/lib/clean.task.ts +2 -2
  158. package/src/lib/cli.ts +7 -7
  159. package/src/lib/commit.task.ts +2 -2
  160. package/src/lib/deploy.task.ts +15 -15
  161. package/src/lib/dev.task.ts +2 -2
  162. package/src/lib/disknode.ts +4 -4
  163. package/src/lib/esbuild_helpers.ts +2 -2
  164. package/src/lib/esbuild_plugin_external_worker.ts +7 -7
  165. package/src/lib/esbuild_plugin_svelte.ts +4 -4
  166. package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +2 -2
  167. package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +5 -5
  168. package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +2 -2
  169. package/src/lib/filer.ts +35 -35
  170. package/src/lib/format.task.ts +2 -2
  171. package/src/lib/format_directory.ts +2 -2
  172. package/src/lib/gen.task.ts +19 -19
  173. package/src/lib/gen.ts +85 -85
  174. package/src/lib/gen_helpers.ts +17 -17
  175. package/src/lib/github.ts +6 -6
  176. package/src/lib/gro.config.default.ts +2 -2
  177. package/src/lib/gro_config.ts +28 -28
  178. package/src/lib/gro_helpers.ts +2 -2
  179. package/src/lib/gro_plugin_gen.ts +5 -5
  180. package/src/lib/gro_plugin_server.ts +8 -8
  181. package/src/lib/gro_plugin_sveltekit_app.ts +15 -15
  182. package/src/lib/gro_plugin_sveltekit_library.ts +6 -6
  183. package/src/lib/index.ts +3 -3
  184. package/src/lib/input_path.ts +56 -56
  185. package/src/lib/invoke.ts +2 -2
  186. package/src/lib/invoke_task.ts +7 -7
  187. package/src/lib/lint.task.ts +2 -2
  188. package/src/lib/modules.ts +31 -31
  189. package/src/lib/package_json.ts +27 -27
  190. package/src/lib/parse_exports.ts +15 -15
  191. package/src/lib/parse_exports_context.ts +9 -9
  192. package/src/lib/parse_imports.ts +6 -6
  193. package/src/lib/paths.ts +6 -6
  194. package/src/lib/plugin.ts +17 -17
  195. package/src/lib/publish.task.ts +13 -13
  196. package/src/lib/reinstall.task.ts +4 -4
  197. package/src/lib/resolve_specifier.ts +5 -5
  198. package/src/lib/run.task.ts +28 -17
  199. package/src/lib/run_gen.ts +14 -14
  200. package/src/lib/run_task.ts +8 -8
  201. package/src/lib/search_fs.ts +13 -13
  202. package/src/lib/src_json.ts +13 -13
  203. package/src/lib/svelte_config.ts +2 -2
  204. package/src/lib/sveltekit_helpers.ts +12 -12
  205. package/src/lib/sveltekit_shim_app.ts +3 -3
  206. package/src/lib/sync.task.ts +2 -2
  207. package/src/lib/task.ts +63 -63
  208. package/src/lib/task_logging.ts +11 -11
  209. package/src/lib/test.task.ts +4 -4
  210. package/src/lib/typecheck.task.ts +4 -4
  211. package/src/lib/upgrade.task.ts +7 -7
  212. package/src/lib/watch_dir.ts +10 -10
@@ -1,7 +1,7 @@
1
1
  import {readFile, writeFile} from 'node:fs/promises';
2
2
  import {z} from 'zod';
3
3
  import type {Logger} from '@ryanatkn/belt/log.js';
4
- import type {Fetch_Value_Cache} from '@ryanatkn/belt/fetch.js';
4
+ import type {FetchValueCache} from '@ryanatkn/belt/fetch.js';
5
5
 
6
6
  import {github_fetch_commit_prs} from './github.ts';
7
7
 
@@ -18,7 +18,7 @@ export const update_changelog = async (
18
18
  path = 'CHANGELOG.md',
19
19
  token?: string,
20
20
  log?: Logger,
21
- cache: Fetch_Value_Cache = new Map(), // include a default cache to efficiently handle multiple changesets per commit
21
+ cache: FetchValueCache = new Map(), // include a default cache to efficiently handle multiple changesets per commit
22
22
  ): Promise<boolean> => {
23
23
  const contents = await readFile(path, 'utf8');
24
24
  const parsed = parse_changelog(contents);
@@ -32,22 +32,22 @@ export const update_changelog = async (
32
32
  };
33
33
 
34
34
  // keeping this really simple for now, no need to parse further for our current usecases
35
- const Parsed_Changelog = z.array(z.string());
36
- type Parsed_Changelog = z.infer<typeof Parsed_Changelog>;
37
- const parse_changelog = (contents: string): Parsed_Changelog => contents.split('\n');
38
- const serialize_changelog = (parsed: Parsed_Changelog): string => parsed.join('\n');
35
+ const ParsedChangelog = z.array(z.string());
36
+ type ParsedChangelog = z.infer<typeof ParsedChangelog>;
37
+ const parse_changelog = (contents: string): ParsedChangelog => contents.split('\n');
38
+ const serialize_changelog = (parsed: ParsedChangelog): string => parsed.join('\n');
39
39
 
40
40
  const LINE_WITH_SHA_MATCHER = /^- ([a-z0-9]{7,8}): /;
41
41
 
42
42
  const map_changelog = async (
43
- parsed: Parsed_Changelog,
43
+ parsed: ParsedChangelog,
44
44
  owner: string,
45
45
  repo: string,
46
46
  token?: string,
47
47
  log?: Logger,
48
- cache?: Fetch_Value_Cache,
49
- ): Promise<Parsed_Changelog> => {
50
- const mapped: Parsed_Changelog = [];
48
+ cache?: FetchValueCache,
49
+ ): Promise<ParsedChangelog> => {
50
+ const mapped: ParsedChangelog = [];
51
51
  for (const line of parsed) {
52
52
  const matches = LINE_WITH_SHA_MATCHER.exec(line);
53
53
  if (matches) {
@@ -6,19 +6,19 @@ import {readFile, writeFile} from 'node:fs/promises';
6
6
  import {join} from 'node:path';
7
7
  import {existsSync, readdirSync} from 'node:fs';
8
8
  import {
9
- Git_Origin,
9
+ GitOrigin,
10
10
  git_check_fully_staged_workspace,
11
11
  git_push_to_create,
12
12
  } from '@ryanatkn/belt/git.js';
13
13
 
14
- import {Task_Error, type Task} from './task.ts';
14
+ import {TaskError, type Task} from './task.ts';
15
15
  import {find_cli, spawn_cli} from './cli.ts';
16
16
  import {has_sveltekit_library} from './sveltekit_helpers.ts';
17
17
  import {
18
18
  CHANGESET_CLI,
19
19
  CHANGESET_DIR,
20
- Changeset_Access,
21
- Changeset_Bump,
20
+ ChangesetAccess,
21
+ ChangesetBump,
22
22
  CHANGESET_PUBLIC_ACCESS,
23
23
  CHANGESET_RESTRICTED_ACCESS,
24
24
  } from './changeset_helpers.ts';
@@ -37,7 +37,7 @@ export const Args = z.strictObject({
37
37
  minor: z.boolean().meta({description: 'bump the minor version'}).default(false),
38
38
  major: z.boolean().meta({description: 'bump the major version'}).default(false),
39
39
  dir: z.string().meta({description: 'changeset dir'}).default(CHANGESET_DIR),
40
- access: Changeset_Access.describe(
40
+ access: ChangesetAccess.describe(
41
41
  "changeset 'access' config value, the default depends on package.json#private",
42
42
  ).optional(),
43
43
  changelog: z
@@ -49,7 +49,7 @@ export const Args = z.strictObject({
49
49
  .boolean()
50
50
  .meta({description: 'opt out of installing the changelog package'})
51
51
  .default(false),
52
- origin: Git_Origin.describe('git origin to deploy to').default('origin'),
52
+ origin: GitOrigin.describe('git origin to deploy to').default('origin'),
53
53
  changeset_cli: z.string().meta({description: 'the changeset CLI to use'}).default(CHANGESET_CLI),
54
54
  });
55
55
  export type Args = z.infer<typeof Args>;
@@ -87,14 +87,14 @@ export const task: Task<Args> = {
87
87
  config,
88
88
  } = ctx;
89
89
 
90
- if (!message && (minor || major)) throw new Task_Error('cannot bump version without a message');
91
- if (minor && major) throw new Task_Error('cannot bump both minor and major');
90
+ if (!message && (minor || major)) throw new TaskError('cannot bump version without a message');
91
+ if (minor && major) throw new TaskError('cannot bump both minor and major');
92
92
 
93
- const bump: Changeset_Bump = minor ? 'minor' : major ? 'major' : 'patch';
93
+ const bump: ChangesetBump = minor ? 'minor' : major ? 'major' : 'patch';
94
94
 
95
95
  const found_changeset_cli = find_cli(changeset_cli);
96
96
  if (!found_changeset_cli) {
97
- throw new Task_Error(
97
+ throw new TaskError(
98
98
  'changeset command not found: install @changesets/cli locally or globally',
99
99
  );
100
100
  }
@@ -103,7 +103,7 @@ export const task: Task<Args> = {
103
103
 
104
104
  const has_sveltekit_library_result = await has_sveltekit_library(package_json, svelte_config);
105
105
  if (!has_sveltekit_library_result.ok) {
106
- throw new Task_Error(
106
+ throw new TaskError(
107
107
  'Failed to find SvelteKit library: ' + has_sveltekit_library_result.message,
108
108
  );
109
109
  }
@@ -165,7 +165,7 @@ const create_changeset_adder = (
165
165
  repo_name: string,
166
166
  dir: string,
167
167
  message: string,
168
- bump: Changeset_Bump,
168
+ bump: ChangesetBump,
169
169
  ) => {
170
170
  const filenames_before = readdirSync(dir);
171
171
  return async () => {
@@ -187,7 +187,7 @@ const create_changeset_adder = (
187
187
  const create_new_changeset = (
188
188
  repo_name: string,
189
189
  message: string,
190
- bump: Changeset_Bump,
190
+ bump: ChangesetBump,
191
191
  ): string => `---
192
192
  "${repo_name}": ${bump}
193
193
  ---
@@ -195,13 +195,13 @@ const create_new_changeset = (
195
195
  ${message}
196
196
  `;
197
197
 
198
- type Changeset_Callback = (config: WrittenConfig) => WrittenConfig | Promise<WrittenConfig>;
198
+ type ChangesetCallback = (config: WrittenConfig) => WrittenConfig | Promise<WrittenConfig>;
199
199
 
200
- type Update_Written_Config = (path: string, cb: Changeset_Callback) => Promise<boolean>;
200
+ type UpdateWrittenConfig = (path: string, cb: ChangesetCallback) => Promise<boolean>;
201
201
 
202
202
  // TODO refactor all of this with zod and package_json helpers - util file helper? JSON parse pluggable
203
203
 
204
- const update_changeset_config: Update_Written_Config = async (path, cb) => {
204
+ const update_changeset_config: UpdateWrittenConfig = async (path, cb) => {
205
205
  const config_contents = await load_changeset_config_contents(path);
206
206
  const config = parse_changeset_config(config_contents);
207
207
 
@@ -3,12 +3,12 @@ import {z} from 'zod';
3
3
  export const CHANGESET_RESTRICTED_ACCESS = 'restricted';
4
4
  export const CHANGESET_PUBLIC_ACCESS = 'public';
5
5
 
6
- export const Changeset_Access = z.enum([CHANGESET_RESTRICTED_ACCESS, CHANGESET_PUBLIC_ACCESS]);
7
- export type Changeset_Access = z.infer<typeof Changeset_Access>;
6
+ export const ChangesetAccess = z.enum([CHANGESET_RESTRICTED_ACCESS, CHANGESET_PUBLIC_ACCESS]);
7
+ export type ChangesetAccess = z.infer<typeof ChangesetAccess>;
8
8
 
9
9
  export const CHANGESET_CLI = 'changeset';
10
10
 
11
11
  export const CHANGESET_DIR = '.changeset';
12
12
 
13
- export const Changeset_Bump = z.enum(['patch', 'minor', 'major']);
14
- export type Changeset_Bump = z.infer<typeof Changeset_Bump>;
13
+ export const ChangesetBump = z.enum(['patch', 'minor', 'major']);
14
+ export type ChangesetBump = z.infer<typeof ChangesetBump>;
@@ -3,7 +3,7 @@ import {spawn} from '@ryanatkn/belt/process.js';
3
3
  import {styleText as st} from 'node:util';
4
4
  import {git_check_clean_workspace} from '@ryanatkn/belt/git.js';
5
5
 
6
- import {Task_Error, type Task} from './task.ts';
6
+ import {TaskError, type Task} from './task.ts';
7
7
  import {sync_package_json} from './package_json.ts';
8
8
 
9
9
  /** @nodocs */
@@ -64,7 +64,7 @@ export const task: Task<Args> = {
64
64
  if (package_json && config.map_package_json) {
65
65
  const {changed} = await sync_package_json(config.map_package_json, log, false);
66
66
  if (changed) {
67
- throw new Task_Error('package.json is out of date, run `gro sync` to update it');
67
+ throw new TaskError('package.json is out of date, run `gro sync` to update it');
68
68
  } else {
69
69
  log.info('check passed for package.json');
70
70
  }
@@ -86,7 +86,7 @@ export const task: Task<Args> = {
86
86
  if (error_message) {
87
87
  log.error(st('red', 'git status'));
88
88
  await spawn('git', ['status']);
89
- throw new Task_Error(
89
+ throw new TaskError(
90
90
  'Failed check for git_check_clean_workspace:' +
91
91
  error_message +
92
92
  ' - do you need to run `gro sync` or commit some files?',
@@ -1,6 +1,6 @@
1
1
  import {spawn} from '@ryanatkn/belt/process.js';
2
2
  import {z} from 'zod';
3
- import {Git_Origin} from '@ryanatkn/belt/git.js';
3
+ import {GitOrigin} from '@ryanatkn/belt/git.js';
4
4
 
5
5
  import type {Task} from './task.ts';
6
6
  import {clean_fs} from './clean_fs.ts';
@@ -21,7 +21,7 @@ export const Args = z.strictObject({
21
21
  'run "git remote prune" to delete local branches referencing nonexistent remote branches',
22
22
  })
23
23
  .default(false),
24
- git_origin: Git_Origin.describe('the origin to "git remote prune"').default('origin'),
24
+ git_origin: GitOrigin.describe('the origin to "git remote prune"').default('origin'),
25
25
  });
26
26
  export type Args = z.infer<typeof Args>;
27
27
 
package/src/lib/cli.ts CHANGED
@@ -2,14 +2,14 @@ import {spawnSync, type SpawnOptions} from 'node:child_process';
2
2
  import {
3
3
  spawn,
4
4
  spawn_process,
5
- type Spawn_Result,
6
- type Spawned_Process,
5
+ type SpawnResult,
6
+ type SpawnedProcess,
7
7
  } from '@ryanatkn/belt/process.js';
8
8
  import {join} from 'node:path';
9
9
  import {existsSync} from 'node:fs';
10
10
  import {fileURLToPath, type URL} from 'node:url';
11
11
  import type {Logger} from '@ryanatkn/belt/log.js';
12
- import type {Path_Id} from '@ryanatkn/belt/path.js';
12
+ import type {PathId} from '@ryanatkn/belt/path.js';
13
13
 
14
14
  import {NODE_MODULES_DIRNAME} from './constants.ts';
15
15
  import {print_command_args} from './args.ts';
@@ -17,8 +17,8 @@ import {print_command_args} from './args.ts';
17
17
  // TODO maybe upstream to Belt?
18
18
 
19
19
  export type Cli =
20
- | {kind: 'local'; name: string; id: Path_Id}
21
- | {kind: 'global'; name: string; id: Path_Id};
20
+ | {kind: 'local'; name: string; id: PathId}
21
+ | {kind: 'global'; name: string; id: PathId};
22
22
 
23
23
  /**
24
24
  * Searches the filesystem for the CLI `name`, first local to the cwd and then globally.
@@ -50,7 +50,7 @@ export const spawn_cli = async (
50
50
  args: Array<string> = [],
51
51
  log?: Logger,
52
52
  options?: SpawnOptions,
53
- ): Promise<Spawn_Result | undefined> => {
53
+ ): Promise<SpawnResult | undefined> => {
54
54
  const cli = resolve_cli(name_or_cli, args, options?.cwd, log, options);
55
55
  if (!cli) return;
56
56
  return spawn(cli.id, args, options);
@@ -66,7 +66,7 @@ export const spawn_cli_process = (
66
66
  args: Array<string> = [],
67
67
  log?: Logger,
68
68
  options?: SpawnOptions,
69
- ): Spawned_Process | undefined => {
69
+ ): SpawnedProcess | undefined => {
70
70
  const cli = resolve_cli(name_or_cli, args, options?.cwd, log, options);
71
71
  if (!cli) return;
72
72
  return spawn_process(cli.id, args, options);
@@ -1,6 +1,6 @@
1
1
  import {spawn} from '@ryanatkn/belt/process.js';
2
2
  import {z} from 'zod';
3
- import {Git_Origin, git_current_branch_name, git_push} from '@ryanatkn/belt/git.js';
3
+ import {GitOrigin, git_current_branch_name, git_push} from '@ryanatkn/belt/git.js';
4
4
 
5
5
  import type {Task} from './task.ts';
6
6
 
@@ -12,7 +12,7 @@ export const Args = z.strictObject({
12
12
  description: 'the git commit message, the same as git commit -m or --message',
13
13
  })
14
14
  .default([]),
15
- origin: Git_Origin.describe('git origin to commit to').default('origin'),
15
+ origin: GitOrigin.describe('git origin to commit to').default('origin'),
16
16
  });
17
17
  export type Args = z.infer<typeof Args>;
18
18
 
@@ -10,8 +10,8 @@ import {
10
10
  git_checkout,
11
11
  git_local_branch_exists,
12
12
  git_remote_branch_exists,
13
- Git_Origin,
14
- Git_Branch,
13
+ GitOrigin,
14
+ GitBranch,
15
15
  git_delete_local_branch,
16
16
  git_push_to_create,
17
17
  git_reset_branch_to_first_commit,
@@ -23,7 +23,7 @@ import {
23
23
  } from '@ryanatkn/belt/git.js';
24
24
  import {fs_empty_dir} from '@ryanatkn/belt/fs.js';
25
25
 
26
- import {Task_Error, type Task} from './task.ts';
26
+ import {TaskError, type Task} from './task.ts';
27
27
  import {print_path} from './paths.ts';
28
28
  import {GRO_DIRNAME, GIT_DIRNAME, SVELTEKIT_BUILD_DIRNAME} from './constants.ts';
29
29
 
@@ -42,9 +42,9 @@ const DANGEROUS_BRANCHES = [SOURCE_BRANCH, 'master'];
42
42
 
43
43
  /** @nodocs */
44
44
  export const Args = z.strictObject({
45
- source: Git_Branch.describe('git source branch to build and deploy from').default(SOURCE_BRANCH),
46
- target: Git_Branch.describe('git target branch to deploy to').default(TARGET_BRANCH),
47
- origin: Git_Origin.describe('git origin to deploy to').default('origin'),
45
+ source: GitBranch.describe('git source branch to build and deploy from').default(SOURCE_BRANCH),
46
+ target: GitBranch.describe('git target branch to deploy to').default(TARGET_BRANCH),
47
+ origin: GitOrigin.describe('git origin to deploy to').default('origin'),
48
48
  deploy_dir: z.string().meta({description: 'the deploy output directory'}).default(DEPLOY_DIR),
49
49
  build_dir: z
50
50
  .string()
@@ -98,7 +98,7 @@ export const task: Task<Args> = {
98
98
 
99
99
  // Checks
100
100
  if (!force && target !== TARGET_BRANCH) {
101
- throw new Task_Error(
101
+ throw new TaskError(
102
102
  `Warning! You are deploying to a custom target branch '${target}',` +
103
103
  ` instead of the default '${TARGET_BRANCH}' branch.` +
104
104
  ` This is destructive to your '${target}' branch!` +
@@ -107,7 +107,7 @@ export const task: Task<Args> = {
107
107
  );
108
108
  }
109
109
  if (!dangerous && DANGEROUS_BRANCHES.includes(target)) {
110
- throw new Task_Error(
110
+ throw new TaskError(
111
111
  `Warning! You are deploying to a custom target branch '${target}'` +
112
112
  ` and that appears very dangerous: it is destructive to your '${target}' branch!` +
113
113
  ` If you understand and are OK with deleting your branch '${target}',` +
@@ -116,12 +116,12 @@ export const task: Task<Args> = {
116
116
  }
117
117
  const clean_error_message = await git_check_clean_workspace();
118
118
  if (clean_error_message) {
119
- throw new Task_Error(
119
+ throw new TaskError(
120
120
  'Deploy failed because the git workspace has uncommitted changes: ' + clean_error_message,
121
121
  );
122
122
  }
123
123
  if (!(await git_check_setting_pull_rebase())) {
124
- throw new Task_Error(
124
+ throw new TaskError(
125
125
  'Deploying currently requires `git config --global pull.rebase true`,' +
126
126
  ' but this restriction could be lifted with more work',
127
127
  );
@@ -138,7 +138,7 @@ export const task: Task<Args> = {
138
138
  await git_pull(origin, source);
139
139
  }
140
140
  if (await git_check_clean_workspace()) {
141
- throw new Task_Error(
141
+ throw new TaskError(
142
142
  'Deploy failed because the local source branch is out of sync with the remote one,' +
143
143
  ' finish rebasing manually or reset with `git rebase --abort`',
144
144
  );
@@ -177,7 +177,7 @@ export const task: Task<Args> = {
177
177
  // It may not exist, or it may have been deleted after failing to sync above.
178
178
  if (!existsSync(resolved_deploy_dir)) {
179
179
  const local_deploy_branch_exists = await git_local_branch_exists(target);
180
- await git_fetch(origin, ('+' + target + ':' + target) as Git_Branch); // fetch+merge and allow non-fastforward updates with the +
180
+ await git_fetch(origin, ('+' + target + ':' + target) as GitBranch); // fetch+merge and allow non-fastforward updates with the +
181
181
  await git_clone_locally(origin, target, dir, resolved_deploy_dir);
182
182
  // Clean up if we created the target branch in the cwd
183
183
  if (!local_deploy_branch_exists) {
@@ -234,12 +234,12 @@ export const task: Task<Args> = {
234
234
  if (dry) {
235
235
  log.info(st('red', 'dry deploy failed'));
236
236
  }
237
- throw new Task_Error(`Deploy safely canceled due to build failure. See the error above.`);
237
+ throw new TaskError(`Deploy safely canceled due to build failure. See the error above.`);
238
238
  }
239
239
 
240
240
  // Verify build output exists
241
241
  if (!existsSync(build_dir)) {
242
- throw new Task_Error(`Directory to deploy does not exist after building: ${build_dir}`);
242
+ throw new TaskError(`Directory to deploy does not exist after building: ${build_dir}`);
243
243
  }
244
244
 
245
245
  // Copy the build
@@ -262,7 +262,7 @@ export const task: Task<Args> = {
262
262
  await spawn('git', ['push', origin, target, '-f'], target_spawn_options); // force push because we may be resetting the branch, see the checks above to make this safer
263
263
  } catch (err) {
264
264
  log.error(st('red', 'updating git failed:'), print_error(err));
265
- throw new Task_Error(`Deploy failed in a bad state: built but not pushed, see error above.`);
265
+ throw new TaskError(`Deploy failed in a bad state: built but not pushed, see error above.`);
266
266
  }
267
267
 
268
268
  log.info(st('green', 'deployed')); // TODO log a different message if "Everything up-to-date"
@@ -1,7 +1,7 @@
1
1
  import {z} from 'zod';
2
2
 
3
3
  import type {Task} from './task.ts';
4
- import {Plugins, type Plugin_Context} from './plugin.ts';
4
+ import {Plugins, type PluginContext} from './plugin.ts';
5
5
  import {clean_fs} from './clean_fs.ts';
6
6
 
7
7
  /** @nodocs */
@@ -19,7 +19,7 @@ export const Args = z.strictObject({
19
19
  });
20
20
  export type Args = z.infer<typeof Args>;
21
21
 
22
- export type DevTask_Context = Plugin_Context<Args>;
22
+ export type DevTask_Context = PluginContext<Args>;
23
23
 
24
24
  /** @nodocs */
25
25
  export const task: Task<Args> = {
@@ -1,9 +1,9 @@
1
- import type {Path_Id} from '@ryanatkn/belt/path.js';
1
+ import type {PathId} from '@ryanatkn/belt/path.js';
2
2
 
3
3
  // TODO extract more here from Filer
4
4
 
5
5
  export interface Disknode {
6
- id: Path_Id;
6
+ id: PathId;
7
7
  // TODO figure out the best API that makes this lazy
8
8
  /**
9
9
  * `null` contents means it doesn't exist.
@@ -16,6 +16,6 @@ export interface Disknode {
16
16
  external: boolean;
17
17
  ctime: number | null;
18
18
  mtime: number | null;
19
- dependents: Map<Path_Id, Disknode>;
20
- dependencies: Map<Path_Id, Disknode>;
19
+ dependents: Map<PathId, Disknode>;
20
+ dependencies: Map<PathId, Disknode>;
21
21
  }
@@ -2,7 +2,7 @@ import {styleText as st} from 'node:util';
2
2
  import type {Logger} from '@ryanatkn/belt/log.js';
3
3
  import type * as esbuild from 'esbuild';
4
4
 
5
- import type {Parsed_Svelte_Config} from './svelte_config.ts';
5
+ import type {ParsedSvelteConfig} from './svelte_config.ts';
6
6
 
7
7
  export const print_build_result = (log: Logger, build_result: esbuild.BuildResult): void => {
8
8
  for (const error of build_result.errors) {
@@ -28,7 +28,7 @@ const import_meta_env = 'import.' + 'meta.env.'; // eslint-disable-line no-usele
28
28
  */
29
29
  export const to_define_import_meta_env = (
30
30
  dev: boolean,
31
- base_url: Parsed_Svelte_Config['base_url'],
31
+ base_url: ParsedSvelteConfig['base_url'],
32
32
  ssr = true,
33
33
  mode = dev ? 'development' : 'production',
34
34
  ): Record<string, string> => ({
@@ -2,7 +2,7 @@ import * as esbuild from 'esbuild';
2
2
  import type {Logger} from '@ryanatkn/belt/log.js';
3
3
  import {basename} from 'node:path';
4
4
  import type {CompileOptions, ModuleCompileOptions, PreprocessorGroup} from 'svelte/compiler';
5
- import type {Path_Id} from '@ryanatkn/belt/path.js';
5
+ import type {PathId} from '@ryanatkn/belt/path.js';
6
6
 
7
7
  import {print_build_result, to_define_import_meta_env} from './esbuild_helpers.ts';
8
8
  import {resolve_specifier} from './resolve_specifier.ts';
@@ -11,9 +11,9 @@ import {esbuild_plugin_sveltekit_shim_env} from './esbuild_plugin_sveltekit_shim
11
11
  import {esbuild_plugin_sveltekit_shim_app} from './esbuild_plugin_sveltekit_shim_app.ts';
12
12
  import {esbuild_plugin_sveltekit_local_imports} from './esbuild_plugin_sveltekit_local_imports.ts';
13
13
  import {esbuild_plugin_svelte} from './esbuild_plugin_svelte.ts';
14
- import type {Parsed_Svelte_Config} from './svelte_config.ts';
14
+ import type {ParsedSvelteConfig} from './svelte_config.ts';
15
15
 
16
- export interface Esbuild_Plugin_External_Worker_Options {
16
+ export interface EsbuildPluginExternalWorkerOptions {
17
17
  dev: boolean;
18
18
  build_options: esbuild.BuildOptions;
19
19
  dir?: string;
@@ -21,8 +21,8 @@ export interface Esbuild_Plugin_External_Worker_Options {
21
21
  svelte_compile_module_options?: ModuleCompileOptions;
22
22
  svelte_preprocessors?: PreprocessorGroup | Array<PreprocessorGroup>;
23
23
  alias?: Record<string, string>;
24
- base_url?: Parsed_Svelte_Config['base_url'];
25
- assets_url?: Parsed_Svelte_Config['assets_url'];
24
+ base_url?: ParsedSvelteConfig['base_url'];
25
+ assets_url?: ParsedSvelteConfig['assets_url'];
26
26
  public_prefix?: string;
27
27
  private_prefix?: string;
28
28
  env_dir?: string;
@@ -47,11 +47,11 @@ export const esbuild_plugin_external_worker = ({
47
47
  env_files,
48
48
  ambient_env,
49
49
  log,
50
- }: Esbuild_Plugin_External_Worker_Options): esbuild.Plugin => ({
50
+ }: EsbuildPluginExternalWorkerOptions): esbuild.Plugin => ({
51
51
  name: 'external_worker',
52
52
  setup: (build) => {
53
53
  const builds: Map<string, Promise<esbuild.BuildResult>> = new Map();
54
- const build_worker = async (path_id: Path_Id): Promise<esbuild.BuildResult> => {
54
+ const build_worker = async (path_id: PathId): Promise<esbuild.BuildResult> => {
55
55
  if (builds.has(path_id)) return builds.get(path_id)!;
56
56
  const building = esbuild.build({
57
57
  entryPoints: [path_id],
@@ -14,13 +14,13 @@ import {to_define_import_meta_env, default_ts_transform_options} from './esbuild
14
14
  import {
15
15
  default_svelte_config,
16
16
  to_default_compile_module_options,
17
- type Parsed_Svelte_Config,
17
+ type ParsedSvelteConfig,
18
18
  } from './svelte_config.ts';
19
19
  import {TS_MATCHER, SVELTE_MATCHER, SVELTE_RUNES_MATCHER} from './constants.ts';
20
20
 
21
- export interface Esbuild_Plugin_Svelte_Options {
21
+ export interface EsbuildPluginSvelteOptions {
22
22
  dev: boolean;
23
- base_url: Parsed_Svelte_Config['base_url'];
23
+ base_url: ParsedSvelteConfig['base_url'];
24
24
  dir?: string;
25
25
  svelte_compile_options?: CompileOptions;
26
26
  svelte_compile_module_options?: ModuleCompileOptions;
@@ -29,7 +29,7 @@ export interface Esbuild_Plugin_Svelte_Options {
29
29
  is_ts?: (filename: string) => boolean;
30
30
  }
31
31
 
32
- export const esbuild_plugin_svelte = (options: Esbuild_Plugin_Svelte_Options): esbuild.Plugin => {
32
+ export const esbuild_plugin_svelte = (options: EsbuildPluginSvelteOptions): esbuild.Plugin => {
33
33
  const {
34
34
  dev,
35
35
  base_url,
@@ -2,7 +2,7 @@ import type * as esbuild from 'esbuild';
2
2
  import {escape_regexp} from '@ryanatkn/belt/regexp.js';
3
3
  import {join} from 'node:path';
4
4
 
5
- export interface Esbuild_Plugin_Sveltekit_Shim_Alias_Options {
5
+ export interface EsbuildPluginSveltekitShimAliasOptions {
6
6
  dir?: string;
7
7
  alias?: Record<string, string>;
8
8
  }
@@ -10,7 +10,7 @@ export interface Esbuild_Plugin_Sveltekit_Shim_Alias_Options {
10
10
  export const esbuild_plugin_sveltekit_shim_alias = ({
11
11
  dir = process.cwd(),
12
12
  alias,
13
- }: Esbuild_Plugin_Sveltekit_Shim_Alias_Options): esbuild.Plugin => ({
13
+ }: EsbuildPluginSveltekitShimAliasOptions): esbuild.Plugin => ({
14
14
  name: 'sveltekit_shim_alias',
15
15
  setup: (build) => {
16
16
  const aliases: Record<string, string> = {$lib: 'src/lib', ...alias};
@@ -5,20 +5,20 @@ import {
5
5
  render_sveltekit_shim_app_paths,
6
6
  sveltekit_shim_app_specifiers,
7
7
  } from './sveltekit_shim_app.ts';
8
- import type {Parsed_Svelte_Config} from './svelte_config.ts';
8
+ import type {ParsedSvelteConfig} from './svelte_config.ts';
9
9
  import {EVERYTHING_MATCHER} from './constants.ts';
10
10
 
11
- export interface Esbuild_Plugin_Sveltekit_Shim_App_Options {
11
+ export interface EsbuildPluginSveltekitShimAppOptions {
12
12
  dev: boolean;
13
- base_url: Parsed_Svelte_Config['base_url'];
14
- assets_url: Parsed_Svelte_Config['assets_url'];
13
+ base_url: ParsedSvelteConfig['base_url'];
14
+ assets_url: ParsedSvelteConfig['assets_url'];
15
15
  }
16
16
 
17
17
  export const esbuild_plugin_sveltekit_shim_app = ({
18
18
  dev,
19
19
  base_url,
20
20
  assets_url,
21
- }: Esbuild_Plugin_Sveltekit_Shim_App_Options): esbuild.Plugin => ({
21
+ }: EsbuildPluginSveltekitShimAppOptions): esbuild.Plugin => ({
22
22
  name: 'sveltekit_shim_app',
23
23
  setup: (build) => {
24
24
  build.onResolve({filter: /^\$app\/(forms|navigation|stores)$/}, ({path, ...rest}) =>
@@ -3,7 +3,7 @@ import type * as esbuild from 'esbuild';
3
3
  import {render_env_shim_module} from './sveltekit_shim_env.ts';
4
4
  import {SVELTEKIT_ENV_MATCHER, EVERYTHING_MATCHER} from './constants.ts';
5
5
 
6
- export interface Esbuild_Plugin_Sveltekit_Shim_Env_Options {
6
+ export interface EsbuildPluginSveltekitShimEnvOptions {
7
7
  dev: boolean;
8
8
  public_prefix?: string;
9
9
  private_prefix?: string;
@@ -21,7 +21,7 @@ export const esbuild_plugin_sveltekit_shim_env = ({
21
21
  env_dir,
22
22
  env_files,
23
23
  ambient_env,
24
- }: Esbuild_Plugin_Sveltekit_Shim_Env_Options): esbuild.Plugin => ({
24
+ }: EsbuildPluginSveltekitShimEnvOptions): esbuild.Plugin => ({
25
25
  name: 'sveltekit_shim_env',
26
26
  setup: (build) => {
27
27
  build.onResolve({filter: SVELTEKIT_ENV_MATCHER}, ({path}) => ({path, namespace}));