Skip to content

Handle exported functions in ExportDeclarations for CJS/AMD/UMD emit - #58489

Merged
Jake Bailey (jakebailey) merged 6 commits into
microsoft:mainfrom
jakebailey:fix-58473
May 29, 2024
Merged

Handle exported functions in ExportDeclarations for CJS/AMD/UMD emit#58489
Jake Bailey (jakebailey) merged 6 commits into
microsoft:mainfrom
jakebailey:fix-58473

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Fixes#58473

Not 100% certain on this but the baselines look right. Feel free to make your own better fix for this, though; this was just my naive attempt.

Comment threadtests/baselines/reference/jsDeclarationsDefault.js Outdated
exports.e = e;
exports.f = f;
exports.g = g;
exports.h = hh;

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Example of this working, in the test case:

/** * @param {{x: string}} a * @param {{y: typeof b}} b */functionhh(a,b){returna.x&&b.y();}export{hhash};

@jakebailey

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) perf test this faster

@typescript-bot

TypeScript Bot (typescript-bot) commented May 9, 2024

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
perf test this faster✅ Started👀 Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols62,15462,154~~~p=1.000 n=6
Types50,24850,248~~~p=1.000 n=6
Memory used193,449k (± 0.93%)192,794k (± 0.76%)~192,144k195,787kp=0.298 n=6
Parse Time1.29s (± 0.98%)1.29s (± 1.44%)~1.26s1.31sp=0.622 n=6
Bind Time0.72s0.72s~~~p=1.000 n=6
Check Time9.52s (± 0.33%)9.52s (± 0.45%)~9.48s9.58sp=0.936 n=6
Emit Time2.65s (± 0.53%)2.65s (± 0.21%)~2.64s2.65sp=0.498 n=6
Total Time14.18s (± 0.19%)14.18s (± 0.33%)~14.13s14.25sp=0.936 n=6
angular-1 - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols944,110944,110~~~p=1.000 n=6
Types407,141407,141~~~p=1.000 n=6
Memory used1,221,993k (± 0.00%)1,222,062k (± 0.00%)+69k (+ 0.01%)1,222,039k1,222,098kp=0.020 n=6
Parse Time6.77s (± 0.52%)6.80s (± 0.49%)~6.75s6.84sp=0.296 n=6
Bind Time1.87s (± 0.48%)1.88s (± 0.65%)~1.86s1.89sp=0.445 n=6
Check Time31.08s (± 0.23%)31.12s (± 0.31%)~30.98s31.22sp=0.378 n=6
Emit Time14.80s (± 0.49%)14.78s (± 0.52%)~14.68s14.87sp=1.000 n=6
Total Time54.52s (± 0.25%)54.58s (± 0.25%)~54.37s54.78sp=0.470 n=6
mui-docs - node (v18.15.0, x64)
Errors55~~~p=1.000 n=6
Symbols1,961,2901,961,290~~~p=1.000 n=6
Types696,905696,905~~~p=1.000 n=6
Memory used1,778,084k (± 0.00%)1,778,075k (± 0.00%)~1,778,036k1,778,101kp=0.575 n=6
Parse Time6.78s (± 0.17%)6.77s (± 0.30%)~6.75s6.80sp=0.744 n=6
Bind Time2.31s (± 0.51%)2.31s (± 1.08%)~2.27s2.33sp=0.864 n=6
Check Time57.01s (± 0.35%)57.13s (± 0.56%)~56.71s57.52sp=0.810 n=6
Emit Time0.14s0.14s~~~p=1.000 n=6
Total Time66.24s (± 0.30%)66.35s (± 0.51%)~65.89s66.73sp=0.936 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,220,3171,220,267-50 (- 0.00%)~~p=0.001 n=6
Types258,942258,936-6 (- 0.00%)~~p=0.001 n=6
Memory used2,334,081k (± 0.03%)2,334,121k (± 0.03%)~2,333,442k2,335,497kp=0.810 n=6
Parse Time5.01s (± 0.48%)5.01s (± 1.10%)~4.95s5.11sp=0.687 n=6
Bind Time1.87s (± 0.73%)1.87s (± 0.48%)~1.86s1.88sp=0.803 n=6
Check Time33.51s (± 0.39%)33.57s (± 0.26%)~33.44s33.71sp=0.575 n=6
Emit Time2.64s (± 2.26%)2.66s (± 1.42%)~2.60s2.71sp=0.873 n=6
Total Time43.05s (± 0.32%)43.11s (± 0.32%)~42.86s43.27sp=0.298 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,220,3171,220,267-50 (- 0.00%)~~p=0.001 n=6
Types258,942258,936-6 (- 0.00%)~~p=0.001 n=6
Memory used2,410,712k (± 0.02%)2,435,652k (± 2.49%)~2,409,730k2,559,612kp=0.575 n=6
Parse Time7.79s (± 1.18%)7.79s (± 1.34%)~7.62s7.93sp=0.936 n=6
Bind Time2.51s (± 0.60%)2.50s (± 1.10%)~2.47s2.55sp=0.686 n=6
Check Time49.46s (± 0.27%)49.50s (± 0.22%)~49.38s49.68sp=0.575 n=6
Emit Time3.89s (± 3.70%)3.89s (± 1.85%)~3.82s3.98sp=0.810 n=6
Total Time63.63s (± 0.34%)63.69s (± 0.43%)~63.37s64.11sp=0.810 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols256,476256,426-50 (- 0.02%)~~p=0.001 n=6
Types104,239104,233-6 (- 0.01%)~~p=0.001 n=6
Memory used425,383k (± 0.02%)425,362k (± 0.03%)~425,281k425,568kp=0.423 n=6
Parse Time3.35s (± 0.78%)3.37s (± 0.67%)~3.35s3.40sp=0.279 n=6
Bind Time1.30s (± 0.93%)1.31s (± 0.64%)~1.29s1.31sp=1.000 n=6
Check Time17.74s (± 0.34%)17.69s (± 0.47%)~17.58s17.82sp=0.295 n=6
Emit Time1.37s (± 2.15%)1.37s (± 1.26%)~1.35s1.39sp=0.628 n=6
Total Time23.76s (± 0.31%)23.73s (± 0.46%)~23.59s23.90sp=0.689 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors3535~~~p=1.000 n=6
Symbols224,575224,575~~~p=1.000 n=6
Types93,78593,785~~~p=1.000 n=6
Memory used369,818k (± 0.04%)369,734k (± 0.02%)~369,635k369,855kp=0.378 n=6
Parse Time2.85s (± 0.75%)2.85s (± 0.87%)~2.81s2.88sp=1.000 n=6
Bind Time1.59s (± 1.17%)1.58s (± 0.77%)~1.57s1.60sp=0.933 n=6
Check Time15.56s (± 0.21%)15.57s (± 0.42%)~15.51s15.66sp=0.936 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time19.99s (± 0.22%)20.01s (± 0.42%)~19.91s20.12sp=0.810 n=6
vscode - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,810,1472,810,147~~~p=1.000 n=6
Types953,583953,583~~~p=1.000 n=6
Memory used2,981,816k (± 0.01%)2,981,795k (± 0.00%)~2,981,644k2,982,017kp=0.689 n=6
Parse Time16.93s (± 0.28%)16.95s (± 0.20%)~16.91s16.99sp=0.466 n=6
Bind Time5.04s (± 2.20%)5.02s (± 0.51%)~4.98s5.05sp=0.373 n=6
Check Time91.37s (± 3.45%)90.68s (± 3.59%)~88.11s94.89sp=0.810 n=6
Emit Time26.63s (± 9.58%)27.41s (± 8.72%)~24.30s29.26sp=0.423 n=6
Total Time139.97s (± 0.43%)140.06s (± 0.64%)~138.99s141.16sp=1.000 n=6
webpack - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols265,866265,866~~~p=1.000 n=6
Types108,424108,424~~~p=1.000 n=6
Memory used410,482k (± 0.01%)410,465k (± 0.01%)~410,419k410,498kp=0.471 n=6
Parse Time3.84s (± 1.25%)3.84s (± 0.65%)~3.80s3.87sp=0.872 n=6
Bind Time1.66s (± 0.89%)1.66s (± 0.45%)~1.65s1.67sp=0.934 n=6
Check Time16.90s (± 0.29%)16.92s (± 0.43%)~16.85s17.01sp=0.747 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time22.40s (± 0.15%)22.42s (± 0.32%)~22.34s22.53sp=0.936 n=6
xstate-main - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols524,576524,576~~~p=1.000 n=6
Types178,847178,847~~~p=1.000 n=6
Memory used462,578k (± 0.01%)462,562k (± 0.02%)~462,458k462,736kp=0.378 n=6
Parse Time3.89s (± 0.22%)3.88s (± 0.35%)~3.87s3.90sp=0.804 n=6
Bind Time1.44s (± 0.84%)1.44s (± 0.76%)~1.42s1.45sp=0.677 n=6
Check Time22.48s (± 0.90%)22.42s (± 0.82%)~22.22s22.66sp=0.689 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time27.80s (± 0.71%)27.75s (± 0.64%)~27.55s27.97sp=0.748 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamFor Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5.5.0 regression - Named exports of functions are not emitted for CommonJS

3 participants

@jakebailey@typescript-bot@rbuckton