next-intl 3.11.0-beta.1 → 3.11.0

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.
@@ -90,7 +90,9 @@ function getRoute(_ref3) {
90
90
  pathname,
91
91
  pathnames
92
92
  } = _ref3;
93
- const unlocalizedPathname = utils.unlocalizePathname(pathname, locale);
93
+ const unlocalizedPathname = utils.unlocalizePathname(
94
+ // Potentially handle foreign symbols
95
+ decodeURI(pathname), locale);
94
96
  let template = (_Object$entries$find = Object.entries(pathnames).find(_ref4 => {
95
97
  let [, routePath] = _ref4;
96
98
  const routePathname = typeof routePath !== 'string' ? routePath[locale] : routePath;
@@ -1 +1 @@
1
- import{unlocalizePathname as t,matchesPathname as n}from"../../shared/utils.js";function e(t){return"string"==typeof t?{pathname:t}:t}function r(t){function n(t){return String(t)}const e=new URLSearchParams;for(const[r,a]of Object.entries(t))Array.isArray(a)?a.forEach((t=>{e.append(r,n(t))})):e.set(r,n(a));return"?"+e.toString()}function a(t){let{pathname:n,locale:e,params:a,pathnames:o,query:i}=t;function c(t){let n=o[t];return n||(n=t),n}function s(t){const n="string"==typeof t?t:t[e];let o=n;if(a&&Object.entries(a).forEach((t=>{let[n,e]=t;o=Array.isArray(e)?o.replace(new RegExp("(\\[)?\\[...".concat(n,"\\](\\])?"),"g"),e.map((t=>String(t))).join("/")):o.replace("[".concat(n,"]"),String(e))})),o.includes("["))throw new Error("Insufficient params provided for localized pathname.\nTemplate: ".concat(n,"\nParams: ").concat(JSON.stringify(a)));return i&&(o+=r(i)),o}if("string"==typeof n){return s(c(n))}{const{pathname:t,...e}=n;return{...e,pathname:s(c(t))}}}function o(e){var r;let{locale:a,pathname:o,pathnames:i}=e;const c=t(o,a);let s=null===(r=Object.entries(i).find((t=>{let[,e]=t;const r="string"!=typeof e?e[a]:e;return n(r,c)})))||void 0===r?void 0:r[0];return s||(s=o),s}function i(t){return window.location.pathname.replace(t,"")}export{a as compileLocalizedPathname,i as getBasePath,o as getRoute,e as normalizeNameOrNameWithParams,r as serializeSearchParams};
1
+ import{unlocalizePathname as t,matchesPathname as n}from"../../shared/utils.js";function e(t){return"string"==typeof t?{pathname:t}:t}function r(t){function n(t){return String(t)}const e=new URLSearchParams;for(const[r,a]of Object.entries(t))Array.isArray(a)?a.forEach((t=>{e.append(r,n(t))})):e.set(r,n(a));return"?"+e.toString()}function a(t){let{pathname:n,locale:e,params:a,pathnames:o,query:c}=t;function i(t){let n=o[t];return n||(n=t),n}function s(t){const n="string"==typeof t?t:t[e];let o=n;if(a&&Object.entries(a).forEach((t=>{let[n,e]=t;o=Array.isArray(e)?o.replace(new RegExp("(\\[)?\\[...".concat(n,"\\](\\])?"),"g"),e.map((t=>String(t))).join("/")):o.replace("[".concat(n,"]"),String(e))})),o.includes("["))throw new Error("Insufficient params provided for localized pathname.\nTemplate: ".concat(n,"\nParams: ").concat(JSON.stringify(a)));return c&&(o+=r(c)),o}if("string"==typeof n){return s(i(n))}{const{pathname:t,...e}=n;return{...e,pathname:s(i(t))}}}function o(e){var r;let{locale:a,pathname:o,pathnames:c}=e;const i=t(decodeURI(o),a);let s=null===(r=Object.entries(c).find((t=>{let[,e]=t;const r="string"!=typeof e?e[a]:e;return n(r,i)})))||void 0===r?void 0:r[0];return s||(s=o),s}function c(t){return window.location.pathname.replace(t,"")}export{a as compileLocalizedPathname,c as getBasePath,o as getRoute,e as normalizeNameOrNameWithParams,r as serializeSearchParams};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../shared/utils.js");function t(e){function t(e){return String(e)}const r=new URLSearchParams;for(const[n,a]of Object.entries(e))Array.isArray(a)?a.forEach((e=>{r.append(n,t(e))})):r.set(n,t(a));return"?"+r.toString()}exports.compileLocalizedPathname=function(e){let{pathname:r,locale:n,params:a,pathnames:o,query:i}=e;function c(e){let t=o[e];return t||(t=e),t}function s(e){let r="string"==typeof e?e:e[n];return a&&Object.entries(a).forEach((e=>{let[t,n]=e;r=Array.isArray(n)?r.replace(new RegExp("(\\[)?\\[...".concat(t,"\\](\\])?"),"g"),n.map((e=>String(e))).join("/")):r.replace("[".concat(t,"]"),String(n))})),i&&(r+=t(i)),r}if("string"==typeof r){return s(c(r))}{const{pathname:e,...t}=r;return{...t,pathname:s(c(e))}}},exports.getBasePath=function(e){return window.location.pathname.replace(e,"")},exports.getRoute=function(t){var r;let{locale:n,pathname:a,pathnames:o}=t;const i=e.unlocalizePathname(a,n);let c=null===(r=Object.entries(o).find((t=>{let[,r]=t;const a="string"!=typeof r?r[n]:r;return e.matchesPathname(a,i)})))||void 0===r?void 0:r[0];return c||(c=a),c},exports.normalizeNameOrNameWithParams=function(e){return"string"==typeof e?{pathname:e}:e},exports.serializeSearchParams=t;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../shared/utils.js");function t(e){function t(e){return String(e)}const r=new URLSearchParams;for(const[n,a]of Object.entries(e))Array.isArray(a)?a.forEach((e=>{r.append(n,t(e))})):r.set(n,t(a));return"?"+r.toString()}exports.compileLocalizedPathname=function(e){let{pathname:r,locale:n,params:a,pathnames:o,query:i}=e;function c(e){let t=o[e];return t||(t=e),t}function s(e){let r="string"==typeof e?e:e[n];return a&&Object.entries(a).forEach((e=>{let[t,n]=e;r=Array.isArray(n)?r.replace(new RegExp("(\\[)?\\[...".concat(t,"\\](\\])?"),"g"),n.map((e=>String(e))).join("/")):r.replace("[".concat(t,"]"),String(n))})),i&&(r+=t(i)),r}if("string"==typeof r){return s(c(r))}{const{pathname:e,...t}=r;return{...t,pathname:s(c(e))}}},exports.getBasePath=function(e){return window.location.pathname.replace(e,"")},exports.getRoute=function(t){var r;let{locale:n,pathname:a,pathnames:o}=t;const i=e.unlocalizePathname(decodeURI(a),n);let c=null===(r=Object.entries(o).find((t=>{let[,r]=t;const a="string"!=typeof r?r[n]:r;return e.matchesPathname(a,i)})))||void 0===r?void 0:r[0];return c||(c=a),c},exports.normalizeNameOrNameWithParams=function(e){return"string"==typeof e?{pathname:e}:e},exports.serializeSearchParams=t;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-intl",
3
- "version": "3.11.0-beta.1",
3
+ "version": "3.11.0",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "funding": [
@@ -16,6 +16,16 @@
16
16
  "type": "git",
17
17
  "url": "https://github.com/amannn/next-intl"
18
18
  },
19
+ "scripts": {
20
+ "build": "rm -rf dist && rollup -c",
21
+ "test": "TZ=Europe/Berlin vitest",
22
+ "lint": "pnpm run lint:source && pnpm run lint:package",
23
+ "lint:source": "eslint src test && tsc --noEmit",
24
+ "lint:package": "publint && attw --pack",
25
+ "prepublishOnly": "CI=true turbo test && turbo lint && turbo build && cp ../../README.md .",
26
+ "postpublish": "git checkout . && rm ./README.md",
27
+ "size": "size-limit"
28
+ },
19
29
  "main": "./dist/index.react-client.js",
20
30
  "module": "./dist/esm/index.react-client.js",
21
31
  "typings": "./dist/types/src/index.react-client.d.ts",
@@ -72,7 +82,7 @@
72
82
  "dependencies": {
73
83
  "@formatjs/intl-localematcher": "^0.2.32",
74
84
  "negotiator": "^0.6.3",
75
- "use-intl": "^3.10.0"
85
+ "use-intl": "^3.11.0"
76
86
  },
77
87
  "peerDependencies": {
78
88
  "next": "^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0",
@@ -131,12 +141,5 @@
131
141
  "limit": "5.95 KB"
132
142
  }
133
143
  ],
134
- "scripts": {
135
- "build": "rm -rf dist && rollup -c",
136
- "test": "TZ=Europe/Berlin vitest",
137
- "lint": "pnpm run lint:source && pnpm run lint:package",
138
- "lint:source": "eslint src test && tsc --noEmit",
139
- "lint:package": "publint && attw --pack",
140
- "size": "size-limit"
141
- }
142
- }
144
+ "gitHead": "5db8a1d7acd8d60f241828f62dab3bcfbd411007"
145
+ }