From 005ddc573e3752183783cc25dd6242b750f8beb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Mon, 18 Sep 2023 22:20:23 +0900 Subject: [PATCH] chore(es/preset-env): Ignore `tp` in the version of a browser version (#7968) --- crates/swc_ecma_preset_env/src/transform_data.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/swc_ecma_preset_env/src/transform_data.rs b/crates/swc_ecma_preset_env/src/transform_data.rs index ab907b1cbcd..11424f9fab7 100644 --- a/crates/swc_ecma_preset_env/src/transform_data.rs +++ b/crates/swc_ecma_preset_env/src/transform_data.rs @@ -201,7 +201,17 @@ pub(crate) static FEATURES: Lazy>> .map(|(feature, version)| { ( feature, - version.map_value(|version| version.map(|v| v.parse().unwrap())), + version.map_value(|version| { + if matches!(version.as_deref(), Some("tp")) { + return None; + } + + version.map(|v| { + v.parse().unwrap_or_else(|err| { + panic!("failed to parse `{v}` as a version: {err:?}") + }) + }) + }), ) }) .collect()