@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.
- package/dist/node/bridge.d.ts +0 -2
- package/dist/node/bundler.test.js +30 -0
- package/dist/node/config.test.js +1 -1
- package/dist/node/declaration.js +4 -1
- package/dist/node/npm_dependencies.d.ts +0 -1
- package/dist/node/server/server.d.ts +0 -6
- package/dist/node/utils/error.d.ts +0 -1
- package/package.json +4 -4
package/dist/node/bridge.d.ts
CHANGED
|
@@ -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
|
+
});
|
package/dist/node/config.test.js
CHANGED
|
@@ -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
|
});
|
package/dist/node/declaration.js
CHANGED
|
@@ -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,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';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/edge-bundler",
|
|
3
|
-
"version": "12.
|
|
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.
|
|
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.
|
|
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": "
|
|
87
|
+
"gitHead": "77980fa9db268a0beead2e2727a36d833716bc11"
|
|
88
88
|
}
|