Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vitest #2039

Draft
wants to merge 26 commits into
base: next
Choose a base branch
from
Draft

Vitest #2039

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a06ab04
migrate to vitest part 1
timofei-iatsenko Sep 24, 2024
e23c36f
add packages
timofei-iatsenko Sep 24, 2024
ed066cd
fix missing methods
timofei-iatsenko Sep 24, 2024
2861fe8
first batch of changed tests
timofei-iatsenko Sep 24, 2024
a74d104
secong batch
timofei-iatsenko Sep 24, 2024
d236b87
wip
timofei-iatsenko Sep 25, 2024
e161ee7
wip
timofei-iatsenko Sep 25, 2024
4dffd13
wip: commonjs plugin for vite
timofei-iatsenko Oct 4, 2024
14fa4d7
Merge pull request #1871 from lingui/next
andrii-bodnar Nov 28, 2024
ef15eae
docs: update v5 social card (#2100)
andrii-bodnar Nov 28, 2024
8a25556
docs: add v4 documentation link (#2107)
andrii-bodnar Dec 5, 2024
38a0c6f
feat(vite-plugin): add support for vite@6 (#2108)
monholm Dec 5, 2024
e4875c5
ci: fix size testing failing (#2112)
andrii-bodnar Dec 6, 2024
e93b73d
feat(react): add support for React 19 (#2111)
andrii-bodnar Dec 6, 2024
36d6252
chore(release): published v5.1.0 [skip ci]
lingui-bot Dec 6, 2024
9ffef77
build(deps): fix peerDependencies (#2115)
andrii-bodnar Dec 9, 2024
de05176
chore(release): published v5.1.1 [skip ci]
lingui-bot Dec 16, 2024
e45a2af
chore(release): published v5.1.2 [skip ci] (#2125)
andrii-bodnar Dec 16, 2024
099820a
docs: update for next 15 (#2073)
timofei-iatsenko Dec 23, 2024
8cae5e0
fix: Allow empty translations for pseudo locale in compile --strict (…
fdev Dec 23, 2024
5ae8363
feat: add meaningful error when locale is not set (#2131)
timofei-iatsenko Dec 23, 2024
7ebb88d
fix: don't use anything from "@babel/types" in runtime (#2132)
timofei-iatsenko Dec 23, 2024
1cb5ecd
chore: update ESLint (#2133)
timofei-iatsenko Dec 23, 2024
349e28d
Merge branch 'main' into vitest
timofei-iatsenko Dec 23, 2024
d5d8c9c
wip
timofei-iatsenko Dec 23, 2024
7ccd129
wip
timofei-iatsenko Dec 23, 2024
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
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

26 changes: 0 additions & 26 deletions .eslintrc

This file was deleted.

15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [5.1.2](https://github.com/lingui/js-lingui/compare/v5.1.1...v5.1.2) (2024-12-16)

**Note:** Version bump only for package js-lingui-workspaces

## [5.1.1](https://github.com/lingui/js-lingui/compare/v5.1.0...v5.1.1) (2024-12-16)

**Note:** Version bump only for package js-lingui-workspaces

# [5.1.0](https://github.com/lingui/js-lingui/compare/v5.0.0...v5.1.0) (2024-12-06)

### Features

- **react:** add support for React 19 ([#2111](https://github.com/lingui/js-lingui/issues/2111)) ([e93b73d](https://github.com/lingui/js-lingui/commit/e93b73d075165d91fa598fa0c579a8ceb5c86845))
- **vite-plugin:** add support for vite@6 ([#2108](https://github.com/lingui/js-lingui/issues/2108)) ([38a0c6f](https://github.com/lingui/js-lingui/commit/38a0c6f8b7f4d961f1580228310f4ebe959eb5a5))

## [5.0.0](https://github.com/lingui/js-lingui/compare/v4.14.1...v5.0.0) (2024-11-28)

We are pleased to announce the release of Lingui 5.0! This release is a **major milestone** for the project and includes a number of new features, improvements and bug fixes.
Expand Down
62 changes: 62 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import pluginJs from "@eslint/js"
import tseslint from "typescript-eslint"
import pluginReact from "eslint-plugin-react"
import { config } from "typescript-eslint"
import importPlugin from "eslint-plugin-import"

export default config(
{ files: ["./packages/**/*.{ts,tsx,js,jsx}"] },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
{
plugins: {
import: importPlugin,
},
},
importPlugin.flatConfigs.typescript,
{
ignores: [
"**/dist/*",
"**/fixtures/*",
"**/locale/*",
"**/test/**/expected/*",
"**/test/**/actual/*",
],
},
{
rules: {
"@typescript-eslint/no-unused-expressions": [
"error",
{
allowShortCircuit: true,
allowTernary: true,
},
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-vars": "off",
"import/no-extraneous-dependencies": [
"error",
{
devDependencies: [
"**/test/**",
"**/*.test.{ts,tsx}",
"**/*.test-d.{ts,tsx}",
"**/vite.config.ts",
],
},
],
"no-undef": "off",
},
},
{
files: ["**/*.test-d.{ts,tsx}", "**/*.test.{ts,tsx}", "eslint.config.mjs"],
rules: {
"import/no-extraneous-dependencies": "off",
},
},
{
files: ["./packages/react/*.{ts,tsx,js,jsx}"],
...pluginReact.configs.flat.recommended,
}
)
19 changes: 0 additions & 19 deletions examples/nextjs-swc/next.config.js

This file was deleted.

17 changes: 17 additions & 0 deletions examples/nextjs-swc/next.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { NextConfig } from 'next'

const nextConfig: NextConfig = {
experimental: {
swcPlugins: [['@lingui/swc-plugin', {}]],
turbo: {
rules: {
'*.po': {
loaders: ['@lingui/loader'],
as: '*.js'
}
}
}
}
}

export default nextConfig
16 changes: 8 additions & 8 deletions examples/nextjs-swc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev --turbopack",
"debug": "NODE_OPTIONS='--inspect' next dev",
"build": "yarn lingui:extract && next build",
"start": "next start",
Expand All @@ -12,22 +12,22 @@
"type-check": "tsc --noEmit"
},
"dependencies": {
"@lingui/core": "^5.0.0-next.3",
"@lingui/react": "^5.0.0-next.3",
"@lingui/core": "^5.1.2",
"@lingui/react": "^5.1.2",
"negotiator": "^0.6.3",
"next": "^14.2.15",
"next": "15.0.1",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@lingui/cli": "^5.0.0-next.3",
"@lingui/loader": "^5.0.0-next.3",
"@lingui/swc-plugin": "^5.0.0-next.2",
"@lingui/cli": "^5.1.2",
"@lingui/loader": "^5.1.2",
"@lingui/swc-plugin": "^5.0.1",
"@types/negotiator": "^0.6.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.3",
"eslint-config-next": "15.0.1",
"typescript": "^5.4.5"
}
}
8 changes: 6 additions & 2 deletions examples/nextjs-swc/src/app/[lang]/app-router-demo/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { HomePage } from '../../../components/HomePage'
import { withLinguiPage } from '../../../withLingui'
import { initLingui } from '../../../initLingui'

export default withLinguiPage(HomePage)
export default async function Page(props) {
const lang = (await props.params).lang
initLingui(lang)
return <HomePage />
}
17 changes: 9 additions & 8 deletions examples/nextjs-swc/src/app/[lang]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import linguiConfig from '../../../lingui.config'
import { allMessages, getI18nInstance } from '../../appRouterI18n'
import { LinguiClientProvider } from '../../components/LinguiClientProvider'
import { PageLangParam, withLinguiLayout } from '../../withLingui'
import { initLingui, PageLangParam } from '../../initLingui'
import React from 'react'
import { t } from '@lingui/macro'
import { setI18n } from '@lingui/react/server'

export async function generateStaticParams() {
return linguiConfig.locales.map((lang) => ({ lang }))
}

export function generateMetadata({ params }: PageLangParam) {
const i18n = getI18nInstance(params.lang)
export async function generateMetadata(props: PageLangParam) {
const i18n = getI18nInstance((await props.params).lang)

return {
title: t(i18n)`Translation Demo`
}
}

export default withLinguiLayout(function RootLayout({
children,
params: { lang }
}) {
export default async function RootLayout({ children, params }) {
const lang = (await params).lang
initLingui(lang)

return (
<html lang={lang}>
<body className="bg-background text-foreground">
Expand All @@ -35,4 +36,4 @@ export default withLinguiLayout(function RootLayout({
</body>
</html>
)
})
}
12 changes: 12 additions & 0 deletions examples/nextjs-swc/src/initLingui.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { getI18nInstance } from './appRouterI18n'
import { setI18n } from '@lingui/react/server'

export type PageLangParam = {
params: Promise<{ lang: string }>
}

export function initLingui(lang: string) {
const i18n = getI18nInstance(lang)
setI18n(i18n)
return i18n
}
2 changes: 1 addition & 1 deletion examples/nextjs-swc/src/pagesRouterI18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useEffect } from 'react'
import { usePathname } from 'next/navigation'

export async function loadCatalog(locale: string) {
const catalog = await import(`@lingui/loader!./locales/${locale}.po`)
const catalog = await import(`./locales/${locale}.po`)
return catalog.messages
}

Expand Down
45 changes: 0 additions & 45 deletions examples/nextjs-swc/src/withLingui.tsx

This file was deleted.

Loading
Loading