@ryanatkn/gro 0.125.1 → 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/changeset.task.js +1 -1
- package/dist/cli.d.ts +4 -4
- package/dist/cli.js +10 -9
- package/dist/github.d.ts +1 -0
- package/dist/github.js +1 -0
- package/dist/gro_plugin_sveltekit_app.js +2 -2
- package/dist/gro_plugin_sveltekit_library.d.ts +8 -1
- package/dist/gro_plugin_sveltekit_library.js +7 -4
- package/dist/lint.task.js +1 -1
- package/dist/loader.js +14 -14
- package/dist/package.js +6 -4
- package/dist/package_json.js +2 -1
- package/dist/publish.task.js +1 -1
- package/dist/sveltekit_helpers.d.ts +49 -0
- package/dist/sveltekit_helpers.js +1 -1
- package/dist/sveltekit_shim_app.d.ts +2 -2
- package/dist/sveltekit_shim_app.js +2 -2
- package/dist/test.task.js +1 -1
- package/dist/typecheck.task.js +2 -2
- package/package.json +3 -3
package/dist/changeset.task.js
CHANGED
|
@@ -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 =
|
|
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
|
}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
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) =>
|
|
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) =>
|
|
30
|
-
export declare const resolve_cli: (name_or_cli: string | Cli, args: string[] | undefined, cwd: string | URL | undefined, log?: any) =>
|
|
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 {
|
|
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 =
|
|
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 } =
|
|
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 =
|
|
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 =
|
|
40
|
-
const cli =
|
|
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 =
|
|
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 =
|
|
49
|
+
const found = find_cli(name_or_cli, cwd, options);
|
|
49
50
|
if (!found)
|
|
50
51
|
return;
|
|
51
52
|
final_cli = found;
|
package/dist/github.d.ts
CHANGED
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 =
|
|
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 =
|
|
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 =
|
|
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(
|
|
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 }) => {
|
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 =
|
|
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,
|
|
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
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
const
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 =
|
|
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 ||
|
|
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) ||
|
|
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.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.
|
|
4
|
+
version: '0.126.0',
|
|
5
5
|
description: 'task runner and toolkit extending SvelteKit',
|
|
6
6
|
motto: 'generate, run, optimize',
|
|
7
7
|
glyph: '🌰',
|
|
@@ -49,8 +49,8 @@ export const package_json = {
|
|
|
49
49
|
'@changesets/changelog-git': '^0.2.0',
|
|
50
50
|
'@changesets/types': '^6.0.0',
|
|
51
51
|
'@ryanatkn/eslint-config': '^0.1.3',
|
|
52
|
-
'@ryanatkn/fuz': '^0.105.
|
|
53
|
-
'@ryanatkn/moss': '^0.6.
|
|
52
|
+
'@ryanatkn/fuz': '^0.105.2',
|
|
53
|
+
'@ryanatkn/moss': '^0.6.1',
|
|
54
54
|
'@sveltejs/adapter-static': '^3.0.2',
|
|
55
55
|
'@sveltejs/kit': '^2.5.17',
|
|
56
56
|
'@sveltejs/package': '^2.3.2',
|
|
@@ -259,7 +259,7 @@ export const package_json = {
|
|
|
259
259
|
};
|
|
260
260
|
export const src_json = {
|
|
261
261
|
name: '@ryanatkn/gro',
|
|
262
|
-
version: '0.
|
|
262
|
+
version: '0.126.0',
|
|
263
263
|
modules: {
|
|
264
264
|
'.': {
|
|
265
265
|
path: 'index.ts',
|
|
@@ -527,6 +527,7 @@ export const src_json = {
|
|
|
527
527
|
'./github.js': {
|
|
528
528
|
path: 'github.ts',
|
|
529
529
|
declarations: [
|
|
530
|
+
{ name: 'GITHUB_REPO_MATCHER', kind: 'variable' },
|
|
530
531
|
{ name: 'Github_Pull_Request', kind: 'variable' },
|
|
531
532
|
{ name: 'github_fetch_commit_prs', kind: 'function' },
|
|
532
533
|
],
|
|
@@ -859,6 +860,7 @@ export const src_json = {
|
|
|
859
860
|
{ name: 'has_sveltekit_library', kind: 'function' },
|
|
860
861
|
{ name: 'sveltekit_sync', kind: 'function' },
|
|
861
862
|
{ name: 'sveltekit_sync_if_obviously_needed', kind: 'function' },
|
|
863
|
+
{ name: 'Svelte_Package_Options', kind: 'type' },
|
|
862
864
|
],
|
|
863
865
|
},
|
|
864
866
|
'./sveltekit_shim_app_environment.js': {
|
package/dist/package_json.js
CHANGED
|
@@ -8,6 +8,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 =
|
|
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/publish.task.js
CHANGED
|
@@ -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 =
|
|
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
|
}
|
|
@@ -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' ?
|
|
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
|
|
3
|
-
export declare const
|
|
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
|
|
2
|
-
export const
|
|
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/test.task.js
CHANGED
package/dist/typecheck.task.js
CHANGED
|
@@ -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 =
|
|
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 =
|
|
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.
|
|
3
|
+
"version": "0.126.0",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"glyph": "🌰",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"@changesets/changelog-git": "^0.2.0",
|
|
65
65
|
"@changesets/types": "^6.0.0",
|
|
66
66
|
"@ryanatkn/eslint-config": "^0.1.3",
|
|
67
|
-
"@ryanatkn/fuz": "^0.105.
|
|
68
|
-
"@ryanatkn/moss": "^0.6.
|
|
67
|
+
"@ryanatkn/fuz": "^0.105.2",
|
|
68
|
+
"@ryanatkn/moss": "^0.6.1",
|
|
69
69
|
"@sveltejs/adapter-static": "^3.0.2",
|
|
70
70
|
"@sveltejs/kit": "^2.5.17",
|
|
71
71
|
"@sveltejs/package": "^2.3.2",
|