-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(nextjs): Remove metadata builder class
Refactor the class into functions to save on bundle size. Extracted from changes in #4196.
- Loading branch information
1 parent
7ff913a
commit 7479626
Showing
4 changed files
with
31 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { SDK_VERSION } from '@sentry/core'; | ||
import { Options, SdkInfo } from '@sentry/types'; | ||
|
||
const PACKAGE_NAME_PREFIX = 'npm:@sentry/'; | ||
|
||
/** | ||
* A builder for the SDK metadata in the options for the SDK initialization. | ||
* @param options sdk options object that gets mutated | ||
* @param names list of package names | ||
*/ | ||
export function buildMetadata(options: Options, names: string[]): void { | ||
options._metadata = options._metadata || {}; | ||
options._metadata.sdk = | ||
options._metadata.sdk || | ||
({ | ||
name: 'sentry.javascript.nextjs', | ||
packages: names.map((name) => ({ | ||
name: `${PACKAGE_NAME_PREFIX}/${name}`, | ||
version: SDK_VERSION, | ||
})), | ||
version: SDK_VERSION, | ||
} as SdkInfo); | ||
} |
This file was deleted.
Oops, something went wrong.