-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(effect): Add base skaffolding for Effect.ts #19622
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
e6cd9c5
86f7209
3d7aaed
a88e9a5
a3afc05
f47fa77
7e9e7c2
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| module.exports = { | ||
| env: { | ||
| browser: true, | ||
| node: true, | ||
| }, | ||
| overrides: [ | ||
| { | ||
| files: ['vite.config.ts', 'vitest.config.ts'], | ||
| parserOptions: { | ||
| project: ['tsconfig.vite.json'], | ||
| }, | ||
| }, | ||
| ], | ||
| extends: ['../../.eslintrc.js'], | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 Functional Software Inc. dba Sentry | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Official Sentry SDK for Effect.ts (Alpha) | ||
|
|
||
| [](https://www.npmjs.com/package/@sentry/effect) | ||
| [](https://www.npmjs.com/package/@sentry/effect) | ||
| [](https://www.npmjs.com/package/@sentry/effect) | ||
|
|
||
| > NOTICE: This package is in alpha state and may be subject to breaking changes. | ||
| ## Getting Started | ||
|
|
||
| This SDK does not have docs yet. Stay tuned. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```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({ | ||
|
Member
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. Do we export
Member
Author
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.
This will be added in later steps. |
||
| dsn: '__DSN__', | ||
| enableLogs: true, | ||
| enableMetrics: true, | ||
| }), | ||
| ), | ||
| ); | ||
|
|
||
| MainLive.pipe(Layer.launch, NodeRuntime.runMain); | ||
| ``` | ||
|
|
||
| The `effectLayer` function initializes Sentry and returns an Effect Layer that provides: | ||
|
|
||
| - Distributed tracing with automatic HTTP header extraction/injection | ||
| - Effect spans traced as Sentry spans | ||
| - Effect logs forwarded to Sentry (when `enableLogs` is set) | ||
| - Effect metrics sent to Sentry (when `enableMetrics` is set) | ||
|
|
||
| ## Links | ||
|
|
||
| <!-- - [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/effect/) --> | ||
|
|
||
| - [Sentry.io](https://sentry.io/?utm_source=github&utm_medium=npm_effect) | ||
| - [Sentry Discord Server](https://discord.gg/Ww9hbqr) | ||
| - [Stack Overflow](https://stackoverflow.com/questions/tagged/sentry) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| { | ||
| "name": "@sentry/effect", | ||
| "version": "10.42.0", | ||
| "description": "Official Sentry SDK for Effect", | ||
| "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
| "homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/effect", | ||
| "author": "Sentry", | ||
| "license": "MIT", | ||
| "engines": { | ||
| "node": ">=18" | ||
| }, | ||
| "files": [ | ||
| "/build" | ||
| ], | ||
| "main": "build/cjs/index.js", | ||
| "module": "build/esm/index.js", | ||
| "types": "build/types/index.d.ts", | ||
| "exports": { | ||
| "./package.json": "./package.json", | ||
| ".": { | ||
| "import": { | ||
| "types": "./build/types/index.d.ts", | ||
| "default": "./build/esm/index.js" | ||
| }, | ||
| "require": { | ||
| "types": "./build/types/index.d.ts", | ||
| "default": "./build/cjs/index.js" | ||
| } | ||
| } | ||
| }, | ||
| "typesVersions": { | ||
| "<5.0": { | ||
| "build/types/index.d.ts": [ | ||
| "build/types-ts3.8/index.d.ts" | ||
| ] | ||
| } | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@sentry/core": "10.42.0" | ||
| }, | ||
| "scripts": { | ||
| "build": "run-p build:transpile build:types", | ||
| "build:dev": "yarn build", | ||
| "build:transpile": "rollup -c rollup.npm.config.mjs", | ||
| "build:types": "run-s build:types:core build:types:downlevel", | ||
| "build:types:core": "tsc -p tsconfig.types.json", | ||
| "build:types:downlevel": "yarn downlevel-dts build/types build/types-ts3.8 --to ts3.8", | ||
| "build:watch": "run-p build:transpile:watch", | ||
| "build:dev:watch": "yarn build:watch", | ||
| "build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch", | ||
| "build:tarball": "npm pack", | ||
| "circularDepCheck": "madge --circular src/index.ts", | ||
| "clean": "rimraf build coverage sentry-effect-*.tgz", | ||
| "fix": "eslint . --format stylish --fix", | ||
| "lint": "eslint . --format stylish", | ||
| "test": "vitest run", | ||
| "test:watch": "vitest --watch", | ||
| "yalc:publish": "yalc publish --push --sig" | ||
| }, | ||
| "volta": { | ||
| "extends": "../../package.json" | ||
| }, | ||
| "sideEffects": false | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils'; | ||
|
|
||
| export default makeNPMConfigVariants( | ||
| makeBaseNPMConfig({ | ||
| packageSpecificConfig: { | ||
| output: { | ||
| preserveModulesRoot: 'src', | ||
| }, | ||
| }, | ||
| }), | ||
| ); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| export type { | ||
| Breadcrumb, | ||
| BreadcrumbHint, | ||
| Context, | ||
| Contexts, | ||
| RequestEventData, | ||
| SdkInfo, | ||
| Event, | ||
| EventHint, | ||
| ErrorEvent, | ||
| Exception, | ||
| SeverityLevel, | ||
| StackFrame, | ||
| Stacktrace, | ||
| Thread, | ||
| User, | ||
| Session, | ||
| CaptureContext, | ||
| ExclusiveEventHintOrCaptureContext, | ||
| Log, | ||
| LogSeverityLevel, | ||
| Span, | ||
| } from '@sentry/core'; | ||
|
|
||
| export { | ||
| addEventProcessor, | ||
| addBreadcrumb, | ||
| addIntegration, | ||
| captureException, | ||
| captureEvent, | ||
| captureFeedback, | ||
| captureMessage, | ||
| close, | ||
| createTransport, | ||
| lastEventId, | ||
| flush, | ||
| getClient, | ||
| isInitialized, | ||
| isEnabled, | ||
| getCurrentScope, | ||
| getIsolationScope, | ||
| getGlobalScope, | ||
| setCurrentClient, | ||
| Scope, | ||
| continueTrace, | ||
| getTraceData, | ||
| suppressTracing, | ||
| SDK_VERSION, | ||
| setContext, | ||
| setExtra, | ||
| setExtras, | ||
| setTag, | ||
| setTags, | ||
| setUser, | ||
| withScope, | ||
| withIsolationScope, | ||
| functionToStringIntegration, | ||
| eventFiltersIntegration, | ||
| dedupeIntegration, | ||
| parameterize, | ||
| startSession, | ||
| captureSession, | ||
| endSession, | ||
| spanToJSON, | ||
| spanToTraceHeader, | ||
| spanToBaggageHeader, | ||
| updateSpanName, | ||
| metrics, | ||
| getActiveSpan, | ||
| getRootSpan, | ||
| startSpan, | ||
| startInactiveSpan, | ||
| startSpanManual, | ||
| withActiveSpan, | ||
| startNewTrace, | ||
| getSpanDescendants, | ||
| setMeasurement, | ||
| getSpanStatusFromHttpCode, | ||
| setHttpStatus, | ||
| } from '@sentry/core'; | ||
|
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
|
||
|
|
||
| export { | ||
| SEMANTIC_ATTRIBUTE_SENTRY_OP, | ||
| SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, | ||
| SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, | ||
| SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, | ||
| } from '@sentry/core'; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import * as index from '../src'; | ||
|
|
||
| describe('effect index export', () => { | ||
| it('has correct exports', () => { | ||
| expect(index.captureException).toBeDefined(); | ||
| }); | ||
| }); | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "extends": "../../tsconfig.json", | ||
| "compilerOptions": { | ||
| "module": "esnext", | ||
| "outDir": "build" | ||
| }, | ||
| "include": ["src/**/*"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
|
|
||
| "include": ["test/**/*", "vitest.config.ts"], | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| "compilerOptions": { | ||
| "types": ["node"] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "declaration": true, | ||
| "declarationMap": true, | ||
| "emitDeclarationOnly": true, | ||
| "outDir": "build/types" | ||
| }, | ||
| "include": ["src/**/*"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
|
|
||
| "include": ["vite.config.ts", "vitest.config.ts"], | ||
|
|
||
| "compilerOptions": { | ||
| "types": ["node"] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import { defineConfig } from 'vitest/config'; | ||
| import baseConfig from '../../vite/vite.config'; | ||
|
|
||
| export default defineConfig({ | ||
| ...baseConfig, | ||
| test: { | ||
| ...baseConfig.test, | ||
| include: ['test/**/*.test.ts'], | ||
| }, | ||
| }); |


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.