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

refactor: invoke functions from runtime #2826

Merged
merged 31 commits into from
Jul 11, 2021
Merged

Conversation

eduardoboucas
Copy link
Member

@eduardoboucas eduardoboucas commented Jul 1, 2021

- Summary

This is the final PR for #2806. Unfortunately, I couldn't break it further down into smaller chunks because all the pieces are heavily interconnected.

I broke each change into its own commit and I'll add as much information as possible in comments, to make this as easy to review as possible.

@eduardoboucas eduardoboucas added the type: chore work needed to keep the product and development running smoothly label Jul 1, 2021
@github-actions
Copy link

github-actions bot commented Jul 1, 2021

📊 Benchmark results

Comparing with 8bfdb2f

Package size: 330 MB

(no change)

^  329 MB  329 MB  329 MB  329 MB  329 MB  331 MB  331 MB  331 MB  331 MB  329 MB  329 MB  329 MB  330 MB 
│   ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐    ┌──┐  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
│   |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |  |    |▒▒|  
└───┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴────┴──┴──>
    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

package.json Outdated Show resolved Hide resolved
src/lib/functions/background.js Show resolved Hide resolved
src/lib/functions/form-submissions-handler.js Show resolved Hide resolved
src/lib/functions/netlify-function.js Show resolved Hide resolved
src/lib/functions/netlify-function.js Show resolved Hide resolved
src/lib/functions/registry.js Show resolved Hide resolved
src/lib/functions/runtimes/js/index.js Show resolved Hide resolved
src/lib/functions/server.js Show resolved Hide resolved
src/lib/functions/synchronous.js Show resolved Hide resolved
@eduardoboucas eduardoboucas marked this pull request as ready for review July 2, 2021 12:56
@eduardoboucas eduardoboucas requested a review from a team as a code owner July 2, 2021 12:56
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

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

Woo, @eduardoboucas this is SO MUCH BETTER.

I added some comments and also noticed an issue with netlify-lambda.
Since netlify-lambda populates the configured functions directory, getBuildFunction will manage to detect it only if it was executed an initial time before reaching that code.

To reproduce:

  1. git clone https://github.com/erezrokah/netlify-build-reproductions
  2. git checkout netlify_lambda
  3. ntl dev
  4. See that netlify-lambda is not detected

If you run npm run build a single time the detection works

We can fix this by moving the detection code earlier in the flow.

src/lib/functions/netlify-function.js Outdated Show resolved Hide resolved
src/lib/functions/netlify-function.js Outdated Show resolved Hide resolved
src/lib/functions/netlify-function.js Outdated Show resolved Hide resolved
src/lib/functions/netlify-function.js Outdated Show resolved Hide resolved
src/lib/functions/registry.js Outdated Show resolved Hide resolved
src/lib/functions/runtimes/index.js Outdated Show resolved Hide resolved
src/lib/functions/runtimes/js/builders/zisi.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/lib/functions/registry.js Outdated Show resolved Hide resolved
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

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

Thanks for the followup @eduardoboucas,

Added 2 clarifications to the review

src/lib/functions/netlify-function.js Outdated Show resolved Hide resolved
src/lib/functions/runtimes/js/builders/zisi.js Outdated Show resolved Hide resolved
Copy link
Contributor

@erezrokah erezrokah left a comment

Choose a reason for hiding this comment

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

🚀

@erezrokah erezrokah enabled auto-merge (squash) July 11, 2021 08:12
@erezrokah erezrokah disabled auto-merge July 11, 2021 09:36
@erezrokah erezrokah enabled auto-merge (squash) July 11, 2021 10:50
@erezrokah erezrokah disabled auto-merge July 11, 2021 10:50
@erezrokah erezrokah enabled auto-merge (squash) July 11, 2021 10:50
@erezrokah erezrokah merged commit 2c6a57a into main Jul 11, 2021
@erezrokah erezrokah deleted the refactor/function-runtimes branch July 11, 2021 11:00
@ehmicky ehmicky mentioned this pull request Dec 15, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: chore work needed to keep the product and development running smoothly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants