intor 2.2.15 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -15
- package/dist/exports/next/proxy/index.d.ts +2 -0
- package/dist/exports/next/proxy/index.js +2 -0
- package/dist/src/adapters/next/{middleware → proxy}/index.d.ts +1 -1
- package/dist/src/adapters/next/{middleware/intor-middleware.d.ts → proxy/intor-proxy.d.ts} +1 -1
- package/dist/src/adapters/next/{middleware/intor-middleware.js → proxy/intor-proxy.js} +2 -2
- package/dist/src/adapters/next/{middleware → proxy}/utils/set-locale-cookie-edge.d.ts +1 -1
- package/dist/src/adapters/next/{middleware → proxy}/utils/set-locale-cookie-edge.js +1 -1
- package/dist/src/adapters/next/{middleware → proxy}/utils/set-pathname-header.d.ts +1 -1
- package/dist/src/adapters/next/{middleware → proxy}/utils/set-pathname-header.js +1 -1
- package/package.json +9 -3
- package/dist/exports/next/middleware/index.d.ts +0 -2
- package/dist/exports/next/middleware/index.js +0 -2
- /package/dist/src/adapters/next/{middleware → proxy}/handle-prefix/handle-prefix-all.d.ts +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/handle-prefix/handle-prefix-all.js +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/handle-prefix/handle-prefix-except-default.d.ts +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/handle-prefix/handle-prefix-except-default.js +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/handle-prefix/handle-prefix-none.d.ts +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/handle-prefix/handle-prefix-none.js +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/utils/create-response.d.ts +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/utils/create-response.js +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/utils/determine-initial-locale.d.ts +0 -0
- /package/dist/src/adapters/next/{middleware → proxy}/utils/determine-initial-locale.js +0 -0
package/README.md
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">Intor</h1>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
A lightweight, framework-agnostic i18n engine that works instantly with a clean, type-safe API.
|
|
6
|
+
Fast to start, easy to extend, and free from the usual i18n heaviness.
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
</div>
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
- ✅ Backend and frontend support
|
|
9
|
-
- ✅ Custom messages and adapters
|
|
10
|
-
- ✅ Caching, error handling, and logging
|
|
10
|
+
<div align="center">
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
[](https://www.npmjs.com/package/intor)
|
|
13
|
+
[](https://bundlephobia.com/package/intor)
|
|
14
|
+
[](https://www.typescriptlang.org/)
|
|
15
|
+
[](LICENSE)
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
npm install intor
|
|
16
|
-
```
|
|
17
|
+
</div>
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
<div align="center">
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
#### 🍳 Cooking the Intor v2 docs, crafting them to perfection...
|
|
22
|
+
|
|
23
|
+
</div>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { intorProxy } from "./intor-proxy";
|
|
2
2
|
export { PATHNAME_HEADER_NAME } from "../../../adapters/next/shared/constants/pathname-header-name";
|
|
@@ -3,4 +3,4 @@ import type { NextRequest } from "next/server";
|
|
|
3
3
|
/**
|
|
4
4
|
* Handle locale routing based on prefix config
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function intorProxy<Req extends NextRequest = NextRequest>(config: IntorResolvedConfig, request: Req): Promise<Response>;
|
|
@@ -5,7 +5,7 @@ import { handlePrefixNone } from './handle-prefix/handle-prefix-none.js';
|
|
|
5
5
|
/**
|
|
6
6
|
* Handle locale routing based on prefix config
|
|
7
7
|
*/
|
|
8
|
-
async function
|
|
8
|
+
async function intorProxy(config, request) {
|
|
9
9
|
const { prefix } = config.routing;
|
|
10
10
|
// ===== Prefix: none =====
|
|
11
11
|
if (prefix === "none") {
|
|
@@ -19,4 +19,4 @@ async function intorMiddleware(config, request) {
|
|
|
19
19
|
return await handlePrefixAll(config, request);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export { intorProxy };
|
|
@@ -9,7 +9,7 @@ interface SetLocaleCookieParams {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Set a locale cookie on the response.
|
|
12
|
-
* - For Next.js
|
|
12
|
+
* - For Next.js proxy.
|
|
13
13
|
*/
|
|
14
14
|
export declare function setLocaleCookieEdge({ request, response, cookie, locale, override, }: SetLocaleCookieParams): void;
|
|
15
15
|
export {};
|
|
@@ -6,7 +6,7 @@ interface SetPathnameHeaderOptions<Req extends NextRequest = NextRequest, Res ex
|
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Set the pathname in the response header.
|
|
9
|
-
* - For Next.js
|
|
9
|
+
* - For Next.js proxy.
|
|
10
10
|
*/
|
|
11
11
|
export declare const setPathnameHeader: <Req extends NextRequest = NextRequest, Res extends NextResponse = NextResponse>({ request, response, key, }: SetPathnameHeaderOptions<Req, Res>) => Response;
|
|
12
12
|
export {};
|
|
@@ -2,7 +2,7 @@ import { PATHNAME_HEADER_NAME } from '../../shared/constants/pathname-header-nam
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Set the pathname in the response header.
|
|
5
|
-
* - For Next.js
|
|
5
|
+
* - For Next.js proxy.
|
|
6
6
|
*/
|
|
7
7
|
const setPathnameHeader = ({ request, response, key = PATHNAME_HEADER_NAME, }) => {
|
|
8
8
|
const pathname = request.nextUrl.pathname;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A modular and extensible i18n core designed for TypeScript and JavaScript projects. Intor enables custom translation logic with support for both frontend and backend environments, featuring runtime configuration, caching, adapters, and message loaders.",
|
|
5
5
|
"author": "Yiming Liao",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,9 +45,13 @@
|
|
|
45
45
|
"types": "./dist/exports/next/index.d.ts",
|
|
46
46
|
"import": "./dist/exports/next/index.js"
|
|
47
47
|
},
|
|
48
|
+
"./next/proxy": {
|
|
49
|
+
"types": "./dist/exports/next/proxy/index.d.ts",
|
|
50
|
+
"import": "./dist/exports/next/proxy/index.js"
|
|
51
|
+
},
|
|
48
52
|
"./next/middleware": {
|
|
49
|
-
"types": "./dist/exports/next/
|
|
50
|
-
"import": "./dist/exports/next/
|
|
53
|
+
"types": "./dist/exports/next/proxy/index.d.ts",
|
|
54
|
+
"import": "./dist/exports/next/proxy/index.js"
|
|
51
55
|
},
|
|
52
56
|
"./next/server": {
|
|
53
57
|
"types": "./dist/exports/next/server/index.d.ts",
|
|
@@ -59,6 +63,8 @@
|
|
|
59
63
|
"README.md",
|
|
60
64
|
"LICENSE"
|
|
61
65
|
],
|
|
66
|
+
"main": "./dist/exports/index.js",
|
|
67
|
+
"module": "./dist/exports/index.js",
|
|
62
68
|
"type": "module",
|
|
63
69
|
"scripts": {
|
|
64
70
|
"type": "tsc --noEmit",
|
|
File without changes
|
|
File without changes
|
/package/dist/src/adapters/next/{middleware → proxy}/handle-prefix/handle-prefix-except-default.d.ts
RENAMED
|
File without changes
|
/package/dist/src/adapters/next/{middleware → proxy}/handle-prefix/handle-prefix-except-default.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|