@sentry/bundler-plugin-core 4.1.1 → 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 +203 -149
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +203 -149
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/build-plugin-manager.d.ts +3 -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 +8 -8
package/dist/esm/index.mjs
CHANGED
|
@@ -8065,7 +8065,7 @@ function normalizeUserOptions(userOptions) {
|
|
|
8065
8065
|
* @returns `true` if the options are valid, `false` otherwise
|
|
8066
8066
|
*/
|
|
8067
8067
|
function validateOptions(options, logger) {
|
|
8068
|
-
var _options$release, _options$release2
|
|
8068
|
+
var _options$release, _options$release2;
|
|
8069
8069
|
var setCommits = (_options$release = options.release) === null || _options$release === void 0 ? void 0 : _options$release.setCommits;
|
|
8070
8070
|
if (setCommits) {
|
|
8071
8071
|
if (!setCommits.auto && !(setCommits.repo && setCommits.commit)) {
|
|
@@ -8076,7 +8076,7 @@ function validateOptions(options, logger) {
|
|
|
8076
8076
|
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`.");
|
|
8077
8077
|
}
|
|
8078
8078
|
}
|
|
8079
|
-
if ((_options$release2 = options.release) !== null && _options$release2 !== void 0 && _options$release2.deploy &&
|
|
8079
|
+
if ((_options$release2 = options.release) !== null && _options$release2 !== void 0 && _options$release2.deploy && _typeof(options.release.deploy) === "object" && !options.release.deploy.env) {
|
|
8080
8080
|
logger.error("The `deploy` option was specified but is missing the required `env` property.", "Please set the `env` property.");
|
|
8081
8081
|
return false;
|
|
8082
8082
|
}
|
|
@@ -8270,7 +8270,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
|
8270
8270
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8271
8271
|
tracesSampleRate: 1,
|
|
8272
8272
|
sampleRate: 1,
|
|
8273
|
-
release: "4.
|
|
8273
|
+
release: "4.3.0",
|
|
8274
8274
|
integrations: [],
|
|
8275
8275
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8276
8276
|
stackParser: stackParser,
|
|
@@ -8715,7 +8715,7 @@ function createCliInstance(options) {
|
|
|
8715
8715
|
silent: options.silent,
|
|
8716
8716
|
url: options.url,
|
|
8717
8717
|
vcsRemote: options.release.vcsRemote,
|
|
8718
|
-
headers: _objectSpread2({}, getTraceData())
|
|
8718
|
+
headers: _objectSpread2(_objectSpread2({}, getTraceData()), options.headers)
|
|
8719
8719
|
});
|
|
8720
8720
|
}
|
|
8721
8721
|
|
|
@@ -8873,7 +8873,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8873
8873
|
});
|
|
8874
8874
|
|
|
8875
8875
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8876
|
-
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.
|
|
8876
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.3.0");
|
|
8877
8877
|
|
|
8878
8878
|
// Not a bulletproof check but should be good enough to at least sometimes determine
|
|
8879
8879
|
// if the plugin is called in dev/watch mode or for a prod build. The important part
|
|
@@ -9265,77 +9265,116 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9265
9265
|
}))();
|
|
9266
9266
|
},
|
|
9267
9267
|
/**
|
|
9268
|
-
* Uploads sourcemaps using the "Debug ID" method.
|
|
9268
|
+
* Uploads sourcemaps using the "Debug ID" method.
|
|
9269
|
+
*
|
|
9270
|
+
* By default, this prepares bundles in a temporary folder before uploading. You can opt into an
|
|
9271
|
+
* in-place, direct upload path by setting `prepareArtifacts` to `false`. If `prepareArtifacts` is set to
|
|
9272
|
+
* `false`, no preparation (e.g. adding `//# debugId=...` and writing adjusted source maps) is performed and no temp folder is used.
|
|
9273
|
+
*
|
|
9274
|
+
* @param buildArtifactPaths - The paths of the build artifacts to upload
|
|
9275
|
+
* @param opts - Optional flags to control temp folder usage and preparation
|
|
9269
9276
|
*/
|
|
9270
|
-
uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths) {
|
|
9271
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9272
|
-
|
|
9273
|
-
|
|
9277
|
+
uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths, opts) {
|
|
9278
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
9279
|
+
var _options$sourcemaps;
|
|
9280
|
+
var assets;
|
|
9281
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
9282
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
9274
9283
|
case 0:
|
|
9275
9284
|
if (canUploadSourceMaps(options, logger, isDevMode)) {
|
|
9276
|
-
|
|
9285
|
+
_context19.next = 2;
|
|
9277
9286
|
break;
|
|
9278
9287
|
}
|
|
9279
|
-
return
|
|
9288
|
+
return _context19.abrupt("return");
|
|
9280
9289
|
case 2:
|
|
9281
|
-
|
|
9290
|
+
// Early exit if assets is explicitly set to an empty array
|
|
9291
|
+
assets = (_options$sourcemaps = options.sourcemaps) === null || _options$sourcemaps === void 0 ? void 0 : _options$sourcemaps.assets;
|
|
9292
|
+
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
9293
|
+
_context19.next = 6;
|
|
9294
|
+
break;
|
|
9295
|
+
}
|
|
9296
|
+
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
9297
|
+
return _context19.abrupt("return");
|
|
9298
|
+
case 6:
|
|
9299
|
+
_context19.next = 8;
|
|
9282
9300
|
return startSpan(
|
|
9283
9301
|
// This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
|
|
9284
9302
|
{
|
|
9285
9303
|
name: "debug-id-sourcemap-upload",
|
|
9286
9304
|
scope: sentryScope,
|
|
9287
9305
|
forceTransaction: true
|
|
9288
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9289
|
-
var
|
|
9290
|
-
|
|
9291
|
-
|
|
9306
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
9307
|
+
var _opts$prepareArtifact;
|
|
9308
|
+
var shouldPrepare, folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$sourcemaps2, _options$sourcemaps3, _options$sourcemaps4, _options$sourcemaps5, pathsToUpload, ignorePaths, globAssets, globResult, debugIdChunkFilePaths, tmpUploadFolder, _process$env2;
|
|
9309
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
9310
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
9292
9311
|
case 0:
|
|
9312
|
+
// If we're not using a temp folder, we must not prepare artifacts in-place (to avoid mutating user files)
|
|
9313
|
+
shouldPrepare = (_opts$prepareArtifact = opts === null || opts === void 0 ? void 0 : opts.prepareArtifacts) !== null && _opts$prepareArtifact !== void 0 ? _opts$prepareArtifact : true;
|
|
9293
9314
|
// 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`)
|
|
9294
9315
|
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
9295
9316
|
freeUploadDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
9296
|
-
|
|
9297
|
-
|
|
9317
|
+
_context18.prev = 2;
|
|
9318
|
+
if (shouldPrepare) {
|
|
9319
|
+
_context18.next = 11;
|
|
9320
|
+
break;
|
|
9321
|
+
}
|
|
9322
|
+
// Direct CLI upload from existing artifact paths (no globbing, no preparation)
|
|
9323
|
+
|
|
9324
|
+
if (assets) {
|
|
9325
|
+
pathsToUpload = Array.isArray(assets) ? assets : [assets];
|
|
9326
|
+
logger.debug("Direct upload mode: passing user-provided assets directly to CLI: ".concat(pathsToUpload.join(", ")));
|
|
9327
|
+
} else {
|
|
9328
|
+
// Use original paths e.g. like ['.next/server'] directly –> preferred way when no globbing is done
|
|
9329
|
+
pathsToUpload = buildArtifactPaths;
|
|
9330
|
+
}
|
|
9331
|
+
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] : [];
|
|
9332
|
+
_context18.next = 8;
|
|
9298
9333
|
return startSpan({
|
|
9299
|
-
name: "
|
|
9334
|
+
name: "upload",
|
|
9300
9335
|
scope: sentryScope
|
|
9301
9336
|
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
9302
|
-
var
|
|
9337
|
+
var _options$release$name;
|
|
9338
|
+
var cliInstance;
|
|
9303
9339
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
9304
9340
|
while (1) switch (_context10.prev = _context10.next) {
|
|
9305
9341
|
case 0:
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
case
|
|
9342
|
+
cliInstance = createCliInstance(options);
|
|
9343
|
+
_context10.next = 3;
|
|
9344
|
+
return cliInstance.releases.uploadSourceMaps((_options$release$name = options.release.name) !== null && _options$release$name !== void 0 ? _options$release$name : "undefined", {
|
|
9345
|
+
include: [{
|
|
9346
|
+
paths: pathsToUpload,
|
|
9347
|
+
rewrite: true,
|
|
9348
|
+
dist: options.release.dist
|
|
9349
|
+
}],
|
|
9350
|
+
ignore: ignorePaths,
|
|
9351
|
+
live: "rejectOnError"
|
|
9352
|
+
});
|
|
9353
|
+
case 3:
|
|
9318
9354
|
case "end":
|
|
9319
9355
|
return _context10.stop();
|
|
9320
9356
|
}
|
|
9321
9357
|
}, _callee10);
|
|
9322
9358
|
})));
|
|
9323
|
-
case
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9359
|
+
case 8:
|
|
9360
|
+
logger.info("Successfully uploaded source maps to Sentry");
|
|
9361
|
+
_context18.next = 28;
|
|
9362
|
+
break;
|
|
9363
|
+
case 11:
|
|
9364
|
+
// Prepare artifacts in temp folder before uploading
|
|
9365
|
+
|
|
9327
9366
|
if (assets) {
|
|
9328
9367
|
globAssets = assets;
|
|
9329
9368
|
} else {
|
|
9330
9369
|
logger.debug("No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.");
|
|
9331
9370
|
globAssets = buildArtifactPaths;
|
|
9332
9371
|
}
|
|
9333
|
-
|
|
9372
|
+
_context18.next = 14;
|
|
9334
9373
|
return startSpan({
|
|
9335
9374
|
name: "glob",
|
|
9336
9375
|
scope: sentryScope
|
|
9337
9376
|
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
9338
|
-
var _options$
|
|
9377
|
+
var _options$sourcemaps6;
|
|
9339
9378
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
9340
9379
|
while (1) switch (_context11.prev = _context11.next) {
|
|
9341
9380
|
case 0:
|
|
@@ -9343,7 +9382,8 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9343
9382
|
return glob(globAssets, {
|
|
9344
9383
|
absolute: true,
|
|
9345
9384
|
nodir: true,
|
|
9346
|
-
|
|
9385
|
+
// We need individual files for preparation
|
|
9386
|
+
ignore: (_options$sourcemaps6 = options.sourcemaps) === null || _options$sourcemaps6 === void 0 ? void 0 : _options$sourcemaps6.ignore
|
|
9347
9387
|
});
|
|
9348
9388
|
case 2:
|
|
9349
9389
|
return _context11.abrupt("return", _context11.sent);
|
|
@@ -9353,241 +9393,255 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9353
9393
|
}
|
|
9354
9394
|
}, _callee11);
|
|
9355
9395
|
})));
|
|
9356
|
-
case
|
|
9357
|
-
globResult =
|
|
9396
|
+
case 14:
|
|
9397
|
+
globResult = _context18.sent;
|
|
9358
9398
|
debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
|
|
9359
9399
|
return !!stripQueryAndHashFromPath(debugIdChunkFilePath).match(/\.(js|mjs|cjs)$/);
|
|
9360
9400
|
}); // The order of the files output by glob() is not deterministic
|
|
9361
9401
|
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
9362
9402
|
debugIdChunkFilePaths.sort();
|
|
9363
|
-
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
9364
|
-
_context17.next = 17;
|
|
9365
|
-
break;
|
|
9366
|
-
}
|
|
9367
|
-
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
9368
|
-
_context17.next = 25;
|
|
9369
|
-
break;
|
|
9370
|
-
case 17:
|
|
9371
9403
|
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
9372
|
-
|
|
9404
|
+
_context18.next = 21;
|
|
9373
9405
|
break;
|
|
9374
9406
|
}
|
|
9375
9407
|
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
9376
|
-
|
|
9408
|
+
_context18.next = 28;
|
|
9377
9409
|
break;
|
|
9378
9410
|
case 21:
|
|
9379
|
-
|
|
9411
|
+
_context18.next = 23;
|
|
9412
|
+
return startSpan({
|
|
9413
|
+
name: "mkdtemp",
|
|
9414
|
+
scope: sentryScope
|
|
9415
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
9416
|
+
var _process$env;
|
|
9417
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
9418
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
9419
|
+
case 0:
|
|
9420
|
+
_context12.t0 = (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env["SENTRY_TEST_OVERRIDE_TEMP_DIR"];
|
|
9421
|
+
if (_context12.t0) {
|
|
9422
|
+
_context12.next = 5;
|
|
9423
|
+
break;
|
|
9424
|
+
}
|
|
9425
|
+
_context12.next = 4;
|
|
9426
|
+
return fs.promises.mkdtemp(path.join(os.tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
9427
|
+
case 4:
|
|
9428
|
+
_context12.t0 = _context12.sent;
|
|
9429
|
+
case 5:
|
|
9430
|
+
return _context12.abrupt("return", _context12.t0);
|
|
9431
|
+
case 6:
|
|
9432
|
+
case "end":
|
|
9433
|
+
return _context12.stop();
|
|
9434
|
+
}
|
|
9435
|
+
}, _callee12);
|
|
9436
|
+
})));
|
|
9437
|
+
case 23:
|
|
9438
|
+
tmpUploadFolder = _context18.sent;
|
|
9439
|
+
folderToCleanUp = tmpUploadFolder;
|
|
9440
|
+
|
|
9441
|
+
// Prepare into temp folder, then upload
|
|
9442
|
+
_context18.next = 27;
|
|
9380
9443
|
return startSpan({
|
|
9381
9444
|
name: "prepare-bundles",
|
|
9382
9445
|
scope: sentryScope
|
|
9383
9446
|
}, /*#__PURE__*/function () {
|
|
9384
|
-
var
|
|
9447
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(prepBundlesSpan) {
|
|
9385
9448
|
var preparationTasks, workers, worker, workerIndex, files, stats, uploadSize;
|
|
9386
|
-
return _regeneratorRuntime().wrap(function
|
|
9387
|
-
while (1) switch (
|
|
9449
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
9450
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
9388
9451
|
case 0:
|
|
9389
9452
|
// Preparing the bundles can be a lot of work and doing it all at once has the potential of nuking the heap so
|
|
9390
9453
|
// instead we do it with a maximum of 16 concurrent workers
|
|
9391
9454
|
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
9392
|
-
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9393
|
-
var _options$sourcemaps$r, _options$
|
|
9394
|
-
return _regeneratorRuntime().wrap(function
|
|
9395
|
-
while (1) switch (
|
|
9455
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
9456
|
+
var _options$sourcemaps$r, _options$sourcemaps7, _options$sourcemaps8;
|
|
9457
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
9458
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
9396
9459
|
case 0:
|
|
9397
|
-
|
|
9398
|
-
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$
|
|
9460
|
+
_context13.next = 2;
|
|
9461
|
+
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);
|
|
9399
9462
|
case 2:
|
|
9400
9463
|
case "end":
|
|
9401
|
-
return
|
|
9464
|
+
return _context13.stop();
|
|
9402
9465
|
}
|
|
9403
|
-
},
|
|
9466
|
+
}, _callee13);
|
|
9404
9467
|
}));
|
|
9405
9468
|
});
|
|
9406
9469
|
workers = [];
|
|
9407
9470
|
worker = /*#__PURE__*/function () {
|
|
9408
|
-
var
|
|
9471
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
9409
9472
|
var task;
|
|
9410
|
-
return _regeneratorRuntime().wrap(function
|
|
9411
|
-
while (1) switch (
|
|
9473
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
9474
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
9412
9475
|
case 0:
|
|
9413
9476
|
if (!(preparationTasks.length > 0)) {
|
|
9414
|
-
|
|
9477
|
+
_context14.next = 7;
|
|
9415
9478
|
break;
|
|
9416
9479
|
}
|
|
9417
9480
|
task = preparationTasks.shift();
|
|
9418
9481
|
if (!task) {
|
|
9419
|
-
|
|
9482
|
+
_context14.next = 5;
|
|
9420
9483
|
break;
|
|
9421
9484
|
}
|
|
9422
|
-
|
|
9485
|
+
_context14.next = 5;
|
|
9423
9486
|
return task();
|
|
9424
9487
|
case 5:
|
|
9425
|
-
|
|
9488
|
+
_context14.next = 0;
|
|
9426
9489
|
break;
|
|
9427
9490
|
case 7:
|
|
9428
9491
|
case "end":
|
|
9429
|
-
return
|
|
9492
|
+
return _context14.stop();
|
|
9430
9493
|
}
|
|
9431
|
-
},
|
|
9494
|
+
}, _callee14);
|
|
9432
9495
|
}));
|
|
9433
9496
|
return function worker() {
|
|
9434
|
-
return
|
|
9497
|
+
return _ref8.apply(this, arguments);
|
|
9435
9498
|
};
|
|
9436
9499
|
}();
|
|
9437
9500
|
for (workerIndex = 0; workerIndex < 16; workerIndex++) {
|
|
9438
9501
|
workers.push(worker());
|
|
9439
9502
|
}
|
|
9440
|
-
|
|
9503
|
+
_context16.next = 6;
|
|
9441
9504
|
return Promise.all(workers);
|
|
9442
9505
|
case 6:
|
|
9443
|
-
|
|
9506
|
+
_context16.next = 8;
|
|
9444
9507
|
return fs.promises.readdir(tmpUploadFolder);
|
|
9445
9508
|
case 8:
|
|
9446
|
-
files =
|
|
9509
|
+
files = _context16.sent;
|
|
9447
9510
|
stats = files.map(function (file) {
|
|
9448
9511
|
return fs.promises.stat(path.join(tmpUploadFolder, file));
|
|
9449
9512
|
});
|
|
9450
|
-
|
|
9513
|
+
_context16.next = 12;
|
|
9451
9514
|
return Promise.all(stats);
|
|
9452
9515
|
case 12:
|
|
9453
|
-
uploadSize =
|
|
9454
|
-
var size =
|
|
9516
|
+
uploadSize = _context16.sent.reduce(function (accumulator, _ref9) {
|
|
9517
|
+
var size = _ref9.size;
|
|
9455
9518
|
return accumulator + size;
|
|
9456
9519
|
}, 0);
|
|
9457
9520
|
setMeasurement("files", files.length, "none", prepBundlesSpan);
|
|
9458
9521
|
setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
|
|
9459
|
-
|
|
9522
|
+
_context16.next = 17;
|
|
9460
9523
|
return startSpan({
|
|
9461
9524
|
name: "upload",
|
|
9462
9525
|
scope: sentryScope
|
|
9463
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9464
|
-
var _options$release$
|
|
9526
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
9527
|
+
var _options$release$name2;
|
|
9465
9528
|
var cliInstance;
|
|
9466
|
-
return _regeneratorRuntime().wrap(function
|
|
9467
|
-
while (1) switch (
|
|
9529
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
9530
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
9468
9531
|
case 0:
|
|
9469
9532
|
cliInstance = createCliInstance(options);
|
|
9470
|
-
|
|
9471
|
-
return cliInstance.releases.uploadSourceMaps((_options$release$
|
|
9472
|
-
// unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
9473
|
-
{
|
|
9533
|
+
_context15.next = 3;
|
|
9534
|
+
return cliInstance.releases.uploadSourceMaps((_options$release$name2 = options.release.name) !== null && _options$release$name2 !== void 0 ? _options$release$name2 : "undefined", {
|
|
9474
9535
|
include: [{
|
|
9475
9536
|
paths: [tmpUploadFolder],
|
|
9476
9537
|
rewrite: false,
|
|
9477
9538
|
dist: options.release.dist
|
|
9478
9539
|
}],
|
|
9479
|
-
// We want this promise to throw if the sourcemaps fail to upload so that we know about it.
|
|
9480
|
-
// see: https://github.com/getsentry/sentry-cli/pull/2605
|
|
9481
9540
|
live: "rejectOnError"
|
|
9482
9541
|
});
|
|
9483
9542
|
case 3:
|
|
9484
9543
|
case "end":
|
|
9485
|
-
return
|
|
9544
|
+
return _context15.stop();
|
|
9486
9545
|
}
|
|
9487
|
-
},
|
|
9546
|
+
}, _callee15);
|
|
9488
9547
|
})));
|
|
9489
9548
|
case 17:
|
|
9490
|
-
return _context15.abrupt("return", files.length);
|
|
9491
|
-
case 18:
|
|
9492
9549
|
case "end":
|
|
9493
|
-
return
|
|
9550
|
+
return _context16.stop();
|
|
9494
9551
|
}
|
|
9495
|
-
},
|
|
9552
|
+
}, _callee16);
|
|
9496
9553
|
}));
|
|
9497
9554
|
return function (_x) {
|
|
9498
|
-
return
|
|
9555
|
+
return _ref6.apply(this, arguments);
|
|
9499
9556
|
};
|
|
9500
9557
|
}());
|
|
9501
|
-
case 23:
|
|
9502
|
-
numUploadedFiles = _context17.sent;
|
|
9503
|
-
if (numUploadedFiles > 0) {
|
|
9504
|
-
logger.info("Successfully uploaded source maps to Sentry");
|
|
9505
|
-
}
|
|
9506
|
-
case 25:
|
|
9507
|
-
_context17.next = 31;
|
|
9508
|
-
break;
|
|
9509
9558
|
case 27:
|
|
9510
|
-
|
|
9511
|
-
|
|
9559
|
+
logger.info("Successfully uploaded source maps to Sentry");
|
|
9560
|
+
case 28:
|
|
9561
|
+
_context18.next = 34;
|
|
9562
|
+
break;
|
|
9563
|
+
case 30:
|
|
9564
|
+
_context18.prev = 30;
|
|
9565
|
+
_context18.t0 = _context18["catch"](2);
|
|
9512
9566
|
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
9513
|
-
handleRecoverableError(
|
|
9514
|
-
case
|
|
9515
|
-
|
|
9567
|
+
handleRecoverableError(_context18.t0, false);
|
|
9568
|
+
case 34:
|
|
9569
|
+
_context18.prev = 34;
|
|
9516
9570
|
if (folderToCleanUp && !((_process$env2 = process.env) !== null && _process$env2 !== void 0 && _process$env2["SENTRY_TEST_OVERRIDE_TEMP_DIR"])) {
|
|
9517
9571
|
void startSpan({
|
|
9518
9572
|
name: "cleanup",
|
|
9519
9573
|
scope: sentryScope
|
|
9520
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9521
|
-
return _regeneratorRuntime().wrap(function
|
|
9522
|
-
while (1) switch (
|
|
9574
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
9575
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
9576
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
9523
9577
|
case 0:
|
|
9524
9578
|
if (!folderToCleanUp) {
|
|
9525
|
-
|
|
9579
|
+
_context17.next = 3;
|
|
9526
9580
|
break;
|
|
9527
9581
|
}
|
|
9528
|
-
|
|
9582
|
+
_context17.next = 3;
|
|
9529
9583
|
return fs.promises.rm(folderToCleanUp, {
|
|
9530
9584
|
recursive: true,
|
|
9531
9585
|
force: true
|
|
9532
9586
|
});
|
|
9533
9587
|
case 3:
|
|
9534
9588
|
case "end":
|
|
9535
|
-
return
|
|
9589
|
+
return _context17.stop();
|
|
9536
9590
|
}
|
|
9537
|
-
},
|
|
9591
|
+
}, _callee17);
|
|
9538
9592
|
})));
|
|
9539
9593
|
}
|
|
9540
9594
|
freeUploadDependencyOnBuildArtifacts();
|
|
9541
|
-
|
|
9595
|
+
_context18.next = 39;
|
|
9542
9596
|
return safeFlushTelemetry(sentryClient);
|
|
9543
|
-
case
|
|
9544
|
-
return
|
|
9545
|
-
case
|
|
9597
|
+
case 39:
|
|
9598
|
+
return _context18.finish(34);
|
|
9599
|
+
case 40:
|
|
9546
9600
|
case "end":
|
|
9547
|
-
return
|
|
9601
|
+
return _context18.stop();
|
|
9548
9602
|
}
|
|
9549
|
-
},
|
|
9603
|
+
}, _callee18, null, [[2, 30, 34, 40]]);
|
|
9550
9604
|
})));
|
|
9551
|
-
case
|
|
9605
|
+
case 8:
|
|
9552
9606
|
case "end":
|
|
9553
|
-
return
|
|
9607
|
+
return _context19.stop();
|
|
9554
9608
|
}
|
|
9555
|
-
},
|
|
9609
|
+
}, _callee19);
|
|
9556
9610
|
}))();
|
|
9557
9611
|
},
|
|
9558
9612
|
/**
|
|
9559
9613
|
* Will delete artifacts based on the passed `sourcemaps.filesToDeleteAfterUpload` option.
|
|
9560
9614
|
*/
|
|
9561
9615
|
deleteArtifacts: function deleteArtifacts() {
|
|
9562
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9563
|
-
var _options$
|
|
9564
|
-
return _regeneratorRuntime().wrap(function
|
|
9565
|
-
while (1) switch (
|
|
9616
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
9617
|
+
var _options$sourcemaps9, filesToDelete, filePathsToDelete;
|
|
9618
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
9619
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
9566
9620
|
case 0:
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
return (_options$
|
|
9621
|
+
_context20.prev = 0;
|
|
9622
|
+
_context20.next = 3;
|
|
9623
|
+
return (_options$sourcemaps9 = options.sourcemaps) === null || _options$sourcemaps9 === void 0 ? void 0 : _options$sourcemaps9.filesToDeleteAfterUpload;
|
|
9570
9624
|
case 3:
|
|
9571
|
-
filesToDelete =
|
|
9625
|
+
filesToDelete = _context20.sent;
|
|
9572
9626
|
if (!(filesToDelete !== undefined)) {
|
|
9573
|
-
|
|
9627
|
+
_context20.next = 14;
|
|
9574
9628
|
break;
|
|
9575
9629
|
}
|
|
9576
|
-
|
|
9630
|
+
_context20.next = 7;
|
|
9577
9631
|
return glob(filesToDelete, {
|
|
9578
9632
|
absolute: true,
|
|
9579
9633
|
nodir: true
|
|
9580
9634
|
});
|
|
9581
9635
|
case 7:
|
|
9582
|
-
filePathsToDelete =
|
|
9636
|
+
filePathsToDelete = _context20.sent;
|
|
9583
9637
|
logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
|
|
9584
|
-
|
|
9638
|
+
_context20.next = 11;
|
|
9585
9639
|
return waitUntilBuildArtifactDependenciesAreFreed();
|
|
9586
9640
|
case 11:
|
|
9587
9641
|
filePathsToDelete.forEach(function (filePathToDelete) {
|
|
9588
9642
|
logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
|
|
9589
9643
|
});
|
|
9590
|
-
|
|
9644
|
+
_context20.next = 14;
|
|
9591
9645
|
return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
|
|
9592
9646
|
return fs.promises.rm(filePathToDelete, {
|
|
9593
9647
|
force: true
|
|
@@ -9597,31 +9651,31 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9597
9651
|
});
|
|
9598
9652
|
}));
|
|
9599
9653
|
case 14:
|
|
9600
|
-
|
|
9654
|
+
_context20.next = 22;
|
|
9601
9655
|
break;
|
|
9602
9656
|
case 16:
|
|
9603
|
-
|
|
9604
|
-
|
|
9657
|
+
_context20.prev = 16;
|
|
9658
|
+
_context20.t0 = _context20["catch"](0);
|
|
9605
9659
|
sentryScope.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
|
|
9606
|
-
|
|
9660
|
+
_context20.next = 21;
|
|
9607
9661
|
return safeFlushTelemetry(sentryClient);
|
|
9608
9662
|
case 21:
|
|
9609
9663
|
// We throw by default if we get here b/c not being able to delete
|
|
9610
9664
|
// source maps could leak them to production
|
|
9611
|
-
handleRecoverableError(
|
|
9665
|
+
handleRecoverableError(_context20.t0, true);
|
|
9612
9666
|
case 22:
|
|
9613
9667
|
case "end":
|
|
9614
|
-
return
|
|
9668
|
+
return _context20.stop();
|
|
9615
9669
|
}
|
|
9616
|
-
},
|
|
9670
|
+
}, _callee20, null, [[0, 16]]);
|
|
9617
9671
|
}))();
|
|
9618
9672
|
},
|
|
9619
9673
|
createDependencyOnBuildArtifacts: createDependencyOnBuildArtifacts
|
|
9620
9674
|
};
|
|
9621
9675
|
}
|
|
9622
9676
|
function canUploadSourceMaps(options, logger, isDevMode) {
|
|
9623
|
-
var _options$
|
|
9624
|
-
if ((_options$
|
|
9677
|
+
var _options$sourcemaps10;
|
|
9678
|
+
if ((_options$sourcemaps10 = options.sourcemaps) !== null && _options$sourcemaps10 !== void 0 && _options$sourcemaps10.disable) {
|
|
9625
9679
|
logger.debug("Source map upload was disabled. Will not upload sourcemaps using debug ID process.");
|
|
9626
9680
|
return false;
|
|
9627
9681
|
}
|