@sentry/bundler-plugin-core 0.5.1 → 0.7.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 +233 -112
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +234 -112
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/debug-id.d.ts +1 -1
- package/dist/types/options-mapping.d.ts +54 -4
- package/dist/types/sentry/cli.d.ts +2 -2
- package/dist/types/sentry/releasePipeline.d.ts +8 -8
- package/dist/types/sentry/telemetry.d.ts +3 -3
- package/dist/types/types.d.ts +28 -19
- package/package.json +27 -6
- package/sentry-esbuild-debugid-injection-file.js +18 -0
package/dist/cjs/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var crypto = require('crypto');
|
|
|
14
14
|
require('@sentry/tracing');
|
|
15
15
|
var util = require('util');
|
|
16
16
|
var glob = require('glob');
|
|
17
|
+
var webpackSources = require('webpack-sources');
|
|
17
18
|
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
20
|
|
|
@@ -45,7 +46,6 @@ var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
|
45
46
|
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
46
47
|
var crypto__default = /*#__PURE__*/_interopDefaultLegacy(crypto);
|
|
47
48
|
var util__namespace = /*#__PURE__*/_interopNamespace(util);
|
|
48
|
-
var util__default = /*#__PURE__*/_interopDefaultLegacy(util);
|
|
49
49
|
|
|
50
50
|
function _regeneratorRuntime() {
|
|
51
51
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
@@ -981,6 +981,7 @@ function normalizeUserOptions(userOptions) {
|
|
|
981
981
|
injectReleasesMap: (_userOptions$injectRe = userOptions.injectReleasesMap) !== null && _userOptions$injectRe !== void 0 ? _userOptions$injectRe : false,
|
|
982
982
|
injectRelease: (_userOptions$injectRe2 = userOptions.injectRelease) !== null && _userOptions$injectRe2 !== void 0 ? _userOptions$injectRe2 : true,
|
|
983
983
|
uploadSourceMaps: (_userOptions$uploadSo = userOptions.uploadSourceMaps) !== null && _userOptions$uploadSo !== void 0 ? _userOptions$uploadSo : true,
|
|
984
|
+
sourcemaps: userOptions.sourcemaps,
|
|
984
985
|
_experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {},
|
|
985
986
|
// These options and can also be set via env variables or the config file.
|
|
986
987
|
// If they're set in the options, we simply pass them to the CLI constructor.
|
|
@@ -1032,6 +1033,10 @@ function normalizeReleaseInjectionTargets(userReleaseInjectionTargets) {
|
|
|
1032
1033
|
|
|
1033
1034
|
|
|
1034
1035
|
function normalizeInclude(userOptions) {
|
|
1036
|
+
if (!userOptions.include) {
|
|
1037
|
+
return [];
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1035
1040
|
return arrayify(userOptions.include).map(function (includeItem) {
|
|
1036
1041
|
return typeof includeItem === "string" ? {
|
|
1037
1042
|
paths: [includeItem]
|
|
@@ -1121,7 +1126,7 @@ function makeSentryClient(dsn, allowedToSendTelemetryPromise, userProject) {
|
|
|
1121
1126
|
// a dashboard.
|
|
1122
1127
|
// Yes, this is slightly abusing the purpose of this field.
|
|
1123
1128
|
dist: userProject,
|
|
1124
|
-
release: "0.
|
|
1129
|
+
release: "0.7.0",
|
|
1125
1130
|
integrations: [],
|
|
1126
1131
|
tracePropagationTargets: ["sentry.io/api"],
|
|
1127
1132
|
stackParser: node.defaultStackParser,
|
|
@@ -1224,7 +1229,7 @@ function addPluginOptionInformationToHub(options, hub, bundler) {
|
|
|
1224
1229
|
errorHandler = options.errorHandler,
|
|
1225
1230
|
deploy = options.deploy,
|
|
1226
1231
|
include = options.include,
|
|
1227
|
-
|
|
1232
|
+
sourcemaps = options.sourcemaps;
|
|
1228
1233
|
hub.setTag("include", include.length > 1 ? "multiple-entries" : "single-entry"); // Optional release pipeline steps
|
|
1229
1234
|
|
|
1230
1235
|
if (cleanArtifacts) {
|
|
@@ -1256,7 +1261,7 @@ function addPluginOptionInformationToHub(options, hub, bundler) {
|
|
|
1256
1261
|
hub.setTag("error-handler", "custom");
|
|
1257
1262
|
}
|
|
1258
1263
|
|
|
1259
|
-
if (
|
|
1264
|
+
if (sourcemaps !== null && sourcemaps !== void 0 && sourcemaps.assets) {
|
|
1260
1265
|
hub.setTag("debug-id-upload", true);
|
|
1261
1266
|
}
|
|
1262
1267
|
|
|
@@ -1901,12 +1906,14 @@ function getDryRunCLI(cli, logger) {
|
|
|
1901
1906
|
}
|
|
1902
1907
|
|
|
1903
1908
|
var DEBUG_ID_INJECTOR_SNIPPET = ';!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]="__SENTRY_DEBUG_ID__",e._sentryDebugIdIdentifier="sentry-dbid-__SENTRY_DEBUG_ID__")}catch(e){}}();';
|
|
1904
|
-
function injectDebugIdSnippetIntoChunk(code) {
|
|
1909
|
+
function injectDebugIdSnippetIntoChunk(code, filename) {
|
|
1905
1910
|
var _code$match;
|
|
1906
1911
|
|
|
1907
1912
|
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
1908
1913
|
|
|
1909
|
-
var ms = new MagicString__default["default"](code
|
|
1914
|
+
var ms = new MagicString__default["default"](code, {
|
|
1915
|
+
filename: filename
|
|
1916
|
+
});
|
|
1910
1917
|
var codeToInject = DEBUG_ID_INJECTOR_SNIPPET.replace(/__SENTRY_DEBUG_ID__/g, debugId); // We need to be careful not to inject the snippet before any `"use strict";`s.
|
|
1911
1918
|
// As an additional complication `"use strict";`s may come after any number of comments.
|
|
1912
1919
|
|
|
@@ -2144,6 +2151,8 @@ function _prepareSourceMapForDebugIdUpload() {
|
|
|
2144
2151
|
var ALLOWED_TRANSFORMATION_FILE_ENDINGS = [".js", ".ts", ".jsx", ".tsx", ".mjs"];
|
|
2145
2152
|
|
|
2146
2153
|
var releaseInjectionFilePath = require.resolve("@sentry/bundler-plugin-core/sentry-release-injection-file");
|
|
2154
|
+
|
|
2155
|
+
var esbuildDebugIdInjectionFilePath = require.resolve("@sentry/bundler-plugin-core/sentry-esbuild-debugid-injection-file");
|
|
2147
2156
|
/**
|
|
2148
2157
|
* The sentry bundler plugin concerns itself with two things:
|
|
2149
2158
|
* - Release injection
|
|
@@ -2173,15 +2182,15 @@ var releaseInjectionFilePath = require.resolve("@sentry/bundler-plugin-core/sent
|
|
|
2173
2182
|
*/
|
|
2174
2183
|
|
|
2175
2184
|
|
|
2176
|
-
var unplugin = unplugin$1.createUnplugin(function (
|
|
2177
|
-
var
|
|
2178
|
-
var allowedToSendTelemetryPromise = shouldSendTelemetry(
|
|
2185
|
+
var unplugin = unplugin$1.createUnplugin(function (userOptions, unpluginMetaContext) {
|
|
2186
|
+
var options = normalizeUserOptions(userOptions);
|
|
2187
|
+
var allowedToSendTelemetryPromise = shouldSendTelemetry(options);
|
|
2179
2188
|
|
|
2180
|
-
var _makeSentryClient = makeSentryClient("https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737", allowedToSendTelemetryPromise,
|
|
2189
|
+
var _makeSentryClient = makeSentryClient("https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737", allowedToSendTelemetryPromise, options.project),
|
|
2181
2190
|
sentryHub = _makeSentryClient.sentryHub,
|
|
2182
2191
|
sentryClient = _makeSentryClient.sentryClient;
|
|
2183
2192
|
|
|
2184
|
-
addPluginOptionInformationToHub(
|
|
2193
|
+
addPluginOptionInformationToHub(options, sentryHub, unpluginMetaContext.framework); //TODO: This call is problematic because as soon as we set our hub as the current hub
|
|
2185
2194
|
// we might interfere with other plugins that use Sentry. However, for now, we'll
|
|
2186
2195
|
// leave it in because without it, we can't get distributed traces (which are pretty nice)
|
|
2187
2196
|
// Let's keep it until someone complains about interference.
|
|
@@ -2190,25 +2199,26 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2190
2199
|
node.makeMain(sentryHub);
|
|
2191
2200
|
var logger = createLogger({
|
|
2192
2201
|
prefix: "[sentry-".concat(unpluginMetaContext.framework, "-plugin]"),
|
|
2193
|
-
silent:
|
|
2194
|
-
debug:
|
|
2202
|
+
silent: options.silent,
|
|
2203
|
+
debug: options.debug
|
|
2195
2204
|
});
|
|
2196
2205
|
|
|
2197
|
-
if (!validateOptions(
|
|
2198
|
-
handleError(new Error("Options were not set correctly. See output above for more details."), logger,
|
|
2206
|
+
if (!validateOptions(options, logger)) {
|
|
2207
|
+
handleError(new Error("Options were not set correctly. See output above for more details."), logger, options.errorHandler);
|
|
2199
2208
|
}
|
|
2200
2209
|
|
|
2201
|
-
var cli = getSentryCli(
|
|
2210
|
+
var cli = getSentryCli(options, logger);
|
|
2202
2211
|
var releaseNamePromise = new Promise(function (resolve) {
|
|
2203
|
-
if (
|
|
2204
|
-
resolve(
|
|
2212
|
+
if (userOptions.release) {
|
|
2213
|
+
resolve(userOptions.release);
|
|
2205
2214
|
} else {
|
|
2206
2215
|
resolve(cli.releases.proposeVersion());
|
|
2207
2216
|
}
|
|
2208
2217
|
});
|
|
2209
2218
|
var transaction;
|
|
2210
2219
|
var releaseInjectionSpan;
|
|
2211
|
-
|
|
2220
|
+
var plugins = [];
|
|
2221
|
+
plugins.push({
|
|
2212
2222
|
name: "sentry-plugin",
|
|
2213
2223
|
enforce: "pre",
|
|
2214
2224
|
// needed for Vite to call resolveId hook
|
|
@@ -2256,7 +2266,7 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2256
2266
|
|
|
2257
2267
|
// At this point, we either have determined a release or we have to bail
|
|
2258
2268
|
if (!releaseName) {
|
|
2259
|
-
handleError(new Error("Unable to determine a release name. Make sure to set the `release` option or use an environment that supports auto-detection https://docs.sentry.io/cli/releases/#creating-releases`"), logger,
|
|
2269
|
+
handleError(new Error("Unable to determine a release name. Make sure to set the `release` option or use an environment that supports auto-detection https://docs.sentry.io/cli/releases/#creating-releases`"), logger, options.errorHandler);
|
|
2260
2270
|
}
|
|
2261
2271
|
|
|
2262
2272
|
transaction = sentryHub.startTransaction({
|
|
@@ -2313,6 +2323,10 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2313
2323
|
id: id
|
|
2314
2324
|
});
|
|
2315
2325
|
|
|
2326
|
+
if (id.includes("sentry-release-injection-file")) {
|
|
2327
|
+
return true;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2316
2330
|
if (id.match(/\\node_modules\\|\/node_modules\//)) {
|
|
2317
2331
|
return false; // never transform 3rd party modules
|
|
2318
2332
|
} // We normalize the id because vite always passes `id` as a unix style path which causes problems when a user passes
|
|
@@ -2321,17 +2335,13 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2321
2335
|
|
|
2322
2336
|
var normalizedId = path__default["default"].normalize(id);
|
|
2323
2337
|
|
|
2324
|
-
if (
|
|
2325
|
-
return true;
|
|
2326
|
-
}
|
|
2327
|
-
|
|
2328
|
-
if (internalOptions.releaseInjectionTargets) {
|
|
2338
|
+
if (options.releaseInjectionTargets) {
|
|
2329
2339
|
// If there's an `releaseInjectionTargets` option transform (ie. inject the release varible) when the file path matches the option.
|
|
2330
|
-
if (typeof
|
|
2331
|
-
return
|
|
2340
|
+
if (typeof options.releaseInjectionTargets === "function") {
|
|
2341
|
+
return options.releaseInjectionTargets(normalizedId);
|
|
2332
2342
|
}
|
|
2333
2343
|
|
|
2334
|
-
return
|
|
2344
|
+
return options.releaseInjectionTargets.some(function (entry) {
|
|
2335
2345
|
if (entry instanceof RegExp) {
|
|
2336
2346
|
return entry.test(normalizedId);
|
|
2337
2347
|
} else {
|
|
@@ -2367,7 +2377,7 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2367
2377
|
id: id
|
|
2368
2378
|
});
|
|
2369
2379
|
|
|
2370
|
-
if (
|
|
2380
|
+
if (options.injectRelease) {
|
|
2371
2381
|
_context2.next = 3;
|
|
2372
2382
|
break;
|
|
2373
2383
|
}
|
|
@@ -2390,10 +2400,10 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2390
2400
|
|
|
2391
2401
|
case 9:
|
|
2392
2402
|
_context2.t2 = _context2.sent;
|
|
2393
|
-
_context2.t3 =
|
|
2394
|
-
_context2.t4 =
|
|
2395
|
-
_context2.t5 =
|
|
2396
|
-
_context2.t6 =
|
|
2403
|
+
_context2.t3 = options.injectReleasesMap;
|
|
2404
|
+
_context2.t4 = options._experiments.injectBuildInformation || false;
|
|
2405
|
+
_context2.t5 = options.org;
|
|
2406
|
+
_context2.t6 = options.project;
|
|
2397
2407
|
_context2.t7 = {
|
|
2398
2408
|
release: _context2.t2,
|
|
2399
2409
|
injectReleasesMap: _context2.t3,
|
|
@@ -2442,14 +2452,14 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2442
2452
|
* Sentry.io, uploading sourcemaps, associating commits and deploys and finalizing the release)
|
|
2443
2453
|
*/
|
|
2444
2454
|
writeBundle: function writeBundle() {
|
|
2445
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
2455
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
2446
2456
|
var _releaseInjectionSpan;
|
|
2447
2457
|
|
|
2448
|
-
var releasePipelineSpan, ctx, releaseName, tmpUploadFolder, _transaction, debugIdChunkFilePaths, sourceFileUploadFolderPromise, _transaction2, _transaction3;
|
|
2458
|
+
var releasePipelineSpan, ctx, releaseName, tmpUploadFolder, _transaction, _options$sourcemaps, debugIdChunkFilePaths, sourceFileUploadFolderPromise, _transaction2, _transaction3;
|
|
2449
2459
|
|
|
2450
|
-
return _regeneratorRuntime().wrap(function
|
|
2460
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
2451
2461
|
while (1) {
|
|
2452
|
-
switch (
|
|
2462
|
+
switch (_context5.prev = _context5.next) {
|
|
2453
2463
|
case 0:
|
|
2454
2464
|
logger.debug('Called "writeBundle"');
|
|
2455
2465
|
(_releaseInjectionSpan = releaseInjectionSpan) === null || _releaseInjectionSpan === void 0 ? void 0 : _releaseInjectionSpan.finish();
|
|
@@ -2469,50 +2479,59 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2469
2479
|
logger: logger,
|
|
2470
2480
|
cli: cli
|
|
2471
2481
|
};
|
|
2472
|
-
|
|
2482
|
+
_context5.next = 7;
|
|
2473
2483
|
return releaseNamePromise;
|
|
2474
2484
|
|
|
2475
2485
|
case 7:
|
|
2476
|
-
releaseName =
|
|
2477
|
-
|
|
2486
|
+
releaseName = _context5.sent;
|
|
2487
|
+
_context5.prev = 8;
|
|
2478
2488
|
|
|
2479
|
-
if (
|
|
2480
|
-
|
|
2489
|
+
if (unpluginMetaContext.watchMode) {
|
|
2490
|
+
_context5.next = 37;
|
|
2481
2491
|
break;
|
|
2482
2492
|
}
|
|
2483
2493
|
|
|
2484
|
-
|
|
2485
|
-
|
|
2494
|
+
if (!((_options$sourcemaps = options.sourcemaps) !== null && _options$sourcemaps !== void 0 && _options$sourcemaps.assets)) {
|
|
2495
|
+
_context5.next = 25;
|
|
2496
|
+
break;
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
_context5.next = 13;
|
|
2500
|
+
return glob.glob(options.sourcemaps.assets, {
|
|
2486
2501
|
absolute: true,
|
|
2487
2502
|
nodir: true,
|
|
2488
|
-
ignore:
|
|
2503
|
+
ignore: options.sourcemaps.ignore
|
|
2489
2504
|
});
|
|
2490
2505
|
|
|
2491
|
-
case
|
|
2492
|
-
debugIdChunkFilePaths =
|
|
2493
|
-
return p.endsWith(".js") || p.endsWith(".mjs");
|
|
2506
|
+
case 13:
|
|
2507
|
+
debugIdChunkFilePaths = _context5.sent.filter(function (p) {
|
|
2508
|
+
return p.endsWith(".js") || p.endsWith(".mjs") || p.endsWith(".cjs");
|
|
2494
2509
|
});
|
|
2495
|
-
|
|
2496
|
-
|
|
2510
|
+
|
|
2511
|
+
if (!(unpluginMetaContext.framework === "esbuild")) {
|
|
2512
|
+
_context5.next = 17;
|
|
2513
|
+
break;
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
_context5.next = 17;
|
|
2497
2517
|
return Promise.all(debugIdChunkFilePaths.map( /*#__PURE__*/function () {
|
|
2498
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(
|
|
2518
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(debugIdChunkFilePath) {
|
|
2519
|
+
var chunkFileContents, debugId, newChunkFileContents;
|
|
2499
2520
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2500
2521
|
while (1) {
|
|
2501
2522
|
switch (_context3.prev = _context3.next) {
|
|
2502
2523
|
case 0:
|
|
2503
|
-
_context3.
|
|
2504
|
-
|
|
2505
|
-
_context3.next = 4;
|
|
2506
|
-
return sourceFileUploadFolderPromise;
|
|
2524
|
+
_context3.next = 2;
|
|
2525
|
+
return util.promisify(fs__default["default"].readFile)(debugIdChunkFilePath, "utf-8");
|
|
2507
2526
|
|
|
2508
|
-
case
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
_context3.next =
|
|
2513
|
-
return (
|
|
2527
|
+
case 2:
|
|
2528
|
+
chunkFileContents = _context3.sent;
|
|
2529
|
+
debugId = stringToUUID(chunkFileContents);
|
|
2530
|
+
newChunkFileContents = chunkFileContents.replace(/__SENTRY_DEBUG_ID__/g, debugId);
|
|
2531
|
+
_context3.next = 7;
|
|
2532
|
+
return util.promisify(fs__default["default"].writeFile)(debugIdChunkFilePath, newChunkFileContents, "utf-8");
|
|
2514
2533
|
|
|
2515
|
-
case
|
|
2534
|
+
case 7:
|
|
2516
2535
|
case "end":
|
|
2517
2536
|
return _context3.stop();
|
|
2518
2537
|
}
|
|
@@ -2520,61 +2539,95 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2520
2539
|
}, _callee3);
|
|
2521
2540
|
}));
|
|
2522
2541
|
|
|
2523
|
-
return function (_x
|
|
2542
|
+
return function (_x) {
|
|
2524
2543
|
return _ref2.apply(this, arguments);
|
|
2525
2544
|
};
|
|
2526
2545
|
}()));
|
|
2527
2546
|
|
|
2528
|
-
case
|
|
2529
|
-
|
|
2530
|
-
|
|
2547
|
+
case 17:
|
|
2548
|
+
sourceFileUploadFolderPromise = util.promisify(fs__default["default"].mkdtemp)(path__default["default"].join(os__default["default"].tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
2549
|
+
_context5.next = 20;
|
|
2550
|
+
return Promise.all(debugIdChunkFilePaths.map( /*#__PURE__*/function () {
|
|
2551
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(chunkFilePath, chunkIndex) {
|
|
2552
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2553
|
+
while (1) {
|
|
2554
|
+
switch (_context4.prev = _context4.next) {
|
|
2555
|
+
case 0:
|
|
2556
|
+
_context4.t0 = prepareBundleForDebugIdUpload;
|
|
2557
|
+
_context4.t1 = chunkFilePath;
|
|
2558
|
+
_context4.next = 4;
|
|
2559
|
+
return sourceFileUploadFolderPromise;
|
|
2531
2560
|
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2561
|
+
case 4:
|
|
2562
|
+
_context4.t2 = _context4.sent;
|
|
2563
|
+
_context4.t3 = String(chunkIndex);
|
|
2564
|
+
_context4.t4 = logger;
|
|
2565
|
+
_context4.next = 9;
|
|
2566
|
+
return (0, _context4.t0)(_context4.t1, _context4.t2, _context4.t3, _context4.t4);
|
|
2536
2567
|
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2568
|
+
case 9:
|
|
2569
|
+
case "end":
|
|
2570
|
+
return _context4.stop();
|
|
2571
|
+
}
|
|
2572
|
+
}
|
|
2573
|
+
}, _callee4);
|
|
2574
|
+
}));
|
|
2540
2575
|
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2576
|
+
return function (_x2, _x3) {
|
|
2577
|
+
return _ref3.apply(this, arguments);
|
|
2578
|
+
};
|
|
2579
|
+
}()));
|
|
2580
|
+
|
|
2581
|
+
case 20:
|
|
2582
|
+
_context5.next = 22;
|
|
2583
|
+
return sourceFileUploadFolderPromise;
|
|
2584
|
+
|
|
2585
|
+
case 22:
|
|
2586
|
+
tmpUploadFolder = _context5.sent;
|
|
2587
|
+
_context5.next = 25;
|
|
2588
|
+
return uploadDebugIdSourcemaps(options, ctx, tmpUploadFolder, releaseName);
|
|
2544
2589
|
|
|
2545
2590
|
case 25:
|
|
2546
|
-
|
|
2547
|
-
return
|
|
2591
|
+
_context5.next = 27;
|
|
2592
|
+
return createNewRelease(options, ctx, releaseName);
|
|
2548
2593
|
|
|
2549
2594
|
case 27:
|
|
2550
|
-
|
|
2551
|
-
return
|
|
2595
|
+
_context5.next = 29;
|
|
2596
|
+
return cleanArtifacts(options, ctx, releaseName);
|
|
2552
2597
|
|
|
2553
2598
|
case 29:
|
|
2554
|
-
|
|
2555
|
-
return
|
|
2599
|
+
_context5.next = 31;
|
|
2600
|
+
return uploadSourceMaps(options, ctx, releaseName);
|
|
2556
2601
|
|
|
2557
2602
|
case 31:
|
|
2558
|
-
|
|
2559
|
-
return
|
|
2603
|
+
_context5.next = 33;
|
|
2604
|
+
return setCommits(options, ctx, releaseName);
|
|
2560
2605
|
|
|
2561
2606
|
case 33:
|
|
2607
|
+
_context5.next = 35;
|
|
2608
|
+
return finalizeRelease(options, ctx, releaseName);
|
|
2609
|
+
|
|
2610
|
+
case 35:
|
|
2611
|
+
_context5.next = 37;
|
|
2612
|
+
return addDeploy(options, ctx, releaseName);
|
|
2613
|
+
|
|
2614
|
+
case 37:
|
|
2562
2615
|
(_transaction = transaction) === null || _transaction === void 0 ? void 0 : _transaction.setStatus("ok");
|
|
2563
|
-
|
|
2616
|
+
_context5.next = 45;
|
|
2564
2617
|
break;
|
|
2565
2618
|
|
|
2566
|
-
case
|
|
2567
|
-
|
|
2568
|
-
|
|
2619
|
+
case 40:
|
|
2620
|
+
_context5.prev = 40;
|
|
2621
|
+
_context5.t0 = _context5["catch"](8);
|
|
2569
2622
|
(_transaction2 = transaction) === null || _transaction2 === void 0 ? void 0 : _transaction2.setStatus("cancelled");
|
|
2570
2623
|
sentryHub.addBreadcrumb({
|
|
2571
2624
|
level: "error",
|
|
2572
2625
|
message: "Error during writeBundle"
|
|
2573
2626
|
});
|
|
2574
|
-
handleError(
|
|
2627
|
+
handleError(_context5.t0, logger, options.errorHandler);
|
|
2575
2628
|
|
|
2576
|
-
case
|
|
2577
|
-
|
|
2629
|
+
case 45:
|
|
2630
|
+
_context5.prev = 45;
|
|
2578
2631
|
|
|
2579
2632
|
if (tmpUploadFolder) {
|
|
2580
2633
|
fs__default["default"].rm(tmpUploadFolder, {
|
|
@@ -2586,33 +2639,33 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2586
2639
|
|
|
2587
2640
|
releasePipelineSpan === null || releasePipelineSpan === void 0 ? void 0 : releasePipelineSpan.finish();
|
|
2588
2641
|
(_transaction3 = transaction) === null || _transaction3 === void 0 ? void 0 : _transaction3.finish();
|
|
2589
|
-
|
|
2642
|
+
_context5.next = 51;
|
|
2590
2643
|
return sentryClient.flush().then(null, function () {
|
|
2591
2644
|
logger.warn("Sending of telemetry failed");
|
|
2592
2645
|
});
|
|
2593
2646
|
|
|
2594
|
-
case
|
|
2595
|
-
return
|
|
2647
|
+
case 51:
|
|
2648
|
+
return _context5.finish(45);
|
|
2596
2649
|
|
|
2597
|
-
case
|
|
2650
|
+
case 52:
|
|
2598
2651
|
sentryHub.addBreadcrumb({
|
|
2599
2652
|
category: "writeBundle:finish",
|
|
2600
2653
|
level: "info"
|
|
2601
2654
|
});
|
|
2602
2655
|
|
|
2603
|
-
case
|
|
2656
|
+
case 53:
|
|
2604
2657
|
case "end":
|
|
2605
|
-
return
|
|
2658
|
+
return _context5.stop();
|
|
2606
2659
|
}
|
|
2607
2660
|
}
|
|
2608
|
-
},
|
|
2661
|
+
}, _callee5, null, [[8, 40, 45, 52]]);
|
|
2609
2662
|
}))();
|
|
2610
2663
|
},
|
|
2611
2664
|
rollup: {
|
|
2612
2665
|
renderChunk: function renderChunk(code, chunk) {
|
|
2613
|
-
var _options$
|
|
2666
|
+
var _options$sourcemaps2;
|
|
2614
2667
|
|
|
2615
|
-
if ((_options$
|
|
2668
|
+
if ((_options$sourcemaps2 = options.sourcemaps) !== null && _options$sourcemaps2 !== void 0 && _options$sourcemaps2.assets && [".js", ".mjs", ".cjs"].some(function (ending) {
|
|
2616
2669
|
return chunk.fileName.endsWith(ending);
|
|
2617
2670
|
}) // chunks could be any file (html, md, ...)
|
|
2618
2671
|
) {
|
|
@@ -2624,9 +2677,9 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2624
2677
|
},
|
|
2625
2678
|
vite: {
|
|
2626
2679
|
renderChunk: function renderChunk(code, chunk) {
|
|
2627
|
-
var _options$
|
|
2680
|
+
var _options$sourcemaps3;
|
|
2628
2681
|
|
|
2629
|
-
if ((_options$
|
|
2682
|
+
if ((_options$sourcemaps3 = options.sourcemaps) !== null && _options$sourcemaps3 !== void 0 && _options$sourcemaps3.assets && [".js", ".mjs", ".cjs"].some(function (ending) {
|
|
2630
2683
|
return chunk.fileName.endsWith(ending);
|
|
2631
2684
|
}) // chunks could be any file (html, md, ...)
|
|
2632
2685
|
) {
|
|
@@ -2635,8 +2688,76 @@ var unplugin = unplugin$1.createUnplugin(function (options, unpluginMetaContext)
|
|
|
2635
2688
|
return null; // returning null means not modifying the chunk at all
|
|
2636
2689
|
}
|
|
2637
2690
|
}
|
|
2691
|
+
},
|
|
2692
|
+
webpack: function webpack(compiler) {
|
|
2693
|
+
var _options$sourcemaps4;
|
|
2694
|
+
|
|
2695
|
+
if ((_options$sourcemaps4 = options.sourcemaps) !== null && _options$sourcemaps4 !== void 0 && _options$sourcemaps4.assets) {
|
|
2696
|
+
// Cache inspired by https://github.com/webpack/webpack/pull/15454
|
|
2697
|
+
var cache = new WeakMap();
|
|
2698
|
+
compiler.hooks.compilation.tap("sentry-plugin", function (compilation) {
|
|
2699
|
+
compilation.hooks.optimizeChunkAssets.tap("sentry-plugin", function (chunks) {
|
|
2700
|
+
chunks.forEach(function (chunk) {
|
|
2701
|
+
var fileNames = chunk.files;
|
|
2702
|
+
fileNames.forEach(function (fileName) {
|
|
2703
|
+
var source = compilation.assets[fileName];
|
|
2704
|
+
|
|
2705
|
+
if (!source) {
|
|
2706
|
+
logger.warn("Unable to access compilation assets. If you see this warning, it is likely a bug in the Sentry webpack plugin. Feel free to open an issue at https://github.com/getsentry/sentry-javascript-bundler-plugins with reproduction steps.");
|
|
2707
|
+
return;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
compilation.updateAsset(fileName, function (oldSource) {
|
|
2711
|
+
var cached = cache.get(oldSource);
|
|
2712
|
+
|
|
2713
|
+
if (cached) {
|
|
2714
|
+
return cached;
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
var originalCode = source.source().toString(); // The source map type is very annoying :(
|
|
2718
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
|
|
2719
|
+
|
|
2720
|
+
var originalSourceMap = source.map();
|
|
2721
|
+
|
|
2722
|
+
var _injectDebugIdSnippet = injectDebugIdSnippetIntoChunk(originalCode, fileName),
|
|
2723
|
+
newCode = _injectDebugIdSnippet.code,
|
|
2724
|
+
newSourceMap = _injectDebugIdSnippet.map; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2725
|
+
|
|
2726
|
+
|
|
2727
|
+
newSourceMap.sources = originalSourceMap.sources; // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
2728
|
+
|
|
2729
|
+
newSourceMap.sourcesContent = originalSourceMap.sourcesContent;
|
|
2730
|
+
var newSource = new webpackSources.SourceMapSource(newCode, fileName, // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
2731
|
+
originalSourceMap, originalCode, newSourceMap, false);
|
|
2732
|
+
cache.set(oldSource, newSource);
|
|
2733
|
+
return newSource;
|
|
2734
|
+
});
|
|
2735
|
+
});
|
|
2736
|
+
});
|
|
2737
|
+
});
|
|
2738
|
+
});
|
|
2739
|
+
}
|
|
2638
2740
|
}
|
|
2639
|
-
};
|
|
2741
|
+
});
|
|
2742
|
+
|
|
2743
|
+
if (unpluginMetaContext.framework === "esbuild") {
|
|
2744
|
+
var _options$sourcemaps5;
|
|
2745
|
+
|
|
2746
|
+
if ((_options$sourcemaps5 = options.sourcemaps) !== null && _options$sourcemaps5 !== void 0 && _options$sourcemaps5.assets) {
|
|
2747
|
+
plugins.push({
|
|
2748
|
+
name: "sentry-esbuild-debug-id-plugin",
|
|
2749
|
+
esbuild: {
|
|
2750
|
+
setup: function setup(_ref4) {
|
|
2751
|
+
var initialOptions = _ref4.initialOptions;
|
|
2752
|
+
initialOptions.inject = initialOptions.inject || [];
|
|
2753
|
+
initialOptions.inject.push(esbuildDebugIdInjectionFilePath);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
|
|
2760
|
+
return plugins;
|
|
2640
2761
|
});
|
|
2641
2762
|
|
|
2642
2763
|
function handleError(unknownError, logger, errorHandler) {
|
|
@@ -2662,12 +2783,12 @@ function handleError(unknownError, logger, errorHandler) {
|
|
|
2662
2783
|
*/
|
|
2663
2784
|
|
|
2664
2785
|
|
|
2665
|
-
function generateGlobalInjectorCode(
|
|
2666
|
-
var release =
|
|
2667
|
-
injectReleasesMap =
|
|
2668
|
-
injectBuildInformation =
|
|
2669
|
-
org =
|
|
2670
|
-
project =
|
|
2786
|
+
function generateGlobalInjectorCode(_ref5) {
|
|
2787
|
+
var release = _ref5.release,
|
|
2788
|
+
injectReleasesMap = _ref5.injectReleasesMap,
|
|
2789
|
+
injectBuildInformation = _ref5.injectBuildInformation,
|
|
2790
|
+
org = _ref5.org,
|
|
2791
|
+
project = _ref5.project;
|
|
2671
2792
|
// The code below is mostly ternary operators because it saves bundle size.
|
|
2672
2793
|
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
2673
2794
|
var code = "\n var _global =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\n typeof self !== 'undefined' ?\n self :\n {};\n\n _global.SENTRY_RELEASE={id:\"".concat(release, "\"};");
|
|
@@ -2688,12 +2809,12 @@ function generateGlobalInjectorCode(_ref3) {
|
|
|
2688
2809
|
function getBuildInformation() {
|
|
2689
2810
|
var packageJson = getPackageJson();
|
|
2690
2811
|
|
|
2691
|
-
var
|
|
2812
|
+
var _ref6 = packageJson ? getDependencies(packageJson) : {
|
|
2692
2813
|
deps: [],
|
|
2693
2814
|
depsVersions: {}
|
|
2694
2815
|
},
|
|
2695
|
-
deps =
|
|
2696
|
-
depsVersions =
|
|
2816
|
+
deps = _ref6.deps,
|
|
2817
|
+
depsVersions = _ref6.depsVersions;
|
|
2697
2818
|
|
|
2698
2819
|
return {
|
|
2699
2820
|
deps: deps,
|