@shopify/create-app 3.65.2 → 3.66.0
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/dist/chunk-2RSJVBMF.js +5625 -0
- package/dist/{chunk-Z65QJ5D7.js → chunk-4DRC2PSU.js} +17 -30
- package/dist/chunk-4OD45DDO.js +31508 -0
- package/dist/chunk-522OB3EU.js +45 -0
- package/dist/{chunk-JTKTLA7L.js → chunk-5U24TEX5.js} +5434 -10324
- package/dist/{chunk-GJPZCXGT.js → chunk-6A7MXLVB.js} +159 -405
- package/dist/{chunk-ZYKRTO5P.js → chunk-7ZCQLP5Y.js} +3 -3
- package/dist/{chunk-5LBEKXRW.js → chunk-FIJKOZJF.js} +19 -55
- package/dist/{chunk-QSKQTKTB.js → chunk-FT6PCF6E.js} +2441 -5551
- package/dist/chunk-GIUM5DCQ.js +2144 -0
- package/dist/chunk-HIAKHDLR.js +54 -0
- package/dist/chunk-LLSRDN3T.js +15352 -0
- package/dist/chunk-LTDD2GRL.js +111 -0
- package/dist/{chunk-63QVG2CD.js → chunk-NGBYQF44.js} +9 -9
- package/dist/chunk-NLC7NBUB.js +80 -0
- package/dist/{chunk-FMKVOTQK.js → chunk-O5K4AU7Q.js} +18 -34
- package/dist/chunk-OMDEA7TV.js +10615 -0
- package/dist/chunk-PNN7RS7Y.js +105 -0
- package/dist/{chunk-ZPL24Y2D.js → chunk-POZ5MGPT.js} +13 -18
- package/dist/chunk-T7T35H4F.js +108 -0
- package/dist/chunk-UBB7JKND.js +55 -0
- package/dist/chunk-VSLR7ET4.js +3034 -0
- package/dist/{chunk-SAO7C4LP.js → chunk-VZVGAREJ.js} +46821 -101962
- package/dist/{chunk-KDNBKIH4.js → chunk-WBQF4CSV.js} +12 -22
- package/dist/chunk-XVNW332R.js +524 -0
- package/dist/{chunk-YB6D4XQ7.js → chunk-Y4ECGRAF.js} +13 -23
- package/dist/chunk-ZAUZQLNO.js +3774 -0
- package/dist/chunk-ZULFH3SL.js +1847 -0
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.js +27 -27
- package/dist/commands/init.test.js +51 -70
- package/dist/{constants-24TFXZKQ.js → constants-WG7I7G3O.js} +5 -5
- package/dist/custom-oclif-loader-JKRJZ56E.js +47 -0
- package/dist/del-NW5KFKFP.js +1820 -0
- package/dist/devtools-UBOREV57.js +2572 -0
- package/dist/error-handler-26SLAJTC.js +35 -0
- package/dist/hooks/postrun.js +35 -42
- package/dist/hooks/prerun.js +58 -36
- package/dist/index.js +7 -7
- package/dist/lib-3K5QYF3J.js +9 -0
- package/dist/{local-3VUKCW4R.js → local-H6TW5MNX.js} +13 -13
- package/dist/magic-string.es-3RXPUXZF.js +843 -0
- package/dist/multipart-parser-QKUAJJP5.js +193 -0
- package/dist/{node-package-manager-HYZRZNU6.js → node-package-manager-QAUN6HGS.js} +16 -14
- package/dist/open-MZGVNFZO.js +197 -0
- package/dist/out-KDGAD475.js +6 -0
- package/dist/{path-CFPIDSWV.js → path-L375JOQ2.js} +4 -4
- package/dist/prompts/init.js +13 -13
- package/dist/prompts/init.test.js +42 -59
- package/dist/services/init.js +20 -20
- package/dist/services/init.test.js +5 -5
- package/dist/system-ZI2HKAKO.js +26 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{ui-7NEDEALP.js → ui-727JEZUX.js} +13 -13
- package/dist/utils/template/cleanup.js +13 -13
- package/dist/utils/template/cleanup.test.js +18 -30
- package/dist/utils/template/npm.js +15 -15
- package/dist/utils/template/npm.test.js +48 -87
- package/oclif.manifest.json +1 -1
- package/package.json +3 -4
- package/dist/chunk-3US34ZNP.js +0 -145
- package/dist/chunk-3XYIOBQ2.js +0 -22131
- package/dist/chunk-6IZMEXPW.js +0 -105
- package/dist/chunk-7DRS5WXI.js +0 -7843
- package/dist/chunk-DL3MKXVR.js +0 -4754
- package/dist/chunk-HDVJ5FPK.js +0 -63
- package/dist/chunk-IKO7JBOJ.js +0 -14788
- package/dist/chunk-LSCXQWNO.js +0 -822
- package/dist/chunk-M2VKB6RG.js +0 -146
- package/dist/chunk-MCED27CG.js +0 -5626
- package/dist/chunk-SWNRLCC6.js +0 -61
- package/dist/chunk-T5LLJYYS.js +0 -195
- package/dist/chunk-U5LTJVWL.js +0 -3185
- package/dist/chunk-WR7YKB6H.js +0 -44962
- package/dist/chunk-YC4FLMDD.js +0 -74
- package/dist/chunk-ZRUHMMSQ.js +0 -2477
- package/dist/custom-oclif-loader-5KBN3RSN.js +0 -83
- package/dist/del-ZCPTGWOA.js +0 -2847
- package/dist/devtools-5N4JAP3R.js +0 -3588
- package/dist/error-handler-GTW2KSRC.js +0 -35
- package/dist/lib-CTSCLPNV.js +0 -9
- package/dist/magic-string.es-ATGURXGQ.js +0 -1353
- package/dist/multipart-parser-KYOHF24X.js +0 -360
- package/dist/open-JRS7RW22.js +0 -291
- package/dist/out-OKI3G7I5.js +0 -6
- package/dist/system-4S4YXUXZ.js +0 -26
|
@@ -0,0 +1,2144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_once
|
|
3
|
+
} from "./chunk-O5K4AU7Q.js";
|
|
4
|
+
import {
|
|
5
|
+
fanoutHooks,
|
|
6
|
+
reportAnalyticsEvent
|
|
7
|
+
} from "./chunk-FT6PCF6E.js";
|
|
8
|
+
import {
|
|
9
|
+
getEnvironmentData
|
|
10
|
+
} from "./chunk-Y4ECGRAF.js";
|
|
11
|
+
import {
|
|
12
|
+
CLI_KIT_VERSION
|
|
13
|
+
} from "./chunk-7ZCQLP5Y.js";
|
|
14
|
+
import {
|
|
15
|
+
AbortSilentError,
|
|
16
|
+
CancelExecution,
|
|
17
|
+
cleanSingleStackTracePath,
|
|
18
|
+
errorMapper,
|
|
19
|
+
getAllPublicMetadata,
|
|
20
|
+
getAllSensitiveMetadata,
|
|
21
|
+
handler,
|
|
22
|
+
outputDebug,
|
|
23
|
+
outputInfo,
|
|
24
|
+
require_stacktracey,
|
|
25
|
+
shouldReportError
|
|
26
|
+
} from "./chunk-4OD45DDO.js";
|
|
27
|
+
import {
|
|
28
|
+
bugsnagApiKey
|
|
29
|
+
} from "./chunk-FIJKOZJF.js";
|
|
30
|
+
import {
|
|
31
|
+
cwd,
|
|
32
|
+
isAbsolutePath,
|
|
33
|
+
joinPath,
|
|
34
|
+
normalizePath,
|
|
35
|
+
relativePath
|
|
36
|
+
} from "./chunk-4DRC2PSU.js";
|
|
37
|
+
import {
|
|
38
|
+
printEventsJson
|
|
39
|
+
} from "./chunk-LTDD2GRL.js";
|
|
40
|
+
import {
|
|
41
|
+
require_lib
|
|
42
|
+
} from "./chunk-VZVGAREJ.js";
|
|
43
|
+
import {
|
|
44
|
+
__commonJS,
|
|
45
|
+
__require,
|
|
46
|
+
__toESM,
|
|
47
|
+
init_cjs_shims
|
|
48
|
+
} from "./chunk-POZ5MGPT.js";
|
|
49
|
+
|
|
50
|
+
// ../../node_modules/.pnpm/stackframe@1.3.4/node_modules/stackframe/stackframe.js
|
|
51
|
+
var require_stackframe = __commonJS({
|
|
52
|
+
"../../node_modules/.pnpm/stackframe@1.3.4/node_modules/stackframe/stackframe.js"(exports, module) {
|
|
53
|
+
init_cjs_shims();
|
|
54
|
+
(function(root, factory) {
|
|
55
|
+
"use strict";
|
|
56
|
+
typeof define == "function" && define.amd ? define("stackframe", [], factory) : typeof exports == "object" ? module.exports = factory() : root.StackFrame = factory();
|
|
57
|
+
})(exports, function() {
|
|
58
|
+
"use strict";
|
|
59
|
+
function _isNumber(n) {
|
|
60
|
+
return !isNaN(parseFloat(n)) && isFinite(n);
|
|
61
|
+
}
|
|
62
|
+
function _capitalize(str) {
|
|
63
|
+
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
64
|
+
}
|
|
65
|
+
function _getter(p) {
|
|
66
|
+
return function() {
|
|
67
|
+
return this[p];
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
var booleanProps = ["isConstructor", "isEval", "isNative", "isToplevel"], numericProps = ["columnNumber", "lineNumber"], stringProps = ["fileName", "functionName", "source"], arrayProps = ["args"], objectProps = ["evalOrigin"], props = booleanProps.concat(numericProps, stringProps, arrayProps, objectProps);
|
|
71
|
+
function StackFrame(obj) {
|
|
72
|
+
if (obj)
|
|
73
|
+
for (var i2 = 0; i2 < props.length; i2++)
|
|
74
|
+
obj[props[i2]] !== void 0 && this["set" + _capitalize(props[i2])](obj[props[i2]]);
|
|
75
|
+
}
|
|
76
|
+
StackFrame.prototype = {
|
|
77
|
+
getArgs: function() {
|
|
78
|
+
return this.args;
|
|
79
|
+
},
|
|
80
|
+
setArgs: function(v) {
|
|
81
|
+
if (Object.prototype.toString.call(v) !== "[object Array]")
|
|
82
|
+
throw new TypeError("Args must be an Array");
|
|
83
|
+
this.args = v;
|
|
84
|
+
},
|
|
85
|
+
getEvalOrigin: function() {
|
|
86
|
+
return this.evalOrigin;
|
|
87
|
+
},
|
|
88
|
+
setEvalOrigin: function(v) {
|
|
89
|
+
if (v instanceof StackFrame)
|
|
90
|
+
this.evalOrigin = v;
|
|
91
|
+
else if (v instanceof Object)
|
|
92
|
+
this.evalOrigin = new StackFrame(v);
|
|
93
|
+
else
|
|
94
|
+
throw new TypeError("Eval Origin must be an Object or StackFrame");
|
|
95
|
+
},
|
|
96
|
+
toString: function() {
|
|
97
|
+
var fileName = this.getFileName() || "", lineNumber = this.getLineNumber() || "", columnNumber = this.getColumnNumber() || "", functionName = this.getFunctionName() || "";
|
|
98
|
+
return this.getIsEval() ? fileName ? "[eval] (" + fileName + ":" + lineNumber + ":" + columnNumber + ")" : "[eval]:" + lineNumber + ":" + columnNumber : functionName ? functionName + " (" + fileName + ":" + lineNumber + ":" + columnNumber + ")" : fileName + ":" + lineNumber + ":" + columnNumber;
|
|
99
|
+
}
|
|
100
|
+
}, StackFrame.fromString = function(str) {
|
|
101
|
+
var argsStartIndex = str.indexOf("("), argsEndIndex = str.lastIndexOf(")"), functionName = str.substring(0, argsStartIndex), args = str.substring(argsStartIndex + 1, argsEndIndex).split(","), locationString = str.substring(argsEndIndex + 1);
|
|
102
|
+
if (locationString.indexOf("@") === 0)
|
|
103
|
+
var parts = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(locationString, ""), fileName = parts[1], lineNumber = parts[2], columnNumber = parts[3];
|
|
104
|
+
return new StackFrame({
|
|
105
|
+
functionName,
|
|
106
|
+
args: args || void 0,
|
|
107
|
+
fileName,
|
|
108
|
+
lineNumber: lineNumber || void 0,
|
|
109
|
+
columnNumber: columnNumber || void 0
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
for (var i = 0; i < booleanProps.length; i++)
|
|
113
|
+
StackFrame.prototype["get" + _capitalize(booleanProps[i])] = _getter(booleanProps[i]), StackFrame.prototype["set" + _capitalize(booleanProps[i])] = /* @__PURE__ */ function(p) {
|
|
114
|
+
return function(v) {
|
|
115
|
+
this[p] = !!v;
|
|
116
|
+
};
|
|
117
|
+
}(booleanProps[i]);
|
|
118
|
+
for (var j = 0; j < numericProps.length; j++)
|
|
119
|
+
StackFrame.prototype["get" + _capitalize(numericProps[j])] = _getter(numericProps[j]), StackFrame.prototype["set" + _capitalize(numericProps[j])] = /* @__PURE__ */ function(p) {
|
|
120
|
+
return function(v) {
|
|
121
|
+
if (!_isNumber(v))
|
|
122
|
+
throw new TypeError(p + " must be a Number");
|
|
123
|
+
this[p] = Number(v);
|
|
124
|
+
};
|
|
125
|
+
}(numericProps[j]);
|
|
126
|
+
for (var k = 0; k < stringProps.length; k++)
|
|
127
|
+
StackFrame.prototype["get" + _capitalize(stringProps[k])] = _getter(stringProps[k]), StackFrame.prototype["set" + _capitalize(stringProps[k])] = /* @__PURE__ */ function(p) {
|
|
128
|
+
return function(v) {
|
|
129
|
+
this[p] = String(v);
|
|
130
|
+
};
|
|
131
|
+
}(stringProps[k]);
|
|
132
|
+
return StackFrame;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// ../../node_modules/.pnpm/error-stack-parser@2.1.4/node_modules/error-stack-parser/error-stack-parser.js
|
|
138
|
+
var require_error_stack_parser = __commonJS({
|
|
139
|
+
"../../node_modules/.pnpm/error-stack-parser@2.1.4/node_modules/error-stack-parser/error-stack-parser.js"(exports, module) {
|
|
140
|
+
init_cjs_shims();
|
|
141
|
+
(function(root, factory) {
|
|
142
|
+
"use strict";
|
|
143
|
+
typeof define == "function" && define.amd ? define("error-stack-parser", ["stackframe"], factory) : typeof exports == "object" ? module.exports = factory(require_stackframe()) : root.ErrorStackParser = factory(root.StackFrame);
|
|
144
|
+
})(exports, function(StackFrame) {
|
|
145
|
+
"use strict";
|
|
146
|
+
var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/, CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m, SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
|
|
147
|
+
return {
|
|
148
|
+
/**
|
|
149
|
+
* Given an Error object, extract the most information from it.
|
|
150
|
+
*
|
|
151
|
+
* @param {Error} error object
|
|
152
|
+
* @return {Array} of StackFrames
|
|
153
|
+
*/
|
|
154
|
+
parse: function(error) {
|
|
155
|
+
if (typeof error.stacktrace < "u" || typeof error["opera#sourceloc"] < "u")
|
|
156
|
+
return this.parseOpera(error);
|
|
157
|
+
if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP))
|
|
158
|
+
return this.parseV8OrIE(error);
|
|
159
|
+
if (error.stack)
|
|
160
|
+
return this.parseFFOrSafari(error);
|
|
161
|
+
throw new Error("Cannot parse given Error object");
|
|
162
|
+
},
|
|
163
|
+
// Separate line and column numbers from a string of the form: (URI:Line:Column)
|
|
164
|
+
extractLocation: function(urlLike) {
|
|
165
|
+
if (urlLike.indexOf(":") === -1)
|
|
166
|
+
return [urlLike];
|
|
167
|
+
var regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/, parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
168
|
+
return [parts[1], parts[2] || void 0, parts[3] || void 0];
|
|
169
|
+
},
|
|
170
|
+
parseV8OrIE: function(error) {
|
|
171
|
+
var filtered = error.stack.split(`
|
|
172
|
+
`).filter(function(line) {
|
|
173
|
+
return !!line.match(CHROME_IE_STACK_REGEXP);
|
|
174
|
+
}, this);
|
|
175
|
+
return filtered.map(function(line) {
|
|
176
|
+
line.indexOf("(eval ") > -1 && (line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""));
|
|
177
|
+
var sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""), location = sanitizedLine.match(/ (\(.+\)$)/);
|
|
178
|
+
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
179
|
+
var locationParts = this.extractLocation(location ? location[1] : sanitizedLine), functionName = location && sanitizedLine || void 0, fileName = ["eval", "<anonymous>"].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];
|
|
180
|
+
return new StackFrame({
|
|
181
|
+
functionName,
|
|
182
|
+
fileName,
|
|
183
|
+
lineNumber: locationParts[1],
|
|
184
|
+
columnNumber: locationParts[2],
|
|
185
|
+
source: line
|
|
186
|
+
});
|
|
187
|
+
}, this);
|
|
188
|
+
},
|
|
189
|
+
parseFFOrSafari: function(error) {
|
|
190
|
+
var filtered = error.stack.split(`
|
|
191
|
+
`).filter(function(line) {
|
|
192
|
+
return !line.match(SAFARI_NATIVE_CODE_REGEXP);
|
|
193
|
+
}, this);
|
|
194
|
+
return filtered.map(function(line) {
|
|
195
|
+
if (line.indexOf(" > eval") > -1 && (line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), line.indexOf("@") === -1 && line.indexOf(":") === -1)
|
|
196
|
+
return new StackFrame({
|
|
197
|
+
functionName: line
|
|
198
|
+
});
|
|
199
|
+
var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/, matches = line.match(functionNameRegex), functionName = matches && matches[1] ? matches[1] : void 0, locationParts = this.extractLocation(line.replace(functionNameRegex, ""));
|
|
200
|
+
return new StackFrame({
|
|
201
|
+
functionName,
|
|
202
|
+
fileName: locationParts[0],
|
|
203
|
+
lineNumber: locationParts[1],
|
|
204
|
+
columnNumber: locationParts[2],
|
|
205
|
+
source: line
|
|
206
|
+
});
|
|
207
|
+
}, this);
|
|
208
|
+
},
|
|
209
|
+
parseOpera: function(e) {
|
|
210
|
+
return !e.stacktrace || e.message.indexOf(`
|
|
211
|
+
`) > -1 && e.message.split(`
|
|
212
|
+
`).length > e.stacktrace.split(`
|
|
213
|
+
`).length ? this.parseOpera9(e) : e.stack ? this.parseOpera11(e) : this.parseOpera10(e);
|
|
214
|
+
},
|
|
215
|
+
parseOpera9: function(e) {
|
|
216
|
+
for (var lineRE = /Line (\d+).*script (?:in )?(\S+)/i, lines = e.message.split(`
|
|
217
|
+
`), result = [], i = 2, len = lines.length; i < len; i += 2) {
|
|
218
|
+
var match = lineRE.exec(lines[i]);
|
|
219
|
+
match && result.push(new StackFrame({
|
|
220
|
+
fileName: match[2],
|
|
221
|
+
lineNumber: match[1],
|
|
222
|
+
source: lines[i]
|
|
223
|
+
}));
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
226
|
+
},
|
|
227
|
+
parseOpera10: function(e) {
|
|
228
|
+
for (var lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i, lines = e.stacktrace.split(`
|
|
229
|
+
`), result = [], i = 0, len = lines.length; i < len; i += 2) {
|
|
230
|
+
var match = lineRE.exec(lines[i]);
|
|
231
|
+
match && result.push(
|
|
232
|
+
new StackFrame({
|
|
233
|
+
functionName: match[3] || void 0,
|
|
234
|
+
fileName: match[2],
|
|
235
|
+
lineNumber: match[1],
|
|
236
|
+
source: lines[i]
|
|
237
|
+
})
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
return result;
|
|
241
|
+
},
|
|
242
|
+
// Opera 10.65+ Error.stack very similar to FF/Safari
|
|
243
|
+
parseOpera11: function(error) {
|
|
244
|
+
var filtered = error.stack.split(`
|
|
245
|
+
`).filter(function(line) {
|
|
246
|
+
return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
|
|
247
|
+
}, this);
|
|
248
|
+
return filtered.map(function(line) {
|
|
249
|
+
var tokens = line.split("@"), locationParts = this.extractLocation(tokens.pop()), functionCall = tokens.shift() || "", functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0, argsRaw;
|
|
250
|
+
functionCall.match(/\(([^)]*)\)/) && (argsRaw = functionCall.replace(/^[^(]+\(([^)]*)\)$/, "$1"));
|
|
251
|
+
var args = argsRaw === void 0 || argsRaw === "[arguments not available]" ? void 0 : argsRaw.split(",");
|
|
252
|
+
return new StackFrame({
|
|
253
|
+
functionName,
|
|
254
|
+
args,
|
|
255
|
+
fileName: locationParts[0],
|
|
256
|
+
lineNumber: locationParts[1],
|
|
257
|
+
columnNumber: locationParts[2],
|
|
258
|
+
source: line
|
|
259
|
+
});
|
|
260
|
+
}, this);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// ../../node_modules/.pnpm/iserror@0.0.2/node_modules/iserror/index.js
|
|
268
|
+
var require_iserror = __commonJS({
|
|
269
|
+
"../../node_modules/.pnpm/iserror@0.0.2/node_modules/iserror/index.js"(exports, module) {
|
|
270
|
+
init_cjs_shims();
|
|
271
|
+
module.exports = isError;
|
|
272
|
+
function isError(value) {
|
|
273
|
+
switch (Object.prototype.toString.call(value)) {
|
|
274
|
+
case "[object Error]":
|
|
275
|
+
return !0;
|
|
276
|
+
case "[object Exception]":
|
|
277
|
+
return !0;
|
|
278
|
+
case "[object DOMException]":
|
|
279
|
+
return !0;
|
|
280
|
+
default:
|
|
281
|
+
return value instanceof Error;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// ../../node_modules/.pnpm/stack-generator@2.0.10/node_modules/stack-generator/stack-generator.js
|
|
288
|
+
var require_stack_generator = __commonJS({
|
|
289
|
+
"../../node_modules/.pnpm/stack-generator@2.0.10/node_modules/stack-generator/stack-generator.js"(exports, module) {
|
|
290
|
+
init_cjs_shims();
|
|
291
|
+
(function(root, factory) {
|
|
292
|
+
"use strict";
|
|
293
|
+
typeof define == "function" && define.amd ? define("stack-generator", ["stackframe"], factory) : typeof exports == "object" ? module.exports = factory(require_stackframe()) : root.StackGenerator = factory(root.StackFrame);
|
|
294
|
+
})(exports, function(StackFrame) {
|
|
295
|
+
return {
|
|
296
|
+
backtrace: function(opts) {
|
|
297
|
+
var stack = [], maxStackSize = 10;
|
|
298
|
+
typeof opts == "object" && typeof opts.maxStackSize == "number" && (maxStackSize = opts.maxStackSize);
|
|
299
|
+
for (var curr = arguments.callee; curr && stack.length < maxStackSize && curr.arguments; ) {
|
|
300
|
+
for (var args = new Array(curr.arguments.length), i = 0; i < args.length; ++i)
|
|
301
|
+
args[i] = curr.arguments[i];
|
|
302
|
+
/function(?:\s+([\w$]+))+\s*\(/.test(curr.toString()) ? stack.push(new StackFrame({ functionName: RegExp.$1 || void 0, args })) : stack.push(new StackFrame({ args }));
|
|
303
|
+
try {
|
|
304
|
+
curr = curr.caller;
|
|
305
|
+
} catch {
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return stack;
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
// ../../node_modules/.pnpm/end-of-stream@1.4.4/node_modules/end-of-stream/index.js
|
|
317
|
+
var require_end_of_stream = __commonJS({
|
|
318
|
+
"../../node_modules/.pnpm/end-of-stream@1.4.4/node_modules/end-of-stream/index.js"(exports, module) {
|
|
319
|
+
init_cjs_shims();
|
|
320
|
+
var once = require_once(), noop = function() {
|
|
321
|
+
}, isRequest = function(stream) {
|
|
322
|
+
return stream.setHeader && typeof stream.abort == "function";
|
|
323
|
+
}, isChildProcess = function(stream) {
|
|
324
|
+
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
|
|
325
|
+
}, eos = function(stream, opts, callback) {
|
|
326
|
+
if (typeof opts == "function")
|
|
327
|
+
return eos(stream, null, opts);
|
|
328
|
+
opts || (opts = {}), callback = once(callback || noop);
|
|
329
|
+
var ws = stream._writableState, rs = stream._readableState, readable = opts.readable || opts.readable !== !1 && stream.readable, writable = opts.writable || opts.writable !== !1 && stream.writable, cancelled = !1, onlegacyfinish = function() {
|
|
330
|
+
stream.writable || onfinish();
|
|
331
|
+
}, onfinish = function() {
|
|
332
|
+
writable = !1, readable || callback.call(stream);
|
|
333
|
+
}, onend = function() {
|
|
334
|
+
readable = !1, writable || callback.call(stream);
|
|
335
|
+
}, onexit = function(exitCode) {
|
|
336
|
+
callback.call(stream, exitCode ? new Error("exited with error code: " + exitCode) : null);
|
|
337
|
+
}, onerror = function(err) {
|
|
338
|
+
callback.call(stream, err);
|
|
339
|
+
}, onclose = function() {
|
|
340
|
+
process.nextTick(onclosenexttick);
|
|
341
|
+
}, onclosenexttick = function() {
|
|
342
|
+
if (!cancelled) {
|
|
343
|
+
if (readable && !(rs && rs.ended && !rs.destroyed))
|
|
344
|
+
return callback.call(stream, new Error("premature close"));
|
|
345
|
+
if (writable && !(ws && ws.ended && !ws.destroyed))
|
|
346
|
+
return callback.call(stream, new Error("premature close"));
|
|
347
|
+
}
|
|
348
|
+
}, onrequest = function() {
|
|
349
|
+
stream.req.on("finish", onfinish);
|
|
350
|
+
};
|
|
351
|
+
return isRequest(stream) ? (stream.on("complete", onfinish), stream.on("abort", onclose), stream.req ? onrequest() : stream.on("request", onrequest)) : writable && !ws && (stream.on("end", onlegacyfinish), stream.on("close", onlegacyfinish)), isChildProcess(stream) && stream.on("exit", onexit), stream.on("end", onend), stream.on("finish", onfinish), opts.error !== !1 && stream.on("error", onerror), stream.on("close", onclose), function() {
|
|
352
|
+
cancelled = !0, stream.removeListener("complete", onfinish), stream.removeListener("abort", onclose), stream.removeListener("request", onrequest), stream.req && stream.req.removeListener("finish", onfinish), stream.removeListener("end", onlegacyfinish), stream.removeListener("close", onlegacyfinish), stream.removeListener("finish", onfinish), stream.removeListener("exit", onexit), stream.removeListener("end", onend), stream.removeListener("error", onerror), stream.removeListener("close", onclose);
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
module.exports = eos;
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
// ../../node_modules/.pnpm/pump@3.0.0/node_modules/pump/index.js
|
|
360
|
+
var require_pump = __commonJS({
|
|
361
|
+
"../../node_modules/.pnpm/pump@3.0.0/node_modules/pump/index.js"(exports, module) {
|
|
362
|
+
init_cjs_shims();
|
|
363
|
+
var once = require_once(), eos = require_end_of_stream(), fs = __require("fs"), noop = function() {
|
|
364
|
+
}, ancient = /^v?\.0/.test(process.version), isFn = function(fn) {
|
|
365
|
+
return typeof fn == "function";
|
|
366
|
+
}, isFS = function(stream) {
|
|
367
|
+
return !ancient || !fs ? !1 : (stream instanceof (fs.ReadStream || noop) || stream instanceof (fs.WriteStream || noop)) && isFn(stream.close);
|
|
368
|
+
}, isRequest = function(stream) {
|
|
369
|
+
return stream.setHeader && isFn(stream.abort);
|
|
370
|
+
}, destroyer = function(stream, reading, writing, callback) {
|
|
371
|
+
callback = once(callback);
|
|
372
|
+
var closed = !1;
|
|
373
|
+
stream.on("close", function() {
|
|
374
|
+
closed = !0;
|
|
375
|
+
}), eos(stream, { readable: reading, writable: writing }, function(err) {
|
|
376
|
+
if (err)
|
|
377
|
+
return callback(err);
|
|
378
|
+
closed = !0, callback();
|
|
379
|
+
});
|
|
380
|
+
var destroyed = !1;
|
|
381
|
+
return function(err) {
|
|
382
|
+
if (!closed && !destroyed) {
|
|
383
|
+
if (destroyed = !0, isFS(stream))
|
|
384
|
+
return stream.close(noop);
|
|
385
|
+
if (isRequest(stream))
|
|
386
|
+
return stream.abort();
|
|
387
|
+
if (isFn(stream.destroy))
|
|
388
|
+
return stream.destroy();
|
|
389
|
+
callback(err || new Error("stream was destroyed"));
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
}, call = function(fn) {
|
|
393
|
+
fn();
|
|
394
|
+
}, pipe = function(from, to) {
|
|
395
|
+
return from.pipe(to);
|
|
396
|
+
}, pump = function() {
|
|
397
|
+
var streams = Array.prototype.slice.call(arguments), callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop;
|
|
398
|
+
if (Array.isArray(streams[0]) && (streams = streams[0]), streams.length < 2)
|
|
399
|
+
throw new Error("pump requires two streams per minimum");
|
|
400
|
+
var error, destroys = streams.map(function(stream, i) {
|
|
401
|
+
var reading = i < streams.length - 1, writing = i > 0;
|
|
402
|
+
return destroyer(stream, reading, writing, function(err) {
|
|
403
|
+
error || (error = err), err && destroys.forEach(call), !reading && (destroys.forEach(call), callback(error));
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
return streams.reduce(pipe);
|
|
407
|
+
};
|
|
408
|
+
module.exports = pump;
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// ../../node_modules/.pnpm/byline@5.0.0/node_modules/byline/lib/byline.js
|
|
413
|
+
var require_byline = __commonJS({
|
|
414
|
+
"../../node_modules/.pnpm/byline@5.0.0/node_modules/byline/lib/byline.js"(exports, module) {
|
|
415
|
+
init_cjs_shims();
|
|
416
|
+
var stream = __require("stream"), util = __require("util"), timers = __require("timers");
|
|
417
|
+
module.exports = function(readStream, options) {
|
|
418
|
+
return module.exports.createStream(readStream, options);
|
|
419
|
+
};
|
|
420
|
+
module.exports.createStream = function(readStream, options) {
|
|
421
|
+
return readStream ? createLineStream(readStream, options) : new LineStream(options);
|
|
422
|
+
};
|
|
423
|
+
module.exports.createLineStream = function(readStream) {
|
|
424
|
+
return console.log("WARNING: byline#createLineStream is deprecated and will be removed soon"), createLineStream(readStream);
|
|
425
|
+
};
|
|
426
|
+
function createLineStream(readStream, options) {
|
|
427
|
+
if (!readStream)
|
|
428
|
+
throw new Error("expected readStream");
|
|
429
|
+
if (!readStream.readable)
|
|
430
|
+
throw new Error("readStream must be readable");
|
|
431
|
+
var ls = new LineStream(options);
|
|
432
|
+
return readStream.pipe(ls), ls;
|
|
433
|
+
}
|
|
434
|
+
module.exports.LineStream = LineStream;
|
|
435
|
+
function LineStream(options) {
|
|
436
|
+
stream.Transform.call(this, options), options = options || {}, this._readableState.objectMode = !0, this._lineBuffer = [], this._keepEmptyLines = options.keepEmptyLines || !1, this._lastChunkEndedWithCR = !1;
|
|
437
|
+
var self2 = this;
|
|
438
|
+
this.on("pipe", function(src) {
|
|
439
|
+
self2.encoding || src instanceof stream.Readable && (self2.encoding = src._readableState.encoding);
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
util.inherits(LineStream, stream.Transform);
|
|
443
|
+
LineStream.prototype._transform = function(chunk, encoding, done) {
|
|
444
|
+
encoding = encoding || "utf8", Buffer.isBuffer(chunk) && (encoding == "buffer" ? (chunk = chunk.toString(), encoding = "utf8") : chunk = chunk.toString(encoding)), this._chunkEncoding = encoding;
|
|
445
|
+
var lines = chunk.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/g);
|
|
446
|
+
this._lastChunkEndedWithCR && chunk[0] == `
|
|
447
|
+
` && lines.shift(), this._lineBuffer.length > 0 && (this._lineBuffer[this._lineBuffer.length - 1] += lines[0], lines.shift()), this._lastChunkEndedWithCR = chunk[chunk.length - 1] == "\r", this._lineBuffer = this._lineBuffer.concat(lines), this._pushBuffer(encoding, 1, done);
|
|
448
|
+
};
|
|
449
|
+
LineStream.prototype._pushBuffer = function(encoding, keep, done) {
|
|
450
|
+
for (; this._lineBuffer.length > keep; ) {
|
|
451
|
+
var line = this._lineBuffer.shift();
|
|
452
|
+
if ((this._keepEmptyLines || line.length > 0) && !this.push(this._reencode(line, encoding))) {
|
|
453
|
+
var self2 = this;
|
|
454
|
+
timers.setImmediate(function() {
|
|
455
|
+
self2._pushBuffer(encoding, keep, done);
|
|
456
|
+
});
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
done();
|
|
461
|
+
};
|
|
462
|
+
LineStream.prototype._flush = function(done) {
|
|
463
|
+
this._pushBuffer(this._chunkEncoding, 0, done);
|
|
464
|
+
};
|
|
465
|
+
LineStream.prototype._reencode = function(line, chunkEncoding) {
|
|
466
|
+
return this.encoding && this.encoding != chunkEncoding ? new Buffer(line, chunkEncoding).toString(this.encoding) : this.encoding ? line : new Buffer(line, chunkEncoding);
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
// ../../node_modules/.pnpm/@bugsnag+node@7.22.7/node_modules/@bugsnag/node/dist/bugsnag.js
|
|
472
|
+
var require_bugsnag = __commonJS({
|
|
473
|
+
"../../node_modules/.pnpm/@bugsnag+node@7.22.7/node_modules/@bugsnag/node/dist/bugsnag.js"(exports, module) {
|
|
474
|
+
init_cjs_shims();
|
|
475
|
+
(function(f) {
|
|
476
|
+
if (typeof exports == "object" && typeof module < "u")
|
|
477
|
+
module.exports = f();
|
|
478
|
+
else if (typeof define == "function" && define.amd)
|
|
479
|
+
define([], f);
|
|
480
|
+
else {
|
|
481
|
+
var g;
|
|
482
|
+
typeof window < "u" ? g = window : typeof global < "u" ? g = global : typeof self < "u" ? g = self : g = this, g.bugsnag = f();
|
|
483
|
+
}
|
|
484
|
+
})(function() {
|
|
485
|
+
var define2, module2, exports2, Breadcrumb = /* @__PURE__ */ function() {
|
|
486
|
+
function Breadcrumb2(message, metadata, type, timestamp) {
|
|
487
|
+
timestamp === void 0 && (timestamp = /* @__PURE__ */ new Date()), this.type = type, this.message = message, this.metadata = metadata, this.timestamp = timestamp;
|
|
488
|
+
}
|
|
489
|
+
var _proto = Breadcrumb2.prototype;
|
|
490
|
+
return _proto.toJSON = function() {
|
|
491
|
+
return {
|
|
492
|
+
type: this.type,
|
|
493
|
+
name: this.message,
|
|
494
|
+
timestamp: this.timestamp,
|
|
495
|
+
metaData: this.metadata
|
|
496
|
+
};
|
|
497
|
+
}, Breadcrumb2;
|
|
498
|
+
}(), _$Breadcrumb_1 = Breadcrumb, _$breadcrumbTypes_6 = ["navigation", "request", "process", "log", "user", "state", "error", "manual"], _$reduce_16 = function(arr, fn, accum) {
|
|
499
|
+
for (var val = accum, i = 0, len = arr.length; i < len; i++)
|
|
500
|
+
val = fn(val, arr[i], i, arr);
|
|
501
|
+
return val;
|
|
502
|
+
}, _$filter_11 = function(arr, fn) {
|
|
503
|
+
return _$reduce_16(arr, function(accum, item, i, arr2) {
|
|
504
|
+
return fn(item, i, arr2) ? accum.concat(item) : accum;
|
|
505
|
+
}, []);
|
|
506
|
+
}, _$includes_12 = function(arr, x) {
|
|
507
|
+
return _$reduce_16(arr, function(accum, item, i, arr2) {
|
|
508
|
+
return accum === !0 || item === x;
|
|
509
|
+
}, !1);
|
|
510
|
+
}, _$isArray_13 = function(obj) {
|
|
511
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
512
|
+
}, _hasDontEnumBug = !{
|
|
513
|
+
toString: null
|
|
514
|
+
}.propertyIsEnumerable("toString"), _dontEnums = ["toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor"], _$keys_14 = function(obj) {
|
|
515
|
+
var result = [], prop;
|
|
516
|
+
for (prop in obj)
|
|
517
|
+
Object.prototype.hasOwnProperty.call(obj, prop) && result.push(prop);
|
|
518
|
+
if (!_hasDontEnumBug)
|
|
519
|
+
return result;
|
|
520
|
+
for (var i = 0, len = _dontEnums.length; i < len; i++)
|
|
521
|
+
Object.prototype.hasOwnProperty.call(obj, _dontEnums[i]) && result.push(_dontEnums[i]);
|
|
522
|
+
return result;
|
|
523
|
+
}, _$intRange_25 = function(min, max) {
|
|
524
|
+
return min === void 0 && (min = 1), max === void 0 && (max = 1 / 0), function(value) {
|
|
525
|
+
return typeof value == "number" && parseInt("" + value, 10) === value && value >= min && value <= max;
|
|
526
|
+
};
|
|
527
|
+
}, _$listOfFunctions_26 = function(value) {
|
|
528
|
+
return typeof value == "function" || _$isArray_13(value) && _$filter_11(value, function(f) {
|
|
529
|
+
return typeof f == "function";
|
|
530
|
+
}).length === value.length;
|
|
531
|
+
}, _$stringWithLength_27 = function(value) {
|
|
532
|
+
return typeof value == "string" && !!value.length;
|
|
533
|
+
}, _$config_3 = {}, defaultErrorTypes = function() {
|
|
534
|
+
return {
|
|
535
|
+
unhandledExceptions: !0,
|
|
536
|
+
unhandledRejections: !0
|
|
537
|
+
};
|
|
538
|
+
};
|
|
539
|
+
_$config_3.schema = {
|
|
540
|
+
apiKey: {
|
|
541
|
+
defaultValue: function() {
|
|
542
|
+
return null;
|
|
543
|
+
},
|
|
544
|
+
message: "is required",
|
|
545
|
+
validate: _$stringWithLength_27
|
|
546
|
+
},
|
|
547
|
+
appVersion: {
|
|
548
|
+
defaultValue: function() {
|
|
549
|
+
},
|
|
550
|
+
message: "should be a string",
|
|
551
|
+
validate: function(value) {
|
|
552
|
+
return value === void 0 || _$stringWithLength_27(value);
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
appType: {
|
|
556
|
+
defaultValue: function() {
|
|
557
|
+
},
|
|
558
|
+
message: "should be a string",
|
|
559
|
+
validate: function(value) {
|
|
560
|
+
return value === void 0 || _$stringWithLength_27(value);
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
autoDetectErrors: {
|
|
564
|
+
defaultValue: function() {
|
|
565
|
+
return !0;
|
|
566
|
+
},
|
|
567
|
+
message: "should be true|false",
|
|
568
|
+
validate: function(value) {
|
|
569
|
+
return value === !0 || value === !1;
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
enabledErrorTypes: {
|
|
573
|
+
defaultValue: function() {
|
|
574
|
+
return defaultErrorTypes();
|
|
575
|
+
},
|
|
576
|
+
message: "should be an object containing the flags { unhandledExceptions:true|false, unhandledRejections:true|false }",
|
|
577
|
+
allowPartialObject: !0,
|
|
578
|
+
validate: function(value) {
|
|
579
|
+
if (typeof value != "object" || !value)
|
|
580
|
+
return !1;
|
|
581
|
+
var providedKeys = _$keys_14(value), defaultKeys = _$keys_14(defaultErrorTypes());
|
|
582
|
+
return !(_$filter_11(providedKeys, function(k) {
|
|
583
|
+
return _$includes_12(defaultKeys, k);
|
|
584
|
+
}).length < providedKeys.length || _$filter_11(_$keys_14(value), function(k) {
|
|
585
|
+
return typeof value[k] != "boolean";
|
|
586
|
+
}).length > 0);
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
onError: {
|
|
590
|
+
defaultValue: function() {
|
|
591
|
+
return [];
|
|
592
|
+
},
|
|
593
|
+
message: "should be a function or array of functions",
|
|
594
|
+
validate: _$listOfFunctions_26
|
|
595
|
+
},
|
|
596
|
+
onSession: {
|
|
597
|
+
defaultValue: function() {
|
|
598
|
+
return [];
|
|
599
|
+
},
|
|
600
|
+
message: "should be a function or array of functions",
|
|
601
|
+
validate: _$listOfFunctions_26
|
|
602
|
+
},
|
|
603
|
+
onBreadcrumb: {
|
|
604
|
+
defaultValue: function() {
|
|
605
|
+
return [];
|
|
606
|
+
},
|
|
607
|
+
message: "should be a function or array of functions",
|
|
608
|
+
validate: _$listOfFunctions_26
|
|
609
|
+
},
|
|
610
|
+
endpoints: {
|
|
611
|
+
defaultValue: function() {
|
|
612
|
+
return {
|
|
613
|
+
notify: "https://notify.bugsnag.com",
|
|
614
|
+
sessions: "https://sessions.bugsnag.com"
|
|
615
|
+
};
|
|
616
|
+
},
|
|
617
|
+
message: "should be an object containing endpoint URLs { notify, sessions }",
|
|
618
|
+
validate: function(val) {
|
|
619
|
+
return (
|
|
620
|
+
// first, ensure it's an object
|
|
621
|
+
val && typeof val == "object" && // notify and sessions must always be set
|
|
622
|
+
_$stringWithLength_27(val.notify) && _$stringWithLength_27(val.sessions) && // ensure no keys other than notify/session are set on endpoints object
|
|
623
|
+
_$filter_11(_$keys_14(val), function(k) {
|
|
624
|
+
return !_$includes_12(["notify", "sessions"], k);
|
|
625
|
+
}).length === 0
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
},
|
|
629
|
+
autoTrackSessions: {
|
|
630
|
+
defaultValue: function(val) {
|
|
631
|
+
return !0;
|
|
632
|
+
},
|
|
633
|
+
message: "should be true|false",
|
|
634
|
+
validate: function(val) {
|
|
635
|
+
return val === !0 || val === !1;
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
enabledReleaseStages: {
|
|
639
|
+
defaultValue: function() {
|
|
640
|
+
return null;
|
|
641
|
+
},
|
|
642
|
+
message: "should be an array of strings",
|
|
643
|
+
validate: function(value) {
|
|
644
|
+
return value === null || _$isArray_13(value) && _$filter_11(value, function(f) {
|
|
645
|
+
return typeof f == "string";
|
|
646
|
+
}).length === value.length;
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
releaseStage: {
|
|
650
|
+
defaultValue: function() {
|
|
651
|
+
return "production";
|
|
652
|
+
},
|
|
653
|
+
message: "should be a string",
|
|
654
|
+
validate: function(value) {
|
|
655
|
+
return typeof value == "string" && value.length;
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
maxBreadcrumbs: {
|
|
659
|
+
defaultValue: function() {
|
|
660
|
+
return 25;
|
|
661
|
+
},
|
|
662
|
+
message: "should be a number \u2264100",
|
|
663
|
+
validate: function(value) {
|
|
664
|
+
return _$intRange_25(0, 100)(value);
|
|
665
|
+
}
|
|
666
|
+
},
|
|
667
|
+
enabledBreadcrumbTypes: {
|
|
668
|
+
defaultValue: function() {
|
|
669
|
+
return _$breadcrumbTypes_6;
|
|
670
|
+
},
|
|
671
|
+
message: "should be null or a list of available breadcrumb types (" + _$breadcrumbTypes_6.join(",") + ")",
|
|
672
|
+
validate: function(value) {
|
|
673
|
+
return value === null || _$isArray_13(value) && _$reduce_16(value, function(accum, maybeType) {
|
|
674
|
+
return accum === !1 ? accum : _$includes_12(_$breadcrumbTypes_6, maybeType);
|
|
675
|
+
}, !0);
|
|
676
|
+
}
|
|
677
|
+
},
|
|
678
|
+
context: {
|
|
679
|
+
defaultValue: function() {
|
|
680
|
+
},
|
|
681
|
+
message: "should be a string",
|
|
682
|
+
validate: function(value) {
|
|
683
|
+
return value === void 0 || typeof value == "string";
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
user: {
|
|
687
|
+
defaultValue: function() {
|
|
688
|
+
return {};
|
|
689
|
+
},
|
|
690
|
+
message: "should be an object with { id, email, name } properties",
|
|
691
|
+
validate: function(value) {
|
|
692
|
+
return value === null || value && _$reduce_16(_$keys_14(value), function(accum, key) {
|
|
693
|
+
return accum && _$includes_12(["id", "email", "name"], key);
|
|
694
|
+
}, !0);
|
|
695
|
+
}
|
|
696
|
+
},
|
|
697
|
+
metadata: {
|
|
698
|
+
defaultValue: function() {
|
|
699
|
+
return {};
|
|
700
|
+
},
|
|
701
|
+
message: "should be an object",
|
|
702
|
+
validate: function(value) {
|
|
703
|
+
return typeof value == "object" && value !== null;
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
logger: {
|
|
707
|
+
defaultValue: function() {
|
|
708
|
+
},
|
|
709
|
+
message: "should be null or an object with methods { debug, info, warn, error }",
|
|
710
|
+
validate: function(value) {
|
|
711
|
+
return !value || value && _$reduce_16(["debug", "info", "warn", "error"], function(accum, method) {
|
|
712
|
+
return accum && typeof value[method] == "function";
|
|
713
|
+
}, !0);
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
redactedKeys: {
|
|
717
|
+
defaultValue: function() {
|
|
718
|
+
return ["password"];
|
|
719
|
+
},
|
|
720
|
+
message: "should be an array of strings|regexes",
|
|
721
|
+
validate: function(value) {
|
|
722
|
+
return _$isArray_13(value) && value.length === _$filter_11(value, function(s) {
|
|
723
|
+
return typeof s == "string" || s && typeof s.test == "function";
|
|
724
|
+
}).length;
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
plugins: {
|
|
728
|
+
defaultValue: function() {
|
|
729
|
+
return [];
|
|
730
|
+
},
|
|
731
|
+
message: "should be an array of plugin objects",
|
|
732
|
+
validate: function(value) {
|
|
733
|
+
return _$isArray_13(value) && value.length === _$filter_11(value, function(p) {
|
|
734
|
+
return p && typeof p == "object" && typeof p.load == "function";
|
|
735
|
+
}).length;
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
featureFlags: {
|
|
739
|
+
defaultValue: function() {
|
|
740
|
+
return [];
|
|
741
|
+
},
|
|
742
|
+
message: 'should be an array of objects that have a "name" property',
|
|
743
|
+
validate: function(value) {
|
|
744
|
+
return _$isArray_13(value) && value.length === _$filter_11(value, function(feature) {
|
|
745
|
+
return feature && typeof feature == "object" && typeof feature.name == "string";
|
|
746
|
+
}).length;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
var _$errorStackParser_9 = require_error_stack_parser(), _$assign_10 = function(target) {
|
|
751
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
752
|
+
var source = arguments[i];
|
|
753
|
+
for (var key in source)
|
|
754
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
755
|
+
}
|
|
756
|
+
return target;
|
|
757
|
+
}, _$map_15 = function(arr, fn) {
|
|
758
|
+
return _$reduce_16(arr, function(accum, item, i, arr2) {
|
|
759
|
+
return accum.concat(fn(item, i, arr2));
|
|
760
|
+
}, []);
|
|
761
|
+
}, _$safeJsonStringify_31 = function(data, replacer, space, opts) {
|
|
762
|
+
var redactedKeys = opts && opts.redactedKeys ? opts.redactedKeys : [], redactedPaths = opts && opts.redactedPaths ? opts.redactedPaths : [];
|
|
763
|
+
return JSON.stringify(prepareObjForSerialization(data, redactedKeys, redactedPaths), replacer, space);
|
|
764
|
+
}, MAX_DEPTH = 20, MAX_EDGES = 25e3, MIN_PRESERVED_DEPTH = 8, REPLACEMENT_NODE = "...";
|
|
765
|
+
function isError(o) {
|
|
766
|
+
return o instanceof Error || /^\[object (Error|(Dom)?Exception)\]$/.test(Object.prototype.toString.call(o));
|
|
767
|
+
}
|
|
768
|
+
function throwsMessage(err) {
|
|
769
|
+
return "[Throws: " + (err ? err.message : "?") + "]";
|
|
770
|
+
}
|
|
771
|
+
function find(haystack, needle) {
|
|
772
|
+
for (var i = 0, len = haystack.length; i < len; i++)
|
|
773
|
+
if (haystack[i] === needle)
|
|
774
|
+
return !0;
|
|
775
|
+
return !1;
|
|
776
|
+
}
|
|
777
|
+
function isDescendent(paths, path2) {
|
|
778
|
+
for (var i = 0, len = paths.length; i < len; i++)
|
|
779
|
+
if (path2.indexOf(paths[i]) === 0)
|
|
780
|
+
return !0;
|
|
781
|
+
return !1;
|
|
782
|
+
}
|
|
783
|
+
function shouldRedact(patterns, key) {
|
|
784
|
+
for (var i = 0, len = patterns.length; i < len; i++)
|
|
785
|
+
if (typeof patterns[i] == "string" && patterns[i].toLowerCase() === key.toLowerCase() || patterns[i] && typeof patterns[i].test == "function" && patterns[i].test(key))
|
|
786
|
+
return !0;
|
|
787
|
+
return !1;
|
|
788
|
+
}
|
|
789
|
+
function __isArray_31(obj) {
|
|
790
|
+
return Object.prototype.toString.call(obj) === "[object Array]";
|
|
791
|
+
}
|
|
792
|
+
function safelyGetProp(obj, prop) {
|
|
793
|
+
try {
|
|
794
|
+
return obj[prop];
|
|
795
|
+
} catch (err) {
|
|
796
|
+
return throwsMessage(err);
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
function prepareObjForSerialization(obj, redactedKeys, redactedPaths) {
|
|
800
|
+
var seen = [], edges = 0;
|
|
801
|
+
function visit(obj2, path2) {
|
|
802
|
+
function edgesExceeded() {
|
|
803
|
+
return path2.length > MIN_PRESERVED_DEPTH && edges > MAX_EDGES;
|
|
804
|
+
}
|
|
805
|
+
if (edges++, path2.length > MAX_DEPTH || edgesExceeded())
|
|
806
|
+
return REPLACEMENT_NODE;
|
|
807
|
+
if (obj2 === null || typeof obj2 != "object")
|
|
808
|
+
return obj2;
|
|
809
|
+
if (find(seen, obj2))
|
|
810
|
+
return "[Circular]";
|
|
811
|
+
if (seen.push(obj2), typeof obj2.toJSON == "function")
|
|
812
|
+
try {
|
|
813
|
+
edges--;
|
|
814
|
+
var fResult = visit(obj2.toJSON(), path2);
|
|
815
|
+
return seen.pop(), fResult;
|
|
816
|
+
} catch (err) {
|
|
817
|
+
return throwsMessage(err);
|
|
818
|
+
}
|
|
819
|
+
var er = isError(obj2);
|
|
820
|
+
if (er) {
|
|
821
|
+
edges--;
|
|
822
|
+
var eResult = visit({
|
|
823
|
+
name: obj2.name,
|
|
824
|
+
message: obj2.message
|
|
825
|
+
}, path2);
|
|
826
|
+
return seen.pop(), eResult;
|
|
827
|
+
}
|
|
828
|
+
if (__isArray_31(obj2)) {
|
|
829
|
+
for (var aResult = [], i = 0, len = obj2.length; i < len; i++) {
|
|
830
|
+
if (edgesExceeded()) {
|
|
831
|
+
aResult.push(REPLACEMENT_NODE);
|
|
832
|
+
break;
|
|
833
|
+
}
|
|
834
|
+
aResult.push(visit(obj2[i], path2.concat("[]")));
|
|
835
|
+
}
|
|
836
|
+
return seen.pop(), aResult;
|
|
837
|
+
}
|
|
838
|
+
var result = {};
|
|
839
|
+
try {
|
|
840
|
+
for (var prop in obj2)
|
|
841
|
+
if (Object.prototype.hasOwnProperty.call(obj2, prop)) {
|
|
842
|
+
if (isDescendent(redactedPaths, path2.join(".")) && shouldRedact(redactedKeys, prop)) {
|
|
843
|
+
result[prop] = "[REDACTED]";
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
if (edgesExceeded()) {
|
|
847
|
+
result[prop] = REPLACEMENT_NODE;
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
850
|
+
result[prop] = visit(safelyGetProp(obj2, prop), path2.concat(prop));
|
|
851
|
+
}
|
|
852
|
+
} catch {
|
|
853
|
+
}
|
|
854
|
+
return seen.pop(), result;
|
|
855
|
+
}
|
|
856
|
+
return visit(obj, []);
|
|
857
|
+
}
|
|
858
|
+
function add(existingFeatures, existingFeatureKeys, name2, variant) {
|
|
859
|
+
if (typeof name2 == "string") {
|
|
860
|
+
variant === void 0 ? variant = null : variant !== null && typeof variant != "string" && (variant = _$safeJsonStringify_31(variant));
|
|
861
|
+
var existingIndex = existingFeatureKeys[name2];
|
|
862
|
+
if (typeof existingIndex == "number") {
|
|
863
|
+
existingFeatures[existingIndex] = {
|
|
864
|
+
name: name2,
|
|
865
|
+
variant
|
|
866
|
+
};
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
existingFeatures.push({
|
|
870
|
+
name: name2,
|
|
871
|
+
variant
|
|
872
|
+
}), existingFeatureKeys[name2] = existingFeatures.length - 1;
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
function merge(existingFeatures, newFeatures, existingFeatureKeys) {
|
|
876
|
+
if (_$isArray_13(newFeatures)) {
|
|
877
|
+
for (var i = 0; i < newFeatures.length; ++i) {
|
|
878
|
+
var feature = newFeatures[i];
|
|
879
|
+
feature === null || typeof feature != "object" || add(existingFeatures, existingFeatureKeys, feature.name, feature.variant);
|
|
880
|
+
}
|
|
881
|
+
return existingFeatures;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function toEventApi(featureFlags) {
|
|
885
|
+
return _$map_15(_$filter_11(featureFlags, Boolean), function(_ref) {
|
|
886
|
+
var name2 = _ref.name, variant = _ref.variant, flag = {
|
|
887
|
+
featureFlag: name2
|
|
888
|
+
};
|
|
889
|
+
return typeof variant == "string" && (flag.variant = variant), flag;
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
function clear(features, featuresIndex, name2) {
|
|
893
|
+
var existingIndex = featuresIndex[name2];
|
|
894
|
+
typeof existingIndex == "number" && (features[existingIndex] = null, delete featuresIndex[name2]);
|
|
895
|
+
}
|
|
896
|
+
var _$featureFlagDelegate_17 = {
|
|
897
|
+
add,
|
|
898
|
+
clear,
|
|
899
|
+
merge,
|
|
900
|
+
toEventApi
|
|
901
|
+
}, _$hasStack_18 = function(err) {
|
|
902
|
+
return !!err && (!!err.stack || !!err.stacktrace || !!err["opera#sourceloc"]) && typeof (err.stack || err.stacktrace || err["opera#sourceloc"]) == "string" && err.stack !== err.name + ": " + err.message;
|
|
903
|
+
}, _$iserror_19 = require_iserror(), __add_21 = function(state, section, keyOrObj, maybeVal) {
|
|
904
|
+
var _updates;
|
|
905
|
+
if (section) {
|
|
906
|
+
var updates;
|
|
907
|
+
if (keyOrObj === null)
|
|
908
|
+
return __clear_21(state, section);
|
|
909
|
+
typeof keyOrObj == "object" && (updates = keyOrObj), typeof keyOrObj == "string" && (updates = (_updates = {}, _updates[keyOrObj] = maybeVal, _updates)), updates && (section === "__proto__" || section === "constructor" || section === "prototype" || (state[section] || (state[section] = {}), state[section] = _$assign_10({}, state[section], updates)));
|
|
910
|
+
}
|
|
911
|
+
}, get = function(state, section, key) {
|
|
912
|
+
if (typeof section == "string") {
|
|
913
|
+
if (!key)
|
|
914
|
+
return state[section];
|
|
915
|
+
if (state[section])
|
|
916
|
+
return state[section][key];
|
|
917
|
+
}
|
|
918
|
+
}, __clear_21 = function(state, section, key) {
|
|
919
|
+
if (typeof section == "string") {
|
|
920
|
+
if (!key) {
|
|
921
|
+
delete state[section];
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
section === "__proto__" || section === "constructor" || section === "prototype" || state[section] && delete state[section][key];
|
|
925
|
+
}
|
|
926
|
+
}, _$metadataDelegate_21 = {
|
|
927
|
+
add: __add_21,
|
|
928
|
+
get,
|
|
929
|
+
clear: __clear_21
|
|
930
|
+
}, StackGenerator = require_stack_generator(), Event2 = /* @__PURE__ */ function() {
|
|
931
|
+
function Event3(errorClass, errorMessage, stacktrace, handledState, originalError) {
|
|
932
|
+
stacktrace === void 0 && (stacktrace = []), handledState === void 0 && (handledState = defaultHandledState()), this.apiKey = void 0, this.context = void 0, this.groupingHash = void 0, this.originalError = originalError, this._handledState = handledState, this.severity = this._handledState.severity, this.unhandled = this._handledState.unhandled, this.app = {}, this.device = {}, this.request = {}, this.breadcrumbs = [], this.threads = [], this._metadata = {}, this._features = [], this._featuresIndex = {}, this._user = {}, this._session = void 0, this.errors = [createBugsnagError(errorClass, errorMessage, Event3.__type, stacktrace)];
|
|
933
|
+
}
|
|
934
|
+
var _proto = Event3.prototype;
|
|
935
|
+
return _proto.addMetadata = function(section, keyOrObj, maybeVal) {
|
|
936
|
+
return _$metadataDelegate_21.add(this._metadata, section, keyOrObj, maybeVal);
|
|
937
|
+
}, _proto.getMetadata = function(section, key) {
|
|
938
|
+
return _$metadataDelegate_21.get(this._metadata, section, key);
|
|
939
|
+
}, _proto.clearMetadata = function(section, key) {
|
|
940
|
+
return _$metadataDelegate_21.clear(this._metadata, section, key);
|
|
941
|
+
}, _proto.addFeatureFlag = function(name2, variant) {
|
|
942
|
+
variant === void 0 && (variant = null), _$featureFlagDelegate_17.add(this._features, this._featuresIndex, name2, variant);
|
|
943
|
+
}, _proto.addFeatureFlags = function(featureFlags) {
|
|
944
|
+
_$featureFlagDelegate_17.merge(this._features, featureFlags, this._featuresIndex);
|
|
945
|
+
}, _proto.getFeatureFlags = function() {
|
|
946
|
+
return _$featureFlagDelegate_17.toEventApi(this._features);
|
|
947
|
+
}, _proto.clearFeatureFlag = function(name2) {
|
|
948
|
+
_$featureFlagDelegate_17.clear(this._features, this._featuresIndex, name2);
|
|
949
|
+
}, _proto.clearFeatureFlags = function() {
|
|
950
|
+
this._features = [], this._featuresIndex = {};
|
|
951
|
+
}, _proto.getUser = function() {
|
|
952
|
+
return this._user;
|
|
953
|
+
}, _proto.setUser = function(id, email, name2) {
|
|
954
|
+
this._user = {
|
|
955
|
+
id,
|
|
956
|
+
email,
|
|
957
|
+
name: name2
|
|
958
|
+
};
|
|
959
|
+
}, _proto.toJSON = function() {
|
|
960
|
+
return {
|
|
961
|
+
payloadVersion: "4",
|
|
962
|
+
exceptions: _$map_15(this.errors, function(er) {
|
|
963
|
+
return _$assign_10({}, er, {
|
|
964
|
+
message: er.errorMessage
|
|
965
|
+
});
|
|
966
|
+
}),
|
|
967
|
+
severity: this.severity,
|
|
968
|
+
unhandled: this._handledState.unhandled,
|
|
969
|
+
severityReason: this._handledState.severityReason,
|
|
970
|
+
app: this.app,
|
|
971
|
+
device: this.device,
|
|
972
|
+
request: this.request,
|
|
973
|
+
breadcrumbs: this.breadcrumbs,
|
|
974
|
+
context: this.context,
|
|
975
|
+
groupingHash: this.groupingHash,
|
|
976
|
+
metaData: this._metadata,
|
|
977
|
+
user: this._user,
|
|
978
|
+
session: this._session,
|
|
979
|
+
featureFlags: this.getFeatureFlags()
|
|
980
|
+
};
|
|
981
|
+
}, Event3;
|
|
982
|
+
}(), formatStackframe = function(frame) {
|
|
983
|
+
var f = {
|
|
984
|
+
file: frame.fileName,
|
|
985
|
+
method: normaliseFunctionName(frame.functionName),
|
|
986
|
+
lineNumber: frame.lineNumber,
|
|
987
|
+
columnNumber: frame.columnNumber,
|
|
988
|
+
code: void 0,
|
|
989
|
+
inProject: void 0
|
|
990
|
+
};
|
|
991
|
+
return f.lineNumber > -1 && !f.file && !f.method && (f.file = "global code"), f;
|
|
992
|
+
}, normaliseFunctionName = function(name2) {
|
|
993
|
+
return /^global code$/i.test(name2) ? "global code" : name2;
|
|
994
|
+
}, defaultHandledState = function() {
|
|
995
|
+
return {
|
|
996
|
+
unhandled: !1,
|
|
997
|
+
severity: "warning",
|
|
998
|
+
severityReason: {
|
|
999
|
+
type: "handledException"
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
}, ensureString = function(str) {
|
|
1003
|
+
return typeof str == "string" ? str : "";
|
|
1004
|
+
};
|
|
1005
|
+
function createBugsnagError(errorClass, errorMessage, type, stacktrace) {
|
|
1006
|
+
return {
|
|
1007
|
+
errorClass: ensureString(errorClass),
|
|
1008
|
+
errorMessage: ensureString(errorMessage),
|
|
1009
|
+
type,
|
|
1010
|
+
stacktrace: _$reduce_16(stacktrace, function(accum, frame) {
|
|
1011
|
+
var f = formatStackframe(frame);
|
|
1012
|
+
try {
|
|
1013
|
+
return JSON.stringify(f) === "{}" ? accum : accum.concat(f);
|
|
1014
|
+
} catch {
|
|
1015
|
+
return accum;
|
|
1016
|
+
}
|
|
1017
|
+
}, [])
|
|
1018
|
+
};
|
|
1019
|
+
}
|
|
1020
|
+
function getCauseStack(error) {
|
|
1021
|
+
return error.cause ? [error].concat(getCauseStack(error.cause)) : [error];
|
|
1022
|
+
}
|
|
1023
|
+
Event2.getStacktrace = function(error, errorFramesToSkip, backtraceFramesToSkip) {
|
|
1024
|
+
if (_$hasStack_18(error))
|
|
1025
|
+
return _$errorStackParser_9.parse(error).slice(errorFramesToSkip);
|
|
1026
|
+
try {
|
|
1027
|
+
return _$filter_11(StackGenerator.backtrace(), function(frame) {
|
|
1028
|
+
return (frame.functionName || "").indexOf("StackGenerator$$") === -1;
|
|
1029
|
+
}).slice(1 + backtraceFramesToSkip);
|
|
1030
|
+
} catch {
|
|
1031
|
+
return [];
|
|
1032
|
+
}
|
|
1033
|
+
}, Event2.create = function(maybeError, tolerateNonErrors, handledState, component, errorFramesToSkip, logger) {
|
|
1034
|
+
errorFramesToSkip === void 0 && (errorFramesToSkip = 0);
|
|
1035
|
+
var _normaliseError = normaliseError(maybeError, tolerateNonErrors, component, logger), error = _normaliseError[0], internalFrames = _normaliseError[1], event;
|
|
1036
|
+
try {
|
|
1037
|
+
var stacktrace = Event2.getStacktrace(
|
|
1038
|
+
error,
|
|
1039
|
+
// if an error was created/throw in the normaliseError() function, we need to
|
|
1040
|
+
// tell the getStacktrace() function to skip the number of frames we know will
|
|
1041
|
+
// be from our own functions. This is added to the number of frames deep we
|
|
1042
|
+
// were told about
|
|
1043
|
+
internalFrames > 0 ? 1 + internalFrames + errorFramesToSkip : 0,
|
|
1044
|
+
// if there's no stacktrace, the callstack may be walked to generated one.
|
|
1045
|
+
// this is how many frames should be removed because they come from our library
|
|
1046
|
+
1 + errorFramesToSkip
|
|
1047
|
+
);
|
|
1048
|
+
event = new Event2(error.name, error.message, stacktrace, handledState, maybeError);
|
|
1049
|
+
} catch {
|
|
1050
|
+
event = new Event2(error.name, error.message, [], handledState, maybeError);
|
|
1051
|
+
}
|
|
1052
|
+
if (error.name === "InvalidError" && event.addMetadata("" + component, "non-error parameter", makeSerialisable(maybeError)), error.cause) {
|
|
1053
|
+
var _event$errors, causes = getCauseStack(error).slice(1), normalisedCauses = _$map_15(causes, function(cause) {
|
|
1054
|
+
var stacktrace2 = _$iserror_19(cause) && _$hasStack_18(cause) ? _$errorStackParser_9.parse(cause) : [], _normaliseError2 = normaliseError(cause, !0, "error cause"), error2 = _normaliseError2[0];
|
|
1055
|
+
return error2.name === "InvalidError" && event.addMetadata("error cause", makeSerialisable(cause)), createBugsnagError(error2.name, error2.message, Event2.__type, stacktrace2);
|
|
1056
|
+
});
|
|
1057
|
+
(_event$errors = event.errors).push.apply(_event$errors, normalisedCauses);
|
|
1058
|
+
}
|
|
1059
|
+
return event;
|
|
1060
|
+
};
|
|
1061
|
+
var makeSerialisable = function(err) {
|
|
1062
|
+
return err === null ? "null" : err === void 0 ? "undefined" : err;
|
|
1063
|
+
}, normaliseError = function(maybeError, tolerateNonErrors, component, logger) {
|
|
1064
|
+
var error, internalFrames = 0, createAndLogInputError = function(reason) {
|
|
1065
|
+
var verb = component === "error cause" ? "was" : "received";
|
|
1066
|
+
logger && logger.warn(component + " " + verb + ' a non-error: "' + reason + '"');
|
|
1067
|
+
var err = new Error(component + " " + verb + ' a non-error. See "' + component + '" tab for more detail.');
|
|
1068
|
+
return err.name = "InvalidError", err;
|
|
1069
|
+
};
|
|
1070
|
+
if (!tolerateNonErrors)
|
|
1071
|
+
_$iserror_19(maybeError) ? error = maybeError : (error = createAndLogInputError(typeof maybeError), internalFrames += 2);
|
|
1072
|
+
else
|
|
1073
|
+
switch (typeof maybeError) {
|
|
1074
|
+
case "string":
|
|
1075
|
+
case "number":
|
|
1076
|
+
case "boolean":
|
|
1077
|
+
error = new Error(String(maybeError)), internalFrames += 1;
|
|
1078
|
+
break;
|
|
1079
|
+
case "function":
|
|
1080
|
+
error = createAndLogInputError("function"), internalFrames += 2;
|
|
1081
|
+
break;
|
|
1082
|
+
case "object":
|
|
1083
|
+
maybeError !== null && _$iserror_19(maybeError) ? error = maybeError : maybeError !== null && hasNecessaryFields(maybeError) ? (error = new Error(maybeError.message || maybeError.errorMessage), error.name = maybeError.name || maybeError.errorClass, internalFrames += 1) : (error = createAndLogInputError(maybeError === null ? "null" : "unsupported object"), internalFrames += 2);
|
|
1084
|
+
break;
|
|
1085
|
+
default:
|
|
1086
|
+
error = createAndLogInputError("nothing"), internalFrames += 2;
|
|
1087
|
+
}
|
|
1088
|
+
if (!_$hasStack_18(error))
|
|
1089
|
+
try {
|
|
1090
|
+
throw error;
|
|
1091
|
+
} catch (e) {
|
|
1092
|
+
_$hasStack_18(e) && (error = e, internalFrames = 1);
|
|
1093
|
+
}
|
|
1094
|
+
return [error, internalFrames];
|
|
1095
|
+
};
|
|
1096
|
+
Event2.__type = "browserjs";
|
|
1097
|
+
var hasNecessaryFields = function(error) {
|
|
1098
|
+
return (typeof error.name == "string" || typeof error.errorClass == "string") && (typeof error.message == "string" || typeof error.errorMessage == "string");
|
|
1099
|
+
}, _$Event_4 = Event2, _$asyncEvery_5 = function(arr, fn, cb) {
|
|
1100
|
+
var index = 0, next = function() {
|
|
1101
|
+
if (index >= arr.length)
|
|
1102
|
+
return cb(null, !0);
|
|
1103
|
+
fn(arr[index], function(err, result) {
|
|
1104
|
+
if (err)
|
|
1105
|
+
return cb(err);
|
|
1106
|
+
if (result === !1)
|
|
1107
|
+
return cb(null, !1);
|
|
1108
|
+
index++, next();
|
|
1109
|
+
});
|
|
1110
|
+
};
|
|
1111
|
+
next();
|
|
1112
|
+
}, _$callbackRunner_7 = function(callbacks, event, onCallbackError, cb) {
|
|
1113
|
+
var runMaybeAsyncCallback = function(fn, cb2) {
|
|
1114
|
+
if (typeof fn != "function")
|
|
1115
|
+
return cb2(null);
|
|
1116
|
+
try {
|
|
1117
|
+
if (fn.length !== 2) {
|
|
1118
|
+
var ret = fn(event);
|
|
1119
|
+
return ret && typeof ret.then == "function" ? ret.then(
|
|
1120
|
+
// resolve
|
|
1121
|
+
function(val) {
|
|
1122
|
+
return setTimeout(function() {
|
|
1123
|
+
return cb2(null, val);
|
|
1124
|
+
});
|
|
1125
|
+
},
|
|
1126
|
+
// reject
|
|
1127
|
+
function(err) {
|
|
1128
|
+
setTimeout(function() {
|
|
1129
|
+
return onCallbackError(err), cb2(null, !0);
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
) : cb2(null, ret);
|
|
1133
|
+
}
|
|
1134
|
+
fn(event, function(err, result) {
|
|
1135
|
+
if (err)
|
|
1136
|
+
return onCallbackError(err), cb2(null);
|
|
1137
|
+
cb2(null, result);
|
|
1138
|
+
});
|
|
1139
|
+
} catch (e) {
|
|
1140
|
+
onCallbackError(e), cb2(null);
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
_$asyncEvery_5(callbacks, runMaybeAsyncCallback, cb);
|
|
1144
|
+
}, _$syncCallbackRunner_24 = function(callbacks, callbackArg, callbackType, logger) {
|
|
1145
|
+
for (var ignore = !1, cbs = callbacks.slice(); !ignore && cbs.length; )
|
|
1146
|
+
try {
|
|
1147
|
+
ignore = cbs.pop()(callbackArg) === !1;
|
|
1148
|
+
} catch (e) {
|
|
1149
|
+
logger.error("Error occurred in " + callbackType + " callback, continuing anyway\u2026"), logger.error(e);
|
|
1150
|
+
}
|
|
1151
|
+
return ignore;
|
|
1152
|
+
}, _$pad_30 = function(num, size) {
|
|
1153
|
+
var s = "000000000" + num;
|
|
1154
|
+
return s.substr(s.length - size);
|
|
1155
|
+
}, os = __require("os"), padding = 2, pid = _$pad_30(process.pid.toString(36), padding), hostname = os.hostname(), length = hostname.length, hostId = _$pad_30(hostname.split("").reduce(function(prev, char) {
|
|
1156
|
+
return +prev + char.charCodeAt(0);
|
|
1157
|
+
}, +length + 36).toString(36), padding), _$fingerprint_29 = function() {
|
|
1158
|
+
return pid + hostId;
|
|
1159
|
+
}, c = 0, blockSize = 4, base = 36, discreteValues = Math.pow(base, blockSize);
|
|
1160
|
+
function randomBlock() {
|
|
1161
|
+
return _$pad_30((Math.random() * discreteValues << 0).toString(base), blockSize);
|
|
1162
|
+
}
|
|
1163
|
+
function safeCounter() {
|
|
1164
|
+
return c = c < discreteValues ? c : 0, c++, c - 1;
|
|
1165
|
+
}
|
|
1166
|
+
function cuid() {
|
|
1167
|
+
var letter = "c", timestamp = (/* @__PURE__ */ new Date()).getTime().toString(base), counter = _$pad_30(safeCounter().toString(base), blockSize), print = _$fingerprint_29(), random = randomBlock() + randomBlock();
|
|
1168
|
+
return letter + timestamp + counter + print + random;
|
|
1169
|
+
}
|
|
1170
|
+
cuid.fingerprint = _$fingerprint_29;
|
|
1171
|
+
var _$cuid_28 = cuid, Session = /* @__PURE__ */ function() {
|
|
1172
|
+
function Session2() {
|
|
1173
|
+
this.id = _$cuid_28(), this.startedAt = /* @__PURE__ */ new Date(), this._handled = 0, this._unhandled = 0, this._user = {}, this.app = {}, this.device = {};
|
|
1174
|
+
}
|
|
1175
|
+
var _proto = Session2.prototype;
|
|
1176
|
+
return _proto.getUser = function() {
|
|
1177
|
+
return this._user;
|
|
1178
|
+
}, _proto.setUser = function(id, email, name2) {
|
|
1179
|
+
this._user = {
|
|
1180
|
+
id,
|
|
1181
|
+
email,
|
|
1182
|
+
name: name2
|
|
1183
|
+
};
|
|
1184
|
+
}, _proto.toJSON = function() {
|
|
1185
|
+
return {
|
|
1186
|
+
id: this.id,
|
|
1187
|
+
startedAt: this.startedAt,
|
|
1188
|
+
events: {
|
|
1189
|
+
handled: this._handled,
|
|
1190
|
+
unhandled: this._unhandled
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
}, _proto._track = function(event) {
|
|
1194
|
+
this[event._handledState.unhandled ? "_unhandled" : "_handled"] += 1;
|
|
1195
|
+
}, Session2;
|
|
1196
|
+
}(), _$Session_32 = Session, __add_2 = _$featureFlagDelegate_17.add, __clear_2 = _$featureFlagDelegate_17.clear, __merge_2 = _$featureFlagDelegate_17.merge, noop = function() {
|
|
1197
|
+
}, Client = /* @__PURE__ */ function() {
|
|
1198
|
+
function Client2(configuration, schema2, internalPlugins2, notifier) {
|
|
1199
|
+
var _this = this;
|
|
1200
|
+
schema2 === void 0 && (schema2 = _$config_3.schema), internalPlugins2 === void 0 && (internalPlugins2 = []), this._notifier = notifier, this._config = {}, this._schema = schema2, this._delivery = {
|
|
1201
|
+
sendSession: noop,
|
|
1202
|
+
sendEvent: noop
|
|
1203
|
+
}, this._logger = {
|
|
1204
|
+
debug: noop,
|
|
1205
|
+
info: noop,
|
|
1206
|
+
warn: noop,
|
|
1207
|
+
error: noop
|
|
1208
|
+
}, this._plugins = {}, this._breadcrumbs = [], this._session = null, this._metadata = {}, this._featuresIndex = {}, this._features = [], this._context = void 0, this._user = {}, this._cbs = {
|
|
1209
|
+
e: [],
|
|
1210
|
+
s: [],
|
|
1211
|
+
sp: [],
|
|
1212
|
+
b: []
|
|
1213
|
+
}, this.Client = Client2, this.Event = _$Event_4, this.Breadcrumb = _$Breadcrumb_1, this.Session = _$Session_32, this._config = this._configure(configuration, internalPlugins2), _$map_15(internalPlugins2.concat(this._config.plugins), function(pl) {
|
|
1214
|
+
pl && _this._loadPlugin(pl);
|
|
1215
|
+
}), this._depth = 1;
|
|
1216
|
+
var self2 = this, notify = this.notify;
|
|
1217
|
+
this.notify = function() {
|
|
1218
|
+
return notify.apply(self2, arguments);
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
var _proto = Client2.prototype;
|
|
1222
|
+
return _proto.addMetadata = function(section, keyOrObj, maybeVal) {
|
|
1223
|
+
return _$metadataDelegate_21.add(this._metadata, section, keyOrObj, maybeVal);
|
|
1224
|
+
}, _proto.getMetadata = function(section, key) {
|
|
1225
|
+
return _$metadataDelegate_21.get(this._metadata, section, key);
|
|
1226
|
+
}, _proto.clearMetadata = function(section, key) {
|
|
1227
|
+
return _$metadataDelegate_21.clear(this._metadata, section, key);
|
|
1228
|
+
}, _proto.addFeatureFlag = function(name2, variant) {
|
|
1229
|
+
variant === void 0 && (variant = null), __add_2(this._features, this._featuresIndex, name2, variant);
|
|
1230
|
+
}, _proto.addFeatureFlags = function(featureFlags) {
|
|
1231
|
+
__merge_2(this._features, featureFlags, this._featuresIndex);
|
|
1232
|
+
}, _proto.clearFeatureFlag = function(name2) {
|
|
1233
|
+
__clear_2(this._features, this._featuresIndex, name2);
|
|
1234
|
+
}, _proto.clearFeatureFlags = function() {
|
|
1235
|
+
this._features = [], this._featuresIndex = {};
|
|
1236
|
+
}, _proto.getContext = function() {
|
|
1237
|
+
return this._context;
|
|
1238
|
+
}, _proto.setContext = function(c2) {
|
|
1239
|
+
this._context = c2;
|
|
1240
|
+
}, _proto._configure = function(opts, internalPlugins2) {
|
|
1241
|
+
var schema2 = _$reduce_16(internalPlugins2, function(schema3, plugin) {
|
|
1242
|
+
return plugin && plugin.configSchema ? _$assign_10({}, schema3, plugin.configSchema) : schema3;
|
|
1243
|
+
}, this._schema), _reduce = _$reduce_16(_$keys_14(schema2), function(accum, key) {
|
|
1244
|
+
var defaultValue = schema2[key].defaultValue(opts[key]);
|
|
1245
|
+
if (opts[key] !== void 0) {
|
|
1246
|
+
var valid = schema2[key].validate(opts[key]);
|
|
1247
|
+
valid ? schema2[key].allowPartialObject ? accum.config[key] = _$assign_10(defaultValue, opts[key]) : accum.config[key] = opts[key] : (accum.errors[key] = schema2[key].message, accum.config[key] = defaultValue);
|
|
1248
|
+
} else
|
|
1249
|
+
accum.config[key] = defaultValue;
|
|
1250
|
+
return accum;
|
|
1251
|
+
}, {
|
|
1252
|
+
errors: {},
|
|
1253
|
+
config: {}
|
|
1254
|
+
}), errors = _reduce.errors, config = _reduce.config;
|
|
1255
|
+
if (schema2.apiKey) {
|
|
1256
|
+
if (!config.apiKey)
|
|
1257
|
+
throw new Error("No Bugsnag API Key set");
|
|
1258
|
+
/^[0-9a-f]{32}$/i.test(config.apiKey) || (errors.apiKey = "should be a string of 32 hexadecimal characters");
|
|
1259
|
+
}
|
|
1260
|
+
return this._metadata = _$assign_10({}, config.metadata), __merge_2(this._features, config.featureFlags, this._featuresIndex), this._user = _$assign_10({}, config.user), this._context = config.context, config.logger && (this._logger = config.logger), config.onError && (this._cbs.e = this._cbs.e.concat(config.onError)), config.onBreadcrumb && (this._cbs.b = this._cbs.b.concat(config.onBreadcrumb)), config.onSession && (this._cbs.s = this._cbs.s.concat(config.onSession)), _$keys_14(errors).length && this._logger.warn(generateConfigErrorMessage(errors, opts)), config;
|
|
1261
|
+
}, _proto.getUser = function() {
|
|
1262
|
+
return this._user;
|
|
1263
|
+
}, _proto.setUser = function(id, email, name2) {
|
|
1264
|
+
this._user = {
|
|
1265
|
+
id,
|
|
1266
|
+
email,
|
|
1267
|
+
name: name2
|
|
1268
|
+
};
|
|
1269
|
+
}, _proto._loadPlugin = function(plugin) {
|
|
1270
|
+
var result = plugin.load(this);
|
|
1271
|
+
return plugin.name && (this._plugins["~" + plugin.name + "~"] = result), this;
|
|
1272
|
+
}, _proto.getPlugin = function(name2) {
|
|
1273
|
+
return this._plugins["~" + name2 + "~"];
|
|
1274
|
+
}, _proto._setDelivery = function(d) {
|
|
1275
|
+
this._delivery = d(this);
|
|
1276
|
+
}, _proto.startSession = function() {
|
|
1277
|
+
var session = new _$Session_32();
|
|
1278
|
+
session.app.releaseStage = this._config.releaseStage, session.app.version = this._config.appVersion, session.app.type = this._config.appType, session._user = _$assign_10({}, this._user);
|
|
1279
|
+
var ignore = _$syncCallbackRunner_24(this._cbs.s, session, "onSession", this._logger);
|
|
1280
|
+
return ignore ? (this._logger.debug("Session not started due to onSession callback"), this) : this._sessionDelegate.startSession(this, session);
|
|
1281
|
+
}, _proto.addOnError = function(fn, front) {
|
|
1282
|
+
front === void 0 && (front = !1), this._cbs.e[front ? "unshift" : "push"](fn);
|
|
1283
|
+
}, _proto.removeOnError = function(fn) {
|
|
1284
|
+
this._cbs.e = _$filter_11(this._cbs.e, function(f) {
|
|
1285
|
+
return f !== fn;
|
|
1286
|
+
});
|
|
1287
|
+
}, _proto._addOnSessionPayload = function(fn) {
|
|
1288
|
+
this._cbs.sp.push(fn);
|
|
1289
|
+
}, _proto.addOnSession = function(fn) {
|
|
1290
|
+
this._cbs.s.push(fn);
|
|
1291
|
+
}, _proto.removeOnSession = function(fn) {
|
|
1292
|
+
this._cbs.s = _$filter_11(this._cbs.s, function(f) {
|
|
1293
|
+
return f !== fn;
|
|
1294
|
+
});
|
|
1295
|
+
}, _proto.addOnBreadcrumb = function(fn, front) {
|
|
1296
|
+
front === void 0 && (front = !1), this._cbs.b[front ? "unshift" : "push"](fn);
|
|
1297
|
+
}, _proto.removeOnBreadcrumb = function(fn) {
|
|
1298
|
+
this._cbs.b = _$filter_11(this._cbs.b, function(f) {
|
|
1299
|
+
return f !== fn;
|
|
1300
|
+
});
|
|
1301
|
+
}, _proto.pauseSession = function() {
|
|
1302
|
+
return this._sessionDelegate.pauseSession(this);
|
|
1303
|
+
}, _proto.resumeSession = function() {
|
|
1304
|
+
return this._sessionDelegate.resumeSession(this);
|
|
1305
|
+
}, _proto.leaveBreadcrumb = function(message, metadata, type) {
|
|
1306
|
+
if (message = typeof message == "string" ? message : "", type = typeof type == "string" && _$includes_12(_$breadcrumbTypes_6, type) ? type : "manual", metadata = typeof metadata == "object" && metadata !== null ? metadata : {}, !!message) {
|
|
1307
|
+
var crumb = new _$Breadcrumb_1(message, metadata, type), ignore = _$syncCallbackRunner_24(this._cbs.b, crumb, "onBreadcrumb", this._logger);
|
|
1308
|
+
if (ignore) {
|
|
1309
|
+
this._logger.debug("Breadcrumb not attached due to onBreadcrumb callback");
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
this._breadcrumbs.push(crumb), this._breadcrumbs.length > this._config.maxBreadcrumbs && (this._breadcrumbs = this._breadcrumbs.slice(this._breadcrumbs.length - this._config.maxBreadcrumbs));
|
|
1313
|
+
}
|
|
1314
|
+
}, _proto._isBreadcrumbTypeEnabled = function(type) {
|
|
1315
|
+
var types = this._config.enabledBreadcrumbTypes;
|
|
1316
|
+
return types === null || _$includes_12(types, type);
|
|
1317
|
+
}, _proto.notify = function(maybeError, onError, postReportCallback) {
|
|
1318
|
+
postReportCallback === void 0 && (postReportCallback = noop);
|
|
1319
|
+
var event = _$Event_4.create(maybeError, !0, void 0, "notify()", this._depth + 1, this._logger);
|
|
1320
|
+
this._notify(event, onError, postReportCallback);
|
|
1321
|
+
}, _proto._notify = function(event, onError, postReportCallback) {
|
|
1322
|
+
var _this2 = this;
|
|
1323
|
+
if (postReportCallback === void 0 && (postReportCallback = noop), event.app = _$assign_10({}, event.app, {
|
|
1324
|
+
releaseStage: this._config.releaseStage,
|
|
1325
|
+
version: this._config.appVersion,
|
|
1326
|
+
type: this._config.appType
|
|
1327
|
+
}), event.context = event.context || this._context, event._metadata = _$assign_10({}, event._metadata, this._metadata), event._user = _$assign_10({}, event._user, this._user), event.breadcrumbs = this._breadcrumbs.slice(), __merge_2(event._features, this._features, event._featuresIndex), this._config.enabledReleaseStages !== null && !_$includes_12(this._config.enabledReleaseStages, this._config.releaseStage))
|
|
1328
|
+
return this._logger.warn("Event not sent due to releaseStage/enabledReleaseStages configuration"), postReportCallback(null, event);
|
|
1329
|
+
var originalSeverity = event.severity, onCallbackError = function(err) {
|
|
1330
|
+
_this2._logger.error("Error occurred in onError callback, continuing anyway\u2026"), _this2._logger.error(err);
|
|
1331
|
+
}, callbacks = [].concat(this._cbs.e).concat(onError);
|
|
1332
|
+
_$callbackRunner_7(callbacks, event, onCallbackError, function(err, shouldSend) {
|
|
1333
|
+
if (err && onCallbackError(err), !shouldSend)
|
|
1334
|
+
return _this2._logger.debug("Event not sent due to onError callback"), postReportCallback(null, event);
|
|
1335
|
+
_this2._isBreadcrumbTypeEnabled("error") && Client2.prototype.leaveBreadcrumb.call(_this2, event.errors[0].errorClass, {
|
|
1336
|
+
errorClass: event.errors[0].errorClass,
|
|
1337
|
+
errorMessage: event.errors[0].errorMessage,
|
|
1338
|
+
severity: event.severity
|
|
1339
|
+
}, "error"), originalSeverity !== event.severity && (event._handledState.severityReason = {
|
|
1340
|
+
type: "userCallbackSetSeverity"
|
|
1341
|
+
}), event.unhandled !== event._handledState.unhandled && (event._handledState.severityReason.unhandledOverridden = !0, event._handledState.unhandled = event.unhandled), _this2._session && (_this2._session._track(event), event._session = _this2._session), _this2._delivery.sendEvent({
|
|
1342
|
+
apiKey: event.apiKey || _this2._config.apiKey,
|
|
1343
|
+
notifier: _this2._notifier,
|
|
1344
|
+
events: [event]
|
|
1345
|
+
}, function(err2) {
|
|
1346
|
+
return postReportCallback(err2, event);
|
|
1347
|
+
});
|
|
1348
|
+
});
|
|
1349
|
+
}, Client2;
|
|
1350
|
+
}(), generateConfigErrorMessage = function(errors, rawInput) {
|
|
1351
|
+
var er = new Error(`Invalid configuration
|
|
1352
|
+
` + _$map_15(_$keys_14(errors), function(key) {
|
|
1353
|
+
return " - " + key + " " + errors[key] + ", got " + stringify(rawInput[key]);
|
|
1354
|
+
}).join(`
|
|
1355
|
+
|
|
1356
|
+
`));
|
|
1357
|
+
return er;
|
|
1358
|
+
}, stringify = function(val) {
|
|
1359
|
+
switch (typeof val) {
|
|
1360
|
+
case "string":
|
|
1361
|
+
case "number":
|
|
1362
|
+
case "object":
|
|
1363
|
+
return JSON.stringify(val);
|
|
1364
|
+
default:
|
|
1365
|
+
return String(val);
|
|
1366
|
+
}
|
|
1367
|
+
}, _$Client_2 = Client, _$jsonPayload_20 = {}, EVENT_REDACTION_PATHS = ["events.[].metaData", "events.[].breadcrumbs.[].metaData", "events.[].request"];
|
|
1368
|
+
_$jsonPayload_20.event = function(event, redactedKeys) {
|
|
1369
|
+
var payload = _$safeJsonStringify_31(event, null, null, {
|
|
1370
|
+
redactedPaths: EVENT_REDACTION_PATHS,
|
|
1371
|
+
redactedKeys
|
|
1372
|
+
});
|
|
1373
|
+
return payload.length > 1e6 && (event.events[0]._metadata = {
|
|
1374
|
+
notifier: `WARNING!
|
|
1375
|
+
Serialized payload was ` + payload.length / 1e6 + `MB (limit = 1MB)
|
|
1376
|
+
metadata was removed`
|
|
1377
|
+
}, payload = _$safeJsonStringify_31(event, null, null, {
|
|
1378
|
+
redactedPaths: EVENT_REDACTION_PATHS,
|
|
1379
|
+
redactedKeys
|
|
1380
|
+
})), payload;
|
|
1381
|
+
}, _$jsonPayload_20.session = function(session, redactedKeys) {
|
|
1382
|
+
var payload = _$safeJsonStringify_31(session, null, null);
|
|
1383
|
+
return payload;
|
|
1384
|
+
};
|
|
1385
|
+
var http = __require("http"), https = __require("https"), ___require_34 = __require("url"), parse = ___require_34.parse, _$request_34 = function(_ref, cb) {
|
|
1386
|
+
var url2 = _ref.url, headers = _ref.headers, body = _ref.body, agent = _ref.agent, didError = !1, onError = function(err) {
|
|
1387
|
+
didError || (didError = !0, cb(err));
|
|
1388
|
+
}, parsedUrl = parse(url2), secure = parsedUrl.protocol === "https:", transport = secure ? https : http, req = transport.request({
|
|
1389
|
+
method: "POST",
|
|
1390
|
+
hostname: parsedUrl.hostname,
|
|
1391
|
+
port: parsedUrl.port,
|
|
1392
|
+
path: parsedUrl.path,
|
|
1393
|
+
headers,
|
|
1394
|
+
agent
|
|
1395
|
+
});
|
|
1396
|
+
req.on("error", onError), req.on("response", function(res) {
|
|
1397
|
+
bufferResponse(res, function(err, body2) {
|
|
1398
|
+
if (err)
|
|
1399
|
+
return onError(err);
|
|
1400
|
+
if (res.statusCode < 200 || res.statusCode >= 300)
|
|
1401
|
+
return onError(new Error("Bad statusCode from API: " + res.statusCode + `
|
|
1402
|
+
` + body2));
|
|
1403
|
+
cb(null, body2);
|
|
1404
|
+
});
|
|
1405
|
+
}), req.write(body), req.end();
|
|
1406
|
+
}, bufferResponse = function(stream, cb) {
|
|
1407
|
+
var data = "";
|
|
1408
|
+
stream.on("error", cb), stream.setEncoding("utf8"), stream.on("data", function(d) {
|
|
1409
|
+
data += d;
|
|
1410
|
+
}), stream.on("end", function() {
|
|
1411
|
+
return cb(null, data);
|
|
1412
|
+
});
|
|
1413
|
+
}, _$delivery_33 = function(client) {
|
|
1414
|
+
return {
|
|
1415
|
+
sendEvent: function(event, cb) {
|
|
1416
|
+
cb === void 0 && (cb = function() {
|
|
1417
|
+
});
|
|
1418
|
+
var body = _$jsonPayload_20.event(event, client._config.redactedKeys), _cb = function(err) {
|
|
1419
|
+
err && client._logger.error(`Event failed to send\u2026
|
|
1420
|
+
` + (err && err.stack ? err.stack : err), err), body.length > 1e6 && client._logger.warn("Event oversized (" + (body.length / 1e6).toFixed(2) + " MB)"), cb(err);
|
|
1421
|
+
};
|
|
1422
|
+
try {
|
|
1423
|
+
_$request_34({
|
|
1424
|
+
url: client._config.endpoints.notify,
|
|
1425
|
+
headers: {
|
|
1426
|
+
"Content-Type": "application/json",
|
|
1427
|
+
"Bugsnag-Api-Key": event.apiKey || client._config.apiKey,
|
|
1428
|
+
"Bugsnag-Payload-Version": "4",
|
|
1429
|
+
"Bugsnag-Sent-At": (/* @__PURE__ */ new Date()).toISOString()
|
|
1430
|
+
},
|
|
1431
|
+
body,
|
|
1432
|
+
agent: client._config.agent
|
|
1433
|
+
}, function(err, body2) {
|
|
1434
|
+
return _cb(err);
|
|
1435
|
+
});
|
|
1436
|
+
} catch (e) {
|
|
1437
|
+
_cb(e);
|
|
1438
|
+
}
|
|
1439
|
+
},
|
|
1440
|
+
sendSession: function(session, cb) {
|
|
1441
|
+
cb === void 0 && (cb = function() {
|
|
1442
|
+
});
|
|
1443
|
+
var _cb = function(err) {
|
|
1444
|
+
err && client._logger.error(`Session failed to send\u2026
|
|
1445
|
+
` + (err && err.stack ? err.stack : err), err), cb(err);
|
|
1446
|
+
};
|
|
1447
|
+
try {
|
|
1448
|
+
_$request_34({
|
|
1449
|
+
url: client._config.endpoints.sessions,
|
|
1450
|
+
headers: {
|
|
1451
|
+
"Content-Type": "application/json",
|
|
1452
|
+
"Bugsnag-Api-Key": client._config.apiKey,
|
|
1453
|
+
"Bugsnag-Payload-Version": "1",
|
|
1454
|
+
"Bugsnag-Sent-At": (/* @__PURE__ */ new Date()).toISOString()
|
|
1455
|
+
},
|
|
1456
|
+
body: _$jsonPayload_20.session(session, client._config.redactedKeys),
|
|
1457
|
+
agent: client._config.agent
|
|
1458
|
+
}, function(err) {
|
|
1459
|
+
return _cb(err);
|
|
1460
|
+
});
|
|
1461
|
+
} catch (e) {
|
|
1462
|
+
_cb(e);
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
};
|
|
1467
|
+
function _extends() {
|
|
1468
|
+
return _extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
1469
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1470
|
+
var source = arguments[i];
|
|
1471
|
+
for (var key in source)
|
|
1472
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
1473
|
+
}
|
|
1474
|
+
return target;
|
|
1475
|
+
}, _extends.apply(this, arguments);
|
|
1476
|
+
}
|
|
1477
|
+
var schema = _$config_3.schema, __os_35 = __require("os"), _require2 = __require("util"), inspect = _require2.inspect, _$config_35 = {
|
|
1478
|
+
appType: _extends({}, schema.appType, {
|
|
1479
|
+
defaultValue: function() {
|
|
1480
|
+
return "node";
|
|
1481
|
+
}
|
|
1482
|
+
}),
|
|
1483
|
+
projectRoot: {
|
|
1484
|
+
defaultValue: function() {
|
|
1485
|
+
return process.cwd();
|
|
1486
|
+
},
|
|
1487
|
+
validate: function(value) {
|
|
1488
|
+
return value === null || _$stringWithLength_27(value);
|
|
1489
|
+
},
|
|
1490
|
+
message: "should be string"
|
|
1491
|
+
},
|
|
1492
|
+
hostname: {
|
|
1493
|
+
defaultValue: function() {
|
|
1494
|
+
return __os_35.hostname();
|
|
1495
|
+
},
|
|
1496
|
+
message: "should be a string",
|
|
1497
|
+
validate: function(value) {
|
|
1498
|
+
return value === null || _$stringWithLength_27(value);
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1501
|
+
logger: _extends({}, schema.logger, {
|
|
1502
|
+
defaultValue: function() {
|
|
1503
|
+
return getPrefixedConsole();
|
|
1504
|
+
}
|
|
1505
|
+
}),
|
|
1506
|
+
releaseStage: _extends({}, schema.releaseStage, {
|
|
1507
|
+
defaultValue: function() {
|
|
1508
|
+
return process.env.NODE_ENV || "production";
|
|
1509
|
+
}
|
|
1510
|
+
}),
|
|
1511
|
+
agent: {
|
|
1512
|
+
defaultValue: function() {
|
|
1513
|
+
},
|
|
1514
|
+
message: "should be an HTTP(s) agent",
|
|
1515
|
+
validate: function(value) {
|
|
1516
|
+
return value === void 0 || isAgent(value);
|
|
1517
|
+
}
|
|
1518
|
+
},
|
|
1519
|
+
onUncaughtException: {
|
|
1520
|
+
defaultValue: function() {
|
|
1521
|
+
return function(err, event, logger) {
|
|
1522
|
+
logger.error("Uncaught exception" + getContext(event) + `, the process will now terminate\u2026
|
|
1523
|
+
` + printError(err)), process.exit(1);
|
|
1524
|
+
};
|
|
1525
|
+
},
|
|
1526
|
+
message: "should be a function",
|
|
1527
|
+
validate: function(value) {
|
|
1528
|
+
return typeof value == "function";
|
|
1529
|
+
}
|
|
1530
|
+
},
|
|
1531
|
+
onUnhandledRejection: {
|
|
1532
|
+
defaultValue: function() {
|
|
1533
|
+
return function(err, event, logger) {
|
|
1534
|
+
logger.error("Unhandled rejection" + getContext(event) + `\u2026
|
|
1535
|
+
` + printError(err));
|
|
1536
|
+
};
|
|
1537
|
+
},
|
|
1538
|
+
message: "should be a function",
|
|
1539
|
+
validate: function(value) {
|
|
1540
|
+
return typeof value == "function";
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}, printError = function(err) {
|
|
1544
|
+
return err && err.stack ? err.stack : inspect(err);
|
|
1545
|
+
}, getPrefixedConsole = function() {
|
|
1546
|
+
return ["debug", "info", "warn", "error"].reduce(function(accum, method) {
|
|
1547
|
+
var consoleMethod = console[method] || console.log;
|
|
1548
|
+
return accum[method] = consoleMethod.bind(console, "[bugsnag]"), accum;
|
|
1549
|
+
}, {});
|
|
1550
|
+
}, getContext = function(event) {
|
|
1551
|
+
return event.request && Object.keys(event.request).length ? " at " + event.request.httpMethod + " " + (event.request.path || event.request.url) : "";
|
|
1552
|
+
}, isAgent = function(value) {
|
|
1553
|
+
return typeof value == "object" && value !== null || typeof value == "boolean";
|
|
1554
|
+
}, appStart = /* @__PURE__ */ new Date(), reset = function() {
|
|
1555
|
+
appStart = /* @__PURE__ */ new Date();
|
|
1556
|
+
}, _$app_37 = {
|
|
1557
|
+
name: "appDuration",
|
|
1558
|
+
load: function(client) {
|
|
1559
|
+
return client.addOnError(function(event) {
|
|
1560
|
+
var now = /* @__PURE__ */ new Date();
|
|
1561
|
+
event.app.duration = now - appStart;
|
|
1562
|
+
}, !0), {
|
|
1563
|
+
reset
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
}, _$nodeFallbackStack_22 = {};
|
|
1567
|
+
_$nodeFallbackStack_22.getStack = function() {
|
|
1568
|
+
return new Error().stack.split(`
|
|
1569
|
+
`).slice(3).join(`
|
|
1570
|
+
`);
|
|
1571
|
+
}, _$nodeFallbackStack_22.maybeUseFallbackStack = function(err, fallbackStack) {
|
|
1572
|
+
var lines = err.stack.split(`
|
|
1573
|
+
`);
|
|
1574
|
+
return (lines.length === 1 || lines.length === 2 && /at Error \(native\)/.test(lines[1])) && (err.stack = lines[0] + `
|
|
1575
|
+
` + fallbackStack), err;
|
|
1576
|
+
};
|
|
1577
|
+
var _$contextualize_38 = {}, domain = __require("domain"), getStack = _$nodeFallbackStack_22.getStack, maybeUseFallbackStack = _$nodeFallbackStack_22.maybeUseFallbackStack;
|
|
1578
|
+
_$contextualize_38 = {
|
|
1579
|
+
name: "contextualize",
|
|
1580
|
+
load: function(client) {
|
|
1581
|
+
var contextualize = function(fn, onError) {
|
|
1582
|
+
var fallbackStack = getStack(), dom = domain.create();
|
|
1583
|
+
dom.on("error", function(err) {
|
|
1584
|
+
err.stack && maybeUseFallbackStack(err, fallbackStack);
|
|
1585
|
+
var event = client.Event.create(err, !0, {
|
|
1586
|
+
severity: "error",
|
|
1587
|
+
unhandled: !0,
|
|
1588
|
+
severityReason: {
|
|
1589
|
+
type: "unhandledException"
|
|
1590
|
+
}
|
|
1591
|
+
}, "contextualize()", 1);
|
|
1592
|
+
client._notify(event, onError, function(e, event2) {
|
|
1593
|
+
e && client._logger.error("Failed to send event to Bugsnag"), client._config.onUncaughtException(err, event2, client._logger);
|
|
1594
|
+
});
|
|
1595
|
+
}), process.nextTick(function() {
|
|
1596
|
+
return dom.run(fn);
|
|
1597
|
+
});
|
|
1598
|
+
};
|
|
1599
|
+
return contextualize;
|
|
1600
|
+
}
|
|
1601
|
+
}, _$contextualize_38.default = _$contextualize_38;
|
|
1602
|
+
var _$intercept_39 = {}, __getStack_39 = _$nodeFallbackStack_22.getStack, __maybeUseFallbackStack_39 = _$nodeFallbackStack_22.maybeUseFallbackStack;
|
|
1603
|
+
_$intercept_39 = {
|
|
1604
|
+
name: "intercept",
|
|
1605
|
+
load: function(client) {
|
|
1606
|
+
var intercept = function(onError, cb) {
|
|
1607
|
+
onError === void 0 && (onError = function() {
|
|
1608
|
+
}), typeof cb != "function" && (cb = onError, onError = function() {
|
|
1609
|
+
});
|
|
1610
|
+
var fallbackStack = __getStack_39();
|
|
1611
|
+
return function(err) {
|
|
1612
|
+
if (err) {
|
|
1613
|
+
err.stack && __maybeUseFallbackStack_39(err, fallbackStack);
|
|
1614
|
+
var event = client.Event.create(err, !0, {
|
|
1615
|
+
severity: "warning",
|
|
1616
|
+
unhandled: !1,
|
|
1617
|
+
severityReason: {
|
|
1618
|
+
type: "callbackErrorIntercept"
|
|
1619
|
+
}
|
|
1620
|
+
}, "intercept()", 1);
|
|
1621
|
+
client._notify(event, onError);
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
for (var _len = arguments.length, data = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)
|
|
1625
|
+
data[_key - 1] = arguments[_key];
|
|
1626
|
+
cb.apply(void 0, data);
|
|
1627
|
+
};
|
|
1628
|
+
};
|
|
1629
|
+
return intercept;
|
|
1630
|
+
}
|
|
1631
|
+
}, _$intercept_39.default = _$intercept_39;
|
|
1632
|
+
function ___extends_40() {
|
|
1633
|
+
return ___extends_40 = Object.assign ? Object.assign.bind() : function(target) {
|
|
1634
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1635
|
+
var source = arguments[i];
|
|
1636
|
+
for (var key in source)
|
|
1637
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
1638
|
+
}
|
|
1639
|
+
return target;
|
|
1640
|
+
}, ___extends_40.apply(this, arguments);
|
|
1641
|
+
}
|
|
1642
|
+
var __os_40 = __require("os"), _$device_40 = {
|
|
1643
|
+
load: function(client) {
|
|
1644
|
+
var device = {
|
|
1645
|
+
osName: __os_40.platform() + " (" + __os_40.arch() + ")",
|
|
1646
|
+
osVersion: __os_40.release(),
|
|
1647
|
+
totalMemory: __os_40.totalmem(),
|
|
1648
|
+
hostname: client._config.hostname,
|
|
1649
|
+
runtimeVersions: {
|
|
1650
|
+
node: process.versions.node
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
client._addOnSessionPayload(function(sp) {
|
|
1654
|
+
sp.device = ___extends_40({}, sp.device, device);
|
|
1655
|
+
}), client.addOnError(function(event) {
|
|
1656
|
+
event.device = ___extends_40({}, event.device, device, {
|
|
1657
|
+
freeMemory: __os_40.freemem(),
|
|
1658
|
+
time: /* @__PURE__ */ new Date()
|
|
1659
|
+
});
|
|
1660
|
+
}, !0);
|
|
1661
|
+
}
|
|
1662
|
+
}, ___require_23 = __require("path"), join = ___require_23.join, resolve = ___require_23.resolve, _$pathNormalizer_23 = function(p) {
|
|
1663
|
+
return join(resolve(p), "/");
|
|
1664
|
+
}, _$inProject_41 = {
|
|
1665
|
+
load: function(client) {
|
|
1666
|
+
return client.addOnError(function(event) {
|
|
1667
|
+
if (client._config.projectRoot) {
|
|
1668
|
+
var projectRoot = _$pathNormalizer_23(client._config.projectRoot), allFrames = event.errors.reduce(function(accum, er) {
|
|
1669
|
+
return accum.concat(er.stacktrace);
|
|
1670
|
+
}, []);
|
|
1671
|
+
allFrames.map(function(stackframe) {
|
|
1672
|
+
stackframe.inProject = typeof stackframe.file == "string" && stackframe.file.indexOf(projectRoot) === 0 && !/\/node_modules\//.test(stackframe.file);
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
function ___extends_42() {
|
|
1679
|
+
return ___extends_42 = Object.assign ? Object.assign.bind() : function(target) {
|
|
1680
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1681
|
+
var source = arguments[i];
|
|
1682
|
+
for (var key in source)
|
|
1683
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
1684
|
+
}
|
|
1685
|
+
return target;
|
|
1686
|
+
}, ___extends_42.apply(this, arguments);
|
|
1687
|
+
}
|
|
1688
|
+
function _inheritsLoose(subClass, superClass) {
|
|
1689
|
+
subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass, _setPrototypeOf(subClass, superClass);
|
|
1690
|
+
}
|
|
1691
|
+
function _setPrototypeOf(o, p) {
|
|
1692
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o2, p2) {
|
|
1693
|
+
return o2.__proto__ = p2, o2;
|
|
1694
|
+
}, _setPrototypeOf(o, p);
|
|
1695
|
+
}
|
|
1696
|
+
var SURROUNDING_LINES = 3, MAX_LINE_LENGTH = 200, ___require_42 = __require("fs"), createReadStream = ___require_42.createReadStream, ___require2_42 = __require("stream"), Writable = ___require2_42.Writable, pump = require_pump(), byline = require_byline(), path = __require("path"), _$surroundingCode_42 = {
|
|
1697
|
+
load: function(client) {
|
|
1698
|
+
if (client._config.sendCode) {
|
|
1699
|
+
var loadSurroundingCode = function(stackframe, cache) {
|
|
1700
|
+
return new Promise(function(resolve2, reject) {
|
|
1701
|
+
try {
|
|
1702
|
+
if (!stackframe.lineNumber || !stackframe.file)
|
|
1703
|
+
return resolve2(stackframe);
|
|
1704
|
+
var file = path.resolve(client._config.projectRoot, stackframe.file), cacheKey = file + "@" + stackframe.lineNumber;
|
|
1705
|
+
if (cacheKey in cache)
|
|
1706
|
+
return stackframe.code = cache[cacheKey], resolve2(stackframe);
|
|
1707
|
+
getSurroundingCode(file, stackframe.lineNumber, function(err, code) {
|
|
1708
|
+
return err || (stackframe.code = cache[cacheKey] = code), resolve2(stackframe);
|
|
1709
|
+
});
|
|
1710
|
+
} catch {
|
|
1711
|
+
return resolve2(stackframe);
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
};
|
|
1715
|
+
client.addOnError(function(event) {
|
|
1716
|
+
return new Promise(function(resolve2, reject) {
|
|
1717
|
+
var cache = /* @__PURE__ */ Object.create(null), allFrames = event.errors.reduce(function(accum, er) {
|
|
1718
|
+
return accum.concat(er.stacktrace);
|
|
1719
|
+
}, []);
|
|
1720
|
+
pMapSeries(allFrames.map(function(stackframe) {
|
|
1721
|
+
return function() {
|
|
1722
|
+
return loadSurroundingCode(stackframe, cache);
|
|
1723
|
+
};
|
|
1724
|
+
})).then(resolve2).catch(reject);
|
|
1725
|
+
});
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
},
|
|
1729
|
+
configSchema: {
|
|
1730
|
+
sendCode: {
|
|
1731
|
+
defaultValue: function() {
|
|
1732
|
+
return !0;
|
|
1733
|
+
},
|
|
1734
|
+
validate: function(value) {
|
|
1735
|
+
return value === !0 || value === !1;
|
|
1736
|
+
},
|
|
1737
|
+
message: "should be true or false"
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
}, getSurroundingCode = function(file, lineNumber, cb) {
|
|
1741
|
+
var start = lineNumber - SURROUNDING_LINES, end = lineNumber + SURROUNDING_LINES, reader = createReadStream(file, {
|
|
1742
|
+
encoding: "utf8"
|
|
1743
|
+
}), splitter = new byline.LineStream({
|
|
1744
|
+
keepEmptyLines: !0
|
|
1745
|
+
}), slicer = new CodeRange({
|
|
1746
|
+
start,
|
|
1747
|
+
end
|
|
1748
|
+
});
|
|
1749
|
+
slicer.on("done", function() {
|
|
1750
|
+
return reader.destroy();
|
|
1751
|
+
}), pump(reader, splitter, slicer, function(err) {
|
|
1752
|
+
if (err && err.message !== "premature close")
|
|
1753
|
+
return cb(err);
|
|
1754
|
+
cb(null, slicer.getCode());
|
|
1755
|
+
});
|
|
1756
|
+
}, CodeRange = /* @__PURE__ */ function(_Writable) {
|
|
1757
|
+
_inheritsLoose(CodeRange2, _Writable);
|
|
1758
|
+
function CodeRange2(opts) {
|
|
1759
|
+
var _this;
|
|
1760
|
+
return _this = _Writable.call(this, ___extends_42({}, opts, {
|
|
1761
|
+
decodeStrings: !1
|
|
1762
|
+
})) || this, _this._start = opts.start, _this._end = opts.end, _this._n = 0, _this._code = {}, _this;
|
|
1763
|
+
}
|
|
1764
|
+
var _proto = CodeRange2.prototype;
|
|
1765
|
+
return _proto._write = function(chunk, enc, cb) {
|
|
1766
|
+
return this._n++, this._n < this._start ? cb(null) : this._n <= this._end ? (this._code[String(this._n)] = chunk.length <= MAX_LINE_LENGTH ? chunk : chunk.substr(0, MAX_LINE_LENGTH), cb(null)) : (this.emit("done"), cb(null));
|
|
1767
|
+
}, _proto.getCode = function() {
|
|
1768
|
+
return this._code;
|
|
1769
|
+
}, CodeRange2;
|
|
1770
|
+
}(Writable), pMapSeries = function(ps) {
|
|
1771
|
+
return new Promise(function(resolve2, reject) {
|
|
1772
|
+
var res = [];
|
|
1773
|
+
ps.reduce(function(accum, p) {
|
|
1774
|
+
return accum.then(function(r) {
|
|
1775
|
+
return res.push(r), p();
|
|
1776
|
+
});
|
|
1777
|
+
}, Promise.resolve()).then(function(r) {
|
|
1778
|
+
res.push(r);
|
|
1779
|
+
}).then(function() {
|
|
1780
|
+
resolve2(res.slice(1));
|
|
1781
|
+
});
|
|
1782
|
+
});
|
|
1783
|
+
}, _handler, _$uncaughtException_43 = {
|
|
1784
|
+
load: function(client) {
|
|
1785
|
+
client._config.autoDetectErrors && client._config.enabledErrorTypes.unhandledExceptions && (_handler = function(err) {
|
|
1786
|
+
var event = client.Event.create(err, !1, {
|
|
1787
|
+
severity: "error",
|
|
1788
|
+
unhandled: !0,
|
|
1789
|
+
severityReason: {
|
|
1790
|
+
type: "unhandledException"
|
|
1791
|
+
}
|
|
1792
|
+
}, "uncaughtException handler", 1);
|
|
1793
|
+
client._notify(event, function() {
|
|
1794
|
+
}, function(e, event2) {
|
|
1795
|
+
e && client._logger.error("Failed to send event to Bugsnag"), client._config.onUncaughtException(err, event2, client._logger);
|
|
1796
|
+
});
|
|
1797
|
+
}, process.on("uncaughtException", _handler));
|
|
1798
|
+
},
|
|
1799
|
+
destroy: function() {
|
|
1800
|
+
process.removeListener("uncaughtException", _handler);
|
|
1801
|
+
}
|
|
1802
|
+
}, ___handler_44, _$unhandledRejection_44 = {
|
|
1803
|
+
load: function(client) {
|
|
1804
|
+
!client._config.autoDetectErrors || !client._config.enabledErrorTypes.unhandledRejections || (___handler_44 = function(err) {
|
|
1805
|
+
var event = client.Event.create(err, !1, {
|
|
1806
|
+
severity: "error",
|
|
1807
|
+
unhandled: !0,
|
|
1808
|
+
severityReason: {
|
|
1809
|
+
type: "unhandledPromiseRejection"
|
|
1810
|
+
}
|
|
1811
|
+
}, "unhandledRejection handler", 1);
|
|
1812
|
+
return new Promise(function(resolve2) {
|
|
1813
|
+
client._notify(event, function() {
|
|
1814
|
+
}, function(e, event2) {
|
|
1815
|
+
e && client._logger.error("Failed to send event to Bugsnag"), client._config.onUnhandledRejection(err, event2, client._logger), resolve2();
|
|
1816
|
+
});
|
|
1817
|
+
});
|
|
1818
|
+
}, process.prependListener ? process.prependListener("unhandledRejection", ___handler_44) : process.on("unhandledRejection", ___handler_44));
|
|
1819
|
+
},
|
|
1820
|
+
destroy: function() {
|
|
1821
|
+
process.removeListener("unhandledRejection", ___handler_44);
|
|
1822
|
+
}
|
|
1823
|
+
}, _$cloneClient_8 = {}, onCloneCallbacks = [];
|
|
1824
|
+
_$cloneClient_8 = function(client) {
|
|
1825
|
+
var clone = new client.Client({}, {}, [], client._notifier);
|
|
1826
|
+
return clone._config = client._config, clone._breadcrumbs = client._breadcrumbs.slice(), clone._metadata = _$assign_10({}, client._metadata), clone._features = [].concat(client._features), clone._featuresIndex = _$assign_10({}, client._featuresIndex), clone._user = _$assign_10({}, client._user), clone._context = client._context, clone._cbs = {
|
|
1827
|
+
e: client._cbs.e.slice(),
|
|
1828
|
+
s: client._cbs.s.slice(),
|
|
1829
|
+
sp: client._cbs.sp.slice(),
|
|
1830
|
+
b: client._cbs.b.slice()
|
|
1831
|
+
}, clone._logger = client._logger, clone._delivery = client._delivery, clone._sessionDelegate = client._sessionDelegate, onCloneCallbacks.forEach(function(callback) {
|
|
1832
|
+
callback(clone);
|
|
1833
|
+
}), clone;
|
|
1834
|
+
}, _$cloneClient_8.registerCallback = function(callback) {
|
|
1835
|
+
onCloneCallbacks.push(callback);
|
|
1836
|
+
};
|
|
1837
|
+
var _$Backoff_45 = Backoff;
|
|
1838
|
+
function Backoff(opts) {
|
|
1839
|
+
opts = opts || {}, this.ms = opts.min || 100, this.max = opts.max || 1e4, this.factor = opts.factor || 2, this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0, this.attempts = 0;
|
|
1840
|
+
}
|
|
1841
|
+
Backoff.prototype.duration = function() {
|
|
1842
|
+
var ms = this.ms * Math.pow(this.factor, this.attempts++);
|
|
1843
|
+
if (this.jitter) {
|
|
1844
|
+
var rand = Math.random(), deviation = Math.floor(rand * this.jitter * ms);
|
|
1845
|
+
ms = Math.floor(rand * 10) & 1 ? ms + deviation : ms - deviation;
|
|
1846
|
+
}
|
|
1847
|
+
return Math.min(ms, this.max) | 0;
|
|
1848
|
+
}, Backoff.prototype.reset = function() {
|
|
1849
|
+
this.attempts = 0;
|
|
1850
|
+
};
|
|
1851
|
+
function _assertThisInitialized(self2) {
|
|
1852
|
+
if (self2 === void 0)
|
|
1853
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1854
|
+
return self2;
|
|
1855
|
+
}
|
|
1856
|
+
function ___inheritsLoose_47(subClass, superClass) {
|
|
1857
|
+
subClass.prototype = Object.create(superClass.prototype), subClass.prototype.constructor = subClass, ___setPrototypeOf_47(subClass, superClass);
|
|
1858
|
+
}
|
|
1859
|
+
function ___setPrototypeOf_47(o, p) {
|
|
1860
|
+
return ___setPrototypeOf_47 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o2, p2) {
|
|
1861
|
+
return o2.__proto__ = p2, o2;
|
|
1862
|
+
}, ___setPrototypeOf_47(o, p);
|
|
1863
|
+
}
|
|
1864
|
+
var DEFAULT_SUMMARY_INTERVAL = 10 * 1e3, Emitter = __require("events").EventEmitter, _$tracker_47 = /* @__PURE__ */ function(_Emitter) {
|
|
1865
|
+
___inheritsLoose_47(SessionTracker, _Emitter);
|
|
1866
|
+
function SessionTracker(intervalLength) {
|
|
1867
|
+
var _this;
|
|
1868
|
+
return _this = _Emitter.call(this) || this, _this._sessions = /* @__PURE__ */ new Map(), _this._interval = null, _this._intervalLength = intervalLength || DEFAULT_SUMMARY_INTERVAL, _this._summarize = _this._summarize.bind(_assertThisInitialized(_this)), _this;
|
|
1869
|
+
}
|
|
1870
|
+
var _proto = SessionTracker.prototype;
|
|
1871
|
+
return _proto.start = function() {
|
|
1872
|
+
this._interval || (this._interval = setInterval(this._summarize, this._intervalLength).unref());
|
|
1873
|
+
}, _proto.stop = function() {
|
|
1874
|
+
clearInterval(this._interval), this._interval = null;
|
|
1875
|
+
}, _proto.track = function(session) {
|
|
1876
|
+
var key = dateToMsKey(session.startedAt), cur = this._sessions.get(key);
|
|
1877
|
+
return this._sessions.set(key, typeof cur > "u" ? 1 : cur + 1), session;
|
|
1878
|
+
}, _proto._summarize = function() {
|
|
1879
|
+
var _this2 = this, summary = [];
|
|
1880
|
+
this._sessions.forEach(function(val, key) {
|
|
1881
|
+
summary.push({
|
|
1882
|
+
startedAt: key,
|
|
1883
|
+
sessionsStarted: val
|
|
1884
|
+
}), _this2._sessions.delete(key);
|
|
1885
|
+
}), summary.length && this.emit("summary", summary);
|
|
1886
|
+
}, SessionTracker;
|
|
1887
|
+
}(Emitter), dateToMsKey = function(d) {
|
|
1888
|
+
var dk = new Date(d);
|
|
1889
|
+
return dk.setSeconds(0), dk.setMilliseconds(0), dk.toISOString();
|
|
1890
|
+
}, _$session_46 = {
|
|
1891
|
+
load: function(client) {
|
|
1892
|
+
var sessionTracker = new _$tracker_47(client._config.sessionSummaryInterval);
|
|
1893
|
+
sessionTracker.on("summary", sendSessionSummary(client)), sessionTracker.start(), client._sessionDelegate = {
|
|
1894
|
+
startSession: function(client2, session) {
|
|
1895
|
+
var sessionClient = _$cloneClient_8(client2);
|
|
1896
|
+
return sessionClient._session = session, sessionClient._pausedSession = null, sessionTracker.track(sessionClient._session), sessionClient;
|
|
1897
|
+
},
|
|
1898
|
+
pauseSession: function(client2) {
|
|
1899
|
+
client2._pausedSession = client2._session, client2._session = null;
|
|
1900
|
+
},
|
|
1901
|
+
resumeSession: function(client2) {
|
|
1902
|
+
return client2._session ? client2 : client2._pausedSession ? (client2._session = client2._pausedSession, client2._pausedSession = null, client2) : client2.startSession();
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
},
|
|
1906
|
+
configSchema: {
|
|
1907
|
+
sessionSummaryInterval: {
|
|
1908
|
+
defaultValue: function() {
|
|
1909
|
+
},
|
|
1910
|
+
validate: function(value) {
|
|
1911
|
+
return value === void 0 || _$intRange_25()(value);
|
|
1912
|
+
},
|
|
1913
|
+
message: "should be a positive integer"
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}, sendSessionSummary = function(client) {
|
|
1917
|
+
return function(sessionCounts) {
|
|
1918
|
+
if (client._config.enabledReleaseStages !== null && !client._config.enabledReleaseStages.includes(client._config.releaseStage)) {
|
|
1919
|
+
client._logger.warn("Session not sent due to releaseStage/enabledReleaseStages configuration");
|
|
1920
|
+
return;
|
|
1921
|
+
}
|
|
1922
|
+
if (!sessionCounts.length)
|
|
1923
|
+
return;
|
|
1924
|
+
var backoff = new _$Backoff_45({
|
|
1925
|
+
min: 1e3,
|
|
1926
|
+
max: 1e4
|
|
1927
|
+
}), maxAttempts = 10;
|
|
1928
|
+
req(handleRes);
|
|
1929
|
+
function handleRes(err) {
|
|
1930
|
+
if (!err) {
|
|
1931
|
+
var sessionCount = sessionCounts.reduce(function(accum, s) {
|
|
1932
|
+
return accum + s.sessionsStarted;
|
|
1933
|
+
}, 0);
|
|
1934
|
+
return client._logger.debug(sessionCount + " session(s) reported");
|
|
1935
|
+
}
|
|
1936
|
+
if (backoff.attempts === 10) {
|
|
1937
|
+
client._logger.error("Session delivery failed, max retries exceeded", err);
|
|
1938
|
+
return;
|
|
1939
|
+
}
|
|
1940
|
+
client._logger.debug("Session delivery failed, retry #" + (backoff.attempts + 1) + "/" + maxAttempts, err), setTimeout(function() {
|
|
1941
|
+
return req(handleRes);
|
|
1942
|
+
}, backoff.duration());
|
|
1943
|
+
}
|
|
1944
|
+
function req(cb) {
|
|
1945
|
+
var payload = {
|
|
1946
|
+
notifier: client._notifier,
|
|
1947
|
+
device: {},
|
|
1948
|
+
app: {
|
|
1949
|
+
releaseStage: client._config.releaseStage,
|
|
1950
|
+
version: client._config.appVersion,
|
|
1951
|
+
type: client._config.appType
|
|
1952
|
+
},
|
|
1953
|
+
sessionCounts
|
|
1954
|
+
}, ignore = _$syncCallbackRunner_24(client._cbs.sp, payload, "onSessionPayload", client._logger);
|
|
1955
|
+
if (ignore)
|
|
1956
|
+
return client._logger.debug("Session not sent due to onSessionPayload callback"), cb(null);
|
|
1957
|
+
client._delivery.sendSession(payload, cb);
|
|
1958
|
+
}
|
|
1959
|
+
};
|
|
1960
|
+
}, _$pathNormaliser_48 = {
|
|
1961
|
+
load: function(client) {
|
|
1962
|
+
client.addOnError(function(event) {
|
|
1963
|
+
var allFrames = event.errors.reduce(function(accum, er) {
|
|
1964
|
+
return accum.concat(er.stacktrace);
|
|
1965
|
+
}, []);
|
|
1966
|
+
allFrames.forEach(function(stackframe) {
|
|
1967
|
+
typeof stackframe.file == "string" && (stackframe.file = stackframe.file.replace(/\\/g, "/"));
|
|
1968
|
+
});
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
}, _$stripProjectRoot_49 = {
|
|
1972
|
+
load: function(client) {
|
|
1973
|
+
return client.addOnError(function(event) {
|
|
1974
|
+
if (client._config.projectRoot) {
|
|
1975
|
+
var projectRoot = _$pathNormalizer_23(client._config.projectRoot), allFrames = event.errors.reduce(function(accum, er) {
|
|
1976
|
+
return accum.concat(er.stacktrace);
|
|
1977
|
+
}, []);
|
|
1978
|
+
allFrames.map(function(stackframe) {
|
|
1979
|
+
typeof stackframe.file == "string" && stackframe.file.indexOf(projectRoot) === 0 && (stackframe.file = stackframe.file.replace(projectRoot, ""));
|
|
1980
|
+
});
|
|
1981
|
+
}
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1984
|
+
}, _$notifier_36 = {};
|
|
1985
|
+
function ___extends_36() {
|
|
1986
|
+
return ___extends_36 = Object.assign ? Object.assign.bind() : function(target) {
|
|
1987
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1988
|
+
var source = arguments[i];
|
|
1989
|
+
for (var key in source)
|
|
1990
|
+
Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
|
|
1991
|
+
}
|
|
1992
|
+
return target;
|
|
1993
|
+
}, ___extends_36.apply(this, arguments);
|
|
1994
|
+
}
|
|
1995
|
+
var name = "Bugsnag Node", version = "7.22.7", url = "https://github.com/bugsnag/bugsnag-js";
|
|
1996
|
+
_$Event_4.__type = "nodejs";
|
|
1997
|
+
var __schema_36 = ___extends_36({}, _$config_3.schema, _$config_35);
|
|
1998
|
+
delete __schema_36.enabledBreadcrumbTypes;
|
|
1999
|
+
var internalPlugins = [_$app_37, _$surroundingCode_42, _$inProject_41, _$stripProjectRoot_49, _$session_46, _$device_40, _$uncaughtException_43, _$unhandledRejection_44, _$intercept_39, _$contextualize_38, _$pathNormaliser_48], Bugsnag2 = {
|
|
2000
|
+
_client: null,
|
|
2001
|
+
createClient: function(opts) {
|
|
2002
|
+
typeof opts == "string" && (opts = {
|
|
2003
|
+
apiKey: opts
|
|
2004
|
+
}), opts || (opts = {});
|
|
2005
|
+
var bugsnag = new _$Client_2(opts, __schema_36, internalPlugins, {
|
|
2006
|
+
name,
|
|
2007
|
+
version,
|
|
2008
|
+
url
|
|
2009
|
+
});
|
|
2010
|
+
return bugsnag._setDelivery(_$delivery_33), bugsnag._logger.debug("Loaded!"), bugsnag.leaveBreadcrumb = function() {
|
|
2011
|
+
bugsnag._logger.warn("Breadcrumbs are not supported in Node.js yet");
|
|
2012
|
+
}, bugsnag._config.enabledBreadcrumbTypes = [], bugsnag;
|
|
2013
|
+
},
|
|
2014
|
+
start: function(opts) {
|
|
2015
|
+
return Bugsnag2._client ? (Bugsnag2._client._logger.warn("Bugsnag.start() was called more than once. Ignoring."), Bugsnag2._client) : (Bugsnag2._client = Bugsnag2.createClient(opts), Bugsnag2._client);
|
|
2016
|
+
},
|
|
2017
|
+
isStarted: function() {
|
|
2018
|
+
return Bugsnag2._client != null;
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
return Object.keys(_$Client_2.prototype).forEach(function(m) {
|
|
2022
|
+
/^_/.test(m) || (Bugsnag2[m] = function() {
|
|
2023
|
+
if (!Bugsnag2._client)
|
|
2024
|
+
return console.error("Bugsnag." + m + "() was called before Bugsnag.start()");
|
|
2025
|
+
Bugsnag2._client._depth += 1;
|
|
2026
|
+
var ret = Bugsnag2._client[m].apply(Bugsnag2._client, arguments);
|
|
2027
|
+
return Bugsnag2._client._depth -= 1, ret;
|
|
2028
|
+
});
|
|
2029
|
+
}), _$notifier_36 = Bugsnag2, _$notifier_36.Client = _$Client_2, _$notifier_36.Event = _$Event_4, _$notifier_36.Session = _$Session_32, _$notifier_36.Breadcrumb = _$Breadcrumb_1, _$notifier_36.default = Bugsnag2, _$notifier_36;
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
});
|
|
2033
|
+
|
|
2034
|
+
// ../../node_modules/.pnpm/@bugsnag+js@7.21.0/node_modules/@bugsnag/js/node/notifier.js
|
|
2035
|
+
var require_notifier = __commonJS({
|
|
2036
|
+
"../../node_modules/.pnpm/@bugsnag+js@7.21.0/node_modules/@bugsnag/js/node/notifier.js"(exports, module) {
|
|
2037
|
+
init_cjs_shims();
|
|
2038
|
+
module.exports = require_bugsnag();
|
|
2039
|
+
}
|
|
2040
|
+
});
|
|
2041
|
+
|
|
2042
|
+
// ../cli-kit/src/public/node/error-handler.ts
|
|
2043
|
+
init_cjs_shims();
|
|
2044
|
+
var import_core = __toESM(require_lib(), 1), import_stacktracey = __toESM(require_stacktracey(), 1), import_js = __toESM(require_notifier(), 1);
|
|
2045
|
+
import { realpath } from "fs/promises";
|
|
2046
|
+
async function errorHandler(error, config) {
|
|
2047
|
+
if (error instanceof CancelExecution)
|
|
2048
|
+
error.message && error.message !== "" && outputInfo(`\u2728 ${error.message}`);
|
|
2049
|
+
else if (error instanceof AbortSilentError)
|
|
2050
|
+
printEventsJson();
|
|
2051
|
+
else
|
|
2052
|
+
return errorMapper(error).then((error2) => handler(error2)).then((mappedError) => (printEventsJson(), reportError(mappedError, config)));
|
|
2053
|
+
}
|
|
2054
|
+
var reportError = async (error, config) => {
|
|
2055
|
+
let exitMode = "expected_error";
|
|
2056
|
+
shouldReportError(error) && (exitMode = "unexpected_error"), config !== void 0 && await reportAnalyticsEvent({ config, errorMessage: error instanceof Error ? error.message : void 0, exitMode }), await sendErrorToBugsnag(error, exitMode);
|
|
2057
|
+
};
|
|
2058
|
+
async function sendErrorToBugsnag(error, exitMode) {
|
|
2059
|
+
if (import_core.settings.debug)
|
|
2060
|
+
return outputDebug("Skipping Bugsnag report"), { reported: !1, error, unhandled: void 0 };
|
|
2061
|
+
let unhandled = exitMode === "unexpected_error", reportableError, stacktrace, report = !1;
|
|
2062
|
+
error instanceof Error ? (report = !0, reportableError = new Error(error.message), stacktrace = error.stack) : typeof error == "string" && error.trim().length !== 0 ? (report = !0, reportableError = new Error(error), stacktrace = reportableError.stack) : (report = !1, reportableError = new Error("Unknown error"));
|
|
2063
|
+
let formattedStacktrace = new import_stacktracey.default(stacktrace ?? "").clean().items.map((item) => {
|
|
2064
|
+
let filePath = cleanSingleStackTracePath(item.file);
|
|
2065
|
+
return ` at ${item.callee} (${filePath}:${item.line}:${item.column})`;
|
|
2066
|
+
}).join(`
|
|
2067
|
+
`);
|
|
2068
|
+
return reportableError.stack = `Error: ${reportableError.message}
|
|
2069
|
+
${formattedStacktrace}`, report && (initializeBugsnag(), await new Promise((resolve, reject) => {
|
|
2070
|
+
outputDebug(`Reporting ${unhandled ? "unhandled" : "handled"} error to Bugsnag: ${reportableError.message}`);
|
|
2071
|
+
let eventHandler = (event) => {
|
|
2072
|
+
event.severity = "error", event.unhandled = unhandled;
|
|
2073
|
+
}, errorHandler2 = (error2) => {
|
|
2074
|
+
error2 ? reject(error2) : resolve(reportableError);
|
|
2075
|
+
};
|
|
2076
|
+
import_js.default.notify(reportableError, eventHandler, errorHandler2);
|
|
2077
|
+
})), { error: reportableError, reported: report, unhandled };
|
|
2078
|
+
}
|
|
2079
|
+
function cleanStackFrameFilePath({
|
|
2080
|
+
currentFilePath,
|
|
2081
|
+
projectRoot,
|
|
2082
|
+
pluginLocations
|
|
2083
|
+
}) {
|
|
2084
|
+
let fullLocation = isAbsolutePath(currentFilePath) ? currentFilePath : joinPath(projectRoot, currentFilePath), matchingPluginPath = pluginLocations.filter(({ pluginPath }) => fullLocation.indexOf(pluginPath) === 0)[0];
|
|
2085
|
+
return matchingPluginPath !== void 0 ? joinPath(matchingPluginPath.name, relativePath(matchingPluginPath.pluginPath, fullLocation)) : currentFilePath.replace(/.*node_modules\//, "");
|
|
2086
|
+
}
|
|
2087
|
+
async function registerCleanBugsnagErrorsFromWithinPlugins(config) {
|
|
2088
|
+
let bugsnagConfigProjectRoot = import_js.default?._client?._config?.projectRoot ?? cwd(), projectRoot = normalizePath(bugsnagConfigProjectRoot), pluginLocations = await Promise.all(
|
|
2089
|
+
[...config.plugins].map(async ([_, plugin]) => {
|
|
2090
|
+
let followSymlinks = await realpath(plugin.root);
|
|
2091
|
+
return { name: plugin.name, pluginPath: normalizePath(followSymlinks) };
|
|
2092
|
+
})
|
|
2093
|
+
);
|
|
2094
|
+
initializeBugsnag(), import_js.default.addOnError(async (event) => {
|
|
2095
|
+
event.errors.forEach((error) => {
|
|
2096
|
+
error.stacktrace.forEach((stackFrame) => {
|
|
2097
|
+
stackFrame.file = cleanStackFrameFilePath({ currentFilePath: stackFrame.file, projectRoot, pluginLocations });
|
|
2098
|
+
});
|
|
2099
|
+
});
|
|
2100
|
+
try {
|
|
2101
|
+
await addBugsnagMetadata(event, config);
|
|
2102
|
+
} catch (metadataError) {
|
|
2103
|
+
outputDebug(`There was an error adding metadata to the Bugsnag report; Ignoring and carrying on ${metadataError}`);
|
|
2104
|
+
}
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
async function addBugsnagMetadata(event, config) {
|
|
2108
|
+
let publicData = getAllPublicMetadata(), { commandStartOptions } = getAllSensitiveMetadata(), { startCommand } = commandStartOptions ?? {}, { "@shopify/app": appPublic, ...otherPluginsPublic } = await fanoutHooks(config, "public_command_metadata", {}), environment = await getEnvironmentData(config), allMetadata = {
|
|
2109
|
+
command: startCommand,
|
|
2110
|
+
...appPublic,
|
|
2111
|
+
...publicData,
|
|
2112
|
+
...environment,
|
|
2113
|
+
pluginData: otherPluginsPublic
|
|
2114
|
+
}, appData = {}, commandData = {}, environmentData = {}, miscData = {}, appKeys = ["api_key", "partner_id", "project_type"], commandKeys = ["command"], environmentKeys = ["cli_version", "node_version", "ruby_version", "uname"];
|
|
2115
|
+
Object.entries(allMetadata).forEach(([key, value]) => {
|
|
2116
|
+
key.startsWith("app_") || appKeys.includes(key) ? appData[key] = value : key.startsWith("cmd_") || commandKeys.includes(key) ? commandData[key] = value : key.startsWith("env_") || environmentKeys ? environmentData[key] = value : miscData[key] = value;
|
|
2117
|
+
}), Object.entries({
|
|
2118
|
+
"Shopify App": appData,
|
|
2119
|
+
Command: commandData,
|
|
2120
|
+
Environment: environmentData,
|
|
2121
|
+
Misc: miscData
|
|
2122
|
+
}).forEach(([section, values]) => {
|
|
2123
|
+
event.addMetadata(section, values);
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
function initializeBugsnag() {
|
|
2127
|
+
import_js.default.isStarted() || import_js.default.start({
|
|
2128
|
+
appType: "node",
|
|
2129
|
+
apiKey: bugsnagApiKey,
|
|
2130
|
+
logger: null,
|
|
2131
|
+
appVersion: CLI_KIT_VERSION,
|
|
2132
|
+
autoTrackSessions: !1,
|
|
2133
|
+
autoDetectErrors: !1
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
export {
|
|
2138
|
+
errorHandler,
|
|
2139
|
+
sendErrorToBugsnag,
|
|
2140
|
+
cleanStackFrameFilePath,
|
|
2141
|
+
registerCleanBugsnagErrorsFromWithinPlugins,
|
|
2142
|
+
addBugsnagMetadata
|
|
2143
|
+
};
|
|
2144
|
+
//# sourceMappingURL=chunk-GIUM5DCQ.js.map
|