Skip to content

Commit

Permalink
fix(es/module): Fix jsc.paths for projects using pnpm (#7918)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Sep 6, 2023
1 parent 5c00525 commit a86e9f3
Show file tree
Hide file tree
Showing 45 changed files with 1,092 additions and 63 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ target/

.DS_Store

node_modules/
/node_modules/

# Flamegraph
*.html
Expand All @@ -42,7 +42,6 @@ package-lock.json
.COVERAGE_DIR

**/*~
**/node_modules
**/.DS_Store

pkg/
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"**/CVS": true,
"**/.DS_Store": true,
"**/*.bk": true,
"**/node_modules": true,
"**/target": true
},
"[rust]": {
Expand Down
93 changes: 47 additions & 46 deletions bindings/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/binding_core_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tracing-chrome = "0.5.0"
tracing-futures = "0.2.5"
tracing-subscriber = { version = "0.3.9", features = ["env-filter"] }

swc_core = { version = "0.82.10", features = [
swc_core = { version = "0.83.0", features = [
"allocator_node",
"ecma_ast",
"ecma_codegen",
Expand Down
2 changes: 1 addition & 1 deletion bindings/binding_core_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ anyhow = "1.0.66"
getrandom = { version = "0.2.10", features = ["js"] }
serde = { version = "1", features = ["derive"] }
serde-wasm-bindgen = "0.4.5"
swc_core = { version = "0.82.10", features = [
swc_core = { version = "0.83.0", features = [
"ecma_ast_serde",
"ecma_codegen",
"binding_macro_wasm",
Expand Down
2 changes: 1 addition & 1 deletion bindings/swc_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ relative-path = "1.6.1"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1", features = ["unbounded_depth"] }
sourcemap = "6.2.2"
swc_core = { version = "0.82.10", features = [
swc_core = { version = "0.83.0", features = [
"trace_macro",
"common_concurrent",
"base_concurrent",
Expand Down
13 changes: 13 additions & 0 deletions crates/swc/tests/fixture/jsc-paths/vercel-site/1/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"jsc": {
"parser": {
"syntax": "typescript"
},
"baseUrl": ".",
"paths": {
"*": [
"./*"
]
}
}
}
21 changes: 21 additions & 0 deletions crates/swc/tests/fixture/jsc-paths/vercel-site/1/input/identity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { nanoid } from 'nanoid';
import { fnv1a } from '../fnv1a';

export const VERCEL_AUTHENTICATED_PREFIX = 'v_';

/**
* 1.0 -- random IDs from nanoid() with default length. Authenticated IDs are v_vercelUserID.
*/
export const IDENTITY_VERSION = '1.0';

export function generateRandomID(): string {
return nanoid();
}

export function formatAuthenticatedID(vercelUserUid: string): string {
return `${VERCEL_AUTHENTICATED_PREFIX}${vercelUserUid}`;
}

export function computeIdentityVersion(): string {
return String(fnv1a(IDENTITY_VERSION));
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

1 comment on commit a86e9f3

@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: a86e9f3 Previous: 0db25a2 Ratio
es/full/bugs-1 281446 ns/iter (± 4713) 290433 ns/iter (± 13281) 0.97
es/full/minify/libraries/antd 1308539670 ns/iter (± 14215141) 1329180516 ns/iter (± 18631869) 0.98
es/full/minify/libraries/d3 279231022 ns/iter (± 4714351) 273115269 ns/iter (± 3284228) 1.02
es/full/minify/libraries/echarts 1065879422 ns/iter (± 12322133) 1054533345 ns/iter (± 19835926) 1.01
es/full/minify/libraries/jquery 83839776 ns/iter (± 363365) 84160036 ns/iter (± 473019) 1.00
es/full/minify/libraries/lodash 96702540 ns/iter (± 1287241) 97283284 ns/iter (± 371163) 0.99
es/full/minify/libraries/moment 49547290 ns/iter (± 209341) 49478523 ns/iter (± 234477) 1.00
es/full/minify/libraries/react 17833131 ns/iter (± 27384) 18107904 ns/iter (± 86036) 0.98
es/full/minify/libraries/terser 217106188 ns/iter (± 846177) 215200945 ns/iter (± 1095047) 1.01
es/full/minify/libraries/three 386504721 ns/iter (± 2405107) 382559202 ns/iter (± 3916009) 1.01
es/full/minify/libraries/typescript 2642061415 ns/iter (± 17586945) 2646509482 ns/iter (± 36322506) 1.00
es/full/minify/libraries/victory 572402185 ns/iter (± 13786019) 559475084 ns/iter (± 6255747) 1.02
es/full/minify/libraries/vue 118938525 ns/iter (± 426863) 118571681 ns/iter (± 549691) 1.00
es/full/codegen/es3 35024 ns/iter (± 253) 33957 ns/iter (± 193) 1.03
es/full/codegen/es5 34677 ns/iter (± 337) 33875 ns/iter (± 246) 1.02
es/full/codegen/es2015 34741 ns/iter (± 205) 33922 ns/iter (± 88) 1.02
es/full/codegen/es2016 34863 ns/iter (± 162) 33979 ns/iter (± 165) 1.03
es/full/codegen/es2017 34901 ns/iter (± 96) 33907 ns/iter (± 69) 1.03
es/full/codegen/es2018 34859 ns/iter (± 120) 33978 ns/iter (± 154) 1.03
es/full/codegen/es2019 34857 ns/iter (± 139) 34033 ns/iter (± 57) 1.02
es/full/codegen/es2020 34828 ns/iter (± 160) 33939 ns/iter (± 120) 1.03
es/full/all/es3 168213081 ns/iter (± 745121) 170331235 ns/iter (± 1196070) 0.99
es/full/all/es5 160411656 ns/iter (± 1008039) 163756801 ns/iter (± 1849589) 0.98
es/full/all/es2015 122007333 ns/iter (± 1055692) 122582395 ns/iter (± 796387) 1.00
es/full/all/es2016 121298526 ns/iter (± 997369) 122082233 ns/iter (± 1175825) 0.99
es/full/all/es2017 119882264 ns/iter (± 517734) 120751803 ns/iter (± 1147045) 0.99
es/full/all/es2018 116773650 ns/iter (± 499869) 118793547 ns/iter (± 804320) 0.98
es/full/all/es2019 116825901 ns/iter (± 532097) 118950139 ns/iter (± 1251212) 0.98
es/full/all/es2020 112381928 ns/iter (± 545603) 113132152 ns/iter (± 877511) 0.99
es/full/parser 499090 ns/iter (± 14134) 493513 ns/iter (± 6000) 1.01
es/full/base/fixer 18028 ns/iter (± 102) 19028 ns/iter (± 144) 0.95
es/full/base/resolver_and_hygiene 80770 ns/iter (± 383) 81227 ns/iter (± 391) 0.99
serialization of serde 297 ns/iter (± 3) 280 ns/iter (± 1) 1.06
css/minify/libraries/bootstrap 28457803 ns/iter (± 142936) 28550938 ns/iter (± 335815) 1.00
css/visitor/compare/clone 1689140 ns/iter (± 7190) 1666053 ns/iter (± 5496) 1.01
css/visitor/compare/visit_mut_span 1806724 ns/iter (± 7866) 1795292 ns/iter (± 5420) 1.01
css/visitor/compare/visit_mut_span_panic 1845963 ns/iter (± 7792) 1865948 ns/iter (± 5494) 0.99
css/visitor/compare/fold_span 2606308 ns/iter (± 13749) 2579926 ns/iter (± 10894) 1.01
css/visitor/compare/fold_span_panic 2803923 ns/iter (± 15473) 2767827 ns/iter (± 8125) 1.01
css/lexer/bootstrap_5_1_3 4524068 ns/iter (± 3273) 4502524 ns/iter (± 4226) 1.00
css/lexer/foundation_6_7_4 3770817 ns/iter (± 1824) 3761133 ns/iter (± 6440) 1.00
css/lexer/tailwind_3_1_1 719045 ns/iter (± 320) 719744 ns/iter (± 1477) 1.00
css/parser/bootstrap_5_1_3 19633023 ns/iter (± 72351) 19366917 ns/iter (± 227025) 1.01
css/parser/foundation_6_7_4 15561375 ns/iter (± 51304) 15335995 ns/iter (± 28330) 1.01
css/parser/tailwind_3_1_1 3068301 ns/iter (± 4015) 2920080 ns/iter (± 15325) 1.05
es/codegen/colors 719448 ns/iter (± 397745) 731855 ns/iter (± 398135) 0.98
es/codegen/large 2890783 ns/iter (± 1526670) 3063935 ns/iter (± 1620277) 0.94
es/codegen/with-parser/colors 45345 ns/iter (± 88) 44606 ns/iter (± 562) 1.02
es/codegen/with-parser/large 491684 ns/iter (± 491) 489396 ns/iter (± 1039) 1.00
es/minify/libraries/antd 1221283888 ns/iter (± 20818333) 1177889445 ns/iter (± 19411153) 1.04
es/minify/libraries/d3 242637769 ns/iter (± 1214776) 242845531 ns/iter (± 669607) 1.00
es/minify/libraries/echarts 938389318 ns/iter (± 7996157) 920883207 ns/iter (± 16828118) 1.02
es/minify/libraries/jquery 75462964 ns/iter (± 1055109) 75635847 ns/iter (± 783946) 1.00
es/minify/libraries/lodash 88713829 ns/iter (± 330523) 89104175 ns/iter (± 489069) 1.00
es/minify/libraries/moment 44036907 ns/iter (± 299934) 45192052 ns/iter (± 571488) 0.97
es/minify/libraries/react 16088190 ns/iter (± 39085) 16411022 ns/iter (± 100622) 0.98
es/minify/libraries/terser 188721415 ns/iter (± 1525543) 190449129 ns/iter (± 1150391) 0.99
es/minify/libraries/three 324028473 ns/iter (± 1462053) 324305963 ns/iter (± 1490128) 1.00
es/minify/libraries/typescript 2261348417 ns/iter (± 8764552) 2304343786 ns/iter (± 56290371) 0.98
es/minify/libraries/victory 476719694 ns/iter (± 1191663) 477721621 ns/iter (± 2276666) 1.00
es/minify/libraries/vue 107062977 ns/iter (± 245320) 109328302 ns/iter (± 1073560) 0.98
es/visitor/compare/clone 1935829 ns/iter (± 2381) 1981275 ns/iter (± 1606) 0.98
es/visitor/compare/visit_mut_span 2276908 ns/iter (± 4413) 2316815 ns/iter (± 3595) 0.98
es/visitor/compare/visit_mut_span_panic 2322928 ns/iter (± 2090) 2354792 ns/iter (± 4989) 0.99
es/visitor/compare/fold_span 3387047 ns/iter (± 8234) 3473764 ns/iter (± 7627) 0.98
es/visitor/compare/fold_span_panic 3499996 ns/iter (± 4591) 3608813 ns/iter (± 12145) 0.97
es/lexer/colors 12762 ns/iter (± 34) 13276 ns/iter (± 77) 0.96
es/lexer/angular 6072341 ns/iter (± 13529) 6129151 ns/iter (± 2360) 0.99
es/lexer/backbone 774517 ns/iter (± 2185) 794770 ns/iter (± 2517) 0.97
es/lexer/jquery 4448339 ns/iter (± 13413) 4543734 ns/iter (± 10772) 0.98
es/lexer/jquery mobile 6791351 ns/iter (± 12228) 6974746 ns/iter (± 31314) 0.97
es/lexer/mootools 3509842 ns/iter (± 3835) 3621360 ns/iter (± 2626) 0.97
es/lexer/underscore 651092 ns/iter (± 888) 660040 ns/iter (± 255) 0.99
es/lexer/three 21073747 ns/iter (± 30099) 21538080 ns/iter (± 31176) 0.98
es/lexer/yui 3785242 ns/iter (± 16130) 3857361 ns/iter (± 6547) 0.98
es/parser/colors 27372 ns/iter (± 79) 26998 ns/iter (± 78) 1.01
es/parser/angular 13629453 ns/iter (± 59427) 13518412 ns/iter (± 89232) 1.01
es/parser/backbone 2004740 ns/iter (± 7106) 1987854 ns/iter (± 6999) 1.01
es/parser/jquery 10966251 ns/iter (± 64688) 10839002 ns/iter (± 44842) 1.01
es/parser/jquery mobile 16743168 ns/iter (± 37863) 16621310 ns/iter (± 38550) 1.01
es/parser/mootools 8440413 ns/iter (± 48990) 8366491 ns/iter (± 25245) 1.01
es/parser/underscore 1731649 ns/iter (± 8169) 1710814 ns/iter (± 9667) 1.01
es/parser/three 48901875 ns/iter (± 576228) 46470165 ns/iter (± 197349) 1.05
es/parser/yui 8355963 ns/iter (± 51729) 8231755 ns/iter (± 46467) 1.02
es/preset-env/usage/builtin_type 135868 ns/iter (± 32178) 136219 ns/iter (± 32200) 1.00
es/preset-env/usage/property 16646 ns/iter (± 127) 16818 ns/iter (± 75) 0.99
es/resolver/typescript 91162423 ns/iter (± 1187244) 89947237 ns/iter (± 1968502) 1.01
es/fixer/typescript 64308060 ns/iter (± 1149032) 63060744 ns/iter (± 1070425) 1.02
es/hygiene/typescript 129681341 ns/iter (± 3147050) 133925975 ns/iter (± 3492106) 0.97
es/resolver_with_hygiene/typescript 241488906 ns/iter (± 1096773) 245109514 ns/iter (± 4376135) 0.99
es/visitor/base-perf/module_clone 58466 ns/iter (± 316) 59501 ns/iter (± 372) 0.98
es/visitor/base-perf/fold_empty 62559 ns/iter (± 230) 63629 ns/iter (± 332) 0.98
es/visitor/base-perf/fold_noop_impl_all 62930 ns/iter (± 275) 63293 ns/iter (± 229) 0.99
es/visitor/base-perf/fold_noop_impl_vec 62679 ns/iter (± 223) 64041 ns/iter (± 319) 0.98
es/visitor/base-perf/boxing_boxed_clone 55 ns/iter (± 0) 56 ns/iter (± 0) 0.98
es/visitor/base-perf/boxing_unboxed_clone 40 ns/iter (± 0) 40 ns/iter (± 0) 1
es/visitor/base-perf/boxing_boxed 109 ns/iter (± 0) 109 ns/iter (± 0) 1
es/visitor/base-perf/boxing_unboxed 78 ns/iter (± 0) 78 ns/iter (± 0) 1
es/visitor/base-perf/visit_empty 0 ns/iter (± 0) 0 ns/iter (± 0) NaN
es/visitor/base-perf/visit_contains_this 2521 ns/iter (± 9) 2523 ns/iter (± 12) 1.00
es/base/parallel/resolver/typescript 4514988160 ns/iter (± 193417253) 3618130616 ns/iter (± 266363016) 1.25
es/base/parallel/hygiene/typescript 1462564280 ns/iter (± 14119610) 1509793152 ns/iter (± 77207379) 0.97
misc/visitors/time-complexity/time 5 136 ns/iter (± 6) 137 ns/iter (± 2) 0.99
misc/visitors/time-complexity/time 10 398 ns/iter (± 3) 273 ns/iter (± 37) 1.46
misc/visitors/time-complexity/time 15 676 ns/iter (± 5) 691 ns/iter (± 6) 0.98
misc/visitors/time-complexity/time 20 1169 ns/iter (± 2) 913 ns/iter (± 10) 1.28
misc/visitors/time-complexity/time 40 3564 ns/iter (± 57) 3651 ns/iter (± 55) 0.98
misc/visitors/time-complexity/time 60 7384 ns/iter (± 69) 7719 ns/iter (± 44) 0.96
es/full-target/es2016 229257 ns/iter (± 709) 229957 ns/iter (± 870) 1.00
es/full-target/es2017 218712 ns/iter (± 823) 221035 ns/iter (± 1255) 0.99
es/full-target/es2018 208881 ns/iter (± 911) 208154 ns/iter (± 888) 1.00
es2020_nullish_coalescing 72415 ns/iter (± 419) 72880 ns/iter (± 601) 0.99
es2020_optional_chaining 80016 ns/iter (± 207) 79698 ns/iter (± 426) 1.00
es2022_class_properties 116106 ns/iter (± 385) 116071 ns/iter (± 313) 1.00
es2018_object_rest_spread 75402 ns/iter (± 328) 75711 ns/iter (± 312) 1.00
es2019_optional_catch_binding 67111 ns/iter (± 260) 65645 ns/iter (± 394) 1.02
es2017_async_to_generator 64658 ns/iter (± 171) 66116 ns/iter (± 252) 0.98
es2016_exponentiation 66595 ns/iter (± 176) 67094 ns/iter (± 166) 0.99
es2015_arrow 72603 ns/iter (± 262) 73104 ns/iter (± 407) 0.99
es2015_block_scoped_fn 68656 ns/iter (± 210) 70166 ns/iter (± 236) 0.98
es2015_block_scoping 123717 ns/iter (± 645) 124123 ns/iter (± 968) 1.00

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

Please sign in to comment.