@ryanatkn/gro 0.130.2 → 0.131.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 +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -8
- package/dist/invoke.js +2 -2
- package/dist/package.js +7 -7
- package/package.json +2 -2
- package/src/lib/config.ts +10 -8
- package/src/lib/invoke.ts +2 -2
- package/src/lib/package.ts +7 -7
package/dist/config.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export interface Raw_Gro_Config {
|
|
|
40
40
|
search_filters?: Path_Filter | Path_Filter[] | null;
|
|
41
41
|
}
|
|
42
42
|
export type Create_Gro_Config = (base_config: Gro_Config) => Raw_Gro_Config | Promise<Raw_Gro_Config>;
|
|
43
|
-
export declare const
|
|
43
|
+
export declare const create_empty_gro_config: () => Gro_Config;
|
|
44
44
|
/**
|
|
45
45
|
* The regexp used by default to exclude directories and files
|
|
46
46
|
* when searching the filesystem for tasks and genfiles.
|
|
@@ -53,10 +53,10 @@ export declare const DEFAULT_EXPORTS_EXCLUDER: RegExp;
|
|
|
53
53
|
* Transforms a `Raw_Gro_Config` to the more strict `Gro_Config`.
|
|
54
54
|
* This allows users to provide a more relaxed config.
|
|
55
55
|
*/
|
|
56
|
-
export declare const
|
|
56
|
+
export declare const normalize_gro_config: (raw_config: Raw_Gro_Config) => Gro_Config;
|
|
57
57
|
export interface Gro_Config_Module {
|
|
58
58
|
readonly default: Raw_Gro_Config | Create_Gro_Config;
|
|
59
59
|
}
|
|
60
|
-
export declare const
|
|
61
|
-
export declare const
|
|
60
|
+
export declare const load_gro_config: (dir?: string) => Promise<Gro_Config>;
|
|
61
|
+
export declare const validate_gro_config_module: (config_module: any, config_path: string) => asserts config_module is Gro_Config_Module;
|
|
62
62
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"../src/lib/","sources":["config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,OAAO,EAAE,qBAAqB,CAAC;IAC/B;;;;OAIG;IACH,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C;;;OAGG;IACH,cAAc,EAAE,OAAO,EAAE,CAAC;IAC1B;;;OAGG;IACH,cAAc,EAAE,WAAW,EAAE,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC;CACpD;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC/B,WAAW,EAAE,UAAU,KACnB,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9C,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"../src/lib/","sources":["config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,OAAO,EAAE,qBAAqB,CAAC;IAC/B;;;;OAIG;IACH,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C;;;OAGG;IACH,cAAc,EAAE,OAAO,EAAE,CAAC;IAC1B;;;OAGG;IACH,cAAc,EAAE,WAAW,EAAE,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC9B,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC;CACpD;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC/B,WAAW,EAAE,UAAU,KACnB,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE9C,eAAO,MAAM,uBAAuB,QAAO,UAUzC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAUnC,CAAC;AAWF,eAAO,MAAM,wBAAwB,QAAwD,CAAC;AAE9F;;;GAGG;AACH,eAAO,MAAM,oBAAoB,eAAgB,cAAc,KAAG,UAoBjE,CAAC;AAEF,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB,CAAC;CACrD;AAED,eAAO,MAAM,eAAe,oBAA6B,OAAO,CAAC,UAAU,CAiB1E,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,CACxC,aAAa,EAAE,GAAG,EAClB,WAAW,EAAE,MAAM,KACf,OAAO,CAAC,aAAa,IAAI,iBAS7B,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync } from 'node:fs';
|
|
|
3
3
|
import { GRO_DIST_DIR, IS_THIS_GRO, paths } from './paths.js';
|
|
4
4
|
import { GRO_CONFIG_PATH, NODE_MODULES_DIRNAME, SERVER_DIST_PATH, SVELTEKIT_BUILD_DIRNAME, SVELTEKIT_DIST_DIRNAME, } from './path_constants.js';
|
|
5
5
|
import create_default_config from './gro.config.default.js';
|
|
6
|
-
export const
|
|
6
|
+
export const create_empty_gro_config = () => ({
|
|
7
7
|
plugins: () => [],
|
|
8
8
|
map_package_json: default_map_package_json,
|
|
9
9
|
task_root_dirs: [
|
|
@@ -38,8 +38,8 @@ export const DEFAULT_EXPORTS_EXCLUDER = /(\.md|\.(test|ignore)\.|\/(test|fixture
|
|
|
38
38
|
* Transforms a `Raw_Gro_Config` to the more strict `Gro_Config`.
|
|
39
39
|
* This allows users to provide a more relaxed config.
|
|
40
40
|
*/
|
|
41
|
-
export const
|
|
42
|
-
const empty_config =
|
|
41
|
+
export const normalize_gro_config = (raw_config) => {
|
|
42
|
+
const empty_config = create_empty_gro_config();
|
|
43
43
|
// All of the raw config properties are optional,
|
|
44
44
|
// so fall back to the empty values when `undefined`.
|
|
45
45
|
const { plugins = empty_config.plugins, map_package_json = empty_config.map_package_json, task_root_dirs = empty_config.task_root_dirs, search_filters = empty_config.search_filters, } = raw_config;
|
|
@@ -54,8 +54,8 @@ export const normalize_config = (raw_config) => {
|
|
|
54
54
|
: [],
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
|
-
export const
|
|
58
|
-
const default_config =
|
|
57
|
+
export const load_gro_config = async (dir = paths.root) => {
|
|
58
|
+
const default_config = normalize_gro_config(await create_default_config(create_empty_gro_config()));
|
|
59
59
|
const config_path = join(dir, GRO_CONFIG_PATH);
|
|
60
60
|
if (!existsSync(config_path)) {
|
|
61
61
|
// No user config file found, so return the default.
|
|
@@ -63,12 +63,12 @@ export const load_config = async (dir = paths.root) => {
|
|
|
63
63
|
}
|
|
64
64
|
// Import the user's `gro.config.ts`.
|
|
65
65
|
const config_module = await import(config_path);
|
|
66
|
-
|
|
67
|
-
return
|
|
66
|
+
validate_gro_config_module(config_module, config_path);
|
|
67
|
+
return normalize_gro_config(typeof config_module.default === 'function'
|
|
68
68
|
? await config_module.default(default_config)
|
|
69
69
|
: config_module.default);
|
|
70
70
|
};
|
|
71
|
-
export const
|
|
71
|
+
export const validate_gro_config_module = (config_module, config_path) => {
|
|
72
72
|
const config = config_module.default;
|
|
73
73
|
if (!config) {
|
|
74
74
|
throw Error(`Invalid Gro config module at ${config_path}: expected a default export`);
|
package/dist/invoke.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { attach_process_error_handlers } from '@ryanatkn/belt/process.js';
|
|
2
2
|
import { invoke_task } from './invoke_task.js';
|
|
3
3
|
import { to_task_args } from './args.js';
|
|
4
|
-
import {
|
|
4
|
+
import { load_gro_config } from './config.js';
|
|
5
5
|
import { sveltekit_sync_if_obviously_needed } from './sveltekit_helpers.js';
|
|
6
6
|
/*
|
|
7
7
|
|
|
@@ -17,4 +17,4 @@ and the rest of the args are forwarded to the task's `run` function.
|
|
|
17
17
|
attach_process_error_handlers((err) => err?.constructor?.name === 'Task_Error' ? 'Task_Error' : null);
|
|
18
18
|
await sveltekit_sync_if_obviously_needed();
|
|
19
19
|
const { task_name, args } = to_task_args();
|
|
20
|
-
await invoke_task(task_name, args, await
|
|
20
|
+
await invoke_task(task_name, args, await load_gro_config());
|
package/dist/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// generated by src/lib/package.gen.ts
|
|
2
2
|
export const package_json = {
|
|
3
3
|
name: '@ryanatkn/gro',
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.131.0',
|
|
5
5
|
description: 'task runner and toolkit extending SvelteKit',
|
|
6
6
|
motto: 'generate, run, optimize',
|
|
7
7
|
glyph: '🌰',
|
|
@@ -56,7 +56,7 @@ export const package_json = {
|
|
|
56
56
|
'@changesets/changelog-git': '^0.2.0',
|
|
57
57
|
'@changesets/types': '^6.0.0',
|
|
58
58
|
'@ryanatkn/eslint-config': '^0.4.2',
|
|
59
|
-
'@ryanatkn/fuz': '^0.
|
|
59
|
+
'@ryanatkn/fuz': '^0.111.0',
|
|
60
60
|
'@ryanatkn/moss': '^0.8.0',
|
|
61
61
|
'@sveltejs/adapter-static': '^3.0.2',
|
|
62
62
|
'@sveltejs/kit': '^2.5.18',
|
|
@@ -266,7 +266,7 @@ export const package_json = {
|
|
|
266
266
|
};
|
|
267
267
|
export const src_json = {
|
|
268
268
|
name: '@ryanatkn/gro',
|
|
269
|
-
version: '0.
|
|
269
|
+
version: '0.131.0',
|
|
270
270
|
modules: {
|
|
271
271
|
'.': {
|
|
272
272
|
path: 'index.ts',
|
|
@@ -367,13 +367,13 @@ export const src_json = {
|
|
|
367
367
|
{ name: 'Gro_Config', kind: 'type' },
|
|
368
368
|
{ name: 'Raw_Gro_Config', kind: 'type' },
|
|
369
369
|
{ name: 'Create_Gro_Config', kind: 'type' },
|
|
370
|
-
{ name: '
|
|
370
|
+
{ name: 'create_empty_gro_config', kind: 'function' },
|
|
371
371
|
{ name: 'DEFAULT_SEARCH_EXCLUDER', kind: 'variable' },
|
|
372
372
|
{ name: 'DEFAULT_EXPORTS_EXCLUDER', kind: 'variable' },
|
|
373
|
-
{ name: '
|
|
373
|
+
{ name: 'normalize_gro_config', kind: 'function' },
|
|
374
374
|
{ name: 'Gro_Config_Module', kind: 'type' },
|
|
375
|
-
{ name: '
|
|
376
|
-
{ name: '
|
|
375
|
+
{ name: 'load_gro_config', kind: 'function' },
|
|
376
|
+
{ name: 'validate_gro_config_module', kind: 'function' },
|
|
377
377
|
],
|
|
378
378
|
},
|
|
379
379
|
'./deploy.task.js': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryanatkn/gro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.131.0",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"glyph": "🌰",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@changesets/changelog-git": "^0.2.0",
|
|
70
70
|
"@changesets/types": "^6.0.0",
|
|
71
71
|
"@ryanatkn/eslint-config": "^0.4.2",
|
|
72
|
-
"@ryanatkn/fuz": "^0.
|
|
72
|
+
"@ryanatkn/fuz": "^0.111.0",
|
|
73
73
|
"@ryanatkn/moss": "^0.8.0",
|
|
74
74
|
"@sveltejs/adapter-static": "^3.0.2",
|
|
75
75
|
"@sveltejs/kit": "^2.5.18",
|
package/src/lib/config.ts
CHANGED
|
@@ -58,7 +58,7 @@ export type Create_Gro_Config = (
|
|
|
58
58
|
base_config: Gro_Config,
|
|
59
59
|
) => Raw_Gro_Config | Promise<Raw_Gro_Config>;
|
|
60
60
|
|
|
61
|
-
export const
|
|
61
|
+
export const create_empty_gro_config = (): Gro_Config => ({
|
|
62
62
|
plugins: () => [],
|
|
63
63
|
map_package_json: default_map_package_json,
|
|
64
64
|
task_root_dirs: [
|
|
@@ -103,8 +103,8 @@ export const DEFAULT_EXPORTS_EXCLUDER = /(\.md|\.(test|ignore)\.|\/(test|fixture
|
|
|
103
103
|
* Transforms a `Raw_Gro_Config` to the more strict `Gro_Config`.
|
|
104
104
|
* This allows users to provide a more relaxed config.
|
|
105
105
|
*/
|
|
106
|
-
export const
|
|
107
|
-
const empty_config =
|
|
106
|
+
export const normalize_gro_config = (raw_config: Raw_Gro_Config): Gro_Config => {
|
|
107
|
+
const empty_config = create_empty_gro_config();
|
|
108
108
|
// All of the raw config properties are optional,
|
|
109
109
|
// so fall back to the empty values when `undefined`.
|
|
110
110
|
const {
|
|
@@ -129,8 +129,10 @@ export interface Gro_Config_Module {
|
|
|
129
129
|
readonly default: Raw_Gro_Config | Create_Gro_Config;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
export const
|
|
133
|
-
const default_config =
|
|
132
|
+
export const load_gro_config = async (dir = paths.root): Promise<Gro_Config> => {
|
|
133
|
+
const default_config = normalize_gro_config(
|
|
134
|
+
await create_default_config(create_empty_gro_config()),
|
|
135
|
+
);
|
|
134
136
|
const config_path = join(dir, GRO_CONFIG_PATH);
|
|
135
137
|
if (!existsSync(config_path)) {
|
|
136
138
|
// No user config file found, so return the default.
|
|
@@ -138,15 +140,15 @@ export const load_config = async (dir = paths.root): Promise<Gro_Config> => {
|
|
|
138
140
|
}
|
|
139
141
|
// Import the user's `gro.config.ts`.
|
|
140
142
|
const config_module = await import(config_path);
|
|
141
|
-
|
|
142
|
-
return
|
|
143
|
+
validate_gro_config_module(config_module, config_path);
|
|
144
|
+
return normalize_gro_config(
|
|
143
145
|
typeof config_module.default === 'function'
|
|
144
146
|
? await config_module.default(default_config)
|
|
145
147
|
: config_module.default,
|
|
146
148
|
);
|
|
147
149
|
};
|
|
148
150
|
|
|
149
|
-
export const
|
|
151
|
+
export const validate_gro_config_module: (
|
|
150
152
|
config_module: any,
|
|
151
153
|
config_path: string,
|
|
152
154
|
) => asserts config_module is Gro_Config_Module = (config_module, config_path) => {
|
package/src/lib/invoke.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {attach_process_error_handlers} from '@ryanatkn/belt/process.js';
|
|
|
2
2
|
|
|
3
3
|
import {invoke_task} from './invoke_task.js';
|
|
4
4
|
import {to_task_args} from './args.js';
|
|
5
|
-
import {
|
|
5
|
+
import {load_gro_config} from './config.js';
|
|
6
6
|
import {sveltekit_sync_if_obviously_needed} from './sveltekit_helpers.js';
|
|
7
7
|
|
|
8
8
|
/*
|
|
@@ -24,4 +24,4 @@ attach_process_error_handlers((err) =>
|
|
|
24
24
|
await sveltekit_sync_if_obviously_needed();
|
|
25
25
|
|
|
26
26
|
const {task_name, args} = to_task_args();
|
|
27
|
-
await invoke_task(task_name, args, await
|
|
27
|
+
await invoke_task(task_name, args, await load_gro_config());
|
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.131.0',
|
|
9
9
|
description: 'task runner and toolkit extending SvelteKit',
|
|
10
10
|
motto: 'generate, run, optimize',
|
|
11
11
|
glyph: '🌰',
|
|
@@ -61,7 +61,7 @@ export const package_json = {
|
|
|
61
61
|
'@changesets/changelog-git': '^0.2.0',
|
|
62
62
|
'@changesets/types': '^6.0.0',
|
|
63
63
|
'@ryanatkn/eslint-config': '^0.4.2',
|
|
64
|
-
'@ryanatkn/fuz': '^0.
|
|
64
|
+
'@ryanatkn/fuz': '^0.111.0',
|
|
65
65
|
'@ryanatkn/moss': '^0.8.0',
|
|
66
66
|
'@sveltejs/adapter-static': '^3.0.2',
|
|
67
67
|
'@sveltejs/kit': '^2.5.18',
|
|
@@ -272,7 +272,7 @@ export const package_json = {
|
|
|
272
272
|
|
|
273
273
|
export const src_json = {
|
|
274
274
|
name: '@ryanatkn/gro',
|
|
275
|
-
version: '0.
|
|
275
|
+
version: '0.131.0',
|
|
276
276
|
modules: {
|
|
277
277
|
'.': {
|
|
278
278
|
path: 'index.ts',
|
|
@@ -373,13 +373,13 @@ export const src_json = {
|
|
|
373
373
|
{name: 'Gro_Config', kind: 'type'},
|
|
374
374
|
{name: 'Raw_Gro_Config', kind: 'type'},
|
|
375
375
|
{name: 'Create_Gro_Config', kind: 'type'},
|
|
376
|
-
{name: '
|
|
376
|
+
{name: 'create_empty_gro_config', kind: 'function'},
|
|
377
377
|
{name: 'DEFAULT_SEARCH_EXCLUDER', kind: 'variable'},
|
|
378
378
|
{name: 'DEFAULT_EXPORTS_EXCLUDER', kind: 'variable'},
|
|
379
|
-
{name: '
|
|
379
|
+
{name: 'normalize_gro_config', kind: 'function'},
|
|
380
380
|
{name: 'Gro_Config_Module', kind: 'type'},
|
|
381
|
-
{name: '
|
|
382
|
-
{name: '
|
|
381
|
+
{name: 'load_gro_config', kind: 'function'},
|
|
382
|
+
{name: 'validate_gro_config_module', kind: 'function'},
|
|
383
383
|
],
|
|
384
384
|
},
|
|
385
385
|
'./deploy.task.js': {
|