Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
  • Loading branch information
eolme committed Dec 20, 2024
1 parent 421930b commit ee068cd
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"tsconfigRootDir": "."
},
"rules": {
"@typescript-eslint/promise-function-async": 0
"@typescript-eslint/promise-function-async": 0,
"unicorn/prefer-string-replace-all": 0
}
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
.eslintcache
yarn.lock
.yarnrc.yml
.yarn
.yarn/
.npmrc
pnpm-lock.yaml
node_modules/
lib/
coverage/
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ vitest.config.ts
.eslintcache
.eslintignore
.eslintrc
.npmrc
pnpm-lock.yaml
.yarn/
coverage/
yarn.lock
Expand Down
40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "i18nano",
"version": "4.0.1",
"version": "4.1.0",
"main": "./lib/index.js",
"module": "./lib/index.mjs",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -42,30 +42,30 @@
"examples/*"
],
"devDependencies": {
"@jest/types": "^29.5.0",
"@jest/types": "^29.6.3",
"@mntm/eslint-config": "^1.4.0",
"@types/node": "^18.16.3",
"@types/react": "^18.2.0",
"@types/react-test-renderer": "^18.0.0",
"@vitest/coverage-c8": "^0.30.1",
"esbuild": "^0.17.18",
"eslint": "^8.39.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-reconciler": "0.29.0",
"react-test-renderer": "18.2.0",
"scheduler": "0.23.0",
"typescript": "^5.0.4",
"vite": "^4.3.4",
"vite-plugin-dts": "^2.3.0",
"vitest": "^0.30.1"
"@types/node": "^22.10.2",
"@types/react": "^19.0.2",
"@types/react-test-renderer": "^19.0.0",
"@vitest/coverage-v8": "^2.1.8",
"esbuild": "0.24.0",
"eslint": "^8.57.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-reconciler": "0.31.0",
"react-test-renderer": "^18.3.1",
"scheduler": "0.25.0",
"typescript": "^5.7.2",
"vite": "^6.0.5",
"vite-plugin-dts": "^4.4.0",
"vitest": "^2.1.8"
},
"resolutions": {
"esbuild": "^0.17.18",
"vite": "^4.3.4"
"esbuild": "0.24.0",
"vite": "^6.0.5"
},
"peerDependencies": {
"react": "^18.2.0"
"react": "^18.2.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"react": {
Expand Down
3 changes: 2 additions & 1 deletion src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ type ReactUsePromise<T> = PromiseLike<T> & {
reason?: unknown;
};

const ReactNextUse = (React as any)['use'.toString()];
const inline = (str: string) => str.toString();
const ReactNextUse = (React as any)[inline('use')];
const ReactNextPromise = ReactNextUse as <T>(promise: ReactUsePromise<T>) => T;
const ReactNextContext = ReactNextUse as <T>(context: React.Context<T>) => T;

Expand Down
6 changes: 5 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { default as dts } from 'vite-plugin-dts';
export default defineConfig({
plugins: [
dts({
exclude: ['tests', 'vite.config.ts', 'vitest.config.ts'],
beforeWriteFile(filePath, content) {
promises.mkdir(dirname(filePath), { recursive: true }).then(() => {
promises.writeFile(
Expand Down Expand Up @@ -38,7 +39,10 @@ export default defineConfig({
'es6'
],
rollupOptions: {
external: ['react']
external: ['react'],
output: {
banner: (chunk) => chunk.fileName === 'index.mjs' ? '"use client";\n' : ''
}
}
},
esbuild: {
Expand Down
15 changes: 13 additions & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,26 @@ export default defineConfig({
environment: 'node',
coverage: {
enabled: true,
provider: 'c8',
reporter: 'text',
exclude: [
// Exclude tests and test utils
'**/tests/**/*',

// Too complex polyfills for coverage
'**/src/react.ts'
'**/src/react.ts',

'**/vite.config.ts',
'**/vitest.config.ts',

'**/examples/**/*',

'**/lib/**/*'
]
}
},
resolve: {
alias: {
react: 'react'
}
}
});

0 comments on commit ee068cd

Please sign in to comment.