@ryanatkn/gro 0.184.0 → 0.186.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/disknode.d.ts +5 -0
- package/dist/disknode.d.ts.map +1 -1
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +8 -2
- package/dist/gen.js +2 -2
- package/dist/gro_config.d.ts.map +1 -1
- package/dist/gro_config.js +1 -1
- package/dist/hash.d.ts +7 -1
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.js +9 -1
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +9 -16
- package/dist/run.task.d.ts +2 -0
- package/dist/run.task.d.ts.map +1 -1
- package/dist/run.task.js +2 -0
- package/dist/sveltekit_shim_app_environment.d.ts +2 -0
- package/dist/sveltekit_shim_app_environment.d.ts.map +1 -1
- package/dist/sveltekit_shim_app_environment.js +2 -0
- package/dist/sveltekit_shim_app_paths.d.ts +2 -0
- package/dist/sveltekit_shim_app_paths.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/lib/disknode.ts +5 -0
- package/src/lib/filer.ts +9 -2
- package/src/lib/gen.ts +2 -2
- package/src/lib/gro_config.ts +1 -3
- package/src/lib/hash.ts +11 -2
- package/src/lib/loader.ts +9 -23
- package/src/lib/run.task.ts +2 -0
- package/src/lib/sveltekit_shim_app_environment.ts +2 -0
- package/src/lib/sveltekit_shim_app_paths.ts +2 -0
package/dist/disknode.d.ts
CHANGED
|
@@ -12,6 +12,11 @@ export interface Disknode {
|
|
|
12
12
|
external: boolean;
|
|
13
13
|
ctime: number | null;
|
|
14
14
|
mtime: number | null;
|
|
15
|
+
/**
|
|
16
|
+
* SHA-256 hash of `contents`. `null` iff `contents` is `null`.
|
|
17
|
+
* Used for content-based change detection and caching.
|
|
18
|
+
*/
|
|
19
|
+
content_hash: string | null;
|
|
15
20
|
dependents: Map<PathId, Disknode>;
|
|
16
21
|
dependencies: Map<PathId, Disknode>;
|
|
17
22
|
}
|
package/dist/disknode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disknode.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/disknode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAIrD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACpC"}
|
|
1
|
+
{"version":3,"file":"disknode.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/disknode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAIrD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IAEX;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;OAGG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CACpC"}
|
package/dist/filer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filer.d.ts","sourceRoot":"../src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C,EAAE,MAAM,CAAC;CACb;AAED,qBAAa,KAAK;;IACjB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAG1B,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAa;gBAetC,OAAO,GAAE,YAA2B;IAUhD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,SAAS,GAAI,IAAI,MAAM,KAAG,QAAQ,GAAG,SAAS,CAE5C;IAEF,aAAa,GAAI,IAAI,MAAM,KAAG,QAAQ,CAqBpC;IAEF,MAAM,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI;IAU1E;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAsDrB,KAAK,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;IAmBzD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CA8OtB;AAGD,eAAO,MAAM,iBAAiB,GAC7B,UAAU,QAAQ,EAClB,WAAW,CAAC,EAAE,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,EAC/C,SAAS,UAAU,EACnB,UAAS,GAAG,CAAC,MAAM,CAAa,EAChC,WAAU,GAAG,CAAC,MAAM,CAAa,EACjC,MAAM,MAAM,KACV,GAAG,CAAC,MAAM,CAuBZ,CAAC"}
|
package/dist/filer.js
CHANGED
|
@@ -11,6 +11,7 @@ import { resolve_specifier } from "./resolve_specifier.js";
|
|
|
11
11
|
import { default_svelte_config } from "./svelte_config.js";
|
|
12
12
|
import { map_sveltekit_aliases } from "./sveltekit_helpers.js";
|
|
13
13
|
import { SVELTEKIT_GLOBAL_SPECIFIER } from "./constants.js";
|
|
14
|
+
import { to_hash } from "./hash.js";
|
|
14
15
|
const aliases = Object.entries(default_svelte_config.alias);
|
|
15
16
|
export class Filer {
|
|
16
17
|
root_dir;
|
|
@@ -51,6 +52,7 @@ export class Filer {
|
|
|
51
52
|
external: this.#is_external(id), // TODO maybe filter externals by default? the user needs to configure the filer then
|
|
52
53
|
ctime: null,
|
|
53
54
|
mtime: null,
|
|
55
|
+
content_hash: null,
|
|
54
56
|
dependents: new Map(),
|
|
55
57
|
dependencies: new Map(),
|
|
56
58
|
};
|
|
@@ -198,13 +200,16 @@ export class Filer {
|
|
|
198
200
|
throw error;
|
|
199
201
|
}
|
|
200
202
|
}
|
|
201
|
-
|
|
203
|
+
// Compute hash for new contents
|
|
204
|
+
const new_hash = new_contents !== null ? await to_hash(new_contents) : null;
|
|
202
205
|
file.ctime = stats?.ctimeMs ?? null;
|
|
203
206
|
file.mtime = stats?.mtimeMs ?? null;
|
|
204
|
-
|
|
207
|
+
// Use hash comparison for change detection (content-based, not mtime-based)
|
|
208
|
+
if (file.content_hash === new_hash) {
|
|
205
209
|
return null;
|
|
206
210
|
}
|
|
207
211
|
file.contents = new_contents;
|
|
212
|
+
file.content_hash = new_hash;
|
|
208
213
|
const dir = dirname(file.id);
|
|
209
214
|
const dependencies_before = new Set(file.dependencies.keys());
|
|
210
215
|
const dependencies_removed = new Set(dependencies_before);
|
|
@@ -260,6 +265,7 @@ export class Filer {
|
|
|
260
265
|
if (!file)
|
|
261
266
|
return null; // this is safe because the object would exist if any other file referenced it as a dependency or dependent
|
|
262
267
|
file.contents = null; // clear contents in case it gets re-added later, we want the change to be detected
|
|
268
|
+
file.content_hash = null; // clear hash so re-add detects the change
|
|
263
269
|
file.dependencies.clear();
|
|
264
270
|
// keep the file in memory if other files still depend on it
|
|
265
271
|
if (file.dependents.size === 0) {
|
package/dist/gen.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { join, basename, dirname, isAbsolute } from 'node:path';
|
|
2
2
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { styleText as st } from 'node:util';
|
|
4
|
-
import { map_concurrent } from '@fuzdev/fuz_util/async.js';
|
|
4
|
+
import { each_concurrent, map_concurrent } from '@fuzdev/fuz_util/async.js';
|
|
5
5
|
import { fs_search } from '@fuzdev/fuz_util/fs.js';
|
|
6
6
|
import { print_path } from "./paths.js";
|
|
7
7
|
import { load_modules } from "./modules.js";
|
|
@@ -112,7 +112,7 @@ export const analyze_gen_result = async (file) => {
|
|
|
112
112
|
};
|
|
113
113
|
export const write_gen_results = async (gen_results, analyzed_gen_results, log) => {
|
|
114
114
|
const files = gen_results.successes.flatMap((result) => result.files);
|
|
115
|
-
await
|
|
115
|
+
await each_concurrent(files, async (file) => {
|
|
116
116
|
const analyzed = analyzed_gen_results.find((r) => r.file.id === file.id);
|
|
117
117
|
if (!analyzed)
|
|
118
118
|
throw Error('Expected to find analyzed result: ' + file.id);
|
package/dist/gro_config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gro_config.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/gro_config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,UAAU,EAAE,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAcjE,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AAG3D;;;GAGG;AACH,eAAO,MAAM,6BAA6B,qEACyB,CAAC;AAEpE;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC9C;;OAEG;IACH,OAAO,EAAE,mBAAmB,CAAC;IAC7B;;;;OAIG;IACH,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC3C;;;OAGG;IACH,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B;;;OAGG;IACH,cAAc,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAClC;;OAEG;IACH,MAAM,EAAE,MAAM,CAA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C,CAAC,CAAC,CAAC;CACtE;AAED,MAAM,MAAM,eAAe,GAAG,CAC7B,WAAW,EAAE,SAAS,EACtB,aAAa,CAAC,EAAE,kBAAkB,KAC9B,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1C,eAAO,MAAM,uBAAuB,QAAO,SAazC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,QAUnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAA+C,CAAC;AAErF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,YAAY,YAAY,KAAG,OAAO,CAAC,SAAS,CA6CjF,CAAC;AAEF,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,eAAe,CAAC;CACjD;AAED,eAAO,MAAM,eAAe,GAAU,YAAgB,KAAG,OAAO,CAAC,SAAS,CAqBzE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,CACxC,aAAa,EAAE,GAAG,EAClB,WAAW,EAAE,MAAM,KACf,OAAO,CAAC,aAAa,IAAI,eAS7B,CAAC"}
|
package/dist/gro_config.js
CHANGED
|
@@ -67,7 +67,7 @@ export const cook_gro_config = async (raw_config) => {
|
|
|
67
67
|
// Resolve if it's a function
|
|
68
68
|
const resolved = typeof build_cache_config === 'function' ? await build_cache_config() : build_cache_config;
|
|
69
69
|
// Hash the JSON representation with deterministic key ordering
|
|
70
|
-
build_cache_config_hash = await to_hash(
|
|
70
|
+
build_cache_config_hash = await to_hash(json_stringify_deterministic(resolved));
|
|
71
71
|
}
|
|
72
72
|
// Delete the raw value to ensure it doesn't persist in memory
|
|
73
73
|
delete raw_config.build_cache_config;
|
package/dist/hash.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* Computes a cryptographic hash of the given data.
|
|
3
|
+
*
|
|
4
|
+
* @param data - String or binary data to hash. Strings are UTF-8 encoded internally.
|
|
5
|
+
* @param algorithm - Hash algorithm to use. Defaults to SHA-256.
|
|
6
|
+
* @returns Hexadecimal hash string.
|
|
7
|
+
*
|
|
2
8
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto
|
|
3
9
|
*/
|
|
4
|
-
export declare const to_hash: (data: BufferSource, algorithm?: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512") => Promise<string>;
|
|
10
|
+
export declare const to_hash: (data: BufferSource | string, algorithm?: "SHA-1" | "SHA-256" | "SHA-384" | "SHA-512") => Promise<string>;
|
|
5
11
|
//# sourceMappingURL=hash.d.ts.map
|
package/dist/hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/hash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/hash.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GACnB,MAAM,YAAY,GAAG,MAAM,EAC3B,YAAW,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,SAAqB,KAChE,OAAO,CAAC,MAAM,CAShB,CAAC"}
|
package/dist/hash.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
const { subtle } = globalThis.crypto;
|
|
2
|
+
const encoder = new TextEncoder();
|
|
2
3
|
/**
|
|
4
|
+
* Computes a cryptographic hash of the given data.
|
|
5
|
+
*
|
|
6
|
+
* @param data - String or binary data to hash. Strings are UTF-8 encoded internally.
|
|
7
|
+
* @param algorithm - Hash algorithm to use. Defaults to SHA-256.
|
|
8
|
+
* @returns Hexadecimal hash string.
|
|
9
|
+
*
|
|
3
10
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto
|
|
4
11
|
*/
|
|
5
12
|
export const to_hash = async (data, algorithm = 'SHA-256') => {
|
|
6
|
-
const
|
|
13
|
+
const buffer = typeof data === 'string' ? encoder.encode(data) : data;
|
|
14
|
+
const digested = await subtle.digest(algorithm, buffer);
|
|
7
15
|
const bytes = Array.from(new Uint8Array(digested));
|
|
8
16
|
let hex = '';
|
|
9
17
|
for (const h of bytes) {
|
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":"AAGA,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":"AAGA,OAAO,KAAK,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAoEvD,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,QA0GlB,CAAC;AAEF,cAAc;AACd,eAAO,MAAM,OAAO,EAAE,WA+CrB,CAAC"}
|
package/dist/loader.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { compile, compileModule, preprocess } from 'svelte/compiler';
|
|
2
2
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
|
-
import { escape_regexp } from '@fuzdev/fuz_util/regexp.js';
|
|
5
4
|
import { readFileSync } from 'node:fs';
|
|
6
5
|
import ts_blank_space from 'ts-blank-space';
|
|
7
6
|
import { render_env_shim_module } from "./sveltekit_shim_env.js";
|
|
8
7
|
import { render_sveltekit_shim_app_environment, render_sveltekit_shim_app_paths, SVELTEKIT_SHIM_APP_ENVIRONMENT_MATCHER, SVELTEKIT_SHIM_APP_PATHS_MATCHER, sveltekit_shim_app_specifiers, } from "./sveltekit_shim_app.js";
|
|
9
8
|
import { default_svelte_config } from "./svelte_config.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { paths } from "./paths.js";
|
|
10
|
+
import { TS_MATCHER, SVELTE_MATCHER, SVELTE_RUNES_MATCHER } from "./constants.js";
|
|
12
11
|
import { resolve_specifier } from "./resolve_specifier.js";
|
|
13
12
|
import { map_sveltekit_aliases } from "./sveltekit_helpers.js";
|
|
14
13
|
// TODO get out of the loader business, starting with https://nodejs.org/api/typescript.html#type-stripping
|
|
@@ -43,7 +42,6 @@ const dir = paths.root;
|
|
|
43
42
|
const { alias, base_url, assets_url, env_dir, private_prefix, public_prefix, svelte_compile_options, svelte_compile_module_options, svelte_preprocessors, } = default_svelte_config;
|
|
44
43
|
const aliases = Object.entries(alias);
|
|
45
44
|
const RAW_MATCHER = /(%3Fraw|\.css|\.svg)$/; // TODO others? configurable?
|
|
46
|
-
const NODE_MODULES_MATCHER = new RegExp(escape_regexp('/' + NODE_MODULES_DIRNAME + '/'), 'u');
|
|
47
45
|
/** @nodocs */
|
|
48
46
|
export const load = async (url, context, nextLoad) => {
|
|
49
47
|
// console.log(`url`, url);
|
|
@@ -174,22 +172,17 @@ export const resolve = async (specifier, context, nextResolve) => {
|
|
|
174
172
|
if (shimmed !== undefined) {
|
|
175
173
|
return nextResolve(shimmed, context);
|
|
176
174
|
}
|
|
177
|
-
//
|
|
178
|
-
// Without this, we'd need to add a dev dep to Gro for Gro, which causes problems.
|
|
179
|
-
// TODO maybe make this generic, checking `package_json.name` against `s` and map it, possibly need to export `resolve_exported_value`
|
|
180
|
-
if (IS_THIS_GRO && s.startsWith('@ryanatkn/gro')) {
|
|
181
|
-
s = join(dir, 'dist', s.substring(13));
|
|
182
|
-
}
|
|
183
|
-
const parent_url = context.parentURL;
|
|
184
|
-
if (!parent_url || NODE_MODULES_MATCHER.test(parent_url)) {
|
|
185
|
-
return nextResolve(s, context);
|
|
186
|
-
}
|
|
175
|
+
// Apply SvelteKit aliases (handles self-referencing packages like @fuzdev/fuz_util -> src/lib)
|
|
187
176
|
s = map_sveltekit_aliases(s, aliases);
|
|
188
|
-
//
|
|
189
|
-
// Imports into `node_modules` use the default algorithm, and the rest use use Vite conventions.
|
|
177
|
+
// Bare specifiers (not starting with . or /) use Node's default resolution
|
|
190
178
|
if (s[0] !== '.' && s[0] !== '/') {
|
|
191
179
|
return nextResolve(s, context);
|
|
192
180
|
}
|
|
181
|
+
// Resolve paths using Vite conventions
|
|
182
|
+
const parent_url = context.parentURL;
|
|
183
|
+
if (!parent_url) {
|
|
184
|
+
return nextResolve(s, context);
|
|
185
|
+
}
|
|
193
186
|
const resolved = await resolve_specifier(s, dirname(fileURLToPath(parent_url)));
|
|
194
187
|
return {
|
|
195
188
|
url: pathToFileURL(resolved.path_id_with_querystring).href,
|
package/dist/run.task.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { type Task } from './task.ts';
|
|
|
3
3
|
/**
|
|
4
4
|
* Runs a TypeScript file with Gro's loader, forwarding all args to the script.
|
|
5
5
|
* Useful for scripts that need SvelteKit shims ($lib, $env, etc).
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
6
8
|
*/
|
|
7
9
|
/** @nodocs */
|
|
8
10
|
export declare const Args: z.ZodObject<{
|
package/dist/run.task.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAI/C
|
|
1
|
+
{"version":3,"file":"run.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/run.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAI/C;;;;;GAKG;AAEH,cAAc;AACd,eAAO,MAAM,IAAI;;8JAWf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA+B3B,CAAC"}
|
package/dist/run.task.js
CHANGED
|
@@ -7,6 +7,8 @@ import { serialize_args, to_implicit_forwarded_args } from "./args.js";
|
|
|
7
7
|
/**
|
|
8
8
|
* Runs a TypeScript file with Gro's loader, forwarding all args to the script.
|
|
9
9
|
* Useful for scripts that need SvelteKit shims ($lib, $env, etc).
|
|
10
|
+
*
|
|
11
|
+
* @module
|
|
10
12
|
*/
|
|
11
13
|
/** @nodocs */
|
|
12
14
|
export const Args = z
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* but exists here for the sake of the Node loader.
|
|
4
4
|
* There may be a cleaner workaround but I couldn't find it.
|
|
5
5
|
* @see https://github.com/nodejs/loaders for details about the forthcoming virtual file support
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
6
8
|
*/
|
|
7
9
|
export declare const browser = false;
|
|
8
10
|
export declare const building = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sveltekit_shim_app_environment.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_environment.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_app_environment.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_environment.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,eAAO,MAAM,OAAO,QAAQ,CAAC;AAC7B,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAC9B,eAAO,MAAM,GAAG,OAAO,CAAC;AACxB,eAAO,MAAM,OAAO,SAAS,CAAC"}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* but exists here for the sake of the Node loader.
|
|
6
6
|
* There may be a cleaner workaround but I couldn't find it.
|
|
7
7
|
* @see https://github.com/nodejs/loaders for details about the forthcoming virtual file support
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
8
10
|
*/
|
|
9
11
|
export const browser = false;
|
|
10
12
|
export const building = false;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* but exists here for the sake of the Node loader.
|
|
4
4
|
* There may be a cleaner workaround but I couldn't find it.
|
|
5
5
|
* @see https://github.com/nodejs/loaders for details about the forthcoming virtual file support
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
6
8
|
*/
|
|
7
9
|
import type { resolve as base_resolve, asset as base_asset, resolveRoute as base_resolveRoute } from '$app/paths';
|
|
8
10
|
export declare const assets = "";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sveltekit_shim_app_paths.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_paths.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"sveltekit_shim_app_paths.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_paths.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACX,OAAO,IAAI,YAAY,EACvB,KAAK,IAAI,UAAU,EACnB,YAAY,IAAI,iBAAiB,EACjC,MAAM,YAAY,CAAC;AAGpB,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,kBAAkB;AAClB,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,eAAO,MAAM,OAAO,EAAE,OAAO,YAAmE,CAAC;AACjG,kBAAkB;AAClB,eAAO,MAAM,YAAY,EAAE,OAAO,iBAAwB,CAAC;AAC3D,eAAO,MAAM,KAAK,EAAE,OAAO,UAAuD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryanatkn/gro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.186.0",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"glyph": "🌰",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"esm-env": "^1.2.2",
|
|
54
54
|
"mri": "^1.2.0",
|
|
55
55
|
"oxc-parser": "^0.99.0",
|
|
56
|
-
"prettier": "^3.
|
|
57
|
-
"prettier-plugin-svelte": "^3.4.
|
|
56
|
+
"prettier": "^3.7.4",
|
|
57
|
+
"prettier-plugin-svelte": "^3.4.1",
|
|
58
58
|
"ts-blank-space": "^0.6.2",
|
|
59
59
|
"tslib": "^2.8.1",
|
|
60
60
|
"zod": "^4.1.13"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@fuzdev/fuz_util": ">=0.
|
|
63
|
+
"@fuzdev/fuz_util": ">=0.45.3",
|
|
64
64
|
"@sveltejs/kit": "^2",
|
|
65
65
|
"esbuild": "^0.27.0",
|
|
66
66
|
"svelte": "^5",
|
|
@@ -82,15 +82,16 @@
|
|
|
82
82
|
"@changesets/changelog-git": "^0.2.1",
|
|
83
83
|
"@changesets/types": "^6.1.0",
|
|
84
84
|
"@fuzdev/fuz_code": "^0.38.0",
|
|
85
|
-
"@fuzdev/fuz_css": "^0.
|
|
86
|
-
"@fuzdev/fuz_ui": "^0.
|
|
87
|
-
"@fuzdev/fuz_util": "^0.45.
|
|
85
|
+
"@fuzdev/fuz_css": "^0.44.1",
|
|
86
|
+
"@fuzdev/fuz_ui": "^0.178.1",
|
|
87
|
+
"@fuzdev/fuz_util": "^0.45.3",
|
|
88
88
|
"@ryanatkn/eslint-config": "^0.9.0",
|
|
89
89
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
90
90
|
"@sveltejs/kit": "^2.49.1",
|
|
91
91
|
"@sveltejs/package": "^2.5.7",
|
|
92
92
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
93
93
|
"@types/node": "^24.10.1",
|
|
94
|
+
"@webref/css": "^8.2.0",
|
|
94
95
|
"esbuild": "^0.27.1",
|
|
95
96
|
"eslint": "^9.39.1",
|
|
96
97
|
"eslint-plugin-svelte": "^3.13.1",
|
package/src/lib/disknode.ts
CHANGED
|
@@ -16,6 +16,11 @@ export interface Disknode {
|
|
|
16
16
|
external: boolean;
|
|
17
17
|
ctime: number | null;
|
|
18
18
|
mtime: number | null;
|
|
19
|
+
/**
|
|
20
|
+
* SHA-256 hash of `contents`. `null` iff `contents` is `null`.
|
|
21
|
+
* Used for content-based change detection and caching.
|
|
22
|
+
*/
|
|
23
|
+
content_hash: string | null;
|
|
19
24
|
dependents: Map<PathId, Disknode>;
|
|
20
25
|
dependencies: Map<PathId, Disknode>;
|
|
21
26
|
}
|
package/src/lib/filer.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {default_svelte_config} from './svelte_config.ts';
|
|
|
23
23
|
import {map_sveltekit_aliases} from './sveltekit_helpers.ts';
|
|
24
24
|
import {SVELTEKIT_GLOBAL_SPECIFIER} from './constants.ts';
|
|
25
25
|
import type {Disknode} from './disknode.ts';
|
|
26
|
+
import {to_hash} from './hash.ts';
|
|
26
27
|
|
|
27
28
|
const aliases = Object.entries(default_svelte_config.alias);
|
|
28
29
|
|
|
@@ -81,6 +82,7 @@ export class Filer {
|
|
|
81
82
|
external: this.#is_external(id), // TODO maybe filter externals by default? the user needs to configure the filer then
|
|
82
83
|
ctime: null,
|
|
83
84
|
mtime: null,
|
|
85
|
+
content_hash: null,
|
|
84
86
|
dependents: new Map(),
|
|
85
87
|
dependencies: new Map(),
|
|
86
88
|
};
|
|
@@ -242,15 +244,19 @@ export class Filer {
|
|
|
242
244
|
}
|
|
243
245
|
}
|
|
244
246
|
|
|
245
|
-
|
|
247
|
+
// Compute hash for new contents
|
|
248
|
+
const new_hash = new_contents !== null ? await to_hash(new_contents) : null;
|
|
249
|
+
|
|
246
250
|
file.ctime = stats?.ctimeMs ?? null;
|
|
247
251
|
file.mtime = stats?.mtimeMs ?? null;
|
|
248
252
|
|
|
249
|
-
|
|
253
|
+
// Use hash comparison for change detection (content-based, not mtime-based)
|
|
254
|
+
if (file.content_hash === new_hash) {
|
|
250
255
|
return null;
|
|
251
256
|
}
|
|
252
257
|
|
|
253
258
|
file.contents = new_contents;
|
|
259
|
+
file.content_hash = new_hash;
|
|
254
260
|
|
|
255
261
|
const dir = dirname(file.id);
|
|
256
262
|
|
|
@@ -308,6 +314,7 @@ export class Filer {
|
|
|
308
314
|
if (!file) return null; // this is safe because the object would exist if any other file referenced it as a dependency or dependent
|
|
309
315
|
|
|
310
316
|
file.contents = null; // clear contents in case it gets re-added later, we want the change to be detected
|
|
317
|
+
file.content_hash = null; // clear hash so re-add detects the change
|
|
311
318
|
|
|
312
319
|
file.dependencies.clear();
|
|
313
320
|
|
package/src/lib/gen.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {Result} from '@fuzdev/fuz_util/result.js';
|
|
|
5
5
|
import type {Timings} from '@fuzdev/fuz_util/timings.js';
|
|
6
6
|
import {styleText as st} from 'node:util';
|
|
7
7
|
import type {PathId} from '@fuzdev/fuz_util/path.js';
|
|
8
|
-
import {map_concurrent} from '@fuzdev/fuz_util/async.js';
|
|
8
|
+
import {each_concurrent, map_concurrent} from '@fuzdev/fuz_util/async.js';
|
|
9
9
|
import {fs_search} from '@fuzdev/fuz_util/fs.js';
|
|
10
10
|
|
|
11
11
|
import {print_path} from './paths.ts';
|
|
@@ -246,7 +246,7 @@ export const write_gen_results = async (
|
|
|
246
246
|
log: Logger,
|
|
247
247
|
): Promise<void> => {
|
|
248
248
|
const files = gen_results.successes.flatMap((result) => result.files);
|
|
249
|
-
await
|
|
249
|
+
await each_concurrent(
|
|
250
250
|
files,
|
|
251
251
|
async (file) => {
|
|
252
252
|
const analyzed = analyzed_gen_results.find((r) => r.file.id === file.id);
|
package/src/lib/gro_config.ts
CHANGED
|
@@ -175,9 +175,7 @@ export const cook_gro_config = async (raw_config: RawGroConfig): Promise<GroConf
|
|
|
175
175
|
typeof build_cache_config === 'function' ? await build_cache_config() : build_cache_config;
|
|
176
176
|
|
|
177
177
|
// Hash the JSON representation with deterministic key ordering
|
|
178
|
-
build_cache_config_hash = await to_hash(
|
|
179
|
-
new TextEncoder().encode(json_stringify_deterministic(resolved)),
|
|
180
|
-
);
|
|
178
|
+
build_cache_config_hash = await to_hash(json_stringify_deterministic(resolved));
|
|
181
179
|
}
|
|
182
180
|
|
|
183
181
|
// Delete the raw value to ensure it doesn't persist in memory
|
package/src/lib/hash.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
const {subtle} = globalThis.crypto;
|
|
2
2
|
|
|
3
|
+
const encoder = new TextEncoder();
|
|
4
|
+
|
|
3
5
|
/**
|
|
6
|
+
* Computes a cryptographic hash of the given data.
|
|
7
|
+
*
|
|
8
|
+
* @param data - String or binary data to hash. Strings are UTF-8 encoded internally.
|
|
9
|
+
* @param algorithm - Hash algorithm to use. Defaults to SHA-256.
|
|
10
|
+
* @returns Hexadecimal hash string.
|
|
11
|
+
*
|
|
4
12
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto
|
|
5
13
|
*/
|
|
6
14
|
export const to_hash = async (
|
|
7
|
-
data: BufferSource,
|
|
15
|
+
data: BufferSource | string,
|
|
8
16
|
algorithm: 'SHA-1' | 'SHA-256' | 'SHA-384' | 'SHA-512' = 'SHA-256',
|
|
9
17
|
): Promise<string> => {
|
|
10
|
-
const
|
|
18
|
+
const buffer = typeof data === 'string' ? encoder.encode(data) : data;
|
|
19
|
+
const digested = await subtle.digest(algorithm, buffer);
|
|
11
20
|
const bytes = Array.from(new Uint8Array(digested));
|
|
12
21
|
let hex = '';
|
|
13
22
|
for (const h of bytes) {
|
package/src/lib/loader.ts
CHANGED
|
@@ -2,7 +2,6 @@ import {compile, compileModule, preprocess} from 'svelte/compiler';
|
|
|
2
2
|
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
3
3
|
import {dirname, join} from 'node:path';
|
|
4
4
|
import type {LoadHook, ResolveHook} from 'node:module';
|
|
5
|
-
import {escape_regexp} from '@fuzdev/fuz_util/regexp.js';
|
|
6
5
|
import {readFileSync} from 'node:fs';
|
|
7
6
|
import ts_blank_space from 'ts-blank-space';
|
|
8
7
|
|
|
@@ -15,13 +14,8 @@ import {
|
|
|
15
14
|
sveltekit_shim_app_specifiers,
|
|
16
15
|
} from './sveltekit_shim_app.ts';
|
|
17
16
|
import {default_svelte_config} from './svelte_config.ts';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
NODE_MODULES_DIRNAME,
|
|
21
|
-
TS_MATCHER,
|
|
22
|
-
SVELTE_MATCHER,
|
|
23
|
-
SVELTE_RUNES_MATCHER,
|
|
24
|
-
} from './constants.ts';
|
|
17
|
+
import {paths} from './paths.ts';
|
|
18
|
+
import {TS_MATCHER, SVELTE_MATCHER, SVELTE_RUNES_MATCHER} from './constants.ts';
|
|
25
19
|
import {resolve_specifier} from './resolve_specifier.ts';
|
|
26
20
|
import {map_sveltekit_aliases} from './sveltekit_helpers.ts';
|
|
27
21
|
|
|
@@ -74,7 +68,6 @@ const {
|
|
|
74
68
|
const aliases = Object.entries(alias);
|
|
75
69
|
|
|
76
70
|
const RAW_MATCHER = /(%3Fraw|\.css|\.svg)$/; // TODO others? configurable?
|
|
77
|
-
const NODE_MODULES_MATCHER = new RegExp(escape_regexp('/' + NODE_MODULES_DIRNAME + '/'), 'u');
|
|
78
71
|
|
|
79
72
|
/** @nodocs */
|
|
80
73
|
export const load: LoadHook = async (url, context, nextLoad) => {
|
|
@@ -212,24 +205,17 @@ export const resolve: ResolveHook = async (specifier, context, nextResolve) => {
|
|
|
212
205
|
return nextResolve(shimmed, context);
|
|
213
206
|
}
|
|
214
207
|
|
|
215
|
-
//
|
|
216
|
-
|
|
217
|
-
// TODO maybe make this generic, checking `package_json.name` against `s` and map it, possibly need to export `resolve_exported_value`
|
|
218
|
-
if (IS_THIS_GRO && s.startsWith('@ryanatkn/gro')) {
|
|
219
|
-
s = join(dir, 'dist', s.substring(13));
|
|
220
|
-
}
|
|
208
|
+
// Apply SvelteKit aliases (handles self-referencing packages like @fuzdev/fuz_util -> src/lib)
|
|
209
|
+
s = map_sveltekit_aliases(s, aliases);
|
|
221
210
|
|
|
222
|
-
|
|
223
|
-
if (
|
|
211
|
+
// Bare specifiers (not starting with . or /) use Node's default resolution
|
|
212
|
+
if (s[0] !== '.' && s[0] !== '/') {
|
|
224
213
|
return nextResolve(s, context);
|
|
225
214
|
}
|
|
226
215
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
// Imports into `node_modules` use the default algorithm, and the rest use use Vite conventions.
|
|
232
|
-
if (s[0] !== '.' && s[0] !== '/') {
|
|
216
|
+
// Resolve paths using Vite conventions
|
|
217
|
+
const parent_url = context.parentURL;
|
|
218
|
+
if (!parent_url) {
|
|
233
219
|
return nextResolve(s, context);
|
|
234
220
|
}
|
|
235
221
|
|
package/src/lib/run.task.ts
CHANGED
|
@@ -9,6 +9,8 @@ import {serialize_args, to_implicit_forwarded_args} from './args.ts';
|
|
|
9
9
|
/**
|
|
10
10
|
* Runs a TypeScript file with Gro's loader, forwarding all args to the script.
|
|
11
11
|
* Useful for scripts that need SvelteKit shims ($lib, $env, etc).
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
16
|
/** @nodocs */
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* but exists here for the sake of the Node loader.
|
|
7
7
|
* There may be a cleaner workaround but I couldn't find it.
|
|
8
8
|
* @see https://github.com/nodejs/loaders for details about the forthcoming virtual file support
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
13
|
export const browser = false;
|