Skip to content

Commit b87c5c9

Browse files
committed
Rewriting types
1 parent fa13e5e commit b87c5c9

File tree

6 files changed

+58
-250
lines changed

6 files changed

+58
-250
lines changed

packages/solidstart/package.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sentry/solidstart",
3-
"version": "8.11.0",
3+
"version": "8.12.0",
44
"description": "Official Sentry SDK for Solid Start",
55
"repository": "git://github.com/getsentry/sentry-javascript.git",
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/solidstart",
@@ -10,36 +10,38 @@
1010
"node": ">=16"
1111
},
1212
"files": [
13-
"cjs",
14-
"esm",
15-
"index.types.d.ts",
16-
"solidrouter.types.d.ts",
17-
"types-ts3.8"
13+
"/build",
14+
"/client",
15+
"/server",
16+
"/*.d.ts",
17+
"/*.d.ts.map"
1818
],
1919
"main": "build/cjs/index.server.js",
2020
"module": "build/esm/index.server.js",
2121
"browser": "build/esm/index.client.js",
22-
"types": "build/index.types.d.ts",
22+
"types": "build/types/index.types.d.ts",
2323
"exports": {
2424
"./package.json": "./package.json",
2525
".": {
26-
"types": "./build/index.types.d.ts",
2726
"browser": {
27+
"types": "./build/types/index.types.d.ts",
2828
"import": "./build/esm/index.client.js",
2929
"require": "./build/cjs/index.client.js"
3030
},
3131
"node": {
32+
"types": "./build/types/index.types.d.ts",
3233
"import": "./build/esm/index.server.js",
3334
"require": "./build/cjs/index.server.js"
3435
}
3536
},
3637
"./solidrouter": {
37-
"types": "./build/solidrouter.types.d.ts",
3838
"browser": {
39+
"types": "./solidrouter.types.d.ts",
3940
"import": "./build/esm/solidrouter.client.js",
4041
"require": "./build/cjs/solidrouter.client.js"
4142
},
4243
"node": {
44+
"types": "./solidrouter.types.d.ts",
4345
"import": "./build/esm/solidrouter.server.js",
4446
"require": "./build/cjs/solidrouter.server.js"
4547
}
@@ -58,12 +60,12 @@
5860
}
5961
},
6062
"dependencies": {
61-
"@sentry/core": "8.11.0",
62-
"@sentry/node": "8.11.0",
63-
"@sentry/opentelemetry": "8.11.0",
64-
"@sentry/solid": "8.11.0",
65-
"@sentry/types": "8.11.0",
66-
"@sentry/utils": "8.11.0",
63+
"@sentry/core": "8.12.0",
64+
"@sentry/node": "8.12.0",
65+
"@sentry/opentelemetry": "8.12.0",
66+
"@sentry/solid": "8.12.0",
67+
"@sentry/types": "8.12.0",
68+
"@sentry/utils": "8.12.0",
6769
"@sentry/vite-plugin": "2.19.0"
6870
},
6971
"devDependencies": {
@@ -72,7 +74,6 @@
7274
"@solidjs/testing-library": "0.8.5",
7375
"@testing-library/jest-dom": "^6.4.5",
7476
"@testing-library/user-event": "^14.5.2",
75-
"solid-js": "^1.8.11",
7677
"vite-plugin-solid": "^2.8.2"
7778
},
7879
"scripts": {

packages/solidstart/rollup.npm.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default makeNPMConfigVariants(
1515
// prevent this internal nextjs code from ending up in our built package (this doesn't happen automatially because
1616
// the name doesn't match an SDK dependency)
1717
packageSpecificConfig: {
18-
external: ['solid-js', '@sentry/solid/solidrouter'],
18+
external: ['solid-js', '@sentry/solid', '@sentry/solid/solidrouter'],
1919
},
2020
}),
2121
);

packages/solidstart/src/index.types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { Integration, Options, StackParser } from '@sentry/types';
99
import type * as clientSdk from './client';
1010
import type * as serverSdk from './server';
1111

