diff --git a/benchmarks/with-cookiekit/app/favicon.ico b/benchmarks/with-cookiekit/app/favicon.ico new file mode 100644 index 0000000..718d6fe Binary files /dev/null and b/benchmarks/with-cookiekit/app/favicon.ico differ diff --git a/benchmarks/with-cookiekit/app/layout.tsx b/benchmarks/with-cookiekit/app/layout.tsx new file mode 100644 index 0000000..1cf9bc8 --- /dev/null +++ b/benchmarks/with-cookiekit/app/layout.tsx @@ -0,0 +1,27 @@ +'use client'; + +/* + * If you're using Next.js, we recommend installing the @c15t/nextjs package. + * The Next.js package is a wrapper around the React package that provides + * additional features for Next.js. + */ + +import { + CookieManager +} from 'react-cookie-manager'; +import type { ReactNode } from 'react'; + + +export default function RootLayout({ + children, +}: Readonly<{ + children: ReactNode; +}>) { + return ( + + + {children} + + + ); +} diff --git a/benchmarks/with-cookiekit/app/page.tsx b/benchmarks/with-cookiekit/app/page.tsx new file mode 100644 index 0000000..98f99f4 --- /dev/null +++ b/benchmarks/with-cookiekit/app/page.tsx @@ -0,0 +1,9 @@ +export default function Home() { + return ( +
+

Benchmark

+
+ ); +} + + diff --git a/benchmarks/with-cookiekit/config.json b/benchmarks/with-cookiekit/config.json new file mode 100644 index 0000000..e722ae2 --- /dev/null +++ b/benchmarks/with-cookiekit/config.json @@ -0,0 +1,48 @@ +{ + "$schema": "./node_modules/@cookiebench/benchmark-schema/schema.json", + "name": "with-cookiekit", + "iterations": 20, + "cookieBanner": { + "selectors": [ + ".cookie-manager", + ".react-cookie-manager", + "[data-react-cookie-manager]" + ], + "serviceHosts": [], + "waitForVisibility": true, + "measureViewportCoverage": true, + "expectedLayoutShift": false, + "serviceName": "Cookiekit" + }, + "internationalization": { + "detection": "none", + "stringLoading": "none" + }, + "techStack": { + "bundler": "vite", + "bundleType": ["esm", "cjs"], + "frameworks": ["react"], + "languages": ["typescript", "javascript"], + "packageManager": "pnpm", + "typescript": true + }, + "source": { + "license": "MIT", + "github": "github.com/hypershiphq/react-cookie-manager", + "npm": "react-cookie-manager", + "website": "https://github.com/hypershiphq/react-cookie-manager", + "openSource": true, + "type": "open-source" + }, + "company": { + "name": "Hypership", + "website": "https://github.com/hypershiphq", + "avatar": "https://github.com/hypershiphq.png" + }, + "includes": { + "backend": [], + "components": ["react", "javascript"] + }, + "tags": ["cookiekit", "react", "open source", "oss", "community"] +} + diff --git a/benchmarks/with-cookiekit/next-env.d.ts b/benchmarks/with-cookiekit/next-env.d.ts new file mode 100644 index 0000000..1b3be08 --- /dev/null +++ b/benchmarks/with-cookiekit/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/benchmarks/with-cookiekit/next.config.ts b/benchmarks/with-cookiekit/next.config.ts new file mode 100644 index 0000000..8b0f049 --- /dev/null +++ b/benchmarks/with-cookiekit/next.config.ts @@ -0,0 +1,7 @@ +import type { NextConfig } from 'next'; + +const nextConfig: NextConfig = {}; + +export default nextConfig; + + diff --git a/benchmarks/with-cookiekit/package.json b/benchmarks/with-cookiekit/package.json new file mode 100644 index 0000000..960fa30 --- /dev/null +++ b/benchmarks/with-cookiekit/package.json @@ -0,0 +1,29 @@ +{ + "name": "with-cookiekit", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev --port 3001", + "build": "next build", + "start": "next start", + "lint": "next lint", + "fmt": "pnpm biome format --write . && pnpm biome check --formatter-enabled=false --linter-enabled=false --organize-imports-enabled=true --write", + "benchmark": "pnpm exec benchmark-cli benchmark" + }, + "dependencies": { + "next": "15.3.3", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "react-cookie-manager": "4.0.3" + }, + "devDependencies": { + "@cookiebench/benchmark-schema": "workspace:*", + "@cookiebench/cli": "workspace:*", + "@cookiebench/ts-config": "workspace:*", + "@types/node": "^22.15.30", + "@types/react": "^19.1.6", + "@types/react-dom": "^19.1.6", + "typescript": "^5.8.3" + } +} + diff --git a/benchmarks/with-cookiekit/tsconfig.json b/benchmarks/with-cookiekit/tsconfig.json new file mode 100644 index 0000000..2f66370 --- /dev/null +++ b/benchmarks/with-cookiekit/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../packages/typescript-config/nextjs.json", + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} + + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index afcb82d..fa2cbeb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -218,6 +218,43 @@ importers: specifier: ^5.8.3 version: 5.8.3 + benchmarks/with-cookiekit: + dependencies: + next: + specifier: 15.3.3 + version: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.52.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + react: + specifier: ^19.0.0 + version: 19.1.0 + react-cookie-manager: + specifier: 4.0.3 + version: 4.0.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0) + react-dom: + specifier: ^19.0.0 + version: 19.1.0(react@19.1.0) + devDependencies: + '@cookiebench/benchmark-schema': + specifier: workspace:* + version: link:../../packages/benchmark-schema + '@cookiebench/cli': + specifier: workspace:* + version: link:../../packages/cli + '@cookiebench/ts-config': + specifier: workspace:* + version: link:../../packages/typescript-config + '@types/node': + specifier: ^22.15.30 + version: 22.15.30 + '@types/react': + specifier: ^19.1.6 + version: 19.1.6 + '@types/react-dom': + specifier: ^19.1.6 + version: 19.1.6(@types/react@19.1.6) + typescript: + specifier: ^5.8.3 + version: 5.8.3 + benchmarks/with-didomi: dependencies: '@didomi/react': @@ -2974,6 +3011,12 @@ packages: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true + react-cookie-manager@4.0.3: + resolution: {integrity: sha512-JlNeeiBAIiofzm2+vUzFAhOUrZq+nzbAV9o+WcDGr3+/tBKbpJvQn94Mk6tiB6wJ8mbYWNNkWmxQaJXCiVxY3w==} + peerDependencies: + react: '>=16.8.0' + react-dom: '>=16.8.0' + react-dom@19.1.0: resolution: {integrity: sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==} peerDependencies: @@ -5963,6 +6006,11 @@ snapshots: strip-json-comments: 2.0.1 optional: true + react-cookie-manager@4.0.3(react-dom@19.1.0(react@19.1.0))(react@19.1.0): + dependencies: + react: 19.1.0 + react-dom: 19.1.0(react@19.1.0) + react-dom@19.1.0(react@19.1.0): dependencies: react: 19.1.0 diff --git a/react-cookie-manager b/react-cookie-manager new file mode 160000 index 0000000..6069f22 --- /dev/null +++ b/react-cookie-manager @@ -0,0 +1 @@ +Subproject commit 6069f2206bd50f92a4d8ec82d63dc87cabe9ec33