@netlify/build 27.6.0 → 27.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/build",
3
- "version": "27.6.0",
3
+ "version": "27.8.1",
4
4
  "description": "Netlify build module",
5
5
  "type": "module",
6
6
  "exports": "./src/core/main.js",
@@ -56,7 +56,7 @@
56
56
  "license": "MIT",
57
57
  "dependencies": {
58
58
  "@bugsnag/js": "^7.0.0",
59
- "@netlify/edge-bundler": "^1.7.0",
59
+ "@netlify/edge-bundler": "^1.8.0",
60
60
  "@netlify/cache-utils": "^4.0.0",
61
61
  "@netlify/config": "^18.1.2",
62
62
  "@netlify/functions-utils": "^4.2.2",
@@ -3,7 +3,15 @@
3
3
  // them consistent
4
4
  export const normalizeGroupingMessage = function (message, type) {
5
5
  const messageA = removeDependenciesLogs(message, type)
6
- return NORMALIZE_REGEXPS.reduce(normalizeMessage, messageA)
6
+ const messageB = NORMALIZE_REGEXPS.reduce(normalizeMessage, messageA)
7
+
8
+ // If this is a functions bundling error, we'll use additional normalization
9
+ // rules to group errors more aggressively.
10
+ if (type === 'functionsBundling') {
11
+ return FUNCTIONS_BUNDLING_REGEXPS.reduce(normalizeMessage, messageB)
12
+ }
13
+
14
+ return messageB
7
15
  }
8
16
 
9
17
  // Discard debug/info installation information
@@ -32,9 +40,9 @@ const normalizeMessage = function (message, [regExp, replacement]) {
32
40
 
33
41
  const NORMALIZE_REGEXPS = [
34
42
  // Base64 URL
35
- [/(data:[^;]+;base64),[\w+/-]+/g, 'dataURI'],
43
+ [/(data:[^;]+;base64),[\w+/-=]+/g, 'dataURI'],
36
44
  // File paths
37
- [/(["'`, ]|^)([^"'`, \n]*[/\\][^"'`, \n]*)(["'`, ]|$)/gm, '$1/file/path$3'],
45
+ [/(["'`, ]|^)([^"'`, \n]*[/\\][^"'`, \n]*)(?=["'`, ]|$)/gm, '$1/file/path'],
38
46
  // Semantic versions
39
47
  [/\d+\.\d+\.\d+(-\d+)?/g, '1.0.0'],
40
48
  [/version "[^"]+"/g, 'version "1.0.0"'],
@@ -45,7 +53,7 @@ const NORMALIZE_REGEXPS = [
45
53
  // Numbers, e.g. number of issues/problems
46
54
  [/\d+/g, '0'],
47
55
  // Hexadecimal strings
48
- [/[\da-fA-F]{6,}/g, 'hex'],
56
+ [/[\da-fA-F-]{6,}/g, 'hex'],
49
57
  // On unknown inputs, we print the inputs
50
58
  [/(does not accept any inputs but you specified: ).*/, '$1'],
51
59
  [/(Unknown inputs for plugin).*/, '$1'],
@@ -75,3 +83,14 @@ const NORMALIZE_REGEXPS = [
75
83
  // Multiple empty lines
76
84
  [/^\s*$/gm, ''],
77
85
  ]
86
+
87
+ const FUNCTIONS_BUNDLING_REGEXPS = [
88
+ // String literals and identifiers
89
+ [/"([^"]+)"/g, '""'],
90
+ [/'([^']+)'/g, "''"],
91
+ [/`([^`]+)`/g, '``'],
92
+
93
+ // Rust crates
94
+ [/(?:Downloaded \S+ v[\d.]+\s*)+/gm, 'Downloaded crates'],
95
+ [/(?:Compiling \S+ v[\d.]+\s*)+/gm, 'Compiled crates'],
96
+ ]
@@ -21,7 +21,7 @@ export const reportBuildError = async function ({ error, errorMonitor, childEnv,
21
21
  const { errorInfo, type, severity, title, group = title } = parseErrorInfo(error)
22
22
  const severityA = getSeverity(severity, errorInfo)
23
23
  const groupA = getGroup(group, errorInfo)
24
- const groupingHash = getGroupingHash(groupA, error, type)
24
+ const groupingHash = getGroupingHash(groupA, error, type, errorInfo)
25
25
  const metadata = getMetadata(errorInfo, childEnv, groupingHash)
26
26
  const app = getApp()
27
27
  const eventProps = getEventProps({ severity: severityA, group: groupA, groupingHash, metadata, app })
@@ -52,7 +52,12 @@ const getGroup = function (group, errorInfo) {
52
52
  return group(errorInfo)
53
53
  }
54
54
 
55
- const getGroupingHash = function (group, error, type) {
55
+ const getGroupingHash = function (group, error, type, errorInfo = {}) {
56
+ // If the error has a `normalizedMessage`, we use it as the grouping hash.
57
+ if (errorInfo.normalizedMessage) {
58
+ return errorInfo.normalizedMessage
59
+ }
60
+
56
61
  const message = error instanceof Error && typeof error.message === 'string' ? error.message : String(error)
57
62
  const messageA = normalizeGroupingMessage(message, type)
58
63
  return `${group}\n${messageA}`
package/src/error/type.js CHANGED
@@ -88,6 +88,7 @@ const TYPES = {
88
88
 
89
89
  return `Bundling of function "${functionName}" failed`
90
90
  },
91
+ group: ({ location: { functionType = 'serverless' } }) => `Bundling of ${functionType} function failed`,
91
92
  stackType: 'none',
92
93
  locationType: 'functionsBundling',
93
94
  severity: 'info',