@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,8 +1,6 @@
1
- import { cwd } from 'process'
2
-
3
- import cleanStack from 'clean-stack'
4
- import stripAnsi from 'strip-ansi'
5
-
1
+ import { cwd } from 'process';
2
+ import cleanStack from 'clean-stack';
3
+ import stripAnsi from 'strip-ansi';
6
4
  // Clean stack traces:
7
5
  // - remove our internal code, e.g. the logic spawning plugins
8
6
  // - remove node modules and Node.js internals
@@ -12,76 +10,61 @@ import stripAnsi from 'strip-ansi'
12
10
  // We do not use libraries that patch `Error.prepareStackTrace()` because they
13
11
  // tend to create issues.
14
12
  export const cleanStacks = function ({ stack, rawStack, debug }) {
15
- if (stack === undefined) {
16
- return
17
- }
18
-
19
- // Internal errors / bugs keep their full stack trace
20
- // Same in debug mode
21
- if (rawStack || debug) {
22
- return stack
23
- }
24
-
25
- return stack.split('\n').reduce(cleanStackLine, '').replace(INITIAL_NEWLINES, '')
26
- }
27
-
13
+ if (stack === undefined) {
14
+ return;
15
+ }
16
+ // Internal errors / bugs keep their full stack trace
17
+ // Same in debug mode
18
+ if (rawStack || debug) {
19
+ return stack;
20
+ }
21
+ return stack.split('\n').reduce(cleanStackLine, '').replace(INITIAL_NEWLINES, '');
22
+ };
28
23
  const cleanStackLine = function (lines, line) {
29
- const lineA = line.replace(getCwd(), '')
30
- const lineB = stripAnsi(lineA)
31
-
32
- if (!STACK_LINE_REGEXP.test(lineB)) {
33
- return `${lines}\n${lineA}`
34
- }
35
-
36
- if (shouldRemoveStackLine(lineB)) {
37
- return lines
38
- }
39
-
40
- const lineC = cleanStack(lineB)
41
-
42
- if (lineC === '') {
43
- return lines
44
- }
45
-
46
- return `${lines}\n${lineC}`
47
- }
48
-
24
+ const lineA = line.replace(getCwd(), '');
25
+ const lineB = stripAnsi(lineA);
26
+ if (!STACK_LINE_REGEXP.test(lineB)) {
27
+ return `${lines}\n${lineA}`;
28
+ }
29
+ if (shouldRemoveStackLine(lineB)) {
30
+ return lines;
31
+ }
32
+ const lineC = cleanStack(lineB);
33
+ if (lineC === '') {
34
+ return lines;
35
+ }
36
+ return `${lines}\n${lineC}`;
37
+ };
49
38
  // `process.cwd()` can sometimes fail: directory name too long, current
50
39
  // directory has been removed, access denied.
51
40
  const getCwd = function () {
52
- try {
53
- return cwd()
54
- } catch {
55
- return ''
56
- }
57
- }
58
-
41
+ try {
42
+ return cwd();
43
+ }
44
+ catch {
45
+ return '';
46
+ }
47
+ };
59
48
  // Check if a line is part of a stack trace
60
- const STACK_LINE_REGEXP = /^\s+at /
61
-
49
+ const STACK_LINE_REGEXP = /^\s+at /;
62
50
  const shouldRemoveStackLine = function (line) {
63
- const lineA = normalizePathSlashes(line)
64
- return INTERNAL_STACK_STRINGS.some((stackString) => lineA.includes(stackString)) || INTERNAL_STACK_REGEXP.test(lineA)
65
- }
66
-
51
+ const lineA = normalizePathSlashes(line);
52
+ return INTERNAL_STACK_STRINGS.some((stackString) => lineA.includes(stackString)) || INTERNAL_STACK_REGEXP.test(lineA);
53
+ };
67
54
  const INTERNAL_STACK_STRINGS = [
68
- // Anonymous function
69
- '<anonymous>',
70
- '(index 0)',
71
- // nyc internal code
72
- 'node_modules/append-transform',
73
- 'node_modules/signal-exit',
74
- // Node internals
75
- '(node:',
76
- ]
77
-
55
+ // Anonymous function
56
+ '<anonymous>',
57
+ '(index 0)',
58
+ // nyc internal code
59
+ 'node_modules/append-transform',
60
+ 'node_modules/signal-exit',
61
+ // Node internals
62
+ '(node:',
63
+ ];
78
64
  // This is only needed for local builds and tests
