@sentry/bundler-plugin-core 3.4.0 → 3.5.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/cjs/index.js +301 -206
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +300 -206
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/build-plugin-manager.d.ts +20 -80
- package/dist/types/build-plugin-manager.d.ts.map +1 -1
- package/dist/types/debug-id-upload.d.ts +8 -4
- package/dist/types/debug-id-upload.d.ts.map +1 -1
- package/dist/types/options-mapping.d.ts +31 -30
- package/dist/types/options-mapping.d.ts.map +1 -1
- package/dist/types/types.d.ts +23 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var childProcess = require('child_process');
|
|
|
18
18
|
var https = require('node:https');
|
|
19
19
|
var node_stream = require('node:stream');
|
|
20
20
|
var node_zlib = require('node:zlib');
|
|
21
|
+
var url = require('url');
|
|
21
22
|
var util = require('util');
|
|
22
23
|
|
|
23
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -54,6 +55,7 @@ var findUp__default = /*#__PURE__*/_interopDefaultLegacy(findUp);
|
|
|
54
55
|
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
|
55
56
|
var childProcess__default = /*#__PURE__*/_interopDefaultLegacy(childProcess);
|
|
56
57
|
var https__namespace = /*#__PURE__*/_interopNamespace(https);
|
|
58
|
+
var url__namespace = /*#__PURE__*/_interopNamespace(url);
|
|
57
59
|
var util__namespace = /*#__PURE__*/_interopNamespace(util);
|
|
58
60
|
|
|
59
61
|
function ownKeys(object, enumerableOnly) {
|
|
@@ -8193,7 +8195,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
|
8193
8195
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8194
8196
|
tracesSampleRate: 1,
|
|
8195
8197
|
sampleRate: 1,
|
|
8196
|
-
release: "3.
|
|
8198
|
+
release: "3.5.0",
|
|
8197
8199
|
integrations: [],
|
|
8198
8200
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8199
8201
|
stackParser: stackParser,
|
|
@@ -8377,7 +8379,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
8377
8379
|
};
|
|
8378
8380
|
}();
|
|
8379
8381
|
}
|
|
8380
|
-
function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6) {
|
|
8382
|
+
function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6, _x7) {
|
|
8381
8383
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
8382
8384
|
}
|
|
8383
8385
|
|
|
@@ -8388,7 +8390,7 @@ function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6) {
|
|
|
8388
8390
|
* The string pattern is injected via the debug ID injection snipped.
|
|
8389
8391
|
*/
|
|
8390
8392
|
function _prepareBundleForDebugIdUpload() {
|
|
8391
|
-
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook) {
|
|
8393
|
+
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook, resolveSourceMapHook) {
|
|
8392
8394
|
var bundleContent, debugId, uniqueUploadName, writeSourceFilePromise, writeSourceMapFilePromise;
|
|
8393
8395
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8394
8396
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -8417,7 +8419,7 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8417
8419
|
uniqueUploadName = "".concat(debugId, "-").concat(chunkIndex);
|
|
8418
8420
|
bundleContent = addDebugIdToBundleSource(bundleContent, debugId);
|
|
8419
8421
|
writeSourceFilePromise = fs__default["default"].promises.writeFile(path__default["default"].join(uploadFolder, "".concat(uniqueUploadName, ".js")), bundleContent, "utf-8");
|
|
8420
|
-
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
|
|
8422
|
+
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger, resolveSourceMapHook).then( /*#__PURE__*/function () {
|
|
8421
8423
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sourceMapPath) {
|
|
8422
8424
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8423
8425
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -8434,7 +8436,7 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8434
8436
|
}
|
|
8435
8437
|
}, _callee2);
|
|
8436
8438
|
}));
|
|
8437
|
-
return function (
|
|
8439
|
+
return function (_x17) {
|
|
8438
8440
|
return _ref3.apply(this, arguments);
|
|
8439
8441
|
};
|
|
8440
8442
|
}());
|
|
@@ -8476,75 +8478,89 @@ function addDebugIdToBundleSource(bundleSource, debugId) {
|
|
|
8476
8478
|
*
|
|
8477
8479
|
* @returns the path to the bundle's source map or `undefined` if none could be found.
|
|
8478
8480
|
*/
|
|
8479
|
-
function determineSourceMapPathFromBundle(
|
|
8481
|
+
function determineSourceMapPathFromBundle(_x8, _x9, _x10, _x11) {
|
|
8480
8482
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
8481
8483
|
}
|
|
8484
|
+
|
|
8482
8485
|
/**
|
|
8483
8486
|
* Reads a source map, injects debug ID fields, and writes the source map to the target path.
|
|
8484
8487
|
*/
|
|
8485
8488
|
function _determineSourceMapPathFromBundle() {
|
|
8486
|
-
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(bundlePath, bundleSource, logger) {
|
|
8487
|
-
var sourceMappingUrlMatch, sourceMappingUrl,
|
|
8489
|
+
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(bundlePath, bundleSource, logger, resolveSourceMapHook) {
|
|
8490
|
+
var sourceMappingUrlMatch, sourceMappingUrl, searchLocations, customPath, parsedUrl, _i, _searchLocations, searchLocation;
|
|
8488
8491
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8489
8492
|
while (1) switch (_context4.prev = _context4.next) {
|
|
8490
8493
|
case 0:
|
|
8491
|
-
// 1. try to find source map at `sourceMappingURL` location
|
|
8492
8494
|
sourceMappingUrlMatch = bundleSource.match(/^\s*\/\/# sourceMappingURL=(.*)$/m);
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
+
sourceMappingUrl = sourceMappingUrlMatch ? sourceMappingUrlMatch[1] : undefined;
|
|
8496
|
+
searchLocations = [];
|
|
8497
|
+
if (!resolveSourceMapHook) {
|
|
8498
|
+
_context4.next = 10;
|
|
8495
8499
|
break;
|
|
8496
8500
|
}
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8501
|
+
logger.debug("Calling sourcemaps.resolveSourceMap(".concat(JSON.stringify(bundlePath), ", ").concat(JSON.stringify(sourceMappingUrl), ")"));
|
|
8502
|
+
_context4.next = 7;
|
|
8503
|
+
return resolveSourceMapHook(bundlePath, sourceMappingUrl);
|
|
8504
|
+
case 7:
|
|
8505
|
+
customPath = _context4.sent;
|
|
8506
|
+
logger.debug("resolveSourceMap hook returned: ".concat(JSON.stringify(customPath)));
|
|
8507
|
+
if (customPath) {
|
|
8508
|
+
searchLocations.push(customPath);
|
|
8505
8509
|
}
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8510
|
+
case 10:
|
|
8511
|
+
// 1. try to find source map at `sourceMappingURL` location
|
|
8512
|
+
if (sourceMappingUrl) {
|
|
8513
|
+
try {
|
|
8514
|
+
parsedUrl = new URL(sourceMappingUrl);
|
|
8515
|
+
} catch (_unused) {
|
|
8516
|
+
// noop
|
|
8517
|
+
}
|
|
8518
|
+
if (parsedUrl && parsedUrl.protocol === "file:") {
|
|
8519
|
+
searchLocations.push(url__namespace.fileURLToPath(sourceMappingUrl));
|
|
8520
|
+
} else if (parsedUrl) ; else if (path__default["default"].isAbsolute(sourceMappingUrl)) {
|
|
8521
|
+
searchLocations.push(path__default["default"].normalize(sourceMappingUrl));
|
|
8522
|
+
} else {
|
|
8523
|
+
searchLocations.push(path__default["default"].normalize(path__default["default"].join(path__default["default"].dirname(bundlePath), sourceMappingUrl)));
|
|
8524
|
+
}
|
|
8512
8525
|
}
|
|
8513
|
-
|
|
8514
|
-
|
|
8526
|
+
|
|
8527
|
+
// 2. try to find source map at path adjacent to chunk source, but with `.map` appended
|
|
8528
|
+
searchLocations.push(bundlePath + ".map");
|
|
8529
|
+
_i = 0, _searchLocations = searchLocations;
|
|
8530
|
+
case 13:
|
|
8531
|
+
if (!(_i < _searchLocations.length)) {
|
|
8532
|
+
_context4.next = 27;
|
|
8515
8533
|
break;
|
|
8516
8534
|
}
|
|
8517
|
-
|
|
8518
|
-
_context4.
|
|
8519
|
-
return util__namespace.promisify(fs__default["default"].access)(absoluteSourceMapPath);
|
|
8520
|
-
case 9:
|
|
8521
|
-
return _context4.abrupt("return", absoluteSourceMapPath);
|
|
8522
|
-
case 12:
|
|
8523
|
-
_context4.prev = 12;
|
|
8524
|
-
_context4.t0 = _context4["catch"](6);
|
|
8525
|
-
case 14:
|
|
8526
|
-
_context4.prev = 14;
|
|
8527
|
-
adjacentSourceMapFilePath = bundlePath + ".map";
|
|
8535
|
+
searchLocation = _searchLocations[_i];
|
|
8536
|
+
_context4.prev = 15;
|
|
8528
8537
|
_context4.next = 18;
|
|
8529
|
-
return util__namespace.promisify(fs__default["default"].access)(
|
|
8538
|
+
return util__namespace.promisify(fs__default["default"].access)(searchLocation);
|
|
8530
8539
|
case 18:
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
_context4.
|
|
8535
|
-
|
|
8540
|
+
logger.debug("Source map found for bundle `".concat(bundlePath, "`: `").concat(searchLocation, "`"));
|
|
8541
|
+
return _context4.abrupt("return", searchLocation);
|
|
8542
|
+
case 22:
|
|
8543
|
+
_context4.prev = 22;
|
|
8544
|
+
_context4.t0 = _context4["catch"](15);
|
|
8545
|
+
case 24:
|
|
8546
|
+
_i++;
|
|
8547
|
+
_context4.next = 13;
|
|
8548
|
+
break;
|
|
8549
|
+
case 27:
|
|
8536
8550
|
// This is just a debug message because it can be quite spammy for some frameworks
|
|
8537
|
-
logger.debug("Could not determine source map path for bundle
|
|
8551
|
+
logger.debug("Could not determine source map path for bundle `".concat(bundlePath, "`") + " with sourceMappingURL=".concat(sourceMappingUrl === undefined ? "undefined" : "`".concat(sourceMappingUrl, "`")) + " - Did you turn on source map generation in your bundler?" + " (Attempted paths: ".concat(searchLocations.map(function (e) {
|
|
8552
|
+
return "`".concat(e, "`");
|
|
8553
|
+
}).join(", "), ")"));
|
|
8538
8554
|
return _context4.abrupt("return", undefined);
|
|
8539
|
-
case
|
|
8555
|
+
case 29:
|
|
8540
8556
|
case "end":
|
|
8541
8557
|
return _context4.stop();
|
|
8542
8558
|
}
|
|
8543
|
-
}, _callee4, null, [[
|
|
8559
|
+
}, _callee4, null, [[15, 22]]);
|
|
8544
8560
|
}));
|
|
8545
8561
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
8546
8562
|
}
|
|
8547
|
-
function prepareSourceMapForDebugIdUpload(
|
|
8563
|
+
function prepareSourceMapForDebugIdUpload(_x12, _x13, _x14, _x15, _x16) {
|
|
8548
8564
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
8549
8565
|
}
|
|
8550
8566
|
function _prepareSourceMapForDebugIdUpload() {
|
|
@@ -8644,6 +8660,85 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8644
8660
|
}
|
|
8645
8661
|
}
|
|
8646
8662
|
var options = normalizeUserOptions(userOptions);
|
|
8663
|
+
if (options.disable) {
|
|
8664
|
+
// Early-return a noop build plugin manager instance so that we
|
|
8665
|
+
// don't continue validating options, setting up Sentry, etc.
|
|
8666
|
+
// Otherwise we might create side-effects or log messages that
|
|
8667
|
+
// users don't expect from a disabled plugin.
|
|
8668
|
+
return {
|
|
8669
|
+
normalizedOptions: options,
|
|
8670
|
+
logger: logger,
|
|
8671
|
+
bundleSizeOptimizationReplacementValues: {},
|
|
8672
|
+
telemetry: {
|
|
8673
|
+
emitBundlerPluginExecutionSignal: function () {
|
|
8674
|
+
var _emitBundlerPluginExecutionSignal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8675
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8676
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8677
|
+
case 0:
|
|
8678
|
+
case "end":
|
|
8679
|
+
return _context.stop();
|
|
8680
|
+
}
|
|
8681
|
+
}, _callee);
|
|
8682
|
+
}));
|
|
8683
|
+
function emitBundlerPluginExecutionSignal() {
|
|
8684
|
+
return _emitBundlerPluginExecutionSignal.apply(this, arguments);
|
|
8685
|
+
}
|
|
8686
|
+
return emitBundlerPluginExecutionSignal;
|
|
8687
|
+
}()
|
|
8688
|
+
},
|
|
8689
|
+
bundleMetadata: {},
|
|
8690
|
+
createRelease: function () {
|
|
8691
|
+
var _createRelease = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8692
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8693
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8694
|
+
case 0:
|
|
8695
|
+
case "end":
|
|
8696
|
+
return _context2.stop();
|
|
8697
|
+
}
|
|
8698
|
+
}, _callee2);
|
|
8699
|
+
}));
|
|
8700
|
+
function createRelease() {
|
|
8701
|
+
return _createRelease.apply(this, arguments);
|
|
8702
|
+
}
|
|
8703
|
+
return createRelease;
|
|
8704
|
+
}(),
|
|
8705
|
+
uploadSourcemaps: function () {
|
|
8706
|
+
var _uploadSourcemaps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
8707
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8708
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
8709
|
+
case 0:
|
|
8710
|
+
case "end":
|
|
8711
|
+
return _context3.stop();
|
|
8712
|
+
}
|
|
8713
|
+
}, _callee3);
|
|
8714
|
+
}));
|
|
8715
|
+
function uploadSourcemaps() {
|
|
8716
|
+
return _uploadSourcemaps.apply(this, arguments);
|
|
8717
|
+
}
|
|
8718
|
+
return uploadSourcemaps;
|
|
8719
|
+
}(),
|
|
8720
|
+
deleteArtifacts: function () {
|
|
8721
|
+
var _deleteArtifacts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
8722
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8723
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
8724
|
+
case 0:
|
|
8725
|
+
case "end":
|
|
8726
|
+
return _context4.stop();
|
|
8727
|
+
}
|
|
8728
|
+
}, _callee4);
|
|
8729
|
+
}));
|
|
8730
|
+
function deleteArtifacts() {
|
|
8731
|
+
return _deleteArtifacts.apply(this, arguments);
|
|
8732
|
+
}
|
|
8733
|
+
return deleteArtifacts;
|
|
8734
|
+
}(),
|
|
8735
|
+
createDependencyOnBuildArtifacts: function createDependencyOnBuildArtifacts() {
|
|
8736
|
+
return function () {
|
|
8737
|
+
/* noop */
|
|
8738
|
+
};
|
|
8739
|
+
}
|
|
8740
|
+
};
|
|
8741
|
+
}
|
|
8647
8742
|
var shouldSendTelemetry = allowedToSendTelemetry(options);
|
|
8648
8743
|
var _createSentryInstance = createSentryInstance(options, shouldSendTelemetry, bundlerPluginMetaContext.buildTool),
|
|
8649
8744
|
sentryScope = _createSentryInstance.sentryScope,
|
|
@@ -8676,7 +8771,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8676
8771
|
});
|
|
8677
8772
|
|
|
8678
8773
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8679
|
-
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "3.
|
|
8774
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "3.5.0");
|
|
8680
8775
|
|
|
8681
8776
|
// Not a bulletproof check but should be good enough to at least sometimes determine
|
|
8682
8777
|
// if the plugin is called in dev/watch mode or for a prod build. The important part
|
|
@@ -8837,15 +8932,15 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8837
8932
|
* Emits a `Sentry Bundler Plugin execution` signal.
|
|
8838
8933
|
*/
|
|
8839
8934
|
emitBundlerPluginExecutionSignal: function emitBundlerPluginExecutionSignal() {
|
|
8840
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8841
|
-
return _regeneratorRuntime().wrap(function
|
|
8842
|
-
while (1) switch (
|
|
8935
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
8936
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
8937
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
8843
8938
|
case 0:
|
|
8844
|
-
|
|
8939
|
+
_context5.next = 2;
|
|
8845
8940
|
return shouldSendTelemetry;
|
|
8846
8941
|
case 2:
|
|
8847
|
-
if (!
|
|
8848
|
-
|
|
8942
|
+
if (!_context5.sent) {
|
|
8943
|
+
_context5.next = 7;
|
|
8849
8944
|
break;
|
|
8850
8945
|
}
|
|
8851
8946
|
logger.info("Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.");
|
|
@@ -8855,13 +8950,13 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8855
8950
|
}, function () {
|
|
8856
8951
|
//
|
|
8857
8952
|
});
|
|
8858
|
-
|
|
8953
|
+
_context5.next = 7;
|
|
8859
8954
|
return safeFlushTelemetry(sentryClient);
|
|
8860
8955
|
case 7:
|
|
8861
8956
|
case "end":
|
|
8862
|
-
return
|
|
8957
|
+
return _context5.stop();
|
|
8863
8958
|
}
|
|
8864
|
-
},
|
|
8959
|
+
}, _callee5);
|
|
8865
8960
|
}))();
|
|
8866
8961
|
}
|
|
8867
8962
|
},
|
|
@@ -8875,50 +8970,50 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8875
8970
|
* - adds deploy information
|
|
8876
8971
|
*/
|
|
8877
8972
|
createRelease: function createRelease() {
|
|
8878
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8973
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
8879
8974
|
var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, normalizedInclude;
|
|
8880
|
-
return _regeneratorRuntime().wrap(function
|
|
8881
|
-
while (1) switch (
|
|
8975
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
8976
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
8882
8977
|
case 0:
|
|
8883
8978
|
if (options.release.name) {
|
|
8884
|
-
|
|
8979
|
+
_context6.next = 5;
|
|
8885
8980
|
break;
|
|
8886
8981
|
}
|
|
8887
8982
|
logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
|
|
8888
|
-
return
|
|
8983
|
+
return _context6.abrupt("return");
|
|
8889
8984
|
case 5:
|
|
8890
8985
|
if (!isDevMode) {
|
|
8891
|
-
|
|
8986
|
+
_context6.next = 10;
|
|
8892
8987
|
break;
|
|
8893
8988
|
}
|
|
8894
8989
|
logger.debug("Running in development mode. Will not create release.");
|
|
8895
|
-
return
|
|
8990
|
+
return _context6.abrupt("return");
|
|
8896
8991
|
case 10:
|
|
8897
8992
|
if (options.authToken) {
|
|
8898
|
-
|
|
8993
|
+
_context6.next = 15;
|
|
8899
8994
|
break;
|
|
8900
8995
|
}
|
|
8901
8996
|
logger.warn("No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" + getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN"));
|
|
8902
|
-
return
|
|
8997
|
+
return _context6.abrupt("return");
|
|
8903
8998
|
case 15:
|
|
8904
8999
|
if (!(!options.org && !options.authToken.startsWith("sntrys_"))) {
|
|
8905
|
-
|
|
9000
|
+
_context6.next = 20;
|
|
8906
9001
|
break;
|
|
8907
9002
|
}
|
|
8908
9003
|
logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
8909
|
-
return
|
|
9004
|
+
return _context6.abrupt("return");
|
|
8910
9005
|
case 20:
|
|
8911
9006
|
if (options.project) {
|
|
8912
|
-
|
|
9007
|
+
_context6.next = 23;
|
|
8913
9008
|
break;
|
|
8914
9009
|
}
|
|
8915
9010
|
logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
8916
|
-
return
|
|
9011
|
+
return _context6.abrupt("return");
|
|
8917
9012
|
case 23:
|
|
8918
9013
|
// It is possible that this writeBundle hook is called multiple times in one build (for example when reusing the plugin, or when using build tooling like `@vitejs/plugin-legacy`)
|
|
8919
9014
|
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
8920
9015
|
freeWriteBundleInvocationDependencyOnSourcemapFiles = createDependencyOnBuildArtifacts();
|
|
8921
|
-
|
|
9016
|
+
_context6.prev = 24;
|
|
8922
9017
|
cliInstance = new SentryCli__default["default"](null, {
|
|
8923
9018
|
authToken: options.authToken,
|
|
8924
9019
|
org: options.org,
|
|
@@ -8929,14 +9024,14 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8929
9024
|
headers: options.headers
|
|
8930
9025
|
});
|
|
8931
9026
|
if (!options.release.create) {
|
|
8932
|
-
|
|
9027
|
+
_context6.next = 29;
|
|
8933
9028
|
break;
|
|
8934
9029
|
}
|
|
8935
|
-
|
|
9030
|
+
_context6.next = 29;
|
|
8936
9031
|
return cliInstance.releases["new"](options.release.name);
|
|
8937
9032
|
case 29:
|
|
8938
9033
|
if (!options.release.uploadLegacySourcemaps) {
|
|
8939
|
-
|
|
9034
|
+
_context6.next = 33;
|
|
8940
9035
|
break;
|
|
8941
9036
|
}
|
|
8942
9037
|
normalizedInclude = arrayify(options.release.uploadLegacySourcemaps).map(function (includeItem) {
|
|
@@ -8953,81 +9048,81 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8953
9048
|
ignore: includeEntry.ignore ? arrayify(includeEntry.ignore) : undefined
|
|
8954
9049
|
});
|
|
8955
9050
|
});
|
|
8956
|
-
|
|
9051
|
+
_context6.next = 33;
|
|
8957
9052
|
return cliInstance.releases.uploadSourceMaps(options.release.name, {
|
|
8958
9053
|
include: normalizedInclude,
|
|
8959
9054
|
dist: options.release.dist
|
|
8960
9055
|
});
|
|
8961
9056
|
case 33:
|
|
8962
9057
|
if (!(options.release.setCommits !== false)) {
|
|
8963
|
-
|
|
9058
|
+
_context6.next = 46;
|
|
8964
9059
|
break;
|
|
8965
9060
|
}
|
|
8966
|
-
|
|
8967
|
-
|
|
9061
|
+
_context6.prev = 34;
|
|
9062
|
+
_context6.next = 37;
|
|
8968
9063
|
return cliInstance.releases.setCommits(options.release.name,
|
|
8969
9064
|
// set commits always exists due to the normalize function
|
|
8970
9065
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8971
9066
|
options.release.setCommits);
|
|
8972
9067
|
case 37:
|
|
8973
|
-
|
|
9068
|
+
_context6.next = 46;
|
|
8974
9069
|
break;
|
|
8975
9070
|
case 39:
|
|
8976
|
-
|
|
8977
|
-
|
|
9071
|
+
_context6.prev = 39;
|
|
9072
|
+
_context6.t0 = _context6["catch"](34);
|
|
8978
9073
|
if (!(options.release.setCommits && "shouldNotThrowOnFailure" in options.release.setCommits && options.release.setCommits.shouldNotThrowOnFailure)) {
|
|
8979
|
-
|
|
9074
|
+
_context6.next = 45;
|
|
8980
9075
|
break;
|
|
8981
9076
|
}
|
|
8982
|
-
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):",
|
|
8983
|
-
|
|
9077
|
+
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context6.t0);
|
|
9078
|
+
_context6.next = 46;
|
|
8984
9079
|
break;
|
|
8985
9080
|
case 45:
|
|
8986
|
-
throw
|
|
9081
|
+
throw _context6.t0;
|
|
8987
9082
|
case 46:
|
|
8988
9083
|
if (!options.release.finalize) {
|
|
8989
|
-
|
|
9084
|
+
_context6.next = 49;
|
|
8990
9085
|
break;
|
|
8991
9086
|
}
|
|
8992
|
-
|
|
9087
|
+
_context6.next = 49;
|
|
8993
9088
|
return cliInstance.releases.finalize(options.release.name);
|
|
8994
9089
|
case 49:
|
|
8995
9090
|
if (!options.release.deploy) {
|
|
8996
|
-
|
|
9091
|
+
_context6.next = 52;
|
|
8997
9092
|
break;
|
|
8998
9093
|
}
|
|
8999
|
-
|
|
9094
|
+
_context6.next = 52;
|
|
9000
9095
|
return cliInstance.releases.newDeploy(options.release.name, options.release.deploy);
|
|
9001
9096
|
case 52:
|
|
9002
|
-
|
|
9097
|
+
_context6.next = 60;
|
|
9003
9098
|
break;
|
|
9004
9099
|
case 54:
|
|
9005
|
-
|
|
9006
|
-
|
|
9100
|
+
_context6.prev = 54;
|
|
9101
|
+
_context6.t1 = _context6["catch"](24);
|
|
9007
9102
|
sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
9008
|
-
|
|
9103
|
+
_context6.next = 59;
|
|
9009
9104
|
return safeFlushTelemetry(sentryClient);
|
|
9010
9105
|
case 59:
|
|
9011
|
-
handleRecoverableError(
|
|
9106
|
+
handleRecoverableError(_context6.t1, false);
|
|
9012
9107
|
case 60:
|
|
9013
|
-
|
|
9108
|
+
_context6.prev = 60;
|
|
9014
9109
|
freeWriteBundleInvocationDependencyOnSourcemapFiles();
|
|
9015
|
-
return
|
|
9110
|
+
return _context6.finish(60);
|
|
9016
9111
|
case 63:
|
|
9017
9112
|
case "end":
|
|
9018
|
-
return
|
|
9113
|
+
return _context6.stop();
|
|
9019
9114
|
}
|
|
9020
|
-
},
|
|
9115
|
+
}, _callee6, null, [[24, 54, 60, 63], [34, 39]]);
|
|
9021
9116
|
}))();
|
|
9022
9117
|
},
|
|
9023
9118
|
/**
|
|
9024
9119
|
* Uploads sourcemaps using the "Debug ID" method. This function takes a list of build artifact paths that will be uploaded
|
|
9025
9120
|
*/
|
|
9026
9121
|
uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths) {
|
|
9027
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9122
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
9028
9123
|
var _options$sourcemaps;
|
|
9029
|
-
return _regeneratorRuntime().wrap(function
|
|
9030
|
-
while (1) switch (
|
|
9124
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
9125
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
9031
9126
|
case 0:
|
|
9032
9127
|
if ((_options$sourcemaps = options.sourcemaps) !== null && _options$sourcemaps !== void 0 && _options$sourcemaps.disable) {
|
|
9033
9128
|
logger.debug("Source map upload was disabled. Will not upload sourcemaps using debug ID process.");
|
|
@@ -9040,50 +9135,50 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9040
9135
|
} else if (!options.project) {
|
|
9041
9136
|
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9042
9137
|
}
|
|
9043
|
-
|
|
9138
|
+
_context15.next = 3;
|
|
9044
9139
|
return startSpan(
|
|
9045
9140
|
// This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
|
|
9046
9141
|
{
|
|
9047
9142
|
name: "debug-id-sourcemap-upload",
|
|
9048
9143
|
scope: sentryScope,
|
|
9049
9144
|
forceTransaction: true
|
|
9050
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9145
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
9051
9146
|
var folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$sourcemaps2, tmpUploadFolder, assets, globAssets, globResult, debugIdChunkFilePaths, _process$env2;
|
|
9052
|
-
return _regeneratorRuntime().wrap(function
|
|
9053
|
-
while (1) switch (
|
|
9147
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
9148
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
9054
9149
|
case 0:
|
|
9055
9150
|
// It is possible that this writeBundle hook (which calls this function) is called multiple times in one build (for example when reusing the plugin, or when using build tooling like `@vitejs/plugin-legacy`)
|
|
9056
9151
|
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
9057
9152
|
freeUploadDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
9058
|
-
|
|
9059
|
-
|
|
9153
|
+
_context14.prev = 1;
|
|
9154
|
+
_context14.next = 4;
|
|
9060
9155
|
return startSpan({
|
|
9061
9156
|
name: "mkdtemp",
|
|
9062
9157
|
scope: sentryScope
|
|
9063
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9158
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
9064
9159
|
var _process$env;
|
|
9065
|
-
return _regeneratorRuntime().wrap(function
|
|
9066
|
-
while (1) switch (
|
|
9160
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
9161
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
9067
9162
|
case 0:
|
|
9068
|
-
|
|
9069
|
-
if (
|
|
9070
|
-
|
|
9163
|
+
_context7.t0 = (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env["SENTRY_TEST_OVERRIDE_TEMP_DIR"];
|
|
9164
|
+
if (_context7.t0) {
|
|
9165
|
+
_context7.next = 5;
|
|
9071
9166
|
break;
|
|
9072
9167
|
}
|
|
9073
|
-
|
|
9168
|
+
_context7.next = 4;
|
|
9074
9169
|
return fs__namespace.promises.mkdtemp(path__namespace.join(os__namespace.tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
9075
9170
|
case 4:
|
|
9076
|
-
|
|
9171
|
+
_context7.t0 = _context7.sent;
|
|
9077
9172
|
case 5:
|
|
9078
|
-
return
|
|
9173
|
+
return _context7.abrupt("return", _context7.t0);
|
|
9079
9174
|
case 6:
|
|
9080
9175
|
case "end":
|
|
9081
|
-
return
|
|
9176
|
+
return _context7.stop();
|
|
9082
9177
|
}
|
|
9083
|
-
},
|
|
9178
|
+
}, _callee7);
|
|
9084
9179
|
})));
|
|
9085
9180
|
case 4:
|
|
9086
|
-
tmpUploadFolder =
|
|
9181
|
+
tmpUploadFolder = _context14.sent;
|
|
9087
9182
|
folderToCleanUp = tmpUploadFolder;
|
|
9088
9183
|
assets = (_options$sourcemaps2 = options.sourcemaps) === null || _options$sourcemaps2 === void 0 ? void 0 : _options$sourcemaps2.assets;
|
|
9089
9184
|
if (assets) {
|
|
@@ -9092,105 +9187,105 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9092
9187
|
logger.debug("No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.");
|
|
9093
9188
|
globAssets = buildArtifactPaths;
|
|
9094
9189
|
}
|
|
9095
|
-
|
|
9190
|
+
_context14.next = 10;
|
|
9096
9191
|
return startSpan({
|
|
9097
9192
|
name: "glob",
|
|
9098
9193
|
scope: sentryScope
|
|
9099
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9194
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
9100
9195
|
var _options$sourcemaps3;
|
|
9101
|
-
return _regeneratorRuntime().wrap(function
|
|
9102
|
-
while (1) switch (
|
|
9196
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
9197
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
9103
9198
|
case 0:
|
|
9104
|
-
|
|
9199
|
+
_context8.next = 2;
|
|
9105
9200
|
return glob.glob(globAssets, {
|
|
9106
9201
|
absolute: true,
|
|
9107
9202
|
nodir: true,
|
|
9108
9203
|
ignore: (_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.ignore
|
|
9109
9204
|
});
|
|
9110
9205
|
case 2:
|
|
9111
|
-
return
|
|
9206
|
+
return _context8.abrupt("return", _context8.sent);
|
|
9112
9207
|
case 3:
|
|
9113
9208
|
case "end":
|
|
9114
|
-
return
|
|
9209
|
+
return _context8.stop();
|
|
9115
9210
|
}
|
|
9116
|
-
},
|
|
9211
|
+
}, _callee8);
|
|
9117
9212
|
})));
|
|
9118
9213
|
case 10:
|
|
9119
|
-
globResult =
|
|
9214
|
+
globResult = _context14.sent;
|
|
9120
9215
|
debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
|
|
9121
9216
|
return !!stripQueryAndHashFromPath(debugIdChunkFilePath).match(/\.(js|mjs|cjs)$/);
|
|
9122
9217
|
}); // The order of the files output by glob() is not deterministic
|
|
9123
9218
|
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
9124
9219
|
debugIdChunkFilePaths.sort();
|
|
9125
9220
|
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
9126
|
-
|
|
9221
|
+
_context14.next = 17;
|
|
9127
9222
|
break;
|
|
9128
9223
|
}
|
|
9129
9224
|
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
9130
|
-
|
|
9225
|
+
_context14.next = 24;
|
|
9131
9226
|
break;
|
|
9132
9227
|
case 17:
|
|
9133
9228
|
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
9134
|
-
|
|
9229
|
+
_context14.next = 21;
|
|
9135
9230
|
break;
|
|
9136
9231
|
}
|
|
9137
9232
|
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
9138
|
-
|
|
9233
|
+
_context14.next = 24;
|
|
9139
9234
|
break;
|
|
9140
9235
|
case 21:
|
|
9141
|
-
|
|
9236
|
+
_context14.next = 23;
|
|
9142
9237
|
return startSpan({
|
|
9143
9238
|
name: "prepare-bundles",
|
|
9144
9239
|
scope: sentryScope
|
|
9145
9240
|
}, /*#__PURE__*/function () {
|
|
9146
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9241
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(prepBundlesSpan) {
|
|
9147
9242
|
var preparationTasks, workers, worker, workerIndex, files, stats, uploadSize;
|
|
9148
|
-
return _regeneratorRuntime().wrap(function
|
|
9149
|
-
while (1) switch (
|
|
9243
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
9244
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
9150
9245
|
case 0:
|
|
9151
9246
|
// Preparing the bundles can be a lot of work and doing it all at once has the potential of nuking the heap so
|
|
9152
9247
|
// instead we do it with a maximum of 16 concurrent workers
|
|
9153
9248
|
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
9154
|
-
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9155
|
-
var _options$sourcemaps$r, _options$sourcemaps4;
|
|
9156
|
-
return _regeneratorRuntime().wrap(function
|
|
9157
|
-
while (1) switch (
|
|
9249
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
9250
|
+
var _options$sourcemaps$r, _options$sourcemaps4, _options$sourcemaps5;
|
|
9251
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
9252
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
9158
9253
|
case 0:
|
|
9159
|
-
|
|
9160
|
-
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.rewriteSources) !== null && _options$sourcemaps$r !== void 0 ? _options$sourcemaps$r : defaultRewriteSourcesHook);
|
|
9254
|
+
_context9.next = 2;
|
|
9255
|
+
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.rewriteSources) !== null && _options$sourcemaps$r !== void 0 ? _options$sourcemaps$r : defaultRewriteSourcesHook, (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.resolveSourceMap);
|
|
9161
9256
|
case 2:
|
|
9162
9257
|
case "end":
|
|
9163
|
-
return
|
|
9258
|
+
return _context9.stop();
|
|
9164
9259
|
}
|
|
9165
|
-
},
|
|
9260
|
+
}, _callee9);
|
|
9166
9261
|
}));
|
|
9167
9262
|
});
|
|
9168
9263
|
workers = [];
|
|
9169
9264
|
worker = /*#__PURE__*/function () {
|
|
9170
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9265
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
9171
9266
|
var task;
|
|
9172
|
-
return _regeneratorRuntime().wrap(function
|
|
9173
|
-
while (1) switch (
|
|
9267
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
9268
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
9174
9269
|
case 0:
|
|
9175
9270
|
if (!(preparationTasks.length > 0)) {
|
|
9176
|
-
|
|
9271
|
+
_context10.next = 7;
|
|
9177
9272
|
break;
|
|
9178
9273
|
}
|
|
9179
9274
|
task = preparationTasks.shift();
|
|
9180
9275
|
if (!task) {
|
|
9181
|
-
|
|
9276
|
+
_context10.next = 5;
|
|
9182
9277
|
break;
|
|
9183
9278
|
}
|
|
9184
|
-
|
|
9279
|
+
_context10.next = 5;
|
|
9185
9280
|
return task();
|
|
9186
9281
|
case 5:
|
|
9187
|
-
|
|
9282
|
+
_context10.next = 0;
|
|
9188
9283
|
break;
|
|
9189
9284
|
case 7:
|
|
9190
9285
|
case "end":
|
|
9191
|
-
return
|
|
9286
|
+
return _context10.stop();
|
|
9192
9287
|
}
|
|
9193
|
-
},
|
|
9288
|
+
}, _callee10);
|
|
9194
9289
|
}));
|
|
9195
9290
|
return function worker() {
|
|
9196
9291
|
return _ref6.apply(this, arguments);
|
|
@@ -9199,35 +9294,35 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9199
9294
|
for (workerIndex = 0; workerIndex < 16; workerIndex++) {
|
|
9200
9295
|
workers.push(worker());
|
|
9201
9296
|
}
|
|
9202
|
-
|
|
9297
|
+
_context12.next = 6;
|
|
9203
9298
|
return Promise.all(workers);
|
|
9204
9299
|
case 6:
|
|
9205
|
-
|
|
9300
|
+
_context12.next = 8;
|
|
9206
9301
|
return fs__namespace.promises.readdir(tmpUploadFolder);
|
|
9207
9302
|
case 8:
|
|
9208
|
-
files =
|
|
9303
|
+
files = _context12.sent;
|
|
9209
9304
|
stats = files.map(function (file) {
|
|
9210
9305
|
return fs__namespace.promises.stat(path__namespace.join(tmpUploadFolder, file));
|
|
9211
9306
|
});
|
|
9212
|
-
|
|
9307
|
+
_context12.next = 12;
|
|
9213
9308
|
return Promise.all(stats);
|
|
9214
9309
|
case 12:
|
|
9215
|
-
uploadSize =
|
|
9310
|
+
uploadSize = _context12.sent.reduce(function (accumulator, _ref7) {
|
|
9216
9311
|
var size = _ref7.size;
|
|
9217
9312
|
return accumulator + size;
|
|
9218
9313
|
}, 0);
|
|
9219
9314
|
setMeasurement("files", files.length, "none", prepBundlesSpan);
|
|
9220
9315
|
setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
|
|
9221
|
-
|
|
9316
|
+
_context12.next = 17;
|
|
9222
9317
|
return startSpan({
|
|
9223
9318
|
name: "upload",
|
|
9224
9319
|
scope: sentryScope
|
|
9225
9320
|
}, /*#__PURE__*/function () {
|
|
9226
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9321
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(uploadSpan) {
|
|
9227
9322
|
var _options$release$name;
|
|
9228
9323
|
var cliInstance;
|
|
9229
|
-
return _regeneratorRuntime().wrap(function
|
|
9230
|
-
while (1) switch (
|
|
9324
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
9325
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
9231
9326
|
case 0:
|
|
9232
9327
|
cliInstance = new SentryCli__default["default"](null, {
|
|
9233
9328
|
authToken: options.authToken,
|
|
@@ -9242,7 +9337,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9242
9337
|
baggage: dynamicSamplingContextToSentryBaggageHeader(getDynamicSamplingContextFromSpan(uploadSpan))
|
|
9243
9338
|
}, options.headers)
|
|
9244
9339
|
});
|
|
9245
|
-
|
|
9340
|
+
_context11.next = 3;
|
|
9246
9341
|
return cliInstance.releases.uploadSourceMaps((_options$release$name = options.release.name) !== null && _options$release$name !== void 0 ? _options$release$name : "undefined",
|
|
9247
9342
|
// unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
9248
9343
|
{
|
|
@@ -9254,9 +9349,9 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9254
9349
|
});
|
|
9255
9350
|
case 3:
|
|
9256
9351
|
case "end":
|
|
9257
|
-
return
|
|
9352
|
+
return _context11.stop();
|
|
9258
9353
|
}
|
|
9259
|
-
},
|
|
9354
|
+
}, _callee11);
|
|
9260
9355
|
}));
|
|
9261
9356
|
return function (_x2) {
|
|
9262
9357
|
return _ref8.apply(this, arguments);
|
|
@@ -9264,9 +9359,9 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9264
9359
|
}());
|
|
9265
9360
|
case 17:
|
|
9266
9361
|
case "end":
|
|
9267
|
-
return
|
|
9362
|
+
return _context12.stop();
|
|
9268
9363
|
}
|
|
9269
|
-
},
|
|
9364
|
+
}, _callee12);
|
|
9270
9365
|
}));
|
|
9271
9366
|
return function (_x) {
|
|
9272
9367
|
return _ref4.apply(this, arguments);
|
|
@@ -9275,90 +9370,90 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9275
9370
|
case 23:
|
|
9276
9371
|
logger.info("Successfully uploaded source maps to Sentry");
|
|
9277
9372
|
case 24:
|
|
9278
|
-
|
|
9373
|
+
_context14.next = 30;
|
|
9279
9374
|
break;
|
|
9280
9375
|
case 26:
|
|
9281
|
-
|
|
9282
|
-
|
|
9376
|
+
_context14.prev = 26;
|
|
9377
|
+
_context14.t0 = _context14["catch"](1);
|
|
9283
9378
|
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
9284
|
-
handleRecoverableError(
|
|
9379
|
+
handleRecoverableError(_context14.t0, false);
|
|
9285
9380
|
case 30:
|
|
9286
|
-
|
|
9381
|
+
_context14.prev = 30;
|
|
9287
9382
|
if (folderToCleanUp && !((_process$env2 = process.env) !== null && _process$env2 !== void 0 && _process$env2["SENTRY_TEST_OVERRIDE_TEMP_DIR"])) {
|
|
9288
9383
|
void startSpan({
|
|
9289
9384
|
name: "cleanup",
|
|
9290
9385
|
scope: sentryScope
|
|
9291
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9292
|
-
return _regeneratorRuntime().wrap(function
|
|
9293
|
-
while (1) switch (
|
|
9386
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
9387
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
9388
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
9294
9389
|
case 0:
|
|
9295
9390
|
if (!folderToCleanUp) {
|
|
9296
|
-
|
|
9391
|
+
_context13.next = 3;
|
|
9297
9392
|
break;
|
|
9298
9393
|
}
|
|
9299
|
-
|
|
9394
|
+
_context13.next = 3;
|
|
9300
9395
|
return fs__namespace.promises.rm(folderToCleanUp, {
|
|
9301
9396
|
recursive: true,
|
|
9302
9397
|
force: true
|
|
9303
9398
|
});
|
|
9304
9399
|
case 3:
|
|
9305
9400
|
case "end":
|
|
9306
|
-
return
|
|
9401
|
+
return _context13.stop();
|
|
9307
9402
|
}
|
|
9308
|
-
},
|
|
9403
|
+
}, _callee13);
|
|
9309
9404
|
})));
|
|
9310
9405
|
}
|
|
9311
9406
|
freeUploadDependencyOnBuildArtifacts();
|
|
9312
|
-
|
|
9407
|
+
_context14.next = 35;
|
|
9313
9408
|
return safeFlushTelemetry(sentryClient);
|
|
9314
9409
|
case 35:
|
|
9315
|
-
return
|
|
9410
|
+
return _context14.finish(30);
|
|
9316
9411
|
case 36:
|
|
9317
9412
|
case "end":
|
|
9318
|
-
return
|
|
9413
|
+
return _context14.stop();
|
|
9319
9414
|
}
|
|
9320
|
-
},
|
|
9415
|
+
}, _callee14, null, [[1, 26, 30, 36]]);
|
|
9321
9416
|
})));
|
|
9322
9417
|
case 3:
|
|
9323
9418
|
case "end":
|
|
9324
|
-
return
|
|
9419
|
+
return _context15.stop();
|
|
9325
9420
|
}
|
|
9326
|
-
},
|
|
9421
|
+
}, _callee15);
|
|
9327
9422
|
}))();
|
|
9328
9423
|
},
|
|
9329
9424
|
/**
|
|
9330
9425
|
* Will delete artifacts based on the passed `sourcemaps.filesToDeleteAfterUpload` option.
|
|
9331
9426
|
*/
|
|
9332
9427
|
deleteArtifacts: function deleteArtifacts() {
|
|
9333
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9334
|
-
var _options$
|
|
9335
|
-
return _regeneratorRuntime().wrap(function
|
|
9336
|
-
while (1) switch (
|
|
9428
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
9429
|
+
var _options$sourcemaps6, filesToDelete, filePathsToDelete;
|
|
9430
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
9431
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
9337
9432
|
case 0:
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
return (_options$
|
|
9433
|
+
_context16.prev = 0;
|
|
9434
|
+
_context16.next = 3;
|
|
9435
|
+
return (_options$sourcemaps6 = options.sourcemaps) === null || _options$sourcemaps6 === void 0 ? void 0 : _options$sourcemaps6.filesToDeleteAfterUpload;
|
|
9341
9436
|
case 3:
|
|
9342
|
-
filesToDelete =
|
|
9437
|
+
filesToDelete = _context16.sent;
|
|
9343
9438
|
if (!(filesToDelete !== undefined)) {
|
|
9344
|
-
|
|
9439
|
+
_context16.next = 14;
|
|
9345
9440
|
break;
|
|
9346
9441
|
}
|
|
9347
|
-
|
|
9442
|
+
_context16.next = 7;
|
|
9348
9443
|
return glob.glob(filesToDelete, {
|
|
9349
9444
|
absolute: true,
|
|
9350
9445
|
nodir: true
|
|
9351
9446
|
});
|
|
9352
9447
|
case 7:
|
|
9353
|
-
filePathsToDelete =
|
|
9448
|
+
filePathsToDelete = _context16.sent;
|
|
9354
9449
|
logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
|
|
9355
|
-
|
|
9450
|
+
_context16.next = 11;
|
|
9356
9451
|
return waitUntilBuildArtifactDependenciesAreFreed();
|
|
9357
9452
|
case 11:
|
|
9358
9453
|
filePathsToDelete.forEach(function (filePathToDelete) {
|
|
9359
9454
|
logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
|
|
9360
9455
|
});
|
|
9361
|
-
|
|
9456
|
+
_context16.next = 14;
|
|
9362
9457
|
return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
|
|
9363
9458
|
return fs__namespace.promises.rm(filePathToDelete, {
|
|
9364
9459
|
force: true
|
|
@@ -9368,23 +9463,23 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9368
9463
|
});
|
|
9369
9464
|
}));
|
|
9370
9465
|
case 14:
|
|
9371
|
-
|
|
9466
|
+
_context16.next = 22;
|
|
9372
9467
|
break;
|
|
9373
9468
|
case 16:
|
|
9374
|
-
|
|
9375
|
-
|
|
9469
|
+
_context16.prev = 16;
|
|
9470
|
+
_context16.t0 = _context16["catch"](0);
|
|
9376
9471
|
sentryScope.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
|
|
9377
|
-
|
|
9472
|
+
_context16.next = 21;
|
|
9378
9473
|
return safeFlushTelemetry(sentryClient);
|
|
9379
9474
|
case 21:
|
|
9380
9475
|
// We throw by default if we get here b/c not being able to delete
|
|
9381
9476
|
// source maps could leak them to production
|
|
9382
|
-
handleRecoverableError(
|
|
9477
|
+
handleRecoverableError(_context16.t0, true);
|
|
9383
9478
|
case 22:
|
|
9384
9479
|
case "end":
|
|
9385
|
-
return
|
|
9480
|
+
return _context16.stop();
|
|
9386
9481
|
}
|
|
9387
|
-
},
|
|
9482
|
+
}, _callee16, null, [[0, 16]]);
|
|
9388
9483
|
}))();
|
|
9389
9484
|
},
|
|
9390
9485
|
createDependencyOnBuildArtifacts: createDependencyOnBuildArtifacts
|