feat(es/preset-env): Update preset-env data (#9573)

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/9544
This commit is contained in:
Donny/강동윤 2024-10-08 13:44:59 +09:00 committed by GitHub
parent 3fb5bf8be4
commit 9a11d34ee5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 419 additions and 334 deletions

View File

@ -0,0 +1,6 @@
---
swc_ecma_preset_env: patch
swc_core: patch
---
feat(es/preset-env): Update preset-env data

View File

@ -0,0 +1,15 @@
{
"$schema": "https://swc.rs/schema.json",
"jsc": {
"parser": {
"syntax": "ecmascript",
},
},
"env": {
"targets": {
"chrome": "40"
},
"mode": "usage",
"coreJs": "3.22"
}
}

View File

@ -0,0 +1,3 @@
document.querySelectorAll('div').forEach(el => {
console.log(el);
})

View File

@ -0,0 +1,4 @@
require("core-js/modules/es.object.to-string.js");
document.querySelectorAll('div').forEach(function(el) {
console.log(el);
});

View File

@ -1,6 +1,7 @@
{
"transform-duplicate-named-capturing-groups-regex": {
"chrome": "126",
"opera": "112",
"edge": "126",
"firefox": "129",
"safari": "17.4",
@ -22,7 +23,7 @@
"chrome": "98",
"opera": "84",
"edge": "98",
"firefox": "95",
"firefox": "75",
"safari": "15",
"node": "12",
"deno": "1.18",

View File

@ -389,6 +389,7 @@
"electron": "10.0",
"firefox": "79",
"firefox-android": "79",
"hermes": "0.13",
"ios": "14.0",
"node": "15.0",
"oculus": "12.0",
@ -410,6 +411,7 @@
"electron": "15.0",
"firefox": "91",
"firefox-android": "91",
"hermes": "0.13",
"ios": "15.0",
"node": "16.11",
"oculus": "18.0",
@ -431,6 +433,7 @@
"electron": "14.0",
"firefox": "90",
"firefox-android": "90",
"hermes": "0.13",
"ios": "15.4",
"node": "16.6",
"oculus": "17.0",
@ -711,6 +714,7 @@
"electron": "1.2",
"firefox": "53",
"firefox-android": "53",
"hermes": "0.13",
"ios": "9.0",
"node": "6.5",
"oculus": "3.0",
@ -1113,6 +1117,7 @@
"electron": "23.0",
"firefox": "115",
"firefox-android": "115",
"hermes": "0.13",
"ios": "16.0",
"node": "20.0",
"oculus": "26.0",
@ -1154,6 +1159,7 @@
"electron": "23.0",
"firefox": "115",
"firefox-android": "115",
"hermes": "0.13",
"ios": "16.0",
"node": "20.0",
"oculus": "26.0",
@ -1238,6 +1244,7 @@
"electron": "23.0",
"firefox": "115",
"firefox-android": "115",
"hermes": "0.13",
"ios": "16.0",
"node": "20.0",
"oculus": "26.0",
@ -1726,6 +1733,7 @@
"electron": "5.0",
"firefox": "64",
"firefox-android": "64",
"hermes": "0.13",
"ios": "12.2",
"node": "12.0",
"oculus": "6.0",
@ -1770,6 +1778,7 @@
"electron": "1.2",
"firefox": "53",
"firefox-android": "53",
"hermes": "0.13",
"ios": "10.0",
"node": "6.5",
"oculus": "3.0",
@ -3673,6 +3682,7 @@
"electron": "3.0",
"firefox": "78",
"firefox-android": "78",
"hermes": "0.13",
"ios": "11.3",
"node": "10.0",
"oculus": "5.0",
@ -3782,6 +3792,7 @@
"electron": "1.2",
"firefox": "53",
"firefox-android": "53",
"hermes": "0.13",
"ios": "10.0",
"node": "6.5",
"oculus": "3.0",
@ -3944,6 +3955,7 @@
"electron": "14.0",
"firefox": "90",
"firefox-android": "90",
"hermes": "0.13",
"ios": "15.4",
"node": "16.6",
"oculus": "17.0",
@ -4237,6 +4249,7 @@
"electron": "3.0",
"firefox": "78",
"firefox-android": "78",
"hermes": "0.13",
"ios": "14.0",
"node": "10.0",
"oculus": "5.0",
@ -4923,6 +4936,7 @@
"electron": "14.0",
"firefox": "90",
"firefox-android": "90",
"hermes": "0.13",
"ios": "15.4",
"node": "16.6",
"oculus": "17.0",
@ -5620,6 +5634,7 @@
"electron": "1.2",
"firefox": "53",
"firefox-android": "53",
"hermes": "0.13",
"ios": "10.0",
"node": "6.5",
"oculus": "3.0",
@ -5642,6 +5657,7 @@
"electron": "1.2",
"firefox": "53",
"firefox-android": "53",
"hermes": "0.13",
"ios": "10.0",
"node": "6.5",
"oculus": "3.0",
@ -5664,6 +5680,7 @@
"electron": "10.0",
"firefox": "79",
"firefox-android": "79",
"hermes": "0.13",
"ios": "14.0",
"node": "15.0",
"oculus": "12.0",
@ -5706,6 +5723,7 @@
"electron": "14.0",
"firefox": "90",
"firefox-android": "90",
"hermes": "0.13",
"ios": "15.4",
"node": "16.6",
"oculus": "17.0",
@ -5781,6 +5799,7 @@
"electron": "23.0",
"firefox": "115",
"firefox-android": "115",
"hermes": "0.13",
"ios": "16.0",
"node": "20.0",
"oculus": "26.0",
@ -5822,6 +5841,7 @@
"electron": "23.0",
"firefox": "115",
"firefox-android": "115",
"hermes": "0.13",
"ios": "16.0",
"node": "20.0",
"oculus": "26.0",
@ -5844,6 +5864,7 @@
"electron": "23.0",
"firefox": "115",
"firefox-android": "115",
"hermes": "0.13",
"ios": "16.0",
"node": "20.0",
"oculus": "26.0",
@ -5936,12 +5957,14 @@
"esnext.composite-key": {},
"esnext.composite-symbol": {},
"esnext.data-view.get-float16": {
"bun": "1.1.23",
"deno": "1.43",
"firefox": "129",
"firefox-android": "129"
},
"esnext.data-view.get-uint8-clamped": {},
"esnext.data-view.set-float16": {
"bun": "1.1.23",
"deno": "1.43",
"firefox": "129",
"firefox-android": "129"
@ -5983,6 +6006,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6000,6 +6025,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6015,6 +6042,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6030,6 +6059,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6045,6 +6076,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6060,6 +6093,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6075,6 +6110,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6090,6 +6127,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6106,6 +6145,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6122,6 +6163,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6137,6 +6180,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6152,6 +6197,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6167,6 +6214,8 @@
"deno": "1.37",
"edge": "122",
"electron": "29.0",
"firefox": "131",
"firefox-android": "131",
"node": "22.0",
"oculus": "32.0",
"opera": "108",
@ -6265,6 +6314,7 @@
"esnext.math.degrees": {},
"esnext.math.fscale": {},
"esnext.math.f16round": {
"bun": "1.1.23",
"deno": "1.43",
"firefox": "129",
"firefox-android": "129"
@ -6371,6 +6421,7 @@
},
"esnext.promise.try": {
"android": "128",
"bun": "1.1.22",
"chrome": "128",
"chrome-android": "128",
"edge": "128",
@ -6406,7 +6457,9 @@
"esnext.reflect.has-metadata": {},
"esnext.reflect.has-own-metadata": {},
"esnext.reflect.metadata": {},
"esnext.regexp.escape": {},
"esnext.regexp.escape": {
"bun": "1.1.22"
},
"esnext.set.add-all": {},
"esnext.set.delete-all": {},
"esnext.set.difference.v2": {
@ -6663,7 +6716,9 @@
"edge": "127",
"electron": "32.0",
"node": "20.5.0",
"opera": "113"
"opera": "113",
"opera-android": "84",
"opera_mobile": "84"
},
"esnext.symbol.custom-matcher": {},
"esnext.symbol.dispose": {
@ -6705,6 +6760,7 @@
"electron": "14.0",
"firefox": "90",
"firefox-android": "90",
"hermes": "0.13",
"ios": "15.4",
"node": "16.6",
"oculus": "17.0",
@ -6826,12 +6882,24 @@
"safari": "16.4",
"samsung": "21.0"
},
"esnext.uint8-array.from-base64": {},
"esnext.uint8-array.from-hex": {},
"esnext.uint8-array.set-from-base64": {},
"esnext.uint8-array.set-from-hex": {},
"esnext.uint8-array.to-base64": {},
"esnext.uint8-array.to-hex": {},
"esnext.uint8-array.from-base64": {
"bun": "1.1.22"
},
"esnext.uint8-array.from-hex": {
"bun": "1.1.22"
},
"esnext.uint8-array.set-from-base64": {
"bun": "1.1.22"
},
"esnext.uint8-array.set-from-hex": {
"bun": "1.1.22"
},
"esnext.uint8-array.to-base64": {
"bun": "1.1.22"
},
"esnext.uint8-array.to-hex": {
"bun": "1.1.22"
},
"esnext.weak-map.delete-all": {},
"esnext.weak-map.from": {},
"esnext.weak-map.of": {},
@ -6851,6 +6919,7 @@
"electron": "0.20",
"firefox": "27",
"firefox-android": "27",
"hermes": "0.13",
"ios": "10.3",
"node": "18.0",
"oculus": "3.0",

View File

@ -30,12 +30,12 @@ const fn concat2<const N: usize>(a: &[&'static str], b: &[&'static str]) -> [&'s
res
}
fn typed(name: &'static str) -> CoreJSPolyfillDescriptor {
let mut global = Vec::with_capacity(1 + TYPED_ARRAY_DEPENDENCIES.len());
global.push(name);
fn typed(names: &'static [&'static str]) -> CoreJSPolyfillDescriptor {
let mut global = Vec::with_capacity(names.len() + TYPED_ARRAY_DEPENDENCIES.len());
global.extend_from_slice(names);
global.extend_from_slice(TYPED_ARRAY_DEPENDENCIES);
descriptor(None, global.leak(), Some(name), &[])
descriptor(None, global.leak(), Some(names[0]), &[])
}
static ARRAY_NATURE_ITERATORS: &[&str] = &["es.array.iterator", "web.dom-collections.iterator"];
@ -54,48 +54,57 @@ static ERROR_DEPENDENCIES: &[&str] = &["es.error.cause", "es.error.to-string"];
static SUPPRESSED_ERROR_DEPENDENCIES: &[&str] =
&concat2::<3>(&["esnext.suppressed-error.constructor"], ERROR_DEPENDENCIES);
static TYPED_ARRAY_DEPENDENCIES: &[&str] = &[
"es.typed-array.at",
"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.find-last",
"es.typed-array.find-last-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-reversed",
"es.typed-array.to-sorted",
"es.typed-array.to-string",
"es.typed-array.with",
"es.object.to-string",
"es.array.iterator",
static ARRAY_BUFFER_DEPENDENCIES: &[&str] = &[
"es.array-buffer.constructor",
"es.array-buffer.slice",
"esnext.array-buffer.detached",
"esnext.array-buffer.transfer",
"esnext.array-buffer.transfer-to-fixed-length",
"esnext.typed-array.filter-reject",
"esnext.typed-array.group-by",
"esnext.typed-array.to-spliced",
"esnext.typed-array.unique-by",
"es.data-view",
"es.array-buffer.detached",
"es.array-buffer.transfer",
"es.array-buffer.transfer-to-fixed-length",
"es.object.to-string",
];
static TYPED_ARRAY_DEPENDENCIES: &[&str] = &concat2::<42>(
&[
"es.typed-array.at",
"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.find-last",
"es.typed-array.find-last-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-reversed",
"es.typed-array.to-sorted",
"es.typed-array.to-string",
"es.typed-array.with",
"es.object.to-string",
"es.array.iterator",
"esnext.typed-array.filter-reject",
"esnext.typed-array.group-by",
"esnext.typed-array.to-spliced",
"esnext.typed-array.unique-by",
],
ARRAY_BUFFER_DEPENDENCIES,
);
pub static PROMISE_DEPENDENCIES: &[&str] = &["es.promise", "es.object.to-string"];
static PROMISE_DEPENDENCIES_WITH_ITERATORS: &[&str] =
@ -128,29 +137,29 @@ static MAP_DEPENDENCIES: &[&str] = &concat2::<19>(
static SET_DEPENDENCIES: &[&str] = &concat2::<28>(
&[
"es.set",
"es.set.difference.v2",
"es.set.intersection.v2",
"es.set.is-disjoint-from.v2",
"es.set.is-subset-of.v2",
"es.set.is-superset-of.v2",
"es.set.symmetric-difference.v2",
"es.set.union.v2",
"esnext.set.add-all",
"esnext.set.delete-all",
"esnext.set.difference",
"esnext.set.difference.v2",
"esnext.set.every",
"esnext.set.filter",
"esnext.set.find",
"esnext.set.intersection",
"esnext.set.intersection.v2",
"esnext.set.is-disjoint-from",
"esnext.set.is-disjoint-from.v2",
"esnext.set.is-subset-of",
"esnext.set.is-subset-of.v2",
"esnext.set.is-superset-of",
"esnext.set.is-superset-of.v2",
"esnext.set.join",
"esnext.set.map",
"esnext.set.reduce",
"esnext.set.some",
"esnext.set.symmetric-difference",
"esnext.set.symmetric-difference.v2",
"esnext.set.union",
"esnext.set.union.v2",
],
COMMON_ITERATORS_WITH_TAG,
);
@ -206,54 +215,70 @@ static ASYNC_ITERATOR_PROBLEM_METHODS: &[&str] = &[
static ITERATOR_DEPENDENCIES: &[&str] = &["esnext.iterator.constructor", "es.object.to-string"];
static TYPED_ARRAY_STATIC_METHODS: Lazy<ObjectMap<CoreJSPolyfillDescriptor>> = lazy_map!(Map {
from: define(null, ["es.typed-array.from"]),
fromAsync: define(
null,
[
"esnext.typed-array.from-async",
PROMISE_DEPENDENCIES_WITH_ITERATORS,
]
),
of: define(null, ["es.typed-array.of"]),
});
static DECORATOR_METADATA_DEPENDENCIES: &[&str] =
&["esnext.symbol.metadata", "esnext.function.metadata"];
static DATA_VIEW_DEPENDENCIES: &[&str] = &[
"es.data-view",
"es.array-buffer.slice",
"es.object.to-string",
];
fn typed_array_static_methods(
base: &'static [&'static str],
) -> ObjectMap<CoreJSPolyfillDescriptor> {
map!(Map {
from: define(
null,
["es.typed-array.from", base, TYPED_ARRAY_DEPENDENCIES]
),
fromAsync: define(
null,
[
"esnext.typed-array.from-async",
base,
PROMISE_DEPENDENCIES_WITH_ITERATORS,
TYPED_ARRAY_DEPENDENCIES,
]
),
of: define(null, ["es.typed-array.of", base, TYPED_ARRAY_DEPENDENCIES]),
})
}
fn uint8_typed_array_static_methods() -> ObjectMap<CoreJSPolyfillDescriptor> {
let mut map = typed_array_static_methods(&["es.typed-array.uint8-array"]);
map.extend(map!(Map {
fromBase64: define(
null,
["esnext.uint8-array.from-base64", TYPED_ARRAY_DEPENDENCIES,]
),
fromHex: define(
null,
["esnext.uint8-array.from-hex", TYPED_ARRAY_DEPENDENCIES,]
),
}));
map
}
static DATA_VIEW_DEPENDENCIES: &[&str] =
&concat2::<8>(&["es.data-view"], ARRAY_BUFFER_DEPENDENCIES);
pub(crate) static BUILT_INS: Lazy<ObjectMap<CoreJSPolyfillDescriptor>> = lazy_map!(Map{
AsyncDisposableStack: define("async-disposable-stack", [
AsyncDisposableStack: define("async-disposable-stack/index", [
"esnext.async-disposable-stack.constructor",
"es.object.to-string",
"esnext.async-iterator.async-dispose",
"esnext.iterator.dispose",
PROMISE_DEPENDENCIES,
SuppressedERROR_DEPENDENCIES,
SUPPRESSED_ERROR_DEPENDENCIES,
]),
AsyncIterator: define("async-iterator/index", ASYNC_ITERATOR_DEPENDENCIES),
AggregateError: define("aggregate-error", [
"es.aggregate-error",
ERROR_DEPENDENCIES,
CommonIteratorsWithTag,
COMMON_ITERATORS_WITH_TAG,
"es.aggregate-error.cause",
]),
ArrayBuffer: define(null, [
"es.array-buffer.constructor",
"es.array-buffer.slice",
"es.object.to-string",
]),
DataView: define(null, [
"es.data-view",
"es.array-buffer.slice",
"es.object.to-string",
]),
ArrayBuffer: define(null, ARRAY_BUFFER_DEPENDENCIES),
DataView: define(null, DATA_VIEW_DEPENDENCIES),
Date: define(null, ["es.date.to-string"]),
DOMException: define("dom-exception", DOM_EXCEPTION_DEPENDENCIES),
DisposableStack: define("disposable-stack", [
DOMException: define("dom-exception/index", DOM_EXCEPTION_DEPENDENCIES),
DisposableStack: define("disposable-stack/index", [
"esnext.disposable-stack.constructor",
"es.object.to-string",
"esnext.iterator.dispose",
@ -261,16 +286,22 @@ pub(crate) static BUILT_INS: Lazy<ObjectMap<CoreJSPolyfillDescriptor>> = lazy_ma
]),
Error: define(null, ERROR_DEPENDENCIES),
EvalError: define(null, ERROR_DEPENDENCIES),
Float32Array: typed("es.typed-array.float32-array"),
Float64Array: typed("es.typed-array.float64-array"),
Int8Array: typed("es.typed-array.int8-array"),
Int16Array: typed("es.typed-array.int16-array"),
Int32Array: typed("es.typed-array.int32-array"),
Float32Array: typed(&["es.typed-array.float32-array"]),
Float64Array: typed(&["es.typed-array.float64-array"]),
Int8Array: typed(&["es.typed-array.int8-array"]),
Int16Array: typed(&["es.typed-array.int16-array"]),
Int32Array: typed(&["es.typed-array.int32-array"]),
Iterator: define("iterator/index", ITERATOR_DEPENDENCIES),
Uint8Array: typed("es.typed-array.uint8-array"),
Uint8ClampedArray: typed("es.typed-array.uint8-clamped-array"),
Uint16Array: typed("es.typed-array.uint16-array"),
Uint32Array: typed("es.typed-array.uint32-array"),
Uint8Array: typed(&[
"es.typed-array.uint8-array",
"esnext.uint8-array.set-from-base64",
"esnext.uint8-array.set-from-hex",
"esnext.uint8-array.to-base64",
"esnext.uint8-array.to-hex",
]),
Uint8ClampedArray: typed(&["es.typed-array.uint8-clamped-array"]),
Uint16Array: typed(&["es.typed-array.uint16-array"]),
Uint32Array: typed(&["es.typed-array.uint32-array"]),
Map: define("map/index", MAP_DEPENDENCIES),
Number: define(null, ["es.number.constructor"]),
Observable: define("observable/index", [
@ -296,7 +327,11 @@ pub(crate) static BUILT_INS: Lazy<ObjectMap<CoreJSPolyfillDescriptor>> = lazy_ma
SyntaxError: define(null, ERROR_DEPENDENCIES),
TypeError: define(null, ERROR_DEPENDENCIES),
URIError: define(null, ERROR_DEPENDENCIES),
URL: define("url/index", ["web.url", URL_SEARCH_PARAMS_DEPENDENCIES]),
URL: define("url/index", [
"web.url",
"web.url.to-json",
URL_SEARCH_PARAMS_DEPENDENCIES,
]),
URLSearchParams: define(
"url-search-params/index",
URL_SEARCH_PARAMS_DEPENDENCIES
@ -331,7 +366,7 @@ pub(crate) static BUILT_INS: Lazy<ObjectMap<CoreJSPolyfillDescriptor>> = lazy_ma
unescape: define("unescape", ["es.unescape"]),
});
pub(crate) static STATIC_PROPERTIES: Lazy<ObjectMap2<CoreJSPolyfillDescriptor>> = lazy_map!(Map{
pub(crate) static STATIC_PROPERTIES: Lazy<ObjectMap2<CoreJSPolyfillDescriptor>> = lazy_map!(Map {
AsyncIterator: Map {
from: define("async-iterator/from", [
"esnext.async-iterator.from",
@ -684,6 +719,7 @@ pub(crate) static STATIC_PROPERTIES: Lazy<ObjectMap2<CoreJSPolyfillDescriptor>>
URL: Map {
canParse: define("url/can-parse", ["web.url.can-parse", "web.url"]),
parse: define("url/parse", ["web.url.parse", "web.url"]),
},
WeakMap: Map {
@ -696,15 +732,15 @@ pub(crate) static STATIC_PROPERTIES: Lazy<ObjectMap2<CoreJSPolyfillDescriptor>>
of: define(null, ["esnext.weak-set.of", WEAK_SET_DEPENDENCIES]),
},
Int8Array: *TYPED_ARRAY_STATIC_METHODS,
Uint8Array: *TYPED_ARRAY_STATIC_METHODS,
Uint8ClampedArray: *TYPED_ARRAY_STATIC_METHODS,
Int16Array: *TYPED_ARRAY_STATIC_METHODS,
Uint16Array: *TYPED_ARRAY_STATIC_METHODS,
Int32Array: *TYPED_ARRAY_STATIC_METHODS,
Uint32Array: *TYPED_ARRAY_STATIC_METHODS,
Float32Array: *TYPED_ARRAY_STATIC_METHODS,
Float64Array: *TYPED_ARRAY_STATIC_METHODS,
Int8Array: typed_array_static_methods(&["es.typed-array.int8-array"]),
Uint8Array: uint8_typed_array_static_methods(),
Uint8ClampedArray: typed_array_static_methods(&["es.typed-array.uint8-clamped-array"]),
Int16Array: typed_array_static_methods(&["es.typed-array.int16-array"]),
Uint16Array: typed_array_static_methods(&["es.typed-array.uint16-array"]),
Int32Array: typed_array_static_methods(&["es.typed-array.int32-array"]),
Uint32Array: typed_array_static_methods(&["es.typed-array.uint32-array"]),
Float32Array: typed_array_static_methods(&["es.typed-array.float32-array"]),
Float64Array: typed_array_static_methods(&["es.typed-array.float64-array"]),
WebAssembly: Map {
CompileError: define(null, ERROR_DEPENDENCIES),
@ -714,29 +750,23 @@ pub(crate) static STATIC_PROPERTIES: Lazy<ObjectMap2<CoreJSPolyfillDescriptor>>
});
pub(crate) static INSTANCE_PROPERTIES: Lazy<ObjectMap<CoreJSPolyfillDescriptor>> = lazy_map!(Map {
asIndexedPairs: define(
"instance/asIndexedPairs",
[
"esnext.async-iterator.as-indexed-pairs",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.as-indexed-pairs",
ITERATOR_DEPENDENCIES,
]
),
at: define(
"instance/at",
[
// TODO: We should introduce overloaded instance methods definition
// Before that is implemented, the `esnext.string.at` must be the first
// In pure mode, the provider resolves the descriptor as a "pure" `esnext.string.at`
// and treats the compat-data of `esnext.string.at` as the compat-data of
// pure import `instance/at`. The first polyfill here should have the lowest corejs
// supported versions.
"esnext.string.at",
"es.string.at-alternative",
"es.array.at",
]
),
asIndexedPairs: define(null, [
"esnext.async-iterator.as-indexed-pairs",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.as-indexed-pairs",
ITERATOR_DEPENDENCIES,
]),
at: define("instance/at", [
// TODO: We should introduce overloaded instance methods definition
// Before that is implemented, the `esnext.string.at` must be the first
// In pure mode, the provider resolves the descriptor as a "pure" `esnext.string.at`
// and treats the compat-data of `esnext.string.at` as the compat-data of
// pure import `instance/at`. The first polyfill here should have the lowest corejs
// supported versions.
"esnext.string.at",
"es.string.at-alternative",
"es.array.at",
]),
anchor: define(null, ["es.string.anchor"]),
big: define(null, ["es.string.big"]),
bind: define("instance/bind", ["es.function.bind"]),
@ -749,124 +779,100 @@ pub(crate) static INSTANCE_PROPERTIES: Lazy<ObjectMap<CoreJSPolyfillDescriptor>>
demethodize: define("instance/demethodize", ["esnext.function.demethodize"]),
description: define(null, ["es.symbol", "es.symbol.description"]),
dotAll: define(null, ["es.regexp.dot-all"]),
drop: define(
"instance/drop",
[
"esnext.async-iterator.drop",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.drop",
ITERATOR_DEPENDENCIES,
]
),
emplace: define(
"instance/emplace",
["esnext.map.emplace", "esnext.weak-map.emplace",]
),
drop: define(null, [
"esnext.async-iterator.drop",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.drop",
ITERATOR_DEPENDENCIES,
]),
emplace: define("instance/emplace", [
"esnext.map.emplace",
"esnext.weak-map.emplace",
]),
endsWith: define("instance/ends-with", ["es.string.ends-with"]),
entries: define("instance/entries", ARRAY_NATURE_ITERATORS_WITH_TAG),
every: define(
"instance/every",
[
"es.array.every",
"esnext.async-iterator.every",
// TODO: add async iterator dependencies when we support sub-dependencies
// esnext.async-iterator.every depends on es.promise
// but we don't want to pull es.promise when esnext.async-iterator is disabled
//
// ASYNC_ITERATOR_DEPENDENCIES
"esnext.iterator.every",
ITERATOR_DEPENDENCIES,
]
),
every: define("instance/every", [
"es.array.every",
"esnext.async-iterator.every",
// TODO: add async iterator dependencies when we support sub-dependencies
// esnext.async-iterator.every depends on es.promise
// but we don't want to pull es.promise when esnext.async-iterator is disabled
//
// ASYNC_ITERATOR_DEPENDENCIES
"esnext.iterator.every",
ITERATOR_DEPENDENCIES,
]),
exec: define(null, ["es.regexp.exec"]),
fill: define("instance/fill", ["es.array.fill"]),
filter: define(
"instance/filter",
[
"es.array.filter",
"esnext.async-iterator.filter",
"esnext.iterator.filter",
ITERATOR_DEPENDENCIES,
]
),
filter: define("instance/filter", [
"es.array.filter",
"esnext.async-iterator.filter",
"esnext.iterator.filter",
ITERATOR_DEPENDENCIES,
]),
filterReject: define("instance/filterReject", ["esnext.array.filter-reject"]),
finally: define(null, ["es.promise.finally", PROMISE_DEPENDENCIES]),
find: define(
"instance/find",
[
"es.array.find",
"esnext.async-iterator.find",
"esnext.iterator.find",
ITERATOR_DEPENDENCIES,
]
),
find: define("instance/find", [
"es.array.find",
"esnext.async-iterator.find",
"esnext.iterator.find",
ITERATOR_DEPENDENCIES,
]),
findIndex: define("instance/find-index", ["es.array.find-index"]),
findLast: define("instance/find-last", ["es.array.find-last"]),
findLastIndex: define("instance/find-last-index", ["es.array.find-last-index",]),
findLastIndex: define("instance/find-last-index", [
"es.array.find-last-index",
]),
fixed: define(null, ["es.string.fixed"]),
flags: define("instance/flags", ["es.regexp.flags"]),
flatMap: define(
"instance/flat-map",
[
"es.array.flat-map",
"es.array.unscopables.flat-map",
"esnext.async-iterator.flat-map",
"esnext.iterator.flat-map",
ITERATOR_DEPENDENCIES,
]
),
flat: define(
"instance/flat",
["es.array.flat", "es.array.unscopables.flat"]
),
getFloat16: define(
null,
["esnext.data-view.get-float16", DATA_VIEW_DEPENDENCIES]
),
getUint8Clamped: define(
null,
["esnext.data-view.get-uint8-clamped", DATA_VIEW_DEPENDENCIES]
),
flatMap: define("instance/flat-map", [
"es.array.flat-map",
"es.array.unscopables.flat-map",
"esnext.async-iterator.flat-map",
"esnext.iterator.flat-map",
ITERATOR_DEPENDENCIES,
]),
flat: define("instance/flat", ["es.array.flat", "es.array.unscopables.flat"]),
getFloat16: define(null, [
"esnext.data-view.get-float16",
DATA_VIEW_DEPENDENCIES,
]),
getUint8Clamped: define(null, [
"esnext.data-view.get-uint8-clamped",
DATA_VIEW_DEPENDENCIES,
]),
getYear: define(null, ["es.date.get-year"]),
group: define("instance/group", ["esnext.array.group"]),
groupBy: define("instance/group-by", ["esnext.array.group-by"]),
groupByToMap: define(
"instance/group-by-to-map",
[
"esnext.array.group-by-to-map",
"es.map",
"es.object.to-string",
]
),
groupToMap: define(
"instance/group-to-map",
["esnext.array.group-to-map", "es.map", "es.object.to-string",]
),
groupByToMap: define("instance/group-by-to-map", [
"esnext.array.group-by-to-map",
"es.map",
"es.object.to-string",
]),
groupToMap: define("instance/group-to-map", [
"esnext.array.group-to-map",
"es.map",
"es.object.to-string",
]),
fontcolor: define(null, ["es.string.fontcolor"]),
fontsize: define(null, ["es.string.fontsize"]),
forEach: define(
"instance/for-each",
[
"es.array.for-each",
"esnext.async-iterator.for-each",
"esnext.iterator.for-each",
ITERATOR_DEPENDENCIES,
"web.dom-collections.for-each",
]
),
includes: define(
"instance/includes",
["es.array.includes", "es.string.includes",]
),
indexed: define(
"instance/indexed",
[
"esnext.async-iterator.indexed",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.indexed",
ITERATOR_DEPENDENCIES,
]
),
forEach: define("instance/for-each", [
"es.array.for-each",
"esnext.async-iterator.for-each",
"esnext.iterator.for-each",
ITERATOR_DEPENDENCIES,
"web.dom-collections.for-each",
]),
includes: define("instance/includes", [
"es.array.includes",
"es.string.includes",
]),
indexed: define(null, [
"esnext.async-iterator.indexed",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.indexed",
ITERATOR_DEPENDENCIES,
]),
indexOf: define("instance/index-of", ["es.array.index-of"]),
isWellFormed: define("instance/is-well-formed", ["es.string.is-well-formed"]),
italic: define(null, ["es.string.italics"]),
@ -876,65 +882,53 @@ pub(crate) static INSTANCE_PROPERTIES: Lazy<ObjectMap<CoreJSPolyfillDescriptor>>
lastIndexOf: define("instance/last-index-of", ["es.array.last-index-of"]),
lastItem: define(null, ["esnext.array.last-item"]),
link: define(null, ["es.string.link"]),
map: define(
"instance/map",
[
"es.array.map",
"esnext.async-iterator.map",
"esnext.iterator.map",
]
),
map: define("instance/map", [
"es.array.map",
"esnext.async-iterator.map",
"esnext.iterator.map",
]),
match: define(null, ["es.string.match", "es.regexp.exec"]),
matchAll: define(
"instance/match-all",
["es.string.match-all", "es.regexp.exec",]
),
matchAll: define("instance/match-all", [
"es.string.match-all",
"es.regexp.exec",
]),
name: define(null, ["es.function.name"]),
padEnd: define("instance/pad-end", ["es.string.pad-end"]),
padStart: define("instance/pad-start", ["es.string.pad-start"]),
push: define("instance/push", ["es.array.push"]),
reduce: define(
"instance/reduce",
[
"es.array.reduce",
"esnext.async-iterator.reduce",
"esnext.iterator.reduce",
ITERATOR_DEPENDENCIES,
]
),
reduce: define("instance/reduce", [
"es.array.reduce",
"esnext.async-iterator.reduce",
"esnext.iterator.reduce",
ITERATOR_DEPENDENCIES,
]),
reduceRight: define("instance/reduce-right", ["es.array.reduce-right"]),
repeat: define("instance/repeat", ["es.string.repeat"]),
replace: define(null, ["es.string.replace", "es.regexp.exec"]),
replaceAll: define(
"instance/replace-all",
[
"es.string.replace-all",
"es.string.replace",
"es.regexp.exec",
]
),
replaceAll: define("instance/replace-all", [
"es.string.replace-all",
"es.string.replace",
"es.regexp.exec",
]),
reverse: define("instance/reverse", ["es.array.reverse"]),
search: define(null, ["es.string.search", "es.regexp.exec"]),
setFloat16: define(
null,
["esnext.data-view.set-float16", DATA_VIEW_DEPENDENCIES]
),
setUint8Clamped: define(
null,
["esnext.data-view.set-uint8-clamped", DATA_VIEW_DEPENDENCIES]
),
setFloat16: define(null, [
"esnext.data-view.set-float16",
DATA_VIEW_DEPENDENCIES,
]),
setUint8Clamped: define(null, [
"esnext.data-view.set-uint8-clamped",
DATA_VIEW_DEPENDENCIES,
]),
setYear: define(null, ["es.date.set-year"]),
slice: define("instance/slice", ["es.array.slice"]),
small: define(null, ["es.string.small"]),
some: define(
"instance/some",
[
"es.array.some",
"esnext.async-iterator.some",
"esnext.iterator.some",
ITERATOR_DEPENDENCIES,
]
),
some: define("instance/some", [
"es.array.some",
"esnext.async-iterator.some",
"esnext.iterator.some",
ITERATOR_DEPENDENCIES,
]),
sort: define("instance/sort", ["es.array.sort"]),
splice: define("instance/splice", ["es.array.splice"]),
split: define(null, ["es.string.split", "es.regexp.exec"]),
@ -944,34 +938,25 @@ pub(crate) static INSTANCE_PROPERTIES: Lazy<ObjectMap<CoreJSPolyfillDescriptor>>
sub: define(null, ["es.string.sub"]),
substr: define(null, ["es.string.substr"]),
sup: define(null, ["es.string.sup"]),
take: define(
"instance/take",
[
"esnext.async-iterator.take",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.take",
ITERATOR_DEPENDENCIES,
]
),
take: define(null, [
"esnext.async-iterator.take",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.take",
ITERATOR_DEPENDENCIES,
]),
test: define(null, ["es.regexp.test", "es.regexp.exec"]),
toArray: define(
"instance/to-array",
[
"esnext.async-iterator.to-array",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.to-array",
ITERATOR_DEPENDENCIES,
]
),
toAsync: define(
null,
[
"esnext.iterator.to-async",
ITERATOR_DEPENDENCIES,
ASYNC_ITERATOR_DEPENDENCIES,
AsyncIteratorProblemMethods,
]
),
toArray: define(null, [
"esnext.async-iterator.to-array",
ASYNC_ITERATOR_DEPENDENCIES,
"esnext.iterator.to-array",
ITERATOR_DEPENDENCIES,
]),
toAsync: define(null, [
"esnext.iterator.to-async",
ITERATOR_DEPENDENCIES,
ASYNC_ITERATOR_DEPENDENCIES,
ASYNC_ITERATOR_PROBLEM_METHODS,
]),
toExponential: define(null, ["es.number.to-exponential"]),
toFixed: define(null, ["es.number.to-fixed"]),
toGMTString: define(null, ["es.date.to-gmt-string"]),
@ -979,20 +964,17 @@ pub(crate) static INSTANCE_PROPERTIES: Lazy<ObjectMap<CoreJSPolyfillDescriptor>>
toJSON: define(null, ["es.date.to-json", "web.url.to-json"]),
toPrecision: define(null, ["es.number.to-precision"]),
toReversed: define("instance/to-reversed", ["es.array.to-reversed"]),
toSorted: define(
"instance/to-sorted",
["es.array.to-sorted", "es.array.sort",]
),
toSorted: define("instance/to-sorted", [
"es.array.to-sorted",
"es.array.sort",
]),
toSpliced: define("instance/to-spliced", ["es.array.to-spliced"]),
toString: define(
null,
[
"es.object.to-string",
"es.error.to-string",
"es.date.to-string",
"es.regexp.to-string",
]
),
toString: define(null, [
"es.object.to-string",
"es.error.to-string",
"es.date.to-string",
"es.regexp.to-string",
]),
toWellFormed: define("instance/to-well-formed", ["es.string.to-well-formed"]),
trim: define("instance/trim", ["es.string.trim"]),
trimEnd: define("instance/trim-end", ["es.string.trim-end"]),

View File

@ -1,3 +1,4 @@
import "core-js/modules/es.array-buffer.constructor.js";
import "core-js/modules/es.array.iterator.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.typed-array.fill.js";

View File

@ -1,5 +1,7 @@
import "core-js/modules/es.array-buffer.constructor.js";
import "core-js/modules/es.array-buffer.slice.js";
import "core-js/modules/es.array.iterator.js";
import "core-js/modules/es.data-view.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.typed-array.copy-within.js";
import "core-js/modules/es.typed-array.every.js";

View File

@ -1,5 +1,7 @@
import "core-js/modules/es.array-buffer.constructor.js";
import "core-js/modules/es.array-buffer.slice.js";
import "core-js/modules/es.array.iterator.js";
import "core-js/modules/es.data-view.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.typed-array.copy-within.js";
import "core-js/modules/es.typed-array.every.js";

View File

@ -22,7 +22,7 @@
"test:html": "cd ./packages/html && yarn test"
},
"devDependencies": {
"@babel/compat-data": "^7.25.2",
"@babel/compat-data": "^7.25.4",
"@babel/core": "^7.13.16",
"@babel/generator": "^7.18.13",
"@babel/plugin-proposal-class-properties": "^7.13.0",
@ -46,7 +46,7 @@
"bootstrap": "^5.2.1",
"class-validator": "^0.13.1",
"core-js": "^2.6.11",
"core-js-compat": "^3.38.0",
"core-js-compat": "^3.38.1",
"cross-env": "^7.0.3",
"cspell": "^5.12.3",
"expect": "^27.4.2",

View File

@ -152,10 +152,10 @@ __metadata:
languageName: node
linkType: hard
"@babel/compat-data@npm:^7.25.2":
version: 7.25.2
resolution: "@babel/compat-data@npm:7.25.2"
checksum: fd61de9303db3177fc98173571f81f3f551eac5c9f839c05ad02818b11fe77a74daa632abebf7f423fbb4a29976ae9141e0d2bd7517746a0ff3d74cb659ad33a
"@babel/compat-data@npm:^7.25.4":
version: 7.25.4
resolution: "@babel/compat-data@npm:7.25.4"
checksum: d37a8936cc355a9ca3050102e03d179bdae26bd2e5c99a977637376c192b23637a039795f153c849437a086727628c9860e2c6af92d7151396e2362c09176337
languageName: node
linkType: hard
@ -4749,7 +4749,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@swc/workspace@workspace:."
dependencies:
"@babel/compat-data": "npm:^7.25.2"
"@babel/compat-data": "npm:^7.25.4"
"@babel/core": "npm:^7.13.16"
"@babel/generator": "npm:^7.18.13"
"@babel/plugin-proposal-class-properties": "npm:^7.13.0"
@ -4773,7 +4773,7 @@ __metadata:
bootstrap: "npm:^5.2.1"
class-validator: "npm:^0.13.1"
core-js: "npm:^2.6.11"
core-js-compat: "npm:^3.38.0"
core-js-compat: "npm:^3.38.1"
cross-env: "npm:^7.0.3"
cspell: "npm:^5.12.3"
expect: "npm:^27.4.2"
@ -7538,12 +7538,12 @@ __metadata:
languageName: node
linkType: hard
"core-js-compat@npm:^3.38.0":
version: 3.38.0
resolution: "core-js-compat@npm:3.38.0"
"core-js-compat@npm:^3.38.1":
version: 3.38.1
resolution: "core-js-compat@npm:3.38.1"
dependencies:
browserslist: "npm:^4.23.3"
checksum: 7ebdca6b305c9c470980e1f7e7a3d759add7cb754bff62926242907ee4d1d4e8bb13f70eb9a7d7769e0f63aec3f4cca83abf60f502286853b45d4b63a01c25ed
checksum: 4e2f219354fd268895f79486461a12df96f24ed307321482fe2a43529c5a64e7c16bcba654980ba217d603444f5141d43a79058aeac77511085f065c5da72207
languageName: node
linkType: hard