@ryanatkn/gro 0.119.1 → 0.120.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 +3 -2
- package/dist/changelog.d.ts +1 -0
- package/dist/changeset.task.js +4 -5
- package/dist/clean_fs.d.ts +1 -2
- package/dist/clean_fs.js +3 -2
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +2 -2
- package/dist/config.d.ts +14 -1
- package/dist/config.js +17 -5
- package/dist/config.test.js +50 -1
- package/dist/deploy.task.js +8 -7
- package/dist/docs/README.gen.md.js +3 -3
- package/dist/docs/config.md +22 -6
- package/dist/docs/gen.md +2 -1
- package/dist/docs/task.md +4 -3
- package/dist/docs/tasks.gen.md.js +17 -10
- package/dist/docs/tasks.md +1 -0
- package/dist/env.d.ts +2 -3
- package/dist/env.js +2 -2
- package/dist/esbuild_helpers.d.ts +2 -1
- package/dist/esbuild_plugin_external_worker.d.ts +0 -1
- package/dist/esbuild_plugin_external_worker.js +7 -7
- package/dist/esbuild_plugin_svelte.d.ts +0 -1
- package/dist/esbuild_plugin_sveltekit_local_imports.js +2 -2
- package/dist/format_directory.d.ts +1 -0
- package/dist/fs.d.ts +1 -3
- package/dist/fs.js +3 -13
- package/dist/fs.test.js +5 -5
- package/dist/gen.d.ts +66 -13
- package/dist/gen.js +77 -9
- package/dist/gen.task.d.ts +3 -0
- package/dist/gen.task.js +24 -19
- package/dist/gen.test.js +48 -35
- package/dist/git.d.ts +0 -1
- package/dist/git.js +3 -3
- package/dist/gro_helpers.js +4 -4
- package/dist/gro_plugin_gen.js +7 -7
- package/dist/gro_plugin_server.d.ts +2 -2
- package/dist/gro_plugin_server.js +5 -5
- package/dist/gro_plugin_sveltekit_app.js +8 -8
- package/dist/hash.d.ts +1 -2
- package/dist/input_path.d.ts +34 -16
- package/dist/input_path.js +119 -67
- package/dist/input_path.test.js +150 -46
- package/dist/invoke_task.d.ts +2 -1
- package/dist/invoke_task.js +33 -79
- package/dist/loader.d.ts +0 -1
- package/dist/loader.js +4 -4
- package/dist/modules.d.ts +17 -36
- package/dist/modules.js +29 -68
- package/dist/modules.test.js +19 -143
- package/dist/package.d.ts +11 -20
- package/dist/package.js +61 -64
- package/dist/package_json.d.ts +1 -0
- package/dist/package_json.js +1 -1
- package/dist/package_meta.d.ts +1 -1
- package/dist/path.d.ts +12 -8
- package/dist/path.js +0 -6
- package/dist/paths.d.ts +7 -12
- package/dist/paths.js +11 -34
- package/dist/paths.test.js +17 -15
- package/dist/plugin.d.ts +1 -1
- package/dist/publish.task.js +3 -3
- package/dist/resolve.task.d.ts +11 -0
- package/dist/resolve.task.js +24 -0
- package/dist/resolve_node_specifier.d.ts +2 -2
- package/dist/resolve_node_specifier.js +3 -3
- package/dist/resolve_specifier.d.ts +2 -1
- package/dist/resolve_specifier.js +16 -16
- package/dist/resolve_specifier.test.js +9 -9
- package/dist/run.task.js +2 -2
- package/dist/run_gen.d.ts +4 -4
- package/dist/run_gen.js +9 -16
- package/dist/run_gen.test.js +10 -15
- package/dist/run_task.d.ts +2 -1
- package/dist/run_task.js +2 -0
- package/dist/search_fs.d.ts +20 -7
- package/dist/search_fs.js +40 -18
- package/dist/search_fs.test.js +9 -11
- package/dist/src_json.js +2 -2
- package/dist/sveltekit_config.d.ts +0 -1
- package/dist/sveltekit_helpers.js +4 -4
- package/dist/sveltekit_shim_app.d.ts +1 -1
- package/dist/sveltekit_shim_app_forms.d.ts +0 -1
- package/dist/sveltekit_shim_app_navigation.d.ts +0 -1
- package/dist/sveltekit_shim_app_paths.d.ts +0 -1
- package/dist/sveltekit_shim_app_stores.d.ts +0 -1
- package/dist/sveltekit_shim_env.d.ts +1 -1
- package/dist/task.d.ts +65 -1
- package/dist/task.js +85 -13
- package/dist/task.test.js +25 -11
- package/dist/task_logging.d.ts +3 -6
- package/dist/task_logging.js +18 -36
- package/dist/watch_dir.d.ts +2 -2
- package/dist/watch_dir.js +14 -16
- package/package.json +18 -23
- package/dist/gen_module.d.ts +0 -34
- package/dist/gen_module.js +0 -32
- package/dist/gen_module.test.d.ts +0 -1
- package/dist/gen_module.test.js +0 -30
- package/dist/task_module.d.ts +0 -15
- package/dist/task_module.js +0 -18
- package/dist/task_module.test.d.ts +0 -1
- package/dist/task_module.test.js +0 -67
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryanatkn/gro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.120.0",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"icon": "🌰",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"funding": "https://www.ryanatkn.com/funding",
|
|
24
24
|
"type": "module",
|
|
25
25
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
26
|
+
"node": ">=22.3"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "rm -rf .gro dist && svelte-kit sync && svelte-package && chmod +x ./dist/gro.js && npm link -f",
|
|
@@ -52,9 +52,8 @@
|
|
|
52
52
|
"kleur": "^4.1.5",
|
|
53
53
|
"mri": "^1.2.0",
|
|
54
54
|
"prettier": "^3.3.2",
|
|
55
|
-
"prettier-plugin-svelte": "^3.2.
|
|
56
|
-
"
|
|
57
|
-
"ts-morph": "^22.0.0",
|
|
55
|
+
"prettier-plugin-svelte": "^3.2.5",
|
|
56
|
+
"ts-morph": "^23.0.0",
|
|
58
57
|
"tslib": "^2.6.3",
|
|
59
58
|
"zod": "^3.23.8"
|
|
60
59
|
},
|
|
@@ -65,23 +64,23 @@
|
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@changesets/changelog-git": "^0.2.0",
|
|
67
66
|
"@changesets/types": "^6.0.0",
|
|
68
|
-
"@ryanatkn/eslint-config": "^0.1.
|
|
69
|
-
"@ryanatkn/fuz": "^0.
|
|
67
|
+
"@ryanatkn/eslint-config": "^0.1.3",
|
|
68
|
+
"@ryanatkn/fuz": "^0.103.0",
|
|
70
69
|
"@ryanatkn/moss": "^0.4.0",
|
|
71
70
|
"@sveltejs/adapter-static": "^3.0.2",
|
|
72
|
-
"@sveltejs/kit": "^2.5.
|
|
71
|
+
"@sveltejs/kit": "^2.5.17",
|
|
73
72
|
"@sveltejs/package": "^2.3.2",
|
|
74
73
|
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
|
75
74
|
"@types/fs-extra": "^11.0.4",
|
|
76
|
-
"@types/node": "^20.14.
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^7.13.
|
|
78
|
-
"@typescript-eslint/parser": "^7.13.
|
|
75
|
+
"@types/node": "^20.14.8",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
77
|
+
"@typescript-eslint/parser": "^7.13.1",
|
|
79
78
|
"esbuild": "^0.20.2",
|
|
80
79
|
"eslint": "^8.57.0",
|
|
81
|
-
"eslint-plugin-svelte": "^2.
|
|
82
|
-
"svelte": "^5.0.0-next.
|
|
83
|
-
"svelte-check": "^3.8.
|
|
84
|
-
"typescript": "^5.
|
|
80
|
+
"eslint-plugin-svelte": "^2.40.0",
|
|
81
|
+
"svelte": "^5.0.0-next.164",
|
|
82
|
+
"svelte-check": "^3.8.1",
|
|
83
|
+
"typescript": "^5.5.2",
|
|
85
84
|
"uvu": "^0.5.6"
|
|
86
85
|
},
|
|
87
86
|
"eslintConfig": {
|
|
@@ -210,10 +209,6 @@
|
|
|
210
209
|
"default": "./dist/fs.js",
|
|
211
210
|
"types": "./dist/fs.d.ts"
|
|
212
211
|
},
|
|
213
|
-
"./gen_module.js": {
|
|
214
|
-
"default": "./dist/gen_module.js",
|
|
215
|
-
"types": "./dist/gen_module.d.ts"
|
|
216
|
-
},
|
|
217
212
|
"./gen.task.js": {
|
|
218
213
|
"default": "./dist/gen.task.js",
|
|
219
214
|
"types": "./dist/gen.task.d.ts"
|
|
@@ -346,6 +341,10 @@
|
|
|
346
341
|
"default": "./dist/resolve_specifier.js",
|
|
347
342
|
"types": "./dist/resolve_specifier.d.ts"
|
|
348
343
|
},
|
|
344
|
+
"./resolve.task.js": {
|
|
345
|
+
"default": "./dist/resolve.task.js",
|
|
346
|
+
"types": "./dist/resolve.task.d.ts"
|
|
347
|
+
},
|
|
349
348
|
"./run_gen.js": {
|
|
350
349
|
"default": "./dist/run_gen.js",
|
|
351
350
|
"types": "./dist/run_gen.d.ts"
|
|
@@ -418,10 +417,6 @@
|
|
|
418
417
|
"default": "./dist/task_logging.js",
|
|
419
418
|
"types": "./dist/task_logging.d.ts"
|
|
420
419
|
},
|
|
421
|
-
"./task_module.js": {
|
|
422
|
-
"default": "./dist/task_module.js",
|
|
423
|
-
"types": "./dist/task_module.d.ts"
|
|
424
|
-
},
|
|
425
420
|
"./task.js": {
|
|
426
421
|
"default": "./dist/task.js",
|
|
427
422
|
"types": "./dist/task.d.ts"
|
package/dist/gen_module.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type Module_Meta, type Load_Module_Result, type Find_Modules_Result } from './modules.js';
|
|
2
|
-
import type { Gen } from './gen.js';
|
|
3
|
-
import { Input_Path } from './input_path.js';
|
|
4
|
-
export declare const GEN_FILE_PATTERN_TEXT = "gen";
|
|
5
|
-
export declare const GEN_FILE_PATTERN: string;
|
|
6
|
-
export declare const is_gen_path: (path: string) => boolean;
|
|
7
|
-
export declare const GEN_SCHEMA_FILE_PATTERN_TEXT = "schema";
|
|
8
|
-
export declare const GEN_SCHEMA_FILE_PATTERN: string;
|
|
9
|
-
export declare const GEN_SCHEMA_PATH_SUFFIX: string;
|
|
10
|
-
export declare const GEN_SCHEMA_IDENTIFIER_SUFFIX = "Schema";
|
|
11
|
-
export type Gen_Module_Type = 'basic';
|
|
12
|
-
export type Gen_Module = Basic_Gen_Module | Schema_Gen_Module;
|
|
13
|
-
export interface Basic_Gen_Module {
|
|
14
|
-
gen: Gen;
|
|
15
|
-
}
|
|
16
|
-
export interface Schema_Gen_Module extends Basic_Gen_Module {
|
|
17
|
-
[key: string]: unknown;
|
|
18
|
-
}
|
|
19
|
-
export declare const to_gen_module_type: (_filename: string) => Gen_Module_Type;
|
|
20
|
-
export declare const gen_module_meta: Record<Gen_Module_Type, {
|
|
21
|
-
pattern: string;
|
|
22
|
-
text: string;
|
|
23
|
-
}>;
|
|
24
|
-
export declare const validate_gen_module: {
|
|
25
|
-
basic: (mod: Record<string, any>) => mod is Basic_Gen_Module;
|
|
26
|
-
schema: (mod: Record<string, any>) => mod is Schema_Gen_Module;
|
|
27
|
-
};
|
|
28
|
-
export type Gen_Module_Meta = Basic_Gen_Module_Meta;
|
|
29
|
-
export interface Basic_Gen_Module_Meta extends Module_Meta<Gen_Module> {
|
|
30
|
-
type: 'basic';
|
|
31
|
-
mod: Basic_Gen_Module;
|
|
32
|
-
}
|
|
33
|
-
export declare const load_gen_module: (id: string) => Promise<Load_Module_Result<Gen_Module_Meta>>;
|
|
34
|
-
export declare const find_gen_modules: (input_paths?: Input_Path[], extensions?: string[], root_dirs?: string[]) => Promise<Find_Modules_Result>;
|
package/dist/gen_module.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { load_module, find_modules, } from './modules.js';
|
|
2
|
-
import { Input_Path, get_possible_source_ids } from './input_path.js';
|
|
3
|
-
import { paths } from './paths.js';
|
|
4
|
-
import { search_fs } from './search_fs.js';
|
|
5
|
-
export const GEN_FILE_PATTERN_TEXT = 'gen';
|
|
6
|
-
export const GEN_FILE_PATTERN = '.' + GEN_FILE_PATTERN_TEXT + '.';
|
|
7
|
-
export const is_gen_path = (path) => path.includes(GEN_FILE_PATTERN);
|
|
8
|
-
export const GEN_SCHEMA_FILE_PATTERN_TEXT = 'schema';
|
|
9
|
-
export const GEN_SCHEMA_FILE_PATTERN = '.' + GEN_SCHEMA_FILE_PATTERN_TEXT + '.';
|
|
10
|
-
export const GEN_SCHEMA_PATH_SUFFIX = GEN_SCHEMA_FILE_PATTERN + 'ts';
|
|
11
|
-
export const GEN_SCHEMA_IDENTIFIER_SUFFIX = 'Schema';
|
|
12
|
-
// TODO remove if not used, but we may generic stuff from Zod schemas or other things
|
|
13
|
-
export const to_gen_module_type = (_filename) => 'basic';
|
|
14
|
-
export const gen_module_meta = {
|
|
15
|
-
basic: { pattern: GEN_FILE_PATTERN, text: GEN_FILE_PATTERN_TEXT },
|
|
16
|
-
};
|
|
17
|
-
export const validate_gen_module = {
|
|
18
|
-
basic: (mod) => typeof mod?.gen === 'function',
|
|
19
|
-
schema: (mod) => !!mod,
|
|
20
|
-
};
|
|
21
|
-
export const load_gen_module = async (id) => {
|
|
22
|
-
const type = to_gen_module_type(id);
|
|
23
|
-
const result = await load_module(id, validate_gen_module[type]);
|
|
24
|
-
if (result.ok) {
|
|
25
|
-
result.mod.type = type;
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
};
|
|
29
|
-
export const find_gen_modules = (input_paths = [paths.source],
|
|
30
|
-
// TODO improve this API to allow config, maybe just a simple `gen` filter function, so the user could return a Rollup pluginutils filter,
|
|
31
|
-
// gets a little tricky with the `get_possible_source_ids` API usage, which would probably need to change
|
|
32
|
-
extensions = [GEN_FILE_PATTERN, GEN_SCHEMA_FILE_PATTERN], root_dirs = []) => find_modules(input_paths, (id) => search_fs(id, { filter: (path) => extensions.some((e) => path.includes(e)) }), (input_path) => get_possible_source_ids(input_path, extensions, root_dirs));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/gen_module.test.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { test } from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { validate_gen_module, find_gen_modules } from './gen_module.js';
|
|
5
|
-
import { paths } from './paths.js';
|
|
6
|
-
test('basic minimal interface', () => {
|
|
7
|
-
assert.ok(validate_gen_module.basic({ gen: Function.prototype }));
|
|
8
|
-
});
|
|
9
|
-
test('basic invalid module', () => {
|
|
10
|
-
assert.ok(!validate_gen_module.basic({ gen: {} }));
|
|
11
|
-
assert.ok(!validate_gen_module.basic({ task: { run: {} } }));
|
|
12
|
-
assert.ok(!validate_gen_module.basic(undefined));
|
|
13
|
-
assert.ok(!validate_gen_module.basic(null));
|
|
14
|
-
assert.ok(!validate_gen_module.basic(false));
|
|
15
|
-
});
|
|
16
|
-
test('schema minimal interface', () => {
|
|
17
|
-
assert.ok(validate_gen_module.schema({}));
|
|
18
|
-
assert.ok(validate_gen_module.schema({ SomeSchema: { $id: '/schemas/SomeSchema' } }));
|
|
19
|
-
});
|
|
20
|
-
test('schema invalid module', () => {
|
|
21
|
-
assert.ok(!validate_gen_module.schema(undefined));
|
|
22
|
-
assert.ok(!validate_gen_module.schema(null));
|
|
23
|
-
assert.ok(!validate_gen_module.schema(false));
|
|
24
|
-
});
|
|
25
|
-
test('finds gen modules in a directory', async () => {
|
|
26
|
-
const find_gen_modules_result = await find_gen_modules([join(paths.lib, 'docs/')]);
|
|
27
|
-
assert.ok(find_gen_modules_result.ok);
|
|
28
|
-
assert.ok(find_gen_modules_result.source_id_path_data_by_input_path.size);
|
|
29
|
-
});
|
|
30
|
-
test.run();
|
package/dist/task_module.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { load_modules, find_modules, type Module_Meta, type Load_Module_Result, type Find_Modules_Failure } from './modules.js';
|
|
2
|
-
import { type Task } from './task.js';
|
|
3
|
-
import { Input_Path } from './input_path.js';
|
|
4
|
-
export interface Task_Module {
|
|
5
|
-
task: Task;
|
|
6
|
-
}
|
|
7
|
-
export interface Task_Module_Meta extends Module_Meta<Task_Module> {
|
|
8
|
-
name: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const validate_task_module: (mod: Record<string, any>) => mod is Task_Module;
|
|
11
|
-
export declare const load_task_module: (id: string, task_root_paths: string[]) => Promise<Load_Module_Result<Task_Module_Meta>>;
|
|
12
|
-
export declare const find_task_modules: (input_paths: Input_Path[], task_root_paths: string[]) => Promise<ReturnType<typeof find_modules>>;
|
|
13
|
-
export declare const load_task_modules: (input_paths: Input_Path[], task_root_paths: string[]) => Promise<ReturnType<typeof load_modules<Task_Module, Task_Module_Meta>> | ({
|
|
14
|
-
ok: false;
|
|
15
|
-
} & Find_Modules_Failure)>;
|
package/dist/task_module.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { load_module, load_modules, find_modules, } from './modules.js';
|
|
2
|
-
import { to_task_name, is_task_path, TASK_FILE_SUFFIX_TS, TASK_FILE_SUFFIX_JS, } from './task.js';
|
|
3
|
-
import { Input_Path, get_possible_source_ids } from './input_path.js';
|
|
4
|
-
import { search_fs } from './search_fs.js';
|
|
5
|
-
export const validate_task_module = (mod) => !!mod.task && typeof mod.task.run === 'function';
|
|
6
|
-
export const load_task_module = async (id, task_root_paths) => {
|
|
7
|
-
const result = await load_module(id, validate_task_module);
|
|
8
|
-
if (!result.ok)
|
|
9
|
-
return result;
|
|
10
|
-
return { ...result, mod: { ...result.mod, name: to_task_name(id, task_root_paths) } }; // TODO this task name needs to use task root paths or cwd
|
|
11
|
-
};
|
|
12
|
-
export const find_task_modules = async (input_paths, task_root_paths) => find_modules(input_paths, (id) => search_fs(id, { filter: (path) => is_task_path(path) }), (input_path) => get_possible_source_ids(input_path, [TASK_FILE_SUFFIX_TS, TASK_FILE_SUFFIX_JS], task_root_paths));
|
|
13
|
-
export const load_task_modules = async (input_paths, task_root_paths) => {
|
|
14
|
-
const find_modules_result = await find_task_modules(input_paths, task_root_paths);
|
|
15
|
-
if (!find_modules_result.ok)
|
|
16
|
-
return find_modules_result;
|
|
17
|
-
return load_modules(find_modules_result.source_ids_by_input_path, (id) => load_task_module(id, task_root_paths));
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/task_module.test.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { suite } from 'uvu';
|
|
2
|
-
import * as assert from 'uvu/assert';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
import { validate_task_module, load_task_module, load_task_modules } from './task_module.js';
|
|
5
|
-
import * as actual_test_task_module from './test.task.js';
|
|
6
|
-
// TODO if we import directly, svelte-package generates types in `src/fixtures`
|
|
7
|
-
/* eslint-disable no-useless-concat */
|
|
8
|
-
const test_task_module = await import('../fixtures/' + 'test_task_module.task_fixture');
|
|
9
|
-
const test_invalid_task_module = await import('../fixtures/' + 'test_invalid_task_module.js');
|
|
10
|
-
/* test__validate_task_module */
|
|
11
|
-
const test__validate_task_module = suite('validate_task_module');
|
|
12
|
-
test__validate_task_module('basic behavior', () => {
|
|
13
|
-
assert.ok(validate_task_module(test_task_module));
|
|
14
|
-
assert.ok(!validate_task_module(test_invalid_task_module));
|
|
15
|
-
assert.ok(!validate_task_module({ task: { run: {} } }));
|
|
16
|
-
});
|
|
17
|
-
test__validate_task_module.run();
|
|
18
|
-
/* test__validate_task_module */
|
|
19
|
-
/* test__load_task_module */
|
|
20
|
-
const test__load_task_module = suite('load_task_module');
|
|
21
|
-
test__load_task_module('basic behavior', async () => {
|
|
22
|
-
const name = 'fixtures/test_task_module.task_fixture.js';
|
|
23
|
-
const id = resolve('src/' + name);
|
|
24
|
-
const result = await load_task_module(id, []);
|
|
25
|
-
assert.ok(result.ok);
|
|
26
|
-
assert.is(result.mod.id, id);
|
|
27
|
-
assert.is(result.mod.id, id);
|
|
28
|
-
assert.is(result.mod.name, id); // TODO was `name` but changed after scoping to lib, but we want to relax that restriction
|
|
29
|
-
assert.is(result.mod.mod, test_task_module);
|
|
30
|
-
});
|
|
31
|
-
test__load_task_module('invalid module', async () => {
|
|
32
|
-
const id = resolve('src/fixtures/test_invalid_task_module.js');
|
|
33
|
-
const result = await load_task_module(id, []);
|
|
34
|
-
assert.ok(!result.ok);
|
|
35
|
-
if (result.type === 'invalid') {
|
|
36
|
-
assert.is(result.id, id);
|
|
37
|
-
assert.is(result.mod, test_invalid_task_module);
|
|
38
|
-
assert.is(result.validation, 'validate_task_module');
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
throw Error('should be invalid');
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
test__load_task_module('failing module', async () => {
|
|
45
|
-
const id = resolve('src/fixtures/test_failing_task_module.js');
|
|
46
|
-
const result = await load_task_module(id, []);
|
|
47
|
-
assert.ok(!result.ok);
|
|
48
|
-
if (result.type === 'importFailed') {
|
|
49
|
-
assert.is(result.id, id);
|
|
50
|
-
assert.ok(result.error);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
throw Error('should have failed');
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
test__load_task_module.run();
|
|
57
|
-
/* test__load_task_module */
|
|
58
|
-
/* test__load_task_modules */
|
|
59
|
-
const test__load_task_modules = suite('load_task_modules');
|
|
60
|
-
test__load_task_modules('basic behavior', async () => {
|
|
61
|
-
const result = await load_task_modules([resolve('src/lib/test'), resolve('src/lib/test.task.ts')], [resolve('src/lib')]);
|
|
62
|
-
assert.ok(result.ok);
|
|
63
|
-
assert.is(result.modules.length, 1);
|
|
64
|
-
assert.is(result.modules[0].mod, actual_test_task_module);
|
|
65
|
-
});
|
|
66
|
-
test__load_task_modules.run();
|
|
67
|
-
/* test__load_task_modules */
|