@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/input_path.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { stat } from 'node:fs/promises';
|
|
3
|
+
import { fs_exists, fs_search } from '@fuzdev/fuz_util/fs.js';
|
|
4
|
+
import { strip_start } from '@fuzdev/fuz_util/string.js';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
import { GRO_PACKAGE_DIR, GRO_DIST_DIR } from "./paths.js";
|
|
6
|
-
import { search_fs } from "./search_fs.js";
|
|
7
7
|
import { TASK_FILE_SUFFIX_JS } from "./task.js";
|
|
8
8
|
// TODO Flavored doesn't work when used in schemas, use Zod brand instead? problem is ergonomics
|
|
9
9
|
export const InputPath = z.string();
|
|
@@ -34,7 +34,7 @@ export const to_input_paths = (raw_input_paths, root_path) => raw_input_paths.ma
|
|
|
34
34
|
* Gets a list of possible source ids for each input path with `extensions`,
|
|
35
35
|
* duplicating each under `root_dirs`, without checking the filesystem.
|
|
36
36
|
*/
|
|
37
|
-
export const get_possible_paths = (input_path, root_dirs, extensions) => {
|
|
37
|
+
export const get_possible_paths = async (input_path, root_dirs, extensions) => {
|
|
38
38
|
const possible_paths = new Set();
|
|
39
39
|
const add_possible_paths = (path, root_dir) => {
|
|
40
40
|
// Specifically for paths to the Gro package dist, optimize by only looking for `.task.js`.
|
|
@@ -57,11 +57,9 @@ export const get_possible_paths = (input_path, root_dirs, extensions) => {
|
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
if (isAbsolute(input_path)) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
add_possible_paths(input_path,
|
|
63
|
-
? input_path
|
|
64
|
-
: dirname(input_path));
|
|
60
|
+
const exists = await fs_exists(input_path);
|
|
61
|
+
const is_directory = exists && (await stat(input_path)).isDirectory();
|
|
62
|
+
add_possible_paths(input_path, is_directory ? input_path : dirname(input_path));
|
|
65
63
|
}
|
|
66
64
|
else {
|
|
67
65
|
for (const root_dir of root_dirs) {
|
|
@@ -75,20 +73,23 @@ export const get_possible_paths = (input_path, root_dirs, extensions) => {
|
|
|
75
73
|
* and stopping at the first existing file or falling back to the first existing directory.
|
|
76
74
|
* If none is found for an input path, it's added to `unmapped_input_paths`.
|
|
77
75
|
*/
|
|
78
|
-
export const resolve_input_paths = (input_paths, root_dirs, extensions) => {
|
|
76
|
+
export const resolve_input_paths = async (input_paths, root_dirs, extensions) => {
|
|
79
77
|
const resolved_input_paths = [];
|
|
80
78
|
const possible_paths_by_input_path = new Map();
|
|
81
79
|
const unmapped_input_paths = [];
|
|
82
80
|
for (const input_path of input_paths) {
|
|
83
81
|
let found_file = null;
|
|
84
82
|
let found_dirs = null;
|
|
85
|
-
|
|
83
|
+
// eslint-disable-next-line no-await-in-loop
|
|
84
|
+
const possible_paths = await get_possible_paths(input_path, root_dirs, extensions);
|
|
86
85
|
possible_paths_by_input_path.set(input_path, possible_paths);
|
|
87
86
|
// Find the first existing file path or fallback to the first directory path.
|
|
88
87
|
for (const possible_path of possible_paths) {
|
|
89
|
-
|
|
88
|
+
// eslint-disable-next-line no-await-in-loop
|
|
89
|
+
if (!(await fs_exists(possible_path.id)))
|
|
90
90
|
continue;
|
|
91
|
-
|
|
91
|
+
// eslint-disable-next-line no-await-in-loop
|
|
92
|
+
const stats = await stat(possible_path.id);
|
|
92
93
|
if (stats.isDirectory()) {
|
|
93
94
|
found_dirs ??= [];
|
|
94
95
|
found_dirs.push([{ id: possible_path.id, is_directory: stats.isDirectory() }, possible_path]);
|
|
@@ -130,7 +131,7 @@ export const resolve_input_paths = (input_paths, root_dirs, extensions) => {
|
|
|
130
131
|
* Finds all of the matching files for the given input paths.
|
|
131
132
|
* De-dupes source ids.
|
|
132
133
|
*/
|
|
133
|
-
export const resolve_input_files = (resolved_input_paths, search =
|
|
134
|
+
export const resolve_input_files = async (resolved_input_paths, search = fs_search) => {
|
|
134
135
|
const resolved_input_files = [];
|
|
135
136
|
// Add all input paths initially, and remove each when resolved to a file.
|
|
136
137
|
const existing_path_ids = new Set();
|
|
@@ -143,7 +144,8 @@ export const resolve_input_files = (resolved_input_paths, search = search_fs) =>
|
|
|
143
144
|
const { input_path, id, is_directory } = resolved_input_path;
|
|
144
145
|
if (is_directory) {
|
|
145
146
|
// Handle input paths that resolve to directories.
|
|
146
|
-
|
|
147
|
+
// eslint-disable-next-line no-await-in-loop
|
|
148
|
+
const files = await search(id);
|
|
147
149
|
if (!files.length)
|
|
148
150
|
continue;
|
|
149
151
|
const path_ids = [];
|
package/dist/invoke.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { attach_process_error_handlers } from '@
|
|
2
|
-
import { configure_print_colors } from '@
|
|
1
|
+
import { attach_process_error_handlers } from '@fuzdev/fuz_util/process.js';
|
|
2
|
+
import { configure_print_colors } from '@fuzdev/fuz_util/print.js';
|
|
3
3
|
import { invoke_task } from "./invoke_task.js";
|
|
4
4
|
import { to_task_args } from "./args.js";
|
|
5
5
|
import { load_gro_config } from "./gro_config.js";
|
package/dist/invoke_task.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Timings } from '@
|
|
2
|
-
import { Logger } from '@
|
|
1
|
+
import { Timings } from '@fuzdev/fuz_util/timings.js';
|
|
2
|
+
import { Logger } from '@fuzdev/fuz_util/log.js';
|
|
3
3
|
import { type Args } from './args.ts';
|
|
4
4
|
import { RawInputPath } from './input_path.ts';
|
|
5
5
|
import type { GroConfig } from './gro_config.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke_task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/invoke_task.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,OAAO,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"invoke_task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/invoke_task.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAE/C,OAAO,EAAoB,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAgB,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAI5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GACvB,WAAW,YAAY,EACvB,MAAM,IAAI,GAAG,SAAS,EACtB,QAAQ,SAAS,EACjB,gBAAgB,KAAK,EACrB,kBAAkB,OAAO,GAAG,IAAI,EAChC,aAAa,MAAM,KACjB,OAAO,CAAC,IAAI,CA8Fd,CAAC"}
|
package/dist/invoke_task.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styleText as st } from 'node:util';
|
|
2
|
-
import { create_stopwatch, Timings } from '@
|
|
3
|
-
import { print_ms, print_timings } from '@
|
|
4
|
-
import { Logger } from '@
|
|
2
|
+
import { create_stopwatch, Timings } from '@fuzdev/fuz_util/timings.js';
|
|
3
|
+
import { print_ms, print_timings } from '@fuzdev/fuz_util/print.js';
|
|
4
|
+
import { Logger } from '@fuzdev/fuz_util/log.js';
|
|
5
5
|
import { to_forwarded_args } from "./args.js";
|
|
6
6
|
import { run_task } from "./run_task.js";
|
|
7
7
|
import { to_input_path, RawInputPath } from "./input_path.js";
|
|
@@ -54,7 +54,7 @@ export const invoke_task = async (task_name, args, config, initial_filer, initia
|
|
|
54
54
|
};
|
|
55
55
|
// Check if the caller just wants to see the version.
|
|
56
56
|
if (!task_name && (args?.version || args?.v)) {
|
|
57
|
-
const gro_package_json = load_gro_package_json();
|
|
57
|
+
const gro_package_json = await load_gro_package_json();
|
|
58
58
|
log.info(`${st('gray', 'v')}${st('cyan', gro_package_json.version)}`);
|
|
59
59
|
await finish();
|
|
60
60
|
return;
|
|
@@ -64,7 +64,7 @@ export const invoke_task = async (task_name, args, config, initial_filer, initia
|
|
|
64
64
|
const { task_root_dirs } = config;
|
|
65
65
|
// Find the task or directory specified by the `input_path`.
|
|
66
66
|
// Fall back to searching the Gro directory as well.
|
|
67
|
-
const found = find_tasks([input_path], task_root_dirs, config);
|
|
67
|
+
const found = await find_tasks([input_path], task_root_dirs, config);
|
|
68
68
|
if (!found.ok) {
|
|
69
69
|
log_error_reasons(log, found.reasons);
|
|
70
70
|
throw new SilentError();
|
package/dist/lint.task.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { print_spawn_result } from '@
|
|
1
|
+
import { print_spawn_result } from '@fuzdev/fuz_util/process.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { TaskError } from "./task.js";
|
|
4
4
|
import { serialize_args, to_forwarded_args } from "./args.js";
|
|
@@ -15,7 +15,7 @@ export const task = {
|
|
|
15
15
|
Args,
|
|
16
16
|
run: async ({ log, args }) => {
|
|
17
17
|
const { _, eslint_cli } = args;
|
|
18
|
-
const found_eslint_cli = find_cli(eslint_cli);
|
|
18
|
+
const found_eslint_cli = await find_cli(eslint_cli);
|
|
19
19
|
if (!found_eslint_cli) {
|
|
20
20
|
// TODO maybe make this an option?
|
|
21
21
|
log.info('ESLint is not installed; skipping linting');
|
package/dist/loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { compile, compileModule, preprocess } from 'svelte/compiler';
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
|
-
import { escape_regexp } from '@
|
|
4
|
+
import { escape_regexp } from '@fuzdev/fuz_util/regexp.js';
|
|
5
5
|
import { readFileSync } from 'node:fs';
|
|
6
6
|
import ts_blank_space from 'ts-blank-space';
|
|
7
7
|
import { render_env_shim_module } from "./sveltekit_shim_env.js";
|
|
@@ -190,7 +190,7 @@ export const resolve = async (specifier, context, nextResolve) => {
|
|
|
190
190
|
if (s[0] !== '.' && s[0] !== '/') {
|
|
191
191
|
return nextResolve(s, context);
|
|
192
192
|
}
|
|
193
|
-
const resolved = resolve_specifier(s, dirname(fileURLToPath(parent_url)));
|
|
193
|
+
const resolved = await resolve_specifier(s, dirname(fileURLToPath(parent_url)));
|
|
194
194
|
return {
|
|
195
195
|
url: pathToFileURL(resolved.path_id_with_querystring).href,
|
|
196
196
|
format: 'module',
|
package/dist/modules.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Timings } from '@
|
|
2
|
-
import type { Result } from '@
|
|
3
|
-
import type { PathId } from '@
|
|
1
|
+
import type { Timings } from '@fuzdev/fuz_util/timings.js';
|
|
2
|
+
import type { Result } from '@fuzdev/fuz_util/result.js';
|
|
3
|
+
import type { PathId } from '@fuzdev/fuz_util/path.js';
|
|
4
4
|
import type { ResolvedInputFile } from './input_path.ts';
|
|
5
5
|
export interface ModuleMeta<TModule extends Record<string, any> = Record<string, any>> {
|
|
6
6
|
id: PathId;
|
package/dist/modules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AAEzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAGvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAErD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAGvD,MAAM,WAAW,UAAU,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpF,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,OAAO,CAAC;CACb;AAED,MAAM,MAAM,gBAAgB,CAAC,OAAO,IAAI,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAC,EAAE,iBAAiB,CAAC,CAAC;AAC9F,MAAM,MAAM,iBAAiB,GAC1B;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,eAAe,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAC,GAC5D;IACA,EAAE,EAAE,KAAK,CAAC;IACV,IAAI,EAAE,mBAAmB,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CAClB,CAAC;AAEL,eAAO,MAAM,WAAW,GAAU,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpE,IAAI,MAAM,EACV,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,OAAO,EACvD,aAAa,OAAO,KAClB,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAiBnC,CAAC;AAEF,MAAM,WAAW,kBAAkB,CAAC,WAAW,SAAS,UAAU;IACjE,IAAI,EAAE,sBAAsB,CAAC;IAC7B,oBAAoB,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC/C,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEvB,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC5B;AAED,MAAM,MAAM,iBAAiB,CAAC,WAAW,SAAS,UAAU,IAAI,MAAM,CACrE;IACC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;CAC5B,EACD,kBAAkB,CAAC,WAAW,CAAC,CAC/B,CAAC;AAGF,eAAO,MAAM,YAAY,GACxB,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnC,WAAW,SAAS,UAAU,CAAC,OAAO,CAAC,EAEvC,sBAAsB,KAAK,CAAC,iBAAiB,CAAC,EAC9C,UAAU,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,IAAI,OAAO,EACtC,iBAAiB,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,GAAG,EAAE,OAAO,KAAK,WAAW,EACtF,UAAU,OAAO,KACf,OAAO,CAAC,iBAAiB,CAAC,WAAW,CAAC,CA2CxC,CAAC"}
|
package/dist/modules.js
CHANGED
|
@@ -6,8 +6,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
6
6
|
}
|
|
7
7
|
return path;
|
|
8
8
|
};
|
|
9
|
-
import { UnreachableError } from '@
|
|
10
|
-
import { print_error } from '@
|
|
9
|
+
import { UnreachableError } from '@fuzdev/fuz_util/error.js';
|
|
10
|
+
import { print_error } from '@fuzdev/fuz_util/print.js';
|
|
11
11
|
import { pathToFileURL } from 'node:url';
|
|
12
12
|
import { print_path } from "./paths.js";
|
|
13
13
|
export const load_module = async (id, validate, bust_cache) => {
|
|
@@ -21,8 +21,8 @@ export const load_module = async (id, validate, bust_cache) => {
|
|
|
21
21
|
}
|
|
22
22
|
mod = await import(__rewriteRelativeImportExtension(import_path, true));
|
|
23
23
|
}
|
|
24
|
-
catch (
|
|
25
|
-
return { ok: false, type: 'failed_import', id, error
|
|
24
|
+
catch (error) {
|
|
25
|
+
return { ok: false, type: 'failed_import', id, error };
|
|
26
26
|
}
|
|
27
27
|
if (validate && !validate(mod)) {
|
|
28
28
|
return { ok: false, type: 'failed_validation', id, mod, validation: validate.name };
|
package/dist/package_json.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { Logger } from '@
|
|
2
|
-
import { PackageJson, PackageJsonExports } from '@
|
|
1
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
2
|
+
import { PackageJson, PackageJsonExports } from '@fuzdev/fuz_util/package_json.js';
|
|
3
3
|
export type PackageJsonMapper = (package_json: PackageJson) => PackageJson | null | Promise<PackageJson | null>;
|
|
4
4
|
export declare const EMPTY_PACKAGE_JSON: PackageJson;
|
|
5
5
|
export declare const load_package_json: (dir?: string, cache?: Record<string, PackageJson>, parse?: boolean, // TODO pass `false` here in more places, especially anything perf-sensitive like work on startup
|
|
6
|
-
log?: Logger) => PackageJson
|
|
6
|
+
log?: Logger) => Promise<PackageJson>;
|
|
7
7
|
export declare const sync_package_json: (map_package_json: PackageJsonMapper, log: Logger, write?: boolean, dir?: string, exports_dir?: string) => Promise<{
|
|
8
8
|
package_json: PackageJson | null;
|
|
9
9
|
changed: boolean;
|
|
10
10
|
}>;
|
|
11
|
-
export declare const load_gro_package_json: () => PackageJson
|
|
12
|
-
export declare const write_package_json: (serialized_package_json: string) => void
|
|
11
|
+
export declare const load_gro_package_json: () => Promise<PackageJson>;
|
|
12
|
+
export declare const write_package_json: (serialized_package_json: string) => Promise<void>;
|
|
13
13
|
export declare const serialize_package_json: (package_json: PackageJson) => string;
|
|
14
14
|
/**
|
|
15
15
|
* Updates package.json. Writes to the filesystem only when contents change.
|
|
@@ -23,7 +23,7 @@ export declare const parse_repo_url: (package_json: PackageJson) => {
|
|
|
23
23
|
owner: string;
|
|
24
24
|
repo: string;
|
|
25
25
|
} | undefined;
|
|
26
|
-
export declare const has_dep: (dep_name: string, package_json
|
|
26
|
+
export declare const has_dep: (dep_name: string, package_json: PackageJson) => boolean;
|
|
27
27
|
export interface PackageJsonDep {
|
|
28
28
|
name: string;
|
|
29
29
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package_json.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package_json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"package_json.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package_json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AAgBjF,MAAM,MAAM,iBAAiB,GAAG,CAC/B,YAAY,EAAE,WAAW,KACrB,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;AAEtD,eAAO,MAAM,kBAAkB,EAAE,WAAqC,CAAC;AAEvE,eAAO,MAAM,iBAAiB,GAC7B,YAA+C,EAC/C,QAAQ,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,EACnC,eAAY,EAAE,iGAAiG;AAC/G,MAAM,MAAM,KACV,OAAO,CAAC,WAAW,CAkBrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC7B,kBAAkB,iBAAiB,EACnC,KAAK,MAAM,EACX,eAAY,EACZ,YAAgB,EAChB,oBAAuB,KACrB,OAAO,CAAC;IAAC,YAAY,EAAE,WAAW,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CA0B9D,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,OAAO,CAAC,WAAW,CAAsC,CAAC;AAMnG,eAAO,MAAM,kBAAkB,GAAI,yBAAyB,MAAM,KAAG,OAAO,CAAC,IAAI,CACL,CAAC;AAE7E,eAAO,MAAM,sBAAsB,GAAI,cAAc,WAAW,KAAG,MACW,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC/B,QAAQ,CAAC,YAAY,EAAE,WAAW,KAAK,WAAW,GAAG,IAAI,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,EACvF,YAAgB,EAChB,eAAY,KACV,OAAO,CAAC;IAAC,YAAY,EAAE,WAAW,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC,CAa9D,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,CAAC,MAAM,CAAC,KAAG,kBAmDzD,CAAC;AAIF,eAAO,MAAM,cAAc,GAC1B,cAAc,WAAW,KACvB;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG,SAgBlC,CAAC;AA8BF,eAAO,MAAM,OAAO,GAAI,UAAU,MAAM,EAAE,cAAc,WAAW,KAAG,OAG1B,CAAC;AAE7C,MAAM,WAAW,cAAc;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,YAAY,GAAI,cAAc,WAAW,KAAG,KAAK,CAAC,cAAc,CAe5E,CAAC"}
|
package/dist/package_json.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import { plural, strip_end } from '@
|
|
3
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { plural, strip_end } from '@fuzdev/fuz_util/string.js';
|
|
5
5
|
import { styleText as st } from 'node:util';
|
|
6
|
-
import { PackageJson, PackageJsonExports } from '@
|
|
6
|
+
import { PackageJson, PackageJsonExports } from '@fuzdev/fuz_util/package_json.js';
|
|
7
|
+
import { fs_search } from '@fuzdev/fuz_util/fs.js';
|
|
7
8
|
import { paths, gro_paths, IS_THIS_GRO } from "./paths.js";
|
|
8
9
|
import { PACKAGE_JSON_FILENAME, SVELTEKIT_DIST_DIRNAME, TS_MATCHER, JS_MATCHER, SVELTE_MATCHER, JSON_MATCHER, CSS_MATCHER, } from "./constants.js";
|
|
9
|
-
import { search_fs } from "./search_fs.js";
|
|
10
10
|
import { has_sveltekit_library } from "./sveltekit_helpers.js";
|
|
11
11
|
import { GITHUB_REPO_MATCHER } from "./github.js";
|
|
12
12
|
export const EMPTY_PACKAGE_JSON = { name: '', version: '' };
|
|
13
|
-
export const load_package_json = (dir = IS_THIS_GRO ? gro_paths.root : paths.root, cache, parse = true, // TODO pass `false` here in more places, especially anything perf-sensitive like work on startup
|
|
13
|
+
export const load_package_json = async (dir = IS_THIS_GRO ? gro_paths.root : paths.root, cache, parse = true, // TODO pass `false` here in more places, especially anything perf-sensitive like work on startup
|
|
14
14
|
log) => {
|
|
15
15
|
let package_json;
|
|
16
16
|
if (cache && dir in cache) {
|
|
17
17
|
return cache[dir];
|
|
18
18
|
}
|
|
19
19
|
try {
|
|
20
|
-
package_json = JSON.parse(load_package_json_contents(dir));
|
|
20
|
+
package_json = JSON.parse(await load_package_json_contents(dir));
|
|
21
21
|
}
|
|
22
|
-
catch (
|
|
23
|
-
log?.error(st('yellow', `Failed to load package.json in ${dir}`),
|
|
22
|
+
catch (error) {
|
|
23
|
+
log?.error(st('yellow', `Failed to load package.json in ${dir}`), error);
|
|
24
24
|
return EMPTY_PACKAGE_JSON;
|
|
25
25
|
}
|
|
26
26
|
if (parse) {
|
|
@@ -32,7 +32,7 @@ log) => {
|
|
|
32
32
|
return package_json;
|
|
33
33
|
};
|
|
34
34
|
export const sync_package_json = async (map_package_json, log, write = true, dir = paths.root, exports_dir = paths.lib) => {
|
|
35
|
-
const exported_files =
|
|
35
|
+
const exported_files = await fs_search(exports_dir);
|
|
36
36
|
const exported_paths = exported_files.map((f) => f.path);
|
|
37
37
|
const updated = await update_package_json(async (package_json) => {
|
|
38
38
|
if ((await has_sveltekit_library(package_json)).ok) {
|
|
@@ -51,16 +51,14 @@ export const sync_package_json = async (map_package_json, log, write = true, dir
|
|
|
51
51
|
};
|
|
52
52
|
export const load_gro_package_json = () => load_package_json(gro_paths.root);
|
|
53
53
|
// TODO probably make this nullable and make callers handle failures
|
|
54
|
-
const load_package_json_contents = (dir) =>
|
|
55
|
-
export const write_package_json = (serialized_package_json) =>
|
|
56
|
-
writeFileSync(join(paths.root, PACKAGE_JSON_FILENAME), serialized_package_json);
|
|
57
|
-
};
|
|
54
|
+
const load_package_json_contents = (dir) => readFile(join(dir, PACKAGE_JSON_FILENAME), 'utf8');
|
|
55
|
+
export const write_package_json = (serialized_package_json) => writeFile(join(paths.root, PACKAGE_JSON_FILENAME), serialized_package_json);
|
|
58
56
|
export const serialize_package_json = (package_json) => JSON.stringify(parse_package_json(PackageJson, package_json), null, 2) + '\n';
|
|
59
57
|
/**
|
|
60
58
|
* Updates package.json. Writes to the filesystem only when contents change.
|
|
61
59
|
*/
|
|
62
60
|
export const update_package_json = async (update, dir = paths.root, write = true) => {
|
|
63
|
-
const original_contents = load_package_json_contents(dir);
|
|
61
|
+
const original_contents = await load_package_json_contents(dir);
|
|
64
62
|
const original = JSON.parse(original_contents);
|
|
65
63
|
const updated = await update(original);
|
|
66
64
|
if (updated === null) {
|
|
@@ -71,7 +69,7 @@ export const update_package_json = async (update, dir = paths.root, write = true
|
|
|
71
69
|
return { package_json: original, changed: false };
|
|
72
70
|
}
|
|
73
71
|
if (write)
|
|
74
|
-
write_package_json(updated_contents);
|
|
72
|
+
await write_package_json(updated_contents);
|
|
75
73
|
return { package_json: updated, changed: true };
|
|
76
74
|
};
|
|
77
75
|
const is_index = (path) => path === 'index.ts' || path === 'index.js';
|
|
@@ -158,7 +156,7 @@ const parse_or_throw_formatted_error = (name, schema, value) => {
|
|
|
158
156
|
}
|
|
159
157
|
return parsed.data;
|
|
160
158
|
};
|
|
161
|
-
export const has_dep = (dep_name, package_json
|
|
159
|
+
export const has_dep = (dep_name, package_json) => !!package_json.devDependencies?.[dep_name] ||
|
|
162
160
|
!!package_json.dependencies?.[dep_name] ||
|
|
163
161
|
!!package_json.peerDependencies?.[dep_name];
|
|
164
162
|
export const extract_deps = (package_json) => {
|
package/dist/parse_exports.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import type { Flavored } from '@
|
|
3
|
-
import type { Logger } from '@
|
|
4
|
-
import type { DeclarationKind } from '@
|
|
5
|
-
import type { PathId } from '@
|
|
2
|
+
import type { Flavored } from '@fuzdev/fuz_util/types.js';
|
|
3
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
4
|
+
import type { DeclarationKind } from '@fuzdev/fuz_util/source_json.js';
|
|
5
|
+
import type { PathId } from '@fuzdev/fuz_util/path.js';
|
|
6
6
|
export interface Declaration {
|
|
7
7
|
name: string;
|
|
8
8
|
kind: DeclarationKind | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_exports.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/parse_exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"parse_exports.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/parse_exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAKrD,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,aAAa,GACzB,IAAI,MAAM,EACV,UAAU,EAAE,CAAC,OAAO,EACpB,eAAc,KAAK,CAAC,iBAAiB,CAAM,EAC3C,MAAM,MAAM,KACV,KAAK,CAAC,iBAAiB,CAyBzB,CAAC;AAGF,eAAO,MAAM,iCAAiC,GAC7C,WAAW,MAAM,EACjB,eAAc,KAAK,CAAC,iBAAiB,CAAM,KACzC,KAAK,CAAC,iBAAiB,CA4BzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC9B,aAAa,EAAE,CAAC,UAAU,EAC1B,SAAS,EAAE,CAAC,OAAO,EACnB,SAAS,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,EACzB,eAAc,KAAK,CAAC,iBAAiB,CAAM,EAC3C,MAAM,MAAM,KACV,KAAK,CAAC,iBAAiB,CAIzB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
|
-
import type { Logger } from '@
|
|
2
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
3
3
|
import type { ExportDeclaration } from './parse_exports.ts';
|
|
4
4
|
/**
|
|
5
5
|
* A class to track export context and determine export kinds.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_exports_context.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/parse_exports_context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"parse_exports_context.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/parse_exports_context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAGpD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAE1D;;GAEG;AACH,qBAAa,mBAAmB;;IAQ/B,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,KAAK,UAAwC;gBAEjC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM;IAc7C;;OAEG;IACH,mBAAmB,CAAC,WAAW,EAAE,EAAE,CAAC,UAAU,GAAG,IAAI;IAerD;;OAEG;IACH,eAAe,CACd,WAAW,EAAE,EAAE,CAAC,UAAU,EAC1B,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,EACzB,YAAY,GAAE,KAAK,CAAC,iBAAiB,CAAM,GACzC,KAAK,CAAC,iBAAiB,CAAC;CA+U3B"}
|
package/dist/parse_imports.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Flavored } from '@
|
|
2
|
-
import type { PathId } from '@
|
|
1
|
+
import type { Flavored } from '@fuzdev/fuz_util/types.js';
|
|
2
|
+
import type { PathId } from '@fuzdev/fuz_util/path.js';
|
|
3
3
|
export type ImportSpecifier = Flavored<string, 'ImportSpecifier'>;
|
|
4
4
|
export declare const parse_imports: (id: PathId, contents: string, ignore_types?: boolean) => Array<ImportSpecifier>;
|
|
5
5
|
//# sourceMappingURL=parse_imports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_imports.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/parse_imports.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"parse_imports.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/parse_imports.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAC;AAExD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAIrD,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAyBlE,eAAO,MAAM,aAAa,GACzB,IAAI,MAAM,EACV,UAAU,MAAM,EAChB,sBAAmB,KACjB,KAAK,CAAC,eAAe,CA+IvB,CAAC"}
|
package/dist/parse_imports.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseSync } from 'oxc-parser';
|
|
2
|
-
import { UnreachableError } from '@
|
|
2
|
+
import { UnreachableError } from '@fuzdev/fuz_util/error.js';
|
|
3
3
|
import { JS_MATCHER, TS_MATCHER, SVELTE_MATCHER, SVELTE_SCRIPT_MATCHER } from "./constants.js";
|
|
4
4
|
// TODO this is probably way more complicated that it should be, maybe report the issues upstream unless I made a mistake here
|
|
5
5
|
/**
|
package/dist/paths.d.ts
CHANGED
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/paths.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/paths.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAkBrD,eAAO,MAAM,WAAW,QAA2C,CAAC;AACpE,eAAO,MAAM,QAAQ,QAA2B,CAAC;AACjD,sBAAsB;AACtB,eAAO,MAAM,OAAO,QAAiB,CAAC;AACtC,eAAO,MAAM,cAAc,QAA8C,CAAC;AAE1E,MAAM,WAAW,KAAK;IACrB,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM,KAAG,KAW/C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,KAAG,KAA4C,CAAC;AAEtF,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,KAAG,OACiC,CAAC;AAGzE,eAAO,MAAM,YAAY,GAAI,IAAI,MAAM,EAAE,SAAmB,KAAG,MAClC,CAAC;AAG9B,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,EAAE,SAAwB,KAAG,MACrD,CAAC;AAI7B,eAAO,MAAM,oBAAoB,GAAI,WAAW,MAAM,EAAE,SAA0B,KAAG,MAC3D,CAAC;AAE3B,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,SAAqB,KAAG,MAMhE,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,eAAe,MAAM,KAAG,MAGvE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,KAAK,OAA8B,CAAC;AAEjD,sBAAsB;AACtB,eAAO,MAAM,eAAe,SAAS,CAAC;AAYtC,eAAO,MAAM,WAAW,SAAsC,CAAC;AAC/D;;GAEG;AACH,eAAO,MAAM,SAAS,OAA2D,CAAC;AAClF,sBAAsB;AACtB,eAAO,MAAM,YAAY,QAAgD,CAAC"}
|
package/dist/paths.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join, extname, relative, basename } from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
-
import { ensure_end, strip_end } from '@
|
|
3
|
+
import { ensure_end, strip_end } from '@fuzdev/fuz_util/string.js';
|
|
4
4
|
import { styleText as st } from 'node:util';
|
|
5
5
|
import { GRO_CONFIG_FILENAME, GRO_DEV_DIR, GRO_DIR, SOURCE_DIR, SVELTEKIT_DIST_DIRNAME, } from "./constants.js";
|
|
6
6
|
import { default_svelte_config } from "./svelte_config.js";
|
package/dist/publish.task.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { spawn } from '@
|
|
1
|
+
import { spawn } from '@fuzdev/fuz_util/process.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { styleText as st } from 'node:util';
|
|
4
|
-
import {
|
|
5
|
-
import { GitBranch, GitOrigin, git_check_clean_workspace, git_checkout, git_fetch, git_pull, } from '@
|
|
4
|
+
import { fs_exists } from '@fuzdev/fuz_util/fs.js';
|
|
5
|
+
import { GitBranch, GitOrigin, git_check_clean_workspace, git_checkout, git_fetch, git_pull, } from '@fuzdev/fuz_util/git.js';
|
|
6
6
|
import { TaskError } from "./task.js";
|
|
7
7
|
import { load_package_json, parse_repo_url } from "./package_json.js";
|
|
8
8
|
import { find_cli, spawn_cli } from "./cli.js";
|
|
@@ -59,13 +59,13 @@ export const task = {
|
|
|
59
59
|
if (dry) {
|
|
60
60
|
log.info(st('green', 'dry run!'));
|
|
61
61
|
}
|
|
62
|
-
const package_json = load_package_json();
|
|
62
|
+
const package_json = await load_package_json();
|
|
63
63
|
const has_sveltekit_library_result = await has_sveltekit_library(package_json);
|
|
64
64
|
if (!has_sveltekit_library_result.ok) {
|
|
65
65
|
throw new TaskError('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
|
|
66
66
|
}
|
|
67
|
-
const changelog_exists =
|
|
68
|
-
const found_changeset_cli = find_cli(changeset_cli);
|
|
67
|
+
const changelog_exists = await fs_exists(changelog);
|
|
68
|
+
const found_changeset_cli = await find_cli(changeset_cli);
|
|
69
69
|
if (!found_changeset_cli) {
|
|
70
70
|
throw new TaskError('changeset command not found, install @changesets/cli locally or globally');
|
|
71
71
|
}
|
|
@@ -132,7 +132,7 @@ export const task = {
|
|
|
132
132
|
// Regenerate files that depend on package.json version.
|
|
133
133
|
// The check above ensures gen is updated.
|
|
134
134
|
await invoke_task('gen');
|
|
135
|
-
const package_json_after_versioning = load_package_json();
|
|
135
|
+
const package_json_after_versioning = await load_package_json();
|
|
136
136
|
version = package_json_after_versioning.version;
|
|
137
137
|
if (package_json.version === version) {
|
|
138
138
|
// The version didn't change.
|
|
@@ -166,7 +166,7 @@ export const task = {
|
|
|
166
166
|
if (!changeset_publish_result?.ok) {
|
|
167
167
|
throw new TaskError(`\`${changeset_cli} publish\` failed - continue manually or try again after running \`git reset --hard\``);
|
|
168
168
|
}
|
|
169
|
-
if (!changelog_exists &&
|
|
169
|
+
if (!changelog_exists && (await fs_exists(changelog))) {
|
|
170
170
|
await spawn('git', ['add', changelog]);
|
|
171
171
|
}
|
|
172
172
|
await spawn('git', ['commit', '-a', '-m', `publish v${version}`]);
|
package/dist/reinstall.task.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { spawn } from '@
|
|
2
|
+
import { spawn } from '@fuzdev/fuz_util/process.js';
|
|
3
3
|
import { rm } from 'node:fs/promises';
|
|
4
4
|
import { TaskError } from "./task.js";
|
|
5
5
|
import { LOCKFILE_FILENAME, NODE_MODULES_DIRNAME } from "./constants.js";
|
package/dist/release.task.js
CHANGED
|
@@ -8,7 +8,7 @@ export const task = {
|
|
|
8
8
|
summary: 'publish and deploy',
|
|
9
9
|
Args,
|
|
10
10
|
run: async ({ invoke_task }) => {
|
|
11
|
-
const package_json = load_package_json();
|
|
11
|
+
const package_json = await load_package_json();
|
|
12
12
|
const publish = (await has_sveltekit_library(package_json)).ok;
|
|
13
13
|
if (publish) {
|
|
14
14
|
await invoke_task('publish', { optional: true });
|
package/dist/resolve.task.js
CHANGED
|
@@ -11,7 +11,7 @@ export const Args = z.strictObject({
|
|
|
11
11
|
export const task = {
|
|
12
12
|
summary: 'diagnostic that logs resolved filesystem info for the given input paths',
|
|
13
13
|
Args,
|
|
14
|
-
run: ({ args, config, log }) => {
|
|
14
|
+
run: async ({ args, config, log }) => {
|
|
15
15
|
const { _, verbose } = args;
|
|
16
16
|
if (verbose)
|
|
17
17
|
log.info('raw input paths:', _);
|
|
@@ -21,7 +21,7 @@ export const task = {
|
|
|
21
21
|
const { task_root_dirs } = config;
|
|
22
22
|
if (verbose)
|
|
23
23
|
log.info('task root paths:', task_root_dirs);
|
|
24
|
-
const { resolved_input_paths, possible_paths_by_input_path, unmapped_input_paths } = resolve_input_paths(input_paths, task_root_dirs, TASK_FILE_SUFFIXES);
|
|
24
|
+
const { resolved_input_paths, possible_paths_by_input_path, unmapped_input_paths } = await resolve_input_paths(input_paths, task_root_dirs, TASK_FILE_SUFFIXES);
|
|
25
25
|
if (verbose)
|
|
26
26
|
log.info('resolved_input_paths:', resolved_input_paths);
|
|
27
27
|
if (verbose)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PathId } from '@
|
|
1
|
+
import type { PathId } from '@fuzdev/fuz_util/path.js';
|
|
2
2
|
export interface ResolvedSpecifier {
|
|
3
3
|
/**
|
|
4
4
|
* The resolved filesystem path for the specifier.
|
|
@@ -18,5 +18,5 @@ export interface ResolvedSpecifier {
|
|
|
18
18
|
* and infer the correct extension following Vite conventions.
|
|
19
19
|
* If no `.js` file is found for the specifier on the filesystem, it assumes `.ts`.
|
|
20
20
|
*/
|
|
21
|
-
export declare const resolve_specifier: (specifier: string, dir: string) => ResolvedSpecifier
|
|
21
|
+
export declare const resolve_specifier: (specifier: string, dir: string) => Promise<ResolvedSpecifier>;
|
|
22
22
|
//# sourceMappingURL=resolve_specifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_specifier.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/resolve_specifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"resolve_specifier.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/resolve_specifier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAMrD,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,wBAAwB,EAAE,MAAM,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,SAAS,GAAG,4BAA4B,GAAG,4BAA4B,CAAC;IACnF,GAAG,EAAE,OAAO,CAAC;CACb;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC7B,WAAW,MAAM,EACjB,KAAK,MAAM,KACT,OAAO,CAAC,iBAAiB,CAiD3B,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { extname, isAbsolute, join, relative } from 'node:path';
|
|
2
|
-
import {
|
|
2
|
+
import { fs_exists } from '@fuzdev/fuz_util/fs.js';
|
|
3
3
|
import { replace_extension } from "./paths.js";
|
|
4
4
|
/**
|
|
5
5
|
* Maps an import `specifier` relative to `dir`,
|
|
6
6
|
* and infer the correct extension following Vite conventions.
|
|
7
7
|
* If no `.js` file is found for the specifier on the filesystem, it assumes `.ts`.
|
|
8
8
|
*/
|
|
9
|
-
export const resolve_specifier = (specifier, dir) => {
|
|
9
|
+
export const resolve_specifier = async (specifier, dir) => {
|
|
10
10
|
const raw = specifier.endsWith('?raw'); // TODO more robust detection? other values?
|
|
11
11
|
const final_specifier = raw ? specifier.substring(0, specifier.length - 4) : specifier;
|
|
12
12
|
const absolute_path = isAbsolute(final_specifier) ? final_specifier : join(dir, final_specifier);
|
|
@@ -16,7 +16,7 @@ export const resolve_specifier = (specifier, dir) => {
|
|
|
16
16
|
const ext = extname(absolute_path);
|
|
17
17
|
const is_js = ext === '.js';
|
|
18
18
|
const is_ts = ext === '.ts';
|
|
19
|
-
if (!is_js && !is_ts &&
|
|
19
|
+
if (!is_js && !is_ts && (await fs_exists(absolute_path))) {
|
|
20
20
|
// unrecognized extension and the file exists
|
|
21
21
|
mapped_path = absolute_path;
|
|
22
22
|
path_id = absolute_path;
|
|
@@ -31,7 +31,8 @@ export const resolve_specifier = (specifier, dir) => {
|
|
|
31
31
|
// extensionless, or js that points to ts, or just js
|
|
32
32
|
const js_id = is_js ? absolute_path : absolute_path + '.js';
|
|
33
33
|
const ts_id = is_js ? replace_extension(absolute_path, '.ts') : absolute_path + '.ts';
|
|
34
|
-
|
|
34
|
+
const [ts_exists, js_exists] = await Promise.all([fs_exists(ts_id), fs_exists(js_id)]);
|
|
35
|
+
if (!ts_exists && js_exists) {
|
|
35
36
|
mapped_path = js_id;
|
|
36
37
|
path_id = js_id;
|
|
37
38
|
namespace = 'sveltekit_local_imports_js';
|
package/dist/run.task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { styleText as st } from 'node:util';
|
|
3
|
-
import {
|
|
3
|
+
import { fs_exists } from '@fuzdev/fuz_util/fs.js';
|
|
4
4
|
import { TaskError } from "./task.js";
|
|
5
5
|
import { resolve_gro_module_path, spawn_with_loader } from "./gro_helpers.js";
|
|
6
6
|
import { serialize_args, to_implicit_forwarded_args } from "./args.js";
|
|
@@ -30,7 +30,7 @@ export const task = {
|
|
|
30
30
|
log.info(st('green', '\n\nUsage: ') + st('cyan', 'gro run path/to/file.ts [...args]\n'));
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (!
|
|
33
|
+
if (!(await fs_exists(path))) {
|
|
34
34
|
throw new TaskError('Cannot find file to run at path: ' + path);
|
|
35
35
|
}
|
|
36
36
|
// Get args after `--` without requiring a command name.
|
package/dist/run_gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Timings } from '@
|
|
2
|
-
import type { Logger } from '@
|
|
1
|
+
import type { Timings } from '@fuzdev/fuz_util/timings.js';
|
|
2
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
3
3
|
import { type GenResults, type GenfileModuleMeta } from './gen.ts';
|
|
4
4
|
import type { format_file as base_format_file } from './format_file.ts';
|
|
5
5
|
import type { GroConfig } from './gro_config.ts';
|
package/dist/run_gen.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run_gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"run_gen.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run_gen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EACN,KAAK,UAAU,EAGf,KAAK,iBAAiB,EAItB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAC,WAAW,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AACtE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAE1C,eAAO,MAAM,mBAAmB,qCAAqC,CAAC;AAEtE,eAAO,MAAM,OAAO,GACnB,aAAa,KAAK,CAAC,iBAAiB,CAAC,EACrC,QAAQ,SAAS,EACjB,OAAO,KAAK,EACZ,KAAK,MAAM,EACX,SAAS,OAAO,EAChB,aAAa,UAAU,EACvB,cAAc,OAAO,gBAAgB,KACnC,OAAO,CAAC,UAAU,CA6EpB,CAAC"}
|