@ryanatkn/gro 0.179.0 → 0.181.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 +1 -1
- package/dist/build.task.d.ts +2 -0
- package/dist/build.task.d.ts.map +1 -1
- package/dist/build.task.js +15 -11
- package/dist/build_cache.d.ts +4 -4
- package/dist/build_cache.d.ts.map +1 -1
- package/dist/build_cache.js +54 -44
- package/dist/changelog.d.ts +2 -2
- package/dist/changelog.d.ts.map +1 -1
- package/dist/changeset.task.js +11 -11
- package/dist/check.task.js +2 -2
- package/dist/child_process_logging.js +1 -1
- package/dist/clean.task.js +2 -2
- package/dist/clean_fs.d.ts +1 -1
- package/dist/clean_fs.d.ts.map +1 -1
- package/dist/clean_fs.js +3 -4
- package/dist/cli.d.ts +7 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -12
- package/dist/commit.task.js +2 -2
- package/dist/deploy.task.d.ts +7 -0
- package/dist/deploy.task.d.ts.map +1 -1
- package/dist/deploy.task.js +30 -17
- package/dist/disknode.d.ts +1 -1
- package/dist/disknode.d.ts.map +1 -1
- package/dist/esbuild_helpers.d.ts +1 -1
- package/dist/esbuild_helpers.d.ts.map +1 -1
- package/dist/esbuild_plugin_external_worker.d.ts +1 -1
- package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
- package/dist/esbuild_plugin_external_worker.js +1 -1
- package/dist/esbuild_plugin_svelte.js +4 -4
- package/dist/esbuild_plugin_sveltekit_local_imports.js +2 -2
- package/dist/esbuild_plugin_sveltekit_shim_alias.js +1 -1
- package/dist/filer.d.ts +4 -4
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +105 -54
- package/dist/format.task.js +1 -1
- package/dist/format_directory.d.ts +2 -2
- package/dist/format_directory.d.ts.map +1 -1
- package/dist/format_file.js +1 -1
- package/dist/gen.d.ts +5 -5
- package/dist/gen.d.ts.map +1 -1
- package/dist/gen.js +28 -22
- package/dist/gen.task.js +3 -3
- package/dist/gen_helpers.d.ts +3 -3
- package/dist/gen_helpers.d.ts.map +1 -1
- package/dist/github.d.ts +2 -2
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +1 -1
- package/dist/gro.config.default.js +1 -1
- package/dist/gro_config.d.ts +1 -1
- package/dist/gro_config.d.ts.map +1 -1
- package/dist/gro_config.js +4 -4
- package/dist/gro_helpers.d.ts +1 -1
- package/dist/gro_helpers.d.ts.map +1 -1
- package/dist/gro_helpers.js +1 -1
- package/dist/gro_plugin_gen.js +4 -4
- package/dist/gro_plugin_server.d.ts +2 -2
- package/dist/gro_plugin_server.d.ts.map +1 -1
- package/dist/gro_plugin_server.js +7 -7
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.js +40 -36
- package/dist/gro_plugin_sveltekit_library.js +3 -2
- package/dist/input_path.d.ts +5 -5
- package/dist/input_path.d.ts.map +1 -1
- package/dist/input_path.js +17 -15
- package/dist/invoke.js +2 -2
- package/dist/invoke_task.d.ts +2 -2
- package/dist/invoke_task.d.ts.map +1 -1
- package/dist/invoke_task.js +5 -5
- package/dist/lint.task.js +2 -2
- package/dist/loader.js +2 -2
- package/dist/modules.d.ts +3 -3
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +4 -4
- package/dist/package_json.d.ts +6 -6
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +14 -16
- package/dist/parse_exports.d.ts +4 -4
- package/dist/parse_exports.d.ts.map +1 -1
- package/dist/parse_exports_context.d.ts +1 -1
- package/dist/parse_exports_context.d.ts.map +1 -1
- package/dist/parse_imports.d.ts +2 -2
- package/dist/parse_imports.d.ts.map +1 -1
- package/dist/parse_imports.js +1 -1
- package/dist/paths.d.ts +1 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +1 -1
- package/dist/publish.task.js +8 -8
- package/dist/reinstall.task.js +1 -1
- package/dist/release.task.js +1 -1
- package/dist/resolve.task.js +2 -2
- package/dist/resolve_specifier.d.ts +2 -2
- package/dist/resolve_specifier.d.ts.map +1 -1
- package/dist/resolve_specifier.js +5 -4
- package/dist/run.task.js +2 -2
- package/dist/run_gen.d.ts +2 -2
- package/dist/run_gen.d.ts.map +1 -1
- package/dist/run_gen.js +10 -9
- package/dist/run_task.d.ts +2 -2
- package/dist/run_task.d.ts.map +1 -1
- package/dist/run_task.js +4 -4
- package/dist/source_json.d.ts +5 -5
- package/dist/source_json.d.ts.map +1 -1
- package/dist/source_json.js +18 -17
- package/dist/svelte_config.js +1 -1
- package/dist/sveltekit_helpers.d.ts +3 -3
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_helpers.js +4 -4
- package/dist/sveltekit_shim_app_forms.js +1 -1
- package/dist/sveltekit_shim_app_navigation.js +1 -1
- package/dist/sveltekit_shim_app_paths.js +1 -1
- package/dist/sveltekit_shim_env.js +1 -1
- package/dist/sync.task.js +1 -1
- package/dist/task.d.ts +5 -5
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +5 -5
- package/dist/task_logging.d.ts +1 -1
- package/dist/task_logging.d.ts.map +1 -1
- package/dist/task_logging.js +2 -2
- package/dist/test.task.d.ts.map +1 -1
- package/dist/test.task.js +5 -4
- package/dist/typecheck.task.js +4 -4
- package/dist/upgrade.task.js +6 -6
- package/dist/watch_dir.d.ts +1 -1
- package/dist/watch_dir.d.ts.map +1 -1
- package/dist/watch_dir.js +2 -2
- package/package.json +8 -8
- package/src/lib/build.task.ts +16 -11
- package/src/lib/build_cache.ts +81 -65
- package/src/lib/changelog.ts +2 -2
- package/src/lib/changeset.task.ts +12 -12
- package/src/lib/check.task.ts +2 -2
- package/src/lib/child_process_logging.ts +1 -1
- package/src/lib/clean.task.ts +2 -2
- package/src/lib/clean_fs.ts +4 -4
- package/src/lib/cli.ts +18 -17
- package/src/lib/commit.task.ts +2 -2
- package/src/lib/deploy.task.ts +33 -16
- package/src/lib/disknode.ts +1 -1
- package/src/lib/esbuild_helpers.ts +1 -1
- package/src/lib/esbuild_plugin_external_worker.ts +3 -3
- package/src/lib/esbuild_plugin_svelte.ts +4 -4
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +2 -2
- package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +1 -1
- package/src/lib/filer.ts +117 -58
- package/src/lib/format.task.ts +1 -1
- package/src/lib/format_directory.ts +2 -2
- package/src/lib/format_file.ts +1 -1
- package/src/lib/gen.task.ts +3 -3
- package/src/lib/gen.ts +56 -50
- package/src/lib/gen_helpers.ts +3 -3
- package/src/lib/github.ts +2 -2
- package/src/lib/gro.config.default.ts +1 -1
- package/src/lib/gro_config.ts +5 -5
- package/src/lib/gro_helpers.ts +1 -1
- package/src/lib/gro_plugin_gen.ts +4 -4
- package/src/lib/gro_plugin_server.ts +9 -9
- package/src/lib/gro_plugin_sveltekit_app.ts +44 -40
- package/src/lib/gro_plugin_sveltekit_library.ts +3 -3
- package/src/lib/input_path.ts +23 -24
- package/src/lib/invoke.ts +2 -2
- package/src/lib/invoke_task.ts +5 -5
- package/src/lib/lint.task.ts +2 -2
- package/src/lib/loader.ts +2 -2
- package/src/lib/modules.ts +7 -7
- package/src/lib/package_json.ts +19 -23
- package/src/lib/parse_exports.ts +4 -4
- package/src/lib/parse_exports_context.ts +2 -2
- package/src/lib/parse_imports.ts +3 -3
- package/src/lib/paths.ts +2 -2
- package/src/lib/publish.task.ts +8 -8
- package/src/lib/reinstall.task.ts +1 -1
- package/src/lib/release.task.ts +1 -1
- package/src/lib/resolve.task.ts +2 -2
- package/src/lib/resolve_specifier.ts +9 -5
- package/src/lib/run.task.ts +2 -2
- package/src/lib/run_gen.ts +18 -13
- package/src/lib/run_task.ts +6 -6
- package/src/lib/source_json.ts +26 -22
- package/src/lib/svelte_config.ts +1 -1
- package/src/lib/sveltekit_helpers.ts +7 -7
- package/src/lib/sveltekit_shim_app_forms.ts +1 -1
- package/src/lib/sveltekit_shim_app_navigation.ts +1 -1
- package/src/lib/sveltekit_shim_app_paths.ts +1 -1
- package/src/lib/sync.task.ts +1 -1
- package/src/lib/task.ts +16 -14
- package/src/lib/task_logging.ts +3 -3
- package/src/lib/test.task.ts +4 -3
- package/src/lib/typecheck.task.ts +4 -4
- package/src/lib/upgrade.task.ts +6 -6
- package/src/lib/watch_dir.ts +3 -3
- package/dist/search_fs.d.ts +0 -26
- package/dist/search_fs.d.ts.map +0 -1
- package/dist/search_fs.js +0 -52
- package/src/lib/search_fs.ts +0 -100
package/dist/deploy.task.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { spawn } from '@
|
|
2
|
-
import { print_error } from '@
|
|
1
|
+
import { spawn } from '@fuzdev/fuz_util/process.js';
|
|
2
|
+
import { print_error } from '@fuzdev/fuz_util/print.js';
|
|
3
3
|
import { styleText as st } from 'node:util';
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { cp, mkdir, rm } from 'node:fs/promises';
|
|
5
|
+
import { cp, mkdir, readdir, rm } from 'node:fs/promises';
|
|
6
6
|
import { join, resolve } from 'node:path';
|
|
7
|
-
import {
|
|
8
|
-
import { git_check_clean_workspace, git_checkout, git_local_branch_exists, git_remote_branch_exists, GitOrigin, GitBranch, git_delete_local_branch, git_push_to_create, git_reset_branch_to_first_commit, git_pull, git_fetch, git_check_setting_pull_rebase, git_clone_locally, git_current_branch_name, } from '@
|
|
9
|
-
import { fs_empty_dir } from '@ryanatkn/belt/fs.js';
|
|
7
|
+
import { fs_exists, fs_empty_dir } from '@fuzdev/fuz_util/fs.js';
|
|
8
|
+
import { git_check_clean_workspace, git_checkout, git_local_branch_exists, git_remote_branch_exists, GitOrigin, GitBranch, git_delete_local_branch, git_push_to_create, git_reset_branch_to_first_commit, git_pull, git_fetch, git_check_setting_pull_rebase, git_clone_locally, git_current_branch_name, } from '@fuzdev/fuz_util/git.js';
|
|
10
9
|
import { TaskError } from "./task.js";
|
|
11
10
|
import { print_path } from "./paths.js";
|
|
12
11
|
import { GRO_DIRNAME, GIT_DIRNAME, SVELTEKIT_BUILD_DIRNAME } from "./constants.js";
|
|
@@ -52,6 +51,19 @@ export const Args = z.strictObject({
|
|
|
52
51
|
.default(false),
|
|
53
52
|
build: z.boolean().meta({ description: 'dual of no-build' }).default(true),
|
|
54
53
|
'no-build': z.boolean().meta({ description: 'opt out of building' }).default(false),
|
|
54
|
+
sync: z.boolean().meta({ description: 'dual of no-sync' }).default(true),
|
|
55
|
+
'no-sync': z.boolean().meta({ description: 'opt out of gro sync in build' }).default(false),
|
|
56
|
+
gen: z.boolean().meta({ description: 'dual of no-gen' }).default(true),
|
|
57
|
+
'no-gen': z.boolean().meta({ description: 'opt out of gro gen in build' }).default(false),
|
|
58
|
+
install: z.boolean().meta({ description: 'dual of no-install' }).default(true),
|
|
59
|
+
'no-install': z
|
|
60
|
+
.boolean()
|
|
61
|
+
.meta({ description: 'opt out of installing packages before building' })
|
|
62
|
+
.default(false),
|
|
63
|
+
force_build: z
|
|
64
|
+
.boolean()
|
|
65
|
+
.meta({ description: 'force a fresh build, ignoring the cache' })
|
|
66
|
+
.default(false),
|
|
55
67
|
pull: z.boolean().meta({ description: 'dual of no-pull' }).default(true),
|
|
56
68
|
'no-pull': z.boolean().meta({ description: 'opt out of git pull' }).default(false),
|
|
57
69
|
});
|
|
@@ -60,7 +72,7 @@ export const task = {
|
|
|
60
72
|
summary: 'deploy to a branch',
|
|
61
73
|
Args,
|
|
62
74
|
run: async ({ args, log, invoke_task }) => {
|
|
63
|
-
const { source, target, origin, build_dir, deploy_dir, dry, force, dangerous, reset, build, pull, } = args;
|
|
75
|
+
const { source, target, origin, build_dir, deploy_dir, dry, force, dangerous, reset, build, sync, gen, install, force_build, pull, } = args;
|
|
64
76
|
// Checks
|
|
65
77
|
if (!force && target !== TARGET_BRANCH) {
|
|
66
78
|
throw new TaskError(`Warning! You are deploying to a custom target branch '${target}',` +
|
|
@@ -105,7 +117,7 @@ export const task = {
|
|
|
105
117
|
// First, check if the deploy dir exists, and if so, attempt to sync it.
|
|
106
118
|
// If anything goes wrong, delete the directory and we'll initialize it
|
|
107
119
|
// using the same code path as if it didn't exist in the first place.
|
|
108
|
-
if (
|
|
120
|
+
if (await fs_exists(resolved_deploy_dir)) {
|
|
109
121
|
if (target !== (await git_current_branch_name(target_spawn_options))) {
|
|
110
122
|
// We're in a bad state because the target branch has changed,
|
|
111
123
|
// so delete the directory and continue as if it wasn't there.
|
|
@@ -126,7 +138,7 @@ export const task = {
|
|
|
126
138
|
}
|
|
127
139
|
// Second, initialize the deploy dir if needed.
|
|
128
140
|
// It may not exist, or it may have been deleted after failing to sync above.
|
|
129
|
-
if (!
|
|
141
|
+
if (!(await fs_exists(resolved_deploy_dir))) {
|
|
130
142
|
const local_deploy_branch_exists = await git_local_branch_exists(target);
|
|
131
143
|
await git_fetch(origin, ('+' + target + ':' + target)); // fetch+merge and allow non-fastforward updates with the +
|
|
132
144
|
await git_clone_locally(origin, target, dir, resolved_deploy_dir);
|
|
@@ -143,7 +155,7 @@ export const task = {
|
|
|
143
155
|
else {
|
|
144
156
|
// Remote target branch does not exist, so start from scratch
|
|
145
157
|
// Delete the deploy dir and recreate it
|
|
146
|
-
if (
|
|
158
|
+
if (await fs_exists(resolved_deploy_dir)) {
|
|
147
159
|
await rm(resolved_deploy_dir, { recursive: true });
|
|
148
160
|
await mkdir(resolved_deploy_dir, { recursive: true });
|
|
149
161
|
}
|
|
@@ -168,22 +180,23 @@ export const task = {
|
|
|
168
180
|
// Build
|
|
169
181
|
try {
|
|
170
182
|
if (build) {
|
|
171
|
-
await invoke_task('build');
|
|
183
|
+
await invoke_task('build', { sync, gen, install, force_build });
|
|
172
184
|
}
|
|
173
185
|
}
|
|
174
|
-
catch (
|
|
175
|
-
log.error(st('red', 'build failed'), 'but', st('green', 'no changes were made to git'), print_error(
|
|
186
|
+
catch (error) {
|
|
187
|
+
log.error(st('red', 'build failed'), 'but', st('green', 'no changes were made to git'), print_error(error));
|
|
176
188
|
if (dry) {
|
|
177
189
|
log.info(st('red', 'dry deploy failed'));
|
|
178
190
|
}
|
|
179
191
|
throw new TaskError(`Deploy safely canceled due to build failure. See the error above.`);
|
|
180
192
|
}
|
|
181
193
|
// Verify build output exists
|
|
182
|
-
if (!
|
|
194
|
+
if (!(await fs_exists(build_dir))) {
|
|
183
195
|
throw new TaskError(`Directory to deploy does not exist after building: ${build_dir}`);
|
|
184
196
|
}
|
|
185
197
|
// Copy the build
|
|
186
|
-
|
|
198
|
+
const build_entries = await readdir(build_dir);
|
|
199
|
+
await Promise.all(build_entries.map((path) => cp(join(build_dir, path), join(resolved_deploy_dir, path), { recursive: true })));
|
|
187
200
|
// At this point, `dist/` is ready to be committed and deployed!
|
|
188
201
|
if (dry) {
|
|
189
202
|
log.info(st('green', 'dry deploy complete:'), 'files at', print_path(resolved_deploy_dir));
|
|
@@ -195,8 +208,8 @@ export const task = {
|
|
|
195
208
|
await spawn('git', ['commit', '-m', 'deployment'], target_spawn_options);
|
|
196
209
|
await spawn('git', ['push', origin, target, '-f'], target_spawn_options); // force push because we may be resetting the branch, see the checks above to make this safer
|
|
197
210
|
}
|
|
198
|
-
catch (
|
|
199
|
-
log.error(st('red', 'updating git failed:'), print_error(
|
|
211
|
+
catch (error) {
|
|
212
|
+
log.error(st('red', 'updating git failed:'), print_error(error));
|
|
200
213
|
throw new TaskError(`Deploy failed in a bad state: built but not pushed, see error above.`);
|
|
201
214
|
}
|
|
202
215
|
log.info(st('green', 'deployed')); // TODO log a different message if "Everything up-to-date"
|
package/dist/disknode.d.ts
CHANGED
package/dist/disknode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disknode.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/disknode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"disknode.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/disknode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAIrD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX;;;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,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACpC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Logger } from '@
|
|
1
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
2
2
|
import type * as esbuild from 'esbuild';
|
|
3
3
|
import type { ParsedSvelteConfig } from './svelte_config.ts';
|
|
4
4
|
export declare const print_build_result: (log: Logger, build_result: esbuild.BuildResult) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/esbuild_helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"esbuild_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/esbuild_helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAE3D,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,cAAc,OAAO,CAAC,WAAW,KAAG,IAOnF,CAAC;AAMF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GACrC,KAAK,OAAO,EACZ,UAAU,kBAAkB,CAAC,UAAU,CAAC,EACxC,aAAU,EACV,aAAyC,KACvC,MAAM,CAAC,MAAM,EAAE,MAAM,CAQtB,CAAC;AAEH,eAAO,MAAM,4BAA4B,EAAE,OAAO,CAAC,gBAKlD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as esbuild from 'esbuild';
|
|
2
|
-
import type { Logger } from '@
|
|
2
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
3
3
|
import type { CompileOptions, ModuleCompileOptions, PreprocessorGroup } from 'svelte/compiler';
|
|
4
4
|
import type { ParsedSvelteConfig } from './svelte_config.ts';
|
|
5
5
|
export interface EsbuildPluginExternalWorkerOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild_plugin_external_worker.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/esbuild_plugin_external_worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"esbuild_plugin_external_worker.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/esbuild_plugin_external_worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAC,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAU7F,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,kCAAkC;IAClD,GAAG,EAAE,OAAO,CAAC;IACb,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sBAAsB,CAAC,EAAE,cAAc,CAAC;IACxC,6BAA6B,CAAC,EAAE,oBAAoB,CAAC;IACrD,oBAAoB,CAAC,EAAE,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC9C,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;IACrC,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,8BAA8B,GAAI,6MAgB5C,kCAAkC,KAAG,OAAO,CAAC,MA4C9C,CAAC"}
|
|
@@ -44,7 +44,7 @@ export const esbuild_plugin_external_worker = ({ dev, build_options, dir = proce
|
|
|
44
44
|
return building;
|
|
45
45
|
};
|
|
46
46
|
build.onResolve({ filter: /\.worker(|\.js|\.ts)$/ }, async ({ path, resolveDir }) => {
|
|
47
|
-
const parsed = resolve_specifier(path, resolveDir);
|
|
47
|
+
const parsed = await resolve_specifier(path, resolveDir);
|
|
48
48
|
const { specifier, path_id, namespace } = parsed;
|
|
49
49
|
const build_result = await build_worker(path_id);
|
|
50
50
|
if (log)
|
|
@@ -35,8 +35,8 @@ export const esbuild_plugin_svelte = (options) => {
|
|
|
35
35
|
warnings: warnings.map((w) => convert_svelte_message_to_esbuild(filename, source, w)),
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
-
catch (
|
|
39
|
-
return { errors: [convert_svelte_message_to_esbuild(path, source,
|
|
38
|
+
catch (error) {
|
|
39
|
+
return { errors: [convert_svelte_message_to_esbuild(path, source, error)] };
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
build.onLoad({ filter: SVELTE_MATCHER }, async ({ path }) => {
|
|
@@ -55,8 +55,8 @@ export const esbuild_plugin_svelte = (options) => {
|
|
|
55
55
|
warnings: warnings.map((w) => convert_svelte_message_to_esbuild(filename, source, w)),
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
catch (
|
|
59
|
-
return { errors: [convert_svelte_message_to_esbuild(path, source,
|
|
58
|
+
catch (error) {
|
|
59
|
+
return { errors: [convert_svelte_message_to_esbuild(path, source, error)] };
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
},
|
|
@@ -10,11 +10,11 @@ import { EVERYTHING_MATCHER } from "./constants.js";
|
|
|
10
10
|
export const esbuild_plugin_sveltekit_local_imports = () => ({
|
|
11
11
|
name: 'sveltekit_local_imports',
|
|
12
12
|
setup: (build) => {
|
|
13
|
-
build.onResolve({ filter: /^(\/|\.)/ }, (args) => {
|
|
13
|
+
build.onResolve({ filter: /^(\/|\.)/ }, async (args) => {
|
|
14
14
|
const { path, importer } = args;
|
|
15
15
|
if (!importer)
|
|
16
16
|
return { path };
|
|
17
|
-
const { path_id, namespace } = resolve_specifier(path, dirname(importer));
|
|
17
|
+
const { path_id, namespace } = await resolve_specifier(path, dirname(importer));
|
|
18
18
|
return { path: path_id, namespace }; // `namespace` may be `undefined`, but esbuild needs the absolute path for json etc
|
|
19
19
|
});
|
|
20
20
|
build.onLoad({ filter: EVERYTHING_MATCHER, namespace: 'sveltekit_local_imports_ts' }, async ({ path }) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { escape_regexp } from '@
|
|
1
|
+
import { escape_regexp } from '@fuzdev/fuz_util/regexp.js';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
export const esbuild_plugin_sveltekit_shim_alias = ({ dir = process.cwd(), alias, }) => ({
|
|
4
4
|
name: 'sveltekit_shim_alias',
|
package/dist/filer.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { OmitStrict } from '@
|
|
2
|
-
import type { Logger } from '@
|
|
3
|
-
import type { PackageJson } from '@
|
|
4
|
-
import type { FileFilter, PathId } from '@
|
|
1
|
+
import type { OmitStrict } from '@fuzdev/fuz_util/types.js';
|
|
2
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
3
|
+
import type { PackageJson } from '@fuzdev/fuz_util/package_json.js';
|
|
4
|
+
import type { FileFilter, PathId } from '@fuzdev/fuz_util/path.js';
|
|
5
5
|
import { watch_dir, type WatcherChange, type WatchDirOptions } from './watch_dir.ts';
|
|
6
6
|
import type { Disknode } from './disknode.ts';
|
|
7
7
|
export type OnFilerChange = (change: WatcherChange, disknode: Disknode) => void;
|
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,UAAU,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/filer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAI1D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EACN,SAAS,EAET,KAAK,aAAa,EAClB,KAAK,eAAe,EAEpB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAI5C,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;AAEhF,MAAM,WAAW,YAAY;IAC5B,SAAS,CAAC,EAAE,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.js';
|
|
2
|
+
import { readFile, stat } from 'node:fs/promises';
|
|
3
3
|
import { dirname, resolve } from 'node:path';
|
|
4
4
|
import { isBuiltin } from 'node:module';
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
-
import { UnreachableError } from '@
|
|
6
|
+
import { UnreachableError } from '@fuzdev/fuz_util/error.js';
|
|
7
7
|
import { watch_dir, } from "./watch_dir.js";
|
|
8
8
|
import { paths } from "./paths.js";
|
|
9
9
|
import { parse_imports } from "./parse_imports.js";
|
|
@@ -23,6 +23,8 @@ export class Filer {
|
|
|
23
23
|
#watching;
|
|
24
24
|
#initing;
|
|
25
25
|
#closing;
|
|
26
|
+
#change_queue = [];
|
|
27
|
+
#processing_promise = null;
|
|
26
28
|
constructor(options = EMPTY_OBJECT) {
|
|
27
29
|
this.#watch_dir = options.watch_dir ?? watch_dir;
|
|
28
30
|
this.#watch_dir_options = options.watch_dir_options ?? EMPTY_OBJECT;
|
|
@@ -53,9 +55,11 @@ export class Filer {
|
|
|
53
55
|
dependencies: new Map(),
|
|
54
56
|
};
|
|
55
57
|
this.files.set(id, file);
|
|
56
|
-
//
|
|
58
|
+
// Defer external file change notification to avoid reentrancy during queue processing
|
|
57
59
|
if (file.external) {
|
|
58
|
-
|
|
60
|
+
queueMicrotask(() => {
|
|
61
|
+
this.#on_change({ type: 'add', path: file.id, is_directory: false });
|
|
62
|
+
});
|
|
59
63
|
}
|
|
60
64
|
return file;
|
|
61
65
|
};
|
|
@@ -86,10 +90,10 @@ export class Filer {
|
|
|
86
90
|
try {
|
|
87
91
|
await this.#initing;
|
|
88
92
|
}
|
|
89
|
-
catch (
|
|
93
|
+
catch (error) {
|
|
90
94
|
// use shared cleanup logic
|
|
91
95
|
this.#cleanup();
|
|
92
|
-
throw
|
|
96
|
+
throw error;
|
|
93
97
|
}
|
|
94
98
|
finally {
|
|
95
99
|
this.#initing = undefined;
|
|
@@ -103,6 +107,8 @@ export class Filer {
|
|
|
103
107
|
});
|
|
104
108
|
try {
|
|
105
109
|
await watcher.init();
|
|
110
|
+
// Wait for any queued changes from init to be processed
|
|
111
|
+
await this.#drain_queue();
|
|
106
112
|
// check if close() was called during init
|
|
107
113
|
if (this.#closing) {
|
|
108
114
|
await watcher.close();
|
|
@@ -111,7 +117,7 @@ export class Filer {
|
|
|
111
117
|
// only set after successful init and not closing
|
|
112
118
|
this.#watching = watcher;
|
|
113
119
|
}
|
|
114
|
-
catch (
|
|
120
|
+
catch (error) {
|
|
115
121
|
// clean up watcher on error, but don't let close error mask init error
|
|
116
122
|
try {
|
|
117
123
|
await watcher.close();
|
|
@@ -119,7 +125,7 @@ export class Filer {
|
|
|
119
125
|
catch {
|
|
120
126
|
// ignore close errors - init error is more important
|
|
121
127
|
}
|
|
122
|
-
throw
|
|
128
|
+
throw error;
|
|
123
129
|
}
|
|
124
130
|
}
|
|
125
131
|
async watch(listener) {
|
|
@@ -135,6 +141,8 @@ export class Filer {
|
|
|
135
141
|
this.#listeners.clear();
|
|
136
142
|
this.files.clear();
|
|
137
143
|
this.#watching = undefined;
|
|
144
|
+
this.#change_queue = [];
|
|
145
|
+
this.#processing_promise = null;
|
|
138
146
|
// #initing is handled in finally block of init()
|
|
139
147
|
}
|
|
140
148
|
close() {
|
|
@@ -173,19 +181,22 @@ export class Filer {
|
|
|
173
181
|
// clean up all state
|
|
174
182
|
this.#cleanup();
|
|
175
183
|
}
|
|
176
|
-
#update(id) {
|
|
184
|
+
async #update(id) {
|
|
177
185
|
const file = this.get_or_create(id);
|
|
178
186
|
let stats = null;
|
|
179
187
|
let new_contents = null; // TODO need to lazily load contents, probably turn `Disknode` into a class
|
|
180
188
|
try {
|
|
181
|
-
stats =
|
|
182
|
-
new_contents = readFileSync(id, 'utf8');
|
|
189
|
+
[stats, new_contents] = await Promise.all([stat(id), readFile(id, 'utf8')]);
|
|
183
190
|
}
|
|
184
|
-
catch (
|
|
185
|
-
|
|
186
|
-
|
|
191
|
+
catch (error) {
|
|
192
|
+
const code = error.code;
|
|
193
|
+
// Treat file as deleted/inaccessible for common error codes
|
|
194
|
+
if (code === 'ENOENT' || code === 'EACCES' || code === 'EPERM') {
|
|
195
|
+
// File doesn't exist or is inaccessible, treat as deleted
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
throw error;
|
|
187
199
|
}
|
|
188
|
-
// ENOENT: file doesn't exist, treat as deleted
|
|
189
200
|
}
|
|
190
201
|
const old_mtime = file.mtime;
|
|
191
202
|
file.ctime = stats?.ctimeMs ?? null;
|
|
@@ -197,7 +208,15 @@ export class Filer {
|
|
|
197
208
|
const dir = dirname(file.id);
|
|
198
209
|
const dependencies_before = new Set(file.dependencies.keys());
|
|
199
210
|
const dependencies_removed = new Set(dependencies_before);
|
|
200
|
-
|
|
211
|
+
let imported = [];
|
|
212
|
+
if (file.contents) {
|
|
213
|
+
try {
|
|
214
|
+
imported = parse_imports(file.id, file.contents);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
this.#log?.error('[filer] Failed to parse imports', file.id, error);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
201
220
|
for (const specifier of imported) {
|
|
202
221
|
if (SVELTEKIT_GLOBAL_SPECIFIER.test(specifier))
|
|
203
222
|
continue;
|
|
@@ -205,7 +224,7 @@ export class Filer {
|
|
|
205
224
|
let path_id;
|
|
206
225
|
// TODO can we replace `resolve_specifier` with `import.meta.resolve` completely now outside of esbuild plugins?
|
|
207
226
|
if (path[0] === '.' || path[0] === '/') {
|
|
208
|
-
const resolved = resolve_specifier(path, dir);
|
|
227
|
+
const resolved = await resolve_specifier(path, dir); // eslint-disable-line no-await-in-loop
|
|
209
228
|
path_id = resolved.path_id;
|
|
210
229
|
}
|
|
211
230
|
else {
|
|
@@ -253,8 +272,8 @@ export class Filer {
|
|
|
253
272
|
try {
|
|
254
273
|
listener({ type: 'add', path: disknode.id, is_directory: false }, disknode);
|
|
255
274
|
}
|
|
256
|
-
catch (
|
|
257
|
-
this.#log?.error('[filer] Listener error during sync:',
|
|
275
|
+
catch (error) {
|
|
276
|
+
this.#log?.error('[filer] Listener error during sync:', error);
|
|
258
277
|
}
|
|
259
278
|
}
|
|
260
279
|
}
|
|
@@ -263,8 +282,8 @@ export class Filer {
|
|
|
263
282
|
try {
|
|
264
283
|
listener(change, disknode);
|
|
265
284
|
}
|
|
266
|
-
catch (
|
|
267
|
-
this.#log?.error('[filer] Listener error during change notification:',
|
|
285
|
+
catch (error) {
|
|
286
|
+
this.#log?.error('[filer] Listener error during change notification:', error);
|
|
268
287
|
}
|
|
269
288
|
}
|
|
270
289
|
}
|
|
@@ -279,28 +298,56 @@ export class Filer {
|
|
|
279
298
|
this.#listeners.delete(listener);
|
|
280
299
|
// keep watching active even with no listeners, only close() tears down
|
|
281
300
|
}
|
|
282
|
-
#
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
301
|
+
async #drain_queue() {
|
|
302
|
+
// Wait for queue to be empty and no active processing
|
|
303
|
+
while (this.#change_queue.length > 0 || this.#processing_promise) {
|
|
304
|
+
await this.#process_queue(); // eslint-disable-line no-await-in-loop
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
async #process_queue() {
|
|
308
|
+
// If already processing, return the existing promise
|
|
309
|
+
if (this.#processing_promise)
|
|
310
|
+
return this.#processing_promise;
|
|
311
|
+
// Create and track the processing promise
|
|
312
|
+
this.#processing_promise = this.#do_process_queue();
|
|
313
|
+
try {
|
|
314
|
+
await this.#processing_promise;
|
|
315
|
+
}
|
|
316
|
+
finally {
|
|
317
|
+
this.#processing_promise = null;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
async #do_process_queue() {
|
|
321
|
+
while (this.#change_queue.length > 0) {
|
|
322
|
+
const change = this.#change_queue.shift();
|
|
323
|
+
if (this.#closing)
|
|
324
|
+
continue; // ignore changes during close
|
|
325
|
+
if (change.is_directory)
|
|
326
|
+
continue; // TODO manage directories?
|
|
327
|
+
let disknode;
|
|
328
|
+
switch (change.type) {
|
|
329
|
+
case 'add':
|
|
330
|
+
case 'update': {
|
|
331
|
+
disknode = await this.#update(change.path); // eslint-disable-line no-await-in-loop
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
case 'delete': {
|
|
335
|
+
disknode = this.#remove(change.path);
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
default:
|
|
339
|
+
throw new UnreachableError(change.type);
|
|
293
340
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
break;
|
|
341
|
+
if (disknode && this.#listeners.size > 0) {
|
|
342
|
+
this.#notify_change(change, disknode);
|
|
297
343
|
}
|
|
298
|
-
default:
|
|
299
|
-
throw new UnreachableError(change.type);
|
|
300
|
-
}
|
|
301
|
-
if (disknode && this.#listeners.size > 0) {
|
|
302
|
-
this.#notify_change(change, disknode);
|
|
303
344
|
}
|
|
345
|
+
}
|
|
346
|
+
#on_change = (change) => {
|
|
347
|
+
// Enqueue the change (sync callback from chokidar)
|
|
348
|
+
this.#change_queue.push(change);
|
|
349
|
+
// Start processing if not already running
|
|
350
|
+
void this.#process_queue();
|
|
304
351
|
};
|
|
305
352
|
#is_external(id) {
|
|
306
353
|
const { filter } = this.#watch_dir_options;
|
|
@@ -309,20 +356,24 @@ export class Filer {
|
|
|
309
356
|
}
|
|
310
357
|
// TODO maybe `Disknode` class?
|
|
311
358
|
export const filter_dependents = (disknode, get_by_id, filter, results = new Set(), searched = new Set(), log) => {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
359
|
+
// Use iterative approach to avoid stack overflow on deep dependency trees
|
|
360
|
+
const stack = [disknode];
|
|
361
|
+
while (stack.length > 0) {
|
|
362
|
+
const current = stack.pop();
|
|
363
|
+
for (const dependent_id of current.dependents.keys()) {
|
|
364
|
+
if (searched.has(dependent_id))
|
|
365
|
+
continue;
|
|
366
|
+
searched.add(dependent_id);
|
|
367
|
+
if (!filter || filter(dependent_id)) {
|
|
368
|
+
results.add(dependent_id);
|
|
369
|
+
}
|
|
370
|
+
const dependent_disknode = get_by_id(dependent_id);
|
|
371
|
+
if (!dependent_disknode) {
|
|
372
|
+
log?.warn(`[filer.filter_dependents] dependent source file ${dependent_id} not found for ${current.id}`);
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
stack.push(dependent_disknode);
|
|
324
376
|
}
|
|
325
|
-
filter_dependents(dependent_disknode, get_by_id, filter, results, searched);
|
|
326
377
|
}
|
|
327
378
|
return results;
|
|
328
379
|
};
|
package/dist/format.task.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SpawnResult } from '@
|
|
2
|
-
import type { Logger } from '@
|
|
1
|
+
import type { SpawnResult } from '@fuzdev/fuz_util/process.js';
|
|
2
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
3
3
|
import { type Cli } from './cli.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Formats a directory on the filesystem.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format_directory.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/format_directory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"format_directory.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/format_directory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAcpD,OAAO,EAAyB,KAAK,GAAG,EAAC,MAAM,UAAU,CAAC;AAY1D;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC5B,KAAK,MAAM,EACX,KAAK,MAAM,EACX,eAAa,EACb,mBAA+B,EAC/B,mBAA+B,EAC/B,eAAc,MAAM,GAAG,GAA0B,EACjD,SAAQ,MAAuB,KAC7B,OAAO,CAAC,WAAW,CAcrB,CAAC"}
|
package/dist/format_file.js
CHANGED
|
@@ -11,7 +11,7 @@ let cached_base_options;
|
|
|
11
11
|
export const format_file = async (content, options, base_options = cached_base_options) => {
|
|
12
12
|
const final_base_options = base_options !== undefined
|
|
13
13
|
? base_options
|
|
14
|
-
: (cached_base_options = load_package_json().prettier);
|
|
14
|
+
: (cached_base_options = (await load_package_json()).prettier);
|
|
15
15
|
let final_options = options;
|
|
16
16
|
if (options.filepath && !options.parser) {
|
|
17
17
|
const { filepath, ...rest } = options;
|
package/dist/gen.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Logger } from '@
|
|
2
|
-
import type { Result } from '@
|
|
3
|
-
import type { Timings } from '@
|
|
4
|
-
import type { PathId } from '@
|
|
1
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
2
|
+
import type { Result } from '@fuzdev/fuz_util/result.js';
|
|
3
|
+
import type { Timings } from '@fuzdev/fuz_util/timings.js';
|
|
4
|
+
import type { PathId } from '@fuzdev/fuz_util/path.js';
|
|
5
5
|
import type { GroConfig } from './gro_config.ts';
|
|
6
6
|
import type { ParsedSvelteConfig } from './svelte_config.ts';
|
|
7
7
|
import { type LoadModulesFailure, type ModuleMeta } from './modules.ts';
|
|
@@ -123,7 +123,7 @@ export type FindGenfilesFailure = {
|
|
|
123
123
|
/**
|
|
124
124
|
* Finds modules from input paths. (see `src/lib/input_path.ts` for more)
|
|
125
125
|
*/
|
|
126
|
-
export declare const find_genfiles: (input_paths: Array<InputPath>, root_dirs: Array<PathId>, config: GroConfig, timings?: Timings) => FindGenfilesResult
|
|
126
|
+
export declare const find_genfiles: (input_paths: Array<InputPath>, root_dirs: Array<PathId>, config: GroConfig, timings?: Timings) => Promise<FindGenfilesResult>;
|
|
127
127
|
export interface GenfileModule {
|
|
128
128
|
gen: Gen;
|
|
129
129
|
}
|
package/dist/gen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAKrD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAe,KAAK,kBAAkB,EAAE,KAAK,UAAU,EAAC,MAAM,cAAc,CAAC;AACpF,OAAO,EACN,SAAS,EAGT,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAE1C,eAAO,MAAM,qBAAqB,QAAQ,CAAC;AAC3C,eAAO,MAAM,gBAAgB,QAAoC,CAAC;AAElE,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,OAA0C,CAAC;AAEtF,MAAM,WAAW,SAAS;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;CACtB;AACD,MAAM,WAAW,OAAO;IACvB,EAA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