Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(bundler): Add Node bundler plugins#22125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
1c327f3c440ac14675d52f9aaa971c7f76c4108067b15cb002875e5ff6fde40c85a0c8a0c515d485a00c4067e6924b22fbc8819f3038f47bb969d0f882e9e61f36aeccd28c1eaeb5e75e0e0bd9be36e7d9b582391a1b63a841874eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import { sentryEsbuildPlugin as sentryEsbuildBundlerPlugin } from '@sentry/bundler-plugins/esbuild'; | ||
| import type { SentryEsbuildPluginOptions as SentryEsbuildPluginOptionsBase } from '@sentry/bundler-plugins/esbuild'; | ||
| import { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/esbuild'; | ||
| export type SentryEsbuildPluginOptions = SentryEsbuildPluginOptionsBase & { | ||
| /** | ||
| * @ignore This is for internal use only when this plugin is consumed by a framework SDK | ||
| */ | ||
| instrumentations?: NonNullable<Parameters<typeof sentryOrchestrionPlugin>[0]>['instrumentations']; | ||
| }; | ||
| type EsbuildPlugin = ReturnType<typeof sentryOrchestrionPlugin>; | ||
| /** | ||
| * esbuild plugin that bundles the Sentry esbuild bundler plugin (source maps, | ||
| * release injection, …) together with the code transformer | ||
| * (build-time `diagnostics_channel` instrumentation for Node libraries). | ||
| * | ||
| * It is a drop-in replacement for `@sentry/bundler-plugins/esbuild` and accepts | ||
| * the same options. | ||
| * @example | ||
| * ```ts | ||
| * // build.mjs | ||
| * import { sentryEsbuildPlugin } from '@sentry/node/esbuild'; | ||
| * await esbuild.build({ plugins: [sentryEsbuildPlugin({ org: '…', project: '…' })] }); | ||
| * ``` | ||
| */ | ||
| export function sentryEsbuildPlugin(options?: SentryEsbuildPluginOptions): EsbuildPlugin { | ||
| const bundlerPlugin = sentryEsbuildBundlerPlugin(options) as EsbuildPlugin; | ||
| const orchestrionPlugin = sentryOrchestrionPlugin(options); | ||
| return { | ||
| name: 'sentry-node-esbuild', | ||
| async setup(build): Promise<void> { | ||
| await bundlerPlugin.setup(build); | ||
| await orchestrionPlugin.setup(build); | ||
| }, | ||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { sentryRollupPlugin as sentryRollupBundlerPlugin } from '@sentry/bundler-plugins/rollup'; | ||
| import type { SentryRollupPluginOptions as SentryRollupPluginOptionsBase } from '@sentry/bundler-plugins/rollup'; | ||
| import { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/rollup'; | ||
| export type SentryRollupPluginOptions = SentryRollupPluginOptionsBase & { | ||
| /** | ||
| * @ignore This is for internal use only when this plugin is consumed by a framework SDK | ||
| */ | ||
| instrumentations?: NonNullable<Parameters<typeof sentryOrchestrionPlugin>[0]>['instrumentations']; | ||
| }; | ||
| type RollupPlugin = ReturnType<typeof sentryOrchestrionPlugin>; | ||
| /** | ||
| * Rollup plugin that bundles the Sentry Rollup bundler plugin (source maps, | ||
| * release injection, bundle size optimizations, …) together with the | ||
| * code transformer (build-time `diagnostics_channel` instrumentation | ||
| * for Node libraries). | ||
| * | ||
| * It is a drop-in replacement for `@sentry/bundler-plugins/rollup` and accepts | ||
| * the same options. | ||
| * @example | ||
| * ```ts | ||
| * // rollup.config.js | ||
| * import { sentryRollupPlugin } from '@sentry/node/rollup'; | ||
| * export default { plugins: [sentryRollupPlugin({ org: '…', project: '…' })] }; | ||
| * ``` | ||
| */ | ||
| export function sentryRollupPlugin(options?: SentryRollupPluginOptions): RollupPlugin[] { | ||
| return [...sentryRollupBundlerPlugin(options), sentryOrchestrionPlugin(options)]; | ||
| } | ||
timfish marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import { sentryVitePlugin as sentryViteBundlerPlugin } from '@sentry/bundler-plugins/vite'; | ||
| import type { SentryVitePluginOptions as SentryVitePluginOptionsBase } from '@sentry/bundler-plugins/vite'; | ||
| import { sentryOrchestrionPlugin } from '@sentry/server-utils/orchestrion/vite'; | ||
| export type SentryVitePluginOptions = SentryVitePluginOptionsBase & { | ||
| /** | ||
| * @ignore This is for internal use only when this plugin is consumed by a framework SDK | ||
| */ | ||
| instrumentations?: NonNullable<Parameters<typeof sentryOrchestrionPlugin>[0]>['instrumentations']; | ||
| }; | ||
| type VitePlugin = ReturnType<typeof sentryOrchestrionPlugin>; | ||
| /** | ||
| * Vite plugin that bundles the Sentry Vite bundler plugin (source maps, release | ||
| * injection, bundle size optimizations, …) together with the code | ||
| * transformer (build-time `diagnostics_channel` instrumentation for Node | ||
| * libraries). | ||
| * | ||
| * It is a drop-in replacement for `@sentry/bundler-plugins/vite` and accepts the | ||
| * same options. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * // vite.config.ts | ||
| * import { sentryVitePlugin } from '@sentry/node/vite'; | ||
| * export default { plugins: [sentryVitePlugin({ org: '…', project: '…' })] }; | ||
| * ``` | ||
| */ | ||
| export function sentryVitePlugin(options?: SentryVitePluginOptions): VitePlugin[] { | ||
| return [...sentryViteBundlerPlugin(options), sentryOrchestrionPlugin(options)]; | ||
cursor[bot] marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
timfish marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. timfish marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { sentryWebpackPlugin as sentryWebpackBundlerPlugin } from '@sentry/bundler-plugins/webpack'; | ||
| import type { SentryWebpackPluginOptions as SentryWebpackPluginOptionsBase } from '@sentry/bundler-plugins/webpack'; | ||
| import { sentryOrchestrionWebpackPlugin } from '@sentry/server-utils/orchestrion/webpack'; | ||
| export type SentryWebpackPluginOptions = SentryWebpackPluginOptionsBase & { | ||
| /** | ||
| * @ignore This is for internal use only when this plugin is consumed by a framework SDK | ||
| */ | ||
| instrumentations?: NonNullable<Parameters<typeof sentryOrchestrionWebpackPlugin>[0]>['instrumentations']; | ||
| }; | ||
| type WebpackCompiler = Parameters<ReturnType<typeof sentryWebpackBundlerPlugin>['apply']>[0]; | ||
| /** | ||
| * webpack plugin that bundles the Sentry webpack bundler plugin (source maps, | ||
| * release injection, …) together with the code transformer | ||
| * (build-time `diagnostics_channel` instrumentation for Node libraries). | ||
| * | ||
| * It is a drop-in replacement for `@sentry/bundler-plugins/webpack` and accepts | ||
| * the same options. | ||
| * @example | ||
| * ```ts | ||
| * // webpack.config.mjs | ||
| * import { sentryWebpackPlugin } from '@sentry/node/webpack'; | ||
| * export default { plugins: [sentryWebpackPlugin({ org: '…', project: '…' })] }; | ||
| * ``` | ||
| */ | ||
| export function sentryWebpackPlugin(options?: SentryWebpackPluginOptions): { | ||
| apply: (compiler: WebpackCompiler) => void; | ||
| } { | ||
| const bundlerPlugin = sentryWebpackBundlerPlugin(options) as { apply: (compiler: WebpackCompiler) => void }; | ||
| const orchestrionPlugin = sentryOrchestrionWebpackPlugin(options) as { apply: (compiler: WebpackCompiler) => void }; | ||
| return { | ||
| apply(compiler: WebpackCompiler): void { | ||
| bundlerPlugin.apply(compiler); | ||
| orchestrionPlugin.apply(compiler); | ||
| }, | ||
| }; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.