@sentry/bundler-plugin-core 4.2.0 → 4.3.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 +100 -85
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +100 -85
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/build-plugin-manager.d.ts.map +1 -1
- package/dist/types/options-mapping.d.ts +1 -1
- package/dist/types/options-mapping.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -8102,7 +8102,7 @@ function normalizeUserOptions(userOptions) {
|
|
|
8102
8102
|
* @returns `true` if the options are valid, `false` otherwise
|
|
8103
8103
|
*/
|
|
8104
8104
|
function validateOptions(options, logger) {
|
|
8105
|
-
var _options$release, _options$release2
|
|
8105
|
+
var _options$release, _options$release2;
|
|
8106
8106
|
var setCommits = (_options$release = options.release) === null || _options$release === void 0 ? void 0 : _options$release.setCommits;
|
|
8107
8107
|
if (setCommits) {
|
|
8108
8108
|
if (!setCommits.auto && !(setCommits.repo && setCommits.commit)) {
|
|
@@ -8113,7 +8113,7 @@ function validateOptions(options, logger) {
|
|
|
8113
8113
|
logger.warn("The `setCommits` options includes `auto` but also `repo` and `commit`.", "Ignoring `repo` and `commit`.", "Please only set either `auto` or both, `repo` and `commit`.");
|
|
8114
8114
|
}
|
|
8115
8115
|
}
|
|
8116
|
-
if ((_options$release2 = options.release) !== null && _options$release2 !== void 0 && _options$release2.deploy &&
|
|
8116
|
+
if ((_options$release2 = options.release) !== null && _options$release2 !== void 0 && _options$release2.deploy && _typeof(options.release.deploy) === "object" && !options.release.deploy.env) {
|
|
8117
8117
|
logger.error("The `deploy` option was specified but is missing the required `env` property.", "Please set the `env` property.");
|
|
8118
8118
|
return false;
|
|
8119
8119
|
}
|
|
@@ -8307,7 +8307,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
|
8307
8307
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8308
8308
|
tracesSampleRate: 1,
|
|
8309
8309
|
sampleRate: 1,
|
|
8310
|
-
release: "4.
|
|
8310
|
+
release: "4.3.0",
|
|
8311
8311
|
integrations: [],
|
|
8312
8312
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8313
8313
|
stackParser: stackParser,
|
|
@@ -8910,7 +8910,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8910
8910
|
});
|
|
8911
8911
|
|
|
8912
8912
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8913
|
-
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.
|
|
8913
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.3.0");
|
|
8914
8914
|
|
|
8915
8915
|
// Not a bulletproof check but should be good enough to at least sometimes determine
|
|
8916
8916
|
// if the plugin is called in dev/watch mode or for a prod build. The important part
|
|
@@ -9313,6 +9313,8 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9313
9313
|
*/
|
|
9314
9314
|
uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths, opts) {
|
|
9315
9315
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
9316
|
+
var _options$sourcemaps;
|
|
9317
|
+
var assets;
|
|
9316
9318
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
9317
9319
|
while (1) switch (_context19.prev = _context19.next) {
|
|
9318
9320
|
case 0:
|
|
@@ -9322,7 +9324,16 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9322
9324
|
}
|
|
9323
9325
|
return _context19.abrupt("return");
|
|
9324
9326
|
case 2:
|
|
9325
|
-
|
|
9327
|
+
// Early exit if assets is explicitly set to an empty array
|
|
9328
|
+
assets = (_options$sourcemaps = options.sourcemaps) === null || _options$sourcemaps === void 0 ? void 0 : _options$sourcemaps.assets;
|
|
9329
|
+
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
9330
|
+
_context19.next = 6;
|
|
9331
|
+
break;
|
|
9332
|
+
}
|
|
9333
|
+
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
9334
|
+
return _context19.abrupt("return");
|
|
9335
|
+
case 6:
|
|
9336
|
+
_context19.next = 8;
|
|
9326
9337
|
return startSpan(
|
|
9327
9338
|
// This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
|
|
9328
9339
|
{
|
|
@@ -9331,7 +9342,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9331
9342
|
forceTransaction: true
|
|
9332
9343
|
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
9333
9344
|
var _opts$prepareArtifact;
|
|
9334
|
-
var shouldPrepare, folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$
|
|
9345
|
+
var shouldPrepare, folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$sourcemaps2, _options$sourcemaps3, _options$sourcemaps4, _options$sourcemaps5, pathsToUpload, ignorePaths, globAssets, globResult, debugIdChunkFilePaths, tmpUploadFolder, _process$env2;
|
|
9335
9346
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
9336
9347
|
while (1) switch (_context18.prev = _context18.next) {
|
|
9337
9348
|
case 0:
|
|
@@ -9341,96 +9352,100 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9341
9352
|
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
9342
9353
|
freeUploadDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
9343
9354
|
_context18.prev = 2;
|
|
9344
|
-
|
|
9355
|
+
if (shouldPrepare) {
|
|
9356
|
+
_context18.next = 11;
|
|
9357
|
+
break;
|
|
9358
|
+
}
|
|
9359
|
+
// Direct CLI upload from existing artifact paths (no globbing, no preparation)
|
|
9360
|
+
|
|
9345
9361
|
if (assets) {
|
|
9346
|
-
|
|
9362
|
+
pathsToUpload = Array.isArray(assets) ? assets : [assets];
|
|
9363
|
+
logger.debug("Direct upload mode: passing user-provided assets directly to CLI: ".concat(pathsToUpload.join(", ")));
|
|
9347
9364
|
} else {
|
|
9348
|
-
|
|
9349
|
-
|
|
9365
|
+
// Use original paths e.g. like ['.next/server'] directly –> preferred way when no globbing is done
|
|
9366
|
+
pathsToUpload = buildArtifactPaths;
|
|
9350
9367
|
}
|
|
9351
|
-
|
|
9368
|
+
ignorePaths = (_options$sourcemaps2 = options.sourcemaps) !== null && _options$sourcemaps2 !== void 0 && _options$sourcemaps2.ignore ? Array.isArray((_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.ignore) ? (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.ignore : [(_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.ignore] : [];
|
|
9369
|
+
_context18.next = 8;
|
|
9352
9370
|
return startSpan({
|
|
9353
|
-
name: "
|
|
9371
|
+
name: "upload",
|
|
9354
9372
|
scope: sentryScope
|
|
9355
9373
|
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
9356
|
-
var _options$
|
|
9374
|
+
var _options$release$name;
|
|
9375
|
+
var cliInstance;
|
|
9357
9376
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
9358
9377
|
while (1) switch (_context10.prev = _context10.next) {
|
|
9359
9378
|
case 0:
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
|
|
9379
|
+
cliInstance = createCliInstance(options);
|
|
9380
|
+
_context10.next = 3;
|
|
9381
|
+
return cliInstance.releases.uploadSourceMaps((_options$release$name = options.release.name) !== null && _options$release$name !== void 0 ? _options$release$name : "undefined", {
|
|
9382
|
+
include: [{
|
|
9383
|
+
paths: pathsToUpload,
|
|
9384
|
+
rewrite: true,
|
|
9385
|
+
dist: options.release.dist
|
|
9386
|
+
}],
|
|
9387
|
+
ignore: ignorePaths,
|
|
9388
|
+
live: "rejectOnError"
|
|
9366
9389
|
});
|
|
9367
|
-
case 2:
|
|
9368
|
-
return _context10.abrupt("return", _context10.sent);
|
|
9369
9390
|
case 3:
|
|
9370
9391
|
case "end":
|
|
9371
9392
|
return _context10.stop();
|
|
9372
9393
|
}
|
|
9373
9394
|
}, _callee10);
|
|
9374
9395
|
})));
|
|
9375
|
-
case
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
return !!stripQueryAndHashFromPath(debugIdChunkFilePath).match(/\.(js|mjs|cjs)$/);
|
|
9379
|
-
}) : globResult; // The order of the files output by glob() is not deterministic
|
|
9380
|
-
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
9381
|
-
debugIdChunkFilePaths.sort();
|
|
9382
|
-
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
9383
|
-
_context18.next = 14;
|
|
9384
|
-
break;
|
|
9385
|
-
}
|
|
9386
|
-
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
9387
|
-
_context18.next = 31;
|
|
9388
|
-
break;
|
|
9389
|
-
case 14:
|
|
9390
|
-
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
9391
|
-
_context18.next = 18;
|
|
9392
|
-
break;
|
|
9393
|
-
}
|
|
9394
|
-
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
9395
|
-
_context18.next = 31;
|
|
9396
|
+
case 8:
|
|
9397
|
+
logger.info("Successfully uploaded source maps to Sentry");
|
|
9398
|
+
_context18.next = 28;
|
|
9396
9399
|
break;
|
|
9397
|
-
case
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9400
|
+
case 11:
|
|
9401
|
+
// Prepare artifacts in temp folder before uploading
|
|
9402
|
+
|
|
9403
|
+
if (assets) {
|
|
9404
|
+
globAssets = assets;
|
|
9405
|
+
} else {
|
|
9406
|
+
logger.debug("No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.");
|
|
9407
|
+
globAssets = buildArtifactPaths;
|
|
9401
9408
|
}
|
|
9402
|
-
_context18.next =
|
|
9409
|
+
_context18.next = 14;
|
|
9403
9410
|
return startSpan({
|
|
9404
|
-
name: "
|
|
9411
|
+
name: "glob",
|
|
9405
9412
|
scope: sentryScope
|
|
9406
9413
|
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
9407
|
-
var _options$
|
|
9408
|
-
var cliInstance;
|
|
9414
|
+
var _options$sourcemaps6;
|
|
9409
9415
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
9410
9416
|
while (1) switch (_context11.prev = _context11.next) {
|
|
9411
9417
|
case 0:
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
dist: options.release.dist
|
|
9419
|
-
}],
|
|
9420
|
-
live: "rejectOnError"
|
|
9418
|
+
_context11.next = 2;
|
|
9419
|
+
return glob.glob(globAssets, {
|
|
9420
|
+
absolute: true,
|
|
9421
|
+
nodir: true,
|
|
9422
|
+
// We need individual files for preparation
|
|
9423
|
+
ignore: (_options$sourcemaps6 = options.sourcemaps) === null || _options$sourcemaps6 === void 0 ? void 0 : _options$sourcemaps6.ignore
|
|
9421
9424
|
});
|
|
9425
|
+
case 2:
|
|
9426
|
+
return _context11.abrupt("return", _context11.sent);
|
|
9422
9427
|
case 3:
|
|
9423
9428
|
case "end":
|
|
9424
9429
|
return _context11.stop();
|
|
9425
9430
|
}
|
|
9426
9431
|
}, _callee11);
|
|
9427
9432
|
})));
|
|
9428
|
-
case
|
|
9429
|
-
|
|
9430
|
-
|
|
9433
|
+
case 14:
|
|
9434
|
+
globResult = _context18.sent;
|
|
9435
|
+
debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
|
|
9436
|
+
return !!stripQueryAndHashFromPath(debugIdChunkFilePath).match(/\.(js|mjs|cjs)$/);
|
|
9437
|
+
}); // The order of the files output by glob() is not deterministic
|
|
9438
|
+
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
9439
|
+
debugIdChunkFilePaths.sort();
|
|
9440
|
+
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
9441
|
+
_context18.next = 21;
|
|
9442
|
+
break;
|
|
9443
|
+
}
|
|
9444
|
+
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
9445
|
+
_context18.next = 28;
|
|
9431
9446
|
break;
|
|
9432
|
-
case
|
|
9433
|
-
_context18.next =
|
|
9447
|
+
case 21:
|
|
9448
|
+
_context18.next = 23;
|
|
9434
9449
|
return startSpan({
|
|
9435
9450
|
name: "mkdtemp",
|
|
9436
9451
|
scope: sentryScope
|
|
@@ -9456,12 +9471,12 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9456
9471
|
}
|
|
9457
9472
|
}, _callee12);
|
|
9458
9473
|
})));
|
|
9459
|
-
case
|
|
9474
|
+
case 23:
|
|
9460
9475
|
tmpUploadFolder = _context18.sent;
|
|
9461
9476
|
folderToCleanUp = tmpUploadFolder;
|
|
9462
9477
|
|
|
9463
9478
|
// Prepare into temp folder, then upload
|
|
9464
|
-
_context18.next =
|
|
9479
|
+
_context18.next = 27;
|
|
9465
9480
|
return startSpan({
|
|
9466
9481
|
name: "prepare-bundles",
|
|
9467
9482
|
scope: sentryScope
|
|
@@ -9475,12 +9490,12 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9475
9490
|
// instead we do it with a maximum of 16 concurrent workers
|
|
9476
9491
|
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
9477
9492
|
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
9478
|
-
var _options$sourcemaps$r, _options$
|
|
9493
|
+
var _options$sourcemaps$r, _options$sourcemaps7, _options$sourcemaps8;
|
|
9479
9494
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
9480
9495
|
while (1) switch (_context13.prev = _context13.next) {
|
|
9481
9496
|
case 0:
|
|
9482
9497
|
_context13.next = 2;
|
|
9483
|
-
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$
|
|
9498
|
+
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$sourcemaps7 = options.sourcemaps) === null || _options$sourcemaps7 === void 0 ? void 0 : _options$sourcemaps7.rewriteSources) !== null && _options$sourcemaps$r !== void 0 ? _options$sourcemaps$r : defaultRewriteSourcesHook, (_options$sourcemaps8 = options.sourcemaps) === null || _options$sourcemaps8 === void 0 ? void 0 : _options$sourcemaps8.resolveSourceMap);
|
|
9484
9499
|
case 2:
|
|
9485
9500
|
case "end":
|
|
9486
9501
|
return _context13.stop();
|
|
@@ -9577,18 +9592,18 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9577
9592
|
return _ref6.apply(this, arguments);
|
|
9578
9593
|
};
|
|
9579
9594
|
}());
|
|
9580
|
-
case
|
|
9595
|
+
case 27:
|
|
9581
9596
|
logger.info("Successfully uploaded source maps to Sentry");
|
|
9582
|
-
case
|
|
9583
|
-
_context18.next =
|
|
9597
|
+
case 28:
|
|
9598
|
+
_context18.next = 34;
|
|
9584
9599
|
break;
|
|
9585
|
-
case
|
|
9586
|
-
_context18.prev =
|
|
9600
|
+
case 30:
|
|
9601
|
+
_context18.prev = 30;
|
|
9587
9602
|
_context18.t0 = _context18["catch"](2);
|
|
9588
9603
|
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
9589
9604
|
handleRecoverableError(_context18.t0, false);
|
|
9590
|
-
case
|
|
9591
|
-
_context18.prev =
|
|
9605
|
+
case 34:
|
|
9606
|
+
_context18.prev = 34;
|
|
9592
9607
|
if (folderToCleanUp && !((_process$env2 = process.env) !== null && _process$env2 !== void 0 && _process$env2["SENTRY_TEST_OVERRIDE_TEMP_DIR"])) {
|
|
9593
9608
|
void startSpan({
|
|
9594
9609
|
name: "cleanup",
|
|
@@ -9614,17 +9629,17 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9614
9629
|
})));
|
|
9615
9630
|
}
|
|
9616
9631
|
freeUploadDependencyOnBuildArtifacts();
|
|
9617
|
-
_context18.next =
|
|
9632
|
+
_context18.next = 39;
|
|
9618
9633
|
return safeFlushTelemetry(sentryClient);
|
|
9619
|
-
case
|
|
9620
|
-
return _context18.finish(
|
|
9621
|
-
case
|
|
9634
|
+
case 39:
|
|
9635
|
+
return _context18.finish(34);
|
|
9636
|
+
case 40:
|
|
9622
9637
|
case "end":
|
|
9623
9638
|
return _context18.stop();
|
|
9624
9639
|
}
|
|
9625
|
-
}, _callee18, null, [[2,
|
|
9640
|
+
}, _callee18, null, [[2, 30, 34, 40]]);
|
|
9626
9641
|
})));
|
|
9627
|
-
case
|
|
9642
|
+
case 8:
|
|
9628
9643
|
case "end":
|
|
9629
9644
|
return _context19.stop();
|
|
9630
9645
|
}
|
|
@@ -9636,13 +9651,13 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9636
9651
|
*/
|
|
9637
9652
|
deleteArtifacts: function deleteArtifacts() {
|
|
9638
9653
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
9639
|
-
var _options$
|
|
9654
|
+
var _options$sourcemaps9, filesToDelete, filePathsToDelete;
|
|
9640
9655
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
9641
9656
|
while (1) switch (_context20.prev = _context20.next) {
|
|
9642
9657
|
case 0:
|
|
9643
9658
|
_context20.prev = 0;
|
|
9644
9659
|
_context20.next = 3;
|
|
9645
|
-
return (_options$
|
|
9660
|
+
return (_options$sourcemaps9 = options.sourcemaps) === null || _options$sourcemaps9 === void 0 ? void 0 : _options$sourcemaps9.filesToDeleteAfterUpload;
|
|
9646
9661
|
case 3:
|
|
9647
9662
|
filesToDelete = _context20.sent;
|
|
9648
9663
|
if (!(filesToDelete !== undefined)) {
|
|
@@ -9696,8 +9711,8 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9696
9711
|
};
|
|
9697
9712
|
}
|
|
9698
9713
|
function canUploadSourceMaps(options, logger, isDevMode) {
|
|
9699
|
-
var _options$
|
|
9700
|
-
if ((_options$
|
|
9714
|
+
var _options$sourcemaps10;
|
|
9715
|
+
if ((_options$sourcemaps10 = options.sourcemaps) !== null && _options$sourcemaps10 !== void 0 && _options$sourcemaps10.disable) {
|
|
9701
9716
|
logger.debug("Source map upload was disabled. Will not upload sourcemaps using debug ID process.");
|
|
9702
9717
|
return false;
|
|
9703
9718
|
}
|