@netlify/build 27.20.3 → 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 +15 -8
@@ -1,42 +1,34 @@
1
- import { THEME } from '../../log/theme.js'
2
-
1
+ import { THEME } from '../../log/theme.js';
3
2
  // Serialize an error object into a title|body string to print in logs
4
- export const serializeLogError = function ({
5
- fullErrorInfo: { title, severity, message, pluginInfo, locationInfo, tsConfigInfo, errorProps },
6
- }) {
7
- const body = getBody({ message, pluginInfo, locationInfo, tsConfigInfo, errorProps, severity })
8
- return { title, body }
9
- }
10
-
3
+ export const serializeLogError = function ({ fullErrorInfo: { title, severity, message, pluginInfo, locationInfo, tsConfigInfo, errorProps }, }) {
4
+ const body = getBody({ message, pluginInfo, locationInfo, tsConfigInfo, errorProps, severity });
5
+ return { title, body };
6
+ };
11
7
  const getBody = function ({ message, pluginInfo, locationInfo, tsConfigInfo, errorProps, severity }) {
12
- if (severity === 'none') {
13
- return message
14
- }
15
-
16
- return Object.entries({
17
- message,
18
- tsConfigInfo,
19
- pluginInfo,
20
- locationInfo,
21
- errorProps,
22
- })
23
- .filter(blockHasValue)
24
- .map(serializeBlock)
25
- .join('\n\n')
26
- }
27
-
8
+ if (severity === 'none') {
9
+ return message;
10
+ }
11
+ return Object.entries({
12
+ message,
13
+ tsConfigInfo,
14
+ pluginInfo,
15
+ locationInfo,
16
+ errorProps,
17
+ })
18
+ .filter(blockHasValue)
19
+ .map(serializeBlock)
20
+ .join('\n\n');
21
+ };
28
22
  const blockHasValue = function ([, value]) {
29
- return value !== undefined
30
- }
31
-
23
+ return value !== undefined;
24
+ };
32
25
  const serializeBlock = function ([key, value]) {
33
- return `${THEME.errorSubHeader(LOG_BLOCK_NAMES[key])}\n${value}`
34
- }
35
-
26
+ return `${THEME.errorSubHeader(LOG_BLOCK_NAMES[key])}\n${value}`;
27
+ };
36
28
  const LOG_BLOCK_NAMES = {
37
- message: 'Error message',
38
- pluginInfo: 'Plugin details',
39
- locationInfo: 'Error location',
40
- tsConfigInfo: 'TypeScript configuration',
41
- errorProps: 'Error properties',
42
- }
29
+ message: 'Error message',
30
+ pluginInfo: 'Plugin details',
31
+ locationInfo: 'Error location',
32
+ tsConfigInfo: 'TypeScript configuration',
33
+ errorProps: 'Error properties',
34
+ };
@@ -1,26 +1,18 @@
1
1
  // Serialize an error object to `statuses` properties
2
- export const serializeErrorStatus = function ({
3
- fullErrorInfo: { title, message, locationInfo, errorProps, errorMetadata },
4
- state,
5
- }) {
6
- const text = getText({ locationInfo, errorProps })
7
- return { state, title, summary: message, text, extraData: errorMetadata }
8
- }
9
-
2
+ export const serializeErrorStatus = function ({ fullErrorInfo: { title, message, locationInfo, errorProps, errorMetadata }, state, }) {
3
+ const text = getText({ locationInfo, errorProps });
4
+ return { state, title, summary: message, text, extraData: errorMetadata };
5
+ };
10
6
  const getText = function ({ locationInfo, errorProps }) {
11
- const parts = [locationInfo, getErrorProps(errorProps)].filter(Boolean)
12
-
13
- if (parts.length === 0) {
14
- return
15
- }
16
-
17
- return parts.join('\n\n')
18
- }
19
-
7
+ const parts = [locationInfo, getErrorProps(errorProps)].filter(Boolean);
8
+ if (parts.length === 0) {
9
+ return;
10
+ }
11
+ return parts.join('\n\n');
12
+ };
20
13
  const getErrorProps = function (errorProps) {
21
- if (errorProps === undefined) {
22
- return
23
- }
24
-
25
- return `Error properties:\n${errorProps}`
26
- }
14
+ if (errorProps === undefined) {
15
+ return;
16
+ }
17
+ return `Error properties:\n${errorProps}`;
18
+ };
@@ -1,43 +1,34 @@
1
- import { cleanStacks } from './clean_stack.js'
2
-
1
+ import { cleanStacks } from './clean_stack.js';
3
2
  // Retrieve the stack trace
