@netlify/edge-bundler 8.12.0 → 8.12.1
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.
|
@@ -3,7 +3,7 @@ import { join } from 'path';
|
|
|
3
3
|
import { pathToFileURL } from 'url';
|
|
4
4
|
import { deleteAsync } from 'del';
|
|
5
5
|
const defaultFormatExportTypeError = (name) => `The Edge Function "${name}" has failed to load. Does it have a function as the default export?`;
|
|
6
|
-
const
|
|
6
|
+
const defaultFormatImportError = (name) => `There was an error with Edge Function "${name}".`;
|
|
7
7
|
const generateStage2 = async ({ bootstrapURL, distDirectory, fileName, formatExportTypeError, formatImportError, functions, }) => {
|
|
8
8
|
await deleteAsync(distDirectory, { force: true });
|
|
9
9
|
await fs.mkdir(distDirectory, { recursive: true });
|
|
@@ -15,7 +15,7 @@ const generateStage2 = async ({ bootstrapURL, distDirectory, fileName, formatExp
|
|
|
15
15
|
// For the local development environment, we import the user functions with
|
|
16
16
|
// dynamic imports to gracefully handle the case where the file doesn't have
|
|
17
17
|
// a valid default export.
|
|
18
|
-
const getLocalEntryPoint = (functions, { bootstrapURL, formatExportTypeError = defaultFormatExportTypeError, formatImportError =
|
|
18
|
+
const getLocalEntryPoint = (functions, { bootstrapURL, formatExportTypeError = defaultFormatExportTypeError, formatImportError = defaultFormatImportError, }) => {
|
|
19
19
|
const bootImport = `import { boot } from "${bootstrapURL}";`;
|
|
20
20
|
const declaration = `const functions = {}; const metadata = { functions: {} };`;
|
|
21
21
|
const imports = functions.map((func) => {
|
package/dist/node/manifest.js
CHANGED
|
@@ -23,6 +23,10 @@ const generateManifest = ({ bundles = [], declarations = [], featureFlags, funct
|
|
|
23
23
|
const postCacheRoutes = [];
|
|
24
24
|
const manifestFunctionConfig = Object.fromEntries(functions.map(({ name }) => [name, { excluded_patterns: [] }]));
|
|
25
25
|
for (const [name, { excludedPath, onError }] of Object.entries(functionConfig)) {
|
|
26
|
+
// If the config block is for a function that is not defined, discard it.
|
|
27
|
+
if (manifestFunctionConfig[name] === undefined) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
26
30
|
if (excludedPath) {
|
|
27
31
|
const paths = Array.isArray(excludedPath) ? excludedPath : [excludedPath];
|
|
28
32
|
const excludedPatterns = paths.map(pathToRegularExpression).map(serializePattern);
|