import { OutputBundle, OutputOptions, ResolveIdResult, TransformSourceDescription, PartialResolvedId } from "rollup"; import { ParseOptions } from "esprima"; import { TypescriptPluginOptions } from "@wessberg/rollup-plugin-ts"; interface IBudgetResult { gzippedSize: number; max: number; sizePerc: number; aboveMax: boolean; name: string; formatted?: boolean; path: string; } declare type BudgetRender = (result: IBudgetResult) => string; interface IRollupPluginBudgetConfig { sizes: { [key: string]: number; }; render: BudgetRender; fileName: string; silent: boolean; threshold: number; timeout: number; } /** * A Rollup plugin that compares the sizes of the files to a specified budget. * @param config * @returns {{name: string, generateBundle(*, *, *): (undefined|void)}} */ declare function budget(config?: Partial): { name: string; generateBundle: (outputOptions: OutputOptions, bundle: OutputBundle, isWrite: boolean) => Promise; }; interface IRollupPluginCleanConfig { targets: string[]; verbose: boolean; } /** * A Rollup plugin that clean directories before rebuilding. * @param config */ declare function clean(config?: Partial): { name: string; generateBundle: () => void; }; declare type Compressor = ({ src, verbose }: { src: string; verbose: boolean; }) => void; interface IRollupPluginCompressConfig { verbose: boolean; include: (string | RegExp)[] | string | RegExp | null; exclude: (string | RegExp)[] | string | RegExp | null; compressors: Compressor[]; dir?: string; timeout: number; } /** * Compresses a file using gzip. * @param src * @param verbose */ declare function compressGzip({ src, verbose }: { src: string; verbose: boolean; }): void; /** * Compresses a file using brotli. * @param src * @param verbose */ declare function compressBrotli({ src, verbose }: { src: string; verbose: boolean; }): void; /** * A Rollup plugin that compresses the files in the bundle after building. * @param config * @returns {{name: string, generateBundle: generateBundle}} */ declare function compress(config?: Partial): { name: string; generateBundle: (outputOptions: OutputOptions, bundle: OutputBundle, isWrite: boolean) => void; }; interface IRollupPluginCopyConfig { resources: [string, string][]; verbose: boolean; overwrite: boolean; } /** * A Rollup plugin that copies resources from one location to another. * @param config */ declare function copy(config?: Partial): { name: string; generateBundle: (outputOptions: OutputOptions, bundle: OutputBundle, isWrite: boolean) => Promise; }; declare type ScriptType = "module" | "text/javascript"; declare type TransformScript = ({ filename, scriptType }: ITransformScriptOptions) => string; interface ITransformScriptOptions { filename: string; scriptType: ScriptType; } interface ITransformOptions { template: string; bodyCloseTagIndex: number; fileNames: string[]; scriptType: ScriptType; polyfillConfig: IPolyfillConfig; transformScript: TransformScript; } interface IPolyfillConfig { src: string; crossorigin: boolean; force: boolean; context: "window" | "worker" | "node"; features: string[]; options: string[]; } interface IRollupPluginHtmlTemplateConfig { template: string; target: string; transform: (info: ITransformOptions) => string; transformScript: TransformScript; verbose: boolean; include: (string | RegExp)[] | string | RegExp | null; exclude: (string | RegExp)[] | string | RegExp | null; scriptType: ScriptType; polyfillConfig: Partial; } /** * Returns the script tag for the polyfill config. * @param crossorigin * @param features * @param src * @param options */ declare function getPolyfillScript({ crossorigin, features, src, options }: IPolyfillConfig): string; /** * Transform the script tag. * @param filename * @param scriptType */ declare function transformScript({ filename, scriptType }: ITransformScriptOptions): string; /** * Transform the template and inserts a script tag for each file. * Injects the script tags before the body close tag. * @param template * @param bodyCloseTagIndex * @param fileNames * @param scriptType * @param polyfillConfig * @param transformScript */ declare function transformTemplate({ template, bodyCloseTagIndex, fileNames, scriptType, polyfillConfig, transformScript }: ITransformOptions): string; /** * A Rollup plugin that injects the bundle entry points into a HTML file. * @param config */ declare function htmlTemplate(config?: Partial): { name: string; generateBundle: (outputOptions: OutputOptions, bundle: OutputBundle, isWrite: boolean) => Promise; }; declare type Transformer = (css: string) => string; declare type GetTransformer = (id: string, isGlobal: boolean) => Transformer; interface IRollupPluginImportStylesConfig { plugins: any[]; extensions: string[]; globals: string[]; postcssConfig: any; sassConfig: any; transform: GetTransformer; } /** * A Rollup plugin that makes it possible to import style files using postcss. * Looks for the "import css from 'styles.scss'" and "import 'styles.scss'" syntax as default. * @param config */ declare function importStyles(config?: Partial): { name: string; resolveId: (id: string, importer: string) => ResolveIdResult; transform: (data: string, id: string) => Promise; }; interface IRollupPLuginLivereloadConfig { watch: string; port: number; verbose: boolean; } /** * A Rollup plugin that live reload files as they changes. * @param config * @returns {*} */ declare function livereload(config?: Partial): { name: string; banner: () => string; generateBundle: () => void; }; declare type HtmlMinifierConfig = any; interface IRollupPluginMinifyLitHtml { include: (string | RegExp)[] | string | RegExp | null; exclude: (string | RegExp)[] | string | RegExp | null; verbose: boolean; esprima: ParseOptions; htmlMinifier: HtmlMinifierConfig; } /** * A Rollup plugin that minifies lit-html templates. * @param config * @returns {{name: string, resolveId: (function(*=, *=): *), transform: (function(*, *=): Promise)}} */ declare function minifyLitHTML(config?: Partial): { name: string; resolveId: (id: string, importer: string) => ResolveIdResult; transform: (code: string, id: string) => void | Promise; }; interface IRollupPluginReplaceConfig { verbose: boolean; resources: [string, string][]; } /** * A Rollup plugin that replaces an import with another import. * @param config */ declare function replace(config?: Partial): { name: string; resolveId: (id: string, importer: string) => string | false | void | PartialResolvedId | null | undefined; }; interface IDefaultResolvePlugins { importStylesConfig: Partial; replaceConfig: Partial; tsConfig: TypescriptPluginOptions; commonjsConfig: any; jsonConfig: any; resolveConfig: any; } interface IDefaultPlugins extends IDefaultResolvePlugins { copyConfig: Partial; htmlTemplateConfig: Partial; replaceConfig: Partial; cleanConfig: Partial; progressConfig: any; } interface IDefaultProdPlugins { minifyLitHtmlConfig: Partial; budgetConfig: Partial; compressConfig: Partial; dist: string; licenseConfig: any; terserConfig: any; visualizerConfig: any; } declare const isProd: boolean; declare const isDev: boolean; declare const isLibrary: boolean; declare const isServe: string | boolean; /** * The default scss plugins. */ declare const postcssPlugins: any[]; /** * Default configuration for the output. * @param config */ declare const defaultOutputConfig: (config: Partial) => { amd?: { define?: string | undefined; id?: string | undefined; } | undefined; assetFileNames?: string | undefined; banner?: string | (() => string | Promise) | undefined; chunkFileNames: string; compact?: boolean | undefined; dir?: string | undefined; dynamicImportFunction?: string | undefined; entryFileNames: string; esModule?: boolean | undefined; exports?: "default" | "named" | "none" | "auto" | undefined; extend?: boolean | undefined; externalLiveBindings?: boolean | undefined; file?: string | undefined; footer?: string | (() => string | Promise) | undefined; format: string; freeze?: boolean | undefined; globals?: { [name: string]: string; } | ((name: string) => string) | undefined; importMetaUrl?: ((chunkId: string, moduleId: string) => string) | undefined; indent?: boolean | undefined; interop?: boolean | undefined; intro?: string | (() => string | Promise) | undefined; name?: string | undefined; namespaceToStringTag?: boolean | undefined; noConflict?: boolean | undefined; outro?: string | (() => string | Promise) | undefined; paths?: Record | ((id: string) => string) | undefined; preferConst?: boolean | undefined; sourcemap: boolean | "inline" | "hidden"; sourcemapExcludeSources?: boolean | undefined; sourcemapFile?: string | undefined; sourcemapPathTransform?: ((sourcePath: string) => string) | undefined; strict?: boolean | undefined; }; /** * Default plugins for resolve. * @param importStylesConfig * @param replaceConfig * @param tsConfig * @param commonjsConfig * @param jsonConfig * @param resolveConfig */ declare const defaultResolvePlugins: ({ importStylesConfig, jsonConfig, resolveConfig, tsConfig, commonjsConfig, replaceConfig }?: Partial) => any[]; /** * Default configuration for the plugins that runs every time the bundle is created. * @param cleanConfig * @param copyConfig * @param importStylesConfig * @param jsonConfig * @param htmlTemplateConfig * @param resolveConfig * @param progressConfig * @param tsConfig * @param commonjsConfig * @param replaceConfig */ declare const defaultPlugins: ({ cleanConfig, copyConfig, importStylesConfig, jsonConfig, htmlTemplateConfig, resolveConfig, progressConfig, tsConfig, commonjsConfig, replaceConfig }?: Partial) => any[]; /** * Default plugins that only run when the bundle is being served. * @param dist * @param serveConfig * @param livereloadConfig */ declare const defaultServePlugins: ({ dist, serveConfig, livereloadConfig }?: any) => any[]; /** * Default plugins that only run when the bundle is being created in prod mode. * @param dist * @param minifyLitHtmlConfig * @param licenseConfig * @param terserConfig * @param budgetConfig * @param visualizerConfig * @param compressConfig */ declare const defaultProdPlugins: ({ dist, minifyLitHtmlConfig, licenseConfig, terserConfig, budgetConfig, visualizerConfig, compressConfig }?: Partial) => any[]; /** * Default external dependencies. * @param dependencies * @param devDependencies * @param peerDependencies */ declare const defaultExternals: ({ dependencies, devDependencies, peerDependencies }: { dependencies?: string[] | undefined; devDependencies?: string[] | undefined; peerDependencies?: string[] | undefined; }) => string[]; interface IDefaultKarmaConfig { files: { pattern: string; watched: boolean; }[]; mime: { [key: string]: string[]; }; preprocessors: { [key: string]: string[]; }; karmaPlugins: string[]; rollupPlugins: any[]; } /** * Creates a default karma configuration. * @param files * @param mime * @param preprocessors * @param karmaPlugins * @param rollupPlugins */ declare const defaultKarmaConfig: ({ files, mime, preprocessors, karmaPlugins, rollupPlugins }?: Partial) => { concurrency: number; colors: boolean; autoWatch: boolean; singleRun: boolean; captureTimeout: number; browsers: string[]; frameworks: string[]; reporters: string[]; plugins: string[]; files: { pattern: string; watched: boolean; }[]; preprocessors: { "**/*.test.+(ts|js)": string[]; }; rollupPreprocessor: { /** * This is just a normal Rollup config object, * except that `input` is handled for you. */ plugins: any[] | undefined; output: { format: string; name: string; sourcemap: string; }; }; mime: { "text/x-typescript": string[]; }; }; declare type WorkboxConfig = any; declare type GenerateServiceWorkerType = "generateSW" | "injectManifest"; declare enum GenerateServiceWorkerKind { generateSw = "generateSW", injectManifest = "injectManifest" } interface IRollupPluginWorkboxConfig { mode: GenerateServiceWorkerType; verbose: boolean; timeout: number; workboxConfig: WorkboxConfig; } /** * A Rollup plugin that uses workbox to generate a service worker. * @param config */ declare function workbox(config?: Partial): { name: string; generateBundle: (outputOptions: OutputOptions, bundle: OutputBundle, isWrite: boolean) => Promise; }; export { IDefaultResolvePlugins, IDefaultPlugins, IDefaultProdPlugins, isProd, isDev, isLibrary, isServe, postcssPlugins, defaultOutputConfig, defaultResolvePlugins, defaultPlugins, defaultServePlugins, defaultProdPlugins, defaultExternals, IDefaultKarmaConfig, defaultKarmaConfig, Transformer, GetTransformer, IRollupPluginImportStylesConfig, importStyles, HtmlMinifierConfig, IRollupPluginMinifyLitHtml, minifyLitHTML, ScriptType, TransformScript, ITransformScriptOptions, ITransformOptions, IPolyfillConfig, IRollupPluginHtmlTemplateConfig, getPolyfillScript, transformScript, transformTemplate, htmlTemplate, IRollupPLuginLivereloadConfig, livereload, IRollupPluginCopyConfig, copy, WorkboxConfig, GenerateServiceWorkerType, GenerateServiceWorkerKind, IRollupPluginWorkboxConfig, workbox, Compressor, IRollupPluginCompressConfig, compressGzip, compressBrotli, compress, IRollupPluginReplaceConfig, replace, IBudgetResult, BudgetRender, IRollupPluginBudgetConfig, budget, IRollupPluginCleanConfig, clean };