@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/esm/index.mjs
CHANGED
|
@@ -705,7 +705,7 @@ function replaceBooleanFlagsInCode(code, replacementValues) {
|
|
|
705
705
|
|
|
706
706
|
var SENTRY_SAAS_URL = "https://sentry.io";
|
|
707
707
|
function normalizeUserOptions(userOptions) {
|
|
708
|
-
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;
|
|
708
|
+
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;
|
|
709
709
|
var options = {
|
|
710
710
|
org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
|
|
711
711
|
project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
|
|
@@ -723,7 +723,8 @@ function normalizeUserOptions(userOptions) {
|
|
|
723
723
|
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,
|
|
724
724
|
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,
|
|
725
725
|
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,
|
|
726
|
-
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"
|
|
726
|
+
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",
|
|
727
|
+
setCommits: (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.setCommits
|
|
727
728
|
}),
|
|
728
729
|
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
|
|
729
730
|
reactComponentAnnotation: userOptions.reactComponentAnnotation,
|
|
@@ -736,6 +737,31 @@ function normalizeUserOptions(userOptions) {
|
|
|
736
737
|
moduleMetadata: userOptions.moduleMetadata,
|
|
737
738
|
_experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
|
|
738
739
|
};
|
|
740
|
+
if (options.release.setCommits === undefined) {
|
|
741
|
+
if (process.env["VERCEL"] && process.env["VERCEL_GIT_COMMIT_SHA"] && process.env["VERCEL_GIT_REPO_SLUG"] && process.env["VERCEL_GIT_REPO_OWNER"]) {
|
|
742
|
+
options.release.setCommits = {
|
|
743
|
+
shouldNotThrowOnFailure: true,
|
|
744
|
+
commit: process.env["VERCEL_GIT_COMMIT_SHA"],
|
|
745
|
+
previousCommit: process.env["VERCEL_GIT_PREVIOUS_SHA"],
|
|
746
|
+
repo: "".concat(process.env["VERCEL_GIT_REPO_OWNER"], "/").concat(process.env["VERCEL_GIT_REPO_SLUG"]),
|
|
747
|
+
ignoreEmpty: true,
|
|
748
|
+
ignoreMissing: true
|
|
749
|
+
};
|
|
750
|
+
} else {
|
|
751
|
+
options.release.setCommits = {
|
|
752
|
+
shouldNotThrowOnFailure: true,
|
|
753
|
+
auto: true,
|
|
754
|
+
ignoreEmpty: true,
|
|
755
|
+
ignoreMissing: true
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
if (options.release.deploy === undefined && process.env["VERCEL"] && process.env["VERCEL_TARGET_ENV"]) {
|
|
760
|
+
options.release.deploy = {
|
|
761
|
+
env: "vercel-".concat(process.env["VERCEL_TARGET_ENV"]),
|
|
762
|
+
url: process.env["VERCEL_URL"] ? "https://".concat(process.env["VERCEL_URL"]) : undefined
|
|
763
|
+
};
|
|
764
|
+
}
|
|
739
765
|
return options;
|
|
740
766
|
}
|
|
741
767
|
|
|
@@ -8075,7 +8101,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
8075
8101
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8076
8102
|
tracesSampleRate: 1,
|
|
8077
8103
|
sampleRate: 1,
|
|
8078
|
-
release: "3.2.
|
|
8104
|
+
release: "3.2.3",
|
|
8079
8105
|
integrations: [],
|
|
8080
8106
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8081
8107
|
stackParser: stackParser,
|
|
@@ -8443,7 +8469,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
8443
8469
|
}));
|
|
8444
8470
|
_context5.next = 3;
|
|
8445
8471
|
return cliInstance.releases.uploadSourceMaps(releaseName !== null && releaseName !== void 0 ? releaseName : "undefined",
|
|
8446
|
-
//
|
|
8472
|
+
// unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
8447
8473
|
{
|
|
8448
8474
|
include: [{
|
|
8449
8475
|
paths: [tmpUploadFolder],
|
|
@@ -8481,7 +8507,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
8481
8507
|
_context8.prev = 25;
|
|
8482
8508
|
_context8.t0 = _context8["catch"](1);
|
|
8483
8509
|
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
8484
|
-
handleRecoverableError(_context8.t0);
|
|
8510
|
+
handleRecoverableError(_context8.t0, false);
|
|
8485
8511
|
case 29:
|
|
8486
8512
|
_context8.prev = 29;
|
|
8487
8513
|
if (folderToCleanUp) {
|
|
@@ -8534,16 +8560,9 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
8534
8560
|
function prepareBundleForDebugIdUpload(_x4, _x5, _x6, _x7, _x8) {
|
|
8535
8561
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
8536
8562
|
}
|
|
8537
|
-
|
|
8538
|
-
/**
|
|
8539
|
-
* Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle
|
|
8540
|
-
* source and extracts the bundle's debug ID from it.
|
|
8541
|
-
*
|
|
8542
|
-
* The string pattern is injected via the debug ID injection snipped.
|
|
8543
|
-
*/
|
|
8544
8563
|
function _prepareBundleForDebugIdUpload() {
|
|
8545
8564
|
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook) {
|
|
8546
|
-
var bundleContent, debugId,
|
|
8565
|
+
var bundleContent, debugId, uniqueSourceFileUploadPath, writeSourceFilePromise, writeSourceMapFilePromise;
|
|
8547
8566
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
8548
8567
|
while (1) switch (_context11.prev = _context11.next) {
|
|
8549
8568
|
case 0:
|
|
@@ -8568,9 +8587,13 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8568
8587
|
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));
|
|
8569
8588
|
return _context11.abrupt("return");
|
|
8570
8589
|
case 14:
|
|
8571
|
-
|
|
8590
|
+
uniqueSourceFileUploadPath = getUniqueUploadPath(uploadFolder, chunkIndex, bundleFilePath);
|
|
8572
8591
|
bundleContent += "\n//# debugId=".concat(debugId);
|
|
8573
|
-
writeSourceFilePromise = fs__default.promises.
|
|
8592
|
+
writeSourceFilePromise = fs__default.promises.mkdir(path__default.dirname(uniqueSourceFileUploadPath), {
|
|
8593
|
+
recursive: true
|
|
8594
|
+
}).then(function () {
|
|
8595
|
+
return fs__default.promises.writeFile(uniqueSourceFileUploadPath, bundleContent, "utf-8");
|
|
8596
|
+
});
|
|
8574
8597
|
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
|
|
8575
8598
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(sourceMapPath) {
|
|
8576
8599
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
@@ -8581,7 +8604,7 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8581
8604
|
break;
|
|
8582
8605
|
}
|
|
8583
8606
|
_context10.next = 3;
|
|
8584
|
-
return prepareSourceMapForDebugIdUpload(sourceMapPath,
|
|
8607
|
+
return prepareSourceMapForDebugIdUpload(sourceMapPath, getUniqueUploadPath(uploadFolder, chunkIndex, sourceMapPath), debugId, rewriteSourcesHook, logger);
|
|
8585
8608
|
case 3:
|
|
8586
8609
|
case "end":
|
|
8587
8610
|
return _context10.stop();
|
|
@@ -8605,6 +8628,26 @@ function _prepareBundleForDebugIdUpload() {
|
|
|
8605
8628
|
}));
|
|
8606
8629
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
8607
8630
|
}
|
|
8631
|
+
function getUniqueUploadPath(uploadFolder, chunkIndex, filePath) {
|
|
8632
|
+
return path__default.join(uploadFolder, // We add a "chunk index" segment to the path that is a simple incrementing number to avoid name collisions.
|
|
8633
|
+
// Name collisions can happen when files are located "outside" of the current working directory, at different levels but they share a subpath.
|
|
8634
|
+
// Example:
|
|
8635
|
+
// - CWD: /root/foo/cwd
|
|
8636
|
+
// - File 1: /root/foo/index.js -> ../foo/index.js -> foo/index.js
|
|
8637
|
+
// - File 2: /foo/index.js -> ../../foo/index.js -> foo/index.js
|
|
8638
|
+
"".concat(chunkIndex), path__default.normalize(path__default.relative(process.cwd(), filePath).split(path__default.sep)
|
|
8639
|
+
// We filter out these "navigation" segments because a) they look ugly b) they will cause us to break out of the upload folder.
|
|
8640
|
+
.filter(function (segment) {
|
|
8641
|
+
return segment !== ".." && segment !== ".";
|
|
8642
|
+
}).join(path__default.sep)));
|
|
8643
|
+
}
|
|
8644
|
+
|
|
8645
|
+
/**
|
|
8646
|
+
* Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle
|
|
8647
|
+
* source and extracts the bundle's debug ID from it.
|
|
8648
|
+
*
|
|
8649
|
+
* The string pattern is injected via the debug ID injection snipped.
|
|
8650
|
+
*/
|
|
8608
8651
|
function determineDebugIdFromBundleSource(code) {
|
|
8609
8652
|
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})/);
|
|
8610
8653
|
if (match) {
|
|
@@ -8731,22 +8774,27 @@ function _prepareSourceMapForDebugIdUpload() {
|
|
|
8731
8774
|
}
|
|
8732
8775
|
_context13.prev = 21;
|
|
8733
8776
|
_context13.next = 24;
|
|
8734
|
-
return
|
|
8735
|
-
|
|
8777
|
+
return fs__default.promises.mkdir(path__default.dirname(targetPath), {
|
|
8778
|
+
recursive: true
|
|
8736
8779
|
});
|
|
8737
8780
|
case 24:
|
|
8738
|
-
_context13.next =
|
|
8739
|
-
|
|
8781
|
+
_context13.next = 26;
|
|
8782
|
+
return fs__default.promises.writeFile(targetPath, JSON.stringify(map), {
|
|
8783
|
+
encoding: "utf8"
|
|
8784
|
+
});
|
|
8740
8785
|
case 26:
|
|
8741
|
-
_context13.
|
|
8786
|
+
_context13.next = 32;
|
|
8787
|
+
break;
|
|
8788
|
+
case 28:
|
|
8789
|
+
_context13.prev = 28;
|
|
8742
8790
|
_context13.t2 = _context13["catch"](21);
|
|
8743
8791
|
logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath), _context13.t2);
|
|
8744
8792
|
return _context13.abrupt("return");
|
|
8745
|
-
case
|
|
8793
|
+
case 32:
|
|
8746
8794
|
case "end":
|
|
8747
8795
|
return _context13.stop();
|
|
8748
8796
|
}
|
|
8749
|
-
}, _callee13, null, [[0, 6], [10, 16], [21,
|
|
8797
|
+
}, _callee13, null, [[0, 6], [10, 16], [21, 28]]);
|
|
8750
8798
|
}));
|
|
8751
8799
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
8752
8800
|
}
|
|
@@ -8765,7 +8813,8 @@ function defaultRewriteSourcesHook(source) {
|
|
|
8765
8813
|
* Additionally, if legacy upload options are set, it uploads source maps in the legacy (non-debugId) way.
|
|
8766
8814
|
*/
|
|
8767
8815
|
function releaseManagementPlugin(_ref) {
|
|
8768
|
-
var
|
|
8816
|
+
var logger = _ref.logger,
|
|
8817
|
+
releaseName = _ref.releaseName,
|
|
8769
8818
|
include = _ref.include,
|
|
8770
8819
|
dist = _ref.dist,
|
|
8771
8820
|
setCommitsOption = _ref.setCommitsOption,
|
|
@@ -8822,47 +8871,63 @@ function releaseManagementPlugin(_ref) {
|
|
|
8822
8871
|
dist: dist
|
|
8823
8872
|
});
|
|
8824
8873
|
case 10:
|
|
8825
|
-
if (!setCommitsOption) {
|
|
8826
|
-
_context.next =
|
|
8874
|
+
if (!(setCommitsOption !== false)) {
|
|
8875
|
+
_context.next = 23;
|
|
8827
8876
|
break;
|
|
8828
8877
|
}
|
|
8829
|
-
_context.
|
|
8878
|
+
_context.prev = 11;
|
|
8879
|
+
_context.next = 14;
|
|
8830
8880
|
return cliInstance.releases.setCommits(releaseName, setCommitsOption);
|
|
8831
|
-
case
|
|
8881
|
+
case 14:
|
|
8882
|
+
_context.next = 23;
|
|
8883
|
+
break;
|
|
8884
|
+
case 16:
|
|
8885
|
+
_context.prev = 16;
|
|
8886
|
+
_context.t0 = _context["catch"](11);
|
|
8887
|
+
if (!("shouldNotThrowOnFailure" in setCommitsOption && setCommitsOption.shouldNotThrowOnFailure)) {
|
|
8888
|
+
_context.next = 22;
|
|
8889
|
+
break;
|
|
8890
|
+
}
|
|
8891
|
+
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context.t0);
|
|
8892
|
+
_context.next = 23;
|
|
8893
|
+
break;
|
|
8894
|
+
case 22:
|
|
8895
|
+
throw _context.t0;
|
|
8896
|
+
case 23:
|
|
8832
8897
|
if (!shouldFinalizeRelease) {
|
|
8833
|
-
_context.next =
|
|
8898
|
+
_context.next = 26;
|
|
8834
8899
|
break;
|
|
8835
8900
|
}
|
|
8836
|
-
_context.next =
|
|
8901
|
+
_context.next = 26;
|
|
8837
8902
|
return cliInstance.releases.finalize(releaseName);
|
|
8838
|
-
case
|
|
8903
|
+
case 26:
|
|
8839
8904
|
if (!deployOptions) {
|
|
8840
|
-
_context.next =
|
|
8905
|
+
_context.next = 29;
|
|
8841
8906
|
break;
|
|
8842
8907
|
}
|
|
8843
|
-
_context.next =
|
|
8908
|
+
_context.next = 29;
|
|
8844
8909
|
return cliInstance.releases.newDeploy(releaseName, deployOptions);
|
|
8845
|
-
case
|
|
8846
|
-
_context.next =
|
|
8910
|
+
case 29:
|
|
8911
|
+
_context.next = 37;
|
|
8847
8912
|
break;
|
|
8848
|
-
case
|
|
8849
|
-
_context.prev =
|
|
8850
|
-
_context.
|
|
8913
|
+
case 31:
|
|
8914
|
+
_context.prev = 31;
|
|
8915
|
+
_context.t1 = _context["catch"](1);
|
|
8851
8916
|
sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
8852
|
-
_context.next =
|
|
8917
|
+
_context.next = 36;
|
|
8853
8918
|
return safeFlushTelemetry(sentryClient);
|
|
8854
|
-
case
|
|
8855
|
-
handleRecoverableError(_context.
|
|
8856
|
-
case
|
|
8857
|
-
_context.prev =
|
|
8919
|
+
case 36:
|
|
8920
|
+
handleRecoverableError(_context.t1, false);
|
|
8921
|
+
case 37:
|
|
8922
|
+
_context.prev = 37;
|
|
8858
8923
|
freeGlobalDependencyOnSourcemapFiles();
|
|
8859
8924
|
freeWriteBundleInvocationDependencyOnSourcemapFiles();
|
|
8860
|
-
return _context.finish(
|
|
8861
|
-
case
|
|
8925
|
+
return _context.finish(37);
|
|
8926
|
+
case 41:
|
|
8862
8927
|
case "end":
|
|
8863
8928
|
return _context.stop();
|
|
8864
8929
|
}
|
|
8865
|
-
}, _callee, null, [[1,
|
|
8930
|
+
}, _callee, null, [[1, 31, 37, 41], [11, 16]]);
|
|
8866
8931
|
}))();
|
|
8867
8932
|
}
|
|
8868
8933
|
};
|
|
@@ -9009,7 +9074,9 @@ function fileDeletionPlugin(_ref) {
|
|
|
9009
9074
|
_context.next = 21;
|
|
9010
9075
|
return safeFlushTelemetry(sentryClient);
|
|
9011
9076
|
case 21:
|
|
9012
|
-
|
|
9077
|
+
// We throw by default if we get here b/c not being able to delete
|
|
9078
|
+
// source maps could leak them to production
|
|
9079
|
+
handleRecoverableError(_context.t0, true);
|
|
9013
9080
|
case 22:
|
|
9014
9081
|
case "end":
|
|
9015
9082
|
return _context.stop();
|
|
@@ -9120,8 +9187,18 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9120
9187
|
});
|
|
9121
9188
|
|
|
9122
9189
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
9123
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.
|
|
9124
|
-
|
|
9190
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.2.3");
|
|
9191
|
+
|
|
9192
|
+
/**
|
|
9193
|
+
* Handles errors caught and emitted in various areas of the plugin.
|
|
9194
|
+
*
|
|
9195
|
+
* Also sets the sentry session status according to the error handling.
|
|
9196
|
+
*
|
|
9197
|
+
* If users specify their custom `errorHandler` we'll leave the decision to throw
|
|
9198
|
+
* or continue up to them. By default, @param throwByDefault controls if the plugin
|
|
9199
|
+
* should throw an error (which causes a build fail in most bundlers) or continue.
|
|
9200
|
+
*/
|
|
9201
|
+
function handleRecoverableError(unknownError, throwByDefault) {
|
|
9125
9202
|
sentrySession.status = "abnormal";
|
|
9126
9203
|
try {
|
|
9127
9204
|
if (options.errorHandler) {
|
|
@@ -9136,15 +9213,21 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9136
9213
|
throw e;
|
|
9137
9214
|
}
|
|
9138
9215
|
} else {
|
|
9216
|
+
// setting the session to "crashed" b/c from a plugin perspective this run failed.
|
|
9217
|
+
// However, we're intentionally not rethrowing the error to avoid breaking the user build.
|
|
9139
9218
|
sentrySession.status = "crashed";
|
|
9140
|
-
|
|
9219
|
+
if (throwByDefault) {
|
|
9220
|
+
throw unknownError;
|
|
9221
|
+
}
|
|
9222
|
+
logger.error("An error occurred. Couldn't finish all operations:", unknownError);
|
|
9141
9223
|
}
|
|
9142
9224
|
} finally {
|
|
9143
9225
|
endSession();
|
|
9144
9226
|
}
|
|
9145
9227
|
}
|
|
9146
9228
|
if (!validateOptions(options, logger)) {
|
|
9147
|
-
|
|
9229
|
+
// Throwing by default to avoid a misconfigured plugin going unnoticed.
|
|
9230
|
+
handleRecoverableError(new Error("Options were not set correctly. See output above for more details."), true);
|
|
9148
9231
|
}
|
|
9149
9232
|
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) {
|
|
9150
9233
|
logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
@@ -9259,16 +9342,21 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9259
9342
|
var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
|
|
9260
9343
|
plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
|
|
9261
9344
|
}
|
|
9345
|
+
// https://turbo.build/repo/docs/reference/system-environment-variables#environment-variables-in-tasks
|
|
9346
|
+
var isRunningInTurborepo = Boolean(process.env["TURBO_HASH"]);
|
|
9347
|
+
var getTurborepoEnvPassthroughWarning = function getTurborepoEnvPassthroughWarning(envVarName) {
|
|
9348
|
+
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") : "";
|
|
9349
|
+
};
|
|
9262
9350
|
if (!options.release.name) {
|
|
9263
9351
|
logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
|
|
9264
9352
|
} else if (isDevMode) {
|
|
9265
9353
|
logger.debug("Running in development mode. Will not create release.");
|
|
9266
9354
|
} else if (!options.authToken) {
|
|
9267
|
-
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/");
|
|
9355
|
+
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"));
|
|
9268
9356
|
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9269
|
-
logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug.");
|
|
9357
|
+
logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9270
9358
|
} else if (!options.project) {
|
|
9271
|
-
logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug.");
|
|
9359
|
+
logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9272
9360
|
} else {
|
|
9273
9361
|
plugins.push(releaseManagementPlugin({
|
|
9274
9362
|
logger: logger,
|
|
@@ -9276,6 +9364,8 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9276
9364
|
shouldCreateRelease: options.release.create,
|
|
9277
9365
|
shouldFinalizeRelease: options.release.finalize,
|
|
9278
9366
|
include: options.release.uploadLegacySourcemaps,
|
|
9367
|
+
// setCommits has a default defined by the options mappings
|
|
9368
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9279
9369
|
setCommitsOption: options.release.setCommits,
|
|
9280
9370
|
deployOptions: options.release.deploy,
|
|
9281
9371
|
dist: options.release.dist,
|
|
@@ -9302,11 +9392,11 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9302
9392
|
} else if (isDevMode) {
|
|
9303
9393
|
logger.debug("Running in development mode. Will not upload sourcemaps.");
|
|
9304
9394
|
} else if (!options.authToken) {
|
|
9305
|
-
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/");
|
|
9395
|
+
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"));
|
|
9306
9396
|
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9307
|
-
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug.");
|
|
9397
|
+
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9308
9398
|
} else if (!options.project) {
|
|
9309
|
-
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug.");
|
|
9399
|
+
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9310
9400
|
} else {
|
|
9311
9401
|
var _options$sourcemaps3, _options$sourcemaps4, _options$sourcemaps5;
|
|
9312
9402
|
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
|