@netlify/edge-bundler
Advanced tools
Comparing version 2.4.0 to 2.5.0
import { FunctionConfig } from './config.js'; | ||
interface DeclarationWithPath { | ||
interface BaseDeclaration { | ||
function: string; | ||
name?: string; | ||
} | ||
declare type DeclarationWithPath = BaseDeclaration & { | ||
path: string; | ||
} | ||
interface DeclarationWithPattern { | ||
function: string; | ||
}; | ||
declare type DeclarationWithPattern = BaseDeclaration & { | ||
pattern: string; | ||
} | ||
}; | ||
declare type Declaration = DeclarationWithPath | DeclarationWithPattern; | ||
export declare const getDeclarationsFromConfig: (tomlDeclarations: Declaration[], functionsConfig: Record<string, FunctionConfig>) => Declaration[]; | ||
export { Declaration, DeclarationWithPath, DeclarationWithPattern }; |
@@ -17,2 +17,3 @@ import type { Bundle } from './bundle.js'; | ||
function: string; | ||
name?: string; | ||
pattern: string; | ||
@@ -19,0 +20,0 @@ }[]; |
@@ -16,2 +16,3 @@ import { promises as fs } from 'fs'; | ||
function: func.name, | ||
name: declaration.name, | ||
pattern: serializablePattern, | ||
@@ -18,0 +19,0 @@ }; |
@@ -27,2 +27,19 @@ import { env } from 'process'; | ||
}); | ||
test('Generates a manifest with display names', () => { | ||
const functions = [ | ||
{ name: 'func-1', path: '/path/to/func-1.ts' }, | ||
{ name: 'func-2', path: '/path/to/func-2.ts' }, | ||
]; | ||
const declarations = [ | ||
{ function: 'func-1', name: 'Display Name', path: '/f1/*' }, | ||
{ function: 'func-2', path: '/f2/*' }, | ||
]; | ||
const manifest = generateManifest({ bundles: [], declarations, functions }); | ||
const expectedRoutes = [ | ||
{ function: 'func-1', name: 'Display Name', pattern: '^/f1/.*/?$' }, | ||
{ function: 'func-2', pattern: '^/f2/.*/?$' }, | ||
]; | ||
expect(manifest.routes).toEqual(expectedRoutes); | ||
expect(manifest.bundler_version).toBe(env.npm_package_version); | ||
}); | ||
test('Excludes functions for which there are function files but no matching config declarations', () => { | ||
@@ -29,0 +46,0 @@ const bundle1 = { |
{ | ||
"name": "@netlify/edge-bundler", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Intelligently prepare Netlify Edge Functions for deployment", | ||
@@ -5,0 +5,0 @@ "type": "module", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109516
2630