@netlify/build 29.20.2 → 29.20.4
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.
package/lib/core/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { relative, normalize } from 'path';
|
|
1
|
+
import { relative, normalize, join } from 'path';
|
|
2
2
|
import { getCacheDir } from '@netlify/cache-utils';
|
|
3
3
|
import mapObj from 'map-obj';
|
|
4
4
|
import { pathExists } from 'path-exists';
|
|
@@ -13,9 +13,9 @@ export const getConstants = async function ({ configPath, buildDir, packagePath,
|
|
|
13
13
|
// In monorepos this is the path that is used to point to a package that should be deployed
|
|
14
14
|
PACKAGE_PATH: packagePath,
|
|
15
15
|
// The directory where built serverless functions are placed before deployment
|
|
16
|
-
FUNCTIONS_DIST: functionsDistDir,
|
|
16
|
+
FUNCTIONS_DIST: join(packagePath || '', functionsDistDir),
|
|
17
17
|
// The directory where built Edge Functions are placed before deployment
|
|
18
|
-
EDGE_FUNCTIONS_DIST: edgeFunctionsDistDir,
|
|
18
|
+
EDGE_FUNCTIONS_DIST: join(packagePath || '', edgeFunctionsDistDir),
|
|
19
19
|
// Path to the Netlify build cache folder
|
|
20
20
|
CACHE_DIR: normalizedCacheDir,
|
|
21
21
|
// Boolean indicating whether the build was run locally (Netlify CLI) or in the production CI
|
|
@@ -30,10 +30,10 @@ export const getConstants = async function ({ configPath, buildDir, packagePath,
|
|
|
30
30
|
NETLIFY_API_HOST: apiHost,
|
|
31
31
|
// The directory where internal functions (i.e. generated programmatically
|
|
32
32
|
// via plugins or others) live
|
|
33
|
-
INTERNAL_FUNCTIONS_SRC:
|
|
33
|
+
INTERNAL_FUNCTIONS_SRC: join(buildDir, packagePath || '', INTERNAL_FUNCTIONS_SRC),
|
|
34
34
|
// The directory where internal Edge Functions (i.e. generated programmatically
|
|
35
35
|
// via plugins or others) live
|
|
36
|
-
INTERNAL_EDGE_FUNCTIONS_SRC:
|
|
36
|
+
INTERNAL_EDGE_FUNCTIONS_SRC: join(buildDir, packagePath || '', INTERNAL_EDGE_FUNCTIONS_SRC),
|
|
37
37
|
};
|
|
38
38
|
const constantsA = await addMutableConstants({ constants, buildDir, netlifyConfig });
|
|
39
39
|
return constantsA;
|
|
@@ -8,11 +8,11 @@ import { validateEdgeFunctionsManifest } from './validate_manifest/validate_edge
|
|
|
8
8
|
// TODO: Replace this with a custom cache directory.
|
|
9
9
|
const DENO_CLI_CACHE_DIRECTORY = '.netlify/plugins/deno-cli';
|
|
10
10
|
const IMPORT_MAP_FILENAME = 'edge-functions-import-map.json';
|
|
11
|
-
const coreStep = async function ({ buildDir,
|
|
11
|
+
const coreStep = async function ({ buildDir, constants: { EDGE_FUNCTIONS_DIST: distDirectory, EDGE_FUNCTIONS_SRC: srcDirectory, INTERNAL_EDGE_FUNCTIONS_SRC: internalSrcDirectory, IS_LOCAL: isRunningLocally, }, debug, systemLog, featureFlags, logs, netlifyConfig, edgeFunctionsBootstrapURL, }) {
|
|
12
12
|
const { edge_functions: declarations = [] } = netlifyConfig;
|
|
13
13
|
const { deno_import_map: userDefinedImportMap } = netlifyConfig.functions['*'];
|
|
14
|
-
const distPath = resolve(buildDir,
|
|
15
|
-
const internalSrcPath = resolve(buildDir,
|
|
14
|
+
const distPath = resolve(buildDir, distDirectory);
|
|
15
|
+
const internalSrcPath = resolve(buildDir, internalSrcDirectory);
|
|
16
16
|
const distImportMapPath = join(dirname(internalSrcPath), IMPORT_MAP_FILENAME);
|
|
17
17
|
const srcPath = srcDirectory ? resolve(buildDir, srcDirectory) : undefined;
|
|
18
18
|
const sourcePaths = [internalSrcPath, srcPath].filter(Boolean);
|
|
@@ -73,12 +73,12 @@ const getMetrics = (manifest) => {
|
|
|
73
73
|
// one configured by the user or the internal one) exists. We use a dynamic
|
|
74
74
|
// `condition` because the directories might be created by the build command
|
|
75
75
|
// or plugins.
|
|
76
|
-
const hasEdgeFunctionsDirectories = async function ({ buildDir,
|
|
76
|
+
const hasEdgeFunctionsDirectories = async function ({ buildDir, constants: { INTERNAL_EDGE_FUNCTIONS_SRC, EDGE_FUNCTIONS_SRC }, }) {
|
|
77
77
|
const hasFunctionsSrc = EDGE_FUNCTIONS_SRC !== undefined && EDGE_FUNCTIONS_SRC !== '';
|
|
78
78
|
if (hasFunctionsSrc) {
|
|
79
79
|
return true;
|
|
80
80
|
}
|
|
81
|
-
const internalFunctionsSrc = resolve(buildDir,
|
|
81
|
+
const internalFunctionsSrc = resolve(buildDir, INTERNAL_EDGE_FUNCTIONS_SRC);
|
|
82
82
|
return await pathExists(internalFunctionsSrc);
|
|
83
83
|
};
|
|
84
84
|
const logFunctions = async ({ internalSrcDirectory, internalSrcPath, logs, srcDirectory: userFunctionsSrc, srcPath, }) => {
|
|
@@ -39,10 +39,10 @@ const zipFunctionsAndLogResults = async ({ buildDir, childEnv, featureFlags, fun
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
// Plugin to package Netlify functions with @netlify/zip-it-and-ship-it
|
|
42
|
-
const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC: relativeInternalFunctionsSrc, IS_LOCAL: isRunningLocally, FUNCTIONS_SRC: relativeFunctionsSrc, FUNCTIONS_DIST: relativeFunctionsDist, }, buildDir,
|
|
42
|
+
const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC: relativeInternalFunctionsSrc, IS_LOCAL: isRunningLocally, FUNCTIONS_SRC: relativeFunctionsSrc, FUNCTIONS_DIST: relativeFunctionsDist, }, buildDir, logs, netlifyConfig, featureFlags, repositoryRoot, userNodeVersion, systemLog, }) {
|
|
43
43
|
const functionsSrc = relativeFunctionsSrc === undefined ? undefined : resolve(buildDir, relativeFunctionsSrc);
|
|
44
|
-
const functionsDist = resolve(buildDir,
|
|
45
|
-
const internalFunctionsSrc = resolve(buildDir,
|
|
44
|
+
const functionsDist = resolve(buildDir, relativeFunctionsDist);
|
|
45
|
+
const internalFunctionsSrc = resolve(buildDir, relativeInternalFunctionsSrc);
|
|
46
46
|
const internalFunctionsSrcExists = await pathExists(internalFunctionsSrc);
|
|
47
47
|
const functionsSrcExists = await validateFunctionsSrc({ functionsSrc, relativeFunctionsSrc });
|
|
48
48
|
const [userFunctions = [], internalFunctions = []] = await getUserAndInternalFunctions({
|
|
@@ -95,12 +95,12 @@ const coreStep = async function ({ childEnv, constants: { INTERNAL_FUNCTIONS_SRC
|
|
|
95
95
|
// one configured by the user or the internal one) exists. We use a dynamic
|
|
96
96
|
// `condition` because the directories might be created by the build command
|
|
97
97
|
// or plugins.
|
|
98
|
-
const hasFunctionsDirectories = async function ({ buildDir,
|
|
98
|
+
const hasFunctionsDirectories = async function ({ buildDir, constants: { INTERNAL_FUNCTIONS_SRC, FUNCTIONS_SRC } }) {
|
|
99
99
|
const hasFunctionsSrc = FUNCTIONS_SRC !== undefined && FUNCTIONS_SRC !== '';
|
|
100
100
|
if (hasFunctionsSrc) {
|
|
101
101
|
return true;
|
|
102
102
|
}
|
|
103
|
-
const internalFunctionsSrc = resolve(buildDir,
|
|
103
|
+
const internalFunctionsSrc = resolve(buildDir, INTERNAL_FUNCTIONS_SRC);
|
|
104
104
|
return await pathExists(internalFunctionsSrc);
|
|
105
105
|
};
|
|
106
106
|
export const bundleFunctions = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.20.
|
|
3
|
+
"version": "29.20.4",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/core/main.js",
|
|
@@ -148,5 +148,5 @@
|
|
|
148
148
|
"module": "commonjs"
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
|
-
"gitHead": "
|
|
151
|
+
"gitHead": "676328d0727b74cf9bd8e263b3b2fbfcefa281ac"
|
|
152
152
|
}
|
|
@@ -13,6 +13,13 @@ export interface NetlifyPluginConstants {
|
|
|
13
13
|
* `undefined` if no `netlify/functions` directory exists in the base directory and if not specified by the user.
|
|
14
14
|
*/
|
|
15
15
|
FUNCTIONS_SRC?: string
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* the directory inside a mono repository where it collects the settings from.
|
|
19
|
+
* This is the value of the package directory field of the build settings
|
|
20
|
+
* `undefined` if none is set.
|
|
21
|
+
*/
|
|
22
|
+
PACKAGE_PATH?: string
|
|
16
23
|
/**
|
|
17
24
|
* the directory where internal Edge Functions source code lives. This is where build plugins should place auto-generated functions.
|
|
18
25
|
* `undefined` if the version of @netlify/build does not support internal Edge Functions
|