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: inline stage 2 ESZIP bundler #102

Merged
merged 1 commit into from
Aug 22, 2022
Merged

Conversation

eduardoboucas
Copy link
Member

Which problem is this pull request solving?

When bundling an edge function with the ESZIP format, Edge Bundler is fetching some logic from the edge bootstrap in order to generate the stage 2 file. In reality, this logic has very little to do with the bootstrap layer itself and is actually concerned with bundling, so it makes sense to move it to Edge Bundler.

By moving it, we're also reducing the number of network calls we need to make at build time, which are causing occasional errors.

@eduardoboucas eduardoboucas added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Aug 22, 2022
@@ -0,0 +1,47 @@
import { load } from "https://deno.land/x/eszip@v0.18.0/loader.ts";
Copy link
Member Author

Choose a reason for hiding this comment

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

This file was copied untouched from the edge bootstrap repo.

Some of the functions here are used by the edge bootstrap when generating the stage 1 ESZIP. We can live with the duplicated code for now, and later on we can change edge bootstrap so that the files are loaded from this repo instead. Conceptually, it makes more sense for the bootstrap to load bundling logic from the bundler repo than the other way around.

@@ -0,0 +1,4 @@
export const PUBLIC_SPECIFIER = "netlify:edge";
Copy link
Member Author

Choose a reason for hiding this comment

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

This file was copied untouched from the edge bootstrap repo.

@@ -0,0 +1,81 @@
import { build, LoadResponse } from 'https://deno.land/x/eszip@v0.18.0/mod.ts'
Copy link
Member Author

Choose a reason for hiding this comment

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

This file was copied untouched from the edge bootstrap repo.

@eduardoboucas eduardoboucas marked this pull request as ready for review August 22, 2022 14:33
@eduardoboucas eduardoboucas requested a review from a team August 22, 2022 14:33
Copy link
Contributor

@EwanValentine EwanValentine left a comment

Choose a reason for hiding this comment

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

Given this was mostly copied from another repo, approving as the change of location for that code makes sense

@eduardoboucas eduardoboucas merged commit 5df5291 into main Aug 22, 2022
Skn0tt pushed a commit to netlify/build that referenced this pull request Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

None yet

2 participants