1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

fix: memory leak when transpiling (#24490)

This commit fixes memory leak described in
https://github.com/denoland/deno/issues/24380.

This is done by upgrading following crates:
- deno_ast
- deno_graph
- eszip
- dprint-plugin-typescript
- deno_lint
- deno_doc
- deno_emit
This commit is contained in:
Bartek Iwańczuk 2024-07-10 14:51:55 +01:00 committed by GitHub
parent 82f9216610
commit 8b34c4d75b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 63 additions and 72 deletions

View file

@ -5,7 +5,7 @@ import { stringify } from "jsr:@std/yaml@^0.221/stringify";
// Bump this number when you want to purge the cache. // Bump this number when you want to purge the cache.
// Note: the tools/release/01_bump_crate_versions.ts script will update this version // Note: the tools/release/01_bump_crate_versions.ts script will update this version
// automatically via regex, so ensure that this line maintains this format. // automatically via regex, so ensure that this line maintains this format.
const cacheVersion = 3; const cacheVersion = 4;
const ubuntuX86Runner = "ubuntu-22.04"; const ubuntuX86Runner = "ubuntu-22.04";
const ubuntuX86XlRunner = "ubuntu-22.04-xl"; const ubuntuX86XlRunner = "ubuntu-22.04-xl";

View file

@ -367,8 +367,8 @@ jobs:
path: |- path: |-
~/.cargo/registry/index ~/.cargo/registry/index
~/.cargo/registry/cache ~/.cargo/registry/cache
key: '3-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}' key: '4-cargo-home-${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles(''Cargo.lock'') }}'
restore-keys: '3-cargo-home-${{ matrix.os }}-${{ matrix.arch }}' restore-keys: '4-cargo-home-${{ matrix.os }}-${{ matrix.arch }}'
if: '!(matrix.skip)' if: '!(matrix.skip)'
- name: Restore cache build output (PR) - name: Restore cache build output (PR)
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
@ -380,7 +380,7 @@ jobs:
!./target/*/*.zip !./target/*/*.zip
!./target/*/*.tar.gz !./target/*/*.tar.gz
key: never_saved key: never_saved
restore-keys: '3-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-' restore-keys: '4-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-'
- name: Apply and update mtime cache - name: Apply and update mtime cache
if: '!(matrix.skip) && (!startsWith(github.ref, ''refs/tags/''))' if: '!(matrix.skip) && (!startsWith(github.ref, ''refs/tags/''))'
uses: ./.github/mtime_cache uses: ./.github/mtime_cache
@ -669,7 +669,7 @@ jobs:
!./target/*/gn_out !./target/*/gn_out
!./target/*/*.zip !./target/*/*.zip
!./target/*/*.tar.gz !./target/*/*.tar.gz
key: '3-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}' key: '4-cargo-target-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
publish-canary: publish-canary:
name: publish canary name: publish canary
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04

109
Cargo.lock generated
View file

@ -1205,9 +1205,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_ast" name = "deno_ast"
version = "0.39.2" version = "0.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "132aace7b62c317da51f84f1cfbbbfc56ce643110821937c04b36c916db64341" checksum = "4d08372522975cce97fe0efbe42fea508c76eea4421619de6d63baae32792f7d"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.21.7", "base64 0.21.7",
@ -1418,9 +1418,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_doc" name = "deno_doc"
version = "0.141.0" version = "0.141.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9089eb2e914a60849ab0094c599eb18a224805b75b3f5607b1fafde756d4899" checksum = "b6638960315276510480f7fdcf8af0c7f4599c703055ccbffae2edd29a18b42d"
dependencies = [ dependencies = [
"ammonia", "ammonia",
"anyhow", "anyhow",
@ -1443,9 +1443,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_emit" name = "deno_emit"
version = "0.43.0" version = "0.43.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4a9faa31cf536b4390073a3d51ec188f0318851961787456e4d91bf0771b634" checksum = "5c60394020be62d8c0d7fa0808ece5d9607f822f4bd27453d248d528d11ae762"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.21.7", "base64 0.21.7",
@ -1515,9 +1515,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_graph" name = "deno_graph"
version = "0.79.0" version = "0.80.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "caa95531b3eb65aced626d8dd8117b29b3e57763e0c1ace502101fb56b8a2c31" checksum = "e1ec763fcd824d63cc056f153ba7fbf6254b515c347ec8b7d1a21515742547bb"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-trait", "async-trait",
@ -1629,9 +1629,9 @@ dependencies = [
[[package]] [[package]]
name = "deno_lint" name = "deno_lint"
version = "0.60.0" version = "0.60.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf6a9540b371b123e3df4ab5fd59af0defc0d834e08ebfb3deacc41837963368" checksum = "598de34cdfb2a8ed335d8f2e33a75249445a9f81c8092a069fc562c2d5cdb9b6"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"deno_ast", "deno_ast",
@ -2362,9 +2362,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-plugin-typescript" name = "dprint-plugin-typescript"
version = "0.91.1" version = "0.91.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4170a1aea5c8d899e9fa96be972931b1f0beaf6f6ba2f3f40a48a13071b376ea" checksum = "fecac09050c0bc7d19a0e47d3ce3cfc2e21780fb30b5081a5042fd49c1b020a2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"deno_ast", "deno_ast",
@ -2377,9 +2377,9 @@ dependencies = [
[[package]] [[package]]
name = "dprint-swc-ext" name = "dprint-swc-ext"
version = "0.16.0" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "019d17f2c2457c5a70a7cf4505b1a562ca8ab168c0ac0c005744efbd29fcb8fe" checksum = "5a0d5b63e52434314e3d767c463b1f68c467c31e61d279bc019227016c44e535"
dependencies = [ dependencies = [
"allocator-api2", "allocator-api2",
"bumpalo", "bumpalo",
@ -2599,9 +2599,9 @@ dependencies = [
[[package]] [[package]]
name = "eszip" name = "eszip"
version = "0.72.1" version = "0.72.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87821a4dc0e26683d866a1841560b99aa9002a60db8a9eded78efe1853144c43" checksum = "671e5931ba2ba3415b8c410a70b767ca80e1b5b721b428aca2f234f9776cf848"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64 0.21.7", "base64 0.21.7",
@ -5855,17 +5855,6 @@ dependencies = [
"v8", "v8",
] ]
[[package]]
name = "sha-1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
]
[[package]] [[package]]
name = "sha1" name = "sha1"
version = "0.10.6" version = "0.10.6"
@ -6231,9 +6220,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_bundler" name = "swc_bundler"
version = "0.228.0" version = "0.230.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43e4698d94115ea10fe3c6fdde2d1e736c6ba6601abab0a61d95e1015d13359f" checksum = "9c506ddddebb846f8e68780464e2fe1fdc0add4bc265659f713a71015ffcdb13"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"crc", "crc",
@ -6275,9 +6264,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_common" name = "swc_common"
version = "0.33.26" version = "0.34.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2f9706038906e66f3919028f9f7a37f3ed552f1b85578e93f4468742e2da438" checksum = "9087befec6b63911f9d2f239e4f91c9b21589c169b86ed2d616944d23cf4a243"
dependencies = [ dependencies = [
"ast_node", "ast_node",
"better_scoped_tls", "better_scoped_tls",
@ -6327,9 +6316,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_ast" name = "swc_ecma_ast"
version = "0.113.7" version = "0.115.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98a534a8360a076a030989f6d121ba6044345594bdf0457c4629f432742026b8" checksum = "7be1306930c235435a892104c00c2b5e16231043c085d5a10bd3e7537b15659b"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"is-macro", "is-macro",
@ -6345,9 +6334,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_codegen" name = "swc_ecma_codegen"
version = "0.149.3" version = "0.151.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efb2bef3f4998865b2d466fb2ef9410a03449d255d199f3eb807fb19acc3862b" checksum = "f5141a8cb4eb69e090e6aea5d49061b46919be5210f3d084f9d9ad63d30f5cff"
dependencies = [ dependencies = [
"memchr", "memchr",
"num-bigint", "num-bigint",
@ -6376,9 +6365,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_loader" name = "swc_ecma_loader"
version = "0.45.28" version = "0.46.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92c68f934bd2c51f29c4ad0bcae09924e9dc30d7ce0680367d45b42d40338a67" checksum = "5a9febebf047d1286e7b723fa2758f3229da2c103834f3eaee69833f46692612"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"pathdiff", "pathdiff",
@ -6390,9 +6379,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_parser" name = "swc_ecma_parser"
version = "0.144.3" version = "0.146.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc0b4193b9c127db1990a5a08111aafe0122bc8b138646807c63f2a6521b7da4" checksum = "0a4e0c2e85f12c63b85c805e923079b04d1fb3e25edd069d638eed5f2098de74"
dependencies = [ dependencies = [
"either", "either",
"new_debug_unreachable", "new_debug_unreachable",
@ -6412,9 +6401,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_base" name = "swc_ecma_transforms_base"
version = "0.138.4" version = "0.140.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7b76d09313cdd8f99bc1519fb04f8a93427c7a6f4bfbc64b39fcc5a378ab1b7" checksum = "d37dc505c92af56d0f77cf6f31a6ccd37ac40cad1e01ff77277e0b1c70e8f8ff"
dependencies = [ dependencies = [
"better_scoped_tls", "better_scoped_tls",
"bitflags 2.5.0", "bitflags 2.5.0",
@ -6435,9 +6424,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_classes" name = "swc_ecma_transforms_classes"
version = "0.127.1" version = "0.129.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53043d81678f3c693604eeb1d1f0fe6ba10f303104a31b954dbeebed9cadf530" checksum = "a3eab5f8179e5b0aedf385eacc2c033691c6d211a7babd1bbbff12cf794a824e"
dependencies = [ dependencies = [
"swc_atoms", "swc_atoms",
"swc_common", "swc_common",
@ -6461,9 +6450,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_optimization" name = "swc_ecma_transforms_optimization"
version = "0.199.2" version = "0.201.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25982d69c91cd64cbfae714d9e953810b3f2835486d08108967cbd15016e7720" checksum = "724a8306e98c1b1f9640fc44c1acc0c971f6daa17651919e06b64f905d4a4564"
dependencies = [ dependencies = [
"dashmap", "dashmap",
"indexmap", "indexmap",
@ -6485,9 +6474,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_proposal" name = "swc_ecma_transforms_proposal"
version = "0.172.3" version = "0.174.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fbc414d6a9c5479cfb4c6e92fcdac504582bd7bc89a0ed7f8808b72dc8bd1f0" checksum = "6df8aa6752cc2fcf3d78ac67827542fb666e52283f2b26802aa058906bb750d3"
dependencies = [ dependencies = [
"either", "either",
"rustc-hash", "rustc-hash",
@ -6505,16 +6494,16 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_react" name = "swc_ecma_transforms_react"
version = "0.184.1" version = "0.186.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "565a76c4ca47ce31d78301c0beab878e4c2cb4f624691254d834ec8c0e236755" checksum = "446da32cac8299973aaf1d37496562bfd0c1e4f3c3ab5d0af6f07f42e8184102"
dependencies = [ dependencies = [
"base64 0.21.7", "base64 0.21.7",
"dashmap", "dashmap",
"indexmap", "indexmap",
"once_cell", "once_cell",
"serde", "serde",
"sha-1", "sha1",
"string_enum", "string_enum",
"swc_atoms", "swc_atoms",
"swc_common", "swc_common",
@ -6529,9 +6518,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_transforms_typescript" name = "swc_ecma_transforms_typescript"
version = "0.189.1" version = "0.191.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e209026c1d3c577cafac257d87e7c0d23119282fbdc8ed03d7f56077e95beb90" checksum = "f1ce8af2865449e714ae56dacb6b54b3f6dc4cc25074da4e39b878bd93c5e39c"
dependencies = [ dependencies = [
"ryu-js", "ryu-js",
"serde", "serde",
@ -6546,9 +6535,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_utils" name = "swc_ecma_utils"
version = "0.128.3" version = "0.130.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02f470d8cc31adf6189b228636201ee3cdd268c0b5a2d0407f83093dfa96ff91" checksum = "13e62b199454a576c5fdbd7e1bef8ab88a395427456d8a713d994b7d469833aa"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"num_cpus", "num_cpus",
@ -6565,9 +6554,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_ecma_visit" name = "swc_ecma_visit"
version = "0.99.1" version = "0.101.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28a6ce28ad8e591f8d627f1f9cb26b25e5d83052a9bc1b674d95fc28040cfa98" checksum = "ce0d997f0c9b4e181225f603d161f6757c2a97022258170982cfe005ec69ec92"
dependencies = [ dependencies = [
"num-bigint", "num-bigint",
"swc_atoms", "swc_atoms",
@ -6590,9 +6579,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_fast_graph" name = "swc_fast_graph"
version = "0.21.22" version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3fdd64bc3d161d6c1ea9a8ae5779e4ba132afc67e7b8ece5420bfc9c6e1275d" checksum = "c00cf5c1687e9858fb9de1ffa90a3e21369095406e97ace870a389320d105b0a"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"petgraph", "petgraph",
@ -6602,9 +6591,9 @@ dependencies = [
[[package]] [[package]]
name = "swc_graph_analyzer" name = "swc_graph_analyzer"
version = "0.22.23" version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c728a8f9b82b7160a1ae246e31232177b371f827eb0d01006c0f120a3494871c" checksum = "a928a2ad8897fb78c38898ba342960863e9937b7a3de2d010d3204d85ce1b72a"
dependencies = [ dependencies = [
"auto_impl", "auto_impl",
"petgraph", "petgraph",

View file

@ -43,7 +43,7 @@ license = "MIT"
repository = "https://github.com/denoland/deno" repository = "https://github.com/denoland/deno"
[workspace.dependencies] [workspace.dependencies]
deno_ast = { version = "=0.39.2", features = ["transpiling"] } deno_ast = { version = "=0.40.0", features = ["transpiling"] }
deno_core = { version = "0.293.0" } deno_core = { version = "0.293.0" }
deno_bench_util = { version = "0.152.0", path = "./bench_util" } deno_bench_util = { version = "0.152.0", path = "./bench_util" }

View file

@ -67,17 +67,17 @@ deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposa
deno_cache_dir = { workspace = true } deno_cache_dir = { workspace = true }
deno_config = { workspace = true, features = ["workspace"] } deno_config = { workspace = true, features = ["workspace"] }
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_doc = { version = "=0.141.0", features = ["html", "syntect"] } deno_doc = { version = "=0.141.1", features = ["html", "syntect"] }
deno_emit = "=0.43.0" deno_emit = "=0.43.1"
deno_graph = { version = "=0.79.0", features = ["tokio_executor"] } deno_graph = { version = "=0.80.0", features = ["tokio_executor"] }
deno_lint = { version = "=0.60.0", features = ["docs"] } deno_lint = { version = "=0.60.1", features = ["docs"] }
deno_lockfile.workspace = true deno_lockfile.workspace = true
deno_npm = "=0.21.4" deno_npm = "=0.21.4"
deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] } deno_runtime = { workspace = true, features = ["include_js_files_for_snapshotting"] }
deno_semver = "=0.5.6" deno_semver = "=0.5.6"
deno_task_shell = "=0.17.0" deno_task_shell = "=0.17.0"
deno_terminal.workspace = true deno_terminal.workspace = true
eszip = "=0.72.1" eszip = "=0.72.2"
napi_sym.workspace = true napi_sym.workspace = true
async-trait.workspace = true async-trait.workspace = true
@ -99,7 +99,7 @@ dotenvy = "0.15.7"
dprint-plugin-json = "=0.19.3" dprint-plugin-json = "=0.19.3"
dprint-plugin-jupyter = "=0.1.3" dprint-plugin-jupyter = "=0.1.3"
dprint-plugin-markdown = "=0.17.1" dprint-plugin-markdown = "=0.17.1"
dprint-plugin-typescript = "=0.91.1" dprint-plugin-typescript = "=0.91.3"
env_logger = "=0.10.0" env_logger = "=0.10.0"
fancy-regex = "=0.10.0" fancy-regex = "=0.10.0"
faster-hex.workspace = true faster-hex.workspace = true

View file

@ -198,6 +198,7 @@ pub fn ts_config_to_transpile_and_emit_options(
jsx_import_source: options.jsx_import_source, jsx_import_source: options.jsx_import_source,
precompile_jsx, precompile_jsx,
precompile_jsx_skip_elements: options.jsx_precompile_skip_elements, precompile_jsx_skip_elements: options.jsx_precompile_skip_elements,
precompile_jsx_dynamic_props: None,
transform_jsx, transform_jsx,
var_decl_imports: false, var_decl_imports: false,
}, },

View file

@ -632,6 +632,7 @@ impl ReplSession {
transform_jsx: true, transform_jsx: true,
precompile_jsx: false, precompile_jsx: false,
precompile_jsx_skip_elements: None, precompile_jsx_skip_elements: None,
precompile_jsx_dynamic_props: None,
jsx_automatic: self.jsx.import_source.is_some(), jsx_automatic: self.jsx.import_source.is_some(),
jsx_development: false, jsx_development: false,
jsx_factory: self.jsx.factory.clone(), jsx_factory: self.jsx.factory.clone(),