79
- const INTERNAL_STACK_REGEXP = /(lib\/|tests\/helpers\/|tests\/.*\/tests.js|node_modules)/
80
-
81
- const INITIAL_NEWLINES = /^\n+/
82
-
65
+ const INTERNAL_STACK_REGEXP = /(lib\/|tests\/helpers\/|tests\/.*\/tests.js|node_modules)/;
66
+ const INITIAL_NEWLINES = /^\n+/;
83
67
  const normalizePathSlashes = function (line) {
84
- return line.replace(BACKLASH_REGEXP, '/')
85
- }
86
-
87
- const BACKLASH_REGEXP = /\\/g
68
+ return line.replace(BACKLASH_REGEXP, '/');
69
+ };
70
+ const BACKLASH_REGEXP = /\\/g;
@@ -1,62 +1,50 @@
1
- import { getBuildCommandDescription, getPluginOrigin } from '../../log/description.js'
2
-
1
+ import { getBuildCommandDescription, getPluginOrigin } from '../../log/description.js';
3
2
  // Retrieve an error's location to print in logs.
4
3
  // Each error type has its own logic (or none if there's no location to print).
5
4
  export const getLocationInfo = function ({ stack, location, locationType }) {
6
- // No location to print
7
- if (locationType === undefined && stack === undefined) {
8
- return
9
- }
10
-
11
- // The location is only the stack trace
12
- if (locationType === undefined) {
13
- return stack
14
- }
15
-
16
- const locationString = LOCATIONS[locationType](location)
17
- return [locationString, stack].filter(Boolean).join('\n')
18
- }
19
-
5
+ // No location to print
6
+ if (locationType === undefined && stack === undefined) {
7
+ return;
8
+ }
9
+ // The location is only the stack trace
10
+ if (locationType === undefined) {
11
+ return stack;
12
+ }
13
+ const locationString = LOCATIONS[locationType](location);
14
+ return [locationString, stack].filter(Boolean).join('\n');
15
+ };
20
16
  const getBuildCommandLocation = function ({ buildCommand, buildCommandOrigin }) {
21
- const description = getBuildCommandDescription(buildCommandOrigin)
22
- return `In ${description}:
23
- ${buildCommand}`
24
- }
25
-
17
+ const description = getBuildCommandDescription(buildCommandOrigin);
18
+ return `In ${description}:
19
+ ${buildCommand}`;
20
+ };
26
21
  const getFunctionsBundlingLocation = function ({ functionName, functionType }) {
27
- if (functionType === 'edge') {
28
- return 'While bundling edge function'
29
- }
30
-
31
- return `While bundling function "${functionName}"`
32
- }
33
-
22
+ if (functionType === 'edge') {
23
+ return 'While bundling edge function';
24
+ }
25
+ return `While bundling function "${functionName}"`;
26
+ };
34
27
  const getCoreStepLocation = function ({ coreStepName }) {
35
- return `During ${coreStepName}`
36
- }
37
-
28
+ return `During ${coreStepName}`;
29
+ };
38
30
  const getBuildFailLocation = function ({ event, packageName, loadedFrom, origin }) {
39
- const eventMessage = getEventMessage(event)
40
- const pluginOrigin = getPluginOrigin(loadedFrom, origin)
41
- return `${eventMessage} "${packageName}" ${pluginOrigin}`
42
- }
43
-
31
+ const eventMessage = getEventMessage(event);
32
+ const pluginOrigin = getPluginOrigin(loadedFrom, origin);
33
+ return `${eventMessage} "${packageName}" ${pluginOrigin}`;
34
+ };
44
35
  const getEventMessage = function (event) {
45
- if (event === 'load') {
46
- return `While loading`
47
- }
48
-
49
- return `In "${event}" event in`
50
- }
51
-
36
+ if (event === 'load') {
37
+ return `While loading`;
38
+ }
39
+ return `In "${event}" event in`;
40
+ };
52
41
  const getApiLocation = function ({ endpoint, parameters }) {
53
- return `While calling the Netlify API endpoint '${endpoint}' with:\n${JSON.stringify(parameters, null, 2)}`
54
- }
55
-
42
+ return `While calling the Netlify API endpoint '${endpoint}' with:\n${JSON.stringify(parameters, null, 2)}`;
43
+ };
56
44
  const LOCATIONS = {
57
- buildCommand: getBuildCommandLocation,
58
- functionsBundling: getFunctionsBundlingLocation,
59
- coreStep: getCoreStepLocation,
60
- buildFail: getBuildFailLocation,
61
- api: getApiLocation,
62
- }
45
+ buildCommand: getBuildCommandLocation,
46
+ functionsBundling: getFunctionsBundlingLocation,
47
+ coreStep: getCoreStepLocation,
48
+ buildFail: getBuildFailLocation,
49
+ api: getApiLocation,
50
+ };
@@ -2,28 +2,23 @@
2
2
  // If is an `Error` instance but is missing usual `Error` properties, we make
