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

feat: include side files with NFT #1614

Merged
merged 11 commits into from
Oct 13, 2023
Merged

feat: include side files with NFT #1614

merged 11 commits into from
Oct 13, 2023

Conversation

eduardoboucas
Copy link
Member

Summary

In the legacy zisi bundler , functions defined in a sub-directory had any sibling files recursively added to the bundle., regardless of whether they were statically required by the function or not.

As we try to remove this bundler entirely without breaking existing workflows, this PR ports that behaviour over to NFT, only when the default bundler is used (so that we don't affect functions explicitly opting in to nft).

@eduardoboucas eduardoboucas requested a review from a team as a code owner October 13, 2023 11:46
@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

⏱ Benchmark results

Comparing with 9f3dab8

largeDepsEsbuild: 2.6s

⬇️ 29.04% decrease vs. 9f3dab8

^                   3.6s                                                                                  
│                   ┌──┐                                    3.4s                            3.3s          
│   3.2s            |  |    3.2s                            ┌──┐                            ┌──┐          
│   ┌──┐            |  |    ┌──┐                            |  |                            |  |          
│   |  |            |  |    |  |    2.8s                    |  |                            |  |          
│ ──┼──┼────2.7s────┼──┼────┼──┼────┌──┐────2.7s────2.7s────┼──┼────2.6s────2.7s────────────┼──┼────2.6s──
│   |  |    ┌──┐    |  |    |  |    |  |    ┌──┐    ┌──┐    |  |    ┌──┐    ┌──┐    2.5s    |  |    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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: 7.6s

⬇️ 32.26% decrease vs. 9f3dab8

^                  11.6s                                                                                  
│                   ┌──┐                                                                                  
│  10.2s            |  |                                   10.7s                                          
│   ┌──┐            |  |    9.8s                            ┌──┐                            10s           
│   |  |            |  |    ┌──┐                            |  |                            ┌──┐          
│ ──┼──┼────────────┼──┼────┼──┼────8.7s────8.5s────8.4s────┼──┼────8.4s────────────────────┼──┼──────────
│   |  |    8.3s    |  |    |  |    ┌──┐    ┌──┐    ┌──┐    |  |    ┌──┐    8.2s            |  |          
│   |  |    ┌──┐    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    7.8s    |  |    7.6s  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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: 15.4s

⬇️ 30.27% decrease vs. 9f3dab8

^                  21.8s                                                                                  
│                   ┌──┐                                   20.6s                                          
│  19.9s            |  |   19.4s                            ┌──┐                            20s           
│   ┌──┐            |  |    ┌──┐                            |  |                            ┌──┐          
│   |  |            |  |    |  |                            |  |                            |  |          
│ ──┼──┼───16.2s────┼──┼────┼──┼───16.8s───16.2s───16.5s────┼──┼───16.1s───16.3s────────────┼──┼──────────
│   |  |    ┌──┐    |  |    |  |    ┌──┐    ┌──┐    ┌──┐    |  |    ┌──┐    ┌──┐   15.6s    |  |   15.4s  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    |  |    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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

Skn0tt
Skn0tt previously approved these changes Oct 13, 2023
Copy link
Contributor

@Skn0tt Skn0tt left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a remnant from Windows testing

Copy link
Contributor

Choose a reason for hiding this comment

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

oh it's not, it's junk!

import type { Stats } from 'fs'
import { basename } from 'path'

import { isJunk } from 'junk'
Copy link
Contributor

Choose a reason for hiding this comment

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

TIL about junk!

@eduardoboucas
Copy link
Member Author

@Skn0tt I pushed a8af287 with a change to the test, ensuring we run for all bundler variants and don't include the side files unless the default bundler is used.

Can you re-approve, please?

@eduardoboucas eduardoboucas merged commit bf7a4ac into main Oct 13, 2023
@eduardoboucas eduardoboucas deleted the feat/nft-side-files branch October 13, 2023 13:10
Skn0tt pushed a commit to netlify/build that referenced this pull request May 21, 2024
* feat: return `jsModuleFormat` property

* feat: add bundled paths to `inputs`

* feat: force bundler to NFT in V2 functions

* chore: fix test

* refactor: rename property

* feat: add CJS shim

* feat: include side files when NFT is the default bundler

* chore: remove whitespace

* chore: update test
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants