@ryanatkn/gro 0.140.4 → 0.140.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +22 -10
- package/dist/moss_helpers.d.ts +1 -1
- package/dist/moss_helpers.d.ts.map +1 -1
- package/dist/moss_helpers.js +16 -8
- package/dist/package.js +2 -2
- package/package.json +1 -1
- package/src/lib/filer.ts +22 -12
- package/src/lib/moss_helpers.ts +17 -7
- package/src/lib/package.ts +2 -2
package/README.md
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
[Windows won't be supported](https://github.com/ryanatkn/gro/issues/319), I chose Bash instead.
|
|
10
10
|
|
|
11
11
|
Feel free to open issues with anything you'd like to discuss or report.
|
|
12
|
-
I also run [a Discord community](https://discord.gg/YU5tyeK72X) that includes channels for Gro.
|
|
13
12
|
|
|
14
13
|
## about
|
|
15
14
|
|
package/dist/filer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["filer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAGzD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EACN,SAAS,EAET,KAAK,cAAc,EACnB,KAAK,OAAO,IAAI,iBAAiB,EAEjC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["filer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAGzD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EACN,SAAS,EAET,KAAK,cAAc,EACnB,KAAK,OAAO,IAAI,iBAAiB,EAEjC,MAAM,gBAAgB,CAAC;AAYxB,MAAM,WAAW,WAAW;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IACtC,YAAY,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;CACxC;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,KAAK,IAAI,CAAC;AAEzF,MAAM,WAAW,OAAO;IACvB,SAAS,CAAC,EAAE,OAAO,SAAS,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC,CAAC;CACzE;AAED,qBAAa,KAAK;;IACjB,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,CAAa;gBAKjC,OAAO,GAAE,OAAsB;IAU3C,SAAS,OAAQ,OAAO,KAAG,WAAW,GAAG,SAAS,CAEhD;IAEF,aAAa,OAAQ,OAAO,KAAG,WAAW,CAWxC;IAyII,KAAK,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAKxD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ5B"}
|
package/dist/filer.js
CHANGED
|
@@ -9,7 +9,8 @@ import { resolve_specifier } from './resolve_specifier.js';
|
|
|
9
9
|
import { default_sveltekit_config } from './sveltekit_config.js';
|
|
10
10
|
import { map_sveltekit_aliases } from './sveltekit_helpers.js';
|
|
11
11
|
import { Unreachable_Error } from '@ryanatkn/belt/error.js';
|
|
12
|
-
|
|
12
|
+
// TODO see below
|
|
13
|
+
// import {resolve_node_specifier} from './resolve_node_specifier.js';
|
|
13
14
|
const aliases = Object.entries(default_sveltekit_config.alias);
|
|
14
15
|
export class Filer {
|
|
15
16
|
files = new Map();
|
|
@@ -53,16 +54,27 @@ export class Filer {
|
|
|
53
54
|
// TODO logic is duplicated from loader
|
|
54
55
|
const path = map_sveltekit_aliases(specifier, aliases);
|
|
55
56
|
// The specifier `path` has now been mapped to its final form, so we can inspect it.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
d.dependents.set(file.id, file);
|
|
57
|
+
if (path[0] === '.' || path[0] === '/') {
|
|
58
|
+
const { path_id } = resolve_specifier(path, dir);
|
|
59
|
+
dependencies_removed.delete(path_id);
|
|
60
|
+
if (!dependencies_before.has(path_id)) {
|
|
61
|
+
const d = this.get_or_create(path_id);
|
|
62
|
+
file.dependencies.set(d.id, d);
|
|
63
|
+
d.dependents.set(file.id, file);
|
|
64
|
+
}
|
|
65
65
|
}
|
|
66
|
+
// TODO this doesn't work
|
|
67
|
+
// const resolved =
|
|
68
|
+
// path[0] === '.' || path[0] === '/'
|
|
69
|
+
// ? resolve_specifier(path, dir)
|
|
70
|
+
// : resolve_node_specifier(path, dir);
|
|
71
|
+
// const {path_id} = resolved;
|
|
72
|
+
// dependencies_removed.delete(path_id);
|
|
73
|
+
// if (!dependencies_before.has(path_id)) {
|
|
74
|
+
// const d = this.get_or_create(path_id);
|
|
75
|
+
// file.dependencies.set(d.id, d);
|
|
76
|
+
// d.dependents.set(file.id, file);
|
|
77
|
+
// }
|
|
66
78
|
}
|
|
67
79
|
// update any removed dependencies
|
|
68
80
|
for (const dependency_removed of dependencies_removed) {
|
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) => Promise<Result<{
|
|
4
|
+
export declare const load_moss_plugin: (package_json?: Package_Json, dep_name?: string, plugin_path?: string, local_plugin_path?: 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;AAE7D,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,kBACb,YAAY,
|
|
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;AAE7D,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,kBACb,YAAY,0EAIzB,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
|
@@ -3,20 +3,28 @@ import { resolve } from 'node:path';
|
|
|
3
3
|
import { has_dep } from './package_json.js';
|
|
4
4
|
export const MOSS_PACKAGE_DEP_NAME = '@ryanatkn/moss';
|
|
5
5
|
// TODO plugin type?
|
|
6
|
-
export const load_moss_plugin = async (package_json, dep_name = MOSS_PACKAGE_DEP_NAME, plugin_path = `node_modules/${dep_name}/dist/gro_plugin_moss.js`
|
|
6
|
+
export const load_moss_plugin = async (package_json, dep_name = MOSS_PACKAGE_DEP_NAME, plugin_path = `node_modules/${dep_name}/dist/gro_plugin_moss.js`, // TODO maybe lookup from its `package_json.exports`? kinda unnecessary
|
|
7
|
+
local_plugin_path = 'src/lib/gro_plugin_moss.ts') => {
|
|
7
8
|
if (!has_dep(dep_name, package_json)) {
|
|
8
9
|
return {
|
|
9
10
|
ok: false,
|
|
10
11
|
message: `no dependency found in package.json for ${dep_name}, install it with \`npm i -D ${dep_name}\``,
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
let path = undefined;
|
|
15
|
+
const resolved_local_plugin_path = resolve(local_plugin_path);
|
|
16
|
+
if (existsSync(resolved_local_plugin_path)) {
|
|
17
|
+
path = resolved_local_plugin_path;
|
|
18
|
+
}
|
|
19
|
+
if (path === undefined) {
|
|
20
|
+
path = resolve(plugin_path);
|
|
21
|
+
if (!existsSync(path)) {
|
|
22
|
+
return {
|
|
23
|
+
ok: false,
|
|
24
|
+
// TODO warn?
|
|
25
|
+
message: `dependency on ${dep_name} detected but plugin not found at ${path}`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
20
28
|
}
|
|
21
29
|
const mod = await import(path);
|
|
22
30
|
return { ok: true, gro_plugin_moss: mod.gro_plugin_moss };
|
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.140.
|
|
4
|
+
version: '0.140.5',
|
|
5
5
|
description: 'task runner and toolkit extending SvelteKit',
|
|
6
6
|
motto: 'generate, run, optimize',
|
|
7
7
|
glyph: '🌰',
|
|
@@ -264,7 +264,7 @@ export const package_json = {
|
|
|
264
264
|
};
|
|
265
265
|
export const src_json = {
|
|
266
266
|
name: '@ryanatkn/gro',
|
|
267
|
-
version: '0.140.
|
|
267
|
+
version: '0.140.5',
|
|
268
268
|
modules: {
|
|
269
269
|
'.': {
|
|
270
270
|
path: 'index.ts',
|
package/package.json
CHANGED
package/src/lib/filer.ts
CHANGED
|
@@ -18,7 +18,8 @@ import {resolve_specifier} from './resolve_specifier.js';
|
|
|
18
18
|
import {default_sveltekit_config} from './sveltekit_config.js';
|
|
19
19
|
import {map_sveltekit_aliases} from './sveltekit_helpers.js';
|
|
20
20
|
import {Unreachable_Error} from '@ryanatkn/belt/error.js';
|
|
21
|
-
|
|
21
|
+
// TODO see below
|
|
22
|
+
// import {resolve_node_specifier} from './resolve_node_specifier.js';
|
|
22
23
|
|
|
23
24
|
const aliases = Object.entries(default_sveltekit_config.alias);
|
|
24
25
|
|
|
@@ -95,18 +96,27 @@ export class Filer {
|
|
|
95
96
|
const path = map_sveltekit_aliases(specifier, aliases);
|
|
96
97
|
|
|
97
98
|
// The specifier `path` has now been mapped to its final form, so we can inspect it.
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const d = this.get_or_create(path_id);
|
|
107
|
-
file.dependencies.set(d.id, d);
|
|
108
|
-
d.dependents.set(file.id, file);
|
|
99
|
+
if (path[0] === '.' || path[0] === '/') {
|
|
100
|
+
const {path_id} = resolve_specifier(path, dir);
|
|
101
|
+
dependencies_removed.delete(path_id);
|
|
102
|
+
if (!dependencies_before.has(path_id)) {
|
|
103
|
+
const d = this.get_or_create(path_id);
|
|
104
|
+
file.dependencies.set(d.id, d);
|
|
105
|
+
d.dependents.set(file.id, file);
|
|
106
|
+
}
|
|
109
107
|
}
|
|
108
|
+
// TODO this doesn't work
|
|
109
|
+
// const resolved =
|
|
110
|
+
// path[0] === '.' || path[0] === '/'
|
|
111
|
+
// ? resolve_specifier(path, dir)
|
|
112
|
+
// : resolve_node_specifier(path, dir);
|
|
113
|
+
// const {path_id} = resolved;
|
|
114
|
+
// dependencies_removed.delete(path_id);
|
|
115
|
+
// if (!dependencies_before.has(path_id)) {
|
|
116
|
+
// const d = this.get_or_create(path_id);
|
|
117
|
+
// file.dependencies.set(d.id, d);
|
|
118
|
+
// d.dependents.set(file.id, file);
|
|
119
|
+
// }
|
|
110
120
|
}
|
|
111
121
|
|
|
112
122
|
// update any removed dependencies
|
package/src/lib/moss_helpers.ts
CHANGED
|
@@ -11,6 +11,7 @@ export const load_moss_plugin = async (
|
|
|
11
11
|
package_json?: Package_Json,
|
|
12
12
|
dep_name = MOSS_PACKAGE_DEP_NAME,
|
|
13
13
|
plugin_path = `node_modules/${dep_name}/dist/gro_plugin_moss.js`, // TODO maybe lookup from its `package_json.exports`? kinda unnecessary
|
|
14
|
+
local_plugin_path = 'src/lib/gro_plugin_moss.ts',
|
|
14
15
|
): Promise<Result<{gro_plugin_moss: any}, {message: string}>> => {
|
|
15
16
|
if (!has_dep(dep_name, package_json)) {
|
|
16
17
|
return {
|
|
@@ -19,13 +20,22 @@ export const load_moss_plugin = async (
|
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
let path: string | undefined = undefined;
|
|
24
|
+
|
|
25
|
+
const resolved_local_plugin_path = resolve(local_plugin_path);
|
|
26
|
+
if (existsSync(resolved_local_plugin_path)) {
|
|
27
|
+
path = resolved_local_plugin_path;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (path === undefined) {
|
|
31
|
+
path = resolve(plugin_path);
|
|
32
|
+
if (!existsSync(path)) {
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
// TODO warn?
|
|
36
|
+
message: `dependency on ${dep_name} detected but plugin not found at ${path}`,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
const mod = await import(path);
|
package/src/lib/package.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.js';
|
|
|
5
5
|
|
|
6
6
|
export const package_json = {
|
|
7
7
|
name: '@ryanatkn/gro',
|
|
8
|
-
version: '0.140.
|
|
8
|
+
version: '0.140.5',
|
|
9
9
|
description: 'task runner and toolkit extending SvelteKit',
|
|
10
10
|
motto: 'generate, run, optimize',
|
|
11
11
|
glyph: '🌰',
|
|
@@ -270,7 +270,7 @@ export const package_json = {
|
|
|
270
270
|
|
|
271
271
|
export const src_json = {
|
|
272
272
|
name: '@ryanatkn/gro',
|
|
273
|
-
version: '0.140.
|
|
273
|
+
version: '0.140.5',
|
|
274
274
|
modules: {
|
|
275
275
|
'.': {
|
|
276
276
|
path: 'index.ts',
|