@ryanatkn/gro 0.141.1 → 0.143.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 (114) hide show
  1. package/dist/build.task.js +1 -1
  2. package/dist/changeset.task.d.ts.map +1 -1
  3. package/dist/changeset.task.js +4 -4
  4. package/dist/check.task.d.ts.map +1 -1
  5. package/dist/check.task.js +4 -2
  6. package/dist/clean_fs.js +1 -1
  7. package/dist/cli.js +1 -1
  8. package/dist/{path_constants.d.ts → constants.d.ts} +4 -1
  9. package/dist/constants.d.ts.map +1 -0
  10. package/dist/{path_constants.js → constants.js} +3 -0
  11. package/dist/deploy.task.js +1 -1
  12. package/dist/dev.task.js +1 -1
  13. package/dist/esbuild_plugin_svelte.js +1 -1
  14. package/dist/esbuild_plugin_sveltekit_local_imports.js +1 -1
  15. package/dist/esbuild_plugin_sveltekit_shim_app.js +1 -1
  16. package/dist/esbuild_plugin_sveltekit_shim_env.js +1 -1
  17. package/dist/filer.d.ts +7 -0
  18. package/dist/filer.d.ts.map +1 -1
  19. package/dist/filer.js +28 -29
  20. package/dist/format.task.d.ts.map +1 -1
  21. package/dist/format.task.js +2 -2
  22. package/dist/format_directory.d.ts +1 -1
  23. package/dist/format_directory.d.ts.map +1 -1
  24. package/dist/format_directory.js +5 -6
  25. package/dist/gen.task.js +1 -1
  26. package/dist/gro_config.d.ts +12 -2
  27. package/dist/gro_config.d.ts.map +1 -1
  28. package/dist/gro_config.js +10 -6
  29. package/dist/gro_helpers.d.ts +1 -1
  30. package/dist/gro_helpers.d.ts.map +1 -1
  31. package/dist/gro_helpers.js +3 -3
  32. package/dist/gro_plugin_server.js +4 -4
  33. package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
  34. package/dist/gro_plugin_sveltekit_app.js +5 -5
  35. package/dist/gro_plugin_sveltekit_library.js +7 -7
  36. package/dist/loader.d.ts.map +1 -1
  37. package/dist/loader.js +23 -17
  38. package/dist/module.js +1 -1
  39. package/dist/moss_helpers.d.ts +1 -1
  40. package/dist/moss_helpers.d.ts.map +1 -1
  41. package/dist/moss_helpers.js +4 -3
  42. package/dist/package.d.ts +334 -172
  43. package/dist/package.d.ts.map +1 -1
  44. package/dist/package.js +51 -51
  45. package/dist/package_json.d.ts +9 -6
  46. package/dist/package_json.d.ts.map +1 -1
  47. package/dist/package_json.js +21 -6
  48. package/dist/package_meta.d.ts +1 -1
  49. package/dist/parse_imports.js +1 -1
  50. package/dist/paths.js +1 -1
  51. package/dist/publish.task.d.ts.map +1 -1
  52. package/dist/publish.task.js +7 -20
  53. package/dist/reinstall.task.js +11 -11
  54. package/dist/resolve_node_specifier.d.ts +7 -1
  55. package/dist/resolve_node_specifier.d.ts.map +1 -1
  56. package/dist/resolve_node_specifier.js +78 -14
  57. package/dist/resolve_specifier.d.ts +2 -6
  58. package/dist/resolve_specifier.d.ts.map +1 -1
  59. package/dist/resolve_specifier.js +2 -6
  60. package/dist/run_task.js +1 -1
  61. package/dist/src_json.d.ts +39 -3
  62. package/dist/src_json.d.ts.map +1 -1
  63. package/dist/sveltekit_config.d.ts +1 -1
  64. package/dist/sveltekit_config.d.ts.map +1 -1
  65. package/dist/sveltekit_config.js +1 -1
  66. package/dist/sveltekit_helpers.d.ts +3 -3
  67. package/dist/sveltekit_helpers.d.ts.map +1 -1
  68. package/dist/sveltekit_helpers.js +7 -7
  69. package/dist/sync.task.js +5 -5
  70. package/dist/upgrade.task.d.ts.map +1 -1
  71. package/dist/upgrade.task.js +4 -2
  72. package/dist/watch_dir.d.ts.map +1 -1
  73. package/dist/watch_dir.js +5 -5
  74. package/package.json +18 -18
  75. package/src/lib/build.task.ts +1 -1
  76. package/src/lib/changeset.task.ts +4 -3
  77. package/src/lib/check.task.ts +4 -2
  78. package/src/lib/clean_fs.ts +1 -1
  79. package/src/lib/cli.ts +1 -1
  80. package/src/lib/{path_constants.ts → constants.ts} +4 -0
  81. package/src/lib/deploy.task.ts +1 -1
  82. package/src/lib/dev.task.ts +1 -1
  83. package/src/lib/esbuild_plugin_svelte.ts +1 -1
  84. package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +1 -1
  85. package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +1 -1
  86. package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +1 -1
  87. package/src/lib/filer.ts +37 -27
  88. package/src/lib/format.task.ts +10 -2
  89. package/src/lib/format_directory.ts +10 -9
  90. package/src/lib/gen.task.ts +1 -1
  91. package/src/lib/gro_config.ts +23 -5
  92. package/src/lib/gro_helpers.ts +3 -2
  93. package/src/lib/gro_plugin_server.ts +4 -4
  94. package/src/lib/gro_plugin_sveltekit_app.ts +7 -5
  95. package/src/lib/gro_plugin_sveltekit_library.ts +7 -7
  96. package/src/lib/loader.ts +25 -17
  97. package/src/lib/module.ts +1 -1
  98. package/src/lib/moss_helpers.ts +4 -2
  99. package/src/lib/package.ts +51 -51
  100. package/src/lib/package_json.ts +23 -6
  101. package/src/lib/package_meta.ts +1 -1
  102. package/src/lib/parse_imports.ts +1 -1
  103. package/src/lib/paths.ts +1 -1
  104. package/src/lib/publish.task.ts +7 -22
  105. package/src/lib/reinstall.task.ts +11 -11
  106. package/src/lib/resolve_node_specifier.ts +100 -18
  107. package/src/lib/resolve_specifier.ts +2 -6
  108. package/src/lib/run_task.ts +1 -1
  109. package/src/lib/sveltekit_config.ts +2 -2
  110. package/src/lib/sveltekit_helpers.ts +7 -4
  111. package/src/lib/sync.task.ts +5 -5
  112. package/src/lib/upgrade.task.ts +4 -2
  113. package/src/lib/watch_dir.ts +6 -6
  114. package/dist/path_constants.d.ts.map +0 -1
