Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

feat!: output pure ESM for .mjs files #1198

Merged
merged 5 commits into from
Sep 5, 2022
Merged

Conversation

eduardoboucas
Copy link
Member

Summary

Currently, ESM functions are transpiled down to CommonJS. With this PR, we'll output pure ESM functions when:

  • The input function file has the .mjs extension, and
  • The zisi_pure_esm_mjs feature flag is on

Part of #750.

@eduardoboucas eduardoboucas added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Sep 5, 2022
@eduardoboucas eduardoboucas requested a review from a team September 5, 2022 14:58
@eduardoboucas eduardoboucas changed the title feat!: output pure ESM for .mjs files feat!: output pure ESM for .mjs files Sep 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2022

⏱ Benchmark results

Comparing with e15da2c

largeDepsEsbuild: 8.4s

⬆️ 13.71% increase vs. e15da2c

^                                   8.5s                                                            8.4s  
│                                   ┌──┐                            8.2s                            ┌──┐  
│                                   |  |                            ┌──┐                            |▒▒|  
│   7.1s                            |  |            7.1s            |  |                    7.3s    |▒▒|  
│ ──┌──┐────6.9s────────────────────┼──┼────────────┌──┐────6.9s────┼──┼────────────────────┌──┐────|▒▒|──
│   |  |    ┌──┐    6.4s            |  |    6.5s    |  |    ┌──┐    |  |            6.2s    |  |    |▒▒|  
│   |  |    |  |    ┌──┐     6s     |  |    ┌──┐    |  |    |  |    |  |    5.9s    ┌──┐    |  |    |▒▒|  
│   |  |    |  |    |  |    ┌──┐    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

largeDepsNft: 44.2s

⬆️ 20.77% increase vs. e15da2c

^                                  46.8s                                                                  
│                                   ┌──┐                            44s                            44.2s  
│                                   |  |                            ┌──┐                            ┌──┐  
│                                   |  |                            |  |                            |▒▒|  
│                                   |  |                            |  |                            |▒▒|  
│  35.5s   34.4s                    |  |           35.4s            |  |                    35s     |▒▒|  
│ ──┌──┐────┌──┐────────────────────┼──┼───32.3s────┌──┐────────────┼──┼────────────────────┌──┐────|▒▒|──
│   |  |    |  |    30s    29.9s    |  |    ┌──┐    |  |            |  |           29.5s    |  |    |▒▒|  
│   |  |    |  |    ┌──┐    ┌──┐    |  |    |  |    |  |            |  |   27.2s    ┌──┐    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    ┌──┐    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |            |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    n/a     |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────────────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

largeDepsZisi: 1m 0.2s

⬆️ 10.75% increase vs. e15da2c

^                                 1m 4.3s                                                                 
│                                   ┌──┐                                                          1m 0.2s 
│                                   |  |                           59.4s                            ┌──┐  
│  53.1s                            |  |           54.4s            ┌──┐                   53.7s    |▒▒|  
│   ┌──┐   52.9s                    |  |            ┌──┐   51.1s    |  |                    ┌──┐    |▒▒|  
│ ──┼──┼────┌──┐────────────────────┼──┼───46.9s────┼──┼────┌──┐────┼──┼────────────────────┼──┼────|▒▒|──
│   |  |    |  |    45s    44.4s    |  |    ┌──┐    |  |    |  |    |  |           44.4s    |  |    |▒▒|  
│   |  |    |  |    ┌──┐    ┌──┐    |  |    |  |    |  |    |  |    |  |   41.7s    ┌──┐    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    T-12    T-11    T-10    T-9     T-8     T-7     T-6     T-5     T-4     T-3     T-2     T-1      T    
Legend

@eduardoboucas eduardoboucas merged commit 950b624 into main Sep 5, 2022
@eduardoboucas eduardoboucas deleted the feat/pure-esm-mjs branch September 5, 2022 16:05
Skn0tt pushed a commit to netlify/build that referenced this pull request May 21, 2024
)

* feat: output pure ESM for .mjs files

* chore: add comment to test

* refactor: simplify `outExtension` generation

* chore: update test

* refactor: remove unused import
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants