netlify-cli 17.5.0 → 17.5.2

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.
@@ -108,10 +108,10 @@ export const fetchLatestVersion = async ({ destination, execName, extension, lat
108
108
  };
109
109
  const options = getOptions();
110
110
  const fetch = latestVersion
111
- // @ts-expect-error TS(2345) FIXME: Argument of type '{ headers: { Authorization: stri... Remove this comment to see the full error message
112
- ? fetchVersion({ ...release, version: latestVersion }, options)
113
- // @ts-expect-error TS(2345) FIXME: Argument of type '{ repository: string; package: s... Remove this comment to see the full error message
114
- : fetchLatest(release, options);
111
+ ? // @ts-expect-error TS(2345) FIXME: Argument of type '{ headers: { Authorization: stri... Remove this comment to see the full error message
112
+ fetchVersion({ ...release, version: latestVersion }, options)
113
+ : // @ts-expect-error TS(2345) FIXME: Argument of type '{ repository: string; package: s... Remove this comment to see the full error message
114
+ fetchLatest(release, options);
115
115
  try {
116
116
  await fetch;
117
117
  }
@@ -57,6 +57,7 @@ export const createFormSubmissionHandler = function ({ functionsRegistry, siteUr
57
57
  }
58
58
  else if (ct.type === 'multipart/form-data') {
59
59
  try {
60
+ ;
60
61
  [fields, files] = await new Promise((resolve, reject) => {
61
62
  const form = new multiparty.Form({ encoding: ct.parameters.charset || 'utf8' });
62
63
  // @ts-expect-error TS(7006) FIXME: Parameter 'err' implicitly has an 'any' type.
@@ -215,7 +215,6 @@ export class FunctionsRegistry {
215
215
  // we create a new watcher and watch them.
216
216
  if (srcFilesDiff.added.size !== 0) {
217
217
  const filesToWatch = [...srcFilesDiff.added, ...includedFiles];
218
- // @ts-expect-error TS(2345) FIXME: Argument of type '{ onChange: () => void; }' is no... Remove this comment to see the full error message
219
218
  const newWatcher = await watchDebounced(filesToWatch, {
220
219
  onChange: () => {
221
220
  this.buildFunctionAndWatchFiles(func, false);
@@ -86,7 +86,7 @@ command = "${chosenSettings.devCommand}"
86
86
  export const detectBuildSettings = async (command) => {
87
87
  const { project, workspacePackage } = command;
88
88
  const buildSettings = await project.getBuildSettings(project.workspace ? workspacePackage : '');
89
- return buildSettings
89
+ return (buildSettings
90
90
  // @ts-expect-error TS(7006) FIXME: Parameter 'setting' implicitly has an 'any' type.
91
91
  .filter((setting) => {
92
92
  if (project.workspace && project.relativeBaseDirectory && setting.packagePath) {
@@ -95,5 +95,5 @@ export const detectBuildSettings = async (command) => {
95
95
  return true;
96
96
  })
97
97
  // @ts-expect-error TS(7006) FIXME: Parameter 'setting' implicitly has an 'any' type.
98
- .filter((setting) => setting.devCommand);
98
+ .filter((setting) => setting.devCommand));
99
99
  };
@@ -209,41 +209,23 @@ export const normalizeConfig = (config) => {
209
209
  const DEBOUNCE_WAIT = 100;
210
210
  /**
211
211
  * Adds a file watcher to a path or set of paths and debounces the events.
212
- *
213
- * @param {string | string[]} target
214
- * @param {Object} opts
215
- * @param {number} [opts.depth]
216
- * @param {Array<string|RegExp>} [opts.ignored]
217
- * @param {(paths: string[]) => any} [opts.onAdd]
218
- * @param {(paths: string[]) => any} [opts.onChange]
219
- * @param {(paths: string[]) => any} [opts.onUnlink]
220
212
  */
221
- export const watchDebounced = async (
222
- // @ts-expect-error TS(7006) FIXME: Parameter 'target' implicitly has an 'any' type.
223
- target,
224
- // @ts-expect-error TS(7031) FIXME: Binding element 'depth' implicitly has an 'any' ty... Remove this comment to see the full error message
225
- { depth, ignored = [], onAdd = () => { }, onChange = () => { }, onUnlink = () => { } }) => {
213
+ export const watchDebounced = async (target, { depth, ignored = [], onAdd = noOp, onChange = noOp, onUnlink = noOp }) => {
226
214
  const baseIgnores = [/\/(node_modules|.git)\//];
227
215
  const watcher = chokidar.watch(target, { depth, ignored: [...baseIgnores, ...ignored], ignoreInitial: true });
228
216
  await once(watcher, 'ready');
229
- // @ts-expect-error TS(7034) FIXME: Variable 'onChangeQueue' implicitly has type 'any[... Remove this comment to see the full error message
230
217
  let onChangeQueue = [];
231
- // @ts-expect-error TS(7034) FIXME: Variable 'onAddQueue' implicitly has type 'any[]' ... Remove this comment to see the full error message
232
218
  let onAddQueue = [];
233
- // @ts-expect-error TS(7034) FIXME: Variable 'onUnlinkQueue' implicitly has type 'any[... Remove this comment to see the full error message
234
219
  let onUnlinkQueue = [];
235
220
  const debouncedOnChange = debounce(() => {
236
- // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1.
237
221
  onChange(onChangeQueue);
238
222
  onChangeQueue = [];
239
223
  }, DEBOUNCE_WAIT);
240
224
  const debouncedOnAdd = debounce(() => {
241
- // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1.
242
225
  onAdd(onAddQueue);
243
226
  onAddQueue = [];
244
227
  }, DEBOUNCE_WAIT);
245
228
  const debouncedOnUnlink = debounce(() => {
246
- // @ts-expect-error TS(2554) FIXME: Expected 0 arguments, but got 1.
247
229
  onUnlink(onUnlinkQueue);
248
230
  onUnlinkQueue = [];
249
231
  }, DEBOUNCE_WAIT);
@@ -271,3 +253,10 @@ target,
271
253
  // @ts-expect-error TS(7006) FIXME: Parameter 'text' implicitly has an 'any' type.
272
254
  export const getTerminalLink = (text, url) => terminalLink(text, url, { fallback: () => `${text} (${url})` });
273
255
  export const isNodeError = (err) => error instanceof Error;
256
+ // FIXME: tsc is throwing the following error:
257
+ // @ts-expect-error TS7060: This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint.
258
+ // Adding a trailing comma to the generic type fixes the problem, but annoyingly Prettier is undoing that.
259
+ export const nonNullable = (value) => value !== null && value !== undefined;
260
+ export const noOp = () => {
261
+ // no-op
262
+ };
@@ -21,7 +21,7 @@ const pluginsToAlwaysInstall = new Set(['@netlify/plugin-nextjs']);
21
21
  * @returns
22
22
  */
23
23
  export const getPluginsToAutoInstall = (pluginsInstalled = [], pluginsRecommended = []) => pluginsRecommended.reduce((acc, plugin) => pluginsInstalled.includes(plugin) && !pluginsToAlwaysInstall.has(plugin) ? acc : [...acc, plugin],
24
- /** @type {string[]} */ ([]));
24
+ /** @type {string[]} */ []);
25
25
  /**
26
26
  *
27
27
  * @param {Partial<import('@netlify/build-info').Settings>} settings
@@ -95,8 +95,8 @@ export const runCommand = (command, options = {}) => {
95
95
  }
96
96
  else {
97
97
  const errorMessage = result.failed
98
- // @ts-expect-error TS(2339) FIXME: Property 'shortMessage' does not exist on type 'Ex... Remove this comment to see the full error message
99
- ? `${NETLIFYDEVERR} ${result.shortMessage}`
98
+ ? // @ts-expect-error TS(2339) FIXME: Property 'shortMessage' does not exist on type 'Ex... Remove this comment to see the full error message
99
+ `${NETLIFYDEVERR} ${result.shortMessage}`
100
100
  : `${NETLIFYDEVWARN} "${command}" exited with code ${result.exitCode}`;
101
101
  log(`${errorMessage}. Shutting down Netlify Dev server`);
102
102
  }
@@ -19,7 +19,7 @@ function send(type, payload) {
19
19
  data: payload,
20
20
  type,
21
21
  });
22
- const args = /** @type {const} */ ([process.execPath, [requestFile, options]]);
22
+ const args = /** @type {const} */ [process.execPath, [requestFile, options]];
23
23
  if (process.env.NETLIFY_TEST_TELEMETRY_WAIT === 'true') {
24
24
  // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
25
25
  return execa(...args, {