@ryanatkn/gro 0.141.1 → 0.143.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/build.task.js +1 -1
- package/dist/changeset.task.d.ts.map +1 -1
- package/dist/changeset.task.js +4 -4
- package/dist/check.task.d.ts.map +1 -1
- package/dist/check.task.js +4 -2
- package/dist/clean_fs.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/{path_constants.d.ts → constants.d.ts} +4 -1
- package/dist/constants.d.ts.map +1 -0
- package/dist/{path_constants.js → constants.js} +3 -0
- package/dist/deploy.task.js +1 -1
- package/dist/dev.task.js +1 -1
- package/dist/esbuild_plugin_svelte.js +1 -1
- package/dist/esbuild_plugin_sveltekit_local_imports.js +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.js +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.js +1 -1
- package/dist/filer.d.ts +7 -0
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +28 -29
- package/dist/format.task.d.ts.map +1 -1
- package/dist/format.task.js +2 -2
- package/dist/format_directory.d.ts +1 -1
- package/dist/format_directory.d.ts.map +1 -1
- package/dist/format_directory.js +5 -6
- package/dist/gen.task.js +1 -1
- package/dist/gro_config.d.ts +12 -2
- package/dist/gro_config.d.ts.map +1 -1
- package/dist/gro_config.js +10 -6
- package/dist/gro_helpers.d.ts +1 -1
- package/dist/gro_helpers.d.ts.map +1 -1
- package/dist/gro_helpers.js +3 -3
- package/dist/gro_plugin_server.js +4 -4
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.js +5 -5
- package/dist/gro_plugin_sveltekit_library.js +7 -7
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +23 -17
- package/dist/module.js +1 -1
- package/dist/moss_helpers.d.ts +1 -1
- package/dist/moss_helpers.d.ts.map +1 -1
- package/dist/moss_helpers.js +4 -3
- package/dist/package.d.ts +334 -172
- package/dist/package.d.ts.map +1 -1
- package/dist/package.js +51 -51
- package/dist/package_json.d.ts +9 -6
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +21 -6
- package/dist/package_meta.d.ts +1 -1
- package/dist/parse_imports.js +1 -1
- package/dist/paths.js +1 -1
- package/dist/publish.task.d.ts.map +1 -1
- package/dist/publish.task.js +7 -20
- package/dist/reinstall.task.js +11 -11
- package/dist/resolve_node_specifier.d.ts +7 -1
- package/dist/resolve_node_specifier.d.ts.map +1 -1
- package/dist/resolve_node_specifier.js +78 -14
- package/dist/resolve_specifier.d.ts +2 -6
- package/dist/resolve_specifier.d.ts.map +1 -1
- package/dist/resolve_specifier.js +2 -6
- package/dist/run_task.js +1 -1
- package/dist/src_json.d.ts +39 -3
- package/dist/src_json.d.ts.map +1 -1
- package/dist/sveltekit_config.d.ts +1 -1
- package/dist/sveltekit_config.d.ts.map +1 -1
- package/dist/sveltekit_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 +7 -7
- package/dist/sync.task.js +5 -5
- package/dist/upgrade.task.d.ts.map +1 -1
- package/dist/upgrade.task.js +4 -2
- package/dist/watch_dir.d.ts.map +1 -1
- package/dist/watch_dir.js +5 -5
- package/package.json +18 -18
- package/src/lib/build.task.ts +1 -1
- package/src/lib/changeset.task.ts +4 -3
- package/src/lib/check.task.ts +4 -2
- package/src/lib/clean_fs.ts +1 -1
- package/src/lib/cli.ts +1 -1
- package/src/lib/{path_constants.ts → constants.ts} +4 -0
- package/src/lib/deploy.task.ts +1 -1
- package/src/lib/dev.task.ts +1 -1
- package/src/lib/esbuild_plugin_svelte.ts +1 -1
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +1 -1
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +1 -1
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +1 -1
- package/src/lib/filer.ts +37 -27
- package/src/lib/format.task.ts +10 -2
- package/src/lib/format_directory.ts +10 -9
- package/src/lib/gen.task.ts +1 -1
- package/src/lib/gro_config.ts +23 -5
- package/src/lib/gro_helpers.ts +3 -2
- package/src/lib/gro_plugin_server.ts +4 -4
- package/src/lib/gro_plugin_sveltekit_app.ts +7 -5
- package/src/lib/gro_plugin_sveltekit_library.ts +7 -7
- package/src/lib/loader.ts +25 -17
- package/src/lib/module.ts +1 -1
- package/src/lib/moss_helpers.ts +4 -2
- package/src/lib/package.ts +51 -51
- package/src/lib/package_json.ts +23 -6
- package/src/lib/package_meta.ts +1 -1
- package/src/lib/parse_imports.ts +1 -1
- package/src/lib/paths.ts +1 -1
- package/src/lib/publish.task.ts +7 -22
- package/src/lib/reinstall.task.ts +11 -11
- package/src/lib/resolve_node_specifier.ts +100 -18
- package/src/lib/resolve_specifier.ts +2 -6
- package/src/lib/run_task.ts +1 -1
- package/src/lib/sveltekit_config.ts +2 -2
- package/src/lib/sveltekit_helpers.ts +7 -4
- package/src/lib/sync.task.ts +5 -5
- package/src/lib/upgrade.task.ts +4 -2
- package/src/lib/watch_dir.ts +6 -6
- package/dist/path_constants.d.ts.map +0 -1
|
@@ -5,18 +5,18 @@ import { serialize_package_json, load_package_json } from './package_json.js';
|
|
|
5
5
|
import { Task_Error } from './task.js';
|
|
6
6
|
import { find_cli, spawn_cli, spawn_cli_process } from './cli.js';
|
|
7
7
|
import { serialize_src_json, create_src_json } from './src_json.js';
|
|
8
|
-
import {
|
|
8
|
+
import { EXPORTS_EXCLUDER_DEFAULT } from './gro_config.js';
|
|
9
9
|
import { default_sveltekit_config } from './sveltekit_config.js';
|
|
10
|
-
import { SOURCE_DIRNAME } from './
|
|
10
|
+
import { SOURCE_DIRNAME } from './constants.js';
|
|
11
11
|
import { VITE_CLI } from './sveltekit_helpers.js';
|
|
12
12
|
export const gro_plugin_sveltekit_app = ({ host_target = 'github_pages', well_known_package_json, well_known_src_json, well_known_src_files, vite_cli = VITE_CLI, } = {}) => {
|
|
13
13
|
let sveltekit_process = undefined;
|
|
14
14
|
return {
|
|
15
15
|
name: 'gro_plugin_sveltekit_app',
|
|
16
|
-
setup: async ({ dev, watch, log }) => {
|
|
16
|
+
setup: async ({ dev, watch, log, config }) => {
|
|
17
17
|
const found_vite_cli = find_cli(vite_cli);
|
|
18
18
|
if (!found_vite_cli)
|
|
19
|
-
throw new Error(`Failed to find Vite CLI \`${vite_cli}\`, do you need to run
|
|
19
|
+
throw new Error(`Failed to find Vite CLI \`${vite_cli}\`, do you need to run \`${config.pm_cli} i\`?`);
|
|
20
20
|
if (dev) {
|
|
21
21
|
// `vite dev` in development mode
|
|
22
22
|
if (watch) {
|
|
@@ -67,7 +67,7 @@ export const gro_plugin_sveltekit_app = ({ host_target = 'github_pages', well_kn
|
|
|
67
67
|
: null,
|
|
68
68
|
serialized_src_json && well_known_src_files
|
|
69
69
|
? copy_temporarily(SOURCE_DIRNAME, assets_path, '.well-known', well_known_src_files === true
|
|
70
|
-
? (file_path) => !
|
|
70
|
+
? (file_path) => !EXPORTS_EXCLUDER_DEFAULT.test(file_path)
|
|
71
71
|
: well_known_src_files)
|
|
72
72
|
: null,
|
|
73
73
|
/**
|
|
@@ -5,27 +5,27 @@ import { SVELTE_PACKAGE_CLI, run_svelte_package, } from './sveltekit_helpers.js'
|
|
|
5
5
|
export const gro_plugin_sveltekit_library = ({ svelte_package_options, svelte_package_cli = SVELTE_PACKAGE_CLI, } = {}) => {
|
|
6
6
|
return {
|
|
7
7
|
name: 'gro_plugin_sveltekit_library',
|
|
8
|
-
setup: async ({ dev, log }) => {
|
|
8
|
+
setup: async ({ dev, log, config }) => {
|
|
9
9
|
if (!dev) {
|
|
10
|
-
await run_svelte_package(svelte_package_options, svelte_package_cli, log);
|
|
10
|
+
await run_svelte_package(svelte_package_options, svelte_package_cli, log, config.pm_cli);
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
-
adapt: async ({ log, timings }) => {
|
|
13
|
+
adapt: async ({ log, timings, config }) => {
|
|
14
14
|
const package_json = load_package_json();
|
|
15
|
-
//
|
|
15
|
+
// link the CLI binaries if they exist
|
|
16
16
|
if (package_json.bin) {
|
|
17
|
-
const
|
|
17
|
+
const timing_to_link = timings.start(`${config.pm_cli} link`);
|
|
18
18
|
await Promise.all(Object.values(package_json.bin).map(async (bin_path) => {
|
|
19
19
|
const chmod_result = await spawn('chmod', ['+x', bin_path]);
|
|
20
20
|
if (!chmod_result.ok)
|
|
21
21
|
log.error(`chmod on bin path ${bin_path} failed with code ${chmod_result.code}`);
|
|
22
22
|
}));
|
|
23
23
|
log.info(`linking`);
|
|
24
|
-
const link_result = await spawn(
|
|
24
|
+
const link_result = await spawn(config.pm_cli, ['link', '-f']); // TODO don't use `-f` unless necessary or at all?
|
|
25
25
|
if (!link_result.ok) {
|
|
26
26
|
throw new Task_Error(`Failed to link. ${print_spawn_result(link_result)}`);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
timing_to_link();
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
};
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAgFvD,eAAO,MAAM,IAAI,EAAE,QAwFlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAgFvD,eAAO,MAAM,IAAI,EAAE,QAwFlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WA4DrB,CAAC"}
|
package/dist/loader.js
CHANGED
|
@@ -8,8 +8,8 @@ import { render_env_shim_module } from './sveltekit_shim_env.js';
|
|
|
8
8
|
import { render_sveltekit_shim_app_environment, render_sveltekit_shim_app_paths, SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER, SVELTEKIT_SHIM_APP_PATHS_MATCHER, sveltekit_shim_app_specifiers, } from './sveltekit_shim_app.js';
|
|
9
9
|
import { default_sveltekit_config } from './sveltekit_config.js';
|
|
10
10
|
import { SVELTE_MATCHER, SVELTE_RUNES_MATCHER } from './svelte_helpers.js';
|
|
11
|
-
import { paths } from './paths.js';
|
|
12
|
-
import { JSON_MATCHER, NODE_MODULES_DIRNAME, TS_MATCHER } from './
|
|
11
|
+
import { IS_THIS_GRO, paths } from './paths.js';
|
|
12
|
+
import { JSON_MATCHER, NODE_MODULES_DIRNAME, TS_MATCHER } from './constants.js';
|
|
13
13
|
import { to_define_import_meta_env, default_ts_transform_options } from './esbuild_helpers.js';
|
|
14
14
|
import { resolve_specifier } from './resolve_specifier.js';
|
|
15
15
|
import { resolve_node_specifier } from './resolve_node_specifier.js';
|
|
@@ -132,34 +132,40 @@ export const load = async (url, context, nextLoad) => {
|
|
|
132
132
|
return nextLoad(url, context);
|
|
133
133
|
};
|
|
134
134
|
export const resolve = async (specifier, context, nextResolve) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
let s = specifier;
|
|
136
|
+
// Support SvelteKit `$env` imports
|
|
137
|
+
if (s === '$env/static/public' ||
|
|
138
|
+
s === '$env/static/private' ||
|
|
139
|
+
s === '$env/dynamic/public' ||
|
|
140
|
+
s === '$env/dynamic/private') {
|
|
139
141
|
// The returned `url` is validated before `load` is called,
|
|
140
142
|
// so we need a slightly roundabout strategy to pass through the specifier for virtual files.
|
|
141
143
|
return {
|
|
142
|
-
url: pathToFileURL(join(dir, 'src/lib',
|
|
144
|
+
url: pathToFileURL(join(dir, 'src/lib', s)).href,
|
|
143
145
|
format: 'module',
|
|
144
146
|
shortCircuit: true,
|
|
145
147
|
};
|
|
146
148
|
}
|
|
149
|
+
// Special case for Gro's dependencies that import into Gro.
|
|
150
|
+
// Without this, we'd need to add a dev dep to Gro for Gro, which causes problems.
|
|
151
|
+
if (IS_THIS_GRO && s.startsWith('@ryanatkn/gro')) {
|
|
152
|
+
s = join(dir, 'dist', s.substring(13));
|
|
153
|
+
}
|
|
147
154
|
const parent_url = context.parentURL;
|
|
148
155
|
if (!parent_url || NODE_MODULES_MATCHER.test(parent_url)) {
|
|
149
|
-
return nextResolve(
|
|
156
|
+
return nextResolve(s, context);
|
|
150
157
|
}
|
|
151
|
-
const shimmed = sveltekit_shim_app_specifiers.get(
|
|
158
|
+
const shimmed = sveltekit_shim_app_specifiers.get(s);
|
|
152
159
|
if (shimmed !== undefined) {
|
|
153
160
|
return nextResolve(shimmed, context);
|
|
154
161
|
}
|
|
155
|
-
|
|
156
|
-
// The specifier
|
|
157
|
-
if (
|
|
162
|
+
s = map_sveltekit_aliases(s, aliases);
|
|
163
|
+
// The specifier has now been mapped to its final form, so we can inspect it.
|
|
164
|
+
if (s[0] !== '.' && s[0] !== '/') {
|
|
158
165
|
// Resolve to `node_modules`.
|
|
159
|
-
if (SVELTE_MATCHER.test(
|
|
166
|
+
if (SVELTE_MATCHER.test(s) || JSON_MATCHER.test(s)) {
|
|
160
167
|
// Match the behavior of Vite and esbuild for Svelte and JSON imports.
|
|
161
|
-
//
|
|
162
|
-
const resolved = resolve_node_specifier(path, dir, parent_url, package_json_cache);
|
|
168
|
+
const resolved = resolve_node_specifier(s, dir, parent_url, package_json_cache); // `node:` specifiers shouldn't reach this point, so the assertion is safe
|
|
163
169
|
return {
|
|
164
170
|
url: pathToFileURL(resolved.path_id_with_querystring).href,
|
|
165
171
|
format: 'module',
|
|
@@ -167,10 +173,10 @@ export const resolve = async (specifier, context, nextResolve) => {
|
|
|
167
173
|
};
|
|
168
174
|
}
|
|
169
175
|
else {
|
|
170
|
-
return nextResolve(
|
|
176
|
+
return nextResolve(s, context);
|
|
171
177
|
}
|
|
172
178
|
}
|
|
173
|
-
const resolved = resolve_specifier(
|
|
179
|
+
const resolved = resolve_specifier(s, dirname(fileURLToPath(parent_url)));
|
|
174
180
|
return {
|
|
175
181
|
url: pathToFileURL(resolved.path_id_with_querystring).href,
|
|
176
182
|
format: 'module',
|
package/dist/module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LIB_DIRNAME } from './paths.js';
|
|
2
|
-
import { SOURCE_DIR, SOURCE_DIRNAME } from './
|
|
2
|
+
import { SOURCE_DIR, SOURCE_DIRNAME } from './constants.js';
|
|
3
3
|
export const MODULE_PATH_SRC_PREFIX = SOURCE_DIR;
|
|
4
4
|
export const MODULE_PATH_LIB_PREFIX = `$${LIB_DIRNAME}/`;
|
|
5
5
|
const INTERNAL_MODULE_MATCHER = new RegExp(`^(\\.?\\.?|${SOURCE_DIRNAME}|\\$${LIB_DIRNAME})\\/`, 'u');
|
package/dist/moss_helpers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Result } from '@ryanatkn/belt/result.js';
|
|
2
2
|
import { type Package_Json } from './package_json.js';
|
|
3
3
|
export declare const MOSS_PACKAGE_DEP_NAME = "@ryanatkn/moss";
|
|
4
|
-
export declare const load_moss_plugin: (package_json?: Package_Json, dep_name?: string, plugin_path?: string, local_plugin_path?: string) => Promise<Result<{
|
|
4
|
+
export declare const load_moss_plugin: (package_json?: Package_Json, dep_name?: string, plugin_path?: string, local_plugin_path?: string, pm_cli?: string) => Promise<Result<{
|
|
5
5
|
gro_plugin_moss: any;
|
|
6
6
|
}, {
|
|
7
7
|
message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moss_helpers.d.ts","sourceRoot":"../src/lib/","sources":["moss_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAIrD,OAAO,EAAU,KAAK,YAAY,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"moss_helpers.d.ts","sourceRoot":"../src/lib/","sources":["moss_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAIrD,OAAO,EAAU,KAAK,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG7D,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,kBACb,YAAY,2FAKzB,OAAO,CAAC,MAAM,CAAC;IAAC,eAAe,EAAE,GAAG,CAAA;CAAC,EAAE;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAAC,CA4B3D,CAAC"}
|
package/dist/moss_helpers.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { has_dep } from './package_json.js';
|
|
4
|
+
import { NODE_MODULES_DIRNAME, PM_CLI_DEFAULT } from './constants.js';
|
|
4
5
|
export const MOSS_PACKAGE_DEP_NAME = '@ryanatkn/moss';
|
|
5
6
|
// TODO plugin type?
|
|
6
|
-
export const load_moss_plugin = async (package_json, dep_name = MOSS_PACKAGE_DEP_NAME, plugin_path =
|
|
7
|
-
local_plugin_path = 'src/lib/gro_plugin_moss.ts') => {
|
|
7
|
+
export const load_moss_plugin = async (package_json, dep_name = MOSS_PACKAGE_DEP_NAME, plugin_path = `${NODE_MODULES_DIRNAME}/${dep_name}/dist/gro_plugin_moss.js`, // TODO maybe lookup from its `package_json.exports`? kinda unnecessary
|
|
8
|
+
local_plugin_path = 'src/lib/gro_plugin_moss.ts', pm_cli = PM_CLI_DEFAULT) => {
|
|
8
9
|
if (!has_dep(dep_name, package_json)) {
|
|
9
10
|
return {
|
|
10
11
|
ok: false,
|
|
11
|
-
message: `no dependency found in package.json for ${dep_name}, install it with
|
|
12
|
+
message: `no dependency found in package.json for ${dep_name}, install it with \`${pm_cli} install -D ${dep_name}\``,
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
let path = undefined;
|