netlify-cli 17.30.0 → 17.32.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":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,oBAAoB,aAAc,MAAM,oBAAa,OACa,CAAA;AAE/E;;GAEG;AACH,eAAO,MAAM,2BAA2B,aAAc;IACpD,aAAa,CAAC,EAAE,OAAO,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;CAC1D,KAAG,YAIF,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,oBAAoB,aAAc,MAAM,oBAAa,OACa,CAAA;AAE/E;;GAEG;AACH,eAAO,MAAM,2BAA2B,aAAc;IACpD,aAAa,CAAC,EAAE,OAAO,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;CAC1D,KAAG,YAKF,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA"}
@@ -19,4 +19,5 @@ export const getFeatureFlagsFromSiteInfo = (siteInfo) => ({
19
19
  ...(siteInfo.feature_flags || {}),
20
20
  // see https://github.com/netlify/pod-dev-foundations/issues/581#issuecomment-1731022753
21
21
  zisi_golang_use_al2: isFeatureFlagEnabled('cli_golang_use_al2', siteInfo),
22
+ netlify_build_frameworks_api: true,
22
23
  });
@@ -0,0 +1,20 @@
1
+ import type { NetlifyOptions } from '../commands/types.js';
2
+ interface FrameworksAPIPath {
3
+ path: string;
4
+ ensureExists: () => Promise<void>;
5
+ exists: () => Promise<boolean>;
6
+ }
7
+ export type FrameworksAPIPaths = ReturnType<typeof getFrameworksAPIPaths>;
8
+ /**
9
+ * Returns an object containing the paths for all the operations of the
10
+ * Frameworks API. Each key maps to an object containing a `path` property with
11
+ * the path of the operation, an `exists` method that returns whether the path
12
+ * exists, and an `ensureExists` method that creates it in case it doesn't.
13
+ */
14
+ export declare const getFrameworksAPIPaths: (basePath: string, packagePath?: string) => Record<"config" | "functions" | "blobs" | "root" | "edgeFunctions" | "edgeFunctionsImportMap", FrameworksAPIPath>;
15
+ /**
16
+ * Merges a config object with any config options from the Frameworks API.
17
+ */
18
+ export declare const getFrameworksAPIConfig: (config: NetlifyOptions['config'], frameworksAPIConfigPath: string) => Promise<import("../commands/types.js").PatchedConfig>;
19
+ export {};
20
+ //# sourceMappingURL=frameworks-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frameworks-api.d.ts","sourceRoot":"","sources":["../../src/utils/frameworks-api.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CAC/B;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,aAAc,MAAM,gBAAgB,MAAM,sHAiC3E,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,WAAkB,cAAc,CAAC,QAAQ,CAAC,2BAA2B,MAAM,0DAY7G,CAAA"}
@@ -0,0 +1,53 @@
1
+ import { access, mkdir, readFile } from 'node:fs/promises';
2
+ import { resolve } from 'node:path';
3
+ import { mergeConfigs } from '@netlify/config';
4
+ /**
5
+ * Returns an object containing the paths for all the operations of the
6
+ * Frameworks API. Each key maps to an object containing a `path` property with
7
+ * the path of the operation, an `exists` method that returns whether the path
8
+ * exists, and an `ensureExists` method that creates it in case it doesn't.
9
+ */
10
+ export const getFrameworksAPIPaths = (basePath, packagePath) => {
11
+ const root = resolve(basePath, packagePath || '', '.netlify/v1');
12
+ const edgeFunctions = resolve(root, 'edge-functions');
13
+ const paths = {
14
+ root,
15
+ config: resolve(root, 'config.json'),
16
+ functions: resolve(root, 'functions'),
17
+ edgeFunctions,
18
+ edgeFunctionsImportMap: resolve(edgeFunctions, 'import_map.json'),
19
+ blobs: resolve(root, 'blobs'),
20
+ };
21
+ return Object.entries(paths).reduce((acc, [name, path]) => ({
22
+ ...acc,
23
+ [name]: {
24
+ path,
25
+ ensureExists: async () => {
26
+ await mkdir(path, { recursive: true });
27
+ },
28
+ exists: async () => {
29
+ try {
30
+ await access(path);
31
+ return true;
32
+ }
33
+ catch {
34
+ return false;
35
+ }
36
+ },
37
+ },
38
+ }), {});
39
+ };
40
+ /**
41
+ * Merges a config object with any config options from the Frameworks API.
42
+ */
43
+ export const getFrameworksAPIConfig = async (config, frameworksAPIConfigPath) => {
44
+ let frameworksAPIConfigFile;
45
+ try {
46
+ frameworksAPIConfigFile = await readFile(frameworksAPIConfigPath, 'utf8');
47
+ }
48
+ catch {
49
+ return config;
50
+ }
51
+ const frameworksAPIConfig = JSON.parse(frameworksAPIConfigFile);
52
+ return mergeConfigs([frameworksAPIConfig, config], { concatenateArrays: true });
53
+ };
@@ -4,6 +4,7 @@ import { readFile } from 'fs/promises';
4
4
  import http from 'http';
