@sentry/bundler-plugin-core 3.5.0 → 3.6.1
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 +84 -60
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +84 -60
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/build-plugin-manager.d.ts.map +1 -1
- 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/sentry/telemetry.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/cjs/index.js
CHANGED
|
@@ -8195,7 +8195,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
|
8195
8195
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8196
8196
|
tracesSampleRate: 1,
|
|
8197
8197
|
sampleRate: 1,
|
|
8198
|
-
release: "3.
|
|
8198
|
+
release: "3.6.1",
|
|
8199
8199
|
integrations: [],
|
|
8200
8200
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8201
8201
|
stackParser: stackParser,
|
|
@@ -8771,7 +8771,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8771
8771
|
});
|
|
8772
8772
|
|
|
8773
8773
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8774
|
-
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "3.
|
|
8774
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "3.6.1");
|
|
8775
8775
|
|
|
8776
8776
|
// Not a bulletproof check but should be good enough to at least sometimes determine
|
|
8777
8777
|
// if the plugin is called in dev/watch mode or for a prod build. The important part
|
|
@@ -9051,7 +9051,10 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9051
9051
|
_context6.next = 33;
|
|
9052
9052
|
return cliInstance.releases.uploadSourceMaps(options.release.name, {
|
|
9053
9053
|
include: normalizedInclude,
|
|
9054
|
-
dist: options.release.dist
|
|
9054
|
+
dist: options.release.dist,
|
|
9055
|
+
// We want this promise to throw if the sourcemaps fail to upload so that we know about it.
|
|
9056
|
+
// see: https://github.com/getsentry/sentry-cli/pull/2605
|
|
9057
|
+
live: "rejectOnError"
|
|
9055
9058
|
});
|
|
9056
9059
|
case 33:
|
|
9057
9060
|
if (!(options.release.setCommits !== false)) {
|
|
@@ -9120,22 +9123,16 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9120
9123
|
*/
|
|
9121
9124
|
uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths) {
|
|
9122
9125
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
9123
|
-
var _options$sourcemaps;
|
|
9124
9126
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
9125
9127
|
while (1) switch (_context15.prev = _context15.next) {
|
|
9126
9128
|
case 0:
|
|
9127
|
-
if ((
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
logger.debug("Running in development mode. Will not upload sourcemaps.");
|
|
9131
|
-
} else if (!options.authToken) {
|
|
9132
|
-
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"));
|
|
9133
|
-
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9134
|
-
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9135
|
-
} else if (!options.project) {
|
|
9136
|
-
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9129
|
+
if (canUploadSourceMaps(options, logger, isDevMode)) {
|
|
9130
|
+
_context15.next = 2;
|
|
9131
|
+
break;
|
|
9137
9132
|
}
|
|
9138
|
-
_context15.
|
|
9133
|
+
return _context15.abrupt("return");
|
|
9134
|
+
case 2:
|
|
9135
|
+
_context15.next = 4;
|
|
9139
9136
|
return startSpan(
|
|
9140
9137
|
// This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
|
|
9141
9138
|
{
|
|
@@ -9143,7 +9140,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9143
9140
|
scope: sentryScope,
|
|
9144
9141
|
forceTransaction: true
|
|
9145
9142
|
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
9146
|
-
var folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$
|
|
9143
|
+
var folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$sourcemaps, tmpUploadFolder, assets, globAssets, globResult, debugIdChunkFilePaths, numUploadedFiles, _process$env2;
|
|
9147
9144
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
9148
9145
|
while (1) switch (_context14.prev = _context14.next) {
|
|
9149
9146
|
case 0:
|
|
@@ -9180,7 +9177,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9180
9177
|
case 4:
|
|
9181
9178
|
tmpUploadFolder = _context14.sent;
|
|
9182
9179
|
folderToCleanUp = tmpUploadFolder;
|
|
9183
|
-
assets = (_options$
|
|
9180
|
+
assets = (_options$sourcemaps = options.sourcemaps) === null || _options$sourcemaps === void 0 ? void 0 : _options$sourcemaps.assets;
|
|
9184
9181
|
if (assets) {
|
|
9185
9182
|
globAssets = assets;
|
|
9186
9183
|
} else {
|
|
@@ -9192,7 +9189,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9192
9189
|
name: "glob",
|
|
9193
9190
|
scope: sentryScope
|
|
9194
9191
|
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
9195
|
-
var _options$
|
|
9192
|
+
var _options$sourcemaps2;
|
|
9196
9193
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
9197
9194
|
while (1) switch (_context8.prev = _context8.next) {
|
|
9198
9195
|
case 0:
|
|
@@ -9200,7 +9197,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9200
9197
|
return glob.glob(globAssets, {
|
|
9201
9198
|
absolute: true,
|
|
9202
9199
|
nodir: true,
|
|
9203
|
-
ignore: (_options$
|
|
9200
|
+
ignore: (_options$sourcemaps2 = options.sourcemaps) === null || _options$sourcemaps2 === void 0 ? void 0 : _options$sourcemaps2.ignore
|
|
9204
9201
|
});
|
|
9205
9202
|
case 2:
|
|
9206
9203
|
return _context8.abrupt("return", _context8.sent);
|
|
@@ -9222,7 +9219,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9222
9219
|
break;
|
|
9223
9220
|
}
|
|
9224
9221
|
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
9225
|
-
_context14.next =
|
|
9222
|
+
_context14.next = 25;
|
|
9226
9223
|
break;
|
|
9227
9224
|
case 17:
|
|
9228
9225
|
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
@@ -9230,7 +9227,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9230
9227
|
break;
|
|
9231
9228
|
}
|
|
9232
9229
|
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
9233
|
-
_context14.next =
|
|
9230
|
+
_context14.next = 25;
|
|
9234
9231
|
break;
|
|
9235
9232
|
case 21:
|
|
9236
9233
|
_context14.next = 23;
|
|
@@ -9247,12 +9244,12 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9247
9244
|
// instead we do it with a maximum of 16 concurrent workers
|
|
9248
9245
|
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
9249
9246
|
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
9250
|
-
var _options$sourcemaps$r, _options$
|
|
9247
|
+
var _options$sourcemaps$r, _options$sourcemaps3, _options$sourcemaps4;
|
|
9251
9248
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
9252
9249
|
while (1) switch (_context9.prev = _context9.next) {
|
|
9253
9250
|
case 0:
|
|
9254
9251
|
_context9.next = 2;
|
|
9255
|
-
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$
|
|
9252
|
+
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);
|
|
9256
9253
|
case 2:
|
|
9257
9254
|
case "end":
|
|
9258
9255
|
return _context9.stop();
|
|
@@ -9345,7 +9342,10 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9345
9342
|
paths: [tmpUploadFolder],
|
|
9346
9343
|
rewrite: false,
|
|
9347
9344
|
dist: options.release.dist
|
|
9348
|
-
}]
|
|
9345
|
+
}],
|
|
9346
|
+
// We want this promise to throw if the sourcemaps fail to upload so that we know about it.
|
|
9347
|
+
// see: https://github.com/getsentry/sentry-cli/pull/2605
|
|
9348
|
+
live: "rejectOnError"
|
|
9349
9349
|
});
|
|
9350
9350
|
case 3:
|
|
9351
9351
|
case "end":
|
|
@@ -9358,6 +9358,8 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9358
9358
|
};
|
|
9359
9359
|
}());
|
|
9360
9360
|
case 17:
|
|
9361
|
+
return _context12.abrupt("return", files.length);
|
|
9362
|
+
case 18:
|
|
9361
9363
|
case "end":
|
|
9362
9364
|
return _context12.stop();
|
|
9363
9365
|
}
|
|
@@ -9368,17 +9370,20 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9368
9370
|
};
|
|
9369
9371
|
}());
|
|
9370
9372
|
case 23:
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9373
|
+
numUploadedFiles = _context14.sent;
|
|
9374
|
+
if (numUploadedFiles > 0) {
|
|
9375
|
+
logger.info("Successfully uploaded source maps to Sentry");
|
|
9376
|
+
}
|
|
9377
|
+
case 25:
|
|
9378
|
+
_context14.next = 31;
|
|
9374
9379
|
break;
|
|
9375
|
-
case
|
|
9376
|
-
_context14.prev =
|
|
9380
|
+
case 27:
|
|
9381
|
+
_context14.prev = 27;
|
|
9377
9382
|
_context14.t0 = _context14["catch"](1);
|
|
9378
9383
|
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
9379
9384
|
handleRecoverableError(_context14.t0, false);
|
|
9380
|
-
case
|
|
9381
|
-
_context14.prev =
|
|
9385
|
+
case 31:
|
|
9386
|
+
_context14.prev = 31;
|
|
9382
9387
|
if (folderToCleanUp && !((_process$env2 = process.env) !== null && _process$env2 !== void 0 && _process$env2["SENTRY_TEST_OVERRIDE_TEMP_DIR"])) {
|
|
9383
9388
|
void startSpan({
|
|
9384
9389
|
name: "cleanup",
|
|
@@ -9404,17 +9409,17 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9404
9409
|
})));
|
|
9405
9410
|
}
|
|
9406
9411
|
freeUploadDependencyOnBuildArtifacts();
|
|
9407
|
-
_context14.next =
|
|
9412
|
+
_context14.next = 36;
|
|
9408
9413
|
return safeFlushTelemetry(sentryClient);
|
|
9409
|
-
case 35:
|
|
9410
|
-
return _context14.finish(30);
|
|
9411
9414
|
case 36:
|
|
9415
|
+
return _context14.finish(31);
|
|
9416
|
+
case 37:
|
|
9412
9417
|
case "end":
|
|
9413
9418
|
return _context14.stop();
|
|
9414
9419
|
}
|
|
9415
|
-
}, _callee14, null, [[1,
|
|
9420
|
+
}, _callee14, null, [[1, 27, 31, 37]]);
|
|
9416
9421
|
})));
|
|
9417
|
-
case
|
|
9422
|
+
case 4:
|
|
9418
9423
|
case "end":
|
|
9419
9424
|
return _context15.stop();
|
|
9420
9425
|
}
|
|
@@ -9426,13 +9431,13 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9426
9431
|
*/
|
|
9427
9432
|
deleteArtifacts: function deleteArtifacts() {
|
|
9428
9433
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
9429
|
-
var _options$
|
|
9434
|
+
var _options$sourcemaps5, filesToDelete, filePathsToDelete;
|
|
9430
9435
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
9431
9436
|
while (1) switch (_context16.prev = _context16.next) {
|
|
9432
9437
|
case 0:
|
|
9433
9438
|
_context16.prev = 0;
|
|
9434
9439
|
_context16.next = 3;
|
|
9435
|
-
return (_options$
|
|
9440
|
+
return (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.filesToDeleteAfterUpload;
|
|
9436
9441
|
case 3:
|
|
9437
9442
|
filesToDelete = _context16.sent;
|
|
9438
9443
|
if (!(filesToDelete !== undefined)) {
|
|
@@ -9485,6 +9490,30 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9485
9490
|
createDependencyOnBuildArtifacts: createDependencyOnBuildArtifacts
|
|
9486
9491
|
};
|
|
9487
9492
|
}
|
|
9493
|
+
function canUploadSourceMaps(options, logger, isDevMode) {
|
|
9494
|
+
var _options$sourcemaps6;
|
|
9495
|
+
if ((_options$sourcemaps6 = options.sourcemaps) !== null && _options$sourcemaps6 !== void 0 && _options$sourcemaps6.disable) {
|
|
9496
|
+
logger.debug("Source map upload was disabled. Will not upload sourcemaps using debug ID process.");
|
|
9497
|
+
return false;
|
|
9498
|
+
}
|
|
9499
|
+
if (isDevMode) {
|
|
9500
|
+
logger.debug("Running in development mode. Will not upload sourcemaps.");
|
|
9501
|
+
return false;
|
|
9502
|
+
}
|
|
9503
|
+
if (!options.authToken) {
|
|
9504
|
+
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"));
|
|
9505
|
+
return false;
|
|
9506
|
+
}
|
|
9507
|
+
if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9508
|
+
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9509
|
+
return false;
|
|
9510
|
+
}
|
|
9511
|
+
if (!options.project) {
|
|
9512
|
+
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9513
|
+
return false;
|
|
9514
|
+
}
|
|
9515
|
+
return true;
|
|
9516
|
+
}
|
|
9488
9517
|
|
|
9489
9518
|
/**
|
|
9490
9519
|
* Creates an unplugin instance used to create Sentry plugins for Vite, Rollup, esbuild, and Webpack.
|
|
@@ -9580,13 +9609,13 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9580
9609
|
});
|
|
9581
9610
|
if (!((_options$sourcemaps = options.sourcemaps) !== null && _options$sourcemaps !== void 0 && _options$sourcemaps.disable)) {
|
|
9582
9611
|
plugins.push(debugIdInjectionPlugin(logger));
|
|
9583
|
-
}
|
|
9584
9612
|
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9613
|
+
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
|
|
9614
|
+
var _webpack_forceExitOnBuildComplete = typeof options._experiments["forceExitOnBuildCompletion"] === "boolean" ? options._experiments["forceExitOnBuildCompletion"] : undefined;
|
|
9615
|
+
plugins.push(debugIdUploadPlugin(createDebugIdUploadFunction({
|
|
9616
|
+
sentryBuildPluginManager: sentryBuildPluginManager
|
|
9617
|
+
}), logger, sentryBuildPluginManager.createDependencyOnBuildArtifacts, _webpack_forceExitOnBuildComplete));
|
|
9618
|
+
}
|
|
9590
9619
|
if (options.reactComponentAnnotation) {
|
|
9591
9620
|
if (!options.reactComponentAnnotation.enabled) {
|
|
9592
9621
|
logger.debug("The component name annotate plugin is currently disabled. Skipping component name annotations.");
|
|
@@ -9620,23 +9649,11 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9620
9649
|
}
|
|
9621
9650
|
|
|
9622
9651
|
/**
|
|
9623
|
-
* @deprecated
|
|
9652
|
+
* @deprecated This will be removed in v4
|
|
9624
9653
|
*/
|
|
9625
|
-
// TODO(v4): Don't export this from the package
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
var _ref2 = packageJson ? getDependencies(packageJson) : {
|
|
9629
|
-
deps: [],
|
|
9630
|
-
depsVersions: {}
|
|
9631
|
-
},
|
|
9632
|
-
deps = _ref2.deps,
|
|
9633
|
-
depsVersions = _ref2.depsVersions;
|
|
9634
|
-
return {
|
|
9635
|
-
deps: deps,
|
|
9636
|
-
depsVersions: depsVersions,
|
|
9637
|
-
nodeVersion: parseMajorVersion(process.version)
|
|
9638
|
-
};
|
|
9639
|
-
}
|
|
9654
|
+
// TODO(v4): Don't export this from the package but keep the utils version
|
|
9655
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
9656
|
+
var getBuildInformation = getBuildInformation$1;
|
|
9640
9657
|
|
|
9641
9658
|
/**
|
|
9642
9659
|
* Determines whether the Sentry CLI binary is in its expected location.
|
|
@@ -9709,6 +9726,13 @@ function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
|
9709
9726
|
var COMMENT_USE_STRICT_REGEX =
|
|
9710
9727
|
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
9711
9728
|
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
9729
|
+
|
|
9730
|
+
/**
|
|
9731
|
+
* Simplified `renderChunk` hook type from Rollup.
|
|
9732
|
+
* We can't reference the type directly because the Vite plugin complains
|
|
9733
|
+
* about type mismatches
|
|
9734
|
+
*/
|
|
9735
|
+
|
|
9712
9736
|
function createRollupDebugIdInjectionHooks() {
|
|
9713
9737
|
return {
|
|
9714
9738
|
renderChunk: function renderChunk(code, chunk) {
|