4
3
  export const getStackInfo = function ({ message, stack, stackType, rawStack, severity, debug }) {
5
- const { message: messageA, stack: stackA } = splitStackInfo({ message, stack, stackType })
6
- const messageB = severity === 'none' ? messageA.replace(SUCCESS_ERROR_NAME, '') : messageA
7
- const stackB = cleanStacks({ stack: stackA, rawStack, debug })
8
- return { message: messageB, stack: stackB }
9
- }
10
-
4
+ const { message: messageA, stack: stackA } = splitStackInfo({ message, stack, stackType });
5
+ const messageB = severity === 'none' ? messageA.replace(SUCCESS_ERROR_NAME, '') : messageA;
6
+ const stackB = cleanStacks({ stack: stackA, rawStack, debug });
7
+ return { message: messageB, stack: stackB };
8
+ };
11
9
  const splitStackInfo = function ({ message, stack, stackType }) {
12
- // Some errors should not show any stack trace
13
- if (stackType === 'none') {
14
- return { message }
15
- }
16
-
17
- // Some errors have their stack trace inside `error.message` instead of
18
- // `error.stack` due to IPC
19
- if (stackType === 'message') {
20
- return splitStack(message)
21
- }
22
-
23
- return splitStack(stack)
24
- }
25
-
10
+ // Some errors should not show any stack trace
11
+ if (stackType === 'none') {
12
+ return { message };
13
+ }
14
+ // Some errors have their stack trace inside `error.message` instead of
15
+ // `error.stack` due to IPC
16
+ if (stackType === 'message') {
17
+ return splitStack(message);
18
+ }
19
+ return splitStack(stack);
20
+ };
26
21
  const splitStack = function (string) {
27
- const lines = string.split('\n')
28
- const stackIndex = lines.findIndex(isStackTrace)
29
-
30
- if (stackIndex === -1) {
31
- return { message: string }
32
- }
33
-
34
- const messageA = lines.slice(0, stackIndex).join('\n')
35
- const stackA = lines.slice(stackIndex).join('\n')
36
- return { message: messageA, stack: stackA }
37
- }
38
-
22
+ const lines = string.split('\n');
23
+ const stackIndex = lines.findIndex(isStackTrace);
24
+ if (stackIndex === -1) {
25
+ return { message: string };
26
+ }
27
+ const messageA = lines.slice(0, stackIndex).join('\n');
28
+ const stackA = lines.slice(stackIndex).join('\n');
29
+ return { message: messageA, stack: stackA };
30
+ };
39
31
  const isStackTrace = function (line) {
40
- return line.trim().startsWith('at ')
41
- }
42
-
43
- const SUCCESS_ERROR_NAME = 'Error: '
32
+ return line.trim().startsWith('at ');
33
+ };
34
+ const SUCCESS_ERROR_NAME = 'Error: ';
package/lib/error/type.js CHANGED
@@ -1,9 +1,8 @@
1
1
  // Retrieve error-type specific information
2
2
  export const getTypeInfo = function ({ type }) {
3
- const typeA = TYPES[type] === undefined ? DEFAULT_TYPE : type
4
- return { type: typeA, ...TYPES[typeA] }
5
- }
6
-
3
+ const typeA = TYPES[type] === undefined ? DEFAULT_TYPE : type;
4
+ return { type: typeA, ...TYPES[typeA] };
5
+ };
7
6
  // List of error types, and their related properties
8
7
  // Related to build error logs:
9
8
  // - `showInBuildLog`: `true` when we want this error to show in build logs (defaults to true)
