UNPKG

1.7 kBTypeScriptView Raw
1import { Plugin } from '@design-systems/plugin';
2import { SyncBailHook } from 'tapable';
3import CleanCSS from 'clean-css';
4import postcss from 'postcss';
5import { SuccessState } from './babel';
6export interface BuildArgs {
7 /** Start the build in watch mode */
8 watch: boolean;
9 /** Directory with all the source files */
10 inputDirectory: string;
11 /** Directory to place all the build files */
12 outputDirectory: string;
13 /** The name of the concatenated css for the component */
14 cssMain: string;
15 /** What files to ignore during the build. */
16 ignore: string | string[];
17}
18export { getPostCssConfig, getPostCssConfigSync } from './postcss';
19export { getBabelConfig, getBabelOptions } from './babel';
20/**
21 * Build looks for js and css files in src/ and outputs a CJS, ESM, and CSS builds to /dist.
22 * By default the same folder structure is maintained.
23 *
24 * - css files are replaced with their js equivalent.
25 * - ESM builds use the .mjs extension, CJS uses .js.
26 */
27export default class BuildPlugin implements Plugin<BuildArgs> {
28 hooks: {
29 processCSSFiles: SyncBailHook<CleanCSS.Source[], any, any, any>;
30 };
31 private logger;
32 private cssFiles;
33 private buildArgs;
34 private typescriptCompiler;
35 generateCSS: () => Promise<void>;
36 getFileList: () => Promise<string[]>;
37 transformFile: (file: string) => Promise<void | SuccessState | Map<string, postcss.Result>>;
38 onAddOrChanged: (file: string) => Promise<void>;
39 onDelete: (file: string) => Promise<void>;
40 isIgnored: (filename: string) => string | undefined;
41 watch: () => Promise<void>;
42 run(args: BuildArgs): Promise<void>;
43}
44//# sourceMappingURL=index.d.ts.map
\No newline at end of file