From a77d2b313eeba9f113cb4616f61936b2d78fd230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Bou=C3=A7as?= Date: Sat, 18 Oct 2025 10:24:09 +0100 Subject: [PATCH 1/3] feat!: split edge-functions package --- .github/workflows/release-please.yaml | 17 +++- .release-please-manifest.json | 3 +- eslint.config.js | 2 +- eslint_temporary_suppressions.js | 19 +---- package-lock.json | 47 ++++++++++- package.json | 3 +- packages/edge-functions/.gitignore | 5 +- .../{ => dev}/bootstrap-bundle.mjs | 0 packages/edge-functions/dev/package.json | 50 ++++++++++++ .../dev/{ => src}/deno/config.mjs | 0 .../dev/{ => src}/deno/errors.mjs | 0 .../dev/{ => src}/deno/invoke.mjs | 0 .../dev/{ => src}/deno/server.mjs | 0 .../dev/{ => src}/deno/workers/config.mjs | 0 .../dev/{ => src}/deno/workers/runner.mjs | 0 .../dev/{ => src}/deno/workers/types.ts | 0 .../dev/{ => src}/node/headers.ts | 0 .../dev/{ => src}/node/main.test.ts | 0 .../edge-functions/dev/{ => src}/node/main.ts | 0 .../dev/{ => src}/shared/types.ts | 0 packages/edge-functions/dev/tsconfig.json | 18 +++++ packages/edge-functions/dev/tsup.config.ts | 49 ++++++++++++ .../edge-functions/{ => prod}/CHANGELOG.md | 0 .../edge-functions/{ => prod}/package.json | 17 +--- .../{ => prod}/src/lib/config.ts | 0 .../{ => prod}/src/lib/edge-function.ts | 0 packages/edge-functions/prod/src/main.test.ts | 7 ++ .../edge-functions/{ => prod}/src/main.ts | 0 .../edge-functions/{ => prod}/tsconfig.json | 0 packages/edge-functions/prod/tsup.config.ts | 17 ++++ packages/edge-functions/src/version.test.ts | 10 --- packages/edge-functions/src/version.ts | 1 - packages/edge-functions/tsup.config.ts | 77 ------------------- release-please-config.json | 3 +- 34 files changed, 211 insertions(+), 134 deletions(-) rename packages/edge-functions/{ => dev}/bootstrap-bundle.mjs (100%) create mode 100644 packages/edge-functions/dev/package.json rename packages/edge-functions/dev/{ => src}/deno/config.mjs (100%) rename packages/edge-functions/dev/{ => src}/deno/errors.mjs (100%) rename packages/edge-functions/dev/{ => src}/deno/invoke.mjs (100%) rename packages/edge-functions/dev/{ => src}/deno/server.mjs (100%) rename packages/edge-functions/dev/{ => src}/deno/workers/config.mjs (100%) rename packages/edge-functions/dev/{ => src}/deno/workers/runner.mjs (100%) rename packages/edge-functions/dev/{ => src}/deno/workers/types.ts (100%) rename packages/edge-functions/dev/{ => src}/node/headers.ts (100%) rename packages/edge-functions/dev/{ => src}/node/main.test.ts (100%) rename packages/edge-functions/dev/{ => src}/node/main.ts (100%) rename packages/edge-functions/dev/{ => src}/shared/types.ts (100%) create mode 100644 packages/edge-functions/dev/tsconfig.json create mode 100644 packages/edge-functions/dev/tsup.config.ts rename packages/edge-functions/{ => prod}/CHANGELOG.md (100%) rename packages/edge-functions/{ => prod}/package.json (68%) rename packages/edge-functions/{ => prod}/src/lib/config.ts (100%) rename packages/edge-functions/{ => prod}/src/lib/edge-function.ts (100%) create mode 100644 packages/edge-functions/prod/src/main.test.ts rename packages/edge-functions/{ => prod}/src/main.ts (100%) rename packages/edge-functions/{ => prod}/tsconfig.json (100%) create mode 100644 packages/edge-functions/prod/tsup.config.ts delete mode 100644 packages/edge-functions/src/version.test.ts delete mode 100644 packages/edge-functions/src/version.ts delete mode 100644 packages/edge-functions/tsup.config.ts diff --git a/.github/workflows/release-please.yaml b/.github/workflows/release-please.yaml index 2a6ab993..a39233e8 100644 --- a/.github/workflows/release-please.yaml +++ b/.github/workflows/release-please.yaml @@ -108,13 +108,24 @@ jobs: env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - if: - ${{ steps.release.outputs['packages/edge-functions--release_created'] || github.event_name == + ${{ steps.release.outputs['packages/edge-functions/prod--release_created'] || github.event_name == 'workflow_dispatch' }} run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - npm publish packages/edge-functions/ --provenance --access=public || true + npm publish packages/edge-functions/prod/ --provenance --access=public || true else - npm publish packages/edge-functions/ --provenance --access=public + npm publish packages/edge-functions/prod/ --provenance --access=public + fi + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} + - if: + ${{ steps.release.outputs['packages/edge-functions/dev--release_created'] || github.event_name == + 'workflow_dispatch' }} + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + npm publish packages/edge-functions/dev/ --provenance --access=public || true + else + npm publish packages/edge-functions/dev/ --provenance --access=public fi env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 87519747..4a530c11 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -4,7 +4,8 @@ "packages/cache": "3.3.0", "packages/dev": "4.6.2", "packages/dev-utils": "4.3.0", - "packages/edge-functions": "2.19.0", + "packages/edge-functions/dev": "0.0.0", + "packages/edge-functions/prod": "2.19.0", "packages/functions/prod": "5.0.0", "packages/functions/dev": "1.0.0", "packages/headers": "2.1.0", diff --git a/eslint.config.js b/eslint.config.js index 91d0eed7..c0432e27 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -37,7 +37,7 @@ export default tseslint.config( // TODO: Move this to `edge-functions` package. { - ignores: ['packages/**/deno', 'packages/edge-functions/bootstrap-bundle.mjs'], + ignores: ['packages/**/deno', 'packages/edge-functions/dev/bootstrap-bundle.mjs'], }, // JavaScript-specific rules diff --git a/eslint_temporary_suppressions.js b/eslint_temporary_suppressions.js index 58d71360..69d7c5d1 100644 --- a/eslint_temporary_suppressions.js +++ b/eslint_temporary_suppressions.js @@ -336,32 +336,17 @@ export default [ }, }, { - files: ['packages/edge-functions/dev/node/main.test.ts'], + files: ['packages/edge-functions/dev/src/node/main.test.ts'], rules: { '@typescript-eslint/require-await': 'off', }, }, { - files: ['packages/edge-functions/dev/node/main.ts'], + files: ['packages/edge-functions/dev/src/node/main.ts'], rules: { '@typescript-eslint/no-unnecessary-condition': 'off', }, }, - { - files: ['packages/edge-functions/src/version.test.ts'], - rules: { - '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - }, - }, - { - files: ['packages/edge-functions/src/version.ts'], - rules: { - '@typescript-eslint/restrict-template-expressions': 'off', - }, - }, { files: ['packages/functions/dev/src/events.ts'], rules: { diff --git a/package-lock.json b/package-lock.json index d70b5cf2..f704b293 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,8 @@ "packages/runtime-utils", "packages/blobs", "packages/cache", - "packages/edge-functions", + "packages/edge-functions/prod", + "packages/edge-functions/dev", "packages/functions/prod", "packages/functions/dev", "packages/headers", @@ -2446,7 +2447,7 @@ } }, "node_modules/@netlify/edge-functions": { - "resolved": "packages/edge-functions", + "resolved": "packages/edge-functions/prod", "link": true }, "node_modules/@netlify/edge-functions-bootstrap": { @@ -2455,6 +2456,10 @@ "integrity": "sha512-v8QQihSbBHj3JxtJsHoepXALpNumD9M7egHoc8z62FYl5it34dWczkaJoFFopEyhiBVKi4K/n0ZYpdzwfujd6g==", "license": "MIT" }, + "node_modules/@netlify/edge-functions-dev": { + "resolved": "packages/edge-functions/dev", + "link": true + }, "node_modules/@netlify/functions": { "resolved": "packages/functions/prod", "link": true @@ -19374,7 +19379,7 @@ "@netlify/blobs": "10.1.0", "@netlify/config": "^23.2.0", "@netlify/dev-utils": "4.3.0", - "@netlify/edge-functions": "2.19.0", + "@netlify/edge-functions-dev": "0.0.0", "@netlify/functions-dev": "1.0.0", "@netlify/headers": "2.1.0", "@netlify/images": "1.3.0", @@ -19458,6 +19463,42 @@ "node": ">=18.0.0" } }, + "packages/edge-functions/dev": { + "name": "@netlify/edge-functions-dev", + "version": "0.0.0", + "license": "MIT", + "dependencies": { + "@netlify/dev-utils": "4.3.0", + "@netlify/edge-bundler": "^14.5.2", + "@netlify/edge-functions": "2.19.0", + "@netlify/edge-functions-bootstrap": "2.16.0", + "@netlify/runtime-utils": "2.2.0", + "get-port": "^7.1.0" + }, + "devDependencies": { + "execa": "^8.0.1", + "tsup": "^8.0.0", + "vitest": "^3.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "packages/edge-functions/prod": { + "name": "@netlify/edge-functions", + "version": "2.19.0", + "license": "MIT", + "dependencies": { + "@netlify/types": "2.1.0" + }, + "devDependencies": { + "tsup": "^8.0.0", + "vitest": "^3.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, "packages/functions": { "name": "@netlify/functions", "version": "5.0.0", diff --git a/package.json b/package.json index 4e8f7321..94944b82 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "packages/runtime-utils", "packages/blobs", "packages/cache", - "packages/edge-functions", + "packages/edge-functions/prod", + "packages/edge-functions/dev", "packages/functions/prod", "packages/functions/dev", "packages/headers", diff --git a/packages/edge-functions/.gitignore b/packages/edge-functions/.gitignore index aa2750f1..520d181c 100644 --- a/packages/edge-functions/.gitignore +++ b/packages/edge-functions/.gitignore @@ -1,3 +1,2 @@ -dist -dist-dev -dev/deno/bootstrap.mjs +dist/ +dev/src/deno/bootstrap.mjs diff --git a/packages/edge-functions/bootstrap-bundle.mjs b/packages/edge-functions/dev/bootstrap-bundle.mjs similarity index 100% rename from packages/edge-functions/bootstrap-bundle.mjs rename to packages/edge-functions/dev/bootstrap-bundle.mjs diff --git a/packages/edge-functions/dev/package.json b/packages/edge-functions/dev/package.json new file mode 100644 index 00000000..eb3619cc --- /dev/null +++ b/packages/edge-functions/dev/package.json @@ -0,0 +1,50 @@ +{ + "name": "@netlify/edge-functions-dev", + "version": "0.0.0", + "description": "Local emulation for Netlify Edge Functions", + "type": "module", + "engines": { + "node": ">=20.6.1" + }, + "main": "./dist/node/main.js", + "exports": { + ".": { + "types": "./dist/node/main.d.ts", + "default": "./dist/node/main.js" + } + }, + "types": "./dist/node/main.d.ts", + "files": [ + "dist/**/*" + ], + "scripts": { + "build": "tsup-node", + "prepack": "npm run build", + "test": "vitest run", + "test:dev": "vitest", + "dev": "tsup-node --watch" + }, + "keywords": [ + "netlify", + "edge functions" + ], + "license": "MIT", + "repository": "netlify/primitives", + "bugs": { + "url": "https://github.com/netlify/primitives/issues" + }, + "author": "Netlify Inc.", + "dependencies": { + "@netlify/dev-utils": "4.3.0", + "@netlify/edge-bundler": "^14.5.2", + "@netlify/edge-functions": "2.19.0", + "@netlify/edge-functions-bootstrap": "2.16.0", + "@netlify/runtime-utils": "2.2.0", + "get-port": "^7.1.0" + }, + "devDependencies": { + "execa": "^8.0.1", + "tsup": "^8.0.0", + "vitest": "^3.0.0" + } +} diff --git a/packages/edge-functions/dev/deno/config.mjs b/packages/edge-functions/dev/src/deno/config.mjs similarity index 100% rename from packages/edge-functions/dev/deno/config.mjs rename to packages/edge-functions/dev/src/deno/config.mjs diff --git a/packages/edge-functions/dev/deno/errors.mjs b/packages/edge-functions/dev/src/deno/errors.mjs similarity index 100% rename from packages/edge-functions/dev/deno/errors.mjs rename to packages/edge-functions/dev/src/deno/errors.mjs diff --git a/packages/edge-functions/dev/deno/invoke.mjs b/packages/edge-functions/dev/src/deno/invoke.mjs similarity index 100% rename from packages/edge-functions/dev/deno/invoke.mjs rename to packages/edge-functions/dev/src/deno/invoke.mjs diff --git a/packages/edge-functions/dev/deno/server.mjs b/packages/edge-functions/dev/src/deno/server.mjs similarity index 100% rename from packages/edge-functions/dev/deno/server.mjs rename to packages/edge-functions/dev/src/deno/server.mjs diff --git a/packages/edge-functions/dev/deno/workers/config.mjs b/packages/edge-functions/dev/src/deno/workers/config.mjs similarity index 100% rename from packages/edge-functions/dev/deno/workers/config.mjs rename to packages/edge-functions/dev/src/deno/workers/config.mjs diff --git a/packages/edge-functions/dev/deno/workers/runner.mjs b/packages/edge-functions/dev/src/deno/workers/runner.mjs similarity index 100% rename from packages/edge-functions/dev/deno/workers/runner.mjs rename to packages/edge-functions/dev/src/deno/workers/runner.mjs diff --git a/packages/edge-functions/dev/deno/workers/types.ts b/packages/edge-functions/dev/src/deno/workers/types.ts similarity index 100% rename from packages/edge-functions/dev/deno/workers/types.ts rename to packages/edge-functions/dev/src/deno/workers/types.ts diff --git a/packages/edge-functions/dev/node/headers.ts b/packages/edge-functions/dev/src/node/headers.ts similarity index 100% rename from packages/edge-functions/dev/node/headers.ts rename to packages/edge-functions/dev/src/node/headers.ts diff --git a/packages/edge-functions/dev/node/main.test.ts b/packages/edge-functions/dev/src/node/main.test.ts similarity index 100% rename from packages/edge-functions/dev/node/main.test.ts rename to packages/edge-functions/dev/src/node/main.test.ts diff --git a/packages/edge-functions/dev/node/main.ts b/packages/edge-functions/dev/src/node/main.ts similarity index 100% rename from packages/edge-functions/dev/node/main.ts rename to packages/edge-functions/dev/src/node/main.ts diff --git a/packages/edge-functions/dev/shared/types.ts b/packages/edge-functions/dev/src/shared/types.ts similarity index 100% rename from packages/edge-functions/dev/shared/types.ts rename to packages/edge-functions/dev/src/shared/types.ts diff --git a/packages/edge-functions/dev/tsconfig.json b/packages/edge-functions/dev/tsconfig.json new file mode 100644 index 00000000..c8b61a25 --- /dev/null +++ b/packages/edge-functions/dev/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "esnext", + "rootDir": "./", + "outDir": "./dist", + "allowJs": true, + "declaration": true, + "esModuleInterop": true, + "sourceMap": false, + "removeComments": false, + "strict": true, + "moduleResolution": "node", + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src"] +} diff --git a/packages/edge-functions/dev/tsup.config.ts b/packages/edge-functions/dev/tsup.config.ts new file mode 100644 index 00000000..83e071b7 --- /dev/null +++ b/packages/edge-functions/dev/tsup.config.ts @@ -0,0 +1,49 @@ +import fs from 'node:fs/promises' +import path from 'node:path' +import { fileURLToPath } from 'node:url' +import { argv } from 'node:process' + +import { getURL } from '@netlify/edge-functions-bootstrap/version' +import { execa } from 'execa' +import { defineConfig } from 'tsup' + +const __filename = fileURLToPath(import.meta.url) + +const BOOTSTRAP_FILENAME = 'bootstrap.mjs' + +export default defineConfig({ + clean: true, + outDir: 'dist/node', + entry: ['src/node/main.ts'], + format: ['esm'], + dts: true, + splitting: false, + watch: argv.includes('--watch'), + platform: 'node', + bundle: true, + + // Using a custom function to copy the contents of the `deno` directory and + // preserve the original structure, so that the relative path to the worker + // files is consistent. + onSuccess: async () => { + const bootstrapURL = await getURL() + const denoPath = path.resolve(path.dirname(__filename), 'src', 'deno') + const distPath = path.resolve(path.dirname(__filename), 'dist') + + await fs.cp(denoPath, path.resolve(distPath, 'deno'), { recursive: true }) + + // We need to bundle the bootstrap layer with the package because Deno + // does not support HTTP imports when inside a `node_modules` directory. + const distBootstrapPath = path.resolve(distPath, 'deno', BOOTSTRAP_FILENAME) + await execa('deno', ['run', '--allow-all', '--no-lock', 'bootstrap-bundle.mjs', bootstrapURL, distBootstrapPath], { + stdio: 'inherit', + }) + + // In addition to putting the bootstrap file in `dist`, we must also + // put it in the source directory so that the reference to the bootstrap + // file still works in tests and local development. This is not great. At + // least we're gitignoring the file so that it doesn't end up in version + // control. + await fs.cp(distBootstrapPath, path.resolve(denoPath, BOOTSTRAP_FILENAME)) + }, +}) diff --git a/packages/edge-functions/CHANGELOG.md b/packages/edge-functions/prod/CHANGELOG.md similarity index 100% rename from packages/edge-functions/CHANGELOG.md rename to packages/edge-functions/prod/CHANGELOG.md diff --git a/packages/edge-functions/package.json b/packages/edge-functions/prod/package.json similarity index 68% rename from packages/edge-functions/package.json rename to packages/edge-functions/prod/package.json index a480a399..4ab83de1 100644 --- a/packages/edge-functions/package.json +++ b/packages/edge-functions/prod/package.json @@ -11,20 +11,11 @@ ".": { "types": "./dist/main.d.ts", "default": "./dist/main.js" - }, - "./dev": { - "types": "./dist-dev/node/main.d.ts", - "default": "./dist-dev/node/main.js" - }, - "./version": { - "types": "./dist/version.d.ts", - "default": "./dist/version.js" } }, "types": "./dist/main.d.ts", "files": [ "dist/**/*", - "dist-dev/**/*", "deno/**/*" ], "scripts": { @@ -50,16 +41,10 @@ "test": "test" }, "devDependencies": { - "execa": "^8.0.1", "tsup": "^8.0.0", "vitest": "^3.0.0" }, "dependencies": { - "@netlify/dev-utils": "4.3.0", - "@netlify/edge-bundler": "^14.5.2", - "@netlify/edge-functions-bootstrap": "2.16.0", - "@netlify/runtime-utils": "2.2.0", - "@netlify/types": "2.1.0", - "get-port": "^7.1.0" + "@netlify/types": "2.1.0" } } diff --git a/packages/edge-functions/src/lib/config.ts b/packages/edge-functions/prod/src/lib/config.ts similarity index 100% rename from packages/edge-functions/src/lib/config.ts rename to packages/edge-functions/prod/src/lib/config.ts diff --git a/packages/edge-functions/src/lib/edge-function.ts b/packages/edge-functions/prod/src/lib/edge-function.ts similarity index 100% rename from packages/edge-functions/src/lib/edge-function.ts rename to packages/edge-functions/prod/src/lib/edge-function.ts diff --git a/packages/edge-functions/prod/src/main.test.ts b/packages/edge-functions/prod/src/main.test.ts new file mode 100644 index 00000000..ae57dd74 --- /dev/null +++ b/packages/edge-functions/prod/src/main.test.ts @@ -0,0 +1,7 @@ +import { expect, test } from 'vitest' + +import * as main from './main.js' + +test('Main file does not export anything', () => { + expect(Object.keys(main)).toStrictEqual([]) +}) diff --git a/packages/edge-functions/src/main.ts b/packages/edge-functions/prod/src/main.ts similarity index 100% rename from packages/edge-functions/src/main.ts rename to packages/edge-functions/prod/src/main.ts diff --git a/packages/edge-functions/tsconfig.json b/packages/edge-functions/prod/tsconfig.json similarity index 100% rename from packages/edge-functions/tsconfig.json rename to packages/edge-functions/prod/tsconfig.json diff --git a/packages/edge-functions/prod/tsup.config.ts b/packages/edge-functions/prod/tsup.config.ts new file mode 100644 index 00000000..9a088574 --- /dev/null +++ b/packages/edge-functions/prod/tsup.config.ts @@ -0,0 +1,17 @@ +import { argv } from 'node:process' + +import { defineConfig } from 'tsup' + +export default defineConfig([ + { + clean: true, + format: ['esm'], + entry: ['src/main.ts'], + tsconfig: 'tsconfig.json', + splitting: false, + bundle: true, + dts: true, + outDir: './dist', + watch: argv.includes('--watch'), + }, +]) diff --git a/packages/edge-functions/src/version.test.ts b/packages/edge-functions/src/version.test.ts deleted file mode 100644 index b9198a15..00000000 --- a/packages/edge-functions/src/version.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { describe, expect, test } from 'vitest' - -import * as bootstrap from '@netlify/edge-functions-bootstrap/version' -import { getURL } from './version.js' - -describe('`getURL`', () => { - test('Returns the URL of the bootstrap entry point', async () => { - expect(await getURL()).toBe(await bootstrap.getURL()) - }) -}) diff --git a/packages/edge-functions/src/version.ts b/packages/edge-functions/src/version.ts deleted file mode 100644 index 2735cb02..00000000 --- a/packages/edge-functions/src/version.ts +++ /dev/null @@ -1 +0,0 @@ -export { getURL } from '@netlify/edge-functions-bootstrap/version' diff --git a/packages/edge-functions/tsup.config.ts b/packages/edge-functions/tsup.config.ts deleted file mode 100644 index a0d9f2c5..00000000 --- a/packages/edge-functions/tsup.config.ts +++ /dev/null @@ -1,77 +0,0 @@ -import fs from 'node:fs/promises' -import path from 'node:path' -import { fileURLToPath } from 'node:url' -import { argv } from 'node:process' - -import { getURL } from '@netlify/edge-functions-bootstrap/version' -import { execa } from 'execa' -import { defineConfig } from 'tsup' - -const __filename = fileURLToPath(import.meta.url) - -const BOOTSTRAP_FILENAME = 'bootstrap.mjs' - -export default defineConfig([ - { - clean: true, - format: ['esm'], - entry: ['src/main.ts'], - tsconfig: 'tsconfig.json', - splitting: false, - bundle: true, - dts: true, - outDir: './dist', - watch: argv.includes('--watch'), - }, - { - clean: true, - format: ['esm'], - entry: ['src/version.ts'], - tsconfig: 'tsconfig.json', - splitting: false, - bundle: true, - dts: true, - outDir: './dist', - watch: argv.includes('--watch'), - }, - { - clean: true, - outDir: 'dist-dev/node', - entry: ['dev/node/main.ts'], - format: ['esm'], - dts: true, - splitting: false, - watch: argv.includes('--watch'), - platform: 'node', - bundle: true, - - // Using a custom function to copy the contents of the `deno` directory and - // preserve the original structure, so that the relative path to the worker - // files is consistent. - onSuccess: async () => { - const bootstrapURL = await getURL() - const denoPath = path.resolve(path.dirname(__filename), 'dev', 'deno') - const distPath = path.resolve(path.dirname(__filename), 'dist-dev') - - await fs.cp(denoPath, path.resolve(distPath, 'deno'), { recursive: true }) - - // We need to bundle the bootstrap layer with the package because Deno - // does not support HTTP imports when inside a `node_modukes` directory. - const distBootstrapPath = path.resolve(distPath, 'deno', BOOTSTRAP_FILENAME) - await execa( - 'deno', - ['run', '--allow-all', '--no-lock', 'bootstrap-bundle.mjs', bootstrapURL, distBootstrapPath], - { - stdio: 'inherit', - }, - ) - - // In addition to putting the bootstrap file in `dist-dev`, we must also - // put it in the source directory so that the reference to the bootstrap - // file still works in tests and local development. This is not great. At - // least we're gitignoring the file so that it doesn't end up in version - // control. - await fs.cp(distBootstrapPath, path.resolve(denoPath, BOOTSTRAP_FILENAME)) - }, - }, -]) diff --git a/release-please-config.json b/release-please-config.json index 251f6242..3b92a268 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -11,7 +11,8 @@ "packages/cache": {}, "packages/dev": {}, "packages/dev-utils": {}, - "packages/edge-functions": {}, + "packages/edge-functions/dev": {}, + "packages/edge-functions/prod": {}, "packages/functions/dev": {}, "packages/functions/prod": {}, "packages/headers": {}, From 16a1c403e7c194a6004e8e950bf6656457be0484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Bou=C3=A7as?= Date: Sat, 18 Oct 2025 10:26:27 +0100 Subject: [PATCH 2/3] fix: use new `@netlify/edge-functions-dev` package --- packages/dev/package.json | 2 +- packages/dev/src/main.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/dev/package.json b/packages/dev/package.json index e44c72fb..14ef0441 100644 --- a/packages/dev/package.json +++ b/packages/dev/package.json @@ -55,7 +55,7 @@ "@netlify/blobs": "10.1.0", "@netlify/config": "^23.2.0", "@netlify/dev-utils": "4.3.0", - "@netlify/edge-functions": "2.19.0", + "@netlify/edge-functions-dev": "0.0.0", "@netlify/functions-dev": "1.0.0", "@netlify/headers": "2.1.0", "@netlify/images": "1.3.0", diff --git a/packages/dev/src/main.ts b/packages/dev/src/main.ts index 46fcd239..f85a8504 100644 --- a/packages/dev/src/main.ts +++ b/packages/dev/src/main.ts @@ -13,7 +13,7 @@ import { type Logger, HTTPServer, } from '@netlify/dev-utils' -import { EdgeFunctionsHandler } from '@netlify/edge-functions/dev' +import { EdgeFunctionsHandler } from '@netlify/edge-functions-dev' import { FunctionsHandler } from '@netlify/functions-dev' import { HeadersHandler, type HeadersCollector } from '@netlify/headers' import { ImageHandler } from '@netlify/images' From e2cc1c67f6e4590952977ccbefd9e21fb3b6639a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Bou=C3=A7as?= Date: Sat, 18 Oct 2025 10:26:38 +0100 Subject: [PATCH 3/3] chore: update tests --- packages/otel/src/instrumentations/fetch.test.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/otel/src/instrumentations/fetch.test.ts b/packages/otel/src/instrumentations/fetch.test.ts index e492d3b6..37c7428b 100644 --- a/packages/otel/src/instrumentations/fetch.test.ts +++ b/packages/otel/src/instrumentations/fetch.test.ts @@ -87,9 +87,7 @@ describe('header exclusion', () => { describe('patched fetch', () => { const server = setupServer( - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access http.get('http://localhost:3000/ok', () => HttpResponse.json({ message: 'ok' })), - // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return http.post('http://localhost:3000/ok', () => HttpResponse.json({ message: 'ok' })), ) @@ -111,7 +109,6 @@ describe('patched fetch', () => { }) afterEach(async () => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-call server.resetHandlers() await shutdownTracers() })