@@ -40,150 +39,133 @@ export const getTypeInfo = function ({ type }) {
40
39
  // for new errors of that type. You must use the bookmark menu action "Update
41
40
  // with current filters"
42
41
  const TYPES = {
43
- // Plugin called `utils.build.cancelBuild()`
44
- cancelBuild: {
45
- title: ({ location: { packageName } }) => `Build canceled by ${packageName}`,
46
- stackType: 'stack',
47
- locationType: 'buildFail',
48
- severity: 'none',
49
- },
50
-
51
- // User configuration error (`@netlify/config`, wrong Node.js version)
52
- resolveConfig: {
53
- title: 'Configuration error',
54
- stackType: 'none',
55
- severity: 'info',
56
- },
57
-
58
- // Error while installing user packages (missing plugins, local plugins or functions dependencies)
59
- dependencies: {
60
- title: 'Dependencies installation error',
61
- stackType: 'none',
62
- severity: 'info',
63
- },
64
-
65
- // User misconfigured a plugin
66
- pluginInput: {
67
- title: ({ location: { packageName, input } }) => `Plugin "${packageName}" invalid input "${input}"`,
68
- stackType: 'none',
69
- locationType: 'buildFail',
70
- severity: 'info',
71
- },
72
-
73
- // `build.command` non-0 exit code
74
- buildCommand: {
75
- title: '"build.command" failed',
76
- group: ({ location: { buildCommand } }) => buildCommand,
77
- stackType: 'message',
78
- locationType: 'buildCommand',
79
- severity: 'info',
80
- },
81
-
82
- // User error during Functions bundling
83
- functionsBundling: {
84
- title: ({ location: { functionName, functionType } }) => {
85
- if (functionType === 'edge') {
86
- return 'Bundling of edge function failed'
87
- }
88
-
89
- return `Bundling of function "${functionName}" failed`
90
- },
91
- group: ({ location: { functionType = 'serverless' } }) => `Bundling of ${functionType} function failed`,
92
- stackType: 'none',
93
- locationType: 'functionsBundling',
94
- severity: 'info',
95
- },
96
-
97
- // Plugin called `utils.build.failBuild()`
98
- failBuild: {
99
- title: ({ location: { packageName } }) => `Plugin "${packageName}" failed`,
100
- stackType: 'stack',
101
- locationType: 'buildFail',
102
- severity: 'info',
103
- },
104
-
105
- // Plugin called `utils.build.failPlugin()`
106
- failPlugin: {
107
- title: ({ location: { packageName } }) => `Plugin "${packageName}" failed`,
108
- stackType: 'stack',
109
- locationType: 'buildFail',
110
- severity: 'info',
111
- },
112
-
113
- // Plugin has an invalid shape
114
- pluginValidation: {
115
- title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
116
- stackType: 'stack',
117
- locationType: 'buildFail',
118
- severity: 'warning',
119
- },
120
-
121
- // Plugin threw an uncaught exception
122
- pluginInternal: {
123
- title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
124
- stackType: 'stack',
125
- showErrorProps: true,
126
- rawStack: true,
127
- locationType: 'buildFail',
128
- severity: 'warning',
129
- },
130
-
131
- // Bug while orchestrating child processes
132
- ipc: {
133
- title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
134
- stackType: 'none',
135
- locationType: 'buildFail',
136
- severity: 'warning',
137
- },
138
-
139
- // Core plugin internal error
140
- corePlugin: {
141
- title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
142
- stackType: 'stack',
143
- showErrorProps: true,
144
- rawStack: true,
145
- locationType: 'buildFail',
146
- severity: 'error',
147
- },
148
-
149
- // Core step internal error
150
- coreStep: {
151
- title: ({ location: { coreStepName } }) => `Internal error during "${coreStepName}"`,
152
- stackType: 'stack',
153
- showErrorProps: true,
154
- rawStack: true,
155
- locationType: 'coreStep',
156
- severity: 'error',
157
- },
158
-
159
- // Request error when `@netlify/build` was calling Netlify API
160
- api: {
161
- title: ({ location: { endpoint } }) => `API error on "${endpoint}"`,
162
- stackType: 'message',
163
- showErrorProps: true,
164
- locationType: 'api',
165
- severity: 'error',
166
- },
167
-
168
- // `@netlify/build` threw an uncaught exception
169
- exception: {
170
- title: 'Core internal error',
171
- stackType: 'stack',
172
- showErrorProps: true,
173
- rawStack: true,
174
- severity: 'error',
175
- },
176
-
177
- // Errors related with the telemetry output
178
- telemetry: {
179
- showInBuildLog: false,
180
- title: 'Telemetry error',
181
- stackType: 'stack',
182
- showErrorProps: true,
183
- rawStack: true,
184
- severity: 'error',
185
- },
186
- }
187
-
42
+ // Plugin called `utils.build.cancelBuild()`
43
+ cancelBuild: {
44
+ title: ({ location: { packageName } }) => `Build canceled by ${packageName}`,
45
+ stackType: 'stack',
46
+ locationType: 'buildFail',
47
+ severity: 'none',
48
+ },
49
+ // User configuration error (`@netlify/config`, wrong Node.js version)
50
+ resolveConfig: {
51
+ title: 'Configuration error',
52
+ stackType: 'none',
53
+ severity: 'info',
54
+ },
55
+ // Error while installing user packages (missing plugins, local plugins or functions dependencies)
56
+ dependencies: {
57
+ title: 'Dependencies installation error',
58
+ stackType: 'none',
59
+ severity: 'info',
60
+ },
61
+ // User misconfigured a plugin
62
+ pluginInput: {
63
+ title: ({ location: { packageName, input } }) => `Plugin "${packageName}" invalid input "${input}"`,
64
+ stackType: 'none',
65
+ locationType: 'buildFail',
66
+ severity: 'info',
67
+ },
68
+ // `build.command` non-0 exit code
69
+ buildCommand: {
70
+ title: '"build.command" failed',
71
+ group: ({ location: { buildCommand } }) => buildCommand,
72
+ stackType: 'message',
73
+ locationType: 'buildCommand',
74
+ severity: 'info',
75
+ },
76
+ // User error during Functions bundling
77
+ functionsBundling: {
78
+ title: ({ location: { functionName, functionType } }) => {
79
+ if (functionType === 'edge') {
80
+ return 'Bundling of edge function failed';
81
+ }
82
+ return `Bundling of function "${functionName}" failed`;
83
+ },
84
+ group: ({ location: { functionType = 'serverless' } }) => `Bundling of ${functionType} function failed`,
85
+ stackType: 'none',
86
+ locationType: 'functionsBundling',
87
+ severity: 'info',
88
+ },
89
+ // Plugin called `utils.build.failBuild()`
90
+ failBuild: {
91
+ title: ({ location: { packageName } }) => `Plugin "${packageName}" failed`,
92
+ stackType: 'stack',
93
+ locationType: 'buildFail',
94
+ severity: 'info',
95
+ },
96
+ // Plugin called `utils.build.failPlugin()`
97
+ failPlugin: {
98
+ title: ({ location: { packageName } }) => `Plugin "${packageName}" failed`,
99
+ stackType: 'stack',
100
+ locationType: 'buildFail',
101
+ severity: 'info',
102
+ },
103
+ // Plugin has an invalid shape
104
+ pluginValidation: {
105
+ title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
106
+ stackType: 'stack',
107
+ locationType: 'buildFail',
108
+ severity: 'warning',
109
+ },
110
+ // Plugin threw an uncaught exception
111
+ pluginInternal: {
112
+ title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
113
+ stackType: 'stack',
114
+ showErrorProps: true,
115
+ rawStack: true,
116
+ locationType: 'buildFail',
117
+ severity: 'warning',
118
+ },
119
+ // Bug while orchestrating child processes
120
+ ipc: {
121
+ title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
122
+ stackType: 'none',
123
+ locationType: 'buildFail',
124
+ severity: 'warning',
125
+ },
126
+ // Core plugin internal error
127
+ corePlugin: {
128
+ title: ({ location: { packageName } }) => `Plugin "${packageName}" internal error`,
129
+ stackType: 'stack',
130
+ showErrorProps: true,
131
+ rawStack: true,
132
+ locationType: 'buildFail',
133
+ severity: 'error',
134
+ },
135
+ // Core step internal error
136
+ coreStep: {
137
+ title: ({ location: { coreStepName } }) => `Internal error during "${coreStepName}"`,
138
+ stackType: 'stack',
139
+ showErrorProps: true,
140
+ rawStack: true,
141
+ locationType: 'coreStep',
142
+ severity: 'error',
143
+ },
144
+ // Request error when `@netlify/build` was calling Netlify API
145
+ api: {
146
+ title: ({ location: { endpoint } }) => `API error on "${endpoint}"`,
147
+ stackType: 'message',
148
+ showErrorProps: true,
149
+ locationType: 'api',
150
+ severity: 'error',
151
+ },
152
+ // `@netlify/build` threw an uncaught exception
153
+ exception: {
154
+ title: 'Core internal error',
155
+ stackType: 'stack',
156
+ showErrorProps: true,
157
+ rawStack: true,
158
+ severity: 'error',
159
+ },
160
+ // Errors related with the telemetry output
161
+ telemetry: {
162
+ showInBuildLog: false,
163
+ title: 'Telemetry error',
164
+ stackType: 'stack',
165
+ showErrorProps: true,
166
+ rawStack: true,
167
+ severity: 'error',
168
+ },
169
+ };
188
170
  // When no error type matches, it's an uncaught exception, i.e. a bug
