@netlify/build 27.20.4 → 27.20.5

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