diff --git a/.craft.yml b/.craft.yml index d69334cd3f94..dd50cb686c79 100644 --- a/.craft.yml +++ b/.craft.yml @@ -108,6 +108,9 @@ targets: - name: npm id: '@sentry/sveltekit' includeNames: /^sentry-sveltekit-\d.*\.tgz$/ + - name: npm + id: '@sentry/tanstackstart' + includeNames: /^sentry-tanstackstart-\d.*\.tgz$/ - name: npm id: '@sentry/gatsby' includeNames: /^sentry-gatsby-\d.*\.tgz$/ diff --git a/dev-packages/e2e-tests/verdaccio-config/config.yaml b/dev-packages/e2e-tests/verdaccio-config/config.yaml index cbb73201eebf..af7d62521c59 100644 --- a/dev-packages/e2e-tests/verdaccio-config/config.yaml +++ b/dev-packages/e2e-tests/verdaccio-config/config.yaml @@ -170,6 +170,12 @@ packages: unpublish: $all # proxy: npmjs # Don't proxy for E2E tests! + '@sentry/tanstackstart': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + '@sentry/types': access: $all publish: $all diff --git a/package.json b/package.json index 6127b9c5c461..460d2c42abb1 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "packages/solidstart", "packages/svelte", "packages/sveltekit", + "packages/tanstackstart", "packages/types", "packages/typescript", "packages/vercel-edge", diff --git a/packages/tanstackstart/.eslintrc.js b/packages/tanstackstart/.eslintrc.js new file mode 100644 index 000000000000..54e8382b22a8 --- /dev/null +++ b/packages/tanstackstart/.eslintrc.js @@ -0,0 +1,10 @@ +module.exports = { + env: { + browser: true, + node: true, + }, + parserOptions: { + jsx: true, + }, + extends: ['../../.eslintrc.js'], +}; diff --git a/packages/tanstackstart/LICENSE b/packages/tanstackstart/LICENSE new file mode 100644 index 000000000000..0da96cd2f885 --- /dev/null +++ b/packages/tanstackstart/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 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. diff --git a/packages/tanstackstart/README.md b/packages/tanstackstart/README.md new file mode 100644 index 000000000000..35e369cf25e9 --- /dev/null +++ b/packages/tanstackstart/README.md @@ -0,0 +1,52 @@ +
+
+
+
+
>( + WrappedComponent: React.ComponentType
, +): React.FC
{ + return WrappedComponent as React.FC
; +} + +/** + * Just a passthrough since we're on the server and showing the report dialog on the server doesn't make any sense. + */ +export function showReportDialog(): void { + return; +} diff --git a/packages/tanstackstart/src/index.types.ts b/packages/tanstackstart/src/index.types.ts new file mode 100644 index 000000000000..ede1b27f0b3b --- /dev/null +++ b/packages/tanstackstart/src/index.types.ts @@ -0,0 +1,26 @@ +// 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. +export * from './config'; +export * from './client'; +export * from './server'; + +import type { Client, Integration, Options, StackParser } from '@sentry/core'; + +import type * as clientSdk from './client'; +import type * as serverSdk from './server'; + +/** Initializes Sentry TanStack Start SDK */ +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 function getSentryRelease(fallback?: string): string | undefined; + +export declare const ErrorBoundary: typeof clientSdk.ErrorBoundary; +export declare const createReduxEnhancer: typeof clientSdk.createReduxEnhancer; +export declare const showReportDialog: typeof clientSdk.showReportDialog; +export declare const withErrorBoundary: typeof clientSdk.withErrorBoundary; diff --git a/packages/tanstackstart/src/server/index.ts b/packages/tanstackstart/src/server/index.ts new file mode 100644 index 000000000000..d61c75b7bfb4 --- /dev/null +++ b/packages/tanstackstart/src/server/index.ts @@ -0,0 +1 @@ +export * from '@sentry/node'; diff --git a/packages/tanstackstart/test/temp.test.ts b/packages/tanstackstart/test/temp.test.ts new file mode 100644 index 000000000000..28874b0d1c84 --- /dev/null +++ b/packages/tanstackstart/test/temp.test.ts @@ -0,0 +1,7 @@ +import { describe, it, expect } from 'vitest'; + +describe('Basic test suite', () => { + it('should pass', () => { + expect(true).toBe(true); + }); +}); diff --git a/packages/tanstackstart/test/tsconfig.json b/packages/tanstackstart/test/tsconfig.json new file mode 100644 index 000000000000..38ca0b13bcdd --- /dev/null +++ b/packages/tanstackstart/test/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../tsconfig.test.json" +} diff --git a/packages/tanstackstart/tsconfig.json b/packages/tanstackstart/tsconfig.json new file mode 100644 index 000000000000..20cf507e5203 --- /dev/null +++ b/packages/tanstackstart/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "include": ["src/**/*"], + "compilerOptions": { + "lib": ["es2018", "es2020.string"], + "module": "Node16" + } +} diff --git a/packages/tanstackstart/tsconfig.test.json b/packages/tanstackstart/tsconfig.test.json new file mode 100644 index 000000000000..bbbebba51d18 --- /dev/null +++ b/packages/tanstackstart/tsconfig.test.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "include": ["test/**/*", "vite.config.ts"], + "compilerOptions": { + "types": ["node"], + "lib": ["DOM", "ESNext"] + } +} diff --git a/packages/tanstackstart/tsconfig.types.json b/packages/tanstackstart/tsconfig.types.json new file mode 100644 index 000000000000..b1a51db073c2 --- /dev/null +++ b/packages/tanstackstart/tsconfig.types.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "build/types" + } +} diff --git a/packages/tanstackstart/vite.config.ts b/packages/tanstackstart/vite.config.ts new file mode 100644 index 000000000000..f18ec92095bc --- /dev/null +++ b/packages/tanstackstart/vite.config.ts @@ -0,0 +1,8 @@ +import baseConfig from '../../vite/vite.config'; + +export default { + ...baseConfig, + test: { + ...baseConfig.test, + }, +};