@ryanatkn/gro 0.116.2 → 0.117.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/config.d.ts +5 -0
- package/dist/config.js +9 -2
- package/dist/docs/config.md +25 -0
- package/dist/docs/task.md +38 -32
- package/dist/docs/tasks.gen.md.js +2 -2
- package/dist/gen.task.js +5 -6
- package/dist/gen_module.d.ts +2 -1
- package/dist/gen_module.js +1 -1
- package/dist/input_path.d.ts +27 -28
- package/dist/input_path.js +62 -66
- package/dist/input_path.test.js +23 -45
- package/dist/invoke_task.d.ts +1 -1
- package/dist/invoke_task.js +78 -87
- package/dist/modules.d.ts +13 -9
- package/dist/modules.js +5 -13
- package/dist/package.d.ts +11 -11
- package/dist/package.gen.js +3 -3
- package/dist/package.js +41 -38
- package/dist/package_json.js +3 -3
- package/dist/paths.d.ts +11 -10
- package/dist/paths.js +23 -39
- package/dist/publish.task.js +2 -2
- package/dist/run_task.js +2 -2
- package/dist/task.js +1 -0
- package/dist/task_logging.d.ts +8 -0
- package/dist/{print_task.js → task_logging.js} +29 -15
- package/dist/task_module.d.ts +3 -2
- package/dist/task_module.js +5 -6
- package/package.json +20 -20
- package/dist/print_task.d.ts +0 -4
package/dist/input_path.test.js
CHANGED
|
@@ -1,68 +1,47 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { test } from 'uvu';
|
|
2
2
|
import * as assert from 'uvu/assert';
|
|
3
3
|
import { resolve } from 'node:path';
|
|
4
|
-
import {
|
|
5
|
-
import { paths } from './paths.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
assert.is(
|
|
11
|
-
|
|
12
|
-
assert.is(
|
|
13
|
-
assert.is(
|
|
14
|
-
assert.is(
|
|
15
|
-
assert.is.not(resolve_input_path('bar.ts'), target);
|
|
4
|
+
import { to_input_path, to_input_paths, load_source_ids_by_input_path, get_possible_source_ids, } from './input_path.js';
|
|
5
|
+
import { GRO_DIST_DIR, paths } from './paths.js';
|
|
6
|
+
test('to_input_path', () => {
|
|
7
|
+
assert.is(to_input_path(resolve('foo.ts')), resolve('foo.ts'));
|
|
8
|
+
assert.is(to_input_path('./foo.ts'), resolve('foo.ts'));
|
|
9
|
+
assert.is(to_input_path('foo.ts'), 'foo.ts');
|
|
10
|
+
assert.is(to_input_path('gro/foo'), GRO_DIST_DIR + 'foo');
|
|
11
|
+
// trailing slashes are preserved:
|
|
12
|
+
assert.is(to_input_path(resolve('foo/bar/')), resolve('foo/bar/'));
|
|
13
|
+
assert.is(to_input_path('./foo/bar/'), resolve('foo/bar/'));
|
|
14
|
+
assert.is(to_input_path('foo/bar/'), 'foo/bar/');
|
|
16
15
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
assert.is(resolve_input_path('./foo/bar/'), target_dir);
|
|
23
|
-
assert.is.not(resolve_input_path('bar'), target_dir);
|
|
24
|
-
});
|
|
25
|
-
test__resolve_input_path.run();
|
|
26
|
-
/* test__resolve_input_path */
|
|
27
|
-
/* test__resolve_input_paths */
|
|
28
|
-
const test__resolve_input_paths = suite('resolve_input_paths');
|
|
29
|
-
test__resolve_input_paths('resolves multiple input path forms', () => {
|
|
30
|
-
assert.equal(resolve_input_paths(['foo/bar.ts', 'baz', './']), [
|
|
31
|
-
resolve('dist/foo/bar.ts'),
|
|
32
|
-
resolve('dist/baz'),
|
|
33
|
-
resolve('dist') + '/',
|
|
16
|
+
test('to_input_paths', () => {
|
|
17
|
+
assert.equal(to_input_paths([resolve('foo/bar.ts'), './baz', 'foo']), [
|
|
18
|
+
resolve('foo/bar.ts'),
|
|
19
|
+
resolve('baz'),
|
|
20
|
+
'foo',
|
|
34
21
|
]);
|
|
35
22
|
});
|
|
36
|
-
|
|
37
|
-
/* test__resolve_input_paths */
|
|
38
|
-
/* test__get_possible_source_ids */
|
|
39
|
-
const test__get_possible_source_ids = suite('get_possible_source_ids');
|
|
40
|
-
test__get_possible_source_ids('in the gro directory', () => {
|
|
23
|
+
test('get_possible_source_ids in the gro directory', () => {
|
|
41
24
|
const input_path = resolve('src/foo/bar');
|
|
42
25
|
assert.equal(get_possible_source_ids(input_path, ['.baz.ts']), [
|
|
43
26
|
input_path,
|
|
44
27
|
input_path + '.baz.ts',
|
|
45
|
-
input_path + '/bar.baz.ts',
|
|
46
28
|
]);
|
|
47
29
|
});
|
|
48
|
-
|
|
30
|
+
test('get_possible_source_ids does not repeat the extension', () => {
|
|
49
31
|
const input_path = resolve('src/foo/bar.baz.ts');
|
|
50
32
|
assert.equal(get_possible_source_ids(input_path, ['.baz.ts']), [input_path]);
|
|
51
33
|
});
|
|
52
|
-
|
|
34
|
+
test('get_possible_source_ids does not repeat with the same root directory', () => {
|
|
53
35
|
const input_path = resolve('src/foo/bar.baz.ts');
|
|
54
36
|
assert.equal(get_possible_source_ids(input_path, ['.baz.ts'], [paths.root, paths.root]), [
|
|
55
37
|
input_path,
|
|
56
38
|
]);
|
|
57
39
|
});
|
|
58
|
-
|
|
40
|
+
test('get_possible_source_ids implied to be a directory by trailing slash', () => {
|
|
59
41
|
const input_path = resolve('src/foo/bar') + '/';
|
|
60
42
|
assert.equal(get_possible_source_ids(input_path, ['.baz.ts']), [input_path]);
|
|
61
43
|
});
|
|
62
|
-
|
|
63
|
-
/* test__get_possible_source_ids */
|
|
64
|
-
/* test__load_source_ids_by_input_path */
|
|
65
|
-
const test__load_source_ids_by_input_path = suite('load_source_ids_by_input_path', async () => {
|
|
44
|
+
test('load_source_ids_by_input_path', async () => {
|
|
66
45
|
const test_files = {
|
|
67
46
|
'fake/test1.bar.ts': new Map([['fake/test1.bar.ts', { isDirectory: () => false }]]),
|
|
68
47
|
'fake/test2.bar.ts': new Map([['fake/test2.bar.ts', { isDirectory: () => false }]]),
|
|
@@ -102,5 +81,4 @@ const test__load_source_ids_by_input_path = suite('load_source_ids_by_input_path
|
|
|
102
81
|
input_directories_with_no_files: ['fake/nomatches'],
|
|
103
82
|
});
|
|
104
83
|
});
|
|
105
|
-
|
|
106
|
-
/* test__load_source_ids_by_input_path */
|
|
84
|
+
test.run();
|
package/dist/invoke_task.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ import type { Gro_Config } from './config.js';
|
|
|
17
17
|
* there are some subtle differences in the complex logical branches.
|
|
18
18
|
* The comments describe each condition.
|
|
19
19
|
*/
|
|
20
|
-
export declare const invoke_task: (task_name: string, args: Args, config: Gro_Config, timings?: any) => Promise<void>;
|
|
20
|
+
export declare const invoke_task: (task_name: Flavored<string, "Raw_Input_Path">, args: Args, config: Gro_Config, timings?: any) => Promise<void>;
|
package/dist/invoke_task.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { cyan, red, gray } from 'kleur/colors';
|
|
2
|
-
import {
|
|
2
|
+
import { System_Logger, print_log_label } from '@ryanatkn/belt/log.js';
|
|
3
3
|
import { create_stopwatch, Timings } from '@ryanatkn/belt/timings.js';
|
|
4
4
|
import { print_ms, print_timings } from '@ryanatkn/belt/print.js';
|
|
5
5
|
import { to_forwarded_args } from './args.js';
|
|
6
6
|
import { run_task } from './run_task.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { find_modules, load_modules } from './modules.js';
|
|
7
|
+
import { to_input_path, Raw_Input_Path } from './input_path.js';
|
|
8
|
+
import { is_gro_id, IS_THIS_GRO, print_path, print_path_or_gro_path } from './paths.js';
|
|
9
|
+
import { load_modules } from './modules.js';
|
|
11
10
|
import { find_task_modules, load_task_module } from './task_module.js';
|
|
12
11
|
import { load_gro_package_json } from './package_json.js';
|
|
13
|
-
import {
|
|
14
|
-
import { search_fs } from './search_fs.js';
|
|
12
|
+
import { log_tasks, log_error_reasons, log_gro_package_tasks } from './task_logging.js';
|
|
15
13
|
/**
|
|
16
14
|
* Invokes Gro tasks by name using the filesystem as the source.
|
|
17
15
|
*
|
|
@@ -33,6 +31,10 @@ export const invoke_task = async (task_name, args, config, timings = new Timings
|
|
|
33
31
|
const log = new System_Logger(print_log_label(task_name || 'gro'));
|
|
34
32
|
log.info('invoking', task_name ? cyan(task_name) : 'gro');
|
|
35
33
|
const total_timing = create_stopwatch();
|
|
34
|
+
const finish = () => {
|
|
35
|
+
print_timings(timings, log);
|
|
36
|
+
log.info(`🕒 ${print_ms(total_timing())}`);
|
|
37
|
+
};
|
|
36
38
|
// Check if the caller just wants to see the version.
|
|
37
39
|
if (!task_name && (args.version || args.v)) {
|
|
38
40
|
const gro_package_json = await load_gro_package_json();
|
|
@@ -41,100 +43,89 @@ export const invoke_task = async (task_name, args, config, timings = new Timings
|
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
45
|
// Resolve the input path for the provided task name.
|
|
44
|
-
const input_path =
|
|
46
|
+
const input_path = to_input_path(task_name);
|
|
45
47
|
// Find the task or directory specified by the `input_path`.
|
|
46
48
|
// Fall back to searching the Gro directory as well.
|
|
47
|
-
const find_modules_result = await find_task_modules([input_path],
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (load_modules_result.ok) {
|
|
58
|
-
// We found a task module. Run it!
|
|
59
|
-
// `path_data` is not a directory, so there's a single task module here.
|
|
60
|
-
const task = load_modules_result.modules[0];
|
|
61
|
-
log.info(`→ ${cyan(task.name)} ${(task.mod.task.summary && gray(task.mod.task.summary)) || ''}`);
|
|
62
|
-
const timing_to_run_task = timings.start('run task ' + task_name);
|
|
63
|
-
const result = await run_task(task, { ...args, ...to_forwarded_args(`gro ${task.name}`) }, invoke_task, config, timings);
|
|
64
|
-
timing_to_run_task();
|
|
65
|
-
if (result.ok) {
|
|
66
|
-
log.info(`✓ ${cyan(task.name)}`);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
log.info(`${red('🞩')} ${cyan(task.name)}`);
|
|
70
|
-
log_error_reasons(log, [result.reason]);
|
|
71
|
-
throw result.error;
|
|
72
|
-
}
|
|
49
|
+
const find_modules_result = await find_task_modules([input_path], config.task_root_paths);
|
|
50
|
+
if (!find_modules_result.ok) {
|
|
51
|
+
if (find_modules_result.type === 'input_directories_with_no_files') {
|
|
52
|
+
// The input path matched a directory, but it contains no matching files.
|
|
53
|
+
if (IS_THIS_GRO ||
|
|
54
|
+
// this is null safe because of the failure type
|
|
55
|
+
is_gro_id(find_modules_result.source_id_path_data_by_input_path.get(input_path).id)) {
|
|
56
|
+
// If the directory is inside Gro, just log the errors.
|
|
57
|
+
log_error_reasons(log, find_modules_result.reasons);
|
|
58
|
+
process.exit(1);
|
|
73
59
|
}
|
|
74
60
|
else {
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
// If there's a matching directory in the current working directory,
|
|
62
|
+
// but it has no matching files, we still want to search Gro's directory.
|
|
63
|
+
const gro_dir_find_modules_result = await log_gro_package_tasks(input_path, log);
|
|
64
|
+
// TODO this doesn't seem to be working as commented, test this condition in another repo (maybe like "gro sync" when there's a "src/lib/sync" folder)
|
|
65
|
+
if (!gro_dir_find_modules_result.ok) {
|
|
66
|
+
// Log the original errors, not the Gro-specific ones.
|
|
67
|
+
log_error_reasons(log, find_modules_result.reasons);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
finish();
|
|
71
|
+
return;
|
|
77
72
|
}
|
|
78
73
|
}
|
|
79
74
|
else {
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
75
|
+
// Some unknown find modules result failure happened, so log it out.
|
|
76
|
+
// (currently, just "unmapped_input_paths")
|
|
77
|
+
log_error_reasons(log, find_modules_result.reasons);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Found a match either in the current working directory or Gro's directory.
|
|
82
|
+
const path_data = find_modules_result.source_id_path_data_by_input_path.get(input_path); // this is null safe because result is ok
|
|
83
|
+
if (!path_data.isDirectory) {
|
|
84
|
+
// The input path matches a file, so load and run it.
|
|
85
|
+
// Try to load the task module.
|
|
86
|
+
const load_modules_result = await load_modules(find_modules_result.source_ids_by_input_path, load_task_module);
|
|
87
|
+
if (load_modules_result.ok) {
|
|
88
|
+
// We found a task module. Run it!
|
|
89
|
+
// `path_data` is not a directory, so there's a single task module here.
|
|
90
|
+
const task = load_modules_result.modules[0];
|
|
91
|
+
log.info(`→ ${cyan(task.name)} ${(task.mod.task.summary && gray(task.mod.task.summary)) || ''}`);
|
|
92
|
+
const timing_to_run_task = timings.start('run task ' + task_name);
|
|
93
|
+
const result = await run_task(task, { ...args, ...to_forwarded_args(`gro ${task.name}`) }, invoke_task, config, timings);
|
|
94
|
+
timing_to_run_task();
|
|
95
|
+
if (result.ok) {
|
|
96
|
+
log.info(`✓ ${cyan(task.name)}`);
|
|
89
97
|
}
|
|
90
98
|
else {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// and log everything out.
|
|
95
|
-
// Ignore any errors - the directory may not exist or have any files!
|
|
96
|
-
const gro_dir_find_modules_result = await to_gro_dir_find_modules_result(input_path, log);
|
|
97
|
-
// Then log the current working directory matches.
|
|
98
|
-
await log_available_tasks(log, print_path(path_data.id), find_modules_result.source_ids_by_input_path, !gro_dir_find_modules_result.ok);
|
|
99
|
+
log.info(`${red('🞩')} ${cyan(task.name)}`);
|
|
100
|
+
log_error_reasons(log, [result.reason]);
|
|
101
|
+
throw result.error;
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
}
|
|
102
|
-
else if (find_modules_result.type === 'input_directories_with_no_files') {
|
|
103
|
-
// The input path matched a directory, but it contains no matching files.
|
|
104
|
-
if (is_this_project_gro ||
|
|
105
|
-
// this is null safe because of the failure type
|
|
106
|
-
is_gro_id(find_modules_result.source_id_path_data_by_input_path.get(input_path).id)) {
|
|
107
|
-
// If the directory is inside Gro, just log the errors.
|
|
108
|
-
log_error_reasons(log, find_modules_result.reasons);
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
104
|
else {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
const gro_dir_find_modules_result = await to_gro_dir_find_modules_result(input_path, log);
|
|
115
|
-
if (!gro_dir_find_modules_result.ok) {
|
|
116
|
-
// Log the original errors, not the Gro-specific ones.
|
|
117
|
-
log_error_reasons(log, find_modules_result.reasons);
|
|
118
|
-
process.exit(1);
|
|
119
|
-
}
|
|
105
|
+
log_error_reasons(log, load_modules_result.reasons);
|
|
106
|
+
process.exit(1);
|
|
120
107
|
}
|
|
121
108
|
}
|
|
122
109
|
else {
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
110
|
+
// The input path matches a directory. Log the tasks but don't run them.
|
|
111
|
+
if (IS_THIS_GRO) {
|
|
112
|
+
// Is the Gro directory the same as the cwd? Log the matching files.
|
|
113
|
+
await log_tasks(log, print_path(path_data.id), find_modules_result.source_ids_by_input_path);
|
|
114
|
+
}
|
|
115
|
+
else if (is_gro_id(path_data.id)) {
|
|
116
|
+
// TODO delete this? merge behavior with the block above/below?
|
|
117
|
+
// Does the Gro directory contain the matching files? Log them.
|
|
118
|
+
await log_tasks(log, print_path_or_gro_path(path_data.id), find_modules_result.source_ids_by_input_path);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
// The Gro directory is not the same as the cwd and it doesn't contain the matching files.
|
|
122
|
+
// Find all of the possible matches in both the current project and the Gro directory,
|
|
123
|
+
// and log everything out.
|
|
124
|
+
// Ignore any errors - the directory may not exist or have any files!
|
|
125
|
+
const gro_dir_find_modules_result = await log_gro_package_tasks(input_path, log);
|
|
126
|
+
// Then log the current working directory matches.
|
|
127
|
+
await log_tasks(log, print_path(path_data.id), find_modules_result.source_ids_by_input_path, !gro_dir_find_modules_result.ok);
|
|
128
|
+
}
|
|
138
129
|
}
|
|
139
|
-
|
|
130
|
+
finish();
|
|
140
131
|
};
|
package/dist/modules.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Result } from '@ryanatkn/belt/result.js';
|
|
2
|
+
import { Input_Path } from './input_path.js';
|
|
2
3
|
import type { Path_Data } from './path.js';
|
|
3
4
|
import { type Source_Id } from './paths.js';
|
|
4
5
|
export interface Module_Meta<T_Module extends Record<string, any> = Record<string, any>> {
|
|
@@ -22,19 +23,19 @@ export type Load_Module_Failure = {
|
|
|
22
23
|
};
|
|
23
24
|
export declare const load_module: <T extends Record<string, any>>(id: string, validate?: (mod: Record<string, any>) => mod is T) => Promise<Load_Module_Result<Module_Meta<T>>>;
|
|
24
25
|
export type Find_Modules_Result = Result<{
|
|
25
|
-
source_ids_by_input_path: Map<
|
|
26
|
-
source_id_path_data_by_input_path: Map<
|
|
26
|
+
source_ids_by_input_path: Map<Input_Path, Source_Id[]>;
|
|
27
|
+
source_id_path_data_by_input_path: Map<Input_Path, Path_Data>;
|
|
27
28
|
}, Find_Modules_Failure>;
|
|
28
29
|
export type Find_Modules_Failure = {
|
|
29
30
|
type: 'unmapped_input_paths';
|
|
30
|
-
source_id_path_data_by_input_path: Map<
|
|
31
|
-
unmapped_input_paths:
|
|
31
|
+
source_id_path_data_by_input_path: Map<Input_Path, Path_Data>;
|
|
32
|
+
unmapped_input_paths: Input_Path[];
|
|
32
33
|
reasons: string[];
|
|
33
34
|
} | {
|
|
34
35
|
type: 'input_directories_with_no_files';
|
|
35
|
-
source_ids_by_input_path: Map<
|
|
36
|
-
source_id_path_data_by_input_path: Map<
|
|
37
|
-
input_directories_with_no_files:
|
|
36
|
+
source_ids_by_input_path: Map<Input_Path, Source_Id[]>;
|
|
37
|
+
source_id_path_data_by_input_path: Map<Input_Path, Path_Data>;
|
|
38
|
+
input_directories_with_no_files: Input_Path[];
|
|
38
39
|
reasons: string[];
|
|
39
40
|
};
|
|
40
41
|
export type Load_Modules_Result<T_Module_Meta extends Module_Meta> = Result<{
|
|
@@ -45,5 +46,8 @@ export type Load_Modules_Result<T_Module_Meta extends Module_Meta> = Result<{
|
|
|
45
46
|
reasons: string[];
|
|
46
47
|
modules: T_Module_Meta[];
|
|
47
48
|
}>;
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Finds modules from input paths. (see `src/lib/input_path.ts` for more)
|
|
51
|
+
*/
|
|
52
|
+
export declare const find_modules: (input_paths: Input_Path[], custom_search_fs?: (dir: string, options?: import("./search_fs.js").Search_Fs_Options) => Promise<Map<string, import("./path.js").Path_Stats>>, get_possible_source_ids?: (input_path: Input_Path) => Source_Id[], timings?: any) => Promise<Find_Modules_Result>;
|
|
53
|
+
export declare const load_modules: <Module_Type extends Record<string, any>, T_Module_Meta extends Module_Meta<Module_Type>>(source_ids_by_input_path: Map<Input_Path, Source_Id[]>, load_module_by_id: (source_id: Source_Id) => Promise<Load_Module_Result<T_Module_Meta>>, timings?: any) => Promise<Load_Modules_Result<T_Module_Meta>>;
|
package/dist/modules.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { red } from 'kleur/colors';
|
|
2
2
|
import { Unreachable_Error } from '@ryanatkn/belt/error.js';
|
|
3
3
|
import { print_error } from '@ryanatkn/belt/print.js';
|
|
4
|
-
import { load_source_path_data_by_input_path, load_source_ids_by_input_path } from './input_path.js';
|
|
4
|
+
import { load_source_path_data_by_input_path, load_source_ids_by_input_path, Input_Path, } from './input_path.js';
|
|
5
5
|
import { paths_from_id, print_path, print_path_or_gro_path } from './paths.js';
|
|
6
6
|
import { search_fs } from './search_fs.js';
|
|
7
7
|
export const load_module = async (id, validate) => {
|
|
@@ -17,11 +17,9 @@ export const load_module = async (id, validate) => {
|
|
|
17
17
|
}
|
|
18
18
|
return { ok: true, mod: { id, mod } };
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*/
|
|
20
|
+
/**
|
|
21
|
+
* Finds modules from input paths. (see `src/lib/input_path.ts` for more)
|
|
22
|
+
*/
|
|
25
23
|
export const find_modules = async (input_paths, custom_search_fs = search_fs, get_possible_source_ids, timings) => {
|
|
26
24
|
// Check which extension variation works - if it's a directory, prefer others first!
|
|
27
25
|
const timing_to_map_input_paths = timings?.start('map input paths');
|
|
@@ -53,13 +51,7 @@ export const find_modules = async (input_paths, custom_search_fs = search_fs, ge
|
|
|
53
51
|
}
|
|
54
52
|
: { ok: true, source_ids_by_input_path, source_id_path_data_by_input_path };
|
|
55
53
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
Load modules by source id.
|
|
59
|
-
|
|
60
|
-
TODO parallelize, originally it needed to be serial for a specific usecase we no longer have
|
|
61
|
-
|
|
62
|
-
*/
|
|
54
|
+
// TODO parallelize, originally it needed to be serial for a specific usecase we no longer have
|
|
63
55
|
export const load_modules = async (source_ids_by_input_path, // TODO maybe make this a flat array and remove `input_path`?
|
|
64
56
|
load_module_by_id, timings) => {
|
|
65
57
|
const timing_to_load_modules = timings?.start('load modules');
|
package/dist/package.d.ts
CHANGED
|
@@ -302,10 +302,6 @@ export declare const package_json: {
|
|
|
302
302
|
default: string;
|
|
303
303
|
types: string;
|
|
304
304
|
};
|
|
305
|
-
'./print_task.js': {
|
|
306
|
-
default: string;
|
|
307
|
-
types: string;
|
|
308
|
-
};
|
|
309
305
|
'./publish.task.js': {
|
|
310
306
|
default: string;
|
|
311
307
|
types: string;
|
|
@@ -382,6 +378,10 @@ export declare const package_json: {
|
|
|
382
378
|
default: string;
|
|
383
379
|
types: string;
|
|
384
380
|
};
|
|
381
|
+
'./task_logging.js': {
|
|
382
|
+
default: string;
|
|
383
|
+
types: string;
|
|
384
|
+
};
|
|
385
385
|
'./task_module.js': {
|
|
386
386
|
default: string;
|
|
387
387
|
types: string;
|
|
@@ -775,13 +775,6 @@ export declare const src_json: {
|
|
|
775
775
|
kind: string;
|
|
776
776
|
}[];
|
|
777
777
|
};
|
|
778
|
-
'./print_task.js': {
|
|
779
|
-
path: string;
|
|
780
|
-
declarations: {
|
|
781
|
-
name: string;
|
|
782
|
-
kind: string;
|
|
783
|
-
}[];
|
|
784
|
-
};
|
|
785
778
|
'./publish.task.js': {
|
|
786
779
|
path: string;
|
|
787
780
|
declarations: {
|
|
@@ -915,6 +908,13 @@ export declare const src_json: {
|
|
|
915
908
|
kind: string;
|
|
916
909
|
}[];
|
|
917
910
|
};
|
|
911
|
+
'./task_logging.js': {
|
|
912
|
+
path: string;
|
|
913
|
+
declarations: {
|
|
914
|
+
name: string;
|
|
915
|
+
kind: string;
|
|
916
|
+
}[];
|
|
917
|
+
};
|
|
918
918
|
'./task_module.js': {
|
|
919
919
|
path: string;
|
|
920
920
|
declarations: never[];
|
package/dist/package.gen.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { load_package_json } from './package_json.js';
|
|
2
|
-
import {
|
|
2
|
+
import { IS_THIS_GRO, to_root_path } from './paths.js';
|
|
3
3
|
import { create_src_json } from './src_json.js';
|
|
4
4
|
// TODO rename? `Package_Json + Src_Json = package.ts` currently, idk
|
|
5
5
|
// TODO consider an api that uses magic imports like SvelteKit's `$app`, like `$repo/package.json`
|
|
@@ -14,8 +14,8 @@ export const gen = async ({ origin_id }) => {
|
|
|
14
14
|
return `
|
|
15
15
|
// generated by ${to_root_path(origin_id)}
|
|
16
16
|
|
|
17
|
-
import type {Package_Json} from '${
|
|
18
|
-
import type {Src_Json} from '${
|
|
17
|
+
import type {Package_Json} from '${IS_THIS_GRO ? './package_json.js' : '@ryanatkn/gro/package_json.js'}';
|
|
18
|
+
import type {Src_Json} from '${IS_THIS_GRO ? './src_json.js' : '@ryanatkn/gro/src_json.js'}';
|
|
19
19
|
|
|
20
20
|
export const package_json = ${JSON.stringify(package_json)} satisfies Package_Json;
|
|
21
21
|
|