@ryanatkn/gro 0.133.2 → 0.133.3
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/build.task.d.ts +6 -0
- package/dist/build.task.d.ts.map +1 -1
- package/dist/build.task.js +6 -3
- package/dist/check.task.d.ts +2 -2
- package/dist/dev.task.d.ts +2 -2
- package/dist/esbuild_helpers.d.ts +1 -1
- package/dist/esbuild_helpers.d.ts.map +1 -1
- package/dist/esbuild_helpers.js +1 -1
- package/dist/esbuild_plugin_external_worker.d.ts +2 -2
- package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
- package/dist/esbuild_plugin_external_worker.js +3 -1
- package/dist/esbuild_plugin_svelte.d.ts +7 -2
- package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
- package/dist/esbuild_plugin_svelte.js +20 -9
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_local_imports.js +3 -2
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.js +3 -2
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.js +6 -5
- package/dist/gro_plugin_server.d.ts.map +1 -1
- package/dist/gro_plugin_server.js +4 -10
- package/dist/gro_plugin_sveltekit_app.js +2 -2
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +14 -14
- package/dist/package.d.ts +0 -11
- package/dist/package.d.ts.map +1 -1
- package/dist/package.js +9 -11
- package/dist/path_constants.d.ts +3 -0
- package/dist/path_constants.d.ts.map +1 -1
- package/dist/path_constants.js +3 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +3 -3
- package/dist/run_gen.js +2 -2
- package/dist/run_task.js +2 -2
- package/dist/sveltekit_config.d.ts +7 -2
- package/dist/sveltekit_config.d.ts.map +1 -1
- package/dist/sveltekit_config.js +11 -1
- package/dist/sveltekit_helpers.d.ts +2 -1
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_helpers.js +3 -2
- package/dist/task_logging.js +2 -4
- package/package.json +1 -5
- package/src/lib/build.task.ts +6 -3
- package/src/lib/esbuild_helpers.ts +1 -1
- package/src/lib/esbuild_plugin_external_worker.ts +4 -2
- package/src/lib/esbuild_plugin_svelte.ts +38 -11
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +16 -9
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +3 -2
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +7 -5
- package/src/lib/gro_plugin_server.ts +4 -11
- package/src/lib/gro_plugin_sveltekit_app.ts +2 -2
- package/src/lib/loader.ts +14 -16
- package/src/lib/package.ts +9 -11
- package/src/lib/path_constants.ts +4 -0
- package/src/lib/paths.ts +3 -3
- package/src/lib/run_gen.ts +2 -2
- package/src/lib/run_task.ts +2 -2
- package/src/lib/sveltekit_config.ts +21 -4
- package/src/lib/sveltekit_helpers.ts +4 -3
- package/src/lib/task_logging.ts +4 -6
- package/dist/sveltekit_config_global.d.ts +0 -5
- package/dist/sveltekit_config_global.d.ts.map +0 -1
- package/dist/sveltekit_config_global.js +0 -5
- package/src/lib/sveltekit_config_global.ts +0 -6
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.133.
|
|
8
|
+
version: '0.133.3',
|
|
9
9
|
description: 'task runner and toolkit extending SvelteKit',
|
|
10
10
|
motto: 'generate, run, optimize',
|
|
11
11
|
glyph: '🌰',
|
|
@@ -216,10 +216,6 @@ export const package_json = {
|
|
|
216
216
|
types: './dist/svelte_helpers.d.ts',
|
|
217
217
|
default: './dist/svelte_helpers.js',
|
|
218
218
|
},
|
|
219
|
-
'./sveltekit_config_global.js': {
|
|
220
|
-
types: './dist/sveltekit_config_global.d.ts',
|
|
221
|
-
default: './dist/sveltekit_config_global.js',
|
|
222
|
-
},
|
|
223
219
|
'./sveltekit_config.js': {
|
|
224
220
|
types: './dist/sveltekit_config.d.ts',
|
|
225
221
|
default: './dist/sveltekit_config.js',
|
|
@@ -272,7 +268,7 @@ export const package_json = {
|
|
|
272
268
|
|
|
273
269
|
export const src_json = {
|
|
274
270
|
name: '@ryanatkn/gro',
|
|
275
|
-
version: '0.133.
|
|
271
|
+
version: '0.133.3',
|
|
276
272
|
modules: {
|
|
277
273
|
'.': {
|
|
278
274
|
path: 'index.ts',
|
|
@@ -397,7 +393,7 @@ export const src_json = {
|
|
|
397
393
|
declarations: [
|
|
398
394
|
{name: 'print_build_result', kind: 'function'},
|
|
399
395
|
{name: 'to_define_import_meta_env', kind: 'function'},
|
|
400
|
-
{name: '
|
|
396
|
+
{name: 'default_ts_transform_options', kind: 'variable'},
|
|
401
397
|
],
|
|
402
398
|
},
|
|
403
399
|
'./esbuild_plugin_external_worker.js': {
|
|
@@ -712,6 +708,9 @@ export const src_json = {
|
|
|
712
708
|
{name: 'GITHUB_DIRNAME', kind: 'variable'},
|
|
713
709
|
{name: 'GIT_DIRNAME', kind: 'variable'},
|
|
714
710
|
{name: 'TSCONFIG_FILENAME', kind: 'variable'},
|
|
711
|
+
{name: 'TS_MATCHER', kind: 'variable'},
|
|
712
|
+
{name: 'JSON_MATCHER', kind: 'variable'},
|
|
713
|
+
{name: 'EVERYTHING_MATCHER', kind: 'variable'},
|
|
715
714
|
],
|
|
716
715
|
},
|
|
717
716
|
'./path.js': {
|
|
@@ -850,16 +849,14 @@ export const src_json = {
|
|
|
850
849
|
{name: 'SVELTE_RUNES_MATCHER', kind: 'variable'},
|
|
851
850
|
],
|
|
852
851
|
},
|
|
853
|
-
'./sveltekit_config_global.js': {
|
|
854
|
-
path: 'sveltekit_config_global.ts',
|
|
855
|
-
declarations: [{name: 'sveltekit_config_global', kind: 'variable'}],
|
|
856
|
-
},
|
|
857
852
|
'./sveltekit_config.js': {
|
|
858
853
|
path: 'sveltekit_config.ts',
|
|
859
854
|
declarations: [
|
|
860
855
|
{name: 'load_sveltekit_config', kind: 'function'},
|
|
861
856
|
{name: 'Parsed_Sveltekit_Config', kind: 'type'},
|
|
862
857
|
{name: 'init_sveltekit_config', kind: 'function'},
|
|
858
|
+
{name: 'to_default_compile_module_options', kind: 'function'},
|
|
859
|
+
{name: 'default_sveltekit_config', kind: 'variable'},
|
|
863
860
|
],
|
|
864
861
|
},
|
|
865
862
|
'./sveltekit_helpers.js': {
|
|
@@ -870,6 +867,7 @@ export const src_json = {
|
|
|
870
867
|
{name: 'SVELTE_PACKAGE_CLI', kind: 'variable'},
|
|
871
868
|
{name: 'SVELTE_PACKAGE_DEP_NAME', kind: 'variable'},
|
|
872
869
|
{name: 'VITE_CLI', kind: 'variable'},
|
|
870
|
+
{name: 'SVELTEKIT_ENV_MATCHER', kind: 'variable'},
|
|
873
871
|
{name: 'has_sveltekit_app', kind: 'function'},
|
|
874
872
|
{name: 'has_sveltekit_library', kind: 'function'},
|
|
875
873
|
{name: 'sveltekit_sync', kind: 'function'},
|
|
@@ -28,3 +28,7 @@ export const SVELTEKIT_VITE_CACHE_PATH = NODE_MODULES_DIRNAME + '/.vite';
|
|
|
28
28
|
export const GITHUB_DIRNAME = '.github';
|
|
29
29
|
export const GIT_DIRNAME = '.git';
|
|
30
30
|
export const TSCONFIG_FILENAME = 'tsconfig.json';
|
|
31
|
+
|
|
32
|
+
export const TS_MATCHER = /\.(ts|tsx|mts|cts)$/;
|
|
33
|
+
export const JSON_MATCHER = /\.(json)$/;
|
|
34
|
+
export const EVERYTHING_MATCHER = /.*/;
|
package/src/lib/paths.ts
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
SOURCE_DIR,
|
|
11
11
|
SVELTEKIT_DIST_DIRNAME,
|
|
12
12
|
} from './path_constants.js';
|
|
13
|
-
import {
|
|
13
|
+
import {default_sveltekit_config} from './sveltekit_config.js';
|
|
14
14
|
import type {Path_Id} from './path.js';
|
|
15
15
|
|
|
16
16
|
/*
|
|
@@ -20,10 +20,10 @@ It's the same name that Rollup uses.
|
|
|
20
20
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
export const LIB_DIRNAME = basename(
|
|
23
|
+
export const LIB_DIRNAME = basename(default_sveltekit_config.lib_path);
|
|
24
24
|
export const LIB_PATH = SOURCE_DIR + LIB_DIRNAME;
|
|
25
25
|
export const LIB_DIR = LIB_PATH + '/';
|
|
26
|
-
export const ROUTES_DIRNAME = basename(
|
|
26
|
+
export const ROUTES_DIRNAME = basename(default_sveltekit_config.routes_path);
|
|
27
27
|
|
|
28
28
|
export interface Paths {
|
|
29
29
|
root: string;
|
package/src/lib/run_gen.ts
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {print_path} from './paths.js';
|
|
15
15
|
import type {format_file as base_format_file} from './format_file.js';
|
|
16
16
|
import type {Gro_Config} from './gro_config.js';
|
|
17
|
-
import {
|
|
17
|
+
import {default_sveltekit_config} from './sveltekit_config.js';
|
|
18
18
|
|
|
19
19
|
export const GEN_NO_PROD_MESSAGE = 'gen runs only during development';
|
|
20
20
|
|
|
@@ -37,7 +37,7 @@ export const run_gen = async (
|
|
|
37
37
|
// Perform code generation by calling `gen` on the module.
|
|
38
38
|
const gen_ctx: Gen_Context = {
|
|
39
39
|
config,
|
|
40
|
-
sveltekit_config:
|
|
40
|
+
sveltekit_config: default_sveltekit_config,
|
|
41
41
|
origin_id: id,
|
|
42
42
|
log,
|
|
43
43
|
};
|
package/src/lib/run_task.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type {invoke_task as base_invoke_task} from './invoke_task.js';
|
|
|
7
7
|
import {log_task_help} from './task_logging.js';
|
|
8
8
|
import type {Gro_Config} from './gro_config.js';
|
|
9
9
|
import {Task_Error, type Task_Module_Meta} from './task.js';
|
|
10
|
-
import {
|
|
10
|
+
import {default_sveltekit_config} from './sveltekit_config.js';
|
|
11
11
|
|
|
12
12
|
export type Run_Task_Result =
|
|
13
13
|
| {
|
|
@@ -52,7 +52,7 @@ export const run_task = async (
|
|
|
52
52
|
output = await task.run({
|
|
53
53
|
args,
|
|
54
54
|
config,
|
|
55
|
-
sveltekit_config:
|
|
55
|
+
sveltekit_config: default_sveltekit_config,
|
|
56
56
|
log,
|
|
57
57
|
timings,
|
|
58
58
|
invoke_task: (invoked_task_name, invoked_args, invoked_config) =>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {Config as SveltekitConfig} from '@sveltejs/kit';
|
|
2
|
-
import type {CompileOptions,
|
|
2
|
+
import type {CompileOptions, ModuleCompileOptions, PreprocessorGroup} from 'svelte/compiler';
|
|
3
3
|
import {join} from 'node:path';
|
|
4
4
|
|
|
5
5
|
import {SVELTEKIT_CONFIG_FILENAME} from './path_constants.js';
|
|
@@ -57,7 +57,7 @@ export interface Parsed_Sveltekit_Config {
|
|
|
57
57
|
private_prefix: string | undefined;
|
|
58
58
|
public_prefix: string | undefined;
|
|
59
59
|
svelte_compile_options: CompileOptions;
|
|
60
|
-
svelte_compile_module_options:
|
|
60
|
+
svelte_compile_module_options: CompileOptions;
|
|
61
61
|
svelte_preprocessors: PreprocessorGroup | PreprocessorGroup[] | undefined;
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -88,8 +88,13 @@ export const init_sveltekit_config = async (
|
|
|
88
88
|
const private_prefix = kit?.env?.privatePrefix;
|
|
89
89
|
const public_prefix = kit?.env?.publicPrefix;
|
|
90
90
|
|
|
91
|
-
const svelte_compile_options = sveltekit_config?.compilerOptions ?? {};
|
|
92
|
-
|
|
91
|
+
const svelte_compile_options: CompileOptions = sveltekit_config?.compilerOptions ?? {};
|
|
92
|
+
// Change the default to `generate: 'server'`,
|
|
93
|
+
// because SvelteKit handles the client in the normal cases.
|
|
94
|
+
if (svelte_compile_options.generate === undefined) {
|
|
95
|
+
svelte_compile_options.generate = 'server';
|
|
96
|
+
}
|
|
97
|
+
const svelte_compile_module_options = to_default_compile_module_options(svelte_compile_options); // TODO will kit have these separately?
|
|
93
98
|
const svelte_preprocessors = sveltekit_config?.preprocess;
|
|
94
99
|
|
|
95
100
|
return {
|
|
@@ -108,3 +113,15 @@ export const init_sveltekit_config = async (
|
|
|
108
113
|
svelte_preprocessors,
|
|
109
114
|
};
|
|
110
115
|
};
|
|
116
|
+
|
|
117
|
+
export const to_default_compile_module_options = ({
|
|
118
|
+
dev,
|
|
119
|
+
generate,
|
|
120
|
+
filename,
|
|
121
|
+
rootDir,
|
|
122
|
+
}: CompileOptions): ModuleCompileOptions => ({dev, generate, filename, rootDir});
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The parsed SvelteKit config for the cwd, cached globally at the module level.
|
|
126
|
+
*/
|
|
127
|
+
export const default_sveltekit_config = await init_sveltekit_config(); // always load it to keep things simple ahead
|
|
@@ -2,8 +2,7 @@ import type {Result} from '@ryanatkn/belt/result.js';
|
|
|
2
2
|
import {existsSync} from 'node:fs';
|
|
3
3
|
|
|
4
4
|
import {Package_Json, load_package_json} from './package_json.js';
|
|
5
|
-
import {
|
|
6
|
-
import type {Parsed_Sveltekit_Config} from './sveltekit_config.js';
|
|
5
|
+
import {default_sveltekit_config, type Parsed_Sveltekit_Config} from './sveltekit_config.js';
|
|
7
6
|
import {SVELTEKIT_CONFIG_FILENAME, SVELTEKIT_DEV_DIRNAME} from './path_constants.js';
|
|
8
7
|
import {find_cli, spawn_cli, to_cli_name, type Cli} from './cli.js';
|
|
9
8
|
import {Task_Error} from './task.js';
|
|
@@ -17,6 +16,8 @@ export const SVELTE_PACKAGE_DEP_NAME = '@sveltejs/package';
|
|
|
17
16
|
|
|
18
17
|
export const VITE_CLI = 'vite';
|
|
19
18
|
|
|
19
|
+
export const SVELTEKIT_ENV_MATCHER = /^\$env\/(static|dynamic)\/(public|private)$/;
|
|
20
|
+
|
|
20
21
|
export const has_sveltekit_app = (): Result<object, {message: string}> => {
|
|
21
22
|
if (!existsSync(SVELTEKIT_CONFIG_FILENAME)) {
|
|
22
23
|
return {ok: false, message: `no SvelteKit config found at ${SVELTEKIT_CONFIG_FILENAME}`};
|
|
@@ -27,7 +28,7 @@ export const has_sveltekit_app = (): Result<object, {message: string}> => {
|
|
|
27
28
|
|
|
28
29
|
export const has_sveltekit_library = (
|
|
29
30
|
package_json?: Package_Json,
|
|
30
|
-
sveltekit_config: Parsed_Sveltekit_Config =
|
|
31
|
+
sveltekit_config: Parsed_Sveltekit_Config = default_sveltekit_config,
|
|
31
32
|
): Result<object, {message: string}> => {
|
|
32
33
|
const has_sveltekit_app_result = has_sveltekit_app();
|
|
33
34
|
if (!has_sveltekit_app_result.ok) {
|
package/src/lib/task_logging.ts
CHANGED
|
@@ -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' + cyan(meta.name.padEnd(longest_task_name)),
|
|
39
39
|
' ',
|
|
40
40
|
meta.mod.task.summary ?? '',
|
|
41
41
|
);
|
|
@@ -75,9 +75,9 @@ 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(
|
|
80
|
-
|
|
78
|
+
`\n${green(name.padEnd(longest_task_name))} `,
|
|
79
|
+
gray(property.schema.type.padEnd(longest_type)) + ' ',
|
|
80
|
+
print_value(property.schema.default).padEnd(longest_default) + ' ',
|
|
81
81
|
property.schema.description || '(no description available)',
|
|
82
82
|
);
|
|
83
83
|
}
|
|
@@ -115,8 +115,6 @@ const to_arg_properties = (def: ZodTypeDef, meta: Task_Module_Meta): Arg_Schema_
|
|
|
115
115
|
return properties;
|
|
116
116
|
};
|
|
117
117
|
|
|
118
|
-
// quick n dirty padding logic
|
|
119
|
-
const pad = (s: string, n: number): string => s + ' '.repeat(n - s.length);
|
|
120
118
|
const to_max_length = <T>(items: T[], toString: (item: T) => string) =>
|
|
121
119
|
items.reduce((max, m) => Math.max(toString(m).length, max), 0);
|
|
122
120
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sveltekit_config_global.d.ts","sourceRoot":"../src/lib/","sources":["sveltekit_config_global.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,uBAAuB,yDAAgC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { init_sveltekit_config } from './sveltekit_config.js';
|
|
2
|
-
/**
|
|
3
|
-
* The parsed SvelteKit config for the cwd, cached globally at the module level.
|
|
4
|
-
*/
|
|
5
|
-
export const sveltekit_config_global = await init_sveltekit_config(); // always load it to keep things simple ahead
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import {init_sveltekit_config} from './sveltekit_config.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The parsed SvelteKit config for the cwd, cached globally at the module level.
|
|
5
|
-
*/
|
|
6
|
-
export const sveltekit_config_global = await init_sveltekit_config(); // always load it to keep things simple ahead
|