@netlify/build 27.18.3 → 27.18.5-rc

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 (135) hide show
  1. package/package.json +10 -9
  2. package/src/core/bin.js +0 -83
  3. package/src/core/build.js +0 -559
  4. package/src/core/config.js +0 -186
  5. package/src/core/constants.js +0 -156
  6. package/src/core/dev.js +0 -31
  7. package/src/core/dry.js +0 -39
  8. package/src/core/feature_flags.js +0 -22
  9. package/src/core/flags.js +0 -204
  10. package/src/core/lingering.js +0 -85
  11. package/src/core/main.js +0 -165
  12. package/src/core/missing_side_file.js +0 -29
  13. package/src/core/normalize_flags.js +0 -70
  14. package/src/core/severity.js +0 -22
  15. package/src/core/user_node_version.js +0 -41
  16. package/src/env/changes.js +0 -52
  17. package/src/env/main.js +0 -19
  18. package/src/env/metadata.js +0 -81
  19. package/src/error/api.js +0 -46
  20. package/src/error/build.js +0 -50
  21. package/src/error/cancel.js +0 -8
  22. package/src/error/colors.js +0 -11
  23. package/src/error/handle.js +0 -57
  24. package/src/error/info.js +0 -46
  25. package/src/error/monitor/location.js +0 -21
  26. package/src/error/monitor/normalize.js +0 -96
  27. package/src/error/monitor/print.js +0 -42
  28. package/src/error/monitor/report.js +0 -138
  29. package/src/error/monitor/start.js +0 -69
  30. package/src/error/parse/clean_stack.js +0 -87
  31. package/src/error/parse/location.js +0 -62
  32. package/src/error/parse/normalize.js +0 -29
  33. package/src/error/parse/parse.js +0 -97
  34. package/src/error/parse/plugin.js +0 -70
  35. package/src/error/parse/properties.js +0 -23
  36. package/src/error/parse/serialize_log.js +0 -42
  37. package/src/error/parse/serialize_status.js +0 -23
  38. package/src/error/parse/stack.js +0 -43
  39. package/src/error/type.js +0 -189
  40. package/src/install/functions.js +0 -28
  41. package/src/install/local.js +0 -62
  42. package/src/install/main.js +0 -81
  43. package/src/install/missing.js +0 -67
  44. package/src/log/colors.js +0 -34
  45. package/src/log/description.js +0 -26
  46. package/src/log/header.js +0 -16
  47. package/src/log/header_func.js +0 -17
  48. package/src/log/logger.js +0 -161
  49. package/src/log/messages/compatibility.js +0 -178
  50. package/src/log/messages/config.js +0 -107
  51. package/src/log/messages/core.js +0 -70
  52. package/src/log/messages/core_steps.js +0 -104
  53. package/src/log/messages/dry.js +0 -63
  54. package/src/log/messages/install.js +0 -32
  55. package/src/log/messages/ipc.js +0 -38
  56. package/src/log/messages/mutations.js +0 -82
  57. package/src/log/messages/plugins.js +0 -39
  58. package/src/log/messages/status.js +0 -16
  59. package/src/log/messages/steps.js +0 -22
  60. package/src/log/old_version.js +0 -41
  61. package/src/log/serialize.js +0 -13
  62. package/src/log/stream.js +0 -85
  63. package/src/log/theme.js +0 -26
  64. package/src/plugins/child/diff.js +0 -55
  65. package/src/plugins/child/error.js +0 -32
  66. package/src/plugins/child/lazy.js +0 -18
  67. package/src/plugins/child/load.js +0 -29
  68. package/src/plugins/child/logic.js +0 -65
  69. package/src/plugins/child/main.js +0 -51
  70. package/src/plugins/child/run.js +0 -28
  71. package/src/plugins/child/status.js +0 -74
  72. package/src/plugins/child/typescript.js +0 -45
  73. package/src/plugins/child/utils.js +0 -56
  74. package/src/plugins/child/validate.js +0 -34
  75. package/src/plugins/compatibility.js +0 -132
  76. package/src/plugins/error.js +0 -50
  77. package/src/plugins/events.js +0 -17
  78. package/src/plugins/expected_version.js +0 -119
  79. package/src/plugins/ipc.js +0 -145
  80. package/src/plugins/list.js +0 -86
  81. package/src/plugins/load.js +0 -70
  82. package/src/plugins/manifest/check.js +0 -106
  83. package/src/plugins/manifest/load.js +0 -41
  84. package/src/plugins/manifest/main.js +0 -22
  85. package/src/plugins/manifest/path.js +0 -31
  86. package/src/plugins/manifest/validate.js +0 -108
  87. package/src/plugins/node_version.js +0 -50
  88. package/src/plugins/options.js +0 -88
  89. package/src/plugins/pinned_version.js +0 -131
  90. package/src/plugins/resolve.js +0 -152
  91. package/src/plugins/spawn.js +0 -72
  92. package/src/plugins_core/add.js +0 -49
  93. package/src/plugins_core/build_command.js +0 -75
  94. package/src/plugins_core/deploy/buildbot_client.js +0 -113
  95. package/src/plugins_core/deploy/index.js +0 -73
  96. package/src/plugins_core/deploy/manifest.yml +0 -1
  97. package/src/plugins_core/edge_functions/index.js +0 -123
  98. package/src/plugins_core/edge_functions/lib/error.js +0 -21
  99. package/src/plugins_core/edge_functions/lib/internal_manifest.js +0 -60
  100. package/src/plugins_core/edge_functions/validate_manifest/validate_edge_functions_manifest.js +0 -89
  101. package/src/plugins_core/functions/error.js +0 -163
  102. package/src/plugins_core/functions/feature_flags.js +0 -6
  103. package/src/plugins_core/functions/index.js +0 -161
  104. package/src/plugins_core/functions/utils.js +0 -66
  105. package/src/plugins_core/functions/zisi.js +0 -56
  106. package/src/plugins_core/functions_install/index.js +0 -13
  107. package/src/plugins_core/functions_install/manifest.yml +0 -1
  108. package/src/plugins_core/list.js +0 -27
  109. package/src/status/add.js +0 -36
  110. package/src/status/colors.js +0 -23
  111. package/src/status/load_error.js +0 -11
  112. package/src/status/report.js +0 -137
  113. package/src/status/success.js +0 -18
  114. package/src/steps/core_step.js +0 -92
  115. package/src/steps/error.js +0 -102
  116. package/src/steps/get.js +0 -51
  117. package/src/steps/plugin.js +0 -85
  118. package/src/steps/return.js +0 -52
  119. package/src/steps/run_core_steps.js +0 -200
  120. package/src/steps/run_step.js +0 -304
  121. package/src/steps/run_steps.js +0 -179
  122. package/src/steps/update_config.js +0 -93
  123. package/src/telemetry/main.js +0 -136
  124. package/src/time/aggregate.js +0 -146
  125. package/src/time/main.js +0 -48
  126. package/src/time/measure.js +0 -22
  127. package/src/time/report.js +0 -59
  128. package/src/utils/errors.js +0 -12
  129. package/src/utils/json.js +0 -19
  130. package/src/utils/omit.js +0 -6
  131. package/src/utils/package.js +0 -23
  132. package/src/utils/remove_falsy.js +0 -10
  133. package/src/utils/resolve.js +0 -46
  134. package/src/utils/runtime.js +0 -5
  135. package/src/utils/semver.js +0 -34
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "27.18.3",
3
+ "version": "27.18.5-rc",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
- "exports": "./src/core/main.js",
7
- "main": "./src/core/main.js",
6
+ "exports": "./lib/core/main.js",
7
+ "main": "./lib/core/main.js",
8
8
  "types": "types/index.d.ts",
