netlify-cli 18.1.0 → 19.0.1-rc.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.
Files changed (82) hide show
  1. package/dist/commands/base-command.d.ts.map +1 -1
  2. package/dist/commands/base-command.js +2 -13
  3. package/dist/commands/blobs/blobs.js +2 -2
  4. package/dist/commands/build/build.d.ts +4 -11
  5. package/dist/commands/build/build.d.ts.map +1 -1
  6. package/dist/commands/build/build.js +1 -7
  7. package/dist/commands/build/index.js +1 -1
  8. package/dist/commands/completion/completion.d.ts.map +1 -1
  9. package/dist/commands/completion/completion.js +0 -1
  10. package/dist/commands/deploy/index.d.ts.map +1 -1
  11. package/dist/commands/deploy/index.js +5 -6
  12. package/dist/commands/dev/dev.d.ts.map +1 -1
  13. package/dist/commands/dev/dev.js +1 -15
  14. package/dist/commands/env/env-list.d.ts +2 -2
  15. package/dist/commands/env/env-list.d.ts.map +1 -1
  16. package/dist/commands/env/env.d.ts.map +1 -1
  17. package/dist/commands/env/env.js +5 -4
  18. package/dist/commands/functions/functions.d.ts +1 -1
  19. package/dist/commands/functions/functions.d.ts.map +1 -1
  20. package/dist/commands/functions/functions.js +4 -2
  21. package/dist/commands/init/index.d.ts.map +1 -1
  22. package/dist/commands/init/index.js +0 -2
  23. package/dist/commands/link/index.d.ts.map +1 -1
  24. package/dist/commands/link/index.js +0 -2
  25. package/dist/commands/main.d.ts.map +1 -1
  26. package/dist/commands/main.js +0 -3
  27. package/dist/commands/serve/index.d.ts.map +1 -1
  28. package/dist/commands/serve/index.js +1 -4
  29. package/dist/commands/status/index.d.ts +1 -1
  30. package/dist/commands/status/index.d.ts.map +1 -1
  31. package/dist/commands/status/index.js +2 -1
  32. package/dist/lib/build.d.ts +36 -67
  33. package/dist/lib/build.d.ts.map +1 -1
  34. package/dist/lib/build.js +6 -41
  35. package/dist/lib/completion/script.js +0 -1
  36. package/dist/lib/functions/form-submissions-handler.d.ts.map +1 -1
  37. package/dist/lib/functions/form-submissions-handler.js +0 -2
  38. package/dist/lib/functions/runtimes/js/builders/netlify-lambda.d.ts.map +1 -1
  39. package/dist/lib/functions/runtimes/js/builders/netlify-lambda.js +8 -7
  40. package/dist/lib/functions/runtimes/js/builders/zisi.d.ts.map +1 -1
  41. package/dist/lib/functions/runtimes/js/builders/zisi.js +0 -1
  42. package/dist/lib/functions/runtimes/js/worker.js +0 -1
  43. package/dist/recipes/vscode/settings.d.ts.map +1 -1
  44. package/dist/recipes/vscode/settings.js +5 -4
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/dist/utils/command-helpers.d.ts +2 -2
  47. package/dist/utils/command-helpers.js +1 -1
  48. package/dist/utils/deploy/hash-files.js +3 -3
  49. package/dist/utils/deploy/hash-fns.d.ts.map +1 -1
  50. package/dist/utils/deploy/hash-fns.js +3 -2
  51. package/dist/utils/deploy/hasher-segments.d.ts +3 -3
  52. package/dist/utils/deploy/hasher-segments.d.ts.map +1 -1
  53. package/dist/utils/deploy/hasher-segments.js +2 -9
  54. package/dist/utils/framework-server.d.ts.map +1 -1
  55. package/dist/utils/framework-server.js +3 -2
  56. package/dist/utils/get-global-config.d.ts.map +1 -1
  57. package/dist/utils/get-global-config.js +2 -2
  58. package/dist/utils/get-repo-data.d.ts +4 -4
  59. package/dist/utils/get-repo-data.d.ts.map +1 -1
  60. package/dist/utils/get-repo-data.js +7 -6
  61. package/dist/utils/open-browser.d.ts.map +1 -1
  62. package/dist/utils/open-browser.js +1 -2
  63. package/dist/utils/proxy.d.ts.map +1 -1
  64. package/dist/utils/proxy.js +0 -3
  65. package/dist/utils/rules-proxy.d.ts.map +1 -1
  66. package/dist/utils/rules-proxy.js +0 -1
  67. package/dist/utils/run-build.d.ts.map +1 -1
  68. package/dist/utils/run-build.js +7 -2
  69. package/dist/utils/sites/create-template.d.ts.map +1 -1
  70. package/dist/utils/sites/create-template.js +2 -3
  71. package/dist/utils/state-config.d.ts.map +1 -1
  72. package/dist/utils/state-config.js +0 -1
  73. package/dist/utils/types.d.ts +7 -0
  74. package/dist/utils/types.d.ts.map +1 -1
  75. package/npm-shrinkwrap.json +829 -172
  76. package/package.json +7 -10
  77. package/dist/commands/integration/deploy.d.ts +0 -8
  78. package/dist/commands/integration/deploy.d.ts.map +0 -1
  79. package/dist/commands/integration/deploy.js +0 -353
  80. package/dist/commands/integration/index.d.ts +0 -4
  81. package/dist/commands/integration/index.d.ts.map +0 -1
  82. package/dist/commands/integration/index.js +0 -26
