Skip to content

Commit

Permalink
Flatten options, remove fields that will get auto-picked up
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiborza committed Aug 28, 2024
1 parent eebbda1 commit 3198d12
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 36 deletions.
8 changes: 3 additions & 5 deletions packages/solidstart/src/vite/sourceMaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ export function makeSourceMapsVitePlugin(options: SourceMapsOptions): Plugin[] {
if (options.debug && sourceMapsPreviouslyNotEnabled) {
// eslint-disable-next-line no-console
console.log('[Sentry SolidStart Plugin] Enabling source map generation');
if (!options.sourcemaps?.filesToDeleteAfterUpload) {
if (!options.filesToDeleteAfterUpload) {
// eslint-disable-next-line no-console
console.warn(
`[Sentry SolidStart PLugin] We recommend setting the \`sourceMapsUploadOptions.sourcemaps.filesToDeleteAfterUpload\` option to clean up source maps after uploading.
`[Sentry SolidStart PLugin] We recommend setting the \`sourceMapsUploadOptions.filesToDeleteAfterUpload\` option to clean up source maps after uploading.
[Sentry SolidStart Plugin] Otherwise, source maps might be deployed to production, depending on your configuration`,
);
}
Expand All @@ -41,9 +41,7 @@ export function makeSourceMapsVitePlugin(options: SourceMapsOptions): Plugin[] {
authToken: options.authToken ?? process.env.SENTRY_AUTH_TOKEN,
telemetry: options.telemetry ?? true,
sourcemaps: {
assets: options.sourcemaps?.assets ?? undefined,
ignore: options.sourcemaps?.ignore ?? undefined,
filesToDeleteAfterUpload: options.sourcemaps?.filesToDeleteAfterUpload ?? undefined,
filesToDeleteAfterUpload: options.filesToDeleteAfterUpload ?? undefined,
...options.unstable_sentryVitePluginOptions?.sourcemaps,
},
_metaOptions: {
Expand Down
37 changes: 7 additions & 30 deletions packages/solidstart/src/vite/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,37 +40,14 @@ export type SourceMapsOptions = {
telemetry?: boolean;

/**
* Options related to sourcemaps
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact
* upload to Sentry has been completed.
*
* @default [] - By default no files are deleted.
*
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
*/
sourcemaps?: {
/**
* A glob or an array of globs that specify the build artifacts and source maps that will be uploaded to Sentry.
*
* The globbing patterns must follow the implementation of the `glob` package.
* @see https://www.npmjs.com/package/glob#glob-primer
*/
assets?: string | Array<string>;

/**
* A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
*
* @default [] - By default no files are ignored. Thus, all files matching the `assets` glob
* or the default value for `assets` are uploaded.
*
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
*/
ignore?: string | Array<string>;

/**
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact
* upload to Sentry has been completed.
*
* @default [] - By default no files are deleted.
*
* The globbing patterns follow the implementation of the glob package. (https://www.npmjs.com/package/glob)
*/
filesToDeleteAfterUpload?: string | Array<string>;
};
filesToDeleteAfterUpload?: string | Array<string>;

/**
* Options to further customize the Sentry Vite Plugin (@sentry/vite-plugin) behavior directly.
Expand Down
2 changes: 1 addition & 1 deletion packages/solidstart/test/vite/sourceMaps.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SentryVitePluginOptions } from '@sentry/vite-plugin';
import type { SentryVitePluginOptions } from '@sentry/vite-plugin';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { makeSourceMapsVitePlugin } from '../../src/vite/sourceMaps';

Expand Down

0 comments on commit 3198d12

Please sign in to comment.