netlify-cli 17.19.3 → 17.19.4

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.
@@ -11,7 +11,7 @@ const blobs = (_options, command) => {
11
11
  export const createBlobsCommand = (program) => {
12
12
  program
13
13
  .command('blobs:delete')
14
- .description(`(Beta) Deletes an object with a given key, if it exists, from a Netlify Blobs store`)
14
+ .description(`Deletes an object with a given key, if it exists, from a Netlify Blobs store`)
15
15
  .argument('<store>', 'Name of the store')
16
16
  .argument('<key>', 'Object key')
17
17
  .alias('blob:delete')
@@ -22,7 +22,7 @@ export const createBlobsCommand = (program) => {
22
22
  });
23
23
  program
24
24
  .command('blobs:get')
25
- .description(`(Beta) Reads an object with a given key from a Netlify Blobs store and, if it exists, prints the content to the terminal or saves it to a file`)
25
+ .description(`Reads an object with a given key from a Netlify Blobs store and, if it exists, prints the content to the terminal or saves it to a file`)
26
26
  .argument('<store>', 'Name of the store')
27
27
  .argument('<key>', 'Object key')
28
28
  .option('-o, --output <path>', 'Defines the filesystem path where the blob data should be persisted')
@@ -34,7 +34,7 @@ export const createBlobsCommand = (program) => {
34
34
  });
35
35
  program
36
36
  .command('blobs:list')
37
- .description(`(Beta) Lists objects in a Netlify Blobs store`)
37
+ .description(`Lists objects in a Netlify Blobs store`)
38
38
  .argument('<store>', 'Name of the store')
39
39
  .option('-d, --directories', `Indicates that keys with the '/' character should be treated as directories, returning a list of sub-directories at a given level rather than all the keys inside them`)
40
40
  .option('-p, --prefix <prefix>', `A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned`)
@@ -47,7 +47,7 @@ export const createBlobsCommand = (program) => {
47
47
  });
48
48
  program
49
49
  .command('blobs:set')
50
- .description(`(Beta) Writes to a Netlify Blobs store an object with the data provided in the command or the contents of a file defined by the 'input' parameter`)
50
+ .description(`Writes to a Netlify Blobs store an object with the data provided in the command or the contents of a file defined by the 'input' parameter`)
51
51
  .argument('<store>', 'Name of the store')
52
52
  .argument('<key>', 'Object key')
53
53
  .argument('[value...]', 'Object value')