@@ -14,26 +14,26 @@ export const Args = z
14
14
  gen: z.boolean({description: 'dual of no-gen'}).default(true),
15
15
  'no-gen': z.boolean({description: 'opt out of running gen'}).default(false),
16
16
  install: z.boolean({description: 'dual of no-install'}).default(true),
17
- 'no-install': z.boolean({description: 'opt out of `npm install`'}).default(false),
17
+ 'no-install': z.boolean({description: 'opt out of installing packages'}).default(false),
18
18
  })
19
19
  .strict();
20
20
  export type Args = z.infer<typeof Args>;
21
21
 
22
22
  export const task: Task<Args> = {
23
- summary: 'run `gro gen`, update `package.json`, and optionally `npm i` to sync up',
23
+ summary: 'run `gro gen`, update `package.json`, and optionally install packages to sync up',
24
24
  Args,
25
25
  run: async ({args, invoke_task, config, log}): Promise<void> => {
26
26
  const {sveltekit, package_json, gen, install} = args;
27
27
 
28
28
  if (install) {
29
- const result = await spawn('npm', ['i']);
29
+ const result = await spawn(config.pm_cli, ['install']);
30
30
  if (!result.ok) {
31
- throw new Task_Error('Failed npm install');
31
+ throw new Task_Error(`Failed \`${config.pm_cli} install\``);
32
32
  }
33
33
  }
34
34
 
35
35
  if (sveltekit) {
36
- await sveltekit_sync();
36
+ await sveltekit_sync(undefined, config.pm_cli);
37
37
  log.info('synced SvelteKit');
38
38
  }
39
39
 
@@ -5,6 +5,7 @@ import {Task_Error, type Task} from './task.js';
5
5
  import {extract_deps, load_package_json, type Package_Json_Dep} from './package_json.js';
6
6
  import {Git_Origin, git_pull} from './git.js';
7
7
  import {spawn_cli} from './cli.js';
8
+ import {serialize_args, to_forwarded_args} from './args.js';
8
9
 
9
10
  export const Args = z
10
11
  .object({
@@ -27,7 +28,7 @@ export type Args = z.infer<typeof Args>;
27
28
  export const task: Task<Args> = {
28
29
  summary: 'upgrade deps',
29
30
  Args,
30
- run: async ({args, log}): Promise<void> => {
31
+ run: async ({args, log, config}): Promise<void> => {
31
32
  const {_, only, origin, force, pull, dry} = args;
32
33
 
33
34
  if (_.length && only.length) {
@@ -65,7 +66,8 @@ export const task: Task<Args> = {
65
66
  if (force) {
66
67
  install_args.push('--force');
67
68
  }
68
- await spawn('npm', install_args);
69
+ install_args.push(...serialize_args(to_forwarded_args(config.pm_cli)));
70
+ await spawn(config.pm_cli, install_args);
69
71
 
70
72
  // Sync in a new process to pick up any changes after installing, avoiding some errors.
71
73
  await spawn_cli('gro', ['sync', '--no-install']); // don't install because we do above
@@ -1,6 +1,7 @@
1
1
  import {watch, type ChokidarOptions, type FSWatcher} from 'chokidar';
2
2
  import {relative} from 'node:path';
3
3
  import {statSync} from 'node:fs';
4
+ import {create_deferred, type Deferred} from '@ryanatkn/belt/async.js';
4
5
 
5
6
  import type {Path_Filter} from './path.js';
6
7
 
@@ -42,13 +43,12 @@ export const watch_dir = ({
42
43
  chokidar,
43
44
  }: Options): Watch_Node_Fs => {
44
45
  let watcher: FSWatcher | undefined;
45
- let initing: Promise<void> | undefined;
46
+ let initing: Deferred<void> | undefined;
46
47
 
47
48
  return {
48
49
  init: async () => {
49
- if (initing) return initing;
50
- let resolve: any;
51
- initing = new Promise((r) => (resolve = r)); // TODO `create_deferred`?// cwd: chokidar?.cwd ?? process.cwd()
50
+ if (initing) return initing.promise;
51
+ initing = create_deferred();
52
52
  watcher = watch(dir, {...chokidar});
53
53
  watcher.on('add', (path) => {
54
54
  const final_path = absolute ? path : relative(dir, path);
@@ -77,8 +77,8 @@ export const watch_dir = ({
77
77
  on_change({type: 'delete', path: final_path, is_directory: true});
78
78
  });
79
79
  // wait until ready
80
- watcher.once('ready', () => resolve());
81
- await initing;
80
+ watcher.once('ready', () => initing?.resolve());
81
+ await initing.promise;
82
82
  },
83
83
  close: async () => {
84
84
  initing = undefined;
@@ -1 +0,0 @@
1
- {"version":3,"file":"path_constants.d.ts","sourceRoot":"../src/lib/","sources":["path_constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAC9C,eAAO,MAAM,eAAe,QAAuB,CAAC;AACpD,eAAO,MAAM,UAAU,QAAuB,CAAC;AAC/C,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,eAAO,MAAM,WAAW,QAAwB,CAAC;AACjD,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAC5D,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AACnD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AACnD,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAC/C,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,eAAO,MAAM,yBAAyB,QAAkC,CAAC;AACzE,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD,eAAO,MAAM,UAAU,QAAwB,CAAC;AAChD,eAAO,MAAM,UAAU,QAAwB,CAAC;AAChD,eAAO,MAAM,YAAY,QAAY,CAAC;AACtC,eAAO,MAAM,kBAAkB,QAAO,CAAC"}