import { TypescriptPluginOptions } from "@wessberg/rollup-plugin-ts"; import { OutputOptions, OutputBundle, ResolveIdResult, SourceDescription } from "rollup"; import { ParseOptions } from "esprima"; interface IBudgetResult { gzippedSize: number; max: number; sizePerc: number; aboveMax: boolean; name: string; formatted?: boolean; path: string; } type BudgetRender = (result: IBudgetResult) => string; interface IRollupPluginBudgetConfig { sizes: { [key: string]: number; }; render: BudgetRender; // The name of the output file where the budget for the files is printed to. fileName: string; // Whether or not the budget for the files should be printed to the console. silent: boolean; // The threshold of what files should be ignored. Every percentage below the threshold is ignored threshold: number; // We need a timeout to make sure all files have been bundled 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; }; 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; // We need a timeout to make sure all files have been bundled 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; }; type ScriptType = "module" | "text/javascript"; 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 { // HTML template (needs to contain a body tag) template: string; // The target destination for the generated file target: string; // Transforms the template transform: (info: ITransformOptions) => string; // Transform the script 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; }; type Transformer = (css: string) => string; type GetTransformer = (id: string, isGlobal: boolean) => Transformer; interface IRollupPluginImportStylesConfig { // Postcss plugins. plugins: any[]; // File types handled by this plugin. extensions: string[]; // Global files that are injected into the DOM. globals: string[]; // Configuration objects for sass and postcss postcssConfig: any; sassConfig: any; // Transform function for the styles 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; }; 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) => ResolveIdResult | void; }; 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; } // Information about the environment. 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?: import("rollup").AmdOptions | undefined; assetFileNames?: string | ((chunkInfo: import("rollup").PreRenderedAsset) => string) | undefined; banner?: string | (() => string | Promise) | undefined; chunkFileNames: string | ((chunkInfo: import("rollup").PreRenderedChunk) => string); compact?: boolean | undefined; dir?: string | undefined; dynamicImportFunction?: string | undefined; entryFileNames: string | ((chunkInfo: import("rollup").PreRenderedChunk) => 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?: import("rollup").GlobalsOption | undefined; hoistTransitiveImports?: boolean | undefined; indent?: string | boolean | undefined; inlineDynamicImports?: boolean | undefined; interop?: import("rollup").InteropType | import("rollup").GetInterop | undefined; intro?: string | (() => string | Promise) | undefined; manualChunks?: import("rollup").ManualChunksOption | undefined; minifyInternalExports?: boolean | undefined; name?: string | undefined; namespaceToStringTag?: boolean | undefined; noConflict?: boolean | undefined; outro?: string | (() => string | Promise) | undefined; paths?: import("rollup").OptionsPaths | undefined; plugins?: import("rollup").OutputPlugin[] | undefined; preferConst?: boolean | undefined; preserveModules?: boolean | undefined; preserveModulesRoot?: string | undefined; sanitizeFileName?: boolean | ((fileName: string) => string) | undefined; sourcemap: boolean | "hidden" | "inline"; sourcemapExcludeSources?: boolean | undefined; sourcemapFile?: string | undefined; sourcemapPathTransform?: import("rollup").SourcemapPathTransformOption | undefined; strict?: boolean | undefined; systemNullSetters?: boolean | undefined; validate?: 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) => ({ name: string; resolveId: (id: string, importer: string) => void | import("rollup").ResolveIdResult; } | import("rollup").Plugin)[]; /** * 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: { plugins: any[] | undefined; output: { format: string; name: string; sourcemap: string; }; }; mime: { "text/x-typescript": string[]; }; }; 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; }; type WorkboxConfig = any; 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 };