@@ -61,7 +61,7 @@ export const createBlobsCommand = (program) => {
61
61
  return program
62
62
  .command('blobs')
63
63
  .alias('blob')
64
- .description(`(Beta) Manage objects in Netlify Blobs`)
64
+ .description(`Manage objects in Netlify Blobs`)
65
65
  .addExamples([
66
66
  'netlify blobs:get my-store my-key',
67
67
  'netlify blobs:set my-store my-key This will go in a blob',
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAuD,MAAM,uBAAuB,CAAA;AAE7G,OAAO,WAAW,MAAM,gCAAgC,CAAA;AAYxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAMhE,MAAM,WAAW,MAAM;IACrB,cAAc,CAAC,EAAE,WAAW,EAAE,CAAA;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAGD,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAA;AAInF,UAAU,4BAA4B;IACpC,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,cAAc,uBAAuB,CAAC,CAAA;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,OAAO,CAAA;IACd,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACzD,YAAY,EAAE,YAAY,CAAA;IAC1B,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;IACtB,SAAS,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AuB;IAMtC,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,MAAM,CAAC,uBAAuB;YAoBxB,gBAAgB;IAoCxB,UAAU;IAIhB;;OAEG;IACH,OAAO,CAAC,QAAQ;IA2ChB;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;IAuC5C;;;OAGG;IACH,OAAO,CAAC,YAAY;IA4CpB;;;OAGG;YACW,QAAQ;IAqBtB,OAAO,KAAK,iBAAiB,GAE5B;YAEa,gBAAgB;YAShB,mBAAmB;YAgBnB,gBAAgB;YA+BhB,aAAa;YAwBb,wBAAwB;CAWvC"}
@@ -5,10 +5,16 @@ import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, nonNullable, chalk, log,
5
5
  import { MultiMap } from '../../utils/multimap.js';
6
6
  import { INTERNAL_EDGE_FUNCTIONS_FOLDER } from './consts.js';
7
7
  /**
8
- * Helper method which, given a edge bundler graph module and an index of modules by path, traverses its dependency tree
9
- * and returns an array of all of ist local dependencies
8
+ * Given an Edge Bundler module graph and an index of modules by path,
9
+ * traverses its dependency tree and returns an array of all of its
10
+ * local dependencies.
10
11
  */
11
- function traverseLocalDependencies({ dependencies = [] }, modulesByPath) {
12
+ function traverseLocalDependencies({ dependencies = [], specifier }, modulesByPath, cache) {
13
+ // If we've already traversed this specifier, return the cached list of
14
+ // dependencies.
15
+ if (cache[specifier] !== undefined) {
16
+ return cache[specifier];
17
+ }
12
18
  return dependencies.flatMap((dependency) => {
13
19
  // We're interested in tracking local dependencies, so we only look at
14
20
  // specifiers with the `file:` protocol.
@@ -20,12 +26,13 @@ function traverseLocalDependencies({ dependencies = [] }, modulesByPath) {
20
26
  const { specifier: dependencyURL } = dependency.code;
21
27
  const dependencyPath = fileURLToPath(dependencyURL);
22
28
  const dependencyModule = modulesByPath.get(dependencyPath);
23
- // No module indexed for this dependency
29
+ // No module indexed for this dependency.
24
30
  if (dependencyModule === undefined) {
25
31
  return [dependencyPath];
26
32
  }
27
- // Keep traversing the child dependencies and return the current dependency path
28
- return [...traverseLocalDependencies(dependencyModule, modulesByPath), dependencyPath];
33
+ // Keep traversing the child dependencies and return the current dependency path.
34
+ cache[specifier] = [...traverseLocalDependencies(dependencyModule, modulesByPath, cache), dependencyPath];
35
+ return cache[specifier];
29
36
  });
30
37
  }
31
38
  export class EdgeFunctionsRegistry {
@@ -305,9 +312,10 @@ export class EdgeFunctionsRegistry {
305
312
  functionModules.add({ functionName, module });
306
313
  }
307
314
  });
315
+ const dependencyCache = {};
308
316
  // We start from our functions and we traverse through their dependency tree
309
317
  functionModules.forEach(({ functionName, module }) => {
310
- const traversedPaths = traverseLocalDependencies(module, modulesByPath);
318
+ const traversedPaths = traverseLocalDependencies(module, modulesByPath, dependencyCache);
311
319
  traversedPaths.forEach((dependencyPath) => {
312
320
  this.dependencyPaths.add(dependencyPath, functionName);
313
321
  });
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/server.ts"],"names":[],"mappings":"AAIA,OAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAKtD,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAUvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAMrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAyDjD,eAAO,MAAM,aAAa,YAAsB,yBAAyB,KAAG,cA8J3E,CAAA;AAED,UAAU,yBAAyB;IACjC,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,Q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A;IAChB,eAAe,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;CAC7C;AA4BD,eAAO,MAAM,oBAAoB,YACtB;IACP,YAAY,EAAE,YAAY,CAAA;IAC1B,OAAO,EAAE,WAAW,CAAA;IACpB,MAAM,EAAE,QAAQ,CAAA;IAChB,YAAY,EAAE,QAAQ,CAAA;IACtB,KAAK,EAAE,OAAO,CAAA;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;CACnB,GAAG,KAAK,yBAAyB,EAAE,mBAAmB,CAAC,KACvD,QAAQ,iBAAiB,GAAG,SAAS,CAiFvC,CAAA"}
@@ -159,6 +159,11 @@ export const createHandler = function (options) {
159
159
  handleBackgroundFunctionResult(functionName, error);
160
160
  }
161
161
  else if (await func.isScheduled()) {
162
+ // In production, scheduled functions always receive POST requests, so we
163
+ // have to emulate that here, even if a user has triggered a GET request
164
+ // as part of their tests. If we don't do this, we'll hit problems when
165
+ // we send the invocation body in a request that can't have a body.
166
+ event.httpMethod = 'POST';
162
167
  const { error, result } = await func.invoke({
163
168
  ...event,
164
169
  body: JSON.stringify({
@@ -173,9 +178,17 @@ export const createHandler = function (options) {
173
178
  }, clientContext);
174
179
  handleScheduledFunction({
175
180
  error,
176
- result,
177
181
  request,
178
182
  response,
183
+ // When we handle the result of invoking a scheduled function, we'll warn
184
+ // people in case their function returned a body or headers, since those
185
+ // will have no practical effect in production. However, in v2 functions
186
+ // we don't currently have a good way of asserting whether the body we're
187
+ // seeing has been actually produced by user code or by the bootstrap, so
188
+ // we risk printing that warn unnecessarily, which causes more harm than
189
+ // good. Until we find a way of making this detection better, ignore the
190
+ // invocation result entirely for v2 functions.
191
+ result: func.runtimeAPIVersion === 1 ? result : {},
179
192
  });
180
193
  }
181
194
  else {