Skip to content

Commit

Permalink
fix(cli): Configure GLOBALS (#6061)
Browse files Browse the repository at this point in the history
**Related issue:**

 - Closes #6059.
  • Loading branch information
kdy1 committed Oct 6, 2022
1 parent 3987452 commit 6cdb5ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 8 additions & 2 deletions bindings/swc_cli/src/commands/compile.rs
Expand Up @@ -16,7 +16,9 @@ use swc_core::{
config::{Config, ConfigFile, Options},
try_with_handler, Compiler, HandlerOpts, TransformOutput,
},
common::{errors::ColorConfig, sync::Lazy, FileName, FilePathMapping, SourceFile, SourceMap},
common::{
errors::ColorConfig, sync::Lazy, FileName, FilePathMapping, SourceFile, SourceMap, GLOBALS,
},
trace_macro::swc_trace,
};
use walkdir::WalkDir;
Expand Down Expand Up @@ -366,7 +368,11 @@ impl CompileOptions {
color: ColorConfig::Always,
skip_filename: false,
},
|handler| compiler.process_js_file(fm, handler, &options),
|handler| {
GLOBALS.set(&Default::default(), || {
compiler.process_js_file(fm, handler, &options)
})
},
)
};

Expand Down
5 changes: 1 addition & 4 deletions scripts/bot/src/auto-rebase.ts
Expand Up @@ -18,10 +18,7 @@ function sleep(ms: number) {

console.log(`Latest commit message: ${latestCommitMessage}`);

if (
!latestCommitMessage.startsWith("test(") &&
!latestCommitMessage.startsWith("chore:")
) {
if (!latestCommitMessage.startsWith("chore:")) {
console.log(
`Auto rebase script cannot work because the latest commit may require a version bump`
);
Expand Down

1 comment on commit 6cdb5ed

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 6cdb5ed Previous: 39481c6 Ratio
es/full/minify/libraries/antd 2237612397 ns/iter (± 108967388) 1993102670 ns/iter (± 130219462) 1.12
es/full/minify/libraries/d3 442644534 ns/iter (± 55898000) 404383026 ns/iter (± 40540928) 1.09
es/full/minify/libraries/echarts 1720042033 ns/iter (± 104198096) 1553814075 ns/iter (± 97243785) 1.11
es/full/minify/libraries/jquery 128837210 ns/iter (± 15859072) 104192571 ns/iter (± 18420803) 1.24
es/full/minify/libraries/lodash 116189573 ns/iter (± 3994489) 127053444 ns/iter (± 18854977) 0.91
es/full/minify/libraries/moment 60853518 ns/iter (± 2636309) 59856120 ns/iter (± 3770879) 1.02
es/full/minify/libraries/react 23000916 ns/iter (± 1152527) 22394882 ns/iter (± 556030) 1.03
es/full/minify/libraries/terser 330476341 ns/iter (± 47706330) 318411690 ns/iter (± 38873702) 1.04
es/full/minify/libraries/three 623578594 ns/iter (± 110497361) 536898745 ns/iter (± 51443137) 1.16
es/full/minify/libraries/typescript 3692321534 ns/iter (± 254414387) 3475497906 ns/iter (± 622070318) 1.06
es/full/minify/libraries/victory 815353702 ns/iter (± 85928189) 770985623 ns/iter (± 26124480) 1.06
es/full/minify/libraries/vue 146509351 ns/iter (± 11036441) 140022748 ns/iter (± 12061640) 1.05
es/full/codegen/es3 34507 ns/iter (± 893) 34109 ns/iter (± 1271) 1.01
es/full/codegen/es5 34388 ns/iter (± 724) 35167 ns/iter (± 16300) 0.98
es/full/codegen/es2015 34360 ns/iter (± 1424) 34097 ns/iter (± 1229) 1.01
es/full/codegen/es2016 35232 ns/iter (± 1514) 34113 ns/iter (± 1507) 1.03
es/full/codegen/es2017 34645 ns/iter (± 2766) 34130 ns/iter (± 1706) 1.02
es/full/codegen/es2018 34673 ns/iter (± 3461) 33959 ns/iter (± 904) 1.02
es/full/codegen/es2019 34717 ns/iter (± 3205) 33906 ns/iter (± 669) 1.02
es/full/codegen/es2020 34832 ns/iter (± 3341) 34098 ns/iter (± 452) 1.02
es/full/all/es3 244014686 ns/iter (± 25359830) 218416475 ns/iter (± 14068162) 1.12
es/full/all/es5 230260273 ns/iter (± 25927870) 200389580 ns/iter (± 19074014) 1.15
es/full/all/es2015 178393398 ns/iter (± 21124642) 162121987 ns/iter (± 10089429) 1.10
es/full/all/es2016 172205616 ns/iter (± 19487958) 158982414 ns/iter (± 9140074) 1.08
es/full/all/es2017 168758826 ns/iter (± 25854740) 158335894 ns/iter (± 12317086) 1.07
es/full/all/es2018 169573823 ns/iter (± 23379156) 154874811 ns/iter (± 8592168) 1.09
es/full/all/es2019 162645670 ns/iter (± 16318383) 152875156 ns/iter (± 11094405) 1.06
es/full/all/es2020 158380234 ns/iter (± 25797752) 149632083 ns/iter (± 8601890) 1.06
es/full/parser 766976 ns/iter (± 106459) 743836 ns/iter (± 31630) 1.03
es/full/base/fixer 27048 ns/iter (± 1021) 26274 ns/iter (± 953) 1.03
es/full/base/resolver_and_hygiene 95792 ns/iter (± 2780) 93585 ns/iter (± 6205) 1.02
serialization of ast node 215 ns/iter (± 2) 216 ns/iter (± 4) 1.00
serialization of serde 221 ns/iter (± 17) 220 ns/iter (± 3) 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.