3
3
  // sure its static properties are preserved.
4
4
  export const normalizeError = function (error) {
5
- if (Array.isArray(error)) {
6
- return normalizeArray(error)
7
- }
8
-
9
- if (!(error instanceof Error)) {
10
- return new Error(String(error))
11
- }
12
-
13
- if (typeof error.message !== 'string') {
14
- error.message = String(error)
15
- }
16
-
17
- if (typeof error.stack !== 'string') {
18
- Error.captureStackTrace(error, normalizeError)
19
- }
20
-
21
- return error
22
- }
23
-
5
+ if (Array.isArray(error)) {
6
+ return normalizeArray(error);
7
+ }
8
+ if (!(error instanceof Error)) {
9
+ return new Error(String(error));
10
+ }
11
+ if (typeof error.message !== 'string') {
12
+ error.message = String(error);
13
+ }
14
+ if (typeof error.stack !== 'string') {
15
+ Error.captureStackTrace(error, normalizeError);
16
+ }
17
+ return error;
18
+ };
24
19
  // Some libraries throw arrays of Errors
25
20
  const normalizeArray = function (errorArray) {
26
- const [error, ...errors] = errorArray.map(normalizeError)
27
- error.errors = errors
28
- return error
29
- }
21
+ const [error, ...errors] = errorArray.map(normalizeError);
22
+ error.errors = errors;
23
+ return error;
24
+ };
@@ -1,101 +1,67 @@
1
- import { serializeObject } from '../../log/serialize.js'
2
- import { getErrorInfo } from '../info.js'
3
- import { getTypeInfo } from '../type.js'
4
-
5
- import { getLocationInfo } from './location.js'
6
- import { normalizeError } from './normalize.js'
7
- import { getPluginInfo } from './plugin.js'
8
- import { getErrorProps } from './properties.js'
9
- import { getStackInfo } from './stack.js'
10
-
1
+ import { serializeObject } from '../../log/serialize.js';
2
+ import { getErrorInfo } from '../info.js';
3
+ import { getTypeInfo } from '../type.js';
4
+ import { getLocationInfo } from './location.js';
5
+ import { normalizeError } from './normalize.js';
6
+ import { getPluginInfo } from './plugin.js';
7
+ import { getErrorProps } from './properties.js';
8
+ import { getStackInfo } from './stack.js';
11
9
  // Add additional type-specific error information
12
10
  export const getFullErrorInfo = function ({ error, colors, debug }) {
13
- const basicErrorInfo = parseErrorInfo(error)
14
- const {
15
- message,
16
- stack,
17
- errorProps,
18
- errorInfo,
19
- errorInfo: { location = {}, plugin = {}, tsConfig },
20
- severity,
21
- title,
22
- stackType,
23
- locationType,
24
- showErrorProps,
25
- rawStack,
26
- errorMetadata,
27
- } = basicErrorInfo
28
-
29
- const titleA = getTitle(title, errorInfo)
30
-
31
- const { message: messageA, stack: stackA } = getStackInfo({ message, stack, stackType, rawStack, severity, debug })
32
-
33
- const pluginInfo = getPluginInfo(plugin, location)
34
- const tsConfigInfo = getTsConfigInfo(tsConfig)
35
- const locationInfo = getLocationInfo({ stack: stackA, location, locationType })
36
- const errorPropsA = getErrorProps({ errorProps, showErrorProps, colors })
37
-
38
- return {
39
- ...basicErrorInfo,
40
- title: titleA,
41
- message: messageA,
42
- tsConfigInfo,
43
- pluginInfo,
44
- locationInfo,
45
- errorProps: errorPropsA,
46
- errorMetadata,
47
- }
48
- }
49
-
11
+ const basicErrorInfo = parseErrorInfo(error);
12
+ const { message, stack, errorProps, errorInfo, errorInfo: { location = {}, plugin = {}, tsConfig }, severity, title, stackType, locationType, showErrorProps, rawStack, errorMetadata, } = basicErrorInfo;
13
+ const titleA = getTitle(title, errorInfo);
14
+ const { message: messageA, stack: stackA } = getStackInfo({ message, stack, stackType, rawStack, severity, debug });
15
+ const pluginInfo = getPluginInfo(plugin, location);
16
+ const tsConfigInfo = getTsConfigInfo(tsConfig);
17
+ const locationInfo = getLocationInfo({ stack: stackA, location, locationType });
18
+ const errorPropsA = getErrorProps({ errorProps, showErrorProps, colors });
19
+ return {
20
+ ...basicErrorInfo,
21
+ title: titleA,
22
+ message: messageA,
23
+ tsConfigInfo,
24
+ pluginInfo,
25
+ locationInfo,
26
+ errorProps: errorPropsA,
27
+ errorMetadata,
28
+ };
29
+ };
50
30
  // Serialize the `tsConfig` error information
