@ryanatkn/gro 0.133.8 → 0.135.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/args.d.ts.map +1 -1
- package/dist/args.js +6 -2
- package/dist/changeset.task.js +3 -3
- package/dist/check.task.js +2 -2
- package/dist/cli.d.ts +5 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/deploy.task.d.ts +2 -2
- package/dist/deploy.task.d.ts.map +1 -1
- package/dist/deploy.task.js +7 -7
- package/dist/esbuild_helpers.js +3 -3
- package/dist/gen.js +3 -3
- package/dist/gen.task.d.ts.map +1 -1
- package/dist/gen.task.js +8 -8
- package/dist/gro_helpers.js +1 -1
- package/dist/gro_plugin_server.d.ts.map +1 -1
- package/dist/gro_plugin_server.js +6 -1
- package/dist/invoke.js +3 -0
- package/dist/invoke_task.d.ts.map +1 -1
- package/dist/invoke_task.js +8 -8
- package/dist/package.js +19 -19
- package/dist/package_json.js +3 -3
- package/dist/path.d.ts +1 -0
- package/dist/path.d.ts.map +1 -1
- package/dist/paths.js +2 -2
- package/dist/publish.task.js +4 -4
- package/dist/resolve.task.js +3 -3
- package/dist/run.task.js +2 -2
- package/dist/run_gen.js +3 -3
- package/dist/run_task.d.ts.map +1 -1
- package/dist/run_task.js +6 -5
- package/dist/task.js +3 -3
- package/dist/task_logging.js +7 -7
- package/dist/test.task.js +2 -2
- package/dist/watch_dir.d.ts +3 -3
- package/dist/watch_dir.d.ts.map +1 -1
- package/dist/watch_dir.js +3 -3
- package/package.json +18 -18
- package/src/lib/args.ts +6 -2
- package/src/lib/changeset.task.ts +3 -3
- package/src/lib/check.task.ts +2 -2
- package/src/lib/cli.ts +5 -5
- package/src/lib/deploy.task.ts +12 -7
- package/src/lib/esbuild_helpers.ts +3 -3
- package/src/lib/gen.task.ts +11 -9
- package/src/lib/gen.ts +3 -3
- package/src/lib/gro_helpers.ts +1 -1
- package/src/lib/gro_plugin_server.ts +6 -1
- package/src/lib/invoke.ts +4 -0
- package/src/lib/invoke_task.ts +10 -8
- package/src/lib/package.ts +19 -19
- package/src/lib/package_json.ts +3 -3
- package/src/lib/path.ts +1 -1
- package/src/lib/paths.ts +2 -2
- package/src/lib/publish.task.ts +4 -4
- package/src/lib/resolve.task.ts +3 -3
- package/src/lib/run.task.ts +2 -2
- package/src/lib/run_gen.ts +3 -3
- package/src/lib/run_task.ts +8 -5
- package/src/lib/task.ts +3 -3
- package/src/lib/task_logging.ts +10 -10
- package/src/lib/test.task.ts +2 -2
- package/src/lib/watch_dir.ts +5 -5
package/src/lib/package.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.js';
|
|
|
5
5
|
|
|
6
6
|
export const package_json = {
|
|
7
7
|
name: '@ryanatkn/gro',
|
|
8
|
-
version: '0.
|
|
8
|
+
version: '0.135.0',
|
|
9
9
|
description: 'task runner and toolkit extending SvelteKit',
|
|
10
10
|
motto: 'generate, run, optimize',
|
|
11
11
|
glyph: '🌰',
|
|
@@ -30,7 +30,7 @@ export const package_json = {
|
|
|
30
30
|
deploy: 'gro deploy',
|
|
31
31
|
},
|
|
32
32
|
type: 'module',
|
|
33
|
-
engines: {node: '>=20.
|
|
33
|
+
engines: {node: '>=20.17'},
|
|
34
34
|
bin: {gro: 'dist/gro.js'},
|
|
35
35
|
keywords: [
|
|
36
36
|
'web',
|
|
@@ -44,8 +44,8 @@ export const package_json = {
|
|
|
44
44
|
'typescript',
|
|
45
45
|
],
|
|
46
46
|
dependencies: {
|
|
47
|
-
'@ryanatkn/belt': '^0.
|
|
48
|
-
chokidar: '^
|
|
47
|
+
'@ryanatkn/belt': '^0.25.0',
|
|
48
|
+
chokidar: '^4.0.0',
|
|
49
49
|
dotenv: '^16.4.5',
|
|
50
50
|
'es-module-lexer': '^1.5.4',
|
|
51
51
|
'esm-env': '^1.0.0',
|
|
@@ -53,29 +53,29 @@ export const package_json = {
|
|
|
53
53
|
prettier: '^3.3.3',
|
|
54
54
|
'prettier-plugin-svelte': '^3.2.6',
|
|
55
55
|
'ts-morph': '^23.0.0',
|
|
56
|
-
tslib: '^2.
|
|
56
|
+
tslib: '^2.7.0',
|
|
57
57
|
zod: '^3.23.8',
|
|
58
58
|
},
|
|
59
59
|
peerDependencies: {esbuild: '^0.21.0', svelte: '^5.0.0-next.0'},
|
|
60
60
|
devDependencies: {
|
|
61
61
|
'@changesets/changelog-git': '^0.2.0',
|
|
62
62
|
'@changesets/types': '^6.0.0',
|
|
63
|
-
'@ryanatkn/eslint-config': '^0.5.
|
|
64
|
-
'@ryanatkn/fuz': '^0.
|
|
65
|
-
'@ryanatkn/moss': '^0.
|
|
63
|
+
'@ryanatkn/eslint-config': '^0.5.3',
|
|
64
|
+
'@ryanatkn/fuz': '^0.121.0',
|
|
65
|
+
'@ryanatkn/moss': '^0.15.0',
|
|
66
66
|
'@sveltejs/adapter-static': '^3.0.4',
|
|
67
|
-
'@sveltejs/kit': '^2.5.
|
|
68
|
-
'@sveltejs/package': '^2.3.
|
|
69
|
-
'@sveltejs/vite-plugin-svelte': '^3.1.
|
|
67
|
+
'@sveltejs/kit': '^2.5.27',
|
|
68
|
+
'@sveltejs/package': '^2.3.5',
|
|
69
|
+
'@sveltejs/vite-plugin-svelte': '^3.1.2',
|
|
70
70
|
'@types/fs-extra': '^11.0.4',
|
|
71
|
-
'@types/node': '^22.
|
|
71
|
+
'@types/node': '^22.5.5',
|
|
72
72
|
esbuild: '^0.21.5',
|
|
73
|
-
eslint: '^9.
|
|
74
|
-
'eslint-plugin-svelte': '^2.
|
|
75
|
-
svelte: '^5.0.0-next.
|
|
76
|
-
'svelte-check': '^4.0.
|
|
77
|
-
typescript: '^5.
|
|
78
|
-
'typescript-eslint': '^8.
|
|
73
|
+
eslint: '^9.10.0',
|
|
74
|
+
'eslint-plugin-svelte': '^2.44.0',
|
|
75
|
+
svelte: '^5.0.0-next.246',
|
|
76
|
+
'svelte-check': '^4.0.2',
|
|
77
|
+
typescript: '^5.6.2',
|
|
78
|
+
'typescript-eslint': '^8.5.0',
|
|
79
79
|
uvu: '^0.5.6',
|
|
80
80
|
},
|
|
81
81
|
prettier: {
|
|
@@ -268,7 +268,7 @@ export const package_json = {
|
|
|
268
268
|
|
|
269
269
|
export const src_json = {
|
|
270
270
|
name: '@ryanatkn/gro',
|
|
271
|
-
version: '0.
|
|
271
|
+
version: '0.135.0',
|
|
272
272
|
modules: {
|
|
273
273
|
'.': {
|
|
274
274
|
path: 'index.ts',
|
package/src/lib/package_json.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {readFileSync, writeFileSync} from 'node:fs';
|
|
|
4
4
|
import {count_graphemes, plural, strip_end} from '@ryanatkn/belt/string.js';
|
|
5
5
|
import type {Logger} from '@ryanatkn/belt/log.js';
|
|
6
6
|
import type {Flavored} from '@ryanatkn/belt/types.js';
|
|
7
|
-
import {
|
|
7
|
+
import {styleText as st} from 'node:util';
|
|
8
8
|
|
|
9
9
|
import {paths, gro_paths, IS_THIS_GRO, replace_extension} from './paths.js';
|
|
10
10
|
import {SVELTEKIT_DIST_DIRNAME} from './path_constants.js';
|
|
@@ -320,9 +320,9 @@ const parse_or_throw_formatted_error = <T extends z.ZodTypeAny>(
|
|
|
320
320
|
): z.infer<T> => {
|
|
321
321
|
const parsed = schema.safeParse(value);
|
|
322
322
|
if (!parsed.success) {
|
|
323
|
-
let msg = red
|
|
323
|
+
let msg = st('red', `Failed to parse ${name}:\n`);
|
|
324
324
|
for (const issue of parsed.error.issues) {
|
|
325
|
-
msg += red
|
|
325
|
+
msg += st('red', `\n\t"${issue.path}" ${issue.message}\n`);
|
|
326
326
|
}
|
|
327
327
|
throw Error(msg);
|
|
328
328
|
}
|
package/src/lib/path.ts
CHANGED
package/src/lib/paths.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {join, extname, relative, basename} from 'node:path';
|
|
2
2
|
import {fileURLToPath} from 'node:url';
|
|
3
3
|
import {strip_end} from '@ryanatkn/belt/string.js';
|
|
4
|
-
import {
|
|
4
|
+
import {styleText as st} from 'node:util';
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
GRO_CONFIG_PATH,
|
|
@@ -68,7 +68,7 @@ export const print_path = (path: string, p = infer_paths(path)): string => {
|
|
|
68
68
|
strip_end(path, '/') === strip_end(GRO_DIST_DIR, '/') ? 'gro' : to_root_path(path, p);
|
|
69
69
|
final_path =
|
|
70
70
|
final_path === 'gro' ? final_path : final_path[0] === '.' ? final_path : './' + final_path;
|
|
71
|
-
return gray
|
|
71
|
+
return st('gray', final_path);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
74
|
export const replace_extension = (path: string, new_extension: string): string => {
|
package/src/lib/publish.task.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {spawn} from '@ryanatkn/belt/process.js';
|
|
2
2
|
import {z} from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import {styleText as st} from 'node:util';
|
|
4
4
|
import {existsSync} from 'node:fs';
|
|
5
5
|
|
|
6
6
|
import {Task_Error, type Task} from './task.js';
|
|
@@ -74,7 +74,7 @@ export const task: Task<Args> = {
|
|
|
74
74
|
changeset_cli,
|
|
75
75
|
} = args;
|
|
76
76
|
if (dry) {
|
|
77
|
-
log.info(
|
|
77
|
+
log.info(st('green', 'dry run!'));
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
const has_sveltekit_library_result = has_sveltekit_library();
|
|
@@ -181,7 +181,7 @@ export const task: Task<Args> = {
|
|
|
181
181
|
|
|
182
182
|
if (dry) {
|
|
183
183
|
log.info('publishing branch ' + branch);
|
|
184
|
-
log.info(
|
|
184
|
+
log.info(st('green', 'dry run complete!'));
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -198,6 +198,6 @@ export const task: Task<Args> = {
|
|
|
198
198
|
await spawn('git', ['commit', '-a', '-m', `publish v${version}`]);
|
|
199
199
|
await spawn('git', ['push', '--follow-tags']);
|
|
200
200
|
|
|
201
|
-
log.info(green
|
|
201
|
+
log.info(st('green', `published to branch ${st('cyan', branch)}!`));
|
|
202
202
|
},
|
|
203
203
|
};
|
package/src/lib/resolve.task.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {z} from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import {styleText as st} from 'node:util';
|
|
3
3
|
|
|
4
4
|
import {TASK_FILE_SUFFIXES, type Task} from './task.js';
|
|
5
5
|
import {resolve_input_paths, to_input_paths} from './input_path.js';
|
|
@@ -33,11 +33,11 @@ export const task: Task<Args> = {
|
|
|
33
33
|
if (verbose) log.info('unmapped_input_paths:', unmapped_input_paths);
|
|
34
34
|
|
|
35
35
|
for (const p of resolved_input_paths) {
|
|
36
|
-
log.info('resolved:', green
|
|
36
|
+
log.info('resolved:', st('green', p.id));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (!resolved_input_paths.length) {
|
|
40
|
-
log.warn(
|
|
40
|
+
log.warn(st('yellow', 'no input paths were resolved'));
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
};
|
package/src/lib/run.task.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {z} from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import {styleText as st} from 'node:util';
|
|
3
3
|
import {existsSync} from 'node:fs';
|
|
4
4
|
|
|
5
5
|
import {Task_Error, type Task} from './task.js';
|
|
@@ -23,7 +23,7 @@ export const task: Task<Args> = {
|
|
|
23
23
|
} = args;
|
|
24
24
|
|
|
25
25
|
if (!path) {
|
|
26
|
-
log.info(
|
|
26
|
+
log.info(st('green', '\n\nUsage: ') + st('cyan', 'gro run path/to/file.ts [...node_args]\n'));
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
|
package/src/lib/run_gen.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {styleText as st} from 'node:util';
|
|
2
2
|
import {print_error} from '@ryanatkn/belt/print.js';
|
|
3
3
|
import type {Timings} from '@ryanatkn/belt/timings.js';
|
|
4
4
|
import type {Logger} from '@ryanatkn/belt/log.js';
|
|
@@ -50,7 +50,7 @@ export const run_gen = async (
|
|
|
50
50
|
ok: false,
|
|
51
51
|
id,
|
|
52
52
|
error: err,
|
|
53
|
-
reason: red
|
|
53
|
+
reason: st('red', `Error generating ${print_path(id)}`),
|
|
54
54
|
elapsed: timing_for_module(),
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -67,7 +67,7 @@ export const run_gen = async (
|
|
|
67
67
|
return {...file, content: await format_file(file.content, {filepath: file.id})};
|
|
68
68
|
} catch (err) {
|
|
69
69
|
log.error(
|
|
70
|
-
red
|
|
70
|
+
st('red', `Error formatting ${print_path(file.id)} via ${print_path(id)}`),
|
|
71
71
|
print_error(err),
|
|
72
72
|
);
|
|
73
73
|
return file;
|
package/src/lib/run_task.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {print_log_label
|
|
1
|
+
import {styleText as st} from 'node:util';
|
|
2
|
+
import {print_log_label} from '@ryanatkn/belt/print.js';
|
|
3
|
+
import {System_Logger} from '@ryanatkn/belt/log.js';
|
|
3
4
|
import type {Timings} from '@ryanatkn/belt/timings.js';
|
|
4
5
|
|
|
5
6
|
import {parse_args, type Args} from './args.js';
|
|
@@ -40,7 +41,7 @@ export const run_task = async (
|
|
|
40
41
|
if (task.Args) {
|
|
41
42
|
const parsed = parse_args(unparsed_args, task.Args);
|
|
42
43
|
if (!parsed.success) {
|
|
43
|
-
log.error(red
|
|
44
|
+
log.error(st('red', `Args validation failed:`), '\n', parsed.error.format());
|
|
44
45
|
throw new Task_Error(`Task args failed validation`);
|
|
45
46
|
}
|
|
46
47
|
args = parsed.data;
|
|
@@ -61,10 +62,12 @@ export const run_task = async (
|
|
|
61
62
|
} catch (err) {
|
|
62
63
|
return {
|
|
63
64
|
ok: false,
|
|
64
|
-
reason:
|
|
65
|
+
reason: st(
|
|
66
|
+
'red',
|
|
65
67
|
err?.constructor?.name === 'Task_Error'
|
|
66
68
|
? (err.message as string)
|
|
67
|
-
: `Unexpected error running task ${
|
|
69
|
+
: `Unexpected error running task ${st(
|
|
70
|
+
'cyan',
|
|
68
71
|
task_meta.name,
|
|
69
72
|
)}. If this is unexpected try running \`npm i\` and \`gro clean\`.`,
|
|
70
73
|
),
|
package/src/lib/task.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type {Logger} from '@ryanatkn/belt/log.js';
|
|
|
2
2
|
import {ensure_end, strip_end, strip_start} from '@ryanatkn/belt/string.js';
|
|
3
3
|
import type {z} from 'zod';
|
|
4
4
|
import type {Timings} from '@ryanatkn/belt/timings.js';
|
|
5
|
-
import {
|
|
5
|
+
import {styleText as st} from 'node:util';
|
|
6
6
|
import type {Result} from '@ryanatkn/belt/result.js';
|
|
7
7
|
import {isAbsolute, join, relative} from 'node:path';
|
|
8
8
|
|
|
@@ -149,7 +149,7 @@ export const find_tasks = (
|
|
|
149
149
|
input_paths,
|
|
150
150
|
task_root_dirs,
|
|
151
151
|
reasons: unmapped_input_paths.map((input_path) =>
|
|
152
|
-
red
|
|
152
|
+
st('red', `Input path ${print_path(input_path)} cannot be mapped to a file or directory.`),
|
|
153
153
|
),
|
|
154
154
|
};
|
|
155
155
|
}
|
|
@@ -177,7 +177,7 @@ export const find_tasks = (
|
|
|
177
177
|
input_paths,
|
|
178
178
|
task_root_dirs,
|
|
179
179
|
reasons: input_directories_with_no_files.map((input_path) =>
|
|
180
|
-
red
|
|
180
|
+
st('red', `Input directory contains no matching files: ${print_path(input_path)}`),
|
|
181
181
|
),
|
|
182
182
|
};
|
|
183
183
|
}
|
package/src/lib/task_logging.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {styleText as st} from 'node:util';
|
|
2
2
|
import type {Logger} from '@ryanatkn/belt/log.js';
|
|
3
3
|
import {plural} from '@ryanatkn/belt/string.js';
|
|
4
4
|
import {print_value} from '@ryanatkn/belt/print.js';
|
|
@@ -15,8 +15,8 @@ export const log_tasks = (log: Logger, loaded_tasks: Loaded_Tasks, log_intro = t
|
|
|
15
15
|
const logged: string[] = [];
|
|
16
16
|
if (log_intro) {
|
|
17
17
|
logged.unshift(
|
|
18
|
-
`\n\n${
|
|
19
|
-
`\n${
|
|
18
|
+
`\n\n${st('gray', 'Run a task:')} gro [name]`,
|
|
19
|
+
`\n${st('gray', 'View help:')} gro [name] --help`,
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -35,7 +35,7 @@ export const log_tasks = (log: Logger, loaded_tasks: Loaded_Tasks, log_intro = t
|
|
|
35
35
|
for (const resolved_input_file of resolved_input_files) {
|
|
36
36
|
const meta = modules.find((m) => m.id === resolved_input_file.id)!;
|
|
37
37
|
logged.push(
|
|
38
|
-
'\n' + cyan
|
|
38
|
+
'\n' + st('cyan', meta.name.padEnd(longest_task_name)),
|
|
39
39
|
' ',
|
|
40
40
|
meta.mod.task.summary ?? '',
|
|
41
41
|
);
|
|
@@ -46,7 +46,7 @@ export const log_tasks = (log: Logger, loaded_tasks: Loaded_Tasks, log_intro = t
|
|
|
46
46
|
|
|
47
47
|
export const log_error_reasons = (log: Logger, reasons: string[]): void => {
|
|
48
48
|
for (const reason of reasons) {
|
|
49
|
-
log.error(red
|
|
49
|
+
log.error(st('red', reason));
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
52
|
|
|
@@ -59,9 +59,9 @@ export const log_task_help = (log: Logger, meta: Task_Module_Meta): void => {
|
|
|
59
59
|
} = meta;
|
|
60
60
|
const logged: string[] = [];
|
|
61
61
|
logged.push(
|
|
62
|
-
cyan
|
|
62
|
+
st('cyan', name),
|
|
63
63
|
'help',
|
|
64
|
-
cyan
|
|
64
|
+
st('cyan', `\n\ngro ${name}`) + `: ${task.summary ?? '(no summary available)'}\n`,
|
|
65
65
|
);
|
|
66
66
|
if (task.Args) {
|
|
67
67
|
const properties = to_arg_properties(task.Args._def, meta);
|
|
@@ -75,14 +75,14 @@ export const log_task_help = (log: Logger, meta: Task_Module_Meta): void => {
|
|
|
75
75
|
for (const property of properties) {
|
|
76
76
|
const name = property.name === '_' ? ARGS_PROPERTY_NAME : property.name;
|
|
77
77
|
logged.push(
|
|
78
|
-
`\n${green
|
|
79
|
-
gray
|
|
78
|
+
`\n${st('green', name.padEnd(longest_task_name))} `,
|
|
79
|
+
st('gray', property.schema.type.padEnd(longest_type)) + ' ',
|
|
80
80
|
print_value(property.schema.default).padEnd(longest_default) + ' ',
|
|
81
81
|
property.schema.description || '(no description available)',
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
if (!properties.length) {
|
|
85
|
-
logged.push('\n' +
|
|
85
|
+
logged.push('\n' + st('gray', 'this task has no args'));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
log.info(...logged, '\n');
|
package/src/lib/test.task.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {styleText as st} from 'node:util';
|
|
2
2
|
import {z} from 'zod';
|
|
3
3
|
|
|
4
4
|
import {Task_Error, type Task} from './task.js';
|
|
@@ -26,7 +26,7 @@ export const task: Task<Args> = {
|
|
|
26
26
|
const {_: patterns, bail, cwd, ignore} = args;
|
|
27
27
|
|
|
28
28
|
if (!find_cli('uvu')) {
|
|
29
|
-
log.warn(
|
|
29
|
+
log.warn(st('yellow', 'uvu is not installed, skipping tests'));
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
|
package/src/lib/watch_dir.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {watch, type ChokidarOptions, type FSWatcher} from 'chokidar';
|
|
2
2
|
import {relative} from 'node:path';
|
|
3
3
|
|
|
4
4
|
import type {Path_Filter} from './path.js';
|
|
@@ -23,7 +23,7 @@ export interface Options {
|
|
|
23
23
|
dir: string;
|
|
24
24
|
on_change: Watcher_Change_Callback;
|
|
25
25
|
filter?: Path_Filter | null | undefined;
|
|
26
|
-
chokidar?:
|
|
26
|
+
chokidar?: ChokidarOptions;
|
|
27
27
|
/**
|
|
28
28
|
* When `false`, returns the `path` relative to `dir`.
|
|
29
29
|
* @default true
|
|
@@ -39,13 +39,13 @@ export const watch_dir = ({
|
|
|
39
39
|
on_change,
|
|
40
40
|
filter,
|
|
41
41
|
absolute = true,
|
|
42
|
-
chokidar
|
|
42
|
+
chokidar = {},
|
|
43
43
|
}: Options): Watch_Node_Fs => {
|
|
44
|
-
let watcher:
|
|
44
|
+
let watcher: FSWatcher | undefined;
|
|
45
45
|
|
|
46
46
|
return {
|
|
47
47
|
init: async () => {
|
|
48
|
-
watcher =
|
|
48
|
+
watcher = watch(dir, chokidar);
|
|
49
49
|
watcher.on('add', (path, s) => {
|
|
50
50
|
const stats = s ?? statSync(path);
|
|
51
51
|
const final_path = absolute ? path : relative(dir, path);
|