@sentry/bundler-plugin-core 2.10.3 → 2.11.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 +88 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +86 -4
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +6 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/options-mapping.d.ts +3 -0
- package/dist/types/options-mapping.d.ts.map +1 -1
- package/dist/types/types.d.ts +13 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import SentryCli from '@sentry/cli';
|
|
2
|
+
import { transformAsync } from '@babel/core';
|
|
3
|
+
import { componentNameAnnotatePlugin } from '@sentry/component-annotate-plugin';
|
|
2
4
|
import * as fs from 'fs';
|
|
3
5
|
import fs__default from 'fs';
|
|
4
6
|
import * as path from 'path';
|
|
@@ -12,7 +14,7 @@ import childProcess from 'child_process';
|
|
|
12
14
|
import { glob } from 'glob';
|
|
13
15
|
import * as util from 'util';
|
|
14
16
|
import { promisify } from 'util';
|
|
15
|
-
import { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/utils';
|
|
17
|
+
import pkg, { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/utils';
|
|
16
18
|
import { NodeClient, defaultStackParser, makeNodeTransport, Hub } from '@sentry/node';
|
|
17
19
|
import * as dotenv from 'dotenv';
|
|
18
20
|
|
|
@@ -660,6 +662,7 @@ function normalizeUserOptions(userOptions) {
|
|
|
660
662
|
cleanArtifacts: (_userOptions$release$6 = (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.cleanArtifacts) !== null && _userOptions$release$6 !== void 0 ? _userOptions$release$6 : false
|
|
661
663
|
}),
|
|
662
664
|
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
|
|
665
|
+
reactComponentAnnotation: userOptions.reactComponentAnnotation,
|
|
663
666
|
_experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
|
|
664
667
|
};
|
|
665
668
|
return options;
|
|
@@ -702,7 +705,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
702
705
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
703
706
|
tracesSampleRate: 1,
|
|
704
707
|
sampleRate: 1,
|
|
705
|
-
release: "2.
|
|
708
|
+
release: "2.11.0",
|
|
706
709
|
integrations: [],
|
|
707
710
|
tracePropagationTargets: ["sentry.io/api"],
|
|
708
711
|
stackParser: defaultStackParser,
|
|
@@ -1538,6 +1541,7 @@ function createLogger(options) {
|
|
|
1538
1541
|
};
|
|
1539
1542
|
}
|
|
1540
1543
|
|
|
1544
|
+
var logger = pkg.logger;
|
|
1541
1545
|
/**
|
|
1542
1546
|
* The sentry bundler plugin concerns itself with two things:
|
|
1543
1547
|
* - Release injection
|
|
@@ -1567,6 +1571,7 @@ function createLogger(options) {
|
|
|
1567
1571
|
*/
|
|
1568
1572
|
function sentryUnpluginFactory(_ref) {
|
|
1569
1573
|
var releaseInjectionPlugin = _ref.releaseInjectionPlugin,
|
|
1574
|
+
componentNameAnnotatePlugin = _ref.componentNameAnnotatePlugin,
|
|
1570
1575
|
moduleMetadataInjectionPlugin = _ref.moduleMetadataInjectionPlugin,
|
|
1571
1576
|
debugIdInjectionPlugin = _ref.debugIdInjectionPlugin,
|
|
1572
1577
|
debugIdUploadPlugin = _ref.debugIdUploadPlugin,
|
|
@@ -1612,7 +1617,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1612
1617
|
});
|
|
1613
1618
|
|
|
1614
1619
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
1615
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.
|
|
1620
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.11.0");
|
|
1616
1621
|
function handleRecoverableError(unknownError) {
|
|
1617
1622
|
sentrySession.status = "abnormal";
|
|
1618
1623
|
try {
|
|
@@ -1767,6 +1772,15 @@ function sentryUnpluginFactory(_ref) {
|
|
|
1767
1772
|
}
|
|
1768
1773
|
})));
|
|
1769
1774
|
}
|
|
1775
|
+
if (options.reactComponentAnnotation) {
|
|
1776
|
+
if (!options.reactComponentAnnotation.enabled) {
|
|
1777
|
+
logger.info("The component name annotate plugin is currently disabled. Skipping component name annotations.");
|
|
1778
|
+
} else if (options.reactComponentAnnotation.enabled && !componentNameAnnotatePlugin) {
|
|
1779
|
+
logger.warn("The component name annotate plugin is currently not supported by '@sentry/esbuild-plugin'");
|
|
1780
|
+
} else {
|
|
1781
|
+
componentNameAnnotatePlugin && plugins.push(componentNameAnnotatePlugin());
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1770
1784
|
return plugins;
|
|
1771
1785
|
});
|
|
1772
1786
|
}
|
|
@@ -1979,9 +1993,77 @@ function createRollupDebugIdUploadHooks(upload) {
|
|
|
1979
1993
|
}
|
|
1980
1994
|
};
|
|
1981
1995
|
}
|
|
1996
|
+
function createComponentNameAnnotateHooks() {
|
|
1997
|
+
return {
|
|
1998
|
+
transform: function transform(code, id) {
|
|
1999
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2000
|
+
var idWithoutQueryAndHash, parserPlugins, _result$code, result;
|
|
2001
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2002
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2003
|
+
case 0:
|
|
2004
|
+
// id may contain query and hash which will trip up our file extension logic below
|
|
2005
|
+
idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
|
|
2006
|
+
if (!idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
|
|
2007
|
+
_context2.next = 3;
|
|
2008
|
+
break;
|
|
2009
|
+
}
|
|
2010
|
+
return _context2.abrupt("return", null);
|
|
2011
|
+
case 3:
|
|
2012
|
+
if ([".jsx", ".tsx"].some(function (ending) {
|
|
2013
|
+
return idWithoutQueryAndHash.endsWith(ending);
|
|
2014
|
+
})) {
|
|
2015
|
+
_context2.next = 5;
|
|
2016
|
+
break;
|
|
2017
|
+
}
|
|
2018
|
+
return _context2.abrupt("return", null);
|
|
2019
|
+
case 5:
|
|
2020
|
+
parserPlugins = [];
|
|
2021
|
+
if (idWithoutQueryAndHash.endsWith(".jsx")) {
|
|
2022
|
+
parserPlugins.push("jsx");
|
|
2023
|
+
} else if (idWithoutQueryAndHash.endsWith(".tsx")) {
|
|
2024
|
+
parserPlugins.push("jsx", "typescript");
|
|
2025
|
+
}
|
|
2026
|
+
_context2.prev = 7;
|
|
2027
|
+
_context2.next = 10;
|
|
2028
|
+
return transformAsync(code, {
|
|
2029
|
+
plugins: [[componentNameAnnotatePlugin]],
|
|
2030
|
+
filename: id,
|
|
2031
|
+
parserOpts: {
|
|
2032
|
+
sourceType: "module",
|
|
2033
|
+
allowAwaitOutsideFunction: true,
|
|
2034
|
+
plugins: parserPlugins
|
|
2035
|
+
},
|
|
2036
|
+
generatorOpts: {
|
|
2037
|
+
decoratorsBeforeExport: true
|
|
2038
|
+
},
|
|
2039
|
+
sourceMaps: true
|
|
2040
|
+
});
|
|
2041
|
+
case 10:
|
|
2042
|
+
result = _context2.sent;
|
|
2043
|
+
return _context2.abrupt("return", {
|
|
2044
|
+
code: (_result$code = result === null || result === void 0 ? void 0 : result.code) !== null && _result$code !== void 0 ? _result$code : code,
|
|
2045
|
+
map: result === null || result === void 0 ? void 0 : result.map
|
|
2046
|
+
});
|
|
2047
|
+
case 14:
|
|
2048
|
+
_context2.prev = 14;
|
|
2049
|
+
_context2.t0 = _context2["catch"](7);
|
|
2050
|
+
logger.error("Failed to apply react annotate plugin", _context2.t0);
|
|
2051
|
+
case 17:
|
|
2052
|
+
return _context2.abrupt("return", {
|
|
2053
|
+
code: code
|
|
2054
|
+
});
|
|
2055
|
+
case 18:
|
|
2056
|
+
case "end":
|
|
2057
|
+
return _context2.stop();
|
|
2058
|
+
}
|
|
2059
|
+
}, _callee2, null, [[7, 14]]);
|
|
2060
|
+
}))();
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
1982
2064
|
function getDebugIdSnippet(debugId) {
|
|
1983
2065
|
return ";!function(){try{var e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"".concat(debugId, "\",e._sentryDebugIdIdentifier=\"sentry-dbid-").concat(debugId, "\")}catch(e){}}();");
|
|
1984
2066
|
}
|
|
1985
2067
|
|
|
1986
|
-
export { createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, getBuildInformation, getDebugIdSnippet, replaceBooleanFlagsInCode, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
2068
|
+
export { createComponentNameAnnotateHooks, createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, getBuildInformation, getDebugIdSnippet, replaceBooleanFlagsInCode, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
1987
2069
|
//# sourceMappingURL=index.mjs.map
|