@polyfill-io-aot/builder
Version:
This is the builder module for polyfill-io-aot.
59 lines (58 loc) • 2.31 kB
TypeScript
import { PolyfillConfigBase } from '@polyfill-io-aot/common';
import { Options as ZopfliOptions } from 'node-zopfli-es';
import { Omit } from './Omit';
import { PackageManager } from './PackageManager';
import { UAGeneratorFunction } from './UAGeneratorFunction';
/** Mock user agent generator functions */
export interface UserAgentGenerators {
android: UAGeneratorFunction;
blackberry: UAGeneratorFunction;
chrome: UAGeneratorFunction;
firefox: UAGeneratorFunction;
firefoxMobile: UAGeneratorFunction;
ie: UAGeneratorFunction;
ieMobile: UAGeneratorFunction;
iosSafari: UAGeneratorFunction;
opera: UAGeneratorFunction;
operaMobile: UAGeneratorFunction;
safari: UAGeneratorFunction;
samsung: UAGeneratorFunction;
}
/** Builder configuration */
export interface PolyfillBuilderConfig extends PolyfillConfigBase {
/**
* Additional directories containing your own polyfills in the polyfill-library format.
* @see https://github.com/Financial-Times/polyfill-library/tree/1b3b661253ba375ca357d8d097a1586351cf439f/polyfills
* @see https://polyfill.io/v2/docs/contributing/authoring-polyfills
* @default []
*/
dirs: string[];
/**
* The package manager to use when spawning processes.
* @default npm
*/
packageManager: PackageManager;
/**
* Number of processes to spawn for compression and polyfill bundle generation
* @default Math.max(1, NUM_CPU_CORES - 1)
*/
processes: number;
/**
* Spoof user agent generators. Every user agent generated by these will be used to generate
* a set of polyfills and every unique set of polyfills will be persisted for use in production.
*/
uaGenerators: UserAgentGenerators;
/**
* Options to pass to node-zopfi-es
* @default {blocksplitting: true, numiterations: 15}
*/
zopfli: ZopfliOptions;
}
/** Partial builder configuration */
export declare type PartialPolyfillBuilderConfig = Partial<Omit<PolyfillBuilderConfig, 'uaGenerators'>> & {
/**
* Spoof user agent generators. Every user agent generated by these will be used to generate
* a set of polyfills and every unique set of polyfills will be persisted for use in production.
*/
uaGenerators?: Partial<UserAgentGenerators>;
};