package/dist/lib/build.js CHANGED
@@ -6,43 +6,12 @@ import tomlify from 'tomlify-j0.4';
6
6
  import { getFeatureFlagsFromSiteInfo } from '../utils/feature-flags.js';
7
7
  import { getBootstrapURL } from './edge-functions/bootstrap.js';
8
8
  import { featureFlags as edgeFunctionsFeatureFlags } from './edge-functions/consts.js';
9
- /**
10
- * The buildConfig + a missing cachedConfig
11
- * @typedef BuildConfig
12
- * @type {Parameters<import('@netlify/build/src/core/main.js')>[0] & {cachedConfig: any}}
13
- */
14
9
  // We have already resolved the configuration using `@netlify/config`
15
10
  // This is stored as `netlify.cachedConfig` and can be passed to
16
11
  // `@netlify/build --cachedConfig`.
17
- /**
18
- *
19
- * @param {object} config
20
- * @param {*} config.cachedConfig
21
- * @param {string} [config.packagePath]
22
- * @param {string} config.currentDir
23
- * @param {string} config.token
24
- * @param {import('commander').OptionValues} config.options
25
- * @param {*} config.deployHandler
26
- * @returns {BuildConfig}
27
- */
28
- export const getBuildOptions = async ({
29
- // @ts-expect-error TS(7031) FIXME: Binding element 'cachedConfig' implicitly has an '... Remove this comment to see the full error message
30
- cachedConfig,
31
- // @ts-expect-error TS(7031) FIXME: Binding element 'currentDir' implicitly has an 'an... Remove this comment to see the full error message
32
- currentDir,
33
- // @ts-expect-error TS(7031) FIXME: Binding element 'defaultConfig' implicitly has an '... Remove this comment to see the full error message
34
- defaultConfig,
35
- // @ts-expect-error TS(7031) FIXME: Binding element 'deployHandler' implicitly has an ... Remove this comment to see the full error message
36
- deployHandler,
37
- // @ts-expect-error TS(7031) FIXME: Binding element 'context' implicitly has an 'any' ... Remove this comment to see the full error message
38
- options: { context, cwd, debug, dry, json, offline, silent },
39
- // @ts-expect-error TS(7031) FIXME: Binding element 'packagePath' implicitly has an 'a... Remove this comment to see the full error message
40
- packagePath,
41
- // @ts-expect-error TS(7031) FIXME: Binding element 'token' implicitly has an 'any' ty... Remove this comment to see the full error message
42
- token, }) => {
12
+ export const getBuildOptions = async ({ cachedConfig, currentDir, defaultConfig, deployHandler, options: { context, cwd, debug, dry, json, offline, silent }, packagePath, token, }) => {
43
13
  const eventHandlers = {
44
14
  onEnd: {
45
- // @ts-expect-error TS(7031) FIXME: Binding element 'netlifyConfig' implicitly has an ... Remove this comment to see the full error message
46
15
  handler: ({ netlifyConfig }) => {
47
16
  const string = tomlify.toToml(netlifyConfig);
48
17
  if (!fs.existsSync(`${currentDir}/.netlify`)) {
@@ -55,7 +24,6 @@ token, }) => {
55
24
  },
56
25
  };
57
26
  if (deployHandler) {
58
- // @ts-expect-error TS(2339) FIXME: Property 'onPostBuild' does not exist on type '{ o... Remove this comment to see the full error message
59
27
  eventHandlers.onPostBuild = {
60
28
  handler: deployHandler,
61
29
  description: 'Deploy Site',
@@ -63,11 +31,11 @@ token, }) => {
63
31
  }
64
32
  return {
65
33
  cachedConfig,
66
- defaultConfig,
34
+ defaultConfig: defaultConfig ?? {},
67
35
  siteId: cachedConfig.siteInfo.id,
68
36
  accountId: cachedConfig.siteInfo.account_id,
69
37
  packagePath,
70
- token,
38
+ token: token ?? undefined,
71
39
  dry,
72
40
  debug,
73
41
  context,
@@ -82,16 +50,11 @@ token, }) => {
82
50
  ...getFeatureFlagsFromSiteInfo(cachedConfig.siteInfo),
83
51
  functionsBundlingManifest: true,
84
52
  },
53
+ // @ts-expect-error(serhalp) -- TODO(serhalp) Upstream the type fixes above into @netlify/build
85
54
  eventHandlers,
86
55
  edgeFunctionsBootstrapURL: await getBootstrapURL(),
87
56
  };
88
57
  };
