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: deploy edge functions as tarballs #5942

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
os: [ubuntu-24.04, macos-14, windows-2022]
node-version: ['22']
# Must include the minimum deno version from the `DENO_VERSION_RANGE` constant in `node/bridge.ts`.
deno-version: ['v1.39.0', 'v1.46.3']
deno-version: ['v2.1.4']
include:
- os: ubuntu-24.04
# Earliest supported version
node-version: '14.16.0'
deno-version: 'v1.46.3'
deno-version: 'v2.1.4'
fail-fast: false
steps:
# Increasing the maximum number of open files. See:
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.46.3
deno-version: v2.1.4
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
- name: Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand Down
184 changes: 177 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/edge-bundler/deno/lib/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const loadWithRetry = (specifier: string, delay = 1000, maxTry = 3) => {
maxTry,
});
} catch (error) {
if (isTooManyTries(error)) {
if (error instanceof Error && isTooManyTries(error)) {
console.error(`Loading ${specifier} failed after ${maxTry} tries.`);
}
throw error;
Expand Down
11 changes: 4 additions & 7 deletions packages/edge-bundler/node/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,7 @@ import { getLogger, Logger } from './logger.js'
import { getBinaryExtension } from './platform.js'

const DENO_VERSION_FILE = 'version.txt'

// When updating DENO_VERSION_RANGE, ensure that the deno version
// on the netlify/buildbot build image satisfies this range!
// https://github.com/netlify/buildbot/blob/f9c03c9dcb091d6570e9d0778381560d469e78ad/build-image/noble/Dockerfile#L410
const DENO_VERSION_RANGE = '1.39.0 - 1.46.3'
const DENO_VERSION_RANGE = '^2.1.4'

type OnBeforeDownloadHook = () => void | Promise<void>
type OnAfterDownloadHook = (error?: Error) => void | Promise<void>
Expand All @@ -37,6 +33,7 @@ interface ProcessRef {
}

interface RunOptions {
cwd?: string
env?: NodeJS.ProcessEnv
extendEnv?: boolean
pipeOutput?: boolean
Expand Down Expand Up @@ -241,11 +238,11 @@ class DenoBridge {
// process, awaiting its execution.
async run(
args: string[],
{ env: inputEnv, extendEnv = true, rejectOnExitCode = true, stderr, stdout }: RunOptions = {},
{ cwd, env: inputEnv, extendEnv = true, rejectOnExitCode = true, stderr, stdout }: RunOptions = {},
) {
const { path: binaryPath } = await this.getBinaryPath()
const env = this.getEnvironmentVariables(inputEnv)
const options: Options = { env, extendEnv, reject: rejectOnExitCode }
const options: Options = { cwd, env, extendEnv, reject: rejectOnExitCode }

return DenoBridge.runWithBinary(binaryPath, args, { options, stderr, stdout })
}
Expand Down
1 change: 1 addition & 0 deletions packages/edge-bundler/node/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export enum BundleFormat {
ESZIP2 = 'eszip2',
JS = 'js',
TARBALL = 'tar',
}

export interface Bundle {
Expand Down
Loading
Loading