@sentry/esbuild-plugin
Advanced tools
Comparing version 2.6.2 to 2.7.0
@@ -477,2 +477,83 @@ 'use strict'; | ||
} | ||
function esbuildModuleMetadataInjectionPlugin(injectionCode) { | ||
var pluginName = "sentry-esbuild-module-metadata-injection-plugin"; | ||
var stubNamespace = "sentry-module-metadata-stub"; | ||
return { | ||
name: pluginName, | ||
esbuild: { | ||
setup: function setup(_ref3) { | ||
var onLoad = _ref3.onLoad, | ||
onResolve = _ref3.onResolve; | ||
onResolve({ | ||
filter: /.*/ | ||
}, function (args) { | ||
if (args.kind !== "entry-point") { | ||
return; | ||
} else { | ||
return { | ||
pluginName: pluginName, | ||
// needs to be an abs path, otherwise esbuild will complain | ||
path: path__namespace.isAbsolute(args.path) ? args.path : path__namespace.join(args.resolveDir, args.path), | ||
pluginData: { | ||
isMetadataProxyResolver: true, | ||
originalPath: args.path, | ||
originalResolveDir: args.resolveDir | ||
}, | ||
// We need to add a suffix here, otherwise esbuild will mark the entrypoint as resolved and won't traverse | ||
// the module tree any further down past the proxy module because we're essentially creating a dependency | ||
// loop back to the proxy module. | ||
// By setting a suffix we're telling esbuild that the entrypoint and proxy module are two different things, | ||
// making it re-resolve the entrypoint when it is imported from the proxy module. | ||
// Super confusing? Yes. Works? Apparently... Let's see. | ||
suffix: "?sentryMetadataProxyModule=true" | ||
}; | ||
} | ||
}); | ||
onLoad({ | ||
filter: /.*/ | ||
}, function (args) { | ||
var _args$pluginData2; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
if (!((_args$pluginData2 = args.pluginData) !== null && _args$pluginData2 !== void 0 && _args$pluginData2.isMetadataProxyResolver)) { | ||
return null; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
var originalPath = args.pluginData.originalPath; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
var originalResolveDir = args.pluginData.originalResolveDir; | ||
return { | ||
loader: "js", | ||
pluginName: pluginName, | ||
// We need to use JSON.stringify below so that any escape backslashes stay escape backslashes, in order not to break paths on windows | ||
contents: "\n import \"_sentry-module-metadata-injection-stub\";\n import * as OriginalModule from ".concat(JSON.stringify(originalPath), ";\n export default OriginalModule.default;\n export * from ").concat(JSON.stringify(originalPath), ";"), | ||
resolveDir: originalResolveDir | ||
}; | ||
}); | ||
onResolve({ | ||
filter: /_sentry-module-metadata-injection-stub/ | ||
}, function (args) { | ||
return { | ||
path: args.path, | ||
sideEffects: true, | ||
pluginName: pluginName, | ||
namespace: stubNamespace, | ||
suffix: "?sentry-module-id=" + uuid.v4() // create different module, each time this is resolved | ||
}; | ||
}); | ||
onLoad({ | ||
filter: /_sentry-module-metadata-injection-stub/, | ||
namespace: stubNamespace | ||
}, function () { | ||
return { | ||
loader: "js", | ||
pluginName: pluginName, | ||
contents: injectionCode | ||
}; | ||
}); | ||
} | ||
} | ||
}; | ||
} | ||
function esbuildDebugIdUploadPlugin(upload) { | ||
@@ -482,8 +563,8 @@ return { | ||
esbuild: { | ||
setup: function setup(_ref3) { | ||
var initialOptions = _ref3.initialOptions, | ||
onEnd = _ref3.onEnd; | ||
setup: function setup(_ref4) { | ||
var initialOptions = _ref4.initialOptions, | ||
onEnd = _ref4.onEnd; | ||
initialOptions.metafile = true; | ||
onEnd( /*#__PURE__*/function () { | ||
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) { | ||
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) { | ||
var buildArtifacts; | ||
@@ -503,3 +584,3 @@ return _regeneratorRuntime().wrap(function _callee$(_context) { | ||
return function (_x) { | ||
return _ref4.apply(this, arguments); | ||
return _ref5.apply(this, arguments); | ||
}; | ||
@@ -514,2 +595,3 @@ }()); | ||
debugIdInjectionPlugin: esbuildDebugIdInjectionPlugin, | ||
moduleMetadataInjectionPlugin: esbuildModuleMetadataInjectionPlugin, | ||
debugIdUploadPlugin: esbuildDebugIdUploadPlugin | ||
@@ -516,0 +598,0 @@ }); |
{ | ||
"name": "@sentry/esbuild-plugin", | ||
"version": "2.6.2", | ||
"version": "2.7.0", | ||
"description": "Official Sentry esbuild plugin", | ||
@@ -51,3 +51,3 @@ "repository": "git@github.com:getsentry/sentry-javascript-bundler-plugins.git", | ||
"dependencies": { | ||
"@sentry/bundler-plugin-core": "2.6.2", | ||
"@sentry/bundler-plugin-core": "2.7.0", | ||
"unplugin": "1.0.1", | ||
@@ -62,4 +62,4 @@ "uuid": "^9.0.0" | ||
"@rollup/plugin-node-resolve": "13.3.0", | ||
"@sentry-internal/eslint-config": "2.6.2", | ||
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.6.2", | ||
"@sentry-internal/eslint-config": "2.7.0", | ||
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.7.0", | ||
"@swc/core": "^1.2.205", | ||
@@ -66,0 +66,0 @@ "@swc/jest": "^0.2.21", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102303
1170
+ Added@sentry/bundler-plugin-core@2.7.0(transitive)
+ Added@sentry/cli@2.38.2(transitive)
+ Added@sentry/cli-darwin@2.38.2(transitive)
+ Added@sentry/cli-linux-arm64@2.38.2(transitive)
+ Added@sentry/cli-linux-i686@2.38.2(transitive)
+ Added@sentry/cli-linux-x64@2.38.2(transitive)
+ Added@sentry/cli-win32-i686@2.38.2(transitive)
+ Added@sentry/cli-win32-x64@2.38.2(transitive)
- Removed@sentry/bundler-plugin-core@2.6.2(transitive)
- Removed@sentry/cli@2.39.0(transitive)
- Removed@sentry/cli-darwin@2.39.0(transitive)
- Removed@sentry/cli-linux-arm@2.39.0(transitive)
- Removed@sentry/cli-linux-arm64@2.39.0(transitive)
- Removed@sentry/cli-linux-i686@2.39.0(transitive)
- Removed@sentry/cli-linux-x64@2.39.0(transitive)
- Removed@sentry/cli-win32-i686@2.39.0(transitive)
- Removed@sentry/cli-win32-x64@2.39.0(transitive)