@sentry/bundler-plugin-core 3.2.1 → 3.2.3
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 +147 -57
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +147 -57
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/debug-id-upload.d.ts +2 -1
- package/dist/types/debug-id-upload.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/options-mapping.d.ts +4 -14
- package/dist/types/options-mapping.d.ts.map +1 -1
- package/dist/types/plugins/release-management.d.ts +7 -4
- package/dist/types/plugins/release-management.d.ts.map +1 -1
- package/dist/types/plugins/sourcemap-deletion.d.ts +2 -1
- package/dist/types/plugins/sourcemap-deletion.d.ts.map +1 -1
- package/dist/types/types.d.ts +5 -2
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -741,7 +741,7 @@ function replaceBooleanFlagsInCode(code, replacementValues) {
|
|
|
741
741
|
|
|
742
742
|
var SENTRY_SAAS_URL = "https://sentry.io";
|
|
743
743
|
function normalizeUserOptions(userOptions) {
|
|
744
|
-
var _userOptions$org, _userOptions$project, _userOptions$authToke, _ref, _userOptions$url, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$disable, _ref2, _userOptions$release$, _userOptions$release, _userOptions$release$2, _userOptions$release2, _userOptions$release$3, _userOptions$release3, _userOptions$release$4, _userOptions$release4, _ref3, _userOptions$release$5, _userOptions$release5, _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$_experim;
|
|
744
|
+
var _userOptions$org, _userOptions$project, _userOptions$authToke, _ref, _userOptions$url, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$disable, _ref2, _userOptions$release$, _userOptions$release, _userOptions$release$2, _userOptions$release2, _userOptions$release$3, _userOptions$release3, _userOptions$release$4, _userOptions$release4, _ref3, _userOptions$release$5, _userOptions$release5, _userOptions$release6, _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$_experim;
|
|
745
745
|
var options = {
|
|
746
746
|
org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
|
|
747
747
|
project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
|
|
@@ -759,7 +759,8 @@ function normalizeUserOptions(userOptions) {
|
|
|
759
759
|
inject: (_userOptions$release$2 = (_userOptions$release2 = userOptions.release) === null || _userOptions$release2 === void 0 ? void 0 : _userOptions$release2.inject) !== null && _userOptions$release$2 !== void 0 ? _userOptions$release$2 : true,
|
|
760
760
|
create: (_userOptions$release$3 = (_userOptions$release3 = userOptions.release) === null || _userOptions$release3 === void 0 ? void 0 : _userOptions$release3.create) !== null && _userOptions$release$3 !== void 0 ? _userOptions$release$3 : true,
|
|
761
761
|
finalize: (_userOptions$release$4 = (_userOptions$release4 = userOptions.release) === null || _userOptions$release4 === void 0 ? void 0 : _userOptions$release4.finalize) !== null && _userOptions$release$4 !== void 0 ? _userOptions$release$4 : true,
|
|
762
|
-
vcsRemote: (_ref3 = (_userOptions$release$5 = (_userOptions$release5 = userOptions.release) === null || _userOptions$release5 === void 0 ? void 0 : _userOptions$release5.vcsRemote) !== null && _userOptions$release$5 !== void 0 ? _userOptions$release$5 : process.env["SENTRY_VSC_REMOTE"]) !== null && _ref3 !== void 0 ? _ref3 : "origin"
|
|
762
|
+
vcsRemote: (_ref3 = (_userOptions$release$5 = (_userOptions$release5 = userOptions.release) === null || _userOptions$release5 === void 0 ? void 0 : _userOptions$release5.vcsRemote) !== null && _userOptions$release$5 !== void 0 ? _userOptions$release$5 : process.env["SENTRY_VSC_REMOTE"]) !== null && _ref3 !== void 0 ? _ref3 : "origin",
|
|
763
|
+
setCommits: (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.setCommits
|
|
763
764
|
}),
|
|
764
765
|
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
|
|
765
766
|
reactComponentAnnotation: userOptions.reactComponentAnnotation,
|
|
@@ -772,6 +773,31 @@ function normalizeUserOptions(userOptions) {
|
|
|
772
773
|
moduleMetadata: userOptions.moduleMetadata,
|
|
773
774
|
_experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
|
|
774
775
|
};
|
|
776
|
+
if (options.release.setCommits === undefined) {
|
|
777
|
+
if (process.env["VERCEL"] && process.env["VERCEL_GIT_COMMIT_SHA"] && process.env["VERCEL_GIT_REPO_SLUG"] && process.env["VERCEL_GIT_REPO_OWNER"]) {
|
|
778
|
+
options.release.setCommits = {
|
|
779
|
+
shouldNotThrowOnFailure: true,
|
|
780
|
+
commit: process.env["VERCEL_GIT_COMMIT_SHA"],
|
|
781
|
+
previousCommit: process.env["VERCEL_GIT_PREVIOUS_SHA"],
|
|
782
|
+
repo: "".concat(process.env["VERCEL_GIT_REPO_OWNER"], "/").concat(process.env["VERCEL_GIT_REPO_SLUG"]),
|
|
783
|
+
ignoreEmpty: true,
|
|
784
|
+
ignoreMissing: true
|
|
785
|
+
};
|
|
786
|
+
} else {
|
|
787
|
+
options.release.setCommits = {
|
|
788
|
+
shouldNotThrowOnFailure: true,
|
|
789
|
+
auto: true,
|
|
790
|
+
ignoreEmpty: true,
|
|
791
|
+
ignoreMissing: true
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
if (options.release.deploy === undefined && process.env["VERCEL"] && process.env["VERCEL_TARGET_ENV"]) {
|
|
796
|
+
options.release.deploy = {
|
|
797
|
+
env: "vercel-".concat(process.env["VERCEL_TARGET_ENV"]),
|
|
798
|
+
url: process.env["VERCEL_URL"] ? "https://".concat(process.env["VERCEL_URL"]) : undefined
|
|
799
|
+
};
|
|
800
|
+
}
|
|
775
801
|
return options;
|
|
776
802
|
}
|
|
777
803
|
|
|
@@ -8111,7 +8137,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
8111
8137
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8112
8138
|
tracesSampleRate: 1,
|
|
8113
8139
|
sampleRate: 1,
|
|
8114
|
-
release: "3.2.
|
|
8140
|
+
release: "3.2.3",
|
|
8115
8141
|
integrations: [],
|
|
8116
8142
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8117
8143
|
stackParser: stackParser,
|
|
@@ -8479,7 +8505,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
8479
8505
|
}));
|
|
8480
8506
|
_context5.next = 3;
|
|
8481
8507
|
return cliInstance.releases.uploadSourceMaps(releaseName !== null && releaseName !== void 0 ? releaseName : "undefined",
|
|
8482
|
-
//
|
|
8508
|
+
// unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
8483
8509
|
{
|
|
8484
8510
|
include: [{
|
|
8485
8511
|
paths: [tmpUploadFolder],
|
|
@@ -8517,7 +8543,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
8517
8543
|
_context8.prev = 25;
|
|
8518
8544
|
_context8.t0 = _context8["catch"](1);
|
|
8519
8545
|
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
8520
|
-
handleRecoverableError(_context8.t0);
|
|
8546
|
+
handleRecoverableError(_context8.t0, false);
|
|
8521
8547
|
case 29:
|
|
8522
8548
|
_context8.prev = 29;
|
|
8523
8549
|
if (folderToCleanUp) {
|
|
@@ -8570,16 +8596,9 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
8570
8596
|
function prepareBundleForDebugIdUpload(_x4, _x5, _x6, _x7, _x8) {
|
|
8571
8597
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
8572
8598
|
}
|
|
8573
|
-
|
|
8574
|
-
/**
|
|
8575
|
-
* Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle
|
|
8576
|
-
* source and extracts the bundle's debug ID from it.
|
|
8577
|
-
*
|
|
8578
|
-
* The string pattern is injected via the debug ID injection snipped.
|
|
8579
|
-
*/
|
|
8580
8599
|
function _prepareBundleForDebugIdUpload() {
|
|
8581
8600
|
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook) {
|
|
8582
|
-
var bundleContent, debugId,
|
|
8601
|
+
var bundleContent, debugId, uniqueSourceFileUploadPath, writeSourceFilePromise, writeSourceMapFilePromise;
|
|
8583
8602
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
8584
8603
|
while (1) switch (_context11.prev = _context11.next) {
|
|
8585
8604
|
case 0:
|
|
@@ -8604,9 +8623,13 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8604
8623
|
logger.debug("Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: ".concat(bundleFilePath));
|
|
8605
8624
|
return _context11.abrupt("return");
|
|
8606
8625
|
case 14:
|
|
8607
|
-
|
|
8626
|
+
uniqueSourceFileUploadPath = getUniqueUploadPath(uploadFolder, chunkIndex, bundleFilePath);
|
|
8608
8627
|
bundleContent += "\n//# debugId=".concat(debugId);
|
|
8609
|
-
writeSourceFilePromise = fs__default["default"].promises.
|
|
8628
|
+
writeSourceFilePromise = fs__default["default"].promises.mkdir(path__default["default"].dirname(uniqueSourceFileUploadPath), {
|
|
8629
|
+
recursive: true
|
|
8630
|
+
}).then(function () {
|
|
8631
|
+
return fs__default["default"].promises.writeFile(uniqueSourceFileUploadPath, bundleContent, "utf-8");
|
|
8632
|
+
});
|
|
8610
8633
|
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
|
|
8611
8634
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(sourceMapPath) {
|
|
8612
8635
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
@@ -8617,7 +8640,7 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8617
8640
|
break;
|
|
8618
8641
|
}
|
|
8619
8642
|
_context10.next = 3;
|
|
8620
|
-
return prepareSourceMapForDebugIdUpload(sourceMapPath,
|
|
8643
|
+
return prepareSourceMapForDebugIdUpload(sourceMapPath, getUniqueUploadPath(uploadFolder, chunkIndex, sourceMapPath), debugId, rewriteSourcesHook, logger);
|
|
8621
8644
|
case 3:
|
|
8622
8645
|
case "end":
|
|
8623
8646
|
return _context10.stop();
|
|
@@ -8641,6 +8664,26 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8641
8664
|
}));
|
|
8642
8665
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
8643
8666
|
}
|
|
8667
|
+
function getUniqueUploadPath(uploadFolder, chunkIndex, filePath) {
|
|
8668
|
+
return path__default["default"].join(uploadFolder, // We add a "chunk index" segment to the path that is a simple incrementing number to avoid name collisions.
|
|
8669
|
+
// Name collisions can happen when files are located "outside" of the current working directory, at different levels but they share a subpath.
|
|
8670
|
+
// Example:
|
|
8671
|
+
// - CWD: /root/foo/cwd
|
|
8672
|
+
// - File 1: /root/foo/index.js -> ../foo/index.js -> foo/index.js
|
|
8673
|
+
// - File 2: /foo/index.js -> ../../foo/index.js -> foo/index.js
|
|
8674
|
+
"".concat(chunkIndex), path__default["default"].normalize(path__default["default"].relative(process.cwd(), filePath).split(path__default["default"].sep)
|
|
8675
|
+
// We filter out these "navigation" segments because a) they look ugly b) they will cause us to break out of the upload folder.
|
|
8676
|
+
.filter(function (segment) {
|
|
8677
|
+
return segment !== ".." && segment !== ".";
|
|
8678
|
+
}).join(path__default["default"].sep)));
|
|
8679
|
+
}
|
|
8680
|
+
|
|
8681
|
+
/**
|
|
8682
|
+
* Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle
|
|
8683
|
+
* source and extracts the bundle's debug ID from it.
|
|
8684
|
+
*
|
|
8685
|
+
* The string pattern is injected via the debug ID injection snipped.
|
|
8686
|
+
*/
|
|
8644
8687
|
function determineDebugIdFromBundleSource(code) {
|
|
8645
8688
|
var match = code.match(/sentry-dbid-([0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12})/);
|
|
8646
8689
|
if (match) {
|
|
@@ -8767,22 +8810,27 @@ function _prepareSourceMapForDebugIdUpload() {
|
|
|
8767
8810
|
}
|
|
8768
8811
|
_context13.prev = 21;
|
|
8769
8812
|
_context13.next = 24;
|
|
8770
|
-
return
|
|
8771
|
-
|
|
8813
|
+
return fs__default["default"].promises.mkdir(path__default["default"].dirname(targetPath), {
|
|
8814
|
+
recursive: true
|
|
8772
8815
|
});
|
|
8773
8816
|
case 24:
|
|
8774
|
-
_context13.next =
|
|
8775
|
-
|
|
8817
|
+
_context13.next = 26;
|
|
8818
|
+
return fs__default["default"].promises.writeFile(targetPath, JSON.stringify(map), {
|
|
8819
|
+
encoding: "utf8"
|
|
8820
|
+
});
|
|
8776
8821
|
case 26:
|
|
8777
|
-
_context13.
|
|
8822
|
+
_context13.next = 32;
|
|
8823
|
+
break;
|
|
8824
|
+
case 28:
|
|
8825
|
+
_context13.prev = 28;
|
|
8778
8826
|
_context13.t2 = _context13["catch"](21);
|
|
8779
8827
|
logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath), _context13.t2);
|
|
8780
8828
|
return _context13.abrupt("return");
|
|
8781
|
-
case
|
|
8829
|
+
case 32:
|
|
8782
8830
|
case "end":
|
|
8783
8831
|
return _context13.stop();
|
|
8784
8832
|
}
|
|
8785
|
-
}, _callee13, null, [[0, 6], [10, 16], [21,
|
|
8833
|
+
}, _callee13, null, [[0, 6], [10, 16], [21, 28]]);
|
|
8786
8834
|
}));
|
|
8787
8835
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
8788
8836
|
}
|
|
@@ -8801,7 +8849,8 @@ function defaultRewriteSourcesHook(source) {
|
|
|
8801
8849
|
* Additionally, if legacy upload options are set, it uploads source maps in the legacy (non-debugId) way.
|
|
8802
8850
|
*/
|
|
8803
8851
|
function releaseManagementPlugin(_ref) {
|
|
8804
|
-
var
|
|
8852
|
+
var logger = _ref.logger,
|
|
8853
|
+
releaseName = _ref.releaseName,
|
|
8805
8854
|
include = _ref.include,
|
|
8806
8855
|
dist = _ref.dist,
|
|
8807
8856
|
setCommitsOption = _ref.setCommitsOption,
|
|
@@ -8858,47 +8907,63 @@ function releaseManagementPlugin(_ref) {
|
|
|
8858
8907
|
dist: dist
|
|
8859
8908
|
});
|
|
8860
8909
|
case 10:
|
|
8861
|
-
if (!setCommitsOption) {
|
|
8862
|
-
_context.next =
|
|
8910
|
+
if (!(setCommitsOption !== false)) {
|
|
8911
|
+
_context.next = 23;
|
|
8863
8912
|
break;
|
|
8864
8913
|
}
|
|
8865
|
-
_context.
|
|
8914
|
+
_context.prev = 11;
|
|
8915
|
+
_context.next = 14;
|
|
8866
8916
|
return cliInstance.releases.setCommits(releaseName, setCommitsOption);
|
|
8867
|
-
case
|
|
8917
|
+
case 14:
|
|
8918
|
+
_context.next = 23;
|
|
8919
|
+
break;
|
|
8920
|
+
case 16:
|
|
8921
|
+
_context.prev = 16;
|
|
8922
|
+
_context.t0 = _context["catch"](11);
|
|
8923
|
+
if (!("shouldNotThrowOnFailure" in setCommitsOption && setCommitsOption.shouldNotThrowOnFailure)) {
|
|
8924
|
+
_context.next = 22;
|
|
8925
|
+
break;
|
|
8926
|
+
}
|
|
8927
|
+
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context.t0);
|
|
8928
|
+
_context.next = 23;
|
|
8929
|
+
break;
|
|
8930
|
+
case 22:
|
|
8931
|
+
throw _context.t0;
|
|
8932
|
+
case 23:
|
|
8868
8933
|
if (!shouldFinalizeRelease) {
|
|
8869
|
-
_context.next =
|
|
8934
|
+
_context.next = 26;
|
|
8870
8935
|
break;
|
|
8871
8936
|
}
|
|
8872
|
-
_context.next =
|
|
8937
|
+
_context.next = 26;
|
|
8873
8938
|
return cliInstance.releases.finalize(releaseName);
|
|
8874
|
-
case
|
|
8939
|
+
case 26:
|
|
8875
8940
|
if (!deployOptions) {
|
|
8876
|
-
_context.next =
|
|
8941
|
+
_context.next = 29;
|
|
8877
8942
|
break;
|
|
8878
8943
|
}
|
|
8879
|
-
_context.next =
|
|
8944
|
+
_context.next = 29;
|
|
8880
8945
|
return cliInstance.releases.newDeploy(releaseName, deployOptions);
|
|
8881
|
-
case
|
|
8882
|
-
_context.next =
|
|
8946
|
+
case 29:
|
|
8947
|
+
_context.next = 37;
|
|
8883
8948
|
break;
|
|
8884
|
-
case
|
|
8885
|
-
_context.prev =
|
|
8886
|
-
_context.
|
|
8949
|
+
case 31:
|
|
8950
|
+
_context.prev = 31;
|
|
8951
|
+
_context.t1 = _context["catch"](1);
|
|
8887
8952
|
sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
8888
|
-
_context.next =
|
|
8953
|
+
_context.next = 36;
|
|
8889
8954
|
return safeFlushTelemetry(sentryClient);
|
|
8890
|
-
case
|
|
8891
|
-
handleRecoverableError(_context.
|
|
8892
|
-
case
|
|
8893
|
-
_context.prev =
|
|
8955
|
+
case 36:
|
|
8956
|
+
handleRecoverableError(_context.t1, false);
|
|
8957
|
+
case 37:
|
|
8958
|
+
_context.prev = 37;
|
|
8894
8959
|
freeGlobalDependencyOnSourcemapFiles();
|
|
8895
8960
|
freeWriteBundleInvocationDependencyOnSourcemapFiles();
|
|
8896
|
-
return _context.finish(
|
|
8897
|
-
case
|
|
8961
|
+
return _context.finish(37);
|
|
8962
|
+
case 41:
|
|
8898
8963
|
case "end":
|
|
8899
8964
|
return _context.stop();
|
|
8900
8965
|
}
|
|
8901
|
-
}, _callee, null, [[1,
|
|
8966
|
+
}, _callee, null, [[1, 31, 37, 41], [11, 16]]);
|
|
8902
8967
|
}))();
|
|
8903
8968
|
}
|
|
8904
8969
|
};
|
|
@@ -9045,7 +9110,9 @@ function fileDeletionPlugin(_ref) {
|
|
|
9045
9110
|
_context.next = 21;
|
|
9046
9111
|
return safeFlushTelemetry(sentryClient);
|
|
9047
9112
|
case 21:
|
|
9048
|
-
|
|
9113
|
+
// We throw by default if we get here b/c not being able to delete
|
|
9114
|
+
// source maps could leak them to production
|
|
9115
|
+
handleRecoverableError(_context.t0, true);
|
|
9049
9116
|
case 22:
|
|
9050
9117
|
case "end":
|
|
9051
9118
|
return _context.stop();
|
|
@@ -9156,8 +9223,18 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9156
9223
|
});
|
|
9157
9224
|
|
|
9158
9225
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
9159
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.
|
|
9160
|
-
|
|
9226
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.3");
|
|
9227
|
+
|
|
9228
|
+
/**
|
|
9229
|
+
* Handles errors caught and emitted in various areas of the plugin.
|
|
9230
|
+
*
|
|
9231
|
+
* Also sets the sentry session status according to the error handling.
|
|
9232
|
+
*
|
|
9233
|
+
* If users specify their custom `errorHandler` we'll leave the decision to throw
|
|
9234
|
+
* or continue up to them. By default, @param throwByDefault controls if the plugin
|
|
9235
|
+
* should throw an error (which causes a build fail in most bundlers) or continue.
|
|
9236
|
+
*/
|
|
9237
|
+
function handleRecoverableError(unknownError, throwByDefault) {
|
|
9161
9238
|
sentrySession.status = "abnormal";
|
|
9162
9239
|
try {
|
|
9163
9240
|
if (options.errorHandler) {
|
|
@@ -9172,15 +9249,21 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9172
9249
|
throw e;
|
|
9173
9250
|
}
|
|
9174
9251
|
} else {
|
|
9252
|
+
// setting the session to "crashed" b/c from a plugin perspective this run failed.
|
|
9253
|
+
// However, we're intentionally not rethrowing the error to avoid breaking the user build.
|
|
9175
9254
|
sentrySession.status = "crashed";
|
|
9176
|
-
|
|
9255
|
+
if (throwByDefault) {
|
|
9256
|
+
throw unknownError;
|
|
9257
|
+
}
|
|
9258
|
+
logger.error("An error occurred. Couldn't finish all operations:", unknownError);
|
|
9177
9259
|
}
|
|
9178
9260
|
} finally {
|
|
9179
9261
|
endSession();
|
|
9180
9262
|
}
|
|
9181
9263
|
}
|
|
9182
9264
|
if (!validateOptions(options, logger)) {
|
|
9183
|
-
|
|
9265
|
+
// Throwing by default to avoid a misconfigured plugin going unnoticed.
|
|
9266
|
+
handleRecoverableError(new Error("Options were not set correctly. See output above for more details."), true);
|
|
9184
9267
|
}
|
|
9185
9268
|
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) {
|
|
9186
9269
|
logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
@@ -9295,16 +9378,21 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9295
9378
|
var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
|
|
9296
9379
|
plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
|
|
9297
9380
|
}
|
|
9381
|
+
// https://turbo.build/repo/docs/reference/system-environment-variables#environment-variables-in-tasks
|
|
9382
|
+
var isRunningInTurborepo = Boolean(process.env["TURBO_HASH"]);
|
|
9383
|
+
var getTurborepoEnvPassthroughWarning = function getTurborepoEnvPassthroughWarning(envVarName) {
|
|
9384
|
+
return isRunningInTurborepo ? "\nYou seem to be using Turborepo, did you forget to put ".concat(envVarName, " in `passThroughEnv`? https://turbo.build/repo/docs/reference/configuration#passthroughenv") : "";
|
|
9385
|
+
};
|
|
9298
9386
|
if (!options.release.name) {
|
|
9299
9387
|
logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
|
|
9300
9388
|
} else if (isDevMode) {
|
|
9301
9389
|
logger.debug("Running in development mode. Will not create release.");
|
|
9302
9390
|
} else if (!options.authToken) {
|
|
9303
|
-
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/");
|
|
9391
|
+
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"));
|
|
9304
9392
|
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9305
|
-
logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug.");
|
|
9393
|
+
logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9306
9394
|
} else if (!options.project) {
|
|
9307
|
-
logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug.");
|
|
9395
|
+
logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9308
9396
|
} else {
|
|
9309
9397
|
plugins.push(releaseManagementPlugin({
|
|
9310
9398
|
logger: logger,
|
|
@@ -9312,6 +9400,8 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9312
9400
|
shouldCreateRelease: options.release.create,
|
|
9313
9401
|
shouldFinalizeRelease: options.release.finalize,
|
|
9314
9402
|
include: options.release.uploadLegacySourcemaps,
|
|
9403
|
+
// setCommits has a default defined by the options mappings
|
|
9404
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9315
9405
|
setCommitsOption: options.release.setCommits,
|
|
9316
9406
|
deployOptions: options.release.deploy,
|
|
9317
9407
|
dist: options.release.dist,
|
|
@@ -9338,11 +9428,11 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9338
9428
|
} else if (isDevMode) {
|
|
9339
9429
|
logger.debug("Running in development mode. Will not upload sourcemaps.");
|
|
9340
9430
|
} else if (!options.authToken) {
|
|
9341
|
-
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/");
|
|
9431
|
+
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"));
|
|
9342
9432
|
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9343
|
-
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug.");
|
|
9433
|
+
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9344
9434
|
} else if (!options.project) {
|
|
9345
|
-
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug.");
|
|
9435
|
+
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9346
9436
|
} else {
|
|
9347
9437
|
var _options$sourcemaps3, _options$sourcemaps4, _options$sourcemaps5;
|
|
9348
9438
|
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
|