@ryanatkn/gro 0.147.1 → 0.149.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/README.md +5 -3
- package/dist/args.d.ts +5 -5
- package/dist/args.d.ts.map +1 -1
- package/dist/build.task.d.ts.map +1 -1
- package/dist/changelog.d.ts +2 -1
- package/dist/changelog.d.ts.map +1 -1
- package/dist/changeset.task.d.ts.map +1 -1
- package/dist/changeset_helpers.d.ts.map +1 -1
- package/dist/check.task.d.ts.map +1 -1
- package/dist/child_process_logging.d.ts +10 -0
- package/dist/child_process_logging.d.ts.map +1 -0
- package/dist/child_process_logging.js +26 -0
- package/dist/clean.task.d.ts.map +1 -1
- package/dist/clean_fs.d.ts.map +1 -1
- package/dist/cli.d.ts +4 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/commit.task.d.ts.map +1 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -0
- package/dist/deploy.task.d.ts +2 -2
- package/dist/deploy.task.d.ts.map +1 -1
- package/dist/dev.task.d.ts.map +1 -1
- package/dist/env.d.ts.map +1 -1
- package/dist/esbuild_helpers.d.ts.map +1 -1
- package/dist/esbuild_helpers.js +1 -1
- package/dist/esbuild_plugin_external_worker.d.ts +2 -2
- package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
- package/dist/esbuild_plugin_svelte.d.ts +1 -1
- package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
- package/dist/filer.d.ts.map +1 -1
- package/dist/format.task.d.ts.map +1 -1
- package/dist/format_directory.d.ts.map +1 -1
- package/dist/format_file.d.ts.map +1 -1
- package/dist/fs.d.ts.map +1 -1
- package/dist/gen.d.ts +23 -22
- package/dist/gen.d.ts.map +1 -1
- package/dist/gen.task.d.ts.map +1 -1
- package/dist/git.d.ts.map +1 -1
- package/dist/github.d.ts +3 -1
- package/dist/github.d.ts.map +1 -1
- package/dist/gro.config.default.d.ts.map +1 -1
- package/dist/gro.d.ts.map +1 -1
- package/dist/gro.js +1 -1
- package/dist/gro_config.d.ts +5 -5
- package/dist/gro_config.d.ts.map +1 -1
- package/dist/gro_helpers.d.ts +1 -1
- package/dist/gro_helpers.d.ts.map +1 -1
- package/dist/gro_plugin_gen.d.ts +2 -2
- package/dist/gro_plugin_gen.d.ts.map +1 -1
- package/dist/gro_plugin_moss.d.ts +1 -1
- package/dist/gro_plugin_moss.d.ts.map +1 -1
- package/dist/gro_plugin_moss.js +1 -1
- package/dist/gro_plugin_server.d.ts +2 -2
- package/dist/gro_plugin_server.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_library.d.ts.map +1 -1
- package/dist/hash.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/input_path.d.ts +10 -10
- package/dist/input_path.d.ts.map +1 -1
- package/dist/invoke.d.ts.map +1 -1
- package/dist/invoke.js +2 -0
- package/dist/invoke_task.d.ts.map +1 -1
- package/dist/lint.task.d.ts.map +1 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/modules.d.ts +6 -5
- package/dist/modules.d.ts.map +1 -1
- package/dist/package.d.ts +11 -1
- package/dist/package.d.ts.map +1 -1
- package/dist/package.gen.d.ts.map +1 -1
- package/dist/package.js +42 -31
- package/dist/package_json.d.ts +2 -2
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_meta.d.ts.map +1 -1
- package/dist/parse_imports.d.ts +1 -1
- package/dist/parse_imports.d.ts.map +1 -1
- package/dist/parse_imports.js +122 -12
- package/dist/path.d.ts.map +1 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.d.ts.map +1 -1
- package/dist/publish.task.d.ts.map +1 -1
- package/dist/register.d.ts.map +1 -1
- package/dist/reinstall.task.d.ts.map +1 -1
- package/dist/release.task.d.ts.map +1 -1
- package/dist/resolve.task.d.ts.map +1 -1
- package/dist/resolve_specifier.d.ts.map +1 -1
- package/dist/run.task.d.ts.map +1 -1
- package/dist/run_gen.d.ts +1 -1
- package/dist/run_gen.d.ts.map +1 -1
- package/dist/run_task.d.ts.map +1 -1
- package/dist/search_fs.d.ts +3 -3
- package/dist/search_fs.d.ts.map +1 -1
- package/dist/src_json.d.ts.map +1 -1
- package/dist/svelte_helpers.d.ts.map +1 -1
- package/dist/sveltekit_config.d.ts +1 -1
- package/dist/sveltekit_config.d.ts.map +1 -1
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_shim_app.d.ts.map +1 -1
- package/dist/sveltekit_shim_app_environment.d.ts.map +1 -1
- package/dist/sveltekit_shim_app_forms.d.ts.map +1 -1
- package/dist/sveltekit_shim_app_navigation.d.ts.map +1 -1
- package/dist/sveltekit_shim_app_paths.d.ts.map +1 -1
- package/dist/sveltekit_shim_app_stores.d.ts.map +1 -1
- package/dist/sveltekit_shim_env.d.ts +1 -1
- package/dist/sveltekit_shim_env.d.ts.map +1 -1
- package/dist/sync.task.d.ts.map +1 -1
- package/dist/task.d.ts +19 -19
- package/dist/task.d.ts.map +1 -1
- package/dist/task_logging.d.ts +1 -1
- package/dist/task_logging.d.ts.map +1 -1
- package/dist/task_logging.js +2 -2
- package/dist/test.task.d.ts.map +1 -1
- package/dist/typecheck.task.d.ts +6 -0
- package/dist/typecheck.task.d.ts.map +1 -1
- package/dist/typecheck.task.js +20 -5
- package/dist/upgrade.task.d.ts.map +1 -1
- package/dist/watch_dir.d.ts.map +1 -1
- package/package.json +33 -30
- package/src/lib/args.ts +10 -10
- package/src/lib/child_process_logging.ts +38 -0
- package/src/lib/cli.ts +3 -3
- package/src/lib/constants.ts +2 -0
- package/src/lib/esbuild_helpers.ts +1 -1
- package/src/lib/esbuild_plugin_external_worker.ts +2 -2
- package/src/lib/esbuild_plugin_svelte.ts +1 -1
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +1 -1
- package/src/lib/gen.ts +28 -26
- package/src/lib/github.ts +2 -2
- package/src/lib/gro.ts +1 -1
- package/src/lib/gro_config.ts +5 -5
- package/src/lib/gro_helpers.ts +1 -1
- package/src/lib/gro_plugin_gen.ts +3 -3
- package/src/lib/gro_plugin_moss.ts +2 -2
- package/src/lib/gro_plugin_server.ts +2 -2
- package/src/lib/gro_plugin_sveltekit_app.ts +1 -1
- package/src/lib/input_path.ts +23 -23
- package/src/lib/invoke.ts +2 -0
- package/src/lib/modules.ts +8 -8
- package/src/lib/package.ts +42 -31
- package/src/lib/package_json.ts +2 -2
- package/src/lib/parse_imports.ts +151 -14
- package/src/lib/plugin.ts +4 -4
- package/src/lib/run_gen.ts +1 -1
- package/src/lib/search_fs.ts +8 -8
- package/src/lib/src_json.ts +1 -1
- package/src/lib/sveltekit_config.ts +1 -1
- package/src/lib/sveltekit_shim_app_stores.ts +3 -0
- package/src/lib/sveltekit_shim_env.ts +1 -1
- package/src/lib/task.ts +20 -20
- package/src/lib/task_logging.ts +8 -8
- package/src/lib/typecheck.task.ts +24 -5
- package/src/lib/upgrade.task.ts +1 -1
package/src/lib/task.ts
CHANGED
|
@@ -95,40 +95,40 @@ export interface Found_Task {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
export interface Found_Tasks {
|
|
98
|
-
resolved_input_files: Resolved_Input_File
|
|
99
|
-
resolved_input_files_by_root_dir: Map<Path_Id, Resolved_Input_File
|
|
100
|
-
resolved_input_paths: Resolved_Input_Path
|
|
101
|
-
input_paths: Input_Path
|
|
102
|
-
task_root_dirs: Path_Id
|
|
98
|
+
resolved_input_files: Array<Resolved_Input_File>;
|
|
99
|
+
resolved_input_files_by_root_dir: Map<Path_Id, Array<Resolved_Input_File>>;
|
|
100
|
+
resolved_input_paths: Array<Resolved_Input_Path>;
|
|
101
|
+
input_paths: Array<Input_Path>;
|
|
102
|
+
task_root_dirs: Array<Path_Id>;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export type Find_Tasks_Result = Result<{value: Found_Tasks}, Find_Modules_Failure>;
|
|
106
106
|
export type Find_Modules_Failure =
|
|
107
107
|
| {
|
|
108
108
|
type: 'unmapped_input_paths';
|
|
109
|
-
unmapped_input_paths: Input_Path
|
|
110
|
-
resolved_input_paths: Resolved_Input_Path
|
|
111
|
-
input_paths: Input_Path
|
|
112
|
-
task_root_dirs: Path_Id
|
|
113
|
-
reasons: string
|
|
109
|
+
unmapped_input_paths: Array<Input_Path>;
|
|
110
|
+
resolved_input_paths: Array<Resolved_Input_Path>;
|
|
111
|
+
input_paths: Array<Input_Path>;
|
|
112
|
+
task_root_dirs: Array<Path_Id>;
|
|
113
|
+
reasons: Array<string>;
|
|
114
114
|
}
|
|
115
115
|
| {
|
|
116
116
|
type: 'input_directories_with_no_files';
|
|
117
|
-
input_directories_with_no_files: Input_Path
|
|
118
|
-
resolved_input_files: Resolved_Input_File
|
|
119
|
-
resolved_input_files_by_root_dir: Map<Path_Id, Resolved_Input_File
|
|
120
|
-
resolved_input_paths: Resolved_Input_Path
|
|
121
|
-
input_paths: Input_Path
|
|
122
|
-
task_root_dirs: Path_Id
|
|
123
|
-
reasons: string
|
|
117
|
+
input_directories_with_no_files: Array<Input_Path>;
|
|
118
|
+
resolved_input_files: Array<Resolved_Input_File>;
|
|
119
|
+
resolved_input_files_by_root_dir: Map<Path_Id, Array<Resolved_Input_File>>;
|
|
120
|
+
resolved_input_paths: Array<Resolved_Input_Path>;
|
|
121
|
+
input_paths: Array<Input_Path>;
|
|
122
|
+
task_root_dirs: Array<Path_Id>;
|
|
123
|
+
reasons: Array<string>;
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
127
|
* Finds modules from input paths. (see `src/lib/input_path.ts` for more)
|
|
128
128
|
*/
|
|
129
129
|
export const find_tasks = (
|
|
130
|
-
input_paths: Input_Path
|
|
131
|
-
task_root_dirs: Path_Id
|
|
130
|
+
input_paths: Array<Input_Path>,
|
|
131
|
+
task_root_dirs: Array<Path_Id>,
|
|
132
132
|
config: Gro_Config,
|
|
133
133
|
timings?: Timings,
|
|
134
134
|
): Find_Tasks_Result => {
|
|
@@ -197,7 +197,7 @@ export const find_tasks = (
|
|
|
197
197
|
};
|
|
198
198
|
|
|
199
199
|
export interface Loaded_Tasks {
|
|
200
|
-
modules: Task_Module_Meta
|
|
200
|
+
modules: Array<Task_Module_Meta>;
|
|
201
201
|
found_tasks: Found_Tasks;
|
|
202
202
|
}
|
|
203
203
|
|
package/src/lib/task_logging.ts
CHANGED
|
@@ -12,7 +12,7 @@ export const log_tasks = (log: Logger, loaded_tasks: Loaded_Tasks, log_intro = t
|
|
|
12
12
|
const {modules, found_tasks} = loaded_tasks;
|
|
13
13
|
const {resolved_input_files_by_root_dir} = found_tasks;
|
|
14
14
|
|
|
15
|
-
const logged: string
|
|
15
|
+
const logged: Array<string> = [];
|
|
16
16
|
if (log_intro) {
|
|
17
17
|
logged.unshift(
|
|
18
18
|
`\n\n${st('gray', 'Run a task:')} gro [name]`,
|
|
@@ -44,7 +44,7 @@ export const log_tasks = (log: Logger, loaded_tasks: Loaded_Tasks, log_intro = t
|
|
|
44
44
|
log[log_intro ? 'info' : 'plain'](logged.join('') + '\n');
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
export const log_error_reasons = (log: Logger, reasons: string
|
|
47
|
+
export const log_error_reasons = (log: Logger, reasons: Array<string>): void => {
|
|
48
48
|
for (const reason of reasons) {
|
|
49
49
|
log.error(st('red', reason));
|
|
50
50
|
}
|
|
@@ -57,7 +57,7 @@ export const log_task_help = (log: Logger, meta: Task_Module_Meta): void => {
|
|
|
57
57
|
name,
|
|
58
58
|
mod: {task},
|
|
59
59
|
} = meta;
|
|
60
|
-
const logged: string
|
|
60
|
+
const logged: Array<string> = [];
|
|
61
61
|
logged.push(
|
|
62
62
|
st('cyan', name),
|
|
63
63
|
'help',
|
|
@@ -93,7 +93,7 @@ interface Arg_Schema_Property {
|
|
|
93
93
|
schema: Arg_Schema;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const to_arg_properties = (def: ZodTypeDef, meta: Task_Module_Meta): Arg_Schema_Property
|
|
96
|
+
const to_arg_properties = (def: ZodTypeDef, meta: Task_Module_Meta): Array<Arg_Schema_Property> => {
|
|
97
97
|
const type_name = to_type_name(def);
|
|
98
98
|
if (type_name !== ZodFirstPartyTypeKind.ZodObject) {
|
|
99
99
|
throw Error(
|
|
@@ -101,7 +101,7 @@ const to_arg_properties = (def: ZodTypeDef, meta: Task_Module_Meta): Arg_Schema_
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
const shape = (def as ZodObjectDef).shape();
|
|
104
|
-
const properties: Arg_Schema_Property
|
|
104
|
+
const properties: Array<Arg_Schema_Property> = [];
|
|
105
105
|
for (const name in shape) {
|
|
106
106
|
if ('no-' + name in shape) continue;
|
|
107
107
|
const s = shape[name];
|
|
@@ -115,7 +115,7 @@ const to_arg_properties = (def: ZodTypeDef, meta: Task_Module_Meta): Arg_Schema_
|
|
|
115
115
|
return properties;
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
const to_max_length = <T>(items: T
|
|
118
|
+
const to_max_length = <T>(items: Array<T>, toString: (item: T) => string) =>
|
|
119
119
|
items.reduce((max, m) => Math.max(toString(m).length, max), 0);
|
|
120
120
|
|
|
121
121
|
// The following Zod helpers only need to support single-depth schemas for CLI args,
|
|
@@ -131,11 +131,11 @@ const to_args_schema_type = ({_def}: ZodTypeAny): Arg_Schema['type'] => {
|
|
|
131
131
|
case ZodFirstPartyTypeKind.ZodNumber:
|
|
132
132
|
return 'number';
|
|
133
133
|
case ZodFirstPartyTypeKind.ZodArray:
|
|
134
|
-
return 'string
|
|
134
|
+
return 'Array<string>'; // TODO support arrays of arbitrary types, or more hardcoded ones as needed
|
|
135
135
|
case ZodFirstPartyTypeKind.ZodEnum:
|
|
136
136
|
return _def.values.map((v: string) => `'${v}'`).join(' | ');
|
|
137
137
|
case ZodFirstPartyTypeKind.ZodUnion:
|
|
138
|
-
return 'string | string
|
|
138
|
+
return 'string | Array<string>'; // TODO support unions of arbitrary types, or more hardcoded ones as needed
|
|
139
139
|
default: {
|
|
140
140
|
const subschema = to_subschema(_def);
|
|
141
141
|
if (subschema) {
|
|
@@ -3,8 +3,10 @@ import {z} from 'zod';
|
|
|
3
3
|
|
|
4
4
|
import {Task_Error, type Task} from './task.js';
|
|
5
5
|
import {serialize_args, to_forwarded_args} from './args.js';
|
|
6
|
-
import {find_cli, spawn_cli} from './cli.js';
|
|
6
|
+
import {find_cli, spawn_cli, spawn_cli_process} from './cli.js';
|
|
7
7
|
import {SVELTE_CHECK_CLI, sveltekit_sync_if_available} from './sveltekit_helpers.js';
|
|
8
|
+
import {configure_colored_output_with_path_replacement} from './child_process_logging.js';
|
|
9
|
+
import {paths} from './paths.js';
|
|
8
10
|
|
|
9
11
|
export const Args = z
|
|
10
12
|
.object({
|
|
@@ -14,6 +16,10 @@ export const Args = z
|
|
|
14
16
|
typescript_cli: z
|
|
15
17
|
.string({description: 'the TypeScript CLI to use as a fallback to svelte-check'})
|
|
16
18
|
.default('tsc'),
|
|
19
|
+
path_replacement: z
|
|
20
|
+
.string({description: 'replacement string for current working directory in output'})
|
|
21
|
+
.default('.'),
|
|
22
|
+
cwd: z.string({description: 'current working directory'}).default(paths.root),
|
|
17
23
|
})
|
|
18
24
|
.strict();
|
|
19
25
|
export type Args = z.infer<typeof Args>;
|
|
@@ -22,7 +28,7 @@ export const task: Task<Args> = {
|
|
|
22
28
|
summary: 'run tsc on the project without emitting any files',
|
|
23
29
|
Args,
|
|
24
30
|
run: async ({args, log}): Promise<void> => {
|
|
25
|
-
const {svelte_check_cli, typescript_cli} = args;
|
|
31
|
+
const {svelte_check_cli, typescript_cli, path_replacement, cwd} = args;
|
|
26
32
|
|
|
27
33
|
await sveltekit_sync_if_available();
|
|
28
34
|
|
|
@@ -30,10 +36,23 @@ export const task: Task<Args> = {
|
|
|
30
36
|
const found_svelte_check_cli = find_cli(svelte_check_cli);
|
|
31
37
|
if (found_svelte_check_cli) {
|
|
32
38
|
const serialized = serialize_args(to_forwarded_args(svelte_check_cli));
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
const spawned = spawn_cli_process(found_svelte_check_cli, serialized, undefined, {
|
|
40
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
41
|
+
env: {...process.env, FORCE_COLOR: '1'}, // Needed for colors (maybe make an option)
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const svelte_check_process = spawned?.child;
|
|
45
|
+
if (svelte_check_process) {
|
|
46
|
+
// Configure process output with path replacement while preserving colors
|
|
47
|
+
configure_colored_output_with_path_replacement(svelte_check_process, path_replacement, cwd);
|
|
48
|
+
|
|
49
|
+
const svelte_check_result = await spawned.closed;
|
|
50
|
+
|
|
51
|
+
if (!svelte_check_result.ok) {
|
|
52
|
+
throw new Task_Error(`Failed to typecheck. ${print_spawn_result(svelte_check_result)}`);
|
|
53
|
+
}
|
|
36
54
|
}
|
|
55
|
+
|
|
37
56
|
return;
|
|
38
57
|
}
|
|
39
58
|
|
package/src/lib/upgrade.task.ts
CHANGED
|
@@ -79,7 +79,7 @@ const CUSTOM_TAG_MATCHER = /^[\^~><=]*.+-(.+)/;
|
|
|
79
79
|
|
|
80
80
|
// TODO hacky and limited
|
|
81
81
|
// TODO probably want to pass through exact deps as well, e.g. @foo/bar@1
|
|
82
|
-
const to_upgrade_items = (deps: Package_Json_Dep
|
|
82
|
+
const to_upgrade_items = (deps: Array<Package_Json_Dep>): Array<string> =>
|
|
83
83
|
deps.map((dep) => {
|
|
84
84
|
if (EXACT_VERSION_MATCHER.test(dep.name)) {
|
|
85
85
|
return dep.name;
|