@netlify/edge-bundler 8.6.0 → 8.8.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.
- package/dist/node/declaration.d.ts +1 -0
- package/dist/node/formats/javascript.js +1 -1
- package/dist/node/manifest.d.ts +2 -0
- package/dist/node/manifest.js +1 -0
- package/dist/node/manifest.test.js +21 -0
- package/dist/node/validation/manifest/index.test.js +2 -0
- package/dist/node/validation/manifest/schema.d.ts +6 -0
- package/dist/node/validation/manifest/schema.js +1 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { join } from 'path';
|
|
|
3
3
|
import { env } from 'process';
|
|
4
4
|
import { pathToFileURL } from 'url';
|
|
5
5
|
import { deleteAsync } from 'del';
|
|
6
|
-
const BOOTSTRAP_LATEST = 'https://
|
|
6
|
+
const BOOTSTRAP_LATEST = 'https://63ee03b14efa8d0008e1330a--edge.netlify.com/bootstrap/index-combined.ts';
|
|
7
7
|
const defaultFormatExportTypeError = (name) => `The Edge Function "${name}" has failed to load. Does it have a function as the default export?`;
|
|
8
8
|
const defaultFormatImpoortError = (name) => `There was an error with Edge Function "${name}".`;
|
|
9
9
|
const generateStage2 = async ({ distDirectory, fileName, formatExportTypeError, formatImportError, functions, }) => {
|
package/dist/node/manifest.d.ts
CHANGED
|
@@ -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 {
|
package/dist/node/manifest.js
CHANGED
|
@@ -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
|
};
|