@ryanatkn/gro 0.125.0 → 0.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/args.js CHANGED
@@ -1,4 +1,4 @@
1
- import { gray, magenta } from 'kleur/colors';
1
+ import { gray, magenta } from '@ryanatkn/belt/styletext.js';
2
2
  import mri from 'mri';
3
3
  /**
4
4
  * Parses user input args with a Zod schema.
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { spawn } from '@ryanatkn/belt/process.js';
3
- import { red, blue } from 'kleur/colors';
3
+ import { red, blue } from '@ryanatkn/belt/styletext.js';
4
4
  import { readFile, writeFile } from 'node:fs/promises';
5
5
  import { join } from 'node:path';
6
6
  import { existsSync, readdirSync } from 'node:fs';
@@ -51,7 +51,7 @@ export const task = {
51
51
  if (minor && major)
52
52
  throw new Task_Error('cannot bump both minor and major');
53
53
  const bump = minor ? 'minor' : major ? 'major' : 'patch';
54
- const found_changeset_cli = await find_cli(changeset_cli);
54
+ const found_changeset_cli = find_cli(changeset_cli);
55
55
  if (!found_changeset_cli) {
56
56
  throw new Task_Error('changeset command not found: install @changesets/cli locally or globally');
57
57
  }
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { spawn } from '@ryanatkn/belt/process.js';
3
- import { red } from 'kleur/colors';
3
+ import { red } from '@ryanatkn/belt/styletext.js';
4
4
  import { Task_Error } from './task.js';
5
5
  import { git_check_clean_workspace } from './git.js';
6
6
  import { sync_package_json } from './package_json.js';
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { SpawnOptions } from 'node:child_process';
1
+ import { type SpawnOptions } from 'node:child_process';
2
2
  import { type Spawn_Result, type Spawned_Process } from '@ryanatkn/belt/process.js';
3
3
  import type { Path_Id } from './path.js';
4
4
  export type Cli = {
@@ -14,7 +14,7 @@ export type Cli = {
14
14
  * Searches the filesystem for the CLI `name`, first local to the cwd and then globally.
15
15
  * @returns `null` if not found locally or globally
16
16
  */
17
- export declare const find_cli: (name: string, cwd?: string | URL) => Promise<Cli | null>;
17
+ export declare const find_cli: (name: string, cwd?: string | URL, options?: SpawnOptions | undefined) => Cli | null;
18
18
  /**
19
19
  * Spawns a CLI if available using Belt's `spawn`.
20
20
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
@@ -26,6 +26,6 @@ export declare const spawn_cli: (name_or_cli: string | Cli, args?: string[], log
26
26
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
27
27
  * @returns `undefined` if no CLI is found, or the spawn result
28
28
  */
29
- export declare const spawn_cli_process: (name_or_cli: string | Cli, args?: string[], log?: any, options?: SpawnOptions | undefined) => Promise<Spawned_Process | undefined>;
30
- export declare const resolve_cli: (name_or_cli: string | Cli, args: string[] | undefined, cwd: string | URL | undefined, log?: any) => Promise<Cli | undefined>;
29
+ export declare const spawn_cli_process: (name_or_cli: string | Cli, args?: string[], log?: any, options?: SpawnOptions | undefined) => Spawned_Process | undefined;
30
+ export declare const resolve_cli: (name_or_cli: string | Cli, args: string[] | undefined, cwd: string | URL | undefined, log?: any, options?: SpawnOptions | undefined) => Cli | undefined;
31
31
  export declare const to_cli_name: (cli: string | Cli) => string;
package/dist/cli.js CHANGED
@@ -1,4 +1,5 @@
1
- import { spawn, spawn_out, spawn_process, } from '@ryanatkn/belt/process.js';
1
+ import { spawnSync } from 'node:child_process';
2
+ import { spawn, spawn_process, } from '@ryanatkn/belt/process.js';
2
3
  import { join } from 'node:path';
3
4
  import { existsSync } from 'node:fs';
4
5
  import { fileURLToPath } from 'node:url';
@@ -8,14 +9,14 @@ import { print_command_args } from './args.js';
8
9
  * Searches the filesystem for the CLI `name`, first local to the cwd and then globally.
9
10
  * @returns `null` if not found locally or globally
10
11
  */
