@fuzdev/gro 0.192.0 → 0.193.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.
@@ -9,6 +9,7 @@ export declare const Args: z.ZodObject<{
9
9
  install: z.ZodDefault<z.ZodBoolean>;
10
10
  'no-install': z.ZodDefault<z.ZodBoolean>;
11
11
  force_build: z.ZodDefault<z.ZodBoolean>;
12
+ allow_dirty: z.ZodDefault<z.ZodBoolean>;
12
13
  }, z.core.$strict>;
13
14
  export type Args = z.infer<typeof Args>;
14
15
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"build.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/build.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAOtB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAW/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;;;;kBAcf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AASvC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAqG3B,CAAC"}
1
+ {"version":3,"file":"build.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/build.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAOtB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAW/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;;;;;kBAkBf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AASvC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAuG3B,CAAC"}
@@ -24,6 +24,10 @@ export const Args = z.strictObject({
24
24
  .boolean()
25
25
  .meta({ description: 'force a fresh build, ignoring the cache' })
26
26
  .default(false),
27
+ allow_dirty: z
28
+ .boolean()
29
+ .meta({ description: 'skip the post-build dirty workspace check' })
30
+ .default(false),
27
31
  });
28
32
  /**
29
33
  * Length of git commit hash when displayed in logs (standard git convention).
@@ -40,7 +44,7 @@ export const task = {
40
44
  Args,
41
45
  run: async (ctx) => {
42
46
  const { args, invoke_task, log, config } = ctx;
43
- const { sync, gen, install, force_build } = args;
47
+ const { sync, gen, install, force_build, allow_dirty } = args;
44
48
  if (sync || install) {
45
49
  if (!sync)
46
50
  log.warn('sync is false but install is true, so ignoring the sync option');
@@ -91,15 +95,17 @@ export const task = {
91
95
  await plugins.adapt();
92
96
  await plugins.teardown();
93
97
  // Verify workspace didn't become dirty during build
94
- const final_workspace_status = await git_check_clean_workspace();
95
- if (final_workspace_status !== workspace_status) {
96
- // Workspace state changed during build - this indicates a problem
97
- throw new TaskError('Build process modified tracked files or created untracked files.\n\n' +
98
- 'Git status after build:\n' +
99
- final_workspace_status +
100
- '\n\n' +
101
- 'Builds should only write to output directories (build/, dist/, etc.).\n' +
102
- 'This usually indicates a plugin or build step is incorrectly modifying source files.');
98
+ if (!allow_dirty) {
99
+ const final_workspace_status = await git_check_clean_workspace();
100
+ if (final_workspace_status !== workspace_status) {
101
+ // Workspace state changed during build - this indicates a problem
102
+ throw new TaskError('Build process modified tracked files or created untracked files.\n\n' +
103
+ 'Git status after build:\n' +
104
+ final_workspace_status +
105
+ '\n\n' +
106
+ 'Builds should only write to output directories (build/, dist/, etc.).\n' +
107
+ 'This usually indicates a plugin or build step is incorrectly modifying source files.');
108
+ }
103
109
  }
104
110
  // Save build cache metadata after successful build (only if workspace is clean)
105
111
  if (!workspace_dirty) {
@@ -1 +1 @@
1
- {"version":3,"file":"filer.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/filer.ts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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;CAiPtB;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
@@ -1,7 +1,6 @@
1
1
  import { EMPTY_OBJECT } from '@fuzdev/fuz_util/object.js';
2
2
  import { readFile, stat } from 'node:fs/promises';
3
3
  import { dirname, resolve } from 'node:path';
4
- import { isBuiltin } from 'node:module';
5
4
  import { fileURLToPath, pathToFileURL } from 'node:url';
6
5
  import { UnreachableError } from '@fuzdev/fuz_util/error.js';
7
6
  import { hash_secure } from '@fuzdev/fuz_util/hash.js';
@@ -227,23 +226,26 @@ export class Filer {
227
226
  continue;
228
227
  const path = map_sveltekit_aliases(specifier, aliases);
229
228
  let path_id;
230
- // TODO can we replace `resolve_specifier` with `import.meta.resolve` completely now outside of esbuild plugins?
229
+ // TODO replace `resolve_specifier` with `import.meta.resolve` for local specifiers too
230
+ // once we move to explicit extensions (Deno-compatible) - the .js→.ts Vite convention
231
+ // is the only reason resolve_specifier is still needed here
231
232
  if (path[0] === '.' || path[0] === '/') {
232
233
  const resolved = await resolve_specifier(path, dir); // eslint-disable-line no-await-in-loop
233
234
  path_id = resolved.path_id;
234
235
  }
235
236
  else {
236
- if (isBuiltin(path))
237
- continue;
238
237
  const file_url = pathToFileURL(file.id);
238
+ let resolved_url;
239
239
  try {
240
- path_id = fileURLToPath(import.meta.resolve(path, file_url.href));
240
+ resolved_url = import.meta.resolve(path, file_url.href);
241
241
  }
242
242
  catch (error) {
243
- // if resolving fails for any reason, just log and ignore it
244
243
  this.#log?.error('[filer] failed to resolve path', path, file_url.href, error);
245
244
  continue;
246
245
  }
246
+ if (!resolved_url.startsWith('file:'))
247
+ continue; // skip node:, npm:, https:, jsr:, etc.
248
+ path_id = fileURLToPath(resolved_url);
247
249
  }
248
250
  dependencies_removed.delete(path_id);
249
251
  if (!dependencies_before.has(path_id)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzdev/gro",
3
- "version": "0.192.0",
3
+ "version": "0.193.0",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -59,7 +59,7 @@
59
59
  "zod": "^4.3.6"
60
60
  },
61
61
  "peerDependencies": {
62
- "@fuzdev/fuz_util": ">=0.49.2",
62
+ "@fuzdev/fuz_util": ">=0.50.1",
63
63
  "@sveltejs/kit": "^2",
64
64
  "esbuild": "^0.27.0",
65
65
  "svelte": "^5",
@@ -80,9 +80,9 @@
80
80
  "devDependencies": {
81
81
  "@changesets/changelog-git": "^0.2.1",
82
82
  "@changesets/types": "^6.1.0",
83
- "@fuzdev/fuz_code": "^0.44.1",
84
- "@fuzdev/fuz_css": "^0.47.0",
85
- "@fuzdev/fuz_ui": "^0.182.0",
83
+ "@fuzdev/fuz_code": "^0.45.0",
84
+ "@fuzdev/fuz_css": "^0.50.0",
85
+ "@fuzdev/fuz_ui": "^0.183.1",
86
86
  "@fuzdev/fuz_util": "^0.50.1",
87
87
  "@jridgewell/trace-mapping": "^0.3.31",
88
88
  "@ryanatkn/eslint-config": "^0.9.0",
@@ -31,6 +31,10 @@ export const Args = z.strictObject({
31
31
  .boolean()
32
32
  .meta({description: 'force a fresh build, ignoring the cache'})
33
33
  .default(false),
34
+ allow_dirty: z
35
+ .boolean()
36
+ .meta({description: 'skip the post-build dirty workspace check'})
37
+ .default(false),
34
38
  });
35
39
  export type Args = z.infer<typeof Args>;
36
40
 
@@ -52,7 +56,7 @@ export const task: Task<Args> = {
52
56
  Args,
53
57
  run: async (ctx): Promise<void> => {
54
58
  const {args, invoke_task, log, config} = ctx;
55
- const {sync, gen, install, force_build} = args;
59
+ const {sync, gen, install, force_build, allow_dirty} = args;
56
60
 
57
61
  if (sync || install) {
58
62
  if (!sync) log.warn('sync is false but install is true, so ignoring the sync option');
@@ -113,17 +117,19 @@ export const task: Task<Args> = {
113
117
  await plugins.teardown();
114
118
 
115
119
  // Verify workspace didn't become dirty during build
116
- const final_workspace_status = await git_check_clean_workspace();
117
- if (final_workspace_status !== workspace_status) {
118
- // Workspace state changed during build - this indicates a problem
119
- throw new TaskError(
120
- 'Build process modified tracked files or created untracked files.\n\n' +
121
- 'Git status after build:\n' +
122
- final_workspace_status +
123
- '\n\n' +
124
- 'Builds should only write to output directories (build/, dist/, etc.).\n' +
125
- 'This usually indicates a plugin or build step is incorrectly modifying source files.',
126
- );
120
+ if (!allow_dirty) {
121
+ const final_workspace_status = await git_check_clean_workspace();
122
+ if (final_workspace_status !== workspace_status) {
123
+ // Workspace state changed during build - this indicates a problem
124
+ throw new TaskError(
125
+ 'Build process modified tracked files or created untracked files.\n\n' +
126
+ 'Git status after build:\n' +
127
+ final_workspace_status +
128
+ '\n\n' +
129
+ 'Builds should only write to output directories (build/, dist/, etc.).\n' +
130
+ 'This usually indicates a plugin or build step is incorrectly modifying source files.',
131
+ );
132
+ }
127
133
  }
128
134
 
129
135
  // Save build cache metadata after successful build (only if workspace is clean)
package/src/lib/filer.ts CHANGED
@@ -2,7 +2,6 @@ import {EMPTY_OBJECT} from '@fuzdev/fuz_util/object.js';
2
2
  import {readFile, stat} from 'node:fs/promises';
3
3
  import {dirname, resolve} from 'node:path';
4
4
  import type {OmitStrict} from '@fuzdev/fuz_util/types.js';
5
- import {isBuiltin} from 'node:module';
6
5
  import {fileURLToPath, pathToFileURL} from 'node:url';
7
6
  import {UnreachableError} from '@fuzdev/fuz_util/error.js';
8
7
  import type {Logger} from '@fuzdev/fuz_util/log.js';
@@ -276,20 +275,23 @@ export class Filer {
276
275
  const path = map_sveltekit_aliases(specifier, aliases);
277
276
 
278
277
  let path_id;
279
- // TODO can we replace `resolve_specifier` with `import.meta.resolve` completely now outside of esbuild plugins?
278
+ // TODO replace `resolve_specifier` with `import.meta.resolve` for local specifiers too
279
+ // once we move to explicit extensions (Deno-compatible) - the .js→.ts Vite convention
280
+ // is the only reason resolve_specifier is still needed here
280
281
  if (path[0] === '.' || path[0] === '/') {
281
282
  const resolved = await resolve_specifier(path, dir); // eslint-disable-line no-await-in-loop
282
283
  path_id = resolved.path_id;
283
284
  } else {
284
- if (isBuiltin(path)) continue;
285
285
  const file_url = pathToFileURL(file.id);
286
+ let resolved_url;
286
287
  try {
287
- path_id = fileURLToPath(import.meta.resolve(path, file_url.href));
288
+ resolved_url = import.meta.resolve(path, file_url.href);
288
289
  } catch (error) {
289
- // if resolving fails for any reason, just log and ignore it
290
290
  this.#log?.error('[filer] failed to resolve path', path, file_url.href, error);
291
291
  continue;
292
292
  }
293
+ if (!resolved_url.startsWith('file:')) continue; // skip node:, npm:, https:, jsr:, etc.
294
+ path_id = fileURLToPath(resolved_url);
293
295
  }
294
296
  dependencies_removed.delete(path_id);
295
297
  if (!dependencies_before.has(path_id)) {