@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/esm/index.mjs
CHANGED
|
@@ -8299,7 +8299,7 @@ function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
|
8299
8299
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8300
8300
|
tracesSampleRate: 1,
|
|
8301
8301
|
sampleRate: 1,
|
|
8302
|
-
release: "4.6.
|
|
8302
|
+
release: "4.6.2",
|
|
8303
8303
|
integrations: [],
|
|
8304
8304
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8305
8305
|
stackParser: stackParser,
|
|
@@ -8908,7 +8908,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
8908
8908
|
});
|
|
8909
8909
|
|
|
8910
8910
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8911
|
-
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.6.
|
|
8911
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "4.6.2");
|
|
8912
8912
|
|
|
8913
8913
|
// Propagate debug flag to Sentry CLI via environment variable
|
|
8914
8914
|
// Only set if not already defined to respect user's explicit configuration
|
|
@@ -9116,7 +9116,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9116
9116
|
*/
|
|
9117
9117
|
createRelease: function createRelease() {
|
|
9118
9118
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
9119
|
-
var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, normalizedInclude;
|
|
9119
|
+
var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, releaseOutput, normalizedInclude;
|
|
9120
9120
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
9121
9121
|
while (1) switch (_context7.prev = _context7.next) {
|
|
9122
9122
|
case 0:
|
|
@@ -9161,14 +9161,17 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9161
9161
|
_context7.prev = 24;
|
|
9162
9162
|
cliInstance = createCliInstance(options);
|
|
9163
9163
|
if (!options.release.create) {
|
|
9164
|
-
_context7.next =
|
|
9164
|
+
_context7.next = 31;
|
|
9165
9165
|
break;
|
|
9166
9166
|
}
|
|
9167
9167
|
_context7.next = 29;
|
|
9168
9168
|
return cliInstance.releases["new"](options.release.name);
|
|
9169
9169
|
case 29:
|
|
9170
|
+
releaseOutput = _context7.sent;
|
|
9171
|
+
logger.debug("Release created:", releaseOutput);
|
|
9172
|
+
case 31:
|
|
9170
9173
|
if (!options.release.uploadLegacySourcemaps) {
|
|
9171
|
-
_context7.next =
|
|
9174
|
+
_context7.next = 35;
|
|
9172
9175
|
break;
|
|
9173
9176
|
}
|
|
9174
9177
|
normalizedInclude = arrayify(options.release.uploadLegacySourcemaps).map(function (includeItem) {
|
|
@@ -9185,7 +9188,7 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9185
9188
|
ignore: includeEntry.ignore ? arrayify(includeEntry.ignore) : undefined
|
|
9186
9189
|
});
|
|
9187
9190
|
});
|
|
9188
|
-
_context7.next =
|
|
9191
|
+
_context7.next = 35;
|
|
9189
9192
|
return cliInstance.releases.uploadSourceMaps(options.release.name, {
|
|
9190
9193
|
include: normalizedInclude,
|
|
9191
9194
|
dist: options.release.dist,
|
|
@@ -9194,66 +9197,66 @@ function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
|
9194
9197
|
// see: https://github.com/getsentry/sentry-cli/pull/2605
|
|
9195
9198
|
live: "rejectOnError"
|
|
9196
9199
|
});
|
|
9197
|
-
case
|
|
9200
|
+
case 35:
|
|
9198
9201
|
if (!(options.release.setCommits !== false)) {
|
|
9199
|
-
_context7.next =
|
|
9202
|
+
_context7.next = 48;
|
|
9200
9203
|
break;
|
|
9201
9204
|
}
|
|
9202
|
-
_context7.prev =
|
|
9203
|
-
_context7.next =
|
|
9205
|
+
_context7.prev = 36;
|
|
9206
|
+
_context7.next = 39;
|
|
9204
9207
|
return cliInstance.releases.setCommits(options.release.name,
|
|
9205
9208
|
// set commits always exists due to the normalize function
|
|
9206
9209
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9207
9210
|
options.release.setCommits);
|
|
9208
|
-
case 37:
|
|
9209
|
-
_context7.next = 46;
|
|
9210
|
-
break;
|
|
9211
9211
|
case 39:
|
|
9212
|
-
_context7.
|
|
9213
|
-
|
|
9212
|
+
_context7.next = 48;
|
|
9213
|
+
break;
|
|
9214
|
+
case 41:
|
|
9215
|
+
_context7.prev = 41;
|
|
9216
|
+
_context7.t0 = _context7["catch"](36);
|
|
9214
9217
|
if (!(options.release.setCommits && "shouldNotThrowOnFailure" in options.release.setCommits && options.release.setCommits.shouldNotThrowOnFailure)) {
|
|
9215
|
-
_context7.next =
|
|
9218
|
+
_context7.next = 47;
|
|
9216
9219
|
break;
|
|
9217
9220
|
}
|
|
9218
9221
|
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context7.t0);
|
|
9219
|
-
_context7.next =
|
|
9222
|
+
_context7.next = 48;
|
|
9220
9223
|
break;
|
|
9221
|
-
case
|
|
9224
|
+
case 47:
|
|
9222
9225
|
throw _context7.t0;
|
|
9223
|
-
case
|
|
9226
|
+
case 48:
|
|
9224
9227
|
if (!options.release.finalize) {
|
|
9225
|
-
_context7.next =
|
|
9228
|
+
_context7.next = 51;
|
|
9226
9229
|
break;
|
|
9227
9230
|
}
|
|
9228
|
-
_context7.next =
|
|
9231
|
+
_context7.next = 51;
|
|
9229
9232
|
return cliInstance.releases.finalize(options.release.name);
|
|
9230
|
-
case
|
|
9233
|
+
case 51:
|
|
9231
9234
|
if (!options.release.deploy) {
|
|
9232
|
-
_context7.next =
|
|
9235
|
+
_context7.next = 54;
|
|
9233
9236
|
break;
|
|
9234
9237
|
}
|
|
9235
|
-
_context7.next =
|
|
9238
|
+
_context7.next = 54;
|
|
9236
9239
|
return cliInstance.releases.newDeploy(options.release.name, options.release.deploy);
|
|
9237
|
-
case 52:
|
|
9238
|
-
_context7.next = 60;
|
|
9239
|
-
break;
|
|
9240
9240
|
case 54:
|
|
9241
|
-
_context7.
|
|
9241
|
+
_context7.next = 62;
|
|
9242
|
+
break;
|
|
9243
|
+
case 56:
|
|
9244
|
+
_context7.prev = 56;
|
|
9242
9245
|
_context7.t1 = _context7["catch"](24);
|
|
9243
9246
|
sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
9244
|
-
_context7.next =
|
|
9247
|
+
_context7.next = 61;
|
|
9245
9248
|
return safeFlushTelemetry(sentryClient);
|
|
9246
|
-
case
|
|
9249
|
+
case 61:
|
|
9247
9250
|
handleRecoverableError(_context7.t1, false);
|
|
9248
|
-
case
|
|
9249
|
-
_context7.prev =
|
|
9251
|
+
case 62:
|
|
9252
|
+
_context7.prev = 62;
|
|
9250
9253
|
freeWriteBundleInvocationDependencyOnSourcemapFiles();
|
|
9251
|
-
return _context7.finish(
|
|
9252
|
-
case
|
|
9254
|
+
return _context7.finish(62);
|
|
9255
|
+
case 65:
|
|
9253
9256
|
case "end":
|
|
9254
9257
|
return _context7.stop();
|
|
9255
9258
|
}
|
|
9256
|
-
}, _callee7, null, [[24,
|
|
9259
|
+
}, _callee7, null, [[24, 56, 62, 65], [36, 41]]);
|
|
9257
9260
|
}))();
|
|
9258
9261
|
},
|
|
9259
9262
|
/*
|
|
@@ -9902,42 +9905,76 @@ var COMMENT_USE_STRICT_REGEX =
|
|
|
9902
9905
|
* about type mismatches
|
|
9903
9906
|
*/
|
|
9904
9907
|
|
|
9908
|
+
/**
|
|
9909
|
+
* Checks if a file is a JavaScript file based on its extension.
|
|
9910
|
+
* Handles query strings and hashes in the filename.
|
|
9911
|
+
*/
|
|
9912
|
+
function isJsFile(fileName) {
|
|
9913
|
+
var cleanFileName = stripQueryAndHashFromPath(fileName);
|
|
9914
|
+
return [".js", ".mjs", ".cjs"].some(function (ext) {
|
|
9915
|
+
return cleanFileName.endsWith(ext);
|
|
9916
|
+
});
|
|
9917
|
+
}
|
|
9918
|
+
|
|
9919
|
+
/**
|
|
9920
|
+
* Checks if a chunk should be skipped for code injection
|
|
9921
|
+
*
|
|
9922
|
+
* This is necessary to handle Vite's MPA (multi-page application) mode where
|
|
9923
|
+
* HTML entry points create "facade" chunks that should not contain injected code.
|
|
9924
|
+
* See: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/829
|
|
9925
|
+
*
|
|
9926
|
+
* @param code - The chunk's code content
|
|
9927
|
+
* @param facadeModuleId - The facade module ID (if any) - HTML files create facade chunks
|
|
9928
|
+
* @returns true if the chunk should be skipped
|
|
9929
|
+
*/
|
|
9930
|
+
function shouldSkipCodeInjection(code, facadeModuleId) {
|
|
9931
|
+
// Skip empty chunks - these are placeholder chunks that should be optimized away
|
|
9932
|
+
if (code.trim().length === 0) {
|
|
9933
|
+
return true;
|
|
9934
|
+
}
|
|
9935
|
+
|
|
9936
|
+
// Skip HTML facade chunks
|
|
9937
|
+
// They only contain import statements and should not have Sentry code injected
|
|
9938
|
+
if (facadeModuleId && stripQueryAndHashFromPath(facadeModuleId).endsWith(".html")) {
|
|
9939
|
+
return true;
|
|
9940
|
+
}
|
|
9941
|
+
return false;
|
|
9942
|
+
}
|
|
9905
9943
|
function createRollupReleaseInjectionHooks(injectionCode) {
|
|
9906
9944
|
return {
|
|
9907
9945
|
renderChunk: function renderChunk(code, chunk) {
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9911
|
-
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9912
|
-
})) {
|
|
9913
|
-
var _code$match;
|
|
9914
|
-
var ms = new MagicString(code, {
|
|
9915
|
-
filename: chunk.fileName
|
|
9916
|
-
});
|
|
9917
|
-
var match = (_code$match = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
9918
|
-
if (match) {
|
|
9919
|
-
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9920
|
-
ms.appendLeft(match.length, injectionCode);
|
|
9921
|
-
} else {
|
|
9922
|
-
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
9923
|
-
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
9924
|
-
// need this special case here.
|
|
9925
|
-
ms.prepend(injectionCode);
|
|
9926
|
-
}
|
|
9927
|
-
return {
|
|
9928
|
-
code: ms.toString(),
|
|
9929
|
-
map: ms.generateMap({
|
|
9930
|
-
file: chunk.fileName,
|
|
9931
|
-
hires: "boundary"
|
|
9932
|
-
})
|
|
9933
|
-
};
|
|
9934
|
-
} else {
|
|
9946
|
+
var _code$match;
|
|
9947
|
+
if (!isJsFile(chunk.fileName)) {
|
|
9935
9948
|
return null; // returning null means not modifying the chunk at all
|
|
9936
9949
|
}
|
|
9950
|
+
|
|
9951
|
+
// Skip empty chunks and HTML facade chunks (Vite MPA)
|
|
9952
|
+
if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {
|
|
9953
|
+
return null;
|
|
9954
|
+
}
|
|
9955
|
+
var ms = new MagicString(code, {
|
|
9956
|
+
filename: chunk.fileName
|
|
9957
|
+
});
|
|
9958
|
+
var match = (_code$match = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match === void 0 ? void 0 : _code$match[0];
|
|
9959
|
+
if (match) {
|
|
9960
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9961
|
+
ms.appendLeft(match.length, injectionCode);
|
|
9962
|
+
} else {
|
|
9963
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
9964
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
9965
|
+
// need this special case here.
|
|
9966
|
+
ms.prepend(injectionCode);
|
|
9967
|
+
}
|
|
9968
|
+
return {
|
|
9969
|
+
code: ms.toString(),
|
|
9970
|
+
map: ms.generateMap({
|
|
9971
|
+
file: chunk.fileName,
|
|
9972
|
+
hires: "boundary"
|
|
9973
|
+
})
|
|
9974
|
+
};
|
|
9937
9975
|
}
|
|
9938
9976
|
};
|
|
9939
9977
|
}
|
|
9940
|
-
|
|
9941
9978
|
function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
9942
9979
|
return {
|
|
9943
9980
|
transform: function transform(code) {
|
|
@@ -9948,77 +9985,83 @@ function createRollupBundleSizeOptimizationHooks(replacementValues) {
|
|
|
9948
9985
|
function createRollupDebugIdInjectionHooks() {
|
|
9949
9986
|
return {
|
|
9950
9987
|
renderChunk: function renderChunk(code, chunk) {
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9954
|
-
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9955
|
-
})) {
|
|
9956
|
-
var _code$match2;
|
|
9957
|
-
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
9958
|
-
var codeToInject = getDebugIdSnippet(debugId);
|
|
9959
|
-
var ms = new MagicString(code, {
|
|
9960
|
-
filename: chunk.fileName
|
|
9961
|
-
});
|
|
9962
|
-
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
9963
|
-
if (match) {
|
|
9964
|
-
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
9965
|
-
ms.appendLeft(match.length, codeToInject);
|
|
9966
|
-
} else {
|
|
9967
|
-
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
9968
|
-
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
9969
|
-
// need this special case here.
|
|
9970
|
-
ms.prepend(codeToInject);
|
|
9971
|
-
}
|
|
9972
|
-
return {
|
|
9973
|
-
code: ms.toString(),
|
|
9974
|
-
map: ms.generateMap({
|
|
9975
|
-
file: chunk.fileName,
|
|
9976
|
-
hires: "boundary"
|
|
9977
|
-
})
|
|
9978
|
-
};
|
|
9979
|
-
} else {
|
|
9988
|
+
var _code$match2;
|
|
9989
|
+
if (!isJsFile(chunk.fileName)) {
|
|
9980
9990
|
return null; // returning null means not modifying the chunk at all
|
|
9981
9991
|
}
|
|
9992
|
+
|
|
9993
|
+
// Skip empty chunks and HTML facade chunks (Vite MPA)
|
|
9994
|
+
if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {
|
|
9995
|
+
return null;
|
|
9996
|
+
}
|
|
9997
|
+
|
|
9998
|
+
// Check if a debug ID has already been injected to avoid duplicate injection (e.g. by another plugin or Sentry CLI)
|
|
9999
|
+
var chunkStartSnippet = code.slice(0, 6000);
|
|
10000
|
+
var chunkEndSnippet = code.slice(-500);
|
|
10001
|
+
if (chunkStartSnippet.includes("_sentryDebugIdIdentifier") || chunkEndSnippet.includes("//# debugId=")) {
|
|
10002
|
+
return null; // Debug ID already present, skip injection
|
|
10003
|
+
}
|
|
10004
|
+
|
|
10005
|
+
var debugId = stringToUUID(code); // generate a deterministic debug ID
|
|
10006
|
+
var codeToInject = getDebugIdSnippet(debugId);
|
|
10007
|
+
var ms = new MagicString(code, {
|
|
10008
|
+
filename: chunk.fileName
|
|
10009
|
+
});
|
|
10010
|
+
var match = (_code$match2 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match2 === void 0 ? void 0 : _code$match2[0];
|
|
10011
|
+
if (match) {
|
|
10012
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
10013
|
+
ms.appendLeft(match.length, codeToInject);
|
|
10014
|
+
} else {
|
|
10015
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
10016
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
10017
|
+
// need this special case here.
|
|
10018
|
+
ms.prepend(codeToInject);
|
|
10019
|
+
}
|
|
10020
|
+
return {
|
|
10021
|
+
code: ms.toString(),
|
|
10022
|
+
map: ms.generateMap({
|
|
10023
|
+
file: chunk.fileName,
|
|
10024
|
+
hires: "boundary"
|
|
10025
|
+
})
|
|
10026
|
+
};
|
|
9982
10027
|
}
|
|
9983
10028
|
};
|
|
9984
10029
|
}
|
|
9985
|
-
|
|
9986
10030
|
function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
9987
10031
|
return {
|
|
9988
10032
|
renderChunk: function renderChunk(code, chunk) {
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
[".js", ".mjs", ".cjs"].some(function (ending) {
|
|
9992
|
-
return stripQueryAndHashFromPath(chunk.fileName).endsWith(ending);
|
|
9993
|
-
})) {
|
|
9994
|
-
var _code$match3;
|
|
9995
|
-
var ms = new MagicString(code, {
|
|
9996
|
-
filename: chunk.fileName
|
|
9997
|
-
});
|
|
9998
|
-
var match = (_code$match3 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match3 === void 0 ? void 0 : _code$match3[0];
|
|
9999
|
-
if (match) {
|
|
10000
|
-
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
10001
|
-
ms.appendLeft(match.length, injectionCode);
|
|
10002
|
-
} else {
|
|
10003
|
-
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
10004
|
-
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
10005
|
-
// need this special case here.
|
|
10006
|
-
ms.prepend(injectionCode);
|
|
10007
|
-
}
|
|
10008
|
-
return {
|
|
10009
|
-
code: ms.toString(),
|
|
10010
|
-
map: ms.generateMap({
|
|
10011
|
-
file: chunk.fileName,
|
|
10012
|
-
hires: "boundary"
|
|
10013
|
-
})
|
|
10014
|
-
};
|
|
10015
|
-
} else {
|
|
10033
|
+
var _code$match3;
|
|
10034
|
+
if (!isJsFile(chunk.fileName)) {
|
|
10016
10035
|
return null; // returning null means not modifying the chunk at all
|
|
10017
10036
|
}
|
|
10037
|
+
|
|
10038
|
+
// Skip empty chunks and HTML facade chunks (Vite MPA)
|
|
10039
|
+
if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {
|
|
10040
|
+
return null;
|
|
10041
|
+
}
|
|
10042
|
+
var ms = new MagicString(code, {
|
|
10043
|
+
filename: chunk.fileName
|
|
10044
|
+
});
|
|
10045
|
+
var match = (_code$match3 = code.match(COMMENT_USE_STRICT_REGEX)) === null || _code$match3 === void 0 ? void 0 : _code$match3[0];
|
|
10046
|
+
if (match) {
|
|
10047
|
+
// Add injected code after any comments or "use strict" at the beginning of the bundle.
|
|
10048
|
+
ms.appendLeft(match.length, injectionCode);
|
|
10049
|
+
} else {
|
|
10050
|
+
// ms.replace() doesn't work when there is an empty string match (which happens if
|
|
10051
|
+
// there is neither, a comment, nor a "use strict" at the top of the chunk) so we
|
|
10052
|
+
// need this special case here.
|
|
10053
|
+
ms.prepend(injectionCode);
|
|
10054
|
+
}
|
|
10055
|
+
return {
|
|
10056
|
+
code: ms.toString(),
|
|
10057
|
+
map: ms.generateMap({
|
|
10058
|
+
file: chunk.fileName,
|
|
10059
|
+
hires: "boundary"
|
|
10060
|
+
})
|
|
10061
|
+
};
|
|
10018
10062
|
}
|
|
10019
10063
|
};
|
|
10020
10064
|
}
|
|
10021
|
-
|
|
10022
10065
|
function createRollupDebugIdUploadHooks(upload, _logger, createDependencyOnBuildArtifacts) {
|
|
10023
10066
|
var freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();
|
|
10024
10067
|
return {
|