@netlify/build 29.49.0 → 29.50.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.
@@ -19,17 +19,17 @@ const coreStep = async function ({ buildDir, packagePath, constants: { EDGE_FUNC
19
19
  const distImportMapPath = join(dirname(internalSrcPath), IMPORT_MAP_FILENAME);
20
20
  const srcPath = srcDirectory ? resolve(buildDir, srcDirectory) : undefined;
21
21
  const frameworksAPISrcPath = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT);
22
- let generatedFunctionsPath = internalSrcPath;
22
+ const generatedFunctionPaths = [internalSrcPath];
23
23
  if (featureFlags.netlify_build_frameworks_api) {
24
24
  if (await pathExists(frameworksAPISrcPath)) {
25
- generatedFunctionsPath = frameworksAPISrcPath;
25
+ generatedFunctionPaths.push(frameworksAPISrcPath);
26
26
  }
27
27
  const frameworkImportMap = resolve(buildDir, packagePath || '', FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT, FRAMEWORKS_API_EDGE_FUNCTIONS_IMPORT_MAP);
28
28
  if (await pathExists(frameworkImportMap)) {
29
29
  importMapPaths.push(frameworkImportMap);
30
30
  }
31
31
  }
32
- const sourcePaths = [generatedFunctionsPath, srcPath].filter(Boolean);
32
+ const sourcePaths = [...generatedFunctionPaths, srcPath].filter(Boolean);
33
33
  logFunctions({ frameworksAPISrcPath, internalSrcDirectory, internalSrcPath, logs, srcDirectory, srcPath });
34
34
  // If we're running in buildbot, we set the Deno cache dir to a directory
35
35
  // that is persisted between builds.
@@ -64,7 +64,7 @@ const coreStep = async function ({ buildDir, packagePath, constants: { EDGE_FUNC
64
64
  importMapPaths,
65
65
  userLogger: (...args) => log(logs, reduceLogLines(args)),
66
66
  systemLogger: systemLog,
67
- internalSrcFolder: generatedFunctionsPath,
67
+ internalSrcFolder: generatedFunctionPaths,
68
68
  bootstrapURL: edgeFunctionsBootstrapURL,
69
69
  vendorDirectory,
70
70
  });
@@ -62,7 +62,7 @@ const zipFunctionsAndLogResults = async ({ buildDir, childEnv, featureFlags, fun
62
62
  try {
63
63
  // Printing an empty line before bundling output.
64
64
  log(logs, '');
65
- const sourceDirectories = [frameworkFunctionsSrc, internalFunctionsSrc, functionsSrc].filter(Boolean);
65
+ const sourceDirectories = [internalFunctionsSrc, frameworkFunctionsSrc, functionsSrc].filter(Boolean);
66
66
  const results = await zipItAndShipIt.zipFunctions(sourceDirectories, functionsDist, zisiParameters);
67
67
  validateCustomRoutes(results);
68
68
  const bundlers = Array.from(getBundlers(results));
@@ -97,13 +97,12 @@ const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC
97
97
  log(logs, '');
98
98
  }
99
99
  }
100
- const hasFrameworkFunctions = frameworkFunctions.length !== 0;
101
100
  logFunctionsToBundle({
102
101
  logs,
103
102
  userFunctions,
104
103
  userFunctionsSrc: relativeFunctionsSrc,
105
104
  userFunctionsSrcExists: functionsSrcExists,
106
- internalFunctions: hasFrameworkFunctions ? [] : internalFunctions,
105
+ internalFunctions,
107
106
  internalFunctionsSrc: relativeInternalFunctionsSrc,
108
107
  frameworkFunctions,
109
108
  });
@@ -118,7 +117,7 @@ const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC
118
117
  functionsDist,
119
118
  functionsSrc,
120
119
  frameworkFunctionsSrc,
121
- internalFunctionsSrc: hasFrameworkFunctions ? undefined : internalFunctionsSrc,
120
+ internalFunctionsSrc,
122
121
  isRunningLocally,
123
122
  logs,
124
123
  repositoryRoot,
@@ -1,22 +1,22 @@
1
1
  import { rm } from 'node:fs/promises';
2
- import { scanForBlobs, getBlobsDirs } from '../../utils/blobs.js';
2
+ import { resolve } from 'node:path';
3
+ import { getBlobsDirs } from '../../utils/blobs.js';
4
+ import { FRAMEWORKS_API_ENDPOINT } from '../../utils/frameworks_api.js';
3
5
  const coreStep = async ({ buildDir, packagePath }) => {
4
- const blobsDirs = getBlobsDirs(buildDir, packagePath);
6
+ const dirs = [...getBlobsDirs(buildDir, packagePath), resolve(buildDir, packagePath || '', FRAMEWORKS_API_ENDPOINT)];
5
7
  try {
6
- await Promise.all(blobsDirs.map((dir) => rm(dir, { recursive: true, force: true })));
8
+ await Promise.all(dirs.map((dir) => rm(dir, { recursive: true, force: true })));
7
9
  }
8
10
  catch {
9
11
  // Ignore errors if it fails, we can continue anyway.
10
12
  }
11
13
  return {};
12
14
  };
13
- const blobsPresent = async ({ buildDir, packagePath }) => Boolean(await scanForBlobs(buildDir, packagePath));
14
15
  export const preCleanup = {
15
16
  event: 'onPreBuild',
16
17
  coreStep,
17
18
  coreStepId: 'pre_cleanup',
18
19
  coreStepName: 'Pre cleanup',
19
20
  coreStepDescription: () => 'Cleaning up leftover files from previous builds',
20
- condition: blobsPresent,
21
21
  quiet: true,
22
22
  };
package/lib/steps/get.js CHANGED
@@ -3,9 +3,9 @@ import { DEV_EVENTS, EVENTS } from '../plugins/events.js';
3
3
  import { uploadBlobs } from '../plugins_core/blobs_upload/index.js';
4
4
  import { buildCommandCore } from '../plugins_core/build_command.js';
5
5
  import { deploySite } from '../plugins_core/deploy/index.js';
6
- import { applyDeployConfig } from '../plugins_core/deploy_config/index.js';
7
6
  import { devUploadBlobs } from '../plugins_core/dev_blobs_upload/index.js';
8
7
  import { bundleEdgeFunctions } from '../plugins_core/edge_functions/index.js';
8
+ import { applyDeployConfig } from '../plugins_core/frameworks_api/index.js';
9
9
  import { bundleFunctions } from '../plugins_core/functions/index.js';
10
10
  import { preCleanup } from '../plugins_core/pre_cleanup/index.js';
11
11
  import { preDevCleanup } from '../plugins_core/pre_dev_cleanup/index.js';
@@ -75,24 +75,22 @@ const METADATA_SUFFIX = '.json';
75
75
  * path to its metadata file.
76
76
  */
77
77
  export const getKeysToUpload = async (blobsDir) => {
78
- const blobsToUpload = [];
79
78
  const files = await new fdir()
80
79
  .withRelativePaths() // we want the relative path from the blobsDir
81
80
  .filter((fpath) => !path.basename(fpath).startsWith(METADATA_PREFIX))
82
81
  .crawl(blobsDir)
83
82
  .withPromise();
84
- files.forEach((filePath) => {
83
+ return files.map((filePath) => {
85
84
  const key = filePath.split(path.sep).join('/');
86
85
  const contentPath = path.resolve(blobsDir, filePath);
87
86
  const basename = path.basename(filePath);
88
87
  const metadataPath = path.resolve(blobsDir, path.dirname(filePath), `${METADATA_PREFIX}${basename}${METADATA_SUFFIX}`);
89
- blobsToUpload.push({
88
+ return {
90
89
  key,
91
90
  contentPath,
92
91
  metadataPath,
93
- });
92
+ };
94
93
  });
95
- return blobsToUpload;
96
94
  };
97
95
  /** Read a file and its metadata file from the blobs directory */
98
96
  export const getFileWithMetadata = async (key, contentPath, metadataPath) => {
@@ -1,3 +1,4 @@
1
+ export declare const FRAMEWORKS_API_ENDPOINT = ".netlify/v1";
1
2
  export declare const FRAMEWORKS_API_BLOBS_ENDPOINT = ".netlify/v1/blobs";
2
3
  export declare const FRAMEWORKS_API_CONFIG_ENDPOINT = ".netlify/v1/config.json";
3
4
  export declare const FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT = ".netlify/v1/edge-functions";
@@ -1,10 +1,11 @@
1
1
  import { basename, dirname, resolve, sep } from 'node:path';
2
2
  import { fdir } from 'fdir';
3
- export const FRAMEWORKS_API_BLOBS_ENDPOINT = '.netlify/v1/blobs';
4
- export const FRAMEWORKS_API_CONFIG_ENDPOINT = '.netlify/v1/config.json';
5
- export const FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT = '.netlify/v1/edge-functions';
3
+ export const FRAMEWORKS_API_ENDPOINT = '.netlify/v1';
4
+ export const FRAMEWORKS_API_BLOBS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/blobs`;
5
+ export const FRAMEWORKS_API_CONFIG_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/config.json`;
6
+ export const FRAMEWORKS_API_EDGE_FUNCTIONS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/edge-functions`;
6
7
  export const FRAMEWORKS_API_EDGE_FUNCTIONS_IMPORT_MAP = 'import_map.json';
7
- export const FRAMEWORKS_API_FUNCTIONS_ENDPOINT = '.netlify/v1/functions';
8
+ export const FRAMEWORKS_API_FUNCTIONS_ENDPOINT = `${FRAMEWORKS_API_ENDPOINT}/functions`;
8
9
  /**
9
10
  * Traverses a directory tree in search of leaf files. The key of each leaf
10
11
  * file is determined by its path relative to the base directory.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "29.49.0",
3
+ "version": "29.50.0",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./lib/index.js",
@@ -71,14 +71,14 @@
71
71
  "@netlify/blobs": "^7.3.0",
72
72
  "@netlify/cache-utils": "^5.1.5",
73
73
  "@netlify/config": "^20.15.4",
74
- "@netlify/edge-bundler": "12.1.0",
74
+ "@netlify/edge-bundler": "12.1.1",
75
75
  "@netlify/framework-info": "^9.8.13",
76
- "@netlify/functions-utils": "^5.2.69",
76
+ "@netlify/functions-utils": "^5.2.70",
77
77
  "@netlify/git-utils": "^5.1.1",
78
78
  "@netlify/opentelemetry-utils": "^1.2.1",
79
79
  "@netlify/plugins-list": "^6.80.0",
80
80
  "@netlify/run-utils": "^5.1.1",
81
- "@netlify/zip-it-and-ship-it": "9.37.1",
81
+ "@netlify/zip-it-and-ship-it": "9.37.2",
82
82
  "@sindresorhus/slugify": "^2.0.0",
83
83
  "ansi-escapes": "^6.0.0",
84
84
  "chalk": "^5.0.0",
@@ -165,5 +165,5 @@
165
165
  "engines": {
166
166
  "node": "^14.16.0 || >=16.0.0"
167
167
  },
168
- "gitHead": "77980fa9db268a0beead2e2727a36d833716bc11"
168
+ "gitHead": "73b6616a85923ed3c436747b5d69353400236a71"
169
169
  }