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
2 changes: 1 addition & 1 deletion packages/assets/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# @routup/assets

[![npm version](https://badge.fury.io/js/@routup%2Fstatic.svg)](https://badge.fury.io/js/@routup%2Fstatic)
[![npm version](https://badge.fury.io/js/@routup%2Fassets.svg)](https://badge.fury.io/js/@routup%2Fassets)
[![main](https://github.com/Tada5hi/routup/actions/workflows/main.yml/badge.svg)](https://github.com/Tada5hi/routup/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/tada5hi/routup/branch/master/graph/badge.svg?token=CLIA667K6V)](https://codecov.io/gh/tada5hi/routup)
[![Known Vulnerabilities](https://snyk.io/test/github/Tada5hi/routup/badge.svg)](https://snyk.io/test/github/Tada5hi/routup)
Expand Down
2 changes: 1 addition & 1 deletion packages/assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/routup/plugins.git",
"directory": "packages/static"
"directory": "packages/assets"
},
"bugs": {
"url": "https://github.com/routup/plugins/issues"
Expand Down
2 changes: 1 addition & 1 deletion packages/assets/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,5 @@ export function createCoreHandler(directory: string, input: OptionsInput = {}) :
export function createHandler(directory: string, input: OptionsInput = {}) : Handler {
const fn = createCoreHandler(directory, input);

return defineCoreHandler((event) => fn(event));
return defineCoreHandler(fn);
}
3 changes: 3 additions & 0 deletions packages/body/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const OptionsSymbol = Symbol.for('ReqBodyOptions');
export const BodySymbol = Symbol.for('ReqBody');
export const RawBodySymbol = Symbol.for('ReqRawBody');
3 changes: 1 addition & 2 deletions packages/body/src/helpers/options.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { IRoutupEvent } from 'routup';
import { OptionsSymbol } from '../constants';
import type { Options } from '../types';

const OptionsSymbol = Symbol.for('ReqBodyOptions');

export function setBodyOptions(event: IRoutupEvent, options: Options): void {
event.store[OptionsSymbol] = options;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/body/src/helpers/read-raw.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { IRoutupEvent } from 'routup';
import { createError } from 'routup';
import { RawBodySymbol } from '../constants';
import type { BaseOptions } from '../types';
import { parseSize } from '../utils';
import { readRequestBodyStream } from './read-stream';

const RawBodySymbol = Symbol.for('ReqRawBody');

/**
* Reads the full request body as a `Uint8Array`.
*
Expand Down
3 changes: 1 addition & 2 deletions packages/body/src/helpers/read.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { IRoutupEvent } from 'routup';
import { BodySymbol } from '../constants';
import { boolToObject } from '../utils';
import { getBodyOptions } from './options';
import { parseJsonBody } from './parse-json';
import { parseUrlEncodedBody } from './parse-url-encoded';

const BodySymbol = Symbol.for('ReqBody');

/**
* Returns the parsed request body (JSON or URL-encoded).
*
Expand Down
1 change: 0 additions & 1 deletion packages/cookie/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
cookie,
} from './module';

export * from './handler';
export * from './module';
export * from './request';
export * from './response';
Expand Down
3 changes: 0 additions & 3 deletions packages/i18n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ const server = createServer(createNodeDispatcher(router));
server.listen(3000);
```

## Types


## Helpers

### `useTranslator`
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"homepage": "https://github.com/routup/plugins#readme",
"peerDependencies": {
"ilingo": "^3.2.0",
"ilingo": "^5.0.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

ilingo npm package version 5.0.0 breaking changes migration guide

💡 Result:

ilingo v5.0.0 (released 2026-01-14) — breaking changes + migration

Breaking changes

  1. ESM-only: ilingo no longer supports CommonJS (require(...)). Your project/build must consume it as ESM. [1]
  2. Type/interface rename: the Store interface was renamed to IStore. Update any imports/annotations/implements accordingly. [1]

Migration checklist (from 4.4.x → 5.0.0)

  • Update imports to ESM

    • ✅ ESM:
      import { Ilingo } from "ilingo";
    • ❌ CommonJS (won’t work in v5):
      const { Ilingo } = require("ilingo");
    • If your app is still CommonJS, you’ll need to migrate the app to ESM (or use an ESM-capable bundler/runtime strategy) because the package is ESM-only. [1]
  • Rename StoreIStore everywhere

    • Example:
      // before
      import type { Store } from "ilingo";
      
      // after
      import type { IStore } from "ilingo";
    • If you had custom stores implementing Store, change them to implement IStore. [1]

Notes:

  • The same release set also moved @ilingo/vue to ESM-only and renamed StoreIStore there as well. [1]

Source(s)
[1] GitHub Releases (tada5hi/ilingo) – entries for ilingo: v5.0.0 and related packages, including the “⚠ BREAKING CHANGES” section. (github.com)

Citations:


🏁 Script executed:

#!/bin/bash
# Description: Identify ilingo API usage patterns in the i18n package to assess compatibility risk

# Search for ilingo imports and usage patterns
echo "=== Ilingo imports ==="
rg -n "from ['\"]ilingo['\"]" packages/i18n/src/

echo -e "\n=== Ilingo API usage patterns ==="
# Look for common ilingo API methods that may have changed
rg -n -C3 "\b(translate|t|locale|language|setLocale|getLocale|addTranslation|loadTranslation)\(" packages/i18n/src/

echo -e "\n=== Check for any ilingo type imports ==="
rg -n "import.*ilingo.*type" packages/i18n/src/

Repository: routup/plugins

Length of output: 1397


🏁 Script executed:

#!/bin/bash
# Description: Check if migration documentation exists for this breaking change

# Check CHANGELOG for ilingo v5 migration notes
echo "=== Checking CHANGELOG ==="
fd -t f "CHANGELOG" packages/i18n/ --exec cat {}

# Check README for migration notes
echo -e "\n=== Checking README ==="
fd -t f "README" packages/i18n/ --exec cat {}

# Check for any migration guide files
echo -e "\n=== Looking for migration guides ==="
fd -t f -e md . packages/i18n/ --exec basename {}

Repository: routup/plugins

Length of output: 4165


🏁 Script executed:

# Read types.ts to see what's imported from ilingo
cat -n packages/i18n/src/types.ts

Repository: routup/plugins

Length of output: 526


🏁 Script executed:

# Search for Store type usage in the entire packages/i18n/src directory
rg -n "Store" packages/i18n/src/

Repository: routup/plugins

Length of output: 40


🏁 Script executed:

# Check the module.ts file more thoroughly to understand store usage
cat -n packages/i18n/src/module.ts | head -100

Repository: routup/plugins

Length of output: 2654


🏁 Script executed:

# List all TypeScript source files in packages/i18n/src
find packages/i18n/src -type f -name "*.ts" -o -name "*.tsx" | sort

Repository: routup/plugins

Length of output: 206


🏁 Script executed:

# Check for any imports of Store type across the entire packages/i18n directory
rg -n "import.*Store" packages/i18n/

Repository: routup/plugins

Length of output: 201


Document the ilingo v5.0.0 upgrade in the CHANGELOG.

The bump from ^3.2.0 to ^5.0.0 is a major version jump that introduces breaking changes in ilingo (ESM-only requirement and Store→IStore rename). While the @routup/i18n package source code is compatible with ilingo v5, downstream consumers should be notified about this dependency upgrade. Add a CHANGELOG entry documenting this breaking change for consumers who use ilingo v3 directly or have transitive dependencies on it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/i18n/package.json` at line 50, Add a CHANGELOG entry documenting the
dependency bump of "ilingo" to ^5.0.0: note this is a major, breaking change
(ESM-only requirement and the API rename Store → IStore), state that
`@routup/i18n` itself is compatible but downstream consumers who depend on ilingo
v3 or use transitive v3 should be warned, and include migration guidance (update
imports to ESM and rename Store to IStore) and the package.json change
("ilingo": "^5.0.0") as the trigger for the entry.

"routup": "^5.0.0-beta.3"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/prometheus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@routup/prometheus",
"version": "2.4.2",
"type": "module",
"description": "Routup rate limiter.",
"description": "Prometheus metrics plugin for routup.",
"exports": {
"./package.json": "./package.json",
".": {
Expand Down
11 changes: 0 additions & 11 deletions packages/query/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import {
parse,
stringify,
} from 'qs';

import {
query,
} from './module';

export * from './handler';
export * from './module';
export * from './request';
export * from './type';

export {
stringify,
parse,
};

export default query;
3 changes: 2 additions & 1 deletion packages/query/test/unit/module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
Router,
defineCoreHandler,
} from 'routup';
import { query, stringify, useRequestQuery } from '../../src';
import { stringify } from 'qs';
import { query, useRequestQuery } from '../../src';

function createTestRequest(url: string, options?: RequestInit): Request {
const fullUrl = url.startsWith('http') ? url : `http://localhost${url}`;
Expand Down
4 changes: 3 additions & 1 deletion packages/rate-limit-redis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@routup/rate-limit-redis",
"version": "3.1.2",
"type": "module",
"description": "Red adapter for the routup rate-limit plugin.",
"description": "Redis adapter for the routup rate-limit plugin.",
"exports": {
"./package.json": "./package.json",
".": {
Expand All @@ -18,6 +18,8 @@
"build": "npm run build:js && npm run build:types",
"build:js": "rimraf ./dist && tsdown",
"build:types": "tsc --noEmit -p tsconfig.build.json",
"test": "vitest run --config ./test/vitest.config.ts",
"test:coverage": "vitest run --config ./test/vitest.config.ts --coverage",
Comment on lines +21 to +22
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify the vitest config file exists and check vitest version in package files

# Check if the vitest config file exists
fd -t f "vitest.config.ts" packages/rate-limit-redis/test/

# Check vitest version in package.json files
rg -g "package*.json" '"vitest":\s*"[^"]+"' packages/rate-limit-redis/

Repository: routup/plugins

Length of output: 105


🏁 Script executed:

cat -n packages/rate-limit-redis/package.json | head -40

Repository: routup/plugins

Length of output: 1480


🏁 Script executed:

cat -n packages/rate-limit-redis/package.json | tail -30

Repository: routup/plugins

Length of output: 1081


Add vitest to devDependencies.

The test scripts reference vitest as a command, but the package is not declared in devDependencies. Add vitest with an appropriate version to the devDependencies section so the test scripts can execute.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/rate-limit-redis/package.json` around lines 21 - 22, The
package.json scripts "test" and "test:coverage" invoke the vitest CLI but vitest
is not declared in devDependencies; add "vitest" (choose a current compatible
semver, e.g. "^1.0.0" or your repo's standard version) to the devDependencies
object in packages/rate-limit-redis/package.json so the scripts can run, then
run npm/yarn/pnpm install to update lockfiles; ensure the version aligns with
other workspace packages to avoid mismatches.

"lint": "eslint ./src",
"lint:fix": "npm run lint -- --fix"
},
Expand Down
10 changes: 6 additions & 4 deletions packages/rate-limit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ Defaults to `5`. Set it to `0` to disable the rate limiter.
An example of using a function:

```ts
const isPremium = async (user) => {
const isPremium = async (ip: string) => {
// ...
}

const handler = createHandler({
// ...
max: async (event) => {
if (await isPremium(event.request.user)) return 10
const ip = getRequestIP(event, { trustProxy: true }) || '127.0.0.1';
if (await isPremium(ip)) return 10
else return 5
},
})
Expand All @@ -121,14 +122,15 @@ Defaults to `'Too many requests, please try again later.'`
An example of using a function:

```ts
const isPremium = async (user) => {
const isPremium = async (ip: string) => {
// ...
}

const handler = createHandler({
// ...
message: async (event) => {
if (await isPremium(event.request.user)) {
const ip = getRequestIP(event, { trustProxy: true }) || '127.0.0.1';
if (await isPremium(ip)) {
return 'You can only make 10 requests every hour.'
}

Expand Down
6 changes: 3 additions & 3 deletions packages/rate-limit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/Tada5hi/routup.git",
"url": "git+https://github.com/routup/plugins.git",
"directory": "packages/rate-limit"
},
"bugs": {
"url": "https://github.com/Tada5hi/routup/issues"
"url": "https://github.com/routup/plugins/issues"
},
"homepage": "https://github.com/Tada5hi/routup#readme",
"homepage": "https://github.com/routup/plugins#readme",
"peerDependencies": {
"routup": "^5.0.0-beta.3"
},
Expand Down
16 changes: 8 additions & 8 deletions packages/rate-limit/src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import type { IRoutupEvent } from 'routup';
import type { RateLimitInfo } from './type';
import { isObject } from './utils';

const symbol = Symbol.for('ReqRateLimit');
const RateLimitSymbol = Symbol.for('ReqRateLimit');

export function useRequestRateLimitInfo(event: IRoutupEvent) : Partial<RateLimitInfo>;
export function useRequestRateLimitInfo<K extends keyof RateLimitInfo>(event: IRoutupEvent, key: K) : RateLimitInfo[K] | undefined;
export function useRequestRateLimitInfo(event: IRoutupEvent, key?: string) {
if (symbol in event.store) {
if (RateLimitSymbol in event.store) {
if (typeof key === 'string') {
return (event.store[symbol] as Record<string, unknown>)[key];
return (event.store[RateLimitSymbol] as Record<string, unknown>)[key];
}

return event.store[symbol];
return event.store[RateLimitSymbol];
}

return {};
Expand All @@ -25,15 +25,15 @@ export function setRequestRateLimitInfo<K extends keyof RateLimitInfo>(
) : void;
export function setRequestRateLimitInfo(event: IRoutupEvent, record: RateLimitInfo) : void;
export function setRequestRateLimitInfo(event: IRoutupEvent, key: RateLimitInfo | string, value?: unknown) : void {
const existing = symbol in event.store ?
event.store[symbol] as Record<string, unknown> :
const existing = RateLimitSymbol in event.store ?
event.store[RateLimitSymbol] as Record<string, unknown> :
undefined;

if (isObject(key)) {
event.store[symbol] = existing ? { ...existing, ...key } : key;
event.store[RateLimitSymbol] = existing ? { ...existing, ...key } : key;
} else if (existing) {
existing[key] = value;
} else {
event.store[symbol] = { [key]: value };
event.store[RateLimitSymbol] = { [key]: value };
}
}
4 changes: 2 additions & 2 deletions packages/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Generate a swagger document for the API endpoints.
**`V2`**

```typescript
import { generate, Version } from '@routup/swager';
import { generate, Version } from '@routup/swagger';
import process from 'node:process';

await generate({
Expand All @@ -61,7 +61,7 @@ The function call will save the file under the location: `./writable/swagger.jso
**`V3`**

```typescript
import { generate, Version } from '@routup/swager';
import { generate, Version } from '@routup/swagger';
import process from 'node:process';

await generate({
Expand Down
2 changes: 1 addition & 1 deletion packages/swagger/src/ui/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ export function createUIHandler(
},
);

return defineCoreHandler((event) => handler(event));
return defineCoreHandler(handler);
}
Loading