@sentry/bundler-plugin-core 2.4.0 → 2.6.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 +52 -20
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +52 -20
- 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 +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/options-mapping.d.ts +1 -0
- package/dist/types/options-mapping.d.ts.map +1 -1
- package/dist/types/plugins/release-management.d.ts +1 -1
- package/dist/types/plugins/release-management.d.ts.map +1 -1
- package/dist/types/types.d.ts +21 -1
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +6 -6
package/dist/esm/index.mjs
CHANGED
|
@@ -585,6 +585,13 @@ function generateGlobalInjectorCode(_ref2) {
|
|
|
585
585
|
}
|
|
586
586
|
return code;
|
|
587
587
|
}
|
|
588
|
+
|
|
589
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
590
|
+
function generateModuleMetadataInjectorCode(metadata) {
|
|
591
|
+
// The code below is mostly ternary operators because it saves bundle size.
|
|
592
|
+
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
593
|
+
return "\n var _global2 =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\n typeof self !== 'undefined' ?\n self :\n {};\n\n _global2._sentryModuleMetadata = _global2._sentryModuleMetadata || {};\n _global2._sentryModuleMetadata[new Error().stack] = ".concat(JSON.stringify(metadata), ";");
|
|
594
|
+
}
|
|
588
595
|
function getBuildInformation$1() {
|
|
589
596
|
var packageJson = getPackageJson();
|
|
590
597
|
var _ref3 = packageJson ? getDependencies(packageJson) : {
|
|
@@ -1259,7 +1266,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
1259
1266
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
1260
1267
|
tracesSampleRate: 1,
|
|
1261
1268
|
sampleRate: 1,
|
|
1262
|
-
release: "2.
|
|
1269
|
+
release: "2.6.0",
|
|
1263
1270
|
integrations: [],
|
|
1264
1271
|
tracePropagationTargets: ["sentry.io/api"],
|
|
1265
1272
|
stackParser: defaultStackParser,
|
|
@@ -1445,6 +1452,7 @@ function _allowedToSendTelemetry() {
|
|
|
1445
1452
|
*/
|
|
1446
1453
|
function sentryUnpluginFactory(_ref) {
|
|
1447
1454
|
var releaseInjectionPlugin = _ref.releaseInjectionPlugin,
|
|
1455
|
+
moduleMetadataInjectionPlugin = _ref.moduleMetadataInjectionPlugin,
|
|
1448
1456
|
debugIdInjectionPlugin = _ref.debugIdInjectionPlugin,
|
|
1449
1457
|
debugIdUploadPlugin = _ref.debugIdUploadPlugin;
|
|
1450
1458
|
return createUnplugin(function (userOptions, unpluginMetaContext) {
|
|
@@ -1488,7 +1496,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1488
1496
|
});
|
|
1489
1497
|
|
|
1490
1498
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
1491
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.
|
|
1499
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.6.0");
|
|
1492
1500
|
function handleRecoverableError(unknownError) {
|
|
1493
1501
|
sentrySession.status = "abnormal";
|
|
1494
1502
|
try {
|
|
@@ -1527,7 +1535,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1527
1535
|
if (!options.release.inject) {
|
|
1528
1536
|
logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
|
|
1529
1537
|
} else if (!options.release.name) {
|
|
1530
|
-
logger.warn("No release name provided. Will not inject release. Please set the `release.name` option to
|
|
1538
|
+
logger.warn("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
|
|
1531
1539
|
} else {
|
|
1532
1540
|
var _injectionCode = generateGlobalInjectorCode({
|
|
1533
1541
|
release: options.release.name,
|
|
@@ -1535,11 +1543,30 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1535
1543
|
});
|
|
1536
1544
|
plugins.push(releaseInjectionPlugin(_injectionCode));
|
|
1537
1545
|
}
|
|
1546
|
+
if (moduleMetadataInjectionPlugin && options._experiments.moduleMetadata) {
|
|
1547
|
+
var metadata;
|
|
1548
|
+
if (typeof options._experiments.moduleMetadata === "function") {
|
|
1549
|
+
var args = {
|
|
1550
|
+
org: options.org,
|
|
1551
|
+
project: options.project,
|
|
1552
|
+
release: options.release.name
|
|
1553
|
+
};
|
|
1554
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
|
|
1555
|
+
metadata = options._experiments.moduleMetadata(args);
|
|
1556
|
+
} else {
|
|
1557
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
1558
|
+
metadata = options._experiments.moduleMetadata;
|
|
1559
|
+
}
|
|
1560
|
+
var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
|
|
1561
|
+
plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
|
|
1562
|
+
} else if (options._experiments.moduleMetadata) {
|
|
1563
|
+
logger.warn("'moduleMetadata' is currently only supported by '@sentry/webpack-plugin'");
|
|
1564
|
+
}
|
|
1538
1565
|
if (!options.release.name) {
|
|
1539
|
-
logger.warn("No release name provided. Will not create release. Please set the `release.name` option to
|
|
1566
|
+
logger.warn("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
|
|
1540
1567
|
} else if (!options.authToken) {
|
|
1541
1568
|
logger.warn("No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/");
|
|
1542
|
-
} else if (!options.org) {
|
|
1569
|
+
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
1543
1570
|
logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug.");
|
|
1544
1571
|
} else if (!options.project) {
|
|
1545
1572
|
logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug.");
|
|
@@ -1571,7 +1598,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1571
1598
|
plugins.push(debugIdInjectionPlugin());
|
|
1572
1599
|
if (!options.authToken) {
|
|
1573
1600
|
logger.warn("No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/");
|
|
1574
|
-
} else if (!options.org) {
|
|
1601
|
+
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
1575
1602
|
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug.");
|
|
1576
1603
|
} else if (!options.project) {
|
|
1577
1604
|
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug.");
|
|
@@ -1724,35 +1751,40 @@ function createRollupDebugIdUploadHooks(upload) {
|
|
|
1724
1751
|
while (1) switch (_context.prev = _context.next) {
|
|
1725
1752
|
case 0:
|
|
1726
1753
|
if (!outputOptions.dir) {
|
|
1727
|
-
_context.next =
|
|
1754
|
+
_context.next = 9;
|
|
1728
1755
|
break;
|
|
1729
1756
|
}
|
|
1730
1757
|
outputDir = outputOptions.dir;
|
|
1731
|
-
|
|
1732
|
-
|
|
1758
|
+
_context.next = 4;
|
|
1759
|
+
return glob(["/**/*.js", "/**/*.js.map"], {
|
|
1760
|
+
root: outputDir,
|
|
1761
|
+
absolute: true,
|
|
1762
|
+
nodir: true
|
|
1733
1763
|
});
|
|
1734
|
-
|
|
1764
|
+
case 4:
|
|
1765
|
+
_buildArtifacts = _context.sent;
|
|
1766
|
+
_context.next = 7;
|
|
1735
1767
|
return upload(_buildArtifacts);
|
|
1736
|
-
case 5:
|
|
1737
|
-
_context.next = 15;
|
|
1738
|
-
break;
|
|
1739
1768
|
case 7:
|
|
1769
|
+
_context.next = 17;
|
|
1770
|
+
break;
|
|
1771
|
+
case 9:
|
|
1740
1772
|
if (!outputOptions.file) {
|
|
1741
|
-
_context.next =
|
|
1773
|
+
_context.next = 14;
|
|
1742
1774
|
break;
|
|
1743
1775
|
}
|
|
1744
|
-
_context.next =
|
|
1776
|
+
_context.next = 12;
|
|
1745
1777
|
return upload([outputOptions.file]);
|
|
1746
|
-
case 10:
|
|
1747
|
-
_context.next = 15;
|
|
1748
|
-
break;
|
|
1749
1778
|
case 12:
|
|
1779
|
+
_context.next = 17;
|
|
1780
|
+
break;
|
|
1781
|
+
case 14:
|
|
1750
1782
|
_buildArtifacts2 = Object.keys(bundle).map(function (asset) {
|
|
1751
1783
|
return path.join(path.resolve(), asset);
|
|
1752
1784
|
});
|
|
1753
|
-
_context.next =
|
|
1785
|
+
_context.next = 17;
|
|
1754
1786
|
return upload(_buildArtifacts2);
|
|
1755
|
-
case
|
|
1787
|
+
case 17:
|
|
1756
1788
|
case "end":
|
|
1757
1789
|
return _context.stop();
|
|
1758
1790
|
}
|