-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(effect): Add client/server entrypoints without functionality #19649
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,25 @@ | ||
| import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; | ||
|
|
||
| export default makeNPMConfigVariants( | ||
| makeBaseNPMConfig({ | ||
| packageSpecificConfig: { | ||
| output: { | ||
| preserveModulesRoot: 'src', | ||
| }, | ||
| const baseConfig = makeBaseNPMConfig({ | ||
| entrypoints: ['src/index.server.ts', 'src/index.client.ts'], | ||
| packageSpecificConfig: { | ||
| output: { | ||
| preserveModulesRoot: 'src', | ||
| }, | ||
| }), | ||
| ); | ||
| }, | ||
| }); | ||
|
|
||
| const defaultExternal = baseConfig.external || []; | ||
| baseConfig.external = id => { | ||
| if (defaultExternal.includes(id)) { | ||
| return true; | ||
| } | ||
|
|
||
| if (id === 'effect' || id.startsWith('effect/') || id.startsWith('@sentry/')) { | ||
| return true; | ||
| } | ||
|
|
||
| return false; | ||
| }; | ||
|
|
||
| export default makeNPMConfigVariants(baseConfig); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import type { BrowserOptions } from '@sentry/browser'; | ||
| import * as EffectLayer from 'effect/Layer'; | ||
|
|
||
| /** | ||
| * Options for the Sentry Effect client layer. | ||
| */ | ||
| export type EffectClientLayerOptions = BrowserOptions; | ||
|
|
||
| /** | ||
| * Creates an empty Effect Layer | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * import * as Sentry from '@sentry/effect/client'; | ||
| * import { Layer, Effect } from 'effect'; | ||
| * | ||
| * const ApiClientWithSentry = ApiClientLive.pipe( | ||
| * Layer.provide(Sentry.effectLayer({ | ||
| * dsn: '__DSN__', | ||
| * integrations: [Sentry.browserTracingIntegration()], | ||
| * tracesSampleRate: 1.0, | ||
| * })), | ||
| * ); | ||
| * | ||
| * Effect.runPromise(Effect.provide(myEffect, ApiClientWithSentry)); | ||
| * ``` | ||
| */ | ||
| export function effectLayer(_: EffectClientLayerOptions): EffectLayer.Layer<never, never, never> { | ||
| return EffectLayer.empty; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export * from '@sentry/browser'; | ||
|
|
||
| export { effectLayer } from './client/index'; | ||
| export type { EffectClientLayerOptions } from './client/index'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export * from '@sentry/node-core/light'; | ||
|
|
||
| export { effectLayer } from './server/index'; | ||
| export type { EffectServerLayerOptions } from './server/index'; |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* eslint-disable import/export */ | ||
|
|
||
| // We export everything from both the client part of the SDK and from the server part. | ||
| // Some of the exports collide, which is not allowed, unless we redefine the colliding | ||
| // exports in this file - which we do below. | ||
| import type { Client, Integration, Options, StackParser } from '@sentry/core'; | ||
| import type * as EffectLayer from 'effect/Layer'; | ||
| import type * as clientSdk from './index.client'; | ||
| import type * as serverSdk from './index.server'; | ||
|
|
||
| export * from './index.client'; | ||
| export * from './index.server'; | ||
|
|
||
| export type { EffectClientLayerOptions } from './index.client'; | ||
| export type { EffectServerLayerOptions } from './index.server'; | ||
|
|
||
| export declare function effectLayer( | ||
| options: clientSdk.EffectClientLayerOptions | serverSdk.EffectServerLayerOptions, | ||
| ): EffectLayer.Layer<never, never, never>; | ||
|
|
||
| export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): Client | undefined; | ||
| export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration; | ||
| export declare const contextLinesIntegration: typeof clientSdk.contextLinesIntegration; | ||
| export declare const getDefaultIntegrations: (options: Options) => Integration[]; | ||
| export declare const defaultStackParser: StackParser; | ||
| export declare const logger: typeof clientSdk.logger | typeof serverSdk.logger; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import type { NodeOptions } from '@sentry/node-core'; | ||
| import * as EffectLayer from 'effect/Layer'; | ||
|
|
||
| /** | ||
| * Options for the Sentry Effect server layer. | ||
| */ | ||
| export type EffectServerLayerOptions = NodeOptions; | ||
|
|
||
| /** | ||
| * Creates an empty Effect Layer | ||
| * | ||
| * @example | ||
| * ```typescript | ||
| * import * as Sentry from '@sentry/effect/server'; | ||
| * import { NodeRuntime } from '@effect/platform-node'; | ||
| * import { Layer } from 'effect'; | ||
| * import { HttpLive } from './Http.js'; | ||
| * | ||
| * const MainLive = HttpLive.pipe( | ||
| * Layer.provide(Sentry.effectLayer({ | ||
| * dsn: '__DSN__', | ||
| * enableLogs: true, | ||
| * enableMetrics: true, | ||
| * })), | ||
| * ); | ||
| * | ||
| * MainLive.pipe(Layer.launch, NodeRuntime.runMain); | ||
| * ``` | ||
| */ | ||
| export function effectLayer(_: EffectServerLayerOptions): EffectLayer.Layer<never, never, never> { | ||
| return EffectLayer.empty; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import * as index from '../src'; | ||
| import * as index from '../src/index.client'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing integration or E2E tests for featureLow Severity This is a Triggered by project rule: PR Review Guidelines for Cursor Bot |
||
|
|
||
| describe('effect index export', () => { | ||
| it('has correct exports', () => { | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing default fallback conditions in exports map
Medium Severity
The
"."export inpackage.jsononly definesbrowserandnodeconditions with noimport/require/defaultfallback. The comparable@sentry/nuxtpackage includes top-level"import"and"require"fallbacks after"browser"and"node". Without these, environments that don't setbrowserornodeconditions (edge runtimes, some test runners, certain bundler configurations) will fail to resolve@sentry/effect.