@netlify/build 18.24.0 → 19.0.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.
- package/package.json +2 -2
- package/src/error/monitor/print.js +9 -1
- package/src/error/monitor/report.js +2 -2
- package/src/error/parse/parse.js +21 -2
- package/src/error/parse/serialize_log.js +5 -3
- package/src/plugins/child/load.js +2 -2
- package/src/plugins/child/logic.js +6 -3
- package/src/plugins/child/typescript.js +20 -2
- package/src/plugins/node_version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"main": "src/core/main.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -127,6 +127,6 @@
|
|
|
127
127
|
"yarn": "^1.22.4"
|
|
128
128
|
},
|
|
129
129
|
"engines": {
|
|
130
|
-
"node": ">=
|
|
130
|
+
"node": "^12.20.0 || ^14.14.0 || >=16.0.0"
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -10,7 +10,14 @@ const printEventForTest = function (
|
|
|
10
10
|
groupingHash,
|
|
11
11
|
severity,
|
|
12
12
|
unhandled,
|
|
13
|
-
_metadata: {
|
|
13
|
+
_metadata: {
|
|
14
|
+
location,
|
|
15
|
+
plugin: { packageName, homepage } = {},
|
|
16
|
+
pluginPackageJson,
|
|
17
|
+
tsConfig,
|
|
18
|
+
env: { BUILD_ID } = {},
|
|
19
|
+
other,
|
|
20
|
+
},
|
|
14
21
|
},
|
|
15
22
|
logs,
|
|
16
23
|
) {
|
|
@@ -26,6 +33,7 @@ const printEventForTest = function (
|
|
|
26
33
|
packageName,
|
|
27
34
|
pluginPackageJson: pluginPackageJson !== undefined,
|
|
28
35
|
homepage,
|
|
36
|
+
tsConfig,
|
|
29
37
|
BUILD_ID,
|
|
30
38
|
other,
|
|
31
39
|
},
|
|
@@ -60,11 +60,11 @@ const getGroupingHash = function (group, error, type) {
|
|
|
60
60
|
return `${group}\n${messageA}`
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const getMetadata = function ({ location, plugin }, childEnv, groupingHash) {
|
|
63
|
+
const getMetadata = function ({ location, plugin, tsConfig }, childEnv, groupingHash) {
|
|
64
64
|
const pluginMetadata = getPluginMetadata({ location, plugin })
|
|
65
65
|
const envMetadata = getEnvMetadata(childEnv)
|
|
66
66
|
const locationMetadata = getLocationMetadata(location, envMetadata)
|
|
67
|
-
return { location: locationMetadata, ...pluginMetadata, env: envMetadata, other: { groupingHash } }
|
|
67
|
+
return { location: locationMetadata, ...pluginMetadata, tsConfig, env: envMetadata, other: { groupingHash } }
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const getPluginMetadata = function ({ location, plugin }) {
|
package/src/error/parse/parse.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { serializeObject } = require('../../log/serialize')
|
|
3
4
|
const { getErrorInfo } = require('../info')
|
|
4
5
|
const { getTypeInfo } = require('../type')
|
|
5
6
|
|
|
@@ -17,7 +18,7 @@ const getFullErrorInfo = function ({ error, colors, debug }) {
|
|
|
17
18
|
stack,
|
|
18
19
|
errorProps,
|
|
19
20
|
errorInfo,
|
|
20
|
-
errorInfo: { location = {}, plugin = {} },
|
|
21
|
+
errorInfo: { location = {}, plugin = {}, tsConfig },
|
|
21
22
|
severity,
|
|
22
23
|
title,
|
|
23
24
|
stackType,
|
|
@@ -31,10 +32,28 @@ const getFullErrorInfo = function ({ error, colors, debug }) {
|
|
|
31
32
|
const { message: messageA, stack: stackA } = getStackInfo({ message, stack, stackType, rawStack, severity, debug })
|
|
32
33
|
|
|
33
34
|
const pluginInfo = getPluginInfo(plugin, location)
|
|
35
|
+
const tsConfigInfo = getTsConfigInfo(tsConfig)
|
|
34
36
|
const locationInfo = getLocationInfo({ stack: stackA, location, locationType })
|
|
35
37
|
const errorPropsA = getErrorProps({ errorProps, showErrorProps, colors })
|
|
36
38
|
|
|
37
|
-
return {
|
|
39
|
+
return {
|
|
40
|
+
...basicErrorInfo,
|
|
41
|
+
title: titleA,
|
|
42
|
+
message: messageA,
|
|
43
|
+
tsConfigInfo,
|
|
44
|
+
pluginInfo,
|
|
45
|
+
locationInfo,
|
|
46
|
+
errorProps: errorPropsA,
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Serialize the `tsConfig` error information
|
|
51
|
+
const getTsConfigInfo = function (tsConfig) {
|
|
52
|
+
if (tsConfig === undefined) {
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return serializeObject(tsConfig)
|
|
38
57
|
}
|
|
39
58
|
|
|
40
59
|
// Parse error instance into all the basic properties containing information
|
|
@@ -4,19 +4,20 @@ const { THEME } = require('../../log/theme')
|
|
|
4
4
|
|
|
5
5
|
// Serialize an error object into a title|body string to print in logs
|
|
6
6
|
const serializeLogError = function ({
|
|
7
|
-
fullErrorInfo: { title, severity, message, pluginInfo, locationInfo, errorProps },
|
|
7
|
+
fullErrorInfo: { title, severity, message, pluginInfo, locationInfo, tsConfigInfo, errorProps },
|
|
8
8
|
}) {
|
|
9
|
-
const body = getBody({ message, pluginInfo, locationInfo, errorProps, severity })
|
|
9
|
+
const body = getBody({ message, pluginInfo, locationInfo, tsConfigInfo, errorProps, severity })
|
|
10
10
|
return { title, body }
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const getBody = function ({ message, pluginInfo, locationInfo, errorProps, severity }) {
|
|
13
|
+
const getBody = function ({ message, pluginInfo, locationInfo, tsConfigInfo, errorProps, severity }) {
|
|
14
14
|
if (severity === 'none') {
|
|
15
15
|
return message
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
return Object.entries({
|
|
19
19
|
message,
|
|
20
|
+
tsConfigInfo,
|
|
20
21
|
pluginInfo,
|
|
21
22
|
locationInfo,
|
|
22
23
|
errorProps,
|
|
@@ -38,6 +39,7 @@ const LOG_BLOCK_NAMES = {
|
|
|
38
39
|
message: 'Error message',
|
|
39
40
|
pluginInfo: 'Plugin details',
|
|
40
41
|
locationInfo: 'Error location',
|
|
42
|
+
tsConfigInfo: 'TypeScript configuration',
|
|
41
43
|
errorProps: 'Error properties',
|
|
42
44
|
}
|
|
43
45
|
|
|
@@ -10,8 +10,8 @@ const { validatePlugin } = require('./validate')
|
|
|
10
10
|
// Do it when parent requests it using the `load` event.
|
|
11
11
|
// Also figure out the list of plugin steps. This is also passed to the parent.
|
|
12
12
|
const load = function ({ pluginPath, inputs, packageJson }) {
|
|
13
|
-
registerTypeScript(pluginPath)
|
|
14
|
-
const logic = getLogic({ pluginPath, inputs })
|
|
13
|
+
const tsNodeService = registerTypeScript(pluginPath)
|
|
14
|
+
const logic = getLogic({ pluginPath, inputs, tsNodeService })
|
|
15
15
|
|
|
16
16
|
validatePlugin(logic)
|
|
17
17
|
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
const { addTsErrorInfo } = require('./typescript')
|
|
4
|
+
|
|
3
5
|
// Require the plugin file and fire its top-level function.
|
|
4
6
|
// The returned object is the `logic` which includes all event handlers.
|
|
5
|
-
const getLogic = function ({ pluginPath, inputs }) {
|
|
6
|
-
const logic = requireLogic(pluginPath)
|
|
7
|
+
const getLogic = function ({ pluginPath, inputs, tsNodeService }) {
|
|
8
|
+
const logic = requireLogic(pluginPath, tsNodeService)
|
|
7
9
|
const logicA = loadLogic({ logic, inputs })
|
|
8
10
|
return logicA
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
const requireLogic = function (pluginPath) {
|
|
13
|
+
const requireLogic = function (pluginPath, tsNodeService) {
|
|
12
14
|
try {
|
|
13
15
|
// eslint-disable-next-line node/global-require, import/no-dynamic-require
|
|
14
16
|
return require(pluginPath)
|
|
15
17
|
} catch (error) {
|
|
18
|
+
addTsErrorInfo(error, tsNodeService)
|
|
16
19
|
error.message = `Could not import plugin:\n${error.message}`
|
|
17
20
|
throw error
|
|
18
21
|
}
|
|
@@ -4,6 +4,8 @@ const { extname } = require('path')
|
|
|
4
4
|
|
|
5
5
|
const { register } = require('ts-node')
|
|
6
6
|
|
|
7
|
+
const { addErrorInfo } = require('../../error/info')
|
|
8
|
+
|
|
7
9
|
// Allow local plugins to be written with TypeScript.
|
|
8
10
|
// Local plugins cannot be transpiled by the build command since they can be run
|
|
9
11
|
// before it. Therefore, we type-check and transpile them automatically using
|
|
@@ -13,7 +15,23 @@ const registerTypeScript = function (pluginPath) {
|
|
|
13
15
|
return
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
register()
|
|
18
|
+
return register()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// On TypeScript errors, adds information about the `ts-node` configuration,
|
|
22
|
+
// which includes the resolved `tsconfig.json`.
|
|
23
|
+
const addTsErrorInfo = function (error, tsNodeService) {
|
|
24
|
+
if (tsNodeService === undefined) {
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
config: {
|
|
30
|
+
raw: { compilerOptions },
|
|
31
|
+
},
|
|
32
|
+
options: tsNodeOptions,
|
|
33
|
+
} = tsNodeService
|
|
34
|
+
addErrorInfo(error, { tsConfig: { compilerOptions, tsNodeOptions } })
|
|
17
35
|
}
|
|
18
36
|
|
|
19
37
|
const isTypeScriptPlugin = function (pluginPath) {
|
|
@@ -22,4 +40,4 @@ const isTypeScriptPlugin = function (pluginPath) {
|
|
|
22
40
|
|
|
23
41
|
const TYPESCRIPT_EXTENSIONS = new Set(['.ts', '.tsx', '.mts', '.cts'])
|
|
24
42
|
|
|
25
|
-
module.exports = { registerTypeScript }
|
|
43
|
+
module.exports = { registerTypeScript, addTsErrorInfo }
|
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
const { addErrorInfo } = require('../error/info')
|
|
11
11
|
|
|
12
12
|
// Local plugins and `package.json`-installed plugins use user's preferred Node.js version if higher than our minimum
|
|
13
|
-
// supported version
|
|
13
|
+
// supported version. Else default to the system Node version.
|
|
14
14
|
// Local and programmatic builds use `@netlify/build` Node.js version, which is
|
|
15
15
|
// usually the system's Node.js version.
|
|
16
16
|
// If the user Node version does not satisfy our supported engine range use our own system Node version
|