@sentry/bundler-plugin-core 4.5.0 → 4.6.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 CHANGED
@@ -8336,7 +8336,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
8336
8336
  dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
8337
8337
  tracesSampleRate: 1,
8338
8338
  sampleRate: 1,
8339
- release: "4.5.0",
8339
+ release: "4.6.1",
8340
8340
  integrations: [],
8341
8341
  tracePropagationTargets: ["sentry.io/api"],
8342
8342
  stackParser: stackParser,
@@ -8945,7 +8945,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
8945
8945
  });
8946
8946
 
8947
8947
  // Set the User-Agent that Sentry CLI will use when interacting with Sentry
8948
- process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.5.0");
8948
+ process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.6.1");
8949
8949
 
8950
8950
  // Propagate debug flag to Sentry CLI via environment variable
8951
8951
  // Only set if not already defined to respect user's explicit configuration
@@ -9153,7 +9153,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
9153
9153
  */
9154
9154
  createRelease: function createRelease() {
9155
9155
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
9156
- var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, normalizedInclude;
9156
+ var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, releaseOutput, normalizedInclude;
9157
9157
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
9158
9158
  while (1) switch (_context7.prev = _context7.next) {
9159
9159
  case 0:
@@ -9198,14 +9198,17 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
9198
9198
  _context7.prev = 24;
9199
9199
  cliInstance = createCliInstance(options);
9200
9200
  if (!options.release.create) {
9201
- _context7.next = 29;
9201
+ _context7.next = 31;
9202
9202
  break;
9203
9203
  }
9204
9204
  _context7.next = 29;
9205
9205
  return cliInstance.releases["new"](options.release.name);
9206
9206
  case 29:
9207
+ releaseOutput = _context7.sent;
9208
+ logger.debug("Release created:", releaseOutput);
9209
+ case 31:
9207
9210
  if (!options.release.uploadLegacySourcemaps) {
9208
- _context7.next = 33;
9211
+ _context7.next = 35;
9209
9212
  break;
9210
9213
  }
9211
9214
  normalizedInclude = arrayify(options.release.uploadLegacySourcemaps).map(function (includeItem) {
@@ -9222,77 +9225,75 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
9222
9225
  ignore: includeEntry.ignore ? arrayify(includeEntry.ignore) : undefined
9223
9226
  });
9224
9227
  });
9225
- _context7.next = 33;
9228
+ _context7.next = 35;
9226
9229
  return cliInstance.releases.uploadSourceMaps(options.release.name, {
9227
9230
  include: normalizedInclude,
9228
9231
  dist: options.release.dist,
9229
- // @ts-expect-error - projects is not a valid option for uploadSourceMaps but is implemented in the CLI
9230
- // Remove once https://github.com/getsentry/sentry-cli/pull/2856 is released
9231
9232
  projects: getProjects(options.project),
9232
9233
  // We want this promise to throw if the sourcemaps fail to upload so that we know about it.
9233
9234
  // see: https://github.com/getsentry/sentry-cli/pull/2605
9234
9235
  live: "rejectOnError"
9235
9236
  });
9236
- case 33:
9237
+ case 35:
9237
9238
  if (!(options.release.setCommits !== false)) {
9238
- _context7.next = 46;
9239
+ _context7.next = 48;
9239
9240
  break;
9240
9241
  }
9241
- _context7.prev = 34;
9242
- _context7.next = 37;
9242
+ _context7.prev = 36;
9243
+ _context7.next = 39;
9243
9244
  return cliInstance.releases.setCommits(options.release.name,
9244
9245
  // set commits always exists due to the normalize function
9245
9246
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9246
9247
  options.release.setCommits);
9247
- case 37:
9248
- _context7.next = 46;
9249
- break;
9250
9248
  case 39:
9251
- _context7.prev = 39;
9252
- _context7.t0 = _context7["catch"](34);
9249
+ _context7.next = 48;
9250
+ break;
9251
+ case 41:
9252
+ _context7.prev = 41;
9253
+ _context7.t0 = _context7["catch"](36);
9253
9254
  if (!(options.release.setCommits && "shouldNotThrowOnFailure" in options.release.setCommits && options.release.setCommits.shouldNotThrowOnFailure)) {
9254
- _context7.next = 45;
9255
+ _context7.next = 47;
9255
9256
  break;
9256
9257
  }
9257
9258
  logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context7.t0);
9258
- _context7.next = 46;
9259
+ _context7.next = 48;
9259
9260
  break;
