@ryanatkn/gro 0.175.0 → 0.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/args.d.ts +5 -5
- package/dist/args.d.ts.map +1 -1
- package/dist/build.task.d.ts.map +1 -1
- package/dist/build.task.js +2 -2
- package/dist/build_cache.d.ts +12 -12
- package/dist/build_cache.d.ts.map +1 -1
- package/dist/build_cache.js +4 -4
- package/dist/changelog.d.ts +2 -2
- package/dist/changelog.d.ts.map +1 -1
- package/dist/changelog.js +1 -1
- package/dist/changeset.task.d.ts.map +1 -1
- package/dist/changeset.task.js +9 -9
- package/dist/changeset_helpers.d.ts +4 -4
- package/dist/changeset_helpers.d.ts.map +1 -1
- package/dist/changeset_helpers.js +2 -2
- package/dist/check.task.d.ts.map +1 -1
- package/dist/check.task.js +3 -3
- package/dist/clean.task.js +2 -2
- package/dist/cli.d.ts +6 -6
- package/dist/cli.d.ts.map +1 -1
- package/dist/commit.task.js +2 -2
- package/dist/deploy.task.d.ts.map +1 -1
- package/dist/deploy.task.js +13 -13
- package/dist/dev.task.d.ts +2 -2
- package/dist/dev.task.d.ts.map +1 -1
- package/dist/disknode.d.ts +4 -4
- package/dist/disknode.d.ts.map +1 -1
- package/dist/esbuild_helpers.d.ts +2 -2
- package/dist/esbuild_helpers.d.ts.map +1 -1
- package/dist/esbuild_plugin_external_worker.d.ts +5 -5
- package/dist/esbuild_plugin_external_worker.d.ts.map +1 -1
- package/dist/esbuild_plugin_svelte.d.ts +4 -4
- package/dist/esbuild_plugin_svelte.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts +2 -2
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts +5 -5
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +2 -2
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -1
- package/dist/filer.d.ts +15 -15
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +2 -2
- package/dist/format.task.d.ts.map +1 -1
- package/dist/format.task.js +2 -2
- package/dist/format_directory.d.ts +2 -2
- package/dist/format_directory.d.ts.map +1 -1
- package/dist/gen.d.ts +73 -73
- package/dist/gen.d.ts.map +1 -1
- package/dist/gen.js +1 -1
- package/dist/gen.task.d.ts.map +1 -1
- package/dist/gen.task.js +8 -8
- package/dist/gen_helpers.d.ts +4 -4
- package/dist/gen_helpers.d.ts.map +1 -1
- package/dist/gen_helpers.js +1 -1
- package/dist/github.d.ts +4 -4
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +3 -3
- package/dist/gro.config.default.d.ts +2 -2
- package/dist/gro.config.default.d.ts.map +1 -1
- package/dist/gro_config.d.ts +25 -25
- package/dist/gro_config.d.ts.map +1 -1
- package/dist/gro_config.js +2 -2
- package/dist/gro_helpers.d.ts +2 -2
- package/dist/gro_helpers.d.ts.map +1 -1
- package/dist/gro_plugin_gen.d.ts +3 -3
- package/dist/gro_plugin_gen.d.ts.map +1 -1
- package/dist/gro_plugin_gen.js +2 -2
- package/dist/gro_plugin_server.d.ts +7 -7
- package/dist/gro_plugin_server.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.d.ts +10 -10
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.js +2 -2
- package/dist/gro_plugin_sveltekit_library.d.ts +4 -4
- package/dist/gro_plugin_sveltekit_library.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_library.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/input_path.d.ts +30 -30
- package/dist/input_path.d.ts.map +1 -1
- package/dist/input_path.js +2 -2
- package/dist/invoke.js +1 -1
- package/dist/invoke_task.d.ts +3 -3
- package/dist/invoke_task.d.ts.map +1 -1
- package/dist/invoke_task.js +4 -4
- package/dist/lint.task.d.ts.map +1 -1
- package/dist/lint.task.js +2 -2
- package/dist/modules.d.ts +20 -20
- package/dist/modules.d.ts.map +1 -1
- package/dist/modules.js +2 -2
- package/dist/package_json.d.ts +16 -16
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +6 -6
- package/dist/parse_exports.d.ts +7 -7
- package/dist/parse_exports.d.ts.map +1 -1
- package/dist/parse_exports.js +3 -3
- package/dist/parse_exports_context.d.ts +3 -3
- package/dist/parse_exports_context.d.ts.map +1 -1
- package/dist/parse_exports_context.js +1 -1
- package/dist/parse_imports.d.ts +3 -3
- package/dist/parse_imports.d.ts.map +1 -1
- package/dist/parse_imports.js +2 -2
- package/dist/paths.d.ts +6 -6
- package/dist/paths.d.ts.map +1 -1
- package/dist/plugin.d.ts +13 -13
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/publish.task.d.ts.map +1 -1
- package/dist/publish.task.js +12 -12
- package/dist/reinstall.task.d.ts.map +1 -1
- package/dist/reinstall.task.js +4 -4
- package/dist/resolve_specifier.d.ts +4 -4
- package/dist/resolve_specifier.d.ts.map +1 -1
- package/dist/run.task.d.ts +5 -1
- package/dist/run.task.d.ts.map +1 -1
- package/dist/run.task.js +25 -15
- package/dist/run_gen.d.ts +4 -4
- package/dist/run_gen.d.ts.map +1 -1
- package/dist/run_task.d.ts +4 -4
- package/dist/run_task.d.ts.map +1 -1
- package/dist/run_task.js +3 -3
- package/dist/search_fs.d.ts +6 -6
- package/dist/search_fs.d.ts.map +1 -1
- package/dist/src_json.d.ts +6 -6
- package/dist/src_json.d.ts.map +1 -1
- package/dist/src_json.js +3 -3
- package/dist/svelte_config.d.ts +3 -3
- package/dist/svelte_config.d.ts.map +1 -1
- package/dist/sveltekit_helpers.d.ts +5 -5
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_helpers.js +5 -5
- package/dist/sveltekit_shim_app.d.ts +2 -2
- package/dist/sveltekit_shim_app.d.ts.map +1 -1
- package/dist/sync.task.d.ts.map +1 -1
- package/dist/sync.task.js +2 -2
- package/dist/task.d.ts +54 -54
- package/dist/task.d.ts.map +1 -1
- package/dist/task.js +3 -3
- package/dist/task_logging.d.ts +3 -3
- package/dist/task_logging.d.ts.map +1 -1
- package/dist/test.task.d.ts.map +1 -1
- package/dist/test.task.js +4 -4
- package/dist/typecheck.task.d.ts.map +1 -1
- package/dist/typecheck.task.js +4 -4
- package/dist/upgrade.task.d.ts.map +1 -1
- package/dist/upgrade.task.js +5 -5
- package/dist/watch_dir.d.ts +10 -10
- package/dist/watch_dir.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/args.ts +9 -9
- package/src/lib/build.task.ts +2 -2
- package/src/lib/build_cache.ts +18 -18
- package/src/lib/changelog.ts +10 -10
- package/src/lib/changeset.task.ts +16 -16
- package/src/lib/changeset_helpers.ts +4 -4
- package/src/lib/check.task.ts +3 -3
- package/src/lib/clean.task.ts +2 -2
- package/src/lib/cli.ts +7 -7
- package/src/lib/commit.task.ts +2 -2
- package/src/lib/deploy.task.ts +15 -15
- package/src/lib/dev.task.ts +2 -2
- package/src/lib/disknode.ts +4 -4
- package/src/lib/esbuild_helpers.ts +2 -2
- package/src/lib/esbuild_plugin_external_worker.ts +7 -7
- package/src/lib/esbuild_plugin_svelte.ts +4 -4
- package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +2 -2
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +5 -5
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +2 -2
- package/src/lib/filer.ts +35 -35
- package/src/lib/format.task.ts +2 -2
- package/src/lib/format_directory.ts +2 -2
- package/src/lib/gen.task.ts +19 -19
- package/src/lib/gen.ts +85 -85
- package/src/lib/gen_helpers.ts +17 -17
- package/src/lib/github.ts +6 -6
- package/src/lib/gro.config.default.ts +2 -2
- package/src/lib/gro_config.ts +28 -28
- package/src/lib/gro_helpers.ts +2 -2
- package/src/lib/gro_plugin_gen.ts +5 -5
- package/src/lib/gro_plugin_server.ts +8 -8
- package/src/lib/gro_plugin_sveltekit_app.ts +15 -15
- package/src/lib/gro_plugin_sveltekit_library.ts +6 -6
- package/src/lib/index.ts +3 -3
- package/src/lib/input_path.ts +56 -56
- package/src/lib/invoke.ts +2 -2
- package/src/lib/invoke_task.ts +7 -7
- package/src/lib/lint.task.ts +2 -2
- package/src/lib/modules.ts +31 -31
- package/src/lib/package_json.ts +27 -27
- package/src/lib/parse_exports.ts +15 -15
- package/src/lib/parse_exports_context.ts +9 -9
- package/src/lib/parse_imports.ts +6 -6
- package/src/lib/paths.ts +6 -6
- package/src/lib/plugin.ts +17 -17
- package/src/lib/publish.task.ts +13 -13
- package/src/lib/reinstall.task.ts +4 -4
- package/src/lib/resolve_specifier.ts +5 -5
- package/src/lib/run.task.ts +28 -17
- package/src/lib/run_gen.ts +14 -14
- package/src/lib/run_task.ts +8 -8
- package/src/lib/search_fs.ts +13 -13
- package/src/lib/src_json.ts +13 -13
- package/src/lib/svelte_config.ts +2 -2
- package/src/lib/sveltekit_helpers.ts +12 -12
- package/src/lib/sveltekit_shim_app.ts +3 -3
- package/src/lib/sync.task.ts +2 -2
- package/src/lib/task.ts +63 -63
- package/src/lib/task_logging.ts +11 -11
- package/src/lib/test.task.ts +4 -4
- package/src/lib/typecheck.task.ts +4 -4
- package/src/lib/upgrade.task.ts +7 -7
- package/src/lib/watch_dir.ts +10 -10
package/dist/publish.task.js
CHANGED
|
@@ -2,8 +2,8 @@ import { spawn } from '@ryanatkn/belt/process.js';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { styleText as st } from 'node:util';
|
|
4
4
|
import { existsSync } from 'node:fs';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { GitBranch, GitOrigin, git_check_clean_workspace, git_checkout, git_fetch, git_pull, } from '@ryanatkn/belt/git.js';
|
|
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";
|
|
9
9
|
import { has_sveltekit_library } from "./sveltekit_helpers.js";
|
|
@@ -12,8 +12,8 @@ import { load_from_env } from "./env.js";
|
|
|
12
12
|
import { CHANGESET_CLI } from "./changeset_helpers.js";
|
|
13
13
|
/** @nodocs */
|
|
14
14
|
export const Args = z.strictObject({
|
|
15
|
-
branch:
|
|
16
|
-
origin:
|
|
15
|
+
branch: GitBranch.describe('branch to publish from').default('main'),
|
|
16
|
+
origin: GitOrigin.describe('git origin to publish from').default('origin'),
|
|
17
17
|
changelog: z
|
|
18
18
|
.string()
|
|
19
19
|
.meta({ description: 'file name and path of the changelog' })
|
|
@@ -62,19 +62,19 @@ export const task = {
|
|
|
62
62
|
const package_json = 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
|
-
throw new
|
|
65
|
+
throw new TaskError('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
|
|
66
66
|
}
|
|
67
67
|
const changelog_exists = existsSync(changelog);
|
|
68
68
|
const found_changeset_cli = find_cli(changeset_cli);
|
|
69
69
|
if (!found_changeset_cli) {
|
|
70
|
-
throw new
|
|
70
|
+
throw new TaskError('changeset command not found, install @changesets/cli locally or globally');
|
|
71
71
|
}
|
|
72
72
|
// Make sure we're on the right branch:
|
|
73
73
|
await git_fetch(origin, branch);
|
|
74
74
|
await git_checkout(branch);
|
|
75
75
|
if (pull) {
|
|
76
76
|
if (await git_check_clean_workspace()) {
|
|
77
|
-
throw new
|
|
77
|
+
throw new TaskError('The git workspace is not clean, pass --no-pull to bypass git pull');
|
|
78
78
|
}
|
|
79
79
|
await git_pull(origin, branch);
|
|
80
80
|
}
|
|
@@ -102,11 +102,11 @@ export const task = {
|
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
104
|
if (typeof package_json.version !== 'string') {
|
|
105
|
-
throw new
|
|
105
|
+
throw new TaskError('Failed to find package.json version');
|
|
106
106
|
}
|
|
107
107
|
const parsed_repo_url = parse_repo_url(package_json);
|
|
108
108
|
if (!parsed_repo_url) {
|
|
109
|
-
throw new
|
|
109
|
+
throw new TaskError('package.json `repository` must contain a repo url (and GitHub only for now, sorry),' +
|
|
110
110
|
' like `git+https://github.com/ryanatkn/gro.git` or `https://github.com/ryanatkn/gro`' +
|
|
111
111
|
' or an object with the `url` key');
|
|
112
112
|
}
|
|
@@ -126,7 +126,7 @@ export const task = {
|
|
|
126
126
|
if (install) {
|
|
127
127
|
const install_result = await spawn(config.pm_cli, ['install']);
|
|
128
128
|
if (!install_result.ok) {
|
|
129
|
-
throw new
|
|
129
|
+
throw new TaskError(`Failed \`${config.pm_cli} install\` after version bump`);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
// Regenerate files that depend on package.json version.
|
|
@@ -142,7 +142,7 @@ export const task = {
|
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
// Doesn't build if the version didn't change and publishing isn't optional.
|
|
145
|
-
throw new
|
|
145
|
+
throw new TaskError(`\`${changeset_cli} version\` failed: are there any changes?`);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -164,7 +164,7 @@ export const task = {
|
|
|
164
164
|
}
|
|
165
165
|
const changeset_publish_result = await spawn_cli(found_changeset_cli, ['publish'], log);
|
|
166
166
|
if (!changeset_publish_result?.ok) {
|
|
167
|
-
throw new
|
|
167
|
+
throw new TaskError(`\`${changeset_cli} publish\` failed - continue manually or try again after running \`git reset --hard\``);
|
|
168
168
|
}
|
|
169
169
|
if (!changelog_exists && existsSync(changelog)) {
|
|
170
170
|
await spawn('git', ['add', changelog]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reinstall.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/reinstall.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,
|
|
1
|
+
{"version":3,"file":"reinstall.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/reinstall.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAG/C,cAAc;AACd,eAAO,MAAM,IAAI,iCAAqB,CAAC;AACvC,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAgC3B,CAAC"}
|
package/dist/reinstall.task.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { spawn } from '@ryanatkn/belt/process.js';
|
|
3
3
|
import { rm } from 'node:fs/promises';
|
|
4
|
-
import {
|
|
4
|
+
import { TaskError } from "./task.js";
|
|
5
5
|
import { LOCKFILE_FILENAME, NODE_MODULES_DIRNAME } from "./constants.js";
|
|
6
6
|
/** @nodocs */
|
|
7
7
|
export const Args = z.strictObject({});
|
|
@@ -13,14 +13,14 @@ export const task = {
|
|
|
13
13
|
log.info(`running the initial \`${config.pm_cli} install\``);
|
|
14
14
|
const initial_install_result = await spawn(config.pm_cli, ['install']);
|
|
15
15
|
if (!initial_install_result.ok) {
|
|
16
|
-
throw new
|
|
16
|
+
throw new TaskError(`Failed initial \`${config.pm_cli} install\``);
|
|
17
17
|
}
|
|
18
18
|
// Deleting both the lockfile and node_modules upgrades to the latest minor/patch versions.
|
|
19
19
|
await Promise.all([rm(LOCKFILE_FILENAME), rm(NODE_MODULES_DIRNAME, { recursive: true })]);
|
|
20
20
|
log.info(`running \`${config.pm_cli} install\` after deleting ${LOCKFILE_FILENAME} and ${NODE_MODULES_DIRNAME}, this can take a while...`);
|
|
21
21
|
const second_install_result = await spawn(config.pm_cli, ['install']);
|
|
22
22
|
if (!second_install_result.ok) {
|
|
23
|
-
throw new
|
|
23
|
+
throw new TaskError(`Failed \`${config.pm_cli} install\` after deleting ${LOCKFILE_FILENAME} and ${NODE_MODULES_DIRNAME}`);
|
|
24
24
|
}
|
|
25
25
|
// TODO @many this relies on npm behavior that changed in v11
|
|
26
26
|
// Deleting the lockfile and reinstalling cleans the lockfile of unnecessary dep noise,
|
|
@@ -29,7 +29,7 @@ export const task = {
|
|
|
29
29
|
log.info(`running \`${config.pm_cli} install\` one last time to clean ${LOCKFILE_FILENAME}`);
|
|
30
30
|
const final_install_result = await spawn(config.pm_cli, ['install']);
|
|
31
31
|
if (!final_install_result.ok) {
|
|
32
|
-
throw new
|
|
32
|
+
throw new TaskError(`Failed \`${config.pm_cli} install\``);
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface
|
|
1
|
+
import type { PathId } from '@ryanatkn/belt/path.js';
|
|
2
|
+
export interface ResolvedSpecifier {
|
|
3
3
|
/**
|
|
4
4
|
* The resolved filesystem path for the specifier.
|
|
5
5
|
*/
|
|
6
|
-
path_id:
|
|
6
|
+
path_id: PathId;
|
|
7
7
|
/**
|
|
8
8
|
* Same as `path_id` but includes `?raw` and other querystrings. (currently none)
|
|
9
9
|
*/
|
|
@@ -18,5 +18,5 @@ export interface Resolved_Specifier {
|
|
|
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) =>
|
|
21
|
+
export declare const resolve_specifier: (specifier: string, dir: string) => 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,
|
|
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,wBAAwB,CAAC;AAMnD,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,GAAI,WAAW,MAAM,EAAE,KAAK,MAAM,KAAG,iBAgDlE,CAAC"}
|
package/dist/run.task.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { type Task } from './task.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Runs a TypeScript file with Gro's loader, forwarding all args to the script.
|
|
5
|
+
* Useful for scripts that need SvelteKit shims ($lib, $env, etc).
|
|
6
|
+
*/
|
|
3
7
|
/** @nodocs */
|
|
4
8
|
export declare const Args: z.ZodObject<{
|
|
5
9
|
_: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
6
|
-
}, z.core.$
|
|
10
|
+
}, z.core.$catchall<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
7
11
|
export type Args = z.infer<typeof Args>;
|
|
8
12
|
/** @nodocs */
|
|
9
13
|
export declare const task: Task<Args>;
|
package/dist/run.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,
|
|
1
|
+
{"version":3,"file":"run.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAI/C;;;GAGG;AAEH,cAAc;AACd,eAAO,MAAM,IAAI;;8JAWf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA2B3B,CAAC"}
|
package/dist/run.task.js
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { styleText as st } from 'node:util';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
|
-
import {
|
|
4
|
+
import { TaskError } from "./task.js";
|
|
5
5
|
import { resolve_gro_module_path, spawn_with_loader } from "./gro_helpers.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import { serialize_args } from "./args.js";
|
|
7
|
+
/**
|
|
8
|
+
* Runs a TypeScript file with Gro's loader, forwarding all args to the script.
|
|
9
|
+
* Useful for scripts that need SvelteKit shims ($lib, $env, etc).
|
|
10
|
+
*/
|
|
9
11
|
/** @nodocs */
|
|
10
|
-
export const Args = z
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export const Args = z
|
|
13
|
+
.object({
|
|
14
|
+
_: z.array(z.string()).meta({ description: 'the file path to run' }).default([]),
|
|
15
|
+
})
|
|
16
|
+
.catchall(z.union([
|
|
17
|
+
z.string(),
|
|
18
|
+
z.number(),
|
|
19
|
+
z.boolean(),
|
|
20
|
+
z.array(z.union([z.string(), z.number(), z.boolean()])),
|
|
21
|
+
]));
|
|
16
22
|
/** @nodocs */
|
|
17
23
|
export const task = {
|
|
18
24
|
summary: 'execute a file with the loader, like `node` but works for TypeScript',
|
|
19
25
|
Args,
|
|
20
26
|
run: async ({ args, log }) => {
|
|
21
|
-
const { _
|
|
27
|
+
const { _, ...forwarded_args } = args;
|
|
28
|
+
const [path, ...positional_argv] = _;
|
|
22
29
|
if (!path) {
|
|
23
|
-
log.info(st('green', '\n\nUsage: ') + st('cyan', 'gro run path/to/file.ts [...
|
|
30
|
+
log.info(st('green', '\n\nUsage: ') + st('cyan', 'gro run path/to/file.ts [...args]\n'));
|
|
24
31
|
return;
|
|
25
32
|
}
|
|
26
33
|
if (!existsSync(path)) {
|
|
27
|
-
throw new
|
|
34
|
+
throw new TaskError('Cannot find file to run at path: ' + path);
|
|
28
35
|
}
|
|
36
|
+
// Reconstruct argv: positional args + serialized named args
|
|
37
|
+
const named_argv = serialize_args(forwarded_args);
|
|
38
|
+
const full_argv = [...positional_argv, ...named_argv];
|
|
29
39
|
const loader_path = resolve_gro_module_path('loader.js');
|
|
30
|
-
const spawned = await spawn_with_loader(loader_path, path,
|
|
40
|
+
const spawned = await spawn_with_loader(loader_path, path, full_argv);
|
|
31
41
|
if (!spawned.ok) {
|
|
32
|
-
throw new
|
|
42
|
+
throw new TaskError(`\`gro run ${path}\` failed with exit code ${spawned.code}`);
|
|
33
43
|
}
|
|
34
44
|
},
|
|
35
45
|
};
|
package/dist/run_gen.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Timings } from '@ryanatkn/belt/timings.js';
|
|
2
2
|
import type { Logger } from '@ryanatkn/belt/log.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type GenResults, type GenfileModuleMeta } from './gen.ts';
|
|
4
4
|
import type { format_file as base_format_file } from './format_file.ts';
|
|
5
|
-
import type {
|
|
5
|
+
import type { GroConfig } from './gro_config.ts';
|
|
6
6
|
import type { Filer } from './filer.ts';
|
|
7
|
-
import type {
|
|
7
|
+
import type { InvokeTask } from './task.ts';
|
|
8
8
|
export declare const GEN_NO_PROD_MESSAGE = "gen runs only during development";
|
|
9
|
-
export declare const run_gen: (gen_modules: Array<
|
|
9
|
+
export declare const run_gen: (gen_modules: Array<GenfileModuleMeta>, config: GroConfig, filer: Filer, log: Logger, timings: Timings, invoke_task: InvokeTask, format_file?: typeof base_format_file) => Promise<GenResults>;
|
|
10
10
|
//# sourceMappingURL=run_gen.d.ts.map
|
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,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,EACN,KAAK,
|
|
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,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,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,CAyEpB,CAAC"}
|
package/dist/run_task.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import type { Timings } from '@ryanatkn/belt/timings.js';
|
|
|
2
2
|
import type { Logger } from '@ryanatkn/belt/log.js';
|
|
3
3
|
import { type Args } from './args.ts';
|
|
4
4
|
import type { invoke_task as base_invoke_task } from './invoke_task.ts';
|
|
5
|
-
import type {
|
|
6
|
-
import { type
|
|
5
|
+
import type { GroConfig } from './gro_config.ts';
|
|
6
|
+
import { type TaskModuleMeta } from './task.ts';
|
|
7
7
|
import type { Filer } from './filer.ts';
|
|
8
|
-
export type
|
|
8
|
+
export type RunTaskResult = {
|
|
9
9
|
ok: true;
|
|
10
10
|
output: unknown;
|
|
11
11
|
} | {
|
|
@@ -13,5 +13,5 @@ export type Run_Task_Result = {
|
|
|
13
13
|
reason: string;
|
|
14
14
|
error: Error;
|
|
15
15
|
};
|
|
16
|
-
export declare const run_task: (task_meta:
|
|
16
|
+
export declare const run_task: (task_meta: TaskModuleMeta, unparsed_args: Args, invoke_task: typeof base_invoke_task, config: GroConfig, filer: Filer, log: Logger, timings: Timings) => Promise<RunTaskResult>;
|
|
17
17
|
//# sourceMappingURL=run_task.d.ts.map
|
package/dist/run_task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run_task.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAC,WAAW,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAEtE,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"run_task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run_task.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAGlD,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAC,WAAW,IAAI,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAEtE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAY,KAAK,cAAc,EAAC,MAAM,WAAW,CAAC;AAEzD,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAEtC,MAAM,MAAM,aAAa,GACtB;IACA,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,OAAO,CAAC;CACf,GACD;IACA,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;CACZ,CAAC;AAEL,eAAO,MAAM,QAAQ,GACpB,WAAW,cAAc,EACzB,eAAe,IAAI,EACnB,aAAa,OAAO,gBAAgB,EACpC,QAAQ,SAAS,EACjB,OAAO,KAAK,EACZ,KAAK,MAAM,EACX,SAAS,OAAO,KACd,OAAO,CAAC,aAAa,CAiDvB,CAAC"}
|
package/dist/run_task.js
CHANGED
|
@@ -2,7 +2,7 @@ import { styleText as st } from 'node:util';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { parse_args } from "./args.js";
|
|
4
4
|
import { log_task_help } from "./task_logging.js";
|
|
5
|
-
import {
|
|
5
|
+
import { TaskError } from "./task.js";
|
|
6
6
|
import { default_svelte_config } from "./svelte_config.js";
|
|
7
7
|
export const run_task = async (task_meta, unparsed_args, invoke_task, config, filer, log, timings) => {
|
|
8
8
|
const { task } = task_meta.mod;
|
|
@@ -15,7 +15,7 @@ export const run_task = async (task_meta, unparsed_args, invoke_task, config, fi
|
|
|
15
15
|
if (task.Args) {
|
|
16
16
|
const parsed = parse_args(unparsed_args, task.Args);
|
|
17
17
|
if (!parsed.success) {
|
|
18
|
-
throw new
|
|
18
|
+
throw new TaskError(`Failed task args validation for task '${task_meta.name}':\n${z.prettifyError(parsed.error)}`);
|
|
19
19
|
}
|
|
20
20
|
args = parsed.data;
|
|
21
21
|
}
|
|
@@ -35,7 +35,7 @@ export const run_task = async (task_meta, unparsed_args, invoke_task, config, fi
|
|
|
35
35
|
catch (err) {
|
|
36
36
|
return {
|
|
37
37
|
ok: false,
|
|
38
|
-
reason: st('red', err?.constructor?.name === '
|
|
38
|
+
reason: st('red', err?.constructor?.name === 'TaskError'
|
|
39
39
|
? err.message
|
|
40
40
|
: `Unexpected error running task ${st('cyan', task_meta.name)}. If this is unexpected try running \`${config.pm_cli} install\` and \`gro clean\`.`),
|
|
41
41
|
error: err,
|
package/dist/search_fs.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface
|
|
1
|
+
import type { FileFilter, ResolvedPath, PathFilter } from '@ryanatkn/belt/path.js';
|
|
2
|
+
export interface SearchFsOptions {
|
|
3
3
|
/**
|
|
4
4
|
* One or more filter functions, any of which can short-circuit the search by returning `false`.
|
|
5
5
|
*/
|
|
6
|
-
filter?:
|
|
6
|
+
filter?: PathFilter | Array<PathFilter>;
|
|
7
7
|
/**
|
|
8
8
|
* One or more file filter functions. Every filter must pass for a file to be included.
|
|
9
9
|
*/
|
|
10
|
-
file_filter?:
|
|
10
|
+
file_filter?: FileFilter | Array<FileFilter>;
|
|
11
11
|
/**
|
|
12
12
|
* Pass `null` or `false` to speed things up at the cost of volatile ordering.
|
|
13
13
|
*/
|
|
14
|
-
sort?: boolean | null | ((a:
|
|
14
|
+
sort?: boolean | null | ((a: ResolvedPath, b: ResolvedPath) => number);
|
|
15
15
|
/**
|
|
16
16
|
* Set to `true` to include directories. Defaults to `false`.
|
|
17
17
|
*/
|
|
@@ -21,6 +21,6 @@ export interface Search_Fs_Options {
|
|
|
21
21
|
*/
|
|
22
22
|
cwd?: string | null;
|
|
23
23
|
}
|
|
24
|
-
export declare const search_fs: (dir: string, options?:
|
|
24
|
+
export declare const search_fs: (dir: string, options?: SearchFsOptions) => Array<ResolvedPath>;
|
|
25
25
|
export declare const find_first_existing_file: (paths: Array<string>) => string | null;
|
|
26
26
|
//# sourceMappingURL=search_fs.d.ts.map
|
package/dist/search_fs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_fs.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/search_fs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"search_fs.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/search_fs.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,UAAU,EAAE,YAAY,EAAE,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAEjF,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC;;OAEG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IAC7C;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,KAAK,MAAM,CAAC,CAAC;IACvE;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,GACrB,KAAK,MAAM,EACX,UAAS,eAA8B,KACrC,KAAK,CAAC,YAAY,CAwBpB,CAAC;AAmCF,eAAO,MAAM,wBAAwB,GAAI,OAAO,KAAK,CAAC,MAAM,CAAC,KAAG,MAAM,GAAG,IAOxE,CAAC"}
|
package/dist/src_json.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { PackageJson, PackageJsonExports } from '@ryanatkn/belt/package_json.js';
|
|
2
|
+
import { SrcJson, type ModuleJson } from '@ryanatkn/belt/src_json.js';
|
|
3
3
|
import type { Logger } from '@ryanatkn/belt/log.js';
|
|
4
|
-
export type
|
|
5
|
-
export declare const src_json_create: (package_json:
|
|
6
|
-
export declare const src_json_serialize: (src_json:
|
|
7
|
-
export declare const src_modules_create: (exports:
|
|
4
|
+
export type SrcJsonMapper = (src_json: SrcJson) => SrcJson | null | Promise<SrcJson | null>;
|
|
5
|
+
export declare const src_json_create: (package_json: PackageJson, lib_path?: string, log?: Logger) => SrcJson;
|
|
6
|
+
export declare const src_json_serialize: (src_json: SrcJson) => string;
|
|
7
|
+
export declare const src_modules_create: (exports: PackageJsonExports | undefined, lib_path?: string, log?: Logger) => Array<ModuleJson> | undefined;
|
|
8
8
|
//# sourceMappingURL=src_json.d.ts.map
|
package/dist/src_json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"src_json.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/src_json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"src_json.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/src_json.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAC,OAAO,EAAE,KAAK,UAAU,EAAsB,MAAM,4BAA4B,CAAC;AACzF,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAOlD,MAAM,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;AAE5F,eAAO,MAAM,eAAe,GAC3B,cAAc,WAAW,EACzB,WAAW,MAAM,EACjB,MAAM,MAAM,KACV,OAKA,CAAC;AAEJ,eAAO,MAAM,kBAAkB,GAAI,UAAU,OAAO,KAAG,MAGtD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC9B,SAAS,kBAAkB,GAAG,SAAS,EACvC,iBAAoB,EACpB,MAAM,MAAM,KACV,KAAK,CAAC,UAAU,CAAC,GAAG,SAgDtB,CAAC"}
|
package/dist/src_json.js
CHANGED
|
@@ -2,18 +2,18 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { ensure_end, strip_start } from '@ryanatkn/belt/string.js';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import ts from 'typescript';
|
|
5
|
-
import {
|
|
5
|
+
import { SrcJson } from '@ryanatkn/belt/src_json.js';
|
|
6
6
|
import { paths, replace_extension } from "./paths.js";
|
|
7
7
|
import { parse_exports } from "./parse_exports.js";
|
|
8
8
|
import { TS_MATCHER, SVELTE_MATCHER, JSON_MATCHER, CSS_MATCHER } from "./constants.js";
|
|
9
9
|
import { search_fs } from "./search_fs.js";
|
|
10
|
-
export const src_json_create = (package_json, lib_path, log) =>
|
|
10
|
+
export const src_json_create = (package_json, lib_path, log) => SrcJson.parse({
|
|
11
11
|
name: package_json.name,
|
|
12
12
|
version: package_json.version,
|
|
13
13
|
modules: src_modules_create(package_json.exports, lib_path, log),
|
|
14
14
|
});
|
|
15
15
|
export const src_json_serialize = (src_json) => {
|
|
16
|
-
const parsed =
|
|
16
|
+
const parsed = SrcJson.parse(src_json);
|
|
17
17
|
return JSON.stringify(parsed, null, 2) + '\n';
|
|
18
18
|
};
|
|
19
19
|
export const src_modules_create = (exports, lib_path = paths.lib, log) => {
|
package/dist/svelte_config.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const load_svelte_config: ({ dir, config_filename, }?: {
|
|
|
16
16
|
* The `base` and `assets` in particular are renamed for clarity with Gro's internal systems,
|
|
17
17
|
* so these properties become first-class vocabulary inside Gro.
|
|
18
18
|
*/
|
|
19
|
-
export interface
|
|
19
|
+
export interface ParsedSvelteConfig {
|
|
20
20
|
svelte_config: SvelteConfig | null;
|
|
21
21
|
alias: Record<string, string>;
|
|
22
22
|
base_url: '' | `/${string}` | undefined;
|
|
@@ -48,10 +48,10 @@ export interface Parsed_Svelte_Config {
|
|
|
48
48
|
export declare const parse_svelte_config: ({ dir_or_config, config_filename, }?: {
|
|
49
49
|
dir_or_config?: string | SvelteConfig;
|
|
50
50
|
config_filename?: string;
|
|
51
|
-
}) => Promise<
|
|
51
|
+
}) => Promise<ParsedSvelteConfig>;
|
|
52
52
|
export declare const to_default_compile_module_options: ({ dev, generate, filename, rootDir, warningFilter, }: CompileOptions) => ModuleCompileOptions;
|
|
53
53
|
/**
|
|
54
54
|
* The parsed SvelteKit config for the cwd, cached globally at the module level.
|
|
55
55
|
*/
|
|
56
|
-
export declare const default_svelte_config:
|
|
56
|
+
export declare const default_svelte_config: ParsedSvelteConfig;
|
|
57
57
|
//# sourceMappingURL=svelte_config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svelte_config.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/svelte_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,IAAI,YAAY,EAAC,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAC,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAe7F;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAU,4BAGtC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAgB,KAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAMvF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"svelte_config.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/svelte_config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,IAAI,YAAY,EAAC,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAC,cAAc,EAAE,oBAAoB,EAAE,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAe7F;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAU,4BAGtC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAgB,KAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAMvF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IAElC,aAAa,EAAE,YAAY,GAAG,IAAI,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,EAAE,GAAG,IAAI,MAAM,EAAE,GAAG,SAAS,CAAC;IACxC,UAAU,EAAE,EAAE,GAAG,UAAU,MAAM,EAAE,GAAG,WAAW,MAAM,EAAE,GAAG,SAAS,CAAC;IAGtE;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,sBAAsB,EAAE,cAAc,CAAC;IACvC,6BAA6B,EAAE,oBAAoB,CAAC;IACpD,oBAAoB,EAAE,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;CAC/E;AAGD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAU,sCAGvC;IACF,aAAa,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC;CACV,KAAG,OAAO,CAAC,kBAAkB,CA8C5C,CAAC;AAEF,eAAO,MAAM,iCAAiC,GAAI,sDAM/C,cAAc,KAAG,oBAA2E,CAAC;AAEhG;;GAEG;AACH,eAAO,MAAM,qBAAqB,oBAA8B,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Result } from '@ryanatkn/belt/result.js';
|
|
2
2
|
import type { Logger } from '@ryanatkn/belt/log.js';
|
|
3
|
-
import type {
|
|
4
|
-
import { type
|
|
3
|
+
import type { PackageJson } from '@ryanatkn/belt/package_json.js';
|
|
4
|
+
import { type ParsedSvelteConfig } from './svelte_config.ts';
|
|
5
5
|
import { type Cli } from './cli.ts';
|
|
6
6
|
export declare const has_sveltekit_app: (svelte_config_path?: string) => Promise<Result<object, {
|
|
7
7
|
message: string;
|
|
8
8
|
}>>;
|
|
9
|
-
export declare const has_sveltekit_library: (package_json:
|
|
9
|
+
export declare const has_sveltekit_library: (package_json: PackageJson, svelte_config?: ParsedSvelteConfig, dep_name?: string) => Promise<Result<object, {
|
|
10
10
|
message: string;
|
|
11
11
|
}>>;
|
|
12
12
|
export declare const sveltekit_sync: (sveltekit_cli?: string | Cli, pm_cli?: string) => Promise<void>;
|
|
@@ -22,7 +22,7 @@ export declare const sveltekit_sync_if_obviously_needed: (sveltekit_cli?: string
|
|
|
22
22
|
* Options to the SvelteKit packaging CLI.
|
|
23
23
|
* @see https://kit.svelte.dev/docs/packaging#options
|
|
24
24
|
*/
|
|
25
|
-
export interface
|
|
25
|
+
export interface SveltePackageOptions {
|
|
26
26
|
/**
|
|
27
27
|
* Watch files in src/lib for changes and rebuild the package
|
|
28
28
|
*/
|
|
@@ -67,7 +67,7 @@ export interface Svelte_Package_Options {
|
|
|
67
67
|
*/
|
|
68
68
|
tsconfig?: string;
|
|
69
69
|
}
|
|
70
|
-
export declare const run_svelte_package: (package_json:
|
|
70
|
+
export declare const run_svelte_package: (package_json: PackageJson, options: SveltePackageOptions | undefined, cli: string | Cli, log: Logger, pm_cli: string) => Promise<void>;
|
|
71
71
|
/**
|
|
72
72
|
* Map an import specifier with the SvelteKit aliases.
|
|
73
73
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sveltekit_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"sveltekit_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gCAAgC,CAAC;AAIhE,OAAO,EAAwB,KAAK,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAQlF,OAAO,EAAmC,KAAK,GAAG,EAAC,MAAM,UAAU,CAAC;AAIpE,eAAO,MAAM,iBAAiB,GAC7B,qBAAoB,MAA+B,KACjD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAC,CAM3C,CAAC;AAEF,eAAO,MAAM,qBAAqB,GACjC,cAAc,WAAW,EACzB,gBAAe,kBAA0C,EACzD,iBAAkC,KAChC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAC,CAkB3C,CAAC;AAEF,eAAO,MAAM,cAAc,GAC1B,gBAAe,MAAM,GAAG,GAAmB,EAC3C,eAAuB,KACrB,OAAO,CAAC,IAAI,CASd,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,2BAA2B,GACvC,gBAAe,MAAM,GAAG,GAAmB,KACzC,OAAO,CAAC,IAAI,CAMd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kCAAkC,GAC9C,gBAAe,MAAM,GAAG,GAAmB,KACzC,OAAO,CAAC,IAAI,CAUd,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACpC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,kBAAkB,GAC9B,cAAc,WAAW,EACzB,SAAS,oBAAoB,GAAG,SAAS,EACzC,KAAK,MAAM,GAAG,GAAG,EACjB,KAAK,MAAM,EACX,QAAQ,MAAM,KACZ,OAAO,CAAC,IAAI,CAmBd,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GACjC,WAAW,MAAM,EACjB,SAAS,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAC9B,MASF,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { has_dep } from "./package_json.js";
|
|
|
4
4
|
import { default_svelte_config } from "./svelte_config.js";
|
|
5
5
|
import { SVELTE_CONFIG_FILENAME, SVELTEKIT_DEV_DIRNAME, PM_CLI_DEFAULT, SVELTE_PACKAGE_DEP_NAME, SVELTEKIT_CLI, } from "./constants.js";
|
|
6
6
|
import { find_cli, spawn_cli, to_cli_name } from "./cli.js";
|
|
7
|
-
import {
|
|
7
|
+
import { TaskError } from "./task.js";
|
|
8
8
|
import { serialize_args, to_forwarded_args } from "./args.js";
|
|
9
9
|
export const has_sveltekit_app = async (svelte_config_path = SVELTE_CONFIG_FILENAME) => {
|
|
10
10
|
if (!(await fs_exists(svelte_config_path))) {
|
|
@@ -32,10 +32,10 @@ export const has_sveltekit_library = async (package_json, svelte_config = defaul
|
|
|
32
32
|
export const sveltekit_sync = async (sveltekit_cli = SVELTEKIT_CLI, pm_cli = PM_CLI_DEFAULT) => {
|
|
33
33
|
const result = await spawn_cli(sveltekit_cli, ['sync']);
|
|
34
34
|
if (!result) {
|
|
35
|
-
throw new
|
|
35
|
+
throw new TaskError(`Failed to find SvelteKit CLI \`${to_cli_name(sveltekit_cli)}\`, do you need to run \`${pm_cli} install\`?`);
|
|
36
36
|
}
|
|
37
37
|
else if (!result.ok) {
|
|
38
|
-
throw new
|
|
38
|
+
throw new TaskError(`Failed ${to_cli_name(sveltekit_cli)} sync`);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
// TODO maybe this shouldn't exist, instead error if `package.json` has SvelteKit but it's not found (with install message above)
|
|
@@ -64,12 +64,12 @@ export const sveltekit_sync_if_obviously_needed = async (sveltekit_cli = SVELTEK
|
|
|
64
64
|
export const run_svelte_package = async (package_json, options, cli, log, pm_cli) => {
|
|
65
65
|
const has_sveltekit_library_result = await has_sveltekit_library(package_json);
|
|
66
66
|
if (!has_sveltekit_library_result.ok) {
|
|
67
|
-
throw new
|
|
67
|
+
throw new TaskError('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
|
|
68
68
|
}
|
|
69
69
|
const cli_name = typeof cli === 'string' ? cli : cli.name;
|
|
70
70
|
const found_svelte_package_cli = cli === cli_name ? find_cli(cli) : cli;
|
|
71
71
|
if (found_svelte_package_cli?.kind !== 'local') {
|
|
72
|
-
throw new
|
|
72
|
+
throw new TaskError(`Failed to find SvelteKit packaging CLI \`${cli_name}\`, do you need to run \`${pm_cli} install\`?`);
|
|
73
73
|
}
|
|
74
74
|
const serialized_args = serialize_args({
|
|
75
75
|
...options,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParsedSvelteConfig } from './svelte_config.ts';
|
|
2
2
|
export declare const SVELTEKIT_SHIM_APP_PATHS_MATCHER: RegExp;
|
|
3
3
|
export declare const SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER: RegExp;
|
|
4
4
|
/**
|
|
@@ -6,6 +6,6 @@ export declare const SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER: RegExp;
|
|
|
6
6
|
* @see https://kit.svelte.dev/docs/modules
|
|
7
7
|
*/
|
|
8
8
|
export declare const sveltekit_shim_app_specifiers: Map<string, string>;
|
|
9
|
-
export declare const render_sveltekit_shim_app_paths: (base_url?:
|
|
9
|
+
export declare const render_sveltekit_shim_app_paths: (base_url?: ParsedSvelteConfig["base_url"], assets_url?: ParsedSvelteConfig["assets_url"]) => string;
|
|
10
10
|
export declare const render_sveltekit_shim_app_environment: (dev: boolean) => string;
|
|
11
11
|
//# sourceMappingURL=sveltekit_shim_app.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sveltekit_shim_app.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_app.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAE3D,eAAO,MAAM,gCAAgC,QAA0C,CAAC;AACxF,eAAO,MAAM,sCAAsC,QAAgD,CAAC;AAEpG;;;GAGG;AACH,eAAO,MAAM,6BAA6B,qBAMxC,CAAC;AAEH,eAAO,MAAM,+BAA+B,GAC3C,WAAU,kBAAkB,CAAC,UAAU,CAAM,EAC7C,aAAY,kBAAkB,CAAC,YAAY,CAAM,KAC/C,MAKF,CAAC;AAMF,eAAO,MAAM,qCAAqC,GACjD,KAAK,OAAO,KACV,MAOF,CAAC"}
|
package/dist/sync.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sync.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,
|
|
1
|
+
{"version":3,"file":"sync.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sync.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAI/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;;;;kBAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA0B3B,CAAC"}
|
package/dist/sync.task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { spawn } from '@ryanatkn/belt/process.js';
|
|
3
|
-
import {
|
|
3
|
+
import { TaskError } from "./task.js";
|
|
4
4
|
import { sync_package_json } from "./package_json.js";
|
|
5
5
|
import { sveltekit_sync } from "./sveltekit_helpers.js";
|
|
6
6
|
/** @nodocs */
|
|
@@ -22,7 +22,7 @@ export const task = {
|
|
|
22
22
|
if (install) {
|
|
23
23
|
const result = await spawn(config.pm_cli, ['install']);
|
|
24
24
|
if (!result.ok) {
|
|
25
|
-
throw new
|
|
25
|
+
throw new TaskError(`Failed \`${config.pm_cli} install\``);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
if (sveltekit) {
|