@embroider/macros
Version:
Standardized build-time macros for ember apps.
47 lines (46 loc) • 1.45 kB
TypeScript
import MacrosConfig from './macros-config';
export interface Options {
/**
* How you configure your own package / app
*/
setOwnConfig?: object;
/**
* This is how you can optionally send configuration into
* your dependencies, if those dependencies choose to use
* @embroider/macros configs.
*
* @example
* ```js
* setConfig: {
* 'some-dependency': {
* // config for some-dependency
* }
* }
* ```
*/
setConfig?: Record<string, object>;
/**
* Callback for further manipulation of the macros' configuration instance.
*
* Useful for libraries to provide their own config with defaults shared between sub-dependencies of those libraries.
*/
configure?: (macrosInstance: MacrosConfig) => void;
/**
* Override the default directory used for the MacrosConfig
*
* defaults to the CWD, via process.cwd()
*/
dir?: string;
}
interface ConfiguredMacros {
/**
* Array of plugins to add to the babel config plugins array
*/
babelMacros: ReturnType<MacrosConfig['babelPluginConfig']>;
/**
* Array of template transforms to pass to the transforms array of the babel-plugin-ember-template-compilation babel plugin
*/
templateMacros: ReturnType<(typeof MacrosConfig)['transforms']>['plugins'];
}
export declare function buildMacros(options?: Options): ConfiguredMacros;
export {};