summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-03-21 11:46:40 -0400
committerGitHub <noreply@github.com>2023-03-21 15:46:40 +0000
commit2fcf1f14cf29bb68995f652f93a4f6e3cb55c8d7 (patch)
tree04fb972934969cb01a52f3b9b8af0a17134ef5b6 /cli/build.rs
parent0366d6833f25b786e897ce0d6393f692507f0532 (diff)
feat: TypeScript 5.0.2 (except decorators) (#18294)
This upgrades TypeScript to 5.0.2, but does not have ES decorator support because swc does not support that yet.
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs24
1 files changed, 11 insertions, 13 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 4943b729a..ecd7ed1be 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -162,6 +162,8 @@ mod ts {
"deno.ns",
"deno.unstable",
// Deno built-in type libraries
+ "decorators",
+ "decorators.legacy",
"es5",
"es2015.collection",
"es2015.core",
@@ -212,8 +214,11 @@ mod ts {
"es2022.error",
"es2022.intl",
"es2022.object",
+ "es2022.regexp",
"es2022.sharedmemory",
"es2022.string",
+ "es2023",
+ "es2023.array",
"esnext",
"esnext.array",
"esnext.intl",
@@ -287,20 +292,11 @@ mod ts {
pub(crate) fn version() -> String {
let file_text = std::fs::read_to_string("tsc/00_typescript.js").unwrap();
- let mut version = String::new();
+ let version_text = " version = \"";
for line in file_text.lines() {
- let major_minor_text = "ts.versionMajorMinor = \"";
- let version_text = "ts.version = \"\".concat(ts.versionMajorMinor, \"";
- if version.is_empty() {
- if let Some(index) = line.find(major_minor_text) {
- let remaining_line = &line[index + major_minor_text.len()..];
- version
- .push_str(&remaining_line[..remaining_line.find('"').unwrap()]);
- }
- } else if let Some(index) = line.find(version_text) {
+ if let Some(index) = line.find(version_text) {
let remaining_line = &line[index + version_text.len()..];
- version.push_str(&remaining_line[..remaining_line.find('"').unwrap()]);
- return version;
+ return remaining_line[..remaining_line.find('"').unwrap()].to_string();
}
}
panic!("Could not find ts version.")
@@ -459,7 +455,9 @@ fn main() {
println!("cargo:rustc-env=GIT_COMMIT_HASH={}", git_commit_hash());
println!("cargo:rerun-if-env-changed=GIT_COMMIT_HASH");
- println!("cargo:rustc-env=TS_VERSION={}", ts::version());
+ let ts_version = ts::version();
+ debug_assert_eq!(ts_version, "5.0.2"); // bump this assertion when it changes
+ println!("cargo:rustc-env=TS_VERSION={}", ts_version);
println!("cargo:rerun-if-env-changed=TS_VERSION");
println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());