@netlify/edge-bundler 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { type WriteStream } from 'fs';
4
2
  import { ExecaChildProcess } from 'execa';
5
3
  import { Logger } from './logger.js';
@@ -455,3 +455,33 @@ test('Supports TSX and process.env', async () => {
455
455
  await rm(vendorDirectory.path, { force: true, recursive: true });
456
456
  delete process.env.FOO;
457
457
  });
458
+ test('Loads edge functions from the Frameworks API', async () => {
459
+ const { basePath, cleanup, distPath } = await useFixture('with_frameworks_api');
460
+ const directories = [resolve(basePath, 'netlify/edge-functions'), resolve(basePath, '.netlify/v1/edge-functions')];
461
+ const result = await bundle(directories, distPath, [], {
462
+ basePath,
463
+ internalSrcFolder: directories[1],
464
+ importMapPaths: [resolve(basePath, '.netlify/v1/edge-functions/import_map.json')],
465
+ });
466
+ const generatedFiles = await readdir(distPath);
467
+ expect(result.functions.length).toBe(3);
468
+ expect(generatedFiles.length).toBe(2);
469
+ const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8');
470
+ const manifest = JSON.parse(manifestFile);
471
+ const { bundles, function_config: functionConfig, routes } = manifest;
472
+ expect(bundles.length).toBe(1);
473
+ expect(bundles[0].format).toBe('eszip2');
474
+ expect(generatedFiles.includes(bundles[0].asset)).toBe(true);
475
+ expect(routes[0].excluded_patterns).toEqual(['^/func2/skip/?$']);
476
+ expect(functionConfig.func2).toEqual({
477
+ excluded_patterns: ['^/func2/skip/?$'],
478
+ name: 'Function two',
479
+ generator: '@netlify/fake-plugin@1.0.0',
480
+ });
481
+ expect(functionConfig.func3).toEqual({
482
+ name: 'in-config-function',
483
+ on_error: 'bypass',
484
+ generator: 'internalFunc',
485
+ });
486
+ await cleanup();
487
+ });
@@ -258,7 +258,7 @@ test('Loads function paths from the in-source `config` function', async () => {
258
258
  expect(routes[5]).toEqual({
259
259
  function: 'user-func5',
260
260
  pattern: '^/user-func5(?:/(.*))/?$',
261
- excluded_patterns: [],
261
+ excluded_patterns: ['^/user-func5/excluded/?$'],
262
262
  path: '/user-func5/*',
263
263
  methods: ['GET'],
264
264
  });
@@ -48,7 +48,7 @@ const getDeclarationsFromInput = (inputDeclarations, functionConfigs, functionsV
48
48
  const createDeclarationsFromFunctionConfigs = (functionConfigs, functionsVisited) => {
49
49
  const declarations = [];
50
50
  for (const name in functionConfigs) {
51
- const { cache, path, method } = functionConfigs[name];
51
+ const { cache, excludedPath, path, method } = functionConfigs[name];
52
52
  // If we have a path specified, create a declaration for each path.
53
53
  if (!functionsVisited.has(name) && path) {
54
54
  const paths = Array.isArray(path) ? path : [path];
@@ -60,6 +60,9 @@ const createDeclarationsFromFunctionConfigs = (functionConfigs, functionsVisited
60
60
  if (method) {
61
61
  declaration.method = method;
62
62
  }
63
+ if (excludedPath) {
64
+ declaration.excludedPath = excludedPath;
65
+ }
63
66
  declarations.push(declaration);
64
67
  });
65
68
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ImportMap } from './import_map.js';
3
2
  import { Logger } from './logger.js';
4
3
  interface VendorNPMSpecifiersOptions {
@@ -1,9 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
- /// <reference types="node" />
5
- /// <reference types="node" />
6
- /// <reference types="node" />
7
1
  import type { WriteStream } from 'fs';
8
2
  import { OnAfterDownloadHook, OnBeforeDownloadHook } from '../bridge.js';
9
3
  import { FunctionConfig } from '../config.js';
@@ -1,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  export declare const isNodeError: (error: any) => error is NodeJS.ErrnoException;
3
2
  export declare const isFileNotFoundError: (error: any) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/edge-bundler",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "Intelligently prepare Netlify Edge Functions for deployment",
5
5
  "type": "module",
6
6
  "main": "./dist/node/index.js",
@@ -61,13 +61,13 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@import-maps/resolve": "^1.0.1",
64
- "@vercel/nft": "^0.26.0",
64
+ "@vercel/nft": "^0.27.0",
65
65
  "ajv": "^8.11.2",
66
66
  "ajv-errors": "^3.0.0",
67
67
  "better-ajv-errors": "^1.2.0",
68
68
  "common-path-prefix": "^3.0.0",
69
69
  "env-paths": "^3.0.0",
70
- "esbuild": "0.20.2",
70
+ "esbuild": "0.21.2",
71
71
  "execa": "^6.0.0",
72
72
  "find-up": "^6.3.0",
73
73
  "get-package-name": "^2.2.0",
@@ -84,5 +84,5 @@
84
84
  "urlpattern-polyfill": "8.0.2",
85
85
  "uuid": "^9.0.0"
86
86
  },
87
- "gitHead": "cf765526c7970810cc1812ac0b2b3d9bb11ea926"
87
+ "gitHead": "77980fa9db268a0beead2e2727a36d833716bc11"
88
88
  }