@sentry/bundler-plugin-core 2.17.0 → 2.18.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 +37 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +37 -15
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/options-mapping.d.ts +8 -1
- package/dist/types/options-mapping.d.ts.map +1 -1
- package/dist/types/sentry/telemetry.d.ts.map +1 -1
- package/dist/types/types.d.ts +40 -5
- package/dist/types/types.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
|
@@ -659,7 +659,8 @@ function generateGlobalInjectorCode(_ref2) {
|
|
|
659
659
|
function generateModuleMetadataInjectorCode(metadata) {
|
|
660
660
|
// The code below is mostly ternary operators because it saves bundle size.
|
|
661
661
|
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
662
|
-
|
|
662
|
+
// We are merging the metadata objects in case modules are bundled twice with the plugin
|
|
663
|
+
return "{\n var _sentryModuleMetadataGlobal =\n typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\n : typeof self !== \"undefined\"\n ? self\n : {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata =\n _sentryModuleMetadataGlobal._sentryModuleMetadata || {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new Error().stack] =\n Object.assign(\n {},\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new Error().stack],\n ".concat(JSON.stringify(metadata), "\n );\n}");
|
|
663
664
|
}
|
|
664
665
|
function getBuildInformation$1() {
|
|
665
666
|
var packageJson = getPackageJson();
|
|
@@ -700,7 +701,7 @@ function replaceBooleanFlagsInCode(code, replacementValues) {
|
|
|
700
701
|
|
|
701
702
|
var SENTRY_SAAS_URL = "https://sentry.io";
|
|
702
703
|
function normalizeUserOptions(userOptions) {
|
|
703
|
-
var _userOptions$org, _userOptions$project, _userOptions$authToke, _ref, _userOptions$url, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$disable, _ref2, _userOptions$release$, _userOptions$release, _userOptions$release$2, _userOptions$release2, _userOptions$release$3, _userOptions$release3, _userOptions$release$4, _userOptions$release4, _ref3, _userOptions$release$5, _userOptions$release5, _userOptions$_experim;
|
|
704
|
+
var _userOptions$org, _userOptions$project, _userOptions$authToke, _ref, _userOptions$url, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$disable, _ref2, _userOptions$release$, _userOptions$release, _userOptions$release$2, _userOptions$release2, _userOptions$release$3, _userOptions$release3, _userOptions$release$4, _userOptions$release4, _ref3, _userOptions$release$5, _userOptions$release5, _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$_experim, _userOptions$_experim2;
|
|
704
705
|
var options = {
|
|
705
706
|
org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
|
|
706
707
|
project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
|
|
@@ -722,7 +723,14 @@ function normalizeUserOptions(userOptions) {
|
|
|
722
723
|
}),
|
|
723
724
|
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
|
|
724
725
|
reactComponentAnnotation: userOptions.reactComponentAnnotation,
|
|
725
|
-
|
|
726
|
+
_metaOptions: {
|
|
727
|
+
telemetry: {
|
|
728
|
+
metaFramework: (_userOptions$_metaOpt = userOptions._metaOptions) === null || _userOptions$_metaOpt === void 0 ? void 0 : (_userOptions$_metaOpt2 = _userOptions$_metaOpt.telemetry) === null || _userOptions$_metaOpt2 === void 0 ? void 0 : _userOptions$_metaOpt2.metaFramework
|
|
729
|
+
}
|
|
730
|
+
},
|
|
731
|
+
applicationKey: userOptions.applicationKey,
|
|
732
|
+
moduleMetadata: userOptions.moduleMetadata || ((_userOptions$_experim = userOptions._experiments) === null || _userOptions$_experim === void 0 ? void 0 : _userOptions$_experim.moduleMetadata),
|
|
733
|
+
_experiments: (_userOptions$_experim2 = userOptions._experiments) !== null && _userOptions$_experim2 !== void 0 ? _userOptions$_experim2 : {}
|
|
726
734
|
};
|
|
727
735
|
return options;
|
|
728
736
|
}
|
|
@@ -13604,7 +13612,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
13604
13612
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
13605
13613
|
tracesSampleRate: 1,
|
|
13606
13614
|
sampleRate: 1,
|
|
13607
|
-
release: "2.
|
|
13615
|
+
release: "2.18.0",
|
|
13608
13616
|
integrations: [],
|
|
13609
13617
|
tracePropagationTargets: ["sentry.io/api"],
|
|
13610
13618
|
stackParser: defaultStackParser,
|
|
@@ -13665,6 +13673,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
13665
13673
|
};
|
|
13666
13674
|
}
|
|
13667
13675
|
function setTelemetryDataOnHub(options, hub, bundler) {
|
|
13676
|
+
var _options$_metaOptions;
|
|
13668
13677
|
var org = options.org,
|
|
13669
13678
|
project = options.project,
|
|
13670
13679
|
release = options.release,
|
|
@@ -13675,7 +13684,7 @@ function setTelemetryDataOnHub(options, hub, bundler) {
|
|
|
13675
13684
|
if (release.uploadLegacySourcemaps) {
|
|
13676
13685
|
hub.setTag("uploadLegacySourcemapsEntries", Array.isArray(release.uploadLegacySourcemaps) ? release.uploadLegacySourcemaps.length : 1);
|
|
13677
13686
|
}
|
|
13678
|
-
hub.setTag("module-metadata", !!options.
|
|
13687
|
+
hub.setTag("module-metadata", !!options.moduleMetadata);
|
|
13679
13688
|
hub.setTag("inject-build-information", !!options._experiments.injectBuildInformation);
|
|
13680
13689
|
|
|
13681
13690
|
// Optional release pipeline steps
|
|
@@ -13694,6 +13703,7 @@ function setTelemetryDataOnHub(options, hub, bundler) {
|
|
|
13694
13703
|
hub.setTag("react-annotate", !!(reactComponentAnnotation !== null && reactComponentAnnotation !== void 0 && reactComponentAnnotation.enabled));
|
|
13695
13704
|
hub.setTag("node", process.version);
|
|
13696
13705
|
hub.setTag("platform", process.platform);
|
|
13706
|
+
hub.setTag("meta-framework", (_options$_metaOptions = options._metaOptions.telemetry.metaFramework) !== null && _options$_metaOptions !== void 0 ? _options$_metaOptions : "none");
|
|
13697
13707
|
hub.setTags({
|
|
13698
13708
|
organization: org,
|
|
13699
13709
|
project: project,
|
|
@@ -14467,7 +14477,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14467
14477
|
debugIdUploadPlugin = _ref.debugIdUploadPlugin,
|
|
14468
14478
|
bundleSizeOptimizationsPlugin = _ref.bundleSizeOptimizationsPlugin;
|
|
14469
14479
|
return unplugin.createUnplugin(function () {
|
|
14470
|
-
var _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$silent, _userOptions$debug;
|
|
14480
|
+
var _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$silent, _userOptions$debug, _userOptions$_experim;
|
|
14471
14481
|
var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
14472
14482
|
var unpluginMetaContext = arguments.length > 1 ? arguments[1] : undefined;
|
|
14473
14483
|
var logger = createLogger({
|
|
@@ -14488,6 +14498,11 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14488
14498
|
}
|
|
14489
14499
|
}
|
|
14490
14500
|
var options = normalizeUserOptions(userOptions);
|
|
14501
|
+
|
|
14502
|
+
// TODO(v3): Remove this warning
|
|
14503
|
+
if ((_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 && _userOptions$_experim.moduleMetadata) {
|
|
14504
|
+
logger.warn("The `_experiments.moduleMetadata` option has been promoted to being stable. You can safely move the option out of the `_experiments` object scope.");
|
|
14505
|
+
}
|
|
14491
14506
|
if (unpluginMetaContext.watchMode || options.disable) {
|
|
14492
14507
|
return [{
|
|
14493
14508
|
name: "sentry-noop-plugin"
|
|
@@ -14509,7 +14524,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14509
14524
|
});
|
|
14510
14525
|
|
|
14511
14526
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
14512
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.
|
|
14527
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.18.0");
|
|
14513
14528
|
function handleRecoverableError(unknownError) {
|
|
14514
14529
|
sentrySession.status = "abnormal";
|
|
14515
14530
|
try {
|
|
@@ -14581,24 +14596,31 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14581
14596
|
});
|
|
14582
14597
|
plugins.push(releaseInjectionPlugin(_injectionCode));
|
|
14583
14598
|
}
|
|
14584
|
-
if (
|
|
14585
|
-
var metadata;
|
|
14586
|
-
if (
|
|
14599
|
+
if (options.moduleMetadata || options.applicationKey) {
|
|
14600
|
+
var metadata = {};
|
|
14601
|
+
if (options.applicationKey) {
|
|
14602
|
+
// We use different keys so that if user-code receives multiple bundling passes, we will store the application keys of all the passes.
|
|
14603
|
+
// It is a bit unfortunate that we have to inject the metadata snippet at the top, because after multiple
|
|
14604
|
+
// injections, the first injection will always "win" because it comes last in the code. We would generally be
|
|
14605
|
+
// fine with making the last bundling pass win. But because it cannot win, we have to use a workaround of storing
|
|
14606
|
+
// the app keys in different object keys.
|
|
14607
|
+
// We can simply use the `_sentryBundlerPluginAppKey:` to filter for app keys in the SDK.
|
|
14608
|
+
metadata["_sentryBundlerPluginAppKey:".concat(options.applicationKey)] = true;
|
|
14609
|
+
}
|
|
14610
|
+
if (typeof options.moduleMetadata === "function") {
|
|
14587
14611
|
var args = {
|
|
14588
14612
|
org: options.org,
|
|
14589
14613
|
project: options.project,
|
|
14590
14614
|
release: options.release.name
|
|
14591
14615
|
};
|
|
14592
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
14593
|
-
metadata = options.
|
|
14616
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
14617
|
+
metadata = _objectSpread2(_objectSpread2({}, metadata), options.moduleMetadata(args));
|
|
14594
14618
|
} else {
|
|
14595
14619
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
14596
|
-
metadata = options.
|
|
14620
|
+
metadata = _objectSpread2(_objectSpread2({}, metadata), options.moduleMetadata);
|
|
14597
14621
|
}
|
|
14598
14622
|
var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
|
|
14599
14623
|
plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
|
|
14600
|
-
} else if (options._experiments.moduleMetadata) {
|
|
14601
|
-
logger.warn("'moduleMetadata' is currently only supported by '@sentry/webpack-plugin'");
|
|
14602
14624
|
}
|
|
14603
14625
|
if (!options.release.name) {
|
|
14604
14626
|
logger.warn("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
|