built-in-definitions.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.CommonInstanceDependencies = exports.InstanceProperties = exports.StaticProperties = exports.BuiltIns = exports.PromiseDependenciesWithIterators = exports.PromiseDependencies = exports.CommonIterators = void 0;
  4. var _data = _interopRequireDefault(require("../core-js-compat/data.js"));
  5. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6. const polyfillsOrder = {};
  7. Object.keys(_data.default).forEach((name, index) => {
  8. polyfillsOrder[name] = index;
  9. });
  10. const define = (pure, global, name = global[0], exclude) => {
  11. return {
  12. name,
  13. pure,
  14. global: global.sort((a, b) => polyfillsOrder[a] - polyfillsOrder[b]),
  15. exclude
  16. };
  17. };
  18. const typed = name => define(null, [name, ...TypedArrayDependencies]);
  19. const ArrayNatureIterators = ["es.array.iterator", "web.dom-collections.iterator"];
  20. const CommonIterators = ["es.string.iterator", ...ArrayNatureIterators];
  21. exports.CommonIterators = CommonIterators;
  22. const ArrayNatureIteratorsWithTag = ["es.object.to-string", ...ArrayNatureIterators];
  23. const CommonIteratorsWithTag = ["es.object.to-string", ...CommonIterators];
  24. const TypedArrayDependencies = ["es.typed-array.copy-within", "es.typed-array.every", "es.typed-array.fill", "es.typed-array.filter", "es.typed-array.find", "es.typed-array.find-index", "es.typed-array.for-each", "es.typed-array.includes", "es.typed-array.index-of", "es.typed-array.iterator", "es.typed-array.join", "es.typed-array.last-index-of", "es.typed-array.map", "es.typed-array.reduce", "es.typed-array.reduce-right", "es.typed-array.reverse", "es.typed-array.set", "es.typed-array.slice", "es.typed-array.some", "es.typed-array.sort", "es.typed-array.subarray", "es.typed-array.to-locale-string", "es.typed-array.to-string", "es.object.to-string", "es.array.iterator", "es.array-buffer.slice"];
  25. const TypedArrayStaticMethods = {
  26. from: define(null, ["es.typed-array.from"]),
  27. of: define(null, ["es.typed-array.of"])
  28. };
  29. const PromiseDependencies = ["es.promise", "es.object.to-string"];
  30. exports.PromiseDependencies = PromiseDependencies;
  31. const PromiseDependenciesWithIterators = [...PromiseDependencies, ...CommonIterators];
  32. exports.PromiseDependenciesWithIterators = PromiseDependenciesWithIterators;
  33. const SymbolDependencies = ["es.symbol", "es.symbol.description", "es.object.to-string"];
  34. const MapDependencies = ["es.map", "esnext.map.delete-all", "esnext.map.every", "esnext.map.filter", "esnext.map.find", "esnext.map.find-key", "esnext.map.includes", "esnext.map.key-of", "esnext.map.map-keys", "esnext.map.map-values", "esnext.map.merge", "esnext.map.reduce", "esnext.map.some", "esnext.map.update", ...CommonIteratorsWithTag];
  35. const SetDependencies = ["es.set", "esnext.set.add-all", "esnext.set.delete-all", "esnext.set.difference", "esnext.set.every", "esnext.set.filter", "esnext.set.find", "esnext.set.intersection", "esnext.set.is-disjoint-from", "esnext.set.is-subset-of", "esnext.set.is-superset-of", "esnext.set.join", "esnext.set.map", "esnext.set.reduce", "esnext.set.some", "esnext.set.symmetric-difference", "esnext.set.union", ...CommonIteratorsWithTag];
  36. const WeakMapDependencies = ["es.weak-map", "esnext.weak-map.delete-all", ...CommonIteratorsWithTag];
  37. const WeakSetDependencies = ["es.weak-set", "esnext.weak-set.add-all", "esnext.weak-set.delete-all", ...CommonIteratorsWithTag];
  38. const URLSearchParamsDependencies = ["web.url", ...CommonIteratorsWithTag];
  39. const BuiltIns = {
  40. AggregateError: define("aggregate-error", ["esnext.aggregate-error", ...CommonIterators]),
  41. ArrayBuffer: define(null, ["es.array-buffer.constructor", "es.array-buffer.slice", "es.object.to-string"]),
  42. DataView: define(null, ["es.data-view", "es.array-buffer.slice", "es.object.to-string"]),
  43. Date: define(null, ["es.date.to-string"]),
  44. Float32Array: typed("es.typed-array.float32-array"),
  45. Float64Array: typed("es.typed-array.float64-array"),
  46. Int8Array: typed("es.typed-array.int8-array"),
  47. Int16Array: typed("es.typed-array.int16-array"),
  48. Int32Array: typed("es.typed-array.int32-array"),
  49. Uint8Array: typed("es.typed-array.uint8-array"),
  50. Uint8ClampedArray: typed("es.typed-array.uint8-clamped-array"),
  51. Uint16Array: typed("es.typed-array.uint16-array"),
  52. Uint32Array: typed("es.typed-array.uint32-array"),
  53. Map: define("map/index", MapDependencies),
  54. Number: define(null, ["es.number.constructor"]),
  55. Observable: define("observable/index", ["esnext.observable", "esnext.symbol.observable", "es.object.to-string", ...CommonIteratorsWithTag]),
  56. Promise: define("promise/index", PromiseDependencies),
  57. RegExp: define(null, ["es.regexp.constructor", "es.regexp.exec", "es.regexp.to-string"]),
  58. Set: define("set/index", SetDependencies),
  59. Symbol: define("symbol/index", SymbolDependencies),
  60. URL: define("url/index", ["web.url", ...URLSearchParamsDependencies]),
  61. URLSearchParams: define("url-search-params/index", URLSearchParamsDependencies),
  62. WeakMap: define("weak-map/index", WeakMapDependencies),
  63. WeakSet: define("weak-set/index", WeakSetDependencies),
  64. clearImmediate: define("clear-immediate", ["web.immediate"]),
  65. compositeKey: define("composite-key", ["esnext.composite-key"]),
  66. compositeSymbol: define("composite-symbol", ["esnext.composite-symbol"]),
  67. fetch: define(null, PromiseDependencies),
  68. globalThis: define("global-this", ["es.global-this"]),
  69. parseFloat: define("parse-float", ["es.parse-float"]),
  70. parseInt: define("parse-int", ["es.parse-int"]),
  71. queueMicrotask: define("queue-microtask", ["web.queue-microtask"]),
  72. setImmediate: define("set-immediate", ["web.immediate"]),
  73. setInterval: define("set-interval", ["web.timers"]),
  74. setTimeout: define("set-timeout", ["web.timers"])
  75. };
  76. exports.BuiltIns = BuiltIns;
  77. const StaticProperties = {
  78. Array: {
  79. from: define("array/from", ["es.array.from", "es.string.iterator"]),
  80. isArray: define("array/is-array", ["es.array.is-array"]),
  81. of: define("array/of", ["es.array.of"])
  82. },
  83. ArrayBuffer: {
  84. isView: define(null, ["es.array-buffer.is-view"])
  85. },
  86. Date: {
  87. now: define("date/now", ["es.date.now"])
  88. },
  89. JSON: {
  90. stringify: define("json/stringify", [], "es.symbol")
  91. },
  92. Math: {
  93. DEG_PER_RAD: define("math/deg-per-rad", ["esnext.math.deg-per-rad"]),
  94. RAD_PER_DEG: define("math/rad-per-deg", ["esnext.math.rad-per-deg"]),
  95. acosh: define("math/acosh", ["es.math.acosh"]),
  96. asinh: define("math/asinh", ["es.math.asinh"]),
  97. atanh: define("math/atanh", ["es.math.atanh"]),
  98. cbrt: define("math/cbrt", ["es.math.cbrt"]),
  99. clamp: define("math/clamp", ["esnext.math.clamp"]),
  100. clz32: define("math/clz32", ["es.math.clz32"]),
  101. cosh: define("math/cosh", ["es.math.cosh"]),
  102. degrees: define("math/degrees", ["esnext.math.degrees"]),
  103. expm1: define("math/expm1", ["es.math.expm1"]),
  104. fround: define("math/fround", ["es.math.fround"]),
  105. fscale: define("math/fscale", ["esnext.math.fscale"]),
  106. hypot: define("math/hypot", ["es.math.hypot"]),
  107. iaddh: define("math/iaddh", ["esnext.math.iaddh"]),
  108. imul: define("math/imul", ["es.math.imul"]),
  109. imulh: define("math/imulh", ["esnext.math.imulh"]),
  110. isubh: define("math/isubh", ["esnext.math.isubh"]),
  111. log10: define("math/log10", ["es.math.log10"]),
  112. log1p: define("math/log1p", ["es.math.log1p"]),
  113. log2: define("math/log2", ["es.math.log2"]),
  114. radians: define("math/radians", ["esnext.math.radians"]),
  115. scale: define("math/scale", ["esnext.math.scale"]),
  116. seededPRNG: define("math/seeded-prng", ["esnext.math.seeded-prng"]),
  117. sign: define("math/sign", ["es.math.sign"]),
  118. signbit: define("math/signbit", ["esnext.math.signbit"]),
  119. sinh: define("math/sinh", ["es.math.sinh"]),
  120. tanh: define("math/tanh", ["es.math.tanh"]),
  121. trunc: define("math/trunc", ["es.math.trunc"]),
  122. umulh: define("math/umulh", ["esnext.math.umulh"])
  123. },
  124. Map: {
  125. from: define(null, ["esnext.map.from", ...MapDependencies]),
  126. groupBy: define(null, ["esnext.map.group-by", ...MapDependencies]),
  127. keyBy: define(null, ["esnext.map.key-by", ...MapDependencies]),
  128. of: define(null, ["esnext.map.of", ...MapDependencies])
  129. },
  130. Number: {
  131. EPSILON: define("number/epsilon", ["es.number.epsilon"]),
  132. MAX_SAFE_INTEGER: define("number/max-safe-integer", ["es.number.max-safe-integer"]),
  133. MIN_SAFE_INTEGER: define("number/min-safe-integer", ["es.number.min-safe-integer"]),
  134. fromString: define("number/from-string", ["esnext.number.from-string"]),
  135. isFinite: define("number/is-finite", ["es.number.is-finite"]),
  136. isInteger: define("number/is-integer", ["es.number.is-integer"]),
  137. isNaN: define("number/is-nan", ["es.number.is-nan"]),
  138. isSafeInteger: define("number/is-safe-integer", ["es.number.is-safe-integer"]),
  139. parseFloat: define("number/parse-float", ["es.number.parse-float"]),
  140. parseInt: define("number/parse-int", ["es.number.parse-int"])
  141. },
  142. Object: {
  143. assign: define("object/assign", ["es.object.assign"]),
  144. create: define("object/create", ["es.object.create"]),
  145. defineProperties: define("object/define-properties", ["es.object.define-properties"]),
  146. defineProperty: define("object/define-property", ["es.object.define-property"]),
  147. entries: define("object/entries", ["es.object.entries"]),
  148. freeze: define("object/freeze", ["es.object.freeze"]),
  149. fromEntries: define("object/from-entries", ["es.object.from-entries", "es.array.iterator"]),
  150. getOwnPropertyDescriptor: define("object/get-own-property-descriptor", ["es.object.get-own-property-descriptor"]),
  151. getOwnPropertyDescriptors: define("object/get-own-property-descriptors", ["es.object.get-own-property-descriptors"]),
  152. getOwnPropertyNames: define("object/get-own-property-names", ["es.object.get-own-property-names"]),
  153. getOwnPropertySymbols: define("object/get-own-property-symbols", ["es.symbol"]),
  154. getPrototypeOf: define("object/get-prototype-of", ["es.object.get-prototype-of"]),
  155. is: define("object/is", ["es.object.is"]),
  156. isExtensible: define("object/is-extensible", ["es.object.is-extensible"]),
  157. isFrozen: define("object/is-frozen", ["es.object.is-frozen"]),
  158. isSealed: define("object/is-sealed", ["es.object.is-sealed"]),
  159. keys: define("object/keys", ["es.object.keys"]),
  160. preventExtensions: define("object/prevent-extensions", ["es.object.prevent-extensions"]),
  161. seal: define("object/seal", ["es.object.seal"]),
  162. setPrototypeOf: define("object/set-prototype-of", ["es.object.set-prototype-of"]),
  163. values: define("object/values", ["es.object.values"])
  164. },
  165. Promise: {
  166. all: define(null, PromiseDependenciesWithIterators),
  167. allSettled: define(null, ["es.promise.all-settled", ...PromiseDependenciesWithIterators]),
  168. any: define(null, ["esnext.promise.any", ...PromiseDependenciesWithIterators]),
  169. race: define(null, PromiseDependenciesWithIterators),
  170. try: define(null, ["esnext.promise.try", ...PromiseDependenciesWithIterators])
  171. },
  172. Reflect: {
  173. apply: define("reflect/apply", ["es.reflect.apply"]),
  174. construct: define("reflect/construct", ["es.reflect.construct"]),
  175. defineMetadata: define("reflect/define-metadata", ["esnext.reflect.define-metadata"]),
  176. defineProperty: define("reflect/define-property", ["es.reflect.define-property"]),
  177. deleteMetadata: define("reflect/delete-metadata", ["esnext.reflect.delete-metadata"]),
  178. deleteProperty: define("reflect/delete-property", ["es.reflect.delete-property"]),
  179. get: define("reflect/get", ["es.reflect.get"]),
  180. getMetadata: define("reflect/get-metadata", ["esnext.reflect.get-metadata"]),
  181. getMetadataKeys: define("reflect/get-metadata-keys", ["esnext.reflect.get-metadata-keys"]),
  182. getOwnMetadata: define("reflect/get-own-metadata", ["esnext.reflect.get-own-metadata"]),
  183. getOwnMetadataKeys: define("reflect/get-own-metadata-keys", ["esnext.reflect.get-own-metadata-keys"]),
  184. getOwnPropertyDescriptor: define("reflect/get-own-property-descriptor", ["es.reflect.get-own-property-descriptor"]),
  185. getPrototypeOf: define("reflect/get-prototype-of", ["es.reflect.get-prototype-of"]),
  186. has: define("reflect/has", ["es.reflect.has"]),
  187. hasMetadata: define("reflect/has-metadata", ["esnext.reflect.has-metadata"]),
  188. hasOwnMetadata: define("reflect/has-own-metadata", ["esnext.reflect.has-own-metadata"]),
  189. isExtensible: define("reflect/is-extensible", ["es.reflect.is-extensible"]),
  190. metadata: define("reflect/metadata", ["esnext.reflect.metadata"]),
  191. ownKeys: define("reflect/own-keys", ["es.reflect.own-keys"]),
  192. preventExtensions: define("reflect/prevent-extensions", ["es.reflect.prevent-extensions"]),
  193. set: define("reflect/set", ["es.reflect.set"]),
  194. setPrototypeOf: define("reflect/set-prototype-of", ["es.reflect.set-prototype-of"])
  195. },
  196. Set: {
  197. from: define(null, ["esnext.set.from", ...SetDependencies]),
  198. of: define(null, ["esnext.set.of", ...SetDependencies])
  199. },
  200. String: {
  201. fromCodePoint: define("string/from-code-point", ["es.string.from-code-point"]),
  202. raw: define("string/raw", ["es.string.raw"])
  203. },
  204. Symbol: {
  205. asyncIterator: define("symbol/async-iterator", ["es.symbol.async-iterator"]),
  206. dispose: define("symbol/dispose", ["esnext.symbol.dispose"]),
  207. for: define("symbol/for", [], "es.symbol"),
  208. hasInstance: define("symbol/has-instance", ["es.symbol.has-instance", "es.function.has-instance"]),
  209. isConcatSpreadable: define("symbol/is-concat-spreadable", ["es.symbol.is-concat-spreadable", "es.array.concat"]),
  210. iterator: define("symbol/iterator", ["es.symbol.iterator", ...CommonIteratorsWithTag]),
  211. keyFor: define("symbol/key-for", [], "es.symbol"),
  212. match: define("symbol/match", ["es.symbol.match", "es.string.match"]),
  213. observable: define("symbol/observable", ["esnext.symbol.observable"]),
  214. patternMatch: define("symbol/pattern-match", ["esnext.symbol.pattern-match"]),
  215. replace: define("symbol/replace", ["es.symbol.replace", "es.string.replace"]),
  216. search: define("symbol/search", ["es.symbol.search", "es.string.search"]),
  217. species: define("symbol/species", ["es.symbol.species", "es.array.species"]),
  218. split: define("symbol/split", ["es.symbol.split", "es.string.split"]),
  219. toPrimitive: define("symbol/to-primitive", ["es.symbol.to-primitive", "es.date.to-primitive"]),
  220. toStringTag: define("symbol/to-string-tag", ["es.symbol.to-string-tag", "es.object.to-string", "es.math.to-string-tag", "es.json.to-string-tag"]),
  221. unscopables: define("symbol/unscopables", ["es.symbol.unscopables"])
  222. },
  223. WeakMap: {
  224. from: define(null, ["esnext.weak-map.from", ...WeakMapDependencies]),
  225. of: define(null, ["esnext.weak-map.of", ...WeakMapDependencies])
  226. },
  227. WeakSet: {
  228. from: define(null, ["esnext.weak-set.from", ...WeakSetDependencies]),
  229. of: define(null, ["esnext.weak-set.of", ...WeakSetDependencies])
  230. },
  231. Int8Array: TypedArrayStaticMethods,
  232. Uint8Array: TypedArrayStaticMethods,
  233. Uint8ClampedArray: TypedArrayStaticMethods,
  234. Int16Array: TypedArrayStaticMethods,
  235. Uint16Array: TypedArrayStaticMethods,
  236. Int32Array: TypedArrayStaticMethods,
  237. Uint32Array: TypedArrayStaticMethods,
  238. Float32Array: TypedArrayStaticMethods,
  239. Float64Array: TypedArrayStaticMethods
  240. };
  241. exports.StaticProperties = StaticProperties;
  242. const InstanceProperties = {
  243. at: define("instance/at", ["esnext.string.at"]),
  244. anchor: define(null, ["es.string.anchor"]),
  245. big: define(null, ["es.string.big"]),
  246. bind: define("instance/bind", ["es.function.bind"]),
  247. blink: define(null, ["es.string.blink"]),
  248. bold: define(null, ["es.string.bold"]),
  249. codePointAt: define("instance/code-point-at", ["es.string.code-point-at"]),
  250. codePoints: define("instance/code-points", ["esnext.string.code-points"]),
  251. concat: define("instance/concat", ["es.array.concat"], undefined, ["String"]),
  252. copyWithin: define("instance/copy-within", ["es.array.copy-within"]),
  253. description: define(null, ["es.symbol", "es.symbol.description"]),
  254. endsWith: define("instance/ends-with", ["es.string.ends-with"]),
  255. entries: define("instance/entries", ArrayNatureIteratorsWithTag),
  256. every: define("instance/every", ["es.array.every"]),
  257. exec: define(null, ["es.regexp.exec"]),
  258. fill: define("instance/fill", ["es.array.fill"]),
  259. filter: define("instance/filter", ["es.array.filter"]),
  260. finally: define(null, ["es.promise.finally", ...PromiseDependencies]),
  261. find: define("instance/find", ["es.array.find"]),
  262. findIndex: define("instance/find-index", ["es.array.find-index"]),
  263. fixed: define(null, ["es.string.fixed"]),
  264. flags: define("instance/flags", ["es.regexp.flags"]),
  265. flatMap: define("instance/flat-map", ["es.array.flat-map", "es.array.unscopables.flat-map"]),
  266. flat: define("instance/flat", ["es.array.flat"]),
  267. fontcolor: define(null, ["es.string.fontcolor"]),
  268. fontsize: define(null, ["es.string.fontsize"]),
  269. forEach: define("instance/for-each", ["es.array.for-each", "web.dom-collections.for-each"]),
  270. includes: define("instance/includes", ["es.array.includes", "es.string.includes"]),
  271. indexOf: define("instance/index-of", ["es.array.index-of"]),
  272. italic: define(null, ["es.string.italics"]),
  273. join: define(null, ["es.array.join"]),
  274. keys: define("instance/keys", ArrayNatureIteratorsWithTag),
  275. lastIndex: define(null, ["esnext.array.last-index"]),
  276. lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
  277. lastItem: define(null, ["esnext.array.last-item"]),
  278. link: define(null, ["es.string.link"]),
  279. map: define("instance/map", ["es.array.map"]),
  280. match: define(null, ["es.string.match", "es.regexp.exec"]),
  281. matchAll: define("instance/match-all", ["es.string.match-all"]),
  282. name: define(null, ["es.function.name"]),
  283. padEnd: define("instance/pad-end", ["es.string.pad-end"]),
  284. padStart: define("instance/pad-start", ["es.string.pad-start"]),
  285. reduce: define("instance/reduce", ["es.array.reduce"]),
  286. reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
  287. repeat: define("instance/repeat", ["es.string.repeat"]),
  288. replace: define(null, ["es.string.replace", "es.regexp.exec"]),
  289. replaceAll: define("instance/replace-all", ["esnext.string.replace-all"]),
  290. reverse: define("instance/reverse", ["es.array.reverse"]),
  291. search: define(null, ["es.string.search", "es.regexp.exec"]),
  292. slice: define("instance/slice", ["es.array.slice"]),
  293. small: define(null, ["es.string.small"]),
  294. some: define("instance/some", ["es.array.some"]),
  295. sort: define("instance/sort", ["es.array.sort"]),
  296. splice: define("instance/splice", ["es.array.splice"]),
  297. split: define(null, ["es.string.split", "es.regexp.exec"]),
  298. startsWith: define("instance/starts-with", ["es.string.starts-with"]),
  299. strike: define(null, ["es.string.strike"]),
  300. sub: define(null, ["es.string.sub"]),
  301. sup: define(null, ["es.string.sup"]),
  302. toFixed: define(null, ["es.number.to-fixed"]),
  303. toISOString: define(null, ["es.date.to-iso-string"]),
  304. toJSON: define(null, ["es.date.to-json", "web.url.to-json"]),
  305. toPrecision: define(null, ["es.number.to-precision"]),
  306. toString: define(null, ["es.object.to-string", "es.regexp.to-string", "es.date.to-string"]),
  307. trim: define("instance/trim", ["es.string.trim"]),
  308. trimEnd: define("instance/trim-end", ["es.string.trim-end"]),
  309. trimLeft: define("instance/trim-left", ["es.string.trim-start"]),
  310. trimRight: define("instance/trim-right", ["es.string.trim-end"]),
  311. trimStart: define("instance/trim-start", ["es.string.trim-start"]),
  312. values: define("instance/values", ArrayNatureIteratorsWithTag),
  313. __defineGetter__: define(null, ["es.object.define-getter"]),
  314. __defineSetter__: define(null, ["es.object.define-setter"]),
  315. __lookupGetter__: define(null, ["es.object.lookup-getter"]),
  316. __lookupSetter__: define(null, ["es.object.lookup-setter"])
  317. };
  318. exports.InstanceProperties = InstanceProperties;
  319. const CommonInstanceDependencies = new Set(["es.object.to-string", "es.object.define-getter", "es.object.define-setter", "es.object.lookup-getter", "es.object.lookup-setter", "es.regexp.exec"]);
  320. exports.CommonInstanceDependencies = CommonInstanceDependencies;