Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into canary
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Jul 12, 2024
2 parents cba448a + 62da0d0 commit 0c670b2
Show file tree
Hide file tree
Showing 48 changed files with 1,734 additions and 721 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 3.17.0 (2024-07-12)

### Features

* Cache `Intl.*` constructors ([#1193](https://github.com/amannn/next-intl/issues/1193)) ([52c4f2c](https://github.com/amannn/next-intl/commit/52c4f2cede844c0ff3d2f73890dcfd75210bc1f2)), closes [#215](https://github.com/amannn/next-intl/issues/215) – by @amannn

## 3.16.0 (2024-07-11)

### Features
Expand Down
3 changes: 2 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"start": "next start"
},
"dependencies": {
"@docsearch/css": "^3.6.0",
"@docsearch/react": "^3.6.0",
"@heroicons/react": "^2.1.4",
"@vercel/analytics": "1.3.1",
Expand All @@ -31,7 +32,7 @@
"eslint-config-molindo": "^7.0.0",
"eslint-config-next": "^14.2.4",
"next-sitemap": "^4.2.3",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
},
"prettier": "../.prettierrc.json"
}
2 changes: 1 addition & 1 deletion examples/example-app-router-migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"eslint": "^8.56.0",
"eslint-config-molindo": "^7.0.0",
"eslint-config-next": "^14.2.4",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/example-app-router-mixed-routing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"eslint-config-molindo": "^7.0.0",
"eslint-config-next": "^14.2.4",
"postcss": "^8.4.38",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/example-app-router-next-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"eslint": "^8.56.0",
"eslint-config-molindo": "^7.0.0",
"eslint-config-next": "^14.2.4",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/example-app-router-playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"sharp": "^0.33.4",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/example-app-router-single-locale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"eslint": "^8.56.0",
"eslint-config-molindo": "^7.0.0",
"eslint-config-next": "^14.2.4",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
"eslint-config-next": "^14.2.4",
"postcss": "^8.4.38",
"tailwindcss": "^3.4.4",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/example-app-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"postcss": "^8.4.38",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/example-pages-router-advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"eslint-config-next": "^14.2.4",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/example-pages-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"eslint": "^8.56.0",
"eslint-config-molindo": "^7.0.0",
"eslint-config-next": "^14.2.4",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
}
}
2 changes: 1 addition & 1 deletion examples/example-remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/react-dom": "^18.3.0",
"eslint": "^8.56.0",
"eslint-config-molindo": "^7.0.0",
"typescript": "^5.1.6"
"typescript": "^5.5.3"
},
"engines": {
"node": ">=20.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/example-use-intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^8.56.0",
"eslint-config-molindo": "^7.0.0",
"typescript": "^5.4.5",
"typescript": "^5.5.3",
"vite": "^5.3.1"
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
"version": "3.16.0",
"version": "3.17.0",
"packages": [
"packages/*"
],
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
"@lerna-lite/cli": "^3.5.1",
"@lerna-lite/publish": "^3.5.2",
"@lerna-lite/cli": "^3.7.0",
"@lerna-lite/publish": "^3.7.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-node-resolve": "^15.2.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/next-intl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 3.17.0 (2024-07-12)

### Features

* Cache `Intl.*` constructors ([#1193](https://github.com/amannn/next-intl/issues/1193)) ([52c4f2c](https://github.com/amannn/next-intl/commit/52c4f2cede844c0ff3d2f73890dcfd75210bc1f2)), closes [#215](https://github.com/amannn/next-intl/issues/215) – by @amannn

## 3.16.0 (2024-07-11)

### Features
Expand Down
14 changes: 7 additions & 7 deletions packages/next-intl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-intl",
"version": "3.16.0",
"version": "3.17.0",
"sideEffects": false,
"author": "Jan Amann <jan@amann.work>",
"funding": [
Expand Down Expand Up @@ -113,34 +113,34 @@
"rollup": "^4.18.0",
"rollup-plugin-preserve-directives": "0.4.0",
"size-limit": "^8.2.6",
"typescript": "^5.4.5",
"vitest": "^1.6.0"
"typescript": "^5.5.3",
"vitest": "^2.0.2"
},
"prettier": "../../.prettierrc.json",
"size-limit": [
{
"path": "dist/production/index.react-client.js",
"limit": "15.785 KB"
"limit": "16.055 KB"
},
{
"path": "dist/production/index.react-server.js",
"limit": "16.66 KB"
"limit": "16.875 KB"
},
{
"path": "dist/production/navigation.react-client.js",
"limit": "3.465 KB"
},
{
"path": "dist/production/navigation.react-server.js",
"limit": "18.075 KB"
"limit": "18.325 KB"
},
{
"path": "dist/production/server.react-client.js",
"limit": "1 KB"
},
{
"path": "dist/production/server.react-server.js",
"limit": "15.84 KB"
"limit": "16.025 KB"
},
{
"path": "dist/production/middleware.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/next-intl/src/middleware/middleware.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ function createMockRequest(
}

const MockedNextResponse = NextResponse as unknown as {
next: Mock<Parameters<(typeof NextResponse)['next']>>;
rewrite: Mock<Parameters<(typeof NextResponse)['rewrite']>>;
redirect: Mock<Parameters<(typeof NextResponse)['redirect']>>;
next: Mock<(typeof NextResponse)['next']>;
rewrite: Mock<(typeof NextResponse)['rewrite']>;
redirect: Mock<(typeof NextResponse)['redirect']>;
};

function withBasePath(request: NextRequest, basePath = '/base') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ beforeEach(() => {
vi.mocked(useNextPathname).mockImplementation(() => '/');

vi.mocked(getRequestLocale).mockImplementation(() => 'en');
vi.mocked(useParams).mockImplementation(() => ({locale: 'en'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'en'}));
});

const locales = ['en', 'de', 'ja'] as const;
Expand Down Expand Up @@ -202,7 +202,9 @@ describe.each([
});

it('can redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de-at'}));
vi.mocked(useParams<any>).mockImplementation(() => ({
locale: 'de-at'
}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de-at');
vi.mocked(useNextPathname).mockImplementation(() => '/');

Expand Down Expand Up @@ -361,7 +363,7 @@ describe.each([
});

it('can redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'de'}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de');
vi.mocked(useNextPathname).mockImplementation(() => '/');

Expand Down Expand Up @@ -457,7 +459,7 @@ describe.each([
});

it('can permanently redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'de'}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de');
vi.mocked(useNextPathname).mockImplementation(() => '/');

Expand Down Expand Up @@ -605,7 +607,7 @@ describe.each([
});

it('can redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'de'}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de');
vi.mocked(useNextPathname).mockImplementation(() => '/');

Expand Down Expand Up @@ -692,7 +694,7 @@ describe.each([
});

it('can permanently redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'de'}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de');
vi.mocked(useNextPathname).mockImplementation(() => '/');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ vi.mock('../../src/server/react-server/RequestLocale', () => ({

beforeEach(() => {
vi.mocked(getRequestLocale).mockImplementation(() => 'en');
vi.mocked(useParams).mockImplementation(() => ({locale: 'en'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'en'}));
});

const locales = ['en', 'de'] as const;
Expand Down Expand Up @@ -174,7 +174,9 @@ describe.each([
});

it('can redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'en-gb'}));
vi.mocked(useParams<any>).mockImplementation(() => ({
locale: 'en-gb'
}));
vi.mocked(getRequestLocale).mockImplementation(() => 'en-gb');
vi.mocked(useNextPathname).mockImplementation(() => '/');

Expand Down Expand Up @@ -235,7 +237,7 @@ describe.each([
});

it('can redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'de'}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de');

vi.mocked(useNextPathname).mockImplementation(() => '/');
Expand Down Expand Up @@ -290,7 +292,7 @@ describe.each([
});

it('can permanently redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'de'}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de');

vi.mocked(useNextPathname).mockImplementation(() => '/');
Expand Down Expand Up @@ -350,7 +352,9 @@ describe.each([
}

it('can redirect for a locale with a custom prefix', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'en-gb'}));
vi.mocked(useParams<any>).mockImplementation(() => ({
locale: 'en-gb'
}));
vi.mocked(getRequestLocale).mockImplementation(() => 'en-gb');

vi.mocked(useNextPathname).mockImplementation(() => '/');
Expand All @@ -369,7 +373,9 @@ describe.each([
}

it('can permanently redirect for a locale with a custom prefix', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'en-gb'}));
vi.mocked(useParams<any>).mockImplementation(() => ({
locale: 'en-gb'
}));
vi.mocked(getRequestLocale).mockImplementation(() => 'en-gb');

vi.mocked(useNextPathname).mockImplementation(() => '/');
Expand Down Expand Up @@ -424,7 +430,7 @@ describe.each([
});

it('can redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'de'}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de');

vi.mocked(useNextPathname).mockImplementation(() => '/');
Expand Down Expand Up @@ -460,7 +466,7 @@ describe.each([
});

it('can permanently redirect for a non-default locale', () => {
vi.mocked(useParams).mockImplementation(() => ({locale: 'de'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'de'}));
vi.mocked(getRequestLocale).mockImplementation(() => 'de');

vi.mocked(useNextPathname).mockImplementation(() => '/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const MockClientLink = forwardRef(
describe('unprefixed routing', () => {
beforeEach(() => {
vi.mocked(usePathname).mockImplementation(() => '/');
vi.mocked(useParams).mockImplementation(() => ({locale: 'en'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'en'}));
});

it('renders an href without a locale if the locale matches', () => {
Expand Down Expand Up @@ -189,7 +189,7 @@ describe('unprefixed routing', () => {
describe('prefixed routing', () => {
beforeEach(() => {
vi.mocked(usePathname).mockImplementation(() => '/en');
vi.mocked(useParams).mockImplementation(() => ({locale: 'en'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'en'}));
});

it('renders an href with a locale if the locale matches', () => {
Expand Down Expand Up @@ -279,7 +279,7 @@ describe('prefixed routing', () => {

describe('usage outside of Next.js', () => {
beforeEach(() => {
vi.mocked(useParams).mockImplementation((() => null) as any);
vi.mocked(useParams<any>).mockImplementation((() => null) as any);
});

it('works with a provider', () => {
Expand All @@ -303,7 +303,7 @@ describe('usage outside of Next.js', () => {
describe('cookie sync', () => {
beforeEach(() => {
vi.mocked(usePathname).mockImplementation(() => '/en');
vi.mocked(useParams).mockImplementation(() => ({locale: 'en'}));
vi.mocked(useParams<any>).mockImplementation(() => ({locale: 'en'}));

mockLocation('/');

Expand Down
Loading

0 comments on commit 0c670b2

Please sign in to comment.