netlify-cli 17.28.0 → 17.29.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.
@@ -1 +1 @@
1
- {"version":3,"file":"netlify-function.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/netlify-function.ts"],"names":[],"mappings":"AA2BA,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,QAAQ,EAAE,MAAM,CAAA;IAChC,SAAgB,WAAW,EAAE,MAAM,CAAA;IACnC,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjC,SAAgB,OAAO,EAAE,MAAM,CAAA;IAE/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAQ;IACpC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAQ;IAC1C,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAQ;IAI3C,SAAgB,YAAY,EAAE,OAAO,CAAA;IAErC,OAAO,CAAC,UAAU,CAAC,CAAiB;IACpC,OAAO,CAAC,SAAS,CAAC,CAAQ;IACnB,UAAU,EAAE,KAAK,GAAG,IAAI,CAAO;IAItC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;gBAEjC,EAEV,YAAY,EAEZ,MAAM,EAEN,SAAS,EAET,WAAW,EAEX,QAAQ,EAER,IAAI,EAEJ,WAAW,EAEX,OAAO,EAEP,QAAQ,EAER,iBAAiB,EAEjB,kBAAkB,GACnB;;;;;;;;;;;;KAAA;IAuBD,IAAI,QAAQ,kBAMX;IAED,uBAAuB;IAqBvB,YAAY;IAMN,WAAW;IAMjB,WAAW;IAIX,YAAY;IAQN,UAAU;IAeV,KAAK,CAAC,EAAE,KAAK,EAAE;;KAAA;;;;;;;;;;;;IA2Cf,YAAY;IAQlB,eAAe,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MX;IAED,uBAAuB;IAqBvB,YAAY;IAMN,WAAW;IAMjB,WAAW;IAIX,YAAY;IAQN,UAAU;IAeV,KAAK,CAAC,EAAE,KAAK,EAAE;;KAAA;;;;;;;;;;;;IA2Cf,YAAY;IAQlB,eAAe,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC;;;;IAWlC,MAAM,CAAC,KAAK,KAAK,EAAE,OAAO,KAAK;;;;;;;IAgCrC;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC;IAqDzF,IAAI,iBAAiB,QAEpB;IAED,IAAI,GAAG,WAWN;CACF"}
@@ -198,28 +198,40 @@ export default class NetlifyFunction {
198
198
  await this.buildQueue;
199
199
  let path = rawPath !== '/' && rawPath.endsWith('/') ? rawPath.slice(0, -1) : rawPath;
200
200
  path = path.toLowerCase();
201
- const { routes = [] } = this.buildData ?? {};
202
- // @ts-expect-error TS(7031) FIXME: Binding element 'expression' implicitly has an 'an... Remove this comment to see the full error message
203
- const route = routes.find(({ expression, literal, methods }) => {
204
- if (methods.length !== 0 && !methods.includes(method)) {
201
+ const { excludedRoutes = [], routes = [] } = this.buildData ?? {};
202
+ const matchingRoute = routes.find((route) => {
203
+ if (route.methods && route.methods.length !== 0 && !route.methods.includes(method)) {
205
204
  return false;
206
205
  }
207
- if (literal !== undefined) {
208
- return path === literal;
206
+ if ('literal' in route && route.literal !== undefined) {
207
+ return path === route.literal;
209
208
  }
210
- if (expression !== undefined) {
211
- const regex = new RegExp(expression);
209
+ if ('expression' in route && route.expression !== undefined) {
210
+ const regex = new RegExp(route.expression);
212
211
  return regex.test(path);
213
212
  }
214
213
  return false;
215
214
  });
216
- if (!route) {
215
+ if (!matchingRoute) {
217
216
  return;
218
217
  }
219
- if (route.prefer_static && (await hasStaticFile())) {
218
+ const isExcluded = excludedRoutes.some((excludedRoute) => {
219
+ if ('literal' in excludedRoute && excludedRoute.literal !== undefined) {
220
+ return path === excludedRoute.literal;
221
+ }
222
+ if ('expression' in excludedRoute && excludedRoute.expression !== undefined) {
223
+ const regex = new RegExp(excludedRoute.expression);
224
+ return regex.test(path);
225
+ }
226
+ return false;
227
+ });
228
+ if (isExcluded) {
229
+ return;
230
+ }
231
+ if (matchingRoute.prefer_static && (await hasStaticFile())) {
220
232
  return;
221
233
  }
222
- return route;
234
+ return matchingRoute;
223
235
  }
224
236
  get runtimeAPIVersion() {
225
237
  return this.buildData?.runtimeAPIVersion ?? 1;
@@ -31,6 +31,7 @@ export default function handler({ config, directory, errorExit, func, metadata,
31
31
  cache?: {} | undefined;
32
32
  }) => Promise<{
33
33
  buildPath: string;
34
+ excludedRoutes: any;
34
35
  includedFiles: any;
35
36
  outputModuleFormat: any;
36
37
  mainFile: any;
@@ -1 +1 @@
1
- {"version":3,"file":"zisi.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/zisi.ts"],"names":[],"mappings":"AAqGA;;;;;GAKG;AAEH,eAAO,MAAM,wBAAwB;;;;+EAMjC,CAAA;AAoCJ;;;;;;;;;GASG;AAEH,wBAA8B,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE;;;;;;;CAAA;;;;;;;;;;;;;;;GAoDlG"}
1
+ {"version":3,"file":"zisi.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/zisi.ts"],"names":[],"mappings":"AAgHA;;;;;GAKG;AAEH,eAAO,MAAM,wBAAwB;;;;+EAMjC,CAAA;AAoCJ;;;;;;;;;GASG;AAEH,wBAA8B,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE;;;;;;;CAAA;;;;;;;;;;;;;;;;GAoDlG"}
@@ -56,7 +56,7 @@ targetDirectory, }) => {
56
56
  // root of the functions directory (e.g. `functions/my-func.js`). In
57
57
  // this case, we use `mainFile` as the function path of `zipFunction`.
58
58
  const entryPath = functionDirectory === directory ? func.mainFile : functionDirectory;
59
- const { entryFilename, includedFiles, inputs, mainFile, outputModuleFormat, path: functionPath, routes, runtimeAPIVersion, schedule, } = await memoizedBuild({
59
+ const { entryFilename, excludedRoutes, includedFiles, inputs, mainFile, outputModuleFormat, path: functionPath, routes, runtimeAPIVersion, schedule, } = await memoizedBuild({
60
60
  cache,
61
61
  cacheKey: `zisi-${entryPath}`,
62
62
  // @ts-expect-error TS(2345) FIXME: Argument of type '{ archiveFormat: string; basePat... Remove this comment to see the full error message
@@ -73,7 +73,17 @@ targetDirectory, }) => {
73
73
  }));
74
74
  }
75
75
  clearFunctionsCache(targetDirectory);
76
- return { buildPath, includedFiles, outputModuleFormat, mainFile, routes, runtimeAPIVersion, srcFiles, schedule };
76
+ return {
77
+ buildPath,
78
+ excludedRoutes,
79
+ includedFiles,
80
+ outputModuleFormat,
81
+ mainFile,
82
+ routes,
83
+ runtimeAPIVersion,
84
+ srcFiles,
85
+ schedule,
86
+ };
77
87
  };
78
88
  /**
79
89
  * @param {object} params