@sentry/bundler-plugin-core 4.6.0 → 4.6.2
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 +164 -121
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +164 -121
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/build-plugin-manager.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -5
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.6.
|
|
8339
|
+
release: "4.6.2",
|
|
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.6.
|
|
8948
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.6.2");
|
|
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 =
|
|
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 =
|
|
9211
|
+
_context7.next = 35;
|
|
9209
9212
|
break;
|
|
9210
9213
|
}
|
|
9211
9214
|
normalizedInclude = arrayify(options.release.uploadLegacySourcemaps).map(function (includeItem) {
|
|
@@ -9222,7 +9225,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9222
9225
|
ignore: includeEntry.ignore ? arrayify(includeEntry.ignore) : undefined
|
|
9223
9226
|
});
|
|
9224
9227
|
});
|
|
9225
|
-
_context7.next =
|
|
9228
|
+
_context7.next = 35;
|
|
9226
9229
|
return cliInstance.releases.uploadSourceMaps(options.release.name, {
|
|
9227
9230
|
include: normalizedInclude,
|
|
9228
9231
|
dist: options.release.dist,
|
|
@@ -9231,66 +9234,66 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9231
9234
|
// see: https://github.com/getsentry/sentry-cli/pull/2605
|
|
9232
9235
|
live: "rejectOnError"
|
|
9233
9236
|
});
|
|
9234
|
-
case
|
|
9237
|
+
case 35:
|
|
9235
9238
|
if (!(options.release.setCommits !== false)) {
|
|
9236
|
-
_context7.next =
|
|
9239
|
+
_context7.next = 48;
|
|
9237
9240
|
break;
|
|
9238
9241
|
}
|
|
9239
|
-
_context7.prev =
|
|
9240
|
-
_context7.next =
|
|
9242
|
+
_context7.prev = 36;
|
|
9243
|
+
_context7.next = 39;
|
|
9241
9244
|
return cliInstance.releases.setCommits(options.release.name,
|
|
9242
9245
|
// set commits always exists due to the normalize function
|
|
9243
9246
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9244
9247
|
options.release.setCommits);
|
|
9245
|
-
case 37:
|
|
9246
|
-
_context7.next = 46;
|
|
9247
|
-
break;
|
|
9248
9248
|
case 39:
|
|
9249
|
-
_context7.
|
|
9250
|
-
|
|
9249
|
+
_context7.next = 48;
|
|
9250
|
+
break;
|
|
9251
|
+
case 41:
|
|
9252
|
+
_context7.prev = 41;
|
|
9253
|
+
_context7.t0 = _context7["catch"](36);
|
|
9251
9254
|
if (!(options.release.setCommits && "shouldNotThrowOnFailure" in options.release.setCommits && options.release.setCommits.shouldNotThrowOnFailure)) {
|
|
9252
|
-
_context7.next =
|
|
9255
|
+
_context7.next = 47;
|
|
9253
9256
|
break;
|
|
9254
9257
|
}
|
|
9255
9258
|
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context7.t0);
|
|
9256
|
-
_context7.next =
|
|
9259
|
+
_context7.next = 48;
|
|
9257
9260
|
break;
|
|
9258
|
-
case
|
|
9261
|
+
case 47:
|
|
9259
9262
|
throw _context7.t0;
|
|
9260
|
-
case
|
|
9263
|
+
case 48:
|
|
9261
9264
|
if (!options.release.finalize) {
|
|
9262
|
-
_context7.next =
|
|
9265
|
+
_context7.next = 51;
|
|
9263
9266
|
break;
|
|
9264
9267
|
}
|
|
9265
|
-
_context7.next =
|
|
9268
|
+
_context7.next = 51;
|
|
9266
9269
|
return cliInstance.releases.finalize(options.release.name);
|
|
9267
|
-
case
|
|
9270
|
+
case 51:
|
|
9268
9271
|
if (!options.release.deploy) {
|
|
9269
|
-
_context7.next =
|
|
9272
|
+
_context7.next = 54;
|
|
9270
9273
|
break;
|
|
9271
9274
|
}
|
|
9272
|
-
_context7.next =
|
|
9275
|
+
_context7.next = 54;
|
|
9273
9276
|
return cliInstance.releases.newDeploy(options.release.name, options.release.deploy);
|
|
9274
|
-
case 52:
|
|
9275
|
-
_context7.next = 60;
|
|
9276
|
-
break;
|
|
9277
9277
|
case 54:
|
|
9278
|
-
_context7.
|
|
9278
|
+
_context7.next = 62;
|
|
9279
|
+
break;
|
|
9280
|
+
case 56:
|
|
9281
|
+
_context7.prev = 56;
|
|
9279
9282
|
_context7.t1 = _context7["catch"](24);
|
|
9280
9283
|
sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
9281
|
-
_context7.next =
|
|
9284
|
+
_context7.next = 61;
|
|
9282
9285
|
return safeFlushTelemetry(sentryClient);
|
|
9283
|
-
case
|
|
9286
|
+
case 61:
|
|
9284
9287
|
handleRecoverableError(_context7.t1, false);
|
|
9285
|
-
case
|
|
9286
|
-
_context7.prev =
|
|
9288
|
+
case 62:
|
|
9289
|
+
_context7.prev = 62;
|
|
9287
9290
|
freeWriteBundleInvocationDependencyOnSourcemapFiles();
|
|
9288
|
-
return _context7.finish(
|
|
9289
|
-
case
|
|
9291
|
+
return _context7.finish(62);
|
|
9292
|
+
case 65:
|
|
9290
9293
|
case "end":
|
|
9291
9294
|
return _context7.stop();
|
|
9292
9295
|
}
|
|
9293
|
-
}, _callee7, null, [[24,
|
|
9296
|
+
}, _callee7, null, [[24, 56, 62, 65], [36, 41]]);
|
|
9294
9297
|
}))();
|
|
9295
9298
|
},
|
|
9296
9299
|
/*
|
|
@@ -9939,42 +9942,76 @@ var COMMENT_USE_STRICT_REGEX =
|
|
|
9939
9942
|
* about type mismatches
|
|
9940
9943
|
*/
|
|
9941
9944
|
|
|
9945
|
+
/**
|
|
9946
|
+
* Checks if a file is a JavaScript file based on its extension.
|
|
9947
|
+
* Handles query strings and hashes in the filename.
|
|
9948
|
+
*/
|
|
9949
|
+
function isJsFile(fileName) {
|
|
9950
|
+
var cleanFileName = stripQueryAndHashFromPath(fileName);
|
|
9951
|
+
return [".js", ".mjs", ".cjs"].some(function (ext) {
|
|
9952
|
+
return cleanFileName.endsWith(ext);
|
|
9953
|
+
});
|
|
9954
|
+
}
|
|
9955
|
+
|
|
9956
|
+
/**
|
|
9957
|
+
* Checks if a chunk should be skipped for code injection
|
|
9958
|
+
*
|
|
9959
|
+
* This is necessary to handle Vite's MPA (multi-page application) mode where
|
|
9960
|
+
* HTML entry points create "facade" chunks that should not contain injected code.
|
|
9961
|
+
* See: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/829
|
|
9962
|
+
*
|
|
9963
|
+
* @param code - The chunk's code content
|
|
9964
|
+
* @param facadeModuleId - The facade module ID (if any) - HTML files create facade chunks
|
|
9965
|
+
* @returns true if the chunk should be skipped
|
|
9966
|
+
*/
|
|
9967
|
+
function shouldSkipCodeInjection(code, facadeModuleId) {
|
|
9968
|
+
// Skip empty chunks - these are placeholder chunks that should be optimized away
|
|
9969
|
+
if (code.trim().length === 0) {
|
|
9970
|
+
return true;
|
|
9971
|
+
}
|
|
9972
|
+
|
|
9973
|
+
// Skip HTML facade chunks
|
|
9974
|
+
// They only contain import statements and should not have Sentry code injected
|
|
9975
|
+
if (facadeModuleId && stripQueryAndHashFromPath(facadeModuleId).endsWith(".html")) {
|
|
9976
|
+
return true;
|
|
9977
|
+
}
|
|
9978
|
+
return false;
|
|
9979
|
+
}
|
|
9942
9980
|
function createRollupReleaseInjectionHooks(injectionCode) {
|
|
9943
9981
|
return {
|
|
9944
9982
|
renderChunk: function renderChunk(code, chunk) {
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9948
|
-
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9949
|
-
})) {
|
|
9950
|
-
var _code$match;
|
|
9951
|
-
var ms = new MagicString__default["default"](code, {
|
|
9952
|
-
filename: chunk.fileName
|
|
9953
|
-
});
|
|
9954
|
-
var match = (_code$match = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
9955
|
-
if (match) {
|
|
9956
|
-
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9957
|
-
ms.appendLeft(match.length, injectionCode);
|
|
9958
|
-
} else {
|
|
9959
|
-
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
9960
|
-
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
9961
|
-
// need this special case here.
|
|
9962
|
-
ms.prepend(injectionCode);
|
|
9963
|
-
}
|
|
9964
|
-
return {
|
|
9965
|
-
code: ms.toString(),
|
|
9966
|
-
map: ms.generateMap({
|
|
9967
|
-
file: chunk.fileName,
|
|
9968
|
-
hires: "boundary"
|
|
9969
|
-
})
|
|
9970
|
-
};
|
|
9971
|
-
} else {
|
|
9983
|
+
var _code$match;
|
|
9984
|
+
if (!isJsFile(chunk.fileName)) {
|
|
9972
9985
|
return null; // returning null means not modifying the chunk at all
|
|
9973
9986
|
}
|
|
9987
|
+
|
|
9988
|
+
// Skip empty chunks and HTML facade chunks (Vite MPA)
|
|
9989
|
+
if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {
|
|
9990
|
+
return null;
|
|
9991
|
+
}
|
|
9992
|
+
var ms = new MagicString__default["default"](code, {
|
|
9993
|
+
filename: chunk.fileName
|
|
9994
|
+
});
|
|
9995
|
+
var match = (_code$match = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
9996
|
+
if (match) {
|
|
9997
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9998
|
+
ms.appendLeft(match.length, injectionCode);
|
|
9999
|
+
} else {
|
|
10000
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
10001
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
10002
|
+
// need this special case here.
|
|
10003
|
+
ms.prepend(injectionCode);
|
|
10004
|
+
}
|
|
10005
|
+
return {
|
|
10006
|
+
code: ms.toString(),
|
|
10007
|
+
map: ms.generateMap({
|
|
10008
|
+
file: chunk.fileName,
|
|
10009
|
+
hires: "boundary"
|
|
10010
|
+
})
|
|
10011
|
+
};
|
|
9974
10012
|
}
|
|
9975
10013
|
};
|
|
9976
10014
|
}
|
|
9977
|
-
|
|
9978
10015
|
function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
9979
10016
|
return {
|
|
9980
10017
|
transform: function transform(code) {
|
|
@@ -9985,77 +10022,83 @@ function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
|
9985
10022
|
function createRollupDebugIdInjectionHooks() {
|
|
9986
10023
|
return {
|
|
9987
10024
|
renderChunk: function renderChunk(code, chunk) {
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9991
|
-
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9992
|
-
})) {
|
|
9993
|
-
var _code$match2;
|
|
9994
|
-
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
9995
|
-
var codeToInject = getDebugIdSnippet(debugId);
|
|
9996
|
-
var ms = new MagicString__default["default"](code, {
|
|
9997
|
-
filename: chunk.fileName
|
|
9998
|
-
});
|
|
9999
|
-
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
10000
|
-
if (match) {
|
|
10001
|
-
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
10002
|
-
ms.appendLeft(match.length, codeToInject);
|
|
10003
|
-
} else {
|
|
10004
|
-
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
10005
|
-
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
10006
|
-
// need this special case here.
|
|
10007
|
-
ms.prepend(codeToInject);
|
|
10008
|
-
}
|
|
10009
|
-
return {
|
|
10010
|
-
code: ms.toString(),
|
|
10011
|
-
map: ms.generateMap({
|
|
10012
|
-
file: chunk.fileName,
|
|
10013
|
-
hires: "boundary"
|
|
10014
|
-
})
|
|
10015
|
-
};
|
|
10016
|
-
} else {
|
|
10025
|
+
var _code$match2;
|
|
10026
|
+
if (!isJsFile(chunk.fileName)) {
|
|
10017
10027
|
return null; // returning null means not modifying the chunk at all
|
|
10018
10028
|
}
|
|
10029
|
+
|
|
10030
|
+
// Skip empty chunks and HTML facade chunks (Vite MPA)
|
|
10031
|
+
if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {
|
|
10032
|
+
return null;
|
|
10033
|
+
}
|
|
10034
|
+
|
|
10035
|
+
// Check if a debug ID has already been injected to avoid duplicate injection (e.g. by another plugin or Sentry CLI)
|
|
10036
|
+
var chunkStartSnippet = code.slice(0, 6000);
|
|
10037
|
+
var chunkEndSnippet = code.slice(-500);
|
|
10038
|
+
if (chunkStartSnippet.includes("_sentryDebugIdIdentifier") || chunkEndSnippet.includes("//# debugId=")) {
|
|
10039
|
+
return null; // Debug ID already present, skip injection
|
|
10040
|
+
}
|
|
10041
|
+
|
|
10042
|
+
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
10043
|
+
var codeToInject = getDebugIdSnippet(debugId);
|
|
10044
|
+
var ms = new MagicString__default["default"](code, {
|
|
10045
|
+
filename: chunk.fileName
|
|
10046
|
+
});
|
|
10047
|
+
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
10048
|
+
if (match) {
|
|
10049
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
10050
|
+
ms.appendLeft(match.length, codeToInject);
|
|
10051
|
+
} else {
|
|
10052
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
10053
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
10054
|
+
// need this special case here.
|
|
10055
|
+
ms.prepend(codeToInject);
|
|
10056
|
+
}
|
|
10057
|
+
return {
|
|
10058
|
+
code: ms.toString(),
|
|
10059
|
+
map: ms.generateMap({
|
|
10060
|
+
file: chunk.fileName,
|
|
10061
|
+
hires: "boundary"
|
|
10062
|
+
})
|
|
10063
|
+
};
|
|
10019
10064
|
}
|
|
10020
10065
|
};
|
|
10021
10066
|
}
|
|
10022
|
-
|
|
10023
10067
|
function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
10024
10068
|
return {
|
|
10025
10069
|
renderChunk: function renderChunk(code, chunk) {
|
|
10026
|
-
|
|
10027
|
-
|
|
10028
|
-
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
10029
|
-
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
10030
|
-
})) {
|
|
10031
|
-
var _code$match3;
|
|
10032
|
-
var ms = new MagicString__default["default"](code, {
|
|
10033
|
-
filename: chunk.fileName
|
|
10034
|
-
});
|
|
10035
|
-
var match = (_code$match3 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match3 === void 0 ? void 0 : _code$match3[0];
|
|
10036
|
-
if (match) {
|
|
10037
|
-
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
10038
|
-
ms.appendLeft(match.length, injectionCode);
|
|
10039
|
-
} else {
|
|
10040
|
-
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
10041
|
-
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
10042
|
-
// need this special case here.
|
|
10043
|
-
ms.prepend(injectionCode);
|
|
10044
|
-
}
|
|
10045
|
-
return {
|
|
10046
|
-
code: ms.toString(),
|
|
10047
|
-
map: ms.generateMap({
|
|
10048
|
-
file: chunk.fileName,
|
|
10049
|
-
hires: "boundary"
|
|
10050
|
-
})
|
|
10051
|
-
};
|
|
10052
|
-
} else {
|
|
10070
|
+
var _code$match3;
|
|
10071
|
+
if (!isJsFile(chunk.fileName)) {
|
|
10053
10072
|
return null; // returning null means not modifying the chunk at all
|
|
10054
10073
|
}
|
|
10074
|
+
|
|
10075
|
+
// Skip empty chunks and HTML facade chunks (Vite MPA)
|
|
10076
|
+
if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {
|
|
10077
|
+
return null;
|
|
10078
|
+
}
|
|
10079
|
+
var ms = new MagicString__default["default"](code, {
|
|
10080
|
+
filename: chunk.fileName
|
|
10081
|
+
});
|
|
10082
|
+
var match = (_code$match3 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match3 === void 0 ? void 0 : _code$match3[0];
|
|
10083
|
+
if (match) {
|
|
10084
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
10085
|
+
ms.appendLeft(match.length, injectionCode);
|
|
10086
|
+
} else {
|
|
10087
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
10088
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
10089
|
+
// need this special case here.
|
|
10090
|
+
ms.prepend(injectionCode);
|
|
10091
|
+
}
|
|
10092
|
+
return {
|
|
10093
|
+
code: ms.toString(),
|
|
10094
|
+
map: ms.generateMap({
|
|
10095
|
+
file: chunk.fileName,
|
|
10096
|
+
hires: "boundary"
|
|
10097
|
+
})
|
|
10098
|
+
};
|
|
10055
10099
|
}
|
|
10056
10100
|
};
|
|
10057
10101
|
}
|
|
10058
|
-
|
|
10059
10102
|
function createRollupDebugIdUploadHooks(upload, _logger, createDependencyOnBuildArtifacts) {
|
|
10060
10103
|
var freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();
|
|
10061
10104
|
return {
|