@netlify/edge-bundler
Advanced tools
Comparing version 12.0.1 to 12.1.0
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { type WriteStream } from 'fs'; | ||
@@ -4,0 +2,0 @@ import { ExecaChildProcess } from 'execa'; |
@@ -458,1 +458,31 @@ import { Buffer } from 'buffer'; | ||
}); | ||
test('Loads edge functions from the Frameworks API', async () => { | ||
const { basePath, cleanup, distPath } = await useFixture('with_frameworks_api'); | ||
const directories = [resolve(basePath, 'netlify/edge-functions'), resolve(basePath, '.netlify/v1/edge-functions')]; | ||
const result = await bundle(directories, distPath, [], { | ||
basePath, | ||
internalSrcFolder: directories[1], | ||
importMapPaths: [resolve(basePath, '.netlify/v1/edge-functions/import_map.json')], | ||
}); | ||
const generatedFiles = await readdir(distPath); | ||
expect(result.functions.length).toBe(3); | ||
expect(generatedFiles.length).toBe(2); | ||
const manifestFile = await readFile(resolve(distPath, 'manifest.json'), 'utf8'); | ||
const manifest = JSON.parse(manifestFile); | ||
const { bundles, function_config: functionConfig, routes } = manifest; | ||
expect(bundles.length).toBe(1); | ||
expect(bundles[0].format).toBe('eszip2'); | ||
expect(generatedFiles.includes(bundles[0].asset)).toBe(true); | ||
expect(routes[0].excluded_patterns).toEqual(['^/func2/skip/?$']); | ||
expect(functionConfig.func2).toEqual({ | ||
excluded_patterns: ['^/func2/skip/?$'], | ||
name: 'Function two', | ||
generator: '@netlify/fake-plugin@1.0.0', | ||
}); | ||
expect(functionConfig.func3).toEqual({ | ||
name: 'in-config-function', | ||
on_error: 'bypass', | ||
generator: 'internalFunc', | ||
}); | ||
await cleanup(); | ||
}); |
@@ -261,3 +261,3 @@ import { promises as fs } from 'fs'; | ||
pattern: '^/user-func5(?:/(.*))/?$', | ||
excluded_patterns: [], | ||
excluded_patterns: ['^/user-func5/excluded/?$'], | ||
path: '/user-func5/*', | ||
@@ -264,0 +264,0 @@ methods: ['GET'], |
@@ -51,3 +51,3 @@ export const mergeDeclarations = (tomlDeclarations, userFunctionsConfig, internalFunctionsConfig, deployConfigDeclarations, | ||
for (const name in functionConfigs) { | ||
const { cache, path, method } = functionConfigs[name]; | ||
const { cache, excludedPath, path, method } = functionConfigs[name]; | ||
// If we have a path specified, create a declaration for each path. | ||
@@ -64,2 +64,5 @@ if (!functionsVisited.has(name) && path) { | ||
} | ||
if (excludedPath) { | ||
declaration.excludedPath = excludedPath; | ||
} | ||
declarations.push(declaration); | ||
@@ -66,0 +69,0 @@ }); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { ImportMap } from './import_map.js'; | ||
@@ -3,0 +2,0 @@ import { Logger } from './logger.js'; |
@@ -1,7 +0,1 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import type { WriteStream } from 'fs'; | ||
@@ -8,0 +2,0 @@ import { OnAfterDownloadHook, OnBeforeDownloadHook } from '../bridge.js'; |
@@ -1,3 +0,2 @@ | ||
/// <reference types="node" /> | ||
export declare const isNodeError: (error: any) => error is NodeJS.ErrnoException; | ||
export declare const isFileNotFoundError: (error: any) => boolean; |
{ | ||
"name": "@netlify/edge-bundler", | ||
"version": "12.0.1", | ||
"version": "12.1.0", | ||
"description": "Intelligently prepare Netlify Edge Functions for deployment", | ||
@@ -87,3 +87,3 @@ "type": "module", | ||
}, | ||
"gitHead": "95038d0359de8abef07cb3caadd8cea0c3fb539e" | ||
"gitHead": "77980fa9db268a0beead2e2727a36d833716bc11" | ||
} |
3803960
9745