@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/esm/index.mjs
CHANGED
|
@@ -7816,12 +7816,13 @@ function generateGlobalInjectorCode(_ref2) {
|
|
|
7816
7816
|
injectBuildInformation = _ref2.injectBuildInformation;
|
|
7817
7817
|
// The code below is mostly ternary operators because it saves bundle size.
|
|
7818
7818
|
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
7819
|
-
var code = "{
|
|
7819
|
+
var code = "!function(){var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{};";
|
|
7820
|
+
code += "e.SENTRY_RELEASE={id:".concat(JSON.stringify(release), "};");
|
|
7820
7821
|
if (injectBuildInformation) {
|
|
7821
|
-
var buildInfo = getBuildInformation
|
|
7822
|
-
code += "
|
|
7822
|
+
var buildInfo = getBuildInformation();
|
|
7823
|
+
code += "e.SENTRY_BUILD_INFO=".concat(JSON.stringify(buildInfo), ";");
|
|
7823
7824
|
}
|
|
7824
|
-
code += "}";
|
|
7825
|
+
code += "}();";
|
|
7825
7826
|
return code;
|
|
7826
7827
|
}
|
|
7827
7828
|
|
|
@@ -7830,9 +7831,9 @@ function generateModuleMetadataInjectorCode(metadata) {
|
|
|
7830
7831
|
// The code below is mostly ternary operators because it saves bundle size.
|
|
7831
7832
|
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
7832
7833
|
// We are merging the metadata objects in case modules are bundled twice with the plugin
|
|
7833
|
-
return "{
|
|
7834
|
+
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), ")}();");
|
|
7834
7835
|
}
|
|
7835
|
-
function getBuildInformation
|
|
7836
|
+
function getBuildInformation() {
|
|
7836
7837
|
var packageJson = getPackageJson();
|
|
7837
7838
|
var _ref3 = packageJson ? getDependencies(packageJson) : {
|
|
7838
7839
|
deps: [],
|
|
@@ -8158,7 +8159,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
|
8158
8159
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8159
8160
|
tracesSampleRate: 1,
|
|
8160
8161
|
sampleRate: 1,
|
|
8161
|
-
release: "
|
|
8162
|
+
release: "4.0.1",
|
|
8162
8163
|
integrations: [],
|
|
8163
8164
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8164
8165
|
stackParser: stackParser,
|
|
@@ -8734,7 +8735,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8734
8735
|
});
|
|
8735
8736
|
|
|
8736
8737
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8737
|
-
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "
|
|
8738
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.0.1");
|
|
8738
8739
|
|
|
8739
8740
|
// Not a bulletproof check but should be good enough to at least sometimes determine
|
|
8740
8741
|
// if the plugin is called in dev/watch mode or for a prod build. The important part
|
|
@@ -9611,13 +9612,6 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9611
9612
|
});
|
|
9612
9613
|
}
|
|
9613
9614
|
|
|
9614
|
-
/**
|
|
9615
|
-
* @deprecated This will be removed in v4
|
|
9616
|
-
*/
|
|
9617
|
-
// TODO(v4): Don't export this from the package but keep the utils version
|
|
9618
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
9619
|
-
var getBuildInformation = getBuildInformation$1;
|
|
9620
|
-
|
|
9621
9615
|
/**
|
|
9622
9616
|
* Determines whether the Sentry CLI binary is in its expected location.
|
|
9623
9617
|
* This function is useful since `@sentry/cli` installs the binary via a post-install
|
|
@@ -9626,56 +9620,55 @@ var getBuildInformation = getBuildInformation$1;
|
|
|
9626
9620
|
function sentryCliBinaryExists() {
|
|
9627
9621
|
return fs.existsSync(SentryCli.getPath());
|
|
9628
9622
|
}
|
|
9623
|
+
|
|
9624
|
+
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
9625
|
+
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
9626
|
+
var COMMENT_USE_STRICT_REGEX =
|
|
9627
|
+
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
9628
|
+
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
9629
|
+
|
|
9630
|
+
/**
|
|
9631
|
+
* Simplified `renderChunk` hook type from Rollup.
|
|
9632
|
+
* We can't reference the type directly because the Vite plugin complains
|
|
9633
|
+
* about type mismatches
|
|
9634
|
+
*/
|
|
9635
|
+
|
|
9629
9636
|
function createRollupReleaseInjectionHooks(injectionCode) {
|
|
9630
|
-
var virtualReleaseInjectionFileId = "\0sentry-release-injection-file";
|
|
9631
9637
|
return {
|
|
9632
|
-
|
|
9633
|
-
if (
|
|
9638
|
+
renderChunk: function renderChunk(code, chunk) {
|
|
9639
|
+
if (
|
|
9640
|
+
// chunks could be any file (html, md, ...)
|
|
9641
|
+
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9642
|
+
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9643
|
+
})) {
|
|
9644
|
+
var _code$match;
|
|
9645
|
+
var ms = new MagicString(code, {
|
|
9646
|
+
filename: chunk.fileName
|
|
9647
|
+
});
|
|
9648
|
+
var match = (_code$match = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
9649
|
+
if (match) {
|
|
9650
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9651
|
+
ms.appendLeft(match.length, injectionCode);
|
|
9652
|
+
} else {
|
|
9653
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
9654
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
9655
|
+
// need this special case here.
|
|
9656
|
+
ms.prepend(injectionCode);
|
|
9657
|
+
}
|
|
9634
9658
|
return {
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9659
|
+
code: ms.toString(),
|
|
9660
|
+
map: ms.generateMap({
|
|
9661
|
+
file: chunk.fileName,
|
|
9662
|
+
hires: "boundary"
|
|
9663
|
+
})
|
|
9638
9664
|
};
|
|
9639
9665
|
} else {
|
|
9640
|
-
return null;
|
|
9641
|
-
}
|
|
9642
|
-
},
|
|
9643
|
-
load: function load(id) {
|
|
9644
|
-
if (id === virtualReleaseInjectionFileId) {
|
|
9645
|
-
return injectionCode;
|
|
9646
|
-
} else {
|
|
9647
|
-
return null;
|
|
9648
|
-
}
|
|
9649
|
-
},
|
|
9650
|
-
transform: function transform(code, id) {
|
|
9651
|
-
if (id === virtualReleaseInjectionFileId) {
|
|
9652
|
-
return null;
|
|
9653
|
-
}
|
|
9654
|
-
|
|
9655
|
-
// id may contain query and hash which will trip up our file extension logic below
|
|
9656
|
-
var idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
|
|
9657
|
-
if (idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
|
|
9658
|
-
return null;
|
|
9659
|
-
}
|
|
9660
|
-
if (![".js", ".ts", ".jsx", ".tsx", ".mjs"].some(function (ending) {
|
|
9661
|
-
return idWithoutQueryAndHash.endsWith(ending);
|
|
9662
|
-
})) {
|
|
9663
|
-
return null;
|
|
9666
|
+
return null; // returning null means not modifying the chunk at all
|
|
9664
9667
|
}
|
|
9665
|
-
var ms = new MagicString(code);
|
|
9666
|
-
|
|
9667
|
-
// Appending instead of prepending has less probability of mucking with user's source maps.
|
|
9668
|
-
// Luckily import statements get hoisted to the top anyways.
|
|
9669
|
-
ms.append("\n\n;import \"".concat(virtualReleaseInjectionFileId, "\";"));
|
|
9670
|
-
return {
|
|
9671
|
-
code: ms.toString(),
|
|
9672
|
-
map: ms.generateMap({
|
|
9673
|
-
hires: "boundary"
|
|
9674
|
-
})
|
|
9675
|
-
};
|
|
9676
9668
|
}
|
|
9677
9669
|
};
|
|
9678
9670
|
}
|
|
9671
|
+
|
|
9679
9672
|
function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
9680
9673
|
return {
|
|
9681
9674
|
transform: function transform(code) {
|
|
@@ -9683,19 +9676,6 @@ function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
|
9683
9676
|
}
|
|
9684
9677
|
};
|
|
9685
9678
|
}
|
|
9686
|
-
|
|
9687
|
-
// We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
9688
|
-
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
9689
|
-
var COMMENT_USE_STRICT_REGEX =
|
|
9690
|
-
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
|
|
9691
|
-
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
|
|
9692
|
-
|
|
9693
|
-
/**
|
|
9694
|
-
* Simplified `renderChunk` hook type from Rollup.
|
|
9695
|
-
* We can't reference the type directly because the Vite plugin complains
|
|
9696
|
-
* about type mismatches
|
|
9697
|
-
*/
|
|
9698
|
-
|
|
9699
9679
|
function createRollupDebugIdInjectionHooks() {
|
|
9700
9680
|
return {
|
|
9701
9681
|
renderChunk: function renderChunk(code, chunk) {
|
|
@@ -9704,13 +9684,13 @@ function createRollupDebugIdInjectionHooks() {
|
|
|
9704
9684
|
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9705
9685
|
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9706
9686
|
})) {
|
|
9707
|
-
var _code$
|
|
9687
|
+
var _code$match2;
|
|
9708
9688
|
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
9709
9689
|
var codeToInject = getDebugIdSnippet(debugId);
|
|
9710
9690
|
var ms = new MagicString(code, {
|
|
9711
9691
|
filename: chunk.fileName
|
|
9712
9692
|
});
|
|
9713
|
-
var match = (_code$
|
|
9693
|
+
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
9714
9694
|
if (match) {
|
|
9715
9695
|
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9716
9696
|
ms.appendLeft(match.length, codeToInject);
|
|
@@ -9742,11 +9722,11 @@ function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
|
9742
9722
|
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9743
9723
|
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9744
9724
|
})) {
|
|
9745
|
-
var _code$
|
|
9725
|
+
var _code$match3;
|
|
9746
9726
|
var ms = new MagicString(code, {
|
|
9747
9727
|
filename: chunk.fileName
|
|
9748
9728
|
});
|
|
9749
|
-
var match = (_code$
|
|
9729
|
+
var match = (_code$match3 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match3 === void 0 ? void 0 : _code$match3[0];
|
|
9750
9730
|
if (match) {
|
|
9751
9731
|
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9752
9732
|
ms.appendLeft(match.length, injectionCode);
|
|
@@ -9902,8 +9882,8 @@ function createComponentNameAnnotateHooks(ignoredComponents) {
|
|
|
9902
9882
|
};
|
|
9903
9883
|
}
|
|
9904
9884
|
function getDebugIdSnippet(debugId) {
|
|
9905
|
-
return ";{try{
|
|
9885
|
+
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){}};");
|
|
9906
9886
|
}
|
|
9907
9887
|
|
|
9908
|
-
export { createComponentNameAnnotateHooks, createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, createSentryBuildPluginManager,
|
|
9888
|
+
export { createComponentNameAnnotateHooks, createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, createSentryBuildPluginManager, getDebugIdSnippet, replaceBooleanFlagsInCode, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
9909
9889
|
//# sourceMappingURL=index.mjs.map
|