89
- /**
90
- * run the build command
91
- * @param {BuildConfig} options
92
- * @returns
93
- */
94
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
95
58
  export const runBuild = async (options) => {
96
59
  // If netlify NETLIFY_API_URL is set we need to pass this information to @netlify/build
97
60
  // TODO don't use testOpts, but add real properties to do this.
@@ -101,6 +64,8 @@ export const runBuild = async (options) => {
101
64
  scheme: apiUrl.protocol.slice(0, -1),
102
65
  host: apiUrl.host,
103
66
  };
67
+ // @ts-expect-error(serhalp) -- I don't know what's going on here and I can't convince myself it even works as
68
+ // intended. TODO(serhalp) Investigate and fix types.
104
69
  options = { ...options, testOpts };
105
70
  }
106
71
  const { configMutations, netlifyConfig: newConfig, severityCode: exitCode } = await build(options);
@@ -4,7 +4,6 @@
4
4
  // if this file is renamed or moved then it needs to be adapted there
5
5
  import { existsSync, readFileSync } from 'fs';
6
6
  import process from 'process';
7
- // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'tabt... Remove this comment to see the full error message
8
7
  import { log, parseEnv } from 'tabtab';
9
8
  import { AUTOCOMPLETION_FILE } from './constants.js';
10
9
  import getAutocompletion from './get-autocompletion.js';
@@ -1 +1 @@
1
- {"version":3,"file":"form-submissions-handler.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/form-submissions-handler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAU7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,cAAc,uCAGxB;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,uBAmBA,CAAA;AAED,eAAO,MAAM,2BAA2B,oCAGrC;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,EAAE,MAAM,CAAA;CAChB,KAAG,cAwIH,CAAA"}
1
+ {"version":3,"file":"form-submissions-handler.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/form-submissions-handler.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAS7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,eAAO,MAAM,cAAc,uCAGxB;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,uBAmBA,CAAA;AAED,eAAO,MAAM,2BAA2B,oCAGrC;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,OAAO,EAAE,MAAM,CAAA;CAChB,KAAG,cAwIH,CAAA"}
@@ -1,7 +1,5 @@
1
1
  import { Readable } from 'stream';
2
- // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'cont... Remove this comment to see the full error message
3
2
  import { parse as parseContentType } from 'content-type';
4
- // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'mult... Remove this comment to see the full error message
5
3
  import multiparty from 'multiparty';
6
4
  import getRawBody from 'raw-body';
7
5
  import { warn } from '../../utils/command-helpers.js';
@@ -1 +1 @@
1
- {"version":3,"file":"netlify-lambda.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/netlify-lambda.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB;;;;;;;;EAqD/B,CAAA;AAED,wBAA8B,OAAO;;;;;;;;GASpC"}
1
+ {"version":3,"file":"netlify-lambda.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/netlify-lambda.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB;;;;;;;;EAuD/B,CAAA;AAED,wBAA8B,OAAO;;;;;;;;GASpC"}
@@ -1,6 +1,6 @@
1
1
  import { readFile } from 'fs/promises';
2
2
  import { resolve } from 'path';
3
- import { program } from 'commander';
3
+ import { Command } from 'commander';
4
4
  import execa from '../../../../../utils/execa.js';
5
5
  import { fileExistsAsync } from '../../../../fs.js';
6
6
  import { memoizedBuild } from '../../../memoized-build.js';