189
- const DEFAULT_TYPE = 'exception'
171
+ const DEFAULT_TYPE = 'exception';
@@ -1,28 +1,20 @@
1
- import { dirname } from 'path'
2
-
3
- import readdirp from 'readdirp'
4
-
5
- import { logInstallFunctionDependencies } from '../log/messages/install.js'
6
-
7
- import { installDependencies } from './main.js'
8
-
1
+ import { dirname } from 'path';
2
+ import readdirp from 'readdirp';
3
+ import { logInstallFunctionDependencies } from '../log/messages/install.js';
4
+ import { installDependencies } from './main.js';
9
5
  // Install dependencies of Netlify Functions
10
6
  export const installFunctionDependencies = async function (functionsSrc, isLocal) {
11
- const packagePaths = await getPackagePaths(functionsSrc)
12
- if (packagePaths.length === 0) {
13
- return
14
- }
15
-
16
- logInstallFunctionDependencies()
17
-
18
- const packageRoots = packagePaths.map(getPackageRoot)
19
- await Promise.all(packageRoots.map((packageRoot) => installDependencies({ packageRoot, isLocal })))
20
- }
21
-
7
+ const packagePaths = await getPackagePaths(functionsSrc);
8
+ if (packagePaths.length === 0) {
9
+ return;
10
+ }
11
+ logInstallFunctionDependencies();
12
+ const packageRoots = packagePaths.map(getPackageRoot);
13
+ await Promise.all(packageRoots.map((packageRoot) => installDependencies({ packageRoot, isLocal })));
14
+ };
22
15
  const getPackagePaths = function (functionsSrc) {
23
- return readdirp.promise(functionsSrc, { depth: 1, fileFilter: 'package.json' })
24
- }
25
-
16
+ return readdirp.promise(functionsSrc, { depth: 1, fileFilter: 'package.json' });
17
+ };
26
18
  const getPackageRoot = function ({ fullPath }) {
27
- return dirname(fullPath)
28
- }
19
+ return dirname(fullPath);
20
+ };
@@ -1,62 +1,45 @@
1
- import { packageDirectory } from 'pkg-dir'
2
-
3
- import { logInstallLocalPluginsDeps } from '../log/messages/install.js'
4
-
5
- import { installDependencies } from './main.js'
6
-
1
+ import { packageDirectory } from 'pkg-dir';
2
+ import { logInstallLocalPluginsDeps } from '../log/messages/install.js';
3
+ import { installDependencies } from './main.js';
7
4
  // Install dependencies of local plugins.
