@sentry/bundler-plugin-core 2.6.1 → 2.7.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 +244 -141
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +244 -142
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/debug-id-upload.d.ts +1 -1
- package/dist/types/debug-id-upload.d.ts.map +1 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +0 -3
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -717,22 +717,22 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
717
717
|
rewriteSourcesHook = _ref.rewriteSourcesHook,
|
|
718
718
|
filesToDeleteAfterUpload = _ref.filesToDeleteAfterUpload;
|
|
719
719
|
return /*#__PURE__*/function () {
|
|
720
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
721
|
-
var artifactBundleUploadTransaction, folderToCleanUp, mkdtempSpan, tmpUploadFolder, globAssets, globSpan, globResult, debugIdChunkFilePaths, prepareSpan, files, stats, uploadSize, uploadSpan, cliInstance, deleteGlobSpan, filePathsToDelete, deleteSpan, cleanupSpan;
|
|
722
|
-
return _regeneratorRuntime().wrap(function
|
|
723
|
-
while (1) switch (
|
|
720
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(buildArtifactPaths) {
|
|
721
|
+
var artifactBundleUploadTransaction, folderToCleanUp, mkdtempSpan, tmpUploadFolder, globAssets, globSpan, globResult, debugIdChunkFilePaths, prepareSpan, preparationTasks, workers, worker, workerIndex, files, stats, uploadSize, uploadSpan, cliInstance, deleteGlobSpan, filePathsToDelete, deleteSpan, cleanupSpan;
|
|
722
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
723
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
724
724
|
case 0:
|
|
725
725
|
artifactBundleUploadTransaction = sentryHub.startTransaction({
|
|
726
726
|
name: "debug-id-sourcemap-upload"
|
|
727
727
|
});
|
|
728
|
-
|
|
728
|
+
_context3.prev = 1;
|
|
729
729
|
mkdtempSpan = artifactBundleUploadTransaction.startChild({
|
|
730
730
|
description: "mkdtemp"
|
|
731
731
|
});
|
|
732
|
-
|
|
732
|
+
_context3.next = 5;
|
|
733
733
|
return fs__default["default"].promises.mkdtemp(path__default["default"].join(os__default["default"].tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
734
734
|
case 5:
|
|
735
|
-
tmpUploadFolder =
|
|
735
|
+
tmpUploadFolder = _context3.sent;
|
|
736
736
|
mkdtempSpan.finish();
|
|
737
737
|
folderToCleanUp = tmpUploadFolder;
|
|
738
738
|
if (assets) {
|
|
@@ -744,14 +744,14 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
744
744
|
globSpan = artifactBundleUploadTransaction.startChild({
|
|
745
745
|
description: "glob"
|
|
746
746
|
});
|
|
747
|
-
|
|
747
|
+
_context3.next = 12;
|
|
748
748
|
return glob.glob(globAssets, {
|
|
749
749
|
absolute: true,
|
|
750
750
|
nodir: true,
|
|
751
751
|
ignore: ignore
|
|
752
752
|
});
|
|
753
753
|
case 12:
|
|
754
|
-
globResult =
|
|
754
|
+
globResult = _context3.sent;
|
|
755
755
|
globSpan.finish();
|
|
756
756
|
debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
|
|
757
757
|
return debugIdChunkFilePath.endsWith(".js") || debugIdChunkFilePath.endsWith(".mjs") || debugIdChunkFilePath.endsWith(".cjs");
|
|
@@ -759,27 +759,27 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
759
759
|
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
760
760
|
debugIdChunkFilePaths.sort();
|
|
761
761
|
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
762
|
-
|
|
762
|
+
_context3.next = 20;
|
|
763
763
|
break;
|
|
764
764
|
}
|
|
765
765
|
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
766
|
-
|
|
766
|
+
_context3.next = 47;
|
|
767
767
|
break;
|
|
768
768
|
case 20:
|
|
769
769
|
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
770
|
-
|
|
770
|
+
_context3.next = 24;
|
|
771
771
|
break;
|
|
772
772
|
}
|
|
773
773
|
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
774
|
-
|
|
774
|
+
_context3.next = 47;
|
|
775
775
|
break;
|
|
776
776
|
case 24:
|
|
777
777
|
prepareSpan = artifactBundleUploadTransaction.startChild({
|
|
778
778
|
description: "prepare-bundles"
|
|
779
|
-
});
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
779
|
+
}); // Preparing the bundles can be a lot of work and doing it all at once has the potential of nuking the heap so
|
|
780
|
+
// instead we do it with a maximum of 16 concurrent workers
|
|
781
|
+
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
782
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
783
783
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
784
784
|
while (1) switch (_context.prev = _context.next) {
|
|
785
785
|
case 0:
|
|
@@ -791,24 +791,57 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
791
791
|
}
|
|
792
792
|
}, _callee);
|
|
793
793
|
}));
|
|
794
|
-
|
|
795
|
-
|
|
794
|
+
});
|
|
795
|
+
workers = [];
|
|
796
|
+
worker = /*#__PURE__*/function () {
|
|
797
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
798
|
+
var task;
|
|
799
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
800
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
801
|
+
case 0:
|
|
802
|
+
if (!(preparationTasks.length > 0)) {
|
|
803
|
+
_context2.next = 7;
|
|
804
|
+
break;
|
|
805
|
+
}
|
|
806
|
+
task = preparationTasks.shift();
|
|
807
|
+
if (!task) {
|
|
808
|
+
_context2.next = 5;
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
_context2.next = 5;
|
|
812
|
+
return task();
|
|
813
|
+
case 5:
|
|
814
|
+
_context2.next = 0;
|
|
815
|
+
break;
|
|
816
|
+
case 7:
|
|
817
|
+
case "end":
|
|
818
|
+
return _context2.stop();
|
|
819
|
+
}
|
|
820
|
+
}, _callee2);
|
|
821
|
+
}));
|
|
822
|
+
return function worker() {
|
|
823
|
+
return _ref4.apply(this, arguments);
|
|
796
824
|
};
|
|
797
|
-
}()
|
|
798
|
-
|
|
825
|
+
}();
|
|
826
|
+
for (workerIndex = 0; workerIndex < 16; workerIndex++) {
|
|
827
|
+
workers.push(worker());
|
|
828
|
+
}
|
|
829
|
+
_context3.next = 31;
|
|
830
|
+
return Promise.all(workers);
|
|
831
|
+
case 31:
|
|
799
832
|
prepareSpan.finish();
|
|
800
|
-
|
|
833
|
+
_context3.next = 34;
|
|
801
834
|
return fs__default["default"].promises.readdir(tmpUploadFolder);
|
|
802
|
-
case
|
|
803
|
-
files =
|
|
835
|
+
case 34:
|
|
836
|
+
files = _context3.sent;
|
|
804
837
|
stats = files.map(function (file) {
|
|
805
838
|
return fs__default["default"].promises.stat(path__default["default"].join(tmpUploadFolder, file));
|
|
806
839
|
});
|
|
807
|
-
|
|
840
|
+
_context3.next = 38;
|
|
808
841
|
return Promise.all(stats);
|
|
809
|
-
case
|
|
810
|
-
uploadSize =
|
|
811
|
-
var size =
|
|
842
|
+
case 38:
|
|
843
|
+
uploadSize = _context3.sent.reduce(function (accumulator, _ref5) {
|
|
844
|
+
var size = _ref5.size;
|
|
812
845
|
return accumulator + size;
|
|
813
846
|
}, 0);
|
|
814
847
|
artifactBundleUploadTransaction.setMeasurement("files", files.length, "none");
|
|
@@ -823,7 +856,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
823
856
|
baggage: utils.dynamicSamplingContextToSentryBaggageHeader(artifactBundleUploadTransaction.getDynamicSamplingContext())
|
|
824
857
|
}, sentryCliOptions.headers)
|
|
825
858
|
}));
|
|
826
|
-
|
|
859
|
+
_context3.next = 45;
|
|
827
860
|
return cliInstance.releases.uploadSourceMaps(releaseName !== null && releaseName !== void 0 ? releaseName : "undefined",
|
|
828
861
|
// unfortunetly this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
829
862
|
{
|
|
@@ -834,24 +867,24 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
834
867
|
}],
|
|
835
868
|
useArtifactBundle: true
|
|
836
869
|
});
|
|
837
|
-
case
|
|
870
|
+
case 45:
|
|
838
871
|
uploadSpan.finish();
|
|
839
872
|
logger.info("Successfully uploaded source maps to Sentry");
|
|
840
|
-
case
|
|
873
|
+
case 47:
|
|
841
874
|
if (!filesToDeleteAfterUpload) {
|
|
842
|
-
|
|
875
|
+
_context3.next = 58;
|
|
843
876
|
break;
|
|
844
877
|
}
|
|
845
878
|
deleteGlobSpan = artifactBundleUploadTransaction.startChild({
|
|
846
879
|
description: "delete-glob"
|
|
847
880
|
});
|
|
848
|
-
|
|
881
|
+
_context3.next = 51;
|
|
849
882
|
return glob.glob(filesToDeleteAfterUpload, {
|
|
850
883
|
absolute: true,
|
|
851
884
|
nodir: true
|
|
852
885
|
});
|
|
853
|
-
case
|
|
854
|
-
filePathsToDelete =
|
|
886
|
+
case 51:
|
|
887
|
+
filePathsToDelete = _context3.sent;
|
|
855
888
|
deleteGlobSpan.finish();
|
|
856
889
|
filePathsToDelete.forEach(function (filePathToDelete) {
|
|
857
890
|
logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
|
|
@@ -859,7 +892,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
859
892
|
deleteSpan = artifactBundleUploadTransaction.startChild({
|
|
860
893
|
description: "delete-files-after-upload"
|
|
861
894
|
});
|
|
862
|
-
|
|
895
|
+
_context3.next = 57;
|
|
863
896
|
return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
|
|
864
897
|
return fs__default["default"].promises.rm(filePathToDelete, {
|
|
865
898
|
force: true
|
|
@@ -868,21 +901,21 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
868
901
|
logger.debug("An error occured while attempting to delete asset: ".concat(filePathToDelete), e);
|
|
869
902
|
});
|
|
870
903
|
}));
|
|
871
|
-
case
|
|
904
|
+
case 57:
|
|
872
905
|
deleteSpan.finish();
|
|
873
|
-
case
|
|
874
|
-
|
|
906
|
+
case 58:
|
|
907
|
+
_context3.next = 64;
|
|
875
908
|
break;
|
|
876
|
-
case
|
|
877
|
-
|
|
878
|
-
|
|
909
|
+
case 60:
|
|
910
|
+
_context3.prev = 60;
|
|
911
|
+
_context3.t0 = _context3["catch"](1);
|
|
879
912
|
sentryHub.withScope(function (scope) {
|
|
880
913
|
scope.setSpan(artifactBundleUploadTransaction);
|
|
881
914
|
sentryHub.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
882
915
|
});
|
|
883
|
-
handleRecoverableError(
|
|
884
|
-
case
|
|
885
|
-
|
|
916
|
+
handleRecoverableError(_context3.t0);
|
|
917
|
+
case 64:
|
|
918
|
+
_context3.prev = 64;
|
|
886
919
|
if (folderToCleanUp) {
|
|
887
920
|
cleanupSpan = artifactBundleUploadTransaction.startChild({
|
|
888
921
|
description: "cleanup"
|
|
@@ -894,22 +927,22 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
894
927
|
cleanupSpan.finish();
|
|
895
928
|
}
|
|
896
929
|
artifactBundleUploadTransaction.finish();
|
|
897
|
-
|
|
930
|
+
_context3.next = 69;
|
|
898
931
|
return sentryClient.flush();
|
|
899
|
-
case
|
|
900
|
-
return
|
|
901
|
-
case
|
|
932
|
+
case 69:
|
|
933
|
+
return _context3.finish(64);
|
|
934
|
+
case 70:
|
|
902
935
|
case "end":
|
|
903
|
-
return
|
|
936
|
+
return _context3.stop();
|
|
904
937
|
}
|
|
905
|
-
},
|
|
938
|
+
}, _callee3, null, [[1, 60, 64, 70]]);
|
|
906
939
|
}));
|
|
907
940
|
return function (_x) {
|
|
908
941
|
return _ref2.apply(this, arguments);
|
|
909
942
|
};
|
|
910
943
|
}();
|
|
911
944
|
}
|
|
912
|
-
function prepareBundleForDebugIdUpload(
|
|
945
|
+
function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6) {
|
|
913
946
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
914
947
|
}
|
|
915
948
|
|
|
@@ -920,64 +953,66 @@ function prepareBundleForDebugIdUpload(_x4, _x5, _x6, _x7, _x8) {
|
|
|
920
953
|
* The string pattern is injected via the debug ID injection snipped.
|
|
921
954
|
*/
|
|
922
955
|
function _prepareBundleForDebugIdUpload() {
|
|
923
|
-
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
956
|
+
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook) {
|
|
924
957
|
var bundleContent, debugId, uniqueUploadName, writeSourceFilePromise, writeSourceMapFilePromise;
|
|
925
|
-
return _regeneratorRuntime().wrap(function
|
|
926
|
-
while (1) switch (
|
|
958
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
959
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
927
960
|
case 0:
|
|
928
|
-
|
|
929
|
-
|
|
961
|
+
_context5.prev = 0;
|
|
962
|
+
_context5.next = 3;
|
|
930
963
|
return util.promisify(fs__default["default"].readFile)(bundleFilePath, "utf8");
|
|
931
964
|
case 3:
|
|
932
|
-
bundleContent =
|
|
933
|
-
|
|
965
|
+
bundleContent = _context5.sent;
|
|
966
|
+
_context5.next = 10;
|
|
934
967
|
break;
|
|
935
968
|
case 6:
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
logger.error("Could not read bundle to determine debug ID and source map: ".concat(bundleFilePath),
|
|
939
|
-
return
|
|
969
|
+
_context5.prev = 6;
|
|
970
|
+
_context5.t0 = _context5["catch"](0);
|
|
971
|
+
logger.error("Could not read bundle to determine debug ID and source map: ".concat(bundleFilePath), _context5.t0);
|
|
972
|
+
return _context5.abrupt("return");
|
|
940
973
|
case 10:
|
|
941
974
|
debugId = determineDebugIdFromBundleSource(bundleContent);
|
|
942
975
|
if (!(debugId === undefined)) {
|
|
943
|
-
|
|
976
|
+
_context5.next = 14;
|
|
944
977
|
break;
|
|
945
978
|
}
|
|
946
979
|
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));
|
|
947
|
-
return
|
|
980
|
+
return _context5.abrupt("return");
|
|
948
981
|
case 14:
|
|
949
982
|
uniqueUploadName = "".concat(debugId, "-").concat(chunkIndex);
|
|
950
983
|
bundleContent += "\n//# debugId=".concat(debugId);
|
|
951
984
|
writeSourceFilePromise = fs__default["default"].promises.writeFile(path__default["default"].join(uploadFolder, "".concat(uniqueUploadName, ".js")), bundleContent, "utf-8");
|
|
952
985
|
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
|
|
953
|
-
var
|
|
954
|
-
return _regeneratorRuntime().wrap(function
|
|
955
|
-
while (1) switch (
|
|
986
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sourceMapPath) {
|
|
987
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
988
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
956
989
|
case 0:
|
|
957
990
|
if (!sourceMapPath) {
|
|
958
|
-
|
|
991
|
+
_context4.next = 3;
|
|
959
992
|
break;
|
|
960
993
|
}
|
|
961
|
-
|
|
994
|
+
_context4.next = 3;
|
|
962
995
|
return prepareSourceMapForDebugIdUpload(sourceMapPath, path__default["default"].join(uploadFolder, "".concat(uniqueUploadName, ".js.map")), debugId, rewriteSourcesHook, logger);
|
|
963
996
|
case 3:
|
|
964
|
-
return _context3.abrupt("return", _context3.sent);
|
|
965
|
-
case 4:
|
|
966
997
|
case "end":
|
|
967
|
-
return
|
|
998
|
+
return _context4.stop();
|
|
968
999
|
}
|
|
969
|
-
},
|
|
1000
|
+
}, _callee4);
|
|
970
1001
|
}));
|
|
971
|
-
return function (
|
|
972
|
-
return
|
|
1002
|
+
return function (_x15) {
|
|
1003
|
+
return _ref6.apply(this, arguments);
|
|
973
1004
|
};
|
|
974
1005
|
}());
|
|
975
|
-
|
|
976
|
-
|
|
1006
|
+
_context5.next = 20;
|
|
1007
|
+
return writeSourceFilePromise;
|
|
1008
|
+
case 20:
|
|
1009
|
+
_context5.next = 22;
|
|
1010
|
+
return writeSourceMapFilePromise;
|
|
1011
|
+
case 22:
|
|
977
1012
|
case "end":
|
|
978
|
-
return
|
|
1013
|
+
return _context5.stop();
|
|
979
1014
|
}
|
|
980
|
-
},
|
|
1015
|
+
}, _callee5, null, [[0, 6]]);
|
|
981
1016
|
}));
|
|
982
1017
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
983
1018
|
}
|
|
@@ -995,114 +1030,143 @@ function determineDebugIdFromBundleSource(code) {
|
|
|
995
1030
|
*
|
|
996
1031
|
* @returns the path to the bundle's source map or `undefined` if none could be found.
|
|
997
1032
|
*/
|
|
998
|
-
function determineSourceMapPathFromBundle(
|
|
1033
|
+
function determineSourceMapPathFromBundle(_x7, _x8, _x9) {
|
|
999
1034
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
1000
1035
|
}
|
|
1001
1036
|
/**
|
|
1002
1037
|
* Reads a source map, injects debug ID fields, and writes the source map to the target path.
|
|
1003
1038
|
*/
|
|
1004
1039
|
function _determineSourceMapPathFromBundle() {
|
|
1005
|
-
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1006
|
-
var sourceMappingUrlMatch, sourceMappingUrl, adjacentSourceMapFilePath;
|
|
1007
|
-
return _regeneratorRuntime().wrap(function
|
|
1008
|
-
while (1) switch (
|
|
1040
|
+
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(bundlePath, bundleSource, logger) {
|
|
1041
|
+
var sourceMappingUrlMatch, sourceMappingUrl, isUrl, isSupportedUrl, url, absoluteSourceMapPath, adjacentSourceMapFilePath;
|
|
1042
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1043
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
1009
1044
|
case 0:
|
|
1010
1045
|
// 1. try to find source map at `sourceMappingURL` location
|
|
1011
|
-
sourceMappingUrlMatch = bundleSource.match(
|
|
1046
|
+
sourceMappingUrlMatch = bundleSource.match(/^\s*\/\/# sourceMappingURL=(.*)$/m);
|
|
1012
1047
|
if (!sourceMappingUrlMatch) {
|
|
1013
|
-
|
|
1048
|
+
_context6.next = 21;
|
|
1014
1049
|
break;
|
|
1015
1050
|
}
|
|
1016
1051
|
sourceMappingUrl = path__default["default"].normalize(sourceMappingUrlMatch[1]);
|
|
1017
|
-
|
|
1018
|
-
|
|
1052
|
+
try {
|
|
1053
|
+
url = new URL(sourceMappingUrl);
|
|
1054
|
+
isUrl = true;
|
|
1055
|
+
isSupportedUrl = url.protocol === "file:";
|
|
1056
|
+
} catch (_unused) {
|
|
1057
|
+
isUrl = false;
|
|
1058
|
+
isSupportedUrl = false;
|
|
1059
|
+
}
|
|
1060
|
+
if (!isSupportedUrl) {
|
|
1061
|
+
_context6.next = 8;
|
|
1019
1062
|
break;
|
|
1020
1063
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1064
|
+
absoluteSourceMapPath = sourceMappingUrl;
|
|
1065
|
+
_context6.next = 13;
|
|
1066
|
+
break;
|
|
1024
1067
|
case 8:
|
|
1025
|
-
|
|
1068
|
+
if (!isUrl) {
|
|
1069
|
+
_context6.next = 12;
|
|
1070
|
+
break;
|
|
1071
|
+
}
|
|
1072
|
+
return _context6.abrupt("return");
|
|
1073
|
+
case 12:
|
|
1074
|
+
if (path__default["default"].isAbsolute(sourceMappingUrl)) {
|
|
1075
|
+
absoluteSourceMapPath = sourceMappingUrl;
|
|
1076
|
+
} else {
|
|
1077
|
+
absoluteSourceMapPath = path__default["default"].join(path__default["default"].dirname(bundlePath), sourceMappingUrl);
|
|
1078
|
+
}
|
|
1079
|
+
case 13:
|
|
1080
|
+
_context6.prev = 13;
|
|
1081
|
+
_context6.next = 16;
|
|
1082
|
+
return util__namespace.promisify(fs__default["default"].access)(absoluteSourceMapPath);
|
|
1083
|
+
case 16:
|
|
1084
|
+
return _context6.abrupt("return", absoluteSourceMapPath);
|
|
1085
|
+
case 19:
|
|
1086
|
+
_context6.prev = 19;
|
|
1087
|
+
_context6.t0 = _context6["catch"](13);
|
|
1088
|
+
case 21:
|
|
1089
|
+
_context6.prev = 21;
|
|
1026
1090
|
adjacentSourceMapFilePath = bundlePath + ".map";
|
|
1027
|
-
|
|
1091
|
+
_context6.next = 25;
|
|
1028
1092
|
return util__namespace.promisify(fs__default["default"].access)(adjacentSourceMapFilePath);
|
|
1029
|
-
case
|
|
1030
|
-
return
|
|
1031
|
-
case
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
case
|
|
1093
|
+
case 25:
|
|
1094
|
+
return _context6.abrupt("return", adjacentSourceMapFilePath);
|
|
1095
|
+
case 28:
|
|
1096
|
+
_context6.prev = 28;
|
|
1097
|
+
_context6.t1 = _context6["catch"](21);
|
|
1098
|
+
case 30:
|
|
1035
1099
|
// This is just a debug message because it can be quite spammy for some frameworks
|
|
1036
1100
|
logger.debug("Could not determine source map path for bundle: ".concat(bundlePath, " - Did you turn on source map generation in your bundler?"));
|
|
1037
|
-
return
|
|
1038
|
-
case
|
|
1101
|
+
return _context6.abrupt("return", undefined);
|
|
1102
|
+
case 32:
|
|
1039
1103
|
case "end":
|
|
1040
|
-
return
|
|
1104
|
+
return _context6.stop();
|
|
1041
1105
|
}
|
|
1042
|
-
},
|
|
1106
|
+
}, _callee6, null, [[13, 19], [21, 28]]);
|
|
1043
1107
|
}));
|
|
1044
1108
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
1045
1109
|
}
|
|
1046
|
-
function prepareSourceMapForDebugIdUpload(
|
|
1110
|
+
function prepareSourceMapForDebugIdUpload(_x10, _x11, _x12, _x13, _x14) {
|
|
1047
1111
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
1048
1112
|
}
|
|
1049
1113
|
function _prepareSourceMapForDebugIdUpload() {
|
|
1050
|
-
_prepareSourceMapForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1114
|
+
_prepareSourceMapForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(sourceMapPath, targetPath, debugId, rewriteSourcesHook, logger) {
|
|
1051
1115
|
var sourceMapFileContent, map;
|
|
1052
|
-
return _regeneratorRuntime().wrap(function
|
|
1053
|
-
while (1) switch (
|
|
1116
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1117
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1054
1118
|
case 0:
|
|
1055
|
-
|
|
1056
|
-
|
|
1119
|
+
_context7.prev = 0;
|
|
1120
|
+
_context7.next = 3;
|
|
1057
1121
|
return util__namespace.promisify(fs__default["default"].readFile)(sourceMapPath, {
|
|
1058
1122
|
encoding: "utf8"
|
|
1059
1123
|
});
|
|
1060
1124
|
case 3:
|
|
1061
|
-
sourceMapFileContent =
|
|
1062
|
-
|
|
1125
|
+
sourceMapFileContent = _context7.sent;
|
|
1126
|
+
_context7.next = 10;
|
|
1063
1127
|
break;
|
|
1064
1128
|
case 6:
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
logger.error("Failed to read source map for debug ID upload: ".concat(sourceMapPath),
|
|
1068
|
-
return
|
|
1129
|
+
_context7.prev = 6;
|
|
1130
|
+
_context7.t0 = _context7["catch"](0);
|
|
1131
|
+
logger.error("Failed to read source map for debug ID upload: ".concat(sourceMapPath), _context7.t0);
|
|
1132
|
+
return _context7.abrupt("return");
|
|
1069
1133
|
case 10:
|
|
1070
|
-
|
|
1134
|
+
_context7.prev = 10;
|
|
1071
1135
|
map = JSON.parse(sourceMapFileContent);
|
|
1072
1136
|
// For now we write both fields until we know what will become the standard - if ever.
|
|
1073
1137
|
map["debug_id"] = debugId;
|
|
1074
1138
|
map["debugId"] = debugId;
|
|
1075
|
-
|
|
1139
|
+
_context7.next = 20;
|
|
1076
1140
|
break;
|
|
1077
1141
|
case 16:
|
|
1078
|
-
|
|
1079
|
-
|
|
1142
|
+
_context7.prev = 16;
|
|
1143
|
+
_context7.t1 = _context7["catch"](10);
|
|
1080
1144
|
logger.error("Failed to parse source map for debug ID upload: ".concat(sourceMapPath));
|
|
1081
|
-
return
|
|
1145
|
+
return _context7.abrupt("return");
|
|
1082
1146
|
case 20:
|
|
1083
1147
|
if (map["sources"] && Array.isArray(map["sources"])) {
|
|
1084
1148
|
map["sources"].map(function (source) {
|
|
1085
1149
|
return rewriteSourcesHook(source, map);
|
|
1086
1150
|
});
|
|
1087
1151
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1152
|
+
_context7.prev = 21;
|
|
1153
|
+
_context7.next = 24;
|
|
1090
1154
|
return util__namespace.promisify(fs__default["default"].writeFile)(targetPath, JSON.stringify(map), {
|
|
1091
1155
|
encoding: "utf8"
|
|
1092
1156
|
});
|
|
1093
1157
|
case 24:
|
|
1094
|
-
|
|
1158
|
+
_context7.next = 30;
|
|
1095
1159
|
break;
|
|
1096
1160
|
case 26:
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath),
|
|
1100
|
-
return
|
|
1161
|
+
_context7.prev = 26;
|
|
1162
|
+
_context7.t2 = _context7["catch"](21);
|
|
1163
|
+
logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath), _context7.t2);
|
|
1164
|
+
return _context7.abrupt("return");
|
|
1101
1165
|
case 30:
|
|
1102
1166
|
case "end":
|
|
1103
|
-
return
|
|
1167
|
+
return _context7.stop();
|
|
1104
1168
|
}
|
|
1105
|
-
},
|
|
1169
|
+
}, _callee7, null, [[0, 6], [10, 16], [21, 26]]);
|
|
1106
1170
|
}));
|
|
1107
1171
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
1108
1172
|
}
|
|
@@ -1303,7 +1367,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
1303
1367
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
1304
1368
|
tracesSampleRate: 1,
|
|
1305
1369
|
sampleRate: 1,
|
|
1306
|
-
release: "2.
|
|
1370
|
+
release: "2.7.0",
|
|
1307
1371
|
integrations: [],
|
|
1308
1372
|
tracePropagationTargets: ["sentry.io/api"],
|
|
1309
1373
|
stackParser: node.defaultStackParser,
|
|
@@ -1535,7 +1599,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1535
1599
|
});
|
|
1536
1600
|
|
|
1537
1601
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
1538
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.
|
|
1602
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.7.0");
|
|
1539
1603
|
function handleRecoverableError(unknownError) {
|
|
1540
1604
|
sentrySession.status = "abnormal";
|
|
1541
1605
|
try {
|
|
@@ -1734,11 +1798,19 @@ function createRollupReleaseInjectionHooks(injectionCode) {
|
|
|
1734
1798
|
ms.append("\n\n;import \"".concat(virtualReleaseInjectionFileId, "\";"));
|
|
1735
1799
|
return {
|
|
1736
1800
|
code: ms.toString(),
|
|
1737
|
-
map: ms.generateMap(
|
|
1801
|
+
map: ms.generateMap({
|
|
1802
|
+
hires: true
|
|
1803
|
+
})
|
|
1738
1804
|
};
|
|
1739
1805
|
}
|
|
1740
1806
|
};
|
|
1741
1807
|
}
|
|
1808
|
+
|
|
1809
|
+
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
1810
|
+
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
1811
|
+
var COMMENT_USE_STRICT_REGEX =
|
|
1812
|
+
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
1813
|
+
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
1742
1814
|
function createRollupDebugIdInjectionHooks() {
|
|
1743
1815
|
return {
|
|
1744
1816
|
renderChunk: function renderChunk(code, chunk) {
|
|
@@ -1752,13 +1824,7 @@ function createRollupDebugIdInjectionHooks() {
|
|
|
1752
1824
|
var ms = new MagicString__default["default"](code, {
|
|
1753
1825
|
filename: chunk.fileName
|
|
1754
1826
|
});
|
|
1755
|
-
|
|
1756
|
-
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
1757
|
-
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
1758
|
-
var commentUseStrictRegex =
|
|
1759
|
-
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
1760
|
-
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
1761
|
-
var match = (_code$match = code.match(commentUseStrictRegex)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
1827
|
+
var match = (_code$match = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
1762
1828
|
if (match) {
|
|
1763
1829
|
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
1764
1830
|
ms.appendLeft(match.length, codeToInject);
|
|
@@ -1771,7 +1837,43 @@ function createRollupDebugIdInjectionHooks() {
|
|
|
1771
1837
|
return {
|
|
1772
1838
|
code: ms.toString(),
|
|
1773
1839
|
map: ms.generateMap({
|
|
1774
|
-
file: chunk.fileName
|
|
1840
|
+
file: chunk.fileName,
|
|
1841
|
+
hires: true
|
|
1842
|
+
})
|
|
1843
|
+
};
|
|
1844
|
+
} else {
|
|
1845
|
+
return null; // returning null means not modifying the chunk at all
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
1852
|
+
return {
|
|
1853
|
+
renderChunk: function renderChunk(code, chunk) {
|
|
1854
|
+
if ([".js", ".mjs", ".cjs"].some(function (ending) {
|
|
1855
|
+
return chunk.fileName.endsWith(ending);
|
|
1856
|
+
}) // chunks could be any file (html, md, ...)
|
|
1857
|
+
) {
|
|
1858
|
+
var _code$match2;
|
|
1859
|
+
var ms = new MagicString__default["default"](code, {
|
|
1860
|
+
filename: chunk.fileName
|
|
1861
|
+
});
|
|
1862
|
+
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
1863
|
+
if (match) {
|
|
1864
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
1865
|
+
ms.appendLeft(match.length, injectionCode);
|
|
1866
|
+
} else {
|
|
1867
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
1868
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
1869
|
+
// need this special case here.
|
|
1870
|
+
ms.prepend(injectionCode);
|
|
1871
|
+
}
|
|
1872
|
+
return {
|
|
1873
|
+
code: ms.toString(),
|
|
1874
|
+
map: ms.generateMap({
|
|
1875
|
+
file: chunk.fileName,
|
|
1876
|
+
hires: true
|
|
1775
1877
|
})
|
|
1776
1878
|
};
|
|
1777
1879
|
} else {
|
|
@@ -1838,6 +1940,7 @@ function getDebugIdSnippet(debugId) {
|
|
|
1838
1940
|
|
|
1839
1941
|
exports.createRollupDebugIdInjectionHooks = createRollupDebugIdInjectionHooks;
|
|
1840
1942
|
exports.createRollupDebugIdUploadHooks = createRollupDebugIdUploadHooks;
|
|
1943
|
+
exports.createRollupModuleMetadataInjectionHooks = createRollupModuleMetadataInjectionHooks;
|
|
1841
1944
|
exports.createRollupReleaseInjectionHooks = createRollupReleaseInjectionHooks;
|
|
1842
1945
|
exports.getBuildInformation = getBuildInformation;
|
|
1843
1946
|
exports.getDebugIdSnippet = getDebugIdSnippet;
|