aboutsummaryrefslogtreecommitdiffstats
path: root/vanilla/node_modules/magicast/dist/helpers.d.ts
blob: ac181552f586aae072ef075aeeeac2fe058e4675 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import { S as ProxifiedObject, b as ProxifiedModule, c as Proxified, p as ProxifiedFunctionCall } from "./types-r4mG9WUV.js";
import { VariableDeclarator } from "@babel/types";

//#region src/helpers/deep-merge.d.ts
declare function deepMergeObject(magicast: Proxified<any>, object: any): void;
//#endregion
//#region src/helpers/nuxt.d.ts
declare function addNuxtModule(magicast: ProxifiedModule<any>, name: string, optionsKey?: string, options?: any): void;
//#endregion
//#region src/helpers/vite.d.ts
interface AddVitePluginOptions {
  /**
   * The import path of the plugin
   */
  from: string;
  /**
   * The import name of the plugin
   * @default "default"
   */
  imported?: string;
  /**
   * The name of local variable
   */
  constructor: string;
  /**
   * The options of the plugin
   */
  options?: Record<string, any>;
  /**
   * The index in the plugins array where the plugin should be inserted at.
   * By default, the plugin is appended to the array.
   */
  index?: number;
}
interface UpdateVitePluginConfigOptions {
  /**
   * The import path of the plugin
   */
  from: string;
  /**
   * The import name of the plugin
   * @default "default"
   */
  imported?: string;
}
declare function addVitePlugin(magicast: ProxifiedModule<any>, plugin: AddVitePluginOptions): boolean;
declare function findVitePluginCall(magicast: ProxifiedModule<any>, plugin: UpdateVitePluginConfigOptions | string): ProxifiedFunctionCall | undefined;
declare function updateVitePluginConfig(magicast: ProxifiedModule<any>, plugin: UpdateVitePluginConfigOptions | string, handler: Record<string, any> | ((args: any[]) => any[])): boolean;
//#endregion
//#region src/helpers/config.d.ts
declare function getDefaultExportOptions(magicast: ProxifiedModule<any>): ProxifiedObject<any>;
/**
 * Returns the vite config object from a variable declaration thats
 * exported as the default export.
 *
 * Example:
 *
 * ```js
 * const config = {};
 * export default config;
 * ```
 *
 * @param magicast the module
 *
 * @returns an object containing the proxified config object and the
 *          declaration "parent" to attach the modified config to later.
 *          If no config declaration is found, undefined is returned.
 */
declare function getConfigFromVariableDeclaration(magicast: ProxifiedModule<any>): {
  declaration: VariableDeclarator;
  config: ProxifiedObject<any> | undefined;
};
//#endregion
export { AddVitePluginOptions, UpdateVitePluginConfigOptions, addNuxtModule, addVitePlugin, deepMergeObject, findVitePluginCall, getConfigFromVariableDeclaration, getDefaultExportOptions, updateVitePluginConfig };