@ryanatkn/gro 0.151.1 → 0.152.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/filer.d.ts CHANGED
@@ -25,6 +25,7 @@ export interface Filer_Options {
25
25
  watch_dir?: typeof watch_dir;
26
26
  watch_dir_options?: Partial<Omit_Strict<Watch_Dir_Options, 'on_change'>>;
27
27
  package_json_cache?: Record<string, Package_Json>;
28
+ log?: Logger;
28
29
  }
29
30
  export declare class Filer {
30
31
  #private;
@@ -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,EACnB,KAAK,iBAAiB,EAEtB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAIpD,MAAM,WAAW,WAAW;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ;;;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,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,c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AAC,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
@@ -17,10 +17,12 @@ export class Filer {
17
17
  files = new Map();
18
18
  #watch_dir;
19
19
  #watch_dir_options;
20
+ #log;
20
21
  constructor(options = EMPTY_OBJECT) {
21
22
  this.#watch_dir = options.watch_dir ?? watch_dir;
22
23
  this.#watch_dir_options = options.watch_dir_options ?? EMPTY_OBJECT;
23
24
  this.root_dir = resolve(options.watch_dir_options?.dir ?? paths.source);
25
+ this.#log = options.log;
24
26
  }
25
27
  #watching;
26
28
  #listeners = new Set();
@@ -67,6 +69,7 @@ export class Filer {
67
69
  continue;
68
70
  const path = map_sveltekit_aliases(specifier, aliases);
69
71
  let path_id;
72
+ // TODO can we replace `resolve_specifier` with `import.meta.resolve` completely now outside of esbuild plugins?
70
73
  if (path[0] === '.' || path[0] === '/') {
71
74
  const resolved = resolve_specifier(path, dir);
72
75
  path_id = resolved.path_id;
@@ -74,16 +77,14 @@ export class Filer {
74
77
  else {
75
78
  if (isBuiltin(path))
76
79
  continue;
80
+ const file_url = pathToFileURL(file.id);
77
81
  try {
78
- const file_url = pathToFileURL(file.id);
79
82
  path_id = fileURLToPath(import.meta.resolve(path, file_url.href));
80
83
  }
81
84
  catch (error) {
82
- // If it's imported from an external module, ignore any import errors.
83
- if (error.code === 'ERR_MODULE_NOT_FOUND' && file.external) {
84
- continue;
85
- }
86
- throw error;
85
+ // if resolving fails for any reason, just log and ignore it
86
+ this.#log?.error('[filer] failed to resolve path', path, file_url.href, error);
87
+ continue;
87
88
  }
88
89
  }
89
90
  dependencies_removed.delete(path_id);
@@ -205,7 +206,7 @@ export const filter_dependents = (source_file, get_by_id, filter, results = new
205
206
  }
206
207
  const dependent_source_file = get_by_id(dependent_id);
207
208
  if (!dependent_source_file) {
208
- log?.warn(`[filer.filter_dependents]: dependent source file ${dependent_id} not found for ${source_file.id}`);
209
+ log?.warn(`[filer.filter_dependents] dependent source file ${dependent_id} not found for ${source_file.id}`);
209
210
  continue;
210
211
  }
211
212
  filter_dependents(dependent_source_file, get_by_id, filter, results, searched);
@@ -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,iBAwBb,CAAC;AAEF,eAAe,MAAM,CAAC"}
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"}
@@ -23,7 +23,9 @@ const config = async (cfg) => {
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 ? (await import('./gro_plugin_moss.js')).gro_plugin_moss() : null, // lazy load to avoid errors if it's not installed
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,
@@ -34,7 +34,7 @@ import { Filer } from './filer.js';
34
34
  export const invoke_task = async (task_name, args, config, initial_filer, initial_timings) => {
35
35
  const log = new System_Logger(print_log_label(task_name || 'gro'));
36
36
  log.info('invoking', task_name ? st('cyan', task_name) : 'gro');
37
- const filer = initial_filer ?? new Filer();
37
+ const filer = initial_filer ?? new Filer({ log });
38
38
  const timings = initial_timings ?? new Timings();
39
39
  const total_timing = create_stopwatch();
40
40
  const finish = () => {
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;
@@ -392,7 +391,7 @@ export declare const package_json: {
392
391
  types: string;
393
392
  default: string;
394
393
  };
395
- './sveltekit_shim_app_stores.js': {
394
+ './sveltekit_shim_app_state.js': {
396
395
  types: string;
397
396
  default: string;
398
397
  };
@@ -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: ({
@@ -1105,15 +1094,12 @@ export declare const src_json: {
1105
1094
  kind: "function";
1106
1095
  })[];
1107
1096
  };
1108
- './sveltekit_shim_app_stores.js': {
1097
+ './sveltekit_shim_app_state.js': {
1109
1098
  path: string;
1110
- declarations: ({
1111
- name: string;
1112
- kind: "function";
1113
- } | {
1099
+ declarations: {
1114
1100
  name: string;
1115
1101
  kind: "variable";
1116
- })[];
1102
+ }[];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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuwBD,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.1',
4
+ version: '0.152.0',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -44,34 +44,35 @@ export const package_json = {
44
44
  dotenv: '^16.5.0',
45
45
  'esm-env': '^1.2.2',
46
46
  mri: '^1.2.0',
47
- 'oxc-parser': '^0.63.0',
47
+ 'oxc-parser': '^0.67.0',
48
48
  prettier: '^3.5.3',
49
49
  'prettier-plugin-svelte': '^3.3.3',
50
50
  'ts-morph': '^25.0.1',
51
51
  tslib: '^2.8.1',
52
- zod: '^3.24.2',
52
+ zod: '^3.24.3',
53
53
  },
54
54
  peerDependencies: { esbuild: '^0.25', svelte: '^5' },
55
55
  devDependencies: {
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.139.0',
60
- '@ryanatkn/moss': '^0.25.0',
59
+ '@ryanatkn/fuz': '^0.139.1',
60
+ '@ryanatkn/moss': '^0.26.0',
61
61
  '@sveltejs/adapter-static': '^3.0.8',
62
- '@sveltejs/kit': '^2.20.7',
62
+ '@sveltejs/kit': '^2.20.8',
63
63
  '@sveltejs/package': '^2.3.11',
64
64
  '@sveltejs/vite-plugin-svelte': '^5.0.3',
65
- '@types/node': '^22.14.1',
66
- esbuild: '^0.25.2',
67
- eslint: '^9.24.0',
65
+ '@types/node': '^22.15.3',
66
+ esbuild: '^0.25.3',
67
+ eslint: '^9.25.1',
68
68
  'eslint-plugin-svelte': '^3.5.1',
69
- svelte: '^5.27.0',
69
+ svelte: '^5.28.2',
70
70
  'svelte-check': '^4.1.6',
71
71
  typescript: '^5.8.3',
72
- 'typescript-eslint': '^8.30.1',
72
+ 'typescript-eslint': '^8.31.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',
@@ -237,9 +234,9 @@ export const package_json = {
237
234
  types: './dist/sveltekit_shim_app_paths.d.ts',
238
235
  default: './dist/sveltekit_shim_app_paths.js',
239
236
  },
240
- './sveltekit_shim_app_stores.js': {
241
- types: './dist/sveltekit_shim_app_stores.d.ts',
242
- default: './dist/sveltekit_shim_app_stores.js',
237
+ './sveltekit_shim_app_state.js': {
238
+ types: './dist/sveltekit_shim_app_state.d.ts',
239
+ default: './dist/sveltekit_shim_app_state.js',
243
240
  },
244
241
  './sveltekit_shim_app.js': {
245
242
  types: './dist/sveltekit_shim_app.d.ts',
@@ -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.1',
263
+ version: '0.152.0',
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: [
@@ -948,10 +937,9 @@ export const src_json = {
948
937
  { name: 'resolveRoute', kind: 'function' },
949
938
  ],
950
939
  },
951
- './sveltekit_shim_app_stores.js': {
952
- path: 'sveltekit_shim_app_stores.ts',
940
+ './sveltekit_shim_app_state.js': {
941
+ path: 'sveltekit_shim_app_state.ts',
953
942
  declarations: [
954
- { name: 'getStores', kind: 'function' },
955
943
  { name: 'navigating', kind: 'variable' },
956
944
  { name: 'page', kind: 'variable' },
957
945
  { name: 'updated', kind: 'variable' },
@@ -9,7 +9,7 @@ export const sveltekit_shim_app_specifiers = new Map([
9
9
  ['$app/forms', '@ryanatkn/gro/sveltekit_shim_app_forms.js'],
10
10
  ['$app/navigation', '@ryanatkn/gro/sveltekit_shim_app_navigation.js'],
11
11
  ['$app/paths', '@ryanatkn/gro/sveltekit_shim_app_paths.js'],
12
- ['$app/stores', '@ryanatkn/gro/sveltekit_shim_app_stores.js'],
12
+ ['$app/state', '@ryanatkn/gro/sveltekit_shim_app_state.js'],
13
13
  ]);
14
14
  export const render_sveltekit_shim_app_paths = (base_url = '', assets_url = '') => `// shim for $app/paths
15
15
  // @see https://github.com/sveltejs/kit/issues/1485
@@ -0,0 +1,5 @@
1
+ import type { navigating as base_navigating, page as base_page, updated as base_updated } from '$app/state';
2
+ export declare const navigating: typeof base_navigating;
3
+ export declare const page: typeof base_page;
4
+ export declare const updated: typeof base_updated;
5
+ //# sourceMappingURL=sveltekit_shim_app_state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sveltekit_shim_app_state.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACX,UAAU,IAAI,eAAe,EAC7B,IAAI,IAAI,SAAS,EACjB,OAAO,IAAI,YAAY,EACvB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,UAAU,EAAE,OAAO,eAO/B,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,OAAO,SASzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAAO,YAK5B,CAAC"}
@@ -0,0 +1,26 @@
1
+ // shim for $app/state
2
+ // @see https://github.com/sveltejs/kit/issues/1485
3
+ export const navigating = {
4
+ from: null,
5
+ to: null,
6
+ type: null,
7
+ willUnload: null,
8
+ delta: null,
9
+ complete: null,
10
+ };
11
+ export const page = {
12
+ data: {},
13
+ form: null,
14
+ error: null,
15
+ params: {},
16
+ route: { id: null },
17
+ state: {},
18
+ status: -1,
19
+ url: new URL('https://github.com/ryanatkn/gro'),
20
+ };
21
+ export const updated = {
22
+ current: false,
23
+ check: () => {
24
+ throw new Error('Can only call updated.check() in the browser');
25
+ },
26
+ };
@@ -7,6 +7,10 @@ export declare const Args: z.ZodObject<{
7
7
  force: z.ZodDefault<z.ZodBoolean>;
8
8
  pull: z.ZodDefault<z.ZodBoolean>;
9
9
  'no-pull': z.ZodDefault<z.ZodBoolean>;
10
+ delete_node_modules: z.ZodDefault<z.ZodBoolean>;
11
+ node_modules_path: z.ZodDefault<z.ZodString>;
12
+ delete_lockfile: z.ZodDefault<z.ZodBoolean>;
13
+ lockfile_path: z.ZodDefault<z.ZodString>;
10
14
  dry: z.ZodDefault<z.ZodBoolean>;
11
15
  }, "strict", z.ZodTypeAny, {
12
16
  _: string[];
@@ -16,6 +20,10 @@ export declare const Args: z.ZodObject<{
16
20
  force: boolean;
17
21
  'no-pull': boolean;
18
22
  only: string[];
23
+ delete_node_modules: boolean;
24
+ node_modules_path: string;
25
+ delete_lockfile: boolean;
26
+ lockfile_path: string;
19
27
  }, {
20
28
  _?: string[] | undefined;
21
29
  origin?: string | undefined;
@@ -24,6 +32,10 @@ export declare const Args: z.ZodObject<{
24
32
  force?: boolean | undefined;
25
33
  'no-pull'?: boolean | undefined;
26
34
  only?: string | string[] | undefined;
35
+ delete_node_modules?: boolean | undefined;
36
+ node_modules_path?: string | undefined;
37
+ delete_lockfile?: boolean | undefined;
38
+ lockfile_path?: string | undefined;
27
39
  }>;
28
40
  export type Args = z.infer<typeof Args>;
29
41
  export declare const task: Task<Args>;
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/upgrade.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAMhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;EAeP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA+C3B,CAAC"}
1
+ {"version":3,"file":"upgrade.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/upgrade.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAOhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAkE3B,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import { spawn } from '@ryanatkn/belt/process.js';
2
2
  import { z } from 'zod';
3
+ import { rmSync } from 'node:fs';
3
4
  import { Task_Error } from './task.js';
4
5
  import { extract_deps, load_package_json } from './package_json.js';
5
6
  import { Git_Origin, git_pull } from './git.js';
6
7
  import { spawn_cli } from './cli.js';
7
8
  import { serialize_args, to_forwarded_args } from './args.js';
9
+ import { NODE_MODULES_DIRNAME } from './constants.js';
8
10
  export const Args = z
9
11
  .object({
10
12
  _: z.array(z.string(), { description: 'names of deps to exclude from the upgrade' }).default([]),
@@ -18,6 +20,18 @@ export const Args = z
18
20
  force: z.boolean({ description: 'if true, print out the planned upgrades' }).default(false),
19
21
  pull: z.boolean({ description: 'dual of no-pull' }).default(true),
20
22
  'no-pull': z.boolean({ description: 'opt out of git pull' }).default(false),
23
+ delete_node_modules: z
24
+ .boolean({ description: 'if true, deletes node_modules before upgrading' })
25
+ .default(false),
26
+ node_modules_path: z // TODO maybe configured globally instead
27
+ .string({ description: 'path to modules directory to delete' })
28
+ .default(NODE_MODULES_DIRNAME),
29
+ delete_lockfile: z
30
+ .boolean({ description: 'if true, deletes the lockfile before upgrading' })
31
+ .default(false),
32
+ lockfile_path: z
33
+ .string({ description: 'path to the lockfile to delete' })
34
+ .default('package-lock.json'),
21
35
  dry: z.boolean({ description: 'if true, print out the planned upgrades' }).default(false),
22
36
  })
23
37
  .strict();
@@ -25,7 +39,7 @@ export const task = {
25
39
  summary: 'upgrade deps',
26
40
  Args,
27
41
  run: async ({ args, log, config }) => {
28
- const { _, only, origin, force, pull, dry } = args;
42
+ const { _, only, origin, force, pull, delete_node_modules, node_modules_path, delete_lockfile, lockfile_path, dry, } = args;
29
43
  if (_.length && only.length) {
30
44
  throw new Task_Error('Cannot call `gro upgrade` with both rest args and --only.');
31
45
  }
@@ -33,6 +47,12 @@ export const task = {
33
47
  if (pull) {
34
48
  await git_pull(origin);
35
49
  }
50
+ if (delete_node_modules) {
51
+ rmSync(node_modules_path, { recursive: true, force: true });
52
+ }
53
+ if (delete_lockfile) {
54
+ rmSync(lockfile_path, { force: true });
55
+ }
36
56
  const package_json = load_package_json();
37
57
  const all_deps = extract_deps(package_json);
38
58
  const deps = only.length
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.151.1",
3
+ "version": "0.152.0",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -54,12 +54,12 @@
54
54
  "dotenv": "^16.5.0",
55
55
  "esm-env": "^1.2.2",
56
56
  "mri": "^1.2.0",
57
- "oxc-parser": "^0.63.0",
57
+ "oxc-parser": "^0.67.0",
58
58
  "prettier": "^3.5.3",
59
59
  "prettier-plugin-svelte": "^3.3.3",
60
60
  "ts-morph": "^25.0.1",
61
61
  "tslib": "^2.8.1",
62
- "zod": "^3.24.2"
62
+ "zod": "^3.24.3"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "esbuild": "^0.25",
@@ -69,22 +69,25 @@
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.139.0",
73
- "@ryanatkn/moss": "^0.25.0",
72
+ "@ryanatkn/fuz": "^0.139.1",
73
+ "@ryanatkn/moss": "^0.26.0",
74
74
  "@sveltejs/adapter-static": "^3.0.8",
75
- "@sveltejs/kit": "^2.20.7",
75
+ "@sveltejs/kit": "^2.20.8",
76
76
  "@sveltejs/package": "^2.3.11",
77
77
  "@sveltejs/vite-plugin-svelte": "^5.0.3",
78
- "@types/node": "^22.14.1",
79
- "esbuild": "^0.25.2",
80
- "eslint": "^9.24.0",
78
+ "@types/node": "^22.15.3",
79
+ "esbuild": "^0.25.3",
80
+ "eslint": "^9.25.1",
81
81
  "eslint-plugin-svelte": "^3.5.1",
82
- "svelte": "^5.27.0",
82
+ "svelte": "^5.28.2",
83
83
  "svelte-check": "^4.1.6",
84
84
  "typescript": "^5.8.3",
85
- "typescript-eslint": "^8.30.1",
85
+ "typescript-eslint": "^8.31.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"
@@ -413,9 +412,9 @@
413
412
  "types": "./dist/sveltekit_shim_app_paths.d.ts",
414
413
  "default": "./dist/sveltekit_shim_app_paths.js"
415
414
  },
416
- "./sveltekit_shim_app_stores.js": {
417
- "types": "./dist/sveltekit_shim_app_stores.d.ts",
418
- "default": "./dist/sveltekit_shim_app_stores.js"
415
+ "./sveltekit_shim_app_state.js": {
416
+ "types": "./dist/sveltekit_shim_app_state.d.ts",
417
+ "default": "./dist/sveltekit_shim_app_state.js"
419
418
  },
420
419
  "./sveltekit_shim_app.js": {
421
420
  "types": "./dist/sveltekit_shim_app.d.ts",
package/src/lib/filer.ts CHANGED
@@ -27,6 +27,7 @@ const aliases = Object.entries(default_sveltekit_config.alias);
27
27
 
28
28
  export interface Source_File {
29
29
  id: Path_Id;
30
+ // TODO figure out the best API that makes this lazy
30
31
  /**
31
32
  * `null` contents means it doesn't exist.
32
33
  * We create the file in memory to track its dependents regardless of its existence on disk.
@@ -50,6 +51,7 @@ export interface Filer_Options {
50
51
  watch_dir?: typeof watch_dir;
51
52
  watch_dir_options?: Partial<Omit_Strict<Watch_Dir_Options, 'on_change'>>;
52
53
  package_json_cache?: Record<string, Package_Json>;
54
+ log?: Logger;
53
55
  }
54
56
 
55
57
  export class Filer {
@@ -60,10 +62,13 @@ export class Filer {
60
62
  #watch_dir: typeof watch_dir;
61
63
  #watch_dir_options: Partial<Watch_Dir_Options>;
62
64
 
65
+ #log?: Logger;
66
+
63
67
  constructor(options: Filer_Options = EMPTY_OBJECT) {
64
68
  this.#watch_dir = options.watch_dir ?? watch_dir;
65
69
  this.#watch_dir_options = options.watch_dir_options ?? EMPTY_OBJECT;
66
70
  this.root_dir = resolve(options.watch_dir_options?.dir ?? paths.source);
71
+ this.#log = options.log;
67
72
  }
68
73
 
69
74
  #watching: Watch_Node_Fs | undefined;
@@ -121,20 +126,19 @@ export class Filer {
121
126
  const path = map_sveltekit_aliases(specifier, aliases);
122
127
 
123
128
  let path_id;
129
+ // TODO can we replace `resolve_specifier` with `import.meta.resolve` completely now outside of esbuild plugins?
124
130
  if (path[0] === '.' || path[0] === '/') {
125
131
  const resolved = resolve_specifier(path, dir);
126
132
  path_id = resolved.path_id;
127
133
  } else {
128
134
  if (isBuiltin(path)) continue;
135
+ const file_url = pathToFileURL(file.id);
129
136
  try {
130
- const file_url = pathToFileURL(file.id);
131
137
  path_id = fileURLToPath(import.meta.resolve(path, file_url.href));
132
138
  } catch (error) {
133
- // If it's imported from an external module, ignore any import errors.
134
- if (error.code === 'ERR_MODULE_NOT_FOUND' && file.external) {
135
- continue;
136
- }
137
- throw error;
139
+ // if resolving fails for any reason, just log and ignore it
140
+ this.#log?.error('[filer] failed to resolve path', path, file_url.href, error);
141
+ continue;
138
142
  }
139
143
  }
140
144
  dependencies_removed.delete(path_id);
@@ -273,7 +277,7 @@ export const filter_dependents = (
273
277
  const dependent_source_file = get_by_id(dependent_id);
274
278
  if (!dependent_source_file) {
275
279
  log?.warn(
276
- `[filer.filter_dependents]: dependent source file ${dependent_id} not found for ${source_file.id}`,
280
+ `[filer.filter_dependents] dependent source file ${dependent_id} not found for ${source_file.id}`,
277
281
  );
278
282
  continue;
279
283
  }
@@ -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 ? (await import('./gro_plugin_moss.js')).gro_plugin_moss() : null, // lazy load to avoid errors if it's not installed
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,
@@ -44,7 +44,7 @@ export const invoke_task = async (
44
44
  const log = new System_Logger(print_log_label(task_name || 'gro'));
45
45
  log.info('invoking', task_name ? st('cyan', task_name) : 'gro');
46
46
 
47
- const filer = initial_filer ?? new Filer();
47
+ const filer = initial_filer ?? new Filer({log});
48
48
 
49
49
  const timings = initial_timings ?? new Timings();
50
50
 
@@ -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.1',
8
+ version: '0.152.0',
9
9
  description: 'task runner and toolkit extending SvelteKit',
10
10
  motto: 'generate, run, optimize',
11
11
  glyph: '🌰',
@@ -49,34 +49,35 @@ export const package_json = {
49
49
  dotenv: '^16.5.0',
50
50
  'esm-env': '^1.2.2',
51
51
  mri: '^1.2.0',
52
- 'oxc-parser': '^0.63.0',
52
+ 'oxc-parser': '^0.67.0',
53
53
  prettier: '^3.5.3',
54
54
  'prettier-plugin-svelte': '^3.3.3',
55
55
  'ts-morph': '^25.0.1',
56
56
  tslib: '^2.8.1',
57
- zod: '^3.24.2',
57
+ zod: '^3.24.3',
58
58
  },
59
59
  peerDependencies: {esbuild: '^0.25', svelte: '^5'},
60
60
  devDependencies: {
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.139.0',
65
- '@ryanatkn/moss': '^0.25.0',
64
+ '@ryanatkn/fuz': '^0.139.1',
65
+ '@ryanatkn/moss': '^0.26.0',
66
66
  '@sveltejs/adapter-static': '^3.0.8',
67
- '@sveltejs/kit': '^2.20.7',
67
+ '@sveltejs/kit': '^2.20.8',
68
68
  '@sveltejs/package': '^2.3.11',
69
69
  '@sveltejs/vite-plugin-svelte': '^5.0.3',
70
- '@types/node': '^22.14.1',
71
- esbuild: '^0.25.2',
72
- eslint: '^9.24.0',
70
+ '@types/node': '^22.15.3',
71
+ esbuild: '^0.25.3',
72
+ eslint: '^9.25.1',
73
73
  'eslint-plugin-svelte': '^3.5.1',
74
- svelte: '^5.27.0',
74
+ svelte: '^5.28.2',
75
75
  'svelte-check': '^4.1.6',
76
76
  typescript: '^5.8.3',
77
- 'typescript-eslint': '^8.30.1',
77
+ 'typescript-eslint': '^8.31.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',
@@ -242,9 +239,9 @@ export const package_json = {
242
239
  types: './dist/sveltekit_shim_app_paths.d.ts',
243
240
  default: './dist/sveltekit_shim_app_paths.js',
244
241
  },
245
- './sveltekit_shim_app_stores.js': {
246
- types: './dist/sveltekit_shim_app_stores.d.ts',
247
- default: './dist/sveltekit_shim_app_stores.js',
242
+ './sveltekit_shim_app_state.js': {
243
+ types: './dist/sveltekit_shim_app_state.d.ts',
244
+ default: './dist/sveltekit_shim_app_state.js',
248
245
  },
249
246
  './sveltekit_shim_app.js': {
250
247
  types: './dist/sveltekit_shim_app.d.ts',
@@ -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.1',
269
+ version: '0.152.0',
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: [
@@ -954,10 +943,9 @@ export const src_json = {
954
943
  {name: 'resolveRoute', kind: 'function'},
955
944
  ],
956
945
  },
957
- './sveltekit_shim_app_stores.js': {
958
- path: 'sveltekit_shim_app_stores.ts',
946
+ './sveltekit_shim_app_state.js': {
947
+ path: 'sveltekit_shim_app_state.ts',
959
948
  declarations: [
960
- {name: 'getStores', kind: 'function'},
961
949
  {name: 'navigating', kind: 'variable'},
962
950
  {name: 'page', kind: 'variable'},
963
951
  {name: 'updated', kind: 'variable'},
@@ -12,7 +12,7 @@ export const sveltekit_shim_app_specifiers = new Map([
12
12
  ['$app/forms', '@ryanatkn/gro/sveltekit_shim_app_forms.js'],
13
13
  ['$app/navigation', '@ryanatkn/gro/sveltekit_shim_app_navigation.js'],
14
14
  ['$app/paths', '@ryanatkn/gro/sveltekit_shim_app_paths.js'],
15
- ['$app/stores', '@ryanatkn/gro/sveltekit_shim_app_stores.js'],
15
+ ['$app/state', '@ryanatkn/gro/sveltekit_shim_app_state.js'],
16
16
  ]);
17
17
 
18
18
  export const render_sveltekit_shim_app_paths = (
@@ -0,0 +1,35 @@
1
+ // shim for $app/state
2
+ // @see https://github.com/sveltejs/kit/issues/1485
3
+
4
+ import type {
5
+ navigating as base_navigating,
6
+ page as base_page,
7
+ updated as base_updated,
8
+ } from '$app/state';
9
+
10
+ export const navigating: typeof base_navigating = {
11
+ from: null,
12
+ to: null,
13
+ type: null,
14
+ willUnload: null,
15
+ delta: null,
16
+ complete: null,
17
+ };
18
+
19
+ export const page: typeof base_page = {
20
+ data: {},
21
+ form: null,
22
+ error: null,
23
+ params: {},
24
+ route: {id: null},
25
+ state: {},
26
+ status: -1,
27
+ url: new URL('https://github.com/ryanatkn/gro'),
28
+ };
29
+
30
+ export const updated: typeof base_updated = {
31
+ current: false,
32
+ check: () => {
33
+ throw new Error('Can only call updated.check() in the browser');
34
+ },
35
+ };
@@ -1,11 +1,13 @@
1
1
  import {spawn} from '@ryanatkn/belt/process.js';
2
2
  import {z} from 'zod';
3
+ import {rmSync} from 'node:fs';
3
4
 
4
5
  import {Task_Error, type Task} from './task.js';
5
6
  import {extract_deps, load_package_json, type Package_Json_Dep} from './package_json.js';
6
7
  import {Git_Origin, git_pull} from './git.js';
7
8
  import {spawn_cli} from './cli.js';
8
9
  import {serialize_args, to_forwarded_args} from './args.js';
10
+ import {NODE_MODULES_DIRNAME} from './constants.js';
9
11
 
10
12
  export const Args = z
11
13
  .object({
@@ -20,6 +22,18 @@ export const Args = z
20
22
  force: z.boolean({description: 'if true, print out the planned upgrades'}).default(false),
21
23
  pull: z.boolean({description: 'dual of no-pull'}).default(true),
22
24
  'no-pull': z.boolean({description: 'opt out of git pull'}).default(false),
25
+ delete_node_modules: z
26
+ .boolean({description: 'if true, deletes node_modules before upgrading'})
27
+ .default(false),
28
+ node_modules_path: z // TODO maybe configured globally instead
29
+ .string({description: 'path to modules directory to delete'})
30
+ .default(NODE_MODULES_DIRNAME),
31
+ delete_lockfile: z
32
+ .boolean({description: 'if true, deletes the lockfile before upgrading'})
33
+ .default(false),
34
+ lockfile_path: z
35
+ .string({description: 'path to the lockfile to delete'})
36
+ .default('package-lock.json'),
23
37
  dry: z.boolean({description: 'if true, print out the planned upgrades'}).default(false),
24
38
  })
25
39
  .strict();
@@ -29,7 +43,18 @@ export const task: Task<Args> = {
29
43
  summary: 'upgrade deps',
30
44
  Args,
31
45
  run: async ({args, log, config}): Promise<void> => {
32
- const {_, only, origin, force, pull, dry} = args;
46
+ const {
47
+ _,
48
+ only,
49
+ origin,
50
+ force,
51
+ pull,
52
+ delete_node_modules,
53
+ node_modules_path,
54
+ delete_lockfile,
55
+ lockfile_path,
56
+ dry,
57
+ } = args;
33
58
 
34
59
  if (_.length && only.length) {
35
60
  throw new Task_Error('Cannot call `gro upgrade` with both rest args and --only.');
@@ -40,6 +65,14 @@ export const task: Task<Args> = {
40
65
  await git_pull(origin);
41
66
  }
42
67
 
68
+ if (delete_node_modules) {
69
+ rmSync(node_modules_path, {recursive: true, force: true});
70
+ }
71
+
72
+ if (delete_lockfile) {
73
+ rmSync(lockfile_path, {force: true});
74
+ }
75
+
43
76
  const package_json = load_package_json();
44
77
 
45
78
  const all_deps = extract_deps(package_json);
@@ -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"}
@@ -1,70 +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/'), // TODO hacky, centralize this and maybe exclude other things like `.gen.` files
11
- flush_debounce_delay = FLUSH_DEBOUNCE_DELAY, banner = 'generated by gro_plugin_moss', } = EMPTY_OBJECT) => {
12
- const css_classes = new Css_Classes(Array.isArray(include_classes) ? new Set(include_classes) : include_classes);
13
- let previous_output;
14
- let flushing_timeout;
15
- const queue_gen = () => {
16
- if (flushing_timeout === undefined) {
17
- flushing_timeout = setTimeout(() => {
18
- flushing_timeout = undefined;
19
- void flush_gen_queue();
20
- }); // the timeout batches synchronously
21
- }
22
- };
23
- const flush_gen_queue = throttle(async () => {
24
- const css = generate_classes_css(css_classes.get(), css_classes_by_name);
25
- const contents = `/* ${banner} */\n\n${css}\n\n/* ${banner} */`;
26
- const output = await format_file(contents, { filepath: outfile });
27
- // TODO think about using gen to implement this, would have some nice benefits like automatic change detection
28
- if (output === previous_output)
29
- return;
30
- previous_output = output;
31
- writeFileSync(outfile, output);
32
- }, { delay: flush_debounce_delay, when: 'trailing' });
33
- let cleanup;
34
- return {
35
- name: 'gro_plugin_moss',
36
- setup: async ({ filer }) => {
37
- // When a file builds, check it and its tree of dependents
38
- // for any `.gen.` files that need to run.
39
- cleanup = await filer.watch((change, source_file) => {
40
- if (filter_file && !filter_file(source_file.id)) {
41
- return;
42
- }
43
- switch (change.type) {
44
- case 'add':
45
- case 'update': {
46
- if (source_file.contents !== null) {
47
- const classes = collect_css_classes(source_file.contents);
48
- css_classes.add(source_file.id, classes);
49
- queue_gen();
50
- }
51
- break;
52
- }
53
- case 'delete': {
54
- css_classes.delete(source_file.id);
55
- break;
56
- }
57
- default:
58
- throw new Unreachable_Error(change.type);
59
- }
60
- });
61
- queue_gen();
62
- },
63
- teardown: async () => {
64
- if (cleanup !== undefined) {
65
- await cleanup();
66
- cleanup = undefined;
67
- }
68
- },
69
- };
70
- };
@@ -1,6 +0,0 @@
1
- import type { getStores as base_getStores, navigating as base_navigating, page as base_page, updated as base_updated } from '$app/stores';
2
- export declare const getStores: typeof base_getStores;
3
- export declare const navigating: typeof base_navigating;
4
- export declare const page: typeof base_page;
5
- export declare const updated: typeof base_updated;
6
- //# sourceMappingURL=sveltekit_shim_app_stores.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sveltekit_shim_app_stores.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/sveltekit_shim_app_stores.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACX,SAAS,IAAI,cAAc,EAC3B,UAAU,IAAI,eAAe,EAC7B,IAAI,IAAI,SAAS,EACjB,OAAO,IAAI,YAAY,EACvB,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,SAAS,EAAE,OAAO,cAA6D,CAAC;AAC7F,eAAO,MAAM,UAAU,EAAE,OAAO,eAAgC,CAAC;AACjE,eAAO,MAAM,IAAI,EAAE,OAAO,SASxB,CAAC;AACH,eAAO,MAAM,OAAO,EAAE,OAAO,YAAoC,CAAC"}
@@ -1,17 +0,0 @@
1
- // shim for $app/stores
2
- // @see https://github.com/sveltejs/kit/issues/1485
3
- import { readable } from 'svelte/store';
4
- export const getStores = () => ({ navigating, page, updated });
5
- export const navigating = readable(null);
6
- export const page = readable({
7
- url: new URL('https://gro.ryanatkn.com/TODO'),
8
- params: {},
9
- route: { id: 'RouteId' },
10
- status: 200,
11
- error: null,
12
- data: {},
13
- state: {},
14
- form: {},
15
- });
16
- export const updated = readable(true);
17
- updated.check = () => Promise.resolve(true);
@@ -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/'), // TODO hacky, centralize this and maybe exclude other things like `.gen.` files
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
- };
@@ -1,28 +0,0 @@
1
- // shim for $app/stores
2
- // @see https://github.com/sveltejs/kit/issues/1485
3
-
4
- // TODO support `$app/state`
5
- /* eslint-disable @typescript-eslint/no-deprecated */
6
-
7
- import type {
8
- getStores as base_getStores,
9
- navigating as base_navigating,
10
- page as base_page,
11
- updated as base_updated,
12
- } from '$app/stores';
13
- import {readable} from 'svelte/store';
14
-
15
- export const getStores: typeof base_getStores = () => ({navigating, page, updated}) as const;
16
- export const navigating: typeof base_navigating = readable(null);
17
- export const page: typeof base_page = readable({
18
- url: new URL('https://gro.ryanatkn.com/TODO'),
19
- params: {},
20
- route: {id: 'RouteId'},
21
- status: 200,
22
- error: null,
23
- data: {},
24
- state: {},
25
- form: {},
26
- });
27
- export const updated: typeof base_updated = readable(true) as any;
28
- updated.check = () => Promise.resolve(true);