diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98e5fc31..1e706545 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -194,6 +194,60 @@ jobs: env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + integration-test: + name: Run Integration Tests (Node ${{ matrix.node-version }}) + needs: install + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [ + "18.19.0", + "20.10.0" + ] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v3 + env: + cache-name: cache-codecov-js-bundle-plugin-node-modules + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-${{ env.cache-name }}- + + - name: Install dependencies + run: pnpm install + + - name: Build packages + run: pnpm run build + + - name: Run unit tests + run: pnpm run test:e2e --maxWorkers=2 + + # fossa: # name: Run Fossa # runs-on: ubuntu-latest diff --git a/codecov.yml b/codecov.yml index 6ea3b414..9cbb6f2a 100644 --- a/codecov.yml +++ b/codecov.yml @@ -28,3 +28,7 @@ component_management: name: Webpack plugin paths: - packages/webpack-plugin/** + +ignore: + - ./examples/* + - ./integration-tests/* diff --git a/integration-tests/fixtures/generate-bundle-stats/rollup-plugin.test.ts b/integration-tests/fixtures/generate-bundle-stats/rollup-plugin.test.ts new file mode 100644 index 00000000..fdc074d4 --- /dev/null +++ b/integration-tests/fixtures/generate-bundle-stats/rollup-plugin.test.ts @@ -0,0 +1,92 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +import path from "path"; +import fs from "fs"; +import { type Output } from "@codecov/bundler-plugin-core"; +import { rollup } from "rollup"; +// @ts-expect-error - no types +import resolve from "@rollup/plugin-node-resolve"; +import commonjs from "@rollup/plugin-commonjs"; +import { codecovRollupPlugin } from "@codecov/rollup-plugin"; + +const expectedStats = { + version: "1", + plugin: { name: "codecov-rollup-bundle-analysis-plugin", version: "1.0.0" }, + builtAt: 1701788687217, + duration: 7, + bundler: { name: "rollup", version: "4.6.0" }, + assets: [{ name: "main-Kc6Ge1DG.js", size: 216 }], + chunks: [ + { + id: "main", + uniqueId: "0-main", + entry: true, + initial: false, + files: ["main-Kc6Ge1DG.js"], + names: ["main"], + }, + ], + modules: [ + { + name: "./src/getRandomNumber.js", + size: 98, + chunks: ["main"], + chunkUniqueIds: ["0-main"], + }, + { + name: "./src/main.js", + size: 115, + chunks: ["main"], + chunkUniqueIds: ["0-main"], + }, + ], +}; + +describe("Generating rollup stats", () => { + let stats: Output; + const rollupPath = path.resolve(__dirname, "../../test-apps/rollup"); + beforeAll(async () => { + await rollup({ + input: `${rollupPath}/src/main.js`, + plugins: [ + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + resolve(), + commonjs(), + codecovRollupPlugin({ enableBundleAnalysis: true, dryRun: true }), + ], + }).then((bundle) => + bundle.write({ + dir: `${rollupPath}/dist`, + entryFileNames: "[name]-[hash].js", + }), + ); + + const statsFilePath = path.resolve( + rollupPath, + "dist/codecov-bundle-stats.json", + ); + + const statsData = fs.readFileSync(statsFilePath); + stats = JSON.parse(statsData.toString()) as Output; + }); + + afterAll(() => { + fs.rm( + path.resolve(rollupPath, "dist"), + { recursive: true, force: true }, + () => null, + ); + }); + + it("sets the correct version", () => { + expect(stats.version).toStrictEqual(expectedStats.version); + }); + + it("sets the correct plugin information", () => { + expect(stats.plugin).toStrictEqual(expectedStats.plugin); + }); + + it("sets the correct bundler information", () => { + expect(stats.bundler).toStrictEqual(expectedStats.bundler); + }); +}); diff --git a/integration-tests/fixtures/generate-bundle-stats/vite-plugin.test.ts b/integration-tests/fixtures/generate-bundle-stats/vite-plugin.test.ts new file mode 100644 index 00000000..49960a10 --- /dev/null +++ b/integration-tests/fixtures/generate-bundle-stats/vite-plugin.test.ts @@ -0,0 +1,91 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +import path from "path"; +import fs from "fs"; +import { type Output } from "@codecov/bundler-plugin-core"; +import { build } from "vite"; +import { codecovVitePlugin } from "@codecov/vite-plugin"; + +const expectedStats = { + version: "1", + plugin: { name: "codecov-vite-bundle-analysis-plugin", version: "1.0.0" }, + builtAt: 1701788687217, + duration: 7, + bundler: { name: "rollup", version: "4.6.0" }, + assets: [{ name: "main-Kc6Ge1DG.js", size: 216 }], + chunks: [ + { + id: "main", + uniqueId: "0-main", + entry: true, + initial: false, + files: ["main-Kc6Ge1DG.js"], + names: ["main"], + }, + ], + modules: [ + { + name: "./src/getRandomNumber.js", + size: 98, + chunks: ["main"], + chunkUniqueIds: ["0-main"], + }, + { + name: "./src/main.js", + size: 115, + chunks: ["main"], + chunkUniqueIds: ["0-main"], + }, + ], +}; + +describe("Generating vite stats", () => { + let stats: Output; + const vitePath = path.resolve(__dirname, "../../test-apps/vite"); + beforeAll(async () => { + await build({ + clearScreen: false, + root: vitePath, + build: { + outDir: "dist", + rollupOptions: { + input: `${vitePath}/index.html`, + output: { + format: "cjs", + }, + }, + }, + plugins: [ + codecovVitePlugin({ enableBundleAnalysis: true, dryRun: true }), + ], + }); + + const statsFilePath = path.resolve( + vitePath, + "dist/codecov-bundle-stats.json", + ); + + const statsData = fs.readFileSync(statsFilePath); + stats = JSON.parse(statsData.toString()) as Output; + }); + + afterAll(() => { + fs.rm( + path.resolve(vitePath, "dist"), + { recursive: true, force: true }, + () => null, + ); + }); + + it("sets the correct version", () => { + expect(stats.version).toStrictEqual(expectedStats.version); + }); + + it("sets the correct plugin information", () => { + expect(stats.plugin).toStrictEqual(expectedStats.plugin); + }); + + it("sets the correct bundler information", () => { + expect(stats.bundler).toStrictEqual(expectedStats.bundler); + }); +}); diff --git a/integration-tests/fixtures/generate-bundle-stats/webpack-plugin.test.ts b/integration-tests/fixtures/generate-bundle-stats/webpack-plugin.test.ts new file mode 100644 index 00000000..76c94873 --- /dev/null +++ b/integration-tests/fixtures/generate-bundle-stats/webpack-plugin.test.ts @@ -0,0 +1,98 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +import path from "path"; +import fs from "fs"; +import { type Output } from "@codecov/bundler-plugin-core"; +import { webpack } from "webpack"; +import { codecovWebpackPlugin } from "@codecov/webpack-plugin"; + +const expectedStats = { + version: "1", + plugin: { name: "codecov-webpack-bundle-analysis-plugin", version: "1.0.0" }, + builtAt: 1701788687217, + duration: 7, + bundler: { name: "webpack", version: "5.89.0" }, + assets: [{ name: "main-Kc6Ge1DG.js", size: 216 }], + chunks: [ + { + id: "main", + uniqueId: "0-main", + entry: true, + initial: false, + files: ["main-Kc6Ge1DG.js"], + names: ["main"], + }, + ], + modules: [ + { + name: "./src/getRandomNumber.js", + size: 98, + chunks: ["main"], + chunkUniqueIds: ["0-main"], + }, + { + name: "./src/main.js", + size: 115, + chunks: ["main"], + chunkUniqueIds: ["0-main"], + }, + ], +}; + +describe("Generating webpack stats", () => { + let stats: Output; + const webpackPath = path.resolve(__dirname, "../../test-apps/webpack"); + beforeAll(async () => { + await new Promise((resolve) => { + webpack( + { + cache: false, + entry: `${webpackPath}/src/main.js`, + output: { + path: `${webpackPath}/dist`, + filename: "main-[hash].js", + }, + mode: "production", + plugins: [ + codecovWebpackPlugin({ enableBundleAnalysis: true, dryRun: true }), + ], + }, + (err) => { + if (err) { + throw err; + } + + resolve(); + }, + ); + }); + + const statsFilePath = path.resolve( + webpackPath, + "dist/codecov-bundle-stats.json", + ); + + const statsData = fs.readFileSync(statsFilePath); + stats = JSON.parse(statsData.toString()) as Output; + }); + + afterAll(() => { + fs.rm( + path.resolve(webpackPath, "dist"), + { recursive: true, force: true }, + () => null, + ); + }); + + it("sets the correct version", () => { + expect(stats.version).toStrictEqual(expectedStats.version); + }); + + it("sets the correct plugin information", () => { + expect(stats.plugin).toStrictEqual(expectedStats.plugin); + }); + + it("sets the correct bundler information", () => { + expect(stats.bundler).toStrictEqual(expectedStats.bundler); + }); +}); diff --git a/integration-tests/jest.config.ts b/integration-tests/jest.config.ts index 40b10b0d..160178bb 100644 --- a/integration-tests/jest.config.ts +++ b/integration-tests/jest.config.ts @@ -1,27 +1,6 @@ -// eslint-disable-next-line @typescript-eslint/no-var-requires -const packageJson = require("./package.json") as { version: string }; - -const config = { +module.exports = { testEnvironment: "node", - collectCoverageFrom: ["!**/node_modules/**"], transform: { - "^.+\\.(t|j)sx?$": [ - "@swc/jest", - { - jsc: { - transform: { - optimizer: { - globals: { - vars: { - __PACKAGE_VERSION__: packageJson.version, - }, - }, - }, - }, - }, - }, - ], + "^.+\\.(t|j)sx?$": ["@swc/jest"], }, }; - -export default config; diff --git a/integration-tests/package.json b/integration-tests/package.json index 248ef3a1..774023c5 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -4,8 +4,9 @@ "description": "", "private": true, "license": "MIT", + "type": "module", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test:e2e": "NODE_OPTIONS=--experimental-vm-modules jest", "type-check": "tsc --noEmit", "clean": "rm -rf node_modules", "lint": "eslint . --ext .ts,.tsx", @@ -14,11 +15,18 @@ "format:check": "prettier '**/*.{cjs,mjs,ts,tsx,md,json}' --ignore-path ../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --check" }, "dependencies": { + "@codecov/bundler-plugin-core": "workspace:^", + "@codecov/rollup-plugin": "workspace:^", + "@codecov/vite-plugin": "workspace:^", + "@codecov/webpack-plugin": "workspace:^", + "@rollup/plugin-commonjs": "^17.0.0", + "@rollup/plugin-node-resolve": "^11.2.1", "@swc/core": "^1.3.99", "@swc/jest": "^0.2.29", "@types/jest": "^29.5.10", "@types/node": "^20.10.3", "jest": "^29.7.0", + "lodash": "^4.17.21", "rollup": "4.6.0", "ts-node": "^10.9.1", "vite": "5.0.3", diff --git a/integration-tests/test-api/.dockerignore b/integration-tests/test-api/.dockerignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/integration-tests/test-api/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/integration-tests/test-api/.gitignore b/integration-tests/test-api/.gitignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/integration-tests/test-api/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/integration-tests/test-api/Dockerfile b/integration-tests/test-api/Dockerfile new file mode 100644 index 00000000..3e4245e1 --- /dev/null +++ b/integration-tests/test-api/Dockerfile @@ -0,0 +1,18 @@ +FROM --platform=arm64 node:20-alpine +WORKDIR /app + +ENV NODE_ENV=production + +COPY . . + +RUN npm install -g pnpm +RUN pnpm install + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 hono + +USER hono +EXPOSE 8000 +ENV PORT 8000 + +CMD ["pnpm", "run", "start"] diff --git a/integration-tests/test-api/README.md b/integration-tests/test-api/README.md new file mode 100644 index 00000000..e12b31db --- /dev/null +++ b/integration-tests/test-api/README.md @@ -0,0 +1,8 @@ +``` +npm install +npm run dev +``` + +``` +open http://localhost:3000 +``` diff --git a/integration-tests/test-api/package.json b/integration-tests/test-api/package.json new file mode 100644 index 00000000..eb7018cd --- /dev/null +++ b/integration-tests/test-api/package.json @@ -0,0 +1,14 @@ +{ + "scripts": { + "dev": "tsx watch src/index.ts", + "start": "tsx src/index.ts" + }, + "dependencies": { + "@hono/node-server": "^1.3.1", + "hono": "^3.11.2", + "tsx": "^3.12.2" + }, + "volta": { + "extends": "../../package.json" + } +} diff --git a/integration-tests/test-api/src/index.ts b/integration-tests/test-api/src/index.ts new file mode 100644 index 00000000..e3918a58 --- /dev/null +++ b/integration-tests/test-api/src/index.ts @@ -0,0 +1,54 @@ +import { serve } from "@hono/node-server"; +import { Hono } from "hono"; + +const app = new Hono(); + +app.get("/", (c) => c.text("Hello Hono!")); + +app.all( + "/:status{[0-9]{3}}/upload/bundle_analysis/v1/:badPUT{true|false}", + (c) => { + const status = parseInt(c.req.param("status")); + const badPUT = c.req.param("badPUT") === "true"; + + if (status >= 400 && !badPUT) { + return c.text(`Error code: ${status}`, { status }); + } + + const url = new URL(c.req.url); + let putURL = `${url.protocol}//${url.host}/file-upload`; + + if (badPUT) { + putURL = `${putURL}/${status}`; + } + + return c.json( + { + url: putURL, + }, + { status: 200 }, + ); + }, +); + +app.all("/file-upload/:status{[0-9]{3}}", async (c) => { + const status = parseInt(c.req.param("status")); + + if (status >= 400) { + return c.text(`Error code: ${status}`, { status }); + } + + await c.req.json(); + + return c.text("File uploaded successfully", { status: 200 }); +}); + +serve( + { + fetch: app.fetch, + port: 8000, + }, + (info) => { + console.info(`🚀 Server listening on ${info.address}:${info.port}`); + }, +); diff --git a/integration-tests/test-api/tsconfig.json b/integration-tests/test-api/tsconfig.json new file mode 100644 index 00000000..9136c143 --- /dev/null +++ b/integration-tests/test-api/tsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "strict": true, + "jsx": "react-jsx", + "jsxImportSource": "hono/jsx" + } +} diff --git a/integration-tests/test-apps/rollup/package.json b/integration-tests/test-apps/rollup/package.json deleted file mode 100644 index 431a7e6d..00000000 --- a/integration-tests/test-apps/rollup/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "rollup", - "version": "1.0.0", - "private": true, - "license": "MIT", - "type": "module", - "scripts": { - "build": "rollup -c" - }, - "dependencies": { - "@codecov/rollup-plugin": "workspace:^", - "@rollup/plugin-commonjs": "^17.0.0", - "@rollup/plugin-node-resolve": "^11.1.0", - "lodash": "^4.17.21", - "rollup": "^4.6.1" - }, - "volta": { - "extends": "../../../package.json" - }, - "engines": { - "node": ">=18.0.0" - } -} diff --git a/integration-tests/test-apps/rollup/rollup.config.js b/integration-tests/test-apps/rollup/rollup.config.js deleted file mode 100644 index 212e14c1..00000000 --- a/integration-tests/test-apps/rollup/rollup.config.js +++ /dev/null @@ -1,20 +0,0 @@ -import resolve from "@rollup/plugin-node-resolve"; -import commonjs from "@rollup/plugin-commonjs"; -import { codecovRollupPlugin } from "@codecov/rollup-plugin"; -import { defineConfig } from "rollup"; - -export default defineConfig({ - input: "src/main.js", - output: { - dir: "dist", - entryFileNames: "[name]-[hash].js", - }, - plugins: [ - resolve(), - commonjs(), - codecovRollupPlugin({ - enableBundleAnalysis: true, - dryRun: true, - }), - ], -}); diff --git a/integration-tests/test-apps/rollup/src/main.js b/integration-tests/test-apps/rollup/src/main.js index cf1af1ad..696da0e8 100644 --- a/integration-tests/test-apps/rollup/src/main.js +++ b/integration-tests/test-apps/rollup/src/main.js @@ -9,4 +9,4 @@ const output = `Is ${randomNumber} between 0 and 5: ${_.inRange( 5, )}`; -console.log(randomNumber); // Outputs a random number between 1 and 10 +console.log(output); diff --git a/integration-tests/test-apps/vite/package.json b/integration-tests/test-apps/vite/package.json deleted file mode 100644 index e34c94c8..00000000 --- a/integration-tests/test-apps/vite/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "vite", - "version": "1.0.0", - "private": true, - "license": "MIT", - "type": "module", - "scripts": { - "build": "vite build" - }, - "dependencies": { - "@codecov/vite-plugin": "workspace:^", - "lodash": "^4.17.21", - "vite": "5.0.3" - }, - "volta": { - "extends": "../../../package.json" - }, - "engines": { - "node": ">=18.0.0" - } -} diff --git a/integration-tests/test-apps/vite/src/main.js b/integration-tests/test-apps/vite/src/main.js index cf1af1ad..696da0e8 100644 --- a/integration-tests/test-apps/vite/src/main.js +++ b/integration-tests/test-apps/vite/src/main.js @@ -9,4 +9,4 @@ const output = `Is ${randomNumber} between 0 and 5: ${_.inRange( 5, )}`; -console.log(randomNumber); // Outputs a random number between 1 and 10 +console.log(output); diff --git a/integration-tests/test-apps/vite/vite.config.js b/integration-tests/test-apps/vite/vite.config.js deleted file mode 100644 index 304b8652..00000000 --- a/integration-tests/test-apps/vite/vite.config.js +++ /dev/null @@ -1,11 +0,0 @@ -import { defineConfig } from "vite"; -import { codecovVitePlugin } from "@codecov/vite-plugin"; - -export default defineConfig({ - plugins: [ - codecovVitePlugin({ - enableBundleAnalysis: true, - dryRun: true, - }), - ], -}); diff --git a/integration-tests/test-apps/webpack/package.json b/integration-tests/test-apps/webpack/package.json deleted file mode 100644 index e408cc14..00000000 --- a/integration-tests/test-apps/webpack/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "webpack", - "version": "1.0.0", - "license": "MIT", - "type": "module", - "scripts": { - "build": "webpack --config webpack.config.cjs" - }, - "dependencies": { - "@codecov/webpack-plugin": "workspace:^", - "lodash": "^4.17.21", - "webpack": "5.89.0" - }, - "volta": { - "extends": "../../../package.json" - }, - "engines": { - "node": ">=18.0.0" - } -} diff --git a/integration-tests/test-apps/webpack/src/main.js b/integration-tests/test-apps/webpack/src/main.js index cf1af1ad..83348311 100644 --- a/integration-tests/test-apps/webpack/src/main.js +++ b/integration-tests/test-apps/webpack/src/main.js @@ -9,4 +9,4 @@ const output = `Is ${randomNumber} between 0 and 5: ${_.inRange( 5, )}`; -console.log(randomNumber); // Outputs a random number between 1 and 10 +console.log(output); // Outputs a random number between 1 and 10 diff --git a/integration-tests/test-apps/webpack/webpack.config.cjs b/integration-tests/test-apps/webpack/webpack.config.cjs deleted file mode 100644 index e020ca8d..00000000 --- a/integration-tests/test-apps/webpack/webpack.config.cjs +++ /dev/null @@ -1,17 +0,0 @@ -const path = require("path"); -const { codecovWebpackPlugin } = require("@codecov/webpack-plugin"); - -module.exports = { - entry: "./src/main.js", - mode: "production", - output: { - path: path.resolve(__dirname, "dist"), - filename: "[name].[contenthash].chunk.js", - }, - plugins: [ - codecovWebpackPlugin({ - enableBundleAnalysis: true, - dryRun: true, - }), - ], -}; diff --git a/integration-tests/tsconfig.json b/integration-tests/tsconfig.json index bed6a762..ea16c150 100644 --- a/integration-tests/tsconfig.json +++ b/integration-tests/tsconfig.json @@ -1,5 +1,8 @@ { "extends": "../tsconfig.json", - "include": ["jest.config.ts"], - "exclude": ["coverage/**/*", "node_modules/**/*", "./test-apps/**/*"] + "include": ["jest.config.ts", "fixtures/**/*", "test-api/**/*"], + "exclude": ["coverage/**/*", "node_modules/**/*", "./test-apps/**/*"], + "compilerOptions": { + "types": ["node", "jest"] + } } diff --git a/package.json b/package.json index e99d4296..3e1ff951 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "format:check": "pnpm -r --filter='./packages/*' format:check && prettier --check '*.{cjs,json}' --ignore-unknown --no-error-on-unmatched-pattern", "test:unit": "pnpm -r --filter='./packages/*' run test:unit", "test:unit:ci": "pnpm -r --filter='./packages/*' run test:unit:ci", + "test:e2e": "pnpm -r --filter='./integration-tests' run test:e2e", "prepare": "husky install" }, "devDependencies": { diff --git a/packages/bundler-plugin-core/src/index.ts b/packages/bundler-plugin-core/src/index.ts index aff09a2f..120b7525 100644 --- a/packages/bundler-plugin-core/src/index.ts +++ b/packages/bundler-plugin-core/src/index.ts @@ -9,6 +9,7 @@ import { type Options, type ProviderUtilInputs, type UploadOverrides, + type Output, } from "./types.ts"; import { red } from "./utils/logging.ts"; @@ -55,4 +56,5 @@ export type { Options, ProviderUtilInputs, UploadOverrides, + Output, }; diff --git a/packages/bundler-plugin-core/src/utils/__tests__/provider.test.ts b/packages/bundler-plugin-core/src/utils/__tests__/provider.test.ts index f8716a0f..fd303c02 100644 --- a/packages/bundler-plugin-core/src/utils/__tests__/provider.test.ts +++ b/packages/bundler-plugin-core/src/utils/__tests__/provider.test.ts @@ -46,8 +46,7 @@ describe("detectProvider", () => { envs: {}, }; - const result = await detectProvider(inputs); - console.info(result); + await detectProvider(inputs); } catch (e) { error = e; } diff --git a/packages/webpack-plugin/src/webpack-bundle-analysis/webpackBundleAnalysisPlugin.ts b/packages/webpack-plugin/src/webpack-bundle-analysis/webpackBundleAnalysisPlugin.ts index 103d2b57..f529f8ca 100644 --- a/packages/webpack-plugin/src/webpack-bundle-analysis/webpackBundleAnalysisPlugin.ts +++ b/packages/webpack-plugin/src/webpack-bundle-analysis/webpackBundleAnalysisPlugin.ts @@ -26,6 +26,11 @@ export const webpackBundleAnalysisPlugin: BundleAnalysisUploadPlugin = ({ hash: true, }); + output.bundler = { + name: "webpack", + version: webpack4or5.version, + }; + const { assets, chunks, modules } = compilationStats; if (assets) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1c78777a..e2602a0c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -186,6 +186,24 @@ importers: integration-tests: dependencies: + '@codecov/bundler-plugin-core': + specifier: workspace:^ + version: link:../packages/bundler-plugin-core + '@codecov/rollup-plugin': + specifier: workspace:^ + version: link:../packages/rollup-plugin + '@codecov/vite-plugin': + specifier: workspace:^ + version: link:../packages/vite-plugin + '@codecov/webpack-plugin': + specifier: workspace:^ + version: link:../packages/webpack-plugin + '@rollup/plugin-commonjs': + specifier: ^17.0.0 + version: 17.1.0(rollup@4.6.0) + '@rollup/plugin-node-resolve': + specifier: ^11.2.1 + version: 11.2.1(rollup@4.6.0) '@swc/core': specifier: ^1.3.99 version: 1.3.99 @@ -201,6 +219,9 @@ importers: jest: specifier: ^29.7.0 version: 29.7.0(@types/node@20.10.3)(ts-node@10.9.1) + lodash: + specifier: ^4.17.21 + version: 4.17.21 rollup: specifier: 4.6.0 version: 4.6.0 @@ -214,6 +235,18 @@ importers: specifier: 5.89.0 version: 5.89.0(@swc/core@1.3.99) + integration-tests/test-api: + dependencies: + '@hono/node-server': + specifier: ^1.3.1 + version: 1.3.1 + hono: + specifier: ^3.11.2 + version: 3.11.3 + tsx: + specifier: ^3.12.2 + version: 3.14.0 + packages/bundler-plugin-core: dependencies: chalk: @@ -757,7 +790,6 @@ packages: cpu: [arm64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-arm64@0.19.4: @@ -774,7 +806,6 @@ packages: cpu: [arm] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-arm@0.19.4: @@ -791,7 +822,6 @@ packages: cpu: [x64] os: [android] requiresBuild: true - dev: true optional: true /@esbuild/android-x64@0.19.4: @@ -808,7 +838,6 @@ packages: cpu: [arm64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/darwin-arm64@0.19.4: @@ -825,7 +854,6 @@ packages: cpu: [x64] os: [darwin] requiresBuild: true - dev: true optional: true /@esbuild/darwin-x64@0.19.4: @@ -842,7 +870,6 @@ packages: cpu: [arm64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-arm64@0.19.4: @@ -859,7 +886,6 @@ packages: cpu: [x64] os: [freebsd] requiresBuild: true - dev: true optional: true /@esbuild/freebsd-x64@0.19.4: @@ -876,7 +902,6 @@ packages: cpu: [arm64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm64@0.19.4: @@ -893,7 +918,6 @@ packages: cpu: [arm] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-arm@0.19.4: @@ -910,7 +934,6 @@ packages: cpu: [ia32] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ia32@0.19.4: @@ -927,7 +950,6 @@ packages: cpu: [loong64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-loong64@0.19.4: @@ -944,7 +966,6 @@ packages: cpu: [mips64el] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-mips64el@0.19.4: @@ -961,7 +982,6 @@ packages: cpu: [ppc64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-ppc64@0.19.4: @@ -978,7 +998,6 @@ packages: cpu: [riscv64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-riscv64@0.19.4: @@ -995,7 +1014,6 @@ packages: cpu: [s390x] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-s390x@0.19.4: @@ -1012,7 +1030,6 @@ packages: cpu: [x64] os: [linux] requiresBuild: true - dev: true optional: true /@esbuild/linux-x64@0.19.4: @@ -1029,7 +1046,6 @@ packages: cpu: [x64] os: [netbsd] requiresBuild: true - dev: true optional: true /@esbuild/netbsd-x64@0.19.4: @@ -1046,7 +1062,6 @@ packages: cpu: [x64] os: [openbsd] requiresBuild: true - dev: true optional: true /@esbuild/openbsd-x64@0.19.4: @@ -1063,7 +1078,6 @@ packages: cpu: [x64] os: [sunos] requiresBuild: true - dev: true optional: true /@esbuild/sunos-x64@0.19.4: @@ -1080,7 +1094,6 @@ packages: cpu: [arm64] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-arm64@0.19.4: @@ -1097,7 +1110,6 @@ packages: cpu: [ia32] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-ia32@0.19.4: @@ -1114,7 +1126,6 @@ packages: cpu: [x64] os: [win32] requiresBuild: true - dev: true optional: true /@esbuild/win32-x64@0.19.4: @@ -1162,6 +1173,11 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true + /@hono/node-server@1.3.1: + resolution: {integrity: sha512-eQBCDbH1Vv/TiYXNP8aGfJTuXi9xGhEd/EZg9u6dhr7zC5/WKKztcBmbrOTtixVBvvV6bfcay6KEginwiqHyXg==} + engines: {node: '>=18.14.1'} + dev: false + /@humanwhocodes/config-array@0.11.13: resolution: {integrity: sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==} engines: {node: '>=10.10.0'} @@ -1634,6 +1650,22 @@ packages: rollup: 2.79.1 dev: true + /@rollup/plugin-commonjs@17.1.0(rollup@4.6.0): + resolution: {integrity: sha512-PoMdXCw0ZyvjpCMT5aV4nkL0QywxP29sODQsSGeDpr/oI49Qq9tRtAsb/LbYbDzFlOydVEqHmmZWFtXJEAX9ew==} + engines: {node: '>= 8.0.0'} + peerDependencies: + rollup: ^2.30.0 + dependencies: + '@rollup/pluginutils': 3.1.0(rollup@4.6.0) + commondir: 1.0.1 + estree-walker: 2.0.2 + glob: 7.2.3 + is-reference: 1.2.1 + magic-string: 0.25.9 + resolve: 1.22.8 + rollup: 4.6.0 + dev: false + /@rollup/plugin-commonjs@25.0.7(rollup@3.29.4): resolution: {integrity: sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ==} engines: {node: '>=14.0.0'} @@ -1680,6 +1712,21 @@ packages: rollup: 2.79.1 dev: true + /@rollup/plugin-node-resolve@11.2.1(rollup@4.6.0): + resolution: {integrity: sha512-yc2n43jcqVyGE2sqV5/YCmocy9ArjVAP/BeXyTtADTBBX6V0e5UMqwO8CdQ0kzjb6zu5P1qMzsScCMRvE9OlVg==} + engines: {node: '>= 10.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0 + dependencies: + '@rollup/pluginutils': 3.1.0(rollup@4.6.0) + '@types/resolve': 1.17.1 + builtin-modules: 3.3.0 + deepmerge: 4.3.1 + is-module: 1.0.0 + resolve: 1.22.8 + rollup: 4.6.0 + dev: false + /@rollup/plugin-node-resolve@15.2.3(rollup@3.29.4): resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} engines: {node: '>=14.0.0'} @@ -1724,6 +1771,18 @@ packages: rollup: 2.79.1 dev: true + /@rollup/pluginutils@3.1.0(rollup@4.6.0): + resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} + engines: {node: '>= 8.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0 + dependencies: + '@types/estree': 0.0.39 + estree-walker: 1.0.1 + picomatch: 2.3.1 + rollup: 4.6.0 + dev: false + /@rollup/pluginutils@5.0.5(rollup@3.29.4): resolution: {integrity: sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q==} engines: {node: '>=14.0.0'} @@ -2016,7 +2075,6 @@ packages: /@types/estree@0.0.39: resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==} - dev: true /@types/estree@1.0.2: resolution: {integrity: sha512-VeiPZ9MMwXjO32/Xu7+OwflfmeoRwkE/qzndw42gGtgJwZopBnzy2gD//NN1+go1mADzkDcqf/KnFRSjTJ8xJA==} @@ -2089,7 +2147,6 @@ packages: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: '@types/node': 20.10.3 - dev: true /@types/resolve@1.20.2: resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -2858,7 +2915,6 @@ packages: /builtin-modules@3.3.0: resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} engines: {node: '>=6'} - dev: true /bundle-name@3.0.0: resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==} @@ -3098,7 +3154,6 @@ packages: /commondir@1.0.1: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} - dev: true /compressible@2.0.18: resolution: {integrity: sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==} @@ -3538,7 +3593,6 @@ packages: '@esbuild/win32-arm64': 0.18.20 '@esbuild/win32-ia32': 0.18.20 '@esbuild/win32-x64': 0.18.20 - dev: true /esbuild@0.19.4: resolution: {integrity: sha512-x7jL0tbRRpv4QUyuDMjONtWFciygUxWaUM1kMX2zWxI0X2YWOt7MSA0g4UdeSiHM8fcYVzpQhKYOycZwxTdZkA==} @@ -3928,11 +3982,9 @@ packages: /estree-walker@1.0.1: resolution: {integrity: sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==} - dev: true /estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} - dev: true /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} @@ -4242,7 +4294,6 @@ packages: resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} dependencies: resolve-pkg-maps: 1.0.0 - dev: true /glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} @@ -4412,6 +4463,11 @@ packages: resolution: {integrity: sha512-EWGTfnTqAO2L/j5HZgoM/3z82L7necsJ0pO9Tp0X1wil3PDLrkypTBRgVO2ExehEEvUycejZD3FuRaXpZZc3kw==} dev: true + /hono@3.11.3: + resolution: {integrity: sha512-MWYBcIS4dZJo9e/852Zwl+gqBiUSRknMOZ/MbW7kW8JiWixTJ58pzXVIeBq7jnvFq3AZ9uQ35QyVpzV05sdNFw==} + engines: {node: '>=16.0.0'} + dev: false + /hookable@5.5.3: resolution: {integrity: sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==} dev: true @@ -4668,7 +4724,6 @@ packages: /is-module@1.0.0: resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} - dev: true /is-negative-zero@2.0.2: resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} @@ -4711,7 +4766,6 @@ packages: resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} dependencies: '@types/estree': 1.0.2 - dev: true /is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} @@ -5615,7 +5669,6 @@ packages: resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} dependencies: sourcemap-codec: 1.4.8 - dev: true /magic-string@0.30.5: resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} @@ -6512,7 +6565,6 @@ packages: /resolve-pkg-maps@1.0.0: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} - dev: true /resolve.exports@2.0.2: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==} @@ -6866,7 +6918,6 @@ packages: /sourcemap-codec@1.4.8: resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} deprecated: Please use @jridgewell/sourcemap-codec instead - dev: true /spdx-correct@3.2.0: resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} @@ -7385,6 +7436,17 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + /tsx@3.14.0: + resolution: {integrity: sha512-xHtFaKtHxM9LOklMmJdI3BEnQq/D5F73Of2E1GDrITi9sgoVkvIsrQUTY1G8FlmGtA+awCI4EBlTRRYxkL2sRg==} + hasBin: true + dependencies: + esbuild: 0.18.20 + get-tsconfig: 4.7.2 + source-map-support: 0.5.21 + optionalDependencies: + fsevents: 2.3.3 + dev: false + /type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e6537bf3..8bbaa5d7 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,5 @@ packages: - - "packages/*" - "examples/*" + - "packages/*" - "integration-tests" + - "integration-tests/test-api"