@ryanatkn/gro 0.178.0 → 0.180.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/build.task.d.ts +2 -0
- package/dist/build.task.d.ts.map +1 -1
- package/dist/build.task.js +14 -10
- package/dist/build_cache.d.ts +3 -3
- package/dist/build_cache.d.ts.map +1 -1
- package/dist/build_cache.js +53 -43
- package/dist/changeset.task.js +9 -9
- package/dist/clean_fs.d.ts +1 -1
- package/dist/clean_fs.d.ts.map +1 -1
- package/dist/clean_fs.js +3 -4
- package/dist/cli.d.ts +4 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -12
- package/dist/deploy.task.d.ts +7 -0
- package/dist/deploy.task.d.ts.map +1 -1
- package/dist/deploy.task.js +27 -14
- package/dist/esbuild_plugin_external_worker.js +1 -1
- package/dist/esbuild_plugin_svelte.js +4 -4
- package/dist/esbuild_plugin_sveltekit_local_imports.js +2 -2
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +103 -52
- package/dist/format_file.js +1 -1
- package/dist/gen.d.ts +1 -1
- package/dist/gen.d.ts.map +1 -1
- package/dist/gen.js +28 -22
- package/dist/gen.task.js +1 -1
- package/dist/gro.config.default.js +1 -1
- package/dist/gro_config.js +2 -2
- package/dist/gro_plugin_gen.js +1 -1
- package/dist/gro_plugin_server.js +2 -2
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.js +40 -36
- package/dist/gro_plugin_sveltekit_library.js +2 -1
- package/dist/input_path.d.ts +3 -3
- package/dist/input_path.d.ts.map +1 -1
- package/dist/input_path.js +16 -14
- package/dist/invoke_task.js +2 -2
- package/dist/lint.task.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/modules.js +2 -2
- package/dist/package_json.d.ts +4 -4
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +12 -14
- package/dist/publish.task.js +6 -6
- package/dist/release.task.js +1 -1
- package/dist/resolve.task.js +2 -2
- package/dist/resolve_specifier.d.ts +1 -1
- package/dist/resolve_specifier.d.ts.map +1 -1
- package/dist/resolve_specifier.js +5 -4
- package/dist/run.task.js +2 -2
- package/dist/run_gen.d.ts.map +1 -1
- package/dist/run_gen.js +9 -8
- package/dist/run_task.js +4 -4
- package/dist/source_json.d.ts +2 -2
- package/dist/source_json.d.ts.map +1 -1
- package/dist/source_json.js +16 -15
- package/dist/sveltekit_helpers.js +3 -3
- package/dist/sveltekit_shim_env.js +1 -1
- package/dist/task.d.ts +1 -1
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +4 -4
- package/dist/test.task.d.ts.map +1 -1
- package/dist/test.task.js +5 -4
- package/dist/typecheck.task.js +3 -3
- package/dist/upgrade.task.js +4 -4
- package/package.json +7 -7
- package/src/lib/build.task.ts +15 -10
- package/src/lib/build_cache.ts +79 -63
- package/src/lib/changeset.task.ts +10 -10
- package/src/lib/clean_fs.ts +4 -4
- package/src/lib/cli.ts +15 -14
- package/src/lib/deploy.task.ts +30 -13
- package/src/lib/esbuild_plugin_external_worker.ts +1 -1
- package/src/lib/esbuild_plugin_svelte.ts +4 -4
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +2 -2
- package/src/lib/filer.ts +111 -52
- package/src/lib/format_file.ts +1 -1
- package/src/lib/gen.task.ts +1 -1
- package/src/lib/gen.ts +52 -46
- package/src/lib/gro.config.default.ts +1 -1
- package/src/lib/gro_config.ts +2 -2
- package/src/lib/gro_plugin_gen.ts +1 -1
- package/src/lib/gro_plugin_server.ts +2 -2
- package/src/lib/gro_plugin_sveltekit_app.ts +49 -41
- package/src/lib/gro_plugin_sveltekit_library.ts +2 -2
- package/src/lib/input_path.ts +20 -21
- package/src/lib/invoke_task.ts +2 -2
- package/src/lib/lint.task.ts +1 -1
- package/src/lib/loader.ts +1 -1
- package/src/lib/modules.ts +2 -2
- package/src/lib/package_json.ts +16 -20
- package/src/lib/publish.task.ts +6 -6
- package/src/lib/release.task.ts +1 -1
- package/src/lib/resolve.task.ts +2 -2
- package/src/lib/resolve_specifier.ts +8 -4
- package/src/lib/run.task.ts +2 -2
- package/src/lib/run_gen.ts +15 -10
- package/src/lib/run_task.ts +4 -4
- package/src/lib/source_json.ts +25 -19
- package/src/lib/sveltekit_helpers.ts +3 -3
- package/src/lib/task.ts +11 -9
- package/src/lib/test.task.ts +4 -3
- package/src/lib/typecheck.task.ts +3 -3
- package/src/lib/upgrade.task.ts +4 -4
- package/dist/search_fs.d.ts +0 -26
- package/dist/search_fs.d.ts.map +0 -1
- package/dist/search_fs.js +0 -52
- package/src/lib/search_fs.ts +0 -100
package/dist/run.task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { styleText as st } from 'node:util';
|
|
3
|
-
import {
|
|
3
|
+
import { fs_exists } from '@ryanatkn/belt/fs.js';
|
|
4
4
|
import { TaskError } from "./task.js";
|
|
5
5
|
import { resolve_gro_module_path, spawn_with_loader } from "./gro_helpers.js";
|
|
6
6
|
import { serialize_args, to_implicit_forwarded_args } from "./args.js";
|
|
@@ -30,7 +30,7 @@ export const task = {
|
|
|
30
30
|
log.info(st('green', '\n\nUsage: ') + st('cyan', 'gro run path/to/file.ts [...args]\n'));
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (!
|
|
33
|
+
if (!(await fs_exists(path))) {
|
|
34
34
|
throw new TaskError('Cannot find file to run at path: ' + path);
|
|
35
35
|
}
|
|
36
36
|
// Get args after `--` without requiring a command name.
|
package/dist/run_gen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run_gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"run_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run_gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EACN,KAAK,UAAU,EAGf,KAAK,iBAAiB,EAItB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,WAAW,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAE1C,eAAO,MAAM,mBAAmB,qCAAqC,CAAC;AAEtE,eAAO,MAAM,OAAO,GACnB,aAAa,KAAK,CAAC,iBAAiB,CAAC,EACrC,QAAQ,SAAS,EACjB,OAAO,KAAK,EACZ,KAAK,MAAM,EACX,SAAS,OAAO,EAChB,aAAa,UAAU,EACvB,cAAc,OAAO,gBAAgB,KACnC,OAAO,CAAC,UAAU,CA6EpB,CAAC"}
|
package/dist/run_gen.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { styleText as st } from 'node:util';
|
|
2
2
|
import { print_error } from '@ryanatkn/belt/print.js';
|
|
3
|
+
import { map_concurrent } from '@ryanatkn/belt/async.js';
|
|
3
4
|
import { to_gen_result, normalize_gen_config, } from "./gen.js";
|
|
4
5
|
import { print_path, to_root_path } from "./paths.js";
|
|
5
6
|
import { default_svelte_config } from "./svelte_config.js";
|
|
@@ -8,7 +9,7 @@ export const run_gen = async (gen_modules, config, filer, log, timings, invoke_t
|
|
|
8
9
|
let input_count = 0;
|
|
9
10
|
let output_count = 0;
|
|
10
11
|
const timing_for_run_gen = timings.start('run_gen');
|
|
11
|
-
const results = await
|
|
12
|
+
const results = await map_concurrent(gen_modules, async (module_meta) => {
|
|
12
13
|
input_count++;
|
|
13
14
|
const { id } = module_meta;
|
|
14
15
|
const timing_for_module = timings.start(id);
|
|
@@ -28,11 +29,11 @@ export const run_gen = async (gen_modules, config, filer, log, timings, invoke_t
|
|
|
28
29
|
try {
|
|
29
30
|
raw_gen_result = await gen_config.generate(gen_ctx);
|
|
30
31
|
}
|
|
31
|
-
catch (
|
|
32
|
+
catch (error) {
|
|
32
33
|
return {
|
|
33
34
|
ok: false,
|
|
34
35
|
id,
|
|
35
|
-
error
|
|
36
|
+
error,
|
|
36
37
|
reason: st('red', `Error generating ${print_path(id)}`),
|
|
37
38
|
elapsed: timing_for_module(),
|
|
38
39
|
};
|
|
@@ -41,17 +42,17 @@ export const run_gen = async (gen_modules, config, filer, log, timings, invoke_t
|
|
|
41
42
|
const gen_result = to_gen_result(id, raw_gen_result);
|
|
42
43
|
// Format the files if needed.
|
|
43
44
|
const files = format_file
|
|
44
|
-
? await
|
|
45
|
+
? await map_concurrent(gen_result.files, async (file) => {
|
|
45
46
|
if (!file.format)
|
|
46
47
|
return file;
|
|
47
48
|
try {
|
|
48
49
|
return { ...file, content: await format_file(file.content, { filepath: file.id }) };
|
|
49
50
|
}
|
|
50
|
-
catch (
|
|
51
|
-
log.error(st('red', `Error formatting ${print_path(file.id)} via ${print_path(id)}`), print_error(
|
|
51
|
+
catch (error) {
|
|
52
|
+
log.error(st('red', `Error formatting ${print_path(file.id)} via ${print_path(id)}`), print_error(error));
|
|
52
53
|
return file;
|
|
53
54
|
}
|
|
54
|
-
})
|
|
55
|
+
}, 10)
|
|
55
56
|
: gen_result.files;
|
|
56
57
|
output_count += files.length;
|
|
57
58
|
return {
|
|
@@ -60,7 +61,7 @@ export const run_gen = async (gen_modules, config, filer, log, timings, invoke_t
|
|
|
60
61
|
files,
|
|
61
62
|
elapsed: timing_for_module(),
|
|
62
63
|
};
|
|
63
|
-
})
|
|
64
|
+
}, 10);
|
|
64
65
|
return {
|
|
65
66
|
results,
|
|
66
67
|
successes: results.filter((r) => r.ok),
|
package/dist/run_task.js
CHANGED
|
@@ -32,13 +32,13 @@ export const run_task = async (task_meta, unparsed_args, invoke_task, config, fi
|
|
|
32
32
|
invoke_task: (invoked_task_name, invoked_args, invoked_config) => invoke_task(invoked_task_name, invoked_args, invoked_config ?? config, filer, timings, log),
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
catch (
|
|
35
|
+
catch (error) {
|
|
36
36
|
return {
|
|
37
37
|
ok: false,
|
|
38
|
-
reason: st('red',
|
|
39
|
-
?
|
|
38
|
+
reason: st('red', error?.constructor?.name === 'TaskError'
|
|
39
|
+
? error.message
|
|
40
40
|
: `Unexpected error running task ${st('cyan', task_meta.name)}. If this is unexpected try running \`${config.pm_cli} install\` and \`gro clean\`.`),
|
|
41
|
-
error
|
|
41
|
+
error,
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
return { ok: true, output };
|
package/dist/source_json.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { PackageJson, PackageJsonExports } from '@ryanatkn/belt/package_jso
|
|
|
2
2
|
import { SourceJson, type ModuleJson } from '@ryanatkn/belt/source_json.js';
|
|
3
3
|
import type { Logger } from '@ryanatkn/belt/log.js';
|
|
4
4
|
export type SourceJsonMapper = (source_json: SourceJson) => SourceJson | null | Promise<SourceJson | null>;
|
|
5
|
-
export declare const source_json_create: (package_json: PackageJson, lib_path?: string, log?: Logger) => SourceJson
|
|
5
|
+
export declare const source_json_create: (package_json: PackageJson, lib_path?: string, log?: Logger) => Promise<SourceJson>;
|
|
6
6
|
export declare const source_json_serialize: (source_json: SourceJson) => string;
|
|
7
|
-
export declare const source_modules_create: (exports: PackageJsonExports | undefined, lib_path?: string, log?: Logger) => Array<ModuleJson> | undefined
|
|
7
|
+
export declare const source_modules_create: (exports: PackageJsonExports | undefined, lib_path?: string, log?: Logger) => Promise<Array<ModuleJson> | undefined>;
|
|
8
8
|
//# sourceMappingURL=source_json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source_json.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/source_json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAC,UAAU,EAAE,KAAK,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAChG,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"source_json.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/source_json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAC,UAAU,EAAE,KAAK,UAAU,EAAuB,MAAM,+BAA+B,CAAC;AAChG,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAMlD,MAAM,MAAM,gBAAgB,GAAG,CAC9B,WAAW,EAAE,UAAU,KACnB,UAAU,GAAG,IAAI,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;AAEpD,eAAO,MAAM,kBAAkB,GAC9B,cAAc,WAAW,EACzB,WAAW,MAAM,EACjB,MAAM,MAAM,KACV,OAAO,CAAC,UAAU,CAKlB,CAAC;AAEJ,eAAO,MAAM,qBAAqB,GAAI,aAAa,UAAU,KAAG,MAG/D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GACjC,SAAS,kBAAkB,GAAG,SAAS,EACvC,iBAAoB,EACpB,MAAM,MAAM,KACV,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,SAAS,CAgDvC,CAAC"}
|
package/dist/source_json.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { ensure_end, strip_start } from '@ryanatkn/belt/string.js';
|
|
3
|
-
import {
|
|
3
|
+
import { fs_exists, fs_search } from '@ryanatkn/belt/fs.js';
|
|
4
4
|
import ts from 'typescript';
|
|
5
5
|
import { SourceJson } from '@ryanatkn/belt/source_json.js';
|
|
6
6
|
import { paths, replace_extension } from "./paths.js";
|
|
7
7
|
import { parse_exports } from "./parse_exports.js";
|
|
8
8
|
import { TS_MATCHER, SVELTE_MATCHER, JSON_MATCHER, CSS_MATCHER } from "./constants.js";
|
|
9
|
-
|
|
10
|
-
export const source_json_create = (package_json, lib_path, log) => SourceJson.parse({
|
|
9
|
+
export const source_json_create = async (package_json, lib_path, log) => SourceJson.parse({
|
|
11
10
|
name: package_json.name,
|
|
12
11
|
version: package_json.version,
|
|
13
|
-
modules: source_modules_create(package_json.exports, lib_path, log),
|
|
12
|
+
modules: await source_modules_create(package_json.exports, lib_path, log),
|
|
14
13
|
});
|
|
15
14
|
export const source_json_serialize = (source_json) => {
|
|
16
15
|
const parsed = SourceJson.parse(source_json);
|
|
17
16
|
return JSON.stringify(parsed, null, 2) + '\n';
|
|
18
17
|
};
|
|
19
|
-
export const source_modules_create = (exports, lib_path = paths.lib, log) => {
|
|
18
|
+
export const source_modules_create = async (exports, lib_path = paths.lib, log) => {
|
|
20
19
|
if (!exports)
|
|
21
20
|
return;
|
|
22
|
-
const file_paths = collect_file_paths(exports, lib_path);
|
|
21
|
+
const file_paths = await collect_file_paths(exports, lib_path);
|
|
23
22
|
// Create a TypeScript program for all TypeScript files
|
|
24
23
|
const ts_files = file_paths
|
|
25
24
|
.filter(({ file_path }) => TS_MATCHER.test(file_path))
|
|
@@ -54,11 +53,11 @@ export const source_modules_create = (exports, lib_path = paths.lib, log) => {
|
|
|
54
53
|
}
|
|
55
54
|
return result;
|
|
56
55
|
};
|
|
57
|
-
const collect_file_paths = (exports, lib_path) => {
|
|
56
|
+
const collect_file_paths = async (exports, lib_path) => {
|
|
58
57
|
const file_paths = [];
|
|
59
58
|
// Handle string exports (single default export)
|
|
60
59
|
if (typeof exports === 'string') {
|
|
61
|
-
const source_file = infer_source_from_export(exports, lib_path);
|
|
60
|
+
const source_file = await infer_source_from_export(exports, lib_path);
|
|
62
61
|
if (source_file) {
|
|
63
62
|
file_paths.push({ export_key: '.', file_path: source_file });
|
|
64
63
|
}
|
|
@@ -75,7 +74,8 @@ const collect_file_paths = (exports, lib_path) => {
|
|
|
75
74
|
// Check if this is a pattern export
|
|
76
75
|
if (k.includes('*')) {
|
|
77
76
|
// Handle pattern exports by finding matching files in lib
|
|
78
|
-
|
|
77
|
+
// eslint-disable-next-line no-await-in-loop
|
|
78
|
+
const matching_files = await fs_search(lib_path, {
|
|
79
79
|
file_filter: (path) => {
|
|
80
80
|
const p = path.replace(ensure_end(lib_path, '/'), '');
|
|
81
81
|
// Only match files in the root directory (no subdirectories)
|
|
@@ -111,7 +111,8 @@ const collect_file_paths = (exports, lib_path) => {
|
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
113
113
|
// Handle explicit exports (non-patterns)
|
|
114
|
-
|
|
114
|
+
// eslint-disable-next-line no-await-in-loop
|
|
115
|
+
const source_file = await infer_source_from_export(k, lib_path);
|
|
115
116
|
if (source_file) {
|
|
116
117
|
file_paths.push({ export_key: k, file_path: source_file });
|
|
117
118
|
}
|
|
@@ -122,14 +123,14 @@ const collect_file_paths = (exports, lib_path) => {
|
|
|
122
123
|
}
|
|
123
124
|
return file_paths;
|
|
124
125
|
};
|
|
125
|
-
const infer_source_from_export = (export_path, lib_path) => {
|
|
126
|
+
const infer_source_from_export = async (export_path, lib_path) => {
|
|
126
127
|
// Handle index specially
|
|
127
128
|
if (export_path === '.' || export_path === './') {
|
|
128
129
|
const index_ts = join(lib_path, 'index.ts');
|
|
129
|
-
if (
|
|
130
|
+
if (await fs_exists(index_ts))
|
|
130
131
|
return index_ts;
|
|
131
132
|
const index_js = join(lib_path, 'index.js');
|
|
132
|
-
if (
|
|
133
|
+
if (await fs_exists(index_js))
|
|
133
134
|
return index_js;
|
|
134
135
|
return null;
|
|
135
136
|
}
|
|
@@ -137,12 +138,12 @@ const infer_source_from_export = (export_path, lib_path) => {
|
|
|
137
138
|
// For .js exports, try .ts first
|
|
138
139
|
if (clean_path.endsWith('.js')) {
|
|
139
140
|
const ts_path = join(lib_path, replace_extension(clean_path, '.ts'));
|
|
140
|
-
if (
|
|
141
|
+
if (await fs_exists(ts_path))
|
|
141
142
|
return ts_path;
|
|
142
143
|
}
|
|
143
144
|
// Try the exact path
|
|
144
145
|
const exact_path = join(lib_path, clean_path);
|
|
145
|
-
if (
|
|
146
|
+
if (await fs_exists(exact_path))
|
|
146
147
|
return exact_path;
|
|
147
148
|
return null;
|
|
148
149
|
};
|
|
@@ -43,7 +43,7 @@ export const sveltekit_sync = async (sveltekit_cli = SVELTEKIT_CLI, pm_cli = PM_
|
|
|
43
43
|
* If the SvelteKit CLI is found and its `.svelte-kit` directory is not, run `svelte-kit sync`.
|
|
44
44
|
*/
|
|
45
45
|
export const sveltekit_sync_if_available = async (sveltekit_cli = SVELTEKIT_CLI) => {
|
|
46
|
-
const found_sveltekit_cli = typeof sveltekit_cli === 'string' ? find_cli(sveltekit_cli) : sveltekit_cli;
|
|
46
|
+
const found_sveltekit_cli = typeof sveltekit_cli === 'string' ? await find_cli(sveltekit_cli) : sveltekit_cli;
|
|
47
47
|
if (found_sveltekit_cli) {
|
|
48
48
|
return sveltekit_sync(found_sveltekit_cli);
|
|
49
49
|
}
|
|
@@ -55,7 +55,7 @@ export const sveltekit_sync_if_obviously_needed = async (sveltekit_cli = SVELTEK
|
|
|
55
55
|
if (await fs_exists(SVELTEKIT_DEV_DIRNAME)) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
const found_sveltekit_cli = typeof sveltekit_cli === 'string' ? find_cli(sveltekit_cli) : sveltekit_cli;
|
|
58
|
+
const found_sveltekit_cli = typeof sveltekit_cli === 'string' ? await find_cli(sveltekit_cli) : sveltekit_cli;
|
|
59
59
|
if (!found_sveltekit_cli) {
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
@@ -67,7 +67,7 @@ export const run_svelte_package = async (package_json, options, cli, log, pm_cli
|
|
|
67
67
|
throw new TaskError('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
|
|
68
68
|
}
|
|
69
69
|
const cli_name = typeof cli === 'string' ? cli : cli.name;
|
|
70
|
-
const found_svelte_package_cli = cli === cli_name ? find_cli(cli) : cli;
|
|
70
|
+
const found_svelte_package_cli = cli === cli_name ? await find_cli(cli) : cli;
|
|
71
71
|
if (found_svelte_package_cli?.kind !== 'local') {
|
|
72
72
|
throw new TaskError(`Failed to find SvelteKit packaging CLI \`${cli_name}\`, do you need to run \`${pm_cli} install\`?`);
|
|
73
73
|
}
|
|
@@ -16,7 +16,7 @@ ${Object.entries(env)
|
|
|
16
16
|
else {
|
|
17
17
|
return `// shim for $env/dynamic/${visibility}
|
|
18
18
|
// @see https://github.com/sveltejs/kit/issues/1485
|
|
19
|
-
import {load_env} from '
|
|
19
|
+
import {load_env} from './env.js';
|
|
20
20
|
export const env = load_env(${dev}, ${JSON.stringify(visibility)}, ${JSON.stringify(public_prefix)}, ${JSON.stringify(private_prefix)}, ${JSON.stringify(env_dir)}, ${JSON.stringify(env_files)}, ${JSON.stringify(ambient_env)});
|
|
21
21
|
`;
|
|
22
22
|
}
|
package/dist/task.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export type FindModulesFailure = {
|
|
|
78
78
|
/**
|
|
79
79
|
* Finds modules from input paths. (see `src/lib/input_path.ts` for more)
|
|
80
80
|
*/
|
|
81
|
-
export declare const find_tasks: (input_paths: Array<InputPath>, task_root_dirs: Array<PathId>, config: GroConfig, timings?: Timings) => FindTasksResult
|
|
81
|
+
export declare const find_tasks: (input_paths: Array<InputPath>, task_root_dirs: Array<PathId>, config: GroConfig, timings?: Timings) => Promise<FindTasksResult>;
|
|
82
82
|
export interface LoadedTasks {
|
|
83
83
|
modules: Array<TaskModuleMeta>;
|
|
84
84
|
found_tasks: FoundTasks;
|
package/dist/task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AAEvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAErD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/task.ts"],"names":[],"mappings":"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"}
|
package/dist/task.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ensure_end, strip_end, strip_start } from '@ryanatkn/belt/string.js';
|
|
2
2
|
import { styleText as st } from 'node:util';
|
|
3
3
|
import { isAbsolute, join, relative } from 'node:path';
|
|
4
|
+
import { fs_search } from '@ryanatkn/belt/fs.js';
|
|
4
5
|
import { resolve_input_files, resolve_input_paths, } from "./input_path.js";
|
|
5
6
|
import { GRO_DIST_DIR, print_path } from "./paths.js";
|
|
6
|
-
import { search_fs } from "./search_fs.js";
|
|
7
7
|
import { load_modules } from "./modules.js";
|
|
8
8
|
export const TASK_FILE_SUFFIX_TS = '.task.ts';
|
|
9
9
|
export const TASK_FILE_SUFFIX_JS = '.task.js';
|
|
@@ -43,10 +43,10 @@ export class SilentError extends Error {
|
|
|
43
43
|
/**
|
|
44
44
|
* Finds modules from input paths. (see `src/lib/input_path.ts` for more)
|
|
45
45
|
*/
|
|
46
|
-
export const find_tasks = (input_paths, task_root_dirs, config, timings) => {
|
|
46
|
+
export const find_tasks = async (input_paths, task_root_dirs, config, timings) => {
|
|
47
47
|
// Check which extension variation works - if it's a directory, prefer others first!
|
|
48
48
|
const timing_to_resolve_input_paths = timings?.start('resolve input paths');
|
|
49
|
-
const { resolved_input_paths, unmapped_input_paths } = resolve_input_paths(input_paths, task_root_dirs, TASK_FILE_SUFFIXES);
|
|
49
|
+
const { resolved_input_paths, unmapped_input_paths } = await resolve_input_paths(input_paths, task_root_dirs, TASK_FILE_SUFFIXES);
|
|
50
50
|
timing_to_resolve_input_paths?.();
|
|
51
51
|
// Error if any input path could not be mapped.
|
|
52
52
|
if (unmapped_input_paths.length) {
|
|
@@ -62,7 +62,7 @@ export const find_tasks = (input_paths, task_root_dirs, config, timings) => {
|
|
|
62
62
|
}
|
|
63
63
|
// Find all of the files for any directories.
|
|
64
64
|
const timing_to_resolve_input_files = timings?.start('resolve input files');
|
|
65
|
-
const { resolved_input_files, resolved_input_files_by_root_dir, input_directories_with_no_files } = resolve_input_files(resolved_input_paths, (id) =>
|
|
65
|
+
const { resolved_input_files, resolved_input_files_by_root_dir, input_directories_with_no_files } = await resolve_input_files(resolved_input_paths, async (id) => await fs_search(id, {
|
|
66
66
|
filter: config.search_filters,
|
|
67
67
|
file_filter: (p) => TASK_FILE_SUFFIXES.some((s) => p.endsWith(s)),
|
|
68
68
|
}));
|
package/dist/test.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/test.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAO/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;kBAWf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"test.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/test.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAO/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;kBAWf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAgC3B,CAAC"}
|
package/dist/test.task.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { spawn_cli } from '
|
|
2
|
+
import { spawn_cli } from './cli.js';
|
|
3
3
|
import { TaskError } from "./task.js";
|
|
4
4
|
import { find_cli } from "./cli.js";
|
|
5
|
-
import { has_dep } from "./package_json.js";
|
|
5
|
+
import { has_dep, load_package_json } from "./package_json.js";
|
|
6
6
|
import { serialize_args, to_implicit_forwarded_args } from "./args.js";
|
|
7
7
|
import { VITEST_CLI } from "./constants.js";
|
|
8
8
|
import { paths } from "./paths.js";
|
|
@@ -25,10 +25,11 @@ export const task = {
|
|
|
25
25
|
Args,
|
|
26
26
|
run: async ({ args }) => {
|
|
27
27
|
const { _: patterns, dir, fail_without_tests, t } = args;
|
|
28
|
-
|
|
28
|
+
const package_json = await load_package_json();
|
|
29
|
+
if (!has_dep(VITEST_CLI, package_json)) {
|
|
29
30
|
throw new TaskError('no test runner found, install vitest');
|
|
30
31
|
}
|
|
31
|
-
if (!find_cli(VITEST_CLI)) {
|
|
32
|
+
if (!(await find_cli(VITEST_CLI))) {
|
|
32
33
|
throw new TaskError('vitest is a dependency but not installed; run `npm i`?');
|
|
33
34
|
}
|
|
34
35
|
const vitest_args = ['run', ...patterns];
|
package/dist/typecheck.task.js
CHANGED
|
@@ -31,10 +31,10 @@ export const task = {
|
|
|
31
31
|
const { svelte_check_cli, typescript_cli, path_replacement, cwd } = args;
|
|
32
32
|
await sveltekit_sync_if_available();
|
|
33
33
|
// Prefer svelte-check if available.
|
|
34
|
-
const found_svelte_check_cli = find_cli(svelte_check_cli);
|
|
34
|
+
const found_svelte_check_cli = await find_cli(svelte_check_cli);
|
|
35
35
|
if (found_svelte_check_cli) {
|
|
36
36
|
const serialized = serialize_args(to_forwarded_args(svelte_check_cli));
|
|
37
|
-
const spawned = spawn_cli_process(found_svelte_check_cli, serialized, undefined, {
|
|
37
|
+
const spawned = await spawn_cli_process(found_svelte_check_cli, serialized, undefined, {
|
|
38
38
|
stdio: ['inherit', 'pipe', 'pipe'],
|
|
39
39
|
env: { ...process.env, FORCE_COLOR: '1' }, // Needed for colors (maybe make an option)
|
|
40
40
|
});
|
|
@@ -50,7 +50,7 @@ export const task = {
|
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
52
|
// Fall back to tsc.
|
|
53
|
-
const found_typescript_cli = find_cli(typescript_cli);
|
|
53
|
+
const found_typescript_cli = await find_cli(typescript_cli);
|
|
54
54
|
if (found_typescript_cli) {
|
|
55
55
|
const forwarded = to_forwarded_args(typescript_cli);
|
|
56
56
|
if (!forwarded.noEmit)
|
package/dist/upgrade.task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from '@ryanatkn/belt/process.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { rm } from 'node:fs/promises';
|
|
4
4
|
import { GitOrigin, git_pull } from '@ryanatkn/belt/git.js';
|
|
5
5
|
import { TaskError } from "./task.js";
|
|
6
6
|
import { extract_deps, load_package_json } from "./package_json.js";
|
|
@@ -57,13 +57,13 @@ export const task = {
|
|
|
57
57
|
}
|
|
58
58
|
if (delete_node_modules) {
|
|
59
59
|
log.info(`deleting node_modules at `, node_modules_path);
|
|
60
|
-
|
|
60
|
+
await rm(node_modules_path, { recursive: true, force: true });
|
|
61
61
|
}
|
|
62
62
|
if (delete_lockfile) {
|
|
63
63
|
log.info(`deleting lockfile at`, lockfile_path);
|
|
64
|
-
|
|
64
|
+
await rm(lockfile_path, { force: true });
|
|
65
65
|
}
|
|
66
|
-
const package_json = load_package_json();
|
|
66
|
+
const package_json = await load_package_json();
|
|
67
67
|
const all_deps = extract_deps(package_json);
|
|
68
68
|
const deps = only.length
|
|
69
69
|
? all_deps.filter((d) => only.includes(d.name))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryanatkn/gro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.180.0",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"glyph": "🌰",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"typescript"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"chokidar": "^
|
|
52
|
+
"chokidar": "^5.0.0",
|
|
53
53
|
"dotenv": "^17.2.3",
|
|
54
54
|
"esm-env": "^1.2.2",
|
|
55
55
|
"mri": "^1.2.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"zod": "^4.1.13"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@ryanatkn/belt": ">=0.
|
|
64
|
+
"@ryanatkn/belt": ">=0.41.1",
|
|
65
65
|
"@sveltejs/kit": "^2",
|
|
66
66
|
"esbuild": "^0.27.0",
|
|
67
67
|
"svelte": "^5",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@changesets/changelog-git": "^0.2.1",
|
|
84
84
|
"@changesets/types": "^6.1.0",
|
|
85
|
-
"@ryanatkn/belt": "^0.
|
|
85
|
+
"@ryanatkn/belt": "^0.41.1",
|
|
86
86
|
"@ryanatkn/eslint-config": "^0.9.0",
|
|
87
|
-
"@ryanatkn/fuz": "^0.
|
|
87
|
+
"@ryanatkn/fuz": "^0.167.0",
|
|
88
88
|
"@ryanatkn/fuz_code": "^0.36.0",
|
|
89
89
|
"@ryanatkn/moss": "^0.39.0",
|
|
90
90
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
@@ -95,11 +95,11 @@
|
|
|
95
95
|
"esbuild": "^0.27.0",
|
|
96
96
|
"eslint": "^9.39.1",
|
|
97
97
|
"eslint-plugin-svelte": "^3.13.0",
|
|
98
|
-
"svelte": "^5.44.
|
|
98
|
+
"svelte": "^5.44.1",
|
|
99
99
|
"svelte-check": "^4.3.4",
|
|
100
100
|
"typescript": "^5.9.3",
|
|
101
101
|
"typescript-eslint": "^8.48.0",
|
|
102
|
-
"vitest": "^4.0.
|
|
102
|
+
"vitest": "^4.0.14"
|
|
103
103
|
},
|
|
104
104
|
"prettier": {
|
|
105
105
|
"plugins": [
|
package/src/lib/build.task.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {z} from 'zod';
|
|
2
2
|
import {styleText as st} from 'node:util';
|
|
3
3
|
import {git_check_clean_workspace, git_current_commit_hash} from '@ryanatkn/belt/git.js';
|
|
4
|
-
import {
|
|
4
|
+
import {rm} from 'node:fs/promises';
|
|
5
5
|
import {join} from 'node:path';
|
|
6
|
+
import {fs_exists} from '@ryanatkn/belt/fs.js';
|
|
6
7
|
|
|
7
8
|
import {TaskError, type Task} from './task.ts';
|
|
8
9
|
import {Plugins} from './plugin.ts';
|
|
@@ -19,6 +20,8 @@ import {paths} from './paths.ts';
|
|
|
19
20
|
export const Args = z.strictObject({
|
|
20
21
|
sync: z.boolean().meta({description: 'dual of no-sync'}).default(true),
|
|
21
22
|
'no-sync': z.boolean().meta({description: 'opt out of gro sync'}).default(false),
|
|
23
|
+
gen: z.boolean().meta({description: 'dual of no-gen'}).default(true),
|
|
24
|
+
'no-gen': z.boolean().meta({description: 'opt out of gro gen'}).default(false),
|
|
22
25
|
install: z.boolean().meta({description: 'dual of no-install'}).default(true),
|
|
23
26
|
'no-install': z // convenience, same as `gro build -- gro sync --no-install` but the latter takes precedence
|
|
24
27
|
.boolean()
|
|
@@ -49,11 +52,15 @@ export const task: Task<Args> = {
|
|
|
49
52
|
Args,
|
|
50
53
|
run: async (ctx): Promise<void> => {
|
|
51
54
|
const {args, invoke_task, log, config} = ctx;
|
|
52
|
-
const {sync, install, force_build} = args;
|
|
55
|
+
const {sync, gen, install, force_build} = args;
|
|
53
56
|
|
|
54
57
|
if (sync || install) {
|
|
55
58
|
if (!sync) log.warn('sync is false but install is true, so ignoring the sync option');
|
|
56
|
-
await invoke_task('sync', {install});
|
|
59
|
+
await invoke_task('sync', {install, gen: false});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (gen) {
|
|
63
|
+
await invoke_task('gen');
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
// Batch git calls upfront for performance (spawning processes is expensive)
|
|
@@ -81,15 +88,13 @@ export const task: Task<Args> = {
|
|
|
81
88
|
// Rationale: Uncommitted changes could be reverted, leaving cached outputs from reverted code.
|
|
82
89
|
// This conservative approach prioritizes safety over convenience during development.
|
|
83
90
|
const cache_path = join(paths.build, 'build.json');
|
|
84
|
-
if (
|
|
85
|
-
|
|
91
|
+
if (await fs_exists(cache_path)) {
|
|
92
|
+
await rm(cache_path, {force: true});
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
// Delete all build output directories
|
|
89
|
-
build_dirs = discover_build_output_dirs();
|
|
90
|
-
|
|
91
|
-
rmSync(dir, {recursive: true, force: true});
|
|
92
|
-
}
|
|
96
|
+
build_dirs = await discover_build_output_dirs();
|
|
97
|
+
await Promise.all(build_dirs.map((dir) => rm(dir, {recursive: true, force: true})));
|
|
93
98
|
|
|
94
99
|
log.info(st('yellow', 'workspace has uncommitted changes - skipping build cache'));
|
|
95
100
|
// Skip clean_fs - already manually cleaned cache and all build outputs above
|
|
@@ -138,7 +143,7 @@ export const task: Task<Args> = {
|
|
|
138
143
|
} else {
|
|
139
144
|
// Commit is stable - safe to save cache
|
|
140
145
|
const metadata = await create_build_cache_metadata(config, log, initial_commit, build_dirs);
|
|
141
|
-
save_build_cache_metadata(metadata, log);
|
|
146
|
+
await save_build_cache_metadata(metadata, log);
|
|
142
147
|
log.debug('Build cache metadata saved');
|
|
143
148
|
}
|
|
144
149
|
}
|