@pentacore/vite-plugin-laravel-typefinder 2.0.0 → 3.0.1

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/index.d.cts CHANGED
@@ -1,23 +1,76 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
+ /**
4
+ * Options for the `typefinder` Vite plugin.
5
+ *
6
+ * All fields are optional — the defaults work for a standard Laravel project
7
+ * running PHP directly. Override `command` when using Sail, Herd, Docker, or
8
+ * any other PHP runtime wrapper. Extend `watch` when you use Typefinder's
9
+ * resource / page / broadcast features so the plugin regenerates on those
10
+ * file changes too.
11
+ */
3
12
  interface TypefinderOptions {
4
13
  /**
5
- * Glob patterns for PHP files to watch for changes.
6
- * @default ['app/Models/\*\*\/\*.php', 'app/Enums/\*\*\/\*.php', 'app/Http/Requests/\*\*\/\*.php']
14
+ * Glob patterns (relative to the Vite project root) whose changes should
15
+ * trigger a regeneration. Matched against each HMR update's file path.
16
+ *
17
+ * The default covers models, enums, and form requests — the always-on
18
+ * Typefinder categories. If you enable optional categories (Inertia pages,
19
+ * broadcasting) or use JSON resources, extend the list so updates on
20
+ * those directories also re-run the generator.
21
+ *
22
+ * @default ['app/Models/** /*.php', 'app/Enums/** /*.php', 'app/Http/Requests/** /*.php']
7
23
  */
8
24
  watch?: string[];
9
25
  /**
10
- * The artisan command to run for type generation.
11
- * Customize for Sail, Herd, Docker, etc.
26
+ * Shell command used to regenerate types. Customize for non-standard
27
+ * PHP runtimes:
28
+ *
29
+ * - Sail: `'./vendor/bin/sail artisan typefinder:generate'`
30
+ * - Herd: `'herd php artisan typefinder:generate'`
31
+ * - Docker: `'docker compose exec app php artisan typefinder:generate'`
32
+ *
12
33
  * @default 'php artisan typefinder:generate'
13
34
  */
14
35
  command?: string;
15
36
  /**
16
- * Debounce window for filesystem changes in milliseconds.
37
+ * Debounce window in milliseconds. When multiple files change within this
38
+ * window the plugin coalesces them into a single regeneration. Keep small
39
+ * for fast feedback; raise if your editor triggers noisy saves.
40
+ *
17
41
  * @default 100
18
42
  */
19
43
  debounceMs?: number;
20
44
  }
45
+ /**
46
+ * Vite plugin that runs `php artisan typefinder:generate` automatically —
47
+ * once at `buildStart`, and again on every HMR update whose file path
48
+ * matches any pattern in {@link TypefinderOptions.watch}.
49
+ *
50
+ * Install the Composer package `pentacore/laravel-typefinder` in your Laravel
51
+ * app, then register this plugin in `vite.config.ts`:
52
+ *
53
+ * ```ts
54
+ * import { defineConfig } from 'vite';
55
+ * import laravel from 'laravel-vite-plugin';
56
+ * import typefinder from '@pentacore/vite-plugin-laravel-typefinder';
57
+ *
58
+ * export default defineConfig({
59
+ * plugins: [
60
+ * laravel({ input: ['resources/js/app.ts'] }),
61
+ * typefinder(),
62
+ * ],
63
+ * });
64
+ * ```
65
+ *
66
+ * Regenerations are debounced and serialized — concurrent triggers coalesce
67
+ * into at most one in-flight run plus one queued run. The plugin uses Vite's
68
+ * `enforce: 'pre'` ordering so types are fresh before other plugins inspect
69
+ * them.
70
+ *
71
+ * @param options Plugin options. See {@link TypefinderOptions}.
72
+ * @returns A Vite plugin.
73
+ */
21
74
  declare const typefinder: ({ watch, command, debounceMs, }?: TypefinderOptions) => Plugin;
22
75
 
23
76
  // @ts-ignore
