Skip to content

Commit

Permalink
ref(solidstart): Simplify middleware structure without subexport (#13494
Browse files Browse the repository at this point in the history
)

⚠️ This is a breaking change ⚠️

Simplifies the package by getting rid of the
`@sentry/solidstart/middleware` subexport in favor of a regular export.

The middleware now needs to be imported like this:

```js
import { sentryBeforeResponseMiddleware } from '@sentry/solidstart';
```
  • Loading branch information
andreiborza authored Aug 28, 2024
1 parent 3964548 commit 2b3e26f
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/solidstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ Sentry.init({

### 4. Server instrumentation

Complete the setup by adding the Sentry middlware to your `src/middleware.ts` file:
Complete the setup by adding the Sentry middleware to your `src/middleware.ts` file:

```typescript
import { sentryBeforeResponseMiddleware } from '@sentry/solidstart/middleware';
import { sentryBeforeResponseMiddleware } from '@sentry/solidstart';
import { createMiddleware } from '@solidjs/start/middleware';

export default createMiddleware({
Expand Down
13 changes: 1 addition & 12 deletions packages/solidstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@
"require": "./build/cjs/index.server.js"
}
},
"./middleware": {
"types": "./middleware.d.ts",
"import": {
"types": "./middleware.d.ts",
"default": "./build/esm/middleware.js"
},
"require": {
"types": "./middleware.d.ts",
"default": "./build/cjs/middleware.js"
}
},
"./solidrouter": {
"types": "./solidrouter.d.ts",
"browser": {
Expand Down Expand Up @@ -106,7 +95,7 @@
"build:transpile:watch": "rollup -c rollup.npm.config.mjs --watch",
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:tarball": "npm pack",
"circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts && madge --circular src/solidrouter.client.ts && madge --circular src/solidrouter.server.ts && madge --circular src/solidrouter.ts && madge --circular src/middleware.ts",
"circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts && madge --circular src/solidrouter.client.ts && madge --circular src/solidrouter.server.ts && madge --circular src/solidrouter.ts",
"clean": "rimraf build coverage sentry-solidstart-*.tgz ./*.d.ts ./*.d.ts.map ./client ./server",
"fix": "eslint . --format stylish --fix",
"lint": "eslint . --format stylish",
Expand Down
1 change: 0 additions & 1 deletion packages/solidstart/rollup.npm.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default makeNPMConfigVariants(
'src/solidrouter.server.ts',
'src/client/solidrouter.ts',
'src/server/solidrouter.ts',
'src/middleware.ts',
],
// prevent this internal code from ending up in our built package (this doesn't happen automatially because
// the name doesn't match an SDK dependency)
Expand Down
1 change: 1 addition & 0 deletions packages/solidstart/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,4 @@ export { withSentryErrorBoundary } from '@sentry/solid';
export { init } from './sdk';

export * from './withServerActionInstrumentation';
export * from './middleware';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as SentryCore from '@sentry/core';
import { beforeEach, describe, it, vi } from 'vitest';
import { sentryBeforeResponseMiddleware } from '../src/middleware';
import type { ResponseMiddlewareResponse } from '../src/middleware';
import { sentryBeforeResponseMiddleware } from '../../src/server';
import type { ResponseMiddlewareResponse } from '../../src/server';

describe('middleware', () => {
describe('sentryBeforeResponseMiddleware', () => {
Expand Down
1 change: 0 additions & 1 deletion packages/solidstart/tsconfig.subexports-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"src/solidrouter.server.ts",
"src/server/solidrouter.ts",
"src/solidrouter.ts",
"src/middleware.ts",
],
// Without this, we cannot output into the root dir
"exclude": []
Expand Down
1 change: 0 additions & 1 deletion packages/solidstart/tsconfig.types.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
"src/solidrouter.server.ts",
"src/server/solidrouter.ts",
"src/solidrouter.ts",
"src/middleware.ts",
]
}

0 comments on commit 2b3e26f

Please sign in to comment.