netlify-cli 17.29.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 });