@ryanatkn/gro 0.161.2 → 0.162.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 +8 -7
- package/dist/build.task.d.ts.map +1 -1
- package/dist/build.task.js +4 -2
- package/dist/check.task.d.ts +0 -1
- package/dist/check.task.d.ts.map +1 -1
- package/dist/check.task.js +8 -8
- package/dist/child_process_logging.js +1 -1
- package/dist/constants.d.ts +10 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +12 -3
- package/dist/dev.task.d.ts +0 -1
- package/dist/dev.task.d.ts.map +1 -1
- package/dist/dev.task.js +5 -7
- package/dist/disknode.d.ts +18 -0
- package/dist/disknode.d.ts.map +1 -0
- package/dist/disknode.js +1 -0
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.js +1 -2
- package/dist/filer.d.ts +6 -21
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +11 -6
- package/dist/format_directory.js +2 -2
- package/dist/gen.task.d.ts.map +1 -1
- package/dist/gen.task.js +56 -12
- package/dist/git.js +3 -3
- package/dist/gro.config.default.d.ts.map +1 -1
- package/dist/gro.config.default.js +2 -1
- package/dist/gro_config.d.ts +1 -1
- package/dist/gro_config.d.ts.map +1 -1
- package/dist/gro_config.js +5 -5
- package/dist/gro_plugin_gen.d.ts.map +1 -1
- package/dist/gro_plugin_gen.js +7 -6
- package/dist/gro_plugin_server.d.ts.map +1 -1
- package/dist/gro_plugin_server.js +16 -25
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.js +1 -2
- package/dist/gro_plugin_sveltekit_library.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_library.js +2 -1
- package/dist/invoke.js +6 -4
- package/dist/package.d.ts.map +1 -1
- package/dist/package.gen.d.ts.map +1 -1
- package/dist/package.gen.js +4 -0
- package/dist/package.js +41 -30
- package/dist/package_json.d.ts +4 -3
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +12 -10
- package/dist/parse_imports.js +2 -2
- package/dist/paths.js +2 -2
- package/dist/reinstall.task.js +1 -1
- package/dist/resolve_specifier.d.ts.map +1 -1
- package/dist/src_json.d.ts.map +1 -1
- package/dist/src_json.js +3 -1
- package/dist/svelte_config.d.ts.map +1 -1
- package/dist/svelte_config.js +2 -0
- package/dist/sveltekit_helpers.d.ts +0 -7
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_helpers.js +1 -8
- package/dist/sync.task.d.ts +0 -1
- package/dist/sync.task.d.ts.map +1 -1
- package/dist/sync.task.js +1 -2
- package/dist/task.d.ts.map +1 -1
- package/dist/test.task.d.ts +2 -3
- package/dist/test.task.d.ts.map +1 -1
- package/dist/test.task.js +31 -30
- package/dist/test_helpers.d.ts +1 -0
- package/dist/test_helpers.d.ts.map +1 -1
- package/dist/test_helpers.js +1 -0
- package/dist/typecheck.task.d.ts.map +1 -1
- package/dist/typecheck.task.js +2 -1
- package/dist/upgrade.task.d.ts.map +1 -1
- package/dist/upgrade.task.js +2 -1
- package/package.json +34 -19
- package/src/lib/build.task.ts +3 -2
- package/src/lib/check.task.ts +7 -8
- package/src/lib/child_process_logging.ts +1 -1
- package/src/lib/constants.ts +12 -3
- package/src/lib/dev.task.ts +4 -7
- package/src/lib/disknode.ts +21 -0
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +1 -2
- package/src/lib/filer.ts +23 -35
- package/src/lib/format_directory.ts +2 -2
- package/src/lib/gen.task.ts +83 -23
- package/src/lib/git.ts +3 -3
- package/src/lib/gro.config.default.ts +2 -1
- package/src/lib/gro_config.ts +11 -7
- package/src/lib/gro_plugin_gen.ts +8 -6
- package/src/lib/gro_plugin_server.ts +18 -24
- package/src/lib/gro_plugin_sveltekit_app.ts +1 -2
- package/src/lib/gro_plugin_sveltekit_library.ts +2 -5
- package/src/lib/invoke.ts +6 -4
- package/src/lib/package.gen.ts +4 -0
- package/src/lib/package.ts +41 -30
- package/src/lib/package_json.ts +11 -9
- package/src/lib/parse_imports.ts +2 -2
- package/src/lib/paths.ts +2 -2
- package/src/lib/reinstall.task.ts +1 -1
- package/src/lib/resolve_specifier.ts +2 -0
- package/src/lib/src_json.ts +3 -1
- package/src/lib/svelte_config.ts +3 -0
- package/src/lib/sveltekit_helpers.ts +7 -13
- package/src/lib/sync.task.ts +1 -2
- package/src/lib/task.ts +0 -2
- package/src/lib/test.task.ts +31 -32
- package/src/lib/test_helpers.ts +2 -0
- package/src/lib/typecheck.task.ts +2 -1
- package/src/lib/upgrade.task.ts +2 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ It includes:
|
|
|
56
56
|
- see [`fuz_template`](https://github.com/fuz-dev/fuz_template)
|
|
57
57
|
for a simple starter project example, and
|
|
58
58
|
[`@feltjs/felt`](https://github.com/feltjs/felt) for a more complex example with custom tasks
|
|
59
|
-
- [testing](/src/docs/test.md) with [`
|
|
59
|
+
- [testing](/src/docs/test.md) with [`vitest`](https://github.com/vitest-dev/vitest)
|
|
60
60
|
- codegen by convention with [`gen`](/src/docs/gen.md)
|
|
61
61
|
- linting with [ESLint](https://github.com/eslint/eslint)
|
|
62
62
|
(I also maintain [`@feltjs/eslint-config`](https://github.com/feltjs/eslint-config))
|
|
@@ -72,7 +72,7 @@ It includes:
|
|
|
72
72
|
- [publish](/src/docs/publish.md) to npm
|
|
73
73
|
- [`Task`](/src/docs/task.md) runner
|
|
74
74
|
- builtin [tasks](/src/docs/tasks.md) list
|
|
75
|
-
- [testing](/src/docs/test.md) with [`
|
|
75
|
+
- [testing](/src/docs/test.md) with [`vitest`](https://github.com/vitest-dev/vitest)
|
|
76
76
|
- [`gen`](/src/docs/gen.md) code generation
|
|
77
77
|
- [`public` package](/src/docs/package_json.md#public-packages) features (nonstandard)
|
|
78
78
|
- full [docs index](/src/docs#readme)
|
|
@@ -128,7 +128,7 @@ release publish and deploy
|
|
|
128
128
|
resolve diagnostic that logs resolved filesystem info for the given input paths
|
|
129
129
|
run execute a file with the loader, like `node` but works for TypeScript
|
|
130
130
|
sync run `gro gen`, update `package.json`, and optionally install packages to sync up
|
|
131
|
-
test run tests with
|
|
131
|
+
test run tests with vitest
|
|
132
132
|
typecheck run svelte-check or tsc on the project without emitting any files
|
|
133
133
|
upgrade upgrade deps
|
|
134
134
|
```
|
|
@@ -176,13 +176,14 @@ gro dev -- vite --port 3003 # forward args by separating sections with --
|
|
|
176
176
|
gro build # build everything for production
|
|
177
177
|
```
|
|
178
178
|
|
|
179
|
-
[Testing](/src/docs/test.md) with [`
|
|
179
|
+
[Testing](/src/docs/test.md) with [`vitest`](https://github.com/vitest-dev/vitest),
|
|
180
180
|
including shims for [SvelteKit modules](https://kit.svelte.dev/docs/modules):
|
|
181
181
|
|
|
182
182
|
```bash
|
|
183
|
-
gro test # run all tests for `*.test.ts` files with `
|
|
183
|
+
gro test # run all tests for `*.test.ts` files with `vitest`
|
|
184
184
|
gro test filepattern1 some.test another.test
|
|
185
|
-
gro test
|
|
185
|
+
gro test optional_pattern -t "optional search string for test name"
|
|
186
|
+
gro test -- vitest --forwarded_args 'to vitest'
|
|
186
187
|
```
|
|
187
188
|
|
|
188
189
|
Check all the things:
|
|
@@ -260,7 +261,7 @@ Gro builds on
|
|
|
260
261
|
[SvelteKit](https://github.com/sveltejs/kit) ∙
|
|
261
262
|
[Vite](https://github.com/vitejs/vite) ∙
|
|
262
263
|
[esbuild](https://github.com/evanw/esbuild) ∙
|
|
263
|
-
[
|
|
264
|
+
[Vitest](https://github.com/vitest-dev/vitest) ∙
|
|
264
265
|
[mri](https://github.com/lukeed/mri) ∙
|
|
265
266
|
[chokidar](https://github.com/paulmillr/chokidar) ∙
|
|
266
267
|
[zod](https://github.com/colinhacks/zod) ∙
|
package/dist/build.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/build.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,IAAI;;;;;kBAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"build.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/build.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,IAAI;;;;;kBAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAsB3B,CAAC"}
|
package/dist/build.task.js
CHANGED
|
@@ -14,9 +14,11 @@ export const task = {
|
|
|
14
14
|
summary: 'build the project',
|
|
15
15
|
Args,
|
|
16
16
|
run: async (ctx) => {
|
|
17
|
-
const { args, invoke_task } = ctx;
|
|
17
|
+
const { args, invoke_task, log } = ctx;
|
|
18
18
|
const { sync, install } = args;
|
|
19
|
-
if (sync) {
|
|
19
|
+
if (sync || install) {
|
|
20
|
+
if (!sync)
|
|
21
|
+
log.warn('sync is false but install is true, so ignoring the sync option');
|
|
20
22
|
await invoke_task('sync', { install });
|
|
21
23
|
}
|
|
22
24
|
// TODO possibly detect if the git workspace is clean, and ask for confirmation if not,
|
package/dist/check.task.d.ts
CHANGED
|
@@ -16,7 +16,6 @@ export declare const Args: z.ZodObject<{
|
|
|
16
16
|
sync: z.ZodDefault<z.ZodBoolean>;
|
|
17
17
|
'no-sync': z.ZodDefault<z.ZodBoolean>;
|
|
18
18
|
install: z.ZodDefault<z.ZodBoolean>;
|
|
19
|
-
'no-install': z.ZodDefault<z.ZodBoolean>;
|
|
20
19
|
workspace: z.ZodDefault<z.ZodBoolean>;
|
|
21
20
|
}, z.core.$strict>;
|
|
22
21
|
export type Args = z.infer<typeof Args>;
|
package/dist/check.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/check.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAIhD,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"check.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/check.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAIhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;kBAuBf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA4D3B,CAAC"}
|
package/dist/check.task.js
CHANGED
|
@@ -22,11 +22,7 @@ export const Args = z.strictObject({
|
|
|
22
22
|
'no-lint': z.boolean().meta({ description: 'opt out of linting' }).default(false),
|
|
23
23
|
sync: z.boolean().meta({ description: 'dual of no-sync' }).default(true),
|
|
24
24
|
'no-sync': z.boolean().meta({ description: 'opt out of syncing' }).default(false),
|
|
25
|
-
install: z.boolean().meta({ description: '
|
|
26
|
-
'no-install': z
|
|
27
|
-
.boolean()
|
|
28
|
-
.meta({ description: 'opt out of installing packages when syncing' })
|
|
29
|
-
.default(false), // convenience, same as `gro check -- gro sync --no-install` but the latter takes precedence
|
|
25
|
+
install: z.boolean().meta({ description: 'opt into installing packages' }).default(false),
|
|
30
26
|
workspace: z
|
|
31
27
|
.boolean()
|
|
32
28
|
.meta({ description: 'ensure a clean git workspace, useful for CI, also implies --no-sync' })
|
|
@@ -39,8 +35,12 @@ export const task = {
|
|
|
39
35
|
const { typecheck, test, gen, format, package_json, lint, sync, install, workspace } = args;
|
|
40
36
|
// When checking the workspace, which was added for CI, never sync.
|
|
41
37
|
// Setup like installing packages and `sveltekit-sync` should be done in the CI setup.
|
|
42
|
-
if (
|
|
43
|
-
|
|
38
|
+
if (!workspace) {
|
|
39
|
+
if (sync || install) {
|
|
40
|
+
if (!sync)
|
|
41
|
+
log.warn('sync is false but install is true, so ignoring the sync option');
|
|
42
|
+
await invoke_task('sync', { install, gen: false }); // never generate because `gro gen --check` runs below
|
|
43
|
+
}
|
|
44
44
|
}
|
|
45
45
|
if (typecheck) {
|
|
46
46
|
await invoke_task('typecheck');
|
|
@@ -52,7 +52,7 @@ export const task = {
|
|
|
52
52
|
await invoke_task('gen', { check: true });
|
|
53
53
|
}
|
|
54
54
|
if (package_json && config.map_package_json) {
|
|
55
|
-
const { changed } = await sync_package_json(config.map_package_json, log,
|
|
55
|
+
const { changed } = await sync_package_json(config.map_package_json, log, false);
|
|
56
56
|
if (changed) {
|
|
57
57
|
throw new Task_Error('package.json is out of date, run `gro sync` to update it');
|
|
58
58
|
}
|
|
@@ -18,7 +18,7 @@ export const map_child_process_output = (child_process, transform) => {
|
|
|
18
18
|
* Configures process output handling with path replacements while preserving ANSI colors.
|
|
19
19
|
*/
|
|
20
20
|
export const configure_colored_output_with_path_replacement = (child_process, replacement = '.', cwd = process.cwd()) => {
|
|
21
|
-
// Escape special characters in the cwd for
|
|
21
|
+
// Escape special characters in the cwd for regexp safety
|
|
22
22
|
const cwd_escaped = strip_end(cwd, '/').replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
23
23
|
const cwd_reg_exp = new RegExp(cwd_escaped, 'g');
|
|
24
24
|
// Use the generic mapper with a path replacement transform
|
package/dist/constants.d.ts
CHANGED
|
@@ -9,11 +9,12 @@ export declare const SOURCE_DIR: string;
|
|
|
9
9
|
export declare const GRO_DIR: string;
|
|
10
10
|
/** @trailing_slash */
|
|
11
11
|
export declare const GRO_DEV_DIR: string;
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const GRO_CONFIG_FILENAME = "gro.config.ts";
|
|
13
13
|
export declare const README_FILENAME = "README.md";
|
|
14
14
|
export declare const SVELTE_CONFIG_FILENAME = "svelte.config.js";
|
|
15
15
|
export declare const VITE_CONFIG_FILENAME = "vite.config.ts";
|
|
16
16
|
export declare const NODE_MODULES_DIRNAME = "node_modules";
|
|
17
|
+
export declare const PACKAGE_JSON_FILENAME = "package.json";
|
|
17
18
|
export declare const LOCKFILE_FILENAME = "package-lock.json";
|
|
18
19
|
export declare const SVELTEKIT_DEV_DIRNAME = ".svelte-kit";
|
|
19
20
|
export declare const SVELTEKIT_BUILD_DIRNAME = "build";
|
|
@@ -29,8 +30,16 @@ export declare const SVELTE_MATCHER: RegExp;
|
|
|
29
30
|
export declare const SVELTE_RUNES_MATCHER: RegExp;
|
|
30
31
|
/** Extracts the script content from Svelte files. */
|
|
31
32
|
export declare const SVELTE_SCRIPT_MATCHER: RegExp;
|
|
33
|
+
export declare const SVELTEKIT_ENV_MATCHER: RegExp;
|
|
34
|
+
export declare const SVELTEKIT_GLOBAL_SPECIFIER: RegExp;
|
|
32
35
|
export declare const EVERYTHING_MATCHER: RegExp;
|
|
33
36
|
export declare const JS_CLI_DEFAULT = "node";
|
|
34
37
|
export declare const PM_CLI_DEFAULT = "npm";
|
|
35
38
|
export declare const PRETTIER_CLI_DEFAULT = "prettier";
|
|
39
|
+
export declare const SVELTEKIT_CLI = "svelte-kit";
|
|
40
|
+
export declare const SVELTE_CHECK_CLI = "svelte-check";
|
|
41
|
+
export declare const SVELTE_PACKAGE_CLI = "svelte-package";
|
|
42
|
+
export declare const SVELTE_PACKAGE_DEP_NAME = "@sveltejs/package";
|
|
43
|
+
export declare const VITE_CLI = "vite";
|
|
44
|
+
export declare const VITEST_CLI = "vitest";
|
|
36
45
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAC9C,eAAO,MAAM,eAAe,QAAuB,CAAC;AACpD,sBAAsB;AACtB,eAAO,MAAM,UAAU,QAAuB,CAAC;AAC/C,sBAAsB;AACtB,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,sBAAsB;AACtB,eAAO,MAAM,WAAW,QAAwB,CAAC;AACjD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAC9C,eAAO,MAAM,eAAe,QAAuB,CAAC;AACpD,sBAAsB;AACtB,eAAO,MAAM,UAAU,QAAuB,CAAC;AAC/C,sBAAsB;AACtB,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,sBAAsB;AACtB,eAAO,MAAM,WAAW,QAAwB,CAAC;AACjD,eAAO,MAAM,mBAAmB,kBAAkB,CAAC;AACnD,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,eAA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17
17
|
/** @trailing_slash */
|
|
18
18
|
export const GRO_DEV_DIR = GRO_DEV_DIRNAME + '/';
|
|
19
|
-
export const
|
|
19
|
+
export const GRO_CONFIG_FILENAME = 'gro.config.ts';
|
|
20
20
|
export const README_FILENAME = 'README.md';
|
|
21
21
|
export const SVELTE_CONFIG_FILENAME = 'svelte.config.js';
|
|
22
22
|
export const VITE_CONFIG_FILENAME = 'vite.config.ts';
|
|
23
23
|
export const NODE_MODULES_DIRNAME = 'node_modules';
|
|
24
|
+
export const PACKAGE_JSON_FILENAME = 'package.json';
|
|
24
25
|
export const LOCKFILE_FILENAME = 'package-lock.json';
|
|
25
26
|
export const SVELTEKIT_DEV_DIRNAME = '.svelte-kit'; // TODO use Svelte config value `outDir`
|
|
26
27
|
export const SVELTEKIT_BUILD_DIRNAME = 'build';
|
|
@@ -29,14 +30,22 @@ export const SVELTEKIT_VITE_CACHE_PATH = NODE_MODULES_DIRNAME + '/.vite';
|
|
|
29
30
|
export const GITHUB_DIRNAME = '.github';
|
|
30
31
|
export const GIT_DIRNAME = '.git';
|
|
31
32
|
export const TSCONFIG_FILENAME = 'tsconfig.json';
|
|
32
|
-
export const TS_MATCHER = /\.(ts|
|
|
33
|
-
export const JS_MATCHER = /\.(js|
|
|
33
|
+
export const TS_MATCHER = /\.(ts|mts|cts)$/;
|
|
34
|
+
export const JS_MATCHER = /\.(js|mjs|cjs)$/;
|
|
34
35
|
export const JSON_MATCHER = /\.json$/;
|
|
35
36
|
export const SVELTE_MATCHER = /\.svelte$/;
|
|
36
37
|
export const SVELTE_RUNES_MATCHER = /\.svelte\.(js|ts)$/; // TODO probably let `.svelte.` appear anywhere - https://github.com/sveltejs/svelte/issues/11536
|
|
37
38
|
/** Extracts the script content from Svelte files. */
|
|
38
39
|
export const SVELTE_SCRIPT_MATCHER = /<script(?:\s+[^>]*)?>([\s\S]*?)<\/script>/gim; // TODO maybe this shouldnt be global? or make a getter?
|
|
40
|
+
export const SVELTEKIT_ENV_MATCHER = /^\$env\/(static|dynamic)\/(public|private)$/;
|
|
41
|
+
export const SVELTEKIT_GLOBAL_SPECIFIER = /^\$(env|app)\//;
|
|
39
42
|
export const EVERYTHING_MATCHER = /.*/;
|
|
40
43
|
export const JS_CLI_DEFAULT = 'node';
|
|
41
44
|
export const PM_CLI_DEFAULT = 'npm';
|
|
42
45
|
export const PRETTIER_CLI_DEFAULT = 'prettier';
|
|
46
|
+
export const SVELTEKIT_CLI = 'svelte-kit';
|
|
47
|
+
export const SVELTE_CHECK_CLI = 'svelte-check';
|
|
48
|
+
export const SVELTE_PACKAGE_CLI = 'svelte-package';
|
|
49
|
+
export const SVELTE_PACKAGE_DEP_NAME = '@sveltejs/package';
|
|
50
|
+
export const VITE_CLI = 'vite';
|
|
51
|
+
export const VITEST_CLI = 'vitest';
|
package/dist/dev.task.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export declare const Args: z.ZodObject<{
|
|
|
7
7
|
sync: z.ZodDefault<z.ZodBoolean>;
|
|
8
8
|
'no-sync': z.ZodDefault<z.ZodBoolean>;
|
|
9
9
|
install: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
'no-install': z.ZodDefault<z.ZodBoolean>;
|
|
11
10
|
}, z.core.$strict>;
|
|
12
11
|
export type Args = z.infer<typeof Args>;
|
|
13
12
|
export type DevTask_Context = Plugin_Context<Args>;
|
package/dist/dev.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dev.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAAU,KAAK,cAAc,EAAC,MAAM,aAAa,CAAC;AAGzD,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"dev.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/dev.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAAU,KAAK,cAAc,EAAC,MAAM,aAAa,CAAC;AAGzD,eAAO,MAAM,IAAI;;;;;;kBAWf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAEnD,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAoB3B,CAAC"}
|
package/dist/dev.task.js
CHANGED
|
@@ -11,20 +11,18 @@ export const Args = z.strictObject({
|
|
|
11
11
|
.default(false),
|
|
12
12
|
sync: z.boolean().meta({ description: 'dual of no-sync' }).default(true),
|
|
13
13
|
'no-sync': z.boolean().meta({ description: 'opt out of gro sync' }).default(false),
|
|
14
|
-
install: z.boolean().meta({ description: '
|
|
15
|
-
'no-install': z // convenience, same as `gro dev -- gro sync --no-install` but the latter takes precedence
|
|
16
|
-
.boolean()
|
|
17
|
-
.meta({ description: 'opt out of installing packages before starting the dev server' })
|
|
18
|
-
.default(false),
|
|
14
|
+
install: z.boolean().meta({ description: 'opt into installing packages' }).default(false),
|
|
19
15
|
});
|
|
20
16
|
export const task = {
|
|
21
17
|
summary: 'start SvelteKit and other dev plugins',
|
|
22
18
|
Args,
|
|
23
19
|
run: async (ctx) => {
|
|
24
|
-
const { args, invoke_task } = ctx;
|
|
20
|
+
const { args, invoke_task, log } = ctx;
|
|
25
21
|
const { watch, sync, install } = args;
|
|
26
22
|
await clean_fs({ build_dev: true });
|
|
27
|
-
if (sync) {
|
|
23
|
+
if (sync || install) {
|
|
24
|
+
if (!sync)
|
|
25
|
+
log.warn('sync is false but install is true, so ignoring the sync option');
|
|
28
26
|
await invoke_task('sync', { install });
|
|
29
27
|
}
|
|
30
28
|
const plugins = await Plugins.create({ ...ctx, dev: true, watch });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Path_Id } from './path.ts';
|
|
2
|
+
export interface Disknode {
|
|
3
|
+
id: Path_Id;
|
|
4
|
+
/**
|
|
5
|
+
* `null` contents means it doesn't exist.
|
|
6
|
+
* We create the file in memory to track its dependents regardless of its existence on disk.
|
|
7
|
+
*/
|
|
8
|
+
contents: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Is the source file outside of the `root_dir` or excluded by `watch_dir_options.filter`?
|
|
11
|
+
*/
|
|
12
|
+
external: boolean;
|
|
13
|
+
ctime: number | null;
|
|
14
|
+
mtime: number | null;
|
|
15
|
+
dependents: Map<Path_Id, Disknode>;
|
|
16
|
+
dependencies: Map<Path_Id, Disknode>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=disknode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disknode.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/disknode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAIvC,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,OAAO,CAAC;IAEZ;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACnC,YAAY,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;CACrC"}
|
package/dist/disknode.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_plugin_sveltekit_shim_env.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/esbuild_plugin_sveltekit_shim_env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"esbuild_plugin_sveltekit_shim_env.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/esbuild_plugin_sveltekit_shim_env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAKxC,MAAM,WAAW,yCAAyC;IACzD,GAAG,EAAE,OAAO,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAID,eAAO,MAAM,iCAAiC,GAAI,0EAO/C,yCAAyC,KAAG,OAAO,CAAC,MAuBrD,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { render_env_shim_module } from "./sveltekit_shim_env.js";
|
|
2
|
-
import { EVERYTHING_MATCHER } from "./constants.js";
|
|
3
|
-
import { SVELTEKIT_ENV_MATCHER } from "./sveltekit_helpers.js";
|
|
2
|
+
import { SVELTEKIT_ENV_MATCHER, EVERYTHING_MATCHER } from "./constants.js";
|
|
4
3
|
const namespace = 'sveltekit_shim_env';
|
|
5
4
|
export const esbuild_plugin_sveltekit_shim_env = ({ dev, public_prefix, private_prefix, env_dir, env_files, ambient_env, }) => ({
|
|
6
5
|
name: 'sveltekit_shim_env',
|
package/dist/filer.d.ts
CHANGED
|
@@ -3,24 +3,9 @@ import type { Logger } from '@ryanatkn/belt/log.js';
|
|
|
3
3
|
import type { Package_Json } from '@ryanatkn/belt/package_json.js';
|
|
4
4
|
import type { File_Filter, Path_Id } from './path.ts';
|
|
5
5
|
import { watch_dir, type Watcher_Change, type Watch_Dir_Options } from './watch_dir.ts';
|
|
6
|
-
|
|
7
|
-
id: Path_Id;
|
|
8
|
-
/**
|
|
9
|
-
* `null` contents means it doesn't exist.
|
|
10
|
-
* We create the file in memory to track its dependents regardless of its existence on disk.
|
|
11
|
-
*/
|
|
12
|
-
contents: string | null;
|
|
13
|
-
/**
|
|
14
|
-
* Is the source file outside of the `root_dir` or excluded by `watch_dir_options.filter`?
|
|
15
|
-
*/
|
|
16
|
-
external: boolean;
|
|
17
|
-
ctime: number | null;
|
|
18
|
-
mtime: number | null;
|
|
19
|
-
dependents: Map<Path_Id, Source_File>;
|
|
20
|
-
dependencies: Map<Path_Id, Source_File>;
|
|
21
|
-
}
|
|
6
|
+
import type { Disknode } from './disknode.ts';
|
|
22
7
|
export type Cleanup_Watch = () => Promise<void>;
|
|
23
|
-
export type On_Filer_Change = (change: Watcher_Change, source_file:
|
|
8
|
+
export type On_Filer_Change = (change: Watcher_Change, source_file: Disknode) => void;
|
|
24
9
|
export interface Filer_Options {
|
|
25
10
|
watch_dir?: typeof watch_dir;
|
|
26
11
|
watch_dir_options?: Partial<Omit_Strict<Watch_Dir_Options, 'on_change'>>;
|
|
@@ -30,12 +15,12 @@ export interface Filer_Options {
|
|
|
30
15
|
export declare class Filer {
|
|
31
16
|
#private;
|
|
32
17
|
readonly root_dir: Path_Id;
|
|
33
|
-
readonly files: Map<Path_Id,
|
|
18
|
+
readonly files: Map<Path_Id, Disknode>;
|
|
34
19
|
constructor(options?: Filer_Options);
|
|
35
|
-
get_by_id: (id: Path_Id) =>
|
|
36
|
-
get_or_create: (id: Path_Id) =>
|
|
20
|
+
get_by_id: (id: Path_Id) => Disknode | undefined;
|
|
21
|
+
get_or_create: (id: Path_Id) => Disknode;
|
|
37
22
|
watch(listener: On_Filer_Change): Promise<Cleanup_Watch>;
|
|
38
23
|
close(): Promise<void>;
|
|
39
24
|
}
|
|
40
|
-
export declare const filter_dependents: (source_file:
|
|
25
|
+
export declare const filter_dependents: (source_file: Disknode, get_by_id: (id: Path_Id) => Disknode | undefined, filter?: File_Filter, results?: Set<string>, searched?: Set<string>, log?: Logger) => Set<string>;
|
|
41
26
|
//# sourceMappingURL=filer.d.ts.map
|
package/dist/filer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/filer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAKzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAEjE,OAAO,KAAK,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EACN,SAAS,EAET,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEtB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/filer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAKzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,gCAAgC,CAAC;AAEjE,OAAO,KAAK,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EACN,SAAS,EAET,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEtB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAI5C,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,KAAK,IAAI,CAAC;AAEtF,MAAM,WAAW,aAAa;IAC7B,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC,CAAC;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAClD,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,qBAAa,KAAK;;IACjB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAa;gBAOvC,OAAO,GAAE,aAA4B;IAgBjD,SAAS,GAAI,IAAI,OAAO,KAAG,QAAQ,GAAG,SAAS,CAE7C;IAEF,aAAa,GAAI,IAAI,OAAO,KAAG,QAAQ,CAkBrC;IA4II,KAAK,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAKxD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAa5B;AAGD,eAAO,MAAM,iBAAiB,GAC7B,aAAa,QAAQ,EACrB,WAAW,CAAC,EAAE,EAAE,OAAO,KAAK,QAAQ,GAAG,SAAS,EAChD,SAAS,WAAW,EACpB,UAAS,GAAG,CAAC,MAAM,CAAa,EAChC,WAAU,GAAG,CAAC,MAAM,CAAa,EACjC,MAAM,MAAM,KACV,GAAG,CAAC,MAAM,CAkBZ,CAAC"}
|
package/dist/filer.js
CHANGED
|
@@ -10,7 +10,8 @@ import { paths } from "./paths.js";
|
|
|
10
10
|
import { parse_imports } from "./parse_imports.js";
|
|
11
11
|
import { resolve_specifier } from "./resolve_specifier.js";
|
|
12
12
|
import { default_svelte_config } from "./svelte_config.js";
|
|
13
|
-
import { map_sveltekit_aliases
|
|
13
|
+
import { map_sveltekit_aliases } from "./sveltekit_helpers.js";
|
|
14
|
+
import { SVELTEKIT_GLOBAL_SPECIFIER } from "./constants.js";
|
|
14
15
|
const aliases = Object.entries(default_svelte_config.alias);
|
|
15
16
|
export class Filer {
|
|
16
17
|
root_dir;
|
|
@@ -22,6 +23,10 @@ export class Filer {
|
|
|
22
23
|
this.#watch_dir = options.watch_dir ?? watch_dir;
|
|
23
24
|
this.#watch_dir_options = options.watch_dir_options ?? EMPTY_OBJECT;
|
|
24
25
|
this.root_dir = resolve(options.watch_dir_options?.dir ?? paths.source);
|
|
26
|
+
// TODO for package.json maybe another array of files/dirs to watch to invalidate everything?
|
|
27
|
+
// or instead of that, think of taking an array of config objects that can specify invalidation rules,
|
|
28
|
+
// so package.json would be configured differently than ./src, and we could add a default with
|
|
29
|
+
// package.json/gro.config.ts/tsconfig.json/svelte.config.js/vite.config.ts to invalidate everything
|
|
25
30
|
this.#log = options.log;
|
|
26
31
|
}
|
|
27
32
|
#watching;
|
|
@@ -55,7 +60,7 @@ export class Filer {
|
|
|
55
60
|
const stats = existsSync(id) ? statSync(id) : null;
|
|
56
61
|
file.ctime = stats?.ctimeMs ?? null;
|
|
57
62
|
file.mtime = stats?.mtimeMs ?? null;
|
|
58
|
-
const new_contents = stats ? readFileSync(id, 'utf8') : null; // TODO need to lazily load contents, probably turn `
|
|
63
|
+
const new_contents = stats ? readFileSync(id, 'utf8') : null; // TODO need to lazily load contents, probably turn `Disknode` into a class
|
|
59
64
|
if (file.contents === new_contents) {
|
|
60
65
|
return null;
|
|
61
66
|
}
|
|
@@ -118,7 +123,7 @@ export class Filer {
|
|
|
118
123
|
this.files.delete(id);
|
|
119
124
|
return file;
|
|
120
125
|
}
|
|
121
|
-
#
|
|
126
|
+
#sync_listener_with_files(listener) {
|
|
122
127
|
if (!this.#ready)
|
|
123
128
|
return;
|
|
124
129
|
for (const source_file of this.files.values()) {
|
|
@@ -138,7 +143,7 @@ export class Filer {
|
|
|
138
143
|
// if already watching, call the listener for all existing files after init
|
|
139
144
|
await this.#watching.init();
|
|
140
145
|
await wait(); // wait a tick to ensure the `this.#ready` value is updated below first
|
|
141
|
-
this.#
|
|
146
|
+
this.#sync_listener_with_files(listener);
|
|
142
147
|
return;
|
|
143
148
|
}
|
|
144
149
|
this.#watching = this.#watch_dir({
|
|
@@ -148,7 +153,7 @@ export class Filer {
|
|
|
148
153
|
});
|
|
149
154
|
await this.#watching.init();
|
|
150
155
|
this.#ready = true;
|
|
151
|
-
this.#
|
|
156
|
+
this.#sync_listener_with_files(listener);
|
|
152
157
|
}
|
|
153
158
|
async #remove_listener(listener) {
|
|
154
159
|
this.#listeners.delete(listener);
|
|
@@ -194,7 +199,7 @@ export class Filer {
|
|
|
194
199
|
return !id.startsWith(this.root_dir + '/') || (!!filter && !filter(id, false));
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
|
-
// TODO maybe `
|
|
202
|
+
// TODO maybe `Disknode` class?
|
|
198
203
|
export const filter_dependents = (source_file, get_by_id, filter, results = new Set(), searched = new Set(), log) => {
|
|
199
204
|
const { dependents } = source_file;
|
|
200
205
|
for (const dependent_id of dependents.keys()) {
|
package/dist/format_directory.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { paths } from "./paths.js";
|
|
2
|
-
import { GITHUB_DIRNAME, README_FILENAME, SVELTE_CONFIG_FILENAME, VITE_CONFIG_FILENAME, TSCONFIG_FILENAME,
|
|
2
|
+
import { GITHUB_DIRNAME, README_FILENAME, SVELTE_CONFIG_FILENAME, VITE_CONFIG_FILENAME, TSCONFIG_FILENAME, GRO_CONFIG_FILENAME, PM_CLI_DEFAULT, PRETTIER_CLI_DEFAULT, } from "./constants.js";
|
|
3
3
|
import { serialize_args, to_forwarded_args } from "./args.js";
|
|
4
4
|
import { spawn_cli, to_cli_name } from "./cli.js";
|
|
5
5
|
const EXTENSIONS_DEFAULT = 'ts,js,json,svelte,html,css,md,yml';
|
|
6
6
|
const ROOT_PATHS_DEFAULT = `${[
|
|
7
7
|
README_FILENAME,
|
|
8
|
-
|
|
8
|
+
GRO_CONFIG_FILENAME,
|
|
9
9
|
SVELTE_CONFIG_FILENAME,
|
|
10
10
|
VITE_CONFIG_FILENAME,
|
|
11
11
|
TSCONFIG_FILENAME,
|
package/dist/gen.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gen.task.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"gen.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gen.task.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAgBhD,eAAO,MAAM,IAAI;;;;kBAaf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAIxC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA+F3B,CAAC"}
|
package/dist/gen.task.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Raw_Input_Path, to_input_paths } from "./input_path.js";
|
|
|
8
8
|
import { format_file } from "./format_file.js";
|
|
9
9
|
import { print_path } from "./paths.js";
|
|
10
10
|
import { log_error_reasons } from "./task_logging.js";
|
|
11
|
-
import { write_gen_results, analyze_gen_results, find_genfiles, load_genfiles } from "./gen.js";
|
|
11
|
+
import { write_gen_results, analyze_gen_results, find_genfiles, load_genfiles, } from "./gen.js";
|
|
12
12
|
import { SOURCE_DIRNAME } from "./constants.js";
|
|
13
13
|
export const Args = z.strictObject({
|
|
14
14
|
_: z
|
|
@@ -87,19 +87,14 @@ export const task = {
|
|
|
87
87
|
await write_gen_results(gen_results, analyzed_gen_results, log);
|
|
88
88
|
timing_to_output_results();
|
|
89
89
|
}
|
|
90
|
-
//
|
|
90
|
+
// collect and format output with summary
|
|
91
|
+
const output_lines = collect_output_lines(gen_results, analyzed_gen_results);
|
|
91
92
|
const new_count = analyzed_gen_results.filter((r) => r.is_new).length;
|
|
92
|
-
const changed_count = analyzed_gen_results.filter((r) => r.has_changed).length;
|
|
93
|
+
const changed_count = analyzed_gen_results.filter((r) => r.has_changed && !r.is_new).length;
|
|
93
94
|
const unchanged_count = analyzed_gen_results.filter((r) => !r.is_new && !r.has_changed).length;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
log_result += `\n\t${unchanged_count} ` + st('gray', 'unchanged');
|
|
98
|
-
for (const result of gen_results.results) {
|
|
99
|
-
log_result += `\n\t${result.ok ? st('green', '✓') : st('red', '🞩')} ${result.ok ? result.files.length : 0} ${st('gray', 'in')} ${print_ms(result.elapsed)} ${st('gray', '←')} ${print_path(result.id)} ${st('gray', '→')} ${result.ok ? result.files.map((f) => print_path(f.id)).join(', ') : print_error(result.error)}`;
|
|
100
|
-
}
|
|
101
|
-
log.info(log_result);
|
|
102
|
-
log.info(st('green', `generated ${gen_results.output_count} file${plural(gen_results.output_count)} from ${gen_results.successes.length} input file${plural(gen_results.successes.length)}`));
|
|
95
|
+
const error_count = gen_results.failures.length;
|
|
96
|
+
log.info(format_gen_output(output_lines) +
|
|
97
|
+
`\n\n\t${new_count} ${st(new_count > 0 ? 'green' : 'gray', 'new')}, ${changed_count} ${st(changed_count > 0 ? 'cyan' : 'gray', 'changed')}, ${unchanged_count} ${st('gray', 'unchanged')}${error_count ? `, ${error_count} ${st('red', 'error' + plural(error_count))}` : ''} from ${gen_results.input_count} input file${plural(gen_results.input_count)}`);
|
|
103
98
|
if (fail_count) {
|
|
104
99
|
for (const result of gen_results.failures) {
|
|
105
100
|
log.error(result.reason, '\n', print_error(result.error));
|
|
@@ -108,3 +103,52 @@ export const task = {
|
|
|
108
103
|
}
|
|
109
104
|
},
|
|
110
105
|
};
|
|
106
|
+
const format_gen_status = (analyzed) => {
|
|
107
|
+
if (!analyzed)
|
|
108
|
+
return { symbol: '?', color: 'gray', text: 'unknown' };
|
|
109
|
+
if (analyzed.is_new)
|
|
110
|
+
return { symbol: '●', color: 'green', text: 'new' };
|
|
111
|
+
if (analyzed.has_changed)
|
|
112
|
+
return { symbol: '◐', color: 'cyan', text: 'changed' };
|
|
113
|
+
return { symbol: '○', color: 'gray', text: 'unchanged' };
|
|
114
|
+
};
|
|
115
|
+
const collect_output_lines = (gen_results, analyzed_gen_results) => {
|
|
116
|
+
const output_lines = [];
|
|
117
|
+
for (const result of gen_results.results) {
|
|
118
|
+
if (result.ok) {
|
|
119
|
+
for (const file of result.files) {
|
|
120
|
+
const analyzed = analyzed_gen_results.find((a) => a.file.id === file.id);
|
|
121
|
+
output_lines.push({
|
|
122
|
+
status: format_gen_status(analyzed),
|
|
123
|
+
elapsed: print_ms(result.elapsed),
|
|
124
|
+
source: print_path(result.id),
|
|
125
|
+
target: print_path(file.id),
|
|
126
|
+
is_error: false,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
output_lines.push({
|
|
132
|
+
status: { symbol: '🞩', color: 'red', text: 'error' },
|
|
133
|
+
elapsed: print_ms(result.elapsed),
|
|
134
|
+
source: print_path(result.id),
|
|
135
|
+
target: st('red', result.error.stack || result.error.message || 'error'),
|
|
136
|
+
is_error: true,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return output_lines;
|
|
141
|
+
};
|
|
142
|
+
const format_gen_output = (output_lines) => {
|
|
143
|
+
// calculate column widths for alignment
|
|
144
|
+
const max_elapsed_length = Math.max(...output_lines.map((l) => l.elapsed.length));
|
|
145
|
+
const max_source_length = Math.max(...output_lines.map((l) => l.source.length));
|
|
146
|
+
// format the output lines
|
|
147
|
+
let log_result = 'gen results:';
|
|
148
|
+
for (const line of output_lines) {
|
|
149
|
+
const elapsed_text = line.elapsed.padStart(max_elapsed_length);
|
|
150
|
+
const source_text = line.source.padEnd(max_source_length);
|
|
151
|
+
log_result += `\n\t${st(line.status.color, line.status.symbol)} ${elapsed_text} ${source_text} → ${line.target}`;
|
|
152
|
+
}
|
|
153
|
+
return log_result;
|
|
154
|
+
};
|
package/dist/git.js
CHANGED
|
@@ -12,7 +12,7 @@ export const git_current_branch_name = async (options) => {
|
|
|
12
12
|
const { stdout } = await spawn_out('git', ['rev-parse', '--abbrev-ref', 'HEAD'], options);
|
|
13
13
|
if (!stdout)
|
|
14
14
|
throw Error('git_current_branch_name failed');
|
|
15
|
-
const branch_name = stdout.
|
|
15
|
+
const branch_name = stdout.trim();
|
|
16
16
|
return branch_name;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
@@ -186,7 +186,7 @@ export const git_current_commit_hash = async (branch, options) => {
|
|
|
186
186
|
const { stdout } = await spawn_out('git', ['show-ref', '-s', final_branch], options);
|
|
187
187
|
if (!stdout)
|
|
188
188
|
return null; // TODO hack for CI
|
|
189
|
-
return stdout.
|
|
189
|
+
return stdout.split('\n')[0].trim();
|
|
190
190
|
};
|
|
191
191
|
/**
|
|
192
192
|
* Returns the hash of the current branch's first commit or throws if something goes wrong.
|
|
@@ -195,7 +195,7 @@ export const git_current_branch_first_commit_hash = async (options) => {
|
|
|
195
195
|
const { stdout } = await spawn_out('git', ['rev-list', '--max-parents=0', '--abbrev-commit', 'HEAD'], options);
|
|
196
196
|
if (!stdout)
|
|
197
197
|
throw Error('git_current_branch_first_commit_hash failed');
|
|
198
|
-
return stdout.
|
|
198
|
+
return stdout.trim();
|
|
199
199
|
};
|
|
200
200
|
/**
|
|
201
201
|
* Returns the global git config setting for `pull.rebase`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gro.config.default.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro.config.default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAWvD;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"gro.config.default.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro.config.default.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAWvD;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,iBAmCb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -34,7 +34,8 @@ const config = async (cfg, svelte_config) => {
|
|
|
34
34
|
]);
|
|
35
35
|
const local_moss_plugin_path = find_first_existing_file([
|
|
36
36
|
'./src/lib/gro_plugin_moss.ts',
|
|
37
|
-
'./src/
|
|
37
|
+
'./src/gro_plugin_moss.ts',
|
|
38
|
+
'./src/routes/gro_plugin_moss.ts', // TODO probably remove this
|
|
38
39
|
]);
|
|
39
40
|
// put things that generate files before SvelteKit so it can see them
|
|
40
41
|
cfg.plugins = async () => [
|
package/dist/gro_config.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export declare const EXPORTS_EXCLUDER_DEFAULT: RegExp;
|
|
|
66
66
|
* Transforms a `Raw_Gro_Config` to the more strict `Gro_Config`.
|
|
67
67
|
* This allows users to provide a more relaxed config.
|
|
68
68
|
*/
|
|
69
|
-
export declare const
|
|
69
|
+
export declare const cook_gro_config: (raw_config: Raw_Gro_Config) => Gro_Config;
|
|
70
70
|
export interface Gro_Config_Module {
|
|
71
71
|
readonly default: Raw_Gro_Config | Create_Gro_Config;
|
|
72
72
|
}
|
package/dist/gro_config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gro_config.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro_config.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAC,WAAW,EAAE,OAA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