12-
/** Initializes Sentry SvelteKit SDK */
12+
/** Initializes Sentry Solid Start SDK */
1313
export declare function init(options: Options | clientSdk.BrowserOptions | serverSdk.NodeOptions): void;
1414

1515
export declare const linkedErrorsIntegration: typeof clientSdk.linkedErrorsIntegration;
@@ -19,8 +19,6 @@ export declare const getDefaultIntegrations: (options: Options) => Integration[]
1919
export declare const defaultStackParser: StackParser;
2020

2121
export declare const getClient: typeof clientSdk.getClient;
22-
// eslint-disable-next-line deprecation/deprecation
23-
export declare const getCurrentHub: typeof clientSdk.getCurrentHub;
2422

2523
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
2624
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;

packages/solidstart/src/server/solidrouter.ts

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import type { HashRouter, MemoryRouter, RouteSectionProps, StaticRouter } from '@solidjs/router';
2-
// import { useBeforeLeave, useLocation } from '@solidjs/router';
3-
import type { Router as BaseRouter } from '@solidjs/router/dist/routers/Router';
1+
import type { Integration } from '@sentry/types';
2+
import type {
3+
HashRouter,
4+
MemoryRouter,
5+
RouteSectionProps,
6+
Router as BaseRouter,
7+
StaticRouter,
8+
} from '@solidjs/router';
9+
import { mergeProps, splitProps } from 'solid-js';
410
import type { Component, JSX, ParentProps } from 'solid-js';
5-
import { createComponent, mergeProps, splitProps } from 'solid-js';
11+
import { createComponent } from 'solid-js/web';
612

713
/** Pass-through component in case user didn't specify a root **/
814
function SentryDefaultRoot(props: ParentProps): JSX.Element {
@@ -15,33 +21,23 @@ function SentryDefaultRoot(props: ParentProps): JSX.Element {
1521
*/
1622
function withSentryRouterRoot(Root: Component<RouteSectionProps>): Component<RouteSectionProps> {
1723
const SentryRouterRoot = (props: RouteSectionProps): JSX.Element => {
18-
// TODO: This is a rudimentary first version of handling navigation spans
19-
// It does not
20-
// - use query params
21-
// - parameterize the route
22-
23-
// useBeforeLeave(({ to }: BeforeLeaveEventArgs) => {
24-
// `to` could be `-1` if the browser back-button was used
25-
// eslint-disable-next-line no-console
26-
// console.log('[server] useBeforeLeave', to.toString());
27-
// });
28-
29-
// const location = useLocation();
30-
// createEffect(() => {
31-
// eslint-disable-next-line no-console
32-
// console.log('[server] useLocation', location.pathname);
33-
// });
34-
3524
return createComponent(Root, props);
3625
};
3726

3827
return SentryRouterRoot;
3928
}
4029

4130
/**
42-
*
31+
* A browser tracing integration that uses Solid Router to instrument navigations.
4332
*/
44-
export function solidRouterBrowserTracingIntegration(): void {}
33+
export function solidRouterBrowserTracingIntegration(
34+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
35+
options: any
36+
): Integration {
37+
return {
38+
name: 'solidRouterBrowserTracingIntegration',
39+
}
40+
}
4541

4642
type RouterType = typeof BaseRouter | typeof HashRouter | typeof MemoryRouter | typeof StaticRouter;
4743

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
4+
"compilerOptions": {
5+
"declaration": true,
6+
"declarationMap": true,
7+
"emitDeclarationOnly": true,
8+
"outDir": "./"
9+
},
10+
11+
"//": "Tehese types are built separately because it is for a subpath export, which has problems if it is not in the root",
12+
"include": ["src/solidrouter.client.ts", "src/solidrouter.server.ts"],
13+
"//": "Without this, we cannot output into the root dir",
14+
"exclude": []
15+
}

0 commit comments

Comments
 (0)