5
5
  import https from 'https';
6
6
  import { isIPv6 } from 'net';
7
+ import { Readable } from 'node:stream';
7
8
  import path from 'path';
8
9
  import process from 'process';
9
10
  import util from 'util';
@@ -21,7 +22,6 @@ import { createProxyMiddleware } from 'http-proxy-middleware';
21
22
  import { jwtDecode } from 'jwt-decode';
22
23
  import { locatePath } from 'locate-path';
23
24
  import pFilter from 'p-filter';
24
- import toReadableStream from 'to-readable-stream';
25
25
  import throttle from 'lodash/throttle.js';
26
26
  import { handleProxyRequest, initializeProxy as initializeEdgeFunctionsProxy, isEdgeFunctionsRequest, } from '../lib/edge-functions/proxy.js';
27
27
  import { fileExistsAsync, isFileAsync } from '../lib/fs.js';
@@ -129,7 +129,7 @@ const proxyToExternalUrl = function ({ dest, destURL, req, res, }) {
129
129
  pathRewrite: () => destURL,
130
130
  // hide logging
131
131
  logLevel: 'warn',
132
- ...(Buffer.isBuffer(req.originalBody) && { buffer: toReadableStream(req.originalBody) }),
132
+ ...(Buffer.isBuffer(req.originalBody) && { buffer: Readable.from(req.originalBody) }),
133
133
  });
134
134
  // @ts-expect-error TS(2345) FIXME: Argument of type 'Request' is not assignable to parameter of type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>'.
135
135
  return handler(req, res, () => { });
@@ -25,11 +25,10 @@ const copyConfig = async (configPath, destinationFolder) => {
25
25
  }
26
26
  return newConfigPath;
27
27
  };