8
5
  // Users must add this plugin to their `netlify.toml` `plugins` to use this
9
6
  // feature. We don't want to provide it by default because this makes build
10
7
  // slow and buggy.
11
8
  export const installLocalPluginsDependencies = async function ({ plugins, pluginsOptions, buildDir, mode, logs }) {
12
- if (!plugins.some(isLocalInstallOptIn)) {
13
- return
14
- }
15
-
16
- const localPluginsOptions = getLocalPluginsOptions(pluginsOptions)
17
- if (localPluginsOptions.length === 0) {
18
- return
19
- }
20
-
21
- const localPluginsOptionsA = await removeMainRoot(localPluginsOptions, buildDir)
22
- if (localPluginsOptionsA.length === 0) {
23
- return
24
- }
25
-
26
- logInstallLocalPluginsDeps(logs, localPluginsOptionsA)
27
- await Promise.all(
28
- localPluginsOptionsA.map(({ packageDir }) =>
29
- installDependencies({ packageRoot: packageDir, isLocal: mode !== 'buildbot' }),
30
- ),
31
- )
32
- }
33
-
9
+ if (!plugins.some(isLocalInstallOptIn)) {
10
+ return;
11
+ }
12
+ const localPluginsOptions = getLocalPluginsOptions(pluginsOptions);
13
+ if (localPluginsOptions.length === 0) {
14
+ return;
15
+ }
16
+ const localPluginsOptionsA = await removeMainRoot(localPluginsOptions, buildDir);
17
+ if (localPluginsOptionsA.length === 0) {
18
+ return;
19
+ }
20
+ logInstallLocalPluginsDeps(logs, localPluginsOptionsA);
21
+ await Promise.all(localPluginsOptionsA.map(({ packageDir }) => installDependencies({ packageRoot: packageDir, isLocal: mode !== 'buildbot' })));
22
+ };
34
23
  const isLocalInstallOptIn = function (plugin) {
35
- return plugin.package === LOCAL_INSTALL_PLUGIN_NAME
36
- }
37
-
38
- export const LOCAL_INSTALL_PLUGIN_NAME = '@netlify/plugin-local-install-core'
39
-
24
+ return plugin.package === LOCAL_INSTALL_PLUGIN_NAME;
25
+ };
26
+ export const LOCAL_INSTALL_PLUGIN_NAME = '@netlify/plugin-local-install-core';
40
27
  // Core plugins and non-local plugins already have their dependencies installed
