@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
package/dist/package.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["package.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAywBD,CAAC"}
|
package/dist/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// generated by src/lib/package.gen.ts
|
|
2
2
|
export const package_json = {
|
|
3
3
|
name: '@ryanatkn/gro',
|
|
4
|
-
version: '0.
|
|
4
|
+
version: '0.143.0',
|
|
5
5
|
description: 'task runner and toolkit extending SvelteKit',
|
|
6
6
|
motto: 'generate, run, optimize',
|
|
7
7
|
glyph: '🌰',
|
|
@@ -48,7 +48,7 @@ export const package_json = {
|
|
|
48
48
|
prettier: '^3.3.3',
|
|
49
49
|
'prettier-plugin-svelte': '^3.2.7',
|
|
50
50
|
'ts-morph': '^24.0.0',
|
|
51
|
-
tslib: '^2.
|
|
51
|
+
tslib: '^2.8.0',
|
|
52
52
|
zod: '^3.23.8',
|
|
53
53
|
},
|
|
54
54
|
peerDependencies: { esbuild: '^0.21.0', svelte: '^5.0.0-next.0' },
|
|
@@ -56,21 +56,21 @@ export const package_json = {
|
|
|
56
56
|
'@changesets/changelog-git': '^0.2.0',
|
|
57
57
|
'@changesets/types': '^6.0.0',
|
|
58
58
|
'@ryanatkn/eslint-config': '^0.5.5',
|
|
59
|
-
'@ryanatkn/fuz': '^0.129.
|
|
60
|
-
'@ryanatkn/moss': '^0.18.
|
|
61
|
-
'@sveltejs/adapter-static': '^3.0.
|
|
62
|
-
'@sveltejs/kit': '^2.
|
|
63
|
-
'@sveltejs/package': '^2.3.
|
|
64
|
-
'@sveltejs/vite-plugin-svelte': '^4.0.0
|
|
59
|
+
'@ryanatkn/fuz': '^0.129.5',
|
|
60
|
+
'@ryanatkn/moss': '^0.18.2',
|
|
61
|
+
'@sveltejs/adapter-static': '^3.0.6',
|
|
62
|
+
'@sveltejs/kit': '^2.7.3',
|
|
63
|
+
'@sveltejs/package': '^2.3.7',
|
|
64
|
+
'@sveltejs/vite-plugin-svelte': '^4.0.0',
|
|
65
65
|
'@types/fs-extra': '^11.0.4',
|
|
66
|
-
'@types/node': '^22.
|
|
66
|
+
'@types/node': '^22.8.1',
|
|
67
67
|
esbuild: '^0.21.5',
|
|
68
|
-
eslint: '^9.
|
|
69
|
-
'eslint-plugin-svelte': '^2.
|
|
70
|
-
svelte: '^5.
|
|
71
|
-
'svelte-check': '^4.0.
|
|
68
|
+
eslint: '^9.13.0',
|
|
69
|
+
'eslint-plugin-svelte': '^2.46.0',
|
|
70
|
+
svelte: '^5.1.3',
|
|
71
|
+
'svelte-check': '^4.0.5',
|
|
72
72
|
typescript: '^5.6.3',
|
|
73
|
-
'typescript-eslint': '^8.
|
|
73
|
+
'typescript-eslint': '^8.11.0',
|
|
74
74
|
uvu: '^0.5.6',
|
|
75
75
|
},
|
|
76
76
|
prettier: {
|
|
@@ -102,6 +102,7 @@ export const package_json = {
|
|
|
102
102
|
'./clean.task.js': { types: './dist/clean.task.d.ts', default: './dist/clean.task.js' },
|
|
103
103
|
'./cli.js': { types: './dist/cli.d.ts', default: './dist/cli.js' },
|
|
104
104
|
'./commit.task.js': { types: './dist/commit.task.d.ts', default: './dist/commit.task.js' },
|
|
105
|
+
'./constants.js': { types: './dist/constants.d.ts', default: './dist/constants.js' },
|
|
105
106
|
'./deploy.task.js': { types: './dist/deploy.task.d.ts', default: './dist/deploy.task.js' },
|
|
106
107
|
'./dev.task.js': { types: './dist/dev.task.d.ts', default: './dist/dev.task.js' },
|
|
107
108
|
'./env.js': { types: './dist/env.d.ts', default: './dist/env.js' },
|
|
@@ -182,10 +183,6 @@ export const package_json = {
|
|
|
182
183
|
'./package.gen.js': { types: './dist/package.gen.d.ts', default: './dist/package.gen.js' },
|
|
183
184
|
'./package.js': { types: './dist/package.d.ts', default: './dist/package.js' },
|
|
184
185
|
'./parse_imports.js': { types: './dist/parse_imports.d.ts', default: './dist/parse_imports.js' },
|
|
185
|
-
'./path_constants.js': {
|
|
186
|
-
types: './dist/path_constants.d.ts',
|
|
187
|
-
default: './dist/path_constants.js',
|
|
188
|
-
},
|
|
189
186
|
'./path.js': { types: './dist/path.d.ts', default: './dist/path.js' },
|
|
190
187
|
'./paths.js': { types: './dist/paths.d.ts', default: './dist/paths.js' },
|
|
191
188
|
'./plugin.js': { types: './dist/plugin.d.ts', default: './dist/plugin.js' },
|
|
@@ -264,7 +261,7 @@ export const package_json = {
|
|
|
264
261
|
};
|
|
265
262
|
export const src_json = {
|
|
266
263
|
name: '@ryanatkn/gro',
|
|
267
|
-
version: '0.
|
|
264
|
+
version: '0.143.0',
|
|
268
265
|
modules: {
|
|
269
266
|
'.': {
|
|
270
267
|
path: 'index.ts',
|
|
@@ -359,6 +356,39 @@ export const src_json = {
|
|
|
359
356
|
{ name: 'task', kind: 'variable' },
|
|
360
357
|
],
|
|
361
358
|
},
|
|
359
|
+
'./constants.js': {
|
|
360
|
+
path: 'constants.ts',
|
|
361
|
+
declarations: [
|
|
362
|
+
{ name: 'SOURCE_DIRNAME', kind: 'variable' },
|
|
363
|
+
{ name: 'GRO_DIRNAME', kind: 'variable' },
|
|
364
|
+
{ name: 'GRO_DIST_PREFIX', kind: 'variable' },
|
|
365
|
+
{ name: 'SERVER_DIST_PATH', kind: 'variable' },
|
|
366
|
+
{ name: 'GRO_DEV_DIRNAME', kind: 'variable' },
|
|
367
|
+
{ name: 'SOURCE_DIR', kind: 'variable' },
|
|
368
|
+
{ name: 'GRO_DIR', kind: 'variable' },
|
|
369
|
+
{ name: 'GRO_DEV_DIR', kind: 'variable' },
|
|
370
|
+
{ name: 'GRO_CONFIG_PATH', kind: 'variable' },
|
|
371
|
+
{ name: 'README_FILENAME', kind: 'variable' },
|
|
372
|
+
{ name: 'SVELTEKIT_CONFIG_FILENAME', kind: 'variable' },
|
|
373
|
+
{ name: 'VITE_CONFIG_FILENAME', kind: 'variable' },
|
|
374
|
+
{ name: 'NODE_MODULES_DIRNAME', kind: 'variable' },
|
|
375
|
+
{ name: 'LOCKFILE_FILENAME', kind: 'variable' },
|
|
376
|
+
{ name: 'SVELTEKIT_DEV_DIRNAME', kind: 'variable' },
|
|
377
|
+
{ name: 'SVELTEKIT_BUILD_DIRNAME', kind: 'variable' },
|
|
378
|
+
{ name: 'SVELTEKIT_DIST_DIRNAME', kind: 'variable' },
|
|
379
|
+
{ name: 'SVELTEKIT_VITE_CACHE_PATH', kind: 'variable' },
|
|
380
|
+
{ name: 'GITHUB_DIRNAME', kind: 'variable' },
|
|
381
|
+
{ name: 'GIT_DIRNAME', kind: 'variable' },
|
|
382
|
+
{ name: 'TSCONFIG_FILENAME', kind: 'variable' },
|
|
383
|
+
{ name: 'TS_MATCHER', kind: 'variable' },
|
|
384
|
+
{ name: 'JS_MATCHER', kind: 'variable' },
|
|
385
|
+
{ name: 'JSON_MATCHER', kind: 'variable' },
|
|
386
|
+
{ name: 'EVERYTHING_MATCHER', kind: 'variable' },
|
|
387
|
+
{ name: 'JS_CLI_DEFAULT', kind: 'variable' },
|
|
388
|
+
{ name: 'PM_CLI_DEFAULT', kind: 'variable' },
|
|
389
|
+
{ name: 'PRETTIER_CLI_DEFAULT', kind: 'variable' },
|
|
390
|
+
],
|
|
391
|
+
},
|
|
362
392
|
'./deploy.task.js': {
|
|
363
393
|
path: 'deploy.task.ts',
|
|
364
394
|
declarations: [
|
|
@@ -539,8 +569,8 @@ export const src_json = {
|
|
|
539
569
|
{ name: 'Raw_Gro_Config', kind: 'type' },
|
|
540
570
|
{ name: 'Create_Gro_Config', kind: 'type' },
|
|
541
571
|
{ name: 'create_empty_gro_config', kind: 'function' },
|
|
542
|
-
{ name: '
|
|
543
|
-
{ name: '
|
|
572
|
+
{ name: 'SEARCH_EXCLUDER_DEFAULT', kind: 'variable' },
|
|
573
|
+
{ name: 'EXPORTS_EXCLUDER_DEFAULT', kind: 'variable' },
|
|
544
574
|
{ name: 'normalize_gro_config', kind: 'function' },
|
|
545
575
|
{ name: 'Gro_Config_Module', kind: 'type' },
|
|
546
576
|
{ name: 'load_gro_config', kind: 'function' },
|
|
@@ -710,36 +740,6 @@ export const src_json = {
|
|
|
710
740
|
{ name: 'parse_imports', kind: 'function' },
|
|
711
741
|
],
|
|
712
742
|
},
|
|
713
|
-
'./path_constants.js': {
|
|
714
|
-
path: 'path_constants.ts',
|
|
715
|
-
declarations: [
|
|
716
|
-
{ name: 'SOURCE_DIRNAME', kind: 'variable' },
|
|
717
|
-
{ name: 'GRO_DIRNAME', kind: 'variable' },
|
|
718
|
-
{ name: 'GRO_DIST_PREFIX', kind: 'variable' },
|
|
719
|
-
{ name: 'SERVER_DIST_PATH', kind: 'variable' },
|
|
720
|
-
{ name: 'GRO_DEV_DIRNAME', kind: 'variable' },
|
|
721
|
-
{ name: 'SOURCE_DIR', kind: 'variable' },
|
|
722
|
-
{ name: 'GRO_DIR', kind: 'variable' },
|
|
723
|
-
{ name: 'GRO_DEV_DIR', kind: 'variable' },
|
|
724
|
-
{ name: 'GRO_CONFIG_PATH', kind: 'variable' },
|
|
725
|
-
{ name: 'README_FILENAME', kind: 'variable' },
|
|
726
|
-
{ name: 'SVELTEKIT_CONFIG_FILENAME', kind: 'variable' },
|
|
727
|
-
{ name: 'VITE_CONFIG_FILENAME', kind: 'variable' },
|
|
728
|
-
{ name: 'NODE_MODULES_DIRNAME', kind: 'variable' },
|
|
729
|
-
{ name: 'LOCKFILE_FILENAME', kind: 'variable' },
|
|
730
|
-
{ name: 'SVELTEKIT_DEV_DIRNAME', kind: 'variable' },
|
|
731
|
-
{ name: 'SVELTEKIT_BUILD_DIRNAME', kind: 'variable' },
|
|
732
|
-
{ name: 'SVELTEKIT_DIST_DIRNAME', kind: 'variable' },
|
|
733
|
-
{ name: 'SVELTEKIT_VITE_CACHE_PATH', kind: 'variable' },
|
|
734
|
-
{ name: 'GITHUB_DIRNAME', kind: 'variable' },
|
|
735
|
-
{ name: 'GIT_DIRNAME', kind: 'variable' },
|
|
736
|
-
{ name: 'TSCONFIG_FILENAME', kind: 'variable' },
|
|
737
|
-
{ name: 'TS_MATCHER', kind: 'variable' },
|
|
738
|
-
{ name: 'JS_MATCHER', kind: 'variable' },
|
|
739
|
-
{ name: 'JSON_MATCHER', kind: 'variable' },
|
|
740
|
-
{ name: 'EVERYTHING_MATCHER', kind: 'variable' },
|
|
741
|
-
],
|
|
742
|
-
},
|
|
743
743
|
'./path.js': {
|
|
744
744
|
path: 'path.ts',
|
|
745
745
|
declarations: [
|
package/dist/package_json.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const Url: z.ZodString;
|
|
|
5
5
|
export type Url = Flavored<z.infer<typeof Url>, 'Url'>;
|
|
6
6
|
export declare const Email: z.ZodString;
|
|
7
7
|
export type Email = Flavored<z.infer<typeof Email>, 'Email'>;
|
|
8
|
-
export declare const transform_empty_object_to_undefined: (val:
|
|
8
|
+
export declare const transform_empty_object_to_undefined: <T>(val: T) => T | undefined;
|
|
9
9
|
export declare const Package_Json_Repository: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
10
10
|
type: z.ZodString;
|
|
11
11
|
url: z.ZodString;
|
|
@@ -45,7 +45,7 @@ export declare const Package_Json_Funding: z.ZodUnion<[z.ZodString, z.ZodObject<
|
|
|
45
45
|
url: z.ZodString;
|
|
46
46
|
}, z.ZodTypeAny, "passthrough">>]>;
|
|
47
47
|
export type Package_Json_Funding = z.infer<typeof Package_Json_Funding>;
|
|
48
|
-
export declare const Package_Json_Exports: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString
|
|
48
|
+
export declare const Package_Json_Exports: z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>>]>>>;
|
|
49
49
|
export type Package_Json_Exports = z.infer<typeof Package_Json_Exports>;
|
|
50
50
|
/**
|
|
51
51
|
* @see https://docs.npmjs.com/cli/v10/configuring-npm/package-json
|
|
@@ -150,7 +150,8 @@ export declare const Package_Json: z.ZodObject<{
|
|
|
150
150
|
bin: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
151
151
|
sideEffects: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
152
152
|
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
153
|
-
|
|
153
|
+
main: z.ZodOptional<z.ZodString>;
|
|
154
|
+
exports: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>>]>>>, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined> | undefined, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined>>>;
|
|
154
155
|
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
155
156
|
name: z.ZodString;
|
|
156
157
|
version: z.ZodString;
|
|
@@ -251,7 +252,8 @@ export declare const Package_Json: z.ZodObject<{
|
|
|
251
252
|
bin: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
252
253
|
sideEffects: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
253
254
|
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
254
|
-
|
|
255
|
+
main: z.ZodOptional<z.ZodString>;
|
|
256
|
+
exports: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>>]>>>, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined> | undefined, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined>>>;
|
|
255
257
|
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
256
258
|
name: z.ZodString;
|
|
257
259
|
version: z.ZodString;
|
|
@@ -352,12 +354,13 @@ export declare const Package_Json: z.ZodObject<{
|
|
|
352
354
|
bin: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
353
355
|
sideEffects: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
354
356
|
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
355
|
-
|
|
357
|
+
main: z.ZodOptional<z.ZodString>;
|
|
358
|
+
exports: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodString>>>>]>>>, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined> | undefined, Record<string, string | Record<string, string | undefined> | Record<string, Record<string, string | undefined> | undefined> | undefined>>>;
|
|
356
359
|
}, z.ZodTypeAny, "passthrough">>;
|
|
357
360
|
export type Package_Json = z.infer<typeof Package_Json>;
|
|
358
361
|
export type Map_Package_Json = (package_json: Package_Json) => Package_Json | null | Promise<Package_Json | null>;
|
|
359
362
|
export declare const EMPTY_PACKAGE_JSON: Package_Json;
|
|
360
|
-
export declare const load_package_json: (dir?: string, cache?: Record<string, Package_Json
|
|
363
|
+
export declare const load_package_json: (dir?: string, cache?: Record<string, Package_Json>, parse?: boolean) => Package_Json;
|
|
361
364
|
export declare const sync_package_json: (map_package_json: Map_Package_Json, log: Logger, check?: boolean, dir?: string, exports_dir?: string) => Promise<{
|
|
362
365
|
package_json: Package_Json | null;
|
|
363
366
|
changed: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package_json.d.ts","sourceRoot":"../src/lib/","sources":["package_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAUtD,eAAO,MAAM,GAAG,aAAa,CAAC;AAC9B,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;AAGvD,eAAO,MAAM,KAAK,aAAa,CAAC;AAChC,MAAM,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;AAG7D,eAAO,MAAM,mCAAmC,
|
|
1
|
+
{"version":3,"file":"package_json.d.ts","sourceRoot":"../src/lib/","sources":["package_json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;AAUtD,eAAO,MAAM,GAAG,aAAa,CA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B,OAGyC,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,YAAY,iBAAkB,YAAY,KAAG,gBAAgB,EAezE,CAAC"}
|
package/dist/package_json.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFileSync, writeFileSync } from 'node:fs';
|
|
|
4
4
|
import { count_graphemes, plural, strip_end } from '@ryanatkn/belt/string.js';
|
|
5
5
|
import { styleText as st } from 'node:util';
|
|
6
6
|
import { paths, gro_paths, IS_THIS_GRO, replace_extension } from './paths.js';
|
|
7
|
-
import { SVELTEKIT_DIST_DIRNAME } from './
|
|
7
|
+
import { SVELTEKIT_DIST_DIRNAME } from './constants.js';
|
|
8
8
|
import { search_fs } from './search_fs.js';
|
|
9
9
|
import { has_sveltekit_library } from './sveltekit_helpers.js';
|
|
10
10
|
import { GITHUB_REPO_MATCHER } from './github.js';
|
|
@@ -48,7 +48,18 @@ export const Package_Json_Funding = z.union([
|
|
|
48
48
|
})
|
|
49
49
|
.passthrough(),
|
|
50
50
|
]);
|
|
51
|
-
|
|
51
|
+
// exports: {
|
|
52
|
+
// './': './index.js',
|
|
53
|
+
// './record': {default: './record.js'},
|
|
54
|
+
// './export_condition': {default: {development: './ec1', default: './ec2.js'}},
|
|
55
|
+
// }
|
|
56
|
+
export const Package_Json_Exports = z.record(z
|
|
57
|
+
.union([
|
|
58
|
+
z.string(),
|
|
59
|
+
z.record(z.string().optional()),
|
|
60
|
+
z.record(z.record(z.string().optional()).optional()),
|
|
61
|
+
])
|
|
62
|
+
.optional());
|
|
52
63
|
/**
|
|
53
64
|
* @see https://docs.npmjs.com/cli/v10/configuring-npm/package-json
|
|
54
65
|
*/
|
|
@@ -57,7 +68,7 @@ export const Package_Json = z
|
|
|
57
68
|
// according to the npm docs, `name` and `version` are the only required properties
|
|
58
69
|
name: z.string(),
|
|
59
70
|
version: z.string(),
|
|
60
|
-
private: z.boolean({ description: 'disallow
|
|
71
|
+
private: z.boolean({ description: 'disallow publishing to the configured registry' }).optional(),
|
|
61
72
|
public: z
|
|
62
73
|
.boolean({
|
|
63
74
|
description: 'a Gro extension that enables publishing `.well-known/package.json` and `.well-known/src`',
|
|
@@ -106,11 +117,12 @@ export const Package_Json = z
|
|
|
106
117
|
bin: z.record(z.string()).optional(),
|
|
107
118
|
sideEffects: z.array(z.string()).optional(),
|
|
108
119
|
files: z.array(z.string()).optional(),
|
|
120
|
+
main: z.string().optional(),
|
|
109
121
|
exports: Package_Json_Exports.transform(transform_empty_object_to_undefined).optional(),
|
|
110
122
|
})
|
|
111
123
|
.passthrough();
|
|
112
124
|
export const EMPTY_PACKAGE_JSON = { name: '', version: '' };
|
|
113
|
-
export const load_package_json = (dir = IS_THIS_GRO ? gro_paths.root : paths.root, cache) => {
|
|
125
|
+
export const load_package_json = (dir = IS_THIS_GRO ? gro_paths.root : paths.root, cache, parse = true) => {
|
|
114
126
|
let package_json;
|
|
115
127
|
if (cache && dir in cache) {
|
|
116
128
|
return cache[dir];
|
|
@@ -121,9 +133,12 @@ export const load_package_json = (dir = IS_THIS_GRO ? gro_paths.root : paths.roo
|
|
|
121
133
|
catch (_err) {
|
|
122
134
|
return EMPTY_PACKAGE_JSON;
|
|
123
135
|
}
|
|
124
|
-
|
|
125
|
-
|
|
136
|
+
if (parse) {
|
|
137
|
+
package_json = parse_package_json(Package_Json, package_json);
|
|
138
|
+
}
|
|
139
|
+
if (cache) {
|
|
126
140
|
cache[dir] = package_json;
|
|
141
|
+
}
|
|
127
142
|
return package_json;
|
|
128
143
|
};
|
|
129
144
|
export const sync_package_json = async (map_package_json, log, check = false, dir = paths.root, exports_dir = paths.lib) => {
|
package/dist/package_meta.d.ts
CHANGED
package/dist/parse_imports.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { init, parse } from 'es-module-lexer';
|
|
2
2
|
import { SVELTE_MATCHER } from './svelte_helpers.js';
|
|
3
|
-
import { JS_MATCHER, TS_MATCHER } from './
|
|
3
|
+
import { JS_MATCHER, TS_MATCHER } from './constants.js';
|
|
4
4
|
export const init_lexer = () => init;
|
|
5
5
|
const script_matcher = /<script.*?>(.*?)<\/script>/gimsu;
|
|
6
6
|
export const parse_imports = (id, contents, ignore_types = true) => {
|
package/dist/paths.js
CHANGED
|
@@ -2,7 +2,7 @@ import { join, extname, relative, basename } from 'node:path';
|
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { strip_end } from '@ryanatkn/belt/string.js';
|
|
4
4
|
import { styleText as st } from 'node:util';
|
|
5
|
-
import { GRO_CONFIG_PATH, GRO_DEV_DIR, GRO_DIR, SOURCE_DIR, SVELTEKIT_DIST_DIRNAME, } from './
|
|
5
|
+
import { GRO_CONFIG_PATH, GRO_DEV_DIR, GRO_DIR, SOURCE_DIR, SVELTEKIT_DIST_DIRNAME, } from './constants.js';
|
|
6
6
|
import { default_sveltekit_config } from './sveltekit_config.js';
|
|
7
7
|
/*
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.task.d.ts","sourceRoot":"../src/lib/","sources":["publish.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"publish.task.d.ts","sourceRoot":"../src/lib/","sources":["publish.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAgBhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA0I3B,CAAC"}
|
package/dist/publish.task.js
CHANGED
|
@@ -5,18 +5,11 @@ import { existsSync } from 'node:fs';
|
|
|
5
5
|
import { Task_Error } from './task.js';
|
|
6
6
|
import { load_package_json, parse_repo_url } from './package_json.js';
|
|
7
7
|
import { find_cli, spawn_cli } from './cli.js';
|
|
8
|
-
import { IS_THIS_GRO } from './paths.js';
|
|
9
8
|
import { has_sveltekit_library } from './sveltekit_helpers.js';
|
|
10
9
|
import { update_changelog } from './changelog.js';
|
|
11
10
|
import { load_from_env } from './env.js';
|
|
12
11
|
import { Git_Branch, Git_Origin, git_check_clean_workspace, git_checkout, git_fetch, git_pull, } from './git.js';
|
|
13
12
|
import { CHANGESET_CLI } from './changeset_helpers.js';
|
|
14
|
-
// publish.task.ts
|
|
15
|
-
// - usage: `gro publish patch`
|
|
16
|
-
// - forwards args to `npm version`: https://docs.npmjs.com/v6/commands/npm-version
|
|
17
|
-
// - runs the production build
|
|
18
|
-
// - publishes to npm from the `main` branch, configurable with `--branch`
|
|
19
|
-
// - syncs commits and tags to the configured main branch
|
|
20
13
|
export const Args = z
|
|
21
14
|
.object({
|
|
22
15
|
branch: Git_Branch.describe('branch to publish from').default('main'),
|
|
@@ -34,9 +27,7 @@ export const Args = z
|
|
|
34
27
|
.boolean({ description: 'build and prepare to publish without actually publishing' })
|
|
35
28
|
.default(false),
|
|
36
29
|
check: z.boolean({ description: 'dual of no-check' }).default(true),
|
|
37
|
-
'no-check': z
|
|
38
|
-
.boolean({ description: 'opt out of npm checking before publishing' })
|
|
39
|
-
.default(false),
|
|
30
|
+
'no-check': z.boolean({ description: 'opt out of checking before publishing' }).default(false),
|
|
40
31
|
build: z.boolean({ description: 'dual of no-build' }).default(true),
|
|
41
32
|
'no-build': z.boolean({ description: 'opt out of building' }).default(false),
|
|
42
33
|
pull: z.boolean({ description: 'dual of no-pull' }).default(true),
|
|
@@ -45,7 +36,7 @@ export const Args = z
|
|
|
45
36
|
})
|
|
46
37
|
.strict();
|
|
47
38
|
export const task = {
|
|
48
|
-
summary: 'bump version, publish to
|
|
39
|
+
summary: 'bump version, publish to the configured registry, and git push',
|
|
49
40
|
Args,
|
|
50
41
|
run: async ({ args, log, invoke_task }) => {
|
|
51
42
|
const { branch, origin, changelog, preserve_changelog, dry, check, build, pull, optional, changeset_cli, } = args;
|
|
@@ -56,10 +47,6 @@ export const task = {
|
|
|
56
47
|
if (!has_sveltekit_library_result.ok) {
|
|
57
48
|
throw new Task_Error('Failed to find SvelteKit library: ' + has_sveltekit_library_result.message);
|
|
58
49
|
}
|
|
59
|
-
// TODO hacky, ensures Gro bootstraps itself
|
|
60
|
-
if (IS_THIS_GRO) {
|
|
61
|
-
await spawn('npm', ['run', 'build']);
|
|
62
|
-
}
|
|
63
50
|
const changelog_exists = existsSync(changelog);
|
|
64
51
|
const found_changeset_cli = find_cli(changeset_cli);
|
|
65
52
|
if (!found_changeset_cli) {
|
|
@@ -100,9 +87,9 @@ export const task = {
|
|
|
100
87
|
' or an object with the `url` key');
|
|
101
88
|
}
|
|
102
89
|
// This is the first line that alters the repo.
|
|
103
|
-
const
|
|
104
|
-
if (!
|
|
105
|
-
throw Error('
|
|
90
|
+
const changeset_ersion_result = await spawn_cli(found_changeset_cli, ['version'], log);
|
|
91
|
+
if (!changeset_ersion_result?.ok) {
|
|
92
|
+
throw Error('changeset version failed: no commits were made: see the error above');
|
|
106
93
|
}
|
|
107
94
|
if (!preserve_changelog) {
|
|
108
95
|
const token = load_from_env('GITHUB_TOKEN_SECRET');
|
|
@@ -140,8 +127,8 @@ export const task = {
|
|
|
140
127
|
log.info(st('green', 'dry run complete!'));
|
|
141
128
|
return;
|
|
142
129
|
}
|
|
143
|
-
const
|
|
144
|
-
if (!
|
|
130
|
+
const changeset_publish_result = await spawn_cli(found_changeset_cli, ['publish'], log);
|
|
131
|
+
if (!changeset_publish_result?.ok) {
|
|
145
132
|
throw new Task_Error(`\`${changeset_cli} publish\` failed - continue manually or try again after running \`git reset --hard\``);
|
|
146
133
|
}
|
|
147
134
|
if (!changelog_exists && existsSync(changelog)) {
|
package/dist/reinstall.task.js
CHANGED
|
@@ -2,31 +2,31 @@ import { z } from 'zod';
|
|
|
2
2
|
import { spawn } from '@ryanatkn/belt/process.js';
|
|
3
3
|
import { rm } from 'node:fs/promises';
|
|
4
4
|
import { Task_Error } from './task.js';
|
|
5
|
-
import { LOCKFILE_FILENAME, NODE_MODULES_DIRNAME } from './
|
|
5
|
+
import { LOCKFILE_FILENAME, NODE_MODULES_DIRNAME } from './constants.js';
|
|
6
6
|
export const Args = z.object({}).strict();
|
|
7
7
|
export const task = {
|
|
8
8
|
summary: `refreshes ${LOCKFILE_FILENAME} with the latest and cleanest deps`,
|
|
9
9
|
Args,
|
|
10
|
-
run: async ({ log }) => {
|
|
11
|
-
log.info(
|
|
12
|
-
const initial_install_result = await spawn(
|
|
10
|
+
run: async ({ log, config }) => {
|
|
11
|
+
log.info(`running the initial \`${config.pm_cli} install\``);
|
|
12
|
+
const initial_install_result = await spawn(config.pm_cli, ['install']);
|
|
13
13
|
if (!initial_install_result.ok) {
|
|
14
|
-
throw new Task_Error(
|
|
14
|
+
throw new Task_Error(`Failed initial \`${config.pm_cli} install\``);
|
|
15
15
|
}
|
|
16
16
|
// Deleting both the lockfile and node_modules upgrades to the latest minor/patch versions.
|
|
17
17
|
await Promise.all([rm(LOCKFILE_FILENAME), rm(NODE_MODULES_DIRNAME, { recursive: true })]);
|
|
18
|
-
log.info(`running
|
|
19
|
-
const second_install_result = await spawn(
|
|
18
|
+
log.info(`running \`${config.pm_cli} install\` after deleting ${LOCKFILE_FILENAME} and ${NODE_MODULES_DIRNAME}, this can take a while...`);
|
|
19
|
+
const second_install_result = await spawn(config.pm_cli, ['install']);
|
|
20
20
|
if (!second_install_result.ok) {
|
|
21
|
-
throw new Task_Error(`Failed
|
|
21
|
+
throw new Task_Error(`Failed \`${config.pm_cli} install\` after deleting ${LOCKFILE_FILENAME} and ${NODE_MODULES_DIRNAME}`);
|
|
22
22
|
}
|
|
23
23
|
// Deleting the lockfile and reinstalling cleans the lockfile of unnecessary dep noise,
|
|
24
24
|
// like esbuild's many packages for each platform.
|
|
25
25
|
await rm(LOCKFILE_FILENAME);
|
|
26
|
-
log.info(`running
|
|
27
|
-
const final_install_result = await spawn(
|
|
26
|
+
log.info(`running \`${config.pm_cli} install\` one last time to clean ${LOCKFILE_FILENAME}`);
|
|
27
|
+
const final_install_result = await spawn(config.pm_cli, ['install']);
|
|
28
28
|
if (!final_install_result.ok) {
|
|
29
|
-
throw new Task_Error(
|
|
29
|
+
throw new Task_Error(`Failed \`${config.pm_cli} install\``);
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { Package_Json } from './package_json.js';
|
|
2
2
|
import type { Resolved_Specifier } from './resolve_specifier.js';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Like `resolve_specifier` but for Node specifiers,
|
|
5
|
+
* typically those that aren't relative or absolute.
|
|
6
|
+
* Optionally return `null` instead of throwing by setting
|
|
7
|
+
* `throw_on_missing_package` to `false`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const resolve_node_specifier: (specifier: string, dir?: string, parent_path?: string, cache?: Record<string, Package_Json>, throw_on_missing_package?: boolean, exports_condition?: string) => Resolved_Specifier | null;
|
|
4
10
|
//# sourceMappingURL=resolve_node_specifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_node_specifier.d.ts","sourceRoot":"../src/lib/","sources":["resolve_node_specifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve_node_specifier.d.ts","sourceRoot":"../src/lib/","sources":["resolve_node_specifier.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,YAAY,EAA0C,MAAM,mBAAmB,CAAC;AAGxF,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,cACvB,MAAM,8BAEH,MAAM,UACZ,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,qEAIlC,kBAAkB,GAAG,IAqEvB,CAAC"}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import {
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { DEV } from 'esm-env';
|
|
4
|
+
import { Package_Json, Package_Json_Exports, load_package_json } from './package_json.js';
|
|
3
5
|
import { paths } from './paths.js';
|
|
4
|
-
import { NODE_MODULES_DIRNAME } from './
|
|
5
|
-
|
|
6
|
+
import { NODE_MODULES_DIRNAME } from './constants.js';
|
|
7
|
+
/**
|
|
8
|
+
* Like `resolve_specifier` but for Node specifiers,
|
|
9
|
+
* typically those that aren't relative or absolute.
|
|
10
|
+
* Optionally return `null` instead of throwing by setting
|
|
11
|
+
* `throw_on_missing_package` to `false`.
|
|
12
|
+
*/
|
|
13
|
+
export const resolve_node_specifier = (specifier, dir = paths.root, parent_path, cache, throw_on_missing_package = true,
|
|
14
|
+
// TODO this needs to use `--conditions`/`-C` to determine the correct key
|
|
15
|
+
exports_condition = DEV ? 'development' : 'default') => {
|
|
6
16
|
const raw = specifier.endsWith('?raw');
|
|
7
17
|
const mapped_specifier = raw ? specifier.substring(0, specifier.length - 4) : specifier;
|
|
8
|
-
|
|
18
|
+
// Parse the specifier
|
|
19
|
+
let idx = -1;
|
|
9
20
|
if (mapped_specifier[0] === '@') {
|
|
10
21
|
// get the index of the second `/`
|
|
11
22
|
let count = 0;
|
|
@@ -21,18 +32,42 @@ export const resolve_node_specifier = (specifier, dir = paths.root, parent_url,
|
|
|
21
32
|
else {
|
|
22
33
|
idx = mapped_specifier.indexOf('/');
|
|
23
34
|
}
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const subpath = './' +
|
|
27
|
-
const package_dir = join(dir, NODE_MODULES_DIRNAME,
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
const pkg_name = idx === -1 ? mapped_specifier : mapped_specifier.substring(0, idx);
|
|
36
|
+
const module_path = idx === -1 ? '' : mapped_specifier.substring(idx + 1);
|
|
37
|
+
const subpath = module_path ? './' + module_path : '.';
|
|
38
|
+
const package_dir = join(dir, NODE_MODULES_DIRNAME, pkg_name);
|
|
39
|
+
if (!existsSync(package_dir)) {
|
|
40
|
+
if (throw_on_missing_package) {
|
|
41
|
+
throw Error(`Package not found at ${package_dir} for specifier ${specifier}, you may need to install packages or fix the path` +
|
|
42
|
+
(parent_path ? ` imported from ${parent_path}` : ''));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const package_json = load_package_json(package_dir, cache, false);
|
|
49
|
+
const { exported, exports_key } = resolve_subpath(package_json, specifier, subpath);
|
|
30
50
|
if (!exported) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(
|
|
51
|
+
if (throw_on_missing_package) {
|
|
52
|
+
// same error message as Node
|
|
53
|
+
throw Error(`[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath '${subpath}' is not defined by 'exports' in ${package_dir}/package.json` +
|
|
54
|
+
(parent_path ? ` imported from ${parent_path}` : ''));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
34
59
|
}
|
|
35
|
-
const
|
|
60
|
+
const exported_value = resolve_exported_value(exported, exports_key, exports_condition);
|
|
61
|
+
if (exported_value === undefined) {
|
|
62
|
+
if (throw_on_missing_package) {
|
|
63
|
+
throw Error(`Package subpath '${subpath}' does not define the key '${exports_key}' in 'exports' in ${package_dir}/package.json` +
|
|
64
|
+
(parent_path ? ` imported from ${parent_path}` : ''));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const path_id = join(package_dir, exported_value);
|
|
36
71
|
return {
|
|
37
72
|
path_id,
|
|
38
73
|
path_id_with_querystring: raw ? path_id + '?raw' : path_id,
|
|
@@ -42,3 +77,32 @@ export const resolve_node_specifier = (specifier, dir = paths.root, parent_url,
|
|
|
42
77
|
namespace: undefined,
|
|
43
78
|
};
|
|
44
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Resolves the subpath of a package.json `exports` field based on the `specifier`.
|
|
82
|
+
*/
|
|
83
|
+
const resolve_subpath = (package_json, specifier, subpath) => {
|
|
84
|
+
const exports_key = specifier.endsWith('.svelte') ? 'svelte' : 'default';
|
|
85
|
+
const exported = subpath === '.' && !package_json.exports
|
|
86
|
+
? { [exports_key]: package_json.main }
|
|
87
|
+
: package_json.exports?.[subpath];
|
|
88
|
+
return { exported, exports_key };
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Resolves the exported value based on the exports key and condition.
|
|
92
|
+
*/
|
|
93
|
+
const resolve_exported_value = (exported, exports_key, exports_condition) => {
|
|
94
|
+
let exported_value = typeof exported === 'string' ? exported : exported[exports_key];
|
|
95
|
+
// TODO best effort fallback, support `default` but fall back to `import` or `node` as the exports key.
|
|
96
|
+
if (exported_value === undefined && typeof exported !== 'string' && exports_key === 'default') {
|
|
97
|
+
exported_value = exported.import ?? exported.node;
|
|
98
|
+
}
|
|
99
|
+
// Possibly resolve to conditional exports.
|
|
100
|
+
exported_value =
|
|
101
|
+
exported_value === undefined || typeof exported_value === 'string'
|
|
102
|
+
? exported_value
|
|
103
|
+
: (exported_value[exports_condition] ??
|
|
104
|
+
exported_value.default ??
|
|
105
|
+
exported_value.import ??
|
|
106
|
+
exported_value.node); // TODO this fallback has corner case bugs for off-spec exports
|
|
107
|
+
return exported_value;
|
|
108
|
+
};
|
|
@@ -14,13 +14,9 @@ export interface Resolved_Specifier {
|
|
|
14
14
|
raw: boolean;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Maps
|
|
17
|
+
* Maps an import `specifier` relative to `dir`,
|
|
18
18
|
* and infer the correct extension following Vite conventions.
|
|
19
|
-
* If no `.js` file is found for the
|
|
20
|
-
* @param specifier
|
|
21
|
-
* @param dir - if defined, enables relative importers like from esbuild plugins
|
|
22
|
-
* @param passthrough_extensions - used to support specifiers that have no file extention, which Vite supports, so we do our best effort
|
|
23
|
-
* @returns
|
|
19
|
+
* If no `.js` file is found for the specifier on the filesystem, it assumes `.ts`.
|
|
24
20
|
*/
|
|
25
21
|
export declare const resolve_specifier: (specifier: string, dir: string) => Resolved_Specifier;
|
|
26
22
|
//# sourceMappingURL=resolve_specifier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_specifier.d.ts","sourceRoot":"../src/lib/","sources":["resolve_specifier.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;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
|
|
1
|
+
{"version":3,"file":"resolve_specifier.d.ts","sourceRoot":"../src/lib/","sources":["resolve_specifier.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAEvC,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;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,cAAe,MAAM,OAAO,MAAM,KAAG,kBAgDlE,CAAC"}
|