Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"packages/replay-internal",
"packages/replay-canvas",
"packages/replay-worker",
"packages/server-utils",
"packages/solid",
"packages/solidstart",
"packages/svelte",
Expand Down
33 changes: 33 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,40 @@
"extends": "../../package.json"
},
"sideEffects": false,
"dependencies": {
"@sentry-internal/server-utils": "10.54.0"
},
"devDependencies": {
"zod": "^3.24.1"
},
"nx": {
"targets": {
"build:transpile": {
"dependsOn": []
},
"build:types": {
"dependsOn": []
},
"build:dev": {
"dependsOn": []
},
"build:tarball": {
"dependsOn": [
"build:transpile",
"build:types"
]
},
"test:unit": {
"dependsOn": [
"build:transpile",
"build:types"
]
},
"lint": {
"dependsOn": [
"build:types"
]
}
}
}
}
4 changes: 4 additions & 0 deletions packages/server-utils/.oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "../../node_modules/oxlint/configuration_schema.json",
"extends": ["../../.oxlintrc.base.json"]
}
21 changes: 21 additions & 0 deletions packages/server-utils/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 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.
23 changes: 23 additions & 0 deletions packages/server-utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<p align="center">
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
</a>
</p>

# Sentry JavaScript SDK Server Utilities

[![npm version](https://img.shields.io/npm/v/@sentry-internal/server-utils.svg)](https://www.npmjs.com/package/@sentry-internal/server-utils)
[![npm dm](https://img.shields.io/npm/dm/@sentry-internal/server-utils.svg)](https://www.npmjs.com/package/@sentry-internal/server-utils)
[![npm dt](https://img.shields.io/npm/dt/@sentry-internal/server-utils.svg)](https://www.npmjs.com/package/@sentry-internal/server-utils)

## Links

- [Official SDK Docs](https://docs.sentry.io/quickstart/)

## General

Common server-side utilities used by the Sentry JavaScript Server SDKs (Node, Bun, Deno, Cloudflare, AWS Lambda, Google
Cloud Functions, Vercel Edge).

Note: This package is only meant to be used internally, and as such is not part of our public API contract and does not
follow semver.
69 changes: 69 additions & 0 deletions packages/server-utils/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "@sentry-internal/server-utils",
"version": "10.54.0",
"description": "Server Utilities for all Sentry JavaScript Server SDKs",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/server-utils",
"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.54.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": "run-p build:transpile: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-internal-server-utils-*.tgz",
"lint:fix": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --fix --type-aware",
"lint": "OXLINT_TSGOLINT_DANGEROUSLY_SUPPRESS_PROGRAM_DIAGNOSTICS=true oxlint . --type-aware",
"lint:es-compatibility": "es-check es2020 ./build/cjs/*.js && es-check es2020 ./build/esm/*.js --module",
"test:unit": "vitest run",
"test": "vitest run",
"test:watch": "vitest --watch",
"yalc:publish": "yalc publish --push --sig"
},
"volta": {
"extends": "../../package.json"
},
"sideEffects": false
}
17 changes: 17 additions & 0 deletions packages/server-utils/rollup.npm.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';

export default makeNPMConfigVariants(
makeBaseNPMConfig({
packageSpecificConfig: {
output: {
// set exports to 'named' or 'auto' so that rollup doesn't warn
exports: 'named',
// set preserveModules to true because we don't want to bundle everything into one file.
preserveModules:
process.env.SENTRY_BUILD_PRESERVE_MODULES === undefined
? true
: Boolean(process.env.SENTRY_BUILD_PRESERVE_MODULES),
},
},
}),
);
4 changes: 4 additions & 0 deletions packages/server-utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Public surface intentionally left empty in this initial scaffold.
// Symbols will land here as code is migrated out of `@sentry/core` per the
// server-utils migration plan.
export {};
9 changes: 9 additions & 0 deletions packages/server-utils/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { describe, expect, it } from 'vitest';

import * as ServerUtils from '../src/index';

describe('@sentry-internal/server-utils', () => {
it('loads the package entry point', () => {
expect(ServerUtils).toBeDefined();
});
});
3 changes: 3 additions & 0 deletions packages/server-utils/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../tsconfig.test.json"
}
9 changes: 9 additions & 0 deletions packages/server-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.json",

"include": ["src/**/*"],

"compilerOptions": {
// package-specific options
}
}
12 changes: 12 additions & 0 deletions packages/server-utils/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",

"include": ["test/**/*", "vite.config.ts"],

"compilerOptions": {
// should include all types from `./tsconfig.json` plus types for all test frameworks used
"types": ["node", "vitest"]

// other package-specific, test-specific options
}
}
9 changes: 9 additions & 0 deletions packages/server-utils/tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "build/types"
}
}
8 changes: 8 additions & 0 deletions packages/server-utils/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import baseConfig from '../../vite/vite.config';

export default {
...baseConfig,
test: {
...baseConfig.test,
},
};
Loading