@i18n-micro/route-strategy 1.1.7 → 1.1.8
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 +9 -9
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +40 -40
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ The generator supports the same strategies as the runtime:
|
|
|
44
44
|
- **`no_prefix`**
|
|
45
45
|
- URLs have **no locale prefix** (`/about`, `/kontakt`).
|
|
46
46
|
- Locale is handled via cookies / runtime logic, not via path.
|
|
47
|
-
- `globalLocaleRoutes` are used to generate per‑locale variants where appropriate, but the
|
|
47
|
+
- `globalLocaleRoutes` are used to generate per‑locale variants where appropriate, but the _visible_ URLs stay prefix‑less.
|
|
48
48
|
|
|
49
49
|
- **`prefix`**
|
|
50
50
|
- All localized routes are prefixed: `/en/about`, `/de/ueber-uns`, etc.
|
|
@@ -69,13 +69,13 @@ import type { NuxtPage } from '@nuxt/schema'
|
|
|
69
69
|
import { RouteGenerator } from '@i18n-micro/route-strategy'
|
|
70
70
|
|
|
71
71
|
const generator = new RouteGenerator({
|
|
72
|
-
locales,
|
|
73
|
-
defaultLocaleCode,
|
|
74
|
-
strategy,
|
|
75
|
-
globalLocaleRoutes,
|
|
76
|
-
filesLocaleRoutes,
|
|
77
|
-
routeLocales,
|
|
78
|
-
noPrefixRedirect,
|
|
72
|
+
locales, // Array<{ code, iso, name, baseUrl?, baseDefault? }>
|
|
73
|
+
defaultLocaleCode, // e.g. 'en'
|
|
74
|
+
strategy, // 'no_prefix' | 'prefix' | 'prefix_except_default' | 'prefix_and_default'
|
|
75
|
+
globalLocaleRoutes, // Optional: per‑path custom routes per locale
|
|
76
|
+
filesLocaleRoutes, // Optional: per‑file routes extracted at build time
|
|
77
|
+
routeLocales, // Optional: per‑route locale restrictions
|
|
78
|
+
noPrefixRedirect, // Optional: behavior for redirect helpers in no_prefix
|
|
79
79
|
})
|
|
80
80
|
|
|
81
81
|
const pages: NuxtPage[] = [
|
|
@@ -90,7 +90,7 @@ generator.extendPages(pages)
|
|
|
90
90
|
Key config fields:
|
|
91
91
|
|
|
92
92
|
- **`globalLocaleRoutes`**:
|
|
93
|
-
- Map from
|
|
93
|
+
- Map from _canonical path_ or _route name_ to per‑locale paths:
|
|
94
94
|
- Example:
|
|
95
95
|
```ts
|
|
96
96
|
const globalLocaleRoutes = {
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { buildRouteName, buildRouteNameFromRoute, cloneArray, isInternalPath, isLocaleDefault, isPageRedirectOnly, shouldAddLocalePrefix, } from './common';
|
|
2
2
|
export { type ResolvedLocales, resolveLocales } from './locales';
|
|
3
|
-
export { buildFullPath, buildFullPathNoPrefix, joinPath, normalizePath, normalizeRouteKey, removeLeadingSlash
|
|
3
|
+
export { buildFullPath, buildFullPathNoPrefix, joinPath, normalizePath, normalizeRouteKey, removeLeadingSlash } from './path';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { buildRouteName, buildRouteNameFromRoute, cloneArray, isInternalPath, isLocaleDefault, isPageRedirectOnly, shouldAddLocalePrefix, } from './common';
|
|
2
2
|
export { type ResolvedLocales, resolveLocales } from './locales';
|
|
3
|
-
export { buildFullPath, buildFullPathNoPrefix, joinPath, normalizePath, normalizeRouteKey, removeLeadingSlash
|
|
3
|
+
export { buildFullPath, buildFullPathNoPrefix, joinPath, normalizePath, normalizeRouteKey, removeLeadingSlash } from './path';
|
package/package.json
CHANGED
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i18n-micro/route-strategy",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Locale-aware route generator for Nuxt i18n micro",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"i18n",
|
|
7
|
+
"internationalization",
|
|
8
|
+
"locale",
|
|
9
|
+
"nuxt",
|
|
10
|
+
"route-generator",
|
|
11
|
+
"routes"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/s00d/nuxt-i18n-micro/tree/main/packages/route-strategy#readme",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/s00d/nuxt-i18n-micro/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": {
|
|
19
|
+
"name": "s00d",
|
|
20
|
+
"email": "Virus191288@gmail.com",
|
|
21
|
+
"url": "https://s00d.github.io/"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/s00d/nuxt-i18n-micro.git",
|
|
26
|
+
"directory": "packages/route-strategy"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
5
33
|
"type": "module",
|
|
34
|
+
"sideEffects": false,
|
|
6
35
|
"main": "dist/index.cjs",
|
|
7
36
|
"types": "dist/index.d.ts",
|
|
37
|
+
"typesVersions": {
|
|
38
|
+
"*": {
|
|
39
|
+
".": [
|
|
40
|
+
"./dist/index.d.ts"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
8
44
|
"exports": {
|
|
9
45
|
".": {
|
|
10
46
|
"import": {
|
|
@@ -18,55 +54,19 @@
|
|
|
18
54
|
"default": "./dist/index.mjs"
|
|
19
55
|
}
|
|
20
56
|
},
|
|
21
|
-
"typesVersions": {
|
|
22
|
-
"*": {
|
|
23
|
-
".": [
|
|
24
|
-
"./dist/index.d.ts"
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist",
|
|
30
|
-
"LICENSE",
|
|
31
|
-
"README.md"
|
|
32
|
-
],
|
|
33
|
-
"keywords": [
|
|
34
|
-
"i18n",
|
|
35
|
-
"nuxt",
|
|
36
|
-
"routes",
|
|
37
|
-
"locale",
|
|
38
|
-
"route-generator",
|
|
39
|
-
"internationalization"
|
|
40
|
-
],
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "git+https://github.com/s00d/nuxt-i18n-micro.git",
|
|
44
|
-
"directory": "packages/route-strategy"
|
|
45
|
-
},
|
|
46
|
-
"homepage": "https://github.com/s00d/nuxt-i18n-micro/tree/main/packages/route-strategy#readme",
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/s00d/nuxt-i18n-micro/issues"
|
|
49
|
-
},
|
|
50
|
-
"license": "MIT",
|
|
51
|
-
"author": {
|
|
52
|
-
"name": "s00d",
|
|
53
|
-
"email": "Virus191288@gmail.com",
|
|
54
|
-
"url": "https://s00d.github.io/"
|
|
55
|
-
},
|
|
56
57
|
"publishConfig": {
|
|
57
58
|
"access": "public"
|
|
58
59
|
},
|
|
59
|
-
"sideEffects": false,
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@nuxt/schema": "^3.18.1 || ^4.0.0",
|
|
62
|
-
"@i18n-micro/
|
|
63
|
-
"@i18n-micro/
|
|
62
|
+
"@i18n-micro/core": "1.3.2",
|
|
63
|
+
"@i18n-micro/types": "1.2.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/jest": "^29.5.14",
|
|
67
67
|
"jest": "^29.7.0",
|
|
68
|
-
"ts-jest": "^29.4.6",
|
|
69
68
|
"publint": "^0.3.17",
|
|
69
|
+
"ts-jest": "^29.4.6",
|
|
70
70
|
"vite": "^7.3.1",
|
|
71
71
|
"vite-plugin-dts": "^4.5.4",
|
|
72
72
|
"vitest": "^3.2.4"
|