UNPKG

watr

Version:

Light & fast WAT compiler – WebAssembly Text to binary, parse, print, transform

35 lines 1.33 kB
/** * Apply polyfill transforms to AST. * * @param {Array|string} ast - Module AST or source string * @param {boolean|string|Object} [opts=true] - Polyfill options * - true: polyfill all detected features * - 'funcref struct': space-separated feature list * - { funcref: true, struct: false }: feature map * @returns {Array} Transformed AST * * @example * polyfill(ast) // auto-detect and polyfill all * polyfill(ast, 'funcref') // only funcref * polyfill(ast, { funcref: true }) // explicit */ export default function polyfill(ast: any[] | string, opts?: boolean | string | any): any[]; /** * Detect which polyfillable features an AST uses. * * @param {Array} ast * @returns {Set<string>} Set of feature names */ export function detect(ast: any[]): Set<string>; /** * Normalize polyfill options to a { feature: bool } map. `true` enables every * feature, a string enables only the named ones (or all via `'all'`), and an * explicit object is passed through untouched. * * @param {boolean|string|Object} opts * @returns {Object} Normalized options */ export function normalize(opts: boolean | string | any): any; /** Feature name → trigger-op list — the public catalogue of polyfillable features. */ export const FEATURES: any; //# sourceMappingURL=polyfill.d.ts.map