@sentry/bundler-plugin-core 3.4.0 → 3.6.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 +360 -247
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +359 -247
- 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/index.d.ts +26 -37
- package/dist/types/index.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/sentry/telemetry.d.ts.map +1 -1
- package/dist/types/types.d.ts +23 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +5 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +5 -5
package/dist/esm/index.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import childProcess from 'child_process';
|
|
|
17
17
|
import * as https from 'node:https';
|
|
18
18
|
import { Readable } from 'node:stream';
|
|
19
19
|
import { createGzip } from 'node:zlib';
|
|
20
|
+
import * as url from 'url';
|
|
20
21
|
import * as util from 'util';
|
|
21
22
|
import { promisify } from 'util';
|
|
22
23
|
|
|
@@ -8157,7 +8158,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
|
8157
8158
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8158
8159
|
tracesSampleRate: 1,
|
|
8159
8160
|
sampleRate: 1,
|
|
8160
|
-
release: "3.
|
|
8161
|
+
release: "3.6.0",
|
|
8161
8162
|
integrations: [],
|
|
8162
8163
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8163
8164
|
stackParser: stackParser,
|
|
@@ -8341,7 +8342,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
8341
8342
|
};
|
|
8342
8343
|
}();
|
|
8343
8344
|
}
|
|
8344
|
-
function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6) {
|
|
8345
|
+
function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6, _x7) {
|
|
8345
8346
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
8346
8347
|
}
|
|
8347
8348
|
|
|
@@ -8352,7 +8353,7 @@ function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6) {
|
|
|
8352
8353
|
* The string pattern is injected via the debug ID injection snipped.
|
|
8353
8354
|
*/
|
|
8354
8355
|
function _prepareBundleForDebugIdUpload() {
|
|
8355
|
-
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook) {
|
|
8356
|
+
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook, resolveSourceMapHook) {
|
|
8356
8357
|
var bundleContent, debugId, uniqueUploadName, writeSourceFilePromise, writeSourceMapFilePromise;
|
|
8357
8358
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8358
8359
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -8381,7 +8382,7 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8381
8382
|
uniqueUploadName = "".concat(debugId, "-").concat(chunkIndex);
|
|
8382
8383
|
bundleContent = addDebugIdToBundleSource(bundleContent, debugId);
|
|
8383
8384
|
writeSourceFilePromise = fs__default.promises.writeFile(path__default.join(uploadFolder, "".concat(uniqueUploadName, ".js")), bundleContent, "utf-8");
|
|
8384
|
-
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
|
|
8385
|
+
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger, resolveSourceMapHook).then( /*#__PURE__*/function () {
|
|
8385
8386
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sourceMapPath) {
|
|
8386
8387
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8387
8388
|
while (1) switch (_context2.prev = _context2.next) {
|
|
@@ -8398,7 +8399,7 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8398
8399
|
}
|
|
8399
8400
|
}, _callee2);
|
|
8400
8401
|
}));
|
|
8401
|
-
return function (
|
|
8402
|
+
return function (_x17) {
|
|
8402
8403
|
return _ref3.apply(this, arguments);
|
|
8403
8404
|
};
|
|
8404
8405
|
}());
|
|
@@ -8440,75 +8441,89 @@ function addDebugIdToBundleSource(bundleSource, debugId) {
|
|
|
8440
8441
|
*
|
|
8441
8442
|
* @returns the path to the bundle's source map or `undefined` if none could be found.
|
|
8442
8443
|
*/
|
|
8443
|
-
function determineSourceMapPathFromBundle(
|
|
8444
|
+
function determineSourceMapPathFromBundle(_x8, _x9, _x10, _x11) {
|
|
8444
8445
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
8445
8446
|
}
|
|
8447
|
+
|
|
8446
8448
|
/**
|
|
8447
8449
|
* Reads a source map, injects debug ID fields, and writes the source map to the target path.
|
|
8448
8450
|
*/
|
|
8449
8451
|
function _determineSourceMapPathFromBundle() {
|
|
8450
|
-
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(bundlePath, bundleSource, logger) {
|
|
8451
|
-
var sourceMappingUrlMatch, sourceMappingUrl,
|
|
8452
|
+
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(bundlePath, bundleSource, logger, resolveSourceMapHook) {
|
|
8453
|
+
var sourceMappingUrlMatch, sourceMappingUrl, searchLocations, customPath, parsedUrl, _i, _searchLocations, searchLocation;
|
|
8452
8454
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8453
8455
|
while (1) switch (_context4.prev = _context4.next) {
|
|
8454
8456
|
case 0:
|
|
8455
|
-
// 1. try to find source map at `sourceMappingURL` location
|
|
8456
8457
|
sourceMappingUrlMatch = bundleSource.match(/^\s*\/\/# sourceMappingURL=(.*)$/m);
|
|
8457
|
-
|
|
8458
|
-
|
|
8458
|
+
sourceMappingUrl = sourceMappingUrlMatch ? sourceMappingUrlMatch[1] : undefined;
|
|
8459
|
+
searchLocations = [];
|
|
8460
|
+
if (!resolveSourceMapHook) {
|
|
8461
|
+
_context4.next = 10;
|
|
8459
8462
|
break;
|
|
8460
8463
|
}
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8464
|
+
logger.debug("Calling sourcemaps.resolveSourceMap(".concat(JSON.stringify(bundlePath), ", ").concat(JSON.stringify(sourceMappingUrl), ")"));
|
|
8465
|
+
_context4.next = 7;
|
|
8466
|
+
return resolveSourceMapHook(bundlePath, sourceMappingUrl);
|
|
8467
|
+
case 7:
|
|
8468
|
+
customPath = _context4.sent;
|
|
8469
|
+
logger.debug("resolveSourceMap hook returned: ".concat(JSON.stringify(customPath)));
|
|
8470
|
+
if (customPath) {
|
|
8471
|
+
searchLocations.push(customPath);
|
|
8469
8472
|
}
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8473
|
+
case 10:
|
|
8474
|
+
// 1. try to find source map at `sourceMappingURL` location
|
|
8475
|
+
if (sourceMappingUrl) {
|
|
8476
|
+
try {
|
|
8477
|
+
parsedUrl = new URL(sourceMappingUrl);
|
|
8478
|
+
} catch (_unused) {
|
|
8479
|
+
// noop
|
|
8480
|
+
}
|
|
8481
|
+
if (parsedUrl && parsedUrl.protocol === "file:") {
|
|
8482
|
+
searchLocations.push(url.fileURLToPath(sourceMappingUrl));
|
|
8483
|
+
} else if (parsedUrl) ; else if (path__default.isAbsolute(sourceMappingUrl)) {
|
|
8484
|
+
searchLocations.push(path__default.normalize(sourceMappingUrl));
|
|
8485
|
+
} else {
|
|
8486
|
+
searchLocations.push(path__default.normalize(path__default.join(path__default.dirname(bundlePath), sourceMappingUrl)));
|
|
8487
|
+
}
|
|
8476
8488
|
}
|
|
8477
|
-
|
|
8478
|
-
|
|
8489
|
+
|
|
8490
|
+
// 2. try to find source map at path adjacent to chunk source, but with `.map` appended
|
|
8491
|
+
searchLocations.push(bundlePath + ".map");
|
|
8492
|
+
_i = 0, _searchLocations = searchLocations;
|
|
8493
|
+
case 13:
|
|
8494
|
+
if (!(_i < _searchLocations.length)) {
|
|
8495
|
+
_context4.next = 27;
|
|
8479
8496
|
break;
|
|
8480
8497
|
}
|
|
8481
|
-
|
|
8482
|
-
_context4.
|
|
8483
|
-
return util.promisify(fs__default.access)(absoluteSourceMapPath);
|
|
8484
|
-
case 9:
|
|
8485
|
-
return _context4.abrupt("return", absoluteSourceMapPath);
|
|
8486
|
-
case 12:
|
|
8487
|
-
_context4.prev = 12;
|
|
8488
|
-
_context4.t0 = _context4["catch"](6);
|
|
8489
|
-
case 14:
|
|
8490
|
-
_context4.prev = 14;
|
|
8491
|
-
adjacentSourceMapFilePath = bundlePath + ".map";
|
|
8498
|
+
searchLocation = _searchLocations[_i];
|
|
8499
|
+
_context4.prev = 15;
|
|
8492
8500
|
_context4.next = 18;
|
|
8493
|
-
return util.promisify(fs__default.access)(
|
|
8501
|
+
return util.promisify(fs__default.access)(searchLocation);
|
|
8494
8502
|
case 18:
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
_context4.
|
|
8499
|
-
|
|
8503
|
+
logger.debug("Source map found for bundle `".concat(bundlePath, "`: `").concat(searchLocation, "`"));
|
|
8504
|
+
return _context4.abrupt("return", searchLocation);
|
|
8505
|
+
case 22:
|
|
8506
|
+
_context4.prev = 22;
|
|
8507
|
+
_context4.t0 = _context4["catch"](15);
|
|
8508
|
+
case 24:
|
|
8509
|
+
_i++;
|
|
8510
|
+
_context4.next = 13;
|
|
8511
|
+
break;
|
|
8512
|
+
case 27:
|
|
8500
8513
|
// This is just a debug message because it can be quite spammy for some frameworks
|
|
8501
|
-
logger.debug("Could not determine source map path for bundle
|
|
8514
|
+
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) {
|
|
8515
|
+
return "`".concat(e, "`");
|
|
8516
|
+
}).join(", "), ")"));
|
|
8502
8517
|
return _context4.abrupt("return", undefined);
|
|
8503
|
-
case
|
|
8518
|
+
case 29:
|
|
8504
8519
|
case "end":
|
|
8505
8520
|
return _context4.stop();
|
|
8506
8521
|
}
|
|
8507
|
-
}, _callee4, null, [[
|
|
8522
|
+
}, _callee4, null, [[15, 22]]);
|
|
8508
8523
|
}));
|
|
8509
8524
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
8510
8525
|
}
|
|
8511
|
-
function prepareSourceMapForDebugIdUpload(
|
|
8526
|
+
function prepareSourceMapForDebugIdUpload(_x12, _x13, _x14, _x15, _x16) {
|
|
8512
8527
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
8513
8528
|
}
|
|
8514
8529
|
function _prepareSourceMapForDebugIdUpload() {
|
|
@@ -8608,6 +8623,85 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8608
8623
|
}
|
|
8609
8624
|
}
|
|
8610
8625
|
var options = normalizeUserOptions(userOptions);
|
|
8626
|
+
if (options.disable) {
|
|
8627
|
+
// Early-return a noop build plugin manager instance so that we
|
|
8628
|
+
// don't continue validating options, setting up Sentry, etc.
|
|
8629
|
+
// Otherwise we might create side-effects or log messages that
|
|
8630
|
+
// users don't expect from a disabled plugin.
|
|
8631
|
+
return {
|
|
8632
|
+
normalizedOptions: options,
|
|
8633
|
+
logger: logger,
|
|
8634
|
+
bundleSizeOptimizationReplacementValues: {},
|
|
8635
|
+
telemetry: {
|
|
8636
|
+
emitBundlerPluginExecutionSignal: function () {
|
|
8637
|
+
var _emitBundlerPluginExecutionSignal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8638
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8639
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8640
|
+
case 0:
|
|
8641
|
+
case "end":
|
|
8642
|
+
return _context.stop();
|
|
8643
|
+
}
|
|
8644
|
+
}, _callee);
|
|
8645
|
+
}));
|
|
8646
|
+
function emitBundlerPluginExecutionSignal() {
|
|
8647
|
+
return _emitBundlerPluginExecutionSignal.apply(this, arguments);
|
|
8648
|
+
}
|
|
8649
|
+
return emitBundlerPluginExecutionSignal;
|
|
8650
|
+
}()
|
|
8651
|
+
},
|
|
8652
|
+
bundleMetadata: {},
|
|
8653
|
+
createRelease: function () {
|
|
8654
|
+
var _createRelease = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8655
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8656
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8657
|
+
case 0:
|
|
8658
|
+
case "end":
|
|
8659
|
+
return _context2.stop();
|
|
8660
|
+
}
|
|
8661
|
+
}, _callee2);
|
|
8662
|
+
}));
|
|
8663
|
+
function createRelease() {
|
|
8664
|
+
return _createRelease.apply(this, arguments);
|
|
8665
|
+
}
|
|
8666
|
+
return createRelease;
|
|
8667
|
+
}(),
|
|
8668
|
+
uploadSourcemaps: function () {
|
|
8669
|
+
var _uploadSourcemaps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
8670
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8671
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
8672
|
+
case 0:
|
|
8673
|
+
case "end":
|
|
8674
|
+
return _context3.stop();
|
|
8675
|
+
}
|
|
8676
|
+
}, _callee3);
|
|
8677
|
+
}));
|
|
8678
|
+
function uploadSourcemaps() {
|
|
8679
|
+
return _uploadSourcemaps.apply(this, arguments);
|
|
8680
|
+
}
|
|
8681
|
+
return uploadSourcemaps;
|
|
8682
|
+
}(),
|
|
8683
|
+
deleteArtifacts: function () {
|
|
8684
|
+
var _deleteArtifacts = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
8685
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8686
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
8687
|
+
case 0:
|
|
8688
|
+
case "end":
|
|
8689
|
+
return _context4.stop();
|
|
8690
|
+
}
|
|
8691
|
+
}, _callee4);
|
|
8692
|
+
}));
|
|
8693
|
+
function deleteArtifacts() {
|
|
8694
|
+
return _deleteArtifacts.apply(this, arguments);
|
|
8695
|
+
}
|
|
8696
|
+
return deleteArtifacts;
|
|
8697
|
+
}(),
|
|
8698
|
+
createDependencyOnBuildArtifacts: function createDependencyOnBuildArtifacts() {
|
|
8699
|
+
return function () {
|
|
8700
|
+
/* noop */
|
|
8701
|
+
};
|
|
8702
|
+
}
|
|
8703
|
+
};
|
|
8704
|
+
}
|
|
8611
8705
|
var shouldSendTelemetry = allowedToSendTelemetry(options);
|
|
8612
8706
|
var _createSentryInstance = createSentryInstance(options, shouldSendTelemetry, bundlerPluginMetaContext.buildTool),
|
|
8613
8707
|
sentryScope = _createSentryInstance.sentryScope,
|
|
@@ -8640,7 +8734,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8640
8734
|
});
|
|
8641
8735
|
|
|
8642
8736
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8643
|
-
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "3.
|
|
8737
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "3.6.0");
|
|
8644
8738
|
|
|
8645
8739
|
// Not a bulletproof check but should be good enough to at least sometimes determine
|
|
8646
8740
|
// if the plugin is called in dev/watch mode or for a prod build. The important part
|
|
@@ -8801,15 +8895,15 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8801
8895
|
* Emits a `Sentry Bundler Plugin execution` signal.
|
|
8802
8896
|
*/
|
|
8803
8897
|
emitBundlerPluginExecutionSignal: function emitBundlerPluginExecutionSignal() {
|
|
8804
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8805
|
-
return _regeneratorRuntime().wrap(function
|
|
8806
|
-
while (1) switch (
|
|
8898
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
8899
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
8900
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
8807
8901
|
case 0:
|
|
8808
|
-
|
|
8902
|
+
_context5.next = 2;
|
|
8809
8903
|
return shouldSendTelemetry;
|
|
8810
8904
|
case 2:
|
|
8811
|
-
if (!
|
|
8812
|
-
|
|
8905
|
+
if (!_context5.sent) {
|
|
8906
|
+
_context5.next = 7;
|
|
8813
8907
|
break;
|
|
8814
8908
|
}
|
|
8815
8909
|
logger.info("Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.");
|
|
@@ -8819,13 +8913,13 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8819
8913
|
}, function () {
|
|
8820
8914
|
//
|
|
8821
8915
|
});
|
|
8822
|
-
|
|
8916
|
+
_context5.next = 7;
|
|
8823
8917
|
return safeFlushTelemetry(sentryClient);
|
|
8824
8918
|
case 7:
|
|
8825
8919
|
case "end":
|
|
8826
|
-
return
|
|
8920
|
+
return _context5.stop();
|
|
8827
8921
|
}
|
|
8828
|
-
},
|
|
8922
|
+
}, _callee5);
|
|
8829
8923
|
}))();
|
|
8830
8924
|
}
|
|
8831
8925
|
},
|
|
@@ -8839,50 +8933,50 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8839
8933
|
* - adds deploy information
|
|
8840
8934
|
*/
|
|
8841
8935
|
createRelease: function createRelease() {
|
|
8842
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8936
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
8843
8937
|
var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, normalizedInclude;
|
|
8844
|
-
return _regeneratorRuntime().wrap(function
|
|
8845
|
-
while (1) switch (
|
|
8938
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
8939
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
8846
8940
|
case 0:
|
|
8847
8941
|
if (options.release.name) {
|
|
8848
|
-
|
|
8942
|
+
_context6.next = 5;
|
|
8849
8943
|
break;
|
|
8850
8944
|
}
|
|
8851
8945
|
logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
|
|
8852
|
-
return
|
|
8946
|
+
return _context6.abrupt("return");
|
|
8853
8947
|
case 5:
|
|
8854
8948
|
if (!isDevMode) {
|
|
8855
|
-
|
|
8949
|
+
_context6.next = 10;
|
|
8856
8950
|
break;
|
|
8857
8951
|
}
|
|
8858
8952
|
logger.debug("Running in development mode. Will not create release.");
|
|
8859
|
-
return
|
|
8953
|
+
return _context6.abrupt("return");
|
|
8860
8954
|
case 10:
|
|
8861
8955
|
if (options.authToken) {
|
|
8862
|
-
|
|
8956
|
+
_context6.next = 15;
|
|
8863
8957
|
break;
|
|
8864
8958
|
}
|
|
8865
8959
|
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"));
|
|
8866
|
-
return
|
|
8960
|
+
return _context6.abrupt("return");
|
|
8867
8961
|
case 15:
|
|
8868
8962
|
if (!(!options.org && !options.authToken.startsWith("sntrys_"))) {
|
|
8869
|
-
|
|
8963
|
+
_context6.next = 20;
|
|
8870
8964
|
break;
|
|
8871
8965
|
}
|
|
8872
8966
|
logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
8873
|
-
return
|
|
8967
|
+
return _context6.abrupt("return");
|
|
8874
8968
|
case 20:
|
|
8875
8969
|
if (options.project) {
|
|
8876
|
-
|
|
8970
|
+
_context6.next = 23;
|
|
8877
8971
|
break;
|
|
8878
8972
|
}
|
|
8879
8973
|
logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
8880
|
-
return
|
|
8974
|
+
return _context6.abrupt("return");
|
|
8881
8975
|
case 23:
|
|
8882
8976
|
// 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`)
|
|
8883
8977
|
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
8884
8978
|
freeWriteBundleInvocationDependencyOnSourcemapFiles = createDependencyOnBuildArtifacts();
|
|
8885
|
-
|
|
8979
|
+
_context6.prev = 24;
|
|
8886
8980
|
cliInstance = new SentryCli(null, {
|
|
8887
8981
|
authToken: options.authToken,
|
|
8888
8982
|
org: options.org,
|
|
@@ -8893,14 +8987,14 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8893
8987
|
headers: options.headers
|
|
8894
8988
|
});
|
|
8895
8989
|
if (!options.release.create) {
|
|
8896
|
-
|
|
8990
|
+
_context6.next = 29;
|
|
8897
8991
|
break;
|
|
8898
8992
|
}
|
|
8899
|
-
|
|
8993
|
+
_context6.next = 29;
|
|
8900
8994
|
return cliInstance.releases["new"](options.release.name);
|
|
8901
8995
|
case 29:
|
|
8902
8996
|
if (!options.release.uploadLegacySourcemaps) {
|
|
8903
|
-
|
|
8997
|
+
_context6.next = 33;
|
|
8904
8998
|
break;
|
|
8905
8999
|
}
|
|
8906
9000
|
normalizedInclude = arrayify(options.release.uploadLegacySourcemaps).map(function (includeItem) {
|
|
@@ -8917,244 +9011,238 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8917
9011
|
ignore: includeEntry.ignore ? arrayify(includeEntry.ignore) : undefined
|
|
8918
9012
|
});
|
|
8919
9013
|
});
|
|
8920
|
-
|
|
9014
|
+
_context6.next = 33;
|
|
8921
9015
|
return cliInstance.releases.uploadSourceMaps(options.release.name, {
|
|
8922
9016
|
include: normalizedInclude,
|
|
8923
9017
|
dist: options.release.dist
|
|
8924
9018
|
});
|
|
8925
9019
|
case 33:
|
|
8926
9020
|
if (!(options.release.setCommits !== false)) {
|
|
8927
|
-
|
|
9021
|
+
_context6.next = 46;
|
|
8928
9022
|
break;
|
|
8929
9023
|
}
|
|
8930
|
-
|
|
8931
|
-
|
|
9024
|
+
_context6.prev = 34;
|
|
9025
|
+
_context6.next = 37;
|
|
8932
9026
|
return cliInstance.releases.setCommits(options.release.name,
|
|
8933
9027
|
// set commits always exists due to the normalize function
|
|
8934
9028
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8935
9029
|
options.release.setCommits);
|
|
8936
9030
|
case 37:
|
|
8937
|
-
|
|
9031
|
+
_context6.next = 46;
|
|
8938
9032
|
break;
|
|
8939
9033
|
case 39:
|
|
8940
|
-
|
|
8941
|
-
|
|
9034
|
+
_context6.prev = 39;
|
|
9035
|
+
_context6.t0 = _context6["catch"](34);
|
|
8942
9036
|
if (!(options.release.setCommits && "shouldNotThrowOnFailure" in options.release.setCommits && options.release.setCommits.shouldNotThrowOnFailure)) {
|
|
8943
|
-
|
|
9037
|
+
_context6.next = 45;
|
|
8944
9038
|
break;
|
|
8945
9039
|
}
|
|
8946
|
-
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):",
|
|
8947
|
-
|
|
9040
|
+
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context6.t0);
|
|
9041
|
+
_context6.next = 46;
|
|
8948
9042
|
break;
|
|
8949
9043
|
case 45:
|
|
8950
|
-
throw
|
|
9044
|
+
throw _context6.t0;
|
|
8951
9045
|
case 46:
|
|
8952
9046
|
if (!options.release.finalize) {
|
|
8953
|
-
|
|
9047
|
+
_context6.next = 49;
|
|
8954
9048
|
break;
|
|
8955
9049
|
}
|
|
8956
|
-
|
|
9050
|
+
_context6.next = 49;
|
|
8957
9051
|
return cliInstance.releases.finalize(options.release.name);
|
|
8958
9052
|
case 49:
|
|
8959
9053
|
if (!options.release.deploy) {
|
|
8960
|
-
|
|
9054
|
+
_context6.next = 52;
|
|
8961
9055
|
break;
|
|
8962
9056
|
}
|
|
8963
|
-
|
|
9057
|
+
_context6.next = 52;
|
|
8964
9058
|
return cliInstance.releases.newDeploy(options.release.name, options.release.deploy);
|
|
8965
9059
|
case 52:
|
|
8966
|
-
|
|
9060
|
+
_context6.next = 60;
|
|
8967
9061
|
break;
|
|
8968
9062
|
case 54:
|
|
8969
|
-
|
|
8970
|
-
|
|
9063
|
+
_context6.prev = 54;
|
|
9064
|
+
_context6.t1 = _context6["catch"](24);
|
|
8971
9065
|
sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
8972
|
-
|
|
9066
|
+
_context6.next = 59;
|
|
8973
9067
|
return safeFlushTelemetry(sentryClient);
|
|
8974
9068
|
case 59:
|
|
8975
|
-
handleRecoverableError(
|
|
9069
|
+
handleRecoverableError(_context6.t1, false);
|
|
8976
9070
|
case 60:
|
|
8977
|
-
|
|
9071
|
+
_context6.prev = 60;
|
|
8978
9072
|
freeWriteBundleInvocationDependencyOnSourcemapFiles();
|
|
8979
|
-
return
|
|
9073
|
+
return _context6.finish(60);
|
|
8980
9074
|
case 63:
|
|
8981
9075
|
case "end":
|
|
8982
|
-
return
|
|
9076
|
+
return _context6.stop();
|
|
8983
9077
|
}
|
|
8984
|
-
},
|
|
9078
|
+
}, _callee6, null, [[24, 54, 60, 63], [34, 39]]);
|
|
8985
9079
|
}))();
|
|
8986
9080
|
},
|
|
8987
9081
|
/**
|
|
8988
9082
|
* Uploads sourcemaps using the "Debug ID" method. This function takes a list of build artifact paths that will be uploaded
|
|
8989
9083
|
*/
|
|
8990
9084
|
uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths) {
|
|
8991
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
while (1) switch (_context11.prev = _context11.next) {
|
|
9085
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
9086
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
9087
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
8995
9088
|
case 0:
|
|
8996
|
-
if ((
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
logger.debug("Running in development mode. Will not upload sourcemaps.");
|
|
9000
|
-
} else if (!options.authToken) {
|
|
9001
|
-
logger.warn("No auth token provided. Will not upload source maps. 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"));
|
|
9002
|
-
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9003
|
-
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9004
|
-
} else if (!options.project) {
|
|
9005
|
-
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9089
|
+
if (canUploadSourceMaps(options, logger, isDevMode)) {
|
|
9090
|
+
_context15.next = 2;
|
|
9091
|
+
break;
|
|
9006
9092
|
}
|
|
9007
|
-
|
|
9093
|
+
return _context15.abrupt("return");
|
|
9094
|
+
case 2:
|
|
9095
|
+
_context15.next = 4;
|
|
9008
9096
|
return startSpan(
|
|
9009
9097
|
// This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
|
|
9010
9098
|
{
|
|
9011
9099
|
name: "debug-id-sourcemap-upload",
|
|
9012
9100
|
scope: sentryScope,
|
|
9013
9101
|
forceTransaction: true
|
|
9014
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9015
|
-
var folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$
|
|
9016
|
-
return _regeneratorRuntime().wrap(function
|
|
9017
|
-
while (1) switch (
|
|
9102
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
9103
|
+
var folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$sourcemaps, tmpUploadFolder, assets, globAssets, globResult, debugIdChunkFilePaths, numUploadedFiles, _process$env2;
|
|
9104
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
9105
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
9018
9106
|
case 0:
|
|
9019
9107
|
// 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`)
|
|
9020
9108
|
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
9021
9109
|
freeUploadDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
9022
|
-
|
|
9023
|
-
|
|
9110
|
+
_context14.prev = 1;
|
|
9111
|
+
_context14.next = 4;
|
|
9024
9112
|
return startSpan({
|
|
9025
9113
|
name: "mkdtemp",
|
|
9026
9114
|
scope: sentryScope
|
|
9027
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9115
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
9028
9116
|
var _process$env;
|
|
9029
|
-
return _regeneratorRuntime().wrap(function
|
|
9030
|
-
while (1) switch (
|
|
9117
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
9118
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
9031
9119
|
case 0:
|
|
9032
|
-
|
|
9033
|
-
if (
|
|
9034
|
-
|
|
9120
|
+
_context7.t0 = (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env["SENTRY_TEST_OVERRIDE_TEMP_DIR"];
|
|
9121
|
+
if (_context7.t0) {
|
|
9122
|
+
_context7.next = 5;
|
|
9035
9123
|
break;
|
|
9036
9124
|
}
|
|
9037
|
-
|
|
9125
|
+
_context7.next = 4;
|
|
9038
9126
|
return fs.promises.mkdtemp(path.join(os.tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
9039
9127
|
case 4:
|
|
9040
|
-
|
|
9128
|
+
_context7.t0 = _context7.sent;
|
|
9041
9129
|
case 5:
|
|
9042
|
-
return
|
|
9130
|
+
return _context7.abrupt("return", _context7.t0);
|
|
9043
9131
|
case 6:
|
|
9044
9132
|
case "end":
|
|
9045
|
-
return
|
|
9133
|
+
return _context7.stop();
|
|
9046
9134
|
}
|
|
9047
|
-
},
|
|
9135
|
+
}, _callee7);
|
|
9048
9136
|
})));
|
|
9049
9137
|
case 4:
|
|
9050
|
-
tmpUploadFolder =
|
|
9138
|
+
tmpUploadFolder = _context14.sent;
|
|
9051
9139
|
folderToCleanUp = tmpUploadFolder;
|
|
9052
|
-
assets = (_options$
|
|
9140
|
+
assets = (_options$sourcemaps = options.sourcemaps) === null || _options$sourcemaps === void 0 ? void 0 : _options$sourcemaps.assets;
|
|
9053
9141
|
if (assets) {
|
|
9054
9142
|
globAssets = assets;
|
|
9055
9143
|
} else {
|
|
9056
9144
|
logger.debug("No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.");
|
|
9057
9145
|
globAssets = buildArtifactPaths;
|
|
9058
9146
|
}
|
|
9059
|
-
|
|
9147
|
+
_context14.next = 10;
|
|
9060
9148
|
return startSpan({
|
|
9061
9149
|
name: "glob",
|
|
9062
9150
|
scope: sentryScope
|
|
9063
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9064
|
-
var _options$
|
|
9065
|
-
return _regeneratorRuntime().wrap(function
|
|
9066
|
-
while (1) switch (
|
|
9151
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
9152
|
+
var _options$sourcemaps2;
|
|
9153
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
9154
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
9067
9155
|
case 0:
|
|
9068
|
-
|
|
9156
|
+
_context8.next = 2;
|
|
9069
9157
|
return glob(globAssets, {
|
|
9070
9158
|
absolute: true,
|
|
9071
9159
|
nodir: true,
|
|
9072
|
-
ignore: (_options$
|
|
9160
|
+
ignore: (_options$sourcemaps2 = options.sourcemaps) === null || _options$sourcemaps2 === void 0 ? void 0 : _options$sourcemaps2.ignore
|
|
9073
9161
|
});
|
|
9074
9162
|
case 2:
|
|
9075
|
-
return
|
|
9163
|
+
return _context8.abrupt("return", _context8.sent);
|
|
9076
9164
|
case 3:
|
|
9077
9165
|
case "end":
|
|
9078
|
-
return
|
|
9166
|
+
return _context8.stop();
|
|
9079
9167
|
}
|
|
9080
|
-
},
|
|
9168
|
+
}, _callee8);
|
|
9081
9169
|
})));
|
|
9082
9170
|
case 10:
|
|
9083
|
-
globResult =
|
|
9171
|
+
globResult = _context14.sent;
|
|
9084
9172
|
debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
|
|
9085
9173
|
return !!stripQueryAndHashFromPath(debugIdChunkFilePath).match(/\.(js|mjs|cjs)$/);
|
|
9086
9174
|
}); // The order of the files output by glob() is not deterministic
|
|
9087
9175
|
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
9088
9176
|
debugIdChunkFilePaths.sort();
|
|
9089
9177
|
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
9090
|
-
|
|
9178
|
+
_context14.next = 17;
|
|
9091
9179
|
break;
|
|
9092
9180
|
}
|
|
9093
9181
|
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
9094
|
-
|
|
9182
|
+
_context14.next = 25;
|
|
9095
9183
|
break;
|
|
9096
9184
|
case 17:
|
|
9097
9185
|
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
9098
|
-
|
|
9186
|
+
_context14.next = 21;
|
|
9099
9187
|
break;
|
|
9100
9188
|
}
|
|
9101
9189
|
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
9102
|
-
|
|
9190
|
+
_context14.next = 25;
|
|
9103
9191
|
break;
|
|
9104
9192
|
case 21:
|
|
9105
|
-
|
|
9193
|
+
_context14.next = 23;
|
|
9106
9194
|
return startSpan({
|
|
9107
9195
|
name: "prepare-bundles",
|
|
9108
9196
|
scope: sentryScope
|
|
9109
9197
|
}, /*#__PURE__*/function () {
|
|
9110
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9198
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(prepBundlesSpan) {
|
|
9111
9199
|
var preparationTasks, workers, worker, workerIndex, files, stats, uploadSize;
|
|
9112
|
-
return _regeneratorRuntime().wrap(function
|
|
9113
|
-
while (1) switch (
|
|
9200
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
9201
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
9114
9202
|
case 0:
|
|
9115
9203
|
// Preparing the bundles can be a lot of work and doing it all at once has the potential of nuking the heap so
|
|
9116
9204
|
// instead we do it with a maximum of 16 concurrent workers
|
|
9117
9205
|
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
9118
|
-
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9119
|
-
var _options$sourcemaps$r, _options$sourcemaps4;
|
|
9120
|
-
return _regeneratorRuntime().wrap(function
|
|
9121
|
-
while (1) switch (
|
|
9206
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
9207
|
+
var _options$sourcemaps$r, _options$sourcemaps3, _options$sourcemaps4;
|
|
9208
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
9209
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
9122
9210
|
case 0:
|
|
9123
|
-
|
|
9124
|
-
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$
|
|
9211
|
+
_context9.next = 2;
|
|
9212
|
+
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.rewriteSources) !== null && _options$sourcemaps$r !== void 0 ? _options$sourcemaps$r : defaultRewriteSourcesHook, (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.resolveSourceMap);
|
|
9125
9213
|
case 2:
|
|
9126
9214
|
case "end":
|
|
9127
|
-
return
|
|
9215
|
+
return _context9.stop();
|
|
9128
9216
|
}
|
|
9129
|
-
},
|
|
9217
|
+
}, _callee9);
|
|
9130
9218
|
}));
|
|
9131
9219
|
});
|
|
9132
9220
|
workers = [];
|
|
9133
9221
|
worker = /*#__PURE__*/function () {
|
|
9134
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9222
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
9135
9223
|
var task;
|
|
9136
|
-
return _regeneratorRuntime().wrap(function
|
|
9137
|
-
while (1) switch (
|
|
9224
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
9225
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
9138
9226
|
case 0:
|
|
9139
9227
|
if (!(preparationTasks.length > 0)) {
|
|
9140
|
-
|
|
9228
|
+
_context10.next = 7;
|
|
9141
9229
|
break;
|
|
9142
9230
|
}
|
|
9143
9231
|
task = preparationTasks.shift();
|
|
9144
9232
|
if (!task) {
|
|
9145
|
-
|
|
9233
|
+
_context10.next = 5;
|
|
9146
9234
|
break;
|
|
9147
9235
|
}
|
|
9148
|
-
|
|
9236
|
+
_context10.next = 5;
|
|
9149
9237
|
return task();
|
|
9150
9238
|
case 5:
|
|
9151
|
-
|
|
9239
|
+
_context10.next = 0;
|
|
9152
9240
|
break;
|
|
9153
9241
|
case 7:
|
|
9154
9242
|
case "end":
|
|
9155
|
-
return
|
|
9243
|
+
return _context10.stop();
|
|
9156
9244
|
}
|
|
9157
|
-
},
|
|
9245
|
+
}, _callee10);
|
|
9158
9246
|
}));
|
|
9159
9247
|
return function worker() {
|
|
9160
9248
|
return _ref6.apply(this, arguments);
|
|
@@ -9163,35 +9251,35 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9163
9251
|
for (workerIndex = 0; workerIndex < 16; workerIndex++) {
|
|
9164
9252
|
workers.push(worker());
|
|
9165
9253
|
}
|
|
9166
|
-
|
|
9254
|
+
_context12.next = 6;
|
|
9167
9255
|
return Promise.all(workers);
|
|
9168
9256
|
case 6:
|
|
9169
|
-
|
|
9257
|
+
_context12.next = 8;
|
|
9170
9258
|
return fs.promises.readdir(tmpUploadFolder);
|
|
9171
9259
|
case 8:
|
|
9172
|
-
files =
|
|
9260
|
+
files = _context12.sent;
|
|
9173
9261
|
stats = files.map(function (file) {
|
|
9174
9262
|
return fs.promises.stat(path.join(tmpUploadFolder, file));
|
|
9175
9263
|
});
|
|
9176
|
-
|
|
9264
|
+
_context12.next = 12;
|
|
9177
9265
|
return Promise.all(stats);
|
|
9178
9266
|
case 12:
|
|
9179
|
-
uploadSize =
|
|
9267
|
+
uploadSize = _context12.sent.reduce(function (accumulator, _ref7) {
|
|
9180
9268
|
var size = _ref7.size;
|
|
9181
9269
|
return accumulator + size;
|
|
9182
9270
|
}, 0);
|
|
9183
9271
|
setMeasurement("files", files.length, "none", prepBundlesSpan);
|
|
9184
9272
|
setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
|
|
9185
|
-
|
|
9273
|
+
_context12.next = 17;
|
|
9186
9274
|
return startSpan({
|
|
9187
9275
|
name: "upload",
|
|
9188
9276
|
scope: sentryScope
|
|
9189
9277
|
}, /*#__PURE__*/function () {
|
|
9190
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9278
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(uploadSpan) {
|
|
9191
9279
|
var _options$release$name;
|
|
9192
9280
|
var cliInstance;
|
|
9193
|
-
return _regeneratorRuntime().wrap(function
|
|
9194
|
-
while (1) switch (
|
|
9281
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
9282
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
9195
9283
|
case 0:
|
|
9196
9284
|
cliInstance = new SentryCli(null, {
|
|
9197
9285
|
authToken: options.authToken,
|
|
@@ -9206,7 +9294,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9206
9294
|
baggage: dynamicSamplingContextToSentryBaggageHeader(getDynamicSamplingContextFromSpan(uploadSpan))
|
|
9207
9295
|
}, options.headers)
|
|
9208
9296
|
});
|
|
9209
|
-
|
|
9297
|
+
_context11.next = 3;
|
|
9210
9298
|
return cliInstance.releases.uploadSourceMaps((_options$release$name = options.release.name) !== null && _options$release$name !== void 0 ? _options$release$name : "undefined",
|
|
9211
9299
|
// unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
9212
9300
|
{
|
|
@@ -9218,111 +9306,116 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9218
9306
|
});
|
|
9219
9307
|
case 3:
|
|
9220
9308
|
case "end":
|
|
9221
|
-
return
|
|
9309
|
+
return _context11.stop();
|
|
9222
9310
|
}
|
|
9223
|
-
},
|
|
9311
|
+
}, _callee11);
|
|
9224
9312
|
}));
|
|
9225
9313
|
return function (_x2) {
|
|
9226
9314
|
return _ref8.apply(this, arguments);
|
|
9227
9315
|
};
|
|
9228
9316
|
}());
|
|
9229
9317
|
case 17:
|
|
9318
|
+
return _context12.abrupt("return", files.length);
|
|
9319
|
+
case 18:
|
|
9230
9320
|
case "end":
|
|
9231
|
-
return
|
|
9321
|
+
return _context12.stop();
|
|
9232
9322
|
}
|
|
9233
|
-
},
|
|
9323
|
+
}, _callee12);
|
|
9234
9324
|
}));
|
|
9235
9325
|
return function (_x) {
|
|
9236
9326
|
return _ref4.apply(this, arguments);
|
|
9237
9327
|
};
|
|
9238
9328
|
}());
|
|
9239
9329
|
case 23:
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9330
|
+
numUploadedFiles = _context14.sent;
|
|
9331
|
+
if (numUploadedFiles > 0) {
|
|
9332
|
+
logger.info("Successfully uploaded source maps to Sentry");
|
|
9333
|
+
}
|
|
9334
|
+
case 25:
|
|
9335
|
+
_context14.next = 31;
|
|
9243
9336
|
break;
|
|
9244
|
-
case
|
|
9245
|
-
|
|
9246
|
-
|
|
9337
|
+
case 27:
|
|
9338
|
+
_context14.prev = 27;
|
|
9339
|
+
_context14.t0 = _context14["catch"](1);
|
|
9247
9340
|
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
9248
|
-
handleRecoverableError(
|
|
9249
|
-
case
|
|
9250
|
-
|
|
9341
|
+
handleRecoverableError(_context14.t0, false);
|
|
9342
|
+
case 31:
|
|
9343
|
+
_context14.prev = 31;
|
|
9251
9344
|
if (folderToCleanUp && !((_process$env2 = process.env) !== null && _process$env2 !== void 0 && _process$env2["SENTRY_TEST_OVERRIDE_TEMP_DIR"])) {
|
|
9252
9345
|
void startSpan({
|
|
9253
9346
|
name: "cleanup",
|
|
9254
9347
|
scope: sentryScope
|
|
9255
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9256
|
-
return _regeneratorRuntime().wrap(function
|
|
9257
|
-
while (1) switch (
|
|
9348
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
9349
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
9350
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
9258
9351
|
case 0:
|
|
9259
9352
|
if (!folderToCleanUp) {
|
|
9260
|
-
|
|
9353
|
+
_context13.next = 3;
|
|
9261
9354
|
break;
|
|
9262
9355
|
}
|
|
9263
|
-
|
|
9356
|
+
_context13.next = 3;
|
|
9264
9357
|
return fs.promises.rm(folderToCleanUp, {
|
|
9265
9358
|
recursive: true,
|
|
9266
9359
|
force: true
|
|
9267
9360
|
});
|
|
9268
9361
|
case 3:
|
|
9269
9362
|
case "end":
|
|
9270
|
-
return
|
|
9363
|
+
return _context13.stop();
|
|
9271
9364
|
}
|
|
9272
|
-
},
|
|
9365
|
+
}, _callee13);
|
|
9273
9366
|
})));
|
|
9274
9367
|
}
|
|
9275
9368
|
freeUploadDependencyOnBuildArtifacts();
|
|
9276
|
-
|
|
9369
|
+
_context14.next = 36;
|
|
9277
9370
|
return safeFlushTelemetry(sentryClient);
|
|
9278
|
-
case 35:
|
|
9279
|
-
return _context10.finish(30);
|
|
9280
9371
|
case 36:
|
|
9372
|
+
return _context14.finish(31);
|
|
9373
|
+
case 37:
|
|
9281
9374
|
case "end":
|
|
9282
|
-
return
|
|
9375
|
+
return _context14.stop();
|
|
9283
9376
|
}
|
|
9284
|
-
},
|
|
9377
|
+
}, _callee14, null, [[1, 27, 31, 37]]);
|
|
9285
9378
|
})));
|
|
9286
|
-
case
|
|
9379
|
+
case 4:
|
|
9287
9380
|
case "end":
|
|
9288
|
-
return
|
|
9381
|
+
return _context15.stop();
|
|
9289
9382
|
}
|
|
9290
|
-
},
|
|
9383
|
+
}, _callee15);
|
|
9291
9384
|
}))();
|
|
9292
9385
|
},
|
|
9293
9386
|
/**
|
|
9294
9387
|
* Will delete artifacts based on the passed `sourcemaps.filesToDeleteAfterUpload` option.
|
|
9295
9388
|
*/
|
|
9296
9389
|
deleteArtifacts: function deleteArtifacts() {
|
|
9297
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9390
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
9298
9391
|
var _options$sourcemaps5, filesToDelete, filePathsToDelete;
|
|
9299
|
-
return _regeneratorRuntime().wrap(function
|
|
9300
|
-
while (1) switch (
|
|
9392
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
9393
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
9301
9394
|
case 0:
|
|
9302
|
-
|
|
9303
|
-
|
|
9395
|
+
_context16.prev = 0;
|
|
9396
|
+
_context16.next = 3;
|
|
9304
9397
|
return (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.filesToDeleteAfterUpload;
|
|
9305
9398
|
case 3:
|
|
9306
|
-
filesToDelete =
|
|
9399
|
+
filesToDelete = _context16.sent;
|
|
9307
9400
|
if (!(filesToDelete !== undefined)) {
|
|
9308
|
-
|
|
9401
|
+
_context16.next = 14;
|
|
9309
9402
|
break;
|
|
9310
9403
|
}
|
|
9311
|
-
|
|
9404
|
+
_context16.next = 7;
|
|
9312
9405
|
return glob(filesToDelete, {
|
|
9313
9406
|
absolute: true,
|
|
9314
9407
|
nodir: true
|
|
9315
9408
|
});
|
|
9316
9409
|
case 7:
|
|
9317
|
-
filePathsToDelete =
|
|
9410
|
+
filePathsToDelete = _context16.sent;
|
|
9318
9411
|
logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
|
|
9319
|
-
|
|
9412
|
+
_context16.next = 11;
|
|
9320
9413
|
return waitUntilBuildArtifactDependenciesAreFreed();
|
|
9321
9414
|
case 11:
|
|
9322
9415
|
filePathsToDelete.forEach(function (filePathToDelete) {
|
|
9323
9416
|
logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
|
|
9324
9417
|
});
|
|
9325
|
-
|
|
9418
|
+
_context16.next = 14;
|
|
9326
9419
|
return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
|
|
9327
9420
|
return fs.promises.rm(filePathToDelete, {
|
|
9328
9421
|
force: true
|
|
@@ -9332,28 +9425,52 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9332
9425
|
});
|
|
9333
9426
|
}));
|
|
9334
9427
|
case 14:
|
|
9335
|
-
|
|
9428
|
+
_context16.next = 22;
|
|
9336
9429
|
break;
|
|
9337
9430
|
case 16:
|
|
9338
|
-
|
|
9339
|
-
|
|
9431
|
+
_context16.prev = 16;
|
|
9432
|
+
_context16.t0 = _context16["catch"](0);
|
|
9340
9433
|
sentryScope.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
|
|
9341
|
-
|
|
9434
|
+
_context16.next = 21;
|
|
9342
9435
|
return safeFlushTelemetry(sentryClient);
|
|
9343
9436
|
case 21:
|
|
9344
9437
|
// We throw by default if we get here b/c not being able to delete
|
|
9345
9438
|
// source maps could leak them to production
|
|
9346
|
-
handleRecoverableError(
|
|
9439
|
+
handleRecoverableError(_context16.t0, true);
|
|
9347
9440
|
case 22:
|
|
9348
9441
|
case "end":
|
|
9349
|
-
return
|
|
9442
|
+
return _context16.stop();
|
|
9350
9443
|
}
|
|
9351
|
-
},
|
|
9444
|
+
}, _callee16, null, [[0, 16]]);
|
|
9352
9445
|
}))();
|
|
9353
9446
|
},
|
|
9354
9447
|
createDependencyOnBuildArtifacts: createDependencyOnBuildArtifacts
|
|
9355
9448
|
};
|
|
9356
9449
|
}
|
|
9450
|
+
function canUploadSourceMaps(options, logger, isDevMode) {
|
|
9451
|
+
var _options$sourcemaps6;
|
|
9452
|
+
if ((_options$sourcemaps6 = options.sourcemaps) !== null && _options$sourcemaps6 !== void 0 && _options$sourcemaps6.disable) {
|
|
9453
|
+
logger.debug("Source map upload was disabled. Will not upload sourcemaps using debug ID process.");
|
|
9454
|
+
return false;
|
|
9455
|
+
}
|
|
9456
|
+
if (isDevMode) {
|
|
9457
|
+
logger.debug("Running in development mode. Will not upload sourcemaps.");
|
|
9458
|
+
return false;
|
|
9459
|
+
}
|
|
9460
|
+
if (!options.authToken) {
|
|
9461
|
+
logger.warn("No auth token provided. Will not upload source maps. 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"));
|
|
9462
|
+
return false;
|
|
9463
|
+
}
|
|
9464
|
+
if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9465
|
+
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9466
|
+
return false;
|
|
9467
|
+
}
|
|
9468
|
+
if (!options.project) {
|
|
9469
|
+
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9470
|
+
return false;
|
|
9471
|
+
}
|
|
9472
|
+
return true;
|
|
9473
|
+
}
|
|
9357
9474
|
|
|
9358
9475
|
/**
|
|
9359
9476
|
* Creates an unplugin instance used to create Sentry plugins for Vite, Rollup, esbuild, and Webpack.
|
|
@@ -9449,13 +9566,13 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9449
9566
|
});
|
|
9450
9567
|
if (!((_options$sourcemaps = options.sourcemaps) !== null && _options$sourcemaps !== void 0 && _options$sourcemaps.disable)) {
|
|
9451
9568
|
plugins.push(debugIdInjectionPlugin(logger));
|
|
9452
|
-
}
|
|
9453
9569
|
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9570
|
+
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
|
|
9571
|
+
var _webpack_forceExitOnBuildComplete = typeof options._experiments["forceExitOnBuildCompletion"] === "boolean" ? options._experiments["forceExitOnBuildCompletion"] : undefined;
|
|
9572
|
+
plugins.push(debugIdUploadPlugin(createDebugIdUploadFunction({
|
|
9573
|
+
sentryBuildPluginManager: sentryBuildPluginManager
|
|
9574
|
+
}), logger, sentryBuildPluginManager.createDependencyOnBuildArtifacts, _webpack_forceExitOnBuildComplete));
|
|
9575
|
+
}
|
|
9459
9576
|
if (options.reactComponentAnnotation) {
|
|
9460
9577
|
if (!options.reactComponentAnnotation.enabled) {
|
|
9461
9578
|
logger.debug("The component name annotate plugin is currently disabled. Skipping component name annotations.");
|
|
@@ -9489,23 +9606,11 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9489
9606
|
}
|
|
9490
9607
|
|
|
9491
9608
|
/**
|
|
9492
|
-
* @deprecated
|
|
9609
|
+
* @deprecated This will be removed in v4
|
|
9493
9610
|
*/
|
|
9494
|
-
// TODO(v4): Don't export this from the package
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
var _ref2 = packageJson ? getDependencies(packageJson) : {
|
|
9498
|
-
deps: [],
|
|
9499
|
-
depsVersions: {}
|
|
9500
|
-
},
|
|
9501
|
-
deps = _ref2.deps,
|
|
9502
|
-
depsVersions = _ref2.depsVersions;
|
|
9503
|
-
return {
|
|
9504
|
-
deps: deps,
|
|
9505
|
-
depsVersions: depsVersions,
|
|
9506
|
-
nodeVersion: parseMajorVersion(process.version)
|
|
9507
|
-
};
|
|
9508
|
-
}
|
|
9611
|
+
// TODO(v4): Don't export this from the package but keep the utils version
|
|
9612
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
9613
|
+
var getBuildInformation = getBuildInformation$1;
|
|
9509
9614
|
|
|
9510
9615
|
/**
|
|
9511
9616
|
* Determines whether the Sentry CLI binary is in its expected location.
|
|
@@ -9578,6 +9683,13 @@ function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
|
9578
9683
|
var COMMENT_USE_STRICT_REGEX =
|
|
9579
9684
|
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
9580
9685
|
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
9686
|
+
|
|
9687
|
+
/**
|
|
9688
|
+
* Simplified `renderChunk` hook type from Rollup.
|
|
9689
|
+
* We can't reference the type directly because the Vite plugin complains
|
|
9690
|
+
* about type mismatches
|
|
9691
|
+
*/
|
|
9692
|
+
|
|
9581
9693
|
function createRollupDebugIdInjectionHooks() {
|
|
9582
9694
|
return {
|
|
9583
9695
|
renderChunk: function renderChunk(code, chunk) {
|