@sentry/wizard 5.4.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/e2e-tests/tests/angular-17.test.js +6 -0
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +7 -1
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js +5 -1
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js +5 -1
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +9 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +9 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +8 -2
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.js +15 -3
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
- package/dist/src/angular/angular-wizard.js +5 -0
- package/dist/src/angular/angular-wizard.js.map +1 -1
- package/dist/src/angular/codemods/main.d.ts +4 -1
- package/dist/src/angular/codemods/main.js +3 -0
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/angular/sdk-setup.d.ts +1 -0
- package/dist/src/angular/sdk-setup.js.map +1 -1
- package/dist/src/apple/xcode-manager.d.ts +5 -0
- package/dist/src/apple/xcode-manager.js +44 -40
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +5 -0
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +3 -0
- package/dist/src/nextjs/templates.js +15 -2
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.js +5 -0
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/nuxt/templates.d.ts +1 -0
- package/dist/src/nuxt/templates.js +3 -2
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/remix/codemods/handle-error.js +3 -6
- package/dist/src/remix/codemods/handle-error.js.map +1 -1
- package/dist/src/remix/codemods/{root-common.d.ts → root.d.ts} +1 -0
- package/dist/src/remix/codemods/{root-v2.js → root.js} +47 -12
- package/dist/src/remix/codemods/root.js.map +1 -0
- package/dist/src/remix/remix-wizard.js +12 -5
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-setup.d.ts +8 -11
- package/dist/src/remix/sdk-setup.js +13 -18
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/remix/templates.d.ts +2 -2
- package/dist/src/remix/templates.js +3 -3
- package/dist/src/remix/templates.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +11 -0
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/templates.d.ts +2 -0
- package/dist/src/sveltekit/templates.js +10 -0
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +119 -0
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +119 -0
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/remix/client-entry.test.js +56 -0
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/remix/root.test.d.ts +1 -0
- package/dist/test/remix/root.test.js +31 -0
- package/dist/test/remix/root.test.js.map +1 -0
- package/dist/test/remix/server-instrumentation.test.js +37 -1
- package/dist/test/remix/server-instrumentation.test.js.map +1 -1
- package/dist/test/sveltekit/templates.test.js +67 -0
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/package.json +1 -1
- package/dist/src/remix/codemods/root-common.js +0 -70
- package/dist/src/remix/codemods/root-common.js.map +0 -1
- package/dist/src/remix/codemods/root-v1.d.ts +0 -1
- package/dist/src/remix/codemods/root-v1.js +0 -52
- package/dist/src/remix/codemods/root-v1.js.map +0 -1
- package/dist/src/remix/codemods/root-v2.d.ts +0 -1
- package/dist/src/remix/codemods/root-v2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nuxt/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,wDAIkC;AAElC,IAAA,iBAAQ,EAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAA,iBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,IAAA,WAAE,EAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,IAAA,eAAM,EAAC,IAAA,gCAAoB,GAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;CAO1D,CAAC,CAAC;QACC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAQ,EAAC,yBAAyB,EAAE,GAAG,EAAE;QACvC,IAAA,iBAAQ,EAAC,eAAe,EAAE,GAAG,EAAE;YAC7B,IAAA,WAAE,EAAC,mDAAmD,EAAE,GAAG,EAAE;gBAC3D,MAAM,QAAQ,GAAG,IAAA,mCAAuB,EACtC,uBAAuB,EACvB,QAAQ,EACR;oBACE,WAAW,EAAE,IAAI;oBACjB,MAAM,EAAE,IAAI;iBACb,CACF,CAAC;gBAEF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BxC,CAAC,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,IAAA,WAAE,EAAC,8DAA8D,EAAE,GAAG,EAAE;gBACtE,MAAM,QAAQ,GAAG,IAAA,mCAAuB,EACtC,uBAAuB,EACvB,QAAQ,EACR;oBACE,WAAW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;gBACtE,MAAM,QAAQ,GAAG,IAAA,mCAAuB,EACtC,uBAAuB,EACvB,QAAQ,EACR;oBACE,WAAW,EAAE,KAAK;oBAClB,MAAM,EAAE,IAAI;iBACb,CACF,CAAC;gBAEF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;OAUxC,CAAC,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAQ,EAAC,+BAA+B,EAAE,GAAG,EAAE;QAC7C,IAAA,WAAE,EAAC,qDAAqD,EAAE,GAAG,EAAE;YAC7D,MAAM,QAAQ,GAAG,IAAA,yCAA6B,EAC5C;gBACE,GAAG,EAAE,QAAQ;gBACb,OAAO,EAAE,YAAY;gBACrB,GAAG,EAAE,mBAAmB;gBACxB,UAAU,EAAE,KAAK;aAClB,EACD,KAAK,CACN,CAAC;YAEF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;OAStC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,2EAA2E,EAAE,GAAG,EAAE;YACnF,MAAM,QAAQ,GAAG,IAAA,yCAA6B,EAC5C;gBACE,GAAG,EAAE,QAAQ;gBACb,OAAO,EAAE,YAAY;gBACrB,GAAG,EAAE,mBAAmB;gBACxB,UAAU,EAAE,KAAK;aAClB,EACD,IAAI,CACL,CAAC;YAEF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;OAUtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from '../../src/nuxt/templates';\n\ndescribe('Nuxt code templates', () => {\n describe('getDefaultNuxtConfig', () => {\n it('returns a default nuxt config', () => {\n expect(getDefaultNuxtConfig()).toMatchInlineSnapshot(`\n \"// https://nuxt.com/docs/api/configuration/nuxt-config\n export default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n })\n \"\n`);\n });\n });\n\n describe('getSentryConfigContents', () => {\n describe('client config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring and session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('server config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: true,\n replay: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: false,\n replay: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getNuxtModuleFallbackTemplate', () => {\n it('generates configuration options for the nuxt config', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n },\n false,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"my-org\",\n project: \"my-project\",\n },\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n\n it('generates configuration options for the nuxt config with top level import', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n },\n true,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"my-org\",\n project: \"my-project\",\n },\n autoInjectServerSentry: \"top-level-import\",\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/nuxt/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,wDAIkC;AAElC,IAAA,iBAAQ,EAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAA,iBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,IAAA,WAAE,EAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,IAAA,eAAM,EAAC,IAAA,gCAAoB,GAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;CAO1D,CAAC,CAAC;QACC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAQ,EAAC,yBAAyB,EAAE,GAAG,EAAE;QACvC,IAAA,iBAAQ,EAAC,eAAe,EAAE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gBACb,OAAO,EAAE,YAAY;gBACrB,GAAG,EAAE,mBAAmB;gBACxB,UAAU,EAAE,KAAK;aAClB,EACD,KAAK,CACN,CAAC;YAEF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;OAStC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,2EAA2E,EAAE,GAAG,EAAE;YACnF,MAAM,QAAQ,GAAG,IAAA,yCAA6B,EAC5C;gBACE,GAAG,EAAE,QAAQ;gBACb,OAAO,EAAE,YAAY;gBACrB,GAAG,EAAE,mBAAmB;gBACxB,UAAU,EAAE,KAAK;aAClB,EACD,IAAI,CACL,CAAC;YAEF,IAAA,eAAM,EAAC,QAAQ,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;OAUtC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from '../../src/nuxt/templates';\n\ndescribe('Nuxt code templates', () => {\n describe('getDefaultNuxtConfig', () => {\n it('returns a default nuxt config', () => {\n expect(getDefaultNuxtConfig()).toMatchInlineSnapshot(`\n \"// https://nuxt.com/docs/api/configuration/nuxt-config\n export default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n })\n \"\n`);\n });\n });\n\n describe('getSentryConfigContents', () => {\n describe('client config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: false,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with logs disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: true,\n replay: true,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n \n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [Sentry.replayIntegration()],\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring and session replay disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: false,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with all features disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'client',\n {\n performance: false,\n replay: false,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n\n Sentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n dsn: \"https://sentry.io/123\",\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n\n describe('server config', () => {\n it('generates Sentry config with all features enabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: true,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with performance monitoring disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: false,\n replay: true,\n logs: true,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with logs disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: true,\n replay: true,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n\n // We recommend adjusting this value in production, or using tracesSampler\n // for finer control\n tracesSampleRate: 1.0,\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n\n it('generates Sentry config with all features disabled', () => {\n const template = getSentryConfigContents(\n 'https://sentry.io/123',\n 'server',\n {\n performance: false,\n replay: false,\n logs: false,\n },\n );\n\n expect(template).toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/nuxt\";\n \n Sentry.init({\n dsn: \"https://sentry.io/123\",\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n });\n \"\n `);\n });\n });\n });\n\n describe('getNuxtModuleFallbackTemplate', () => {\n it('generates configuration options for the nuxt config', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n },\n false,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"my-org\",\n project: \"my-project\",\n },\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n\n it('generates configuration options for the nuxt config with top level import', () => {\n const template = getNuxtModuleFallbackTemplate(\n {\n org: 'my-org',\n project: 'my-project',\n url: 'https://sentry.io',\n selfHosted: false,\n },\n true,\n );\n\n expect(template).toMatchInlineSnapshot(`\n \" modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"my-org\",\n project: \"my-project\",\n },\n autoInjectServerSentry: \"top-level-import\",\n },\n sourcemap: { client: \"hidden\" },\"\n `);\n });\n });\n});\n"]}
|
|
@@ -12,6 +12,7 @@ const vitest_1 = require("vitest");
|
|
|
12
12
|
const selectedFeatures = {
|
|
13
13
|
performance: true,
|
|
14
14
|
replay: true,
|
|
15
|
+
logs: true,
|
|
15
16
|
};
|
|
16
17
|
const result = (0, sdk_setup_1.updateEntryClientMod)(originalEntryClientMod, dsn, selectedFeatures);
|
|
17
18
|
(0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
|
|
@@ -27,6 +28,7 @@ const vitest_1 = require("vitest");
|
|
|
27
28
|
init({
|
|
28
29
|
dsn: "https://sentry.io/123",
|
|
29
30
|
tracesSampleRate: 1,
|
|
31
|
+
enableLogs: true,
|
|
30
32
|
|
|
31
33
|
integrations: [browserTracingIntegration({
|
|
32
34
|
useEffect,
|
|
@@ -49,6 +51,7 @@ const vitest_1 = require("vitest");
|
|
|
49
51
|
const selectedFeatures = {
|
|
50
52
|
performance: false,
|
|
51
53
|
replay: true,
|
|
54
|
+
logs: false,
|
|
52
55
|
};
|
|
53
56
|
const result = (0, sdk_setup_1.updateEntryClientMod)(originalEntryClientMod, dsn, selectedFeatures);
|
|
54
57
|
(0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
|
|
@@ -74,6 +77,7 @@ const vitest_1 = require("vitest");
|
|
|
74
77
|
const selectedFeatures = {
|
|
75
78
|
performance: true,
|
|
76
79
|
replay: false,
|
|
80
|
+
logs: false,
|
|
77
81
|
};
|
|
78
82
|
const result = (0, sdk_setup_1.updateEntryClientMod)(originalEntryClientMod, dsn, selectedFeatures);
|
|
79
83
|
(0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
|
|
@@ -98,5 +102,57 @@ const vitest_1 = require("vitest");
|
|
|
98
102
|
})"
|
|
99
103
|
`);
|
|
100
104
|
});
|
|
105
|
+
(0, vitest_1.it)('should initialize Sentry on client entry with only logs enabled', () => {
|
|
106
|
+
// Empty entry.client.tsx file for testing
|
|
107
|
+
const originalEntryClientMod = (0, magicast_1.parseModule)('');
|
|
108
|
+
const dsn = 'https://sentry.io/123';
|
|
109
|
+
const selectedFeatures = {
|
|
110
|
+
performance: false,
|
|
111
|
+
replay: false,
|
|
112
|
+
logs: true,
|
|
113
|
+
};
|
|
114
|
+
const result = (0, sdk_setup_1.updateEntryClientMod)(originalEntryClientMod, dsn, selectedFeatures);
|
|
115
|
+
(0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
|
|
116
|
+
"import { init,} from "@sentry/remix";
|
|
117
|
+
|
|
118
|
+
init({
|
|
119
|
+
dsn: "https://sentry.io/123",
|
|
120
|
+
enableLogs: true
|
|
121
|
+
})"
|
|
122
|
+
`);
|
|
123
|
+
});
|
|
124
|
+
(0, vitest_1.it)('should initialize Sentry on client entry with performance and logs enabled', () => {
|
|
125
|
+
// Empty entry.client.tsx file for testing
|
|
126
|
+
const originalEntryClientMod = (0, magicast_1.parseModule)('');
|
|
127
|
+
const dsn = 'https://sentry.io/123';
|
|
128
|
+
const selectedFeatures = {
|
|
129
|
+
performance: true,
|
|
130
|
+
replay: false,
|
|
131
|
+
logs: true,
|
|
132
|
+
};
|
|
133
|
+
const result = (0, sdk_setup_1.updateEntryClientMod)(originalEntryClientMod, dsn, selectedFeatures);
|
|
134
|
+
(0, vitest_1.expect)(result.generate().code).toMatchInlineSnapshot(`
|
|
135
|
+
"import { useEffect,} from "react";
|
|
136
|
+
|
|
137
|
+
import {
|
|
138
|
+
useLocation,
|
|
139
|
+
useMatches,
|
|
140
|
+
} from "@remix-run/react";
|
|
141
|
+
|
|
142
|
+
import { init, browserTracingIntegration,} from "@sentry/remix";
|
|
143
|
+
|
|
144
|
+
init({
|
|
145
|
+
dsn: "https://sentry.io/123",
|
|
146
|
+
tracesSampleRate: 1,
|
|
147
|
+
enableLogs: true,
|
|
148
|
+
|
|
149
|
+
integrations: [browserTracingIntegration({
|
|
150
|
+
useEffect,
|
|
151
|
+
useLocation,
|
|
152
|
+
useMatches
|
|
153
|
+
})]
|
|
154
|
+
})"
|
|
155
|
+
`);
|
|
156
|
+
});
|
|
101
157
|
});
|
|
102
158
|
//# sourceMappingURL=client-entry.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-entry.test.js","sourceRoot":"","sources":["../../../test/remix/client-entry.test.ts"],"names":[],"mappings":";;AAAA,kFAAkF;AAClF,uCAAuC;AACvC,yDAAiE;AACjE,mCAA8C;AAE9C,IAAA,iBAAQ,EAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,IAAA,WAAE,EAAC,oEAAoE,EAAE,GAAG,EAAE;QAC5E,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,g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C,CAAC;QAE/C,MAAM,GAAG,GAAG,uBAAuB,CAAC;QACpC,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;SACX,CAAC;QAEF,MAAM,MAAM,GAAG,IAAA,gCAAoB,EACjC,sBAAsB,EACtB,GAAG,EACH,gBAAgB,CACjB,CAAC;QAEF,IAAA,eAAM,EAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;KAqBpD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\nimport { updateEntryClientMod } from '../../src/remix/sdk-setup';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('initializeSentryOnEntryClient', () => {\n it('should initialize Sentry on client entry with all features enabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: true,\n replay: true,\n logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, replayIntegration, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry when performance disabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: false,\n replay: true,\n logs: false,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { init, replayIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n\n integrations: [replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry when replay disabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: true,\n replay: false,\n logs: false,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n })]\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry with only logs enabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: false,\n replay: false,\n logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { init,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n enableLogs: true\n })\"\n `);\n });\n\n it('should initialize Sentry on client entry with performance and logs enabled', () => {\n // Empty entry.client.tsx file for testing\n const originalEntryClientMod = parseModule('');\n\n const dsn = 'https://sentry.io/123';\n const selectedFeatures = {\n performance: true,\n replay: false,\n logs: true,\n };\n\n const result = updateEntryClientMod(\n originalEntryClientMod,\n dsn,\n selectedFeatures,\n );\n\n expect(result.generate().code).toMatchInlineSnapshot(`\n \"import { useEffect,} from \"react\";\n\n import {\n useLocation,\n useMatches,\n } from \"@remix-run/react\";\n\n import { init, browserTracingIntegration,} from \"@sentry/remix\";\n\n init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n })]\n })\"\n `);\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// @ts-expect-error - magicast is ESM and TS complains about that. It works though
|
|
4
|
+
const magicast_1 = require("magicast");
|
|
5
|
+
const vitest_1 = require("vitest");
|
|
6
|
+
const root_1 = require("../../src/remix/codemods/root");
|
|
7
|
+
(0, vitest_1.describe)('wrapAppWithSentry', () => {
|
|
8
|
+
(0, vitest_1.it)('should wrap the app with Sentry', () => {
|
|
9
|
+
// Empty root.tsx file for testing
|
|
10
|
+
const originalRootAst = (0, magicast_1.parseModule)(`
|
|
11
|
+
import { Outlet } from '@remix-run/react';
|
|
12
|
+
|
|
13
|
+
export default function App() {
|
|
14
|
+
return <Outlet />;
|
|
15
|
+
}
|
|
16
|
+
`);
|
|
17
|
+
(0, root_1.wrapAppWithSentry)(originalRootAst, 'root.tsx');
|
|
18
|
+
const result = originalRootAst.generate().code;
|
|
19
|
+
(0, vitest_1.expect)(result).toMatchInlineSnapshot(`
|
|
20
|
+
"import {withSentry} from '@sentry/remix';
|
|
21
|
+
import { Outlet } from '@remix-run/react';
|
|
22
|
+
|
|
23
|
+
function App() {
|
|
24
|
+
return <Outlet />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default withSentry(App);"
|
|
28
|
+
`);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=root.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.test.js","sourceRoot":"","sources":["../../../test/remix/root.test.ts"],"names":[],"mappings":";;AAAA,kFAAkF;AAClF,uCAAuC;AACvC,mCAA8C;AAC9C,wDAAkE;AAElE,IAAA,iBAAQ,EAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,IAAA,WAAE,EAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,kCAAkC;QAClC,MAAM,eAAe,GAAG,IAAA,sBAAW,EAAC;;;;;;KAMnC,CAAC,CAAC;QAEH,IAAA,wBAAiB,EAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QAE/C,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC;QAE/C,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;KASpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { parseModule } from 'magicast';\nimport { describe, expect, it } from 'vitest';\nimport { wrapAppWithSentry } from '../../src/remix/codemods/root';\n\ndescribe('wrapAppWithSentry', () => {\n it('should wrap the app with Sentry', () => {\n // Empty root.tsx file for testing\n const originalRootAst = parseModule(`\n import { Outlet } from '@remix-run/react';\n\n export default function App() {\n return <Outlet />;\n }\n `);\n\n wrapAppWithSentry(originalRootAst, 'root.tsx');\n\n const result = originalRootAst.generate().code;\n\n expect(result).toMatchInlineSnapshot(`\n \"import {withSentry} from '@sentry/remix';\n import { Outlet } from '@remix-run/react';\n\n function App() {\n return <Outlet />;\n }\n\n export default withSentry(App);\"\n `);\n });\n});\n"]}
|
|
@@ -7,6 +7,7 @@ const sdk_setup_1 = require("../../src/remix/sdk-setup");
|
|
|
7
7
|
const result = (0, sdk_setup_1.generateServerInstrumentationFile)('https://sentry.io/123', {
|
|
8
8
|
performance: true,
|
|
9
9
|
replay: true,
|
|
10
|
+
logs: true,
|
|
10
11
|
});
|
|
11
12
|
(0, vitest_1.expect)(result.instrumentationFileMod.generate().code)
|
|
12
13
|
.toMatchInlineSnapshot(`
|
|
@@ -14,7 +15,8 @@ const sdk_setup_1 = require("../../src/remix/sdk-setup");
|
|
|
14
15
|
|
|
15
16
|
Sentry.init({
|
|
16
17
|
dsn: "https://sentry.io/123",
|
|
17
|
-
tracesSampleRate: 1
|
|
18
|
+
tracesSampleRate: 1,
|
|
19
|
+
enableLogs: true
|
|
18
20
|
})"
|
|
19
21
|
`);
|
|
20
22
|
});
|
|
@@ -22,6 +24,7 @@ const sdk_setup_1 = require("../../src/remix/sdk-setup");
|
|
|
22
24
|
const result = (0, sdk_setup_1.generateServerInstrumentationFile)('https://sentry.io/123', {
|
|
23
25
|
performance: false,
|
|
24
26
|
replay: true,
|
|
27
|
+
logs: false,
|
|
25
28
|
});
|
|
26
29
|
(0, vitest_1.expect)(result.instrumentationFileMod.generate().code)
|
|
27
30
|
.toMatchInlineSnapshot(`
|
|
@@ -32,5 +35,38 @@ const sdk_setup_1 = require("../../src/remix/sdk-setup");
|
|
|
32
35
|
})"
|
|
33
36
|
`);
|
|
34
37
|
});
|
|
38
|
+
(0, vitest_1.it)('should generate server instrumentation file with only logs enabled', () => {
|
|
39
|
+
const result = (0, sdk_setup_1.generateServerInstrumentationFile)('https://sentry.io/123', {
|
|
40
|
+
performance: false,
|
|
41
|
+
replay: false,
|
|
42
|
+
logs: true,
|
|
43
|
+
});
|
|
44
|
+
(0, vitest_1.expect)(result.instrumentationFileMod.generate().code)
|
|
45
|
+
.toMatchInlineSnapshot(`
|
|
46
|
+
"import * as Sentry from "@sentry/remix";
|
|
47
|
+
|
|
48
|
+
Sentry.init({
|
|
49
|
+
dsn: "https://sentry.io/123",
|
|
50
|
+
enableLogs: true
|
|
51
|
+
})"
|
|
52
|
+
`);
|
|
53
|
+
});
|
|
54
|
+
(0, vitest_1.it)('should generate server instrumentation file with performance and logs enabled', () => {
|
|
55
|
+
const result = (0, sdk_setup_1.generateServerInstrumentationFile)('https://sentry.io/123', {
|
|
56
|
+
performance: true,
|
|
57
|
+
replay: false,
|
|
58
|
+
logs: true,
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.expect)(result.instrumentationFileMod.generate().code)
|
|
61
|
+
.toMatchInlineSnapshot(`
|
|
62
|
+
"import * as Sentry from "@sentry/remix";
|
|
63
|
+
|
|
64
|
+
Sentry.init({
|
|
65
|
+
dsn: "https://sentry.io/123",
|
|
66
|
+
tracesSampleRate: 1,
|
|
67
|
+
enableLogs: true
|
|
68
|
+
})"
|
|
69
|
+
`);
|
|
70
|
+
});
|
|
35
71
|
});
|
|
36
72
|
//# sourceMappingURL=server-instrumentation.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-instrumentation.test.js","sourceRoot":"","sources":["../../../test/remix/server-instrumentation.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,yDAA8E;AAE9E,IAAA,iBAAQ,EAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,IAAA,WAAE,EAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,MAAM,GAAG,IAAA,6CAAiC,EAAC,uBAAuB,EAAE;YACxE,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"server-instrumentation.test.js","sourceRoot":"","sources":["../../../test/remix/server-instrumentation.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,yDAA8E;AAE9E,IAAA,iBAAQ,EAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,IAAA,WAAE,EAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,MAAM,GAAG,IAAA,6CAAiC,EAAC,uBAAuB,EAAE;YACxE,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;S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AC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport { generateServerInstrumentationFile } from '../../src/remix/sdk-setup';\n\ndescribe('generateServerInstrumentationFile', () => {\n it('should generate server instrumentation file', () => {\n const result = generateServerInstrumentationFile('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result.instrumentationFileMod.generate().code)\n .toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n enableLogs: true\n })\"\n `);\n });\n\n it('should generate server instrumentation file when performance is disabled', () => {\n const result = generateServerInstrumentationFile('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result.instrumentationFileMod.generate().code)\n .toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\"\n })\"\n `);\n });\n\n it('should generate server instrumentation file with only logs enabled', () => {\n const result = generateServerInstrumentationFile('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result.instrumentationFileMod.generate().code)\n .toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n enableLogs: true\n })\"\n `);\n });\n\n it('should generate server instrumentation file with performance and logs enabled', () => {\n const result = generateServerInstrumentationFile('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: true,\n });\n\n expect(result.instrumentationFileMod.generate().code)\n .toMatchInlineSnapshot(`\n \"import * as Sentry from \"@sentry/remix\";\n\n Sentry.init({\n dsn: \"https://sentry.io/123\",\n tracesSampleRate: 1,\n enableLogs: true\n })\"\n `);\n });\n});\n"]}
|
|
@@ -7,6 +7,7 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
7
7
|
const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
|
|
8
8
|
performance: true,
|
|
9
9
|
replay: true,
|
|
10
|
+
logs: true,
|
|
10
11
|
});
|
|
11
12
|
(0, vitest_1.expect)(result).toMatchInlineSnapshot(`
|
|
12
13
|
"import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
|
|
@@ -17,6 +18,9 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
17
18
|
|
|
18
19
|
tracesSampleRate: 1.0,
|
|
19
20
|
|
|
21
|
+
// Enable logs to be sent to Sentry
|
|
22
|
+
enableLogs: true,
|
|
23
|
+
|
|
20
24
|
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
21
25
|
// in development and sample at a lower rate in production
|
|
22
26
|
replaysSessionSampleRate: 0.1,
|
|
@@ -38,6 +42,7 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
38
42
|
const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
|
|
39
43
|
performance: false,
|
|
40
44
|
replay: true,
|
|
45
|
+
logs: false,
|
|
41
46
|
});
|
|
42
47
|
(0, vitest_1.expect)(result).toMatchInlineSnapshot(`
|
|
43
48
|
"import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
|
|
@@ -46,6 +51,7 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
46
51
|
Sentry.init({
|
|
47
52
|
dsn: 'https://sentry.io/123',
|
|
48
53
|
|
|
54
|
+
|
|
49
55
|
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
50
56
|
// in development and sample at a lower rate in production
|
|
51
57
|
replaysSessionSampleRate: 0.1,
|
|
@@ -67,6 +73,7 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
67
73
|
const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
|
|
68
74
|
performance: true,
|
|
69
75
|
replay: false,
|
|
76
|
+
logs: false,
|
|
70
77
|
});
|
|
71
78
|
(0, vitest_1.expect)(result).toMatchInlineSnapshot(`
|
|
72
79
|
"import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
|
|
@@ -78,6 +85,31 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
78
85
|
tracesSampleRate: 1.0,
|
|
79
86
|
|
|
80
87
|
|
|
88
|
+
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// If you have a custom error handler, pass it to \`handleErrorWithSentry\`
|
|
92
|
+
export const handleError = handleErrorWithSentry();
|
|
93
|
+
"
|
|
94
|
+
`);
|
|
95
|
+
});
|
|
96
|
+
(0, vitest_1.it)('should generate client hooks template with only logs enabled', () => {
|
|
97
|
+
const result = (0, templates_1.getClientHooksTemplate)('https://sentry.io/123', {
|
|
98
|
+
performance: false,
|
|
99
|
+
replay: false,
|
|
100
|
+
logs: true,
|
|
101
|
+
});
|
|
102
|
+
(0, vitest_1.expect)(result).toMatchInlineSnapshot(`
|
|
103
|
+
"import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
|
|
104
|
+
import * as Sentry from '@sentry/sveltekit';
|
|
105
|
+
|
|
106
|
+
Sentry.init({
|
|
107
|
+
dsn: 'https://sentry.io/123',
|
|
108
|
+
|
|
109
|
+
// Enable logs to be sent to Sentry
|
|
110
|
+
enableLogs: true,
|
|
111
|
+
|
|
112
|
+
|
|
81
113
|
});
|
|
82
114
|
|
|
83
115
|
// If you have a custom error handler, pass it to \`handleErrorWithSentry\`
|
|
@@ -91,6 +123,7 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
91
123
|
const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
|
|
92
124
|
performance: true,
|
|
93
125
|
replay: true,
|
|
126
|
+
logs: true,
|
|
94
127
|
});
|
|
95
128
|
(0, vitest_1.expect)(result).toMatchInlineSnapshot(`
|
|
96
129
|
"import { sequence } from "@sveltejs/kit/hooks";
|
|
@@ -102,6 +135,9 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
102
135
|
|
|
103
136
|
tracesSampleRate: 1.0,
|
|
104
137
|
|
|
138
|
+
// Enable logs to be sent to Sentry
|
|
139
|
+
enableLogs: true,
|
|
140
|
+
|
|
105
141
|
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
|
106
142
|
// spotlight: import.meta.env.DEV,
|
|
107
143
|
});
|
|
@@ -118,6 +154,34 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
118
154
|
const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
|
|
119
155
|
performance: false,
|
|
120
156
|
replay: true,
|
|
157
|
+
logs: false,
|
|
158
|
+
});
|
|
159
|
+
(0, vitest_1.expect)(result).toMatchInlineSnapshot(`
|
|
160
|
+
"import { sequence } from "@sveltejs/kit/hooks";
|
|
161
|
+
import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
|
|
162
|
+
import * as Sentry from '@sentry/sveltekit';
|
|
163
|
+
|
|
164
|
+
Sentry.init({
|
|
165
|
+
dsn: 'https://sentry.io/123',
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
|
169
|
+
// spotlight: import.meta.env.DEV,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// If you have custom handlers, make sure to place them after \`sentryHandle()\` in the \`sequence\` function.
|
|
173
|
+
export const handle = sequence(sentryHandle());
|
|
174
|
+
|
|
175
|
+
// If you have a custom error handler, pass it to \`handleErrorWithSentry\`
|
|
176
|
+
export const handleError = handleErrorWithSentry();
|
|
177
|
+
"
|
|
178
|
+
`);
|
|
179
|
+
});
|
|
180
|
+
(0, vitest_1.it)('should generate server hooks template with only logs enabled', () => {
|
|
181
|
+
const result = (0, templates_1.getServerHooksTemplate)('https://sentry.io/123', {
|
|
182
|
+
performance: false,
|
|
183
|
+
replay: false,
|
|
184
|
+
logs: true,
|
|
121
185
|
});
|
|
122
186
|
(0, vitest_1.expect)(result).toMatchInlineSnapshot(`
|
|
123
187
|
"import { sequence } from "@sveltejs/kit/hooks";
|
|
@@ -127,6 +191,9 @@ const templates_1 = require("../../src/sveltekit/templates");
|
|
|
127
191
|
Sentry.init({
|
|
128
192
|
dsn: 'https://sentry.io/123',
|
|
129
193
|
|
|
194
|
+
// Enable logs to be sent to Sentry
|
|
195
|
+
enableLogs: true,
|
|
196
|
+
|
|
130
197
|
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
|
131
198
|
// spotlight: import.meta.env.DEV,
|
|
132
199
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,6DAGuC;AAEvC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"templates.test.js","sourceRoot":"","sources":["../../../test/sveltekit/templates.test.ts"],"names":[],"mappings":";;AAAA,mCAA8C;AAC9C,6DAGuC;AAEvC,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;IACtC,IAAA,WAAE,EAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;YACZ,IA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E,GAAG,EAAE;QACzE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;KAmBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,MAAM,GAAG,IAAA,kCAAsB,EAAC,uBAAuB,EAAE;YAC7D,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;KAqBpC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it } from 'vitest';\nimport {\n getClientHooksTemplate,\n getServerHooksTemplate,\n} from '../../src/sveltekit/templates';\n\ndescribe('getClientHooksTemplate', () => {\n it('should generate client hooks template with all features enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate client hooks template when performance disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate client hooks template when replay disabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: false,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n\n\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate client hooks template with only logs enabled', () => {\n const result = getClientHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n\ndescribe('getServerHooksTemplate', () => {\n it('should generate server hooks template with all features enabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: true,\n replay: true,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate server hooks template when performance disabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: true,\n logs: false,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n\n it('should generate server hooks template with only logs enabled', () => {\n const result = getServerHooksTemplate('https://sentry.io/123', {\n performance: false,\n replay: false,\n logs: true,\n });\n\n expect(result).toMatchInlineSnapshot(`\n \"import { sequence } from \"@sveltejs/kit/hooks\";\n import { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: 'https://sentry.io/123',\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\n\n // If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\n export const handle = sequence(sentryHandle());\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n });\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.wrapAppWithSentry = void 0;
|
|
33
|
-
const recast = __importStar(require("recast"));
|
|
34
|
-
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
35
|
-
const prompts_1 = __importDefault(require("@clack/prompts"));
|
|
36
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
37
|
-
// @ts-expect-error - magicast is ESM and TS complains about that. It works though
|
|
38
|
-
const magicast_1 = require("magicast");
|
|
39
|
-
function wrapAppWithSentry(rootRouteAst, rootFileName) {
|
|
40
|
-
rootRouteAst.imports.$add({
|
|
41
|
-
from: '@sentry/remix',
|
|
42
|
-
imported: 'withSentry',
|
|
43
|
-
local: 'withSentry',
|
|
44
|
-
});
|
|
45
|
-
recast.visit(rootRouteAst.$ast, {
|
|
46
|
-
visitExportDefaultDeclaration(path) {
|
|
47
|
-
if (path.value.declaration.type === 'FunctionDeclaration') {
|
|
48
|
-
// Move the function declaration just before the default export
|
|
49
|
-
path.insertBefore(path.value.declaration);
|
|
50
|
-
// Get the name of the function to be wrapped
|
|
51
|
-
const functionName = path.value.declaration.id.name;
|
|
52
|
-
// Create the wrapped function call
|
|
53
|
-
const functionCall = recast.types.builders.callExpression(recast.types.builders.identifier('withSentry'), [recast.types.builders.identifier(functionName)]);
|
|
54
|
-
// Replace the default export with the wrapped function call
|
|
55
|
-
path.value.declaration = functionCall;
|
|
56
|
-
}
|
|
57
|
-
else if (path.value.declaration.type === 'Identifier') {
|
|
58
|
-
const rootRouteExport = rootRouteAst.exports.default;
|
|
59
|
-
const expressionToWrap = (0, magicast_1.generateCode)(rootRouteExport.$ast).code;
|
|
60
|
-
rootRouteAst.exports.default = magicast_1.builders.raw(`withSentry(${expressionToWrap})`);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
prompts_1.default.log.warn(chalk_1.default.yellow(`Couldn't instrument ${chalk_1.default.bold(rootFileName)} automatically. Wrap your default export with: ${chalk_1.default.dim('withSentry()')}\n`));
|
|
64
|
-
}
|
|
65
|
-
this.traverse(path);
|
|
66
|
-
},
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
exports.wrapAppWithSentry = wrapAppWithSentry;
|
|
70
|
-
//# sourceMappingURL=root-common.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"root-common.js","sourceRoot":"","sources":["../../../../src/remix/codemods/root-common.ts"],"names":[],"mappings":";AAAA,4DAA4D;AAC5D,+DAA+D;AAC/D,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1D,+CAAiC;AACjC,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,kFAAkF;AAClF,uCAAmE;AAEnE,SAAgB,iBAAiB,CAC/B,YAA6B,EAC7B,YAAoB;IAEpB,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC;QACxB,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,YAAY;QACtB,KAAK,EAAE,YAAY;KACpB,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE;QAC9B,6BAA6B,CAAC,IAAI;YAChC,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,qBAAqB,EAAE;gBACzD,+DAA+D;gBAC/D,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBAE1C,6CAA6C;gBAC7C,MAAM,YAAY,GAAW,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,IAAc,CAAC;gBAEtE,mCAAmC;gBACnC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CACvD,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,EAC9C,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CACjD,CAAC;gBAEF,4DAA4D;gBAC5D,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC;aACvC;iBAAM,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,YAAY,EAAE;gBACvD,MAAM,eAAe,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC;gBAErD,MAAM,gBAAgB,GAAG,IAAA,uBAAY,EAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;gBAEjE,YAAY,CAAC,OAAO,CAAC,OAAO,GAAG,mBAAQ,CAAC,GAAG,CACzC,cAAc,gBAAgB,GAAG,CAClC,CAAC;aACH;iBAAM;gBACL,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,eAAK,CAAC,MAAM,CACV,uBAAuB,eAAK,CAAC,IAAI,CAC/B,YAAY,CACb,kDAAkD,eAAK,CAAC,GAAG,CAC1D,cAAc,CACf,IAAI,CACN,CACF,CAAC;aACH;YAED,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAlDD,8CAkDC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\n\nimport * as recast from 'recast';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { builders, ProxifiedModule, generateCode } from 'magicast';\n\nexport function wrapAppWithSentry(\n rootRouteAst: ProxifiedModule,\n rootFileName: string,\n) {\n rootRouteAst.imports.$add({\n from: '@sentry/remix',\n imported: 'withSentry',\n local: 'withSentry',\n });\n\n recast.visit(rootRouteAst.$ast, {\n visitExportDefaultDeclaration(path) {\n if (path.value.declaration.type === 'FunctionDeclaration') {\n // Move the function declaration just before the default export\n path.insertBefore(path.value.declaration);\n\n // Get the name of the function to be wrapped\n const functionName: string = path.value.declaration.id.name as string;\n\n // Create the wrapped function call\n const functionCall = recast.types.builders.callExpression(\n recast.types.builders.identifier('withSentry'),\n [recast.types.builders.identifier(functionName)],\n );\n\n // Replace the default export with the wrapped function call\n path.value.declaration = functionCall;\n } else if (path.value.declaration.type === 'Identifier') {\n const rootRouteExport = rootRouteAst.exports.default;\n\n const expressionToWrap = generateCode(rootRouteExport.$ast).code;\n\n rootRouteAst.exports.default = builders.raw(\n `withSentry(${expressionToWrap})`,\n );\n } else {\n clack.log.warn(\n chalk.yellow(\n `Couldn't instrument ${chalk.bold(\n rootFileName,\n )} automatically. Wrap your default export with: ${chalk.dim(\n 'withSentry()',\n )}\\n`,\n ),\n );\n }\n\n this.traverse(path);\n },\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function instrumentRootRouteV1(rootFileName: string): Promise<void>;
|