41
28
  const getLocalPluginsOptions = function (pluginsOptions) {
42
- return pluginsOptions.filter(isLocalPlugin).filter(isUnique).filter(hasPackageDir)
43
- }
44
-
29
+ return pluginsOptions.filter(isLocalPlugin).filter(isUnique).filter(hasPackageDir);
30
+ };
45
31
  const isLocalPlugin = function ({ loadedFrom }) {
46
- return loadedFrom === 'local'
47
- }
48
-
32
+ return loadedFrom === 'local';
33
+ };
49
34
  // Remove duplicates
50
35
  const isUnique = function ({ packageDir }, index, pluginsOptions) {
51
- return pluginsOptions.slice(index + 1).every((pluginOption) => pluginOption.packageDir !== packageDir)
52
- }
53
-
36
+ return pluginsOptions.slice(index + 1).every((pluginOption) => pluginOption.packageDir !== packageDir);
37
+ };
54
38
  const hasPackageDir = function ({ packageDir }) {
55
- return packageDir !== undefined
56
- }
57
-
39
+ return packageDir !== undefined;
40
+ };
58
41
  // We only install dependencies of local plugins that have their own `package.json`
59
42
  const removeMainRoot = async function (localPluginsOptions, buildDir) {
60
- const mainPackageDir = await packageDirectory({ cwd: buildDir })
61
- return localPluginsOptions.filter(({ packageDir }) => packageDir !== mainPackageDir)
62
- }
43
+ const mainPackageDir = await packageDirectory({ cwd: buildDir });
44
+ return localPluginsOptions.filter(({ packageDir }) => packageDir !== mainPackageDir);
45
+ };