Skip to content

Commit e4ae897

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

File tree

1 file changed

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

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +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 { normalizeOptions } from "./utils/normalizeOptions.ts";
17+
import {
18+
normalizeOptions,
19+
type NormalizedOptions,
20+
} from "./utils/normalizeOptions.ts";
21+
import { createSentryInstance } from "./sentry.ts";
1822

1923
const NODE_VERSION_RANGE = ">=18.18.0";
2024

@@ -37,6 +41,13 @@ function codecovUnpluginFactory({
3741
return [];
3842
}
3943

44+
const options = normalizedOptions.options;
45+
46+
const { sentryClient } = createSentryInstance(
47+
options,
48+
unpluginMetaContext.framework,
49+
);
50+
4051
if (!satisfies(process.version, NODE_VERSION_RANGE)) {
4152
red(
4253
`Codecov ${unpluginMetaContext.framework} bundler plugin requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,
@@ -45,12 +56,12 @@ function codecovUnpluginFactory({
4556
return plugins;
4657
}
4758

48-
const options = normalizedOptions.options;
4959
if (options?.enableBundleAnalysis) {
5060
plugins.push(
5161
bundleAnalysisPluginFactory({
5262
options,
5363
bundleAnalysisUploadPlugin,
64+
sentryClient,
5465
}),
5566
);
5667
}
@@ -68,6 +79,7 @@ export type {
6879
ProviderUtilInputs,
6980
UploadOverrides,
7081
Output,
82+
NormalizedOptions,
7183
};
7284

7385
export { normalizePath, codecovUnpluginFactory, red };

0 commit comments

Comments
 (0)