Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .changeset/empty-hounds-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@codecov/nextjs-webpack-plugin": minor
"@codecov/bundler-plugin-core": minor
"@codecov/remix-vite-plugin": minor
"@codecov/solidstart-plugin": minor
"@codecov/sveltekit-plugin": minor
"@codecov/bundle-analyzer": minor
"@codecov/webpack-plugin": minor
"@codecov/rollup-plugin": minor
"@codecov/astro-plugin": minor
"@codecov/nuxt-plugin": minor
"@codecov/vite-plugin": minor
---

Update normalizePath to handle Vite legacy builds as they currently are not being normalized
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"typedoc": "^0.27.5",
"typescript": "^5.3.3",
"vite": "^6.0.3",
"vitest": "^2.1.8"
"vitest": "^2.1.9"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,json,css,scss,md,json}": [
Expand Down
4 changes: 2 additions & 2 deletions packages/astro-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"devDependencies": {
"@rollup/plugin-replace": "^5.0.5",
"@types/node": "^20.11.15",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/coverage-v8": "^2.1.9",
"astro": "^5.0.9",
"codecovProdRollupPlugin": "npm:@codecov/rollup-plugin@1.5.0",
"msw": "^2.7.0",
Expand All @@ -67,7 +67,7 @@
"typescript": "^5.3.3",
"unbuild": "^2.0.0",
"vite": "^6.0.3",
"vitest": "^2.1.8"
"vitest": "^2.1.9"
},
"peerDependencies": {
"astro": "4.x || 5.x"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ describe("astroBundleAnalysisPlugin", () => {
it("returns a plugin object", () => {
const plugin = astroBundleAnalysisPlugin({
target: "client",
output: new Output({
apiUrl: "http://localhost",
bundleName: "test-bundle",
debug: false,
dryRun: true,
enableBundleAnalysis: true,
retryCount: 1,
uploadToken: "test-token",
telemetry: false,
}),
output: new Output(
{
apiUrl: "http://localhost",
bundleName: "test-bundle",
debug: false,
dryRun: true,
enableBundleAnalysis: true,
retryCount: 1,
uploadToken: "test-token",
telemetry: false,
},
{ metaFramework: "vite" },
),
pluginName: PLUGIN_NAME,
pluginVersion: PLUGIN_VERSION,
});
Expand Down
8 changes: 7 additions & 1 deletion packages/astro-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@
bundler: unpluginMetaContext.framework,
metaFramework: "astro",
});
const output = new Output(options, sentryConfig);

const output = new Output(
options,
{ metaFramework: unpluginMetaContext.framework },
sentryConfig,
);

Check warning on line 59 in packages/astro-plugin/src/index.ts

View check run for this annotation

Codecov Notifications / codecov/patch

packages/astro-plugin/src/index.ts#L55-L59

Added lines #L55 - L59 were not covered by tests

if (options.enableBundleAnalysis) {
plugins.push(
telemetryPlugin({
Expand Down
4 changes: 2 additions & 2 deletions packages/bundle-analyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
"@types/micromatch": "^4.0.9",
"@types/node": "^20.11.15",
"@types/yargs": "^17.0.33",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/coverage-v8": "^2.1.9",
"codecovProdRollupPlugin": "npm:@codecov/rollup-plugin@1.5.0",
"msw": "^2.7.0",
"ts-node": "^10.9.2",
"typedoc": "^0.27.5",
"unbuild": "^2.0.0",
"vite": "^6.0.3",
"vitest": "^2.1.8"
"vitest": "^2.1.9"
},
"volta": {
"extends": "../../package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/bundle-analyzer/src/assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ describe("getAsset", () => {
expect(normalizePath).toHaveBeenCalledWith(
path.relative(mockParentPath, mockFilePath),
"",
"bundle-analyzer",
);
expect(asset).toEqual({
name: path.relative(mockParentPath, mockFilePath),
Expand All @@ -127,6 +128,7 @@ describe("getAsset", () => {
expect(normalizePath).toHaveBeenCalledWith(
path.relative(mockParentPath, mockFilePath),
inputPattern,
"bundle-analyzer",
);

expect(asset.normalized).toBe(expectedNormalizedName);
Expand Down
6 changes: 5 additions & 1 deletion packages/bundle-analyzer/src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export const getAsset = async (

// normalize the file name if a pattern is provided. By default (when pattern is ""), this
// will replace anything "hashlike" with *. For example index-1dca144e.js --> index-*.js
const normalizedName = normalizePath(fileName, normalizeAssetsPattern);
const normalizedName = normalizePath(
fileName,
normalizeAssetsPattern,
"bundle-analyzer",
);

return {
name: fileName,
Expand Down
4 changes: 3 additions & 1 deletion packages/bundle-analyzer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ const createReport = async (
normalizedBundleAnalyzerOptions: NormalizedBundleAnalyzerOptions,
): Promise<Output> => {
// initialize report
const output: Output = new Output(normalizedCoreOptions);
const output: Output = new Output(normalizedCoreOptions, {
metaFramework: "bundle-analyzer",
});
output.start();
output.setPlugin(PLUGIN_NAME, PLUGIN_VERSION);

Expand Down
4 changes: 2 additions & 2 deletions packages/bundler-plugin-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@sentry/core": "^8.42.0",
"@types/node": "^20.11.15",
"@types/semver": "^7.5.6",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/coverage-v8": "^2.1.9",
"codecovProdRollupPlugin": "npm:@codecov/rollup-plugin@1.5.0",
"msw": "^2.7.0",
"testdouble": "^3.20.1",
Expand All @@ -60,7 +60,7 @@
"typedoc": "^0.27.5",
"typescript": "^5.3.3",
"unbuild": "^2.0.0",
"vitest": "^2.1.8"
"vitest": "^2.1.9"
},
"volta": {
"extends": "../../package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/bundler-plugin-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
type ExtendedBAUploadPlugin,
type Chunk,
type Module,
type MetaFramework,
type Options,
type ProviderUtilInputs,
type UploadOverrides,
Expand Down Expand Up @@ -38,6 +39,7 @@ export type {
ExtendedBAUploadArgs,
ExtendedBAUploadPlugin,
Chunk,
MetaFramework,
Module,
Options,
NormalizedOptions,
Expand Down
6 changes: 5 additions & 1 deletion packages/bundler-plugin-core/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type UnpluginOptions } from "unplugin";
import { type UnpluginContextMeta, type UnpluginOptions } from "unplugin";
import { type Output } from "./utils/Output";
import { type ValidGitService } from "./utils/normalizeOptions";

Expand All @@ -7,6 +7,10 @@ export interface Dependency {
version: string;
}

export type MetaFramework =
| UnpluginContextMeta["framework"]
| "bundle-analyzer";

export interface Asset {
name: string;
size: number;
Expand Down
14 changes: 12 additions & 2 deletions packages/bundler-plugin-core/src/utils/Output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { type Client, type Scope, startSpan } from "@sentry/core";
import {
type Asset,
type Chunk,
type MetaFramework,
type Module,
type OutputPayload,
type ProviderUtilInputs,
Expand All @@ -15,6 +16,10 @@ import { type ValidGitService } from "./normalizeOptions";
import { debug } from "./logging.ts";
import { safeFlushTelemetry } from "../sentry/telemetry.ts";

interface OtherOptions {
metaFramework: MetaFramework;
}

interface SentryConfig {
sentryClient?: Client;
sentryScope?: Scope;
Expand Down Expand Up @@ -47,6 +52,7 @@ class Output {
name: string;
version: string;
};
metaFramework: MetaFramework;
outputPath?: string;
builtAt?: number;
duration?: number;
Expand All @@ -66,7 +72,11 @@ class Output {
sentryClient?: Client;
sentryScope?: Scope;

constructor(userOptions: NormalizedOptions, sentryConfig?: SentryConfig) {
constructor(
userOptions: NormalizedOptions,
otherOptions: OtherOptions,
sentryConfig?: SentryConfig,
) {
this.version = "3";
this.apiUrl = userOptions.apiUrl;
this.dryRun = userOptions.dryRun;
Expand All @@ -80,7 +90,7 @@ class Output {
this.telemetry = userOptions.telemetry;
this.sentryClient = sentryConfig?.sentryClient;
this.sentryScope = sentryConfig?.sentryScope;

this.metaFramework = otherOptions.metaFramework;
if (userOptions.uploadOverrides) {
this.branch = userOptions.uploadOverrides.branch;
this.build = userOptions.uploadOverrides.build;
Expand Down
Loading
Loading