netlify-cli 17.19.1 → 17.19.3

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 (36) hide show
  1. package/dist/commands/base-command.d.ts +4 -0
  2. package/dist/commands/base-command.d.ts.map +1 -1
  3. package/dist/commands/base-command.js +6 -0
  4. package/dist/commands/deploy/deploy.d.ts.map +1 -1
  5. package/dist/commands/deploy/deploy.js +23 -57
  6. package/dist/commands/dev/dev.d.ts.map +1 -1
  7. package/dist/commands/dev/dev.js +2 -1
  8. package/dist/commands/serve/serve.d.ts.map +1 -1
  9. package/dist/commands/serve/serve.js +1 -0
  10. package/dist/lib/edge-functions/deploy.d.ts +3 -6
  11. package/dist/lib/edge-functions/deploy.d.ts.map +1 -1
  12. package/dist/lib/edge-functions/deploy.js +0 -5
  13. package/dist/lib/edge-functions/proxy.d.ts +23 -41
  14. package/dist/lib/edge-functions/proxy.d.ts.map +1 -1
  15. package/dist/lib/edge-functions/proxy.js +7 -86
  16. package/dist/lib/edge-functions/registry.d.ts +5 -2
  17. package/dist/lib/edge-functions/registry.d.ts.map +1 -1
  18. package/dist/lib/edge-functions/registry.js +3 -3
  19. package/dist/lib/settings.d.ts +1 -0
  20. package/dist/lib/settings.d.ts.map +1 -1
  21. package/dist/lib/settings.js +1 -0
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/dist/utils/deploy/deploy-site.d.ts +4 -1
  24. package/dist/utils/deploy/deploy-site.d.ts.map +1 -1
  25. package/dist/utils/deploy/deploy-site.js +8 -18
  26. package/dist/utils/deploy/hash-fns.d.ts +14 -10
  27. package/dist/utils/deploy/hash-fns.d.ts.map +1 -1
  28. package/dist/utils/deploy/hash-fns.js +5 -34
  29. package/dist/utils/proxy-server.d.ts +2 -1
  30. package/dist/utils/proxy-server.d.ts.map +1 -1
  31. package/dist/utils/proxy-server.js +3 -0
  32. package/dist/utils/proxy.d.ts +2 -1
  33. package/dist/utils/proxy.d.ts.map +1 -1
  34. package/dist/utils/proxy.js +12 -9
  35. package/npm-shrinkwrap.json +236 -328
  36. package/package.json +3 -3
