From 46ea59631d3d5025382e03b221b3739eaa84602b Mon Sep 17 00:00:00 2001 From: Evan Wallace Date: Sun, 12 May 2024 12:36:33 -0400 Subject: [PATCH] fix #3762: add `es2023` as an alias for `es2022` --- CHANGELOG.md | 6 ++++++ internal/resolver/tsconfig_json.go | 2 +- pkg/api/api.go | 1 + pkg/api/api_impl.go | 2 ++ pkg/cli/cli_impl.go | 1 + 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6518254033..0e1064a9f4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +* Allow `es2023` as a target environment ([#3762](https://github.com/evanw/esbuild/issues/3762)) + + TypeScript recently [added `es2023`](https://github.com/microsoft/TypeScript/pull/58140) as a compilation target, so esbuild now supports this too. There is no difference between a target of `es2022` and `es2023` as far as esbuild is concerned since the 2023 edition of JavaScript doesn't introduce any new syntax features. + ## 0.21.1 * Fix a regression with `--keep-names` ([#3756](https://github.com/evanw/esbuild/issues/3756)) diff --git a/internal/resolver/tsconfig_json.go b/internal/resolver/tsconfig_json.go index 1cc48941859..ffeb75dbb93 100644 --- a/internal/resolver/tsconfig_json.go +++ b/internal/resolver/tsconfig_json.go @@ -213,7 +213,7 @@ func ParseTSConfigJSON( switch lowerValue { case "es3", "es5", "es6", "es2015", "es2016", "es2017", "es2018", "es2019", "es2020", "es2021": result.Settings.Target = config.TSTargetBelowES2022 - case "es2022", "esnext": + case "es2022", "es2023", "esnext": result.Settings.Target = config.TSTargetAtOrAboveES2022 default: ok = false diff --git a/pkg/api/api.go b/pkg/api/api.go index 9981953346f..017ed8905c6 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -132,6 +132,7 @@ const ( ES2020 ES2021 ES2022 + ES2023 ) type Loader uint16 diff --git a/pkg/api/api_impl.go b/pkg/api/api_impl.go index 98a29c58055..18efb58d3b3 100644 --- a/pkg/api/api_impl.go +++ b/pkg/api/api_impl.go @@ -305,6 +305,8 @@ func validateFeatures(log logger.Log, target Target, engines []Engine) (compat.J constraints[compat.ES] = compat.Semver{Parts: []int{2021}} case ES2022: constraints[compat.ES] = compat.Semver{Parts: []int{2022}} + case ES2023: + constraints[compat.ES] = compat.Semver{Parts: []int{2023}} case ESNext, DefaultTarget: default: panic("Invalid target") diff --git a/pkg/cli/cli_impl.go b/pkg/cli/cli_impl.go index 8e292cc315b..396023ebf7d 100644 --- a/pkg/cli/cli_impl.go +++ b/pkg/cli/cli_impl.go @@ -980,6 +980,7 @@ func parseTargets(targets []string, arg string) (target api.Target, engines []ap "es2020": api.ES2020, "es2021": api.ES2021, "es2022": api.ES2022, + "es2023": api.ES2023, } outer: