index int64 0 0 | repo_id stringlengths 16 181 | file_path stringlengths 28 270 | content stringlengths 1 11.6M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/transactions/useWaitForTransaction.ts | import type {
WaitForTransactionArgs,
WaitForTransactionResult,
} from '@wagmi/core'
import { waitForTransaction } from '@wagmi/core'
import type { QueryConfig, QueryFunctionArgs } from '../../types'
import { useChainId, useQuery } from '../utils'
export type UseWaitForTransactionArgs = Partial<WaitForTransaction... | 8,700 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/transactions/useWatchPendingTransactions.test.ts | import type { Hex } from 'viem'
import { parseEther } from 'viem'
import { describe, expect, it, test, vi } from 'vitest'
import { actConnect, renderHook } from '../../../test'
import { sendTransaction } from '../../actions'
import { useConnect } from '../accounts'
import { usePublicClient } from '../viem'
import type... | 8,701 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/transactions/useWatchPendingTransactions.ts | import * as React from 'react'
import type { WatchPendingTransactionsCallback } from '../../actions'
import { useChainId } from '../utils'
import { usePublicClient, useWebSocketPublicClient } from '../viem'
export type UseWatchPendingTransactionsConfig = {
/** The chain ID to listen on. */
chainId?: number
/** ... | 8,702 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/index.ts | export {
useBaseQuery,
useQuery,
useInfiniteQuery,
useMutation,
useQueryClient,
type UseInfiniteQueryResult,
type UseQueryResult,
} from './query'
export { useChainId } from './useChainId'
export { useForceUpdate } from './useForceUpdate'
export { useInvalidateOnBlock } from './useInvalidateOnBlock'
expor... | 8,703 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useChainId.test.ts | import { describe, expect, it } from 'vitest'
import { renderHook } from '../../../test'
import { useChainId } from './useChainId'
describe('useChainId', () => {
it('mounts', async () => {
const { result } = renderHook(() => useChainId())
expect(result.current).toMatchInlineSnapshot('1')
})
describe('a... | 8,704 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useChainId.ts | import { usePublicClient } from '../viem'
export type UseChainIdArgs = {
chainId?: number
}
export function useChainId({ chainId }: UseChainIdArgs = {}) {
const publicClient = usePublicClient({ chainId })
return publicClient.chain.id
}
| 8,705 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useForceUpdate.test.ts | import * as React from 'react'
import { describe, expect, it } from 'vitest'
import { act, renderHook } from '../../../test'
import { useForceUpdate } from './useForceUpdate'
function useForceUpdateWithCounter() {
const counter = React.useRef(0)
const forceUpdate = useForceUpdate()
counter.current = counter.cur... | 8,706 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useForceUpdate.ts | import * as React from 'react'
export function useForceUpdate() {
const [, forceUpdate] = React.useReducer((x) => x + 1, 0)
return forceUpdate
}
| 8,707 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useInvalidateOnBlock.test.ts | import { describe, it } from 'vitest'
describe('useInvalidateOnBlock', () => {
it.todo('invalidates queries on new block')
})
| 8,708 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useInvalidateOnBlock.ts | import type { QueryKey } from '@tanstack/react-query'
import * as React from 'react'
import { useBlockNumber } from '../network-status'
import { useQueryClient } from './query'
export function useInvalidateOnBlock({
chainId,
enabled,
queryKey,
}: {
chainId?: number
enabled?: boolean
queryKey: QueryKey
}) ... | 8,709 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useSyncExternalStore.native.ts | // @ts-ignore
import * as pkg from 'use-sync-external-store/shim/index.native.js'
export const useSyncExternalStore = pkg.useSyncExternalStore
| 8,710 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useSyncExternalStore.ts | import * as pkg from 'use-sync-external-store/shim/index.js'
export const useSyncExternalStore = pkg.useSyncExternalStore
| 8,711 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useSyncExternalStoreWithTracked.test.ts | import * as ReactDOM from 'react-dom'
import { afterEach, describe, expect, it } from 'vitest'
import { act, cleanup, renderHook } from '../../../test'
import { useSyncExternalStoreWithTracked } from './useSyncExternalStoreWithTracked'
function createExternalStore<State>(initialState: State) {
const listeners = new... | 8,712 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/useSyncExternalStoreWithTracked.ts | import { deepEqual } from '@wagmi/core'
import * as React from 'react'
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js'
const isPlainObject = (obj: unknown) =>
typeof obj === 'object' && !Array.isArray(obj)
export function useSyncExternalStoreWithTracked<
Snapshot e... | 8,713 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/query/index.ts | export { useBaseQuery } from './useBaseQuery'
export {
useInfiniteQuery,
type UseInfiniteQueryResult,
} from './useInfiniteQuery'
export { useMutation } from './useMutation'
export { useQuery, type UseQueryResult } from './useQuery'
export { useQueryClient } from './useQueryClient'
| 8,714 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/query/useBaseQuery.ts | import type {
QueryKey,
QueryObserver,
UseBaseQueryOptions,
} from '@tanstack/react-query'
import {
notifyManager,
useIsRestoring,
useQueryClient,
useQueryErrorResetBoundary,
} from '@tanstack/react-query'
import * as React from 'react'
import { useSyncExternalStore } from '../useSyncExternalStore'
impor... | 8,715 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/query/useInfiniteQuery.ts | import type {
InfiniteQueryObserverResult,
QueryFunction,
QueryKey,
QueryObserver,
UseInfiniteQueryOptions,
} from '@tanstack/react-query'
import { InfiniteQueryObserver } from '@tanstack/react-query'
import { queryClientContext as context } from '../../../context'
import { useBaseQuery } from './useBaseQuer... | 8,716 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/query/useMutation.ts | import type {
MutationFunction,
MutationKey,
UseMutationOptions,
UseMutationResult,
} from '@tanstack/react-query'
import {
parseMutationArgs,
useMutation as useMutation_,
} from '@tanstack/react-query'
import { queryClientContext as context } from '../../../context'
export function useMutation<
TData =... | 8,717 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/query/useQuery.ts | import type {
QueryFunction,
QueryKey,
QueryObserverResult,
UseQueryOptions,
} from '@tanstack/react-query'
import { QueryObserver } from '@tanstack/react-query'
import { queryClientContext as context } from '../../../context'
import { useBaseQuery } from './useBaseQuery'
import { parseQueryArgs, trackResult }... | 8,718 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/query/useQueryClient.ts | import { useQueryClient as useQueryClient_ } from '@tanstack/react-query'
import { queryClientContext as context } from '../../../context'
export const useQueryClient = () => useQueryClient_({ context })
| 8,719 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/utils/query/utils.ts | import type {
QueryFunction,
QueryKey,
QueryObserver,
QueryOptions,
} from '@tanstack/react-query'
function isQueryKey(value: unknown): value is QueryKey {
return Array.isArray(value)
}
function isPlainObject(o: any): o is Object {
if (!hasObjectPrototype(o)) {
return false
}
// If has modified c... | 8,720 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/viem/index.ts | export { usePublicClient } from './usePublicClient'
export { useWalletClient } from './useWalletClient'
export { useWebSocketPublicClient } from './useWebSocketPublicClient'
| 8,721 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/viem/usePublicClient.test.ts | import { describe, expect, it } from 'vitest'
import { actConnect, actSwitchNetwork, renderHook } from '../../../test'
import { useConnect, useSwitchNetwork } from '../accounts'
import type { UsePublicClientArgs } from './usePublicClient'
import { usePublicClient } from './usePublicClient'
function usePublicClientWit... | 8,722 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/viem/usePublicClient.ts | import type { GetPublicClientArgs, PublicClient } from '@wagmi/core'
import { getPublicClient, watchPublicClient } from '@wagmi/core'
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js'
export type UsePublicClientArgs = Partial<GetPublicClientArgs>
export function usePubli... | 8,723 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/viem/useWalletClient.test.ts | import { connect } from '@wagmi/core'
import { describe, expect, it } from 'vitest'
import {
actConnect,
actDisconnect,
actSwitchNetwork,
getWalletClients,
renderHook,
setupConfig,
} from '../../../test'
import {
useAccount,
useConnect,
useDisconnect,
useSwitchNetwork,
} from '../accounts'
import {... | 8,724 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/viem/useWalletClient.ts | import type { GetWalletClientArgs, GetWalletClientResult } from '@wagmi/core'
import { getWalletClient, watchWalletClient } from '@wagmi/core'
import * as React from 'react'
import type { QueryConfig, QueryFunctionArgs } from '../../types'
import { useAccount } from '../accounts'
import { useChainId, useQuery, useQue... | 8,725 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/viem/useWebSocketPublicClient.test.ts | import { beforeEach, describe, expect, it } from 'vitest'
import {
getWebSocketPublicClient,
renderHook,
setupConfig,
} from '../../../test'
import type { Config } from '../../config'
import { useWebSocketPublicClient } from './useWebSocketPublicClient'
describe('useWebSocketPublicClient', () => {
let config:... | 8,726 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks | petrpan-code/wagmi-dev/wagmi/packages/react/src/hooks/viem/useWebSocketPublicClient.ts | import type {
GetWebSocketPublicClientArgs,
WebSocketPublicClient,
} from '@wagmi/core'
import {
getWebSocketPublicClient,
watchWebSocketPublicClient,
} from '@wagmi/core'
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector.js'
export type UseWebSocketPublicClientArgs =... | 8,727 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src | petrpan-code/wagmi-dev/wagmi/packages/react/src/providers/alchemy.ts | export { alchemyProvider } from '@wagmi/core/providers/alchemy'
| 8,728 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src | petrpan-code/wagmi-dev/wagmi/packages/react/src/providers/infura.ts | export { infuraProvider } from '@wagmi/core/providers/infura'
| 8,729 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src | petrpan-code/wagmi-dev/wagmi/packages/react/src/providers/jsonRpc.ts | export { jsonRpcProvider } from '@wagmi/core/providers/jsonRpc'
| 8,730 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src | petrpan-code/wagmi-dev/wagmi/packages/react/src/providers/public.ts | export { publicProvider } from '@wagmi/core/providers/public'
| 8,731 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react/src | petrpan-code/wagmi-dev/wagmi/packages/react/src/types/index.ts | import type {
QueryFunctionContext,
UseInfiniteQueryOptions,
UseMutationOptions,
UseQueryOptions,
} from '@tanstack/react-query'
/**
* Makes {@link TKeys} optional in {@link TType} while preserving type inference.
*/
// s/o trpc (https://github.com/trpc/trpc/blob/main/packages/server/src/types.ts#L6)
export ... | 8,732 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react | petrpan-code/wagmi-dev/wagmi/packages/react/test/index.tsx | import { QueryClient } from '@tanstack/react-query'
import type { RenderHookOptions } from '@testing-library/react'
import {
renderHook as defaultRenderHook,
waitFor,
} from '@testing-library/react'
import * as React from 'react'
import { WagmiConfig } from '../src'
import type { Config } from '../src/config'
impo... | 8,733 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react | petrpan-code/wagmi-dev/wagmi/packages/react/test/setup.ts | import { vi } from 'vitest'
// Make dates stable across runs
Date.now = vi.fn(() => new Date(Date.UTC(2022, 1, 1)).valueOf())
| 8,734 |
0 | petrpan-code/wagmi-dev/wagmi/packages/react | petrpan-code/wagmi-dev/wagmi/packages/react/test/utils.ts | import { act } from '@testing-library/react'
import type {
Connector,
PublicClient,
WebSocketPublicClient,
} from '@wagmi/core'
import { MockConnector } from '@wagmi/core/connectors/mock'
import { goerli, mainnet } from 'viem/chains'
import { expect } from 'vitest'
import type { renderHook } from '.'
import { ge... | 8,735 |
0 | petrpan-code/wagmi-dev/wagmi | petrpan-code/wagmi-dev/wagmi/scripts/cjs.ts | import type { Package } from '@manypkg/get-packages'
import { getPackagesSync } from '@manypkg/get-packages'
import { execa } from 'execa'
import { readJsonSync, writeJsonSync } from 'fs-extra'
import path from 'path'
type PackageJson = Package['packageJson']
type PreparedPackage = Package & {
oldPackageJson: Packa... | 8,736 |
0 | petrpan-code/wagmi-dev/wagmi | petrpan-code/wagmi-dev/wagmi/scripts/tsup.ts | import dedent from 'dedent'
import { execa } from 'execa'
import { default as fs } from 'fs-extra'
import type { Format, Options } from 'tsup'
import path from 'path'
type GetConfig = Omit<
Options,
'bundle' | 'clean' | 'dts' | 'entry' | 'format'
> & {
entry?: string[]
dev?: boolean
noExport?: string[]
}
e... | 8,737 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/.all-contributorsrc | {
"projectName": "next-i18next",
"projectOwner": "i18next",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 100,
"commit": true,
"contributors": [
{
"login": "capellini",
"name": "Rob Capellini",
"avatar_url": "https://avatars3.g... | 8,738 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/.editorconfig | root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# see docs: https://editorconfig.org/
# see example from a project on GitHub: https://github.com/tailwindlabs/tailwindcss/blob/master/.editorconfig
| 8,739 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/.eslintrc.json | {
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"eslint-plugin-import",
"typescript-sort-keys",
"prefer-arrow"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"pl... | 8,740 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/.npmignore | # Untranspiled source and examples
examples
src
# Dependencies
node_modules
yarn.lock
# NextJs
.next
out
# OS
.DS_Store
# Development Environment
.vscode
# Logs
runtime.log
# Testing
cypress
cypress.json
coverage
jest.*
.e2e
*.test.*
# Build tools
tsconfig.json
.eslintrc.json
babel.config.json
# Misc
.circleci
... | 8,741 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/.size-limit.cjs | // @ts-check
const fullEsmMaxSize = '5KB'
// Recent Nextjs version have some optimizations for commonjs that
// aren't available on bare-bone webpack. don't worry about threshold
// difference here for cjs. We can keep this till cjs is supported.
const fullCjsMaxSize = '29KB'
const getSimpleExamplePageLimits = () => ... | 8,742 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/CHANGELOG.md | ## 15.0.0
- refactor: reuse existing i18next instance [#2226](https://github.com/i18next/next-i18next/pull/2226)
-> If you use client side pages (not lazy loading translations), like described [here](https://github.com/i18next/i18next-http-backend/tree/master/example/next#4-setup-your-client-rendered-pagescomponents... | 8,743 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/CODE_OF_CONDUCT.md | # Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex ch... | 8,744 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/CONTRIBUTING.md | # Contributing
## Setup local dev environment
1. Clone the repo
2. Ensure you have a node version >=14, npm > 8
## Working on the code
Run npm install
```bash
npm install
```
Useful commands:
| Name | Description |
| -----------------... | 8,745 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/LICENSE | The MIT License (MIT)
Copyright (c) 2022 i18next
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish,... | 8,746 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/README.md | # next-i18next
[](https://circleci.com/gh/i18next/next-i18next)
[](https://packagequality.com/#?package=next-i18next)
[
an... | 8,749 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/babel.config.json | {
"env": {
"es": {
"presets": [
"@babel/preset-typescript",
[
"@babel/env",
{
"modules": false,
"targets": {
"node": "current"
}
}
],
["@babel/preset-react"]
]
},
"cjs": {
"pre... | 8,750 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/cypress.config.ts | import { defineConfig } from 'cypress'
export default defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
supportFile: false,
//
// setupNodeEvents(on, config) {
// // implement node event listeners here
// },
//
},
})
| 8,751 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/jest.config.js | module.exports = {
automock: false,
collectCoverage: true,
collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'],
moduleDirectories: ['node_modules', 'src'],
moduleNameMapper: {
createClient: '<rootDir>/src/createClient/browser.ts',
},
rootDir: '.',
testPathIgnorePatterns: [
'<rootDir>/.next/',
... | 8,752 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/package-lock.json | {
"name": "next-i18next",
"version": "15.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "next-i18next",
"version": "15.0.0",
"funding": [
{
"type": "individual",
"url": "https://locize.com/i18next.html"
},
{
... | 8,753 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/package.json | {
"name": "next-i18next",
"version": "15.0.0",
"repository": "git@github.com:i18next/next-i18next.git",
"author": "i18next",
"funding": [
{
"type": "individual",
"url": "https://locize.com/i18next.html"
},
{
"type": "individual",
"url": "https://www.i18next.com/how-to/faq#i... | 8,754 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/prettier.config.js | // see docs: https://prettier.io/docs/en/options.html
// also: https://prettier.io/docs/en/configuration.html
// see example from a project on GitHub: https://github.com/tailwindlabs/tailwindcss/blob/master/prettier.config.js
// editorconfig role is to configure your editor so that the code you write is already format... | 8,755 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/serverSideTranslations.d.ts | export { serverSideTranslations } from './dist/types/serverSideTranslations'
| 8,756 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/serverSideTranslations.js | module.exports = require('./dist/commonjs/serverSideTranslations')
| 8,757 |
0 | petrpan-code/i18next | petrpan-code/i18next/next-i18next/tsconfig.json | {
"compilerOptions": {
"esModuleInterop": true,
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"lib": ["esnext", "dom"],
"target": "es5",
"jsx": "react"
},
"include": ["src/**/*", "node_modules/next/types/global.d.ts"]
}
| 8,758 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/.circleci/config.yml | version: 2.1
commands:
build-and-test:
steps:
- checkout
- run:
name: Install dependencies (main)
command: npm install
- run:
name: Build next-i18next
command: npm run build
- run:
name: Install examples
command: npm run install:e... | 8,759 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/.husky/pre-commit | #!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm test
| 8,760 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/cypress/tsconfig.json | {
"extends": "../tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"types": ["cypress", "@types/testing-library__cypress"]
},
"include": ["**/*.ts"]
}
| 8,761 |
0 | petrpan-code/i18next/next-i18next/cypress | petrpan-code/i18next/next-i18next/cypress/e2e/spec.cy.ts | describe('basic e2e test run', () => {
it('should display translated content across routes', () => {
cy.visit('/')
// Test English content
cy.contains('A simple example')
cy.contains('To second page').click()
cy.location('pathname', { timeout: 10000 }).should(
'equal',
'/second-page'
... | 8,762 |
0 | petrpan-code/i18next/next-i18next | petrpan-code/i18next/next-i18next/docs/v8-migration.md | # Migration Guide v7 to v8
Please read the [full documentation](https://github.com/i18next/next-i18next/blob/master/README.md), before migrating from previous versions to v8.
This is a guide which will cover most use cases to migrate from v7 to v8.
We advise migrating as soon as possible, as new versions of NextJs wo... | 8,763 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/simple/next-env.d.ts | /// <reference types="next" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
| 8,764 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/simple/next-i18next.config.js | // @ts-check
/**
* @type {import('next-i18next').UserConfig}
*/
module.exports = {
// https://www.i18next.com/overview/configuration-options#logging
debug: process.env.NODE_ENV === 'development',
i18n: {
defaultLocale: 'en',
locales: ['en', 'de'],
},
/** To avoid issues when deploying to some paas ... | 8,765 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/simple/next-utils.config.js | const pc = require('picocolors')
const nextUtilsConfig = () => {
const trueEnv = ['true', '1', 'yes']
const esmExternals = trueEnv.includes(
process.env?.NEXTJS_ESM_EXTERNALS ?? 'false'
)
const tsconfigPath = process.env.NEXTJS_TSCONFIG_PATH
? process.env.NEXTJS_TSCONFIG_PATH
: './tsconfig.json'
... | 8,766 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/simple/next.config.js | // @ts-check
const { i18n } = require('./next-i18next.config.js')
// You can remove the following 2 lines when integrating our example.
const { loadCustomBuildParams } = require('./next-utils.config')
const { esmExternals = false, tsconfigPath } =
loadCustomBuildParams()
/** @type {import('next').NextConfig} */
con... | 8,767 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/simple/package.json | {
"name": "next-i18next-example-simple",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start -p ${PORT:=3000}",
"typecheck": "tsc --project ./tsconfig.json --noEmit",
"clean": "rimraf .next",
"nuke:install": ... | 8,768 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/simple/tsconfig.json | {
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"baseUrl": ".",
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInter... | 8,769 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/simple/vercel.json | {
"github": {
"silent": true
}
}
| 8,770 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/@types/i18next.d.ts | /**
* If you want to enable locale keys typechecking and enhance IDE experience.
*
* Requires `resolveJsonModule:true` in your tsconfig.json.
*
* @link https://www.i18next.com/overview/typescript
*/
import 'i18next'
// resources.ts file is generated with `npm run toc`
import resources from './resources.ts'
decl... | 8,771 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/@types/resources.ts | import common from '../public/locales/en/common.json';
import footer from '../public/locales/en/footer.json';
import secondpage from '../public/locales/en/second-page.json';
const resources = {
common,
footer,
'second-page': secondpage
} as const;
export default resources;
| 8,772 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/components/Footer.tsx | import pkg from 'next-i18next/package.json'
import { useTranslation, Trans } from 'next-i18next'
import type { FC } from 'react'
export const Footer: FC = () => {
const { t } = useTranslation('footer')
return (
<footer>
<p>{t('description')}</p>
<p>next-i18next v{pkg.version}</p>
<p
... | 8,773 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/components/Header.tsx | import Head from 'next/head'
import type { FC } from 'react'
type Props = {
heading: string
title: string
}
export const Header: FC<Props> = ({ heading, title }) => (
<>
<Head>
<title>{title}</title>
</Head>
<h2>
next-i18next
<hr />
</h2>
<h1>{heading}</h1>
<a className... | 8,774 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/pages/_app.tsx | import type { AppProps } from 'next/app'
import { appWithTranslation } from 'next-i18next'
// import nextI18NextConfig from '../next-i18next.config.js'
const MyApp = ({ Component, pageProps }: AppProps) => (
<Component {...pageProps} />
)
// https://github.com/i18next/next-i18next#unserializable-configs
export defa... | 8,775 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/pages/_document.tsx | import Document, {
Html,
Head,
Main,
NextScript,
} from 'next/document'
import type { DocumentProps } from 'next/document'
import i18nextConfig from '../next-i18next.config'
type Props = DocumentProps & {
// add custom document props
}
class MyDocument extends Document<Props> {
render() {
const curren... | 8,776 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/pages/index.tsx | import Link from 'next/link'
import { useRouter } from 'next/router'
import type { GetStaticProps, InferGetStaticPropsType } from 'next'
import { useTranslation, Trans } from 'next-i18next'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { Header } from '../components/Header'
impor... | 8,777 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/pages/second-page.tsx | import Link from 'next/link'
import type {
GetServerSideProps,
InferGetServerSidePropsType,
} from 'next'
import { useTranslation } from 'next-i18next'
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import { Header } from '../components/Header'
import { Footer } from '../components/F... | 8,778 |
0 | petrpan-code/i18next/next-i18next/examples/simple | petrpan-code/i18next/next-i18next/examples/simple/public/app.css | #__next {
font-family: 'Open Sans', sans-serif;
text-align: center;
background-image: linear-gradient(
to left top,
#ffffff,
#f5f5f5,
#eaeaea,
#e0e0e0,
#d6d6d6
);
display: flex;
flex-direction: column;
margin: 0;
min-height: 100vh;
min-width: 100vw;
}
h1,
h2 {
font-family: '... | 8,779 |
0 | petrpan-code/i18next/next-i18next/examples/simple/public/locales | petrpan-code/i18next/next-i18next/examples/simple/public/locales/de/common.json | {
"h1": "Ein einfaches Beispiel",
"change-locale": "Sprache wechseln zu \"{{changeTo}}\"",
"to-second-page": "Zur zweiten Seite",
"error-with-status": "Auf dem Server ist ein Fehler ({{statusCode}}) aufgetreten",
"error-without-status": "Auf dem Server ist ein Fehler aufgetreten",
"title": "Hauptseite | nex... | 8,780 |
0 | petrpan-code/i18next/next-i18next/examples/simple/public/locales | petrpan-code/i18next/next-i18next/examples/simple/public/locales/de/footer.json | {
"description": "Dies ist eine Nicht-Seitenkomponente, die einen eigenen Namespace erfordert",
"helpLocize": "Wenn Sie <1>locize</1> einsetzen, unterstützen Sie direkt die Zukunft von <3>i18next</3>."
}
| 8,781 |
0 | petrpan-code/i18next/next-i18next/examples/simple/public/locales | petrpan-code/i18next/next-i18next/examples/simple/public/locales/de/second-page.json | {
"h1": "Eine zweite Seite, um das Routing zu demonstrieren",
"back-to-home": "Zurück zur Hauptseite",
"title": "Zweite Seite | next-i18next"
}
| 8,782 |
0 | petrpan-code/i18next/next-i18next/examples/simple/public/locales | petrpan-code/i18next/next-i18next/examples/simple/public/locales/en/common.json | {
"h1": "A simple example",
"change-locale": "Change locale to \"{{changeTo}}\"",
"to-second-page": "To second page",
"error-with-status": "A {{statusCode}} error occurred on server",
"error-without-status": "An error occurred on the server",
"title": "Home | next-i18next",
"blog": {
"appDir": {
... | 8,783 |
0 | petrpan-code/i18next/next-i18next/examples/simple/public/locales | petrpan-code/i18next/next-i18next/examples/simple/public/locales/en/footer.json | {
"description": "This is a non-page component that requires its own namespace",
"helpLocize": "With using <1>locize</1> you directly support the future of <3>i18next</3>."
}
| 8,784 |
0 | petrpan-code/i18next/next-i18next/examples/simple/public/locales | petrpan-code/i18next/next-i18next/examples/simple/public/locales/en/second-page.json | {
"h1": "A second page, to demonstrate routing",
"back-to-home": "Back to home",
"title": "Second page | next-i18next"
}
| 8,785 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/ssg/README.md | # Static internationalized (i18n) next.js website with the help of [next-i18next](https://github.com/i18next/next-i18next) and [next-language-detector](https://github.com/i18next/next-language-detector)
## What is this?
This is a simple example of how to use [next-i18next](https://github.com/i18next/next-i18next) wit... | 8,786 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/ssg/next-i18next.config.js | module.exports = {
debug: process.env.NODE_ENV === 'development',
i18n: {
defaultLocale: 'en',
locales: ['en', 'de', 'it'],
},
}
| 8,787 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/ssg/next.config.js | // const { i18n } = require('./next-i18next.config')
module.exports = {
output: 'export',
// i18n,
trailingSlash: true,
}
| 8,788 |
0 | petrpan-code/i18next/next-i18next/examples | petrpan-code/i18next/next-i18next/examples/ssg/package.json | {
"name": "next-i18next-example-ssg",
"version": "13.0.0",
"license": "MIT",
"scripts": {
"404": "cp out/404/index.html out/404.html",
"dev": "next dev",
"build": "next build",
"postbuild": "npm run 404",
"server": "next start",
"start": "npm run dev",
"lint": "next lint",
"test"... | 8,789 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/components/Footer.js | import { useTranslation } from 'next-i18next'
import { useRouter } from 'next/router'
import LanguageSwitchLink from './LanguageSwitchLink'
import pkg from 'next-i18next/package.json'
import pkgLD from 'next-language-detector/package.json'
import i18nextConfig from '../next-i18next.config'
export const Footer = () =>... | 8,790 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/components/Header.js | import Head from 'next/head'
export const Header = ({ heading, title }) => (
<>
<Head>
<title>{title}</title>
</Head>
<h2>
next-language-detector example
<hr />
</h2>
<h1>{heading}</h1>
<a
className="github"
href="//github.com/i18next/next-language-detector"
... | 8,791 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/components/LanguageSwitchLink.js | import languageDetector from '../lib/languageDetector'
import { useRouter } from 'next/router'
import Link from 'next/link'
const LanguageSwitchLink = ({ locale, ...rest }) => {
const router = useRouter()
let href = rest.href || router.asPath
let pName = router.pathname
Object.keys(router.query).forEach(k => ... | 8,792 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/components/Link.js | import React from 'react'
import Link from 'next/link'
import { useRouter } from 'next/router'
const LinkComponent = ({
children,
skipLocaleHandling,
...rest
}) => {
const router = useRouter()
const locale = rest.locale || router.query.locale || ''
let href = rest.href || router.asPath
if (href.indexOf(... | 8,793 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/lib/getStatic.js | import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
import i18nextConfig from '../next-i18next.config'
export const getI18nPaths = () =>
i18nextConfig.i18n.locales.map(lng => ({
params: {
locale: lng,
},
}))
export const getStaticPaths = () => ({
fallback: false,
paths: ... | 8,794 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/lib/languageDetector.js | import languageDetector from 'next-language-detector'
import i18nextConfig from '../next-i18next.config'
export default languageDetector({
fallbackLng: i18nextConfig.i18n.defaultLocale,
supportedLngs: i18nextConfig.i18n.locales,
})
| 8,795 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/lib/redirect.js | import { useEffect } from 'react'
import { useRouter } from 'next/router'
import languageDetector from './languageDetector'
export const useRedirect = to => {
const router = useRouter()
to = to || router.asPath
// language detection
useEffect(() => {
const detectedLng = languageDetector.detect()
if (
... | 8,796 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/pages/404.js | import { Redirect } from '../lib/redirect'
export default Redirect
| 8,797 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/pages/_app.js | import { appWithTranslation } from 'next-i18next'
const MyApp = ({ Component, pageProps }) => (
<Component {...pageProps} />
)
export default appWithTranslation(MyApp)
| 8,798 |
0 | petrpan-code/i18next/next-i18next/examples/ssg | petrpan-code/i18next/next-i18next/examples/ssg/pages/_document.js | import Document, {
Html,
Head,
Main,
NextScript,
} from 'next/document'
import i18nextConfig from '../next-i18next.config'
class MyDocument extends Document {
render() {
const currentLocale =
this.props.__NEXT_DATA__.query.locale ||
i18nextConfig.i18n.defaultLocale
return (
<Html la... | 8,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.