@@ -1,4 +1,6 @@
1
- export declare const deploySite: (api: any, siteId: any, dir: any, { assetType, branch, concurrentHash, concurrentUpload, config, deployId, deployTimeout, draft, filter, fnDir, functionsConfig, hashAlgorithm, manifestPath, maxRetry, siteEnv, siteRoot, skipFunctionsCache, statusCb, syncFileLimit, tmpDir, workingDir, }?: {
1
+ import BaseCommand from '../../commands/base-command.js';
2
+ import { type $TSFixMe } from '../../commands/types.js';
3
+ export declare const deploySite: (command: BaseCommand, api: $TSFixMe, siteId: any, dir: any, { assetType, branch, concurrentHash, concurrentUpload, config, deployId, deployTimeout, draft, filter, fnDir, functionsConfig, hashAlgorithm, manifestPath, maxRetry, siteRoot, skipFunctionsCache, statusCb, syncFileLimit, tmpDir, workingDir, }: {
2
4
  concurrentHash?: number | undefined;
3
5
  concurrentUpload?: number | undefined;
4
6
  deployTimeout?: number | undefined;
@@ -12,6 +14,7 @@ export declare const deploySite: (api: any, siteId: any, dir: any, { assetType,
12
14
  syncFileLimit?: number | undefined;
13
15
  tmpDir?: string | undefined;
14
16
  fnDir?: string[] | undefined;
17
+ workingDir: string;
15
18
  }) => Promise<{
16
19
  deployId: any;
17
20
  deploy: any;
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-site.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy/deploy-site.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,UAAU;;;;;;yBAiDC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;;;;;EA8I5E,CAAA"}
1
+ {"version":3,"file":"deploy-site.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy/deploy-site.ts"],"names":[],"mappings":"AAKA,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAwBvD,eAAO,MAAM,UAAU,YACZ,WAAW,OACf,QAAQ;;;;;;yBA4CS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;gBAI7D,MAAM;;;;;EAwIrB,CAAA"}
@@ -9,9 +9,12 @@ import hashFiles from './hash-files.js';
9
9
  import hashFns from './hash-fns.js';
10
10
  import uploadFiles from './upload-files.js';
11
11
  import { getUploadList, waitForDeploy, waitForDiff } from './util.js';
12
- export const deploySite = async (
13
- // @ts-expect-error TS(7006) FIXME: Parameter 'api' implicitly has an 'any' type.
14
- api,
12
+ const buildStatsString = (possibleParts) => {
13
+ const parts = possibleParts.filter(Boolean);
14
+ const message = parts.slice(0, -1).join(', ');
15
+ return parts.length > 1 ? `${message} and ${parts[parts.length - 1]}` : message;
16
+ };
17
+ export const deploySite = async (command, api,
15
18
  // @ts-expect-error TS(7006) FIXME: Parameter 'siteId' implicitly has an 'any' type.
16
19
  siteId,
17
20
  // @ts-expect-error TS(7006) FIXME: Parameter 'dir' implicitly has an 'any' type.
@@ -33,15 +36,11 @@ hashAlgorithm,
33
36
  // @ts-expect-error TS(2525) FIXME: Initializer provides no value for this binding ele... Remove this comment to see the full error message
34
37
  manifestPath, maxRetry = DEFAULT_MAX_RETRY,
35
38
  // @ts-expect-error TS(2525) FIXME: Initializer provides no value for this binding ele... Remove this comment to see the full error message
36
- siteEnv,
37
- // @ts-expect-error TS(2525) FIXME: Initializer provides no value for this binding ele... Remove this comment to see the full error message
38
39
  siteRoot,
39
40
  // @ts-expect-error TS(2525) FIXME: Initializer provides no value for this binding ele... Remove this comment to see the full error message
40
41
  skipFunctionsCache, statusCb = () => {
41
42
  /* default to noop */
42
- }, syncFileLimit = DEFAULT_SYNC_LIMIT, tmpDir = temporaryDirectory(),
43
- // @ts-expect-error TS(2525) FIXME: Initializer provides no value for this binding ele... Remove this comment to see the full error message
44
- workingDir, } = {}) => {
43
+ }, syncFileLimit = DEFAULT_SYNC_LIMIT, tmpDir = temporaryDirectory(), workingDir, }) => {
45
44
  statusCb({
46
45
  type: 'hashing',
47
46
  msg: `Hashing files...`,
@@ -58,18 +57,15 @@ workingDir, } = {}) => {
58
57
  normalizer: deployFileNormalizer.bind(null, workingDir),
59
58
  statusCb,
60
59
  }),
61
- hashFns(fnDir, {
60
+ hashFns(command, fnDir, {
62
61
  functionsConfig,
63
62
  tmpDir,
64
63
  concurrentHash,
65
64
  hashAlgorithm,
66
65
  statusCb,
67
66
  assetType,
68
- // @ts-expect-error TS(2345) FIXME: Argument of type '{ functionsConfig: any; tmpDir: ... Remove this comment to see the full error message
69
- workingDir,
70
67
  manifestPath,
71
68
  skipFunctionsCache,
72
- siteEnv,
73
69
  rootDir: siteRoot,
74
70
  }),
75
71
  hashConfig({ config }),
@@ -157,9 +153,3 @@ For more information, visit https://ntl.fyi/cli-native-modules.`);
157
153
  };
158
154
  return deployManifest;
159
155
  };
160
- // @ts-expect-error TS(7006) FIXME: Parameter 'possibleParts' implicitly has an 'any' ... Remove this comment to see the full error message
161
- const buildStatsString = (possibleParts) => {
162
- const parts = possibleParts.filter(Boolean);
163
- const message = parts.slice(0, -1).join(', ');
164
- return parts.length > 1 ? `${message} and ${parts[parts.length - 1]}` : message;
165
- };
@@ -1,13 +1,17 @@
1
- declare const hashFns: (directories: any, { assetType, concurrentHash, functionsConfig, hashAlgorithm, manifestPath, rootDir, skipFunctionsCache, statusCb, tmpDir, }: {
2
- assetType?: string | undefined;
3
- concurrentHash: any;
4
- functionsConfig: any;
5
- hashAlgorithm?: string | undefined;
6
- manifestPath: any;
7
- rootDir: any;
8
- skipFunctionsCache: any;
9
- statusCb: any;
10
- tmpDir: any;
1
+ import BaseCommand from '../../commands/base-command.js';
2
+ import { $TSFixMe } from '../../commands/types.js';
3
+ declare const hashFns: (command: BaseCommand, directories: string[], config: {
4
+ /** @default 'function' */
5
+ assetType?: string;
6
+ concurrentHash?: number;
7
+ functionsConfig: $TSFixMe;
8
+ /** @default 'sha256' */
9
+ hashAlgorithm?: string;
10
+ manifestPath: $TSFixMe;
11
+ rootDir: $TSFixMe;
12
+ skipFunctionsCache: $TSFixMe;
13
+ statusCb: $TSFixMe;
14
+ tmpDir: $TSFixMe;
11
15
  }) => Promise<{
12
16
  functions: {};
13
17
  functionsWithNativeModules: never[];
@@ -1 +1 @@
1
- {"version":3,"file":"hash-fns.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy/hash-fns.ts"],"names":[],"mappings":"AAsFA,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;EAkGZ,CAAA;AAED,eAAe,OAAO,CAAA"}
1
+ {"version":3,"file":"hash-fns.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy/hash-fns.ts"],"names":[],"mappings":"AAUA,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA+ElD,QAAA,MAAM,OAAO,YACF,WAAW,eACP,MAAM,EAAE,UACb;IACN,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,QAAQ,CAAA;IACzB,wBAAwB;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,QAAQ,CAAA;IACtB,OAAO,EAAE,QAAQ,CAAA;IACjB,kBAAkB,EAAE,QAAQ,CAAA;IAC5B,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,QAAQ,CAAA;CACjB;;;;;;;;;;;;;;EA0FF,CAAA;AAED,eAAe,OAAO,CAAA"}
@@ -6,27 +6,12 @@ import { zipFunctions } from '@netlify/zip-it-and-ship-it';
6
6
  import fromArray from 'from2-array';
7
7
  // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'pump... Remove this comment to see the full error message
8
8
  import pumpModule from 'pump';
9
- import { getPathInProject } from '../../lib/settings.js';
10
9
  import { INTERNAL_FUNCTIONS_FOLDER } from '../functions/functions.js';
11
10
  import { hasherCtor, manifestCollectorCtor } from './hasher-segments.js';
12
11
  const pump = promisify(pumpModule);
13
12
  // Maximum age of functions manifest (2 minutes).
14
13
  const MANIFEST_FILE_TTL = 12e4;
15
- const getFunctionZips = async ({
16
- // @ts-expect-error TS(7031) FIXME: Binding element 'directories' implicitly has an 'a... Remove this comment to see the full error message
17
- directories,
18
- // @ts-expect-error TS(7031) FIXME: Binding element 'functionsConfig' implicitly has a... Remove this comment to see the full error message
19
- functionsConfig,
20
- // @ts-expect-error TS(7031) FIXME: Binding element 'manifestPath' implicitly has an '... Remove this comment to see the full error message
21
- manifestPath,
22
- // @ts-expect-error TS(7031) FIXME: Binding element 'rootDir' implicitly has an 'any' ... Remove this comment to see the full error message
23
- rootDir,
24
- // @ts-expect-error TS(7031) FIXME: Binding element 'skipFunctionsCache' implicitly ha... Remove this comment to see the full error message
25
- skipFunctionsCache,
26
- // @ts-expect-error TS(7031) FIXME: Binding element 'statusCb' implicitly has an 'any'... Remove this comment to see the full error message
27
- statusCb,
28
- // @ts-expect-error TS(7031) FIXME: Binding element 'tmpDir' implicitly has an 'any' t... Remove this comment to see the full error message
29
- tmpDir, }) => {
14
+ const getFunctionZips = async ({ command, directories, functionsConfig, manifestPath, rootDir, skipFunctionsCache, statusCb, tmpDir, }) => {
30
15
  statusCb({
31
16
  type: 'functions-manifest',
32
17
  msg: 'Looking for a functions cache...',
@@ -68,27 +53,12 @@ tmpDir, }) => {
68
53
  }
69
54
  return await zipFunctions(directories, tmpDir, {
70
55
  basePath: rootDir,
71
- configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
56
+ configFileDirectories: [command.getPathInProject(INTERNAL_FUNCTIONS_FOLDER)],
72
57
  config: functionsConfig,
73
58
  });
74
59
  };
75
- const hashFns = async (
76
- // @ts-expect-error TS(7006) FIXME: Parameter 'directories' implicitly has an 'any' ty... Remove this comment to see the full error message
77
- directories, { assetType = 'function',
78
- // @ts-expect-error TS(7031) FIXME: Binding element 'concurrentHash' implicitly has an... Remove this comment to see the full error message
79
- concurrentHash,
80
- // @ts-expect-error TS(7031) FIXME: Binding element 'functionsConfig' implicitly has a... Remove this comment to see the full error message
81
- functionsConfig, hashAlgorithm = 'sha256',
82
- // @ts-expect-error TS(7031) FIXME: Binding element 'manifestPath' implicitly has an '... Remove this comment to see the full error message
83
- manifestPath,
84
- // @ts-expect-error TS(7031) FIXME: Binding element 'rootDir' implicitly has an 'any' ... Remove this comment to see the full error message
85
- rootDir,
86
- // @ts-expect-error TS(7031) FIXME: Binding element 'skipFunctionsCache' implicitly ha... Remove this comment to see the full error message
87
- skipFunctionsCache,
88
- // @ts-expect-error TS(7031) FIXME: Binding element 'statusCb' implicitly has an 'any'... Remove this comment to see the full error message
89
- statusCb,
90
- // @ts-expect-error TS(7031) FIXME: Binding element 'tmpDir' implicitly has an 'any' t... Remove this comment to see the full error message
91
- tmpDir, }) => {
60
+ const hashFns = async (command, directories, config) => {
61
+ const { assetType = 'function', concurrentHash, functionsConfig, hashAlgorithm = 'sha256', manifestPath, rootDir, skipFunctionsCache, statusCb, tmpDir, } = config || {};
92
62
  // Early out if no functions directories are configured.
93
63
  if (directories.length === 0) {
94
64
  return { functions: {}, functionsWithNativeModules: [], shaMap: {} };
@@ -97,6 +67,7 @@ tmpDir, }) => {
97
67
  throw new Error('Missing tmpDir directory for zipping files');
98
68
  }
99
69
  const functionZips = await getFunctionZips({
70
+ command,
100
71
  directories,
101
72
  functionsConfig,
102
73
  manifestPath,
@@ -38,10 +38,11 @@ export declare const generateInspectSettings: (edgeInspect: any, edgeInspectBrk:
38
38
  * @param {import('../lib/functions/registry.js').FunctionsRegistry=} params.functionsRegistry
39
39
  * @returns
40
40
  */
41
- export declare const startProxyServer: ({ accountId, addonsUrls, blobsContext, config, configPath, debug, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, site, siteInfo, state, }: {
41
+ export declare const startProxyServer: ({ accountId, addonsUrls, blobsContext, command, config, configPath, debug, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, site, siteInfo, state, }: {
42
42
  accountId: any;
43
43
  addonsUrls: any;
44
44
  blobsContext: any;
45
+ command: any;
45
46
  config: any;
46
47
  configPath: any;
47
48
  debug: any;
@@ -1 +1 @@
1
- {"version":3,"file":"proxy-server.d.ts","sourceRoot":"","sources":["../../src/utils/proxy-server.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB;;;;CAiBnC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;qBAkE5B,CAAA"}
1
+ {"version":3,"file":"proxy-server.d.ts","sourceRoot":"","sources":["../../src/utils/proxy-server.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB;;;;CAiBnC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;qBAqE5B,CAAA"}
@@ -60,6 +60,8 @@ accountId,
60
60
  addonsUrls,
61
61
  // @ts-expect-error TS(7031) FIXME: Binding element 'blobsContext' implicitly has an '... Remove this comment to see the full error message
62
62
  blobsContext,
63
+ // @ts-expect-error TS(7031) FIXME: Binding element 'accountId' implicitly has an 'any... Remove this comment to see the full error message
64
+ command,
63
65
  // @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
64
66
  config,
65
67
  // @ts-expect-error TS(7031) FIXME: Binding element 'configPath' implicitly has an 'an... Remove this comment to see the full error message
@@ -95,6 +97,7 @@ state, }) => {
95
97
  const url = await startProxy({
96
98
  addonsUrls,
97
99
  blobsContext,
100
+ command,
98
101
  config,
99
102
  configPath: configPath || site.configPath,
100
103
  debug,
@@ -3,10 +3,11 @@
3
3
  * @returns
4
4
  */
5
5
  export declare const getProxyUrl: (settings: any) => string;
6
- export declare const startProxy: ({ accountId, addonsUrls, blobsContext, config, configPath, debug, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, siteInfo, state, }: {
6
+ export declare const startProxy: ({ accountId, addonsUrls, blobsContext, command, config, configPath, debug, env, functionsRegistry, geoCountry, geolocationMode, getUpdatedConfig, inspectSettings, offline, projectDir, repositoryRoot, settings, siteInfo, state, }: {
7
7
  accountId: any;
8
8
  addonsUrls: any;
9
9
  blobsContext: any;
10
+ command: any;
10
11
  config: any;
11
12
  configPath: any;
12
13
  debug: any;
@@ -1 +1 @@
1
- {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/utils/proxy.ts"],"names":[],"mappings":"AA0xBA;;;GAGG;AAEH,eAAO,MAAM,WAAW,2BAGvB,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;qBAgItB,CAAA"}
1
+ {"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/utils/proxy.ts"],"names":[],"mappings":"AA0xBA;;;GAGG;AAEH,eAAO,MAAM,WAAW,2BAGvB,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;qBAmItB,CAAA"}
@@ -354,23 +354,23 @@ const reqToURL = function (req, pathname) {
354
354
  const MILLISEC_TO_SEC = 1e3;
355
355
  const initializeProxy = async function ({
356
356
  // @ts-expect-error TS(7031) FIXME: Binding element 'configPath' implicitly has an 'any... Remove this comment to see the full error message
357
- configPath,
357
+ config,
358
358
  // @ts-expect-error TS(7031) FIXME: Binding element 'distDir' implicitly has an 'any... Remove this comment to see the full error message
359
- distDir,
359
+ configPath,
360
360
  // @ts-expect-error TS(7031) FIXME: Binding element 'env' implicitly has an 'any... Remove this comment to see the full error message
361
- env,
361
+ distDir,
362
362
  // @ts-expect-error TS(7031) FIXME: Binding element 'host' implicitly has an 'any... Remove this comment to see the full error message
363
- host,
363
+ env,
364
364
  // @ts-expect-error TS(7031) FIXME: Binding element 'imageProxy' implicitly has an 'any... Remove this comment to see the full error message
365
- imageProxy,
365
+ host,
366
366
  // @ts-expect-error TS(7031) FIXME: Binding element 'port' implicitly has an 'any... Remove this comment to see the full error message
367
- port,
367
+ imageProxy,
368
368
  // @ts-expect-error TS(7031) FIXME: Binding element 'projectDir' implicitly has an 'any... Remove this comment to see the full error message
369
- projectDir,
369
+ port,
370
370
  // @ts-expect-error TS(7031) FIXME: Binding element 'siteInfo' implicitly has an 'any... Remove this comment to see the full error message
371
- siteInfo,
371
+ projectDir,
372
372
  // @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any... Remove this comment to see the full error message
373
- config, }) {
373
+ siteInfo, }) {
374
374
  const proxy = httpProxy.createProxyServer({
375
375
  selfHandleResponse: true,
376
376
  target: {
@@ -669,6 +669,8 @@ accountId,
669
669
  addonsUrls,
670
670
  // @ts-expect-error TS(7031) FIXME: Binding element 'blobsContext' implicitly has an '... Remove this comment to see the full error message
671
671
  blobsContext,
672
+ // @ts-expect-error TS(7031) FIXME: Binding element 'accountId' implicitly has an 'any... Remove this comment to see the full error message
673
+ command,
672
674
  // @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
673
675
  config,
674
676
  // @ts-expect-error TS(7031) FIXME: Binding element 'configPath' implicitly has an 'an... Remove this comment to see the full error message
@@ -702,6 +704,7 @@ state, }) {
702
704
  const secondaryServerPort = settings.https ? await getAvailablePort() : null;
703
705
  const functionsServer = settings.functionsPort ? `http://127.0.0.1:${settings.functionsPort}` : null;
704
706
  const edgeFunctionsProxy = await initializeEdgeFunctionsProxy({
707
+ command,
705
708
  blobsContext,
706
709
  config,
707
710
  configPath,