From 4cf94c8a22fc7c7713e52bf1882d8658e0c5e1ac Mon Sep 17 00:00:00 2001 From: LXR Date: Fri, 16 Sep 2022 10:23:22 +0800 Subject: [PATCH 1/2] feat: support export vueInit --- packages/vue/src/index.ts | 2 +- packages/vue/src/sdk.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/vue/src/index.ts b/packages/vue/src/index.ts index 24a352aba99a..56ad683c850a 100644 --- a/packages/vue/src/index.ts +++ b/packages/vue/src/index.ts @@ -1,6 +1,6 @@ export * from '@sentry/browser'; -export { init } from './sdk'; +export { init, vueInit } from './sdk'; export { vueRouterInstrumentation } from './router'; export { attachErrorHandler } from './errorhandler'; export { createTracingMixins } from './tracing'; diff --git a/packages/vue/src/sdk.ts b/packages/vue/src/sdk.ts index 35490f925a8d..d84764026ee9 100644 --- a/packages/vue/src/sdk.ts +++ b/packages/vue/src/sdk.ts @@ -44,8 +44,8 @@ export function init( __DEBUG_BUILD__ && logger.warn( 'Misconfigured SDK. Vue specific errors will not be captured.\n' + - 'Update your `Sentry.init` call with an appropriate config option:\n' + - '`app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2).', + 'Update your `Sentry.init` call with an appropriate config option:\n' + + '`app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2).', ); return; } @@ -58,7 +58,11 @@ export function init( } } -const vueInit = (app: Vue, options: Options): void => { +export const vueInit = (app: Vue, options: Options): void => { + options = { + ...DEFAULT_CONFIG, + ...options, + }; attachErrorHandler(app, options); if ('tracesSampleRate' in options || 'tracesSampler' in options) { From 51695afc57e53fe5e63405abd0009c4338acfc50 Mon Sep 17 00:00:00 2001 From: Rockergmail Date: Fri, 16 Sep 2022 10:35:09 +0800 Subject: [PATCH 2/2] Update sdk.ts recover spacing --- packages/vue/src/sdk.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vue/src/sdk.ts b/packages/vue/src/sdk.ts index d84764026ee9..0df16207564d 100644 --- a/packages/vue/src/sdk.ts +++ b/packages/vue/src/sdk.ts @@ -44,8 +44,8 @@ export function init( __DEBUG_BUILD__ && logger.warn( 'Misconfigured SDK. Vue specific errors will not be captured.\n' + - 'Update your `Sentry.init` call with an appropriate config option:\n' + - '`app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2).', + 'Update your `Sentry.init` call with an appropriate config option:\n' + + '`app` (Application Instance - Vue 3) or `Vue` (Vue Constructor - Vue 2).', ); return; }