@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/esm/index.mjs
CHANGED
|
@@ -683,22 +683,22 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
683
683
|
rewriteSourcesHook = _ref.rewriteSourcesHook,
|
|
684
684
|
filesToDeleteAfterUpload = _ref.filesToDeleteAfterUpload;
|
|
685
685
|
return /*#__PURE__*/function () {
|
|
686
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
687
|
-
var artifactBundleUploadTransaction, folderToCleanUp, mkdtempSpan, tmpUploadFolder, globAssets, globSpan, globResult, debugIdChunkFilePaths, prepareSpan, files, stats, uploadSize, uploadSpan, cliInstance, deleteGlobSpan, filePathsToDelete, deleteSpan, cleanupSpan;
|
|
688
|
-
return _regeneratorRuntime().wrap(function
|
|
689
|
-
while (1) switch (
|
|
686
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(buildArtifactPaths) {
|
|
687
|
+
var artifactBundleUploadTransaction, folderToCleanUp, mkdtempSpan, tmpUploadFolder, globAssets, globSpan, globResult, debugIdChunkFilePaths, prepareSpan, preparationTasks, workers, worker, workerIndex, files, stats, uploadSize, uploadSpan, cliInstance, deleteGlobSpan, filePathsToDelete, deleteSpan, cleanupSpan;
|
|
688
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
689
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
690
690
|
case 0:
|
|
691
691
|
artifactBundleUploadTransaction = sentryHub.startTransaction({
|
|
692
692
|
name: "debug-id-sourcemap-upload"
|
|
693
693
|
});
|
|
694
|
-
|
|
694
|
+
_context3.prev = 1;
|
|
695
695
|
mkdtempSpan = artifactBundleUploadTransaction.startChild({
|
|
696
696
|
description: "mkdtemp"
|
|
697
697
|
});
|
|
698
|
-
|
|
698
|
+
_context3.next = 5;
|
|
699
699
|
return fs__default.promises.mkdtemp(path__default.join(os.tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
700
700
|
case 5:
|
|
701
|
-
tmpUploadFolder =
|
|
701
|
+
tmpUploadFolder = _context3.sent;
|
|
702
702
|
mkdtempSpan.finish();
|
|
703
703
|
folderToCleanUp = tmpUploadFolder;
|
|
704
704
|
if (assets) {
|
|
@@ -710,14 +710,14 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
710
710
|
globSpan = artifactBundleUploadTransaction.startChild({
|
|
711
711
|
description: "glob"
|
|
712
712
|
});
|
|
713
|
-
|
|
713
|
+
_context3.next = 12;
|
|
714
714
|
return glob(globAssets, {
|
|
715
715
|
absolute: true,
|
|
716
716
|
nodir: true,
|
|
717
717
|
ignore: ignore
|
|
718
718
|
});
|
|
719
719
|
case 12:
|
|
720
|
-
globResult =
|
|
720
|
+
globResult = _context3.sent;
|
|
721
721
|
globSpan.finish();
|
|
722
722
|
debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
|
|
723
723
|
return debugIdChunkFilePath.endsWith(".js") || debugIdChunkFilePath.endsWith(".mjs") || debugIdChunkFilePath.endsWith(".cjs");
|
|
@@ -725,27 +725,27 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
725
725
|
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
726
726
|
debugIdChunkFilePaths.sort();
|
|
727
727
|
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
728
|
-
|
|
728
|
+
_context3.next = 20;
|
|
729
729
|
break;
|
|
730
730
|
}
|
|
731
731
|
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
732
|
-
|
|
732
|
+
_context3.next = 47;
|
|
733
733
|
break;
|
|
734
734
|
case 20:
|
|
735
735
|
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
736
|
-
|
|
736
|
+
_context3.next = 24;
|
|
737
737
|
break;
|
|
738
738
|
}
|
|
739
739
|
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
740
|
-
|
|
740
|
+
_context3.next = 47;
|
|
741
741
|
break;
|
|
742
742
|
case 24:
|
|
743
743
|
prepareSpan = artifactBundleUploadTransaction.startChild({
|
|
744
744
|
description: "prepare-bundles"
|
|
745
|
-
});
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
745
|
+
}); // Preparing the bundles can be a lot of work and doing it all at once has the potential of nuking the heap so
|
|
746
|
+
// instead we do it with a maximum of 16 concurrent workers
|
|
747
|
+
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
748
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
749
749
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
750
750
|
while (1) switch (_context.prev = _context.next) {
|
|
751
751
|
case 0:
|
|
@@ -757,24 +757,57 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
757
757
|
}
|
|
758
758
|
}, _callee);
|
|
759
759
|
}));
|
|
760
|
-
|
|
761
|
-
|
|
760
|
+
});
|
|
761
|
+
workers = [];
|
|
762
|
+
worker = /*#__PURE__*/function () {
|
|
763
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
764
|
+
var task;
|
|
765
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
766
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
767
|
+
case 0:
|
|
768
|
+
if (!(preparationTasks.length > 0)) {
|
|
769
|
+
_context2.next = 7;
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
task = preparationTasks.shift();
|
|
773
|
+
if (!task) {
|
|
774
|
+
_context2.next = 5;
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
_context2.next = 5;
|
|
778
|
+
return task();
|
|
779
|
+
case 5:
|
|
780
|
+
_context2.next = 0;
|
|
781
|
+
break;
|
|
782
|
+
case 7:
|
|
783
|
+
case "end":
|
|
784
|
+
return _context2.stop();
|
|
785
|
+
}
|
|
786
|
+
}, _callee2);
|
|
787
|
+
}));
|
|
788
|
+
return function worker() {
|
|
789
|
+
return _ref4.apply(this, arguments);
|
|
762
790
|
};
|
|
763
|
-
}()
|
|
764
|
-
|
|
791
|
+
}();
|
|
792
|
+
for (workerIndex = 0; workerIndex < 16; workerIndex++) {
|
|
793
|
+
workers.push(worker());
|
|
794
|
+
}
|
|
795
|
+
_context3.next = 31;
|
|
796
|
+
return Promise.all(workers);
|
|
797
|
+
case 31:
|
|
765
798
|
prepareSpan.finish();
|
|
766
|
-
|
|
799
|
+
_context3.next = 34;
|
|
767
800
|
return fs__default.promises.readdir(tmpUploadFolder);
|
|
768
|
-
case
|
|
769
|
-
files =
|
|
801
|
+
case 34:
|
|
802
|
+
files = _context3.sent;
|
|
770
803
|
stats = files.map(function (file) {
|
|
771
804
|
return fs__default.promises.stat(path__default.join(tmpUploadFolder, file));
|
|
772
805
|
});
|
|
773
|
-
|
|
806
|
+
_context3.next = 38;
|
|
774
807
|
return Promise.all(stats);
|
|
775
|
-
case
|
|
776
|
-
uploadSize =
|
|
777
|
-
var size =
|
|
808
|
+
case 38:
|
|
809
|
+
uploadSize = _context3.sent.reduce(function (accumulator, _ref5) {
|
|
810
|
+
var size = _ref5.size;
|
|
778
811
|
return accumulator + size;
|
|
779
812
|
}, 0);
|
|
780
813
|
artifactBundleUploadTransaction.setMeasurement("files", files.length, "none");
|
|
@@ -789,7 +822,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
789
822
|
baggage: dynamicSamplingContextToSentryBaggageHeader(artifactBundleUploadTransaction.getDynamicSamplingContext())
|
|
790
823
|
}, sentryCliOptions.headers)
|
|
791
824
|
}));
|
|
792
|
-
|
|
825
|
+
_context3.next = 45;
|
|
793
826
|
return cliInstance.releases.uploadSourceMaps(releaseName !== null && releaseName !== void 0 ? releaseName : "undefined",
|
|
794
827
|
// unfortunetly this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
795
828
|
{
|
|
@@ -800,24 +833,24 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
800
833
|
}],
|
|
801
834
|
useArtifactBundle: true
|
|
802
835
|
});
|
|
803
|
-
case
|
|
836
|
+
case 45:
|
|
804
837
|
uploadSpan.finish();
|
|
805
838
|
logger.info("Successfully uploaded source maps to Sentry");
|
|
806
|
-
case
|
|
839
|
+
case 47:
|
|
807
840
|
if (!filesToDeleteAfterUpload) {
|
|
808
|
-
|
|
841
|
+
_context3.next = 58;
|
|
809
842
|
break;
|
|
810
843
|
}
|
|
811
844
|
deleteGlobSpan = artifactBundleUploadTransaction.startChild({
|
|
812
845
|
description: "delete-glob"
|
|
813
846
|
});
|
|
814
|
-
|
|
847
|
+
_context3.next = 51;
|
|
815
848
|
return glob(filesToDeleteAfterUpload, {
|
|
816
849
|
absolute: true,
|
|
817
850
|
nodir: true
|
|
818
851
|
});
|
|
819
|
-
case
|
|
820
|
-
filePathsToDelete =
|
|
852
|
+
case 51:
|
|
853
|
+
filePathsToDelete = _context3.sent;
|
|
821
854
|
deleteGlobSpan.finish();
|
|
822
855
|
filePathsToDelete.forEach(function (filePathToDelete) {
|
|
823
856
|
logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
|
|
@@ -825,7 +858,7 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
825
858
|
deleteSpan = artifactBundleUploadTransaction.startChild({
|
|
826
859
|
description: "delete-files-after-upload"
|
|
827
860
|
});
|
|
828
|
-
|
|
861
|
+
_context3.next = 57;
|
|
829
862
|
return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
|
|
830
863
|
return fs__default.promises.rm(filePathToDelete, {
|
|
831
864
|
force: true
|
|
@@ -834,21 +867,21 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
834
867
|
logger.debug("An error occured while attempting to delete asset: ".concat(filePathToDelete), e);
|
|
835
868
|
});
|
|
836
869
|
}));
|
|
837
|
-
case
|
|
870
|
+
case 57:
|
|
838
871
|
deleteSpan.finish();
|
|
839
|
-
case
|
|
840
|
-
|
|
872
|
+
case 58:
|
|
873
|
+
_context3.next = 64;
|
|
841
874
|
break;
|
|
842
|
-
case
|
|
843
|
-
|
|
844
|
-
|
|
875
|
+
case 60:
|
|
876
|
+
_context3.prev = 60;
|
|
877
|
+
_context3.t0 = _context3["catch"](1);
|
|
845
878
|
sentryHub.withScope(function (scope) {
|
|
846
879
|
scope.setSpan(artifactBundleUploadTransaction);
|
|
847
880
|
sentryHub.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
848
881
|
});
|
|
849
|
-
handleRecoverableError(
|
|
850
|
-
case
|
|
851
|
-
|
|
882
|
+
handleRecoverableError(_context3.t0);
|
|
883
|
+
case 64:
|
|
884
|
+
_context3.prev = 64;
|
|
852
885
|
if (folderToCleanUp) {
|
|
853
886
|
cleanupSpan = artifactBundleUploadTransaction.startChild({
|
|
854
887
|
description: "cleanup"
|
|
@@ -860,22 +893,22 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
860
893
|
cleanupSpan.finish();
|
|
861
894
|
}
|
|
862
895
|
artifactBundleUploadTransaction.finish();
|
|
863
|
-
|
|
896
|
+
_context3.next = 69;
|
|
864
897
|
return sentryClient.flush();
|
|
865
|
-
case
|
|
866
|
-
return
|
|
867
|
-
case
|
|
898
|
+
case 69:
|
|
899
|
+
return _context3.finish(64);
|
|
900
|
+
case 70:
|
|
868
901
|
case "end":
|
|
869
|
-
return
|
|
902
|
+
return _context3.stop();
|
|
870
903
|
}
|
|
871
|
-
},
|
|
904
|
+
}, _callee3, null, [[1, 60, 64, 70]]);
|
|
872
905
|
}));
|
|
873
906
|
return function (_x) {
|
|
874
907
|
return _ref2.apply(this, arguments);
|
|
875
908
|
};
|
|
876
909
|
}();
|
|
877
910
|
}
|
|
878
|
-
function prepareBundleForDebugIdUpload(
|
|
911
|
+
function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6) {
|
|
879
912
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
880
913
|
}
|
|
881
914
|
|
|
@@ -886,64 +919,66 @@ function prepareBundleForDebugIdUpload(_x4, _x5, _x6, _x7, _x8) {
|
|
|
886
919
|
* The string pattern is injected via the debug ID injection snipped.
|
|
887
920
|
*/
|
|
888
921
|
function _prepareBundleForDebugIdUpload() {
|
|
889
|
-
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
922
|
+
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook) {
|
|
890
923
|
var bundleContent, debugId, uniqueUploadName, writeSourceFilePromise, writeSourceMapFilePromise;
|
|
891
|
-
return _regeneratorRuntime().wrap(function
|
|
892
|
-
while (1) switch (
|
|
924
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
925
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
893
926
|
case 0:
|
|
894
|
-
|
|
895
|
-
|
|
927
|
+
_context5.prev = 0;
|
|
928
|
+
_context5.next = 3;
|
|
896
929
|
return promisify(fs__default.readFile)(bundleFilePath, "utf8");
|
|
897
930
|
case 3:
|
|
898
|
-
bundleContent =
|
|
899
|
-
|
|
931
|
+
bundleContent = _context5.sent;
|
|
932
|
+
_context5.next = 10;
|
|
900
933
|
break;
|
|
901
934
|
case 6:
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
logger.error("Could not read bundle to determine debug ID and source map: ".concat(bundleFilePath),
|
|
905
|
-
return
|
|
935
|
+
_context5.prev = 6;
|
|
936
|
+
_context5.t0 = _context5["catch"](0);
|
|
937
|
+
logger.error("Could not read bundle to determine debug ID and source map: ".concat(bundleFilePath), _context5.t0);
|
|
938
|
+
return _context5.abrupt("return");
|
|
906
939
|
case 10:
|
|
907
940
|
debugId = determineDebugIdFromBundleSource(bundleContent);
|
|
908
941
|
if (!(debugId === undefined)) {
|
|
909
|
-
|
|
942
|
+
_context5.next = 14;
|
|
910
943
|
break;
|
|
911
944
|
}
|
|
912
945
|
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));
|
|
913
|
-
return
|
|
946
|
+
return _context5.abrupt("return");
|
|
914
947
|
case 14:
|
|
915
948
|
uniqueUploadName = "".concat(debugId, "-").concat(chunkIndex);
|
|
916
949
|
bundleContent += "\n//# debugId=".concat(debugId);
|
|
917
950
|
writeSourceFilePromise = fs__default.promises.writeFile(path__default.join(uploadFolder, "".concat(uniqueUploadName, ".js")), bundleContent, "utf-8");
|
|
918
951
|
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
|
|
919
|
-
var
|
|
920
|
-
return _regeneratorRuntime().wrap(function
|
|
921
|
-
while (1) switch (
|
|
952
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sourceMapPath) {
|
|
953
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
954
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
922
955
|
case 0:
|
|
923
956
|
if (!sourceMapPath) {
|
|
924
|
-
|
|
957
|
+
_context4.next = 3;
|
|
925
958
|
break;
|
|
926
959
|
}
|
|
927
|
-
|
|
960
|
+
_context4.next = 3;
|
|
928
961
|
return prepareSourceMapForDebugIdUpload(sourceMapPath, path__default.join(uploadFolder, "".concat(uniqueUploadName, ".js.map")), debugId, rewriteSourcesHook, logger);
|
|
929
962
|
case 3:
|
|
930
|
-
return _context3.abrupt("return", _context3.sent);
|
|
931
|
-
case 4:
|
|
932
963
|
case "end":
|
|
933
|
-
return
|
|
964
|
+
return _context4.stop();
|
|
934
965
|
}
|
|
935
|
-
},
|
|
966
|
+
}, _callee4);
|
|
936
967
|
}));
|
|
937
|
-
return function (
|
|
938
|
-
return
|
|
968
|
+
return function (_x15) {
|
|
969
|
+
return _ref6.apply(this, arguments);
|
|
939
970
|
};
|
|
940
971
|
}());
|
|
941
|
-
|
|
942
|
-
|
|
972
|
+
_context5.next = 20;
|
|
973
|
+
return writeSourceFilePromise;
|
|
974
|
+
case 20:
|
|
975
|
+
_context5.next = 22;
|
|
976
|
+
return writeSourceMapFilePromise;
|
|
977
|
+
case 22:
|
|
943
978
|
case "end":
|
|
944
|
-
return
|
|
979
|
+
return _context5.stop();
|
|
945
980
|
}
|
|
946
|
-
},
|
|
981
|
+
}, _callee5, null, [[0, 6]]);
|
|
947
982
|
}));
|
|
948
983
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
949
984
|
}
|
|
@@ -961,114 +996,143 @@ function determineDebugIdFromBundleSource(code) {
|
|
|
961
996
|
*
|
|
962
997
|
* @returns the path to the bundle's source map or `undefined` if none could be found.
|
|
963
998
|
*/
|
|
964
|
-
function determineSourceMapPathFromBundle(
|
|
999
|
+
function determineSourceMapPathFromBundle(_x7, _x8, _x9) {
|
|
965
1000
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
966
1001
|
}
|
|
967
1002
|
/**
|
|
968
1003
|
* Reads a source map, injects debug ID fields, and writes the source map to the target path.
|
|
969
1004
|
*/
|
|
970
1005
|
function _determineSourceMapPathFromBundle() {
|
|
971
|
-
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
972
|
-
var sourceMappingUrlMatch, sourceMappingUrl, adjacentSourceMapFilePath;
|
|
973
|
-
return _regeneratorRuntime().wrap(function
|
|
974
|
-
while (1) switch (
|
|
1006
|
+
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(bundlePath, bundleSource, logger) {
|
|
1007
|
+
var sourceMappingUrlMatch, sourceMappingUrl, isUrl, isSupportedUrl, url, absoluteSourceMapPath, adjacentSourceMapFilePath;
|
|
1008
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
1009
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
975
1010
|
case 0:
|
|
976
1011
|
// 1. try to find source map at `sourceMappingURL` location
|
|
977
|
-
sourceMappingUrlMatch = bundleSource.match(
|
|
1012
|
+
sourceMappingUrlMatch = bundleSource.match(/^\s*\/\/# sourceMappingURL=(.*)$/m);
|
|
978
1013
|
if (!sourceMappingUrlMatch) {
|
|
979
|
-
|
|
1014
|
+
_context6.next = 21;
|
|
980
1015
|
break;
|
|
981
1016
|
}
|
|
982
1017
|
sourceMappingUrl = path__default.normalize(sourceMappingUrlMatch[1]);
|
|
983
|
-
|
|
984
|
-
|
|
1018
|
+
try {
|
|
1019
|
+
url = new URL(sourceMappingUrl);
|
|
1020
|
+
isUrl = true;
|
|
1021
|
+
isSupportedUrl = url.protocol === "file:";
|
|
1022
|
+
} catch (_unused) {
|
|
1023
|
+
isUrl = false;
|
|
1024
|
+
isSupportedUrl = false;
|
|
1025
|
+
}
|
|
1026
|
+
if (!isSupportedUrl) {
|
|
1027
|
+
_context6.next = 8;
|
|
985
1028
|
break;
|
|
986
1029
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1030
|
+
absoluteSourceMapPath = sourceMappingUrl;
|
|
1031
|
+
_context6.next = 13;
|
|
1032
|
+
break;
|
|
990
1033
|
case 8:
|
|
991
|
-
|
|
1034
|
+
if (!isUrl) {
|
|
1035
|
+
_context6.next = 12;
|
|
1036
|
+
break;
|
|
1037
|
+
}
|
|
1038
|
+
return _context6.abrupt("return");
|
|
1039
|
+
case 12:
|
|
1040
|
+
if (path__default.isAbsolute(sourceMappingUrl)) {
|
|
1041
|
+
absoluteSourceMapPath = sourceMappingUrl;
|
|
1042
|
+
} else {
|
|
1043
|
+
absoluteSourceMapPath = path__default.join(path__default.dirname(bundlePath), sourceMappingUrl);
|
|
1044
|
+
}
|
|
1045
|
+
case 13:
|
|
1046
|
+
_context6.prev = 13;
|
|
1047
|
+
_context6.next = 16;
|
|
1048
|
+
return util.promisify(fs__default.access)(absoluteSourceMapPath);
|
|
1049
|
+
case 16:
|
|
1050
|
+
return _context6.abrupt("return", absoluteSourceMapPath);
|
|
1051
|
+
case 19:
|
|
1052
|
+
_context6.prev = 19;
|
|
1053
|
+
_context6.t0 = _context6["catch"](13);
|
|
1054
|
+
case 21:
|
|
1055
|
+
_context6.prev = 21;
|
|
992
1056
|
adjacentSourceMapFilePath = bundlePath + ".map";
|
|
993
|
-
|
|
1057
|
+
_context6.next = 25;
|
|
994
1058
|
return util.promisify(fs__default.access)(adjacentSourceMapFilePath);
|
|
995
|
-
case
|
|
996
|
-
return
|
|
997
|
-
case
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
case
|
|
1059
|
+
case 25:
|
|
1060
|
+
return _context6.abrupt("return", adjacentSourceMapFilePath);
|
|
1061
|
+
case 28:
|
|
1062
|
+
_context6.prev = 28;
|
|
1063
|
+
_context6.t1 = _context6["catch"](21);
|
|
1064
|
+
case 30:
|
|
1001
1065
|
// This is just a debug message because it can be quite spammy for some frameworks
|
|
1002
1066
|
logger.debug("Could not determine source map path for bundle: ".concat(bundlePath, " - Did you turn on source map generation in your bundler?"));
|
|
1003
|
-
return
|
|
1004
|
-
case
|
|
1067
|
+
return _context6.abrupt("return", undefined);
|
|
1068
|
+
case 32:
|
|
1005
1069
|
case "end":
|
|
1006
|
-
return
|
|
1070
|
+
return _context6.stop();
|
|
1007
1071
|
}
|
|
1008
|
-
},
|
|
1072
|
+
}, _callee6, null, [[13, 19], [21, 28]]);
|
|
1009
1073
|
}));
|
|
1010
1074
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
1011
1075
|
}
|
|
1012
|
-
function prepareSourceMapForDebugIdUpload(
|
|
1076
|
+
function prepareSourceMapForDebugIdUpload(_x10, _x11, _x12, _x13, _x14) {
|
|
1013
1077
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
1014
1078
|
}
|
|
1015
1079
|
function _prepareSourceMapForDebugIdUpload() {
|
|
1016
|
-
_prepareSourceMapForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
1080
|
+
_prepareSourceMapForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(sourceMapPath, targetPath, debugId, rewriteSourcesHook, logger) {
|
|
1017
1081
|
var sourceMapFileContent, map;
|
|
1018
|
-
return _regeneratorRuntime().wrap(function
|
|
1019
|
-
while (1) switch (
|
|
1082
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
1083
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
1020
1084
|
case 0:
|
|
1021
|
-
|
|
1022
|
-
|
|
1085
|
+
_context7.prev = 0;
|
|
1086
|
+
_context7.next = 3;
|
|
1023
1087
|
return util.promisify(fs__default.readFile)(sourceMapPath, {
|
|
1024
1088
|
encoding: "utf8"
|
|
1025
1089
|
});
|
|
1026
1090
|
case 3:
|
|
1027
|
-
sourceMapFileContent =
|
|
1028
|
-
|
|
1091
|
+
sourceMapFileContent = _context7.sent;
|
|
1092
|
+
_context7.next = 10;
|
|
1029
1093
|
break;
|
|
1030
1094
|
case 6:
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
logger.error("Failed to read source map for debug ID upload: ".concat(sourceMapPath),
|
|
1034
|
-
return
|
|
1095
|
+
_context7.prev = 6;
|
|
1096
|
+
_context7.t0 = _context7["catch"](0);
|
|
1097
|
+
logger.error("Failed to read source map for debug ID upload: ".concat(sourceMapPath), _context7.t0);
|
|
1098
|
+
return _context7.abrupt("return");
|
|
1035
1099
|
case 10:
|
|
1036
|
-
|
|
1100
|
+
_context7.prev = 10;
|
|
1037
1101
|
map = JSON.parse(sourceMapFileContent);
|
|
1038
1102
|
// For now we write both fields until we know what will become the standard - if ever.
|
|
1039
1103
|
map["debug_id"] = debugId;
|
|
1040
1104
|
map["debugId"] = debugId;
|
|
1041
|
-
|
|
1105
|
+
_context7.next = 20;
|
|
1042
1106
|
break;
|
|
1043
1107
|
case 16:
|
|
1044
|
-
|
|
1045
|
-
|
|
1108
|
+
_context7.prev = 16;
|
|
1109
|
+
_context7.t1 = _context7["catch"](10);
|
|
1046
1110
|
logger.error("Failed to parse source map for debug ID upload: ".concat(sourceMapPath));
|
|
1047
|
-
return
|
|
1111
|
+
return _context7.abrupt("return");
|
|
1048
1112
|
case 20:
|
|
1049
1113
|
if (map["sources"] && Array.isArray(map["sources"])) {
|
|
1050
1114
|
map["sources"].map(function (source) {
|
|
1051
1115
|
return rewriteSourcesHook(source, map);
|
|
1052
1116
|
});
|
|
1053
1117
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1118
|
+
_context7.prev = 21;
|
|
1119
|
+
_context7.next = 24;
|
|
1056
1120
|
return util.promisify(fs__default.writeFile)(targetPath, JSON.stringify(map), {
|
|
1057
1121
|
encoding: "utf8"
|
|
1058
1122
|
});
|
|
1059
1123
|
case 24:
|
|
1060
|
-
|
|
1124
|
+
_context7.next = 30;
|
|
1061
1125
|
break;
|
|
1062
1126
|
case 26:
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath),
|
|
1066
|
-
return
|
|
1127
|
+
_context7.prev = 26;
|
|
1128
|
+
_context7.t2 = _context7["catch"](21);
|
|
1129
|
+
logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath), _context7.t2);
|
|
1130
|
+
return _context7.abrupt("return");
|
|
1067
1131
|
case 30:
|
|
1068
1132
|
case "end":
|
|
1069
|
-
return
|
|
1133
|
+
return _context7.stop();
|
|
1070
1134
|
}
|
|
1071
|
-
},
|
|
1135
|
+
}, _callee7, null, [[0, 6], [10, 16], [21, 26]]);
|
|
1072
1136
|
}));
|
|
1073
1137
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
1074
1138
|
}
|
|
@@ -1269,7 +1333,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
1269
1333
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
1270
1334
|
tracesSampleRate: 1,
|
|
1271
1335
|
sampleRate: 1,
|
|
1272
|
-
release: "2.
|
|
1336
|
+
release: "2.7.0",
|
|
1273
1337
|
integrations: [],
|
|
1274
1338
|
tracePropagationTargets: ["sentry.io/api"],
|
|
1275
1339
|
stackParser: defaultStackParser,
|
|
@@ -1501,7 +1565,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1501
1565
|
});
|
|
1502
1566
|
|
|
1503
1567
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
1504
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.
|
|
1568
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.7.0");
|
|
1505
1569
|
function handleRecoverableError(unknownError) {
|
|
1506
1570
|
sentrySession.status = "abnormal";
|
|
1507
1571
|
try {
|
|
@@ -1700,11 +1764,19 @@ function createRollupReleaseInjectionHooks(injectionCode) {
|
|
|
1700
1764
|
ms.append("\n\n;import \"".concat(virtualReleaseInjectionFileId, "\";"));
|
|
1701
1765
|
return {
|
|
1702
1766
|
code: ms.toString(),
|
|
1703
|
-
map: ms.generateMap(
|
|
1767
|
+
map: ms.generateMap({
|
|
1768
|
+
hires: true
|
|
1769
|
+
})
|
|
1704
1770
|
};
|
|
1705
1771
|
}
|
|
1706
1772
|
};
|
|
1707
1773
|
}
|
|
1774
|
+
|
|
1775
|
+
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
1776
|
+
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
1777
|
+
var COMMENT_USE_STRICT_REGEX =
|
|
1778
|
+
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
1779
|
+
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
1708
1780
|
function createRollupDebugIdInjectionHooks() {
|
|
1709
1781
|
return {
|
|
1710
1782
|
renderChunk: function renderChunk(code, chunk) {
|
|
@@ -1718,13 +1790,7 @@ function createRollupDebugIdInjectionHooks() {
|
|
|
1718
1790
|
var ms = new MagicString(code, {
|
|
1719
1791
|
filename: chunk.fileName
|
|
1720
1792
|
});
|
|
1721
|
-
|
|
1722
|
-
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
1723
|
-
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
1724
|
-
var commentUseStrictRegex =
|
|
1725
|
-
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
1726
|
-
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
1727
|
-
var match = (_code$match = code.match(commentUseStrictRegex)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
1793
|
+
var match = (_code$match = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
1728
1794
|
if (match) {
|
|
1729
1795
|
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
1730
1796
|
ms.appendLeft(match.length, codeToInject);
|
|
@@ -1737,7 +1803,43 @@ function createRollupDebugIdInjectionHooks() {
|
|
|
1737
1803
|
return {
|
|
1738
1804
|
code: ms.toString(),
|
|
1739
1805
|
map: ms.generateMap({
|
|
1740
|
-
file: chunk.fileName
|
|
1806
|
+
file: chunk.fileName,
|
|
1807
|
+
hires: true
|
|
1808
|
+
})
|
|
1809
|
+
};
|
|
1810
|
+
} else {
|
|
1811
|
+
return null; // returning null means not modifying the chunk at all
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
1818
|
+
return {
|
|
1819
|
+
renderChunk: function renderChunk(code, chunk) {
|
|
1820
|
+
if ([".js", ".mjs", ".cjs"].some(function (ending) {
|
|
1821
|
+
return chunk.fileName.endsWith(ending);
|
|
1822
|
+
}) // chunks could be any file (html, md, ...)
|
|
1823
|
+
) {
|
|
1824
|
+
var _code$match2;
|
|
1825
|
+
var ms = new MagicString(code, {
|
|
1826
|
+
filename: chunk.fileName
|
|
1827
|
+
});
|
|
1828
|
+
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
1829
|
+
if (match) {
|
|
1830
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
1831
|
+
ms.appendLeft(match.length, injectionCode);
|
|
1832
|
+
} else {
|
|
1833
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
1834
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
1835
|
+
// need this special case here.
|
|
1836
|
+
ms.prepend(injectionCode);
|
|
1837
|
+
}
|
|
1838
|
+
return {
|
|
1839
|
+
code: ms.toString(),
|
|
1840
|
+
map: ms.generateMap({
|
|
1841
|
+
file: chunk.fileName,
|
|
1842
|
+
hires: true
|
|
1741
1843
|
})
|
|
1742
1844
|
};
|
|
1743
1845
|
} else {
|
|
@@ -1802,5 +1904,5 @@ function getDebugIdSnippet(debugId) {
|
|
|
1802
1904
|
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){}}();");
|
|
1803
1905
|
}
|
|
1804
1906
|
|
|
1805
|
-
export { createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupReleaseInjectionHooks, getBuildInformation, getDebugIdSnippet, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
1907
|
+
export { createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, getBuildInformation, getDebugIdSnippet, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
1806
1908
|
//# sourceMappingURL=index.mjs.map
|