diff --git a/CHANGELOG.md b/CHANGELOG.md index fa74a6ec..428638e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog -### [1.1.1](https://github.com/netlify/edge-bundler/compare/v1.1.0...v1.1.1) (2022-05-23) +### [1.2.0](https://github.com/netlify/edge-bundler/compare/v1.1.0...v1.2.0) (2022-05-25) + + +### Features + +* support for Edge Functions debugging ([#31](https://github.com/netlify/edge-bundler/issues/31)) ([d69c79e](https://github.com/netlify/edge-bundler/commit/d69c79edb75f0bd1cf177c8c2e7fde0d20f923c2)) ### Bug Fixes diff --git a/package-lock.json b/package-lock.json index be4d42e4..96cb7a23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@netlify/edge-bundler", - "version": "1.1.1", + "version": "1.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@netlify/edge-bundler", - "version": "1.1.1", + "version": "1.2.0", "license": "MIT", "dependencies": { "common-path-prefix": "^3.0.0", diff --git a/package.json b/package.json index 6b31c11d..87207016 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@netlify/edge-bundler", - "version": "1.1.1", + "version": "1.2.0", "description": "Intelligently prepare Netlify Edge Functions for deployment", "type": "module", "main": "./dist/index.js", diff --git a/src/server/server.ts b/src/server/server.ts index 45e5f454..1cd793a3 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -71,10 +71,21 @@ const prepareServer = ({ return startIsolate } +interface InspectSettings { + // Inspect mode enabled + enabled: boolean + + // Pause on breakpoints (i.e. "--brk") + pause: boolean + + // Host/port override (optional) + address?: string +} interface ServeOptions { certificatePath?: string debug?: boolean distImportMapPath?: string + inspectSettings?: InspectSettings importMaps?: ImportMapFile[] onAfterDownload?: LifecycleHook onBeforeDownload?: LifecycleHook @@ -83,10 +94,12 @@ interface ServeOptions { port: number } +// eslint-disable-next-line complexity, max-statements const serve = async ({ certificatePath, debug, distImportMapPath, + inspectSettings, formatExportTypeError, formatImportError, importMaps, @@ -122,6 +135,14 @@ const serve = async ({ flags.push('--quiet') } + if (inspectSettings && inspectSettings.enabled) { + if (inspectSettings.pause) { + flags.push(inspectSettings.address ? `--inspect-brk=${inspectSettings.address}` : '--inspect-brk') + } else { + flags.push(inspectSettings.address ? `--inspect=${inspectSettings.address}` : '--inspect') + } + } + const server = await prepareServer({ deno, distDirectory,