51
31
  const getTsConfigInfo = function (tsConfig) {
52
- if (tsConfig === undefined) {
53
- return
54
- }
55
-
56
- return serializeObject(tsConfig)
57
- }
58
-
32
+ if (tsConfig === undefined) {
33
+ return;
34
+ }
35
+ return serializeObject(tsConfig);
36
+ };
59
37
  // Parse error instance into all the basic properties containing information
60
38
  export const parseErrorInfo = function (error) {
61
- const { message, stack, ...errorProps } = normalizeError(error)
62
- const [errorInfo, errorPropsA] = getErrorInfo(errorProps)
63
- const { errorMetadata } = errorInfo
64
- const {
65
- type,
66
- severity,
67
- title,
68
- group,
69
- stackType,
70
- locationType,
71
- showErrorProps,
72
- showInBuildLog = true,
73
- rawStack,
74
- } = getTypeInfo(errorInfo)
75
- const basicErrorInfo = {
76
- message,
77
- stack,
78
- errorProps: errorPropsA,
79
- errorInfo,
80
- type,
81
- severity,
82
- title,
83
- group,
84
- stackType,
85
- locationType,
86
- showInBuildLog,
87
- showErrorProps,
88
- rawStack,
89
- errorMetadata,
90
- }
91
- return basicErrorInfo
92
- }
93
-
39
+ const { message, stack, ...errorProps } = normalizeError(error);
40
+ const [errorInfo, errorPropsA] = getErrorInfo(errorProps);
41
+ const { errorMetadata } = errorInfo;
42
+ const { type, severity, title, group, stackType, locationType, showErrorProps, showInBuildLog = true, rawStack, } = getTypeInfo(errorInfo);
43
+ const basicErrorInfo = {
44
+ message,
45
+ stack,
46
+ errorProps: errorPropsA,
47
+ errorInfo,
48
+ type,
49
+ severity,
50
+ title,
51
+ group,
52
+ stackType,
53
+ locationType,
54
+ showInBuildLog,
55
+ showErrorProps,
56
+ rawStack,
57
+ errorMetadata,
58
+ };
59
+ return basicErrorInfo;
60
+ };
94
61
  // Retrieve title to print in logs
95
62
  const getTitle = function (title, errorInfo) {
96
- if (typeof title !== 'function') {
97
- return title
98
- }
99
-
100
- return title(errorInfo)
101
- }
63
+ if (typeof title !== 'function') {
64
+ return title;
65
+ }
66
+ return title(errorInfo);
67
+ };
@@ -1,70 +1,55 @@
1
1
  // Retrieve plugin's package.json details to include in error messages.
2
2
  // Please note `pluginPackageJson` has been normalized by `normalize-package-data`.
3
3
  export const getPluginInfo = function ({ pluginPackageJson = {} }, { packageName, loadedFrom }) {
4
- if (Object.keys(pluginPackageJson).length === 0) {
5
- return
6
- }
7
-
8
- return Object.entries(FIELDS)
9
- .map(([name, getField]) => serializeField({ name, getField, pluginPackageJson, packageName, loadedFrom }))
10
- .filter(Boolean)
11
- .join('\n')
12
- }
13
-
4
+ if (Object.keys(pluginPackageJson).length === 0) {
5
+ return;
6
+ }
7
+ return Object.entries(FIELDS)
8
+ .map(([name, getField]) => serializeField({ name, getField, pluginPackageJson, packageName, loadedFrom }))
9
+ .filter(Boolean)
10
+ .join('\n');
11
+ };
14
12
  // Serialize a single package.json field