9260
- case 45:
9261
+ case 47:
9261
9262
  throw _context7.t0;
9262
- case 46:
9263
+ case 48:
9263
9264
  if (!options.release.finalize) {
9264
- _context7.next = 49;
9265
+ _context7.next = 51;
9265
9266
  break;
9266
9267
  }
9267
- _context7.next = 49;
9268
+ _context7.next = 51;
9268
9269
  return cliInstance.releases.finalize(options.release.name);
9269
- case 49:
9270
+ case 51:
9270
9271
  if (!options.release.deploy) {
9271
- _context7.next = 52;
9272
+ _context7.next = 54;
9272
9273
  break;
9273
9274
  }
9274
- _context7.next = 52;
9275
+ _context7.next = 54;
9275
9276
  return cliInstance.releases.newDeploy(options.release.name, options.release.deploy);
9276
- case 52:
9277
- _context7.next = 60;
9278
- break;
9279
9277
  case 54:
9280
- _context7.prev = 54;
9278
+ _context7.next = 62;
9279
+ break;
9280
+ case 56:
9281
+ _context7.prev = 56;
9281
9282
  _context7.t1 = _context7["catch"](24);
9282
9283
  sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
9283
- _context7.next = 59;
9284
+ _context7.next = 61;
9284
9285
  return safeFlushTelemetry(sentryClient);
9285
- case 59:
9286
+ case 61:
9286
9287
  handleRecoverableError(_context7.t1, false);
9287
- case 60:
9288
- _context7.prev = 60;
9288
+ case 62:
9289
+ _context7.prev = 62;
9289
9290
  freeWriteBundleInvocationDependencyOnSourcemapFiles();
9290
- return _context7.finish(60);
9291
- case 63:
9291
+ return _context7.finish(62);
9292
+ case 65:
9292
9293
  case "end":
9293
9294
  return _context7.stop();
9294
9295
  }
9295
- }, _callee7, null, [[24, 54, 60, 63], [34, 39]]);
9296
+ }, _callee7, null, [[24, 56, 62, 65], [36, 41]]);
9296
9297
  }))();
9297
9298
  },
