index.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { Plugin, UserConfig, ConfigEnv } from 'vite';
  2. import { Config as FullReloadConfig } from 'vite-plugin-full-reload';
  3. interface PluginConfig {
  4. /**
  5. * The path or paths of the entry points to compile.
  6. */
  7. input: string | string[];
  8. /**
  9. * Laravel's public directory.
  10. *
  11. * @default 'public'
  12. */
  13. publicDirectory?: string;
  14. /**
  15. * The public subdirectory where compiled assets should be written.
  16. *
  17. * @default 'build'
  18. */
  19. buildDirectory?: string;
  20. /**
  21. * The path to the "hot" file.
  22. *
  23. * @default `${publicDirectory}/hot`
  24. */
  25. hotFile?: string;
  26. /**
  27. * The path of the SSR entry point.
  28. */
  29. ssr?: string | string[];
  30. /**
  31. * The directory where the SSR bundle should be written.
  32. *
  33. * @default 'bootstrap/ssr'
  34. */
  35. ssrOutputDirectory?: string;
  36. /**
  37. * Configuration for performing full page refresh on blade (or other) file changes.
  38. *
  39. * {@link https://github.com/ElMassimo/vite-plugin-full-reload}
  40. * @default false
  41. */
  42. refresh?: boolean | string | string[] | RefreshConfig | RefreshConfig[];
  43. /**
  44. * Utilise the valet TLS certificates.
  45. *
  46. * @default false
  47. */
  48. valetTls?: string | boolean;
  49. /**
  50. * Transform the code while serving.
  51. */
  52. transformOnServe?: (code: string, url: DevServerUrl) => string;
  53. }
  54. interface RefreshConfig {
  55. paths: string[];
  56. config?: FullReloadConfig;
  57. }
  58. interface LaravelPlugin extends Plugin {
  59. config: (config: UserConfig, env: ConfigEnv) => UserConfig;
  60. }
  61. type DevServerUrl = `${'http' | 'https'}://${string}:${number}`;
  62. export declare const refreshPaths: string[];
  63. /**
  64. * Laravel plugin for Vite.
  65. *
  66. * @param config - A config object or relative path(s) of the scripts to be compiled.
  67. */
  68. export default function laravel(config: string | string[] | PluginConfig): [LaravelPlugin, ...Plugin[]];
  69. export {};