11
- export const find_cli = async (name, cwd = process.cwd()) => {
12
+ export const find_cli = (name, cwd = process.cwd(), options) => {
12
13
  const final_cwd = typeof cwd === 'string' ? cwd : fileURLToPath(cwd);
13
14
  const local_id = join(final_cwd, NODE_MODULES_DIRNAME, `.bin/${name}`);
14
15
  if (existsSync(local_id)) {
15
16
  return { name, id: local_id, kind: 'local' };
16
17
  }
17
- const { stdout } = await spawn_out('which', [name]);
18
- const global_id = stdout?.trim();
18
+ const { stdout } = spawnSync('which', [name], options);
19
+ const global_id = stdout?.toString().trim();
19
20
  if (!global_id)
20
21
  return null;
21
22
  return { name, id: global_id, kind: 'global' };
@@ -26,7 +27,7 @@ export const find_cli = async (name, cwd = process.cwd()) => {
26
27
  * @returns `undefined` if no CLI is found, or the spawn result
27
28
  */
28
29
  export const spawn_cli = async (name_or_cli, args = [], log, options) => {
29
- const cli = await resolve_cli(name_or_cli, args, options?.cwd, log);
30
+ const cli = resolve_cli(name_or_cli, args, options?.cwd, log, options);
30
31
  if (!cli)
31
32
  return;
32
33
  return spawn(cli.id, args, options);
@@ -36,16 +37,16 @@ export const spawn_cli = async (name_or_cli, args = [], log, options) => {
36
37
  * If a string is provided for `name_or_cli`, it checks first local to the cwd and then globally.
37
38
  * @returns `undefined` if no CLI is found, or the spawn result
38
39
  */
39
- export const spawn_cli_process = async (name_or_cli, args = [], log, options) => {
40
- const cli = await resolve_cli(name_or_cli, args, options?.cwd, log);
40
+ export const spawn_cli_process = (name_or_cli, args = [], log, options) => {
41
+ const cli = resolve_cli(name_or_cli, args, options?.cwd, log, options);
41
42
  if (!cli)
42
43
  return;
43
44
  return spawn_process(cli.id, args, options);
44
45
  };
45
- export const resolve_cli = async (name_or_cli, args = [], cwd, log) => {
46
+ export const resolve_cli = (name_or_cli, args = [], cwd, log, options) => {
46
47
  let final_cli;
47
48
  if (typeof name_or_cli === 'string') {
48
- const found = await find_cli(name_or_cli, cwd);
49
+ const found = find_cli(name_or_cli, cwd, options);
49
50
  if (!found)
50
51
  return;
51
52
  final_cli = found;
@@ -1,6 +1,6 @@
1
1
  import { spawn } from '@ryanatkn/belt/process.js';
2
2
  import { print_error } from '@ryanatkn/belt/print.js';
3
- import { green, red } from 'kleur/colors';
3
+ import { green, red } from '@ryanatkn/belt/styletext.js';
4
4
  import { z } from 'zod';
5
5
  import { cp, mkdir, rm } from 'node:fs/promises';
6
6
  import { join, resolve } from 'node:path';
@@ -1,4 +1,4 @@
1
- import { yellow, red } from 'kleur/colors';
1
+ import { yellow, red } from '@ryanatkn/belt/styletext.js';
2
2
  export const print_build_result = (log, build_result) => {
3
3
  for (const error of build_result.errors) {
4
4
  log.error(red('esbuild error'), error);
package/dist/gen.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { join, basename, dirname, isAbsolute } from 'node:path';
2
2
  import { mkdir, readFile, writeFile } from 'node:fs/promises';
3
3
  import { z } from 'zod';
4
- import { red } from 'kleur/colors';
4
+ import { red } from '@ryanatkn/belt/styletext.js';
5
5
  import { existsSync } from 'node:fs';
6
6
  import { print_path } from './paths.js';
7
7
  import { load_modules } from './modules.js';
package/dist/gen.task.js CHANGED
@@ -1,4 +1,4 @@
1
- import { red, green, gray } from 'kleur/colors';
1
+ import { red, green, gray } from '@ryanatkn/belt/styletext.js';
2
2
  import { print_ms, print_error } from '@ryanatkn/belt/print.js';
3
3
  import { plural } from '@ryanatkn/belt/string.js';
4
4
  import { z } from 'zod';
package/dist/github.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export declare const GITHUB_REPO_MATCHER: RegExp;
2
3
  export declare const Github_Pull_Request: z.ZodObject<{
3
4
  url: z.ZodString;
4
5
  id: z.ZodNumber;
package/dist/github.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // and we specify just the types we need
4
4
  import { Fetch_Value_Cache, fetch_value } from '@ryanatkn/belt/fetch.js';
5
5
  import { z } from 'zod';
6
+ export const GITHUB_REPO_MATCHER = /.+github.com\/(.+)\/(.+)/u;
6
7
  export const Github_Pull_Request = z.object({
7
8
  url: z.string(),
8
9
  id: z.number(),
@@ -15,14 +15,14 @@ export const gro_plugin_sveltekit_app = ({ host_target = 'github_pages', well_kn
15
15
  return {
16
16
  name: 'gro_plugin_sveltekit_app',
17
17
  setup: async ({ dev, watch, log }) => {
18
- const found_vite_cli = await find_cli(vite_cli);
18
+ const found_vite_cli = find_cli(vite_cli);
19
19
  if (!found_vite_cli)
20
20
  throw new Error(`Failed to find Vite CLI \`${vite_cli}\`, do you need to run \`npm i\`?`);
21
21
  if (dev) {
22
22
  // `vite dev` in development mode
23
23
  if (watch) {
24
24
  const serialized_args = ['dev', ...serialize_args(to_forwarded_args(vite_cli))];
25
- sveltekit_process = await spawn_cli_process(found_vite_cli, serialized_args, log);
25
+ sveltekit_process = spawn_cli_process(found_vite_cli, serialized_args, log);
26
26
  }
27
27
  else {
28
28
  log.debug(`the SvelteKit app plugin is loaded but will not output anything` +
@@ -1,8 +1,15 @@
1
1
  import type { Plugin, Plugin_Context } from './plugin.js';
2
+ import { type Svelte_Package_Options } from './sveltekit_helpers.js';
2
3
  export interface Options {
4
+ /**
5
+ * The options passed to the SvelteKit packaging CLI.
6
+ * @see https://kit.svelte.dev/docs/packaging#options
7
+ */
8
+ svelte_package_options?: Svelte_Package_Options;
3
9
  /**
4
10
  * The SvelteKit packaging CLI to use. Defaults to `svelte-package`.
11
+ * @see https://kit.svelte.dev/docs/packaging
5
12
  */
6
13
  svelte_package_cli?: string;
7
14
  }
8
- export declare const gro_plugin_sveltekit_library: ({ svelte_package_cli, }?: Options) => Plugin<Plugin_Context>;
15
+ export declare const gro_plugin_sveltekit_library: ({ svelte_package_options, svelte_package_cli, }?: Options) => Plugin<Plugin_Context>;
@@ -3,8 +3,8 @@ import { Task_Error } from './task.js';
3
3
  import { load_package_json } from './package_json.js';
4
4
  import { serialize_args, to_forwarded_args } from './args.js';
5
5
  import { find_cli, spawn_cli } from './cli.js';
6
- import { SVELTE_PACKAGE_CLI, has_sveltekit_library } from './sveltekit_helpers.js';
7
- export const gro_plugin_sveltekit_library = ({ svelte_package_cli = SVELTE_PACKAGE_CLI, } = {}) => {
6
+ import { SVELTE_PACKAGE_CLI, has_sveltekit_library, } from './sveltekit_helpers.js';
7
+ export const gro_plugin_sveltekit_library = ({ svelte_package_options, svelte_package_cli = SVELTE_PACKAGE_CLI, } = {}) => {
8
8
  return {
9
9
  name: 'gro_plugin_sveltekit_library',
10
10
  setup: async ({ log }) => {
@@ -12,11 +12,14 @@ export const gro_plugin_sveltekit_library = ({ svelte_package_cli = SVELTE_PACKA
12
12
  if (!has_sveltekit_library_result.ok) {
13
13
  throw new Task_Error('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
14
14
  }
15
- const found_svelte_package_cli = await find_cli(svelte_package_cli);
15
+ const found_svelte_package_cli = find_cli(svelte_package_cli);
16
16
  if (found_svelte_package_cli?.kind !== 'local') {
17
17
  throw new Task_Error(`Failed to find SvelteKit packaging CLI \`${svelte_package_cli}\`, do you need to run \`npm i\`?`);
18
18
  }
19
- const serialized_args = serialize_args(to_forwarded_args(svelte_package_cli));
19
+ const serialized_args = serialize_args({
20
+ ...svelte_package_options,
21
+ ...to_forwarded_args(svelte_package_cli),
22
+ });
20
23
  await spawn_cli(found_svelte_package_cli, serialized_args, log);
21
24
  },
22
25
  adapt: async ({ log, timings }) => {
@@ -1,4 +1,4 @@
1
- import { cyan, red, gray } from 'kleur/colors';
1
+ import { cyan, red, gray } from '@ryanatkn/belt/styletext.js';
2
2
  import { System_Logger, print_log_label } from '@ryanatkn/belt/log.js';
3
3
  import { create_stopwatch, Timings } from '@ryanatkn/belt/timings.js';
4
4
  import { print_ms, print_timings } from '@ryanatkn/belt/print.js';
package/dist/lint.task.js CHANGED
@@ -16,7 +16,7 @@ export const task = {
16
16
  Args,
17
17
  run: async ({ log, args }) => {
18
18
  const { _, eslint_cli } = args;
19
- const found_eslint_cli = await find_cli(eslint_cli);
19
+ const found_eslint_cli = find_cli(eslint_cli);
20
20
  if (!found_eslint_cli) {
21
21
  // TODO maybe make this an option?
22
22
  log.info('ESLint is not installed; skipping linting');
package/dist/loader.js CHANGED
@@ -4,7 +4,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
4
4
  import { dirname, join } from 'node:path';
5
5
  import { escape_regexp } from '@ryanatkn/belt/regexp.js';
6
6
  import { render_env_shim_module } from './sveltekit_shim_env.js';
7
- import { render_sveltekit_shim_app_environment, render_sveltekit_shim_app_paths, sveltekit_shim_app_environment_matcher, sveltekit_shim_app_paths_matcher, sveltekit_shim_app_specifiers, } from './sveltekit_shim_app.js';
7
+ import { render_sveltekit_shim_app_environment, render_sveltekit_shim_app_paths, SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER, SVELTEKIT_SHIM_APP_PATHS_MATCHER, sveltekit_shim_app_specifiers, } from './sveltekit_shim_app.js';
8
8
  import { sveltekit_config_global } from './sveltekit_config_global.js';
9
9
  import { SVELTE_MATCHER, SVELTE_RUNES_MATCHER } from './svelte_helpers.js';
10
10
  import { paths } from './paths.js';
@@ -48,14 +48,14 @@ const final_ts_transform_options = {
48
48
  sourcemap: 'inline',
49
49
  };
50
50
  const aliases = Object.entries({ $lib: 'src/lib', ...alias });
51
- const ts_matcher = /\.(ts|tsx|mts|cts)$/u;
52
- const json_matcher = /\.(json)$/u;
53
- const noop_matcher = /\.(css|svg)$/u; // TODO others? configurable?
54
- const env_matcher = /src\/lib\/\$env\/(static|dynamic)\/(public|private)$/u;
55
- const node_modules_matcher = new RegExp(escape_regexp('/' + NODE_MODULES_DIRNAME + '/'), 'u');
51
+ const TS_MATCHER = /\.(ts|tsx|mts|cts)$/u;
52
+ const JSON_MATCHER = /\.(json)$/u;
53
+ const NOOP_MATCHER = /\.(css|svg)$/u; // TODO others? configurable?
54
+ const ENV_MATCHER = /src\/lib\/\$env\/(static|dynamic)\/(public|private)$/u;
55
+ const NODE_MODULES_MATCHER = new RegExp(escape_regexp('/' + NODE_MODULES_DIRNAME + '/'), 'u');
56
56
  const package_json_cache = {};
57
57
  export const load = async (url, context, nextLoad) => {
58
- if (sveltekit_shim_app_paths_matcher.test(url)) {
58
+ if (SVELTEKIT_SHIM_APP_PATHS_MATCHER.test(url)) {
59
59
  // SvelteKit `$app/paths` shim
60
60
  return {
61
61
  format: 'module',
@@ -63,7 +63,7 @@ export const load = async (url, context, nextLoad) => {
63
63
  source: render_sveltekit_shim_app_paths(base_url, assets_url),
64
64
  };
65
65
  }
66
- else if (sveltekit_shim_app_environment_matcher.test(url)) {
66
+ else if (SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER.test(url)) {
67
67
  // SvelteKit `$app/environment` shim
68
68
  return {
69
69
  format: 'module',
@@ -80,7 +80,7 @@ export const load = async (url, context, nextLoad) => {
80
80
  const transformed = compileModule(source, { ...svelte_compile_module_options, filename });
81
81
  return { format: 'module', shortCircuit: true, source: transformed.js.code };
82
82
  }
83
- else if (ts_matcher.test(url)) {
83
+ else if (TS_MATCHER.test(url)) {
84
84
  // ts
85
85
  const loaded = await nextLoad(url, context.format === 'module' ? context : { ...context, format: 'module' });
86
86
  const transformed = await esbuild.transform(loaded.source.toString(), // eslint-disable-line @typescript-eslint/no-base-to-string
@@ -100,7 +100,7 @@ export const load = async (url, context, nextLoad) => {
100
100
  const transformed = compile(source, { ...svelte_compile_options, filename });
101
101
  return { format: 'module', shortCircuit: true, source: transformed.js.code };
102
102
  }
103
- else if (json_matcher.test(url)) {
103
+ else if (JSON_MATCHER.test(url)) {
104
104
  // json
105
105
  // TODO probably follow esbuild and also export every top-level property for objects from the module - https://esbuild.github.io/content-types/#json (type generation?)
106
106
  const loaded = await nextLoad(url);
@@ -108,13 +108,13 @@ export const load = async (url, context, nextLoad) => {
108
108
  const source = `export default ` + raw_source;
109
109
  return { format: 'module', shortCircuit: true, source };
110
110
  }
111
- else if (noop_matcher.test(url)) {
111
+ else if (NOOP_MATCHER.test(url)) {
112
112
  // no-ops like `.css` and `.svg`
113
113
  const source = `export default 'no-op import from ${url}'`;
114
114
  return { format: 'module', shortCircuit: true, source };
115
115
  }
116
116
  else {
117
- const matched_env = env_matcher.exec(url);
117
+ const matched_env = ENV_MATCHER.exec(url);
118
118
  if (matched_env) {
119
119
  // SvelteKit `$env`
120
120
  const mode = matched_env[1];
@@ -143,7 +143,7 @@ export const resolve = async (specifier, context, nextResolve) => {
143
143
  };
144
144
  }
145
145
  const parent_url = context.parentURL;
146
- if (!parent_url || node_modules_matcher.test(parent_url)) {
146
+ if (!parent_url || NODE_MODULES_MATCHER.test(parent_url)) {
147
147
  return nextResolve(specifier, context);
148
148
  }
149
149
  const shimmed = sveltekit_shim_app_specifiers.get(specifier);
@@ -161,7 +161,7 @@ export const resolve = async (specifier, context, nextResolve) => {
161
161
  // The specifier `path` has now been mapped to its final form, so we can inspect it.
162
162
  if (path[0] !== '.' && path[0] !== '/') {
163
163
  // Resolve to `node_modules`.
164
- if (SVELTE_MATCHER.test(path) || json_matcher.test(path)) {
164
+ if (SVELTE_MATCHER.test(path) || JSON_MATCHER.test(path)) {
165
165
  // Match the behavior of Vite and esbuild for Svelte and JSON imports.
166
166
  // TODO maybe `.ts` too
167
167
  const path_id = await resolve_node_specifier(path, dir, parent_url, package_json_cache);
package/dist/package.d.ts CHANGED
@@ -37,7 +37,6 @@ export declare const package_json: {
37
37
  chokidar: string;
38
38
  dotenv: string;
39
39
  'es-module-lexer': string;
40
- kleur: string;
41
40
  mri: string;
42
41
  prettier: string;
43
42
  'prettier-plugin-svelte': string;
package/dist/package.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // generated by src/lib/package.gen.ts
2
2
  export const package_json = {
3
3
  name: '@ryanatkn/gro',
4
- version: '0.125.0',
4
+ version: '0.126.0',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -33,11 +33,10 @@ export const package_json = {
33
33
  ],
34
34
  files: ['dist'],
35
35
  dependencies: {
36
- '@ryanatkn/belt': '^0.22.0',
36
+ '@ryanatkn/belt': '^0.23.0',
37
37
  chokidar: '^3.6.0',
38
38
  dotenv: '^16.4.5',
39
39
  'es-module-lexer': '^1.5.4',
40
- kleur: '^4.1.5',
41
40
  mri: '^1.2.0',
42
41
  prettier: '^3.3.2',
43
42
  'prettier-plugin-svelte': '^3.2.5',
@@ -50,8 +49,8 @@ export const package_json = {
50
49
  '@changesets/changelog-git': '^0.2.0',
51
50
  '@changesets/types': '^6.0.0',
52
51
  '@ryanatkn/eslint-config': '^0.1.3',
53
- '@ryanatkn/fuz': '^0.105.1',
54
- '@ryanatkn/moss': '^0.6.0',
52
+ '@ryanatkn/fuz': '^0.105.2',
53
+ '@ryanatkn/moss': '^0.6.1',
55
54
  '@sveltejs/adapter-static': '^3.0.2',
56
55
  '@sveltejs/kit': '^2.5.17',
57
56
  '@sveltejs/package': '^2.3.2',
@@ -260,7 +259,7 @@ export const package_json = {
260
259
  };
261
260
  export const src_json = {
262
261
  name: '@ryanatkn/gro',
263
- version: '0.125.0',
262
+ version: '0.126.0',
264
263
  modules: {
265
264
  '.': {
266
265
  path: 'index.ts',
@@ -528,6 +527,7 @@ export const src_json = {
528
527
  './github.js': {
529
528
  path: 'github.ts',
530
529
  declarations: [
530
+ { name: 'GITHUB_REPO_MATCHER', kind: 'variable' },
531
531
  { name: 'Github_Pull_Request', kind: 'variable' },
532
532
  { name: 'github_fetch_commit_prs', kind: 'function' },
533
533
  ],
@@ -860,6 +860,7 @@ export const src_json = {
860
860
  { name: 'has_sveltekit_library', kind: 'function' },
861
861
  { name: 'sveltekit_sync', kind: 'function' },
862
862
  { name: 'sveltekit_sync_if_obviously_needed', kind: 'function' },
863
+ { name: 'Svelte_Package_Options', kind: 'type' },
863
864
  ],
864
865
  },
865
866
  './sveltekit_shim_app_environment.js': {
@@ -3,11 +3,12 @@ import { join } from 'node:path';
3
3
  import { readFile, writeFile } from 'node:fs/promises';
4
4
  import { count_graphemes, plural } from '@ryanatkn/belt/string.js';
5
5
  import { strip_end } from '@ryanatkn/belt/string.js';
6
- import { red } from 'kleur/colors';
6
+ import { red } from '@ryanatkn/belt/styletext.js';
7
7
  import { paths, gro_paths, IS_THIS_GRO, replace_extension } from './paths.js';
8
8
  import { SVELTEKIT_DIST_DIRNAME } from './path_constants.js';
9
9
  import { search_fs } from './search_fs.js';
10
10
  import { has_sveltekit_library } from './sveltekit_helpers.js';
11
+ import { GITHUB_REPO_MATCHER } from './github.js';
11
12
  // TODO @multiple belongs elsewhere
12
13
  export const Url = z.string();
13
14
  // TODO @multiple belongs elsewhere
@@ -225,7 +226,7 @@ export const parse_repo_url = (package_json) => {
225
226
  if (!repo_url) {
226
227
  return undefined;
227
228
  }
228
- const parsed_repo_url = /.+github.com\/(.+)\/(.+)/u.exec(strip_end(strip_end(repo_url, '/'), '.git'));
229
+ const parsed_repo_url = GITHUB_REPO_MATCHER.exec(strip_end(strip_end(repo_url, '/'), '.git'));
229
230
  if (!parsed_repo_url) {
230
231
  return undefined;
231
232
  }
package/dist/paths.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { join, extname, relative, basename } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { strip_end } from '@ryanatkn/belt/string.js';
4
- import { gray } from 'kleur/colors';
4
+ import { gray } from '@ryanatkn/belt/styletext.js';
5
5
  import { GRO_CONFIG_PATH, GRO_DEV_DIR, GRO_DIR, SOURCE_DIR, SVELTEKIT_DIST_DIRNAME, } from './path_constants.js';
6
6
  import { sveltekit_config_global } from './sveltekit_config_global.js';
7
7
  /*
@@ -1,6 +1,6 @@
1
1
  import { spawn } from '@ryanatkn/belt/process.js';
2
2
  import { z } from 'zod';
3
- import { green, cyan } from 'kleur/colors';
3
+ import { green, cyan } from '@ryanatkn/belt/styletext.js';
4
4
  import { existsSync } from 'node:fs';
5
5
  import { Task_Error } from './task.js';
6
6
  import { load_package_json, parse_repo_url } from './package_json.js';
@@ -61,7 +61,7 @@ export const task = {
61
61
  await spawn('npm', ['run', 'build']);
62
62
  }
63
63
  const changelog_exists = existsSync(changelog);
64
- const found_changeset_cli = await find_cli(changeset_cli);
64
+ const found_changeset_cli = find_cli(changeset_cli);
65
65
  if (!found_changeset_cli) {
66
66
  throw new Task_Error('changeset command not found, install @changesets/cli locally or globally');
67
67
  }
package/dist/run.task.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { green, cyan } from 'kleur/colors';
2
+ import { green, cyan } from '@ryanatkn/belt/styletext.js';
3
3
  import { existsSync } from 'node:fs';
4
4
  import { Task_Error } from './task.js';
5
5
  import { resolve_gro_module_path, spawn_with_loader } from './gro_helpers.js';
package/dist/run_gen.js CHANGED
@@ -1,4 +1,4 @@
1
- import { red } from 'kleur/colors';
1
+ import { red } from '@ryanatkn/belt/styletext.js';
2
2
  import { print_error } from '@ryanatkn/belt/print.js';
3
3
  import { to_gen_result, } from './gen.js';
4
4
  import { print_path } from './paths.js';
package/dist/run_task.js CHANGED
@@ -1,4 +1,4 @@
1
- import { cyan, red } from 'kleur/colors';
1
+ import { cyan, red } from '@ryanatkn/belt/styletext.js';
2
2
  import { print_log_label, System_Logger } from '@ryanatkn/belt/log.js';
3
3
  import { parse_args } from './args.js';
4
4
  import { log_task_help } from './task_logging.js';
@@ -18,3 +18,52 @@ export declare const sveltekit_sync: (sveltekit_cli?: string | Cli) => Promise<v
18
18
  * If the SvelteKit CLI is found and its `.svelte-kit` directory is not, run `svelte-kit sync`.
19
19
  */
20
20
  export declare const sveltekit_sync_if_obviously_needed: (sveltekit_cli?: string | Cli) => Promise<void>;
21
+ /**
22
+ * Options to the SvelteKit packaging CLI.
23
+ * @see https://kit.svelte.dev/docs/packaging#options
24
+ */
25
+ export interface Svelte_Package_Options {
26
+ /**
27
+ * Watch files in src/lib for changes and rebuild the package
28
+ */
29
+ watch?: boolean;
30
+ /**
31
+ * Alias for `watch`.
32
+ */
33
+ w?: boolean;
34
+ /**
35
+ * The input directory which contains all the files of the package.
36
+ * Defaults to src/lib
37
+ */
38
+ input?: string;
39
+ /**
40
+ * Alias for `input`.
41
+ */
42
+ i?: string;
43
+ /**
44
+ * The output directory where the processed files are written to.
45
+ * Your package.json's exports should point to files inside there,
46
+ * and the files array should include that folder.
47
+ * Defaults to dist
48
+ */
49
+ output?: string;
50
+ /**
51
+ * Alias for `output`.
52
+ */
53
+ o?: string;
54
+ /**
55
+ * Whether or not to create type definitions (d.ts files).
56
+ * We strongly recommend doing this as it fosters ecosystem library quality.
57
+ * Defaults to true
58
+ */
59
+ types?: boolean;
60
+ /**
61
+ * Alias for `types`.
62
+ */
63
+ t?: boolean;
64
+ /**
65
+ * The path to a tsconfig or jsconfig.
66
+ * When not provided, searches for the next upper tsconfig/jsconfig in the workspace path.
67
+ */
68
+ tsconfig?: string;
69
+ }
@@ -49,7 +49,7 @@ export const sveltekit_sync_if_obviously_needed = async (sveltekit_cli = SVELTEK
49
49
  if (existsSync(SVELTEKIT_DEV_DIRNAME)) {
50
50
  return;
51
51
  }
52
- const found_sveltekit_cli = typeof sveltekit_cli === 'string' ? await find_cli(sveltekit_cli) : sveltekit_cli;
52
+ const found_sveltekit_cli = typeof sveltekit_cli === 'string' ? find_cli(sveltekit_cli) : sveltekit_cli;
53
53
  if (!found_sveltekit_cli) {
54
54
  return;
55
55
  }
@@ -1,6 +1,6 @@
1
1
  import type { Parsed_Sveltekit_Config } from './sveltekit_config.js';
2
- export declare const sveltekit_shim_app_paths_matcher: RegExp;
3
- export declare const sveltekit_shim_app_environment_matcher: RegExp;
2
+ export declare const SVELTEKIT_SHIM_APP_PATHS_MATCHER: RegExp;
3
+ export declare const SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER: RegExp;
4
4
  /**
5
5
  * Maps SvelteKit `$app` specifiers to their Gro shims.
6
6
  * @see https://kit.svelte.dev/docs/modules
@@ -1,5 +1,5 @@
1
- export const sveltekit_shim_app_paths_matcher = /\/util\/sveltekit_shim_app_paths\.js$/u;
2
- export const sveltekit_shim_app_environment_matcher = /\/util\/sveltekit_shim_app_environment\.js$/u;
1
+ export const SVELTEKIT_SHIM_APP_PATHS_MATCHER = /\/util\/sveltekit_shim_app_paths\.js$/u;
2
+ export const SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER = /\/util\/sveltekit_shim_app_environment\.js$/u;
3
3
  /**
4
4
  * Maps SvelteKit `$app` specifiers to their Gro shims.
5
5
  * @see https://kit.svelte.dev/docs/modules
package/dist/task.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { strip_end, strip_start } from '@ryanatkn/belt/string.js';
2
- import { red } from 'kleur/colors';
2
+ import { red } from '@ryanatkn/belt/styletext.js';
3
3
  import { isAbsolute, join, relative } from 'node:path';
4
4
  import { resolve_input_files, resolve_input_paths, } from './input_path.js';
5
5
  import { print_path } from './paths.js';
@@ -1,4 +1,4 @@
1
- import { cyan, gray, green, red } from 'kleur/colors';
1
+ import { cyan, gray, green, red } from '@ryanatkn/belt/styletext.js';
2
2
  import { plural } from '@ryanatkn/belt/string.js';
3
3
  import { print_value } from '@ryanatkn/belt/print.js';
4
4
  import { ZodFirstPartyTypeKind } from 'zod';
package/dist/test.task.js CHANGED
@@ -1,4 +1,4 @@
1
- import { yellow } from 'kleur/colors';
1
+ import { yellow } from '@ryanatkn/belt/styletext.js';
2
2
  import { z } from 'zod';
3
3
  import { Task_Error } from './task.js';
4
4
  import { paths } from './paths.js';
@@ -20,7 +20,7 @@ export const task = {
20
20
  Args,
21
21
  run: async ({ args, log }) => {
22
22
  const { _: patterns, bail, cwd, ignore } = args;
23
- if (!(await find_cli('uvu'))) {
23
+ if (!find_cli('uvu')) {
24
24
  log.warn(yellow('uvu is not installed, skipping tests'));
25
25
  return;
26
26
  }
@@ -21,7 +21,7 @@ export const task = {
21
21
  const { svelte_check_cli, typescript_cli } = args;
22
22
  await sveltekit_sync();
23
23
  // Prefer svelte-check if available.
24
- const found_svelte_check_cli = await find_cli(svelte_check_cli);
24
+ const found_svelte_check_cli = find_cli(svelte_check_cli);
25
25
  if (found_svelte_check_cli) {
26
26
  const serialized = serialize_args(to_forwarded_args(svelte_check_cli));
27
27
  const svelte_check_result = await spawn_cli(found_svelte_check_cli, serialized, log);
@@ -31,7 +31,7 @@ export const task = {
31
31
  return;
32
32
  }
33
33
  // Fall back to tsc.
34
- const found_typescript_cli = await find_cli(typescript_cli);
34
+ const found_typescript_cli = find_cli(typescript_cli);
35
35
  if (found_typescript_cli) {
36
36
  const forwarded = to_forwarded_args(typescript_cli);
37
37
  if (!forwarded.noEmit)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.125.0",
3
+ "version": "0.126.0",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -45,11 +45,10 @@
45
45
  "dist"
46
46
  ],
47
47
  "dependencies": {
48
- "@ryanatkn/belt": "^0.22.0",
48
+ "@ryanatkn/belt": "^0.23.0",
49
49
  "chokidar": "^3.6.0",
50
50
  "dotenv": "^16.4.5",
51
51
  "es-module-lexer": "^1.5.4",
52
- "kleur": "^4.1.5",
53
52
  "mri": "^1.2.0",
54
53
  "prettier": "^3.3.2",
55
54
  "prettier-plugin-svelte": "^3.2.5",
@@ -65,8 +64,8 @@
65
64
  "@changesets/changelog-git": "^0.2.0",
66
65
  "@changesets/types": "^6.0.0",
67
66
  "@ryanatkn/eslint-config": "^0.1.3",
68
- "@ryanatkn/fuz": "^0.105.1",
69
- "@ryanatkn/moss": "^0.6.0",
67
+ "@ryanatkn/fuz": "^0.105.2",
68
+ "@ryanatkn/moss": "^0.6.1",
70
69
  "@sveltejs/adapter-static": "^3.0.2",
71
70
  "@sveltejs/kit": "^2.5.17",
72
71
  "@sveltejs/package": "^2.3.2",