@fuzdev/gro 0.192.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/LICENSE +21 -0
- package/README.md +283 -0
- package/dist/args.d.ts +37 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +102 -0
- package/dist/build.task.d.ts +20 -0
- package/dist/build.task.d.ts.map +1 -0
- package/dist/build.task.js +119 -0
- package/dist/build_cache.d.ts +100 -0
- package/dist/build_cache.d.ts.map +1 -0
- package/dist/build_cache.js +299 -0
- package/dist/changelog.d.ts +11 -0
- package/dist/changelog.d.ts.map +1 -0
- package/dist/changelog.js +47 -0
- package/dist/changeset.task.d.ts +35 -0
- package/dist/changeset.task.d.ts.map +1 -0
- package/dist/changeset.task.js +151 -0
- package/dist/changeset_helpers.d.ts +17 -0
- package/dist/changeset_helpers.d.ts.map +1 -0
- package/dist/changeset_helpers.js +7 -0
- package/dist/check.task.d.ts +28 -0
- package/dist/check.task.d.ts.map +1 -0
- package/dist/check.task.js +104 -0
- package/dist/child_process_logging.d.ts +10 -0
- package/dist/child_process_logging.d.ts.map +1 -0
- package/dist/child_process_logging.js +26 -0
- package/dist/clean.task.d.ts +15 -0
- package/dist/clean.task.d.ts.map +1 -0
- package/dist/clean.task.js +40 -0
- package/dist/clean_fs.d.ts +9 -0
- package/dist/clean_fs.d.ts.map +1 -0
- package/dist/clean_fs.js +28 -0
- package/dist/cli.d.ts +34 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +61 -0
- package/dist/commit.task.d.ts +11 -0
- package/dist/commit.task.d.ts.map +1 -0
- package/dist/commit.task.js +24 -0
- package/dist/constants.d.ts +46 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +52 -0
- package/dist/deploy.task.d.ts +29 -0
- package/dist/deploy.task.d.ts.map +1 -0
- package/dist/deploy.task.js +217 -0
- package/dist/dev.task.d.ts +16 -0
- package/dist/dev.task.d.ts.map +1 -0
- package/dist/dev.task.js +44 -0
- package/dist/disknode.d.ts +23 -0
- package/dist/disknode.d.ts.map +1 -0
- package/dist/disknode.js +1 -0
- package/dist/env.d.ts +11 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +49 -0
- package/dist/esbuild_helpers.d.ts +16 -0
- package/dist/esbuild_helpers.d.ts.map +1 -0
- package/dist/esbuild_helpers.js +36 -0
- package/dist/esbuild_plugin_external_worker.d.ts +23 -0
- package/dist/esbuild_plugin_external_worker.d.ts.map +1 -0
- package/dist/esbuild_plugin_external_worker.js +55 -0
- package/dist/esbuild_plugin_svelte.d.ts +15 -0
- package/dist/esbuild_plugin_svelte.d.ts.map +1 -0
- package/dist/esbuild_plugin_svelte.js +83 -0
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts +8 -0
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts.map +1 -0
- package/dist/esbuild_plugin_sveltekit_local_imports.js +30 -0
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts +7 -0
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +1 -0
- package/dist/esbuild_plugin_sveltekit_shim_alias.js +18 -0
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts +9 -0
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +1 -0
- package/dist/esbuild_plugin_sveltekit_shim_app.js +22 -0
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +11 -0
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +1 -0
- package/dist/esbuild_plugin_sveltekit_shim_env.js +18 -0
- package/dist/filer.d.ts +33 -0
- package/dist/filer.d.ts.map +1 -0
- package/dist/filer.js +385 -0
- package/dist/format.task.d.ts +11 -0
- package/dist/format.task.d.ts.map +1 -0
- package/dist/format.task.js +27 -0
- package/dist/format_directory.d.ts +13 -0
- package/dist/format_directory.d.ts.map +1 -0
- package/dist/format_directory.js +40 -0
- package/dist/format_file.d.ts +9 -0
- package/dist/format_file.d.ts.map +1 -0
- package/dist/format_file.js +42 -0
- package/dist/gen.d.ts +142 -0
- package/dist/gen.d.ts.map +1 -0
- package/dist/gen.js +199 -0
- package/dist/gen.task.d.ts +12 -0
- package/dist/gen.task.d.ts.map +1 -0
- package/dist/gen.task.js +149 -0
- package/dist/gen_helpers.d.ts +11 -0
- package/dist/gen_helpers.d.ts.map +1 -0
- package/dist/gen_helpers.js +76 -0
- package/dist/github.d.ts +19 -0
- package/dist/github.d.ts.map +1 -0
- package/dist/github.js +33 -0
- package/dist/gro.config.default.d.ts +13 -0
- package/dist/gro.config.default.d.ts.map +1 -0
- package/dist/gro.config.default.js +33 -0
- package/dist/gro.d.ts +3 -0
- package/dist/gro.d.ts.map +1 -0
- package/dist/gro.js +21 -0
- package/dist/gro_config.d.ts +115 -0
- package/dist/gro_config.d.ts.map +1 -0
- package/dist/gro_config.js +114 -0
- package/dist/gro_helpers.d.ts +49 -0
- package/dist/gro_helpers.d.ts.map +1 -0
- package/dist/gro_helpers.js +97 -0
- package/dist/gro_plugin_gen.d.ts +12 -0
- package/dist/gro_plugin_gen.d.ts.map +1 -0
- package/dist/gro_plugin_gen.js +101 -0
- package/dist/gro_plugin_server.d.ts +80 -0
- package/dist/gro_plugin_server.d.ts.map +1 -0
- package/dist/gro_plugin_server.js +167 -0
- package/dist/gro_plugin_sveltekit_app.d.ts +9 -0
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -0
- package/dist/gro_plugin_sveltekit_app.js +42 -0
- package/dist/gro_plugin_sveltekit_library.d.ts +16 -0
- package/dist/gro_plugin_sveltekit_library.d.ts.map +1 -0
- package/dist/gro_plugin_sveltekit_library.js +34 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/input_path.d.ts +64 -0
- package/dist/input_path.d.ts.map +1 -0
- package/dist/input_path.js +199 -0
- package/dist/invoke.d.ts +2 -0
- package/dist/invoke.d.ts.map +1 -0
- package/dist/invoke.js +28 -0
- package/dist/invoke_task.d.ts +30 -0
- package/dist/invoke_task.d.ts.map +1 -0
- package/dist/invoke_task.js +104 -0
- package/dist/lint.task.d.ts +11 -0
- package/dist/lint.task.d.ts.map +1 -0
- package/dist/lint.task.js +32 -0
- package/dist/loader.d.ts +6 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +192 -0
- package/dist/module.d.ts +4 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +6 -0
- package/dist/modules.d.ts +36 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +71 -0
- package/dist/package_json.d.ts +32 -0
- package/dist/package_json.d.ts.map +1 -0
- package/dist/package_json.js +178 -0
- package/dist/parse_exports.d.ts +20 -0
- package/dist/parse_exports.d.ts.map +1 -0
- package/dist/parse_exports.js +65 -0
- package/dist/parse_exports_context.d.ts +21 -0
- package/dist/parse_exports_context.d.ts.map +1 -0
- package/dist/parse_exports_context.js +332 -0
- package/dist/parse_imports.d.ts +5 -0
- package/dist/parse_imports.d.ts.map +1 -0
- package/dist/parse_imports.js +140 -0
- package/dist/paths.d.ts +41 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +69 -0
- package/dist/plugin.d.ts +36 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +78 -0
- package/dist/publish.task.d.ts +26 -0
- package/dist/publish.task.d.ts.map +1 -0
- package/dist/publish.task.js +176 -0
- package/dist/register.d.ts +2 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +2 -0
- package/dist/reinstall.task.d.ts +8 -0
- package/dist/reinstall.task.d.ts.map +1 -0
- package/dist/reinstall.task.js +35 -0
- package/dist/release.task.d.ts +8 -0
- package/dist/release.task.d.ts.map +1 -0
- package/dist/release.task.js +20 -0
- package/dist/resolve.task.d.ts +11 -0
- package/dist/resolve.task.d.ts.map +1 -0
- package/dist/resolve.task.js +38 -0
- package/dist/resolve_specifier.d.ts +22 -0
- package/dist/resolve_specifier.d.ts.map +1 -0
- package/dist/resolve_specifier.js +57 -0
- package/dist/run.task.d.ts +16 -0
- package/dist/run.task.d.ts.map +1 -0
- package/dist/run.task.js +52 -0
- package/dist/run_gen.d.ts +10 -0
- package/dist/run_gen.d.ts.map +1 -0
- package/dist/run_gen.js +73 -0
- package/dist/run_task.d.ts +17 -0
- package/dist/run_task.d.ts.map +1 -0
- package/dist/run_task.js +45 -0
- package/dist/source_json.d.ts +7 -0
- package/dist/source_json.d.ts.map +1 -0
- package/dist/source_json.js +145 -0
- package/dist/svelte_config.d.ts +57 -0
- package/dist/svelte_config.d.ts.map +1 -0
- package/dist/svelte_config.js +81 -0
- package/dist/sveltekit_helpers.d.ts +75 -0
- package/dist/sveltekit_helpers.d.ts.map +1 -0
- package/dist/sveltekit_helpers.js +94 -0
- package/dist/sveltekit_shim_app.d.ts +11 -0
- package/dist/sveltekit_shim_app.d.ts.map +1 -0
- package/dist/sveltekit_shim_app.js +31 -0
- package/dist/sveltekit_shim_app_environment.d.ts +13 -0
- package/dist/sveltekit_shim_app_environment.d.ts.map +1 -0
- package/dist/sveltekit_shim_app_environment.js +14 -0
- package/dist/sveltekit_shim_app_forms.d.ts +5 -0
- package/dist/sveltekit_shim_app_forms.d.ts.map +1 -0
- package/dist/sveltekit_shim_app_forms.js +6 -0
- package/dist/sveltekit_shim_app_navigation.d.ts +10 -0
- package/dist/sveltekit_shim_app_navigation.d.ts.map +1 -0
- package/dist/sveltekit_shim_app_navigation.js +11 -0
- package/dist/sveltekit_shim_app_paths.d.ts +17 -0
- package/dist/sveltekit_shim_app_paths.d.ts.map +1 -0
- package/dist/sveltekit_shim_app_paths.js +10 -0
- package/dist/sveltekit_shim_app_state.d.ts +5 -0
- package/dist/sveltekit_shim_app_state.d.ts.map +1 -0
- package/dist/sveltekit_shim_app_state.js +26 -0
- package/dist/sveltekit_shim_env.d.ts +5 -0
- package/dist/sveltekit_shim_env.d.ts.map +1 -0
- package/dist/sveltekit_shim_env.js +23 -0
- package/dist/sync.task.d.ts +16 -0
- package/dist/sync.task.d.ts.map +1 -0
- package/dist/sync.task.js +39 -0
- package/dist/task.d.ts +98 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +109 -0
- package/dist/task_logging.d.ts +6 -0
- package/dist/task_logging.d.ts.map +1 -0
- package/dist/task_logging.js +201 -0
- package/dist/test.task.d.ts +13 -0
- package/dist/test.task.d.ts.map +1 -0
- package/dist/test.task.js +53 -0
- package/dist/typecheck.task.d.ts +13 -0
- package/dist/typecheck.task.d.ts.map +1 -0
- package/dist/typecheck.task.js +68 -0
- package/dist/upgrade.task.d.ts +20 -0
- package/dist/upgrade.task.d.ts.map +1 -0
- package/dist/upgrade.task.js +111 -0
- package/dist/watch_dir.d.ts +36 -0
- package/dist/watch_dir.d.ts.map +1 -0
- package/dist/watch_dir.js +69 -0
- package/package.json +149 -0
- package/src/lib/args.ts +115 -0
- package/src/lib/build.task.ts +151 -0
- package/src/lib/build_cache.ts +378 -0
- package/src/lib/changelog.ts +69 -0
- package/src/lib/changeset.task.ts +228 -0
- package/src/lib/changeset_helpers.ts +14 -0
- package/src/lib/check.task.ts +132 -0
- package/src/lib/child_process_logging.ts +38 -0
- package/src/lib/clean.task.ts +48 -0
- package/src/lib/clean_fs.ts +54 -0
- package/src/lib/cli.ts +98 -0
- package/src/lib/commit.task.ts +34 -0
- package/src/lib/constants.ts +56 -0
- package/src/lib/deploy.task.ts +287 -0
- package/src/lib/dev.task.ts +52 -0
- package/src/lib/disknode.ts +26 -0
- package/src/lib/env.ts +78 -0
- package/src/lib/esbuild_helpers.ts +49 -0
- package/src/lib/esbuild_plugin_external_worker.ts +94 -0
- package/src/lib/esbuild_plugin_svelte.ts +134 -0
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +38 -0
- package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +27 -0
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +42 -0
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +47 -0
- package/src/lib/filer.ts +458 -0
- package/src/lib/format.task.ts +44 -0
- package/src/lib/format_directory.ts +65 -0
- package/src/lib/format_file.ts +49 -0
- package/src/lib/gen.task.ts +206 -0
- package/src/lib/gen.ts +406 -0
- package/src/lib/gen_helpers.ts +131 -0
- package/src/lib/github.ts +46 -0
- package/src/lib/gro.config.default.ts +42 -0
- package/src/lib/gro.ts +29 -0
- package/src/lib/gro_config.ts +254 -0
- package/src/lib/gro_helpers.ts +108 -0
- package/src/lib/gro_plugin_gen.ts +149 -0
- package/src/lib/gro_plugin_server.ts +288 -0
- package/src/lib/gro_plugin_sveltekit_app.ts +58 -0
- package/src/lib/gro_plugin_sveltekit_library.ts +63 -0
- package/src/lib/index.ts +8 -0
- package/src/lib/input_path.ts +254 -0
- package/src/lib/invoke.ts +34 -0
- package/src/lib/invoke_task.ts +139 -0
- package/src/lib/lint.task.ts +39 -0
- package/src/lib/loader.ts +229 -0
- package/src/lib/module.ts +13 -0
- package/src/lib/modules.ts +117 -0
- package/src/lib/package_json.ts +255 -0
- package/src/lib/parse_exports.ts +100 -0
- package/src/lib/parse_exports_context.ts +395 -0
- package/src/lib/parse_imports.ts +180 -0
- package/src/lib/paths.ts +111 -0
- package/src/lib/plugin.ts +106 -0
- package/src/lib/publish.task.ts +228 -0
- package/src/lib/register.ts +3 -0
- package/src/lib/reinstall.task.ts +45 -0
- package/src/lib/release.task.ts +26 -0
- package/src/lib/resolve.task.ts +43 -0
- package/src/lib/resolve_specifier.ts +81 -0
- package/src/lib/run.task.ts +65 -0
- package/src/lib/run_gen.ts +110 -0
- package/src/lib/run_task.ts +82 -0
- package/src/lib/source_json.ts +183 -0
- package/src/lib/svelte_config.ts +140 -0
- package/src/lib/sveltekit_helpers.ts +193 -0
- package/src/lib/sveltekit_shim_app.ts +41 -0
- package/src/lib/sveltekit_shim_app_environment.ts +16 -0
- package/src/lib/sveltekit_shim_app_forms.ts +13 -0
- package/src/lib/sveltekit_shim_app_navigation.ts +23 -0
- package/src/lib/sveltekit_shim_app_paths.ts +26 -0
- package/src/lib/sveltekit_shim_app_state.ts +35 -0
- package/src/lib/sveltekit_shim_env.ts +45 -0
- package/src/lib/sync.task.ts +47 -0
- package/src/lib/task.ts +245 -0
- package/src/lib/task_logging.ts +255 -0
- package/src/lib/test.task.ts +63 -0
- package/src/lib/typecheck.task.ts +81 -0
- package/src/lib/upgrade.task.ts +148 -0
- package/src/lib/watch_dir.ts +115 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { EMPTY_OBJECT } from '@fuzdev/fuz_util/object.js';
|
|
11
|
+
import { SVELTE_CONFIG_FILENAME } from "./constants.js";
|
|
12
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
13
|
+
// see https://github.com/sveltejs/kit/discussions/14240
|
|
14
|
+
/*
|
|
15
|
+
|
|
16
|
+
This module is intended to have minimal dependencies to avoid over-imports in the CLI.
|
|
17
|
+
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Loads a SvelteKit config at `dir`.
|
|
21
|
+
* @returns `null` if no config is found
|
|
22
|
+
*/
|
|
23
|
+
export const load_svelte_config = async ({ dir = process.cwd(), config_filename = SVELTE_CONFIG_FILENAME, } = EMPTY_OBJECT) => {
|
|
24
|
+
try {
|
|
25
|
+
return (await import(__rewriteRelativeImportExtension(join(dir, config_filename), true))).default;
|
|
26
|
+
}
|
|
27
|
+
catch (_err) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
// TODO currently incomplete and hack - maybe rethink
|
|
32
|
+
/**
|
|
33
|
+
* Returns Gro-relevant properties of a SvelteKit config
|
|
34
|
+
* as a convenience wrapper around `load_svelte_config`.
|
|
35
|
+
* Needed because SvelteKit doesn't expose its config resolver.
|
|
36
|
+
*/
|
|
37
|
+
export const parse_svelte_config = async ({ dir_or_config = process.cwd(), // TODO maybe not the best API, maybe a type union? `({svelte_config} | {dir}) & {config_filename}`
|
|
38
|
+
config_filename = SVELTE_CONFIG_FILENAME, } = EMPTY_OBJECT) => {
|
|
39
|
+
const svelte_config = typeof dir_or_config === 'string'
|
|
40
|
+
? await load_svelte_config({ dir: dir_or_config, config_filename })
|
|
41
|
+
: dir_or_config;
|
|
42
|
+
const kit = svelte_config?.kit;
|
|
43
|
+
const alias = { $lib: 'src/lib', ...kit?.alias };
|
|
44
|
+
const base_url = kit?.paths?.base;
|
|
45
|
+
const assets_url = kit?.paths?.assets;
|
|
46
|
+
// TODO probably a Zod schema instead
|
|
47
|
+
const assets_path = kit?.files?.assets ?? 'static';
|
|
48
|
+
const lib_path = kit?.files?.lib ?? 'src/lib';
|
|
49
|
+
const routes_path = kit?.files?.routes ?? 'src/routes';
|
|
50
|
+
const env_dir = kit?.env?.dir;
|
|
51
|
+
const private_prefix = kit?.env?.privatePrefix;
|
|
52
|
+
const public_prefix = kit?.env?.publicPrefix;
|
|
53
|
+
const svelte_compile_options = svelte_config?.compilerOptions ?? {};
|
|
54
|
+
// Change the default to `generate: 'server'`,
|
|
55
|
+
// because SvelteKit handles the client in the normal cases.
|
|
56
|
+
if (svelte_compile_options.generate === undefined) {
|
|
57
|
+
svelte_compile_options.generate = 'server';
|
|
58
|
+
}
|
|
59
|
+
const svelte_compile_module_options = to_default_compile_module_options(svelte_compile_options); // TODO will kit have these separately?
|
|
60
|
+
const svelte_preprocessors = svelte_config?.preprocess;
|
|
61
|
+
return {
|
|
62
|
+
svelte_config,
|
|
63
|
+
alias,
|
|
64
|
+
base_url,
|
|
65
|
+
assets_url,
|
|
66
|
+
assets_path,
|
|
67
|
+
lib_path,
|
|
68
|
+
routes_path,
|
|
69
|
+
env_dir,
|
|
70
|
+
private_prefix,
|
|
71
|
+
public_prefix,
|
|
72
|
+
svelte_compile_options,
|
|
73
|
+
svelte_compile_module_options,
|
|
74
|
+
svelte_preprocessors,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export const to_default_compile_module_options = ({ dev, generate, filename, rootDir, warningFilter, }) => ({ dev, generate, filename, rootDir, warningFilter });
|
|
78
|
+
/**
|
|
79
|
+
* The parsed SvelteKit config for the cwd, cached globally at the module level.
|
|
80
|
+
*/
|
|
81
|
+
export const default_svelte_config = await parse_svelte_config(); // always load it to keep things simple ahead
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
2
|
+
import type { PackageJson } from '@fuzdev/fuz_util/package_json.js';
|
|
3
|
+
import type { Result } from '@fuzdev/fuz_util/result.js';
|
|
4
|
+
import { type Cli } from './cli.ts';
|
|
5
|
+
import { type ParsedSvelteConfig } from './svelte_config.ts';
|
|
6
|
+
export declare const has_sveltekit_app: (svelte_config_path?: string) => Promise<Result<object, {
|
|
7
|
+
message: string;
|
|
8
|
+
}>>;
|
|
9
|
+
export declare const has_sveltekit_library: (package_json: PackageJson, svelte_config?: ParsedSvelteConfig, dep_name?: string) => Promise<Result<object, {
|
|
10
|
+
message: string;
|
|
11
|
+
}>>;
|
|
12
|
+
export declare const sveltekit_sync: (sveltekit_cli?: string | Cli, pm_cli?: string) => Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* If the SvelteKit CLI is found and its `.svelte-kit` directory is not, run `svelte-kit sync`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const sveltekit_sync_if_available: (sveltekit_cli?: string | Cli) => Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* If the SvelteKit CLI is found and its `.svelte-kit` directory is not, run `svelte-kit sync`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const sveltekit_sync_if_obviously_needed: (sveltekit_cli?: string | Cli) => Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Options to the SvelteKit packaging CLI.
|
|
23
|
+
* @see https://kit.svelte.dev/docs/packaging#options
|
|
24
|
+
*/
|
|
25
|
+
export interface SveltePackageOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Watch files in src/lib for changes and rebuild the package
|
|
28
|
+
*/
|
|
29
|
+
watch?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Alias for `watch`.
|
|
32
|
+
*/
|
|
33
|
+
w?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The input directory which contains all the files of the package.
|
|
36
|
+
* Defaults to src/lib
|
|
37
|
+
*/
|
|
38
|
+
input?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Alias for `input`.
|
|
41
|
+
*/
|
|
42
|
+
i?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The output directory where the processed files are written to.
|
|
45
|
+
* Your package.json's exports should point to files inside there,
|
|
46
|
+
* and the files array should include that folder.
|
|
47
|
+
* Defaults to dist
|
|
48
|
+
*/
|
|
49
|
+
output?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Alias for `output`.
|
|
52
|
+
*/
|
|
53
|
+
o?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether or not to create type definitions (d.ts files).
|
|
56
|
+
* We strongly recommend doing this as it fosters ecosystem library quality.
|
|
57
|
+
* Defaults to true
|
|
58
|
+
*/
|
|
59
|
+
types?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Alias for `types`.
|
|
62
|
+
*/
|
|
63
|
+
t?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The path to a tsconfig or jsconfig.
|
|
66
|
+
* When not provided, searches for the next upper tsconfig/jsconfig in the workspace path.
|
|
67
|
+
*/
|
|
68
|
+
tsconfig?: string;
|
|
69
|
+
}
|
|
70
|
+
export declare const run_svelte_package: (package_json: PackageJson, options: SveltePackageOptions | undefined, cli: string | Cli, log: Logger, pm_cli: string) => Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Map an import specifier with the SvelteKit aliases.
|
|
73
|
+
*/
|
|
74
|
+
export declare const map_sveltekit_aliases: (specifier: string, aliases: Array<[string, string]>) => string;
|
|
75
|
+
//# sourceMappingURL=sveltekit_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sveltekit_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_helpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AAIvD,OAAO,EAAmC,KAAK,GAAG,EAAC,MAAM,UAAU,CAAC;AASpE,OAAO,EAAwB,KAAK,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAGlF,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"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { args_serialize } from '@fuzdev/fuz_util/args.js';
|
|
2
|
+
import { fs_exists } from '@fuzdev/fuz_util/fs.js';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { to_forwarded_args } from "./args.js";
|
|
5
|
+
import { find_cli, spawn_cli, to_cli_name } from "./cli.js";
|
|
6
|
+
import { PM_CLI_DEFAULT, SVELTE_CONFIG_FILENAME, SVELTE_PACKAGE_DEP_NAME, SVELTEKIT_CLI, SVELTEKIT_DEV_DIRNAME, } from "./constants.js";
|
|
7
|
+
import { package_json_has_dependency } from "./package_json.js";
|
|
8
|
+
import { default_svelte_config } from "./svelte_config.js";
|
|
9
|
+
import { TaskError } from "./task.js";
|
|
10
|
+
export const has_sveltekit_app = async (svelte_config_path = SVELTE_CONFIG_FILENAME) => {
|
|
11
|
+
if (!(await fs_exists(svelte_config_path))) {
|
|
12
|
+
return { ok: false, message: `no SvelteKit config found at ${SVELTE_CONFIG_FILENAME}` };
|
|
13
|
+
}
|
|
14
|
+
// TODO check for routes?
|
|
15
|
+
return { ok: true };
|
|
16
|
+
};
|
|
17
|
+
export const has_sveltekit_library = async (package_json, svelte_config = default_svelte_config, dep_name = SVELTE_PACKAGE_DEP_NAME) => {
|
|
18
|
+
const has_sveltekit_app_result = await has_sveltekit_app();
|
|
19
|
+
if (!has_sveltekit_app_result.ok) {
|
|
20
|
+
return has_sveltekit_app_result;
|
|
21
|
+
}
|
|
22
|
+
if (!(await fs_exists(svelte_config.lib_path))) {
|
|
23
|
+
return { ok: false, message: `no SvelteKit lib directory found at ${svelte_config.lib_path}` };
|
|
24
|
+
}
|
|
25
|
+
if (!package_json_has_dependency(dep_name, package_json)) {
|
|
26
|
+
return {
|
|
27
|
+
ok: false,
|
|
28
|
+
message: `no dependency found in package.json for ${dep_name}`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return { ok: true };
|
|
32
|
+
};
|
|
33
|
+
export const sveltekit_sync = async (sveltekit_cli = SVELTEKIT_CLI, pm_cli = PM_CLI_DEFAULT) => {
|
|
34
|
+
const result = await spawn_cli(sveltekit_cli, ['sync']);
|
|
35
|
+
if (!result) {
|
|
36
|
+
throw new TaskError(`Failed to find SvelteKit CLI \`${to_cli_name(sveltekit_cli)}\`, do you need to run \`${pm_cli} install\`?`);
|
|
37
|
+
}
|
|
38
|
+
else if (!result.ok) {
|
|
39
|
+
throw new TaskError(`Failed ${to_cli_name(sveltekit_cli)} sync`);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
// TODO maybe this shouldn't exist, instead error if `package.json` has SvelteKit but it's not found (with install message above)
|
|
43
|
+
/**
|
|
44
|
+
* If the SvelteKit CLI is found and its `.svelte-kit` directory is not, run `svelte-kit sync`.
|
|
45
|
+
*/
|
|
46
|
+
export const sveltekit_sync_if_available = async (sveltekit_cli = SVELTEKIT_CLI) => {
|
|
47
|
+
const found_sveltekit_cli = typeof sveltekit_cli === 'string' ? await find_cli(sveltekit_cli) : sveltekit_cli;
|
|
48
|
+
if (found_sveltekit_cli) {
|
|
49
|
+
return sveltekit_sync(found_sveltekit_cli);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* If the SvelteKit CLI is found and its `.svelte-kit` directory is not, run `svelte-kit sync`.
|
|
54
|
+
*/
|
|
55
|
+
export const sveltekit_sync_if_obviously_needed = async (sveltekit_cli = SVELTEKIT_CLI) => {
|
|
56
|
+
if (await fs_exists(SVELTEKIT_DEV_DIRNAME)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const found_sveltekit_cli = typeof sveltekit_cli === 'string' ? await find_cli(sveltekit_cli) : sveltekit_cli;
|
|
60
|
+
if (!found_sveltekit_cli) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
return sveltekit_sync(found_sveltekit_cli);
|
|
64
|
+
};
|
|
65
|
+
export const run_svelte_package = async (package_json, options, cli, log, pm_cli) => {
|
|
66
|
+
const has_sveltekit_library_result = await has_sveltekit_library(package_json);
|
|
67
|
+
if (!has_sveltekit_library_result.ok) {
|
|
68
|
+
throw new TaskError('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
|
|
69
|
+
}
|
|
70
|
+
const cli_name = typeof cli === 'string' ? cli : cli.name;
|
|
71
|
+
const found_svelte_package_cli = cli === cli_name ? await find_cli(cli) : cli;
|
|
72
|
+
if (found_svelte_package_cli?.kind !== 'local') {
|
|
73
|
+
throw new TaskError(`Failed to find SvelteKit packaging CLI \`${cli_name}\`, do you need to run \`${pm_cli} install\`?`);
|
|
74
|
+
}
|
|
75
|
+
const serialized_args = args_serialize({
|
|
76
|
+
...options,
|
|
77
|
+
...to_forwarded_args(cli_name),
|
|
78
|
+
});
|
|
79
|
+
await spawn_cli(found_svelte_package_cli, serialized_args, log);
|
|
80
|
+
};
|
|
81
|
+
//
|
|
82
|
+
/**
|
|
83
|
+
* Map an import specifier with the SvelteKit aliases.
|
|
84
|
+
*/
|
|
85
|
+
export const map_sveltekit_aliases = (specifier, aliases) => {
|
|
86
|
+
let path = specifier;
|
|
87
|
+
for (const [from, to] of aliases) {
|
|
88
|
+
if (path.startsWith(from)) {
|
|
89
|
+
path = join(process.cwd(), to, path.substring(from.length));
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return path;
|
|
94
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ParsedSvelteConfig } from './svelte_config.ts';
|
|
2
|
+
export declare const SVELTEKIT_SHIM_APP_PATHS_MATCHER: RegExp;
|
|
3
|
+
export declare const SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER: RegExp;
|
|
4
|
+
/**
|
|
5
|
+
* Maps SvelteKit `$app` specifiers to their Gro shims.
|
|
6
|
+
* @see https://kit.svelte.dev/docs/modules
|
|
7
|
+
*/
|
|
8
|
+
export declare const sveltekit_shim_app_specifiers: Map<string, string>;
|
|
9
|
+
export declare const render_sveltekit_shim_app_paths: (base_url?: ParsedSvelteConfig["base_url"], assets_url?: ParsedSvelteConfig["assets_url"]) => string;
|
|
10
|
+
export declare const render_sveltekit_shim_app_environment: (dev: boolean) => string;
|
|
11
|
+
//# sourceMappingURL=sveltekit_shim_app.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const SVELTEKIT_SHIM_APP_PATHS_MATCHER = /\/util\/sveltekit_shim_app_paths\.js$/;
|
|
2
|
+
export const SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER = /\/util\/sveltekit_shim_app_environment\.js$/;
|
|
3
|
+
/**
|
|
4
|
+
* Maps SvelteKit `$app` specifiers to their Gro shims.
|
|
5
|
+
* @see https://kit.svelte.dev/docs/modules
|
|
6
|
+
*/
|
|
7
|
+
export const sveltekit_shim_app_specifiers = new Map([
|
|
8
|
+
['$app/environment', '@fuzdev/gro/sveltekit_shim_app_environment.js'],
|
|
9
|
+
['$app/forms', '@fuzdev/gro/sveltekit_shim_app_forms.js'],
|
|
10
|
+
['$app/navigation', '@fuzdev/gro/sveltekit_shim_app_navigation.js'],
|
|
11
|
+
['$app/paths', '@fuzdev/gro/sveltekit_shim_app_paths.js'],
|
|
12
|
+
['$app/state', '@fuzdev/gro/sveltekit_shim_app_state.js'],
|
|
13
|
+
]);
|
|
14
|
+
export const render_sveltekit_shim_app_paths = (base_url = '', assets_url = '') => `// shim for $app/paths
|
|
15
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
16
|
+
|
|
17
|
+
export const assets = ${JSON.stringify(assets_url)};
|
|
18
|
+
export const base = ${JSON.stringify(base_url)};
|
|
19
|
+
`;
|
|
20
|
+
// TODO improve support
|
|
21
|
+
// `dev` is not guaranteed to be the same as `MODE` - https://kit.svelte.dev/docs/modules#$app-environment-dev
|
|
22
|
+
// `version` is `config.kit.version.name` but I couldn't see how to load a SvelteKit `ValidatedConfig`
|
|
23
|
+
// `building` is just being hardcoded, might be better (but still not correct) to be `!dev`
|
|
24
|
+
export const render_sveltekit_shim_app_environment = (dev) => `// shim for $app/environment
|
|
25
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
26
|
+
|
|
27
|
+
export const browser = false;
|
|
28
|
+
export const building = false;
|
|
29
|
+
export const dev = ${JSON.stringify(dev)};
|
|
30
|
+
export const version = 'TODO';
|
|
31
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is created dynamically by `render_sveltekit_shim_app_environment`
|
|
3
|
+
* but exists here for the sake of the Node loader.
|
|
4
|
+
* There may be a cleaner workaround but I couldn't find it.
|
|
5
|
+
* @see https://github.com/nodejs/loaders for details about the forthcoming virtual file support
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
export declare const browser = false;
|
|
10
|
+
export declare const building = false;
|
|
11
|
+
export declare const dev = true;
|
|
12
|
+
export declare const version = "TODO";
|
|
13
|
+
//# sourceMappingURL=sveltekit_shim_app_environment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_app_environment.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_environment.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,eAAO,MAAM,OAAO,QAAQ,CAAC;AAC7B,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAC9B,eAAO,MAAM,GAAG,OAAO,CAAC;AACxB,eAAO,MAAM,OAAO,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// shim for $app/environment
|
|
2
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
3
|
+
/**
|
|
4
|
+
* This file is created dynamically by `render_sveltekit_shim_app_environment`
|
|
5
|
+
* but exists here for the sake of the Node loader.
|
|
6
|
+
* There may be a cleaner workaround but I couldn't find it.
|
|
7
|
+
* @see https://github.com/nodejs/loaders for details about the forthcoming virtual file support
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export const browser = false;
|
|
12
|
+
export const building = false;
|
|
13
|
+
export const dev = true;
|
|
14
|
+
export const version = 'TODO';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { applyAction as base_applyAction, deserialize as base_deserialize, enhance as base_enhance } from '$app/forms';
|
|
2
|
+
export declare const applyAction: typeof base_applyAction;
|
|
3
|
+
export declare const deserialize: typeof base_deserialize;
|
|
4
|
+
export declare const enhance: typeof base_enhance;
|
|
5
|
+
//# sourceMappingURL=sveltekit_shim_app_forms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_app_forms.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_forms.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,WAAW,IAAI,gBAAgB,EAC/B,WAAW,IAAI,gBAAgB,EAC/B,OAAO,IAAI,YAAY,EACvB,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,WAAW,EAAE,OAAO,gBAA6B,CAAC;AAC/D,eAAO,MAAM,WAAW,EAAE,OAAO,gBAAoC,CAAC;AACtE,eAAO,MAAM,OAAO,EAAE,OAAO,YAAsC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// shim for $app/forms
|
|
2
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
3
|
+
import { noop, noop_async } from '@fuzdev/fuz_util/function.js';
|
|
4
|
+
export const applyAction = noop_async;
|
|
5
|
+
export const deserialize = () => ({});
|
|
6
|
+
export const enhance = () => ({ destroy: noop });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { afterNavigate as base_afterNavigate, beforeNavigate as base_beforeNavigate, disableScrollHandling as base_disableScrollHandling, goto as base_goto, invalidate as base_invalidate, invalidateAll as base_invalidateAll, preloadCode as base_preloadCode, preloadData as base_preloadData } from '$app/navigation';
|
|
2
|
+
export declare const afterNavigate: typeof base_afterNavigate;
|
|
3
|
+
export declare const beforeNavigate: typeof base_beforeNavigate;
|
|
4
|
+
export declare const disableScrollHandling: typeof base_disableScrollHandling;
|
|
5
|
+
export declare const goto: typeof base_goto;
|
|
6
|
+
export declare const invalidate: typeof base_invalidate;
|
|
7
|
+
export declare const invalidateAll: typeof base_invalidateAll;
|
|
8
|
+
export declare const preloadCode: typeof base_preloadCode;
|
|
9
|
+
export declare const preloadData: typeof base_preloadData;
|
|
10
|
+
//# sourceMappingURL=sveltekit_shim_app_navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_app_navigation.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_navigation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,aAAa,IAAI,kBAAkB,EACnC,cAAc,IAAI,mBAAmB,EACrC,qBAAqB,IAAI,0BAA0B,EACnD,IAAI,IAAI,SAAS,EACjB,UAAU,IAAI,eAAe,EAC7B,aAAa,IAAI,kBAAkB,EACnC,WAAW,IAAI,gBAAgB,EAC/B,WAAW,IAAI,gBAAgB,EAC/B,MAAM,iBAAiB,CAAC;AAGzB,eAAO,MAAM,aAAa,EAAE,OAAO,kBAAyB,CAAC;AAC7D,eAAO,MAAM,cAAc,EAAE,OAAO,mBAA0B,CAAC;AAC/D,eAAO,MAAM,qBAAqB,EAAE,OAAO,0BAAiC,CAAC;AAC7E,eAAO,MAAM,IAAI,EAAE,OAAO,SAAsB,CAAC;AACjD,eAAO,MAAM,UAAU,EAAE,OAAO,eAA4B,CAAC;AAC7D,eAAO,MAAM,aAAa,EAAE,OAAO,kBAA+B,CAAC;AACnE,eAAO,MAAM,WAAW,EAAE,OAAO,gBAA6B,CAAC;AAC/D,eAAO,MAAM,WAAW,EAAE,OAAO,gBAA6B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// shim for $app/navigation
|
|
2
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
3
|
+
import { noop, noop_async } from '@fuzdev/fuz_util/function.js';
|
|
4
|
+
export const afterNavigate = noop;
|
|
5
|
+
export const beforeNavigate = noop;
|
|
6
|
+
export const disableScrollHandling = noop;
|
|
7
|
+
export const goto = noop_async;
|
|
8
|
+
export const invalidate = noop_async;
|
|
9
|
+
export const invalidateAll = noop_async;
|
|
10
|
+
export const preloadCode = noop_async;
|
|
11
|
+
export const preloadData = noop_async;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is created dynamically by `render_sveltekit_shim_app_paths`
|
|
3
|
+
* but exists here for the sake of the Node loader.
|
|
4
|
+
* There may be a cleaner workaround but I couldn't find it.
|
|
5
|
+
* @see https://github.com/nodejs/loaders for details about the forthcoming virtual file support
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import type { resolve as base_resolve, asset as base_asset, resolveRoute as base_resolveRoute } from '$app/paths';
|
|
10
|
+
export declare const assets = "";
|
|
11
|
+
/** @deprecated */
|
|
12
|
+
export declare const base = "";
|
|
13
|
+
export declare const resolve: typeof base_resolve;
|
|
14
|
+
/** @deprecated */
|
|
15
|
+
export declare const resolveRoute: typeof base_resolveRoute;
|
|
16
|
+
export declare const asset: typeof base_asset;
|
|
17
|
+
//# sourceMappingURL=sveltekit_shim_app_paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_app_paths.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_paths.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACX,OAAO,IAAI,YAAY,EACvB,KAAK,IAAI,UAAU,EACnB,YAAY,IAAI,iBAAiB,EACjC,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,kBAAkB;AAClB,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,OAAO,EAAE,OAAO,YAAmE,CAAC;AACjG,kBAAkB;AAClB,eAAO,MAAM,YAAY,EAAE,OAAO,iBAAwB,CAAC;AAC3D,eAAO,MAAM,KAAK,EAAE,OAAO,UAAuD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// shim for $app/paths
|
|
2
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
3
|
+
import { noop } from '@fuzdev/fuz_util/function.js';
|
|
4
|
+
export const assets = '';
|
|
5
|
+
/** @deprecated */
|
|
6
|
+
export const base = '';
|
|
7
|
+
export const resolve = (v, ..._rest) => ('/' + v.replace(/^\//, '')); // TODO needs to use SvelteKit config base
|
|
8
|
+
/** @deprecated */
|
|
9
|
+
export const resolveRoute = noop; // eslint-disable-line @typescript-eslint/no-deprecated
|
|
10
|
+
export const asset = (v) => ('/' + v.replace(/^\//, '')); // TODO needs to use SvelteKit config base
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { navigating as base_navigating, page as base_page, updated as base_updated } from '$app/state';
|
|
2
|
+
export declare const navigating: typeof base_navigating;
|
|
3
|
+
export declare const page: typeof base_page;
|
|
4
|
+
export declare const updated: typeof base_updated;
|
|
5
|
+
//# sourceMappingURL=sveltekit_shim_app_state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_app_state.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,UAAU,IAAI,eAAe,EAC7B,IAAI,IAAI,SAAS,EACjB,OAAO,IAAI,YAAY,EACvB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,UAAU,EAAE,OAAO,eAO/B,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,OAAO,SASzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAAO,YAK5B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// shim for $app/state
|
|
2
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
3
|
+
export const navigating = {
|
|
4
|
+
from: null,
|
|
5
|
+
to: null,
|
|
6
|
+
type: null,
|
|
7
|
+
willUnload: null,
|
|
8
|
+
delta: null,
|
|
9
|
+
complete: null,
|
|
10
|
+
};
|
|
11
|
+
export const page = {
|
|
12
|
+
data: {},
|
|
13
|
+
form: null,
|
|
14
|
+
error: null,
|
|
15
|
+
params: {},
|
|
16
|
+
route: { id: null },
|
|
17
|
+
state: {},
|
|
18
|
+
status: -1,
|
|
19
|
+
url: new URL('https://github.com/fuzdev/gro'), // TODO maybe use package.json?
|
|
20
|
+
};
|
|
21
|
+
export const updated = {
|
|
22
|
+
current: false,
|
|
23
|
+
check: () => {
|
|
24
|
+
throw Error('Can only call updated.check() in the browser');
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a module shim for SvelteKit's `$env` imports.
|
|
3
|
+
*/
|
|
4
|
+
export declare const render_env_shim_module: (dev: boolean, mode: "static" | "dynamic", visibility: "public" | "private", public_prefix?: string, private_prefix?: string, env_dir?: string, env_files?: Array<string>, ambient_env?: Record<string, string | undefined>) => string;
|
|
5
|
+
//# sourceMappingURL=sveltekit_shim_env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_env.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_env.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAClC,KAAK,OAAO,EACZ,MAAM,QAAQ,GAAG,SAAS,EAC1B,YAAY,QAAQ,GAAG,SAAS,EAChC,sBAAyB,EACzB,uBAAmB,EACnB,UAAU,MAAM,EAChB,YAAY,KAAK,CAAC,MAAM,CAAC,EACzB,cAAc,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAC9C,MA4BF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { load_env } from "./env.js";
|
|
2
|
+
// TODO might want to do more escaping and validation
|
|
3
|
+
/**
|
|
4
|
+
* Generates a module shim for SvelteKit's `$env` imports.
|
|
5
|
+
*/
|
|
6
|
+
export const render_env_shim_module = (dev, mode, visibility, public_prefix = 'PUBLIC_', private_prefix = '', env_dir, env_files, ambient_env) => {
|
|
7
|
+
const env = load_env(dev, visibility, public_prefix, private_prefix, env_dir, env_files, ambient_env);
|
|
8
|
+
if (mode === 'static') {
|
|
9
|
+
return `// shim for $env/static/${visibility}
|
|
10
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
11
|
+
${Object.entries(env)
|
|
12
|
+
.map(([k, v]) => `export let ${k} = ${JSON.stringify(v)};`)
|
|
13
|
+
.join('\n')}
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return `// shim for $env/dynamic/${visibility}
|
|
18
|
+
// @see https://github.com/sveltejs/kit/issues/1485
|
|
19
|
+
import {load_env} from './env.js';
|
|
20
|
+
export const env = load_env(${dev}, ${JSON.stringify(visibility)}, ${JSON.stringify(public_prefix)}, ${JSON.stringify(private_prefix)}, ${JSON.stringify(env_dir)}, ${JSON.stringify(env_files)}, ${JSON.stringify(ambient_env)});
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type Task } from './task.ts';
|
|
3
|
+
/** @nodocs */
|
|
4
|
+
export declare const Args: z.ZodObject<{
|
|
5
|
+
sveltekit: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
+
'no-sveltekit': z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
package_json: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
'no-package_json': z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
gen: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
'no-gen': z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
install: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
export type Args = z.infer<typeof Args>;
|
|
14
|
+
/** @nodocs */
|
|
15
|
+
export declare const task: Task<Args>;
|
|
16
|
+
//# sourceMappingURL=sync.task.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { spawn } from '@fuzdev/fuz_util/process.js';
|
|
3
|
+
import { TaskError } from "./task.js";
|
|
4
|
+
import { package_json_sync } from "./package_json.js";
|
|
5
|
+
import { sveltekit_sync } from "./sveltekit_helpers.js";
|
|
6
|
+
/** @nodocs */
|
|
7
|
+
export const Args = z.strictObject({
|
|
8
|
+
sveltekit: z.boolean().meta({ description: 'dual of no-sveltekit' }).default(true),
|
|
9
|
+
'no-sveltekit': z.boolean().meta({ description: 'opt out of svelte-kit sync' }).default(false),
|
|
10
|
+
package_json: z.boolean().meta({ description: 'dual of no-package_json' }).default(true),
|
|
11
|
+
'no-package_json': z.boolean().meta({ description: 'opt out of package.json sync' }).default(false),
|
|
12
|
+
gen: z.boolean().meta({ description: 'dual of no-gen' }).default(true),
|
|
13
|
+
'no-gen': z.boolean().meta({ description: 'opt out of running gen' }).default(false),
|
|
14
|
+
install: z.boolean().meta({ description: 'opt into installing packages' }).default(false),
|
|
15
|
+
});
|
|
16
|
+
/** @nodocs */
|
|
17
|
+
export const task = {
|
|
18
|
+
summary: 'run `gro gen`, update `package.json`, and optionally install packages to sync up',
|
|
19
|
+
Args,
|
|
20
|
+
run: async ({ args, invoke_task, config, log }) => {
|
|
21
|
+
const { sveltekit, package_json, gen, install } = args;
|
|
22
|
+
if (install) {
|
|
23
|
+
const result = await spawn(config.pm_cli, ['install']);
|
|
24
|
+
if (!result.ok) {
|
|
25
|
+
throw new TaskError(`Failed \`${config.pm_cli} install\``);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (sveltekit) {
|
|
29
|
+
await sveltekit_sync(undefined, config.pm_cli);
|
|
30
|
+
log.info('synced SvelteKit');
|
|
31
|
+
}
|
|
32
|
+
if (package_json && config.map_package_json) {
|
|
33
|
+
await package_json_sync(config.map_package_json, log);
|
|
34
|
+
}
|
|
35
|
+
if (gen) {
|
|
36
|
+
await invoke_task('gen');
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
};
|