netlify-cli 17.30.0 → 17.31.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
+ };
@@ -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.31.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.31.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",
@@ -8622,9 +8622,9 @@
8622
8622
  }
8623
8623
  },
8624
8624
  "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==",
8625
+ "version": "7.0.5",
8626
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz",
8627
+ "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==",
8628
8628
  "dependencies": {
8629
8629
  "agent-base": "^7.0.2",
8630
8630
  "debug": "4"
@@ -20159,9 +20159,9 @@
20159
20159
  }
20160
20160
  },
20161
20161
  "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==",
20162
+ "version": "7.0.5",
20163
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz",
20164
+ "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==",
20165
20165
  "requires": {
20166
20166
  "agent-base": "^7.0.2",
20167
20167
  "debug": "4"
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.31.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",