diff --git a/analyze/package.json b/analyze/package.json index 32542735e..c72588f25 100644 --- a/analyze/package.json +++ b/analyze/package.json @@ -1,6 +1,6 @@ { "name": "@arcjet/analyze", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Arcjet local analysis engine", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "analyze" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "type": "module", "main": "./index.js", @@ -36,12 +35,12 @@ "./wasm/arcjet_analyze_js_req_bg.js" ], "dependencies": { - "@arcjet/logger": "1.0.0-alpha.3" + "@arcjet/logger": "1.0.0-alpha.4" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", diff --git a/arcjet-next/index.ts b/arcjet-next/index.ts index 6a6f79959..be8920150 100644 --- a/arcjet-next/index.ts +++ b/arcjet-next/index.ts @@ -1,11 +1,13 @@ import { Interceptor } from "@connectrpc/connect"; import { createConnectTransport } from "@connectrpc/connect-web"; +import type { NextApiResponse } from "next"; import { - NextFetchEvent, - NextMiddleware, - NextRequest, + type NextFetchEvent, + type NextMiddleware, + type NextRequest, NextResponse, } from "next/server.js"; +import type { NextMiddlewareResult } from "next/dist/server/web/types.js"; import arcjet, { ArcjetDecision, ArcjetOptions, @@ -22,7 +24,6 @@ import arcjet, { createRemoteClient, } from "arcjet"; import findIP from "@arcjet/ip"; -import { NextMiddlewareResult } from "next/dist/server/web/types.js"; // Re-export all named exports from the generic SDK export * from "arcjet"; @@ -236,6 +237,30 @@ export function createMiddleware( }; } +function isNextApiResponse(val: unknown): val is NextApiResponse { + if (val === null) { + return false; + } + + if (typeof val !== "object") { + return false; + } + + if (!("status" in val)) { + return false; + } + + if (!("json" in val)) { + return false; + } + + if (typeof val.status !== "function" || typeof val.json !== "function") { + return false; + } + + return true; +} + /** * Wraps a Next.js page route, edge middleware, or an API route running on the * Edge Runtime. @@ -258,19 +283,31 @@ export function withArcjet( ) { return async (...args: Args) => { const request = args[0]; + const response = args[1]; const decision = await arcjet.protect(request); if (decision.isDenied()) { - // TODO(#222): Content type negotiation using `Accept` header - if (decision.reason.isRateLimit()) { - return NextResponse.json( - { code: 429, message: "Too Many Requests" }, - { status: 429 }, - ); + if (isNextApiResponse(response)) { + // TODO(#222): Content type negotiation using `Accept` header + if (decision.reason.isRateLimit()) { + return response + .status(429) + .json({ code: 429, message: "Too Many Requests" }); + } else { + return response.status(403).json({ code: 403, message: "Forbidden" }); + } } else { - return NextResponse.json( - { code: 403, message: "Forbidden" }, - { status: 403 }, - ); + // TODO(#222): Content type negotiation using `Accept` header + if (decision.reason.isRateLimit()) { + return NextResponse.json( + { code: 429, message: "Too Many Requests" }, + { status: 429 }, + ); + } else { + return NextResponse.json( + { code: 403, message: "Forbidden" }, + { status: 403 }, + ); + } } } else { return handler(...args); diff --git a/arcjet-next/package.json b/arcjet-next/package.json index f858193cd..f280217bd 100644 --- a/arcjet-next/package.json +++ b/arcjet-next/package.json @@ -1,6 +1,6 @@ { "name": "@arcjet/next", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Arcjet SDK for the Next.js framework", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "arcjet-next" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "type": "module", "main": "./index.js", @@ -32,15 +31,15 @@ "test": "NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests" }, "dependencies": { - "@arcjet/ip": "1.0.0-alpha.3", + "@arcjet/ip": "1.0.0-alpha.4", "@connectrpc/connect-web": "1.1.4", - "arcjet": "1.0.0-alpha.3", + "arcjet": "1.0.0-alpha.4", "next": "14.0.4" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@types/node": "18.18.0", "@rollup/wasm-node": "4.8.0", diff --git a/arcjet/package.json b/arcjet/package.json index cdd524927..b646ad625 100644 --- a/arcjet/package.json +++ b/arcjet/package.json @@ -1,6 +1,6 @@ { "name": "arcjet", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Arcjet TypeScript and JavaScript SDK core", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "arcjet" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "type": "module", "main": "./index.js", @@ -32,14 +31,14 @@ "test": "NODE_OPTIONS=--experimental-vm-modules jest" }, "dependencies": { - "@arcjet/analyze": "1.0.0-alpha.3", - "@arcjet/logger": "1.0.0-alpha.3", - "@arcjet/protocol": "1.0.0-alpha.3" + "@arcjet/analyze": "1.0.0-alpha.4", + "@arcjet/logger": "1.0.0-alpha.4", + "@arcjet/protocol": "1.0.0-alpha.4" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@edge-runtime/jest-environment": "2.3.7", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", diff --git a/eslint-config/package.json b/eslint-config/package.json index 35f3184d1..df1a9af51 100644 --- a/eslint-config/package.json +++ b/eslint-config/package.json @@ -1,6 +1,6 @@ { "name": "@arcjet/eslint-config", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Custom eslint config for Arcjet projects", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "eslint-config" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "type": "commonjs", "main": "./index.js", diff --git a/examples/nextjs-14-pages-wrap/.eslintrc.json b/examples/nextjs-14-pages-wrap/.eslintrc.json new file mode 100644 index 000000000..bffb357a7 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/examples/nextjs-14-pages-wrap/.gitignore b/examples/nextjs-14-pages-wrap/.gitignore new file mode 100644 index 000000000..fd3dbb571 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/.gitignore @@ -0,0 +1,36 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +.yarn/install-state.gz + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env*.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts diff --git a/examples/nextjs-14-pages-wrap/README.md b/examples/nextjs-14-pages-wrap/README.md new file mode 100644 index 000000000..3e72e4d43 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/README.md @@ -0,0 +1,29 @@ + + + + Arcjet Logo + + + +# Using `withArcjet` with Next.js 14 and the Pages Router + +This example shows how to use `withArcjet` in a Next.js [API +Route](https://nextjs.org/docs/pages/building-your-application/routing/api-routes). + +## How to use + +1. From the root of the project, install the dependencies. + + ```bash + npm ci + ``` + +2. Enter this directory and start the dev server. + + ```bash + cd examples/nextjs-14-pages-wrap + npm run dev + ``` + +3. Visit `http://localhost:3000/api/arcjet`. +4. Refresh the page to trigger the rate limit. diff --git a/examples/nextjs-14-pages-wrap/next.config.js b/examples/nextjs-14-pages-wrap/next.config.js new file mode 100644 index 000000000..a843cbee0 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/next.config.js @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, +} + +module.exports = nextConfig diff --git a/examples/nextjs-14-pages-wrap/package.json b/examples/nextjs-14-pages-wrap/package.json new file mode 100644 index 000000000..f4a2752bd --- /dev/null +++ b/examples/nextjs-14-pages-wrap/package.json @@ -0,0 +1,28 @@ +{ + "name": "nextjs-14-pages-wrap", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint" + }, + "dependencies": { + "@arcjet/next": "*", + "react": "^18", + "react-dom": "^18", + "next": "14.0.4" + }, + "devDependencies": { + "typescript": "^5", + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "autoprefixer": "^10.0.1", + "postcss": "^8", + "tailwindcss": "^3.3.0", + "eslint": "^8", + "eslint-config-next": "14.0.4" + } +} diff --git a/examples/nextjs-14-pages-wrap/pages/_app.tsx b/examples/nextjs-14-pages-wrap/pages/_app.tsx new file mode 100644 index 000000000..021681f4d --- /dev/null +++ b/examples/nextjs-14-pages-wrap/pages/_app.tsx @@ -0,0 +1,6 @@ +import '@/styles/globals.css' +import type { AppProps } from 'next/app' + +export default function App({ Component, pageProps }: AppProps) { + return +} diff --git a/examples/nextjs-14-pages-wrap/pages/_document.tsx b/examples/nextjs-14-pages-wrap/pages/_document.tsx new file mode 100644 index 000000000..54e8bf3e2 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/pages/_document.tsx @@ -0,0 +1,13 @@ +import { Html, Head, Main, NextScript } from 'next/document' + +export default function Document() { + return ( + + + +
+ + + + ) +} diff --git a/examples/nextjs-14-pages-wrap/pages/api/arcjet-edge.ts b/examples/nextjs-14-pages-wrap/pages/api/arcjet-edge.ts new file mode 100644 index 000000000..99ff17a5b --- /dev/null +++ b/examples/nextjs-14-pages-wrap/pages/api/arcjet-edge.ts @@ -0,0 +1,28 @@ +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction +import arcjet, { rateLimit, withArcjet } from "@arcjet/next"; +import { NextRequest, NextResponse } from "next/server"; + +export const config = { + runtime: "edge", +}; + +const aj = arcjet({ + // mark + key: "ajkey_yourkey", + rules: [ + rateLimit({ + mode: "LIVE", + // Limiting by ip.src is the default if not specified + //characteristics: ["ip.src"], + window: "1m", + max: 1, + timeout: "10m", + }), + ], +}); + +export default withArcjet(aj, async function handler(req: NextRequest) { + return NextResponse.json({ + message: "Hello world", + }); +}); diff --git a/examples/nextjs-14-pages-wrap/pages/api/arcjet.ts b/examples/nextjs-14-pages-wrap/pages/api/arcjet.ts new file mode 100644 index 000000000..1fa947026 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/pages/api/arcjet.ts @@ -0,0 +1,25 @@ +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction +import arcjet, { rateLimit, withArcjet } from "@arcjet/next"; +import type { NextApiRequest, NextApiResponse } from "next"; + +const aj = arcjet({ + // mark + key: "ajkey_yourkey", + rules: [ + rateLimit({ + mode: "LIVE", + // Limiting by ip.src is the default if not specified + //characteristics: ["ip.src"], + window: "1m", + max: 1, + timeout: "10m", + }), + ], +}); + +export default withArcjet( + aj, + async function handler(req: NextApiRequest, res: NextApiResponse) { + res.status(200).json({ name: "Hello world" }); + }, +); diff --git a/examples/nextjs-14-pages-wrap/pages/index.tsx b/examples/nextjs-14-pages-wrap/pages/index.tsx new file mode 100644 index 000000000..000a75138 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/pages/index.tsx @@ -0,0 +1,118 @@ +import Image from 'next/image' +import { Inter } from 'next/font/google' + +const inter = Inter({ subsets: ['latin'] }) + +export default function Home() { + return ( +
+
+

+ Get started by editing  + pages/index.tsx +

+ +
+ +
+ Next.js Logo +
+ + +
+ ) +} diff --git a/examples/nextjs-14-pages-wrap/postcss.config.js b/examples/nextjs-14-pages-wrap/postcss.config.js new file mode 100644 index 000000000..33ad091d2 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/examples/nextjs-14-pages-wrap/public/favicon.ico b/examples/nextjs-14-pages-wrap/public/favicon.ico new file mode 100644 index 000000000..718d6fea4 Binary files /dev/null and b/examples/nextjs-14-pages-wrap/public/favicon.ico differ diff --git a/examples/nextjs-14-pages-wrap/public/next.svg b/examples/nextjs-14-pages-wrap/public/next.svg new file mode 100644 index 000000000..5174b28c5 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/public/next.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/nextjs-14-pages-wrap/public/vercel.svg b/examples/nextjs-14-pages-wrap/public/vercel.svg new file mode 100644 index 000000000..d2f842227 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/public/vercel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/nextjs-14-pages-wrap/styles/globals.css b/examples/nextjs-14-pages-wrap/styles/globals.css new file mode 100644 index 000000000..fd81e8858 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/styles/globals.css @@ -0,0 +1,27 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +:root { + --foreground-rgb: 0, 0, 0; + --background-start-rgb: 214, 219, 220; + --background-end-rgb: 255, 255, 255; +} + +@media (prefers-color-scheme: dark) { + :root { + --foreground-rgb: 255, 255, 255; + --background-start-rgb: 0, 0, 0; + --background-end-rgb: 0, 0, 0; + } +} + +body { + color: rgb(var(--foreground-rgb)); + background: linear-gradient( + to bottom, + transparent, + rgb(var(--background-end-rgb)) + ) + rgb(var(--background-start-rgb)); +} diff --git a/examples/nextjs-14-pages-wrap/tailwind.config.ts b/examples/nextjs-14-pages-wrap/tailwind.config.ts new file mode 100644 index 000000000..c7ead8046 --- /dev/null +++ b/examples/nextjs-14-pages-wrap/tailwind.config.ts @@ -0,0 +1,20 @@ +import type { Config } from 'tailwindcss' + +const config: Config = { + content: [ + './pages/**/*.{js,ts,jsx,tsx,mdx}', + './components/**/*.{js,ts,jsx,tsx,mdx}', + './app/**/*.{js,ts,jsx,tsx,mdx}', + ], + theme: { + extend: { + backgroundImage: { + 'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))', + 'gradient-conic': + 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))', + }, + }, + }, + plugins: [], +} +export default config diff --git a/examples/nextjs-14-pages-wrap/tsconfig.json b/examples/nextjs-14-pages-wrap/tsconfig.json new file mode 100644 index 000000000..670224f3e --- /dev/null +++ b/examples/nextjs-14-pages-wrap/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "paths": { + "@/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} diff --git a/ip/package.json b/ip/package.json index c212a7cab..0ba0062be 100644 --- a/ip/package.json +++ b/ip/package.json @@ -1,6 +1,6 @@ { "name": "@arcjet/ip", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Arcjet utilities for finding the originating IP of a request", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "ip" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "type": "module", "main": "./index.js", @@ -33,9 +32,9 @@ }, "dependencies": {}, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", diff --git a/logger/package.json b/logger/package.json index 5c754a0a6..3355be63e 100644 --- a/logger/package.json +++ b/logger/package.json @@ -1,6 +1,6 @@ { "name": "@arcjet/logger", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Arcjet logging interface which mirrors the console interface but allows log levels", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "logger" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "type": "module", "main": "./index.js", @@ -33,9 +32,9 @@ }, "dependencies": {}, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", diff --git a/package-lock.json b/package-lock.json index da61eacda..4cb242671 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,21 +10,20 @@ "examples/*" ], "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" } }, "analyze": { "name": "@arcjet/analyze", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "dependencies": { - "@arcjet/logger": "1.0.0-alpha.3" + "@arcjet/logger": "1.0.0-alpha.4" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", @@ -32,22 +31,21 @@ "typescript": "5.3.3" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" } }, "arcjet": { - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "dependencies": { - "@arcjet/analyze": "1.0.0-alpha.3", - "@arcjet/logger": "1.0.0-alpha.3", - "@arcjet/protocol": "1.0.0-alpha.3" + "@arcjet/analyze": "1.0.0-alpha.4", + "@arcjet/logger": "1.0.0-alpha.4", + "@arcjet/protocol": "1.0.0-alpha.4" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@edge-runtime/jest-environment": "2.3.7", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", @@ -56,24 +54,23 @@ "typescript": "5.3.3" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" } }, "arcjet-next": { "name": "@arcjet/next", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "dependencies": { - "@arcjet/ip": "1.0.0-alpha.3", + "@arcjet/ip": "1.0.0-alpha.4", "@connectrpc/connect-web": "1.1.4", - "arcjet": "1.0.0-alpha.3", + "arcjet": "1.0.0-alpha.4", "next": "14.0.4" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", @@ -81,13 +78,12 @@ "typescript": "5.3.3" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" } }, "eslint-config": { "name": "@arcjet/eslint-config", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "dependencies": { "eslint-config-next": "14.0.4", @@ -100,8 +96,7 @@ "eslint": "8.55.0" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "peerDependencies": { "eslint": "^8" @@ -357,14 +352,43 @@ } } }, + "examples/nextjs-14-pages-wrap": { + "version": "0.1.0", + "dependencies": { + "@arcjet/next": "*", + "next": "14.0.4", + "react": "^18", + "react-dom": "^18" + }, + "devDependencies": { + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "autoprefixer": "^10.0.1", + "eslint": "^8", + "eslint-config-next": "14.0.4", + "postcss": "^8", + "tailwindcss": "^3.3.0", + "typescript": "^5" + } + }, + "examples/nextjs-14-pages-wrap/node_modules/@types/node": { + "version": "20.10.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.4.tgz", + "integrity": "sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, "ip": { "name": "@arcjet/ip", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", @@ -372,18 +396,17 @@ "typescript": "5.3.3" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" } }, "logger": { "name": "@arcjet/logger", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", @@ -391,8 +414,7 @@ "typescript": "5.3.3" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -6293,6 +6315,10 @@ "resolved": "examples/nextjs-14-app-dir-rl", "link": true }, + "node_modules/nextjs-14-pages-wrap": { + "resolved": "examples/nextjs-14-pages-wrap", + "link": true + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -8145,7 +8171,7 @@ }, "protocol": { "name": "@arcjet/protocol", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "dependencies": { "@bufbuild/protobuf": "1.6.0", @@ -8153,9 +8179,9 @@ "typeid-js": "0.3.0" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", @@ -8163,21 +8189,20 @@ "typescript": "5.3.3" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" } }, "rollup-config": { "name": "@arcjet/rollup-config", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "dependencies": { "@rollup/plugin-replace": "5.0.5", "@rollup/plugin-typescript": "11.1.5" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", @@ -8185,8 +8210,7 @@ "typescript": "5.3.3" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "peerDependencies": { "@rollup/wasm-node": "^4" @@ -8194,12 +8218,11 @@ }, "tsconfig": { "name": "@arcjet/tsconfig", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "license": "Apache-2.0", "devDependencies": {}, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "peerDependencies": { "typescript": "^5" diff --git a/package.json b/package.json index 1200a1859..21cbb078a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,7 @@ { "name": "arcjet-js", "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "workspaces": [ "*", diff --git a/protocol/package.json b/protocol/package.json index 9b02c235d..6c320c18f 100644 --- a/protocol/package.json +++ b/protocol/package.json @@ -1,6 +1,6 @@ { "name": "@arcjet/protocol", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "The TypeScript & JavaScript interface into the Arcjet protocol", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "protocol" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "type": "module", "main": "./index.js", @@ -38,9 +37,9 @@ "typeid-js": "0.3.0" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/rollup-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/rollup-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@rollup/wasm-node": "4.8.0", "@types/node": "18.18.0", diff --git a/rollup-config/package.json b/rollup-config/package.json index 6508a93c8..6b27f07db 100644 --- a/rollup-config/package.json +++ b/rollup-config/package.json @@ -1,6 +1,6 @@ { "name": "@arcjet/rollup-config", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Custom rollup config for Arcjet projects", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "rollup-config" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "type": "module", "main": "./index.js", @@ -36,8 +35,8 @@ "@rollup/wasm-node": "^4" }, "devDependencies": { - "@arcjet/eslint-config": "1.0.0-alpha.3", - "@arcjet/tsconfig": "1.0.0-alpha.3", + "@arcjet/eslint-config": "1.0.0-alpha.4", + "@arcjet/tsconfig": "1.0.0-alpha.4", "@jest/globals": "29.7.0", "@types/node": "18.18.0", "@rollup/wasm-node": "4.8.0", diff --git a/tsconfig/package.json b/tsconfig/package.json index c0762936c..41e18b517 100644 --- a/tsconfig/package.json +++ b/tsconfig/package.json @@ -1,6 +1,6 @@ { "name": "@arcjet/tsconfig", - "version": "1.0.0-alpha.3", + "version": "1.0.0-alpha.4", "description": "Custom tsconfig for Arcjet projects", "license": "Apache-2.0", "homepage": "https://arcjet.com", @@ -10,8 +10,7 @@ "directory": "tsconfig" }, "engines": { - "node": ">=18", - "npm": ">=10" + "node": ">=18" }, "files": [ "LICENSE",