@netlify/edge-bundler 8.6.0 → 8.7.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.
@@ -4,6 +4,7 @@ interface BaseDeclaration {
4
4
  cache?: string;
5
5
  function: string;
6
6
  name?: string;
7
+ generator?: string;
7
8
  }
8
9
  type DeclarationWithPath = BaseDeclaration & {
9
10
  path: string;
@@ -8,6 +8,7 @@ interface Route {
8
8
  function: string;
9
9
  name?: string;
10
10
  pattern: string;
11
+ generator?: string;
11
12
  }
12
13
  interface EdgeFunctionConfig {
13
14
  excluded_patterns: string[];
@@ -40,6 +41,7 @@ interface Route {
40
41
  function: string;
41
42
  name?: string;
42
43
  pattern: string;
44
+ generator?: string;
43
45
  }
44
46
  declare const generateManifest: ({ bundles, declarations, featureFlags, functions, functionConfig, importMap, layers, }: GenerateManifestOptions) => Manifest;
45
47
  interface WriteManifestOptions extends GenerateManifestOptions {
@@ -39,6 +39,7 @@ const generateManifest = ({ bundles = [], declarations = [], featureFlags, funct
39
39
  function: func.name,
40
40
  name: declaration.name,
41
41
  pattern: serializePattern(pattern),
42
+ generator: declaration.generator,
42
43
  };
43
44
  const excludedPattern = getExcludedRegularExpression(declaration, featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.edge_functions_fail_unsupported_regex);
44
45
  if (excludedPattern) {
@@ -42,6 +42,27 @@ test('Generates a manifest with display names', () => {
42
42
  expect(manifest.routes).toEqual(expectedRoutes);
43
43
  expect(manifest.bundler_version).toBe(env.npm_package_version);
44
44
  });
45
+ test('Generates a manifest with a generator field', () => {
46
+ const functions = [
47
+ { name: 'func-1', path: '/path/to/func-1.ts' },
48
+ { name: 'func-2', path: '/path/to/func-2.ts' },
49
+ { name: 'func-3', path: '/path/to/func-3.ts' },
50
+ ];
51
+ const declarations = [
52
+ { function: 'func-1', generator: '@netlify/fake-plugin@1.0.0', path: '/f1/*' },
53
+ { function: 'func-2', path: '/f2/*' },
54
+ { function: 'func-3', generator: '@netlify/fake-plugin@1.0.0', cache: 'manual', path: '/f3' },
55
+ ];
56
+ const manifest = generateManifest({ bundles: [], declarations, functions });
57
+ const expectedRoutes = [
58
+ { function: 'func-1', generator: '@netlify/fake-plugin@1.0.0', pattern: '^/f1/.*/?$' },
59
+ { function: 'func-2', pattern: '^/f2/.*/?$' },
60
+ ];
61
+ const expectedPostCacheRoutes = [{ function: 'func-3', generator: '@netlify/fake-plugin@1.0.0', pattern: '^/f3/?$' }];
62
+ expect(manifest.routes).toEqual(expectedRoutes);
63
+ expect(manifest.post_cache_routes).toEqual(expectedPostCacheRoutes);
64
+ expect(manifest.bundler_version).toBe(env.npm_package_version);
65
+ });
45
66
  test('Generates a manifest with excluded paths and patterns', () => {
46
67
  const functions = [
47
68
  { name: 'func-1', path: '/path/to/func-1.ts' },
@@ -14,6 +14,7 @@ const getBaseManifest = () => ({
14
14
  name: 'name',
15
15
  function: 'hello',
16
16
  pattern: '^/hello/?$',
17
+ generator: '@netlify/fake-plugin@1.0.0',
17
18
  },
18
19
  ],
19
20
  post_cache_routes: [
@@ -21,6 +22,7 @@ const getBaseManifest = () => ({
21
22
  name: 'name',
22
23
  function: 'hello',
23
24
  pattern: '^/hello/?$',
25
+ generator: '@netlify/fake-plugin@1.0.0',
24
26
  },
25
27
  ],
26
28
  layers: [
@@ -36,6 +36,9 @@ declare const edgeManifestSchema: {
36
36
  format: string;
37
37
  errorMessage: string;
38
38
  };
39
+ generator: {
40
+ type: string;
41
+ };
39
42
  };
40
43
  additionalProperties: boolean;
41
44
  };
@@ -57,6 +60,9 @@ declare const edgeManifestSchema: {
57
60
  format: string;
58
61
  errorMessage: string;
59
62
  };
63
+ generator: {
64
+ type: string;
65
+ };
60
66
  };
61
67
  additionalProperties: boolean;
62
68
  };
@@ -18,6 +18,7 @@ const routesSchema = {
18
18
  format: 'regexPattern',
19
19
  errorMessage: 'pattern needs to be a regex that starts with ^ and ends with $ without any additional slashes before and afterwards',
20
20
  },
21
+ generator: { type: 'string' },
21
22
  },
22
23
  additionalProperties: false,
23
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/edge-bundler",
3
- "version": "8.6.0",
3
+ "version": "8.7.0",
4
4
  "description": "Intelligently prepare Netlify Edge Functions for deployment",
5
5
  "type": "module",
6
6
  "main": "./dist/node/index.js",