built-in-definitions.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.StaticProperties = exports.InstanceProperties = exports.CommonIterators = exports.BuiltIns = void 0;
  4. var _corejs2BuiltIns = _interopRequireDefault(require("@babel/compat-data/corejs2-built-ins"));
  5. function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
  6. const define = (name, pure, global = [], meta) => {
  7. return {
  8. name,
  9. pure,
  10. global,
  11. meta
  12. };
  13. };
  14. const pureAndGlobal = (pure, global, minRuntimeVersion = null) => define(global[0], pure, global, {
  15. minRuntimeVersion
  16. });
  17. const globalOnly = global => define(global[0], null, global);
  18. const pureOnly = (pure, name) => define(name, pure, []);
  19. const ArrayNatureIterators = ["es6.object.to-string", "es6.array.iterator", "web.dom.iterable"];
  20. const CommonIterators = exports.CommonIterators = ["es6.string.iterator", ...ArrayNatureIterators];
  21. const PromiseDependencies = ["es6.object.to-string", "es6.promise"];
  22. const BuiltIns = exports.BuiltIns = {
  23. DataView: globalOnly(["es6.typed.data-view"]),
  24. Float32Array: globalOnly(["es6.typed.float32-array"]),
  25. Float64Array: globalOnly(["es6.typed.float64-array"]),
  26. Int8Array: globalOnly(["es6.typed.int8-array"]),
  27. Int16Array: globalOnly(["es6.typed.int16-array"]),
  28. Int32Array: globalOnly(["es6.typed.int32-array"]),
  29. Map: pureAndGlobal("map", ["es6.map", ...CommonIterators]),
  30. Number: globalOnly(["es6.number.constructor"]),
  31. Promise: pureAndGlobal("promise", PromiseDependencies),
  32. RegExp: globalOnly(["es6.regexp.constructor"]),
  33. Set: pureAndGlobal("set", ["es6.set", ...CommonIterators]),
  34. Symbol: pureAndGlobal("symbol/index", ["es6.symbol"]),
  35. Uint8Array: globalOnly(["es6.typed.uint8-array"]),
  36. Uint8ClampedArray: globalOnly(["es6.typed.uint8-clamped-array"]),
  37. Uint16Array: globalOnly(["es6.typed.uint16-array"]),
  38. Uint32Array: globalOnly(["es6.typed.uint32-array"]),
  39. WeakMap: pureAndGlobal("weak-map", ["es6.weak-map", ...CommonIterators]),
  40. WeakSet: pureAndGlobal("weak-set", ["es6.weak-set", ...CommonIterators]),
  41. setImmediate: pureOnly("set-immediate", "web.immediate"),
  42. clearImmediate: pureOnly("clear-immediate", "web.immediate"),
  43. parseFloat: pureOnly("parse-float", "es6.parse-float"),
  44. parseInt: pureOnly("parse-int", "es6.parse-int")
  45. };
  46. const InstanceProperties = exports.InstanceProperties = {
  47. __defineGetter__: globalOnly(["es7.object.define-getter"]),
  48. __defineSetter__: globalOnly(["es7.object.define-setter"]),
  49. __lookupGetter__: globalOnly(["es7.object.lookup-getter"]),
  50. __lookupSetter__: globalOnly(["es7.object.lookup-setter"]),
  51. anchor: globalOnly(["es6.string.anchor"]),
  52. big: globalOnly(["es6.string.big"]),
  53. bind: globalOnly(["es6.function.bind"]),
  54. blink: globalOnly(["es6.string.blink"]),
  55. bold: globalOnly(["es6.string.bold"]),
  56. codePointAt: globalOnly(["es6.string.code-point-at"]),
  57. copyWithin: globalOnly(["es6.array.copy-within"]),
  58. endsWith: globalOnly(["es6.string.ends-with"]),
  59. entries: globalOnly(ArrayNatureIterators),
  60. every: globalOnly(["es6.array.every"]),
  61. fill: globalOnly(["es6.array.fill"]),
  62. filter: globalOnly(["es6.array.filter"]),
  63. finally: globalOnly(["es7.promise.finally", ...PromiseDependencies]),
  64. find: globalOnly(["es6.array.find"]),
  65. findIndex: globalOnly(["es6.array.find-index"]),
  66. fixed: globalOnly(["es6.string.fixed"]),
  67. flags: globalOnly(["es6.regexp.flags"]),
  68. flatMap: globalOnly(["es7.array.flat-map"]),
  69. fontcolor: globalOnly(["es6.string.fontcolor"]),
  70. fontsize: globalOnly(["es6.string.fontsize"]),
  71. forEach: globalOnly(["es6.array.for-each"]),
  72. includes: globalOnly(["es6.string.includes", "es7.array.includes"]),
  73. indexOf: globalOnly(["es6.array.index-of"]),
  74. italics: globalOnly(["es6.string.italics"]),
  75. keys: globalOnly(ArrayNatureIterators),
  76. lastIndexOf: globalOnly(["es6.array.last-index-of"]),
  77. link: globalOnly(["es6.string.link"]),
  78. map: globalOnly(["es6.array.map"]),
  79. match: globalOnly(["es6.regexp.match"]),
  80. name: globalOnly(["es6.function.name"]),
  81. padStart: globalOnly(["es7.string.pad-start"]),
  82. padEnd: globalOnly(["es7.string.pad-end"]),
  83. reduce: globalOnly(["es6.array.reduce"]),
  84. reduceRight: globalOnly(["es6.array.reduce-right"]),
  85. repeat: globalOnly(["es6.string.repeat"]),
  86. replace: globalOnly(["es6.regexp.replace"]),
  87. search: globalOnly(["es6.regexp.search"]),
  88. small: globalOnly(["es6.string.small"]),
  89. some: globalOnly(["es6.array.some"]),
  90. sort: globalOnly(["es6.array.sort"]),
  91. split: globalOnly(["es6.regexp.split"]),
  92. startsWith: globalOnly(["es6.string.starts-with"]),
  93. strike: globalOnly(["es6.string.strike"]),
  94. sub: globalOnly(["es6.string.sub"]),
  95. sup: globalOnly(["es6.string.sup"]),
  96. toISOString: globalOnly(["es6.date.to-iso-string"]),
  97. toJSON: globalOnly(["es6.date.to-json"]),
  98. toString: globalOnly(["es6.object.to-string", "es6.date.to-string", "es6.regexp.to-string"]),
  99. trim: globalOnly(["es6.string.trim"]),
  100. trimEnd: globalOnly(["es7.string.trim-right"]),
  101. trimLeft: globalOnly(["es7.string.trim-left"]),
  102. trimRight: globalOnly(["es7.string.trim-right"]),
  103. trimStart: globalOnly(["es7.string.trim-left"]),
  104. values: globalOnly(ArrayNatureIterators)
  105. };
  106. // This isn't present in older @babel/compat-data versions
  107. if ("es6.array.slice" in _corejs2BuiltIns.default) {
  108. InstanceProperties.slice = globalOnly(["es6.array.slice"]);
  109. }
  110. const StaticProperties = exports.StaticProperties = {
  111. Array: {
  112. from: pureAndGlobal("array/from", ["es6.symbol", "es6.array.from", ...CommonIterators]),
  113. isArray: pureAndGlobal("array/is-array", ["es6.array.is-array"]),
  114. of: pureAndGlobal("array/of", ["es6.array.of"])
  115. },
  116. Date: {
  117. now: pureAndGlobal("date/now", ["es6.date.now"])
  118. },
  119. JSON: {
  120. stringify: pureOnly("json/stringify", "es6.symbol")
  121. },
  122. Math: {
  123. // 'Math' was not included in the 7.0.0
  124. // release of '@babel/runtime'. See issue https://github.com/babel/babel/pull/8616.
  125. acosh: pureAndGlobal("math/acosh", ["es6.math.acosh"], "7.0.1"),
  126. asinh: pureAndGlobal("math/asinh", ["es6.math.asinh"], "7.0.1"),
  127. atanh: pureAndGlobal("math/atanh", ["es6.math.atanh"], "7.0.1"),
  128. cbrt: pureAndGlobal("math/cbrt", ["es6.math.cbrt"], "7.0.1"),
  129. clz32: pureAndGlobal("math/clz32", ["es6.math.clz32"], "7.0.1"),
  130. cosh: pureAndGlobal("math/cosh", ["es6.math.cosh"], "7.0.1"),
  131. expm1: pureAndGlobal("math/expm1", ["es6.math.expm1"], "7.0.1"),
  132. fround: pureAndGlobal("math/fround", ["es6.math.fround"], "7.0.1"),
  133. hypot: pureAndGlobal("math/hypot", ["es6.math.hypot"], "7.0.1"),
  134. imul: pureAndGlobal("math/imul", ["es6.math.imul"], "7.0.1"),
  135. log1p: pureAndGlobal("math/log1p", ["es6.math.log1p"], "7.0.1"),
  136. log10: pureAndGlobal("math/log10", ["es6.math.log10"], "7.0.1"),
  137. log2: pureAndGlobal("math/log2", ["es6.math.log2"], "7.0.1"),
  138. sign: pureAndGlobal("math/sign", ["es6.math.sign"], "7.0.1"),
  139. sinh: pureAndGlobal("math/sinh", ["es6.math.sinh"], "7.0.1"),
  140. tanh: pureAndGlobal("math/tanh", ["es6.math.tanh"], "7.0.1"),
  141. trunc: pureAndGlobal("math/trunc", ["es6.math.trunc"], "7.0.1")
  142. },
  143. Number: {
  144. EPSILON: pureAndGlobal("number/epsilon", ["es6.number.epsilon"]),
  145. MIN_SAFE_INTEGER: pureAndGlobal("number/min-safe-integer", ["es6.number.min-safe-integer"]),
  146. MAX_SAFE_INTEGER: pureAndGlobal("number/max-safe-integer", ["es6.number.max-safe-integer"]),
  147. isFinite: pureAndGlobal("number/is-finite", ["es6.number.is-finite"]),
  148. isInteger: pureAndGlobal("number/is-integer", ["es6.number.is-integer"]),
  149. isSafeInteger: pureAndGlobal("number/is-safe-integer", ["es6.number.is-safe-integer"]),
  150. isNaN: pureAndGlobal("number/is-nan", ["es6.number.is-nan"]),
  151. parseFloat: pureAndGlobal("number/parse-float", ["es6.number.parse-float"]),
  152. parseInt: pureAndGlobal("number/parse-int", ["es6.number.parse-int"])
  153. },
  154. Object: {
  155. assign: pureAndGlobal("object/assign", ["es6.object.assign"]),
  156. create: pureAndGlobal("object/create", ["es6.object.create"]),
  157. defineProperties: pureAndGlobal("object/define-properties", ["es6.object.define-properties"]),
  158. defineProperty: pureAndGlobal("object/define-property", ["es6.object.define-property"]),
  159. entries: pureAndGlobal("object/entries", ["es7.object.entries"]),
  160. freeze: pureAndGlobal("object/freeze", ["es6.object.freeze"]),
  161. getOwnPropertyDescriptor: pureAndGlobal("object/get-own-property-descriptor", ["es6.object.get-own-property-descriptor"]),
  162. getOwnPropertyDescriptors: pureAndGlobal("object/get-own-property-descriptors", ["es7.object.get-own-property-descriptors"]),
  163. getOwnPropertyNames: pureAndGlobal("object/get-own-property-names", ["es6.object.get-own-property-names"]),
  164. getOwnPropertySymbols: pureAndGlobal("object/get-own-property-symbols", ["es6.symbol"]),
  165. getPrototypeOf: pureAndGlobal("object/get-prototype-of", ["es6.object.get-prototype-of"]),
  166. is: pureAndGlobal("object/is", ["es6.object.is"]),
  167. isExtensible: pureAndGlobal("object/is-extensible", ["es6.object.is-extensible"]),
  168. isFrozen: pureAndGlobal("object/is-frozen", ["es6.object.is-frozen"]),
  169. isSealed: pureAndGlobal("object/is-sealed", ["es6.object.is-sealed"]),
  170. keys: pureAndGlobal("object/keys", ["es6.object.keys"]),
  171. preventExtensions: pureAndGlobal("object/prevent-extensions", ["es6.object.prevent-extensions"]),
  172. seal: pureAndGlobal("object/seal", ["es6.object.seal"]),
  173. setPrototypeOf: pureAndGlobal("object/set-prototype-of", ["es6.object.set-prototype-of"]),
  174. values: pureAndGlobal("object/values", ["es7.object.values"])
  175. },
  176. Promise: {
  177. all: globalOnly(CommonIterators),
  178. race: globalOnly(CommonIterators)
  179. },
  180. Reflect: {
  181. apply: pureAndGlobal("reflect/apply", ["es6.reflect.apply"]),
  182. construct: pureAndGlobal("reflect/construct", ["es6.reflect.construct"]),
  183. defineProperty: pureAndGlobal("reflect/define-property", ["es6.reflect.define-property"]),
  184. deleteProperty: pureAndGlobal("reflect/delete-property", ["es6.reflect.delete-property"]),
  185. get: pureAndGlobal("reflect/get", ["es6.reflect.get"]),
  186. getOwnPropertyDescriptor: pureAndGlobal("reflect/get-own-property-descriptor", ["es6.reflect.get-own-property-descriptor"]),
  187. getPrototypeOf: pureAndGlobal("reflect/get-prototype-of", ["es6.reflect.get-prototype-of"]),
  188. has: pureAndGlobal("reflect/has", ["es6.reflect.has"]),
  189. isExtensible: pureAndGlobal("reflect/is-extensible", ["es6.reflect.is-extensible"]),
  190. ownKeys: pureAndGlobal("reflect/own-keys", ["es6.reflect.own-keys"]),
  191. preventExtensions: pureAndGlobal("reflect/prevent-extensions", ["es6.reflect.prevent-extensions"]),
  192. set: pureAndGlobal("reflect/set", ["es6.reflect.set"]),
  193. setPrototypeOf: pureAndGlobal("reflect/set-prototype-of", ["es6.reflect.set-prototype-of"])
  194. },
  195. String: {
  196. at: pureOnly("string/at", "es7.string.at"),
  197. fromCodePoint: pureAndGlobal("string/from-code-point", ["es6.string.from-code-point"]),
  198. raw: pureAndGlobal("string/raw", ["es6.string.raw"])
  199. },
  200. Symbol: {
  201. // FIXME: Pure disabled to work around zloirock/core-js#262.
  202. asyncIterator: globalOnly(["es6.symbol", "es7.symbol.async-iterator"]),
  203. for: pureOnly("symbol/for", "es6.symbol"),
  204. hasInstance: pureOnly("symbol/has-instance", "es6.symbol"),
  205. isConcatSpreadable: pureOnly("symbol/is-concat-spreadable", "es6.symbol"),
  206. iterator: define("es6.symbol", "symbol/iterator", CommonIterators),
  207. keyFor: pureOnly("symbol/key-for", "es6.symbol"),
  208. match: pureAndGlobal("symbol/match", ["es6.regexp.match"]),
  209. replace: pureOnly("symbol/replace", "es6.symbol"),
  210. search: pureOnly("symbol/search", "es6.symbol"),
  211. species: pureOnly("symbol/species", "es6.symbol"),
  212. split: pureOnly("symbol/split", "es6.symbol"),
  213. toPrimitive: pureOnly("symbol/to-primitive", "es6.symbol"),
  214. toStringTag: pureOnly("symbol/to-string-tag", "es6.symbol"),
  215. unscopables: pureOnly("symbol/unscopables", "es6.symbol")
  216. }
  217. };