Skip to content
Merged
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
8 changes: 5 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ jobs:
os: [ubuntu-24.04, macos-14, windows-2025]
node-version: ['22']
# Must include the minimum deno version from the `DENO_VERSION_RANGE` constant in `node/bridge.ts`.
deno-version: ['v2.4.2']
# We're adding v2.4.2 here because it's needed for the upcoming nimble release, so we can test
# those workflows ahead of time before we can update the base version across the board.
deno-version: ['v1.39.0', 'v2.2.4', 'v2.4.2']
include:
- os: ubuntu-24.04
# Earliest supported version
node-version: '18.14.0'
deno-version: 'v2.4.2'
deno-version: 'v2.2.4'
fail-fast: false
steps:
# Sets an output parameter if this is a release PR
Expand Down Expand Up @@ -157,7 +159,7 @@ jobs:
- name: Setup Deno
uses: denoland/setup-deno@v1
with:
deno-version: v2.4.2
deno-version: v2.2.4
if: ${{ !steps.release-check.outputs.IS_RELEASE }}
- name: Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ export async function loadESZIP(filename: string): Promise<ESZIP> {
return await V1.load(bytes);
}

function url2path(url: string) {
return join(...(new URL(url).pathname.split("/").filter(Boolean)));
function url2path(urlString: string) {
const url = new URL(urlString);
const tail = url.pathname.split("/").filter(Boolean);
const relativePath = tail.length === 0 ? [".root"] : tail;
Copy link
Member Author

Choose a reason for hiding this comment

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

return join(url.hostname, ...relativePath);
}

async function write(path: string, content: string) {
Expand Down
10 changes: 8 additions & 2 deletions packages/edge-bundler/node/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ 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
export const DENO_VERSION_RANGE = '^2.4.2'
export const DENO_VERSION_RANGE = '1.39.0 - 2.2.4'

const NEXT_DENO_VERSION_RANGE = '^2.4.2'

export type OnBeforeDownloadHook = () => void | Promise<void>
export type OnAfterDownloadHook = (error?: Error) => void | Promise<void>
Expand Down Expand Up @@ -67,7 +69,11 @@ export class DenoBridge {
this.onAfterDownload = options.onAfterDownload
this.onBeforeDownload = options.onBeforeDownload
this.useGlobal = options.useGlobal ?? true
this.versionRange = options.versionRange ?? DENO_VERSION_RANGE

const useNextDeno =
options.featureFlags?.edge_bundler_generate_tarball || options.featureFlags?.edge_bundler_deno_v2

this.versionRange = options.versionRange ?? (useNextDeno ? NEXT_DENO_VERSION_RANGE : DENO_VERSION_RANGE)
}

private async downloadBinary() {
Expand Down
3 changes: 3 additions & 0 deletions packages/edge-bundler/node/bundler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,9 @@ test('Emits a system log when import assertions are used', async () => {

await bundle([sourceDirectory], distPath, [], {
basePath,
featureFlags: {
edge_bundler_deno_v2: true,
},
systemLogger,
vendorDirectory: vendorDirectory.path,
})
Expand Down
5 changes: 4 additions & 1 deletion packages/edge-bundler/node/bundler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export const bundle = async (
basePath,
deno,
eszipPath,
featureFlags,
importMap,
internalFunctions,
log: logger,
Expand Down Expand Up @@ -210,6 +211,7 @@ interface GetFunctionConfigsOptions {
basePath: string
deno: DenoBridge
eszipPath?: string
featureFlags?: FeatureFlags
importMap: ImportMap
internalFunctions: EdgeFunction[]
log: Logger
Expand All @@ -220,6 +222,7 @@ const getFunctionConfigs = async ({
basePath,
deno,
eszipPath,
featureFlags,
importMap,
log,
internalFunctions,
Expand All @@ -242,7 +245,7 @@ const getFunctionConfigs = async ({
userFunctions: userFunctionsWithConfig,
}
} catch (err) {
if (!(err instanceof Error && err.cause === 'IMPORT_ASSERT') || !eszipPath) {
if (!(err instanceof Error && err.cause === 'IMPORT_ASSERT') || !eszipPath || !featureFlags?.edge_bundler_deno_v2) {
throw err
}

Expand Down
1 change: 1 addition & 0 deletions packages/edge-bundler/node/feature_flags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const defaultFlags = {
edge_bundler_generate_tarball: false,
edge_bundler_deno_v2: false,
}

type FeatureFlag = keyof typeof defaultFlags
Expand Down
Loading