9298
9299
  /*
@@ -9431,8 +9432,6 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
9431
9432
  dist: options.release.dist
9432
9433
  }],
9433
9434
  ignore: ignorePaths,
9434
- // @ts-expect-error - projects is not a valid option for uploadSourceMaps but is implemented in the CLI
9435
- // Remove once https://github.com/getsentry/sentry-cli/pull/2856 is released
9436
9435
  projects: getProjects(options.project),
9437
9436
  live: "rejectOnError"
9438
9437
  });
@@ -9623,8 +9622,6 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
9623
9622
  rewrite: false,
9624
9623
  dist: options.release.dist
9625
9624
  }],
9626
- // @ts-expect-error - projects is not a valid option for uploadSourceMaps but is implemented in the CLI
9627
- // Remove once https://github.com/getsentry/sentry-cli/pull/2856 is released
9628
9625
  projects: getProjects(options.project),
9629
9626
  live: "rejectOnError"
9630
9627
  });
@@ -9828,18 +9825,14 @@ function sentryUnpluginFactory(_ref) {
9828
9825
  plugins.push({
9829
9826
  name: "sentry-telemetry-plugin",
9830
9827
  buildStart: function buildStart() {
9831
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9832
- return _regeneratorRuntime().wrap(function _callee$(_context) {
9833
- while (1) switch (_context.prev = _context.next) {
9834
- case 0:
9835
- _context.next = 2;
9836
- return sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal();
9837
- case 2:
9838
- case "end":
9839
- return _context.stop();
9840
- }
9841
- }, _callee);
9842
- }))();
9828
+ // Technically, for very fast builds we might miss the telemetry signal
9829
+ // but it's okay because telemetry is not critical for us.
9830
+ // We cannot await the flush here because it would block the build start
9831
+ // which in turn would break module federation builds, see
9832
+ // https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/816
9833
+ void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal()["catch"](function () {
9834
+ // Nothing for the users to do here. If telemetry fails it's acceptable.
9835
+ });
9843
9836
  }
9844
9837
  });
9845
9838
  if (Object.keys(bundleSizeOptimizationReplacementValues).length > 0) {
@@ -9866,22 +9859,22 @@ function sentryUnpluginFactory(_ref) {
9866
9859
  plugins.push({
9867
9860
  name: "sentry-release-management-plugin",
9868
9861
  writeBundle: function writeBundle() {
9869
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9870
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9871
- while (1) switch (_context2.prev = _context2.next) {
9862
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9863
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9864
+ while (1) switch (_context.prev = _context.next) {
9872
9865
  case 0:
9873
- _context2.prev = 0;
9874
- _context2.next = 3;
9866
+ _context.prev = 0;
9867
+ _context.next = 3;
9875
9868
  return sentryBuildPluginManager.createRelease();
9876
9869
  case 3:
9877
- _context2.prev = 3;
9870
+ _context.prev = 3;
9878
9871
  freeGlobalDependencyOnBuildArtifacts();
9879
- return _context2.finish(3);
9872
+ return _context.finish(3);
9880
9873
  case 6:
9881
9874
  case "end":
9882
- return _context2.stop();
9875
+ return _context.stop();
9883
9876
  }
9884
- }, _callee2, null, [[0,, 3, 6]]);
9877
+ }, _callee, null, [[0,, 3, 6]]);
9885
9878
  }))();
9886
9879
  }
9887
9880
  });
@@ -9910,17 +9903,17 @@ function sentryUnpluginFactory(_ref) {
9910
9903
  plugins.push({
9911
9904
  name: "sentry-file-deletion-plugin",
9912
9905
  writeBundle: function writeBundle() {
9913
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
9914
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
9915
- while (1) switch (_context3.prev = _context3.next) {
9906
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9907
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9908
+ while (1) switch (_context2.prev = _context2.next) {
9916
9909
  case 0:
9917
- _context3.next = 2;
9910
+ _context2.next = 2;
9918
9911
  return sentryBuildPluginManager.deleteArtifacts();
9919
9912
  case 2:
9920
9913
  case "end":
9921
- return _context3.stop();
9914
+ return _context2.stop();
9922
9915
  }
9923
- }, _callee3);
9916
+ }, _callee2);
9924
9917
  }))();
9925
9918
  }
9926
9919
  });
@@ -10070,18 +10063,18 @@ function createRollupDebugIdUploadHooks(upload, _logger, createDependencyOnBuild
10070
10063
  var freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();
10071
10064
  return {
10072
10065
  writeBundle: function writeBundle(outputOptions, bundle) {
10073
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
10066
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
10074
10067
  var outputDir, _buildArtifacts, _buildArtifacts2;
10075
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
10076
- while (1) switch (_context4.prev = _context4.next) {
10068
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
10069
+ while (1) switch (_context3.prev = _context3.next) {
10077
10070
  case 0:
10078
- _context4.prev = 0;
10071
+ _context3.prev = 0;
10079
10072
  if (!outputOptions.dir) {
10080
- _context4.next = 10;
10073
+ _context3.next = 10;
10081
10074
  break;
10082
10075
  }
10083
10076
  outputDir = outputOptions.dir;
10084
- _context4.next = 5;
10077
+ _context3.next = 5;
10085
10078
  return glob.glob(["/**/*.js", "/**/*.mjs", "/**/*.cjs", "/**/*.js.map", "/**/*.mjs.map", "/**/*.cjs.map"].map(function (q) {
10086
10079
  return "".concat(q, "?(\\?*)?(#*)");
10087
10080
  }),
@@ -10092,37 +10085,37 @@ function createRollupDebugIdUploadHooks(upload, _logger, createDependencyOnBuild
10092
10085
  nodir: true
10093
10086
  });
10094
10087
  case 5:
10095
- _buildArtifacts = _context4.sent;
10096
- _context4.next = 8;
10088
+ _buildArtifacts = _context3.sent;
10089
+ _context3.next = 8;
10097
10090
  return upload(_buildArtifacts);
10098
10091
  case 8:
10099
- _context4.next = 18;
10092
+ _context3.next = 18;
10100
10093
  break;
10101
10094
  case 10:
10102
10095
  if (!outputOptions.file) {
10103
- _context4.next = 15;
10096
+ _context3.next = 15;
10104
10097
  break;
10105
10098
  }
10106
- _context4.next = 13;
10099
+ _context3.next = 13;
10107
10100
  return upload([outputOptions.file]);
10108
10101
  case 13:
10109
- _context4.next = 18;
10102
+ _context3.next = 18;
10110
10103
  break;
10111
10104
  case 15:
10112
10105
  _buildArtifacts2 = Object.keys(bundle).map(function (asset) {
10113
10106
  return path__namespace.join(path__namespace.resolve(), asset);
10114
10107
  });
