Skip to content

Commit f62c17a

Browse files
committed
ref(nuxt): Remove defineNitroPlugin wrapper
1 parent 4763ff1 commit f62c17a

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

packages/nuxt/src/runtime/plugins/database.server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
type StartSpanOptions,
1212
} from '@sentry/core';
1313
import type { Database, PreparedStatement } from 'db0';
14-
import { defineNitroPlugin, useDatabase } from 'nitropack/runtime';
14+
import type { NitroAppPlugin } from 'nitropack';
15+
import { useDatabase } from 'nitropack/runtime';
1516
import type { DatabaseConnectionConfig as DatabaseConfig } from 'nitropack/types';
1617
// @ts-expect-error - This is a virtual module
1718
import { databaseConfig } from '#sentry/database-config.mjs';
@@ -34,7 +35,7 @@ const SENTRY_ORIGIN = 'auto.db.nuxt';
3435
/**
3536
* Creates a Nitro plugin that instruments the database calls.
3637
*/
37-
export default defineNitroPlugin(() => {
38+
export default (() => {
3839
try {
3940
const _databaseConfig = databaseConfig as Record<string, DatabaseConfig>;
4041
const databaseInstances = Object.keys(databaseConfig);
@@ -56,7 +57,7 @@ export default defineNitroPlugin(() => {
5657

5758
debug.error('[Nitro Database Plugin]: Failed to instrument database:', error);
5859
}
59-
});
60+
}) satisfies NitroAppPlugin;
6061

6162
/**
6263
* Instruments a database instance with Sentry.

packages/nuxt/src/runtime/plugins/sentry.server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import {
66
withIsolationScope,
77
} from '@sentry/core';
88
import type { EventHandler, H3Event } from 'h3';
9-
import { defineNitroPlugin } from 'nitropack/runtime';
9+
import type { NitroAppPlugin } from 'nitropack';
1010
import type { NuxtRenderHTMLContext } from 'nuxt/app';
1111
import { sentryCaptureErrorHook } from '../hooks/captureErrorHook';
1212
import { updateRouteBeforeResponse } from '../hooks/updateRouteBeforeResponse';
1313
import { addSentryTracingMetaTags } from '../utils';
1414

15-
export default defineNitroPlugin(nitroApp => {
15+
export default (nitroApp => {
1616
nitroApp.h3App.handler = patchEventHandler(nitroApp.h3App.handler);
1717

1818
nitroApp.hooks.hook('beforeResponse', updateRouteBeforeResponse);
@@ -36,7 +36,7 @@ export default defineNitroPlugin(nitroApp => {
3636
);
3737
}
3838
});
39-
});
39+
}) satisfies NitroAppPlugin;
4040

4141
function patchEventHandler(handler: EventHandler): EventHandler {
4242
return new Proxy(handler, {

packages/nuxt/src/runtime/plugins/storage.server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
startSpan,
1313
type StartSpanOptions,
1414
} from '@sentry/core';
15-
import { defineNitroPlugin, useStorage } from 'nitropack/runtime';
15+
import type { NitroAppPlugin } from 'nitropack';
16+
import { useStorage } from 'nitropack/runtime';
1617
import type { CacheEntry, ResponseCacheEntry } from 'nitropack/types';
1718
import type { Driver, Storage } from 'unstorage';
1819
// @ts-expect-error - This is a virtual module
@@ -34,7 +35,7 @@ const CACHE_HIT_METHODS = new Set<DriverMethod>(['hasItem', 'getItem', 'getItemR
3435
/**
3536
* Creates a Nitro plugin that instruments the storage driver.
3637
*/
37-
export default defineNitroPlugin(async _nitroApp => {
38+
export default (async _nitroApp => {
3839
// This runs at runtime when the Nitro server starts
3940
const storage = useStorage();
4041
// Mounts are suffixed with a colon, so we need to add it to the set items
@@ -63,7 +64,7 @@ export default defineNitroPlugin(async _nitroApp => {
6364

6465
// Wrap the mount method to instrument future mounts
6566
storage.mount = wrapStorageMount(storage);
66-
});
67+
}) satisfies NitroAppPlugin;
6768

6869
/**
6970
* Instruments a driver by wrapping all method calls using proxies.

0 commit comments

Comments
 (0)