@ryanatkn/gro 0.176.0 → 0.177.1
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.d.ts +5 -5
- package/dist/args.d.ts.map +1 -1
- package/dist/build.task.d.ts.map +1 -1
- package/dist/build.task.js +2 -2
- package/dist/build_cache.d.ts +12 -12
- package/dist/build_cache.d.ts.map +1 -1
- package/dist/build_cache.js +4 -4
- package/dist/changelog.d.ts +2 -2
- package/dist/changelog.d.ts.map +1 -1
- package/dist/changelog.js +1 -1
- package/dist/changeset.task.d.ts.map +1 -1
- package/dist/changeset.task.js +9 -9
- package/dist/changeset_helpers.d.ts +4 -4
- package/dist/changeset_helpers.d.ts.map +1 -1
- package/dist/changeset_helpers.js +2 -2
- package/dist/check.task.d.ts.map +1 -1
- package/dist/check.task.js +3 -3
- package/dist/clean.task.js +2 -2
- package/dist/cli.d.ts +6 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/commit.task.js +2 -2
- package/dist/deploy.task.d.ts.map +1 -1
- package/dist/deploy.task.js +13 -13
- package/dist/dev.task.d.ts +2 -2
- package/dist/dev.task.d.ts.map +1 -1
- package/dist/disknode.d.ts +4 -4
- package/dist/disknode.d.ts.map +1 -1
- package/dist/esbuild_helpers.d.ts +2 -2
- package/dist/esbuild_helpers.d.ts.map +1 -1
- package/dist/esbuild_plugin_external_worker.d.ts +5 -5
- package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
- package/dist/esbuild_plugin_svelte.d.ts +4 -4
- package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts +2 -2
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts +5 -5
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +2 -2
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
- package/dist/filer.d.ts +15 -15
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +2 -2
- package/dist/format.task.d.ts.map +1 -1
- package/dist/format.task.js +2 -2
- package/dist/format_directory.d.ts +2 -2
- package/dist/format_directory.d.ts.map +1 -1
- package/dist/gen.d.ts +73 -73
- package/dist/gen.d.ts.map +1 -1
- package/dist/gen.js +1 -1
- package/dist/gen.task.d.ts.map +1 -1
- package/dist/gen.task.js +8 -8
- package/dist/gen_helpers.d.ts +4 -4
- package/dist/gen_helpers.d.ts.map +1 -1
- package/dist/gen_helpers.js +1 -1
- package/dist/github.d.ts +4 -4
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +3 -3
- package/dist/gro.config.default.d.ts +2 -2
- package/dist/gro.config.default.d.ts.map +1 -1
- package/dist/gro_config.d.ts +25 -25
- package/dist/gro_config.d.ts.map +1 -1
- package/dist/gro_config.js +2 -2
- package/dist/gro_helpers.d.ts +2 -2
- package/dist/gro_helpers.d.ts.map +1 -1
- package/dist/gro_plugin_gen.d.ts +3 -3
- package/dist/gro_plugin_gen.d.ts.map +1 -1
- package/dist/gro_plugin_gen.js +2 -2
- package/dist/gro_plugin_server.d.ts +7 -7
- package/dist/gro_plugin_server.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.d.ts +10 -10
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.js +2 -2
- package/dist/gro_plugin_sveltekit_library.d.ts +4 -4
- package/dist/gro_plugin_sveltekit_library.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_library.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/input_path.d.ts +30 -30
- package/dist/input_path.d.ts.map +1 -1
- package/dist/input_path.js +2 -2
- package/dist/invoke.js +1 -1
- package/dist/invoke_task.d.ts +3 -3
- package/dist/invoke_task.d.ts.map +1 -1
- package/dist/invoke_task.js +4 -4
- package/dist/lint.task.d.ts.map +1 -1
- package/dist/lint.task.js +2 -2
- package/dist/modules.d.ts +20 -20
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +2 -2
- package/dist/package_json.d.ts +16 -16
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +6 -6
- package/dist/parse_exports.d.ts +7 -7
- package/dist/parse_exports.d.ts.map +1 -1
- package/dist/parse_exports.js +3 -3
- package/dist/parse_exports_context.d.ts +3 -3
- package/dist/parse_exports_context.d.ts.map +1 -1
- package/dist/parse_exports_context.js +1 -1
- package/dist/parse_imports.d.ts +3 -3
- package/dist/parse_imports.d.ts.map +1 -1
- package/dist/parse_imports.js +2 -2
- package/dist/paths.d.ts +6 -6
- package/dist/paths.d.ts.map +1 -1
- package/dist/plugin.d.ts +13 -13
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/publish.task.d.ts.map +1 -1
- package/dist/publish.task.js +12 -12
- package/dist/reinstall.task.d.ts.map +1 -1
- package/dist/reinstall.task.js +4 -4
- package/dist/resolve_specifier.d.ts +4 -4
- package/dist/resolve_specifier.d.ts.map +1 -1
- package/dist/run.task.d.ts.map +1 -1
- package/dist/run.task.js +9 -6
- package/dist/run_gen.d.ts +4 -4
- package/dist/run_gen.d.ts.map +1 -1
- package/dist/run_task.d.ts +4 -4
- package/dist/run_task.d.ts.map +1 -1
- package/dist/run_task.js +3 -3
- package/dist/search_fs.d.ts +6 -6
- package/dist/search_fs.d.ts.map +1 -1
- package/dist/src_json.d.ts +6 -6
- package/dist/src_json.d.ts.map +1 -1
- package/dist/src_json.js +3 -3
- package/dist/svelte_config.d.ts +3 -3
- package/dist/svelte_config.d.ts.map +1 -1
- package/dist/sveltekit_helpers.d.ts +5 -5
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_helpers.js +5 -5
- package/dist/sveltekit_shim_app.d.ts +2 -2
- package/dist/sveltekit_shim_app.d.ts.map +1 -1
- package/dist/sync.task.d.ts.map +1 -1
- package/dist/sync.task.js +2 -2
- package/dist/task.d.ts +54 -54
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +3 -3
- package/dist/task_logging.d.ts +3 -3
- package/dist/task_logging.d.ts.map +1 -1
- package/dist/test.task.d.ts.map +1 -1
- package/dist/test.task.js +4 -4
- package/dist/typecheck.task.d.ts.map +1 -1
- package/dist/typecheck.task.js +4 -4
- package/dist/upgrade.task.d.ts.map +1 -1
- package/dist/upgrade.task.js +5 -5
- package/dist/watch_dir.d.ts +10 -10
- package/dist/watch_dir.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/args.ts +9 -9
- package/src/lib/build.task.ts +2 -2
- package/src/lib/build_cache.ts +18 -18
- package/src/lib/changelog.ts +10 -10
- package/src/lib/changeset.task.ts +16 -16
- package/src/lib/changeset_helpers.ts +4 -4
- package/src/lib/check.task.ts +3 -3
- package/src/lib/clean.task.ts +2 -2
- package/src/lib/cli.ts +7 -7
- package/src/lib/commit.task.ts +2 -2
- package/src/lib/deploy.task.ts +15 -15
- package/src/lib/dev.task.ts +2 -2
- package/src/lib/disknode.ts +4 -4
- package/src/lib/esbuild_helpers.ts +2 -2
- package/src/lib/esbuild_plugin_external_worker.ts +7 -7
- package/src/lib/esbuild_plugin_svelte.ts +4 -4
- package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +2 -2
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +5 -5
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +2 -2
- package/src/lib/filer.ts +35 -35
- package/src/lib/format.task.ts +2 -2
- package/src/lib/format_directory.ts +2 -2
- package/src/lib/gen.task.ts +19 -19
- package/src/lib/gen.ts +85 -85
- package/src/lib/gen_helpers.ts +17 -17
- package/src/lib/github.ts +6 -6
- package/src/lib/gro.config.default.ts +2 -2
- package/src/lib/gro_config.ts +28 -28
- package/src/lib/gro_helpers.ts +2 -2
- package/src/lib/gro_plugin_gen.ts +5 -5
- package/src/lib/gro_plugin_server.ts +8 -8
- package/src/lib/gro_plugin_sveltekit_app.ts +15 -15
- package/src/lib/gro_plugin_sveltekit_library.ts +6 -6
- package/src/lib/index.ts +3 -3
- package/src/lib/input_path.ts +56 -56
- package/src/lib/invoke.ts +2 -2
- package/src/lib/invoke_task.ts +7 -7
- package/src/lib/lint.task.ts +2 -2
- package/src/lib/modules.ts +31 -31
- package/src/lib/package_json.ts +27 -27
- package/src/lib/parse_exports.ts +15 -15
- package/src/lib/parse_exports_context.ts +9 -9
- package/src/lib/parse_imports.ts +6 -6
- package/src/lib/paths.ts +6 -6
- package/src/lib/plugin.ts +17 -17
- package/src/lib/publish.task.ts +13 -13
- package/src/lib/reinstall.task.ts +4 -4
- package/src/lib/resolve_specifier.ts +5 -5
- package/src/lib/run.task.ts +10 -6
- package/src/lib/run_gen.ts +14 -14
- package/src/lib/run_task.ts +8 -8
- package/src/lib/search_fs.ts +13 -13
- package/src/lib/src_json.ts +13 -13
- package/src/lib/svelte_config.ts +2 -2
- package/src/lib/sveltekit_helpers.ts +12 -12
- package/src/lib/sveltekit_shim_app.ts +3 -3
- package/src/lib/sync.task.ts +2 -2
- package/src/lib/task.ts +63 -63
- package/src/lib/task_logging.ts +11 -11
- package/src/lib/test.task.ts +4 -4
- package/src/lib/typecheck.task.ts +4 -4
- package/src/lib/upgrade.task.ts +7 -7
- package/src/lib/watch_dir.ts +10 -10
package/dist/task.d.ts
CHANGED
|
@@ -2,97 +2,97 @@ import type { Logger } from '@ryanatkn/belt/log.js';
|
|
|
2
2
|
import type { z } from 'zod';
|
|
3
3
|
import type { Timings } from '@ryanatkn/belt/timings.js';
|
|
4
4
|
import type { Result } from '@ryanatkn/belt/result.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { PathId } from '@ryanatkn/belt/path.js';
|
|
6
6
|
import type { Args } from './args.ts';
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import { type
|
|
10
|
-
import { type
|
|
7
|
+
import type { GroConfig } from './gro_config.ts';
|
|
8
|
+
import type { ParsedSvelteConfig } from './svelte_config.ts';
|
|
9
|
+
import { type InputPath, type ResolvedInputFile, type ResolvedInputPath } from './input_path.ts';
|
|
10
|
+
import { type LoadModulesFailure, type ModuleMeta } from './modules.ts';
|
|
11
11
|
import type { Filer } from './filer.ts';
|
|
12
|
-
export interface Task<
|
|
13
|
-
|
|
14
|
-
run: (ctx:
|
|
12
|
+
export interface Task<TArgs = Args, TArgsSchema extends z.ZodType<Args, Args> = z.ZodType<Args, Args>, // TODO improve type? separate input/output?
|
|
13
|
+
TReturn = unknown> {
|
|
14
|
+
run: (ctx: TaskContext<TArgs>) => TReturn | Promise<TReturn>;
|
|
15
15
|
summary?: string;
|
|
16
|
-
Args?:
|
|
16
|
+
Args?: TArgsSchema;
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
19
|
-
args:
|
|
20
|
-
config:
|
|
21
|
-
svelte_config:
|
|
18
|
+
export interface TaskContext<TArgs = object> {
|
|
19
|
+
args: TArgs;
|
|
20
|
+
config: GroConfig;
|
|
21
|
+
svelte_config: ParsedSvelteConfig;
|
|
22
22
|
filer: Filer;
|
|
23
23
|
log: Logger;
|
|
24
24
|
timings: Timings;
|
|
25
|
-
invoke_task:
|
|
25
|
+
invoke_task: InvokeTask;
|
|
26
26
|
}
|
|
27
|
-
export type
|
|
27
|
+
export type InvokeTask = (task_name: string, args?: Args, config?: GroConfig) => Promise<void>;
|
|
28
28
|
export declare const TASK_FILE_SUFFIX_TS = ".task.ts";
|
|
29
29
|
export declare const TASK_FILE_SUFFIX_JS = ".task.js";
|
|
30
30
|
export declare const TASK_FILE_SUFFIXES: string[];
|
|
31
31
|
export declare const is_task_path: (path: string) => boolean;
|
|
32
|
-
export declare const to_task_name: (id:
|
|
32
|
+
export declare const to_task_name: (id: PathId, task_root_dir: PathId, input_path: InputPath, root_path: PathId) => string;
|
|
33
33
|
/**
|
|
34
34
|
* This is used by tasks to signal a known failure.
|
|
35
35
|
* It's useful for cleaning up logging because
|
|
36
36
|
* we usually don't need their stack trace.
|
|
37
37
|
*/
|
|
38
|
-
export declare class
|
|
38
|
+
export declare class TaskError extends Error {
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* This is used to tell Gro to exit silently, usually still with with a non-zero exit code.
|
|
42
42
|
* Using it means error logging is handled by the code that threw it.
|
|
43
43
|
*/
|
|
44
|
-
export declare class
|
|
44
|
+
export declare class SilentError extends Error {
|
|
45
45
|
}
|
|
46
|
-
export interface
|
|
47
|
-
input_path:
|
|
48
|
-
id:
|
|
49
|
-
task_root_dir:
|
|
46
|
+
export interface FoundTask {
|
|
47
|
+
input_path: InputPath;
|
|
48
|
+
id: PathId;
|
|
49
|
+
task_root_dir: PathId;
|
|
50
50
|
}
|
|
51
|
-
export interface
|
|
52
|
-
resolved_input_files: Array<
|
|
53
|
-
resolved_input_files_by_root_dir: Map<
|
|
54
|
-
resolved_input_paths: Array<
|
|
55
|
-
input_paths: Array<
|
|
56
|
-
task_root_dirs: Array<
|
|
51
|
+
export interface FoundTasks {
|
|
52
|
+
resolved_input_files: Array<ResolvedInputFile>;
|
|
53
|
+
resolved_input_files_by_root_dir: Map<PathId, Array<ResolvedInputFile>>;
|
|
54
|
+
resolved_input_paths: Array<ResolvedInputPath>;
|
|
55
|
+
input_paths: Array<InputPath>;
|
|
56
|
+
task_root_dirs: Array<PathId>;
|
|
57
57
|
}
|
|
58
|
-
export type
|
|
59
|
-
value:
|
|
60
|
-
},
|
|
61
|
-
export type
|
|
58
|
+
export type FindTasksResult = Result<{
|
|
59
|
+
value: FoundTasks;
|
|
60
|
+
}, FindModulesFailure>;
|
|
61
|
+
export type FindModulesFailure = {
|
|
62
62
|
type: 'unmapped_input_paths';
|
|
63
|
-
unmapped_input_paths: Array<
|
|
64
|
-
resolved_input_paths: Array<
|
|
65
|
-
input_paths: Array<
|
|
66
|
-
task_root_dirs: Array<
|
|
63
|
+
unmapped_input_paths: Array<InputPath>;
|
|
64
|
+
resolved_input_paths: Array<ResolvedInputPath>;
|
|
65
|
+
input_paths: Array<InputPath>;
|
|
66
|
+
task_root_dirs: Array<PathId>;
|
|
67
67
|
reasons: Array<string>;
|
|
68
68
|
} | {
|
|
69
69
|
type: 'input_directories_with_no_files';
|
|
70
|
-
input_directories_with_no_files: Array<
|
|
71
|
-
resolved_input_files: Array<
|
|
72
|
-
resolved_input_files_by_root_dir: Map<
|
|
73
|
-
resolved_input_paths: Array<
|
|
74
|
-
input_paths: Array<
|
|
75
|
-
task_root_dirs: Array<
|
|
70
|
+
input_directories_with_no_files: Array<InputPath>;
|
|
71
|
+
resolved_input_files: Array<ResolvedInputFile>;
|
|
72
|
+
resolved_input_files_by_root_dir: Map<PathId, Array<ResolvedInputFile>>;
|
|
73
|
+
resolved_input_paths: Array<ResolvedInputPath>;
|
|
74
|
+
input_paths: Array<InputPath>;
|
|
75
|
+
task_root_dirs: Array<PathId>;
|
|
76
76
|
reasons: Array<string>;
|
|
77
77
|
};
|
|
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<
|
|
82
|
-
export interface
|
|
83
|
-
modules: Array<
|
|
84
|
-
found_tasks:
|
|
81
|
+
export declare const find_tasks: (input_paths: Array<InputPath>, task_root_dirs: Array<PathId>, config: GroConfig, timings?: Timings) => FindTasksResult;
|
|
82
|
+
export interface LoadedTasks {
|
|
83
|
+
modules: Array<TaskModuleMeta>;
|
|
84
|
+
found_tasks: FoundTasks;
|
|
85
85
|
}
|
|
86
|
-
export interface
|
|
86
|
+
export interface TaskModule {
|
|
87
87
|
task: Task;
|
|
88
88
|
}
|
|
89
|
-
export interface
|
|
89
|
+
export interface TaskModuleMeta extends ModuleMeta<TaskModule> {
|
|
90
90
|
name: string;
|
|
91
91
|
}
|
|
92
|
-
export type
|
|
93
|
-
value:
|
|
94
|
-
},
|
|
95
|
-
export type
|
|
96
|
-
export declare const load_tasks: (found_tasks:
|
|
97
|
-
export declare const validate_task_module: (mod: Record<string, any>) => mod is
|
|
92
|
+
export type LoadTasksResult = Result<{
|
|
93
|
+
value: LoadedTasks;
|
|
94
|
+
}, LoadTasksFailure>;
|
|
95
|
+
export type LoadTasksFailure = LoadModulesFailure<TaskModuleMeta>;
|
|
96
|
+
export declare const load_tasks: (found_tasks: FoundTasks, root_path?: PathId) => Promise<LoadTasksResult>;
|
|
97
|
+
export declare const validate_task_module: (mod: Record<string, any>) => mod is TaskModule;
|
|
98
98
|
//# sourceMappingURL=task.d.ts.map
|
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,
|
|
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;AAEnD,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;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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';
|
|
10
|
-
export const TASK_FILE_SUFFIXES = [TASK_FILE_SUFFIX_TS, TASK_FILE_SUFFIX_JS]; // TODO from `
|
|
10
|
+
export const TASK_FILE_SUFFIXES = [TASK_FILE_SUFFIX_TS, TASK_FILE_SUFFIX_JS]; // TODO from `GroConfig`, but needs to be used everywhere the constants are
|
|
11
11
|
export const is_task_path = (path) => path.endsWith(TASK_FILE_SUFFIX_TS) || path.endsWith(TASK_FILE_SUFFIX_JS);
|
|
12
12
|
export const to_task_name = (id, task_root_dir, input_path, root_path) => {
|
|
13
13
|
let task_name = id.startsWith(task_root_dir)
|
|
@@ -32,13 +32,13 @@ export const to_task_name = (id, task_root_dir, input_path, root_path) => {
|
|
|
32
32
|
* It's useful for cleaning up logging because
|
|
33
33
|
* we usually don't need their stack trace.
|
|
34
34
|
*/
|
|
35
|
-
export class
|
|
35
|
+
export class TaskError extends Error {
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* This is used to tell Gro to exit silently, usually still with with a non-zero exit code.
|
|
39
39
|
* Using it means error logging is handled by the code that threw it.
|
|
40
40
|
*/
|
|
41
|
-
export class
|
|
41
|
+
export class SilentError extends Error {
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Finds modules from input paths. (see `src/lib/input_path.ts` for more)
|
package/dist/task_logging.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger } from '@ryanatkn/belt/log.js';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const log_tasks: (log: Logger, loaded_tasks:
|
|
2
|
+
import type { LoadedTasks, TaskModuleMeta } from './task.ts';
|
|
3
|
+
export declare const log_tasks: (log: Logger, loaded_tasks: LoadedTasks, log_intro?: boolean) => void;
|
|
4
4
|
export declare const log_error_reasons: (log: Logger, reasons: Array<string>) => void;
|
|
5
|
-
export declare const log_task_help: (log: Logger, meta:
|
|
5
|
+
export declare const log_task_help: (log: Logger, meta: TaskModuleMeta) => void;
|
|
6
6
|
//# sourceMappingURL=task_logging.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task_logging.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/task_logging.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAMlD,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"task_logging.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/task_logging.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAMlD,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAG3D,eAAO,MAAM,SAAS,GAAI,KAAK,MAAM,EAAE,cAAc,WAAW,EAAE,mBAAgB,KAAG,IAkCpF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,KAAK,MAAM,EAAE,SAAS,KAAK,CAAC,MAAM,CAAC,KAAG,IAIvE,CAAC;AAIF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,MAAM,cAAc,KAAG,IAkCjE,CAAC"}
|
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,
|
|
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,CA+B3B,CAAC"}
|
package/dist/test.task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { spawn_cli } from '@ryanatkn/gro/cli.js';
|
|
3
|
-
import {
|
|
3
|
+
import { TaskError } from "./task.js";
|
|
4
4
|
import { find_cli } from "./cli.js";
|
|
5
5
|
import { has_dep } from "./package_json.js";
|
|
6
6
|
import { serialize_args, to_implicit_forwarded_args } from "./args.js";
|
|
@@ -26,10 +26,10 @@ export const task = {
|
|
|
26
26
|
run: async ({ args }) => {
|
|
27
27
|
const { _: patterns, dir, fail_without_tests, t } = args;
|
|
28
28
|
if (!has_dep(VITEST_CLI)) {
|
|
29
|
-
throw new
|
|
29
|
+
throw new TaskError('no test runner found, install vitest');
|
|
30
30
|
}
|
|
31
31
|
if (!find_cli(VITEST_CLI)) {
|
|
32
|
-
throw new
|
|
32
|
+
throw new TaskError('vitest is a dependency but not installed; run `npm i`?');
|
|
33
33
|
}
|
|
34
34
|
const vitest_args = ['run', ...patterns];
|
|
35
35
|
if (dir) {
|
|
@@ -44,7 +44,7 @@ export const task = {
|
|
|
44
44
|
vitest_args.push(...serialize_args(to_implicit_forwarded_args(VITEST_CLI)));
|
|
45
45
|
const spawned = await spawn_cli(VITEST_CLI, vitest_args);
|
|
46
46
|
if (!spawned?.ok) {
|
|
47
|
-
throw new
|
|
47
|
+
throw new TaskError(`vitest failed with exit code ${spawned?.code}`);
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typecheck.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/typecheck.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,
|
|
1
|
+
{"version":3,"file":"typecheck.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/typecheck.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAQ/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;kBAcf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAiD3B,CAAC"}
|
package/dist/typecheck.task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { print_spawn_result } from '@ryanatkn/belt/process.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { TaskError } from "./task.js";
|
|
4
4
|
import { serialize_args, to_forwarded_args } from "./args.js";
|
|
5
5
|
import { find_cli, spawn_cli, spawn_cli_process } from "./cli.js";
|
|
6
6
|
import { sveltekit_sync_if_available } from "./sveltekit_helpers.js";
|
|
@@ -44,7 +44,7 @@ export const task = {
|
|
|
44
44
|
configure_colored_output_with_path_replacement(svelte_check_process, path_replacement, cwd);
|
|
45
45
|
const svelte_check_result = await spawned.closed;
|
|
46
46
|
if (!svelte_check_result.ok) {
|
|
47
|
-
throw new
|
|
47
|
+
throw new TaskError(`Failed to typecheck. ${print_spawn_result(svelte_check_result)}`);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
return;
|
|
@@ -58,10 +58,10 @@ export const task = {
|
|
|
58
58
|
const serialized = serialize_args(forwarded);
|
|
59
59
|
const svelte_check_result = await spawn_cli(found_typescript_cli, serialized, log);
|
|
60
60
|
if (!svelte_check_result?.ok) {
|
|
61
|
-
throw new
|
|
61
|
+
throw new TaskError(`Failed to typecheck. ${print_spawn_result(svelte_check_result)}`);
|
|
62
62
|
}
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
throw new
|
|
65
|
+
throw new TaskError(`Failed to typecheck because neither \`${svelte_check_cli}\` nor \`${typescript_cli}\` was found`);
|
|
66
66
|
},
|
|
67
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/upgrade.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,
|
|
1
|
+
{"version":3,"file":"upgrade.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/upgrade.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAM/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;;;;;;;;kBAiCf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA4E3B,CAAC"}
|
package/dist/upgrade.task.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawn } from '@ryanatkn/belt/process.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { rmSync } from 'node:fs';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { GitOrigin, git_pull } from '@ryanatkn/belt/git.js';
|
|
5
|
+
import { TaskError } from "./task.js";
|
|
6
6
|
import { extract_deps, load_package_json } from "./package_json.js";
|
|
7
7
|
import { spawn_cli } from "./cli.js";
|
|
8
8
|
import { serialize_args, to_forwarded_args } from "./args.js";
|
|
@@ -20,7 +20,7 @@ export const Args = z.strictObject({
|
|
|
20
20
|
})
|
|
21
21
|
.default([])
|
|
22
22
|
.transform((v) => (Array.isArray(v) ? v : [v])),
|
|
23
|
-
origin:
|
|
23
|
+
origin: GitOrigin.describe('git origin to deploy to').default('origin'),
|
|
24
24
|
force: z.boolean().meta({ description: 'if true, print out the planned upgrades' }).default(false),
|
|
25
25
|
pull: z.boolean().meta({ description: 'dual of no-pull' }).default(true),
|
|
26
26
|
'no-pull': z.boolean().meta({ description: 'opt out of git pull' }).default(false),
|
|
@@ -49,7 +49,7 @@ export const task = {
|
|
|
49
49
|
run: async ({ args, log, config }) => {
|
|
50
50
|
const { _, only, origin, force, pull, delete_node_modules, node_modules_path, delete_lockfile, lockfile_path, dry, } = args;
|
|
51
51
|
if (_.length && only.length) {
|
|
52
|
-
throw new
|
|
52
|
+
throw new TaskError('Cannot call `gro upgrade` with both rest args and --only.');
|
|
53
53
|
}
|
|
54
54
|
// TODO maybe a different task that pulls and does other things, like `gro ready`
|
|
55
55
|
if (pull) {
|
|
@@ -69,7 +69,7 @@ export const task = {
|
|
|
69
69
|
? all_deps.filter((d) => only.includes(d.name))
|
|
70
70
|
: all_deps.filter((d) => !_.includes(d.name));
|
|
71
71
|
if (only.length && only.length !== deps.length) {
|
|
72
|
-
throw new
|
|
72
|
+
throw new TaskError(`Some deps to upgrade were not found: ${only.filter((o) => !deps.find((d) => d.name === o)).join(', ')}`);
|
|
73
73
|
}
|
|
74
74
|
const upgrade_items = to_upgrade_items(deps);
|
|
75
75
|
log.info(`upgrading:`, upgrade_items.join(' '));
|
package/dist/watch_dir.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { type ChokidarOptions, type Matcher } from 'chokidar';
|
|
2
|
-
import type {
|
|
3
|
-
export interface
|
|
2
|
+
import type { PathFilter } from '@ryanatkn/belt/path.js';
|
|
3
|
+
export interface WatchNodeFs {
|
|
4
4
|
init: () => Promise<void>;
|
|
5
5
|
close: () => Promise<void>;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
8
|
-
type:
|
|
7
|
+
export interface WatcherChange {
|
|
8
|
+
type: WatcherChangeType;
|
|
9
9
|
path: string;
|
|
10
10
|
is_directory: boolean;
|
|
11
11
|
}
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
14
|
-
export interface
|
|
12
|
+
export type WatcherChangeType = 'add' | 'update' | 'delete';
|
|
13
|
+
export type WatcherChangeCallback = (change: WatcherChange) => void;
|
|
14
|
+
export interface WatchDirOptions {
|
|
15
15
|
dir: string;
|
|
16
|
-
on_change:
|
|
17
|
-
filter?:
|
|
16
|
+
on_change: WatcherChangeCallback;
|
|
17
|
+
filter?: PathFilter | null | undefined;
|
|
18
18
|
chokidar?: ChokidarOptions;
|
|
19
19
|
/**
|
|
20
20
|
* When `false`, returns the `path` relative to `dir`.
|
|
@@ -32,5 +32,5 @@ export interface Watch_Dir_Options {
|
|
|
32
32
|
/**
|
|
33
33
|
* Watch for changes on the filesystem using chokidar.
|
|
34
34
|
*/
|
|
35
|
-
export declare const watch_dir: ({ dir, on_change, filter, absolute, chokidar, ignored, }:
|
|
35
|
+
export declare const watch_dir: ({ dir, on_change, filter, absolute, chokidar, ignored, }: WatchDirOptions) => WatchNodeFs;
|
|
36
36
|
//# sourceMappingURL=watch_dir.d.ts.map
|
package/dist/watch_dir.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch_dir.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/watch_dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,eAAe,EAAkB,KAAK,OAAO,EAAC,MAAM,UAAU,CAAC;AAInF,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"watch_dir.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/watch_dir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,eAAe,EAAkB,KAAK,OAAO,EAAC,MAAM,UAAU,CAAC;AAInF,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAOvD,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;CACtB;AACD,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC5D,MAAM,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;AAEpE,MAAM,WAAW,eAAe;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,qBAAqB,CAAC;IACjC,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,0DAOvB,eAAe,KAAG,WA+CpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryanatkn/gro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.177.1",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"glyph": "🌰",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"zod": "^4.1.12"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@ryanatkn/belt": ">=0.
|
|
64
|
+
"@ryanatkn/belt": ">=0.39.0",
|
|
65
65
|
"@sveltejs/kit": "^2",
|
|
66
66
|
"esbuild": "^0.27.0",
|
|
67
67
|
"svelte": "^5",
|
|
@@ -82,7 +82,7 @@
|
|
|
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.39.0",
|
|
86
86
|
"@ryanatkn/eslint-config": "^0.9.0",
|
|
87
87
|
"@ryanatkn/fuz": "^0.161.0",
|
|
88
88
|
"@ryanatkn/fuz_code": "^0.34.0",
|
package/src/lib/args.ts
CHANGED
|
@@ -14,14 +14,14 @@ import type {z} from 'zod';
|
|
|
14
14
|
export interface Args {
|
|
15
15
|
_?: Array<string>;
|
|
16
16
|
help?: boolean;
|
|
17
|
-
[key: string]:
|
|
17
|
+
[key: string]: ArgValue;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type
|
|
20
|
+
export type ArgValue = string | number | boolean | undefined | Array<string | number | boolean>;
|
|
21
21
|
|
|
22
|
-
export interface
|
|
22
|
+
export interface ArgSchema {
|
|
23
23
|
type: string;
|
|
24
|
-
default:
|
|
24
|
+
default: ArgValue;
|
|
25
25
|
description: string;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -38,12 +38,12 @@ export interface Arg_Schema {
|
|
|
38
38
|
* A simpler implementation could replace `mri`, but it handles some finicky details well.
|
|
39
39
|
*/
|
|
40
40
|
export const parse_args = <
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
TOutput extends Record<string, ArgValue> = Args,
|
|
42
|
+
TInput extends Record<string, ArgValue> = Args,
|
|
43
43
|
>(
|
|
44
|
-
unparsed_args:
|
|
45
|
-
schema: z.ZodType<
|
|
46
|
-
): z.ZodSafeParseResult<
|
|
44
|
+
unparsed_args: TInput,
|
|
45
|
+
schema: z.ZodType<TOutput, TInput>,
|
|
46
|
+
): z.ZodSafeParseResult<TOutput> => {
|
|
47
47
|
const parsed = schema.safeParse(unparsed_args);
|
|
48
48
|
if (parsed.success) {
|
|
49
49
|
// mutate `data` with the correct source of truth for `no-` prefixed args
|
package/src/lib/build.task.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {git_check_clean_workspace, git_current_commit_hash} from '@ryanatkn/belt
|
|
|
4
4
|
import {rmSync, existsSync} from 'node:fs';
|
|
5
5
|
import {join} from 'node:path';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {TaskError, type Task} from './task.ts';
|
|
8
8
|
import {Plugins} from './plugin.ts';
|
|
9
9
|
import {clean_fs} from './clean_fs.ts';
|
|
10
10
|
import {
|
|
@@ -111,7 +111,7 @@ export const task: Task<Args> = {
|
|
|
111
111
|
const final_workspace_status = await git_check_clean_workspace();
|
|
112
112
|
if (final_workspace_status !== workspace_status) {
|
|
113
113
|
// Workspace state changed during build - this indicates a problem
|
|
114
|
-
throw new
|
|
114
|
+
throw new TaskError(
|
|
115
115
|
'Build process modified tracked files or created untracked files.\n\n' +
|
|
116
116
|
'Git status after build:\n' +
|
|
117
117
|
final_workspace_status +
|
package/src/lib/build_cache.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {git_current_commit_hash} from '@ryanatkn/belt/git.js';
|
|
|
14
14
|
import {z} from 'zod';
|
|
15
15
|
|
|
16
16
|
import {to_hash} from './hash.ts';
|
|
17
|
-
import type {
|
|
17
|
+
import type {GroConfig} from './gro_config.ts';
|
|
18
18
|
import {paths} from './paths.ts';
|
|
19
19
|
import {SVELTEKIT_BUILD_DIRNAME, SVELTEKIT_DIST_DIRNAME, GRO_DIST_PREFIX} from './constants.ts';
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ export const BUILD_CACHE_VERSION = '1';
|
|
|
25
25
|
* Metadata about a single build output file.
|
|
26
26
|
* Includes cryptographic hash for validation plus filesystem stats for debugging and optimization.
|
|
27
27
|
*/
|
|
28
|
-
export const
|
|
28
|
+
export const BuildOutputEntry = z.strictObject({
|
|
29
29
|
path: z
|
|
30
30
|
.string()
|
|
31
31
|
.meta({description: "relative path from project root (e.g., 'build/index.html')."}),
|
|
@@ -37,13 +37,13 @@ export const Build_Output_Entry = z.strictObject({
|
|
|
37
37
|
}),
|
|
38
38
|
mode: z.number().meta({description: 'unix file permission mode (e.g., 33188 = 0644)'}),
|
|
39
39
|
});
|
|
40
|
-
export type
|
|
40
|
+
export type BuildOutputEntry = z.infer<typeof BuildOutputEntry>;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* Metadata stored in .gro/ directory to track build cache validity.
|
|
44
44
|
* Schema validates structure at load time to catch corrupted cache files.
|
|
45
45
|
*/
|
|
46
|
-
export const
|
|
46
|
+
export const BuildCacheMetadata = z.strictObject({
|
|
47
47
|
version: z.string().meta({description: 'schema version for future compatibility'}),
|
|
48
48
|
git_commit: z.string().nullable().meta({description: 'git commit hash at time of build'}),
|
|
49
49
|
build_cache_config_hash: z
|
|
@@ -51,10 +51,10 @@ export const Build_Cache_Metadata = z.strictObject({
|
|
|
51
51
|
.meta({description: "hash of user's custom build_cache_config from gro.config.ts."}),
|
|
52
52
|
timestamp: z.string().meta({description: 'timestamp when build completed'}),
|
|
53
53
|
outputs: z
|
|
54
|
-
.array(
|
|
54
|
+
.array(BuildOutputEntry)
|
|
55
55
|
.meta({description: 'build output files with hashes and filesystem stats'}),
|
|
56
56
|
});
|
|
57
|
-
export type
|
|
57
|
+
export type BuildCacheMetadata = z.infer<typeof BuildCacheMetadata>;
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Computes the cache key components for a build.
|
|
@@ -65,7 +65,7 @@ export type Build_Cache_Metadata = z.infer<typeof Build_Cache_Metadata>;
|
|
|
65
65
|
* @param git_commit Optional pre-computed git commit hash (optimization to avoid re-reading)
|
|
66
66
|
*/
|
|
67
67
|
export const compute_build_cache_key = async (
|
|
68
|
-
config:
|
|
68
|
+
config: GroConfig,
|
|
69
69
|
log: Logger,
|
|
70
70
|
git_commit?: string | null,
|
|
71
71
|
): Promise<{
|
|
@@ -89,7 +89,7 @@ export const compute_build_cache_key = async (
|
|
|
89
89
|
* Loads build cache metadata from .gro/ directory.
|
|
90
90
|
* Invalid or corrupted cache files are automatically deleted.
|
|
91
91
|
*/
|
|
92
|
-
export const load_build_cache_metadata = ():
|
|
92
|
+
export const load_build_cache_metadata = (): BuildCacheMetadata | null => {
|
|
93
93
|
const metadata_path = join(paths.build, BUILD_CACHE_METADATA_FILENAME);
|
|
94
94
|
|
|
95
95
|
if (!existsSync(metadata_path)) {
|
|
@@ -101,7 +101,7 @@ export const load_build_cache_metadata = (): Build_Cache_Metadata | null => {
|
|
|
101
101
|
const parsed = JSON.parse(contents);
|
|
102
102
|
|
|
103
103
|
// Validate structure with Zod
|
|
104
|
-
const metadata =
|
|
104
|
+
const metadata = BuildCacheMetadata.parse(parsed);
|
|
105
105
|
|
|
106
106
|
// Validate version
|
|
107
107
|
if (metadata.version !== BUILD_CACHE_VERSION) {
|
|
@@ -131,7 +131,7 @@ export const load_build_cache_metadata = (): Build_Cache_Metadata | null => {
|
|
|
131
131
|
* Saves build cache metadata to .gro/ directory.
|
|
132
132
|
* Errors are logged but don't fail the build (cache is optional).
|
|
133
133
|
*/
|
|
134
|
-
export const save_build_cache_metadata = (metadata:
|
|
134
|
+
export const save_build_cache_metadata = (metadata: BuildCacheMetadata, log?: Logger): void => {
|
|
135
135
|
try {
|
|
136
136
|
// Ensure .gro directory exists
|
|
137
137
|
mkdirSync(paths.build, {recursive: true});
|
|
@@ -152,7 +152,7 @@ export const save_build_cache_metadata = (metadata: Build_Cache_Metadata, log?:
|
|
|
152
152
|
* Uses size as a fast negative check before expensive hashing.
|
|
153
153
|
* This is comprehensive validation to catch manual tampering or corruption.
|
|
154
154
|
*/
|
|
155
|
-
export const validate_build_cache = async (metadata:
|
|
155
|
+
export const validate_build_cache = async (metadata: BuildCacheMetadata): Promise<boolean> => {
|
|
156
156
|
// Verify all tracked output files exist and have matching size
|
|
157
157
|
for (const output of metadata.outputs) {
|
|
158
158
|
if (!existsSync(output.path)) {
|
|
@@ -193,7 +193,7 @@ export const validate_build_cache = async (metadata: Build_Cache_Metadata): Prom
|
|
|
193
193
|
* @param git_commit Optional pre-computed git commit hash (optimization)
|
|
194
194
|
*/
|
|
195
195
|
export const is_build_cache_valid = async (
|
|
196
|
-
config:
|
|
196
|
+
config: GroConfig,
|
|
197
197
|
log: Logger,
|
|
198
198
|
git_commit?: string | null,
|
|
199
199
|
): Promise<boolean> => {
|
|
@@ -240,14 +240,14 @@ export const is_build_cache_valid = async (
|
|
|
240
240
|
*/
|
|
241
241
|
export const collect_build_outputs = async (
|
|
242
242
|
build_dirs: Array<string>,
|
|
243
|
-
): Promise<Array<
|
|
243
|
+
): Promise<Array<BuildOutputEntry>> => {
|
|
244
244
|
// Collect all files to hash first
|
|
245
|
-
interface
|
|
245
|
+
interface FileEntry {
|
|
246
246
|
full_path: string;
|
|
247
247
|
cache_key: string;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
const files_to_hash: Array<
|
|
250
|
+
const files_to_hash: Array<FileEntry> = [];
|
|
251
251
|
|
|
252
252
|
// Recursively collect files
|
|
253
253
|
const collect_files = (dir: string, relative_base: string, dir_prefix: string): void => {
|
|
@@ -282,7 +282,7 @@ export const collect_build_outputs = async (
|
|
|
282
282
|
|
|
283
283
|
// Hash all files in parallel and collect stats
|
|
284
284
|
const hash_promises = files_to_hash.map(
|
|
285
|
-
async ({full_path, cache_key}): Promise<
|
|
285
|
+
async ({full_path, cache_key}): Promise<BuildOutputEntry> => {
|
|
286
286
|
const stats = statSync(full_path);
|
|
287
287
|
const contents = readFileSync(full_path);
|
|
288
288
|
const hash = await to_hash(contents);
|
|
@@ -344,11 +344,11 @@ export const discover_build_output_dirs = (): Array<string> => {
|
|
|
344
344
|
* @param build_dirs Optional pre-discovered build directories (optimization to avoid redundant filesystem scans)
|
|
345
345
|
*/
|
|
346
346
|
export const create_build_cache_metadata = async (
|
|
347
|
-
config:
|
|
347
|
+
config: GroConfig,
|
|
348
348
|
log: Logger,
|
|
349
349
|
git_commit?: string | null,
|
|
350
350
|
build_dirs?: Array<string>,
|
|
351
|
-
): Promise<
|
|
351
|
+
): Promise<BuildCacheMetadata> => {
|
|
352
352
|
const cache_key = await compute_build_cache_key(config, log, git_commit);
|
|
353
353
|
const dirs = build_dirs ?? discover_build_output_dirs();
|
|
354
354
|
const outputs = await collect_build_outputs(dirs);
|