@sentry/bundler-plugin-core 3.6.1 → 4.0.1
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 +54 -75
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +55 -75
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +6 -13
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -7853,12 +7853,13 @@ function generateGlobalInjectorCode(_ref2) {
|
|
|
7853
7853
|
injectBuildInformation = _ref2.injectBuildInformation;
|
|
7854
7854
|
// The code below is mostly ternary operators because it saves bundle size.
|
|
7855
7855
|
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
7856
|
-
var code = "{
|
|
7856
|
+
var code = "!function(){var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{};";
|
|
7857
|
+
code += "e.SENTRY_RELEASE={id:".concat(JSON.stringify(release), "};");
|
|
7857
7858
|
if (injectBuildInformation) {
|
|
7858
|
-
var buildInfo = getBuildInformation
|
|
7859
|
-
code += "
|
|
7859
|
+
var buildInfo = getBuildInformation();
|
|
7860
|
+
code += "e.SENTRY_BUILD_INFO=".concat(JSON.stringify(buildInfo), ";");
|
|
7860
7861
|
}
|
|
7861
|
-
code += "}";
|
|
7862
|
+
code += "}();";
|
|
7862
7863
|
return code;
|
|
7863
7864
|
}
|
|
7864
7865
|
|
|
@@ -7867,9 +7868,9 @@ function generateModuleMetadataInjectorCode(metadata) {
|
|
|
7867
7868
|
// The code below is mostly ternary operators because it saves bundle size.
|
|
7868
7869
|
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
7869
7870
|
// We are merging the metadata objects in case modules are bundled twice with the plugin
|
|
7870
|
-
return "{
|
|
7871
|
+
return "!function(){var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=Object.assign({},e._sentryModuleMetadata[(new e.Error).stack],".concat(JSON.stringify(metadata), ")}();");
|
|
7871
7872
|
}
|
|
7872
|
-
function getBuildInformation
|
|
7873
|
+
function getBuildInformation() {
|
|
7873
7874
|
var packageJson = getPackageJson();
|
|
7874
7875
|
var _ref3 = packageJson ? getDependencies(packageJson) : {
|
|
7875
7876
|
deps: [],
|
|
@@ -8195,7 +8196,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
|
8195
8196
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8196
8197
|
tracesSampleRate: 1,
|
|
8197
8198
|
sampleRate: 1,
|
|
8198
|
-
release: "
|
|
8199
|
+
release: "4.0.1",
|
|
8199
8200
|
integrations: [],
|
|
8200
8201
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8201
8202
|
stackParser: stackParser,
|
|
@@ -8771,7 +8772,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8771
8772
|
});
|
|
8772
8773
|
|
|
8773
8774
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8774
|
-
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "
|
|
8775
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.0.1");
|
|
8775
8776
|
|
|
8776
8777
|
// Not a bulletproof check but should be good enough to at least sometimes determine
|
|
8777
8778
|
// if the plugin is called in dev/watch mode or for a prod build. The important part
|
|
@@ -9648,13 +9649,6 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9648
9649
|
});
|
|
9649
9650
|
}
|
|
9650
9651
|
|
|
9651
|
-
/**
|
|
9652
|
-
* @deprecated This will be removed in v4
|
|
9653
|
-
*/
|
|
9654
|
-
// TODO(v4): Don't export this from the package but keep the utils version
|
|
9655
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
9656
|
-
var getBuildInformation = getBuildInformation$1;
|
|
9657
|
-
|
|
9658
9652
|
/**
|
|
9659
9653
|
* Determines whether the Sentry CLI binary is in its expected location.
|
|
9660
9654
|
* This function is useful since `@sentry/cli` installs the binary via a post-install
|
|
@@ -9663,56 +9657,55 @@ var getBuildInformation = getBuildInformation$1;
|
|
|
9663
9657
|
function sentryCliBinaryExists() {
|
|
9664
9658
|
return fs__namespace.existsSync(SentryCli__default["default"].getPath());
|
|
9665
9659
|
}
|
|
9660
|
+
|
|
9661
|
+
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
9662
|
+
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
9663
|
+
var COMMENT_USE_STRICT_REGEX =
|
|
9664
|
+
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
9665
|
+
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
9666
|
+
|
|
9667
|
+
/**
|
|
9668
|
+
* Simplified `renderChunk` hook type from Rollup.
|
|
9669
|
+
* We can't reference the type directly because the Vite plugin complains
|
|
9670
|
+
* about type mismatches
|
|
9671
|
+
*/
|
|
9672
|
+
|
|
9666
9673
|
function createRollupReleaseInjectionHooks(injectionCode) {
|
|
9667
|
-
var virtualReleaseInjectionFileId = "\0sentry-release-injection-file";
|
|
9668
9674
|
return {
|
|
9669
|
-
|
|
9670
|
-
if (
|
|
9675
|
+
renderChunk: function renderChunk(code, chunk) {
|
|
9676
|
+
if (
|
|
9677
|
+
// chunks could be any file (html, md, ...)
|
|
9678
|
+
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9679
|
+
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9680
|
+
})) {
|
|
9681
|
+
var _code$match;
|
|
9682
|
+
var ms = new MagicString__default["default"](code, {
|
|
9683
|
+
filename: chunk.fileName
|
|
9684
|
+
});
|
|
9685
|
+
var match = (_code$match = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
9686
|
+
if (match) {
|
|
9687
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9688
|
+
ms.appendLeft(match.length, injectionCode);
|
|
9689
|
+
} else {
|
|
9690
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
9691
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
9692
|
+
// need this special case here.
|
|
9693
|
+
ms.prepend(injectionCode);
|
|
9694
|
+
}
|
|
9671
9695
|
return {
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9696
|
+
code: ms.toString(),
|
|
9697
|
+
map: ms.generateMap({
|
|
9698
|
+
file: chunk.fileName,
|
|
9699
|
+
hires: "boundary"
|
|
9700
|
+
})
|
|
9675
9701
|
};
|
|
9676
9702
|
} else {
|
|
9677
|
-
return null;
|
|
9678
|
-
}
|
|
9679
|
-
},
|
|
9680
|
-
load: function load(id) {
|
|
9681
|
-
if (id === virtualReleaseInjectionFileId) {
|
|
9682
|
-
return injectionCode;
|
|
9683
|
-
} else {
|
|
9684
|
-
return null;
|
|
9685
|
-
}
|
|
9686
|
-
},
|
|
9687
|
-
transform: function transform(code, id) {
|
|
9688
|
-
if (id === virtualReleaseInjectionFileId) {
|
|
9689
|
-
return null;
|
|
9690
|
-
}
|
|
9691
|
-
|
|
9692
|
-
// id may contain query and hash which will trip up our file extension logic below
|
|
9693
|
-
var idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
|
|
9694
|
-
if (idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
|
|
9695
|
-
return null;
|
|
9696
|
-
}
|
|
9697
|
-
if (![".js", ".ts", ".jsx", ".tsx", ".mjs"].some(function (ending) {
|
|
9698
|
-
return idWithoutQueryAndHash.endsWith(ending);
|
|
9699
|
-
})) {
|
|
9700
|
-
return null;
|
|
9703
|
+
return null; // returning null means not modifying the chunk at all
|
|
9701
9704
|
}
|
|
9702
|
-
var ms = new MagicString__default["default"](code);
|
|
9703
|
-
|
|
9704
|
-
// Appending instead of prepending has less probability of mucking with user's source maps.
|
|
9705
|
-
// Luckily import statements get hoisted to the top anyways.
|
|
9706
|
-
ms.append("\n\n;import \"".concat(virtualReleaseInjectionFileId, "\";"));
|
|
9707
|
-
return {
|
|
9708
|
-
code: ms.toString(),
|
|
9709
|
-
map: ms.generateMap({
|
|
9710
|
-
hires: "boundary"
|
|
9711
|
-
})
|
|
9712
|
-
};
|
|
9713
9705
|
}
|
|
9714
9706
|
};
|
|
9715
9707
|
}
|
|
9708
|
+
|
|
9716
9709
|
function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
9717
9710
|
return {
|
|
9718
9711
|
transform: function transform(code) {
|
|
@@ -9720,19 +9713,6 @@ function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
|
9720
9713
|
}
|
|
9721
9714
|
};
|
|
9722
9715
|
}
|
|
9723
|
-
|
|
9724
|
-
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
9725
|
-
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
9726
|
-
var COMMENT_USE_STRICT_REGEX =
|
|
9727
|
-
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
9728
|
-
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
9729
|
-
|
|
9730
|
-
/**
|
|
9731
|
-
* Simplified `renderChunk` hook type from Rollup.
|
|
9732
|
-
* We can't reference the type directly because the Vite plugin complains
|
|
9733
|
-
* about type mismatches
|
|
9734
|
-
*/
|
|
9735
|
-
|
|
9736
9716
|
function createRollupDebugIdInjectionHooks() {
|
|
9737
9717
|
return {
|
|
9738
9718
|
renderChunk: function renderChunk(code, chunk) {
|
|
@@ -9741,13 +9721,13 @@ function createRollupDebugIdInjectionHooks() {
|
|
|
9741
9721
|
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9742
9722
|
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9743
9723
|
})) {
|
|
9744
|
-
var _code$
|
|
9724
|
+
var _code$match2;
|
|
9745
9725
|
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
9746
9726
|
var codeToInject = getDebugIdSnippet(debugId);
|
|
9747
9727
|
var ms = new MagicString__default["default"](code, {
|
|
9748
9728
|
filename: chunk.fileName
|
|
9749
9729
|
});
|
|
9750
|
-
var match = (_code$
|
|
9730
|
+
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
9751
9731
|
if (match) {
|
|
9752
9732
|
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9753
9733
|
ms.appendLeft(match.length, codeToInject);
|
|
@@ -9779,11 +9759,11 @@ function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
|
9779
9759
|
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9780
9760
|
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9781
9761
|
})) {
|
|
9782
|
-
var _code$
|
|
9762
|
+
var _code$match3;
|
|
9783
9763
|
var ms = new MagicString__default["default"](code, {
|
|
9784
9764
|
filename: chunk.fileName
|
|
9785
9765
|
});
|
|
9786
|
-
var match = (_code$
|
|
9766
|
+
var match = (_code$match3 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match3 === void 0 ? void 0 : _code$match3[0];
|
|
9787
9767
|
if (match) {
|
|
9788
9768
|
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9789
9769
|
ms.appendLeft(match.length, injectionCode);
|
|
@@ -9939,7 +9919,7 @@ function createComponentNameAnnotateHooks(ignoredComponents) {
|
|
|
9939
9919
|
};
|
|
9940
9920
|
}
|
|
9941
9921
|
function getDebugIdSnippet(debugId) {
|
|
9942
|
-
return ";{try{
|
|
9922
|
+
return ";{try{(function(){var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"".concat(debugId, "\",e._sentryDebugIdIdentifier=\"sentry-dbid-").concat(debugId, "\");})();}catch(e){}};");
|
|
9943
9923
|
}
|
|
9944
9924
|
|
|
9945
9925
|
exports.createComponentNameAnnotateHooks = createComponentNameAnnotateHooks;
|
|
@@ -9949,7 +9929,6 @@ exports.createRollupDebugIdUploadHooks = createRollupDebugIdUploadHooks;
|
|
|
9949
9929
|
exports.createRollupModuleMetadataInjectionHooks = createRollupModuleMetadataInjectionHooks;
|
|
9950
9930
|
exports.createRollupReleaseInjectionHooks = createRollupReleaseInjectionHooks;
|
|
9951
9931
|
exports.createSentryBuildPluginManager = createSentryBuildPluginManager;
|
|
9952
|
-
exports.getBuildInformation = getBuildInformation;
|
|
9953
9932
|
exports.getDebugIdSnippet = getDebugIdSnippet;
|
|
9954
9933
|
exports.replaceBooleanFlagsInCode = replaceBooleanFlagsInCode;
|
|
9955
9934
|
exports.sentryCliBinaryExists = sentryCliBinaryExists;
|