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
6 changes: 3 additions & 3 deletions packages/edge-bundler/node/bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import semver from 'semver'
import tmp, { DirectoryResult } from 'tmp-promise'
import { test, expect } from 'vitest'

import { DenoBridge, LEGACY_DENO_VERSION_RANGE } from './bridge.js'
import { DenoBridge, DENO_VERSION_RANGE } from './bridge.js'
import { getPlatformTarget } from './platform.js'

const require = createRequire(import.meta.url)
const archiver = require('archiver')

const getMockDenoBridge = function (tmpDir: DirectoryResult, mockBinaryOutput: string) {
const latestVersion = semver.minVersion(LEGACY_DENO_VERSION_RANGE)?.version ?? ''
const latestVersion = semver.minVersion(DENO_VERSION_RANGE)?.version ?? ''
const data = new PassThrough()
const archive = archiver('zip', { zlib: { level: 9 } })

Expand Down Expand Up @@ -139,7 +139,7 @@ test('Does inherit environment variables if `extendEnv` is not set', async () =>

test('Provides actionable error message when downloaded binary cannot be executed', async () => {
const tmpDir = await tmp.dir()
const latestVersion = semver.minVersion(LEGACY_DENO_VERSION_RANGE)?.version ?? ''
const latestVersion = semver.minVersion(DENO_VERSION_RANGE)?.version ?? ''
const data = new PassThrough()
const archive = archiver('zip', { zlib: { level: 9 } })

Expand Down
10 changes: 2 additions & 8 deletions packages/edge-bundler/node/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const LEGACY_DENO_VERSION_RANGE = '1.39.0 - 2.2.4'
// 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 = '^2.4.2'
export const DENO_VERSION_RANGE = '^2.4.2'

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

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

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

private async downloadBinary() {
Expand Down
3 changes: 0 additions & 3 deletions packages/edge-bundler/node/bundler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,6 @@ test('Is backwards compatible with Deno 1.x', async () => {

await bundle([sourceDirectory], distPath, [], {
basePath,
featureFlags: {
edge_bundler_deno_v2: true,
},
systemLogger,
vendorDirectory: vendorDirectory.path,
})
Expand Down
1 change: 0 additions & 1 deletion packages/edge-bundler/node/feature_flags.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const defaultFlags = {
edge_bundler_generate_tarball: false,
edge_bundler_dry_run_generate_tarball: false,
edge_bundler_deno_v2: true,
}

type FeatureFlag = keyof typeof defaultFlags
Expand Down
4 changes: 2 additions & 2 deletions packages/edge-bundler/node/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import semver from 'semver'
import tmp from 'tmp-promise'
import { test, expect, vi } from 'vitest'

import { DenoBridge, LEGACY_DENO_VERSION_RANGE } from './bridge.js'
import { DenoBridge, DENO_VERSION_RANGE } from './bridge.js'
import { getPlatformTarget } from './platform.js'

const require = createRequire(import.meta.url)
const archiver = require('archiver')

test('Downloads the Deno CLI on demand and caches it for subsequent calls', async () => {
const latestVersion = semver.minVersion(LEGACY_DENO_VERSION_RANGE)?.version ?? ''
const latestVersion = semver.minVersion(DENO_VERSION_RANGE)?.version ?? ''
const mockBinaryOutput = `#!/usr/bin/env sh\n\necho "deno ${latestVersion}"`
const data = new PassThrough()
const archive = archiver('zip', { zlib: { level: 9 } })
Expand Down
Loading