@sentry/bundler-plugin-core 4.0.0 → 4.0.2
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 +52 -65
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +52 -65
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +6 -8
- 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
7859
|
var buildInfo = getBuildInformation();
|
|
7859
|
-
code += "
|
|
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,7 +7868,7 @@ 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]=function(e){for(var n=1;n<arguments.length;n++){var a=arguments[n];if(null!=a)for(var t in a)a.hasOwnProperty(t)&&(e[t]=a[t])}return e}({},e._sentryModuleMetadata[(new e.Error).stack],".concat(JSON.stringify(metadata), ")}();");
|
|
7871
7872
|
}
|
|
7872
7873
|
function getBuildInformation() {
|
|
7873
7874
|
var packageJson = getPackageJson();
|
|
@@ -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: "4.0.
|
|
8199
|
+
release: "4.0.2",
|
|
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/", "4.0.
|
|
8775
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.0.2");
|
|
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
|
|
@@ -9656,56 +9657,55 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9656
9657
|
function sentryCliBinaryExists() {
|
|
9657
9658
|
return fs__namespace.existsSync(SentryCli__default["default"].getPath());
|
|
9658
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
|
+
|
|
9659
9673
|
function createRollupReleaseInjectionHooks(injectionCode) {
|
|
9660
|
-
var virtualReleaseInjectionFileId = "\0sentry-release-injection-file";
|
|
9661
9674
|
return {
|
|
9662
|
-
|
|
9663
|
-
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
|
+
}
|
|
9664
9695
|
return {
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9696
|
+
code: ms.toString(),
|
|
9697
|
+
map: ms.generateMap({
|
|
9698
|
+
file: chunk.fileName,
|
|
9699
|
+
hires: "boundary"
|
|
9700
|
+
})
|
|
9668
9701
|
};
|
|
9669
9702
|
} else {
|
|
9670
|
-
return null;
|
|
9671
|
-
}
|
|
9672
|
-
},
|
|
9673
|
-
load: function load(id) {
|
|
9674
|
-
if (id === virtualReleaseInjectionFileId) {
|
|
9675
|
-
return injectionCode;
|
|
9676
|
-
} else {
|
|
9677
|
-
return null;
|
|
9678
|
-
}
|
|
9679
|
-
},
|
|
9680
|
-
transform: function transform(code, id) {
|
|
9681
|
-
if (id === virtualReleaseInjectionFileId) {
|
|
9682
|
-
return null;
|
|
9683
|
-
}
|
|
9684
|
-
|
|
9685
|
-
// id may contain query and hash which will trip up our file extension logic below
|
|
9686
|
-
var idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
|
|
9687
|
-
if (idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
|
|
9688
|
-
return null;
|
|
9689
|
-
}
|
|
9690
|
-
if (![".js", ".ts", ".jsx", ".tsx", ".mjs"].some(function (ending) {
|
|
9691
|
-
return idWithoutQueryAndHash.endsWith(ending);
|
|
9692
|
-
})) {
|
|
9693
|
-
return null;
|
|
9703
|
+
return null; // returning null means not modifying the chunk at all
|
|
9694
9704
|
}
|
|
9695
|
-
var ms = new MagicString__default["default"](code);
|
|
9696
|
-
|
|
9697
|
-
// Appending instead of prepending has less probability of mucking with user's source maps.
|
|
9698
|
-
// Luckily import statements get hoisted to the top anyways.
|
|
9699
|
-
ms.append("\n\n;import \"".concat(virtualReleaseInjectionFileId, "\";"));
|
|
9700
|
-
return {
|
|
9701
|
-
code: ms.toString(),
|
|
9702
|
-
map: ms.generateMap({
|
|
9703
|
-
hires: "boundary"
|
|
9704
|
-
})
|
|
9705
|
-
};
|
|
9706
9705
|
}
|
|
9707
9706
|
};
|
|
9708
9707
|
}
|
|
9708
|
+
|
|
9709
9709
|
function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
9710
9710
|
return {
|
|
9711
9711
|
transform: function transform(code) {
|
|
@@ -9713,19 +9713,6 @@ function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
|
9713
9713
|
}
|
|
9714
9714
|
};
|
|
9715
9715
|
}
|
|
9716
|
-
|
|
9717
|
-
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
9718
|
-
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
9719
|
-
var COMMENT_USE_STRICT_REGEX =
|
|
9720
|
-
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
9721
|
-
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
9722
|
-
|
|
9723
|
-
/**
|
|
9724
|
-
* Simplified `renderChunk` hook type from Rollup.
|
|
9725
|
-
* We can't reference the type directly because the Vite plugin complains
|
|
9726
|
-
* about type mismatches
|
|
9727
|
-
*/
|
|
9728
|
-
|
|
9729
9716
|
function createRollupDebugIdInjectionHooks() {
|
|
9730
9717
|
return {
|
|
9731
9718
|
renderChunk: function renderChunk(code, chunk) {
|
|
@@ -9734,13 +9721,13 @@ function createRollupDebugIdInjectionHooks() {
|
|
|
9734
9721
|
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9735
9722
|
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9736
9723
|
})) {
|
|
9737
|
-
var _code$
|
|
9724
|
+
var _code$match2;
|
|
9738
9725
|
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
9739
9726
|
var codeToInject = getDebugIdSnippet(debugId);
|
|
9740
9727
|
var ms = new MagicString__default["default"](code, {
|
|
9741
9728
|
filename: chunk.fileName
|
|
9742
9729
|
});
|
|
9743
|
-
var match = (_code$
|
|
9730
|
+
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
9744
9731
|
if (match) {
|
|
9745
9732
|
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9746
9733
|
ms.appendLeft(match.length, codeToInject);
|
|
@@ -9772,11 +9759,11 @@ function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
|
9772
9759
|
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9773
9760
|
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9774
9761
|
})) {
|
|
9775
|
-
var _code$
|
|
9762
|
+
var _code$match3;
|
|
9776
9763
|
var ms = new MagicString__default["default"](code, {
|
|
9777
9764
|
filename: chunk.fileName
|
|
9778
9765
|
});
|
|
9779
|
-
var match = (_code$
|
|
9766
|
+
var match = (_code$match3 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match3 === void 0 ? void 0 : _code$match3[0];
|
|
9780
9767
|
if (match) {
|
|
9781
9768
|
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9782
9769
|
ms.appendLeft(match.length, injectionCode);
|
|
@@ -9932,7 +9919,7 @@ function createComponentNameAnnotateHooks(ignoredComponents) {
|
|
|
9932
9919
|
};
|
|
9933
9920
|
}
|
|
9934
9921
|
function getDebugIdSnippet(debugId) {
|
|
9935
|
-
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){}};");
|
|
9936
9923
|
}
|
|
9937
9924
|
|
|
9938
9925
|
exports.createComponentNameAnnotateHooks = createComponentNameAnnotateHooks;
|