28
- /**
29
- * @param {string} basePath
30
- */
31
- // @ts-expect-error TS(7006) FIXME: Parameter 'basePath' implicitly has an 'any' type.
32
28
  const cleanInternalDirectory = async (basePath) => {
29
+ if (!basePath) {
30
+ return;
31
+ }
33
32
  const ops = [INTERNAL_FUNCTIONS_FOLDER, INTERNAL_EDGE_FUNCTIONS_FOLDER, 'netlify.toml'].map((name) => {
34
33
  const fullPath = path.resolve(basePath, getPathInProject([name]));
35
34
  return fs.rm(fullPath, { force: true, recursive: true });
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "17.30.0",
3
+ "version": "17.32.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "17.30.0",
9
+ "version": "17.32.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
@@ -66,7 +66,7 @@
66
66
  "hasha": "5.2.2",
67
67
  "http-proxy": "1.18.1",
68
68
  "http-proxy-middleware": "2.0.6",
69
- "https-proxy-agent": "7.0.4",
69
+ "https-proxy-agent": "7.0.5",
70
70
  "inquirer": "6.5.2",
71
71
  "inquirer-autocomplete-prompt": "1.4.0",
72
72
  "ipx": "2.1.0",
@@ -113,7 +113,6 @@
113
113
  "terminal-link": "3.0.0",
114
114
  "through2-filter": "4.0.0",
115
115
  "through2-map": "4.0.0",
116
- "to-readable-stream": "3.0.0",
117
116
  "toml": "3.0.0",
118
117
  "tomlify-j0.4": "3.0.0",
119
118
  "ulid": "2.3.0",
@@ -8622,9 +8621,9 @@
8622
8621
  }
8623
8622
  },
8624
8623
  "node_modules/https-proxy-agent": {
8625
- "version": "7.0.4",
8626
- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz",
8627
- "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==",
8624
+ "version": "7.0.5",
8625
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz",
8626
+ "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==",
8628
8627
  "dependencies": {
8629
8628
  "agent-base": "^7.0.2",
8630
8629
  "debug": "4"
@@ -13443,17 +13442,6 @@
13443
13442
  "node": ">=4"
13444
13443
  }
13445
13444
  },
13446
- "node_modules/to-readable-stream": {
13447
- "version": "3.0.0",
13448
- "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-3.0.0.tgz",
13449
- "integrity": "sha512-vD2LytT6DxPynBa1xbMtswY9gGqj27wNbh2uvI5OhBe+mrGLurRWRQZyQn3812sqlQRtUJwaKVshG+PoGwbPDQ==",
13450
- "engines": {
13451
- "node": ">=12"
13452
- },
13453
- "funding": {
13454
- "url": "https://github.com/sponsors/sindresorhus"
13455
- }
13456
- },
13457
13445
  "node_modules/to-regex-range": {
13458
13446
  "version": "5.0.1",
13459
13447
  "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@@ -20159,9 +20147,9 @@
20159
20147
  }
20160
20148
  },
20161
20149
  "https-proxy-agent": {
20162
- "version": "7.0.4",
20163
- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz",
20164
- "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==",
20150
+ "version": "7.0.5",
20151
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz",
20152
+ "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==",
20165
20153
  "requires": {
20166
20154
  "agent-base": "^7.0.2",
20167
20155
  "debug": "4"
@@ -23563,11 +23551,6 @@
23563
23551
  "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
23564
23552
  "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4="
23565
23553
  },
23566
- "to-readable-stream": {
23567
- "version": "3.0.0",
23568
- "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-3.0.0.tgz",
23569
- "integrity": "sha512-vD2LytT6DxPynBa1xbMtswY9gGqj27wNbh2uvI5OhBe+mrGLurRWRQZyQn3812sqlQRtUJwaKVshG+PoGwbPDQ=="
23570
- },
23571
23554
  "to-regex-range": {
23572
23555
  "version": "5.0.1",
23573
23556
  "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "17.30.0",
4
+ "version": "17.32.0",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "engines": {
@@ -91,7 +91,7 @@
91
91
  "hasha": "5.2.2",
92
92
  "http-proxy": "1.18.1",
93
93
  "http-proxy-middleware": "2.0.6",
94
- "https-proxy-agent": "7.0.4",
94
+ "https-proxy-agent": "7.0.5",
95
95
  "inquirer": "6.5.2",
96
96
  "inquirer-autocomplete-prompt": "1.4.0",
97
97
  "ipx": "2.1.0",
@@ -138,7 +138,6 @@
138
138
  "terminal-link": "3.0.0",
139
139
  "through2-filter": "4.0.0",
140
140
  "through2-map": "4.0.0",
141
- "to-readable-stream": "3.0.0",
142
141
  "toml": "3.0.0",
143
142
  "tomlify-j0.4": "3.0.0",
144
143
  "ulid": "2.3.0",