1 line
39 KiB
Plaintext
1 line
39 KiB
Plaintext
|
{"version":3,"file":"index.mjs","sources":["../src/built-in-definitions.ts","../src/add-platform-specific-polyfills.ts","../src/helpers.ts","../src/index.ts"],"sourcesContent":["import corejs2Polyfills from \"@babel/compat-data/corejs2-built-ins\";\n\ntype ObjectMap<V> = { [name: string]: V };\n\ntype PolyfillDescriptor<T> = {\n name: string;\n pure: string | null;\n global: string[];\n meta: T | null;\n};\n\ntype CoreJS2Meta = {\n minRuntimeVersion: string | null;\n};\n\nconst define = <T>(\n name: string,\n pure?: string | null,\n global: string[] = [],\n meta?: T | null,\n): PolyfillDescriptor<T> => {\n return { name, pure, global, meta };\n};\n\nconst pureAndGlobal = (\n pure: string,\n global: string[],\n minRuntimeVersion: string | null = null,\n) => define<CoreJS2Meta>(global[0], pure, global, { minRuntimeVersion });\n\nconst globalOnly = (global: string[]) =>\n define<CoreJS2Meta>(global[0], null, global);\n\nconst pureOnly = (pure: string, name: string) =>\n define<CoreJS2Meta>(name, pure, []);\n\nconst ArrayNatureIterators = [\n \"es6.object.to-string\",\n \"es6.array.iterator\",\n \"web.dom.iterable\",\n];\n\nexport const CommonIterators = [\"es6.string.iterator\", ...ArrayNatureIterators];\n\nconst PromiseDependencies = [\"es6.object.to-string\", \"es6.promise\"];\n\nexport const BuiltIns: ObjectMap<PolyfillDescriptor<CoreJS2Meta>> = {\n DataView: globalOnly([\"es6.typed.data-view\"]),\n Float32Array: globalOnly([\"es6.typed.float32-array\"]),\n Float64Array: globalOnly([\"es6.typed.float64-array\"]),\n Int8Array: globalOnly([\"es6.typed.int8-array\"]),\n Int16Array: globalOnly([\"es6.typed.int16-array\"]),\n Int32Array: globalOnly([\"es6.typed.int32-array\"]),\n Map: pureAndGlobal(\"map\", [\"es6.map\", ...CommonIterators]),\n Number: globalOnly([\"es6.number.constructor\"]),\n Promise: pureAndGlobal(\"promise\", PromiseDependencies),\n RegExp: globalOnly([\"es6.regexp.constructor\"]),\n Set: pureAndGlobal(\"set\", [\"es6.set\", ...CommonIterators]),\n Symbol: pureAndGlobal(\"symbol/index\", [\"es6.symbol\"]),\n Uint8Array: globalOnly([\"es6.typed.uint8-array\"]),\n Uint8ClampedArray: globalOnly([\"es6.typed.uint8-clamped-array\"]),\n Uint16Array: globalOnly([\"es6.typed.uint16-array\"]),\n Uint32Array: globalOnly([\"es6.typed.uint32-array\"]),\n WeakMap: pureAndGlobal(\"weak-map\", [\"es6.weak-map\", ...CommonIterators]),\n WeakSet: pureAndGlobal(\"weak-set\", [\"es6.weak-set\", ...CommonIterators]),\n\n setImmediate: pureOnly(\"set-immediate\", \"web.immediate\"),\n clearImmediate: pureOnly(\"clear-immediate\", \"web.immediate\"),\n parseFloat: pureOnly(\"parse-float\", \"es6.parse-float\"),\n parseInt: pureOnly(\"parse-int\", \"es6.parse-int\"),\n};\n\nexport const InstanceProperties: ObjectMap<PolyfillDescriptor<CoreJS2Meta>> = {\n __defineGetter__: globalOnly([\"es7.object.define-getter\"]),\n __defineSetter__: globalOnly([\"es7.object.define-setter\"]),\n __lookupGetter__: globalOnly([\"es7.object.lookup-getter\"]),\n __lookupSetter__: globalOnly([\"es7.object.lookup-setter\"]),\n anchor: globalOnly([\"es6.string.anchor\"]),\n big: globalOnly([\"es6.string.big\"]),\n bind: globalOnly([\"es6.function.bind\"]),\n blink: globalOnly([\"es6.string.blink\"]),\n bold: globalOnly([\"es6.string.bold\"]),\n codePointAt: globalOnly([\"es6.string.code-point-at\"]),\n copyWithin: globalOnly([\"es6.array.copy-within\"]),\n endsWith: globalOnly([\"es6.string.ends-with\"]),\n entries: globalOnly(ArrayNatureIterators),\n every: globalOnly([\"es6.array.every\"]),\n fill: globalOnly([\"es6.array.fill\"]),\n filter: globalOnly([\"es6.array.filter\"]),\n finally: globalOnly([\"es7.promise.finally\", ...PromiseDependencies]),\n find: globalOnly([\"es6.array.find\"]),\n findIndex: globalOnly([\"es6.array.find-index\"]),\n fixed: globalOnly([\"es6.string.fixed\"]),\n flags: globalOnly([\"es6.regexp.flags\"]),\n flatMap: globalOnly([\"es7.array.flat-map\"]),\n fontcolor: globalOnly([\"es6.string.fontcolor\"]),\n fontsize: globalOnly([\"es6.string.fontsize\"]),\n
|