spack.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Options } from "@swc/types";
  2. export type BundleInput = BundleOptions | BundleOptions[];
  3. export declare const isLocalFile: RegExp;
  4. export declare function compileBundleOptions(config: BundleInput | string | undefined): Promise<BundleInput>;
  5. /**
  6. * Usage: In `spack.config.js` / `spack.config.ts`, you can utilize type annotations (to get autocompletions) like
  7. *
  8. * ```ts
  9. * import { config } from '@swc/core/spack';
  10. *
  11. * export default config({
  12. * name: 'web',
  13. * });
  14. * ```
  15. *
  16. *
  17. *
  18. */
  19. export declare function config(c: BundleInput): BundleInput;
  20. export interface BundleOptions extends SpackConfig {
  21. workingDir?: string;
  22. }
  23. /**
  24. * `spack.config,js`
  25. */
  26. export interface SpackConfig {
  27. /**
  28. * @default process.env.NODE_ENV
  29. */
  30. mode?: Mode;
  31. target?: Target;
  32. entry: EntryConfig;
  33. output: OutputConfig;
  34. module: ModuleConfig;
  35. options?: Options;
  36. /**
  37. * Modules to exclude from bundle.
  38. */
  39. externalModules?: string[];
  40. }
  41. export interface OutputConfig {
  42. name: string;
  43. path: string;
  44. }
  45. export interface ModuleConfig {
  46. }
  47. export type Mode = 'production' | 'development' | 'none';
  48. export type Target = 'browser' | 'node';
  49. export type EntryConfig = string | string[] | {
  50. [name: string]: string;
  51. };