@@ -10,17 +10,18 @@ export const detectNetlifyLambda = async function ({ packageJson } = {}) {
10
10
  if (!((dependencies && dependencies['netlify-lambda']) || (devDependencies && devDependencies['netlify-lambda']))) {
11
11
  return false;
12
12
  }
13
+ const program = new Command()
14
+ .option('-s, --static')
15
+ .option('-c, --config [file]')
16
+ .option('-p, --port [number]')
17
+ .option('-b, --babelrc [file]')
18
+ .option('-t, --timeout [delay]');
19
+ program.allowExcessArguments();
13
20
  // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
14
21
  const matchingScripts = Object.entries(scripts).filter(([, script]) => script.match(/netlify-lambda\s+build/));
15
22
  for (const [key, script] of matchingScripts) {
16
23
  // E.g. ["netlify-lambda", "build", "functions/folder"]
17
24
  // these are all valid options for netlify-lambda
18
- program
19
- .option('-s, --static')
20
- .option('-c, --config [file]')
21
- .option('-p, --port [number]')
22
- .option('-b, --babelrc [file]')
23
- .option('-t, --timeout [delay]');
24
25
  program.parse(script.split(' ') ?? []);
25
26
  // We are not interested in 'netlify-lambda' and 'build' commands
26
27
  const functionDirectories = program.args.filter((arg) => !['netlify-lambda', 'build'].includes(arg));
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"zisi.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/functions/runtimes/js/builders/zisi.ts"],"names":[],"mappings":"AA+GA;;;;;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"}
@@ -4,7 +4,6 @@ import path from 'path';
4
4
  import { zipFunction, listFunction } from '@netlify/zip-it-and-ship-it';
5
5
  import decache from 'decache';
6
6
  import { readPackageUp } from 'read-package-up';
7
- // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'sour... Remove this comment to see the full error message
8
7
  import sourceMapSupport from 'source-map-support';
9
8
  import { NETLIFYDEVERR } from '../../../../../utils/command-helpers.js';
10
9
  import { SERVE_FUNCTIONS_FOLDER } from '../../../../../utils/functions/functions.js';
@@ -3,7 +3,6 @@ import process from 'process';
3
3
  import { isMainThread, workerData, parentPort } from 'worker_threads';
4
4
  import { isStream } from 'is-stream';
5
5
  import lambdaLocal from 'lambda-local';
6
- // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'sour... Remove this comment to see the full error message
7
6
  import sourceMapSupport from 'source-map-support';
8
7
  if (isMainThread) {
9
8
  throw new Error(`Do not import "${import.meta.url}" in the main thread.`);
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/recipes/vscode/settings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,eAAO,MAAM,aAAa;;;;SAwBzB,CAAA;AAGD,eAAO,MAAM,WAAW;;;;;;EA0BvB,CAAA;AAGD,eAAO,MAAM,aAAa;;;mBAKzB,CAAA"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/recipes/vscode/settings.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAKrC,eAAO,MAAM,aAAa;;;;SA0BzB,CAAA;AAGD,eAAO,MAAM,WAAW;;;;;;EA0BvB,CAAA;AAGD,eAAO,MAAM,aAAa;;;mBAKzB,CAAA"}
@@ -1,11 +1,12 @@
1
1
  import { mkdir, readFile, stat, writeFile } from 'fs/promises';
2
- import { dirname, relative } from 'path';
2
+ import { dirname, posix, relative } from 'path';
3
3
  import * as JSONC from 'comment-json';
4
- // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'unix... Remove this comment to see the full error message
5
- import unixify from 'unixify';
4
+ const toUnixPath = (path) => path.replace(/\\/g, '/');
6
5
  // @ts-expect-error TS(7006) FIXME: Parameter 'existingSettings' implicitly has an 'an... Remove this comment to see the full error message
7
6
  export const applySettings = (existingSettings, { denoBinary, edgeFunctionsPath, repositoryRoot }) => {
8
- const relativeEdgeFunctionsPath = unixify(relative(repositoryRoot, edgeFunctionsPath));
7
+ // TODO(serhalp) I'm not convinced we want to convert to Unix paths on Windows? Does this even work? Was this a
8
+ // workaround for something, perhaps https://github.com/denoland/vscode_deno/pull/745?
9
+ const relativeEdgeFunctionsPath = toUnixPath(posix.normalize(relative(repositoryRoot, edgeFunctionsPath)));
9
10
  const settings = JSONC.assign(existingSettings, {
10
11
  'deno.enable': true,
11
12
  'deno.enablePaths': existingSettings['deno.enablePaths'] || [],