package/dist/index.d.mts CHANGED
@@ -1,23 +1,76 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
+ /**
4
+ * Options for the `typefinder` Vite plugin.
5
+ *
6
+ * All fields are optional — the defaults work for a standard Laravel project
7
+ * running PHP directly. Override `command` when using Sail, Herd, Docker, or
8
+ * any other PHP runtime wrapper. Extend `watch` when you use Typefinder's
9
+ * resource / page / broadcast features so the plugin regenerates on those
10
+ * file changes too.
11
+ */
3
12
  interface TypefinderOptions {
4
13
  /**
5
- * Glob patterns for PHP files to watch for changes.
6
- * @default ['app/Models/\*\*\/\*.php', 'app/Enums/\*\*\/\*.php', 'app/Http/Requests/\*\*\/\*.php']
14
+ * Glob patterns (relative to the Vite project root) whose changes should
15
+ * trigger a regeneration. Matched against each HMR update's file path.
16
+ *
17
+ * The default covers models, enums, and form requests — the always-on
18
+ * Typefinder categories. If you enable optional categories (Inertia pages,
19
+ * broadcasting) or use JSON resources, extend the list so updates on
20
+ * those directories also re-run the generator.
21
+ *
22
+ * @default ['app/Models/** /*.php', 'app/Enums/** /*.php', 'app/Http/Requests/** /*.php']
7
23
  */
8
24
  watch?: string[];
9
25
  /**
10
- * The artisan command to run for type generation.
11
- * Customize for Sail, Herd, Docker, etc.
26
+ * Shell command used to regenerate types. Customize for non-standard
27
+ * PHP runtimes:
28
+ *
29
+ * - Sail: `'./vendor/bin/sail artisan typefinder:generate'`
30
+ * - Herd: `'herd php artisan typefinder:generate'`
31
+ * - Docker: `'docker compose exec app php artisan typefinder:generate'`
32
+ *
12
33
  * @default 'php artisan typefinder:generate'
13
34
  */
14
35
  command?: string;
15
36
  /**
16
- * Debounce window for filesystem changes in milliseconds.
37
+ * Debounce window in milliseconds. When multiple files change within this
38
+ * window the plugin coalesces them into a single regeneration. Keep small
39
+ * for fast feedback; raise if your editor triggers noisy saves.
40
+ *
17
41
  * @default 100
18
42
  */
19
43
  debounceMs?: number;
20
44
  }
45
+ /**
46
+ * Vite plugin that runs `php artisan typefinder:generate` automatically —
47
+ * once at `buildStart`, and again on every HMR update whose file path
48
+ * matches any pattern in {@link TypefinderOptions.watch}.
49
+ *
50
+ * Install the Composer package `pentacore/laravel-typefinder` in your Laravel
51
+ * app, then register this plugin in `vite.config.ts`:
52
+ *
53
+ * ```ts
54
+ * import { defineConfig } from 'vite';
55
+ * import laravel from 'laravel-vite-plugin';
56
+ * import typefinder from '@pentacore/vite-plugin-laravel-typefinder';
57
+ *
58
+ * export default defineConfig({
59
+ * plugins: [
60
+ * laravel({ input: ['resources/js/app.ts'] }),
61
+ * typefinder(),
62
+ * ],
63
+ * });
64
+ * ```
65
+ *
66
+ * Regenerations are debounced and serialized — concurrent triggers coalesce
67
+ * into at most one in-flight run plus one queued run. The plugin uses Vite's
68
+ * `enforce: 'pre'` ordering so types are fresh before other plugins inspect
69
+ * them.
70
+ *
71
+ * @param options Plugin options. See {@link TypefinderOptions}.
72
+ * @returns A Vite plugin.
73
+ */
21
74
  declare const typefinder: ({ watch, command, debounceMs, }?: TypefinderOptions) => Plugin;
22
75
 
23
76
  export { typefinder as default, typefinder };
package/dist/index.d.ts CHANGED
@@ -1,23 +1,76 @@
1
1
  import { Plugin } from 'vite';
2
2
 