15
13
  const serializeField = function ({ name, getField, pluginPackageJson, packageName, loadedFrom }) {
16
- const field = getField(pluginPackageJson, { packageName, loadedFrom })
17
- if (field === undefined) {
18
- return
19
- }
20
-
21
- const nameA = `${name}:`.padEnd(NAME_PADDING)
22
- return `${nameA}${field}`
23
- }
24
-
25
- const NAME_PADDING = 16
26
-
14
+ const field = getField(pluginPackageJson, { packageName, loadedFrom });
15
+ if (field === undefined) {
16
+ return;
17
+ }
18
+ const nameA = `${name}:`.padEnd(NAME_PADDING);
19
+ return `${nameA}${field}`;
20
+ };
21
+ const NAME_PADDING = 16;
27
22
  const getPackage = function (pluginPackageJson, { packageName }) {
28
- return packageName
29
- }
30
-
23
+ return packageName;
24
+ };
31
25
  const getVersion = function ({ version }) {
32
- if (version === '') {
33
- return
34
- }
35
-
36
- return version
37
- }
38
-
26
+ if (version === '') {
27
+ return;
28
+ }
29
+ return version;
30
+ };
39
31
  export const getHomepage = function (pluginPackageJson = {}, { loadedFrom } = {}) {
40
- return (
41
- getRepository(pluginPackageJson) ||
42
- getNpmLink(pluginPackageJson, { loadedFrom }) ||
43
- getIssuesLink(pluginPackageJson)
44
- )
45
- }
46
-
32
+ return (getRepository(pluginPackageJson) ||
33
+ getNpmLink(pluginPackageJson, { loadedFrom }) ||
34
+ getIssuesLink(pluginPackageJson));
35
+ };
47
36
  const getRepository = function ({ repository: { url } = {} }) {
48
- return url
49
- }
50
-
37
+ return url;
38
+ };
51
39
  const getNpmLink = function ({ name }, { loadedFrom }) {
52
- if (!name || loadedFrom === 'local') {
53
- return
54
- }
55
-
56
- return `https://www.npmjs.com/package/${name}`
57
- }
58
-
40
+ if (!name || loadedFrom === 'local') {
41
+ return;
42
+ }
43
+ return `https://www.npmjs.com/package/${name}`;
44
+ };
59
45
  const getIssuesLink = function ({ bugs: { url } = {} }) {
60
- return url
61
- }
62
-
46
+ return url;
47
+ };
63
48
  // List of package.json to serialize
64
49
  const FIELDS = {
65
- Package: getPackage,
66
- Version: getVersion,
67
- Repository: getRepository,
68
- 'npm link': getNpmLink,
69
- 'Report issues': getIssuesLink,
70
- }
50
+ Package: getPackage,
51
+ Version: getVersion,
52
+ Repository: getRepository,
53
+ 'npm link': getNpmLink,
54
+ 'Report issues': getIssuesLink,
55
+ };
@@ -1,23 +1,16 @@
1
- import { inspect } from 'util'
2
-
3
- import { omit } from '../../utils/omit.js'
4
-
1
+ import { inspect } from 'util';
2
+ import { omit } from '../../utils/omit.js';
5
3
  // In uncaught exceptions, print error static properties
6
4
  export const getErrorProps = function ({ errorProps, showErrorProps, colors }) {
7
- if (!showErrorProps) {
8
- return
9
- }
10
-
11
- const errorPropsA = omit(errorProps, CLEANED_ERROR_PROPS)
12
-
13
- if (Object.keys(errorPropsA).length === 0) {
14
- return
15
- }
16
-
17
- return inspect(errorPropsA, { colors, depth: INSPECT_MAX_DEPTH })
18
- }
19
-
20
- const INSPECT_MAX_DEPTH = 5
21
-
5
+ if (!showErrorProps) {
6
+ return;
7
+ }
8
+ const errorPropsA = omit(errorProps, CLEANED_ERROR_PROPS);
9
+ if (Object.keys(errorPropsA).length === 0) {
10
+ return;
11
+ }
12
+ return inspect(errorPropsA, { colors, depth: INSPECT_MAX_DEPTH });
13
+ };
14
+ const INSPECT_MAX_DEPTH = 5;
22
15
  // Remove error static properties that should not be logged
23
- const CLEANED_ERROR_PROPS = ['requireStack']
16
+ const CLEANED_ERROR_PROPS = ['requireStack'];