@sentry/bundler-plugin-core 0.4.0 → 0.5.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 +780 -133
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +758 -136
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/debug-id.d.ts +6 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/options-mapping.d.ts +1 -1
- package/dist/types/sentry/releasePipeline.d.ts +1 -0
- package/dist/types/types.d.ts +41 -0
- package/dist/types/utils.d.ts +21 -0
- package/package.json +8 -11
- package/sentry-release-injection-file.js +4 -0
package/dist/cjs/index.js
CHANGED
|
@@ -6,14 +6,46 @@ var unplugin$1 = require('unplugin');
|
|
|
6
6
|
var MagicString = require('magic-string');
|
|
7
7
|
var SentryCli = require('@sentry/cli');
|
|
8
8
|
var node = require('@sentry/node');
|
|
9
|
-
require('
|
|
9
|
+
var findUp = require('find-up');
|
|
10
10
|
var path = require('path');
|
|
11
|
+
var fs = require('fs');
|
|
12
|
+
var os = require('os');
|
|
13
|
+
var crypto = require('crypto');
|
|
14
|
+
require('@sentry/tracing');
|
|
15
|
+
var util = require('util');
|
|
16
|
+
var glob = require('glob');
|
|
11
17
|
|
|
12
18
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
19
|
|
|
20
|
+
function _interopNamespace(e) {
|
|
21
|
+
if (e && e.__esModule) return e;
|
|
22
|
+
var n = Object.create(null);
|
|
23
|
+
if (e) {
|
|
24
|
+
Object.keys(e).forEach(function (k) {
|
|
25
|
+
if (k !== 'default') {
|
|
26
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
27
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return e[k]; }
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
n["default"] = e;
|
|
35
|
+
return Object.freeze(n);
|
|
36
|
+
}
|
|
37
|
+
|
|
14
38
|
var MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
|
15
39
|
var SentryCli__default = /*#__PURE__*/_interopDefaultLegacy(SentryCli);
|
|
40
|
+
var findUp__default = /*#__PURE__*/_interopDefaultLegacy(findUp);
|
|
16
41
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
42
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
43
|
+
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
44
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
45
|
+
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
46
|
+
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
|
47
|
+
var util__namespace = /*#__PURE__*/_interopNamespace(util);
|
|
48
|
+
var util__default = /*#__PURE__*/_interopDefaultLegacy(util);
|
|
17
49
|
|
|
18
50
|
function _regeneratorRuntime() {
|
|
19
51
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
@@ -769,13 +801,156 @@ timestampSource.nowSeconds.bind(timestampSource);
|
|
|
769
801
|
* @param maybeArray Input to turn into an array, if necessary
|
|
770
802
|
* @returns The input, if already an array, or an array with the input as the only element, if not
|
|
771
803
|
*/
|
|
804
|
+
|
|
772
805
|
function arrayify(maybeArray) {
|
|
773
806
|
return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
|
|
774
807
|
}
|
|
775
808
|
|
|
809
|
+
/**
|
|
810
|
+
* Get the closes package.json from a given starting point upwards.
|
|
811
|
+
* This handles a few edge cases:
|
|
812
|
+
* * Check if a given file package.json appears to be an actual NPM package.json file
|
|
813
|
+
* * Stop at the home dir, to avoid looking too deeply
|
|
814
|
+
*/
|
|
815
|
+
function getPackageJson() {
|
|
816
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
817
|
+
cwd = _ref.cwd,
|
|
818
|
+
stopAt = _ref.stopAt;
|
|
819
|
+
|
|
820
|
+
return lookupPackageJson(cwd !== null && cwd !== void 0 ? cwd : process.cwd(), path__default["default"].normalize(stopAt !== null && stopAt !== void 0 ? stopAt : os__default["default"].homedir()));
|
|
821
|
+
}
|
|
822
|
+
function parseMajorVersion(version) {
|
|
823
|
+
// if it has a `v` prefix, remove it
|
|
824
|
+
if (version.startsWith("v")) {
|
|
825
|
+
version = version.slice(1);
|
|
826
|
+
} // First, try simple lookup of exact, ~ and ^ versions
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
var regex = /^[\^~]?(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
830
|
+
var match = version.match(regex);
|
|
831
|
+
|
|
832
|
+
if (match) {
|
|
833
|
+
return parseInt(match[1], 10);
|
|
834
|
+
} // Try to parse e.g. 1.x
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
var coerced = parseInt(version, 10);
|
|
838
|
+
|
|
839
|
+
if (!Number.isNaN(coerced)) {
|
|
840
|
+
return coerced;
|
|
841
|
+
} // Match <= and >= ranges.
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
var gteLteRegex = /^[<>]=\s*(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
845
|
+
var gteLteMatch = version.match(gteLteRegex);
|
|
846
|
+
|
|
847
|
+
if (gteLteMatch) {
|
|
848
|
+
return parseInt(gteLteMatch[1], 10);
|
|
849
|
+
} // match < ranges
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
var ltRegex = /^<\s*(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
853
|
+
var ltMatch = version.match(ltRegex);
|
|
854
|
+
|
|
855
|
+
if (ltMatch) {
|
|
856
|
+
// Two scenarios:
|
|
857
|
+
// a) < 2.0.0 --> return 1
|
|
858
|
+
// b) < 2.1.0 --> return 2
|
|
859
|
+
var major = parseInt(ltMatch[1], 10);
|
|
860
|
+
|
|
861
|
+
if ( // minor version > 0
|
|
862
|
+
typeof ltMatch[2] === "string" && parseInt(ltMatch[2].slice(1), 10) > 0 || // patch version > 0
|
|
863
|
+
typeof ltMatch[3] === "string" && parseInt(ltMatch[3].slice(1), 10) > 0) {
|
|
864
|
+
return major;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
return major - 1;
|
|
868
|
+
} // match > ranges
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
var gtRegex = /^>\s*(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
872
|
+
var gtMatch = version.match(gtRegex);
|
|
873
|
+
|
|
874
|
+
if (gtMatch) {
|
|
875
|
+
// We always return the version here, even though it _may_ be incorrect
|
|
876
|
+
// E.g. if given > 2.0.0, it should be 2 if there exists any 2.x.x version, else 3
|
|
877
|
+
// Since there is no way for us to know this, we're going to assume any kind of patch/feature release probably exists
|
|
878
|
+
return parseInt(gtMatch[1], 10);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
return undefined;
|
|
882
|
+
} // This is an explicit list of packages where we want to include the (major) version number.
|
|
883
|
+
|
|
884
|
+
var PACKAGES_TO_INCLUDE_VERSION = ["react", "@angular/core", "vue", "ember-source", "svelte", "@sveltejs/kit", "webpack", "vite", "gatsby", "next", "remix", "rollup", "esbuild"];
|
|
885
|
+
function getDependencies(packageJson) {
|
|
886
|
+
var _packageJson$devDepen, _packageJson$dependen;
|
|
887
|
+
|
|
888
|
+
var dependencies = Object.assign({}, (_packageJson$devDepen = packageJson["devDependencies"]) !== null && _packageJson$devDepen !== void 0 ? _packageJson$devDepen : {}, (_packageJson$dependen = packageJson["dependencies"]) !== null && _packageJson$dependen !== void 0 ? _packageJson$dependen : {});
|
|
889
|
+
var deps = Object.keys(dependencies).sort();
|
|
890
|
+
var depsVersions = deps.reduce(function (depsVersions, depName) {
|
|
891
|
+
if (PACKAGES_TO_INCLUDE_VERSION.includes(depName)) {
|
|
892
|
+
var version = dependencies[depName];
|
|
893
|
+
var majorVersion = parseMajorVersion(version);
|
|
894
|
+
|
|
895
|
+
if (majorVersion) {
|
|
896
|
+
depsVersions[depName] = majorVersion;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
return depsVersions;
|
|
901
|
+
}, {});
|
|
902
|
+
return {
|
|
903
|
+
deps: deps,
|
|
904
|
+
depsVersions: depsVersions
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
function lookupPackageJson(cwd, stopAt) {
|
|
909
|
+
var jsonPath = findUp__default["default"].sync(function (dirName) {
|
|
910
|
+
// Stop if we reach this dir
|
|
911
|
+
if (path__default["default"].normalize(dirName) === stopAt) {
|
|
912
|
+
return findUp__default["default"].stop;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
return findUp__default["default"].sync.exists(dirName + "/package.json") ? "package.json" : undefined;
|
|
916
|
+
}, {
|
|
917
|
+
cwd: cwd
|
|
918
|
+
});
|
|
919
|
+
|
|
920
|
+
if (!jsonPath) {
|
|
921
|
+
return undefined;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
try {
|
|
925
|
+
var jsonStr = fs__default["default"].readFileSync(jsonPath, "utf8");
|
|
926
|
+
var json = JSON.parse(jsonStr); // Ensure it is an actual package.json
|
|
927
|
+
// This is very much not bulletproof, but should be good enough
|
|
928
|
+
|
|
929
|
+
if ("name" in json || "private" in json) {
|
|
930
|
+
return json;
|
|
931
|
+
}
|
|
932
|
+
} catch (error) {// Ignore and walk up
|
|
933
|
+
} // Continue up the tree, if we find a fitting package.json
|
|
934
|
+
|
|
935
|
+
|
|
936
|
+
var newCwd = path__default["default"].dirname(path__default["default"].resolve(jsonPath + "/.."));
|
|
937
|
+
return lookupPackageJson(newCwd, stopAt);
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Deterministically hashes a string and turns the hash into a uuid.
|
|
941
|
+
*/
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
function stringToUUID(str) {
|
|
945
|
+
var md5sum = crypto__default["default"].createHash("md5");
|
|
946
|
+
md5sum.update(str);
|
|
947
|
+
var md5Hash = md5sum.digest("hex");
|
|
948
|
+
return (md5Hash.substring(0, 8) + "-" + md5Hash.substring(8, 12) + "-4" + md5Hash.substring(13, 16) + "-" + md5Hash.substring(16, 20) + "-" + md5Hash.substring(20)).toLowerCase();
|
|
949
|
+
}
|
|
950
|
+
|
|
776
951
|
var SENTRY_SAAS_URL = "https://sentry.io";
|
|
777
952
|
function normalizeUserOptions(userOptions) {
|
|
778
|
-
var _userOptions$org, _userOptions$project, _ref, _userOptions$release, _ref2, _userOptions$url, _userOptions$finalize, _userOptions$cleanArt, _userOptions$dryRun, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$injectRe;
|
|
953
|
+
var _userOptions$org, _userOptions$project, _ref, _userOptions$release, _ref2, _userOptions$url, _userOptions$finalize, _userOptions$cleanArt, _userOptions$dryRun, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$injectRe, _userOptions$injectRe2, _userOptions$uploadSo, _userOptions$_experim;
|
|
779
954
|
|
|
780
955
|
var options = {
|
|
781
956
|
// include is the only strictly required option
|
|
@@ -804,6 +979,9 @@ function normalizeUserOptions(userOptions) {
|
|
|
804
979
|
silent: (_userOptions$silent = userOptions.silent) !== null && _userOptions$silent !== void 0 ? _userOptions$silent : false,
|
|
805
980
|
telemetry: (_userOptions$telemetr = userOptions.telemetry) !== null && _userOptions$telemetr !== void 0 ? _userOptions$telemetr : true,
|
|
806
981
|
injectReleasesMap: (_userOptions$injectRe = userOptions.injectReleasesMap) !== null && _userOptions$injectRe !== void 0 ? _userOptions$injectRe : false,
|
|
982
|
+
injectRelease: (_userOptions$injectRe2 = userOptions.injectRelease) !== null && _userOptions$injectRe2 !== void 0 ? _userOptions$injectRe2 : true,
|
|
983
|
+
uploadSourceMaps: (_userOptions$uploadSo = userOptions.uploadSourceMaps) !== null && _userOptions$uploadSo !== void 0 ? _userOptions$uploadSo : true,
|
|
984
|
+
_experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {},
|
|
807
985
|
// These options and can also be set via env variables or the config file.
|
|
808
986
|
// If they're set in the options, we simply pass them to the CLI constructor.
|
|
809
987
|
// Sentry CLI will internally query env variables and read its config file if
|
|
@@ -943,7 +1121,7 @@ function makeSentryClient(dsn, allowedToSendTelemetryPromise, userProject) {
|
|
|
943
1121
|
// a dashboard.
|
|
944
1122
|
// Yes, this is slightly abusing the purpose of this field.
|
|
945
1123
|
dist: userProject,
|
|
946
|
-
release: "0.
|
|
1124
|
+
release: "0.5.0",
|
|
947
1125
|
integrations: [],
|
|
948
1126
|
tracePropagationTargets: ["sentry.io/api"],
|
|
949
1127
|
stackParser: node.defaultStackParser,
|
|
@@ -1045,7 +1223,8 @@ function addPluginOptionInformationToHub(options, hub, bundler) {
|
|
|
1045
1223
|
dryRun = options.dryRun,
|
|
1046
1224
|
errorHandler = options.errorHandler,
|
|
1047
1225
|
deploy = options.deploy,
|
|
1048
|
-
include = options.include
|
|
1226
|
+
include = options.include,
|
|
1227
|
+
_experiments = options._experiments;
|
|
1049
1228
|
hub.setTag("include", include.length > 1 ? "multiple-entries" : "single-entry"); // Optional release pipeline steps
|
|
1050
1229
|
|
|
1051
1230
|
if (cleanArtifacts) {
|
|
@@ -1077,6 +1256,10 @@ function addPluginOptionInformationToHub(options, hub, bundler) {
|
|
|
1077
1256
|
hub.setTag("error-handler", "custom");
|
|
1078
1257
|
}
|
|
1079
1258
|
|
|
1259
|
+
if (_experiments.debugIdUpload) {
|
|
1260
|
+
hub.setTag("debug-id-upload", true);
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1080
1263
|
hub.setTag("node", process.version);
|
|
1081
1264
|
hub.setTags({
|
|
1082
1265
|
organization: org,
|
|
@@ -1288,74 +1471,141 @@ function _uploadSourceMaps() {
|
|
|
1288
1471
|
while (1) {
|
|
1289
1472
|
switch (_context3.prev = _context3.next) {
|
|
1290
1473
|
case 0:
|
|
1474
|
+
if (options.uploadSourceMaps) {
|
|
1475
|
+
_context3.next = 3;
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
logger.debug("Skipping source maps upload.");
|
|
1480
|
+
return _context3.abrupt("return");
|
|
1481
|
+
|
|
1482
|
+
case 3:
|
|
1291
1483
|
span = addSpanToTransaction(ctx, "function.plugin.upload_sourcemaps");
|
|
1292
1484
|
ctx.logger.info("Uploading Sourcemaps."); // Since our internal include entries contain all top-level sourcemaps options,
|
|
1293
1485
|
// we only need to pass the include option here.
|
|
1294
1486
|
|
|
1295
|
-
_context3.prev =
|
|
1296
|
-
_context3.next =
|
|
1487
|
+
_context3.prev = 5;
|
|
1488
|
+
_context3.next = 8;
|
|
1297
1489
|
return ctx.cli.releases.uploadSourceMaps(releaseName, {
|
|
1298
1490
|
include: options.include,
|
|
1299
1491
|
dist: options.dist
|
|
1300
1492
|
});
|
|
1301
1493
|
|
|
1302
|
-
case
|
|
1303
|
-
_context3.next =
|
|
1494
|
+
case 8:
|
|
1495
|
+
_context3.next = 14;
|
|
1304
1496
|
break;
|
|
1305
1497
|
|
|
1306
|
-
case
|
|
1307
|
-
_context3.prev =
|
|
1308
|
-
_context3.t0 = _context3["catch"](
|
|
1498
|
+
case 10:
|
|
1499
|
+
_context3.prev = 10;
|
|
1500
|
+
_context3.t0 = _context3["catch"](5);
|
|
1309
1501
|
ctx.hub.captureException(new Error("CLI Error: Uploading source maps failed"));
|
|
1310
1502
|
throw _context3.t0;
|
|
1311
1503
|
|
|
1312
|
-
case
|
|
1313
|
-
_context3.prev =
|
|
1504
|
+
case 14:
|
|
1505
|
+
_context3.prev = 14;
|
|
1314
1506
|
span === null || span === void 0 ? void 0 : span.finish();
|
|
1315
|
-
return _context3.finish(
|
|
1507
|
+
return _context3.finish(14);
|
|
1316
1508
|
|
|
1317
|
-
case
|
|
1509
|
+
case 17:
|
|
1318
1510
|
ctx.hub.addBreadcrumb({
|
|
1319
1511
|
level: "info",
|
|
1320
1512
|
message: "Successfully uploaded source maps."
|
|
1321
1513
|
});
|
|
1322
1514
|
ctx.logger.info("Successfully uploaded source maps.");
|
|
1323
1515
|
|
|
1324
|
-
case
|
|
1516
|
+
case 19:
|
|
1325
1517
|
case "end":
|
|
1326
1518
|
return _context3.stop();
|
|
1327
1519
|
}
|
|
1328
1520
|
}
|
|
1329
|
-
}, _callee3, null, [[
|
|
1521
|
+
}, _callee3, null, [[5, 10, 14, 17]]);
|
|
1330
1522
|
}));
|
|
1331
1523
|
return _uploadSourceMaps.apply(this, arguments);
|
|
1332
1524
|
}
|
|
1333
1525
|
|
|
1334
|
-
function
|
|
1526
|
+
function uploadDebugIdSourcemaps(_x10, _x11, _x12, _x13) {
|
|
1527
|
+
return _uploadDebugIdSourcemaps.apply(this, arguments);
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
function _uploadDebugIdSourcemaps() {
|
|
1531
|
+
_uploadDebugIdSourcemaps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(options, ctx, folderPathToUpload, releaseName) {
|
|
1532
|
+
var span;
|
|
1533
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1534
|
+
while (1) {
|
|
1535
|
+
switch (_context4.prev = _context4.next) {
|
|
1536
|
+
case 0:
|
|
1537
|
+
span = addSpanToTransaction(ctx, "function.plugin.upload_debug_id_sourcemaps");
|
|
1538
|
+
ctx.logger.info("Uploading debug ID Sourcemaps."); // Since our internal include entries contain all top-level sourcemaps options,
|
|
1539
|
+
// we only need to pass the include option here.
|
|
1540
|
+
|
|
1541
|
+
_context4.prev = 2;
|
|
1542
|
+
_context4.next = 5;
|
|
1543
|
+
return ctx.cli.releases.uploadSourceMaps(releaseName, {
|
|
1544
|
+
include: [{
|
|
1545
|
+
paths: [folderPathToUpload],
|
|
1546
|
+
rewrite: false,
|
|
1547
|
+
dist: options.dist
|
|
1548
|
+
}],
|
|
1549
|
+
useArtifactBundle: true
|
|
1550
|
+
});
|
|
1551
|
+
|
|
1552
|
+
case 5:
|
|
1553
|
+
_context4.next = 11;
|
|
1554
|
+
break;
|
|
1555
|
+
|
|
1556
|
+
case 7:
|
|
1557
|
+
_context4.prev = 7;
|
|
1558
|
+
_context4.t0 = _context4["catch"](2);
|
|
1559
|
+
ctx.hub.captureException(new Error("CLI Error: Uploading debug ID source maps failed"));
|
|
1560
|
+
throw _context4.t0;
|
|
1561
|
+
|
|
1562
|
+
case 11:
|
|
1563
|
+
_context4.prev = 11;
|
|
1564
|
+
span === null || span === void 0 ? void 0 : span.finish();
|
|
1565
|
+
return _context4.finish(11);
|
|
1566
|
+
|
|
1567
|
+
case 14:
|
|
1568
|
+
ctx.hub.addBreadcrumb({
|
|
1569
|
+
level: "info",
|
|
1570
|
+
message: "Successfully uploaded debug ID source maps."
|
|
1571
|
+
});
|
|
1572
|
+
ctx.logger.info("Successfully uploaded debug ID source maps.");
|
|
1573
|
+
|
|
1574
|
+
case 16:
|
|
1575
|
+
case "end":
|
|
1576
|
+
return _context4.stop();
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
}, _callee4, null, [[2, 7, 11, 14]]);
|
|
1580
|
+
}));
|
|
1581
|
+
return _uploadDebugIdSourcemaps.apply(this, arguments);
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
function setCommits(_x14, _x15, _x16) {
|
|
1335
1585
|
return _setCommits.apply(this, arguments);
|
|
1336
1586
|
}
|
|
1337
1587
|
|
|
1338
1588
|
function _setCommits() {
|
|
1339
|
-
_setCommits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1589
|
+
_setCommits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(options, ctx, releaseName) {
|
|
1340
1590
|
var span, _options$setCommits, auto, repo, commit, previousCommit, ignoreMissing, ignoreEmpty;
|
|
1341
1591
|
|
|
1342
|
-
return _regeneratorRuntime().wrap(function
|
|
1592
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
1343
1593
|
while (1) {
|
|
1344
|
-
switch (
|
|
1594
|
+
switch (_context5.prev = _context5.next) {
|
|
1345
1595
|
case 0:
|
|
1346
1596
|
if (options.setCommits) {
|
|
1347
|
-
|
|
1597
|
+
_context5.next = 3;
|
|
1348
1598
|
break;
|
|
1349
1599
|
}
|
|
1350
1600
|
|
|
1351
1601
|
logger.debug("Skipping setting commits to release.");
|
|
1352
|
-
return
|
|
1602
|
+
return _context5.abrupt("return");
|
|
1353
1603
|
|
|
1354
1604
|
case 3:
|
|
1355
1605
|
span = addSpanToTransaction(ctx, "function.plugin.set_commits");
|
|
1356
1606
|
_options$setCommits = options.setCommits, auto = _options$setCommits.auto, repo = _options$setCommits.repo, commit = _options$setCommits.commit, previousCommit = _options$setCommits.previousCommit, ignoreMissing = _options$setCommits.ignoreMissing, ignoreEmpty = _options$setCommits.ignoreEmpty;
|
|
1357
|
-
|
|
1358
|
-
|
|
1607
|
+
_context5.prev = 5;
|
|
1608
|
+
_context5.next = 8;
|
|
1359
1609
|
return ctx.cli.releases.setCommits(releaseName, {
|
|
1360
1610
|
commit: commit,
|
|
1361
1611
|
previousCommit: previousCommit,
|
|
@@ -1366,46 +1616,46 @@ function _setCommits() {
|
|
|
1366
1616
|
});
|
|
1367
1617
|
|
|
1368
1618
|
case 8:
|
|
1369
|
-
|
|
1619
|
+
_context5.next = 14;
|
|
1370
1620
|
break;
|
|
1371
1621
|
|
|
1372
1622
|
case 10:
|
|
1373
|
-
|
|
1374
|
-
|
|
1623
|
+
_context5.prev = 10;
|
|
1624
|
+
_context5.t0 = _context5["catch"](5);
|
|
1375
1625
|
ctx.hub.captureException(new Error("CLI Error: Setting commits failed"));
|
|
1376
|
-
throw
|
|
1626
|
+
throw _context5.t0;
|
|
1377
1627
|
|
|
1378
1628
|
case 14:
|
|
1379
|
-
|
|
1629
|
+
_context5.prev = 14;
|
|
1380
1630
|
span === null || span === void 0 ? void 0 : span.finish();
|
|
1381
|
-
return
|
|
1631
|
+
return _context5.finish(14);
|
|
1382
1632
|
|
|
1383
1633
|
case 17:
|
|
1384
1634
|
ctx.logger.info("Successfully set commits.");
|
|
1385
1635
|
|
|
1386
1636
|
case 18:
|
|
1387
1637
|
case "end":
|
|
1388
|
-
return
|
|
1638
|
+
return _context5.stop();
|
|
1389
1639
|
}
|
|
1390
1640
|
}
|
|
1391
|
-
},
|
|
1641
|
+
}, _callee5, null, [[5, 10, 14, 17]]);
|
|
1392
1642
|
}));
|
|
1393
1643
|
return _setCommits.apply(this, arguments);
|
|
1394
1644
|
}
|
|
1395
1645
|
|
|
1396
|
-
function finalizeRelease(
|
|
1646
|
+
function finalizeRelease(_x17, _x18, _x19) {
|
|
1397
1647
|
return _finalizeRelease.apply(this, arguments);
|
|
1398
1648
|
}
|
|
1399
1649
|
|
|
1400
1650
|
function _finalizeRelease() {
|
|
1401
|
-
_finalizeRelease = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1651
|
+
_finalizeRelease = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(options, ctx, releaseName) {
|
|
1402
1652
|
var span;
|
|
1403
|
-
return _regeneratorRuntime().wrap(function
|
|
1653
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1404
1654
|
while (1) {
|
|
1405
|
-
switch (
|
|
1655
|
+
switch (_context6.prev = _context6.next) {
|
|
1406
1656
|
case 0:
|
|
1407
1657
|
if (options.finalize) {
|
|
1408
|
-
|
|
1658
|
+
_context6.next = 4;
|
|
1409
1659
|
break;
|
|
1410
1660
|
}
|
|
1411
1661
|
|
|
@@ -1414,28 +1664,28 @@ function _finalizeRelease() {
|
|
|
1414
1664
|
message: "Skipping release finalization."
|
|
1415
1665
|
});
|
|
1416
1666
|
logger.debug("Skipping release finalization.");
|
|
1417
|
-
return
|
|
1667
|
+
return _context6.abrupt("return");
|
|
1418
1668
|
|
|
1419
1669
|
case 4:
|
|
1420
1670
|
span = addSpanToTransaction(ctx, "function.plugin.finalize_release");
|
|
1421
|
-
|
|
1422
|
-
|
|
1671
|
+
_context6.prev = 5;
|
|
1672
|
+
_context6.next = 8;
|
|
1423
1673
|
return ctx.cli.releases.finalize(releaseName);
|
|
1424
1674
|
|
|
1425
1675
|
case 8:
|
|
1426
|
-
|
|
1676
|
+
_context6.next = 14;
|
|
1427
1677
|
break;
|
|
1428
1678
|
|
|
1429
1679
|
case 10:
|
|
1430
|
-
|
|
1431
|
-
|
|
1680
|
+
_context6.prev = 10;
|
|
1681
|
+
_context6.t0 = _context6["catch"](5);
|
|
1432
1682
|
ctx.hub.captureException(new Error("CLI Error: Finalizing release failed"));
|
|
1433
|
-
throw
|
|
1683
|
+
throw _context6.t0;
|
|
1434
1684
|
|
|
1435
1685
|
case 14:
|
|
1436
|
-
|
|
1686
|
+
_context6.prev = 14;
|
|
1437
1687
|
span === null || span === void 0 ? void 0 : span.finish();
|
|
1438
|
-
return
|
|
1688
|
+
return _context6.finish(14);
|
|
1439
1689
|
|
|
1440
1690
|
case 17:
|
|
1441
1691
|
ctx.hub.addBreadcrumb({
|
|
@@ -1446,28 +1696,28 @@ function _finalizeRelease() {
|
|
|
1446
1696
|
|
|
1447
1697
|
case 19:
|
|
1448
1698
|
case "end":
|
|
1449
|
-
return
|
|
1699
|
+
return _context6.stop();
|
|
1450
1700
|
}
|
|
1451
1701
|
}
|
|
1452
|
-
},
|
|
1702
|
+
}, _callee6, null, [[5, 10, 14, 17]]);
|
|
1453
1703
|
}));
|
|
1454
1704
|
return _finalizeRelease.apply(this, arguments);
|
|
1455
1705
|
}
|
|
1456
1706
|
|
|
1457
|
-
function addDeploy(
|
|
1707
|
+
function addDeploy(_x20, _x21, _x22) {
|
|
1458
1708
|
return _addDeploy.apply(this, arguments);
|
|
1459
1709
|
}
|
|
1460
1710
|
|
|
1461
1711
|
function _addDeploy() {
|
|
1462
|
-
_addDeploy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1712
|
+
_addDeploy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(options, ctx, releaseName) {
|
|
1463
1713
|
var span, _options$deploy, env, started, finished, time, name, url;
|
|
1464
1714
|
|
|
1465
|
-
return _regeneratorRuntime().wrap(function
|
|
1715
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1466
1716
|
while (1) {
|
|
1467
|
-
switch (
|
|
1717
|
+
switch (_context7.prev = _context7.next) {
|
|
1468
1718
|
case 0:
|
|
1469
1719
|
if (options.deploy) {
|
|
1470
|
-
|
|
1720
|
+
_context7.next = 4;
|
|
1471
1721
|
break;
|
|
1472
1722
|
}
|
|
1473
1723
|
|
|
@@ -1476,13 +1726,13 @@ function _addDeploy() {
|
|
|
1476
1726
|
message: "Skipping adding deploy info to release."
|
|
1477
1727
|
});
|
|
1478
1728
|
logger.debug("Skipping adding deploy info to release.");
|
|
1479
|
-
return
|
|
1729
|
+
return _context7.abrupt("return");
|
|
1480
1730
|
|
|
1481
1731
|
case 4:
|
|
1482
1732
|
span = addSpanToTransaction(ctx, "function.plugin.deploy");
|
|
1483
1733
|
_options$deploy = options.deploy, env = _options$deploy.env, started = _options$deploy.started, finished = _options$deploy.finished, time = _options$deploy.time, name = _options$deploy.name, url = _options$deploy.url;
|
|
1484
|
-
|
|
1485
|
-
|
|
1734
|
+
_context7.prev = 6;
|
|
1735
|
+
_context7.next = 9;
|
|
1486
1736
|
return ctx.cli.releases.newDeploy(releaseName, {
|
|
1487
1737
|
env: env,
|
|
1488
1738
|
started: started,
|
|
@@ -1493,19 +1743,19 @@ function _addDeploy() {
|
|
|
1493
1743
|
});
|
|
1494
1744
|
|
|
1495
1745
|
case 9:
|
|
1496
|
-
|
|
1746
|
+
_context7.next = 15;
|
|
1497
1747
|
break;
|
|
1498
1748
|
|
|
1499
1749
|
case 11:
|
|
1500
|
-
|
|
1501
|
-
|
|
1750
|
+
_context7.prev = 11;
|
|
1751
|
+
_context7.t0 = _context7["catch"](6);
|
|
1502
1752
|
ctx.hub.captureException(new Error("CLI Error: Adding deploy info failed"));
|
|
1503
|
-
throw
|
|
1753
|
+
throw _context7.t0;
|
|
1504
1754
|
|
|
1505
1755
|
case 15:
|
|
1506
|
-
|
|
1756
|
+
_context7.prev = 15;
|
|
1507
1757
|
span === null || span === void 0 ? void 0 : span.finish();
|
|
1508
|
-
return
|
|
1758
|
+
return _context7.finish(15);
|
|
1509
1759
|
|
|
1510
1760
|
case 18:
|
|
1511
1761
|
ctx.hub.addBreadcrumb({
|
|
@@ -1516,10 +1766,10 @@ function _addDeploy() {
|
|
|
1516
1766
|
|
|
1517
1767
|
case 20:
|
|
1518
1768
|
case "end":
|
|
1519
|
-
return
|
|
1769
|
+
return _context7.stop();
|
|
1520
1770
|
}
|
|
1521
1771
|
}
|
|
1522
|
-
},
|
|
1772
|
+
}, _callee7, null, [[6, 11, 15, 18]]);
|
|
1523
1773
|
}));
|
|
1524
1774
|
return _addDeploy.apply(this, arguments);
|
|
1525
1775
|
}
|
|
@@ -1650,18 +1900,261 @@ function getDryRunCLI(cli, logger) {
|
|
|
1650
1900
|
};
|
|
1651
1901
|
}
|
|
1652
1902
|
|
|
1903
|
+
var DEBUG_ID_INJECTOR_SNIPPET = ';!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="__SENTRY_DEBUG_ID__",e._sentryDebugIdIdentifier="sentry-dbid-__SENTRY_DEBUG_ID__")}catch(e){}}();';
|
|
1904
|
+
function injectDebugIdSnippetIntoChunk(code) {
|
|
1905
|
+
var _code$match;
|
|
1906
|
+
|
|
1907
|
+
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
1908
|
+
|
|
1909
|
+
var ms = new MagicString__default["default"](code);
|
|
1910
|
+
var codeToInject = DEBUG_ID_INJECTOR_SNIPPET.replace(/__SENTRY_DEBUG_ID__/g, debugId); // We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
1911
|
+
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
1912
|
+
|
|
1913
|
+
var commentUseStrictRegex = /^(?:\s*|\/\*(.|\r|\n)*?\*\/|\/\/.*?[\n\r])*(?:"use strict";|'use strict';)?/;
|
|
1914
|
+
|
|
1915
|
+
if ((_code$match = code.match(commentUseStrictRegex)) !== null && _code$match !== void 0 && _code$match[0]) {
|
|
1916
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
1917
|
+
ms.replace(commentUseStrictRegex, function (match) {
|
|
1918
|
+
return "".concat(match).concat(codeToInject);
|
|
1919
|
+
});
|
|
1920
|
+
} else {
|
|
1921
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
1922
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
1923
|
+
// need this special case here.
|
|
1924
|
+
ms.prepend(codeToInject);
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
return {
|
|
1928
|
+
code: ms.toString(),
|
|
1929
|
+
map: ms.generateMap()
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
function prepareBundleForDebugIdUpload(_x, _x2, _x3, _x4) {
|
|
1933
|
+
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
1934
|
+
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Looks for a particular string pattern (`sdbid-[debug ID]`) in the bundle
|
|
1937
|
+
* source and extracts the bundle's debug ID from it.
|
|
1938
|
+
*
|
|
1939
|
+
* The string pattern is injected via the debug ID injection snipped.
|
|
1940
|
+
*/
|
|
1941
|
+
|
|
1942
|
+
function _prepareBundleForDebugIdUpload() {
|
|
1943
|
+
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(bundleFilePath, uploadFolder, uniqueUploadName, logger) {
|
|
1944
|
+
var bundleContent, debugId, writeSourceFilePromise, writeSourceMapFilePromise;
|
|
1945
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1946
|
+
while (1) {
|
|
1947
|
+
switch (_context2.prev = _context2.next) {
|
|
1948
|
+
case 0:
|
|
1949
|
+
_context2.prev = 0;
|
|
1950
|
+
_context2.next = 3;
|
|
1951
|
+
return util__namespace.promisify(fs__namespace.readFile)(bundleFilePath, "utf8");
|
|
1952
|
+
|
|
1953
|
+
case 3:
|
|
1954
|
+
bundleContent = _context2.sent;
|
|
1955
|
+
_context2.next = 10;
|
|
1956
|
+
break;
|
|
1957
|
+
|
|
1958
|
+
case 6:
|
|
1959
|
+
_context2.prev = 6;
|
|
1960
|
+
_context2.t0 = _context2["catch"](0);
|
|
1961
|
+
logger.warn("Could not read bundle to determine debug ID and source map: ".concat(bundleFilePath));
|
|
1962
|
+
return _context2.abrupt("return");
|
|
1963
|
+
|
|
1964
|
+
case 10:
|
|
1965
|
+
debugId = determineDebugIdFromBundleSource(bundleContent);
|
|
1966
|
+
|
|
1967
|
+
if (!(debugId === undefined)) {
|
|
1968
|
+
_context2.next = 14;
|
|
1969
|
+
break;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
logger.warn("Could not determine debug ID from bundle: ".concat(bundleFilePath));
|
|
1973
|
+
return _context2.abrupt("return");
|
|
1974
|
+
|
|
1975
|
+
case 14:
|
|
1976
|
+
bundleContent += "\n//# debugId=".concat(debugId);
|
|
1977
|
+
writeSourceFilePromise = util__namespace.promisify(fs__namespace.writeFile)(path__namespace.join(uploadFolder, "".concat(uniqueUploadName, ".js")), bundleContent, "utf-8");
|
|
1978
|
+
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
|
|
1979
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sourceMapPath) {
|
|
1980
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1981
|
+
while (1) {
|
|
1982
|
+
switch (_context.prev = _context.next) {
|
|
1983
|
+
case 0:
|
|
1984
|
+
if (!sourceMapPath) {
|
|
1985
|
+
_context.next = 4;
|
|
1986
|
+
break;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
_context.next = 3;
|
|
1990
|
+
return prepareSourceMapForDebugIdUpload(sourceMapPath, path__namespace.join(uploadFolder, "".concat(uniqueUploadName, ".js.map")), debugId, logger);
|
|
1991
|
+
|
|
1992
|
+
case 3:
|
|
1993
|
+
return _context.abrupt("return", _context.sent);
|
|
1994
|
+
|
|
1995
|
+
case 4:
|
|
1996
|
+
case "end":
|
|
1997
|
+
return _context.stop();
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
}, _callee);
|
|
2001
|
+
}));
|
|
2002
|
+
|
|
2003
|
+
return function (_x12) {
|
|
2004
|
+
return _ref.apply(this, arguments);
|
|
2005
|
+
};
|
|
2006
|
+
}());
|
|
2007
|
+
return _context2.abrupt("return", Promise.all([writeSourceFilePromise, writeSourceMapFilePromise]));
|
|
2008
|
+
|
|
2009
|
+
case 18:
|
|
2010
|
+
case "end":
|
|
2011
|
+
return _context2.stop();
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
}, _callee2, null, [[0, 6]]);
|
|
2015
|
+
}));
|
|
2016
|
+
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
function determineDebugIdFromBundleSource(code) {
|
|
2020
|
+
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})/);
|
|
2021
|
+
|
|
2022
|
+
if (match) {
|
|
2023
|
+
return match[1];
|
|
2024
|
+
} else {
|
|
2025
|
+
return undefined;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
/**
|
|
2029
|
+
* Applies a set of heuristics to find the source map for a particular bundle.
|
|
2030
|
+
*
|
|
2031
|
+
* @returns the path to the bundle's source map or `undefined` if none could be found.
|
|
2032
|
+
*/
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
function determineSourceMapPathFromBundle(_x5, _x6, _x7) {
|
|
2036
|
+
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
2037
|
+
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Reads a source map, injects debug ID fields, and writes the source map to the target path.
|
|
2040
|
+
*/
|
|
2041
|
+
|
|
2042
|
+
|
|
2043
|
+
function _determineSourceMapPathFromBundle() {
|
|
2044
|
+
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(bundlePath, bundleSource, logger) {
|
|
2045
|
+
var sourceMappingUrlMatch, sourceMappingUrl, adjacentSourceMapFilePath;
|
|
2046
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2047
|
+
while (1) {
|
|
2048
|
+
switch (_context3.prev = _context3.next) {
|
|
2049
|
+
case 0:
|
|
2050
|
+
// 1. try to find source map at `sourceMappingURL` location
|
|
2051
|
+
sourceMappingUrlMatch = bundleSource.match(/^\/\/# sourceMappingURL=(.*)$/);
|
|
2052
|
+
|
|
2053
|
+
if (!sourceMappingUrlMatch) {
|
|
2054
|
+
_context3.next = 8;
|
|
2055
|
+
break;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
sourceMappingUrl = path__namespace.normalize(sourceMappingUrlMatch[1]);
|
|
2059
|
+
|
|
2060
|
+
if (!path__namespace.isAbsolute(sourceMappingUrl)) {
|
|
2061
|
+
_context3.next = 7;
|
|
2062
|
+
break;
|
|
2063
|
+
}
|
|
2064
|
+
|
|
2065
|
+
return _context3.abrupt("return", sourceMappingUrl);
|
|
2066
|
+
|
|
2067
|
+
case 7:
|
|
2068
|
+
return _context3.abrupt("return", path__namespace.join(path__namespace.dirname(bundlePath), sourceMappingUrl));
|
|
2069
|
+
|
|
2070
|
+
case 8:
|
|
2071
|
+
_context3.prev = 8;
|
|
2072
|
+
adjacentSourceMapFilePath = bundlePath + ".map";
|
|
2073
|
+
_context3.next = 12;
|
|
2074
|
+
return util__namespace.promisify(fs__namespace.access)(adjacentSourceMapFilePath);
|
|
2075
|
+
|
|
2076
|
+
case 12:
|
|
2077
|
+
return _context3.abrupt("return", adjacentSourceMapFilePath);
|
|
2078
|
+
|
|
2079
|
+
case 15:
|
|
2080
|
+
_context3.prev = 15;
|
|
2081
|
+
_context3.t0 = _context3["catch"](8);
|
|
2082
|
+
|
|
2083
|
+
case 17:
|
|
2084
|
+
logger.warn("Could not determine source map path for bundle: ".concat(bundlePath));
|
|
2085
|
+
return _context3.abrupt("return", undefined);
|
|
2086
|
+
|
|
2087
|
+
case 19:
|
|
2088
|
+
case "end":
|
|
2089
|
+
return _context3.stop();
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
}, _callee3, null, [[8, 15]]);
|
|
2093
|
+
}));
|
|
2094
|
+
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
function prepareSourceMapForDebugIdUpload(_x8, _x9, _x10, _x11) {
|
|
2098
|
+
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
function _prepareSourceMapForDebugIdUpload() {
|
|
2102
|
+
_prepareSourceMapForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sourceMapPath, targetPath, debugId, logger) {
|
|
2103
|
+
var sourceMapFileContent, map;
|
|
2104
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2105
|
+
while (1) {
|
|
2106
|
+
switch (_context4.prev = _context4.next) {
|
|
2107
|
+
case 0:
|
|
2108
|
+
_context4.prev = 0;
|
|
2109
|
+
_context4.next = 3;
|
|
2110
|
+
return util__namespace.promisify(fs__namespace.readFile)(sourceMapPath, {
|
|
2111
|
+
encoding: "utf8"
|
|
2112
|
+
});
|
|
2113
|
+
|
|
2114
|
+
case 3:
|
|
2115
|
+
sourceMapFileContent = _context4.sent;
|
|
2116
|
+
map = JSON.parse(sourceMapFileContent); // For now we write both fields until we know what will become the standard - if ever.
|
|
2117
|
+
|
|
2118
|
+
map["debug_id"] = debugId;
|
|
2119
|
+
map["debugId"] = debugId;
|
|
2120
|
+
_context4.next = 9;
|
|
2121
|
+
return util__namespace.promisify(fs__namespace.writeFile)(targetPath, JSON.stringify(map), {
|
|
2122
|
+
encoding: "utf8"
|
|
2123
|
+
});
|
|
2124
|
+
|
|
2125
|
+
case 9:
|
|
2126
|
+
_context4.next = 14;
|
|
2127
|
+
break;
|
|
2128
|
+
|
|
2129
|
+
case 11:
|
|
2130
|
+
_context4.prev = 11;
|
|
2131
|
+
_context4.t0 = _context4["catch"](0);
|
|
2132
|
+
logger.warn("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath));
|
|
2133
|
+
|
|
2134
|
+
case 14:
|
|
2135
|
+
case "end":
|
|
2136
|
+
return _context4.stop();
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
}, _callee4, null, [[0, 11]]);
|
|
2140
|
+
}));
|
|
2141
|
+
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
2142
|
+
}
|
|
2143
|
+
|
|
1653
2144
|
var ALLOWED_TRANSFORMATION_FILE_ENDINGS = [".js", ".ts", ".jsx", ".tsx", ".mjs"];
|
|
2145
|
+
|
|
2146
|
+
var releaseInjectionFilePath = require.resolve("@sentry/bundler-plugin-core/sentry-release-injection-file");
|
|
1654
2147
|
/**
|
|
1655
2148
|
* The sentry bundler plugin concerns itself with two things:
|
|
1656
2149
|
* - Release injection
|
|
1657
2150
|
* - Sourcemaps upload
|
|
1658
2151
|
*
|
|
1659
2152
|
* Release injection:
|
|
1660
|
-
* Per default the sentry bundler plugin will inject a global `SENTRY_RELEASE` into
|
|
1661
|
-
*
|
|
1662
|
-
*
|
|
1663
|
-
*
|
|
1664
|
-
* they can use the `releaseInjectionTargets` option.
|
|
2153
|
+
* Per default the sentry bundler plugin will inject a global `SENTRY_RELEASE` into each JavaScript/TypeScript module
|
|
2154
|
+
* that is part of the bundle. On a technical level this is done by appending an import (`import "sentry-release-injector;"`)
|
|
2155
|
+
* to all entrypoint files of the user code (see `transformInclude` and `transform` hooks). This import is then resolved
|
|
2156
|
+
* by the sentry plugin to a virtual module that sets the global variable (see `resolveId` and `load` hooks).
|
|
2157
|
+
* If a user wants to inject the release into a particular set of modules they can use the `releaseInjectionTargets` option.
|
|
1665
2158
|
*
|
|
1666
2159
|
* Source maps upload:
|
|
1667
2160
|
*
|
|
@@ -1679,6 +2172,7 @@ var ALLOWED_TRANSFORMATION_FILE_ENDINGS = [".js", ".ts", ".jsx", ".tsx", ".mjs"]
|
|
|
1679
2172
|
* This release creation pipeline relies on Sentry CLI to execute the different steps.
|
|
1680
2173
|
*/
|
|
1681
2174
|
|
|
2175
|
+
|
|
1682
2176
|
var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext) {
|
|
1683
2177
|
var internalOptions = normalizeUserOptions(options);
|
|
1684
2178
|
var allowedToSendTelemetryPromise = shouldSendTelemetry(internalOptions);
|
|
@@ -1714,7 +2208,6 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
1714
2208
|
});
|
|
1715
2209
|
var transaction;
|
|
1716
2210
|
var releaseInjectionSpan;
|
|
1717
|
-
var absolueEntrypointPaths = new Set();
|
|
1718
2211
|
return {
|
|
1719
2212
|
name: "sentry-plugin",
|
|
1720
2213
|
enforce: "pre",
|
|
@@ -1800,11 +2293,6 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
1800
2293
|
importer: importer,
|
|
1801
2294
|
isEntry: isEntry
|
|
1802
2295
|
});
|
|
1803
|
-
|
|
1804
|
-
if (isEntry) {
|
|
1805
|
-
absolueEntrypointPaths.add(path__default["default"].resolve(path__default["default"].normalize(id)));
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
2296
|
return undefined;
|
|
1809
2297
|
},
|
|
1810
2298
|
|
|
@@ -1824,6 +2312,10 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
1824
2312
|
|
|
1825
2313
|
var normalizedId = path__default["default"].normalize(id);
|
|
1826
2314
|
|
|
2315
|
+
if (id.includes("sentry-release-injection-file")) {
|
|
2316
|
+
return true;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
1827
2319
|
if (internalOptions.releaseInjectionTargets) {
|
|
1828
2320
|
// If there's an `releaseInjectionTargets` option transform (ie. inject the release varible) when the file path matches the option.
|
|
1829
2321
|
if (typeof internalOptions.releaseInjectionTargets === "function") {
|
|
@@ -1838,14 +2330,12 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
1838
2330
|
return normalizedId === normalizedEntry;
|
|
1839
2331
|
}
|
|
1840
2332
|
});
|
|
1841
|
-
} else
|
|
2333
|
+
} else {
|
|
1842
2334
|
var pathIsOrdinary = !normalizedId.includes("?") && !normalizedId.includes("#");
|
|
1843
2335
|
var pathHasAllowedFileEnding = ALLOWED_TRANSFORMATION_FILE_ENDINGS.some(function (allowedFileEnding) {
|
|
1844
2336
|
return normalizedId.endsWith(allowedFileEnding);
|
|
1845
2337
|
});
|
|
1846
2338
|
return pathIsOrdinary && pathHasAllowedFileEnding;
|
|
1847
|
-
} else {
|
|
1848
|
-
return false;
|
|
1849
2339
|
}
|
|
1850
2340
|
},
|
|
1851
2341
|
|
|
@@ -1866,43 +2356,70 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
1866
2356
|
case 0:
|
|
1867
2357
|
logger.debug('Called "transform":', {
|
|
1868
2358
|
id: id
|
|
1869
|
-
});
|
|
2359
|
+
});
|
|
1870
2360
|
|
|
2361
|
+
if (internalOptions.injectRelease) {
|
|
2362
|
+
_context2.next = 3;
|
|
2363
|
+
break;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
return _context2.abrupt("return");
|
|
2367
|
+
|
|
2368
|
+
case 3:
|
|
2369
|
+
// The MagicString library allows us to generate sourcemaps for the changes we make to the user code.
|
|
1871
2370
|
ms = new MagicString__default["default"](code);
|
|
2371
|
+
|
|
2372
|
+
if (!code.includes("_sentry_release_injection_file")) {
|
|
2373
|
+
_context2.next = 19;
|
|
2374
|
+
break;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
1872
2377
|
_context2.t0 = ms;
|
|
1873
2378
|
_context2.t1 = generateGlobalInjectorCode;
|
|
1874
|
-
_context2.next =
|
|
2379
|
+
_context2.next = 9;
|
|
1875
2380
|
return releaseNamePromise;
|
|
1876
2381
|
|
|
1877
|
-
case
|
|
2382
|
+
case 9:
|
|
1878
2383
|
_context2.t2 = _context2.sent;
|
|
1879
2384
|
_context2.t3 = internalOptions.injectReleasesMap;
|
|
1880
|
-
_context2.t4 = internalOptions.
|
|
1881
|
-
_context2.t5 = internalOptions.
|
|
1882
|
-
_context2.t6 =
|
|
2385
|
+
_context2.t4 = internalOptions._experiments.injectBuildInformation || false;
|
|
2386
|
+
_context2.t5 = internalOptions.org;
|
|
2387
|
+
_context2.t6 = internalOptions.project;
|
|
2388
|
+
_context2.t7 = {
|
|
1883
2389
|
release: _context2.t2,
|
|
1884
2390
|
injectReleasesMap: _context2.t3,
|
|
1885
|
-
|
|
1886
|
-
|
|
2391
|
+
injectBuildInformation: _context2.t4,
|
|
2392
|
+
org: _context2.t5,
|
|
2393
|
+
project: _context2.t6
|
|
1887
2394
|
};
|
|
1888
|
-
_context2.
|
|
2395
|
+
_context2.t8 = (0, _context2.t1)(_context2.t7);
|
|
2396
|
+
|
|
2397
|
+
_context2.t0.append.call(_context2.t0, _context2.t8);
|
|
1889
2398
|
|
|
1890
|
-
_context2.
|
|
2399
|
+
_context2.next = 20;
|
|
2400
|
+
break;
|
|
2401
|
+
|
|
2402
|
+
case 19:
|
|
2403
|
+
// Appending instead of prepending has less probability of mucking with user's source maps.
|
|
2404
|
+
// Luckily import statements get hoisted to the top anyways.
|
|
2405
|
+
// The import needs to be an absolute path because Rollup doesn't bundle stuff in `node_modules` by default when bundling CJS (unless the import path is absolute or the node-resolve-plugin is used).
|
|
2406
|
+
ms.append(";\nimport \"".concat(releaseInjectionFilePath.replace(/\\/g, "\\\\"), "\";"));
|
|
1891
2407
|
|
|
2408
|
+
case 20:
|
|
1892
2409
|
if (!(unpluginMetaContext.framework === "esbuild")) {
|
|
1893
|
-
_context2.next =
|
|
2410
|
+
_context2.next = 24;
|
|
1894
2411
|
break;
|
|
1895
2412
|
}
|
|
1896
2413
|
|
|
1897
2414
|
return _context2.abrupt("return", ms.toString());
|
|
1898
2415
|
|
|
1899
|
-
case
|
|
2416
|
+
case 24:
|
|
1900
2417
|
return _context2.abrupt("return", {
|
|
1901
2418
|
code: ms.toString(),
|
|
1902
2419
|
map: ms.generateMap()
|
|
1903
2420
|
});
|
|
1904
2421
|
|
|
1905
|
-
case
|
|
2422
|
+
case 25:
|
|
1906
2423
|
case "end":
|
|
1907
2424
|
return _context2.stop();
|
|
1908
2425
|
}
|
|
@@ -1916,14 +2433,14 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
1916
2433
|
* Sentry.io, uploading sourcemaps, associating commits and deploys and finalizing the release)
|
|
1917
2434
|
*/
|
|
1918
2435
|
writeBundle: function writeBundle() {
|
|
1919
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2436
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
1920
2437
|
var _releaseInjectionSpan;
|
|
1921
2438
|
|
|
1922
|
-
var releasePipelineSpan, ctx, releaseName, _transaction, _transaction2, _transaction3;
|
|
2439
|
+
var releasePipelineSpan, ctx, releaseName, tmpUploadFolder, _transaction, debugIdChunkFilePaths, sourceFileUploadFolderPromise, _transaction2, _transaction3;
|
|
1923
2440
|
|
|
1924
|
-
return _regeneratorRuntime().wrap(function
|
|
2441
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1925
2442
|
while (1) {
|
|
1926
|
-
switch (
|
|
2443
|
+
switch (_context4.prev = _context4.next) {
|
|
1927
2444
|
case 0:
|
|
1928
2445
|
logger.debug('Called "writeBundle"');
|
|
1929
2446
|
(_releaseInjectionSpan = releaseInjectionSpan) === null || _releaseInjectionSpan === void 0 ? void 0 : _releaseInjectionSpan.finish();
|
|
@@ -1943,75 +2460,172 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
1943
2460
|
logger: logger,
|
|
1944
2461
|
cli: cli
|
|
1945
2462
|
};
|
|
1946
|
-
|
|
2463
|
+
_context4.next = 7;
|
|
1947
2464
|
return releaseNamePromise;
|
|
1948
2465
|
|
|
1949
2466
|
case 7:
|
|
1950
|
-
releaseName =
|
|
1951
|
-
|
|
1952
|
-
|
|
2467
|
+
releaseName = _context4.sent;
|
|
2468
|
+
_context4.prev = 8;
|
|
2469
|
+
|
|
2470
|
+
if (!internalOptions._experiments.debugIdUpload) {
|
|
2471
|
+
_context4.next = 21;
|
|
2472
|
+
break;
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
_context4.next = 12;
|
|
2476
|
+
return glob.glob(internalOptions._experiments.debugIdUpload.include, {
|
|
2477
|
+
absolute: true,
|
|
2478
|
+
nodir: true,
|
|
2479
|
+
ignore: internalOptions._experiments.debugIdUpload.ignore
|
|
2480
|
+
});
|
|
2481
|
+
|
|
2482
|
+
case 12:
|
|
2483
|
+
debugIdChunkFilePaths = _context4.sent.filter(function (p) {
|
|
2484
|
+
return p.endsWith(".js") || p.endsWith(".mjs");
|
|
2485
|
+
});
|
|
2486
|
+
sourceFileUploadFolderPromise = util__default["default"].promisify(fs__default["default"].mkdtemp)(path__default["default"].join(os__default["default"].tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
2487
|
+
_context4.next = 16;
|
|
2488
|
+
return Promise.all(debugIdChunkFilePaths.map( /*#__PURE__*/function () {
|
|
2489
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(chunkFilePath, chunkIndex) {
|
|
2490
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2491
|
+
while (1) {
|
|
2492
|
+
switch (_context3.prev = _context3.next) {
|
|
2493
|
+
case 0:
|
|
2494
|
+
_context3.t0 = prepareBundleForDebugIdUpload;
|
|
2495
|
+
_context3.t1 = chunkFilePath;
|
|
2496
|
+
_context3.next = 4;
|
|
2497
|
+
return sourceFileUploadFolderPromise;
|
|
2498
|
+
|
|
2499
|
+
case 4:
|
|
2500
|
+
_context3.t2 = _context3.sent;
|
|
2501
|
+
_context3.t3 = String(chunkIndex);
|
|
2502
|
+
_context3.t4 = logger;
|
|
2503
|
+
_context3.next = 9;
|
|
2504
|
+
return (0, _context3.t0)(_context3.t1, _context3.t2, _context3.t3, _context3.t4);
|
|
2505
|
+
|
|
2506
|
+
case 9:
|
|
2507
|
+
case "end":
|
|
2508
|
+
return _context3.stop();
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
}, _callee3);
|
|
2512
|
+
}));
|
|
2513
|
+
|
|
2514
|
+
return function (_x, _x2) {
|
|
2515
|
+
return _ref2.apply(this, arguments);
|
|
2516
|
+
};
|
|
2517
|
+
}()));
|
|
2518
|
+
|
|
2519
|
+
case 16:
|
|
2520
|
+
_context4.next = 18;
|
|
2521
|
+
return sourceFileUploadFolderPromise;
|
|
2522
|
+
|
|
2523
|
+
case 18:
|
|
2524
|
+
tmpUploadFolder = _context4.sent;
|
|
2525
|
+
_context4.next = 21;
|
|
2526
|
+
return uploadDebugIdSourcemaps(internalOptions, ctx, tmpUploadFolder, releaseName);
|
|
2527
|
+
|
|
2528
|
+
case 21:
|
|
2529
|
+
_context4.next = 23;
|
|
1953
2530
|
return createNewRelease(internalOptions, ctx, releaseName);
|
|
1954
2531
|
|
|
1955
|
-
case
|
|
1956
|
-
|
|
2532
|
+
case 23:
|
|
2533
|
+
_context4.next = 25;
|
|
1957
2534
|
return cleanArtifacts(internalOptions, ctx, releaseName);
|
|
1958
2535
|
|
|
1959
|
-
case
|
|
1960
|
-
|
|
2536
|
+
case 25:
|
|
2537
|
+
_context4.next = 27;
|
|
1961
2538
|
return uploadSourceMaps(internalOptions, ctx, releaseName);
|
|
1962
2539
|
|
|
1963
|
-
case
|
|
1964
|
-
|
|
2540
|
+
case 27:
|
|
2541
|
+
_context4.next = 29;
|
|
1965
2542
|
return setCommits(internalOptions, ctx, releaseName);
|
|
1966
2543
|
|
|
1967
|
-
case
|
|
1968
|
-
|
|
2544
|
+
case 29:
|
|
2545
|
+
_context4.next = 31;
|
|
1969
2546
|
return finalizeRelease(internalOptions, ctx, releaseName);
|
|
1970
2547
|
|
|
1971
|
-
case
|
|
1972
|
-
|
|
2548
|
+
case 31:
|
|
2549
|
+
_context4.next = 33;
|
|
1973
2550
|
return addDeploy(internalOptions, ctx, releaseName);
|
|
1974
2551
|
|
|
1975
|
-
case
|
|
2552
|
+
case 33:
|
|
1976
2553
|
(_transaction = transaction) === null || _transaction === void 0 ? void 0 : _transaction.setStatus("ok");
|
|
1977
|
-
|
|
2554
|
+
_context4.next = 41;
|
|
1978
2555
|
break;
|
|
1979
2556
|
|
|
1980
|
-
case
|
|
1981
|
-
|
|
1982
|
-
|
|
2557
|
+
case 36:
|
|
2558
|
+
_context4.prev = 36;
|
|
2559
|
+
_context4.t0 = _context4["catch"](8);
|
|
1983
2560
|
(_transaction2 = transaction) === null || _transaction2 === void 0 ? void 0 : _transaction2.setStatus("cancelled");
|
|
1984
2561
|
sentryHub.addBreadcrumb({
|
|
1985
2562
|
level: "error",
|
|
1986
2563
|
message: "Error during writeBundle"
|
|
1987
2564
|
});
|
|
1988
|
-
handleError(
|
|
2565
|
+
handleError(_context4.t0, logger, internalOptions.errorHandler);
|
|
2566
|
+
|
|
2567
|
+
case 41:
|
|
2568
|
+
_context4.prev = 41;
|
|
2569
|
+
|
|
2570
|
+
if (tmpUploadFolder) {
|
|
2571
|
+
fs__default["default"].rm(tmpUploadFolder, {
|
|
2572
|
+
recursive: true,
|
|
2573
|
+
force: true
|
|
2574
|
+
}, function () {// We don't care if this errors
|
|
2575
|
+
});
|
|
2576
|
+
}
|
|
1989
2577
|
|
|
1990
|
-
case 29:
|
|
1991
|
-
_context3.prev = 29;
|
|
1992
2578
|
releasePipelineSpan === null || releasePipelineSpan === void 0 ? void 0 : releasePipelineSpan.finish();
|
|
1993
2579
|
(_transaction3 = transaction) === null || _transaction3 === void 0 ? void 0 : _transaction3.finish();
|
|
1994
|
-
|
|
2580
|
+
_context4.next = 47;
|
|
1995
2581
|
return sentryClient.flush().then(null, function () {
|
|
1996
2582
|
logger.warn("Sending of telemetry failed");
|
|
1997
2583
|
});
|
|
1998
2584
|
|
|
1999
|
-
case
|
|
2000
|
-
return
|
|
2585
|
+
case 47:
|
|
2586
|
+
return _context4.finish(41);
|
|
2001
2587
|
|
|
2002
|
-
case
|
|
2588
|
+
case 48:
|
|
2003
2589
|
sentryHub.addBreadcrumb({
|
|
2004
2590
|
category: "writeBundle:finish",
|
|
2005
2591
|
level: "info"
|
|
2006
2592
|
});
|
|
2007
2593
|
|
|
2008
|
-
case
|
|
2594
|
+
case 49:
|
|
2009
2595
|
case "end":
|
|
2010
|
-
return
|
|
2596
|
+
return _context4.stop();
|
|
2011
2597
|
}
|
|
2012
2598
|
}
|
|
2013
|
-
},
|
|
2599
|
+
}, _callee4, null, [[8, 36, 41, 48]]);
|
|
2014
2600
|
}))();
|
|
2601
|
+
},
|
|
2602
|
+
rollup: {
|
|
2603
|
+
renderChunk: function renderChunk(code, chunk) {
|
|
2604
|
+
var _options$_experiments;
|
|
2605
|
+
|
|
2606
|
+
if ((_options$_experiments = options._experiments) !== null && _options$_experiments !== void 0 && _options$_experiments.debugIdUpload && [".js", ".mjs"].some(function (ending) {
|
|
2607
|
+
return chunk.fileName.endsWith(ending);
|
|
2608
|
+
}) // chunks could be any file (html, md, ...)
|
|
2609
|
+
) {
|
|
2610
|
+
return injectDebugIdSnippetIntoChunk(code);
|
|
2611
|
+
} else {
|
|
2612
|
+
return null; // returning null means not modifying the chunk at all
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
},
|
|
2616
|
+
vite: {
|
|
2617
|
+
renderChunk: function renderChunk(code, chunk) {
|
|
2618
|
+
var _options$_experiments2;
|
|
2619
|
+
|
|
2620
|
+
if ((_options$_experiments2 = options._experiments) !== null && _options$_experiments2 !== void 0 && _options$_experiments2.debugIdUpload && [".js", ".mjs"].some(function (ending) {
|
|
2621
|
+
return chunk.fileName.endsWith(ending);
|
|
2622
|
+
}) // chunks could be any file (html, md, ...)
|
|
2623
|
+
) {
|
|
2624
|
+
return injectDebugIdSnippetIntoChunk(code);
|
|
2625
|
+
} else {
|
|
2626
|
+
return null; // returning null means not modifying the chunk at all
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2015
2629
|
}
|
|
2016
2630
|
};
|
|
2017
2631
|
});
|
|
@@ -2034,16 +2648,17 @@ function handleError(unknownError, logger, errorHandler) {
|
|
|
2034
2648
|
}
|
|
2035
2649
|
}
|
|
2036
2650
|
/**
|
|
2037
|
-
* Generates code for the
|
|
2038
|
-
*
|
|
2651
|
+
* Generates code for the global injector which is responsible for setting the global
|
|
2652
|
+
* `SENTRY_RELEASE` & `SENTRY_BUILD_INFO` variables.
|
|
2039
2653
|
*/
|
|
2040
2654
|
|
|
2041
2655
|
|
|
2042
|
-
function generateGlobalInjectorCode(
|
|
2043
|
-
var release =
|
|
2044
|
-
injectReleasesMap =
|
|
2045
|
-
|
|
2046
|
-
|
|
2656
|
+
function generateGlobalInjectorCode(_ref3) {
|
|
2657
|
+
var release = _ref3.release,
|
|
2658
|
+
injectReleasesMap = _ref3.injectReleasesMap,
|
|
2659
|
+
injectBuildInformation = _ref3.injectBuildInformation,
|
|
2660
|
+
org = _ref3.org,
|
|
2661
|
+
project = _ref3.project;
|
|
2047
2662
|
// The code below is mostly ternary operators because it saves bundle size.
|
|
2048
2663
|
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
2049
2664
|
var code = "\n var _global =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\n typeof self !== 'undefined' ?\n self :\n {};\n\n _global.SENTRY_RELEASE={id:\"".concat(release, "\"};");
|
|
@@ -2053,9 +2668,39 @@ function generateGlobalInjectorCode(_ref2) {
|
|
|
2053
2668
|
code += "\n _global.SENTRY_RELEASES=_global.SENTRY_RELEASES || {};\n _global.SENTRY_RELEASES[\"".concat(key, "\"]={id:\"").concat(release, "\"};");
|
|
2054
2669
|
}
|
|
2055
2670
|
|
|
2671
|
+
if (injectBuildInformation) {
|
|
2672
|
+
var buildInfo = getBuildInformation();
|
|
2673
|
+
code += "\n _global.SENTRY_BUILD_INFO=".concat(JSON.stringify(buildInfo), ";");
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2056
2676
|
return code;
|
|
2057
|
-
}
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
function getBuildInformation() {
|
|
2680
|
+
var packageJson = getPackageJson();
|
|
2681
|
+
|
|
2682
|
+
var _ref4 = packageJson ? getDependencies(packageJson) : {
|
|
2683
|
+
deps: [],
|
|
2684
|
+
depsVersions: {}
|
|
2685
|
+
},
|
|
2686
|
+
deps = _ref4.deps,
|
|
2687
|
+
depsVersions = _ref4.depsVersions;
|
|
2688
|
+
|
|
2689
|
+
return {
|
|
2690
|
+
deps: deps,
|
|
2691
|
+
depsVersions: depsVersions,
|
|
2692
|
+
nodeVersion: parseMajorVersion(process.version)
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
/**
|
|
2696
|
+
* Determines whether the Sentry CLI binary is in its expected location.
|
|
2697
|
+
* This function is useful since `@sentry/cli` installs the binary via a post-install
|
|
2698
|
+
* script and post-install scripts may not always run. E.g. with `npm i --ignore-scripts`.
|
|
2699
|
+
*/
|
|
2058
2700
|
|
|
2701
|
+
function sentryCliBinaryExists() {
|
|
2702
|
+
return fs__default["default"].existsSync(SentryCli__default["default"].getPath());
|
|
2703
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2059
2704
|
|
|
2060
2705
|
var sentryVitePlugin = unplugin.vite; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2061
2706
|
|
|
@@ -2065,6 +2710,8 @@ var sentryWebpackPlugin = unplugin.webpack; // eslint-disable-next-line @typescr
|
|
|
2065
2710
|
|
|
2066
2711
|
var sentryEsbuildPlugin = unplugin.esbuild;
|
|
2067
2712
|
|
|
2713
|
+
exports.getBuildInformation = getBuildInformation;
|
|
2714
|
+
exports.sentryCliBinaryExists = sentryCliBinaryExists;
|
|
2068
2715
|
exports.sentryEsbuildPlugin = sentryEsbuildPlugin;
|
|
2069
2716
|
exports.sentryRollupPlugin = sentryRollupPlugin;
|
|
2070
2717
|
exports.sentryVitePlugin = sentryVitePlugin;
|