10115
- _context4.next = 18;
10108
+ _context3.next = 18;
10116
10109
  return upload(_buildArtifacts2);
10117
10110
  case 18:
10118
- _context4.prev = 18;
10111
+ _context3.prev = 18;
10119
10112
  freeGlobalDependencyOnDebugIdSourcemapArtifacts();
10120
- return _context4.finish(18);
10113
+ return _context3.finish(18);
10121
10114
  case 21:
10122
10115
  case "end":
10123
- return _context4.stop();
10116
+ return _context3.stop();
10124
10117
  }
10125
- }, _callee4, null, [[0,, 18, 21]]);
10118
+ }, _callee3, null, [[0,, 18, 21]]);
10126
10119
  }))();
10127
10120
  }
10128
10121
  };
@@ -10130,26 +10123,26 @@ function createRollupDebugIdUploadHooks(upload, _logger, createDependencyOnBuild
10130
10123
  function createComponentNameAnnotateHooks(ignoredComponents) {
10131
10124
  return {
10132
10125
  transform: function transform(code, id) {
10133
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
10126
+ return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
10134
10127
  var idWithoutQueryAndHash, parserPlugins, _result$code, result;
10135
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
10136
- while (1) switch (_context5.prev = _context5.next) {
10128
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
10129
+ while (1) switch (_context4.prev = _context4.next) {
10137
10130
  case 0:
10138
10131
  // id may contain query and hash which will trip up our file extension logic below
10139
10132
  idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
10140
10133
  if (!idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
10141
- _context5.next = 3;
10134
+ _context4.next = 3;
10142
10135
  break;
10143
10136
  }
10144
- return _context5.abrupt("return", null);
10137
+ return _context4.abrupt("return", null);
10145
10138
  case 3:
10146
10139
  if ([".jsx", ".tsx"].some(function (ending) {
10147
10140
  return idWithoutQueryAndHash.endsWith(ending);
10148
10141
  })) {
10149
- _context5.next = 5;
10142
+ _context4.next = 5;
10150
10143
  break;
10151
10144
  }
10152
- return _context5.abrupt("return", null);
10145
+ return _context4.abrupt("return", null);
10153
10146
  case 5:
10154
10147
  parserPlugins = [];
10155
10148
  if (idWithoutQueryAndHash.endsWith(".jsx")) {
@@ -10157,8 +10150,8 @@ function createComponentNameAnnotateHooks(ignoredComponents) {
10157
10150
  } else if (idWithoutQueryAndHash.endsWith(".tsx")) {
10158
10151
  parserPlugins.push("jsx", "typescript");
10159
10152
  }
10160
- _context5.prev = 7;
10161
- _context5.next = 10;
10153
+ _context4.prev = 7;
10154
+ _context4.next = 10;
10162
10155
  return core.transformAsync(code, {
10163
10156
  plugins: [[componentNameAnnotatePlugin__default["default"], {
10164
10157
  ignoredComponents: ignoredComponents
@@ -10175,24 +10168,24 @@ function createComponentNameAnnotateHooks(ignoredComponents) {
10175
10168
  sourceMaps: true
10176
10169
  });
10177
10170
  case 10:
10178
- result = _context5.sent;
10179
- return _context5.abrupt("return", {
10171
+ result = _context4.sent;
10172
+ return _context4.abrupt("return", {
10180
10173
  code: (_result$code = result === null || result === void 0 ? void 0 : result.code) !== null && _result$code !== void 0 ? _result$code : code,
10181
10174
  map: result === null || result === void 0 ? void 0 : result.map
10182
10175
  });
10183
10176
  case 14:
10184
- _context5.prev = 14;
10185
- _context5.t0 = _context5["catch"](7);
10186
- logger.error("Failed to apply react annotate plugin", _context5.t0);
10177
+ _context4.prev = 14;
10178
+ _context4.t0 = _context4["catch"](7);
10179
+ logger.error("Failed to apply react annotate plugin", _context4.t0);
10187
10180
  case 17:
10188
- return _context5.abrupt("return", {
10181
+ return _context4.abrupt("return", {
10189
10182
  code: code
10190
10183
  });
10191
10184
  case 18:
10192
10185
  case "end":
10193
- return _context5.stop();
10186
+ return _context4.stop();
10194
10187
  }
10195
- }, _callee5, null, [[7, 14]]);
10188
+ }, _callee4, null, [[7, 14]]);
10196
10189
  }))();
10197
10190
  }
10198
10191
  };