Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include resolved included_files in response of zipFunction #1098

Merged
merged 2 commits into from Jun 2, 2022

Conversation

danez
Copy link
Contributor

@danez danez commented May 30, 2022

Summary

Refs netlify/cli#4454

cli counterpart: netlify/cli#4619

Return the resolved paths of included_files from the config. This will allow the cli to watch these files and rebuild the function on demand.

A picture of a cute animal (not mandatory, but encouraged)

H30cfc3adb41641e497c1ce2f446b091aV

@danez danez added type: feature code contributing to the implementation of a feature and/or user facing functionality area: functions labels May 30, 2022
@danez danez marked this pull request as ready for review May 30, 2022 17:47
@danez danez requested a review from a team May 30, 2022 17:47
@github-actions
Copy link
Contributor

⏱ Benchmark results

Comparing with 0d22eac

largeDepsEsbuild: 7.6s

⬆️ 14.11% increase vs. 0d22eac

^   8.1s                                                                                                  
│   ┌──┐    7.8s                                                                                    7.6s  
│   |  |    ┌──┐            7.2s                                                                    ┌──┐  
│   |  |    |  |            ┌──┐    6.8s                                            6.8s            |▒▒|  
│ ──┼──┼────┼──┼────6.3s────┼──┼────┌──┐────6.5s────6.5s────6.5s────────────────────┌──┐────6.6s────|▒▒|──
│   |  |    |  |    ┌──┐    |  |    |  |    ┌──┐    ┌──┐    ┌──┐    6.2s    6.3s    |  |    ┌──┐    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    ┌──┐    ┌──┐    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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: 36.1s

⬆️ 15.80% increase vs. 0d22eac

^  37.5s    37s                                                                                           
│   ┌──┐    ┌──┐                                                                                   36.1s  
│   |  |    |  |                                                                                    ┌──┐  
│   |  |    |  |            32s    31.7s                   31.4s                                    |▒▒|  
│ ──┼──┼────┼──┼───30.5s────┌──┐────┌──┐───30.1s───29.6s────┌──┐───────────29.6s────30s────29.4s────|▒▒|──
│   |  |    |  |    ┌──┐    |  |    |  |    ┌──┐    ┌──┐    |  |   28.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

tests/main.js Outdated Show resolved Hide resolved
src/runtimes/node/index.ts Outdated Show resolved Hide resolved
tests/main.js Outdated Show resolved Hide resolved
eduardoboucas
eduardoboucas previously approved these changes Jun 2, 2022
Copy link
Member

@eduardoboucas eduardoboucas left a comment

Choose a reason for hiding this comment

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

Great work! I wonder if there's anything we could/should do to make the terminology clearer, because we have srcFiles (which represents files identified by the bundler) and includedFiles (which represents files identified by the user), and that might not be obvious by the naming alone?

What do you think? Can we rename something to make it clearer? Or maybe some comments to help guide people in the right direction?

@eduardoboucas
Copy link
Member

Oh, I should've clarified that my questions above are non-blocking. I think it's fine to ship this as is, just wondering if there's anything we should do in a follow up issue/PR.

srcFiles: [...includedPaths, mainFile],
includedFiles: filterExcludedPaths(includedFilePaths, excludedPaths),
srcFiles: [...srcFiles, ...includedPaths, mainFile],
includedFiles: includedPaths,
Copy link
Contributor Author

@danez danez Jun 2, 2022

Choose a reason for hiding this comment

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

I just made some minor adjustments to every bundler, so that we do not iterate over includedFilePaths twice.

Copy link
Member

Choose a reason for hiding this comment

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

Nice! That also makes things a bit clearer, IMO.

@danez
Copy link
Contributor Author

danez commented Jun 2, 2022

Great work! I wonder if there's anything we could/should do to make the terminology clearer, because we have srcFiles (which represents files identified by the bundler) and includedFiles (which represents files identified by the user), and that might not be obvious by the naming alone?

What do you think? Can we rename something to make it clearer? Or maybe some comments to help guide people in the right direction?

Yeah it had me confused as well. There is also input which contains all files that are the input to the bundling, including resolved dependencies.
Also afaics every bundler slightly differs in what is included in srcFiles. I think we should definitely come back to this.

@eduardoboucas
Copy link
Member

I think we should definitely come back to this

Do you mind creating an issue so that is captured somewhere?

@danez
Copy link
Contributor Author

danez commented Jun 2, 2022

Created #1099

@danez danez added the automerge label Jun 2, 2022
@kodiakhq kodiakhq bot merged commit 830f9f2 into main Jun 2, 2022
@kodiakhq kodiakhq bot deleted the included_files-resolved branch June 2, 2022 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: functions automerge 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.

None yet

2 participants