@ryanatkn/gro 0.151.0 → 0.151.2
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/filer.d.ts.map +1 -1
- package/dist/filer.js +4 -3
- package/dist/gro.config.default.d.ts.map +1 -1
- package/dist/gro.config.default.js +5 -3
- package/dist/gro_helpers.d.ts.map +1 -1
- package/dist/gro_helpers.js +1 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +2 -1
- package/dist/package.d.ts +3 -14
- package/dist/package.d.ts.map +1 -1
- package/dist/package.js +6 -16
- package/dist/package_json.d.ts +1 -0
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +1 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/resolve_specifier.js +1 -1
- package/package.json +6 -7
- package/src/lib/filer.ts +4 -3
- package/src/lib/gro.config.default.ts +5 -3
- package/src/lib/gro_helpers.ts +1 -0
- package/src/lib/loader.ts +3 -1
- package/src/lib/package.ts +6 -16
- package/src/lib/package_json.ts +5 -0
- package/src/lib/plugin.ts +1 -1
- package/src/lib/resolve_specifier.ts +1 -1
- package/dist/gro_plugin_moss.d.ts +0 -15
- package/dist/gro_plugin_moss.d.ts.map +0 -1
- package/dist/gro_plugin_moss.js +0 -69
- package/src/lib/gro_plugin_moss.ts +0 -105
package/dist/filer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/filer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAKzD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACpD,OAAO,EACN,SAAS,EAET,KAAK,cAAc,EAC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1C,OAAO,GAAE,aAA4B;IAWjD,SAAS,GAAI,IAAI,OAAO,KAAG,WAAW,GAAG,SAAS,CAEhD;IAEF,aAAa,GAAI,IAAI,OAAO,KAAG,WAAW,CAkBxC;IA6II,KAAK,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC;IAKxD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAa5B;AAGD,eAAO,MAAM,iBAAiB,GAC7B,aAAa,WAAW,EACxB,WAAW,CAAC,EAAE,EAAE,OAAO,KAAK,WAAW,GAAG,SAAS,EACnD,SAAS,WAAW,EACpB,UAAS,GAAG,CAAC,MAAM,CAAa,EAChC,WAAU,GAAG,CAAC,MAAM,CAAa,EACjC,MAAM,MAAM,KACV,GAAG,CAAC,MAAM,CAkBZ,CAAC"}
|
package/dist/filer.js
CHANGED
|
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
|
3
3
|
import { dirname, resolve } from 'node:path';
|
|
4
4
|
import { wait } from '@ryanatkn/belt/async.js';
|
|
5
5
|
import { isBuiltin } from 'node:module';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
7
|
import { Unreachable_Error } from '@ryanatkn/belt/error.js';
|
|
8
8
|
import { watch_dir, } from './watch_dir.js';
|
|
9
9
|
import { paths } from './paths.js';
|
|
@@ -53,7 +53,7 @@ export class Filer {
|
|
|
53
53
|
const stats = existsSync(id) ? statSync(id) : null;
|
|
54
54
|
file.ctime = stats?.ctimeMs ?? null;
|
|
55
55
|
file.mtime = stats?.mtimeMs ?? null;
|
|
56
|
-
const new_contents = stats ? readFileSync(id, 'utf8') : null;
|
|
56
|
+
const new_contents = stats ? readFileSync(id, 'utf8') : null; // TODO need to lazily load contents, probably turn `Source_File` into a class
|
|
57
57
|
if (file.contents === new_contents) {
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
@@ -75,7 +75,8 @@ export class Filer {
|
|
|
75
75
|
if (isBuiltin(path))
|
|
76
76
|
continue;
|
|
77
77
|
try {
|
|
78
|
-
|
|
78
|
+
const file_url = pathToFileURL(file.id);
|
|
79
|
+
path_id = fileURLToPath(import.meta.resolve(path, file_url.href));
|
|
79
80
|
}
|
|
80
81
|
catch (error) {
|
|
81
82
|
// If it's imported from an external module, ignore any import errors.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gro.config.default.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro.config.default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAQvD;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"gro.config.default.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro.config.default.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAQvD;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,iBA0Bb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { has_server, gro_plugin_server } from './gro_plugin_server.js';
|
|
|
3
3
|
import { gro_plugin_sveltekit_app } from './gro_plugin_sveltekit_app.js';
|
|
4
4
|
import { has_sveltekit_app, has_sveltekit_library } from './sveltekit_helpers.js';
|
|
5
5
|
import { gro_plugin_gen } from './gro_plugin_gen.js';
|
|
6
|
-
import { has_dep, load_package_json } from './package_json.js';
|
|
6
|
+
import { has_dep, is_dep, load_package_json } from './package_json.js';
|
|
7
7
|
/**
|
|
8
8
|
* This is the default config that's passed to `gro.config.ts`
|
|
9
9
|
* if it exists in the current project, and if not, this is the final config.
|
|
@@ -16,14 +16,16 @@ import { has_dep, load_package_json } from './package_json.js';
|
|
|
16
16
|
const config = async (cfg) => {
|
|
17
17
|
const package_json = load_package_json(); // TODO gets wastefully loaded by some plugins, maybe put in plugin/task context? how does that interact with `map_package_json`?
|
|
18
18
|
const [has_moss_dep, has_server_result, has_sveltekit_library_result, has_sveltekit_app_result] = await Promise.all([
|
|
19
|
-
has_dep('@ryanatkn/moss', package_json),
|
|
19
|
+
has_dep('@ryanatkn/moss', package_json) || is_dep('@ryanatkn/moss', package_json),
|
|
20
20
|
has_server(),
|
|
21
21
|
has_sveltekit_library(package_json),
|
|
22
22
|
has_sveltekit_app(),
|
|
23
23
|
]);
|
|
24
24
|
cfg.plugins = async () => [
|
|
25
25
|
// put things that generate files before SvelteKit so it can see them
|
|
26
|
-
has_moss_dep
|
|
26
|
+
has_moss_dep
|
|
27
|
+
? (await import('@ryanatkn/moss/gro_plugin_moss.js')).gro_plugin_moss()
|
|
28
|
+
: null, // lazy load to avoid errors if it's not installed
|
|
27
29
|
gro_plugin_gen(),
|
|
28
30
|
has_server_result.ok ? gro_plugin_server() : null,
|
|
29
31
|
has_sveltekit_library_result.ok ? gro_plugin_sveltekit_library() : null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gro_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro_helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAUnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,uBAAuB,GAAI,aAAS,KAAG,MAsBnD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAC7B,aAAa,MAAM,EACnB,aAAa,MAAM,EACnB,MAAM,KAAK,CAAC,MAAM,CAAC,EACnB,eAAuB,KACrB,OAAO,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"gro_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro_helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,KAAK,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAUnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,uBAAuB,GAAI,aAAS,KAAG,MAsBnD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,GAC7B,aAAa,MAAM,EACnB,aAAa,MAAM,EACnB,MAAM,KAAK,CAAC,MAAM,CAAC,EACnB,eAAuB,KACrB,OAAO,CAAC,YAAY,CAiBtB,CAAC"}
|
package/dist/gro_helpers.js
CHANGED
|
@@ -82,6 +82,7 @@ export const spawn_with_loader = (loader_path, invoke_path, argv, js_cli = JS_CL
|
|
|
82
82
|
import {register} from "node:module";
|
|
83
83
|
import {pathToFileURL} from "node:url";
|
|
84
84
|
register("${loader_path}", pathToFileURL("./"));`,
|
|
85
|
+
'--experimental-import-meta-resolve', // for `import.meta.resolve`
|
|
85
86
|
'--enable-source-maps', // because TypeScript
|
|
86
87
|
];
|
|
87
88
|
// In almost all cases we want the exports condition to be `"development"`. Needed for `esm-env`.
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AA8EvD,eAAO,MAAM,IAAI,EAAE,QAwFlB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WAoDrB,CAAC"}
|
package/dist/loader.js
CHANGED
|
@@ -13,6 +13,7 @@ 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 { map_sveltekit_aliases } from './sveltekit_helpers.js';
|
|
16
|
+
// TODO get out of the loader business, starting with https://nodejs.org/api/typescript.html#type-stripping
|
|
16
17
|
/*
|
|
17
18
|
|
|
18
19
|
Usage via `$lib/register.ts`:
|
|
@@ -30,7 +31,7 @@ gro run foo.ts
|
|
|
30
31
|
Direct usage without register (see also `$lib/gro.ts`):
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
|
-
node --import 'data:text/javascript,import {register} from "node:module"; import {pathToFileURL} from "node:url"; register("@ryanatkn/gro/loader.js", pathToFileURL("./"));' --enable-source-maps' foo.ts
|
|
34
|
+
node --import 'data:text/javascript,import {register} from "node:module"; import {pathToFileURL} from "node:url"; register("@ryanatkn/gro/loader.js", pathToFileURL("./"));' --experimental-import-meta-resolve --enable-source-maps' foo.ts
|
|
34
35
|
```
|
|
35
36
|
|
|
36
37
|
TODO how to improve that gnarly import line? was originally designed for the now-deprecated `--loader`
|
package/dist/package.d.ts
CHANGED
|
@@ -75,6 +75,9 @@ export declare const package_json: {
|
|
|
75
75
|
'typescript-eslint': string;
|
|
76
76
|
uvu: string;
|
|
77
77
|
};
|
|
78
|
+
optionalDependencies: {
|
|
79
|
+
'@ryanatkn/moss': string;
|
|
80
|
+
};
|
|
78
81
|
prettier: {
|
|
79
82
|
plugins: string[];
|
|
80
83
|
useTabs: boolean;
|
|
@@ -232,10 +235,6 @@ export declare const package_json: {
|
|
|
232
235
|
types: string;
|
|
233
236
|
default: string;
|
|
234
237
|
};
|
|
235
|
-
'./gro_plugin_moss.js': {
|
|
236
|
-
types: string;
|
|
237
|
-
default: string;
|
|
238
|
-
};
|
|
239
238
|
'./gro_plugin_server.js': {
|
|
240
239
|
types: string;
|
|
241
240
|
default: string;
|
|
@@ -747,16 +746,6 @@ export declare const src_json: {
|
|
|
747
746
|
kind: "function";
|
|
748
747
|
})[];
|
|
749
748
|
};
|
|
750
|
-
'./gro_plugin_moss.js': {
|
|
751
|
-
path: string;
|
|
752
|
-
declarations: ({
|
|
753
|
-
name: string;
|
|
754
|
-
kind: "type";
|
|
755
|
-
} | {
|
|
756
|
-
name: string;
|
|
757
|
-
kind: "function";
|
|
758
|
-
})[];
|
|
759
|
-
};
|
|
760
749
|
'./gro_plugin_server.js': {
|
|
761
750
|
path: string;
|
|
762
751
|
declarations: ({
|
package/dist/package.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"package.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmQD,CAAC;AAEzB,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwwBD,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.151.
|
|
4
|
+
version: '0.151.2',
|
|
5
5
|
description: 'task runner and toolkit extending SvelteKit',
|
|
6
6
|
motto: 'generate, run, optimize',
|
|
7
7
|
glyph: '🌰',
|
|
@@ -56,8 +56,8 @@ export const package_json = {
|
|
|
56
56
|
'@changesets/changelog-git': '^0.2.1',
|
|
57
57
|
'@changesets/types': '^6.1.0',
|
|
58
58
|
'@ryanatkn/eslint-config': '^0.8.0',
|
|
59
|
-
'@ryanatkn/fuz': '^0.
|
|
60
|
-
'@ryanatkn/moss': '^0.
|
|
59
|
+
'@ryanatkn/fuz': '^0.139.0',
|
|
60
|
+
'@ryanatkn/moss': '^0.26.0',
|
|
61
61
|
'@sveltejs/adapter-static': '^3.0.8',
|
|
62
62
|
'@sveltejs/kit': '^2.20.7',
|
|
63
63
|
'@sveltejs/package': '^2.3.11',
|
|
@@ -72,6 +72,7 @@ export const package_json = {
|
|
|
72
72
|
'typescript-eslint': '^8.30.1',
|
|
73
73
|
uvu: '^0.5.6',
|
|
74
74
|
},
|
|
75
|
+
optionalDependencies: { '@ryanatkn/moss': '^0.26.0' },
|
|
75
76
|
prettier: {
|
|
76
77
|
plugins: ['prettier-plugin-svelte'],
|
|
77
78
|
useTabs: true,
|
|
@@ -155,10 +156,6 @@ export const package_json = {
|
|
|
155
156
|
types: './dist/gro_plugin_gen.d.ts',
|
|
156
157
|
default: './dist/gro_plugin_gen.js',
|
|
157
158
|
},
|
|
158
|
-
'./gro_plugin_moss.js': {
|
|
159
|
-
types: './dist/gro_plugin_moss.d.ts',
|
|
160
|
-
default: './dist/gro_plugin_moss.js',
|
|
161
|
-
},
|
|
162
159
|
'./gro_plugin_server.js': {
|
|
163
160
|
types: './dist/gro_plugin_server.d.ts',
|
|
164
161
|
default: './dist/gro_plugin_server.js',
|
|
@@ -263,7 +260,7 @@ export const package_json = {
|
|
|
263
260
|
};
|
|
264
261
|
export const src_json = {
|
|
265
262
|
name: '@ryanatkn/gro',
|
|
266
|
-
version: '0.151.
|
|
263
|
+
version: '0.151.2',
|
|
267
264
|
modules: {
|
|
268
265
|
'.': {
|
|
269
266
|
path: 'index.ts',
|
|
@@ -603,14 +600,6 @@ export const src_json = {
|
|
|
603
600
|
{ name: 'gro_plugin_gen', kind: 'function' },
|
|
604
601
|
],
|
|
605
602
|
},
|
|
606
|
-
'./gro_plugin_moss.js': {
|
|
607
|
-
path: 'gro_plugin_moss.ts',
|
|
608
|
-
declarations: [
|
|
609
|
-
{ name: 'Task_Args', kind: 'type' },
|
|
610
|
-
{ name: 'Gro_Plugin_Moss_Options', kind: 'type' },
|
|
611
|
-
{ name: 'gro_plugin_moss', kind: 'function' },
|
|
612
|
-
],
|
|
613
|
-
},
|
|
614
603
|
'./gro_plugin_server.js': {
|
|
615
604
|
path: 'gro_plugin_server.ts',
|
|
616
605
|
declarations: [
|
|
@@ -722,6 +711,7 @@ export const src_json = {
|
|
|
722
711
|
{ name: 'update_package_json', kind: 'function' },
|
|
723
712
|
{ name: 'to_package_exports', kind: 'function' },
|
|
724
713
|
{ name: 'parse_repo_url', kind: 'function' },
|
|
714
|
+
{ name: 'is_dep', kind: 'function' },
|
|
725
715
|
{ name: 'has_dep', kind: 'function' },
|
|
726
716
|
{ name: 'Package_Json_Dep', kind: 'type' },
|
|
727
717
|
{ name: 'extract_deps', kind: 'function' },
|
package/dist/package_json.d.ts
CHANGED
|
@@ -382,6 +382,7 @@ export declare const parse_repo_url: (package_json: Package_Json) => {
|
|
|
382
382
|
owner: string;
|
|
383
383
|
repo: string;
|
|
384
384
|
} | undefined;
|
|
385
|
+
export declare const is_dep: (dep_name: string, package_json?: Package_Json) => boolean;
|
|
385
386
|
export declare const has_dep: (dep_name: string, package_json?: Package_Json) => boolean;
|
|
386
387
|
export interface Package_Json_Dep {
|
|
387
388
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package_json.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/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,M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
|
|
|
275
275
|
}
|
|
276
276
|
return parsed.data;
|
|
277
277
|
};
|
|
278
|
+
export const is_dep = (dep_name, package_json = load_package_json()) => package_json.name === dep_name;
|
|
278
279
|
export const has_dep = (dep_name, package_json = load_package_json()) => !!package_json.devDependencies?.[dep_name] ||
|
|
279
280
|
!!package_json.dependencies?.[dep_name] ||
|
|
280
281
|
!!package_json.peerDependencies?.[dep_name];
|
package/dist/plugin.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface Plugin_Context<T_Args = object> extends Task_Context<T_Args> {
|
|
|
14
14
|
dev: boolean;
|
|
15
15
|
watch: boolean;
|
|
16
16
|
}
|
|
17
|
+
/** See `Plugins.create` for a usage example. */
|
|
17
18
|
export declare class Plugins<T_Plugin_Context extends Plugin_Context> {
|
|
18
19
|
private ctx;
|
|
19
20
|
private instances;
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,MAAM,CAAC,gBAAgB,SAAS,cAAc,GAAG,cAAc;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D;AAED,MAAM,MAAM,qBAAqB,CAAC,gBAAgB,SAAS,cAAc,GAAG,cAAc,IAAI,CAC7F,GAAG,EAAE,gBAAgB,KACjB,KAAK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C;CACf;AAED,gDAAgD;AAChD,qBAAa,OAAO,CAAC,gBAAgB,SAAS,cAAc;IAE1D,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,SAAS;gBADT,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;WAGpB,MAAM,CAAC,gBAAgB,SAAS,cAAc,EAC1D,GAAG,EAAE,gBAAgB,GACnB,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAS/B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAetB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAatB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAc/B;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAC1B,SAAS,KAAK,CAAC,MAAM,CAAC,EACtB,YAAY,MAAM,EAClB,aAAsB,KACpB,KAAK,CAAC,MAAM,CAMd,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -7,7 +7,7 @@ import { replace_extension } from './paths.js';
|
|
|
7
7
|
* If no `.js` file is found for the specifier on the filesystem, it assumes `.ts`.
|
|
8
8
|
*/
|
|
9
9
|
export const resolve_specifier = (specifier, dir) => {
|
|
10
|
-
const raw = specifier.endsWith('?raw');
|
|
10
|
+
const raw = specifier.endsWith('?raw'); // TODO more robust detection? other values?
|
|
11
11
|
const final_specifier = raw ? specifier.substring(0, specifier.length - 4) : specifier;
|
|
12
12
|
const absolute_path = isAbsolute(final_specifier) ? final_specifier : join(dir, final_specifier);
|
|
13
13
|
let mapped_path;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryanatkn/gro",
|
|
3
|
-
"version": "0.151.
|
|
3
|
+
"version": "0.151.2",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"glyph": "🌰",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@changesets/changelog-git": "^0.2.1",
|
|
70
70
|
"@changesets/types": "^6.1.0",
|
|
71
71
|
"@ryanatkn/eslint-config": "^0.8.0",
|
|
72
|
-
"@ryanatkn/fuz": "^0.
|
|
73
|
-
"@ryanatkn/moss": "^0.
|
|
72
|
+
"@ryanatkn/fuz": "^0.139.0",
|
|
73
|
+
"@ryanatkn/moss": "^0.26.0",
|
|
74
74
|
"@sveltejs/adapter-static": "^3.0.8",
|
|
75
75
|
"@sveltejs/kit": "^2.20.7",
|
|
76
76
|
"@sveltejs/package": "^2.3.11",
|
|
@@ -85,6 +85,9 @@
|
|
|
85
85
|
"typescript-eslint": "^8.30.1",
|
|
86
86
|
"uvu": "^0.5.6"
|
|
87
87
|
},
|
|
88
|
+
"optionalDependencies": {
|
|
89
|
+
"@ryanatkn/moss": "^0.26.0"
|
|
90
|
+
},
|
|
88
91
|
"prettier": {
|
|
89
92
|
"plugins": [
|
|
90
93
|
"prettier-plugin-svelte"
|
|
@@ -253,10 +256,6 @@
|
|
|
253
256
|
"types": "./dist/gro_plugin_gen.d.ts",
|
|
254
257
|
"default": "./dist/gro_plugin_gen.js"
|
|
255
258
|
},
|
|
256
|
-
"./gro_plugin_moss.js": {
|
|
257
|
-
"types": "./dist/gro_plugin_moss.d.ts",
|
|
258
|
-
"default": "./dist/gro_plugin_moss.js"
|
|
259
|
-
},
|
|
260
259
|
"./gro_plugin_server.js": {
|
|
261
260
|
"types": "./dist/gro_plugin_server.d.ts",
|
|
262
261
|
"default": "./dist/gro_plugin_server.js"
|
package/src/lib/filer.ts
CHANGED
|
@@ -4,7 +4,7 @@ import {dirname, resolve} from 'node:path';
|
|
|
4
4
|
import type {Omit_Strict} from '@ryanatkn/belt/types.js';
|
|
5
5
|
import {wait} from '@ryanatkn/belt/async.js';
|
|
6
6
|
import {isBuiltin} from 'node:module';
|
|
7
|
-
import {fileURLToPath} from 'node:url';
|
|
7
|
+
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
8
8
|
import {Unreachable_Error} from '@ryanatkn/belt/error.js';
|
|
9
9
|
import type {Logger} from '@ryanatkn/belt/log.js';
|
|
10
10
|
|
|
@@ -102,7 +102,7 @@ export class Filer {
|
|
|
102
102
|
file.ctime = stats?.ctimeMs ?? null;
|
|
103
103
|
file.mtime = stats?.mtimeMs ?? null;
|
|
104
104
|
|
|
105
|
-
const new_contents = stats ? readFileSync(id, 'utf8') : null;
|
|
105
|
+
const new_contents = stats ? readFileSync(id, 'utf8') : null; // TODO need to lazily load contents, probably turn `Source_File` into a class
|
|
106
106
|
|
|
107
107
|
if (file.contents === new_contents) {
|
|
108
108
|
return null;
|
|
@@ -127,7 +127,8 @@ export class Filer {
|
|
|
127
127
|
} else {
|
|
128
128
|
if (isBuiltin(path)) continue;
|
|
129
129
|
try {
|
|
130
|
-
|
|
130
|
+
const file_url = pathToFileURL(file.id);
|
|
131
|
+
path_id = fileURLToPath(import.meta.resolve(path, file_url.href));
|
|
131
132
|
} catch (error) {
|
|
132
133
|
// If it's imported from an external module, ignore any import errors.
|
|
133
134
|
if (error.code === 'ERR_MODULE_NOT_FOUND' && file.external) {
|
|
@@ -4,7 +4,7 @@ import {has_server, gro_plugin_server} from './gro_plugin_server.js';
|
|
|
4
4
|
import {gro_plugin_sveltekit_app} from './gro_plugin_sveltekit_app.js';
|
|
5
5
|
import {has_sveltekit_app, has_sveltekit_library} from './sveltekit_helpers.js';
|
|
6
6
|
import {gro_plugin_gen} from './gro_plugin_gen.js';
|
|
7
|
-
import {has_dep, load_package_json} from './package_json.js';
|
|
7
|
+
import {has_dep, is_dep, load_package_json} from './package_json.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* This is the default config that's passed to `gro.config.ts`
|
|
@@ -20,7 +20,7 @@ const config: Create_Gro_Config = async (cfg) => {
|
|
|
20
20
|
|
|
21
21
|
const [has_moss_dep, has_server_result, has_sveltekit_library_result, has_sveltekit_app_result] =
|
|
22
22
|
await Promise.all([
|
|
23
|
-
has_dep('@ryanatkn/moss', package_json),
|
|
23
|
+
has_dep('@ryanatkn/moss', package_json) || is_dep('@ryanatkn/moss', package_json),
|
|
24
24
|
has_server(),
|
|
25
25
|
has_sveltekit_library(package_json),
|
|
26
26
|
has_sveltekit_app(),
|
|
@@ -29,7 +29,9 @@ const config: Create_Gro_Config = async (cfg) => {
|
|
|
29
29
|
cfg.plugins = async () =>
|
|
30
30
|
[
|
|
31
31
|
// put things that generate files before SvelteKit so it can see them
|
|
32
|
-
has_moss_dep
|
|
32
|
+
has_moss_dep
|
|
33
|
+
? ((await import('@ryanatkn/moss/gro_plugin_moss.js')) as any).gro_plugin_moss()
|
|
34
|
+
: null, // lazy load to avoid errors if it's not installed
|
|
33
35
|
gro_plugin_gen(),
|
|
34
36
|
has_server_result.ok ? gro_plugin_server() : null,
|
|
35
37
|
has_sveltekit_library_result.ok ? gro_plugin_sveltekit_library() : null,
|
package/src/lib/gro_helpers.ts
CHANGED
|
@@ -93,6 +93,7 @@ export const spawn_with_loader = (
|
|
|
93
93
|
import {register} from "node:module";
|
|
94
94
|
import {pathToFileURL} from "node:url";
|
|
95
95
|
register("${loader_path}", pathToFileURL("./"));`,
|
|
96
|
+
'--experimental-import-meta-resolve', // for `import.meta.resolve`
|
|
96
97
|
'--enable-source-maps', // because TypeScript
|
|
97
98
|
];
|
|
98
99
|
// In almost all cases we want the exports condition to be `"development"`. Needed for `esm-env`.
|
package/src/lib/loader.ts
CHANGED
|
@@ -22,6 +22,8 @@ import {to_define_import_meta_env, default_ts_transform_options} from './esbuild
|
|
|
22
22
|
import {resolve_specifier} from './resolve_specifier.js';
|
|
23
23
|
import {map_sveltekit_aliases} from './sveltekit_helpers.js';
|
|
24
24
|
|
|
25
|
+
// TODO get out of the loader business, starting with https://nodejs.org/api/typescript.html#type-stripping
|
|
26
|
+
|
|
25
27
|
/*
|
|
26
28
|
|
|
27
29
|
Usage via `$lib/register.ts`:
|
|
@@ -39,7 +41,7 @@ gro run foo.ts
|
|
|
39
41
|
Direct usage without register (see also `$lib/gro.ts`):
|
|
40
42
|
|
|
41
43
|
```bash
|
|
42
|
-
node --import 'data:text/javascript,import {register} from "node:module"; import {pathToFileURL} from "node:url"; register("@ryanatkn/gro/loader.js", pathToFileURL("./"));' --enable-source-maps' foo.ts
|
|
44
|
+
node --import 'data:text/javascript,import {register} from "node:module"; import {pathToFileURL} from "node:url"; register("@ryanatkn/gro/loader.js", pathToFileURL("./"));' --experimental-import-meta-resolve --enable-source-maps' foo.ts
|
|
43
45
|
```
|
|
44
46
|
|
|
45
47
|
TODO how to improve that gnarly import line? was originally designed for the now-deprecated `--loader`
|
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.151.
|
|
8
|
+
version: '0.151.2',
|
|
9
9
|
description: 'task runner and toolkit extending SvelteKit',
|
|
10
10
|
motto: 'generate, run, optimize',
|
|
11
11
|
glyph: '🌰',
|
|
@@ -61,8 +61,8 @@ export const package_json = {
|
|
|
61
61
|
'@changesets/changelog-git': '^0.2.1',
|
|
62
62
|
'@changesets/types': '^6.1.0',
|
|
63
63
|
'@ryanatkn/eslint-config': '^0.8.0',
|
|
64
|
-
'@ryanatkn/fuz': '^0.
|
|
65
|
-
'@ryanatkn/moss': '^0.
|
|
64
|
+
'@ryanatkn/fuz': '^0.139.0',
|
|
65
|
+
'@ryanatkn/moss': '^0.26.0',
|
|
66
66
|
'@sveltejs/adapter-static': '^3.0.8',
|
|
67
67
|
'@sveltejs/kit': '^2.20.7',
|
|
68
68
|
'@sveltejs/package': '^2.3.11',
|
|
@@ -77,6 +77,7 @@ export const package_json = {
|
|
|
77
77
|
'typescript-eslint': '^8.30.1',
|
|
78
78
|
uvu: '^0.5.6',
|
|
79
79
|
},
|
|
80
|
+
optionalDependencies: {'@ryanatkn/moss': '^0.26.0'},
|
|
80
81
|
prettier: {
|
|
81
82
|
plugins: ['prettier-plugin-svelte'],
|
|
82
83
|
useTabs: true,
|
|
@@ -160,10 +161,6 @@ export const package_json = {
|
|
|
160
161
|
types: './dist/gro_plugin_gen.d.ts',
|
|
161
162
|
default: './dist/gro_plugin_gen.js',
|
|
162
163
|
},
|
|
163
|
-
'./gro_plugin_moss.js': {
|
|
164
|
-
types: './dist/gro_plugin_moss.d.ts',
|
|
165
|
-
default: './dist/gro_plugin_moss.js',
|
|
166
|
-
},
|
|
167
164
|
'./gro_plugin_server.js': {
|
|
168
165
|
types: './dist/gro_plugin_server.d.ts',
|
|
169
166
|
default: './dist/gro_plugin_server.js',
|
|
@@ -269,7 +266,7 @@ export const package_json = {
|
|
|
269
266
|
|
|
270
267
|
export const src_json = {
|
|
271
268
|
name: '@ryanatkn/gro',
|
|
272
|
-
version: '0.151.
|
|
269
|
+
version: '0.151.2',
|
|
273
270
|
modules: {
|
|
274
271
|
'.': {
|
|
275
272
|
path: 'index.ts',
|
|
@@ -609,14 +606,6 @@ export const src_json = {
|
|
|
609
606
|
{name: 'gro_plugin_gen', kind: 'function'},
|
|
610
607
|
],
|
|
611
608
|
},
|
|
612
|
-
'./gro_plugin_moss.js': {
|
|
613
|
-
path: 'gro_plugin_moss.ts',
|
|
614
|
-
declarations: [
|
|
615
|
-
{name: 'Task_Args', kind: 'type'},
|
|
616
|
-
{name: 'Gro_Plugin_Moss_Options', kind: 'type'},
|
|
617
|
-
{name: 'gro_plugin_moss', kind: 'function'},
|
|
618
|
-
],
|
|
619
|
-
},
|
|
620
609
|
'./gro_plugin_server.js': {
|
|
621
610
|
path: 'gro_plugin_server.ts',
|
|
622
611
|
declarations: [
|
|
@@ -728,6 +717,7 @@ export const src_json = {
|
|
|
728
717
|
{name: 'update_package_json', kind: 'function'},
|
|
729
718
|
{name: 'to_package_exports', kind: 'function'},
|
|
730
719
|
{name: 'parse_repo_url', kind: 'function'},
|
|
720
|
+
{name: 'is_dep', kind: 'function'},
|
|
731
721
|
{name: 'has_dep', kind: 'function'},
|
|
732
722
|
{name: 'Package_Json_Dep', kind: 'type'},
|
|
733
723
|
{name: 'extract_deps', kind: 'function'},
|
package/src/lib/package_json.ts
CHANGED
|
@@ -347,6 +347,11 @@ const parse_or_throw_formatted_error = <T extends z.ZodTypeAny>(
|
|
|
347
347
|
return parsed.data;
|
|
348
348
|
};
|
|
349
349
|
|
|
350
|
+
export const is_dep = (
|
|
351
|
+
dep_name: string,
|
|
352
|
+
package_json: Package_Json = load_package_json(),
|
|
353
|
+
): boolean => package_json.name === dep_name;
|
|
354
|
+
|
|
350
355
|
export const has_dep = (
|
|
351
356
|
dep_name: string,
|
|
352
357
|
package_json: Package_Json = load_package_json(),
|
package/src/lib/plugin.ts
CHANGED
|
@@ -20,8 +20,8 @@ export interface Plugin_Context<T_Args = object> extends Task_Context<T_Args> {
|
|
|
20
20
|
watch: boolean;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/** See `Plugins.create` for a usage example. */
|
|
23
24
|
export class Plugins<T_Plugin_Context extends Plugin_Context> {
|
|
24
|
-
/* prefer `Plugins.create` to the constructor */
|
|
25
25
|
constructor(
|
|
26
26
|
private ctx: T_Plugin_Context,
|
|
27
27
|
private instances: Array<Plugin>,
|
|
@@ -25,7 +25,7 @@ export interface Resolved_Specifier {
|
|
|
25
25
|
* If no `.js` file is found for the specifier on the filesystem, it assumes `.ts`.
|
|
26
26
|
*/
|
|
27
27
|
export const resolve_specifier = (specifier: string, dir: string): Resolved_Specifier => {
|
|
28
|
-
const raw = specifier.endsWith('?raw');
|
|
28
|
+
const raw = specifier.endsWith('?raw'); // TODO more robust detection? other values?
|
|
29
29
|
const final_specifier = raw ? specifier.substring(0, specifier.length - 4) : specifier;
|
|
30
30
|
const absolute_path = isAbsolute(final_specifier) ? final_specifier : join(dir, final_specifier);
|
|
31
31
|
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from './plugin.js';
|
|
2
|
-
import type { Args } from './args.js';
|
|
3
|
-
import type { File_Filter } from './path.js';
|
|
4
|
-
export interface Task_Args extends Args {
|
|
5
|
-
watch?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface Gro_Plugin_Moss_Options {
|
|
8
|
-
include_classes?: Array<string> | Set<string> | null;
|
|
9
|
-
outfile?: string;
|
|
10
|
-
filter_file?: File_Filter | null;
|
|
11
|
-
flush_debounce_delay?: number;
|
|
12
|
-
banner?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare const gro_plugin_moss: ({ include_classes, outfile, filter_file, flush_debounce_delay, banner, }?: Gro_Plugin_Moss_Options) => Plugin;
|
|
15
|
-
//# sourceMappingURL=gro_plugin_moss.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gro_plugin_moss.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro_plugin_moss.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAGpC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAI3C,MAAM,WAAW,SAAU,SAAQ,IAAI;IACtC,KAAK,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACvC,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,eAAe,GAAI,2EAM7B,uBAAsC,KAAG,MAmE3C,CAAC"}
|
package/dist/gro_plugin_moss.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { EMPTY_OBJECT } from '@ryanatkn/belt/object.js';
|
|
2
|
-
import { throttle } from '@ryanatkn/belt/throttle.js';
|
|
3
|
-
import { Unreachable_Error } from '@ryanatkn/belt/error.js';
|
|
4
|
-
import { writeFileSync } from 'node:fs';
|
|
5
|
-
import { collect_css_classes, Css_Classes, generate_classes_css, } from '@ryanatkn/moss/css_class_helpers.js';
|
|
6
|
-
import { css_classes_by_name } from '@ryanatkn/moss/css_classes.js';
|
|
7
|
-
import { format_file } from './format_file.js';
|
|
8
|
-
const FLUSH_DEBOUNCE_DELAY = 500;
|
|
9
|
-
export const gro_plugin_moss = ({ include_classes = null, outfile = 'src/routes/moss.css', // TODO maybe support multiple files using file filters to check where to collect them?
|
|
10
|
-
filter_file = (p) => !p.includes('.test.') && !p.includes('/test/'), flush_debounce_delay = FLUSH_DEBOUNCE_DELAY, banner = 'generated by gro_plugin_moss', } = EMPTY_OBJECT) => {
|
|
11
|
-
const css_classes = new Css_Classes(Array.isArray(include_classes) ? new Set(include_classes) : include_classes);
|
|
12
|
-
let previous_output;
|
|
13
|
-
let flushing_timeout;
|
|
14
|
-
const queue_gen = () => {
|
|
15
|
-
if (flushing_timeout === undefined) {
|
|
16
|
-
flushing_timeout = setTimeout(() => {
|
|
17
|
-
flushing_timeout = undefined;
|
|
18
|
-
void flush_gen_queue();
|
|
19
|
-
}); // the timeout batches synchronously
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const flush_gen_queue = throttle(async () => {
|
|
23
|
-
const css = generate_classes_css(css_classes.get(), css_classes_by_name);
|
|
24
|
-
const contents = `/* ${banner} */\n\n${css}\n\n/* ${banner} */`;
|
|
25
|
-
const output = await format_file(contents, { filepath: outfile });
|
|
26
|
-
// TODO think about using gen to implement this, would have some nice benefits like automatic change detection
|
|
27
|
-
if (output === previous_output)
|
|
28
|
-
return;
|
|
29
|
-
previous_output = output;
|
|
30
|
-
writeFileSync(outfile, output);
|
|
31
|
-
}, { delay: flush_debounce_delay, when: 'trailing' });
|
|
32
|
-
let cleanup;
|
|
33
|
-
return {
|
|
34
|
-
name: 'gro_plugin_moss',
|
|
35
|
-
setup: async ({ filer }) => {
|
|
36
|
-
// When a file builds, check it and its tree of dependents
|
|
37
|
-
// for any `.gen.` files that need to run.
|
|
38
|
-
cleanup = await filer.watch((change, source_file) => {
|
|
39
|
-
if (filter_file && !filter_file(source_file.id)) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
switch (change.type) {
|
|
43
|
-
case 'add':
|
|
44
|
-
case 'update': {
|
|
45
|
-
if (source_file.contents !== null) {
|
|
46
|
-
const classes = collect_css_classes(source_file.contents);
|
|
47
|
-
css_classes.add(source_file.id, classes);
|
|
48
|
-
queue_gen();
|
|
49
|
-
}
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case 'delete': {
|
|
53
|
-
css_classes.delete(source_file.id);
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
default:
|
|
57
|
-
throw new Unreachable_Error(change.type);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
queue_gen();
|
|
61
|
-
},
|
|
62
|
-
teardown: async () => {
|
|
63
|
-
if (cleanup !== undefined) {
|
|
64
|
-
await cleanup();
|
|
65
|
-
cleanup = undefined;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {EMPTY_OBJECT} from '@ryanatkn/belt/object.js';
|
|
2
|
-
import {throttle} from '@ryanatkn/belt/throttle.js';
|
|
3
|
-
import {Unreachable_Error} from '@ryanatkn/belt/error.js';
|
|
4
|
-
import {writeFileSync} from 'node:fs';
|
|
5
|
-
import {
|
|
6
|
-
collect_css_classes,
|
|
7
|
-
Css_Classes,
|
|
8
|
-
generate_classes_css,
|
|
9
|
-
} from '@ryanatkn/moss/css_class_helpers.js';
|
|
10
|
-
import {css_classes_by_name} from '@ryanatkn/moss/css_classes.js';
|
|
11
|
-
|
|
12
|
-
import type {Plugin} from './plugin.js';
|
|
13
|
-
import type {Args} from './args.js';
|
|
14
|
-
import type {Cleanup_Watch} from './filer.js';
|
|
15
|
-
import {format_file} from './format_file.js';
|
|
16
|
-
import type {File_Filter} from './path.js';
|
|
17
|
-
|
|
18
|
-
const FLUSH_DEBOUNCE_DELAY = 500;
|
|
19
|
-
|
|
20
|
-
export interface Task_Args extends Args {
|
|
21
|
-
watch?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface Gro_Plugin_Moss_Options {
|
|
25
|
-
include_classes?: Array<string> | Set<string> | null;
|
|
26
|
-
outfile?: string;
|
|
27
|
-
filter_file?: File_Filter | null;
|
|
28
|
-
flush_debounce_delay?: number;
|
|
29
|
-
banner?: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const gro_plugin_moss = ({
|
|
33
|
-
include_classes = null,
|
|
34
|
-
outfile = 'src/routes/moss.css', // TODO maybe support multiple files using file filters to check where to collect them?
|
|
35
|
-
filter_file = (p) => !p.includes('.test.') && !p.includes('/test/'),
|
|
36
|
-
flush_debounce_delay = FLUSH_DEBOUNCE_DELAY,
|
|
37
|
-
banner = 'generated by gro_plugin_moss',
|
|
38
|
-
}: Gro_Plugin_Moss_Options = EMPTY_OBJECT): Plugin => {
|
|
39
|
-
const css_classes = new Css_Classes(
|
|
40
|
-
Array.isArray(include_classes) ? new Set(include_classes) : include_classes,
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
let previous_output: string | undefined;
|
|
44
|
-
|
|
45
|
-
let flushing_timeout: NodeJS.Timeout | undefined;
|
|
46
|
-
const queue_gen = () => {
|
|
47
|
-
if (flushing_timeout === undefined) {
|
|
48
|
-
flushing_timeout = setTimeout(() => {
|
|
49
|
-
flushing_timeout = undefined;
|
|
50
|
-
void flush_gen_queue();
|
|
51
|
-
}); // the timeout batches synchronously
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const flush_gen_queue = throttle(
|
|
55
|
-
async () => {
|
|
56
|
-
const css = generate_classes_css(css_classes.get(), css_classes_by_name);
|
|
57
|
-
const contents = `/* ${banner} */\n\n${css}\n\n/* ${banner} */`;
|
|
58
|
-
const output = await format_file(contents, {filepath: outfile});
|
|
59
|
-
// TODO think about using gen to implement this, would have some nice benefits like automatic change detection
|
|
60
|
-
if (output === previous_output) return;
|
|
61
|
-
previous_output = output;
|
|
62
|
-
writeFileSync(outfile, output);
|
|
63
|
-
},
|
|
64
|
-
{delay: flush_debounce_delay, when: 'trailing'},
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
let cleanup: Cleanup_Watch | undefined;
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
name: 'gro_plugin_moss',
|
|
71
|
-
setup: async ({filer}) => {
|
|
72
|
-
// When a file builds, check it and its tree of dependents
|
|
73
|
-
// for any `.gen.` files that need to run.
|
|
74
|
-
cleanup = await filer.watch((change, source_file) => {
|
|
75
|
-
if (filter_file && !filter_file(source_file.id)) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
switch (change.type) {
|
|
79
|
-
case 'add':
|
|
80
|
-
case 'update': {
|
|
81
|
-
if (source_file.contents !== null) {
|
|
82
|
-
const classes = collect_css_classes(source_file.contents);
|
|
83
|
-
css_classes.add(source_file.id, classes);
|
|
84
|
-
queue_gen();
|
|
85
|
-
}
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
case 'delete': {
|
|
89
|
-
css_classes.delete(source_file.id);
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
default:
|
|
93
|
-
throw new Unreachable_Error(change.type);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
queue_gen();
|
|
97
|
-
},
|
|
98
|
-
teardown: async () => {
|
|
99
|
-
if (cleanup !== undefined) {
|
|
100
|
-
await cleanup();
|
|
101
|
-
cleanup = undefined;
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
};
|