Skip to content

Commit d36ea7f

Browse files
committed
use new normalizeOptions function and create sentry client if conditions are met
1 parent d547bdf commit d36ea7f

File tree

1 file changed

+16
-2
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+16
-2
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ import {
1414
import { red } from "./utils/logging.ts";
1515
import { normalizePath } from "./utils/normalizePath.ts";
1616
import { bundleAnalysisPluginFactory } from "./bundle-analysis/bundleAnalysisPluginFactory.ts";
17+
import {
18+
normalizeOptions,
19+
type NormalizedOptions,
20+
} from "./utils/normalizeOptions.ts";
21+
import { createSentryInstance } from "./sentry.ts";
1722

1823
const NODE_VERSION_RANGE = ">=18.18.0";
1924

@@ -27,6 +32,13 @@ function codecovUnpluginFactory({
2732
return createUnplugin<Options, true>((userOptions, unpluginMetaContext) => {
2833
const plugins: UnpluginOptions[] = [];
2934

35+
const options = normalizeOptions(userOptions);
36+
37+
const { sentryClient } = createSentryInstance(
38+
options,
39+
unpluginMetaContext.framework,
40+
);
41+
3042
if (!satisfies(process.version, NODE_VERSION_RANGE)) {
3143
red(
3244
`Codecov ${unpluginMetaContext.framework} bundler plugin requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,
@@ -35,11 +47,12 @@ function codecovUnpluginFactory({
3547
return plugins;
3648
}
3749

38-
if (userOptions?.enableBundleAnalysis) {
50+
if (options?.enableBundleAnalysis) {
3951
plugins.push(
4052
bundleAnalysisPluginFactory({
41-
userOptions,
53+
userOptions: options,
4254
bundleAnalysisUploadPlugin,
55+
sentryClient,
4356
}),
4457
);
4558
}
@@ -57,6 +70,7 @@ export type {
5770
ProviderUtilInputs,
5871
UploadOverrides,
5972
Output,
73+
NormalizedOptions,
6074
};
6175

6276
export { normalizePath, codecovUnpluginFactory, red };

0 commit comments

Comments
 (0)