@netlify/build 29.0.1-rc → 29.0.2
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/bin.js +5 -0
- package/lib/core/bin.js +66 -0
- package/lib/core/build.js +356 -0
- package/lib/core/config.js +121 -0
- package/lib/core/constants.js +116 -0
- package/lib/core/dev.js +27 -0
- package/lib/core/dry.js +21 -0
- package/lib/core/feature_flags.js +21 -0
- package/lib/core/flags.js +201 -0
- package/lib/core/lingering.js +68 -0
- package/lib/core/main.js +110 -0
- package/lib/core/missing_side_file.js +17 -0
- package/lib/core/normalize_flags.js +59 -0
- package/lib/core/severity.js +21 -0
- package/lib/core/types.js +8 -0
- package/lib/core/user_node_version.js +32 -0
- package/lib/env/changes.js +43 -0
- package/lib/env/main.js +14 -0
- package/lib/env/metadata.js +68 -0
- package/lib/error/api.js +37 -0
- package/lib/error/build.js +36 -0
- package/{src → lib}/error/cancel.js +5 -6
- package/lib/error/colors.js +9 -0
- package/lib/error/handle.js +46 -0
- package/lib/error/info.js +37 -0
- package/lib/error/monitor/location.js +16 -0
- package/lib/error/monitor/normalize.js +86 -0
- package/lib/error/monitor/print.js +20 -0
- package/lib/error/monitor/report.js +120 -0
- package/lib/error/monitor/start.js +61 -0
- package/lib/error/parse/clean_stack.js +70 -0
- package/lib/error/parse/location.js +50 -0
- package/lib/error/parse/normalize.js +24 -0
- package/lib/error/parse/parse.js +67 -0
- package/lib/error/parse/plugin.js +55 -0
- package/lib/error/parse/properties.js +16 -0
- package/lib/error/parse/serialize_log.js +34 -0
- package/lib/error/parse/serialize_status.js +18 -0
- package/lib/error/parse/stack.js +34 -0
- package/lib/error/report.js +27 -0
- package/lib/error/type.js +177 -0
- package/lib/install/functions.js +20 -0
- package/lib/install/local.js +45 -0
- package/lib/install/main.js +67 -0
- package/lib/install/missing.js +54 -0
- package/lib/log/colors.js +28 -0
- package/lib/log/description.js +21 -0
- package/lib/log/header.js +14 -0
- package/lib/log/header_func.js +13 -0
- package/lib/log/logger.js +140 -0
- package/lib/log/messages/compatibility.js +146 -0
- package/lib/log/messages/config.js +91 -0
- package/lib/log/messages/core.js +51 -0
- package/lib/log/messages/core_steps.js +75 -0
- package/lib/log/messages/dry.js +41 -0
- package/lib/log/messages/install.js +25 -0
- package/lib/log/messages/ipc.js +29 -0
- package/lib/log/messages/mutations.js +62 -0
- package/{src → lib}/log/messages/plugins.js +18 -32
- package/lib/log/messages/status.js +14 -0
- package/lib/log/messages/steps.js +18 -0
- package/lib/log/old_version.js +32 -0
- package/lib/log/serialize.js +10 -0
- package/lib/log/stream.js +68 -0
- package/lib/log/theme.js +27 -0
- package/lib/plugins/child/diff.js +46 -0
- package/lib/plugins/child/error.js +26 -0
- package/lib/plugins/child/lazy.js +15 -0
- package/lib/plugins/child/load.js +22 -0
- package/lib/plugins/child/logic.js +57 -0
- package/lib/plugins/child/main.js +37 -0
- package/lib/plugins/child/run.js +19 -0
- package/lib/plugins/child/status.js +63 -0
- package/lib/plugins/child/typescript.js +28 -0
- package/lib/plugins/child/utils.js +42 -0
- package/lib/plugins/child/validate.js +31 -0
- package/lib/plugins/compatibility.js +104 -0
- package/{src → lib}/plugins/error.js +31 -35
- package/{src → lib}/plugins/events.js +7 -12
- package/lib/plugins/expected_version.js +81 -0
- package/lib/plugins/internal.js +10 -0
- package/lib/plugins/ipc.js +120 -0
- package/lib/plugins/list.js +73 -0
- package/lib/plugins/load.js +50 -0
- package/lib/plugins/manifest/check.js +85 -0
- package/lib/plugins/manifest/load.js +38 -0
- package/lib/plugins/manifest/main.js +19 -0
- package/lib/plugins/manifest/path.js +24 -0
- package/lib/plugins/manifest/validate.js +91 -0
- package/lib/plugins/node_version.js +35 -0
- package/lib/plugins/options.js +70 -0
- package/lib/plugins/pinned_version.js +83 -0
- package/lib/plugins/resolve.js +110 -0
- package/lib/plugins/spawn.js +58 -0
- package/lib/plugins_core/add.js +35 -0
- package/lib/plugins_core/build_command.js +50 -0
- package/lib/plugins_core/deploy/buildbot_client.js +87 -0
- package/lib/plugins_core/deploy/index.js +49 -0
- package/{src → lib}/plugins_core/deploy/manifest.yml +0 -0
- package/lib/plugins_core/edge_functions/index.js +76 -0
- package/{src → lib}/plugins_core/edge_functions/lib/error.js +13 -17
- package/lib/plugins_core/edge_functions/validate_manifest/validate_edge_functions_manifest.js +21 -0
- package/lib/plugins_core/functions/error.js +123 -0
- package/lib/plugins_core/functions/feature_flags.js +6 -0
- package/lib/plugins_core/functions/index.js +114 -0
- package/lib/plugins_core/functions/utils.js +45 -0
- package/lib/plugins_core/functions/zisi.js +39 -0
- package/{src → lib}/plugins_core/functions_install/index.js +8 -11
- package/{src → lib}/plugins_core/functions_install/manifest.yml +0 -0
- package/lib/plugins_core/list.js +20 -0
- package/lib/report/statsd.js +31 -0
- package/lib/status/add.js +30 -0
- package/lib/status/colors.js +18 -0
- package/lib/status/load_error.js +10 -0
- package/lib/status/report.js +83 -0
- package/lib/status/success.js +14 -0
- package/lib/steps/core_step.js +59 -0
- package/lib/steps/error.js +65 -0
- package/lib/steps/get.js +43 -0
- package/lib/steps/plugin.js +55 -0
- package/lib/steps/return.js +25 -0
- package/lib/steps/run_core_steps.js +117 -0
- package/lib/steps/run_step.js +190 -0
- package/lib/steps/run_steps.js +96 -0
- package/lib/steps/update_config.js +66 -0
- package/lib/telemetry/main.js +97 -0
- package/lib/time/aggregate.js +109 -0
- package/lib/time/main.js +31 -0
- package/lib/time/measure.js +16 -0
- package/lib/time/report.js +24 -0
- package/lib/utils/errors.js +13 -0
- package/lib/utils/json.js +15 -0
- package/lib/utils/omit.js +3 -0
- package/lib/utils/package.js +24 -0
- package/lib/utils/remove_falsy.js +8 -0
- package/lib/utils/resolve.js +41 -0
- package/lib/utils/runtime.js +5 -0
- package/lib/utils/semver.js +28 -0
- package/package.json +41 -24
- package/types/config/netlify_config.d.ts +4 -4
- package/types/netlify_plugin_constants.d.ts +8 -8
- package/src/core/bin.js +0 -83
- package/src/core/build.js +0 -554
- package/src/core/config.js +0 -186
- package/src/core/constants.js +0 -156
- package/src/core/dev.js +0 -31
- package/src/core/dry.js +0 -39
- package/src/core/feature_flags.js +0 -22
- package/src/core/flags.js +0 -204
- package/src/core/lingering.js +0 -85
- package/src/core/main.js +0 -165
- package/src/core/missing_side_file.js +0 -29
- package/src/core/normalize_flags.js +0 -70
- package/src/core/severity.js +0 -22
- package/src/core/user_node_version.js +0 -41
- package/src/env/changes.js +0 -52
- package/src/env/main.js +0 -19
- package/src/env/metadata.js +0 -81
- package/src/error/api.js +0 -46
- package/src/error/build.js +0 -50
- package/src/error/colors.js +0 -11
- package/src/error/handle.js +0 -57
- package/src/error/info.js +0 -46
- package/src/error/monitor/location.js +0 -21
- package/src/error/monitor/normalize.js +0 -96
- package/src/error/monitor/print.js +0 -42
- package/src/error/monitor/report.js +0 -138
- package/src/error/monitor/start.js +0 -69
- package/src/error/parse/clean_stack.js +0 -87
- package/src/error/parse/location.js +0 -62
- package/src/error/parse/normalize.js +0 -29
- package/src/error/parse/parse.js +0 -97
- package/src/error/parse/plugin.js +0 -70
- package/src/error/parse/properties.js +0 -23
- package/src/error/parse/serialize_log.js +0 -42
- package/src/error/parse/serialize_status.js +0 -23
- package/src/error/parse/stack.js +0 -43
- package/src/error/type.js +0 -189
- package/src/install/functions.js +0 -28
- package/src/install/local.js +0 -62
- package/src/install/main.js +0 -81
- package/src/install/missing.js +0 -67
- package/src/log/colors.js +0 -34
- package/src/log/description.js +0 -26
- package/src/log/header.js +0 -16
- package/src/log/header_func.js +0 -17
- package/src/log/logger.js +0 -161
- package/src/log/messages/compatibility.js +0 -164
- package/src/log/messages/config.js +0 -107
- package/src/log/messages/core.js +0 -70
- package/src/log/messages/core_steps.js +0 -104
- package/src/log/messages/dry.js +0 -63
- package/src/log/messages/install.js +0 -20
- package/src/log/messages/ipc.js +0 -38
- package/src/log/messages/mutations.js +0 -82
- package/src/log/messages/status.js +0 -16
- package/src/log/messages/steps.js +0 -22
- package/src/log/old_version.js +0 -41
- package/src/log/serialize.js +0 -13
- package/src/log/stream.js +0 -85
- package/src/log/theme.js +0 -26
- package/src/plugins/child/diff.js +0 -55
- package/src/plugins/child/error.js +0 -32
- package/src/plugins/child/lazy.js +0 -18
- package/src/plugins/child/load.js +0 -29
- package/src/plugins/child/logic.js +0 -57
- package/src/plugins/child/main.js +0 -51
- package/src/plugins/child/run.js +0 -28
- package/src/plugins/child/status.js +0 -74
- package/src/plugins/child/typescript.js +0 -45
- package/src/plugins/child/utils.js +0 -56
- package/src/plugins/child/validate.js +0 -34
- package/src/plugins/compatibility.js +0 -128
- package/src/plugins/expected_version.js +0 -119
- package/src/plugins/ipc.js +0 -145
- package/src/plugins/list.js +0 -86
- package/src/plugins/load.js +0 -70
- package/src/plugins/manifest/check.js +0 -106
- package/src/plugins/manifest/load.js +0 -41
- package/src/plugins/manifest/main.js +0 -22
- package/src/plugins/manifest/path.js +0 -31
- package/src/plugins/manifest/validate.js +0 -108
- package/src/plugins/node_version.js +0 -50
- package/src/plugins/options.js +0 -88
- package/src/plugins/pinned_version.js +0 -131
- package/src/plugins/resolve.js +0 -152
- package/src/plugins/spawn.js +0 -66
- package/src/plugins_core/add.js +0 -49
- package/src/plugins_core/build_command.js +0 -75
- package/src/plugins_core/deploy/buildbot_client.js +0 -102
- package/src/plugins_core/deploy/index.js +0 -73
- package/src/plugins_core/edge_functions/index.js +0 -123
- package/src/plugins_core/edge_functions/lib/internal_manifest.js +0 -54
- package/src/plugins_core/edge_functions/validate_manifest/validate_edge_functions_manifest.js +0 -89
- package/src/plugins_core/functions/error.js +0 -163
- package/src/plugins_core/functions/feature_flags.js +0 -6
- package/src/plugins_core/functions/index.js +0 -160
- package/src/plugins_core/functions/utils.js +0 -66
- package/src/plugins_core/functions/zisi.js +0 -53
- package/src/plugins_core/list.js +0 -27
- package/src/status/add.js +0 -36
- package/src/status/colors.js +0 -23
- package/src/status/load_error.js +0 -11
- package/src/status/report.js +0 -137
- package/src/status/success.js +0 -18
- package/src/steps/core_step.js +0 -92
- package/src/steps/error.js +0 -102
- package/src/steps/get.js +0 -51
- package/src/steps/plugin.js +0 -85
- package/src/steps/return.js +0 -52
- package/src/steps/run_core_steps.js +0 -200
- package/src/steps/run_step.js +0 -304
- package/src/steps/run_steps.js +0 -179
- package/src/steps/update_config.js +0 -93
- package/src/telemetry/main.js +0 -136
- package/src/time/aggregate.js +0 -146
- package/src/time/main.js +0 -48
- package/src/time/measure.js +0 -22
- package/src/time/report.js +0 -59
- package/src/utils/errors.js +0 -12
- package/src/utils/json.js +0 -19
- package/src/utils/omit.js +0 -6
- package/src/utils/package.js +0 -23
- package/src/utils/remove_falsy.js +0 -10
- package/src/utils/resolve.js +0 -46
- package/src/utils/semver.js +0 -34
package/src/core/build.js
DELETED
|
@@ -1,554 +0,0 @@
|
|
|
1
|
-
import { getErrorInfo } from '../error/info.js'
|
|
2
|
-
import { startErrorMonitor } from '../error/monitor/start.js'
|
|
3
|
-
import { getBufferLogs, getSystemLogger } from '../log/logger.js'
|
|
4
|
-
import { logBuildStart } from '../log/messages/core.js'
|
|
5
|
-
import { loadPlugins } from '../plugins/load.js'
|
|
6
|
-
import { getPluginsOptions } from '../plugins/options.js'
|
|
7
|
-
import { pinPlugins } from '../plugins/pinned_version.js'
|
|
8
|
-
import { startPlugins, stopPlugins } from '../plugins/spawn.js'
|
|
9
|
-
import { addCorePlugins } from '../plugins_core/add.js'
|
|
10
|
-
import { reportStatuses } from '../status/report.js'
|
|
11
|
-
import { getDevSteps, getSteps } from '../steps/get.js'
|
|
12
|
-
import { runSteps } from '../steps/run_steps.js'
|
|
13
|
-
import { initTimers, measureDuration } from '../time/main.js'
|
|
14
|
-
|
|
15
|
-
import { getConfigOpts, loadConfig } from './config.js'
|
|
16
|
-
import { getConstants } from './constants.js'
|
|
17
|
-
import { doDryRun } from './dry.js'
|
|
18
|
-
import { warnOnLingeringProcesses } from './lingering.js'
|
|
19
|
-
import { warnOnMissingSideFiles } from './missing_side_file.js'
|
|
20
|
-
import { normalizeFlags } from './normalize_flags.js'
|
|
21
|
-
|
|
22
|
-
// Performed on build start. Must be kept small and unlikely to fail since it
|
|
23
|
-
// does not have proper error handling. Error handling relies on `errorMonitor`
|
|
24
|
-
// being built, which relies itself on flags being normalized.
|
|
25
|
-
export const startBuild = function (flags) {
|
|
26
|
-
const timers = initTimers()
|
|
27
|
-
|
|
28
|
-
const logs = getBufferLogs(flags)
|
|
29
|
-
logBuildStart(logs)
|
|
30
|
-
|
|
31
|
-
const { bugsnagKey, ...flagsA } = normalizeFlags(flags, logs)
|
|
32
|
-
const errorMonitor = startErrorMonitor({ flags: flagsA, logs, bugsnagKey })
|
|
33
|
-
|
|
34
|
-
return { ...flagsA, errorMonitor, logs, timers }
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const tExecBuild = async function ({
|
|
38
|
-
config,
|
|
39
|
-
defaultConfig,
|
|
40
|
-
cachedConfig,
|
|
41
|
-
cachedConfigPath,
|
|
42
|
-
cwd,
|
|
43
|
-
repositoryRoot,
|
|
44
|
-
apiHost,
|
|
45
|
-
token,
|
|
46
|
-
siteId,
|
|
47
|
-
context,
|
|
48
|
-
branch,
|
|
49
|
-
baseRelDir,
|
|
50
|
-
env: envOpt,
|
|
51
|
-
debug,
|
|
52
|
-
systemLogFile,
|
|
53
|
-
verbose,
|
|
54
|
-
nodePath,
|
|
55
|
-
functionsDistDir,
|
|
56
|
-
edgeFunctionsDistDir,
|
|
57
|
-
cacheDir,
|
|
58
|
-
dry,
|
|
59
|
-
mode,
|
|
60
|
-
offline,
|
|
61
|
-
deployId,
|
|
62
|
-
buildId,
|
|
63
|
-
testOpts,
|
|
64
|
-
errorMonitor,
|
|
65
|
-
errorParams,
|
|
66
|
-
logs,
|
|
67
|
-
timers,
|
|
68
|
-
buildbotServerSocket,
|
|
69
|
-
sendStatus,
|
|
70
|
-
saveConfig,
|
|
71
|
-
featureFlags,
|
|
72
|
-
timeline,
|
|
73
|
-
devCommand,
|
|
74
|
-
}) {
|
|
75
|
-
const configOpts = getConfigOpts({
|
|
76
|
-
config,
|
|
77
|
-
defaultConfig,
|
|
78
|
-
cwd,
|
|
79
|
-
repositoryRoot,
|
|
80
|
-
apiHost,
|
|
81
|
-
token,
|
|
82
|
-
siteId,
|
|
83
|
-
context,
|
|
84
|
-
branch,
|
|
85
|
-
baseRelDir,
|
|
86
|
-
envOpt,
|
|
87
|
-
mode,
|
|
88
|
-
offline,
|
|
89
|
-
deployId,
|
|
90
|
-
buildId,
|
|
91
|
-
testOpts,
|
|
92
|
-
featureFlags,
|
|
93
|
-
})
|
|
94
|
-
const {
|
|
95
|
-
netlifyConfig,
|
|
96
|
-
configPath,
|
|
97
|
-
headersPath,
|
|
98
|
-
redirectsPath,
|
|
99
|
-
buildDir,
|
|
100
|
-
repositoryRoot: repositoryRootA,
|
|
101
|
-
packageJson,
|
|
102
|
-
userNodeVersion,
|
|
103
|
-
childEnv,
|
|
104
|
-
context: contextA,
|
|
105
|
-
branch: branchA,
|
|
106
|
-
token: tokenA,
|
|
107
|
-
api,
|
|
108
|
-
siteInfo,
|
|
109
|
-
timers: timersA,
|
|
110
|
-
} = await loadConfig({
|
|
111
|
-
configOpts,
|
|
112
|
-
cachedConfig,
|
|
113
|
-
cachedConfigPath,
|
|
114
|
-
envOpt,
|
|
115
|
-
debug,
|
|
116
|
-
logs,
|
|
117
|
-
nodePath,
|
|
118
|
-
timers,
|
|
119
|
-
})
|
|
120
|
-
const constants = await getConstants({
|
|
121
|
-
configPath,
|
|
122
|
-
buildDir,
|
|
123
|
-
functionsDistDir,
|
|
124
|
-
edgeFunctionsDistDir,
|
|
125
|
-
cacheDir,
|
|
126
|
-
netlifyConfig,
|
|
127
|
-
siteInfo,
|
|
128
|
-
apiHost,
|
|
129
|
-
token: tokenA,
|
|
130
|
-
mode,
|
|
131
|
-
testOpts,
|
|
132
|
-
})
|
|
133
|
-
const systemLog = getSystemLogger(logs, debug, systemLogFile)
|
|
134
|
-
const pluginsOptions = addCorePlugins({ netlifyConfig, constants })
|
|
135
|
-
// `errorParams` is purposely stateful
|
|
136
|
-
// eslint-disable-next-line fp/no-mutating-assign
|
|
137
|
-
Object.assign(errorParams, { netlifyConfig, pluginsOptions, siteInfo, childEnv, userNodeVersion })
|
|
138
|
-
|
|
139
|
-
const {
|
|
140
|
-
pluginsOptions: pluginsOptionsA,
|
|
141
|
-
netlifyConfig: netlifyConfigA,
|
|
142
|
-
stepsCount,
|
|
143
|
-
timers: timersB,
|
|
144
|
-
configMutations,
|
|
145
|
-
} = await runAndReportBuild({
|
|
146
|
-
pluginsOptions,
|
|
147
|
-
netlifyConfig,
|
|
148
|
-
configOpts,
|
|
149
|
-
siteInfo,
|
|
150
|
-
configPath,
|
|
151
|
-
headersPath,
|
|
152
|
-
redirectsPath,
|
|
153
|
-
buildDir,
|
|
154
|
-
repositoryRoot: repositoryRootA,
|
|
155
|
-
nodePath,
|
|
156
|
-
packageJson,
|
|
157
|
-
userNodeVersion,
|
|
158
|
-
childEnv,
|
|
159
|
-
context: contextA,
|
|
160
|
-
branch: branchA,
|
|
161
|
-
dry,
|
|
162
|
-
mode,
|
|
163
|
-
api,
|
|
164
|
-
errorMonitor,
|
|
165
|
-
deployId,
|
|
166
|
-
errorParams,
|
|
167
|
-
logs,
|
|
168
|
-
debug,
|
|
169
|
-
systemLog,
|
|
170
|
-
verbose,
|
|
171
|
-
timers: timersA,
|
|
172
|
-
sendStatus,
|
|
173
|
-
saveConfig,
|
|
174
|
-
testOpts,
|
|
175
|
-
buildbotServerSocket,
|
|
176
|
-
constants,
|
|
177
|
-
featureFlags,
|
|
178
|
-
timeline,
|
|
179
|
-
devCommand,
|
|
180
|
-
})
|
|
181
|
-
return {
|
|
182
|
-
pluginsOptions: pluginsOptionsA,
|
|
183
|
-
netlifyConfig: netlifyConfigA,
|
|
184
|
-
siteInfo,
|
|
185
|
-
userNodeVersion,
|
|
186
|
-
stepsCount,
|
|
187
|
-
timers: timersB,
|
|
188
|
-
configMutations,
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export const execBuild = measureDuration(tExecBuild, 'total', { parentTag: 'build_site' })
|
|
193
|
-
|
|
194
|
-
// Runs a build then report any plugin statuses
|
|
195
|
-
export const runAndReportBuild = async function ({
|
|
196
|
-
pluginsOptions,
|
|
197
|
-
netlifyConfig,
|
|
198
|
-
configOpts,
|
|
199
|
-
siteInfo,
|
|
200
|
-
configPath,
|
|
201
|
-
headersPath,
|
|
202
|
-
redirectsPath,
|
|
203
|
-
buildDir,
|
|
204
|
-
repositoryRoot,
|
|
205
|
-
nodePath,
|
|
206
|
-
packageJson,
|
|
207
|
-
userNodeVersion,
|
|
208
|
-
childEnv,
|
|
209
|
-
context,
|
|
210
|
-
branch,
|
|
211
|
-
buildbotServerSocket,
|
|
212
|
-
constants,
|
|
213
|
-
dry,
|
|
214
|
-
mode,
|
|
215
|
-
api,
|
|
216
|
-
errorMonitor,
|
|
217
|
-
deployId,
|
|
218
|
-
errorParams,
|
|
219
|
-
logs,
|
|
220
|
-
debug,
|
|
221
|
-
systemLog,
|
|
222
|
-
verbose,
|
|
223
|
-
timers,
|
|
224
|
-
sendStatus,
|
|
225
|
-
saveConfig,
|
|
226
|
-
testOpts,
|
|
227
|
-
featureFlags,
|
|
228
|
-
timeline,
|
|
229
|
-
devCommand,
|
|
230
|
-
}) {
|
|
231
|
-
try {
|
|
232
|
-
const {
|
|
233
|
-
stepsCount,
|
|
234
|
-
netlifyConfig: netlifyConfigA,
|
|
235
|
-
statuses,
|
|
236
|
-
pluginsOptions: pluginsOptionsA,
|
|
237
|
-
failedPlugins,
|
|
238
|
-
timers: timersA,
|
|
239
|
-
configMutations,
|
|
240
|
-
} = await initAndRunBuild({
|
|
241
|
-
pluginsOptions,
|
|
242
|
-
netlifyConfig,
|
|
243
|
-
configOpts,
|
|
244
|
-
siteInfo,
|
|
245
|
-
configPath,
|
|
246
|
-
headersPath,
|
|
247
|
-
redirectsPath,
|
|
248
|
-
buildDir,
|
|
249
|
-
repositoryRoot,
|
|
250
|
-
nodePath,
|
|
251
|
-
packageJson,
|
|
252
|
-
userNodeVersion,
|
|
253
|
-
childEnv,
|
|
254
|
-
context,
|
|
255
|
-
branch,
|
|
256
|
-
dry,
|
|
257
|
-
mode,
|
|
258
|
-
api,
|
|
259
|
-
errorMonitor,
|
|
260
|
-
deployId,
|
|
261
|
-
errorParams,
|
|
262
|
-
logs,
|
|
263
|
-
debug,
|
|
264
|
-
systemLog,
|
|
265
|
-
verbose,
|
|
266
|
-
timers,
|
|
267
|
-
sendStatus,
|
|
268
|
-
saveConfig,
|
|
269
|
-
testOpts,
|
|
270
|
-
buildbotServerSocket,
|
|
271
|
-
constants,
|
|
272
|
-
featureFlags,
|
|
273
|
-
timeline,
|
|
274
|
-
devCommand,
|
|
275
|
-
})
|
|
276
|
-
await Promise.all([
|
|
277
|
-
reportStatuses({
|
|
278
|
-
statuses,
|
|
279
|
-
childEnv,
|
|
280
|
-
api,
|
|
281
|
-
mode,
|
|
282
|
-
pluginsOptions: pluginsOptionsA,
|
|
283
|
-
netlifyConfig: netlifyConfigA,
|
|
284
|
-
errorMonitor,
|
|
285
|
-
deployId,
|
|
286
|
-
logs,
|
|
287
|
-
debug,
|
|
288
|
-
sendStatus,
|
|
289
|
-
testOpts,
|
|
290
|
-
}),
|
|
291
|
-
pinPlugins({
|
|
292
|
-
pluginsOptions: pluginsOptionsA,
|
|
293
|
-
failedPlugins,
|
|
294
|
-
api,
|
|
295
|
-
siteInfo,
|
|
296
|
-
childEnv,
|
|
297
|
-
mode,
|
|
298
|
-
netlifyConfig: netlifyConfigA,
|
|
299
|
-
errorMonitor,
|
|
300
|
-
logs,
|
|
301
|
-
debug,
|
|
302
|
-
testOpts,
|
|
303
|
-
sendStatus,
|
|
304
|
-
}),
|
|
305
|
-
])
|
|
306
|
-
|
|
307
|
-
return {
|
|
308
|
-
pluginsOptions: pluginsOptionsA,
|
|
309
|
-
netlifyConfig: netlifyConfigA,
|
|
310
|
-
stepsCount,
|
|
311
|
-
timers: timersA,
|
|
312
|
-
configMutations,
|
|
313
|
-
}
|
|
314
|
-
} catch (error) {
|
|
315
|
-
const [{ statuses }] = getErrorInfo(error)
|
|
316
|
-
await reportStatuses({
|
|
317
|
-
statuses,
|
|
318
|
-
childEnv,
|
|
319
|
-
api,
|
|
320
|
-
mode,
|
|
321
|
-
pluginsOptions,
|
|
322
|
-
netlifyConfig,
|
|
323
|
-
errorMonitor,
|
|
324
|
-
deployId,
|
|
325
|
-
logs,
|
|
326
|
-
debug,
|
|
327
|
-
sendStatus,
|
|
328
|
-
testOpts,
|
|
329
|
-
})
|
|
330
|
-
throw error
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// Initialize plugin processes then runs a build
|
|
335
|
-
const initAndRunBuild = async function ({
|
|
336
|
-
pluginsOptions,
|
|
337
|
-
netlifyConfig,
|
|
338
|
-
configOpts,
|
|
339
|
-
siteInfo,
|
|
340
|
-
configPath,
|
|
341
|
-
headersPath,
|
|
342
|
-
redirectsPath,
|
|
343
|
-
buildDir,
|
|
344
|
-
repositoryRoot,
|
|
345
|
-
nodePath,
|
|
346
|
-
packageJson,
|
|
347
|
-
userNodeVersion,
|
|
348
|
-
childEnv,
|
|
349
|
-
context,
|
|
350
|
-
branch,
|
|
351
|
-
dry,
|
|
352
|
-
mode,
|
|
353
|
-
api,
|
|
354
|
-
errorMonitor,
|
|
355
|
-
deployId,
|
|
356
|
-
errorParams,
|
|
357
|
-
logs,
|
|
358
|
-
debug,
|
|
359
|
-
systemLog,
|
|
360
|
-
verbose,
|
|
361
|
-
sendStatus,
|
|
362
|
-
saveConfig,
|
|
363
|
-
timers,
|
|
364
|
-
testOpts,
|
|
365
|
-
buildbotServerSocket,
|
|
366
|
-
constants,
|
|
367
|
-
featureFlags,
|
|
368
|
-
timeline,
|
|
369
|
-
devCommand,
|
|
370
|
-
}) {
|
|
371
|
-
const { pluginsOptions: pluginsOptionsA, timers: timersA } = await getPluginsOptions({
|
|
372
|
-
pluginsOptions,
|
|
373
|
-
netlifyConfig,
|
|
374
|
-
siteInfo,
|
|
375
|
-
buildDir,
|
|
376
|
-
nodePath,
|
|
377
|
-
packageJson,
|
|
378
|
-
userNodeVersion,
|
|
379
|
-
mode,
|
|
380
|
-
api,
|
|
381
|
-
logs,
|
|
382
|
-
debug,
|
|
383
|
-
sendStatus,
|
|
384
|
-
timers,
|
|
385
|
-
testOpts,
|
|
386
|
-
featureFlags,
|
|
387
|
-
})
|
|
388
|
-
// eslint-disable-next-line fp/no-mutation, no-param-reassign
|
|
389
|
-
errorParams.pluginsOptions = pluginsOptionsA
|
|
390
|
-
|
|
391
|
-
const { childProcesses, timers: timersB } = await startPlugins({
|
|
392
|
-
pluginsOptions: pluginsOptionsA,
|
|
393
|
-
buildDir,
|
|
394
|
-
childEnv,
|
|
395
|
-
logs,
|
|
396
|
-
debug,
|
|
397
|
-
timers: timersA,
|
|
398
|
-
})
|
|
399
|
-
|
|
400
|
-
try {
|
|
401
|
-
const {
|
|
402
|
-
stepsCount,
|
|
403
|
-
netlifyConfig: netlifyConfigA,
|
|
404
|
-
statuses,
|
|
405
|
-
failedPlugins,
|
|
406
|
-
timers: timersC,
|
|
407
|
-
configMutations,
|
|
408
|
-
} = await runBuild({
|
|
409
|
-
childProcesses,
|
|
410
|
-
pluginsOptions: pluginsOptionsA,
|
|
411
|
-
netlifyConfig,
|
|
412
|
-
configOpts,
|
|
413
|
-
packageJson,
|
|
414
|
-
configPath,
|
|
415
|
-
headersPath,
|
|
416
|
-
redirectsPath,
|
|
417
|
-
buildDir,
|
|
418
|
-
repositoryRoot,
|
|
419
|
-
nodePath,
|
|
420
|
-
childEnv,
|
|
421
|
-
context,
|
|
422
|
-
branch,
|
|
423
|
-
dry,
|
|
424
|
-
buildbotServerSocket,
|
|
425
|
-
constants,
|
|
426
|
-
mode,
|
|
427
|
-
api,
|
|
428
|
-
errorMonitor,
|
|
429
|
-
deployId,
|
|
430
|
-
errorParams,
|
|
431
|
-
logs,
|
|
432
|
-
debug,
|
|
433
|
-
systemLog,
|
|
434
|
-
verbose,
|
|
435
|
-
saveConfig,
|
|
436
|
-
timers: timersB,
|
|
437
|
-
testOpts,
|
|
438
|
-
featureFlags,
|
|
439
|
-
timeline,
|
|
440
|
-
devCommand,
|
|
441
|
-
})
|
|
442
|
-
|
|
443
|
-
await Promise.all([
|
|
444
|
-
warnOnMissingSideFiles({ buildDir, netlifyConfig: netlifyConfigA, logs }),
|
|
445
|
-
warnOnLingeringProcesses({ mode, logs, testOpts }),
|
|
446
|
-
])
|
|
447
|
-
|
|
448
|
-
return {
|
|
449
|
-
stepsCount,
|
|
450
|
-
netlifyConfig: netlifyConfigA,
|
|
451
|
-
statuses,
|
|
452
|
-
pluginsOptions: pluginsOptionsA,
|
|
453
|
-
failedPlugins,
|
|
454
|
-
timers: timersC,
|
|
455
|
-
configMutations,
|
|
456
|
-
}
|
|
457
|
-
} finally {
|
|
458
|
-
stopPlugins(childProcesses)
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
// Load plugin main files, retrieve their event handlers then runs them,
|
|
463
|
-
// together with the build command
|
|
464
|
-
const runBuild = async function ({
|
|
465
|
-
childProcesses,
|
|
466
|
-
pluginsOptions,
|
|
467
|
-
netlifyConfig,
|
|
468
|
-
configOpts,
|
|
469
|
-
packageJson,
|
|
470
|
-
configPath,
|
|
471
|
-
headersPath,
|
|
472
|
-
redirectsPath,
|
|
473
|
-
buildDir,
|
|
474
|
-
repositoryRoot,
|
|
475
|
-
nodePath,
|
|
476
|
-
childEnv,
|
|
477
|
-
context,
|
|
478
|
-
branch,
|
|
479
|
-
dry,
|
|
480
|
-
buildbotServerSocket,
|
|
481
|
-
constants,
|
|
482
|
-
mode,
|
|
483
|
-
api,
|
|
484
|
-
errorMonitor,
|
|
485
|
-
deployId,
|
|
486
|
-
errorParams,
|
|
487
|
-
logs,
|
|
488
|
-
debug,
|
|
489
|
-
systemLog,
|
|
490
|
-
verbose,
|
|
491
|
-
saveConfig,
|
|
492
|
-
timers,
|
|
493
|
-
testOpts,
|
|
494
|
-
featureFlags,
|
|
495
|
-
timeline,
|
|
496
|
-
devCommand,
|
|
497
|
-
}) {
|
|
498
|
-
const { pluginsSteps, timers: timersA } = await loadPlugins({
|
|
499
|
-
pluginsOptions,
|
|
500
|
-
childProcesses,
|
|
501
|
-
packageJson,
|
|
502
|
-
timers,
|
|
503
|
-
logs,
|
|
504
|
-
debug,
|
|
505
|
-
verbose,
|
|
506
|
-
})
|
|
507
|
-
|
|
508
|
-
const { steps, events } = timeline === 'dev' ? getDevSteps(devCommand, pluginsSteps) : getSteps(pluginsSteps)
|
|
509
|
-
|
|
510
|
-
if (dry) {
|
|
511
|
-
await doDryRun({ buildDir, steps, netlifyConfig, constants, buildbotServerSocket, logs })
|
|
512
|
-
return { netlifyConfig }
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
const {
|
|
516
|
-
stepsCount,
|
|
517
|
-
netlifyConfig: netlifyConfigA,
|
|
518
|
-
statuses,
|
|
519
|
-
failedPlugins,
|
|
520
|
-
timers: timersB,
|
|
521
|
-
configMutations,
|
|
522
|
-
} = await runSteps({
|
|
523
|
-
steps,
|
|
524
|
-
buildbotServerSocket,
|
|
525
|
-
events,
|
|
526
|
-
configPath,
|
|
527
|
-
headersPath,
|
|
528
|
-
redirectsPath,
|
|
529
|
-
buildDir,
|
|
530
|
-
repositoryRoot,
|
|
531
|
-
nodePath,
|
|
532
|
-
childEnv,
|
|
533
|
-
context,
|
|
534
|
-
branch,
|
|
535
|
-
constants,
|
|
536
|
-
mode,
|
|
537
|
-
api,
|
|
538
|
-
errorMonitor,
|
|
539
|
-
deployId,
|
|
540
|
-
errorParams,
|
|
541
|
-
netlifyConfig,
|
|
542
|
-
configOpts,
|
|
543
|
-
logs,
|
|
544
|
-
debug,
|
|
545
|
-
systemLog,
|
|
546
|
-
verbose,
|
|
547
|
-
saveConfig,
|
|
548
|
-
timers: timersA,
|
|
549
|
-
testOpts,
|
|
550
|
-
featureFlags,
|
|
551
|
-
})
|
|
552
|
-
|
|
553
|
-
return { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersB, configMutations }
|
|
554
|
-
}
|
package/src/core/config.js
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { resolveConfig, updateConfig, restoreConfig } from '@netlify/config'
|
|
2
|
-
import mapObj from 'map-obj'
|
|
3
|
-
|
|
4
|
-
import { getChildEnv } from '../env/main.js'
|
|
5
|
-
import { addApiErrorHandlers } from '../error/api.js'
|
|
6
|
-
import { changeErrorType } from '../error/info.js'
|
|
7
|
-
import { logBuildDir, logConfigPath, logConfig, logContext } from '../log/messages/config.js'
|
|
8
|
-
import { logConfigOnUpload, logHeadersOnUpload, logRedirectsOnUpload } from '../log/messages/mutations.js'
|
|
9
|
-
import { measureDuration } from '../time/main.js'
|
|
10
|
-
import { getPackageJson } from '../utils/package.js'
|
|
11
|
-
|
|
12
|
-
import { getUserNodeVersion } from './user_node_version.js'
|
|
13
|
-
|
|
14
|
-
// Retrieve immutable options passed to `@netlify/config`.
|
|
15
|
-
// This does not include options which might change during the course of the
|
|
16
|
-
// build:
|
|
17
|
-
// - `cachedConfig` and `cachedConfigPath` are only used at the beginning of
|
|
18
|
-
// the build
|
|
19
|
-
// - If plugins change the configuration, `configMutations` is used instead
|
|
20
|
-
// In both cases, almost all options should remain the same.
|
|
21
|
-
export const getConfigOpts = function ({
|
|
22
|
-
config,
|
|
23
|
-
defaultConfig,
|
|
24
|
-
cwd,
|
|
25
|
-
repositoryRoot,
|
|
26
|
-
apiHost,
|
|
27
|
-
token,
|
|
28
|
-
siteId,
|
|
29
|
-
context,
|
|
30
|
-
branch,
|
|
31
|
-
baseRelDir,
|
|
32
|
-
envOpt,
|
|
33
|
-
mode,
|
|
34
|
-
offline,
|
|
35
|
-
deployId,
|
|
36
|
-
buildId,
|
|
37
|
-
testOpts,
|
|
38
|
-
featureFlags,
|
|
39
|
-
}) {
|
|
40
|
-
return {
|
|
41
|
-
config,
|
|
42
|
-
defaultConfig,
|
|
43
|
-
cwd,
|
|
44
|
-
repositoryRoot,
|
|
45
|
-
context,
|
|
46
|
-
branch,
|
|
47
|
-
baseRelDir,
|
|
48
|
-
host: apiHost,
|
|
49
|
-
token,
|
|
50
|
-
siteId,
|
|
51
|
-
deployId,
|
|
52
|
-
buildId,
|
|
53
|
-
mode,
|
|
54
|
-
offline,
|
|
55
|
-
env: envOpt,
|
|
56
|
-
testOpts,
|
|
57
|
-
featureFlags,
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Retrieve configuration object
|
|
62
|
-
const tLoadConfig = async function ({ configOpts, cachedConfig, cachedConfigPath, envOpt, debug, logs, nodePath }) {
|
|
63
|
-
const {
|
|
64
|
-
configPath,
|
|
65
|
-
headersPath,
|
|
66
|
-
redirectsPath,
|
|
67
|
-
buildDir,
|
|
68
|
-
repositoryRoot,
|
|
69
|
-
config: netlifyConfig,
|
|
70
|
-
context: contextA,
|
|
71
|
-
branch: branchA,
|
|
72
|
-
token: tokenA,
|
|
73
|
-
api,
|
|
74
|
-
siteInfo,
|
|
75
|
-
env,
|
|
76
|
-
} = await resolveInitialConfig(configOpts, cachedConfig, cachedConfigPath)
|
|
77
|
-
logConfigInfo({ logs, configPath, buildDir, netlifyConfig, context: contextA, debug })
|
|
78
|
-
|
|
79
|
-
const apiA = addApiErrorHandlers(api)
|
|
80
|
-
const envValues = mapObj(env, (key, { value }) => [key, value])
|
|
81
|
-
const childEnv = getChildEnv({ envOpt, env: envValues })
|
|
82
|
-
const [{ packageJson }, userNodeVersion] = await Promise.all([getPackageJson(buildDir), getUserNodeVersion(nodePath)])
|
|
83
|
-
return {
|
|
84
|
-
netlifyConfig,
|
|
85
|
-
configPath,
|
|
86
|
-
headersPath,
|
|
87
|
-
redirectsPath,
|
|
88
|
-
buildDir,
|
|
89
|
-
repositoryRoot,
|
|
90
|
-
packageJson,
|
|
91
|
-
userNodeVersion,
|
|
92
|
-
childEnv,
|
|
93
|
-
context: contextA,
|
|
94
|
-
branch: branchA,
|
|
95
|
-
token: tokenA,
|
|
96
|
-
api: apiA,
|
|
97
|
-
siteInfo,
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export const loadConfig = measureDuration(tLoadConfig, 'resolve_config')
|
|
102
|
-
|
|
103
|
-
// Retrieve initial configuration.
|
|
104
|
-
// In the buildbot and CLI, we re-use the already parsed `@netlify/config`
|
|
105
|
-
// return value which is passed as `cachedConfig`/`cachedConfigPath`.
|
|
106
|
-
const resolveInitialConfig = async function (configOpts, cachedConfig, cachedConfigPath) {
|
|
107
|
-
return await resolveConfig({ ...configOpts, cachedConfig, cachedConfigPath })
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const logConfigInfo = function ({ logs, configPath, buildDir, netlifyConfig, context, debug }) {
|
|
111
|
-
logBuildDir(logs, buildDir)
|
|
112
|
-
logConfigPath(logs, configPath)
|
|
113
|
-
logConfig({ logs, netlifyConfig, debug })
|
|
114
|
-
logContext(logs, context)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Retrieve the configuration after it's been changed.
|
|
118
|
-
// This ensures any configuration changes done by plugins is validated and
|
|
119
|
-
// normalized.
|
|
120
|
-
// We use `debug: false` to avoid any debug logs. Otherwise every configuration
|
|
121
|
-
// change would create debug logs which would be too verbose.
|
|
122
|
-
// Errors are propagated and assigned to the specific plugin or core step
|
|
123
|
-
// which changed the configuration.
|
|
124
|
-
export const resolveUpdatedConfig = async function (configOpts, configMutations) {
|
|
125
|
-
try {
|
|
126
|
-
return await resolveConfig({ ...configOpts, configMutations, debug: false })
|
|
127
|
-
} catch (error) {
|
|
128
|
-
changeErrorType(error, 'resolveConfig', 'pluginValidation')
|
|
129
|
-
throw error
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// If the configuration was changed, persist it to `netlify.toml`.
|
|
134
|
-
// If `netlify.toml` does not exist, create it inside repository root.
|
|
135
|
-
// This is only done when `saveConfig` is `true`. This allows performing this
|
|
136
|
-
// in the buildbot but not in local builds, since only the latter run in a
|
|
137
|
-
// container and we want to avoid saving files on local machines.
|
|
138
|
-
export const saveUpdatedConfig = async function ({
|
|
139
|
-
configMutations,
|
|
140
|
-
buildDir,
|
|
141
|
-
repositoryRoot,
|
|
142
|
-
configPath = `${repositoryRoot}/netlify.toml`,
|
|
143
|
-
headersPath,
|
|
144
|
-
redirectsPath,
|
|
145
|
-
logs,
|
|
146
|
-
featureFlags,
|
|
147
|
-
context,
|
|
148
|
-
branch,
|
|
149
|
-
debug,
|
|
150
|
-
saveConfig,
|
|
151
|
-
}) {
|
|
152
|
-
if (!saveConfig) {
|
|
153
|
-
return
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
await updateConfig(configMutations, {
|
|
157
|
-
buildDir,
|
|
158
|
-
configPath,
|
|
159
|
-
headersPath,
|
|
160
|
-
redirectsPath,
|
|
161
|
-
context,
|
|
162
|
-
branch,
|
|
163
|
-
logs,
|
|
164
|
-
featureFlags,
|
|
165
|
-
})
|
|
166
|
-
|
|
167
|
-
await logConfigOnUpload({ logs, configPath, debug })
|
|
168
|
-
await logHeadersOnUpload({ logs, headersPath, debug })
|
|
169
|
-
await logRedirectsOnUpload({ logs, redirectsPath, debug })
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export const restoreUpdatedConfig = async function ({
|
|
173
|
-
configMutations,
|
|
174
|
-
buildDir,
|
|
175
|
-
repositoryRoot,
|
|
176
|
-
configPath = `${repositoryRoot}/netlify.toml`,
|
|
177
|
-
headersPath,
|
|
178
|
-
redirectsPath,
|
|
179
|
-
saveConfig,
|
|
180
|
-
}) {
|
|
181
|
-
if (!saveConfig) {
|
|
182
|
-
return
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
await restoreConfig(configMutations, { buildDir, configPath, headersPath, redirectsPath })
|
|
186
|
-
}
|