3
+ /**
4
+ * Options for the `typefinder` Vite plugin.
5
+ *
6
+ * All fields are optional — the defaults work for a standard Laravel project
7
+ * running PHP directly. Override `command` when using Sail, Herd, Docker, or
8
+ * any other PHP runtime wrapper. Extend `watch` when you use Typefinder's
9
+ * resource / page / broadcast features so the plugin regenerates on those
10
+ * file changes too.
11
+ */
3
12
  interface TypefinderOptions {
4
13
  /**
5
- * Glob patterns for PHP files to watch for changes.
6
- * @default ['app/Models/\*\*\/\*.php', 'app/Enums/\*\*\/\*.php', 'app/Http/Requests/\*\*\/\*.php']
14
+ * Glob patterns (relative to the Vite project root) whose changes should
15
+ * trigger a regeneration. Matched against each HMR update's file path.
16
+ *
17
+ * The default covers models, enums, and form requests — the always-on
18
+ * Typefinder categories. If you enable optional categories (Inertia pages,
19
+ * broadcasting) or use JSON resources, extend the list so updates on
20
+ * those directories also re-run the generator.
21
+ *
22
+ * @default ['app/Models/** /*.php', 'app/Enums/** /*.php', 'app/Http/Requests/** /*.php']
7
23
  */
8
24
  watch?: string[];
9
25
  /**
10
- * The artisan command to run for type generation.
11
- * Customize for Sail, Herd, Docker, etc.
26
+ * Shell command used to regenerate types. Customize for non-standard
27
+ * PHP runtimes:
28
+ *
29
+ * - Sail: `'./vendor/bin/sail artisan typefinder:generate'`
30
+ * - Herd: `'herd php artisan typefinder:generate'`
31
+ * - Docker: `'docker compose exec app php artisan typefinder:generate'`
32
+ *
12
33
  * @default 'php artisan typefinder:generate'
13
34
  */
14
35
  command?: string;
15
36
  /**
16
- * Debounce window for filesystem changes in milliseconds.
37
+ * Debounce window in milliseconds. When multiple files change within this
38
+ * window the plugin coalesces them into a single regeneration. Keep small
39
+ * for fast feedback; raise if your editor triggers noisy saves.
40
+ *
17
41
  * @default 100
18
42
  */
19
43
  debounceMs?: number;
20
44
  }
45
+ /**
46
+ * Vite plugin that runs `php artisan typefinder:generate` automatically —
47
+ * once at `buildStart`, and again on every HMR update whose file path
48
+ * matches any pattern in {@link TypefinderOptions.watch}.
49
+ *
50
+ * Install the Composer package `pentacore/laravel-typefinder` in your Laravel
51
+ * app, then register this plugin in `vite.config.ts`:
52
+ *
53
+ * ```ts
54
+ * import { defineConfig } from 'vite';
55
+ * import laravel from 'laravel-vite-plugin';
56
+ * import typefinder from '@pentacore/vite-plugin-laravel-typefinder';
57
+ *
58
+ * export default defineConfig({
59
+ * plugins: [
60
+ * laravel({ input: ['resources/js/app.ts'] }),
61
+ * typefinder(),
62
+ * ],
63
+ * });
64
+ * ```
65
+ *
66
+ * Regenerations are debounced and serialized — concurrent triggers coalesce
67
+ * into at most one in-flight run plus one queued run. The plugin uses Vite's
68
+ * `enforce: 'pre'` ordering so types are fresh before other plugins inspect
69
+ * them.
70
+ *
71
+ * @param options Plugin options. See {@link TypefinderOptions}.
72
+ * @returns A Vite plugin.
73
+ */
21
74
  declare const typefinder: ({ watch, command, debounceMs, }?: TypefinderOptions) => Plugin;
22
75
 
23
76
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pentacore/vite-plugin-laravel-typefinder",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Vite plugin for Laravel Typefinder — auto-generate TypeScript types from Models, Enums, Casts, and Requests.",
5
5
  "keywords": [
6
6
  "vite",