9
9
  "bin": {
10
- "netlify-build": "./src/core/bin.js"
10
+ "netlify-build": "./lib/core/bin.js"
11
11
  },
12
12
  "files": [
13
- "src/**/*.js",
14
- "src/**/*.yml",
13
+ "lib/**/*.js",
14
+ "lib/**/*.yml",
15
15
  "types/**/*.d.ts"
16
16
  ],
17
17
  "author": "Netlify Inc.",
@@ -20,7 +20,8 @@
20
20
  "Swyx <swyx@netlify.com> (https://www.swyx.io)"
21
21
  ],
22
22
  "scripts": {
23
- "prepublishOnly": "cd ../../ && npm run prepublishOnly"
23
+ "prepublishOnly": "cd ../../ && npm run prepublishOnly",
24
+ "build": "cp -a src lib/"
24
25
  },
25
26
  "keywords": [
26
27
  "nodejs",
@@ -56,12 +57,12 @@
56
57
  "license": "MIT",
57
58
  "dependencies": {
58
59
  "@bugsnag/js": "^7.0.0",
59
- "@netlify/edge-bundler": "^2.1.0",
60
+ "@netlify/edge-bundler": "^2.2.0",
60
61
  "@netlify/cache-utils": "^4.0.0",
61
62
  "@netlify/config": "^18.2.3",
62
63
  "@netlify/functions-utils": "^4.2.9",
63
64
  "@netlify/git-utils": "^4.0.0",
64
- "@netlify/plugins-list": "^6.44.0",
65
+ "@netlify/plugins-list": "^6.45.0",
65
66
  "@netlify/run-utils": "^4.0.0",
66
67
  "@netlify/zip-it-and-ship-it": "^7.1.2",
67
68
  "@sindresorhus/slugify": "^2.0.0",
package/src/core/bin.js DELETED
@@ -1,83 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import process from 'process'
4
-
5
- import filterObj from 'filter-obj'
6
- import yargs from 'yargs'
7
- import { hideBin } from 'yargs/helpers'
8
-
9
- import { normalizeCliFeatureFlags } from './feature_flags.js'
10
- import { FLAGS } from './flags.js'
11
- import build from './main.js'
12
- import { FALLBACK_SEVERITY_ENTRY } from './severity.js'
13
-
14
- // CLI entry point.
15
- // Before adding logic to this file, please consider adding it to the main
16
- // programmatic command instead, so that the new logic is available when run
17
- // programmatically as well. This file should only contain logic that makes
18
- // sense only in CLI, such as CLI flags parsing and exit code.
19
- const runCli = async function () {
20
- const flags = parseFlags()
21
- const flagsA = filterObj(flags, isUserFlag)
22
-
23
- const state = { done: false }
24
- process.on('exit', onExit.bind(undefined, state))
25
-
26
- const { severityCode, logs } = await build(flagsA)
27
- printLogs(logs)
28
- process.exitCode = severityCode
29
-
30
- state.done = true
31
- }
32
-
33
- const parseFlags = function () {
34
- const { featureFlags: cliFeatureFlags = '', ...flags } = yargs(hideBin(process.argv))
35
- .options(FLAGS)
36
- .usage(USAGE)
37
- .parse()
38
- const featureFlags = normalizeCliFeatureFlags(cliFeatureFlags)
39
- return { ...flags, featureFlags }
40
- }
41
-
42
- const USAGE = `netlify-build [OPTIONS...]
43
-
44
- Run Netlify Build system locally.
45
-
46
- Options can also be specified as environment variables prefixed with
47
- NETLIFY_BUILD_. For example the environment variable NETLIFY_BUILD_DRY=true can
48
- be used instead of the CLI flag --dry.`
49
-
50
- // Remove `yargs`-specific options, shortcuts, dash-cased and aliases
51
- const isUserFlag = function (key, value) {
52
- return value !== undefined && !INTERNAL_KEYS.has(key) && key.length !== 1 && !key.includes('-')
53
- }
54
-
55
- const INTERNAL_KEYS = new Set(['help', 'version', '_', '$0', 'dryRun'])
56
-
57
- // Used mostly for testing
58
- const printLogs = function (logs) {
59
- if (logs === undefined) {
60
- return
61
- }
62
-
63
- const allLogs = [logs.stdout.join('\n'), logs.stderr.join('\n')].filter(Boolean).join('\n\n')
64
- console.log(allLogs)
65
- }
66
-
67
- // In theory, the main process should not exit until the main `build()` function
68
- // has completed. In practice, this might happen due to bugs.
69
- // Making the exit code not 0 in that case ensures the caller knows that the
70
- // build has completed when the exit code is 0. This `exit` event handlers
71
- // guarantees this.
72
- const onExit = function ({ done }, exitCode) {
73
- if (done || exitCode !== 0) {
74
- return
75
- }
76
-
77
- const [, processName] = process.argv
78
- console.log(`${processName} exited with exit code ${exitCode} without finishing the build.`)
79
-
80
- process.exitCode = FALLBACK_SEVERITY_ENTRY.severityCode
81
- }
82
-
83
- runCli()
package/src/core/build.js DELETED
@@ -1,559 +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
- // Terminate the child processes of plugins so that they don't linger after
459
- // the build is finished. The exception is when running in the dev timeline
460
- // since those are long-running events by nature.
461
- if (timeline !== 'dev') {
462
- stopPlugins(childProcesses)
463
- }
464
- }
465
- }
466
-
467
- // Load plugin main files, retrieve their event handlers then runs them,
468
- // together with the build command
469
- const runBuild = async function ({
470
- childProcesses,
471
- pluginsOptions,
472
- netlifyConfig,
473
- configOpts,
474
- packageJson,
475
- configPath,
476
- headersPath,
477
- redirectsPath,
478
- buildDir,
479
- repositoryRoot,
480
- nodePath,
481
- childEnv,
482
- context,
483
- branch,
484
- dry,
485
- buildbotServerSocket,
486
- constants,
487
- mode,
488
- api,
489
- errorMonitor,
490
- deployId,
491
- errorParams,
492
- logs,
493
- debug,
494
- systemLog,
495
- verbose,
496
- saveConfig,
497
- timers,
498
- testOpts,
499
- featureFlags,
500
- timeline,
501
- devCommand,
502
- }) {
503
- const { pluginsSteps, timers: timersA } = await loadPlugins({
504
- pluginsOptions,
505
- childProcesses,
506
- packageJson,
507
- timers,
508
- logs,
509
- debug,
510
- verbose,
511
- })
512
-
513
- const { steps, events } = timeline === 'dev' ? getDevSteps(devCommand, pluginsSteps) : getSteps(pluginsSteps)
514
-
515
- if (dry) {
516
- await doDryRun({ buildDir, steps, netlifyConfig, constants, buildbotServerSocket, logs })
517
- return { netlifyConfig }
518
- }
519
-
520
- const {
521
- stepsCount,
522
- netlifyConfig: netlifyConfigA,
523
- statuses,
524
- failedPlugins,
525
- timers: timersB,
526
- configMutations,
527
- } = await runSteps({
528
- steps,
529
- buildbotServerSocket,
530
- events,
531
- configPath,
532
- headersPath,
533
- redirectsPath,
534
- buildDir,
535
- repositoryRoot,
536
- nodePath,
537
- childEnv,
538
- context,
539
- branch,
540
- constants,
541
- mode,
542
- api,
543
- errorMonitor,
544
- deployId,
545
- errorParams,
546
- netlifyConfig,
547
- configOpts,
548
- logs,
549
- debug,
550
- systemLog,
551
- verbose,
552
- saveConfig,
553
- timers: timersA,
554
- testOpts,
555
- featureFlags,
556
- })
557
-
558
- return { stepsCount, netlifyConfig: netlifyConfigA, statuses, failedPlugins, timers: timersB, configMutations }
559
- }