@sentry/bundler-plugin-core 2.10.2 → 2.11.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 +284 -171
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +282 -171
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/debug-id-upload.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/options-mapping.d.ts +3 -0
- package/dist/types/options-mapping.d.ts.map +1 -1
- package/dist/types/plugins/release-management.d.ts.map +1 -1
- package/dist/types/plugins/telemetry.d.ts.map +1 -1
- package/dist/types/sentry/telemetry.d.ts +4 -0
- package/dist/types/sentry/telemetry.d.ts.map +1 -1
- package/dist/types/types.d.ts +13 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import SentryCli from '@sentry/cli';
|
|
2
|
+
import { transformAsync } from '@babel/core';
|
|
3
|
+
import { componentNameAnnotatePlugin } from '@sentry/component-annotate-plugin';
|
|
2
4
|
import * as fs from 'fs';
|
|
3
5
|
import fs__default from 'fs';
|
|
4
6
|
import * as path from 'path';
|
|
@@ -12,7 +14,7 @@ import childProcess from 'child_process';
|
|
|
12
14
|
import { glob } from 'glob';
|
|
13
15
|
import * as util from 'util';
|
|
14
16
|
import { promisify } from 'util';
|
|
15
|
-
import { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/utils';
|
|
17
|
+
import pkg, { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/utils';
|
|
16
18
|
import { NodeClient, defaultStackParser, makeNodeTransport, Hub } from '@sentry/node';
|
|
17
19
|
import * as dotenv from 'dotenv';
|
|
18
20
|
|
|
@@ -660,6 +662,7 @@ function normalizeUserOptions(userOptions) {
|
|
|
660
662
|
cleanArtifacts: (_userOptions$release$6 = (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.cleanArtifacts) !== null && _userOptions$release$6 !== void 0 ? _userOptions$release$6 : false
|
|
661
663
|
}),
|
|
662
664
|
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
|
|
665
|
+
reactComponentAnnotation: userOptions.reactComponentAnnotation,
|
|
663
666
|
_experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
|
|
664
667
|
};
|
|
665
668
|
return options;
|
|
@@ -696,6 +699,200 @@ function validateOptions(options, logger) {
|
|
|
696
699
|
return true;
|
|
697
700
|
}
|
|
698
701
|
|
|
702
|
+
var SENTRY_SAAS_HOSTNAME = "sentry.io";
|
|
703
|
+
function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
704
|
+
var client = new NodeClient({
|
|
705
|
+
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
706
|
+
tracesSampleRate: 1,
|
|
707
|
+
sampleRate: 1,
|
|
708
|
+
release: "2.11.0",
|
|
709
|
+
integrations: [],
|
|
710
|
+
tracePropagationTargets: ["sentry.io/api"],
|
|
711
|
+
stackParser: defaultStackParser,
|
|
712
|
+
beforeSend: function beforeSend(event) {
|
|
713
|
+
var _event$exception, _event$exception$valu;
|
|
714
|
+
(_event$exception = event.exception) === null || _event$exception === void 0 ? void 0 : (_event$exception$valu = _event$exception.values) === null || _event$exception$valu === void 0 ? void 0 : _event$exception$valu.forEach(function (exception) {
|
|
715
|
+
delete exception.stacktrace;
|
|
716
|
+
});
|
|
717
|
+
delete event.server_name; // Server name might contain PII
|
|
718
|
+
return event;
|
|
719
|
+
},
|
|
720
|
+
beforeSendTransaction: function beforeSendTransaction(event) {
|
|
721
|
+
delete event.server_name; // Server name might contain PII
|
|
722
|
+
return event;
|
|
723
|
+
},
|
|
724
|
+
// We create a transport that stalls sending events until we know that we're allowed to (i.e. when Sentry CLI told
|
|
725
|
+
// us that the upload URL is the Sentry SaaS URL)
|
|
726
|
+
transport: function transport(nodeTransportOptions) {
|
|
727
|
+
var nodeTransport = makeNodeTransport(nodeTransportOptions);
|
|
728
|
+
return {
|
|
729
|
+
flush: function flush(timeout) {
|
|
730
|
+
return nodeTransport.flush(timeout);
|
|
731
|
+
},
|
|
732
|
+
send: function () {
|
|
733
|
+
var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
|
734
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
735
|
+
while (1) switch (_context.prev = _context.next) {
|
|
736
|
+
case 0:
|
|
737
|
+
_context.next = 2;
|
|
738
|
+
return shouldSendTelemetry;
|
|
739
|
+
case 2:
|
|
740
|
+
if (!_context.sent) {
|
|
741
|
+
_context.next = 6;
|
|
742
|
+
break;
|
|
743
|
+
}
|
|
744
|
+
return _context.abrupt("return", nodeTransport.send(request));
|
|
745
|
+
case 6:
|
|
746
|
+
return _context.abrupt("return", undefined);
|
|
747
|
+
case 7:
|
|
748
|
+
case "end":
|
|
749
|
+
return _context.stop();
|
|
750
|
+
}
|
|
751
|
+
}, _callee);
|
|
752
|
+
}));
|
|
753
|
+
function send(_x) {
|
|
754
|
+
return _send.apply(this, arguments);
|
|
755
|
+
}
|
|
756
|
+
return send;
|
|
757
|
+
}()
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
});
|
|
761
|
+
var hub = new Hub(client);
|
|
762
|
+
setTelemetryDataOnHub(options, hub, bundler);
|
|
763
|
+
return {
|
|
764
|
+
sentryHub: hub,
|
|
765
|
+
sentryClient: client
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
function setTelemetryDataOnHub(options, hub, bundler) {
|
|
769
|
+
var org = options.org,
|
|
770
|
+
project = options.project,
|
|
771
|
+
release = options.release,
|
|
772
|
+
errorHandler = options.errorHandler,
|
|
773
|
+
sourcemaps = options.sourcemaps;
|
|
774
|
+
hub.setTag("upload-legacy-sourcemaps", !!release.uploadLegacySourcemaps);
|
|
775
|
+
if (release.uploadLegacySourcemaps) {
|
|
776
|
+
hub.setTag("uploadLegacySourcemapsEntries", Array.isArray(release.uploadLegacySourcemaps) ? release.uploadLegacySourcemaps.length : 1);
|
|
777
|
+
}
|
|
778
|
+
hub.setTag("module-metadata", !!options._experiments.moduleMetadata);
|
|
779
|
+
hub.setTag("inject-build-information", !!options._experiments.injectBuildInformation);
|
|
780
|
+
|
|
781
|
+
// Optional release pipeline steps
|
|
782
|
+
hub.setTag("clean-artifacts", release.cleanArtifacts);
|
|
783
|
+
if (release.setCommits) {
|
|
784
|
+
hub.setTag("set-commits", release.setCommits.auto === true ? "auto" : "manual");
|
|
785
|
+
} else {
|
|
786
|
+
hub.setTag("set-commits", "undefined");
|
|
787
|
+
}
|
|
788
|
+
hub.setTag("finalize-release", release.finalize);
|
|
789
|
+
hub.setTag("deploy-options", !!release.deploy);
|
|
790
|
+
|
|
791
|
+
// Miscelaneous options
|
|
792
|
+
hub.setTag("custom-error-handler", !!errorHandler);
|
|
793
|
+
hub.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
|
|
794
|
+
hub.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.deleteFilesAfterUpload) || !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
|
|
795
|
+
hub.setTag("node", process.version);
|
|
796
|
+
hub.setTag("platform", process.platform);
|
|
797
|
+
hub.setTags({
|
|
798
|
+
organization: org,
|
|
799
|
+
project: project,
|
|
800
|
+
bundler: bundler
|
|
801
|
+
});
|
|
802
|
+
hub.setUser({
|
|
803
|
+
id: org
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
function allowedToSendTelemetry(_x2) {
|
|
807
|
+
return _allowedToSendTelemetry.apply(this, arguments);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* Flushing the SDK client can fail. We never want to crash the plugin because of telemetry.
|
|
812
|
+
*/
|
|
813
|
+
function _allowedToSendTelemetry() {
|
|
814
|
+
_allowedToSendTelemetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
815
|
+
var _cliInfo$split$, _cliInfo$split$$repla;
|
|
816
|
+
var silent, org, project, authToken, url, headers, telemetry, release, cli, cliInfo, cliInfoUrl;
|
|
817
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
818
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
819
|
+
case 0:
|
|
820
|
+
silent = options.silent, org = options.org, project = options.project, authToken = options.authToken, url = options.url, headers = options.headers, telemetry = options.telemetry, release = options.release; // `options.telemetry` defaults to true
|
|
821
|
+
if (!(telemetry === false)) {
|
|
822
|
+
_context2.next = 3;
|
|
823
|
+
break;
|
|
824
|
+
}
|
|
825
|
+
return _context2.abrupt("return", false);
|
|
826
|
+
case 3:
|
|
827
|
+
if (!(url === SENTRY_SAAS_URL)) {
|
|
828
|
+
_context2.next = 5;
|
|
829
|
+
break;
|
|
830
|
+
}
|
|
831
|
+
return _context2.abrupt("return", true);
|
|
832
|
+
case 5:
|
|
833
|
+
cli = new SentryCli(null, {
|
|
834
|
+
url: url,
|
|
835
|
+
authToken: authToken,
|
|
836
|
+
org: org,
|
|
837
|
+
project: project,
|
|
838
|
+
vcsRemote: release.vcsRemote,
|
|
839
|
+
silent: silent,
|
|
840
|
+
headers: headers
|
|
841
|
+
});
|
|
842
|
+
_context2.prev = 6;
|
|
843
|
+
_context2.next = 9;
|
|
844
|
+
return cli.execute(["info"], false);
|
|
845
|
+
case 9:
|
|
846
|
+
cliInfo = _context2.sent;
|
|
847
|
+
_context2.next = 15;
|
|
848
|
+
break;
|
|
849
|
+
case 12:
|
|
850
|
+
_context2.prev = 12;
|
|
851
|
+
_context2.t0 = _context2["catch"](6);
|
|
852
|
+
return _context2.abrupt("return", false);
|
|
853
|
+
case 15:
|
|
854
|
+
cliInfoUrl = (_cliInfo$split$ = cliInfo.split(/(\r\n|\n|\r)/)[0]) === null || _cliInfo$split$ === void 0 ? void 0 : (_cliInfo$split$$repla = _cliInfo$split$.replace(/^Sentry Server: /, "")) === null || _cliInfo$split$$repla === void 0 ? void 0 : _cliInfo$split$$repla.trim();
|
|
855
|
+
if (!(cliInfoUrl === undefined)) {
|
|
856
|
+
_context2.next = 18;
|
|
857
|
+
break;
|
|
858
|
+
}
|
|
859
|
+
return _context2.abrupt("return", false);
|
|
860
|
+
case 18:
|
|
861
|
+
return _context2.abrupt("return", new URL(cliInfoUrl).hostname === SENTRY_SAAS_HOSTNAME);
|
|
862
|
+
case 19:
|
|
863
|
+
case "end":
|
|
864
|
+
return _context2.stop();
|
|
865
|
+
}
|
|
866
|
+
}, _callee2, null, [[6, 12]]);
|
|
867
|
+
}));
|
|
868
|
+
return _allowedToSendTelemetry.apply(this, arguments);
|
|
869
|
+
}
|
|
870
|
+
function safeFlushTelemetry(_x3) {
|
|
871
|
+
return _safeFlushTelemetry.apply(this, arguments);
|
|
872
|
+
}
|
|
873
|
+
function _safeFlushTelemetry() {
|
|
874
|
+
_safeFlushTelemetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sentryClient) {
|
|
875
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
876
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
877
|
+
case 0:
|
|
878
|
+
_context3.prev = 0;
|
|
879
|
+
_context3.next = 3;
|
|
880
|
+
return sentryClient.flush(2000);
|
|
881
|
+
case 3:
|
|
882
|
+
_context3.next = 7;
|
|
883
|
+
break;
|
|
884
|
+
case 5:
|
|
885
|
+
_context3.prev = 5;
|
|
886
|
+
_context3.t0 = _context3["catch"](0);
|
|
887
|
+
case 7:
|
|
888
|
+
case "end":
|
|
889
|
+
return _context3.stop();
|
|
890
|
+
}
|
|
891
|
+
}, _callee3, null, [[0, 5]]);
|
|
892
|
+
}));
|
|
893
|
+
return _safeFlushTelemetry.apply(this, arguments);
|
|
894
|
+
}
|
|
895
|
+
|
|
699
896
|
function createDebugIdUploadFunction(_ref) {
|
|
700
897
|
var assets = _ref.assets,
|
|
701
898
|
ignore = _ref.ignore,
|
|
@@ -920,7 +1117,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
920
1117
|
}
|
|
921
1118
|
artifactBundleUploadTransaction.finish();
|
|
922
1119
|
_context3.next = 69;
|
|
923
|
-
return sentryClient
|
|
1120
|
+
return safeFlushTelemetry(sentryClient);
|
|
924
1121
|
case 69:
|
|
925
1122
|
return _context3.finish(64);
|
|
926
1123
|
case 70:
|
|
@@ -1251,7 +1448,7 @@ function releaseManagementPlugin(_ref) {
|
|
|
1251
1448
|
_context.t0 = _context["catch"](0);
|
|
1252
1449
|
sentryHub.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
1253
1450
|
_context.next = 28;
|
|
1254
|
-
return sentryClient
|
|
1451
|
+
return safeFlushTelemetry(sentryClient);
|
|
1255
1452
|
case 28:
|
|
1256
1453
|
handleRecoverableError(_context.t0);
|
|
1257
1454
|
case 29:
|
|
@@ -1288,7 +1485,7 @@ function telemetryPlugin(_ref) {
|
|
|
1288
1485
|
name: "Sentry Bundler Plugin execution"
|
|
1289
1486
|
}).finish();
|
|
1290
1487
|
_context.next = 7;
|
|
1291
|
-
return sentryClient
|
|
1488
|
+
return safeFlushTelemetry(sentryClient);
|
|
1292
1489
|
case 7:
|
|
1293
1490
|
case "end":
|
|
1294
1491
|
return _context.stop();
|
|
@@ -1344,171 +1541,7 @@ function createLogger(options) {
|
|
|
1344
1541
|
};
|
|
1345
1542
|
}
|
|
1346
1543
|
|
|
1347
|
-
var
|
|
1348
|
-
function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
1349
|
-
var client = new NodeClient({
|
|
1350
|
-
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
1351
|
-
tracesSampleRate: 1,
|
|
1352
|
-
sampleRate: 1,
|
|
1353
|
-
release: "2.10.2",
|
|
1354
|
-
integrations: [],
|
|
1355
|
-
tracePropagationTargets: ["sentry.io/api"],
|
|
1356
|
-
stackParser: defaultStackParser,
|
|
1357
|
-
beforeSend: function beforeSend(event) {
|
|
1358
|
-
var _event$exception, _event$exception$valu;
|
|
1359
|
-
(_event$exception = event.exception) === null || _event$exception === void 0 ? void 0 : (_event$exception$valu = _event$exception.values) === null || _event$exception$valu === void 0 ? void 0 : _event$exception$valu.forEach(function (exception) {
|
|
1360
|
-
delete exception.stacktrace;
|
|
1361
|
-
});
|
|
1362
|
-
delete event.server_name; // Server name might contain PII
|
|
1363
|
-
return event;
|
|
1364
|
-
},
|
|
1365
|
-
beforeSendTransaction: function beforeSendTransaction(event) {
|
|
1366
|
-
delete event.server_name; // Server name might contain PII
|
|
1367
|
-
return event;
|
|
1368
|
-
},
|
|
1369
|
-
// We create a transport that stalls sending events until we know that we're allowed to (i.e. when Sentry CLI told
|
|
1370
|
-
// us that the upload URL is the Sentry SaaS URL)
|
|
1371
|
-
transport: function transport(nodeTransportOptions) {
|
|
1372
|
-
var nodeTransport = makeNodeTransport(nodeTransportOptions);
|
|
1373
|
-
return {
|
|
1374
|
-
flush: function flush(timeout) {
|
|
1375
|
-
return nodeTransport.flush(timeout);
|
|
1376
|
-
},
|
|
1377
|
-
send: function () {
|
|
1378
|
-
var _send = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(request) {
|
|
1379
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1380
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1381
|
-
case 0:
|
|
1382
|
-
_context.next = 2;
|
|
1383
|
-
return shouldSendTelemetry;
|
|
1384
|
-
case 2:
|
|
1385
|
-
if (!_context.sent) {
|
|
1386
|
-
_context.next = 6;
|
|
1387
|
-
break;
|
|
1388
|
-
}
|
|
1389
|
-
return _context.abrupt("return", nodeTransport.send(request));
|
|
1390
|
-
case 6:
|
|
1391
|
-
return _context.abrupt("return", undefined);
|
|
1392
|
-
case 7:
|
|
1393
|
-
case "end":
|
|
1394
|
-
return _context.stop();
|
|
1395
|
-
}
|
|
1396
|
-
}, _callee);
|
|
1397
|
-
}));
|
|
1398
|
-
function send(_x) {
|
|
1399
|
-
return _send.apply(this, arguments);
|
|
1400
|
-
}
|
|
1401
|
-
return send;
|
|
1402
|
-
}()
|
|
1403
|
-
};
|
|
1404
|
-
}
|
|
1405
|
-
});
|
|
1406
|
-
var hub = new Hub(client);
|
|
1407
|
-
setTelemetryDataOnHub(options, hub, bundler);
|
|
1408
|
-
return {
|
|
1409
|
-
sentryHub: hub,
|
|
1410
|
-
sentryClient: client
|
|
1411
|
-
};
|
|
1412
|
-
}
|
|
1413
|
-
function setTelemetryDataOnHub(options, hub, bundler) {
|
|
1414
|
-
var org = options.org,
|
|
1415
|
-
project = options.project,
|
|
1416
|
-
release = options.release,
|
|
1417
|
-
errorHandler = options.errorHandler,
|
|
1418
|
-
sourcemaps = options.sourcemaps;
|
|
1419
|
-
hub.setTag("upload-legacy-sourcemaps", !!release.uploadLegacySourcemaps);
|
|
1420
|
-
if (release.uploadLegacySourcemaps) {
|
|
1421
|
-
hub.setTag("uploadLegacySourcemapsEntries", Array.isArray(release.uploadLegacySourcemaps) ? release.uploadLegacySourcemaps.length : 1);
|
|
1422
|
-
}
|
|
1423
|
-
hub.setTag("module-metadata", !!options._experiments.moduleMetadata);
|
|
1424
|
-
hub.setTag("inject-build-information", !!options._experiments.injectBuildInformation);
|
|
1425
|
-
|
|
1426
|
-
// Optional release pipeline steps
|
|
1427
|
-
hub.setTag("clean-artifacts", release.cleanArtifacts);
|
|
1428
|
-
if (release.setCommits) {
|
|
1429
|
-
hub.setTag("set-commits", release.setCommits.auto === true ? "auto" : "manual");
|
|
1430
|
-
} else {
|
|
1431
|
-
hub.setTag("set-commits", "undefined");
|
|
1432
|
-
}
|
|
1433
|
-
hub.setTag("finalize-release", release.finalize);
|
|
1434
|
-
hub.setTag("deploy-options", !!release.deploy);
|
|
1435
|
-
|
|
1436
|
-
// Miscelaneous options
|
|
1437
|
-
hub.setTag("custom-error-handler", !!errorHandler);
|
|
1438
|
-
hub.setTag("sourcemaps-assets", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets));
|
|
1439
|
-
hub.setTag("delete-after-upload", !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.deleteFilesAfterUpload) || !!(sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.filesToDeleteAfterUpload));
|
|
1440
|
-
hub.setTag("node", process.version);
|
|
1441
|
-
hub.setTag("platform", process.platform);
|
|
1442
|
-
hub.setTags({
|
|
1443
|
-
organization: org,
|
|
1444
|
-
project: project,
|
|
1445
|
-
bundler: bundler
|
|
1446
|
-
});
|
|
1447
|
-
hub.setUser({
|
|
1448
|
-
id: org
|
|
1449
|
-
});
|
|
1450
|
-
}
|
|
1451
|
-
function allowedToSendTelemetry(_x2) {
|
|
1452
|
-
return _allowedToSendTelemetry.apply(this, arguments);
|
|
1453
|
-
}
|
|
1454
|
-
function _allowedToSendTelemetry() {
|
|
1455
|
-
_allowedToSendTelemetry = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
1456
|
-
var _cliInfo$split$, _cliInfo$split$$repla;
|
|
1457
|
-
var silent, org, project, authToken, url, headers, telemetry, release, cli, cliInfo, cliInfoUrl;
|
|
1458
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1459
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
1460
|
-
case 0:
|
|
1461
|
-
silent = options.silent, org = options.org, project = options.project, authToken = options.authToken, url = options.url, headers = options.headers, telemetry = options.telemetry, release = options.release; // `options.telemetry` defaults to true
|
|
1462
|
-
if (!(telemetry === false)) {
|
|
1463
|
-
_context2.next = 3;
|
|
1464
|
-
break;
|
|
1465
|
-
}
|
|
1466
|
-
return _context2.abrupt("return", false);
|
|
1467
|
-
case 3:
|
|
1468
|
-
if (!(url === SENTRY_SAAS_URL)) {
|
|
1469
|
-
_context2.next = 5;
|
|
1470
|
-
break;
|
|
1471
|
-
}
|
|
1472
|
-
return _context2.abrupt("return", true);
|
|
1473
|
-
case 5:
|
|
1474
|
-
cli = new SentryCli(null, {
|
|
1475
|
-
url: url,
|
|
1476
|
-
authToken: authToken,
|
|
1477
|
-
org: org,
|
|
1478
|
-
project: project,
|
|
1479
|
-
vcsRemote: release.vcsRemote,
|
|
1480
|
-
silent: silent,
|
|
1481
|
-
headers: headers
|
|
1482
|
-
});
|
|
1483
|
-
_context2.prev = 6;
|
|
1484
|
-
_context2.next = 9;
|
|
1485
|
-
return cli.execute(["info"], false);
|
|
1486
|
-
case 9:
|
|
1487
|
-
cliInfo = _context2.sent;
|
|
1488
|
-
_context2.next = 15;
|
|
1489
|
-
break;
|
|
1490
|
-
case 12:
|
|
1491
|
-
_context2.prev = 12;
|
|
1492
|
-
_context2.t0 = _context2["catch"](6);
|
|
1493
|
-
return _context2.abrupt("return", false);
|
|
1494
|
-
case 15:
|
|
1495
|
-
cliInfoUrl = (_cliInfo$split$ = cliInfo.split(/(\r\n|\n|\r)/)[0]) === null || _cliInfo$split$ === void 0 ? void 0 : (_cliInfo$split$$repla = _cliInfo$split$.replace(/^Sentry Server: /, "")) === null || _cliInfo$split$$repla === void 0 ? void 0 : _cliInfo$split$$repla.trim();
|
|
1496
|
-
if (!(cliInfoUrl === undefined)) {
|
|
1497
|
-
_context2.next = 18;
|
|
1498
|
-
break;
|
|
1499
|
-
}
|
|
1500
|
-
return _context2.abrupt("return", false);
|
|
1501
|
-
case 18:
|
|
1502
|
-
return _context2.abrupt("return", new URL(cliInfoUrl).hostname === SENTRY_SAAS_HOSTNAME);
|
|
1503
|
-
case 19:
|
|
1504
|
-
case "end":
|
|
1505
|
-
return _context2.stop();
|
|
1506
|
-
}
|
|
1507
|
-
}, _callee2, null, [[6, 12]]);
|
|
1508
|
-
}));
|
|
1509
|
-
return _allowedToSendTelemetry.apply(this, arguments);
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1544
|
+
var logger = pkg.logger;
|
|
1512
1545
|
/**
|
|
1513
1546
|
* The sentry bundler plugin concerns itself with two things:
|
|
1514
1547
|
* - Release injection
|
|
@@ -1538,6 +1571,7 @@ function _allowedToSendTelemetry() {
|
|
|
1538
1571
|
*/
|
|
1539
1572
|
function sentryUnpluginFactory(_ref) {
|
|
1540
1573
|
var releaseInjectionPlugin = _ref.releaseInjectionPlugin,
|
|
1574
|
+
componentNameAnnotatePlugin = _ref.componentNameAnnotatePlugin,
|
|
1541
1575
|
moduleMetadataInjectionPlugin = _ref.moduleMetadataInjectionPlugin,
|
|
1542
1576
|
debugIdInjectionPlugin = _ref.debugIdInjectionPlugin,
|
|
1543
1577
|
debugIdUploadPlugin = _ref.debugIdUploadPlugin,
|
|
@@ -1583,7 +1617,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1583
1617
|
});
|
|
1584
1618
|
|
|
1585
1619
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
1586
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.
|
|
1620
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.11.0");
|
|
1587
1621
|
function handleRecoverableError(unknownError) {
|
|
1588
1622
|
sentrySession.status = "abnormal";
|
|
1589
1623
|
try {
|
|
@@ -1738,6 +1772,15 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1738
1772
|
}
|
|
1739
1773
|
})));
|
|
1740
1774
|
}
|
|
1775
|
+
if (options.reactComponentAnnotation) {
|
|
1776
|
+
if (!options.reactComponentAnnotation.enabled) {
|
|
1777
|
+
logger.info("The component name annotate plugin is currently disabled. Skipping component name annotations.");
|
|
1778
|
+
} else if (options.reactComponentAnnotation.enabled && !componentNameAnnotatePlugin) {
|
|
1779
|
+
logger.warn("The component name annotate plugin is currently not supported by '@sentry/esbuild-plugin'");
|
|
1780
|
+
} else {
|
|
1781
|
+
componentNameAnnotatePlugin && plugins.push(componentNameAnnotatePlugin());
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1741
1784
|
return plugins;
|
|
1742
1785
|
});
|
|
1743
1786
|
}
|
|
@@ -1950,9 +1993,77 @@ function createRollupDebugIdUploadHooks(upload) {
|
|
|
1950
1993
|
}
|
|
1951
1994
|
};
|
|
1952
1995
|
}
|
|
1996
|
+
function createComponentNameAnnotateHooks() {
|
|
1997
|
+
return {
|
|
1998
|
+
transform: function transform(code, id) {
|
|
1999
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2000
|
+
var idWithoutQueryAndHash, parserPlugins, _result$code, result;
|
|
2001
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2002
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2003
|
+
case 0:
|
|
2004
|
+
// id may contain query and hash which will trip up our file extension logic below
|
|
2005
|
+
idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
|
|
2006
|
+
if (!idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
|
|
2007
|
+
_context2.next = 3;
|
|
2008
|
+
break;
|
|
2009
|
+
}
|
|
2010
|
+
return _context2.abrupt("return", null);
|
|
2011
|
+
case 3:
|
|
2012
|
+
if ([".jsx", ".tsx"].some(function (ending) {
|
|
2013
|
+
return idWithoutQueryAndHash.endsWith(ending);
|
|
2014
|
+
})) {
|
|
2015
|
+
_context2.next = 5;
|
|
2016
|
+
break;
|
|
2017
|
+
}
|
|
2018
|
+
return _context2.abrupt("return", null);
|
|
2019
|
+
case 5:
|
|
2020
|
+
parserPlugins = [];
|
|
2021
|
+
if (idWithoutQueryAndHash.endsWith(".jsx")) {
|
|
2022
|
+
parserPlugins.push("jsx");
|
|
2023
|
+
} else if (idWithoutQueryAndHash.endsWith(".tsx")) {
|
|
2024
|
+
parserPlugins.push("jsx", "typescript");
|
|
2025
|
+
}
|
|
2026
|
+
_context2.prev = 7;
|
|
2027
|
+
_context2.next = 10;
|
|
2028
|
+
return transformAsync(code, {
|
|
2029
|
+
plugins: [[componentNameAnnotatePlugin]],
|
|
2030
|
+
filename: id,
|
|
2031
|
+
parserOpts: {
|
|
2032
|
+
sourceType: "module",
|
|
2033
|
+
allowAwaitOutsideFunction: true,
|
|
2034
|
+
plugins: parserPlugins
|
|
2035
|
+
},
|
|
2036
|
+
generatorOpts: {
|
|
2037
|
+
decoratorsBeforeExport: true
|
|
2038
|
+
},
|
|
2039
|
+
sourceMaps: true
|
|
2040
|
+
});
|
|
2041
|
+
case 10:
|
|
2042
|
+
result = _context2.sent;
|
|
2043
|
+
return _context2.abrupt("return", {
|
|
2044
|
+
code: (_result$code = result === null || result === void 0 ? void 0 : result.code) !== null && _result$code !== void 0 ? _result$code : code,
|
|
2045
|
+
map: result === null || result === void 0 ? void 0 : result.map
|
|
2046
|
+
});
|
|
2047
|
+
case 14:
|
|
2048
|
+
_context2.prev = 14;
|
|
2049
|
+
_context2.t0 = _context2["catch"](7);
|
|
2050
|
+
logger.error("Failed to apply react annotate plugin", _context2.t0);
|
|
2051
|
+
case 17:
|
|
2052
|
+
return _context2.abrupt("return", {
|
|
2053
|
+
code: code
|
|
2054
|
+
});
|
|
2055
|
+
case 18:
|
|
2056
|
+
case "end":
|
|
2057
|
+
return _context2.stop();
|
|
2058
|
+
}
|
|
2059
|
+
}, _callee2, null, [[7, 14]]);
|
|
2060
|
+
}))();
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
1953
2064
|
function getDebugIdSnippet(debugId) {
|
|
1954
2065
|
return ";!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]=\"".concat(debugId, "\",e._sentryDebugIdIdentifier=\"sentry-dbid-").concat(debugId, "\")}catch(e){}}();");
|
|
1955
2066
|
}
|
|
1956
2067
|
|
|
1957
|
-
export { createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, getBuildInformation, getDebugIdSnippet, replaceBooleanFlagsInCode, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
2068
|
+
export { createComponentNameAnnotateHooks, createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, getBuildInformation, getDebugIdSnippet, replaceBooleanFlagsInCode, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
1958
2069
|
//# sourceMappingURL=index.mjs.map
|