diff --git a/.ncurc.yml b/.ncurc.yml index ff667f276d8..8b5d2f13ec4 100644 --- a/.ncurc.yml +++ b/.ncurc.yml @@ -3,4 +3,4 @@ # @link https://github.com/raineorshine/npm-check-updates # Add here exclusions on packages if any -reject: ['i18next', 'react-i18next'] +reject: [] diff --git a/apps/nextjs-app/package.json b/apps/nextjs-app/package.json index e0bd0511681..fc7f2823c37 100644 --- a/apps/nextjs-app/package.json +++ b/apps/nextjs-app/package.json @@ -135,13 +135,13 @@ "clsx": "1.2.1", "cors": "2.8.5", "graphql": "16.6.0", - "i18next": "21.10.0", + "i18next": "22.0.4", "jose": "4.10.4", "ky": "0.32.2", "next": "13.0.2", "next-auth": "4.16.2", "next-connect": "0.13.0", - "next-i18next": "12.1.0", + "next-i18next": "workspace:*", "next-secure-headers": "2.2.0", "next-seo": "5.14.0", "next-transpile-modules": "10.0.0", @@ -149,7 +149,7 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "7.39.1", - "react-i18next": "11.18.6", + "react-i18next": "12.0.0", "rooks": "7.4.1", "sharp": "0.31.2", "superjson": "1.11.0", diff --git a/apps/nextjs-app/src/lib/i18n/I18nNamespace.types.ts b/apps/nextjs-app/src/lib/i18n/I18nNamespace.types.ts index e02e994c7e8..257bbad3652 100644 --- a/apps/nextjs-app/src/lib/i18n/I18nNamespace.types.ts +++ b/apps/nextjs-app/src/lib/i18n/I18nNamespace.types.ts @@ -1,4 +1,4 @@ -import type { CustomTypeOptions } from 'react-i18next'; +import type { CustomTypeOptions } from 'i18next'; export type I18nNamespace = keyof CustomTypeOptions['resources']; diff --git a/apps/nextjs-app/src/pages/admin/index.tsx b/apps/nextjs-app/src/pages/admin/index.tsx index ea71dec9f8a..9cb32dfe2fd 100644 --- a/apps/nextjs-app/src/pages/admin/index.tsx +++ b/apps/nextjs-app/src/pages/admin/index.tsx @@ -1,10 +1,10 @@ import { HttpBadRequest } from '@belgattitude/http-exception'; import type { GetStaticProps, InferGetStaticPropsType } from 'next'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import type { ReactElement } from 'react'; import { adminConfig } from '@/features/admin/admin.config'; import { AdminLayout } from '@/features/admin/layouts'; import { AdminMainPage } from '@/features/admin/pages'; +import { getServerSideTranslations } from '@/lib/i18n'; type Props = { /** Add props here */ @@ -22,7 +22,7 @@ export const getStaticProps: GetStaticProps = async (context) => { const { i18nNamespaces } = adminConfig; return { props: { - ...(await serverSideTranslations(locale, i18nNamespaces)), + ...(await getServerSideTranslations(locale, i18nNamespaces)), }, // revalidate: 60, }; diff --git a/apps/nextjs-app/src/pages/auth/login.tsx b/apps/nextjs-app/src/pages/auth/login.tsx index 11b3af1e78e..7285eccdc9e 100644 --- a/apps/nextjs-app/src/pages/auth/login.tsx +++ b/apps/nextjs-app/src/pages/auth/login.tsx @@ -1,8 +1,8 @@ import { HttpBadRequest } from '@belgattitude/http-exception'; import type { GetStaticProps, InferGetStaticPropsType } from 'next'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { authConfig } from '@/features/auth/auth.config'; import { LoginPage } from '@/features/auth/pages/LoginPage'; +import { getServerSideTranslations } from '@/lib/i18n'; type Props = { /** Add props here */ @@ -22,7 +22,7 @@ export const getStaticProps: GetStaticProps = async (context) => { const { i18nNamespaces } = authConfig; return { props: { - ...(await serverSideTranslations(locale, i18nNamespaces)), + ...(await getServerSideTranslations(locale, i18nNamespaces)), }, }; }; diff --git a/apps/nextjs-app/src/pages/home.tsx b/apps/nextjs-app/src/pages/home.tsx index 93a1c504346..c5f6839db26 100644 --- a/apps/nextjs-app/src/pages/home.tsx +++ b/apps/nextjs-app/src/pages/home.tsx @@ -1,8 +1,8 @@ import { HttpBadRequest } from '@belgattitude/http-exception'; import type { GetServerSideProps, InferGetServerSidePropsType } from 'next'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { homeConfig } from '@/features/home/home.config'; import { HomePage } from '@/features/home/pages'; +import { getServerSideTranslations } from '@/lib/i18n'; type Props = { /** Add HomeRoute props here */ @@ -24,7 +24,7 @@ export const getServerSideProps: GetServerSideProps = async ( const { i18nNamespaces } = homeConfig; return { props: { - ...(await serverSideTranslations(locale, i18nNamespaces)), + ...(await getServerSideTranslations(locale, i18nNamespaces)), }, }; }; diff --git a/apps/nextjs-app/src/pages/index.tsx b/apps/nextjs-app/src/pages/index.tsx index 7da5e6b60d3..6d7a90487fb 100644 --- a/apps/nextjs-app/src/pages/index.tsx +++ b/apps/nextjs-app/src/pages/index.tsx @@ -1,8 +1,8 @@ import { HttpBadRequest } from '@belgattitude/http-exception'; import type { GetStaticProps, InferGetStaticPropsType } from 'next'; -import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; import { demoConfig } from '@/features/demo/demo.config'; import { DemoPage } from '@/features/demo/pages'; +import { getServerSideTranslations } from '@/lib/i18n'; type Props = { /** Add HomeRoute props here */ @@ -22,7 +22,7 @@ export const getStaticProps: GetStaticProps = async (context) => { const { i18nNamespaces } = demoConfig; return { props: { - ...(await serverSideTranslations(locale, i18nNamespaces)), + ...(await getServerSideTranslations(locale, i18nNamespaces)), }, }; }; diff --git a/apps/nextjs-app/src/types.d/react-i18next.d.ts b/apps/nextjs-app/src/types.d/i18next.d.ts similarity index 87% rename from apps/nextjs-app/src/types.d/react-i18next.d.ts rename to apps/nextjs-app/src/types.d/i18next.d.ts index aa115878cfd..633aa28c544 100644 --- a/apps/nextjs-app/src/types.d/react-i18next.d.ts +++ b/apps/nextjs-app/src/types.d/i18next.d.ts @@ -4,10 +4,10 @@ * you can opt out by commenting the following code. * @link https://react.i18next.com/latest/typescript */ -import 'react-i18next'; +import 'i18next'; import type { I18nNamespaces } from '@your-org/common-i18n'; -declare module 'react-i18next' { +declare module 'i18next' { interface CustomTypeOptions { defaultNS: 'common'; resources: I18nNamespaces; diff --git a/package.json b/package.json index 40157cee76f..ff2ac2ea299 100644 --- a/package.json +++ b/package.json @@ -79,8 +79,7 @@ "@graphql-inspector/core": "https://github.com/kamilkisiela/graphql-inspector/issues/2175" }, "resolutions": { - "@graphql-inspector/core": "3.3.0", - "i18next": "^22.0.0" + "@graphql-inspector/core": "3.3.0" }, "dependencies": { "cross-env": "7.0.3" diff --git a/packages/next-i18next/.size-limit.cjs b/packages/next-i18next/.size-limit.cjs new file mode 100644 index 00000000000..f7567ba90fe --- /dev/null +++ b/packages/next-i18next/.size-limit.cjs @@ -0,0 +1,80 @@ +// @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 = () => { + const dir = './examples/simple/.next' + let manifest; + try { + manifest = require(`${dir}/build-manifest.json`); + } catch (e) { + throw new Error( + 'Cannot find a NextJs build folder, did you forget to run build:examples ?' + ); + } + const limitCfg = { + defaultSize: '90kb', + pages: { + '/': '85kb', + '/404': '90kb', + '/_app': '100kb', + '/_error': '80Kb', + '/second-page': '85Kb' + }, + }; + let pageLimits = []; + for (const [uri, paths] of Object.entries(manifest.pages)) { + pageLimits.push({ + name: `Example app: page '${uri}'`, + limit: limitCfg.pages?.[uri] ?? limitCfg.defaultSize, + webpack: false, + path: paths.map(p => `${dir}/${p}`) + }); + } + return pageLimits; +} + +const modifyWebpackConfig = config => { + config.resolve = {}; + config.resolve.fallback = { "path": false, "fs": false }; +} + +/** + * Will ensure esm tree-shakeability and total size are within expectations. + * + * @link https://github.com/ai/size-limit/ + * @type {{name: string, path: string[], limit: string, import?: string, webpack?: boolean, modifyWebpackConfig: any}[]} + */ +module.exports = [ + // ################################################### + // Dist ESM full bundle + // ################################################### + { + name: "ESM (import everything *)", + path: ["dist/esm/index.js"], + import: "*", + limit: fullEsmMaxSize, + modifyWebpackConfig, + }, + // ################################################### + // Fist commonjs full bundle + // Tip: older versions of nextjs will not tree-shake + // cjs very well. This explains threshold differences + // ################################################### + { + name: "CJS (require everything *)", + path: ["dist/commonjs/index.js"], + import: "*", + webpack: true, + limit: fullCjsMaxSize, + modifyWebpackConfig, + }, + // ################################################### + // Example apps + // ################################################### + ...getSimpleExamplePageLimits(), +]; diff --git a/packages/next-i18next/README.md b/packages/next-i18next/README.md new file mode 100644 index 00000000000..16c8da02237 --- /dev/null +++ b/packages/next-i18next/README.md @@ -0,0 +1,418 @@ +# next-i18next + +[![CircleCI](https://circleci.com/gh/i18next/next-i18next.svg?style=shield)](https://circleci.com/gh/i18next/next-i18next) +[![Package Quality](https://npm.packagequality.com/shield/next-i18next.svg)](https://packagequality.com/#?package=next-i18next) +[![npm version](https://img.shields.io/npm/v/next-i18next.svg?style=flat-square)](https://www.npmjs.com/package/next-i18next) +![npm](https://img.shields.io/npm/dw/next-i18next) + +**The easiest way to translate your Next.js apps.** + +If you are using next-i18next in production and like to unleash some super powers, you may have a look at [this blog post](https://locize.com/blog/next-i18next/). +[![](https://locize.com/blog/next-i18next/next-i18next.jpg)](https://locize.com/blog/next-i18next/) + +## What is this? + +Although Next.js [provides internationalised routing directly](https://nextjs.org/docs/advanced-features/i18n-routing), it does not handle any management of translation content, or the actual translation functionality itself. All Next.js does is keep your locales and URLs in sync. + +To complement this, `next-i18next` provides the remaining functionality – management of translation content, and components/hooks to translate your React components – while fully supporting SSG/SSR, multiple [namespaces](https://www.i18next.com/principles/namespaces), codesplitting, etc. + +While `next-i18next` uses [i18next](https://www.i18next.com/) and [react-i18next](https://github.com/i18next/react-i18next) under the hood, users of `next-i18next` simply need to include their translation content as JSON files and don't have to worry about much else. + +A live demo is [available here](https://next.i18next.com/). This demo app is the [simple example](./examples/simple/) - nothing more, nothing less. + +## Why next-i18next? + +Easy to set up, easy to use: setup only takes a few steps, and configuration is simple. + +No other requirements: `next-i18next` simplifies internationalisation for your [Next.js](https://nextjs.org/) app without extra dependencies. + +Production ready: `next-i18next` supports passing translations and configuration options into pages as props with SSG/SSR support. + +## How does it work? + +Your `next-i18next.config.js` file will provide configuration for `next-i18next`. +After configuration, `appWithTranslation` allows us to use the `t` (translate) function in our components via hooks. + +Then we add `serverSideTranslation` to [getStaticProps](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) or [getServerSideProps](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) (depending on your case) in our page-level components. + +Now our Next.js app is fully translatable! + +## Setup + +### 1. Installation + +```bash +yarn add next-i18next react-i18next i18next +``` + +You need to also have `react` and `next` installed. + +### 2. Translation content + +By default, `next-i18next` expects your translations to be organised as such: + +``` +. +└── public + └── locales + ├── en + | └── common.json + └── de + └── common.json +``` + +This structure can also be seen in the [simple example](./examples/simple). + +If you want to structure your translations/namespaces in a custom way, you will need to pass modified `localePath` and `localeStructure` values into the initialisation config. + +### 3. Project setup + +First, create a `next-i18next.config.js` file in the root of your project. The syntax for the nested `i18n` object [comes from Next.js directly](https://nextjs.org/docs/advanced-features/i18n-routing). + +This tells `next-i18next` what your `defaultLocale` and other locales are, so that it can preload translations on the server: + +#### `next-i18next.config.js` + +```js +module.exports = { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'], + }, +}; +``` + +Now, create or modify your `next.config.js` file, by passing the `i18n` object into your `next.config.js` file, to enable localised URL routing: + +#### [`next.config.js`](https://nextjs.org/docs/api-reference/next.config.js/introduction) + +```js +const { i18n } = require('./next-i18next.config'); + +module.exports = { + i18n, +}; +``` + +There are three functions that `next-i18next` exports, which you will need to use to translate your project: + +#### appWithTranslation + +This is a HOC which wraps your [`_app`](https://nextjs.org/docs/advanced-features/custom-app): + +```tsx +import { appWithTranslation } from 'next-i18next'; + +const MyApp = ({ Component, pageProps }) => ; + +export default appWithTranslation(MyApp); +``` + +The `appWithTranslation` HOC is primarily responsible for adding a [`I18nextProvider`](https://react.i18next.com/latest/i18nextprovider). + +#### serverSideTranslations + +This is an async function that you need to include on your page-level components, via either [`getStaticProps`](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) or [`getServerSideProps`](https://nextjs.org/docs/basic-features/data-fetching#getserversideprops-server-side-rendering) (depending on your use case): + +```tsx +import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; + +export async function getStaticProps({ locale }) { + return { + props: { + ...(await serverSideTranslations(locale, ['common', 'footer'])), + // Will be passed to the page component as props + }, + }; +} +``` + +Note that `serverSideTranslations` must be imported from `next-i18next/serverSideTranslations` – this is a separate module that contains NodeJs-specific code. + +Also, note that `serverSideTranslations` is not compatible with `getInitialProps`, as it _only_ can execute in a server environment, whereas `getInitialProps` is called on the client side when navigating between pages. + +The `serverSideTranslations` HOC is primarily responsible for passing translations and configuration options into pages, as props – you need to add it to any page that has translations. + +### useTranslation + +This is the hook which you'll actually use to do the translation itself. The `useTranslation` hook [comes from `react-i18next`](https://react.i18next.com/latest/usetranslation-hook), but can be imported from `next-i18next` directly: + +```tsx +import { useTranslation } from 'next-i18next'; + +export const Footer = () => { + const { t } = useTranslation('footer'); + + return ( +
+

{t('description')}

+
+ ); +}; +``` + +### 4. Declaring namespace dependencies + +By default, `next-i18next` will send _all your namespaces_ down to the client on each initial request. This can be an appropriate approach for smaller apps with less content, but a lot of apps will benefit from splitting namespaces based on route. + +To do that, you can pass an array of required namespaces for each page into `serverSideTranslations`. You can see this approach in [examples/simple/pages/index.tsx](./examples/simple/pages/index.tsx). Passing in an empty array of required namespaces will send no namespaces. + +Note: `useTranslation` provides namespaces to the component that you use it in. However, `serverSideTranslations` provides the total available namespaces to the entire React tree and belongs on the page level. Both are required. + +### 5. Declaring locale dependencies + +By default, `next-i18next` will send _only the active locale_ down to the client on each request. This helps reduce the size of the +initial payload sent to the client. However in some cases one may need the translations for other languages at runtime too. For example +when using [getFixedT](https://www.i18next.com/overview/api#getfixedt) of `useTranslation` hook. + +To change the behavior and load extra locales just pass in an array of locales as the last argument to `serverSideTranslations`. + +```diff + import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; + + export async function getStaticProps({ locale }) { + return { + props: { +- ...(await serverSideTranslations(locale, ['common', 'footer'])), ++ ...(await serverSideTranslations(locale, ['common', 'footer'], null, ['en', 'no'])), + }, + }; + } +``` + +As a result the translations for both `no` and `en` locales will always be loaded regardless of the current language. + +> Note: The extra argument should be added to all pages that use `getFixedT` function. + +#### Fallback locales +By default, `next-i18next` will add the `defaultLocale` as fallback. To change this, you can set [`fallbackLng`](https://www.i18next.com/principles/fallback). All values supported by `i18next` (`string`, `array`, `object` and `function`) are supported by `next-i18next` too. + +Additionally `nonExplicitSupportedLngs` can be set to `true` to support all variants of a language, without the need to provide JSON files for each of them. Notice that all variants still must be included in `locales` to enable routing within `next.js`. + +> Note: `fallbackLng` and `nonExplicitSupportedLngs` can be used at once. There is only one exception: You can not use a function for `fallbackLng` when `nonExplicitSupportedLngs` is `true`, + +```js +module.exports = { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr', 'de-AT', 'de-DE', 'de-CH'], + }, + fallbackLng: { + default: ['en'], + 'de-CH': ['fr'] + }, + nonExplicitSupportedLngs: true, + // de, fr and en will be loaded as fallback languages for de-CH +}; +``` + +Be aware that using `fallbackLng` and `nonExplicitSupportedLngs` can easily increase the initial size of the page. + +### 6. Advanced configuration + +#### Passing other config options + +If you need to modify more advanced configuration options, you can pass them via `next-i18next.config.js`. For example: + +```js +module.exports = { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'], + }, + localePath: typeof window === 'undefined' ? + require('path').resolve('./my-custom/path'): + '/public/my-custom/path', +}; +``` + +#### Unserializable configs + +Some `i18next` plugins (which you can pass into `config.use`) are unserializable, as they contain functions and other JavaScript primitives. + +You may run into this if your use case is more advanced. You'll see Next.js throw an error like: + +``` +Error: Error serializing `._nextI18Next.userConfig.use[0].process` returned from `getStaticProps` in "/my-page". +Reason: `function` cannot be serialized as JSON. Please only return JSON serializable data types. +``` + +To fix this, you'll need to set `config.serializeConfig` to `false`, and manually pass your config into `appWithTranslation`: + +```tsx +import { appWithTranslation } from 'next-i18next'; +import nextI18NextConfig from '../next-i18next.config.js'; + +const MyApp = ({ Component, pageProps }) => ; + +export default appWithTranslation(MyApp, nextI18NextConfig); +``` + +```tsx +import { serverSideTranslations } from 'next-i18next/serverSideTranslations'; + +import nextI18NextConfig from '../next-i18next.config.js'; + +export const getStaticProps = async ({ locale }) => ({ + props: { + ...(await serverSideTranslations( + locale, + ['common', 'footer'], + nextI18NextConfig + )), + }, +}); +``` + +#### Client side loading of translations via HTTP + +Since [v11.0.0](https://github.com/i18next/next-i18next/releases/tag/v11.0.0) next-i18next also provides support for client side loading of translations. + +In some use cases, you might want to load a translation file dynamically without having to use `serverSideTranslations`. This can be especially useful for lazy-loaded components that you don't want slowing down pages. + +More information about that can be found [here](https://github.com/i18next/i18next-http-backend/tree/master/example/next). + +#### Reloading Resources in Development + +Because resources are loaded once when the server is started, any changes made to your translation JSON files in development will not be loaded until the server is restarted. + +In production this does not tend to be an issue, but in development you may want to see updates to your translation JSON files without having to restart your development server each time. To do this, set the `reloadOnPrerender` config option to `true`. + +This option will reload your translations whenever `serverSideTranslations` is called (in `getStaticProps` or `getServerSideProps`). If you are using `serverSideTranslations` in `getServerSideProps`, it is recommended to disable `reloadOnPrerender` in production environments as to avoid reloading resources on each server call. + +#### Options + +| Key | Default value | Note | +| ------------------- | -------------------- | -------------------------------------- | +| `defaultNS` | `'common'` | | +| `localePath` | `'./public/locales'` | Can be a function, see note below. | +| `localeExtension` | `'json'` | Ignored if `localePath` is a function. | +| `localeStructure` | `'{{lng}}/{{ns}}'` | Ignored if `localePath` is a function. | +| `reloadOnPrerender` | `false` | | +| `serializeConfig` | `true` | | +| `use` (for plugins) | `[]` | | +| `onPreInitI18next` | `undefined` | i.e. `(i18n) => i18n.on('failedLoading', handleFailedLoading)` | + +`localePath` as a function is of the form `(locale: string, namespace: string, missing: boolean) => string` returning the entire path including filename and extension. When `missing` is true, return the path for the `addPath` option of `i18next-fs-backend`, when false, return the path for the `loadPath` option. [More info at the `i18next-fs-backend` repo.](https://github.com/i18next/i18next-fs-backend/tree/master#backend-options) + +All other [i18next options](https://www.i18next.com/overview/configuration-options) and [react-i18next options](https://react.i18next.com/latest/i18next-instance) can be passed in as well. + + +#### Custom interpolation prefix/suffix + +By default, i18next uses `{{` as prefix and `}}` as suffix for [interpolation](https://www.i18next.com/translation-function/interpolation). +If you want/need to override these interpolation settings, you **must** also specify an alternative `localeStructure` setting that matches your custom prefix and suffix. + +For example, if you want to use `{` and `}` the config would look like this: + +```js +{ + i18n: { + defaultLocale: 'en', + locales: ['en', 'nl'], + }, + interpolation: { + prefix: '{', + suffix: '}', + }, + localeStructure: '{lng}/{ns}', +} +``` + +## Notes + +### Vercel and Netlify + +Some serverless PaaS may not be able to locate the path of your translations and require additional configuration. If you have filesystem issues using `serverSideTranslations`, set `config.localePath` to use `path.resolve`. An example can be [found here](https://github.com/i18next/next-i18next/issues/1552#issuecomment-981156476). + + +### Docker + +For Docker deployment, note that if you use the `Dockerfile` from [Next.js docs](https://nextjs.org/docs/deployment#docker-image) do not forget to copy `next.config.js` and `next-i18next.config.js` into the Docker image. + +``` +COPY --from=builder /app/next.config.js ./next.config.js +COPY --from=builder /app/next-i18next.config.js ./next-i18next.config.js +``` + +### Asynchronous i18next backends + +If you choose to use an i18next backend different to the built-in [i18next-fs-backend](https://github.com/i18next/i18next-fs-backend), you will need to ensure the translation resources are loaded before you call the `t` function. +Since [React suspense is not yet supported for SSR](https://github.com/i18next/next-i18next/issues/1255), this can be solved in 2 different ways: + +**1) Preload the namespaces:** + +Set the `ns` option, like in [this example](https://github.com/locize/next-i18next-locize/blob/main/next-i18next.config.js#L48). Doing this will ensure all translation resources are loaded on initialization. + +**2) Check the ready flag:** + +If you cannot or do not want to provide the `ns` array, calls to the `t` function will cause namespaces to be loaded on the fly. This means you'll need to handle the "not ready" state by checking `ready === true` or `props.tReady === true`. Not doing so will result in rendering your translations before they loaded, which will cause "save missing" be called despite the translations actually existing (just yet not loaded). +This can be done with the [useTranslation hook](https://react.i18next.com/latest/usetranslation-hook#not-using-suspense) or the [withTranslation HOC](https://react.i18next.com/latest/withtranslation-hoc#not-using-suspense). + + +### Static HTML Export SSG + +Are you trying to generate a [static HTML export](https://nextjs.org/docs/advanced-features/static-html-export) by executing `next export` and are getting this error? +>Error: i18n support is not compatible with next export. See here for more info on deploying: https://nextjs.org/docs/deployment + +But there's a way to workaround that with the help of [next-language-detector](https://github.com/i18next/next-language-detector). +Check out [this blog post](https://locize.com/blog/next-i18n-static/) and [this example project](./examples/ssg/). +[![](https://locize.com/blog/next-i18n-static/title.jpg)](https://locize.com/blog/next-i18n-static/) + +## Contributors + +Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): + + + + + + + + + + + + + + + + + + + + + +
Rob Capellini
Rob Capellini

💻 ⚠️
Alexander Kachkaev
Alexander Kachkaev

📢 💬 🤔 💻 ⚠️
Mathias Wøbbe
Mathias Wøbbe

💻 🤔 ⚠️
Lucas Feliciano
Lucas Feliciano

🤔 👀
Ryan Leung
Ryan Leung

💻
Nathan Friemel
Nathan Friemel

💻 📖 💡 🤔
Isaac Hinman
Isaac Hinman

️️️️♿️ 💬 🔊 📝 🐛 💼 💻 🖋 🔣 🎨 📖 📋 💡 💵 🔍 🤔 🚇 🚧 🧑‍🏫 📦 🔌 📆 🔬 👀 🛡️ 📢 ⚠️ 🔧 🌍 📓 📹
Adriano Raiano
Adriano Raiano

️️️️♿️ 💬 🔊 📝 🐛 💼 💻 🖋 🔣 🎨 📖 📋 💡 💵 🔍 🤔 🚇 🚧 🧑‍🏫 📦 🔌 📆 🔬 👀 🛡️ 📢 ⚠️ 🔧 🌍 📓 📹
Felix Mosheev
Felix Mosheev

💬 💻 📢 ⚠️
Sébastien Vanvelthem
Sébastien Vanvelthem

💻 📖 💡 🚧 📓
+ + + + + + +This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! + +--- + +

Gold Sponsors

+ +

+ + + + + + +

+ +--- + +**localization as a service - locize.com** + +Needing a translation management? Want to edit your translations with an InContext Editor? Use the original provided to you by the maintainers of i18next! + +![locize](https://locize.com/img/ads/github_locize.png) + +With using [locize](http://locize.com/?utm_source=next_i18next_readme&utm_medium=github) you directly support the future of i18next and next-i18next. + +--- diff --git a/packages/next-i18next/babel.config.json b/packages/next-i18next/babel.config.json new file mode 100644 index 00000000000..34a7bc1fc4d --- /dev/null +++ b/packages/next-i18next/babel.config.json @@ -0,0 +1,121 @@ +{ + "env": { + "es": { + "presets": [ + "@babel/preset-typescript", + [ + "@babel/env", + { + "modules": false, + "targets": { + "node": "current" + } + } + ], + [ + "@babel/preset-react" + ] + ] + }, + "cjs": { + "presets": [ + "@babel/preset-typescript", + [ + "@babel/preset-env", + { + "useBuiltIns": "usage", + "corejs": { + "version": 3 + } + } + ], + [ + "next/babel", + { + "transform-runtime": { + "corejs": false, + "helpers": true, + "regenerator": true, + "useESModules": false + } + } + ] + ], + "plugins": [ + "@babel/proposal-class-properties", + [ + "add-module-exports", + { + "addDefaultProperty": true + } + ] + ] + }, + "esm": { + "presets": [ + "@babel/preset-typescript", + [ + "@babel/preset-env", + { + "modules": false, + "targets": { + "browsers": [ + "last 2 versions", + "ie >= 11" + ] + } + } + ], + [ + "next/babel", + { + "transform-runtime": { + "corejs": false, + "helpers": true, + "regenerator": true, + "useESModules": false + }, + "preset-env": { + "modules": false + } + } + ] + ], + "plugins": [ + "@babel/proposal-class-properties", + [ + "add-module-exports", + { + "addDefaultProperty": true + } + ] + ] + }, + "test": { + "presets": [ + "@babel/preset-typescript", + [ + "@babel/env", + { + "targets": { + "node": "current" + }, + "modules": "commonjs" + } + ], + [ + "@babel/preset-react" + ] + ], + "plugins": [ + "@babel/proposal-class-properties", + [ + "add-module-exports", + { + "addDefaultProperty": true + } + ] + ] + } + } +} diff --git a/packages/next-i18next/dist/commonjs/appWithTranslation.client.test.js b/packages/next-i18next/dist/commonjs/appWithTranslation.client.test.js new file mode 100644 index 00000000000..b632eac24a6 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/appWithTranslation.client.test.js @@ -0,0 +1,295 @@ +"use strict"; + +require("core-js/modules/es.object.keys.js"); +require("core-js/modules/es.symbol.js"); +require("core-js/modules/es.array.filter.js"); +require("core-js/modules/es.object.to-string.js"); +require("core-js/modules/es.object.get-own-property-descriptor.js"); +require("core-js/modules/es.array.for-each.js"); +require("core-js/modules/web.dom-collections.for-each.js"); +require("core-js/modules/es.object.get-own-property-descriptors.js"); +require("core-js/modules/es.object.define-properties.js"); +require("core-js/modules/es.object.define-property.js"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); +var _react = _interopRequireDefault(require("react")); +var _fs = _interopRequireDefault(require("fs")); +var _react2 = require("@testing-library/react"); +var _reactI18next = require("react-i18next"); +var _createClient = _interopRequireDefault(require("./createClient")); +var _appWithTranslation = require("./appWithTranslation"); +var __jsx = _react["default"].createElement; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +jest.mock('fs', function () { + return { + existsSync: jest.fn(), + readdirSync: jest.fn() + }; +}); +var DummyI18nextProvider = function DummyI18nextProvider(_ref) { + var children = _ref.children; + return __jsx(_react["default"].Fragment, null, children); +}; +jest.mock('react-i18next', function () { + return { + I18nextProvider: jest.fn(), + __esmodule: true + }; +}); +jest.mock('./createClient', function () { + return jest.fn(); +}); +var DummyApp = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); +}, { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } +}); +var createProps = function createProps() { + var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en'; + var router = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return { + pageProps: { + _nextI18Next: { + initialLocale: locale, + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + } + } + }, + router: _objectSpread({ + locale: locale, + route: '/' + }, router) + }; +}; +var defaultRenderProps = createProps(); +var renderComponent = function renderComponent() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultRenderProps; + return (0, _react2.render)(__jsx(DummyApp, props)); +}; +describe('appWithTranslation', function () { + beforeEach(function () { + _fs["default"].existsSync.mockReturnValue(true); + _fs["default"].readdirSync.mockReturnValue([]); + _reactI18next.I18nextProvider.mockImplementation(DummyI18nextProvider); + var actualCreateClient = jest.requireActual('./createClient'); + _createClient["default"].mockImplementation(actualCreateClient); + }); + afterEach(jest.resetAllMocks); + it('returns children', function () { + renderComponent(); + expect(_react2.screen.getByText('Hello world')).toBeTruthy(); + }); + it('respects configOverride', function () { + var DummyAppConfigOverride = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); + }, { + configOverride: 'custom-value', + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en' + } + } + }); + (0, _react2.render)(__jsx(DummyAppConfigOverride, customProps)); + var _mock$calls = (0, _slicedToArray2["default"])(_reactI18next.I18nextProvider.mock.calls, 1), + args = _mock$calls[0]; + expect(_react2.screen.getByText('Hello world')).toBeTruthy(); + expect(args[0].i18n.options.configOverride).toBe('custom-value'); + }); + it('allows passing configOverride.resources', function () { + var DummyAppConfigOverride = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); + }, { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + }, + resources: { + xyz: { + custom: 'resources' + } + } + }); + (0, _react2.render)(__jsx(DummyAppConfigOverride, createProps())); + var _mock$calls2 = (0, _slicedToArray2["default"])(_reactI18next.I18nextProvider.mock.calls, 1), + args = _mock$calls2[0]; + expect(args[0].i18n.options.resources).toMatchObject({ + xyz: { + custom: 'resources' + } + }); + }); + it('throws an error if userConfig and configOverride are both missing', function () { + var DummyAppConfigOverride = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: null + } + } + }); + expect(function () { + return (0, _react2.render)(__jsx(DummyAppConfigOverride, customProps)); + }).toThrow('appWithTranslation was called without a next-i18next config'); + }); + it('throws an error if userConfig and configOverride are both missing an i18n property', function () { + var DummyAppConfigOverride = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); + }, {}); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: {} + } + } + }); + expect(function () { + return (0, _react2.render)(__jsx(DummyAppConfigOverride, customProps)); + }).toThrow('appWithTranslation was called without config.i18n'); + }); + it('throws an error if userConfig and configOverride are both missing a defaultLocale property', function () { + var DummyAppConfigOverride = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); + }, { + i18n: {} + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: {} + } + } + } + }); + expect(function () { + return (0, _react2.render)(__jsx(DummyAppConfigOverride, customProps)); + }).toThrow('config.i18n does not include a defaultLocale property'); + }); + it('should use the initialLocale property if the router locale is undefined', function () { + var DummyAppConfigOverride = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: { + defaultLocale: 'fr' + } + } + } + } + }); + customProps.router = _objectSpread(_objectSpread({}, customProps.router), {}, { + locale: undefined + }); + (0, _react2.render)(__jsx(DummyAppConfigOverride, customProps)); + var _mock$calls3 = (0, _slicedToArray2["default"])(_reactI18next.I18nextProvider.mock.calls, 1), + args = _mock$calls3[0]; + expect(args[0].i18n.language).toBe('en'); + }); + it('should use the userConfig defaltLocale property if the router locale is undefined and initialLocale is undefined', function () { + var DummyAppConfigOverride = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: undefined, + userConfig: { + i18n: { + defaultLocale: 'fr' + } + } + } + } + }); + customProps.router = _objectSpread(_objectSpread({}, customProps.router), {}, { + locale: undefined + }); + (0, _react2.render)(__jsx(DummyAppConfigOverride, customProps)); + var _mock$calls4 = (0, _slicedToArray2["default"])(_reactI18next.I18nextProvider.mock.calls, 1), + args = _mock$calls4[0]; + expect(args[0].i18n.language).toBe('fr'); + }); + it('returns an I18nextProvider', function () { + renderComponent(); + expect(_reactI18next.I18nextProvider).toHaveBeenCalledTimes(1); + var _mock$calls5 = (0, _slicedToArray2["default"])(_reactI18next.I18nextProvider.mock.calls, 1), + args = _mock$calls5[0]; + expect(_reactI18next.I18nextProvider).toHaveBeenCalledTimes(1); + expect(args).toHaveLength(2); + expect(args[0].children).toBeTruthy(); + expect(args[0].i18n.addResource).toBeTruthy(); + expect(args[0].i18n.language).toBe('en'); + expect(args[0].i18n.isInitialized).toBe(true); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(0); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(0); + }); + it('should use locale from router', function () { + renderComponent(createProps('de')); + var _mock$calls6 = (0, _slicedToArray2["default"])(_reactI18next.I18nextProvider.mock.calls, 1), + args = _mock$calls6[0]; + expect(args[0].i18n.language).toBe('de'); + }); + it('does not re-call createClient on re-renders unless locale or props have changed', function () { + var _renderComponent = renderComponent(), + rerender = _renderComponent.rerender; + expect(_createClient["default"]).toHaveBeenCalledTimes(1); + rerender(__jsx(DummyApp, defaultRenderProps)); + expect(_createClient["default"]).toHaveBeenCalledTimes(1); + var newProps = createProps(); + rerender(__jsx(DummyApp, newProps)); + expect(_createClient["default"]).toHaveBeenCalledTimes(2); + newProps.pageProps._nextI18Next.initialLocale = 'de'; + newProps.router.locale = 'de'; + rerender(__jsx(DummyApp, newProps)); + expect(_createClient["default"]).toHaveBeenCalledTimes(3); + }); + it('assures locale key is set to the right value', function () { + var lng = 'de'; + var props = createProps('de'); + var DummyAppWithVar = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "language is: ", lng); + }, { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + }); + var _render = (0, _react2.render)(__jsx(DummyAppWithVar, props)), + rerender = _render.rerender; + props.router.locale = 'en'; + props.pageProps._nextI18Next.initialLocale = 'en'; + lng = 'en'; + rerender(__jsx(DummyAppWithVar, props)); + expect(_react2.screen.getByText("language is: ".concat(lng))).toBeTruthy(); + props.router.locale = 'de'; + props.pageProps._nextI18Next.initialLocale = 'de'; + lng = 'de'; + rerender(__jsx(DummyAppWithVar, createProps('de'))); + expect(_react2.screen.getByText("language is: ".concat(lng))).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/appWithTranslation.js b/packages/next-i18next/dist/commonjs/appWithTranslation.js new file mode 100644 index 00000000000..9e32c620171 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/appWithTranslation.js @@ -0,0 +1,102 @@ +"use strict"; + +require("core-js/modules/es.object.keys.js"); +require("core-js/modules/es.symbol.js"); +require("core-js/modules/es.array.filter.js"); +require("core-js/modules/es.object.to-string.js"); +require("core-js/modules/es.object.get-own-property-descriptor.js"); +require("core-js/modules/es.array.for-each.js"); +require("core-js/modules/web.dom-collections.for-each.js"); +require("core-js/modules/es.object.get-own-property-descriptors.js"); +require("core-js/modules/es.object.define-properties.js"); +require("core-js/modules/es.object.define-property.js"); +require("core-js/modules/es.array.iterator.js"); +require("core-js/modules/es.string.iterator.js"); +require("core-js/modules/es.weak-map.js"); +require("core-js/modules/web.dom-collections.iterator.js"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +var _typeof = require("@babel/runtime/helpers/typeof"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Trans", { + enumerable: true, + get: function get() { + return _reactI18next.Trans; + } +}); +exports.globalI18n = exports.appWithTranslation = void 0; +Object.defineProperty(exports, "useTranslation", { + enumerable: true, + get: function get() { + return _reactI18next.useTranslation; + } +}); +Object.defineProperty(exports, "withTranslation", { + enumerable: true, + get: function get() { + return _reactI18next.withTranslation; + } +}); +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); +var _react = _interopRequireWildcard(require("react")); +var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics")); +var _reactI18next = require("react-i18next"); +var _createConfig = require("./config/createConfig"); +var _createClient = _interopRequireDefault(require("./createClient")); +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +var __jsx = _react["default"].createElement; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +var globalI18n = null; +exports.globalI18n = globalI18n; +var appWithTranslation = function appWithTranslation(WrappedComponent) { + var configOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var AppWithTranslation = function AppWithTranslation(props) { + var _nextI18Next$initialL, _props$router; + var _nextI18Next = props.pageProps._nextI18Next; + var locale = (_nextI18Next$initialL = _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.initialLocale) !== null && _nextI18Next$initialL !== void 0 ? _nextI18Next$initialL : props === null || props === void 0 ? void 0 : (_props$router = props.router) === null || _props$router === void 0 ? void 0 : _props$router.locale; + var ns = _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.ns; + + // Memoize the instance and only re-initialize when either: + // 1. The route changes (non-shallowly) + // 2. Router locale changes + // 3. UserConfig override changes + var i18n = (0, _react.useMemo)(function () { + var _userConfig$i18n; + if (!_nextI18Next && !configOverride) return null; + var userConfig = configOverride !== null && configOverride !== void 0 ? configOverride : _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.userConfig; + if (!userConfig) { + throw new Error('appWithTranslation was called without a next-i18next config'); + } + if (!(userConfig !== null && userConfig !== void 0 && userConfig.i18n)) { + throw new Error('appWithTranslation was called without config.i18n'); + } + if (!(userConfig !== null && userConfig !== void 0 && (_userConfig$i18n = userConfig.i18n) !== null && _userConfig$i18n !== void 0 && _userConfig$i18n.defaultLocale)) { + throw new Error('config.i18n does not include a defaultLocale property'); + } + var _ref = _nextI18Next || {}, + initialI18nStore = _ref.initialI18nStore; + var resources = configOverride !== null && configOverride !== void 0 && configOverride.resources ? configOverride.resources : initialI18nStore; + if (!locale) locale = userConfig.i18n.defaultLocale; + var instance = (0, _createClient["default"])(_objectSpread(_objectSpread({}, (0, _createConfig.createConfig)(_objectSpread(_objectSpread({}, userConfig), {}, { + lng: locale + }))), {}, { + lng: locale, + ns: ns, + resources: resources + })).i18n; + exports.globalI18n = globalI18n = instance; + return instance; + }, [_nextI18Next, locale, configOverride, ns]); + return i18n !== null ? __jsx(_reactI18next.I18nextProvider, { + i18n: i18n + }, __jsx(WrappedComponent, props)) : __jsx(WrappedComponent, (0, _extends2["default"])({ + key: locale + }, props)); + }; + return (0, _hoistNonReactStatics["default"])(AppWithTranslation, WrappedComponent); +}; +exports.appWithTranslation = appWithTranslation; \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/appWithTranslation.server.test.js b/packages/next-i18next/dist/commonjs/appWithTranslation.server.test.js new file mode 100644 index 00000000000..d09057598e2 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/appWithTranslation.server.test.js @@ -0,0 +1,76 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); +var _react = _interopRequireDefault(require("react")); +var _fs = _interopRequireDefault(require("fs")); +var _reactI18next = require("react-i18next"); +var _server = require("react-dom/server"); +var _appWithTranslation = require("./appWithTranslation"); +var __jsx = _react["default"].createElement; +jest.mock('fs', function () { + return { + existsSync: jest.fn(), + readdirSync: jest.fn() + }; +}); +var DummyI18nextProvider = function DummyI18nextProvider(_ref) { + var children = _ref.children; + return __jsx(_react["default"].Fragment, null, children); +}; +jest.mock('react-i18next', function () { + return { + I18nextProvider: jest.fn(), + __esmodule: true + }; +}); +var MyApp = function MyApp(_ref2) { + var Component = _ref2.Component, + pageProps = _ref2.pageProps; + Component; + pageProps; + return __jsx("div", null, "Hello world"); +}; +var DummyApp = (0, _appWithTranslation.appWithTranslation)(MyApp); +var props = { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr'] + } + } + } + }, + router: { + locale: 'en', + route: '/' + } +}; +var renderComponent = function renderComponent() { + return (0, _server.renderToString)(__jsx(DummyApp, props)); +}; +describe('appWithTranslation', function () { + beforeEach(function () { + _fs["default"].existsSync.mockReturnValue(true); + _fs["default"].readdirSync.mockReturnValue([]); + _reactI18next.I18nextProvider.mockImplementation(DummyI18nextProvider); + }); + afterEach(jest.resetAllMocks); + it('returns an I18nextProvider', function () { + renderComponent(); + expect(_reactI18next.I18nextProvider).toHaveBeenCalledTimes(1); + var _mock$calls = (0, _slicedToArray2["default"])(_reactI18next.I18nextProvider.mock.calls, 1), + args = _mock$calls[0]; + expect(_reactI18next.I18nextProvider).toHaveBeenCalledTimes(1); + expect(args).toHaveLength(2); + expect(args[0].children).toBeTruthy(); + expect(args[0].i18n.addResource).toBeTruthy(); + expect(args[0].i18n.language).toBe('en'); + expect(args[0].i18n.isInitialized).toBe(true); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(3); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(1); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/config/createConfig.js b/packages/next-i18next/dist/commonjs/config/createConfig.js new file mode 100644 index 00000000000..f64c8ad8e84 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/config/createConfig.js @@ -0,0 +1,271 @@ +"use strict"; + +require("core-js/modules/es.object.keys.js"); +require("core-js/modules/es.symbol.js"); +require("core-js/modules/es.object.get-own-property-descriptor.js"); +require("core-js/modules/web.dom-collections.for-each.js"); +require("core-js/modules/es.object.get-own-property-descriptors.js"); +require("core-js/modules/es.object.define-properties.js"); +require("core-js/modules/es.object.define-property.js"); +require("core-js/modules/es.array.slice.js"); +require("core-js/modules/es.function.name.js"); +require("core-js/modules/es.array.from.js"); +require("core-js/modules/es.string.iterator.js"); +require("core-js/modules/es.symbol.description.js"); +require("core-js/modules/es.symbol.iterator.js"); +require("core-js/modules/es.array.iterator.js"); +require("core-js/modules/web.dom-collections.iterator.js"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.createConfig = void 0; +require("core-js/modules/es.array.filter.js"); +require("core-js/modules/es.object.to-string.js"); +require("core-js/modules/es.regexp.exec.js"); +require("core-js/modules/es.string.split.js"); +require("core-js/modules/es.array.reduce.js"); +require("core-js/modules/es.array.includes.js"); +require("core-js/modules/es.string.includes.js"); +require("core-js/modules/es.array.is-array.js"); +require("core-js/modules/es.object.entries.js"); +require("core-js/modules/es.array.concat.js"); +require("core-js/modules/es.array.some.js"); +require("core-js/modules/es.string.replace.js"); +require("core-js/modules/es.array.join.js"); +require("core-js/modules/es.array.map.js"); +require("core-js/modules/es.array.for-each.js"); +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); +var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); +var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); +var _defaultConfig = require("./defaultConfig"); +var _utils = require("../utils"); +var _excluded = ["i18n"], + _excluded2 = ["i18n"]; +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +var deepMergeObjects = ['backend', 'detection']; +var createConfig = function createConfig(userConfig) { + var _userConfig$use; + if (typeof (userConfig === null || userConfig === void 0 ? void 0 : userConfig.lng) !== 'string') { + throw new Error('config.lng was not passed into createConfig'); + } + + // + // Initial merge of default and user-provided config + // + var userI18n = userConfig.i18n, + userConfigStripped = (0, _objectWithoutProperties2["default"])(userConfig, _excluded); + var defaultI18n = _defaultConfig.defaultConfig.i18n, + defaultConfigStripped = (0, _objectWithoutProperties2["default"])(_defaultConfig.defaultConfig, _excluded2); + var combinedConfig = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultConfigStripped), userConfigStripped), defaultI18n), userI18n); + var defaultNS = combinedConfig.defaultNS, + lng = combinedConfig.lng, + localeExtension = combinedConfig.localeExtension, + localePath = combinedConfig.localePath, + localeStructure = combinedConfig.localeStructure, + nonExplicitSupportedLngs = combinedConfig.nonExplicitSupportedLngs; + var locales = combinedConfig.locales.filter(function (l) { + return l !== 'default'; + }); + + /** + * Skips translation file resolution while in cimode + * https://github.com/i18next/next-i18next/pull/851#discussion_r503113620 + */ + if (lng === 'cimode') { + return combinedConfig; + } + if (typeof combinedConfig.fallbackLng === 'undefined') { + combinedConfig.fallbackLng = combinedConfig.defaultLocale; + if (combinedConfig.fallbackLng === 'default') { + var _locales = (0, _slicedToArray2["default"])(locales, 1); + combinedConfig.fallbackLng = _locales[0]; + } + } + var fallbackLng = combinedConfig.fallbackLng; + if (nonExplicitSupportedLngs) { + var createFallbackObject = function createFallbackObject(acc, l) { + var _l$split = l.split('-'), + _l$split2 = (0, _slicedToArray2["default"])(_l$split, 1), + locale = _l$split2[0]; + acc[l] = [locale]; + return acc; + }; + if (typeof fallbackLng === 'string') { + combinedConfig.fallbackLng = combinedConfig.locales.filter(function (l) { + return l.includes('-'); + }).reduce(createFallbackObject, { + "default": [fallbackLng] + }); + } else if (Array.isArray(fallbackLng)) { + combinedConfig.fallbackLng = combinedConfig.locales.filter(function (l) { + return l.includes('-'); + }).reduce(createFallbackObject, { + "default": fallbackLng + }); + } else if ((0, _typeof2["default"])(fallbackLng) === 'object') { + combinedConfig.fallbackLng = Object.entries(combinedConfig.fallbackLng).reduce(function (acc, _ref) { + var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), + l = _ref2[0], + f = _ref2[1]; + acc[l] = l.includes('-') ? (0, _utils.unique)([l.split('-')[0]].concat((0, _toConsumableArray2["default"])(f))) : f; + return acc; + }, fallbackLng); + } else if (typeof fallbackLng === 'function') { + throw new Error('If nonExplicitSupportedLngs is true, no functions are allowed for fallbackLng'); + } + } + var hasCustomBackend = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$use = userConfig.use) === null || _userConfig$use === void 0 ? void 0 : _userConfig$use.some(function (b) { + return b.type === 'backend'; + }); + if (!process.browser && typeof window === 'undefined') { + combinedConfig.preload = locales; + if (!hasCustomBackend) { + var fs = require('fs'); + var path = require('path'); + + // + // Validate defaultNS + // https://github.com/i18next/next-i18next/issues/358 + // + if (typeof defaultNS === 'string' && typeof lng !== 'undefined') { + if (typeof localePath === 'string') { + var _userConfig$interpola, _userConfig$interpola2, _userConfig$interpola3, _userConfig$interpola4; + var prefix = (_userConfig$interpola = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola2 = userConfig.interpolation) === null || _userConfig$interpola2 === void 0 ? void 0 : _userConfig$interpola2.prefix) !== null && _userConfig$interpola !== void 0 ? _userConfig$interpola : '{{'; + var suffix = (_userConfig$interpola3 = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola4 = userConfig.interpolation) === null || _userConfig$interpola4 === void 0 ? void 0 : _userConfig$interpola4.suffix) !== null && _userConfig$interpola3 !== void 0 ? _userConfig$interpola3 : '}}'; + var defaultLocaleStructure = localeStructure.replace("".concat(prefix, "lng").concat(suffix), lng).replace("".concat(prefix, "ns").concat(suffix), defaultNS); + var defaultFile = "/".concat(defaultLocaleStructure, ".").concat(localeExtension); + var defaultNSPath = path.join(localePath, defaultFile); + var defaultNSExists = fs.existsSync(defaultNSPath); + var fallback = (0, _utils.getFallbackForLng)(lng, combinedConfig.fallbackLng); + var defaultFallbackNSExists = fallback.some(function (f) { + var fallbackFile = defaultFile.replace(lng, f); + var defaultNSPath = path.join(localePath, fallbackFile); + return fs.existsSync(defaultNSPath); + }); + if (!defaultNSExists && !defaultFallbackNSExists && process.env.NODE_ENV !== 'production') { + throw new Error("Default namespace not found at ".concat(defaultNSPath)); + } + } else if (typeof localePath === 'function') { + var _defaultNSPath = localePath(lng, defaultNS, false); + var _defaultNSExists = fs.existsSync(_defaultNSPath); + var _fallback = (0, _utils.getFallbackForLng)(lng, combinedConfig.fallbackLng); + var _defaultFallbackNSExists = _fallback.some(function (f) { + var defaultNSPath = localePath(f, defaultNS, false); + return fs.existsSync(defaultNSPath); + }); + if (!_defaultNSExists && !_defaultFallbackNSExists && process.env.NODE_ENV !== 'production') { + throw new Error("Default namespace not found at ".concat(_defaultNSPath)); + } + } + } + + // + // Set server side backend + // + if (typeof localePath === 'string') { + combinedConfig.backend = { + addPath: path.resolve(process.cwd(), "".concat(localePath, "/").concat(localeStructure, ".missing.").concat(localeExtension)), + loadPath: path.resolve(process.cwd(), "".concat(localePath, "/").concat(localeStructure, ".").concat(localeExtension)) + }; + } else if (typeof localePath === 'function') { + combinedConfig.backend = { + addPath: function addPath(locale, namespace) { + return localePath(locale, namespace, true); + }, + loadPath: function loadPath(locale, namespace) { + return localePath(locale, namespace, false); + } + }; + } else { + throw new Error("Unsupported localePath type: ".concat((0, _typeof2["default"])(localePath))); + } + + // + // Set server side preload (namespaces) + // + if (!combinedConfig.ns && typeof lng !== 'undefined') { + if (typeof localePath === 'function') { + throw new Error('Must provide all namespaces in ns option if using a function as localePath'); + } + var getNamespaces = function getNamespaces(locales) { + var getLocaleNamespaces = function getLocaleNamespaces(p) { + var ret = []; + if (!fs.existsSync(p)) return ret; + fs.readdirSync(p).map(function (file) { + var joinedP = path.join(p, file); + if (fs.statSync(joinedP).isDirectory()) { + var subRet = getLocaleNamespaces(joinedP).map(function (n) { + return "".concat(file, "/").concat(n); + }); + ret = ret.concat(subRet); + return; + } + ret.push(file.replace(".".concat(localeExtension), '')); + }); + return ret; + }; + var namespacesByLocale = locales.map(function (locale) { + return getLocaleNamespaces(path.resolve(process.cwd(), "".concat(localePath, "/").concat(locale))); + }); + var allNamespaces = []; + var _iterator = _createForOfIteratorHelper(namespacesByLocale), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var localNamespaces = _step.value; + allNamespaces.push.apply(allNamespaces, (0, _toConsumableArray2["default"])(localNamespaces)); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return (0, _utils.unique)(allNamespaces); + }; + combinedConfig.ns = getNamespaces((0, _utils.unique)([lng].concat((0, _toConsumableArray2["default"])((0, _utils.getFallbackForLng)(lng, combinedConfig.fallbackLng))))); + } + } + } else { + // + // Set client side backend, if there is no custom backend + // + if (!hasCustomBackend) { + if (typeof localePath === 'string') { + combinedConfig.backend = { + addPath: "".concat(localePath, "/").concat(localeStructure, ".missing.").concat(localeExtension), + loadPath: "".concat(localePath, "/").concat(localeStructure, ".").concat(localeExtension) + }; + } else if (typeof localePath === 'function') { + combinedConfig.backend = { + addPath: function addPath(locale, namespace) { + return localePath(locale, namespace, true); + }, + loadPath: function loadPath(locale, namespace) { + return localePath(locale, namespace, false); + } + }; + } + } + if (typeof combinedConfig.ns !== 'string' && !Array.isArray(combinedConfig.ns)) { + combinedConfig.ns = [defaultNS]; + } + } + + // + // Deep merge with overwrite - goes last + // + deepMergeObjects.forEach(function (obj) { + if (userConfig[obj]) { + combinedConfig[obj] = _objectSpread(_objectSpread({}, combinedConfig[obj]), userConfig[obj]); + } + }); + return combinedConfig; +}; +exports.createConfig = createConfig; \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/config/createConfig.test.js b/packages/next-i18next/dist/commonjs/config/createConfig.test.js new file mode 100644 index 00000000000..a945786b268 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/config/createConfig.test.js @@ -0,0 +1,491 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); +require("core-js/modules/es.object.assign.js"); +require("core-js/modules/es.regexp.exec.js"); +require("core-js/modules/es.string.split.js"); +require("core-js/modules/es.array.join.js"); +require("core-js/modules/es.function.bind.js"); +require("core-js/modules/es.array.concat.js"); +var _fs = _interopRequireDefault(require("fs")); +var _path = _interopRequireDefault(require("path")); +var _createConfig = require("./createConfig"); +jest.mock('fs', function () { + return { + existsSync: jest.fn(), + readdirSync: jest.fn(), + statSync: jest.fn() + }; +}); +describe('createConfig', function () { + /** + * @jest-environment node + */ + describe('server side', function () { + beforeAll(function () { + Object.assign(process, { + browser: false + }); + delete global.window; + }); + describe('when filesystem is as expected', function () { + beforeAll(function () { + _fs["default"].existsSync.mockReturnValue(true); + _fs["default"].readdirSync.mockImplementation(function (locale) { + return ["namespace-of-".concat(locale.split('/').pop())]; + }); + // eslint-disable-next-line max-len + _fs["default"].statSync.mockImplementation(function () { + return { + isDirectory: function isDirectory() { + return false; + } + }; + }); + }); + it('throws when lng is not provided', function () { + expect(_createConfig.createConfig).toThrow('config.lng was not passed into createConfig'); + }); + it('returns a valid config when only lng is provided', function () { + var _config$react, _config$interpolation, _config$interpolation2; + var config = (0, _createConfig.createConfig)({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/public/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/public/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['namespace-of-en']); + expect(config.preload).toEqual(['en']); + expect(config.use).toEqual([]); + expect((_config$react = config.react) === null || _config$react === void 0 ? void 0 : _config$react.useSuspense).toBe(false); + expect((_config$interpolation = config.interpolation) === null || _config$interpolation === void 0 ? void 0 : _config$interpolation.escapeValue).toBe(false); + expect((_config$interpolation2 = config.interpolation) === null || _config$interpolation2 === void 0 ? void 0 : _config$interpolation2.format).toBeUndefined(); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(3); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(1); + }); + it('gets namespaces from current language + fallback (as string) when ns is not provided', function () { + var config = (0, _createConfig.createConfig)({ + fallbackLng: 'en', + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en']); + }); + it('gets namespaces from current language + fallback (as array) when ns is not provided', function () { + var config = (0, _createConfig.createConfig)({ + fallbackLng: ['en', 'fr'], + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + }); + it('gets namespaces from current language + fallback (as object) when ns is not provided', function () { + var fallbackLng = { + "default": ['fr'], + 'en-US': ['en'] + }; + var config = (0, _createConfig.createConfig)({ + fallbackLng: fallbackLng, + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + }); + it('deep merges backend', function () { + var config = (0, _createConfig.createConfig)({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en' + }); + expect(config.backend.hello).toBe('world'); + expect(config.backend.loadPath).toEqual(_path["default"].join(process.cwd(), '/public/locales/{{lng}}/{{ns}}.json')); + }); + it('deep merges detection', function () { + var config = (0, _createConfig.createConfig)({ + detection: { + hello: 'world' + }, + lng: 'en' + }); + expect(config.detection.hello).toBe('world'); + }); + describe('fallbackLng', function () { + it('automatically sets if it user does not provide', function () { + var config = (0, _createConfig.createConfig)({ + lng: 'en' + }); + expect(config.fallbackLng).toBe('en'); + }); + it('does not overwrite user provided value', function () { + var config = (0, _createConfig.createConfig)({ + fallbackLng: 'hello-world', + lng: 'en' + }); + expect(config.fallbackLng).toBe('hello-world'); + }); + it('does not overwrite user provided boolean', function () { + var config = (0, _createConfig.createConfig)({ + fallbackLng: false, + lng: 'en' + }); + expect(config.fallbackLng).toBe(false); + }); + }); + }); + describe('defaultNS validation', function () { + it('when filesystem is missing defaultNS throws an error', function () { + _fs["default"].existsSync.mockReset(); + _fs["default"].existsSync.mockReturnValueOnce(false); + var config = _createConfig.createConfig.bind(null, { + lng: 'en' + }); + expect(config).toThrow('Default namespace not found at public/locales/en/common.json'); + }); + it('does not throw an error if fallback exists', function () { + _fs["default"].existsSync.mockReset(); + _fs["default"].existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + var config = (0, _createConfig.createConfig)({ + fallbackLng: { + 'en-US': ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect(config.fallbackLng).toStrictEqual({ + 'en-US': ['en'] + }); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw error if fallbackLng has default key and it exists', function () { + _fs["default"].existsSync.mockReset(); + _fs["default"].existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + (0, _createConfig.createConfig)({ + fallbackLng: { + "default": ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw an error if fallback (as function) exists', function () { + _fs["default"].existsSync.mockReset(); + _fs["default"].existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + var config = (0, _createConfig.createConfig)({ + fallbackLng: function fallbackLng(code) { + return code.split('-')[0]; + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect((0, _typeof2["default"])(config.fallbackLng)).toBe('function'); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw an error if nonExplicitSupportedLngs is true', function () { + _fs["default"].existsSync.mockReset(); + _fs["default"].existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + var config = (0, _createConfig.createConfig)({ + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + }, + lng: 'en-US', + nonExplicitSupportedLngs: true + }); + expect((0, _typeof2["default"])(config.nonExplicitSupportedLngs)).toBe('boolean'); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(5); + }); + it('uses user provided prefix/suffix with localeStructure', function () { + _fs["default"].existsSync.mockReset(); + _fs["default"].existsSync.mockReturnValueOnce(false); + var config = _createConfig.createConfig.bind(null, { + interpolation: { + prefix: '^^', + suffix: '$$' + }, + lng: 'en', + localeStructure: '^^lng$$/^^ns$$' + }); + expect(config).toThrow('Default namespace not found at public/locales/en/common.json'); + expect(_fs["default"].existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + }); + }); + describe('hasCustomBackend', function () { + it('returns a config without calling any fs methods', function () { + _fs["default"].existsSync.mockReset(); + _fs["default"].readdirSync.mockReset(); + (0, _createConfig.createConfig)({ + lng: 'en', + use: [{ + type: 'backend' + }] + }); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(0); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(0); + }); + }); + describe('ci mode', function () { + it('returns a config without calling any fs methods', function () { + (0, _createConfig.createConfig)({ + lng: 'cimode' + }); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(0); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(0); + }); + }); + describe('with a function for localePath', function () { + var localePathFn = function localePathFn(locale, namespace, missing) { + return "".concat(missing, "/").concat(namespace, "/").concat(locale, ".json"); + }; + it('returns a config whose localePath works as expected', function () { + _fs["default"].existsSync.mockReturnValueOnce(true); + var config = (0, _createConfig.createConfig)({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn, + ns: ['common'] + }); + expect(config.backend.loadPath('en', 'common')).toBe('false/common/en.json'); + expect(config.backend.addPath('en', 'common')).toBe('true/common/en.json'); + }); + it('when filesystem is missing defaultNS throws an error', function () { + _fs["default"].existsSync.mockReturnValueOnce(false); + var config = _createConfig.createConfig.bind(null, { + lng: 'en', + localePath: localePathFn + }); + expect(config).toThrow('Default namespace not found at false/common/en.json'); + }); + it('throws an error if namespaces are not provided', function () { + _fs["default"].existsSync.mockReturnValueOnce(true); + expect(function () { + return (0, _createConfig.createConfig)({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn + }); + }).toThrow('Must provide all namespaces in ns option if using a function as localePath'); + }); + }); + describe('with default as locale', function () { + beforeAll(function () { + _fs["default"].existsSync.mockReturnValue(true); + _fs["default"].readdirSync.mockImplementation(function (locale) { + return ["namespace-of-".concat(locale.split('/').pop())]; + }); + // eslint-disable-next-line max-len + _fs["default"].statSync.mockImplementation(function () { + return { + isDirectory: function isDirectory() { + return false; + } + }; + }); + }); + // eslint-disable-next-line max-len + // https://nextjs.org/docs/advanced-features/i18n-routing#prefixing-the-default-locale + it('should ignore the default value', function () { + var config = (0, _createConfig.createConfig)({ + i18n: { + defaultLocale: 'default', + locales: ['default', 'en', 'de'] + }, + lng: 'de' + }); + expect(config.fallbackLng).toBe('en'); + expect(config.preload).toEqual(['en', 'de']); + }); + }); + describe('when filesystem contains nested namespace structure', function () { + beforeAll(function () { + _fs["default"].existsSync.mockReset(); + _fs["default"].readdirSync.mockReset(); + _fs["default"].statSync.mockReset(); + _fs["default"].existsSync.mockReturnValue(true); + var level = 0; + _fs["default"].readdirSync.mockImplementation(function (locale) { + return level === 0 ? ['sub-folder'] : ["namespace-of-".concat(locale.split('/').pop())]; + }); + // eslint-disable-next-line max-len + _fs["default"].statSync.mockImplementation(function () { + return { + isDirectory: function isDirectory() { + return ++level > 1 ? false : true; + } + }; + }); + }); + it('returns a valid config', function () { + var _config$react2, _config$interpolation3, _config$interpolation4; + var config = (0, _createConfig.createConfig)({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/public/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/public/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['sub-folder/namespace-of-sub-folder']); + expect(config.preload).toEqual(['en']); + expect(config.use).toEqual([]); + expect((_config$react2 = config.react) === null || _config$react2 === void 0 ? void 0 : _config$react2.useSuspense).toBe(false); + expect((_config$interpolation3 = config.interpolation) === null || _config$interpolation3 === void 0 ? void 0 : _config$interpolation3.escapeValue).toBe(false); + expect((_config$interpolation4 = config.interpolation) === null || _config$interpolation4 === void 0 ? void 0 : _config$interpolation4.format).toBeUndefined(); + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(4); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(2); + expect(_fs["default"].statSync).toHaveBeenCalledTimes(2); + }); + }); + }); + + /** + * @jest-environment jsdom + */ + describe('client side', function () { + beforeAll(function () { + Object.assign(process, { + browser: true + }); + global.window = {}; + }); + it('throws when lng is not provided', function () { + expect(_createConfig.createConfig).toThrow('config.lng was not passed into createConfig'); + }); + it('returns a valid config when only lng is provided', function () { + var _config$react3, _config$interpolation5, _config$interpolation6; + var config = (0, _createConfig.createConfig)({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['common']); + expect(config.preload).toBeUndefined(); + expect(config.use).toEqual([]); + expect((_config$react3 = config.react) === null || _config$react3 === void 0 ? void 0 : _config$react3.useSuspense).toBe(false); + expect((_config$interpolation5 = config.interpolation) === null || _config$interpolation5 === void 0 ? void 0 : _config$interpolation5.escapeValue).toBe(false); + expect((_config$interpolation6 = config.interpolation) === null || _config$interpolation6 === void 0 ? void 0 : _config$interpolation6.format).toBeUndefined(); + }); + it('deep merges backend', function () { + var config = (0, _createConfig.createConfig)({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en' + }); + expect(config.backend.hello).toBe('world'); + expect(config.backend.loadPath).toMatch('/locales/{{lng}}/{{ns}}.json'); + }); + it('returns ns as [defaultNS]', function () { + var config = (0, _createConfig.createConfig)({ + defaultNS: 'core', + lng: 'en' + }); + expect(config.ns).toEqual(['core']); + }); + it('returns ns when provided as a string', function () { + var config = (0, _createConfig.createConfig)({ + lng: 'en', + ns: 'core' + }); + expect(config.ns).toBe('core'); + }); + it('returns ns when provided as an array', function () { + var config = (0, _createConfig.createConfig)({ + lng: 'en', + ns: ['core', 'page'] + }); + expect(config.ns).toEqual(['core', 'page']); + }); + describe('hasCustomBackend', function () { + it('returns the correct configuration', function () { + var config = (0, _createConfig.createConfig)({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + use: [{ + type: 'backend' + }] + }); + expect(config.backend).toEqual({ + hello: 'world' + }); + }); + }); + describe('with a function for localePath', function () { + var localePathFn = function localePathFn(locale, namespace, missing) { + return "".concat(missing, "/").concat(namespace, "/").concat(locale, ".json"); + }; + it('returns a config whose localePath works as expected', function () { + var config = (0, _createConfig.createConfig)({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn, + ns: ['common'] + }); + expect(config.backend.loadPath('en', 'common')).toBe('false/common/en.json'); + expect(config.backend.addPath('en', 'common')).toBe('true/common/en.json'); + }); + }); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/config/defaultConfig.js b/packages/next-i18next/dist/commonjs/config/defaultConfig.js new file mode 100644 index 00000000000..d92c5993b9f --- /dev/null +++ b/packages/next-i18next/dist/commonjs/config/defaultConfig.js @@ -0,0 +1,38 @@ +"use strict"; + +require("core-js/modules/es.object.define-property.js"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.defaultConfig = void 0; +var DEFAULT_LOCALE = 'en'; +var LOCALES = ['en']; +var DEFAULT_NAMESPACE = 'common'; +var LOCALE_PATH = './public/locales'; +var LOCALE_STRUCTURE = '{{lng}}/{{ns}}'; +var LOCALE_EXTENSION = 'json'; +var defaultConfig = { + defaultNS: DEFAULT_NAMESPACE, + errorStackTraceLimit: 0, + i18n: { + defaultLocale: DEFAULT_LOCALE, + locales: LOCALES + }, + get initImmediate() { + return process.browser && typeof window !== 'undefined'; + }, + interpolation: { + escapeValue: false + }, + load: 'currentOnly', + localeExtension: LOCALE_EXTENSION, + localePath: LOCALE_PATH, + localeStructure: LOCALE_STRUCTURE, + react: { + useSuspense: false + }, + reloadOnPrerender: false, + serializeConfig: true, + use: [] +}; +exports.defaultConfig = defaultConfig; \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/createClient/browser.js b/packages/next-i18next/dist/commonjs/createClient/browser.js new file mode 100644 index 00000000000..a757ccf1e10 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/createClient/browser.js @@ -0,0 +1,37 @@ +"use strict"; + +require("core-js/modules/es.object.define-property.js"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +require("core-js/modules/es.array.for-each.js"); +require("core-js/modules/es.object.to-string.js"); +require("core-js/modules/web.dom-collections.for-each.js"); +require("core-js/modules/es.promise.js"); +var _i18next = _interopRequireDefault(require("i18next")); +var _default = function _default(config) { + if (config.ns === undefined) config.ns = []; + var instance = _i18next["default"].createInstance(config); + var initPromise; + if (!instance.isInitialized) { + var _config$use; + config === null || config === void 0 ? void 0 : (_config$use = config.use) === null || _config$use === void 0 ? void 0 : _config$use.forEach(function (x) { + return instance.use(x); + }); + if (typeof config.onPreInitI18next === 'function') { + config.onPreInitI18next(instance); + } + initPromise = instance.init(config); + } else { + initPromise = Promise.resolve(_i18next["default"].t); + } + return { + i18n: instance, + initPromise: initPromise + }; +}; +exports["default"] = _default; +module.exports = exports.default; +module.exports.default = exports.default; \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/createClient/browser.test.js b/packages/next-i18next/dist/commonjs/createClient/browser.test.js new file mode 100644 index 00000000000..90b52ee38a4 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/createClient/browser.test.js @@ -0,0 +1,32 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); +var _browser = _interopRequireDefault(require("./browser")); +/** + * @jest-environment jsdom + */ + +var onPreInitI18nextCalled; +var config = { + defaultLocale: 'en', + locales: ['en', 'de'], + onPreInitI18next: function onPreInitI18next(i18n) { + onPreInitI18nextCalled = i18n; + }, + use: [] +}; +describe('createClientBrowser', function () { + beforeEach(function () { + onPreInitI18nextCalled = null; + }); + it('returns a browser client', function () { + var client = (0, _browser["default"])(config); + expect((0, _typeof2["default"])(client.initPromise.then)).toBe('function'); + expect((0, _typeof2["default"])(client.i18n.addResource)).toBe('function'); + expect((0, _typeof2["default"])(client.i18n.translator)).toBe('object'); + expect(client.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(client.i18n.options.locales).toEqual(config.locales); + expect(onPreInitI18nextCalled).toEqual(client.i18n); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/createClient/node.js b/packages/next-i18next/dist/commonjs/createClient/node.js new file mode 100644 index 00000000000..0105da8db92 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/createClient/node.js @@ -0,0 +1,63 @@ +"use strict"; + +require("core-js/modules/es.object.keys.js"); +require("core-js/modules/es.symbol.js"); +require("core-js/modules/es.array.filter.js"); +require("core-js/modules/es.object.get-own-property-descriptor.js"); +require("core-js/modules/es.object.get-own-property-descriptors.js"); +require("core-js/modules/es.object.define-properties.js"); +require("core-js/modules/es.object.define-property.js"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +require("core-js/modules/es.array.some.js"); +require("core-js/modules/es.object.to-string.js"); +require("core-js/modules/es.array.for-each.js"); +require("core-js/modules/web.dom-collections.for-each.js"); +require("core-js/modules/es.promise.js"); +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); +var _i18next = _interopRequireDefault(require("i18next")); +var _i18nextFsBackend = _interopRequireDefault(require("i18next-fs-backend")); +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +var globalInstance; +var _default = function _default(config) { + if (config.ns === undefined) config.ns = []; + var instance; + if (!globalInstance) { + globalInstance = _i18next["default"].createInstance(config); + instance = globalInstance; + } else { + instance = globalInstance.cloneInstance(_objectSpread(_objectSpread({}, config), {}, { + initImmediate: false + })); + } + var initPromise; + if (!instance.isInitialized) { + var _config$use, _config$use2; + var hasCustomBackend = config === null || config === void 0 ? void 0 : (_config$use = config.use) === null || _config$use === void 0 ? void 0 : _config$use.some(function (b) { + return b.type === 'backend'; + }); + if (!hasCustomBackend) { + instance.use(_i18nextFsBackend["default"]); + } + config === null || config === void 0 ? void 0 : (_config$use2 = config.use) === null || _config$use2 === void 0 ? void 0 : _config$use2.forEach(function (x) { + return instance.use(x); + }); + if (typeof config.onPreInitI18next === 'function') { + config.onPreInitI18next(instance); + } + initPromise = instance.init(config); + } else { + initPromise = Promise.resolve(_i18next["default"].t); + } + return { + i18n: instance, + initPromise: initPromise + }; +}; +exports["default"] = _default; +module.exports = exports.default; +module.exports.default = exports.default; \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/createClient/node.test.js b/packages/next-i18next/dist/commonjs/createClient/node.test.js new file mode 100644 index 00000000000..b65aa85ee43 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/createClient/node.test.js @@ -0,0 +1,48 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); +var _node = _interopRequireDefault(require("./node")); +/** + * @jest-environment node + */ + +var onPreInitI18nextCalled; +var config = { + defaultLocale: 'en', + locales: ['en', 'de'], + onPreInitI18next: function onPreInitI18next(i18n) { + onPreInitI18nextCalled = i18n; + }, + use: [] +}; +describe('createClientNode', function () { + var client; + beforeEach(function () { + onPreInitI18nextCalled = null; + }); + it('returns a node client', function () { + client = (0, _node["default"])(config); + expect((0, _typeof2["default"])(client.initPromise.then)).toBe('function'); + expect((0, _typeof2["default"])(client.i18n.addResource)).toBe('function'); + expect((0, _typeof2["default"])(client.i18n.translator)).toBe('object'); + expect(client.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(client.i18n.options.locales).toEqual(config.locales); + expect(client.i18n.options.isClone).not.toBe(true); + expect(onPreInitI18nextCalled).toEqual(client.i18n); + }); + describe('createClientNode a second time should return a clone of i18next', function () { + it('returns a node client', function () { + var secondClient = (0, _node["default"])(config); + expect((0, _typeof2["default"])(secondClient.initPromise.then)).toBe('function'); + expect((0, _typeof2["default"])(secondClient.i18n.addResource)).toBe('function'); + expect((0, _typeof2["default"])(secondClient.i18n.translator)).toBe('object'); + expect(secondClient.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(secondClient.i18n.options.locales).toEqual(config.locales); + expect(secondClient.i18n.options.isClone).toBe(true); + expect(secondClient).not.toEqual(client); + expect(secondClient.store).toEqual(client.store); + expect(onPreInitI18nextCalled).toBeNull(); + }); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/createClient/package.json b/packages/next-i18next/dist/commonjs/createClient/package.json new file mode 100644 index 00000000000..1e05149178d --- /dev/null +++ b/packages/next-i18next/dist/commonjs/createClient/package.json @@ -0,0 +1,5 @@ +{ + "name": "next-i18next-create-client", + "browser": "./browser.js", + "main": "./node.js" +} \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/index.js b/packages/next-i18next/dist/commonjs/index.js new file mode 100644 index 00000000000..4e4fcd2be74 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/index.js @@ -0,0 +1,50 @@ +"use strict"; + +require("core-js/modules/es.object.define-property.js"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "I18nContext", { + enumerable: true, + get: function get() { + return _reactI18next.I18nContext; + } +}); +Object.defineProperty(exports, "Trans", { + enumerable: true, + get: function get() { + return _reactI18next.Trans; + } +}); +Object.defineProperty(exports, "Translation", { + enumerable: true, + get: function get() { + return _reactI18next.Translation; + } +}); +Object.defineProperty(exports, "appWithTranslation", { + enumerable: true, + get: function get() { + return _appWithTranslation.appWithTranslation; + } +}); +Object.defineProperty(exports, "i18n", { + enumerable: true, + get: function get() { + return _appWithTranslation.globalI18n; + } +}); +Object.defineProperty(exports, "useTranslation", { + enumerable: true, + get: function get() { + return _reactI18next.useTranslation; + } +}); +Object.defineProperty(exports, "withTranslation", { + enumerable: true, + get: function get() { + return _reactI18next.withTranslation; + } +}); +var _reactI18next = require("react-i18next"); +var _appWithTranslation = require("./appWithTranslation"); \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/serverSideTranslations.js b/packages/next-i18next/dist/commonjs/serverSideTranslations.js new file mode 100644 index 00000000000..674f3338074 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/serverSideTranslations.js @@ -0,0 +1,218 @@ +"use strict"; + +require("core-js/modules/es.array.iterator.js"); +require("core-js/modules/es.string.iterator.js"); +require("core-js/modules/es.weak-map.js"); +require("core-js/modules/web.dom-collections.iterator.js"); +require("core-js/modules/es.object.define-property.js"); +require("core-js/modules/es.object.get-own-property-descriptor.js"); +require("core-js/modules/es.symbol.js"); +require("core-js/modules/es.array.filter.js"); +require("core-js/modules/es.object.get-own-property-descriptors.js"); +require("core-js/modules/es.object.define-properties.js"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +var _typeof = require("@babel/runtime/helpers/typeof"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.serverSideTranslations = void 0; +var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); +require("core-js/modules/es.object.to-string.js"); +require("core-js/modules/es.promise.js"); +require("core-js/modules/es.array.for-each.js"); +require("core-js/modules/web.dom-collections.for-each.js"); +require("core-js/modules/es.array.concat.js"); +require("core-js/modules/es.array.is-array.js"); +require("core-js/modules/es.array.map.js"); +require("core-js/modules/es.regexp.exec.js"); +require("core-js/modules/es.string.replace.js"); +require("core-js/modules/es.array.flat.js"); +require("core-js/modules/es.array.unscopables.flat.js"); +require("core-js/modules/es.object.keys.js"); +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); +var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); +var _fs = _interopRequireDefault(require("fs")); +var _path = _interopRequireDefault(require("path")); +var _createConfig = require("./config/createConfig"); +var _node = _interopRequireDefault(require("./createClient/node")); +var _appWithTranslation = require("./appWithTranslation"); +var _utils = require("./utils"); + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + enumerableOnly && (symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + })), keys.push.apply(keys, symbols); + } + return keys; +} + +function _objectSpread(target) { + for (var i = 1; i < arguments.length; i++) { + var source = null != arguments[i] ? arguments[i] : {}; + i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { + (0, _defineProperty2["default"])(target, key, source[key]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; +} + +function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap !== "function") return null; + var cacheBabelInterop = new WeakMap(); + var cacheNodeInterop = new WeakMap(); + return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { + return nodeInterop ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); +} + +function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) { + return obj; + } + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { + return {"default": obj}; + } + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) { + return cache.get(obj); + } + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) { + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) { + Object.defineProperty(newObj, key, desc); + } else { + newObj[key] = obj[key]; + } + } + } + newObj["default"] = obj; + if (cache) { + cache.set(obj, newObj); + } + return newObj; +} + +var DEFAULT_CONFIG_PATH = './next-i18next.config.js'; +var serverSideTranslations = /*#__PURE__*/function () { + var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(initialLocale) { + var namespacesRequired, + configOverride, + extraLocales, + userConfig, + config, + localeExtension, + localePath, + fallbackLng, + reloadOnPrerender, + _createClient, + i18n, + initPromise, + initialI18nStore, + getLocaleNamespaces, + namespacesByLocale, + _args = arguments; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + namespacesRequired = _args.length > 1 && _args[1] !== undefined ? _args[1] : undefined; + configOverride = _args.length > 2 && _args[2] !== undefined ? _args[2] : null; + extraLocales = _args.length > 3 && _args[3] !== undefined ? _args[3] : false; + if (!(typeof initialLocale !== 'string')) { + _context.next = 5; + break; + } + throw new Error('Initial locale argument was not passed into serverSideTranslations'); + case 5: + userConfig = configOverride; + if (!(!userConfig && _fs["default"].existsSync(_path["default"].resolve(DEFAULT_CONFIG_PATH)))) { + _context.next = 10; + break; + } + _context.next = 9; + return Promise.resolve("".concat(_path["default"].resolve(DEFAULT_CONFIG_PATH))).then(function (s) { + return _interopRequireWildcard(require(s)); + }); + case 9: + userConfig = _context.sent; + case 10: + if (!(userConfig === null)) { + _context.next = 12; + break; + } + throw new Error('next-i18next was unable to find a user config'); + case 12: + config = (0, _createConfig.createConfig)(_objectSpread(_objectSpread({}, userConfig), {}, { + lng: initialLocale + })); + localeExtension = config.localeExtension, localePath = config.localePath, fallbackLng = config.fallbackLng, reloadOnPrerender = config.reloadOnPrerender; + if (!reloadOnPrerender) { + _context.next = 17; + break; + } + _context.next = 17; + return _appWithTranslation.globalI18n === null || _appWithTranslation.globalI18n === void 0 ? void 0 : _appWithTranslation.globalI18n.reloadResources(); + case 17: + _createClient = (0, _node["default"])(_objectSpread(_objectSpread({}, config), {}, { + lng: initialLocale + })), i18n = _createClient.i18n, initPromise = _createClient.initPromise; + _context.next = 20; + return initPromise; + case 20: + initialI18nStore = (0, _defineProperty2["default"])({}, initialLocale, {}); + (0, _utils.getFallbackForLng)(initialLocale, fallbackLng !== null && fallbackLng !== void 0 ? fallbackLng : false).concat(extraLocales || []).forEach(function (lng) { + initialI18nStore[lng] = {}; + }); + if (Array.isArray(namespacesRequired)) { + _context.next = 28; + break; + } + if (!(typeof localePath === 'function')) { + _context.next = 25; + break; + } + throw new Error('Must provide namespacesRequired to serverSideTranslations when using a function as localePath'); + case 25: + getLocaleNamespaces = function getLocaleNamespaces(path) { + return _fs["default"].existsSync(path) ? _fs["default"].readdirSync(path).map(function (file) { + return file.replace(".".concat(localeExtension), ''); + }) : []; + }; + namespacesByLocale = Object.keys(initialI18nStore).map(function (locale) { + return getLocaleNamespaces(_path["default"].resolve(process.cwd(), "".concat(localePath, "/").concat(locale))); + }).flat(); + namespacesRequired = (0, _utils.unique)(namespacesByLocale); + case 28: + namespacesRequired.forEach(function (ns) { + for (var locale in initialI18nStore) { + initialI18nStore[locale][ns] = (i18n.services.resourceStore.data[locale] || {})[ns] || {}; + } + }); + return _context.abrupt("return", { + _nextI18Next: { + initialI18nStore: initialI18nStore, + initialLocale: initialLocale, + ns: namespacesRequired, + userConfig: config.serializeConfig ? userConfig : null + } + }); + case 30: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return function serverSideTranslations(_x) { + return _ref.apply(this, arguments); + }; +}(); +exports.serverSideTranslations = serverSideTranslations; \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/serverSideTranslations.test.js b/packages/next-i18next/dist/commonjs/serverSideTranslations.test.js new file mode 100644 index 00000000000..4655db60fb2 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/serverSideTranslations.test.js @@ -0,0 +1,706 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); +var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); +require("core-js/modules/es.object.assign.js"); +require("core-js/modules/es.regexp.exec.js"); +require("core-js/modules/es.string.split.js"); +require("core-js/modules/es.array.concat.js"); +var _react = _interopRequireDefault(require("react")); +var _fs = _interopRequireDefault(require("fs")); +var _serverSideTranslations = require("./serverSideTranslations"); +var _appWithTranslation = require("./appWithTranslation"); +var _server = require("react-dom/server"); +var __jsx = _react["default"].createElement; +jest.mock('fs', function () { + return { + existsSync: jest.fn(), + readdirSync: jest.fn(), + statSync: jest.fn() + }; +}); +var DummyApp = (0, _appWithTranslation.appWithTranslation)(function () { + return __jsx("div", null, "Hello world"); +}); +var props = { + pageProps: { + _nextI18Next: { + initialLocale: 'en-US', + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr'] + } + } + } + }, + router: { + locale: 'en' + } +}; +var renderDummyComponent = function renderDummyComponent() { + return (0, _server.renderToString)(__jsx(DummyApp, props)); +}; +describe('serverSideTranslations', function () { + beforeAll(function () { + Object.assign(process, { + browser: false + }); + delete global.window; + }); + beforeEach(function () { + _fs["default"].existsSync.mockReturnValue(true); + _fs["default"].readdirSync.mockReturnValue([]); + _fs["default"].statSync.mockImplementation(function () { + return { + isDirectory: function isDirectory() { + return false; + } + }; + }); + }); + afterEach(jest.resetAllMocks); + it('throws if initialLocale is not passed', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return expect((0, _serverSideTranslations.serverSideTranslations)(undefined)).rejects.toThrow('Initial locale argument was not passed into serverSideTranslations'); + case 2: + case "end": + return _context.stop(); + } + } + }, _callee); + }))); + describe('When namespacesRequired is not provided', function () { + beforeEach(function () { + _fs["default"].readdirSync.mockImplementation(function (path) { + return ['common', "namespace-of-".concat(path.split('/').pop())]; + }); + }); + it('returns all namespaces', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() { + var _props$_nextI18Next, _props$_nextI18Next2; + var props; + return _regenerator["default"].wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + }); + case 2: + props = _context2.sent; + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(4); + expect(_fs["default"].existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(2); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect((_props$_nextI18Next = props._nextI18Next) === null || _props$_nextI18Next === void 0 ? void 0 : _props$_nextI18Next.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {} + } + }); + expect((_props$_nextI18Next2 = props._nextI18Next) === null || _props$_nextI18Next2 === void 0 ? void 0 : _props$_nextI18Next2.ns).toEqual(['common', 'namespace-of-en-US']); + case 9: + case "end": + return _context2.stop(); + } + } + }, _callee2); + }))); + it('returns all namespaces with fallbackLng (as string)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() { + var _props$_nextI18Next3, _props$_nextI18Next4; + var props; + return _regenerator["default"].wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', undefined, { + i18n: { + defaultLocale: 'fr-BE', + fallbackLng: 'fr', + locales: ['nl-BE', 'fr-BE', 'en-US'] + } + }); + case 2: + props = _context3.sent; + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(6); + expect(_fs["default"].existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(_fs["default"].existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(4); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect((_props$_nextI18Next3 = props._nextI18Next) === null || _props$_nextI18Next3 === void 0 ? void 0 : _props$_nextI18Next3.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect((_props$_nextI18Next4 = props._nextI18Next) === null || _props$_nextI18Next4 === void 0 ? void 0 : _props$_nextI18Next4.ns).toStrictEqual(['common', 'namespace-of-en-US', 'namespace-of-fr']); + case 11: + case "end": + return _context3.stop(); + } + } + }, _callee3); + }))); + it('returns all namespaces with fallbackLng (as array)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() { + var _props$_nextI18Next5, _props$_nextI18Next6; + var props; + return _regenerator["default"].wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', undefined, { + i18n: { + defaultLocale: 'en-US', + fallbackLng: ['en', 'fr'], + locales: ['en-US', 'fr-CA'] + } + }); + case 2: + props = _context4.sent; + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(8); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(6); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en')); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect((_props$_nextI18Next5 = props._nextI18Next) === null || _props$_nextI18Next5 === void 0 ? void 0 : _props$_nextI18Next5.initialI18nStore).toEqual({ + en: { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + 'en-US': { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect((_props$_nextI18Next6 = props._nextI18Next) === null || _props$_nextI18Next6 === void 0 ? void 0 : _props$_nextI18Next6.ns).toEqual(['common', 'namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + case 10: + case "end": + return _context4.stop(); + } + } + }, _callee4); + }))); + it('returns all namespaces with fallbackLng (as object)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() { + var _props$_nextI18Next7, _props$_nextI18Next8; + var props; + return _regenerator["default"].wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + _context5.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', undefined, { + i18n: { + defaultLocale: 'nl-BE', + fallbackLng: { + "default": ['fr'], + 'nl-BE': ['en'] + }, + locales: ['nl-BE', 'fr-BE', 'en-US'] + } + }); + case 2: + props = _context5.sent; + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(6); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(4); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect((_props$_nextI18Next7 = props._nextI18Next) === null || _props$_nextI18Next7 === void 0 ? void 0 : _props$_nextI18Next7.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect((_props$_nextI18Next8 = props._nextI18Next) === null || _props$_nextI18Next8 === void 0 ? void 0 : _props$_nextI18Next8.ns).toEqual(['common', 'namespace-of-en-US', 'namespace-of-fr']); + case 9: + case "end": + return _context5.stop(); + } + } + }, _callee5); + }))); + it('loads extra locales when extraLocales is provided', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() { + var _props$_nextI18Next9, _props$_nextI18Next10; + var props; + return _regenerator["default"].wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + _context6.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('de-CH', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-BE', 'nl-BE', 'de-CH'] + } + }, ['en-US', 'fr-BE', 'fr-BE']); + case 2: + props = _context6.sent; + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(7); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(5); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/de-CH')); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr-BE')); + expect((_props$_nextI18Next9 = props._nextI18Next) === null || _props$_nextI18Next9 === void 0 ? void 0 : _props$_nextI18Next9.initialI18nStore).toEqual({ + 'de-CH': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + }, + 'en-US': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + }, + 'fr-BE': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + } + }); + expect((_props$_nextI18Next10 = props._nextI18Next) === null || _props$_nextI18Next10 === void 0 ? void 0 : _props$_nextI18Next10.ns).toEqual(['common', 'namespace-of-de-CH', 'namespace-of-en-US', 'namespace-of-fr-BE']); + case 10: + case "end": + return _context6.stop(); + } + } + }, _callee6); + }))); + it('does not load extra locales when extraLocales is false', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() { + var _props$_nextI18Next11, _props$_nextI18Next12; + var props; + return _regenerator["default"].wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + _context7.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('de-CH', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-BE', 'nl-BE', 'de-CH'] + } + }, false); + case 2: + props = _context7.sent; + expect(_fs["default"].existsSync).toHaveBeenCalledTimes(6); + expect(_fs["default"].readdirSync).toHaveBeenCalledTimes(4); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/de')); + expect(_fs["default"].readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en')); + expect((_props$_nextI18Next11 = props._nextI18Next) === null || _props$_nextI18Next11 === void 0 ? void 0 : _props$_nextI18Next11.initialI18nStore).toEqual({ + 'de-CH': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {} + }, + 'en-US': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {} + } + }); + expect((_props$_nextI18Next12 = props._nextI18Next) === null || _props$_nextI18Next12 === void 0 ? void 0 : _props$_nextI18Next12.ns).toEqual(['common', 'namespace-of-de-CH', 'namespace-of-en-US']); + case 9: + case "end": + return _context7.stop(); + } + } + }, _callee7); + }))); + }); + it('does load fallback locales with fallbackLng (as array)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() { + var _props$_nextI18Next13, _props$_nextI18Next14; + var props; + return _regenerator["default"].wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + _context8.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', ['common'], { + fallbackLng: ['de'], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-AT'] + } + }, false); + case 2: + props = _context8.sent; + expect((_props$_nextI18Next13 = props._nextI18Next) === null || _props$_nextI18Next13 === void 0 ? void 0 : _props$_nextI18Next13.initialI18nStore).toEqual({ + de: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect((_props$_nextI18Next14 = props._nextI18Next) === null || _props$_nextI18Next14 === void 0 ? void 0 : _props$_nextI18Next14.ns).toEqual(['common']); + case 5: + case "end": + return _context8.stop(); + } + } + }, _callee8); + }))); + it('does load fallback locales with fallbackLng (as object)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() { + var _props$_nextI18Next15, _props$_nextI18Next16; + var props; + return _regenerator["default"].wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + _context9.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', ['common'], { + fallbackLng: { + 'de-AT': ['de'], + "default": ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-AT'] + } + }, false); + case 2: + props = _context9.sent; + expect((_props$_nextI18Next15 = props._nextI18Next) === null || _props$_nextI18Next15 === void 0 ? void 0 : _props$_nextI18Next15.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect((_props$_nextI18Next16 = props._nextI18Next) === null || _props$_nextI18Next16 === void 0 ? void 0 : _props$_nextI18Next16.ns).toEqual(['common']); + case 5: + case "end": + return _context9.stop(); + } + } + }, _callee9); + }))); + it('does load fallback locales with fallbackLng (as function)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() { + var _props$_nextI18Next17, _props$_nextI18Next18; + var props; + return _regenerator["default"].wrap(function _callee10$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + _context10.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', ['common'], { + fallbackLng: function fallbackLng(code) { + return code.split('-')[0]; + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + } + }, false); + case 2: + props = _context10.sent; + expect((_props$_nextI18Next17 = props._nextI18Next) === null || _props$_nextI18Next17 === void 0 ? void 0 : _props$_nextI18Next17.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect((_props$_nextI18Next18 = props._nextI18Next) === null || _props$_nextI18Next18 === void 0 ? void 0 : _props$_nextI18Next18.ns).toEqual(['common']); + case 5: + case "end": + return _context10.stop(); + } + } + }, _callee10); + }))); + describe('When nonExplicitSupportedLngs is true', function () { + it('does load fallback locales', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() { + var _props$_nextI18Next19; + var props; + return _regenerator["default"].wrap(function _callee11$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + _context11.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', ['common'], { + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + }, + nonExplicitSupportedLngs: true + }, false); + case 2: + props = _context11.sent; + expect((_props$_nextI18Next19 = props._nextI18Next) === null || _props$_nextI18Next19 === void 0 ? void 0 : _props$_nextI18Next19.initialI18nStore).toEqual({ + de: { + common: {} + }, + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + case 4: + case "end": + return _context11.stop(); + } + } + }, _callee11); + }))); + it('does load fallback locales with fallbackLng (as array)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() { + var _props$_nextI18Next20; + var props; + return _regenerator["default"].wrap(function _callee12$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + _context12.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', ['common'], { + fallbackLng: ['fr'], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'fr'] + }, + nonExplicitSupportedLngs: true + }, false); + case 2: + props = _context12.sent; + expect((_props$_nextI18Next20 = props._nextI18Next) === null || _props$_nextI18Next20 === void 0 ? void 0 : _props$_nextI18Next20.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + }, + fr: { + common: {} + } + }); + case 4: + case "end": + return _context12.stop(); + } + } + }, _callee12); + }))); + it('does load fallback locales with fallbackLng (as object)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() { + var _props$_nextI18Next21; + var props; + return _regenerator["default"].wrap(function _callee13$(_context13) { + while (1) { + switch (_context13.prev = _context13.next) { + case 0: + _context13.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', ['common'], { + fallbackLng: { + "default": ['fr'], + 'en-US': ['de'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-DE'] + }, + nonExplicitSupportedLngs: true + }, false); + case 2: + props = _context13.sent; + expect((_props$_nextI18Next21 = props._nextI18Next) === null || _props$_nextI18Next21 === void 0 ? void 0 : _props$_nextI18Next21.initialI18nStore).toEqual({ + de: { + common: {} + }, + en: { + common: {} + }, + 'en-US': { + common: {} + }, + fr: { + common: {} + } + }); + case 4: + case "end": + return _context13.stop(); + } + } + }, _callee13); + }))); + it('does thrown an error with fallbackLng (as function)', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() { + var config; + return _regenerator["default"].wrap(function _callee14$(_context14) { + while (1) { + switch (_context14.prev = _context14.next) { + case 0: + config = { + fallbackLng: function fallbackLng(code) { + return code === 'de-AT' ? 'de' : 'en'; + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-DE'] + }, + nonExplicitSupportedLngs: true + }; + _context14.next = 3; + return expect((0, _serverSideTranslations.serverSideTranslations)('de-DE', ['common'], config)).rejects.toThrow('If nonExplicitSupportedLngs is true, no functions are allowed for fallbackLng'); + case 3: + case "end": + return _context14.stop(); + } + } + }, _callee14); + }))); + }); + it('returns props', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15() { + var props; + return _regenerator["default"].wrap(function _callee15$(_context15) { + while (1) { + switch (_context15.prev = _context15.next) { + case 0: + _context15.next = 2; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + }); + case 2: + props = _context15.sent; + expect(props).toEqual({ + _nextI18Next: { + initialI18nStore: { + 'en-US': {} + }, + initialLocale: 'en-US', + ns: [], + userConfig: { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + } + } + }); + case 4: + case "end": + return _context15.stop(); + } + } + }, _callee15); + }))); + it('calls reloadResources when reloadOnPrerender option is true', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16() { + return _regenerator["default"].wrap(function _callee16$(_context16) { + while (1) { + switch (_context16.prev = _context16.next) { + case 0: + renderDummyComponent(); + if (_appWithTranslation.globalI18n) { + _appWithTranslation.globalI18n.reloadResources = jest.fn(); + } + _context16.next = 4; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + }, + reloadOnPrerender: true + }); + case 4: + expect(_appWithTranslation.globalI18n === null || _appWithTranslation.globalI18n === void 0 ? void 0 : _appWithTranslation.globalI18n.reloadResources).toHaveBeenCalledTimes(1); + case 5: + case "end": + return _context16.stop(); + } + } + }, _callee16); + }))); + it('does not call reloadResources when reloadOnPrerender option is false', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17() { + return _regenerator["default"].wrap(function _callee17$(_context17) { + while (1) { + switch (_context17.prev = _context17.next) { + case 0: + renderDummyComponent(); + if (_appWithTranslation.globalI18n) { + _appWithTranslation.globalI18n.reloadResources = jest.fn(); + } + _context17.next = 4; + return (0, _serverSideTranslations.serverSideTranslations)('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + }, + reloadOnPrerender: false + }); + case 4: + expect(_appWithTranslation.globalI18n === null || _appWithTranslation.globalI18n === void 0 ? void 0 : _appWithTranslation.globalI18n.reloadResources).toHaveBeenCalledTimes(0); + case 5: + case "end": + return _context17.stop(); + } + } + }, _callee17); + }))); + it('throws if a function is used for localePath and namespaces are not provided', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee18() { + var localePathFn, config; + return _regenerator["default"].wrap(function _callee18$(_context18) { + while (1) { + switch (_context18.prev = _context18.next) { + case 0: + localePathFn = function localePathFn(locale, namespace, missing) { + return "".concat(missing, "/").concat(namespace, "/").concat(locale, ".json"); + }; + config = { + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + localePath: localePathFn, + ns: ['common'] + }; + _context18.next = 4; + return expect((0, _serverSideTranslations.serverSideTranslations)('en-US', undefined, config)).rejects.toMatchObject({ + message: 'Must provide namespacesRequired to serverSideTranslations when using a function as localePath' + }); + case 4: + case "end": + return _context18.stop(); + } + } + }, _callee18); + }))); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/types.js b/packages/next-i18next/dist/commonjs/types.js new file mode 100644 index 00000000000..f2a28eb1493 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/types.js @@ -0,0 +1,56 @@ +"use strict"; + +require("core-js/modules/es.object.define-property.js"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "DefaultNamespace", { + enumerable: true, + get: function get() { + return _reactI18next.DefaultNamespace; + } +}); +Object.defineProperty(exports, "I18nContext", { + enumerable: true, + get: function get() { + return _reactI18next.I18nContext; + } +}); +Object.defineProperty(exports, "Trans", { + enumerable: true, + get: function get() { + return _reactI18next.Trans; + } +}); +Object.defineProperty(exports, "Translation", { + enumerable: true, + get: function get() { + return _reactI18next.Translation; + } +}); +Object.defineProperty(exports, "appWithTranslation", { + enumerable: true, + get: function get() { + return _.appWithTranslation; + } +}); +Object.defineProperty(exports, "i18n", { + enumerable: true, + get: function get() { + return _.i18n; + } +}); +Object.defineProperty(exports, "useTranslation", { + enumerable: true, + get: function get() { + return _reactI18next.useTranslation; + } +}); +Object.defineProperty(exports, "withTranslation", { + enumerable: true, + get: function get() { + return _reactI18next.withTranslation; + } +}); +var _reactI18next = require("react-i18next"); +var _ = require("./"); \ No newline at end of file diff --git a/packages/next-i18next/dist/commonjs/utils.js b/packages/next-i18next/dist/commonjs/utils.js new file mode 100644 index 00000000000..1e55563a336 --- /dev/null +++ b/packages/next-i18next/dist/commonjs/utils.js @@ -0,0 +1,40 @@ +"use strict"; + +require("core-js/modules/es.object.define-property.js"); +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.unique = exports.getFallbackForLng = void 0; +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); +var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); +require("core-js/modules/es.array.is-array.js"); +require("core-js/modules/es.array.concat.js"); +require("core-js/modules/es.array.from.js"); +require("core-js/modules/es.string.iterator.js"); +require("core-js/modules/es.array.iterator.js"); +require("core-js/modules/es.object.to-string.js"); +require("core-js/modules/es.set.js"); +require("core-js/modules/web.dom-collections.iterator.js"); +var getFallbackForLng = function getFallbackForLng(lng, fallbackLng) { + if (typeof fallbackLng === 'string') { + return [fallbackLng]; + } + if (Array.isArray(fallbackLng)) { + return fallbackLng; + } + if ((0, _typeof2["default"])(fallbackLng) === 'object') { + var fallbackList = fallbackLng[lng]; + var fallbackDefault = fallbackLng["default"]; + return [].concat((0, _toConsumableArray2["default"])(fallbackList !== null && fallbackList !== void 0 ? fallbackList : []), (0, _toConsumableArray2["default"])(fallbackDefault !== null && fallbackDefault !== void 0 ? fallbackDefault : [])); + } + if (typeof fallbackLng === 'function') { + return getFallbackForLng(lng, fallbackLng(lng)); + } + return []; +}; +exports.getFallbackForLng = getFallbackForLng; +var unique = function unique(list) { + return Array.from(new Set(list)); +}; +exports.unique = unique; \ No newline at end of file diff --git a/packages/next-i18next/dist/es/appWithTranslation.client.test.js b/packages/next-i18next/dist/es/appWithTranslation.client.test.js new file mode 100644 index 00000000000..a37275f183f --- /dev/null +++ b/packages/next-i18next/dist/es/appWithTranslation.client.test.js @@ -0,0 +1,248 @@ +/** + * @jest-environment jsdom + */ + +import React from 'react'; +import fs from 'fs'; +import { screen, render } from '@testing-library/react'; +import { I18nextProvider } from 'react-i18next'; +import createClient from './createClient'; +import { appWithTranslation } from './appWithTranslation'; +jest.mock('fs', () => ({ + existsSync: jest.fn(), + readdirSync: jest.fn() +})); +const DummyI18nextProvider = ({ + children +}) => /*#__PURE__*/React.createElement(React.Fragment, null, children); +jest.mock('react-i18next', () => ({ + I18nextProvider: jest.fn(), + __esmodule: true +})); +jest.mock('./createClient', () => jest.fn()); +const DummyApp = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world"), { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } +}); +const createProps = (locale = 'en', router = {}) => ({ + pageProps: { + _nextI18Next: { + initialLocale: locale, + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + } + } + }, + router: { + locale: locale, + route: '/', + ...router + } +}); +const defaultRenderProps = createProps(); +const renderComponent = (props = defaultRenderProps) => render( /*#__PURE__*/React.createElement(DummyApp, props)); +describe('appWithTranslation', () => { + beforeEach(() => { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockReturnValue([]); + I18nextProvider.mockImplementation(DummyI18nextProvider); + const actualCreateClient = jest.requireActual('./createClient'); + createClient.mockImplementation(actualCreateClient); + }); + afterEach(jest.resetAllMocks); + it('returns children', () => { + renderComponent(); + expect(screen.getByText('Hello world')).toBeTruthy(); + }); + it('respects configOverride', () => { + const DummyAppConfigOverride = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world"), { + configOverride: 'custom-value', + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + }); + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en' + } + } + }; + render( /*#__PURE__*/React.createElement(DummyAppConfigOverride, customProps)); + const [args] = I18nextProvider.mock.calls; + expect(screen.getByText('Hello world')).toBeTruthy(); + expect(args[0].i18n.options.configOverride).toBe('custom-value'); + }); + it('allows passing configOverride.resources', () => { + const DummyAppConfigOverride = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world"), { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + }, + resources: { + xyz: { + custom: 'resources' + } + } + }); + render( /*#__PURE__*/React.createElement(DummyAppConfigOverride, createProps())); + const [args] = I18nextProvider.mock.calls; + expect(args[0].i18n.options.resources).toMatchObject({ + xyz: { + custom: 'resources' + } + }); + }); + it('throws an error if userConfig and configOverride are both missing', () => { + const DummyAppConfigOverride = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world")); + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: null + } + } + }; + expect(() => render( /*#__PURE__*/React.createElement(DummyAppConfigOverride, customProps))).toThrow('appWithTranslation was called without a next-i18next config'); + }); + it('throws an error if userConfig and configOverride are both missing an i18n property', () => { + const DummyAppConfigOverride = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world"), {}); + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: {} + } + } + }; + expect(() => render( /*#__PURE__*/React.createElement(DummyAppConfigOverride, customProps))).toThrow('appWithTranslation was called without config.i18n'); + }); + it('throws an error if userConfig and configOverride are both missing a defaultLocale property', () => { + const DummyAppConfigOverride = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world"), { + i18n: {} + }); + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: {} + } + } + } + }; + expect(() => render( /*#__PURE__*/React.createElement(DummyAppConfigOverride, customProps))).toThrow('config.i18n does not include a defaultLocale property'); + }); + it('should use the initialLocale property if the router locale is undefined', () => { + const DummyAppConfigOverride = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world")); + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: { + defaultLocale: 'fr' + } + } + } + } + }; + customProps.router = { + ...customProps.router, + locale: undefined + }; + render( /*#__PURE__*/React.createElement(DummyAppConfigOverride, customProps)); + const [args] = I18nextProvider.mock.calls; + expect(args[0].i18n.language).toBe('en'); + }); + it('should use the userConfig defaltLocale property if the router locale is undefined and initialLocale is undefined', () => { + const DummyAppConfigOverride = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world")); + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: undefined, + userConfig: { + i18n: { + defaultLocale: 'fr' + } + } + } + } + }; + customProps.router = { + ...customProps.router, + locale: undefined + }; + render( /*#__PURE__*/React.createElement(DummyAppConfigOverride, customProps)); + const [args] = I18nextProvider.mock.calls; + expect(args[0].i18n.language).toBe('fr'); + }); + it('returns an I18nextProvider', () => { + renderComponent(); + expect(I18nextProvider).toHaveBeenCalledTimes(1); + const [args] = I18nextProvider.mock.calls; + expect(I18nextProvider).toHaveBeenCalledTimes(1); + expect(args).toHaveLength(2); + expect(args[0].children).toBeTruthy(); + expect(args[0].i18n.addResource).toBeTruthy(); + expect(args[0].i18n.language).toBe('en'); + expect(args[0].i18n.isInitialized).toBe(true); + expect(fs.existsSync).toHaveBeenCalledTimes(0); + expect(fs.readdirSync).toHaveBeenCalledTimes(0); + }); + it('should use locale from router', () => { + renderComponent(createProps('de')); + const [args] = I18nextProvider.mock.calls; + expect(args[0].i18n.language).toBe('de'); + }); + it('does not re-call createClient on re-renders unless locale or props have changed', () => { + const { + rerender + } = renderComponent(); + expect(createClient).toHaveBeenCalledTimes(1); + rerender( /*#__PURE__*/React.createElement(DummyApp, defaultRenderProps)); + expect(createClient).toHaveBeenCalledTimes(1); + const newProps = createProps(); + rerender( /*#__PURE__*/React.createElement(DummyApp, newProps)); + expect(createClient).toHaveBeenCalledTimes(2); + newProps.pageProps._nextI18Next.initialLocale = 'de'; + newProps.router.locale = 'de'; + rerender( /*#__PURE__*/React.createElement(DummyApp, newProps)); + expect(createClient).toHaveBeenCalledTimes(3); + }); + it('assures locale key is set to the right value', () => { + let lng = 'de'; + const props = createProps('de'); + const DummyAppWithVar = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "language is: ", lng), { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + }); + const { + rerender + } = render( /*#__PURE__*/React.createElement(DummyAppWithVar, props)); + props.router.locale = 'en'; + props.pageProps._nextI18Next.initialLocale = 'en'; + lng = 'en'; + rerender( /*#__PURE__*/React.createElement(DummyAppWithVar, props)); + expect(screen.getByText(`language is: ${lng}`)).toBeTruthy(); + props.router.locale = 'de'; + props.pageProps._nextI18Next.initialLocale = 'de'; + lng = 'de'; + rerender( /*#__PURE__*/React.createElement(DummyAppWithVar, createProps('de'))); + expect(screen.getByText(`language is: ${lng}`)).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/es/appWithTranslation.js b/packages/next-i18next/dist/es/appWithTranslation.js new file mode 100644 index 00000000000..7eaa710125a --- /dev/null +++ b/packages/next-i18next/dist/es/appWithTranslation.js @@ -0,0 +1,57 @@ +function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +import React, { useMemo } from 'react'; +import hoistNonReactStatics from 'hoist-non-react-statics'; +import { I18nextProvider } from 'react-i18next'; +import { createConfig } from './config/createConfig'; +import createClient from './createClient'; +export { Trans, useTranslation, withTranslation } from 'react-i18next'; +export let globalI18n = null; +export const appWithTranslation = (WrappedComponent, configOverride = null) => { + const AppWithTranslation = props => { + const { + _nextI18Next + } = props.pageProps; + let locale = _nextI18Next?.initialLocale ?? props?.router?.locale; + const ns = _nextI18Next?.ns; + + // Memoize the instance and only re-initialize when either: + // 1. The route changes (non-shallowly) + // 2. Router locale changes + // 3. UserConfig override changes + const i18n = useMemo(() => { + if (!_nextI18Next && !configOverride) return null; + const userConfig = configOverride ?? _nextI18Next?.userConfig; + if (!userConfig) { + throw new Error('appWithTranslation was called without a next-i18next config'); + } + if (!userConfig?.i18n) { + throw new Error('appWithTranslation was called without config.i18n'); + } + if (!userConfig?.i18n?.defaultLocale) { + throw new Error('config.i18n does not include a defaultLocale property'); + } + const { + initialI18nStore + } = _nextI18Next || {}; + const resources = configOverride?.resources ? configOverride.resources : initialI18nStore; + if (!locale) locale = userConfig.i18n.defaultLocale; + const instance = createClient({ + ...createConfig({ + ...userConfig, + lng: locale + }), + lng: locale, + ns, + resources + }).i18n; + globalI18n = instance; + return instance; + }, [_nextI18Next, locale, configOverride, ns]); + return i18n !== null ? /*#__PURE__*/React.createElement(I18nextProvider, { + i18n: i18n + }, /*#__PURE__*/React.createElement(WrappedComponent, props)) : /*#__PURE__*/React.createElement(WrappedComponent, _extends({ + key: locale + }, props)); + }; + return hoistNonReactStatics(AppWithTranslation, WrappedComponent); +}; \ No newline at end of file diff --git a/packages/next-i18next/dist/es/appWithTranslation.server.test.js b/packages/next-i18next/dist/es/appWithTranslation.server.test.js new file mode 100644 index 00000000000..e3c018420b9 --- /dev/null +++ b/packages/next-i18next/dist/es/appWithTranslation.server.test.js @@ -0,0 +1,68 @@ +/** + * @jest-environment node + */ + +import React from 'react'; +import fs from 'fs'; +import { I18nextProvider } from 'react-i18next'; +import { renderToString } from 'react-dom/server'; +import { appWithTranslation } from './appWithTranslation'; +jest.mock('fs', () => ({ + existsSync: jest.fn(), + readdirSync: jest.fn() +})); +const DummyI18nextProvider = ({ + children +}) => /*#__PURE__*/React.createElement(React.Fragment, null, children); +jest.mock('react-i18next', () => ({ + I18nextProvider: jest.fn(), + __esmodule: true +})); +const MyApp = ({ + Component, + pageProps +}) => { + Component; + pageProps; + return /*#__PURE__*/React.createElement("div", null, "Hello world"); +}; +const DummyApp = appWithTranslation(MyApp); +const props = { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr'] + } + } + } + }, + router: { + locale: 'en', + route: '/' + } +}; +const renderComponent = () => renderToString( /*#__PURE__*/React.createElement(DummyApp, props)); +describe('appWithTranslation', () => { + beforeEach(() => { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockReturnValue([]); + I18nextProvider.mockImplementation(DummyI18nextProvider); + }); + afterEach(jest.resetAllMocks); + it('returns an I18nextProvider', () => { + renderComponent(); + expect(I18nextProvider).toHaveBeenCalledTimes(1); + const [args] = I18nextProvider.mock.calls; + expect(I18nextProvider).toHaveBeenCalledTimes(1); + expect(args).toHaveLength(2); + expect(args[0].children).toBeTruthy(); + expect(args[0].i18n.addResource).toBeTruthy(); + expect(args[0].i18n.language).toBe('en'); + expect(args[0].i18n.isInitialized).toBe(true); + expect(fs.existsSync).toHaveBeenCalledTimes(3); + expect(fs.readdirSync).toHaveBeenCalledTimes(1); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/es/config/createConfig.js b/packages/next-i18next/dist/es/config/createConfig.js new file mode 100644 index 00000000000..79376fc2e28 --- /dev/null +++ b/packages/next-i18next/dist/es/config/createConfig.js @@ -0,0 +1,198 @@ +import { defaultConfig } from './defaultConfig'; +import { getFallbackForLng, unique } from '../utils'; +const deepMergeObjects = ['backend', 'detection']; +export const createConfig = userConfig => { + if (typeof userConfig?.lng !== 'string') { + throw new Error('config.lng was not passed into createConfig'); + } + + // + // Initial merge of default and user-provided config + // + const { + i18n: userI18n, + ...userConfigStripped + } = userConfig; + const { + i18n: defaultI18n, + ...defaultConfigStripped + } = defaultConfig; + const combinedConfig = { + ...defaultConfigStripped, + ...userConfigStripped, + ...defaultI18n, + ...userI18n + }; + const { + defaultNS, + lng, + localeExtension, + localePath, + localeStructure, + nonExplicitSupportedLngs + } = combinedConfig; + const locales = combinedConfig.locales.filter(l => l !== 'default'); + + /** + * Skips translation file resolution while in cimode + * https://github.com/i18next/next-i18next/pull/851#discussion_r503113620 + */ + if (lng === 'cimode') { + return combinedConfig; + } + if (typeof combinedConfig.fallbackLng === 'undefined') { + combinedConfig.fallbackLng = combinedConfig.defaultLocale; + if (combinedConfig.fallbackLng === 'default') [combinedConfig.fallbackLng] = locales; + } + const { + fallbackLng + } = combinedConfig; + if (nonExplicitSupportedLngs) { + const createFallbackObject = (acc, l) => { + const [locale] = l.split('-'); + acc[l] = [locale]; + return acc; + }; + if (typeof fallbackLng === 'string') { + combinedConfig.fallbackLng = combinedConfig.locales.filter(l => l.includes('-')).reduce(createFallbackObject, { + default: [fallbackLng] + }); + } else if (Array.isArray(fallbackLng)) { + combinedConfig.fallbackLng = combinedConfig.locales.filter(l => l.includes('-')).reduce(createFallbackObject, { + default: fallbackLng + }); + } else if (typeof fallbackLng === 'object') { + combinedConfig.fallbackLng = Object.entries(combinedConfig.fallbackLng).reduce((acc, [l, f]) => { + acc[l] = l.includes('-') ? unique([l.split('-')[0], ...f]) : f; + return acc; + }, fallbackLng); + } else if (typeof fallbackLng === 'function') { + throw new Error('If nonExplicitSupportedLngs is true, no functions are allowed for fallbackLng'); + } + } + const hasCustomBackend = userConfig?.use?.some(b => b.type === 'backend'); + if (!process.browser && typeof window === 'undefined') { + combinedConfig.preload = locales; + if (!hasCustomBackend) { + const fs = require('fs'); + const path = require('path'); + + // + // Validate defaultNS + // https://github.com/i18next/next-i18next/issues/358 + // + if (typeof defaultNS === 'string' && typeof lng !== 'undefined') { + if (typeof localePath === 'string') { + const prefix = userConfig?.interpolation?.prefix ?? '{{'; + const suffix = userConfig?.interpolation?.suffix ?? '}}'; + const defaultLocaleStructure = localeStructure.replace(`${prefix}lng${suffix}`, lng).replace(`${prefix}ns${suffix}`, defaultNS); + const defaultFile = `/${defaultLocaleStructure}.${localeExtension}`; + const defaultNSPath = path.join(localePath, defaultFile); + const defaultNSExists = fs.existsSync(defaultNSPath); + const fallback = getFallbackForLng(lng, combinedConfig.fallbackLng); + const defaultFallbackNSExists = fallback.some(f => { + const fallbackFile = defaultFile.replace(lng, f); + const defaultNSPath = path.join(localePath, fallbackFile); + return fs.existsSync(defaultNSPath); + }); + if (!defaultNSExists && !defaultFallbackNSExists && process.env.NODE_ENV !== 'production') { + throw new Error(`Default namespace not found at ${defaultNSPath}`); + } + } else if (typeof localePath === 'function') { + const defaultNSPath = localePath(lng, defaultNS, false); + const defaultNSExists = fs.existsSync(defaultNSPath); + const fallback = getFallbackForLng(lng, combinedConfig.fallbackLng); + const defaultFallbackNSExists = fallback.some(f => { + const defaultNSPath = localePath(f, defaultNS, false); + return fs.existsSync(defaultNSPath); + }); + if (!defaultNSExists && !defaultFallbackNSExists && process.env.NODE_ENV !== 'production') { + throw new Error(`Default namespace not found at ${defaultNSPath}`); + } + } + } + + // + // Set server side backend + // + if (typeof localePath === 'string') { + combinedConfig.backend = { + addPath: path.resolve(process.cwd(), `${localePath}/${localeStructure}.missing.${localeExtension}`), + loadPath: path.resolve(process.cwd(), `${localePath}/${localeStructure}.${localeExtension}`) + }; + } else if (typeof localePath === 'function') { + combinedConfig.backend = { + addPath: (locale, namespace) => localePath(locale, namespace, true), + loadPath: (locale, namespace) => localePath(locale, namespace, false) + }; + } else { + throw new Error(`Unsupported localePath type: ${typeof localePath}`); + } + + // + // Set server side preload (namespaces) + // + if (!combinedConfig.ns && typeof lng !== 'undefined') { + if (typeof localePath === 'function') { + throw new Error('Must provide all namespaces in ns option if using a function as localePath'); + } + const getNamespaces = locales => { + const getLocaleNamespaces = p => { + let ret = []; + if (!fs.existsSync(p)) return ret; + fs.readdirSync(p).map(file => { + const joinedP = path.join(p, file); + if (fs.statSync(joinedP).isDirectory()) { + const subRet = getLocaleNamespaces(joinedP).map(n => `${file}/${n}`); + ret = ret.concat(subRet); + return; + } + ret.push(file.replace(`.${localeExtension}`, '')); + }); + return ret; + }; + const namespacesByLocale = locales.map(locale => getLocaleNamespaces(path.resolve(process.cwd(), `${localePath}/${locale}`))); + const allNamespaces = []; + for (const localNamespaces of namespacesByLocale) { + allNamespaces.push(...localNamespaces); + } + return unique(allNamespaces); + }; + combinedConfig.ns = getNamespaces(unique([lng, ...getFallbackForLng(lng, combinedConfig.fallbackLng)])); + } + } + } else { + // + // Set client side backend, if there is no custom backend + // + if (!hasCustomBackend) { + if (typeof localePath === 'string') { + combinedConfig.backend = { + addPath: `${localePath}/${localeStructure}.missing.${localeExtension}`, + loadPath: `${localePath}/${localeStructure}.${localeExtension}` + }; + } else if (typeof localePath === 'function') { + combinedConfig.backend = { + addPath: (locale, namespace) => localePath(locale, namespace, true), + loadPath: (locale, namespace) => localePath(locale, namespace, false) + }; + } + } + if (typeof combinedConfig.ns !== 'string' && !Array.isArray(combinedConfig.ns)) { + combinedConfig.ns = [defaultNS]; + } + } + + // + // Deep merge with overwrite - goes last + // + deepMergeObjects.forEach(obj => { + if (userConfig[obj]) { + combinedConfig[obj] = { + ...combinedConfig[obj], + ...userConfig[obj] + }; + } + }); + return combinedConfig; +}; \ No newline at end of file diff --git a/packages/next-i18next/dist/es/config/createConfig.test.js b/packages/next-i18next/dist/es/config/createConfig.test.js new file mode 100644 index 00000000000..22163b4f7da --- /dev/null +++ b/packages/next-i18next/dist/es/config/createConfig.test.js @@ -0,0 +1,450 @@ +import fs from 'fs'; +import path from 'path'; +import { createConfig } from './createConfig'; +jest.mock('fs', () => ({ + existsSync: jest.fn(), + readdirSync: jest.fn(), + statSync: jest.fn() +})); +describe('createConfig', () => { + /** + * @jest-environment node + */ + describe('server side', () => { + beforeAll(() => { + Object.assign(process, { + browser: false + }); + delete global.window; + }); + describe('when filesystem is as expected', () => { + beforeAll(() => { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockImplementation(locale => [`namespace-of-${locale.split('/').pop()}`]); + // eslint-disable-next-line max-len + fs.statSync.mockImplementation(() => ({ + isDirectory: () => false + })); + }); + it('throws when lng is not provided', () => { + expect(createConfig).toThrow('config.lng was not passed into createConfig'); + }); + it('returns a valid config when only lng is provided', () => { + const config = createConfig({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/public/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/public/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['namespace-of-en']); + expect(config.preload).toEqual(['en']); + expect(config.use).toEqual([]); + expect(config.react?.useSuspense).toBe(false); + expect(config.interpolation?.escapeValue).toBe(false); + expect(config.interpolation?.format).toBeUndefined(); + expect(fs.existsSync).toHaveBeenCalledTimes(3); + expect(fs.readdirSync).toHaveBeenCalledTimes(1); + }); + it('gets namespaces from current language + fallback (as string) when ns is not provided', () => { + const config = createConfig({ + fallbackLng: 'en', + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en']); + }); + it('gets namespaces from current language + fallback (as array) when ns is not provided', () => { + const config = createConfig({ + fallbackLng: ['en', 'fr'], + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + }); + it('gets namespaces from current language + fallback (as object) when ns is not provided', () => { + const fallbackLng = { + default: ['fr'], + 'en-US': ['en'] + }; + const config = createConfig({ + fallbackLng, + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + }); + it('deep merges backend', () => { + const config = createConfig({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en' + }); + expect(config.backend.hello).toBe('world'); + expect(config.backend.loadPath).toEqual(path.join(process.cwd(), '/public/locales/{{lng}}/{{ns}}.json')); + }); + it('deep merges detection', () => { + const config = createConfig({ + detection: { + hello: 'world' + }, + lng: 'en' + }); + expect(config.detection.hello).toBe('world'); + }); + describe('fallbackLng', () => { + it('automatically sets if it user does not provide', () => { + const config = createConfig({ + lng: 'en' + }); + expect(config.fallbackLng).toBe('en'); + }); + it('does not overwrite user provided value', () => { + const config = createConfig({ + fallbackLng: 'hello-world', + lng: 'en' + }); + expect(config.fallbackLng).toBe('hello-world'); + }); + it('does not overwrite user provided boolean', () => { + const config = createConfig({ + fallbackLng: false, + lng: 'en' + }); + expect(config.fallbackLng).toBe(false); + }); + }); + }); + describe('defaultNS validation', () => { + it('when filesystem is missing defaultNS throws an error', () => { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false); + const config = createConfig.bind(null, { + lng: 'en' + }); + expect(config).toThrow('Default namespace not found at public/locales/en/common.json'); + }); + it('does not throw an error if fallback exists', () => { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + const config = createConfig({ + fallbackLng: { + 'en-US': ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect(config.fallbackLng).toStrictEqual({ + 'en-US': ['en'] + }); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw error if fallbackLng has default key and it exists', () => { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + createConfig({ + fallbackLng: { + default: ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw an error if fallback (as function) exists', () => { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + const config = createConfig({ + fallbackLng: code => code.split('-')[0], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect(typeof config.fallbackLng).toBe('function'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw an error if nonExplicitSupportedLngs is true', () => { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + const config = createConfig({ + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + }, + lng: 'en-US', + nonExplicitSupportedLngs: true + }); + expect(typeof config.nonExplicitSupportedLngs).toBe('boolean'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledTimes(5); + }); + it('uses user provided prefix/suffix with localeStructure', () => { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false); + const config = createConfig.bind(null, { + interpolation: { + prefix: '^^', + suffix: '$$' + }, + lng: 'en', + localeStructure: '^^lng$$/^^ns$$' + }); + expect(config).toThrow('Default namespace not found at public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + }); + }); + describe('hasCustomBackend', () => { + it('returns a config without calling any fs methods', () => { + fs.existsSync.mockReset(); + fs.readdirSync.mockReset(); + createConfig({ + lng: 'en', + use: [{ + type: 'backend' + }] + }); + expect(fs.existsSync).toHaveBeenCalledTimes(0); + expect(fs.readdirSync).toHaveBeenCalledTimes(0); + }); + }); + describe('ci mode', () => { + it('returns a config without calling any fs methods', () => { + createConfig({ + lng: 'cimode' + }); + expect(fs.existsSync).toHaveBeenCalledTimes(0); + expect(fs.readdirSync).toHaveBeenCalledTimes(0); + }); + }); + describe('with a function for localePath', () => { + const localePathFn = (locale, namespace, missing) => `${missing}/${namespace}/${locale}.json`; + it('returns a config whose localePath works as expected', () => { + fs.existsSync.mockReturnValueOnce(true); + const config = createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn, + ns: ['common'] + }); + expect(config.backend.loadPath('en', 'common')).toBe('false/common/en.json'); + expect(config.backend.addPath('en', 'common')).toBe('true/common/en.json'); + }); + it('when filesystem is missing defaultNS throws an error', () => { + fs.existsSync.mockReturnValueOnce(false); + const config = createConfig.bind(null, { + lng: 'en', + localePath: localePathFn + }); + expect(config).toThrow('Default namespace not found at false/common/en.json'); + }); + it('throws an error if namespaces are not provided', () => { + fs.existsSync.mockReturnValueOnce(true); + expect(() => createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn + })).toThrow('Must provide all namespaces in ns option if using a function as localePath'); + }); + }); + describe('with default as locale', () => { + beforeAll(() => { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockImplementation(locale => [`namespace-of-${locale.split('/').pop()}`]); + // eslint-disable-next-line max-len + fs.statSync.mockImplementation(() => ({ + isDirectory: () => false + })); + }); + // eslint-disable-next-line max-len + // https://nextjs.org/docs/advanced-features/i18n-routing#prefixing-the-default-locale + it('should ignore the default value', () => { + const config = createConfig({ + i18n: { + defaultLocale: 'default', + locales: ['default', 'en', 'de'] + }, + lng: 'de' + }); + expect(config.fallbackLng).toBe('en'); + expect(config.preload).toEqual(['en', 'de']); + }); + }); + describe('when filesystem contains nested namespace structure', () => { + beforeAll(() => { + fs.existsSync.mockReset(); + fs.readdirSync.mockReset(); + fs.statSync.mockReset(); + fs.existsSync.mockReturnValue(true); + let level = 0; + fs.readdirSync.mockImplementation(locale => level === 0 ? ['sub-folder'] : [`namespace-of-${locale.split('/').pop()}`]); + // eslint-disable-next-line max-len + fs.statSync.mockImplementation(() => ({ + isDirectory: () => ++level > 1 ? false : true + })); + }); + it('returns a valid config', () => { + const config = createConfig({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/public/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/public/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['sub-folder/namespace-of-sub-folder']); + expect(config.preload).toEqual(['en']); + expect(config.use).toEqual([]); + expect(config.react?.useSuspense).toBe(false); + expect(config.interpolation?.escapeValue).toBe(false); + expect(config.interpolation?.format).toBeUndefined(); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + expect(fs.readdirSync).toHaveBeenCalledTimes(2); + expect(fs.statSync).toHaveBeenCalledTimes(2); + }); + }); + }); + + /** + * @jest-environment jsdom + */ + describe('client side', () => { + beforeAll(() => { + Object.assign(process, { + browser: true + }); + global.window = {}; + }); + it('throws when lng is not provided', () => { + expect(createConfig).toThrow('config.lng was not passed into createConfig'); + }); + it('returns a valid config when only lng is provided', () => { + const config = createConfig({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['common']); + expect(config.preload).toBeUndefined(); + expect(config.use).toEqual([]); + expect(config.react?.useSuspense).toBe(false); + expect(config.interpolation?.escapeValue).toBe(false); + expect(config.interpolation?.format).toBeUndefined(); + }); + it('deep merges backend', () => { + const config = createConfig({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en' + }); + expect(config.backend.hello).toBe('world'); + expect(config.backend.loadPath).toMatch('/locales/{{lng}}/{{ns}}.json'); + }); + it('returns ns as [defaultNS]', () => { + const config = createConfig({ + defaultNS: 'core', + lng: 'en' + }); + expect(config.ns).toEqual(['core']); + }); + it('returns ns when provided as a string', () => { + const config = createConfig({ + lng: 'en', + ns: 'core' + }); + expect(config.ns).toBe('core'); + }); + it('returns ns when provided as an array', () => { + const config = createConfig({ + lng: 'en', + ns: ['core', 'page'] + }); + expect(config.ns).toEqual(['core', 'page']); + }); + describe('hasCustomBackend', () => { + it('returns the correct configuration', () => { + const config = createConfig({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + use: [{ + type: 'backend' + }] + }); + expect(config.backend).toEqual({ + hello: 'world' + }); + }); + }); + describe('with a function for localePath', () => { + const localePathFn = (locale, namespace, missing) => `${missing}/${namespace}/${locale}.json`; + it('returns a config whose localePath works as expected', () => { + const config = createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn, + ns: ['common'] + }); + expect(config.backend.loadPath('en', 'common')).toBe('false/common/en.json'); + expect(config.backend.addPath('en', 'common')).toBe('true/common/en.json'); + }); + }); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/es/config/defaultConfig.js b/packages/next-i18next/dist/es/config/defaultConfig.js new file mode 100644 index 00000000000..cfe93f966ca --- /dev/null +++ b/packages/next-i18next/dist/es/config/defaultConfig.js @@ -0,0 +1,30 @@ +const DEFAULT_LOCALE = 'en'; +const LOCALES = ['en']; +const DEFAULT_NAMESPACE = 'common'; +const LOCALE_PATH = './public/locales'; +const LOCALE_STRUCTURE = '{{lng}}/{{ns}}'; +const LOCALE_EXTENSION = 'json'; +export const defaultConfig = { + defaultNS: DEFAULT_NAMESPACE, + errorStackTraceLimit: 0, + i18n: { + defaultLocale: DEFAULT_LOCALE, + locales: LOCALES + }, + get initImmediate() { + return process.browser && typeof window !== 'undefined'; + }, + interpolation: { + escapeValue: false + }, + load: 'currentOnly', + localeExtension: LOCALE_EXTENSION, + localePath: LOCALE_PATH, + localeStructure: LOCALE_STRUCTURE, + react: { + useSuspense: false + }, + reloadOnPrerender: false, + serializeConfig: true, + use: [] +}; \ No newline at end of file diff --git a/packages/next-i18next/dist/es/createClient/browser.js b/packages/next-i18next/dist/es/createClient/browser.js new file mode 100644 index 00000000000..fb499b4be20 --- /dev/null +++ b/packages/next-i18next/dist/es/createClient/browser.js @@ -0,0 +1,19 @@ +import i18n from 'i18next'; +export default (config => { + if (config.ns === undefined) config.ns = []; + const instance = i18n.createInstance(config); + let initPromise; + if (!instance.isInitialized) { + config?.use?.forEach(x => instance.use(x)); + if (typeof config.onPreInitI18next === 'function') { + config.onPreInitI18next(instance); + } + initPromise = instance.init(config); + } else { + initPromise = Promise.resolve(i18n.t); + } + return { + i18n: instance, + initPromise + }; +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/es/createClient/browser.test.js b/packages/next-i18next/dist/es/createClient/browser.test.js new file mode 100644 index 00000000000..1927d68924f --- /dev/null +++ b/packages/next-i18next/dist/es/createClient/browser.test.js @@ -0,0 +1,28 @@ +/** + * @jest-environment jsdom + */ + +import createClientBrowser from './browser'; +let onPreInitI18nextCalled; +const config = { + defaultLocale: 'en', + locales: ['en', 'de'], + onPreInitI18next: i18n => { + onPreInitI18nextCalled = i18n; + }, + use: [] +}; +describe('createClientBrowser', () => { + beforeEach(() => { + onPreInitI18nextCalled = null; + }); + it('returns a browser client', () => { + const client = createClientBrowser(config); + expect(typeof client.initPromise.then).toBe('function'); + expect(typeof client.i18n.addResource).toBe('function'); + expect(typeof client.i18n.translator).toBe('object'); + expect(client.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(client.i18n.options.locales).toEqual(config.locales); + expect(onPreInitI18nextCalled).toEqual(client.i18n); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/es/createClient/node.js b/packages/next-i18next/dist/es/createClient/node.js new file mode 100644 index 00000000000..947b90b060d --- /dev/null +++ b/packages/next-i18next/dist/es/createClient/node.js @@ -0,0 +1,34 @@ +import i18n from 'i18next'; +import i18nextFSBackend from 'i18next-fs-backend'; +let globalInstance; +export default (config => { + if (config.ns === undefined) config.ns = []; + let instance; + if (!globalInstance) { + globalInstance = i18n.createInstance(config); + instance = globalInstance; + } else { + instance = globalInstance.cloneInstance({ + ...config, + initImmediate: false + }); + } + let initPromise; + if (!instance.isInitialized) { + const hasCustomBackend = config?.use?.some(b => b.type === 'backend'); + if (!hasCustomBackend) { + instance.use(i18nextFSBackend); + } + config?.use?.forEach(x => instance.use(x)); + if (typeof config.onPreInitI18next === 'function') { + config.onPreInitI18next(instance); + } + initPromise = instance.init(config); + } else { + initPromise = Promise.resolve(i18n.t); + } + return { + i18n: instance, + initPromise + }; +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/es/createClient/node.test.js b/packages/next-i18next/dist/es/createClient/node.test.js new file mode 100644 index 00000000000..09dce9dba3f --- /dev/null +++ b/packages/next-i18next/dist/es/createClient/node.test.js @@ -0,0 +1,44 @@ +/** + * @jest-environment node + */ + +import createClientNode from './node'; +let onPreInitI18nextCalled; +const config = { + defaultLocale: 'en', + locales: ['en', 'de'], + onPreInitI18next: i18n => { + onPreInitI18nextCalled = i18n; + }, + use: [] +}; +describe('createClientNode', () => { + let client; + beforeEach(() => { + onPreInitI18nextCalled = null; + }); + it('returns a node client', () => { + client = createClientNode(config); + expect(typeof client.initPromise.then).toBe('function'); + expect(typeof client.i18n.addResource).toBe('function'); + expect(typeof client.i18n.translator).toBe('object'); + expect(client.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(client.i18n.options.locales).toEqual(config.locales); + expect(client.i18n.options.isClone).not.toBe(true); + expect(onPreInitI18nextCalled).toEqual(client.i18n); + }); + describe('createClientNode a second time should return a clone of i18next', () => { + it('returns a node client', () => { + const secondClient = createClientNode(config); + expect(typeof secondClient.initPromise.then).toBe('function'); + expect(typeof secondClient.i18n.addResource).toBe('function'); + expect(typeof secondClient.i18n.translator).toBe('object'); + expect(secondClient.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(secondClient.i18n.options.locales).toEqual(config.locales); + expect(secondClient.i18n.options.isClone).toBe(true); + expect(secondClient).not.toEqual(client); + expect(secondClient.store).toEqual(client.store); + expect(onPreInitI18nextCalled).toBeNull(); + }); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/es/createClient/package.json b/packages/next-i18next/dist/es/createClient/package.json new file mode 100644 index 00000000000..1e05149178d --- /dev/null +++ b/packages/next-i18next/dist/es/createClient/package.json @@ -0,0 +1,5 @@ +{ + "name": "next-i18next-create-client", + "browser": "./browser.js", + "main": "./node.js" +} \ No newline at end of file diff --git a/packages/next-i18next/dist/es/index.js b/packages/next-i18next/dist/es/index.js new file mode 100644 index 00000000000..d24d38e99a4 --- /dev/null +++ b/packages/next-i18next/dist/es/index.js @@ -0,0 +1,2 @@ +export { I18nContext, Trans, Translation, useTranslation, withTranslation } from 'react-i18next'; +export { appWithTranslation, globalI18n as i18n } from './appWithTranslation'; \ No newline at end of file diff --git a/packages/next-i18next/dist/es/serverSideTranslations.js b/packages/next-i18next/dist/es/serverSideTranslations.js new file mode 100644 index 00000000000..d2e9b5235c3 --- /dev/null +++ b/packages/next-i18next/dist/es/serverSideTranslations.js @@ -0,0 +1,67 @@ +import fs from 'fs'; +import path from 'path'; +import { createConfig } from './config/createConfig'; +import createClient from './createClient/node'; +import { globalI18n } from './appWithTranslation'; +import { getFallbackForLng, unique } from './utils'; +const DEFAULT_CONFIG_PATH = './next-i18next.config.js'; +export const serverSideTranslations = async (initialLocale, namespacesRequired = undefined, configOverride = null, extraLocales = false) => { + if (typeof initialLocale !== 'string') { + throw new Error('Initial locale argument was not passed into serverSideTranslations'); + } + let userConfig = configOverride; + if (!userConfig && fs.existsSync(path.resolve(DEFAULT_CONFIG_PATH))) { + userConfig = await import(path.resolve(DEFAULT_CONFIG_PATH)); + } + if (userConfig === null) { + throw new Error('next-i18next was unable to find a user config'); + } + const config = createConfig({ + ...userConfig, + lng: initialLocale + }); + const { + localeExtension, + localePath, + fallbackLng, + reloadOnPrerender + } = config; + if (reloadOnPrerender) { + await globalI18n?.reloadResources(); + } + const { + i18n, + initPromise + } = createClient({ + ...config, + lng: initialLocale + }); + await initPromise; + const initialI18nStore = { + [initialLocale]: {} + }; + getFallbackForLng(initialLocale, fallbackLng ?? false).concat(extraLocales || []).forEach(lng => { + initialI18nStore[lng] = {}; + }); + if (!Array.isArray(namespacesRequired)) { + if (typeof localePath === 'function') { + throw new Error('Must provide namespacesRequired to serverSideTranslations when using a function as localePath'); + } + const getLocaleNamespaces = path => fs.existsSync(path) ? fs.readdirSync(path).map(file => file.replace(`.${localeExtension}`, '')) : []; + const namespacesByLocale = Object.keys(initialI18nStore).map(locale => getLocaleNamespaces(path.resolve(process.cwd(), `${localePath}/${locale}`))).flat(); + namespacesRequired = unique(namespacesByLocale); + } + namespacesRequired.forEach(ns => { + for (const locale in initialI18nStore) { + initialI18nStore[locale][ns] = (i18n.services.resourceStore.data[locale] || {})[ns] || {}; + } + }); + return { + _nextI18Next: { + initialI18nStore, + initialLocale, + ns: namespacesRequired, + userConfig: config.serializeConfig ? userConfig : null + } + }; +}; \ No newline at end of file diff --git a/packages/next-i18next/dist/es/serverSideTranslations.test.js b/packages/next-i18next/dist/es/serverSideTranslations.test.js new file mode 100644 index 00000000000..7074a486105 --- /dev/null +++ b/packages/next-i18next/dist/es/serverSideTranslations.test.js @@ -0,0 +1,430 @@ +/** + * @jest-environment node + */ + +import React from 'react'; +import fs from 'fs'; +import { serverSideTranslations } from './serverSideTranslations'; +import { globalI18n } from './appWithTranslation'; +import { renderToString } from 'react-dom/server'; +import { appWithTranslation } from './appWithTranslation'; +jest.mock('fs', () => ({ + existsSync: jest.fn(), + readdirSync: jest.fn(), + statSync: jest.fn() +})); +const DummyApp = appWithTranslation(() => /*#__PURE__*/React.createElement("div", null, "Hello world")); +const props = { + pageProps: { + _nextI18Next: { + initialLocale: 'en-US', + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr'] + } + } + } + }, + router: { + locale: 'en' + } +}; +const renderDummyComponent = () => renderToString( /*#__PURE__*/React.createElement(DummyApp, props)); +describe('serverSideTranslations', () => { + beforeAll(() => { + Object.assign(process, { + browser: false + }); + delete global.window; + }); + beforeEach(() => { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockReturnValue([]); + fs.statSync.mockImplementation(() => ({ + isDirectory: () => false + })); + }); + afterEach(jest.resetAllMocks); + it('throws if initialLocale is not passed', async () => { + await expect(serverSideTranslations(undefined)).rejects.toThrow('Initial locale argument was not passed into serverSideTranslations'); + }); + describe('When namespacesRequired is not provided', () => { + beforeEach(() => { + fs.readdirSync.mockImplementation(path => ['common', `namespace-of-${path.split('/').pop()}`]); + }); + it('returns all namespaces', async () => { + const props = await serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + }); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledTimes(2); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {} + } + }); + expect(props._nextI18Next?.ns).toEqual(['common', 'namespace-of-en-US']); + }); + it('returns all namespaces with fallbackLng (as string)', async () => { + const props = await serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'fr-BE', + fallbackLng: 'fr', + locales: ['nl-BE', 'fr-BE', 'en-US'] + } + }); + expect(fs.existsSync).toHaveBeenCalledTimes(6); + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect(fs.readdirSync).toHaveBeenCalledTimes(4); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect(props._nextI18Next?.ns).toStrictEqual(['common', 'namespace-of-en-US', 'namespace-of-fr']); + }); + it('returns all namespaces with fallbackLng (as array)', async () => { + const props = await serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'en-US', + fallbackLng: ['en', 'fr'], + locales: ['en-US', 'fr-CA'] + } + }); + expect(fs.existsSync).toHaveBeenCalledTimes(8); + expect(fs.readdirSync).toHaveBeenCalledTimes(6); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + en: { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + 'en-US': { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect(props._nextI18Next?.ns).toEqual(['common', 'namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + }); + it('returns all namespaces with fallbackLng (as object)', async () => { + const props = await serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'nl-BE', + fallbackLng: { + default: ['fr'], + 'nl-BE': ['en'] + }, + locales: ['nl-BE', 'fr-BE', 'en-US'] + } + }); + expect(fs.existsSync).toHaveBeenCalledTimes(6); + expect(fs.readdirSync).toHaveBeenCalledTimes(4); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect(props._nextI18Next?.ns).toEqual(['common', 'namespace-of-en-US', 'namespace-of-fr']); + }); + it('loads extra locales when extraLocales is provided', async () => { + const props = await serverSideTranslations('de-CH', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-BE', 'nl-BE', 'de-CH'] + } + }, ['en-US', 'fr-BE', 'fr-BE']); + expect(fs.existsSync).toHaveBeenCalledTimes(7); + expect(fs.readdirSync).toHaveBeenCalledTimes(5); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/de-CH')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr-BE')); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + 'de-CH': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + }, + 'en-US': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + }, + 'fr-BE': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + } + }); + expect(props._nextI18Next?.ns).toEqual(['common', 'namespace-of-de-CH', 'namespace-of-en-US', 'namespace-of-fr-BE']); + }); + it('does not load extra locales when extraLocales is false', async () => { + const props = await serverSideTranslations('de-CH', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-BE', 'nl-BE', 'de-CH'] + } + }, false); + expect(fs.existsSync).toHaveBeenCalledTimes(6); + expect(fs.readdirSync).toHaveBeenCalledTimes(4); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/de')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en')); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + 'de-CH': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {} + }, + 'en-US': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {} + } + }); + expect(props._nextI18Next?.ns).toEqual(['common', 'namespace-of-de-CH', 'namespace-of-en-US']); + }); + }); + it('does load fallback locales with fallbackLng (as array)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: ['de'], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-AT'] + } + }, false); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + de: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect(props._nextI18Next?.ns).toEqual(['common']); + }); + it('does load fallback locales with fallbackLng (as object)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: { + 'de-AT': ['de'], + default: ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-AT'] + } + }, false); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect(props._nextI18Next?.ns).toEqual(['common']); + }); + it('does load fallback locales with fallbackLng (as function)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: code => code.split('-')[0], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + } + }, false); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect(props._nextI18Next?.ns).toEqual(['common']); + }); + describe('When nonExplicitSupportedLngs is true', () => { + it('does load fallback locales', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + }, + nonExplicitSupportedLngs: true + }, false); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + de: { + common: {} + }, + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + }); + it('does load fallback locales with fallbackLng (as array)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: ['fr'], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'fr'] + }, + nonExplicitSupportedLngs: true + }, false); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + }, + fr: { + common: {} + } + }); + }); + it('does load fallback locales with fallbackLng (as object)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: { + default: ['fr'], + 'en-US': ['de'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-DE'] + }, + nonExplicitSupportedLngs: true + }, false); + expect(props._nextI18Next?.initialI18nStore).toEqual({ + de: { + common: {} + }, + en: { + common: {} + }, + 'en-US': { + common: {} + }, + fr: { + common: {} + } + }); + }); + it('does thrown an error with fallbackLng (as function)', async () => { + const config = { + fallbackLng: code => code === 'de-AT' ? 'de' : 'en', + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-DE'] + }, + nonExplicitSupportedLngs: true + }; + await expect(serverSideTranslations('de-DE', ['common'], config)).rejects.toThrow('If nonExplicitSupportedLngs is true, no functions are allowed for fallbackLng'); + }); + }); + it('returns props', async () => { + const props = await serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + }); + expect(props).toEqual({ + _nextI18Next: { + initialI18nStore: { + 'en-US': {} + }, + initialLocale: 'en-US', + ns: [], + userConfig: { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + } + } + }); + }); + it('calls reloadResources when reloadOnPrerender option is true', async () => { + renderDummyComponent(); + if (globalI18n) { + globalI18n.reloadResources = jest.fn(); + } + await serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + }, + reloadOnPrerender: true + }); + expect(globalI18n?.reloadResources).toHaveBeenCalledTimes(1); + }); + it('does not call reloadResources when reloadOnPrerender option is false', async () => { + renderDummyComponent(); + if (globalI18n) { + globalI18n.reloadResources = jest.fn(); + } + await serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + }, + reloadOnPrerender: false + }); + expect(globalI18n?.reloadResources).toHaveBeenCalledTimes(0); + }); + it('throws if a function is used for localePath and namespaces are not provided', async () => { + const localePathFn = (locale, namespace, missing) => `${missing}/${namespace}/${locale}.json`; + const config = { + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + localePath: localePathFn, + ns: ['common'] + }; + await expect(serverSideTranslations('en-US', undefined, config)).rejects.toMatchObject({ + message: 'Must provide namespacesRequired to serverSideTranslations when using a function as localePath' + }); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/es/types.js b/packages/next-i18next/dist/es/types.js new file mode 100644 index 00000000000..90a05836808 --- /dev/null +++ b/packages/next-i18next/dist/es/types.js @@ -0,0 +1,4 @@ +/* tslint:disable no-explicit-any */ +import { I18nContext, useTranslation, Trans, withTranslation, DefaultNamespace, Translation } from 'react-i18next'; +import { appWithTranslation, i18n } from './'; +export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, Translation, withTranslation, DefaultNamespace }; \ No newline at end of file diff --git a/packages/next-i18next/dist/es/utils.js b/packages/next-i18next/dist/es/utils.js new file mode 100644 index 00000000000..c9f5e08155d --- /dev/null +++ b/packages/next-i18next/dist/es/utils.js @@ -0,0 +1,18 @@ +export const getFallbackForLng = (lng, fallbackLng) => { + if (typeof fallbackLng === 'string') { + return [fallbackLng]; + } + if (Array.isArray(fallbackLng)) { + return fallbackLng; + } + if (typeof fallbackLng === 'object') { + const fallbackList = fallbackLng[lng]; + const fallbackDefault = fallbackLng.default; + return [...(fallbackList ?? []), ...(fallbackDefault ?? [])]; + } + if (typeof fallbackLng === 'function') { + return getFallbackForLng(lng, fallbackLng(lng)); + } + return []; +}; +export const unique = list => Array.from(new Set(list)); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/appWithTranslation.client.test.js b/packages/next-i18next/dist/esm/appWithTranslation.client.test.js new file mode 100644 index 00000000000..1e6c821d956 --- /dev/null +++ b/packages/next-i18next/dist/esm/appWithTranslation.client.test.js @@ -0,0 +1,286 @@ +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +var __jsx = React.createElement; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +/** + * @jest-environment jsdom + */ + +import React from 'react'; +import fs from 'fs'; +import { screen, render } from '@testing-library/react'; +import { I18nextProvider } from 'react-i18next'; +import createClient from './createClient'; +import { appWithTranslation } from './appWithTranslation'; +jest.mock('fs', function () { + return { + existsSync: jest.fn(), + readdirSync: jest.fn() + }; +}); +var DummyI18nextProvider = function DummyI18nextProvider(_ref) { + var children = _ref.children; + return __jsx(React.Fragment, null, children); +}; +jest.mock('react-i18next', function () { + return { + I18nextProvider: jest.fn(), + __esmodule: true + }; +}); +jest.mock('./createClient', function () { + return jest.fn(); +}); +var DummyApp = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); +}, { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } +}); +var createProps = function createProps() { + var locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en'; + var router = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + return { + pageProps: { + _nextI18Next: { + initialLocale: locale, + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + } + } + }, + router: _objectSpread({ + locale: locale, + route: '/' + }, router) + }; +}; +var defaultRenderProps = createProps(); +var renderComponent = function renderComponent() { + var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultRenderProps; + return render(__jsx(DummyApp, props)); +}; +describe('appWithTranslation', function () { + beforeEach(function () { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockReturnValue([]); + I18nextProvider.mockImplementation(DummyI18nextProvider); + var actualCreateClient = jest.requireActual('./createClient'); + createClient.mockImplementation(actualCreateClient); + }); + afterEach(jest.resetAllMocks); + it('returns children', function () { + renderComponent(); + expect(screen.getByText('Hello world')).toBeTruthy(); + }); + it('respects configOverride', function () { + var DummyAppConfigOverride = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); + }, { + configOverride: 'custom-value', + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en' + } + } + }); + render(__jsx(DummyAppConfigOverride, customProps)); + var _mock$calls = _slicedToArray(I18nextProvider.mock.calls, 1), + args = _mock$calls[0]; + expect(screen.getByText('Hello world')).toBeTruthy(); + expect(args[0].i18n.options.configOverride).toBe('custom-value'); + }); + it('allows passing configOverride.resources', function () { + var DummyAppConfigOverride = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); + }, { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + }, + resources: { + xyz: { + custom: 'resources' + } + } + }); + render(__jsx(DummyAppConfigOverride, createProps())); + var _mock$calls2 = _slicedToArray(I18nextProvider.mock.calls, 1), + args = _mock$calls2[0]; + expect(args[0].i18n.options.resources).toMatchObject({ + xyz: { + custom: 'resources' + } + }); + }); + it('throws an error if userConfig and configOverride are both missing', function () { + var DummyAppConfigOverride = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: null + } + } + }); + expect(function () { + return render(__jsx(DummyAppConfigOverride, customProps)); + }).toThrow('appWithTranslation was called without a next-i18next config'); + }); + it('throws an error if userConfig and configOverride are both missing an i18n property', function () { + var DummyAppConfigOverride = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); + }, {}); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: {} + } + } + }); + expect(function () { + return render(__jsx(DummyAppConfigOverride, customProps)); + }).toThrow('appWithTranslation was called without config.i18n'); + }); + it('throws an error if userConfig and configOverride are both missing a defaultLocale property', function () { + var DummyAppConfigOverride = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); + }, { + i18n: {} + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: {} + } + } + } + }); + expect(function () { + return render(__jsx(DummyAppConfigOverride, customProps)); + }).toThrow('config.i18n does not include a defaultLocale property'); + }); + it('should use the initialLocale property if the router locale is undefined', function () { + var DummyAppConfigOverride = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: { + defaultLocale: 'fr' + } + } + } + } + }); + customProps.router = _objectSpread(_objectSpread({}, customProps.router), {}, { + locale: undefined + }); + render(__jsx(DummyAppConfigOverride, customProps)); + var _mock$calls3 = _slicedToArray(I18nextProvider.mock.calls, 1), + args = _mock$calls3[0]; + expect(args[0].i18n.language).toBe('en'); + }); + it('should use the userConfig defaltLocale property if the router locale is undefined and initialLocale is undefined', function () { + var DummyAppConfigOverride = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); + }); + var customProps = _objectSpread(_objectSpread({}, createProps()), {}, { + pageProps: { + _nextI18Next: { + initialLocale: undefined, + userConfig: { + i18n: { + defaultLocale: 'fr' + } + } + } + } + }); + customProps.router = _objectSpread(_objectSpread({}, customProps.router), {}, { + locale: undefined + }); + render(__jsx(DummyAppConfigOverride, customProps)); + var _mock$calls4 = _slicedToArray(I18nextProvider.mock.calls, 1), + args = _mock$calls4[0]; + expect(args[0].i18n.language).toBe('fr'); + }); + it('returns an I18nextProvider', function () { + renderComponent(); + expect(I18nextProvider).toHaveBeenCalledTimes(1); + var _mock$calls5 = _slicedToArray(I18nextProvider.mock.calls, 1), + args = _mock$calls5[0]; + expect(I18nextProvider).toHaveBeenCalledTimes(1); + expect(args).toHaveLength(2); + expect(args[0].children).toBeTruthy(); + expect(args[0].i18n.addResource).toBeTruthy(); + expect(args[0].i18n.language).toBe('en'); + expect(args[0].i18n.isInitialized).toBe(true); + expect(fs.existsSync).toHaveBeenCalledTimes(0); + expect(fs.readdirSync).toHaveBeenCalledTimes(0); + }); + it('should use locale from router', function () { + renderComponent(createProps('de')); + var _mock$calls6 = _slicedToArray(I18nextProvider.mock.calls, 1), + args = _mock$calls6[0]; + expect(args[0].i18n.language).toBe('de'); + }); + it('does not re-call createClient on re-renders unless locale or props have changed', function () { + var _renderComponent = renderComponent(), + rerender = _renderComponent.rerender; + expect(createClient).toHaveBeenCalledTimes(1); + rerender(__jsx(DummyApp, defaultRenderProps)); + expect(createClient).toHaveBeenCalledTimes(1); + var newProps = createProps(); + rerender(__jsx(DummyApp, newProps)); + expect(createClient).toHaveBeenCalledTimes(2); + newProps.pageProps._nextI18Next.initialLocale = 'de'; + newProps.router.locale = 'de'; + rerender(__jsx(DummyApp, newProps)); + expect(createClient).toHaveBeenCalledTimes(3); + }); + it('assures locale key is set to the right value', function () { + var lng = 'de'; + var props = createProps('de'); + var DummyAppWithVar = appWithTranslation(function () { + return __jsx("div", null, "language is: ", lng); + }, { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'] + } + }); + var _render = render(__jsx(DummyAppWithVar, props)), + rerender = _render.rerender; + props.router.locale = 'en'; + props.pageProps._nextI18Next.initialLocale = 'en'; + lng = 'en'; + rerender(__jsx(DummyAppWithVar, props)); + expect(screen.getByText("language is: ".concat(lng))).toBeTruthy(); + props.router.locale = 'de'; + props.pageProps._nextI18Next.initialLocale = 'de'; + lng = 'de'; + rerender(__jsx(DummyAppWithVar, createProps('de'))); + expect(screen.getByText("language is: ".concat(lng))).toBeTruthy(); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/appWithTranslation.js b/packages/next-i18next/dist/esm/appWithTranslation.js new file mode 100644 index 00000000000..305fbe0b74b --- /dev/null +++ b/packages/next-i18next/dist/esm/appWithTranslation.js @@ -0,0 +1,59 @@ +import _extends from "@babel/runtime/helpers/extends"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +var __jsx = React.createElement; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +import React, { useMemo } from 'react'; +import hoistNonReactStatics from 'hoist-non-react-statics'; +import { I18nextProvider } from 'react-i18next'; +import { createConfig } from './config/createConfig'; +import createClient from './createClient'; +export { Trans, useTranslation, withTranslation } from 'react-i18next'; +export var globalI18n = null; +export var appWithTranslation = function appWithTranslation(WrappedComponent) { + var configOverride = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + var AppWithTranslation = function AppWithTranslation(props) { + var _nextI18Next$initialL, _props$router; + var _nextI18Next = props.pageProps._nextI18Next; + var locale = (_nextI18Next$initialL = _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.initialLocale) !== null && _nextI18Next$initialL !== void 0 ? _nextI18Next$initialL : props === null || props === void 0 ? void 0 : (_props$router = props.router) === null || _props$router === void 0 ? void 0 : _props$router.locale; + var ns = _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.ns; + + // Memoize the instance and only re-initialize when either: + // 1. The route changes (non-shallowly) + // 2. Router locale changes + // 3. UserConfig override changes + var i18n = useMemo(function () { + var _userConfig$i18n; + if (!_nextI18Next && !configOverride) return null; + var userConfig = configOverride !== null && configOverride !== void 0 ? configOverride : _nextI18Next === null || _nextI18Next === void 0 ? void 0 : _nextI18Next.userConfig; + if (!userConfig) { + throw new Error('appWithTranslation was called without a next-i18next config'); + } + if (!(userConfig !== null && userConfig !== void 0 && userConfig.i18n)) { + throw new Error('appWithTranslation was called without config.i18n'); + } + if (!(userConfig !== null && userConfig !== void 0 && (_userConfig$i18n = userConfig.i18n) !== null && _userConfig$i18n !== void 0 && _userConfig$i18n.defaultLocale)) { + throw new Error('config.i18n does not include a defaultLocale property'); + } + var _ref = _nextI18Next || {}, + initialI18nStore = _ref.initialI18nStore; + var resources = configOverride !== null && configOverride !== void 0 && configOverride.resources ? configOverride.resources : initialI18nStore; + if (!locale) locale = userConfig.i18n.defaultLocale; + var instance = createClient(_objectSpread(_objectSpread({}, createConfig(_objectSpread(_objectSpread({}, userConfig), {}, { + lng: locale + }))), {}, { + lng: locale, + ns: ns, + resources: resources + })).i18n; + globalI18n = instance; + return instance; + }, [_nextI18Next, locale, configOverride, ns]); + return i18n !== null ? __jsx(I18nextProvider, { + i18n: i18n + }, __jsx(WrappedComponent, props)) : __jsx(WrappedComponent, _extends({ + key: locale + }, props)); + }; + return hoistNonReactStatics(AppWithTranslation, WrappedComponent); +}; \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/appWithTranslation.server.test.js b/packages/next-i18next/dist/esm/appWithTranslation.server.test.js new file mode 100644 index 00000000000..e354a4d372f --- /dev/null +++ b/packages/next-i18next/dist/esm/appWithTranslation.server.test.js @@ -0,0 +1,77 @@ +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +var __jsx = React.createElement; +/** + * @jest-environment node + */ + +import React from 'react'; +import fs from 'fs'; +import { I18nextProvider } from 'react-i18next'; +import { renderToString } from 'react-dom/server'; +import { appWithTranslation } from './appWithTranslation'; +jest.mock('fs', function () { + return { + existsSync: jest.fn(), + readdirSync: jest.fn() + }; +}); +var DummyI18nextProvider = function DummyI18nextProvider(_ref) { + var children = _ref.children; + return __jsx(React.Fragment, null, children); +}; +jest.mock('react-i18next', function () { + return { + I18nextProvider: jest.fn(), + __esmodule: true + }; +}); +var MyApp = function MyApp(_ref2) { + var Component = _ref2.Component, + pageProps = _ref2.pageProps; + Component; + pageProps; + return __jsx("div", null, "Hello world"); +}; +var DummyApp = appWithTranslation(MyApp); +var props = { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr'] + } + } + } + }, + router: { + locale: 'en', + route: '/' + } +}; +var renderComponent = function renderComponent() { + return renderToString(__jsx(DummyApp, props)); +}; +describe('appWithTranslation', function () { + beforeEach(function () { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockReturnValue([]); + I18nextProvider.mockImplementation(DummyI18nextProvider); + }); + afterEach(jest.resetAllMocks); + it('returns an I18nextProvider', function () { + renderComponent(); + expect(I18nextProvider).toHaveBeenCalledTimes(1); + var _mock$calls = _slicedToArray(I18nextProvider.mock.calls, 1), + args = _mock$calls[0]; + expect(I18nextProvider).toHaveBeenCalledTimes(1); + expect(args).toHaveLength(2); + expect(args[0].children).toBeTruthy(); + expect(args[0].i18n.addResource).toBeTruthy(); + expect(args[0].i18n.language).toBe('en'); + expect(args[0].i18n.isInitialized).toBe(true); + expect(fs.existsSync).toHaveBeenCalledTimes(3); + expect(fs.readdirSync).toHaveBeenCalledTimes(1); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/config/createConfig.js b/packages/next-i18next/dist/esm/config/createConfig.js new file mode 100644 index 00000000000..95e6ce70a9c --- /dev/null +++ b/packages/next-i18next/dist/esm/config/createConfig.js @@ -0,0 +1,233 @@ +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _typeof from "@babel/runtime/helpers/typeof"; +import _slicedToArray from "@babel/runtime/helpers/slicedToArray"; +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties"; +var _excluded = ["i18n"], + _excluded2 = ["i18n"]; +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +import { defaultConfig } from './defaultConfig'; +import { getFallbackForLng, unique } from '../utils'; +var deepMergeObjects = ['backend', 'detection']; +export var createConfig = function createConfig(userConfig) { + var _userConfig$use; + if (typeof (userConfig === null || userConfig === void 0 ? void 0 : userConfig.lng) !== 'string') { + throw new Error('config.lng was not passed into createConfig'); + } + + // + // Initial merge of default and user-provided config + // + var userI18n = userConfig.i18n, + userConfigStripped = _objectWithoutProperties(userConfig, _excluded); + var defaultI18n = defaultConfig.i18n, + defaultConfigStripped = _objectWithoutProperties(defaultConfig, _excluded2); + var combinedConfig = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultConfigStripped), userConfigStripped), defaultI18n), userI18n); + var defaultNS = combinedConfig.defaultNS, + lng = combinedConfig.lng, + localeExtension = combinedConfig.localeExtension, + localePath = combinedConfig.localePath, + localeStructure = combinedConfig.localeStructure, + nonExplicitSupportedLngs = combinedConfig.nonExplicitSupportedLngs; + var locales = combinedConfig.locales.filter(function (l) { + return l !== 'default'; + }); + + /** + * Skips translation file resolution while in cimode + * https://github.com/i18next/next-i18next/pull/851#discussion_r503113620 + */ + if (lng === 'cimode') { + return combinedConfig; + } + if (typeof combinedConfig.fallbackLng === 'undefined') { + combinedConfig.fallbackLng = combinedConfig.defaultLocale; + if (combinedConfig.fallbackLng === 'default') { + var _locales = _slicedToArray(locales, 1); + combinedConfig.fallbackLng = _locales[0]; + } + } + var fallbackLng = combinedConfig.fallbackLng; + if (nonExplicitSupportedLngs) { + var createFallbackObject = function createFallbackObject(acc, l) { + var _l$split = l.split('-'), + _l$split2 = _slicedToArray(_l$split, 1), + locale = _l$split2[0]; + acc[l] = [locale]; + return acc; + }; + if (typeof fallbackLng === 'string') { + combinedConfig.fallbackLng = combinedConfig.locales.filter(function (l) { + return l.includes('-'); + }).reduce(createFallbackObject, { + "default": [fallbackLng] + }); + } else if (Array.isArray(fallbackLng)) { + combinedConfig.fallbackLng = combinedConfig.locales.filter(function (l) { + return l.includes('-'); + }).reduce(createFallbackObject, { + "default": fallbackLng + }); + } else if (_typeof(fallbackLng) === 'object') { + combinedConfig.fallbackLng = Object.entries(combinedConfig.fallbackLng).reduce(function (acc, _ref) { + var _ref2 = _slicedToArray(_ref, 2), + l = _ref2[0], + f = _ref2[1]; + acc[l] = l.includes('-') ? unique([l.split('-')[0]].concat(_toConsumableArray(f))) : f; + return acc; + }, fallbackLng); + } else if (typeof fallbackLng === 'function') { + throw new Error('If nonExplicitSupportedLngs is true, no functions are allowed for fallbackLng'); + } + } + var hasCustomBackend = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$use = userConfig.use) === null || _userConfig$use === void 0 ? void 0 : _userConfig$use.some(function (b) { + return b.type === 'backend'; + }); + if (!process.browser && typeof window === 'undefined') { + combinedConfig.preload = locales; + if (!hasCustomBackend) { + var fs = require('fs'); + var path = require('path'); + + // + // Validate defaultNS + // https://github.com/i18next/next-i18next/issues/358 + // + if (typeof defaultNS === 'string' && typeof lng !== 'undefined') { + if (typeof localePath === 'string') { + var _userConfig$interpola, _userConfig$interpola2, _userConfig$interpola3, _userConfig$interpola4; + var prefix = (_userConfig$interpola = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola2 = userConfig.interpolation) === null || _userConfig$interpola2 === void 0 ? void 0 : _userConfig$interpola2.prefix) !== null && _userConfig$interpola !== void 0 ? _userConfig$interpola : '{{'; + var suffix = (_userConfig$interpola3 = userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$interpola4 = userConfig.interpolation) === null || _userConfig$interpola4 === void 0 ? void 0 : _userConfig$interpola4.suffix) !== null && _userConfig$interpola3 !== void 0 ? _userConfig$interpola3 : '}}'; + var defaultLocaleStructure = localeStructure.replace("".concat(prefix, "lng").concat(suffix), lng).replace("".concat(prefix, "ns").concat(suffix), defaultNS); + var defaultFile = "/".concat(defaultLocaleStructure, ".").concat(localeExtension); + var defaultNSPath = path.join(localePath, defaultFile); + var defaultNSExists = fs.existsSync(defaultNSPath); + var fallback = getFallbackForLng(lng, combinedConfig.fallbackLng); + var defaultFallbackNSExists = fallback.some(function (f) { + var fallbackFile = defaultFile.replace(lng, f); + var defaultNSPath = path.join(localePath, fallbackFile); + return fs.existsSync(defaultNSPath); + }); + if (!defaultNSExists && !defaultFallbackNSExists && process.env.NODE_ENV !== 'production') { + throw new Error("Default namespace not found at ".concat(defaultNSPath)); + } + } else if (typeof localePath === 'function') { + var _defaultNSPath = localePath(lng, defaultNS, false); + var _defaultNSExists = fs.existsSync(_defaultNSPath); + var _fallback = getFallbackForLng(lng, combinedConfig.fallbackLng); + var _defaultFallbackNSExists = _fallback.some(function (f) { + var defaultNSPath = localePath(f, defaultNS, false); + return fs.existsSync(defaultNSPath); + }); + if (!_defaultNSExists && !_defaultFallbackNSExists && process.env.NODE_ENV !== 'production') { + throw new Error("Default namespace not found at ".concat(_defaultNSPath)); + } + } + } + + // + // Set server side backend + // + if (typeof localePath === 'string') { + combinedConfig.backend = { + addPath: path.resolve(process.cwd(), "".concat(localePath, "/").concat(localeStructure, ".missing.").concat(localeExtension)), + loadPath: path.resolve(process.cwd(), "".concat(localePath, "/").concat(localeStructure, ".").concat(localeExtension)) + }; + } else if (typeof localePath === 'function') { + combinedConfig.backend = { + addPath: function addPath(locale, namespace) { + return localePath(locale, namespace, true); + }, + loadPath: function loadPath(locale, namespace) { + return localePath(locale, namespace, false); + } + }; + } else { + throw new Error("Unsupported localePath type: ".concat(_typeof(localePath))); + } + + // + // Set server side preload (namespaces) + // + if (!combinedConfig.ns && typeof lng !== 'undefined') { + if (typeof localePath === 'function') { + throw new Error('Must provide all namespaces in ns option if using a function as localePath'); + } + var getNamespaces = function getNamespaces(locales) { + var getLocaleNamespaces = function getLocaleNamespaces(p) { + var ret = []; + if (!fs.existsSync(p)) return ret; + fs.readdirSync(p).map(function (file) { + var joinedP = path.join(p, file); + if (fs.statSync(joinedP).isDirectory()) { + var subRet = getLocaleNamespaces(joinedP).map(function (n) { + return "".concat(file, "/").concat(n); + }); + ret = ret.concat(subRet); + return; + } + ret.push(file.replace(".".concat(localeExtension), '')); + }); + return ret; + }; + var namespacesByLocale = locales.map(function (locale) { + return getLocaleNamespaces(path.resolve(process.cwd(), "".concat(localePath, "/").concat(locale))); + }); + var allNamespaces = []; + var _iterator = _createForOfIteratorHelper(namespacesByLocale), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var localNamespaces = _step.value; + allNamespaces.push.apply(allNamespaces, _toConsumableArray(localNamespaces)); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return unique(allNamespaces); + }; + combinedConfig.ns = getNamespaces(unique([lng].concat(_toConsumableArray(getFallbackForLng(lng, combinedConfig.fallbackLng))))); + } + } + } else { + // + // Set client side backend, if there is no custom backend + // + if (!hasCustomBackend) { + if (typeof localePath === 'string') { + combinedConfig.backend = { + addPath: "".concat(localePath, "/").concat(localeStructure, ".missing.").concat(localeExtension), + loadPath: "".concat(localePath, "/").concat(localeStructure, ".").concat(localeExtension) + }; + } else if (typeof localePath === 'function') { + combinedConfig.backend = { + addPath: function addPath(locale, namespace) { + return localePath(locale, namespace, true); + }, + loadPath: function loadPath(locale, namespace) { + return localePath(locale, namespace, false); + } + }; + } + } + if (typeof combinedConfig.ns !== 'string' && !Array.isArray(combinedConfig.ns)) { + combinedConfig.ns = [defaultNS]; + } + } + + // + // Deep merge with overwrite - goes last + // + deepMergeObjects.forEach(function (obj) { + if (userConfig[obj]) { + combinedConfig[obj] = _objectSpread(_objectSpread({}, combinedConfig[obj]), userConfig[obj]); + } + }); + return combinedConfig; +}; \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/config/createConfig.test.js b/packages/next-i18next/dist/esm/config/createConfig.test.js new file mode 100644 index 00000000000..520b76b2504 --- /dev/null +++ b/packages/next-i18next/dist/esm/config/createConfig.test.js @@ -0,0 +1,482 @@ +import _typeof from "@babel/runtime/helpers/typeof"; +import fs from 'fs'; +import path from 'path'; +import { createConfig } from './createConfig'; +jest.mock('fs', function () { + return { + existsSync: jest.fn(), + readdirSync: jest.fn(), + statSync: jest.fn() + }; +}); +describe('createConfig', function () { + /** + * @jest-environment node + */ + describe('server side', function () { + beforeAll(function () { + Object.assign(process, { + browser: false + }); + delete global.window; + }); + describe('when filesystem is as expected', function () { + beforeAll(function () { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockImplementation(function (locale) { + return ["namespace-of-".concat(locale.split('/').pop())]; + }); + // eslint-disable-next-line max-len + fs.statSync.mockImplementation(function () { + return { + isDirectory: function isDirectory() { + return false; + } + }; + }); + }); + it('throws when lng is not provided', function () { + expect(createConfig).toThrow('config.lng was not passed into createConfig'); + }); + it('returns a valid config when only lng is provided', function () { + var _config$react, _config$interpolation, _config$interpolation2; + var config = createConfig({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/public/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/public/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['namespace-of-en']); + expect(config.preload).toEqual(['en']); + expect(config.use).toEqual([]); + expect((_config$react = config.react) === null || _config$react === void 0 ? void 0 : _config$react.useSuspense).toBe(false); + expect((_config$interpolation = config.interpolation) === null || _config$interpolation === void 0 ? void 0 : _config$interpolation.escapeValue).toBe(false); + expect((_config$interpolation2 = config.interpolation) === null || _config$interpolation2 === void 0 ? void 0 : _config$interpolation2.format).toBeUndefined(); + expect(fs.existsSync).toHaveBeenCalledTimes(3); + expect(fs.readdirSync).toHaveBeenCalledTimes(1); + }); + it('gets namespaces from current language + fallback (as string) when ns is not provided', function () { + var config = createConfig({ + fallbackLng: 'en', + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en']); + }); + it('gets namespaces from current language + fallback (as array) when ns is not provided', function () { + var config = createConfig({ + fallbackLng: ['en', 'fr'], + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + }); + it('gets namespaces from current language + fallback (as object) when ns is not provided', function () { + var fallbackLng = { + "default": ['fr'], + 'en-US': ['en'] + }; + var config = createConfig({ + fallbackLng: fallbackLng, + lng: 'en-US' + }); + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + }); + it('deep merges backend', function () { + var config = createConfig({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en' + }); + expect(config.backend.hello).toBe('world'); + expect(config.backend.loadPath).toEqual(path.join(process.cwd(), '/public/locales/{{lng}}/{{ns}}.json')); + }); + it('deep merges detection', function () { + var config = createConfig({ + detection: { + hello: 'world' + }, + lng: 'en' + }); + expect(config.detection.hello).toBe('world'); + }); + describe('fallbackLng', function () { + it('automatically sets if it user does not provide', function () { + var config = createConfig({ + lng: 'en' + }); + expect(config.fallbackLng).toBe('en'); + }); + it('does not overwrite user provided value', function () { + var config = createConfig({ + fallbackLng: 'hello-world', + lng: 'en' + }); + expect(config.fallbackLng).toBe('hello-world'); + }); + it('does not overwrite user provided boolean', function () { + var config = createConfig({ + fallbackLng: false, + lng: 'en' + }); + expect(config.fallbackLng).toBe(false); + }); + }); + }); + describe('defaultNS validation', function () { + it('when filesystem is missing defaultNS throws an error', function () { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false); + var config = createConfig.bind(null, { + lng: 'en' + }); + expect(config).toThrow('Default namespace not found at public/locales/en/common.json'); + }); + it('does not throw an error if fallback exists', function () { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + var config = createConfig({ + fallbackLng: { + 'en-US': ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect(config.fallbackLng).toStrictEqual({ + 'en-US': ['en'] + }); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw error if fallbackLng has default key and it exists', function () { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + createConfig({ + fallbackLng: { + "default": ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw an error if fallback (as function) exists', function () { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + var config = createConfig({ + fallbackLng: function fallbackLng(code) { + return code.split('-')[0]; + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'] + }, + lng: 'en-US' + }); + expect(_typeof(config.fallbackLng)).toBe('function'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + }); + it('does not throw an error if nonExplicitSupportedLngs is true', function () { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false).mockReturnValueOnce(true); + var config = createConfig({ + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + }, + lng: 'en-US', + nonExplicitSupportedLngs: true + }); + expect(_typeof(config.nonExplicitSupportedLngs)).toBe('boolean'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledTimes(5); + }); + it('uses user provided prefix/suffix with localeStructure', function () { + fs.existsSync.mockReset(); + fs.existsSync.mockReturnValueOnce(false); + var config = createConfig.bind(null, { + interpolation: { + prefix: '^^', + suffix: '$$' + }, + lng: 'en', + localeStructure: '^^lng$$/^^ns$$' + }); + expect(config).toThrow('Default namespace not found at public/locales/en/common.json'); + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json'); + }); + }); + describe('hasCustomBackend', function () { + it('returns a config without calling any fs methods', function () { + fs.existsSync.mockReset(); + fs.readdirSync.mockReset(); + createConfig({ + lng: 'en', + use: [{ + type: 'backend' + }] + }); + expect(fs.existsSync).toHaveBeenCalledTimes(0); + expect(fs.readdirSync).toHaveBeenCalledTimes(0); + }); + }); + describe('ci mode', function () { + it('returns a config without calling any fs methods', function () { + createConfig({ + lng: 'cimode' + }); + expect(fs.existsSync).toHaveBeenCalledTimes(0); + expect(fs.readdirSync).toHaveBeenCalledTimes(0); + }); + }); + describe('with a function for localePath', function () { + var localePathFn = function localePathFn(locale, namespace, missing) { + return "".concat(missing, "/").concat(namespace, "/").concat(locale, ".json"); + }; + it('returns a config whose localePath works as expected', function () { + fs.existsSync.mockReturnValueOnce(true); + var config = createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn, + ns: ['common'] + }); + expect(config.backend.loadPath('en', 'common')).toBe('false/common/en.json'); + expect(config.backend.addPath('en', 'common')).toBe('true/common/en.json'); + }); + it('when filesystem is missing defaultNS throws an error', function () { + fs.existsSync.mockReturnValueOnce(false); + var config = createConfig.bind(null, { + lng: 'en', + localePath: localePathFn + }); + expect(config).toThrow('Default namespace not found at false/common/en.json'); + }); + it('throws an error if namespaces are not provided', function () { + fs.existsSync.mockReturnValueOnce(true); + expect(function () { + return createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn + }); + }).toThrow('Must provide all namespaces in ns option if using a function as localePath'); + }); + }); + describe('with default as locale', function () { + beforeAll(function () { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockImplementation(function (locale) { + return ["namespace-of-".concat(locale.split('/').pop())]; + }); + // eslint-disable-next-line max-len + fs.statSync.mockImplementation(function () { + return { + isDirectory: function isDirectory() { + return false; + } + }; + }); + }); + // eslint-disable-next-line max-len + // https://nextjs.org/docs/advanced-features/i18n-routing#prefixing-the-default-locale + it('should ignore the default value', function () { + var config = createConfig({ + i18n: { + defaultLocale: 'default', + locales: ['default', 'en', 'de'] + }, + lng: 'de' + }); + expect(config.fallbackLng).toBe('en'); + expect(config.preload).toEqual(['en', 'de']); + }); + }); + describe('when filesystem contains nested namespace structure', function () { + beforeAll(function () { + fs.existsSync.mockReset(); + fs.readdirSync.mockReset(); + fs.statSync.mockReset(); + fs.existsSync.mockReturnValue(true); + var level = 0; + fs.readdirSync.mockImplementation(function (locale) { + return level === 0 ? ['sub-folder'] : ["namespace-of-".concat(locale.split('/').pop())]; + }); + // eslint-disable-next-line max-len + fs.statSync.mockImplementation(function () { + return { + isDirectory: function isDirectory() { + return ++level > 1 ? false : true; + } + }; + }); + }); + it('returns a valid config', function () { + var _config$react2, _config$interpolation3, _config$interpolation4; + var config = createConfig({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/public/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/public/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['sub-folder/namespace-of-sub-folder']); + expect(config.preload).toEqual(['en']); + expect(config.use).toEqual([]); + expect((_config$react2 = config.react) === null || _config$react2 === void 0 ? void 0 : _config$react2.useSuspense).toBe(false); + expect((_config$interpolation3 = config.interpolation) === null || _config$interpolation3 === void 0 ? void 0 : _config$interpolation3.escapeValue).toBe(false); + expect((_config$interpolation4 = config.interpolation) === null || _config$interpolation4 === void 0 ? void 0 : _config$interpolation4.format).toBeUndefined(); + expect(fs.existsSync).toHaveBeenCalledTimes(4); + expect(fs.readdirSync).toHaveBeenCalledTimes(2); + expect(fs.statSync).toHaveBeenCalledTimes(2); + }); + }); + }); + + /** + * @jest-environment jsdom + */ + describe('client side', function () { + beforeAll(function () { + Object.assign(process, { + browser: true + }); + global.window = {}; + }); + it('throws when lng is not provided', function () { + expect(createConfig).toThrow('config.lng was not passed into createConfig'); + }); + it('returns a valid config when only lng is provided', function () { + var _config$react3, _config$interpolation5, _config$interpolation6; + var config = createConfig({ + lng: 'en' + }); + expect(config.backend.addPath).toMatch('/locales/{{lng}}/{{ns}}.missing.json'); + expect(config.backend.loadPath).toMatch('/locales/{{lng}}/{{ns}}.json'); + expect(config.defaultLocale).toBe('en'); + expect(config.defaultNS).toBe('common'); + expect(config.errorStackTraceLimit).toBe(0); + expect(config.lng).toBe('en'); + expect(config.load).toBe('currentOnly'); + expect(config.localeExtension).toBe('json'); + expect(config.localePath).toBe('./public/locales'); + expect(config.localeStructure).toBe('{{lng}}/{{ns}}'); + expect(config.locales).toEqual(['en']); + expect(config.ns).toEqual(['common']); + expect(config.preload).toBeUndefined(); + expect(config.use).toEqual([]); + expect((_config$react3 = config.react) === null || _config$react3 === void 0 ? void 0 : _config$react3.useSuspense).toBe(false); + expect((_config$interpolation5 = config.interpolation) === null || _config$interpolation5 === void 0 ? void 0 : _config$interpolation5.escapeValue).toBe(false); + expect((_config$interpolation6 = config.interpolation) === null || _config$interpolation6 === void 0 ? void 0 : _config$interpolation6.format).toBeUndefined(); + }); + it('deep merges backend', function () { + var config = createConfig({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en' + }); + expect(config.backend.hello).toBe('world'); + expect(config.backend.loadPath).toMatch('/locales/{{lng}}/{{ns}}.json'); + }); + it('returns ns as [defaultNS]', function () { + var config = createConfig({ + defaultNS: 'core', + lng: 'en' + }); + expect(config.ns).toEqual(['core']); + }); + it('returns ns when provided as a string', function () { + var config = createConfig({ + lng: 'en', + ns: 'core' + }); + expect(config.ns).toBe('core'); + }); + it('returns ns when provided as an array', function () { + var config = createConfig({ + lng: 'en', + ns: ['core', 'page'] + }); + expect(config.ns).toEqual(['core', 'page']); + }); + describe('hasCustomBackend', function () { + it('returns the correct configuration', function () { + var config = createConfig({ + backend: { + hello: 'world' + }, + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + use: [{ + type: 'backend' + }] + }); + expect(config.backend).toEqual({ + hello: 'world' + }); + }); + }); + describe('with a function for localePath', function () { + var localePathFn = function localePathFn(locale, namespace, missing) { + return "".concat(missing, "/").concat(namespace, "/").concat(locale, ".json"); + }; + it('returns a config whose localePath works as expected', function () { + var config = createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + lng: 'en', + localePath: localePathFn, + ns: ['common'] + }); + expect(config.backend.loadPath('en', 'common')).toBe('false/common/en.json'); + expect(config.backend.addPath('en', 'common')).toBe('true/common/en.json'); + }); + }); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/config/defaultConfig.js b/packages/next-i18next/dist/esm/config/defaultConfig.js new file mode 100644 index 00000000000..c4c8c525571 --- /dev/null +++ b/packages/next-i18next/dist/esm/config/defaultConfig.js @@ -0,0 +1,30 @@ +var DEFAULT_LOCALE = 'en'; +var LOCALES = ['en']; +var DEFAULT_NAMESPACE = 'common'; +var LOCALE_PATH = './public/locales'; +var LOCALE_STRUCTURE = '{{lng}}/{{ns}}'; +var LOCALE_EXTENSION = 'json'; +export var defaultConfig = { + defaultNS: DEFAULT_NAMESPACE, + errorStackTraceLimit: 0, + i18n: { + defaultLocale: DEFAULT_LOCALE, + locales: LOCALES + }, + get initImmediate() { + return process.browser && typeof window !== 'undefined'; + }, + interpolation: { + escapeValue: false + }, + load: 'currentOnly', + localeExtension: LOCALE_EXTENSION, + localePath: LOCALE_PATH, + localeStructure: LOCALE_STRUCTURE, + react: { + useSuspense: false + }, + reloadOnPrerender: false, + serializeConfig: true, + use: [] +}; \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/createClient/browser.js b/packages/next-i18next/dist/esm/createClient/browser.js new file mode 100644 index 00000000000..51f7b1a3ba1 --- /dev/null +++ b/packages/next-i18next/dist/esm/createClient/browser.js @@ -0,0 +1,22 @@ +import i18n from 'i18next'; +export default (function (config) { + if (config.ns === undefined) config.ns = []; + var instance = i18n.createInstance(config); + var initPromise; + if (!instance.isInitialized) { + var _config$use; + config === null || config === void 0 ? void 0 : (_config$use = config.use) === null || _config$use === void 0 ? void 0 : _config$use.forEach(function (x) { + return instance.use(x); + }); + if (typeof config.onPreInitI18next === 'function') { + config.onPreInitI18next(instance); + } + initPromise = instance.init(config); + } else { + initPromise = Promise.resolve(i18n.t); + } + return { + i18n: instance, + initPromise: initPromise + }; +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/createClient/browser.test.js b/packages/next-i18next/dist/esm/createClient/browser.test.js new file mode 100644 index 00000000000..012f01d34c9 --- /dev/null +++ b/packages/next-i18next/dist/esm/createClient/browser.test.js @@ -0,0 +1,29 @@ +import _typeof from "@babel/runtime/helpers/typeof"; +/** + * @jest-environment jsdom + */ + +import createClientBrowser from './browser'; +var onPreInitI18nextCalled; +var config = { + defaultLocale: 'en', + locales: ['en', 'de'], + onPreInitI18next: function onPreInitI18next(i18n) { + onPreInitI18nextCalled = i18n; + }, + use: [] +}; +describe('createClientBrowser', function () { + beforeEach(function () { + onPreInitI18nextCalled = null; + }); + it('returns a browser client', function () { + var client = createClientBrowser(config); + expect(_typeof(client.initPromise.then)).toBe('function'); + expect(_typeof(client.i18n.addResource)).toBe('function'); + expect(_typeof(client.i18n.translator)).toBe('object'); + expect(client.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(client.i18n.options.locales).toEqual(config.locales); + expect(onPreInitI18nextCalled).toEqual(client.i18n); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/createClient/node.js b/packages/next-i18next/dist/esm/createClient/node.js new file mode 100644 index 00000000000..8b975259590 --- /dev/null +++ b/packages/next-i18next/dist/esm/createClient/node.js @@ -0,0 +1,41 @@ +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +import i18n from 'i18next'; +import i18nextFSBackend from 'i18next-fs-backend'; +var globalInstance; +export default (function (config) { + if (config.ns === undefined) config.ns = []; + var instance; + if (!globalInstance) { + globalInstance = i18n.createInstance(config); + instance = globalInstance; + } else { + instance = globalInstance.cloneInstance(_objectSpread(_objectSpread({}, config), {}, { + initImmediate: false + })); + } + var initPromise; + if (!instance.isInitialized) { + var _config$use, _config$use2; + var hasCustomBackend = config === null || config === void 0 ? void 0 : (_config$use = config.use) === null || _config$use === void 0 ? void 0 : _config$use.some(function (b) { + return b.type === 'backend'; + }); + if (!hasCustomBackend) { + instance.use(i18nextFSBackend); + } + config === null || config === void 0 ? void 0 : (_config$use2 = config.use) === null || _config$use2 === void 0 ? void 0 : _config$use2.forEach(function (x) { + return instance.use(x); + }); + if (typeof config.onPreInitI18next === 'function') { + config.onPreInitI18next(instance); + } + initPromise = instance.init(config); + } else { + initPromise = Promise.resolve(i18n.t); + } + return { + i18n: instance, + initPromise: initPromise + }; +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/createClient/node.test.js b/packages/next-i18next/dist/esm/createClient/node.test.js new file mode 100644 index 00000000000..12e67ed8ea8 --- /dev/null +++ b/packages/next-i18next/dist/esm/createClient/node.test.js @@ -0,0 +1,45 @@ +import _typeof from "@babel/runtime/helpers/typeof"; +/** + * @jest-environment node + */ + +import createClientNode from './node'; +var onPreInitI18nextCalled; +var config = { + defaultLocale: 'en', + locales: ['en', 'de'], + onPreInitI18next: function onPreInitI18next(i18n) { + onPreInitI18nextCalled = i18n; + }, + use: [] +}; +describe('createClientNode', function () { + var client; + beforeEach(function () { + onPreInitI18nextCalled = null; + }); + it('returns a node client', function () { + client = createClientNode(config); + expect(_typeof(client.initPromise.then)).toBe('function'); + expect(_typeof(client.i18n.addResource)).toBe('function'); + expect(_typeof(client.i18n.translator)).toBe('object'); + expect(client.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(client.i18n.options.locales).toEqual(config.locales); + expect(client.i18n.options.isClone).not.toBe(true); + expect(onPreInitI18nextCalled).toEqual(client.i18n); + }); + describe('createClientNode a second time should return a clone of i18next', function () { + it('returns a node client', function () { + var secondClient = createClientNode(config); + expect(_typeof(secondClient.initPromise.then)).toBe('function'); + expect(_typeof(secondClient.i18n.addResource)).toBe('function'); + expect(_typeof(secondClient.i18n.translator)).toBe('object'); + expect(secondClient.i18n.options.defaultLocale).toEqual(config.defaultLocale); + expect(secondClient.i18n.options.locales).toEqual(config.locales); + expect(secondClient.i18n.options.isClone).toBe(true); + expect(secondClient).not.toEqual(client); + expect(secondClient.store).toEqual(client.store); + expect(onPreInitI18nextCalled).toBeNull(); + }); + }); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/createClient/package.json b/packages/next-i18next/dist/esm/createClient/package.json new file mode 100644 index 00000000000..1e05149178d --- /dev/null +++ b/packages/next-i18next/dist/esm/createClient/package.json @@ -0,0 +1,5 @@ +{ + "name": "next-i18next-create-client", + "browser": "./browser.js", + "main": "./node.js" +} \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/index.js b/packages/next-i18next/dist/esm/index.js new file mode 100644 index 00000000000..d24d38e99a4 --- /dev/null +++ b/packages/next-i18next/dist/esm/index.js @@ -0,0 +1,2 @@ +export { I18nContext, Trans, Translation, useTranslation, withTranslation } from 'react-i18next'; +export { appWithTranslation, globalI18n as i18n } from './appWithTranslation'; \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/serverSideTranslations.js b/packages/next-i18next/dist/esm/serverSideTranslations.js new file mode 100644 index 00000000000..44bfcb76752 --- /dev/null +++ b/packages/next-i18next/dist/esm/serverSideTranslations.js @@ -0,0 +1,124 @@ +import _defineProperty from "@babel/runtime/helpers/defineProperty"; +import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; +import _regeneratorRuntime from "@babel/runtime/regenerator"; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +import fs from 'fs'; +import path from 'path'; +import { createConfig } from './config/createConfig'; +import createClient from './createClient/node'; +import { globalI18n } from './appWithTranslation'; +import { getFallbackForLng, unique } from './utils'; +var DEFAULT_CONFIG_PATH = './next-i18next.config.js'; +export var serverSideTranslations = /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(initialLocale) { + var namespacesRequired, + configOverride, + extraLocales, + userConfig, + config, + localeExtension, + localePath, + fallbackLng, + reloadOnPrerender, + _createClient, + i18n, + initPromise, + initialI18nStore, + getLocaleNamespaces, + namespacesByLocale, + _args = arguments; + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + namespacesRequired = _args.length > 1 && _args[1] !== undefined ? _args[1] : undefined; + configOverride = _args.length > 2 && _args[2] !== undefined ? _args[2] : null; + extraLocales = _args.length > 3 && _args[3] !== undefined ? _args[3] : false; + if (!(typeof initialLocale !== 'string')) { + _context.next = 5; + break; + } + throw new Error('Initial locale argument was not passed into serverSideTranslations'); + case 5: + userConfig = configOverride; + if (!(!userConfig && fs.existsSync(path.resolve(DEFAULT_CONFIG_PATH)))) { + _context.next = 10; + break; + } + _context.next = 9; + return import(path.resolve(DEFAULT_CONFIG_PATH)); + case 9: + userConfig = _context.sent; + case 10: + if (!(userConfig === null)) { + _context.next = 12; + break; + } + throw new Error('next-i18next was unable to find a user config'); + case 12: + config = createConfig(_objectSpread(_objectSpread({}, userConfig), {}, { + lng: initialLocale + })); + localeExtension = config.localeExtension, localePath = config.localePath, fallbackLng = config.fallbackLng, reloadOnPrerender = config.reloadOnPrerender; + if (!reloadOnPrerender) { + _context.next = 17; + break; + } + _context.next = 17; + return globalI18n === null || globalI18n === void 0 ? void 0 : globalI18n.reloadResources(); + case 17: + _createClient = createClient(_objectSpread(_objectSpread({}, config), {}, { + lng: initialLocale + })), i18n = _createClient.i18n, initPromise = _createClient.initPromise; + _context.next = 20; + return initPromise; + case 20: + initialI18nStore = _defineProperty({}, initialLocale, {}); + getFallbackForLng(initialLocale, fallbackLng !== null && fallbackLng !== void 0 ? fallbackLng : false).concat(extraLocales || []).forEach(function (lng) { + initialI18nStore[lng] = {}; + }); + if (Array.isArray(namespacesRequired)) { + _context.next = 28; + break; + } + if (!(typeof localePath === 'function')) { + _context.next = 25; + break; + } + throw new Error('Must provide namespacesRequired to serverSideTranslations when using a function as localePath'); + case 25: + getLocaleNamespaces = function getLocaleNamespaces(path) { + return fs.existsSync(path) ? fs.readdirSync(path).map(function (file) { + return file.replace(".".concat(localeExtension), ''); + }) : []; + }; + namespacesByLocale = Object.keys(initialI18nStore).map(function (locale) { + return getLocaleNamespaces(path.resolve(process.cwd(), "".concat(localePath, "/").concat(locale))); + }).flat(); + namespacesRequired = unique(namespacesByLocale); + case 28: + namespacesRequired.forEach(function (ns) { + for (var locale in initialI18nStore) { + initialI18nStore[locale][ns] = (i18n.services.resourceStore.data[locale] || {})[ns] || {}; + } + }); + return _context.abrupt("return", { + _nextI18Next: { + initialI18nStore: initialI18nStore, + initialLocale: initialLocale, + ns: namespacesRequired, + userConfig: config.serializeConfig ? userConfig : null + } + }); + case 30: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return function serverSideTranslations(_x) { + return _ref.apply(this, arguments); + }; +}(); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/serverSideTranslations.test.js b/packages/next-i18next/dist/esm/serverSideTranslations.test.js new file mode 100644 index 00000000000..bb4911445c3 --- /dev/null +++ b/packages/next-i18next/dist/esm/serverSideTranslations.test.js @@ -0,0 +1,704 @@ +import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator"; +var __jsx = React.createElement; +import _regeneratorRuntime from "@babel/runtime/regenerator"; +/** + * @jest-environment node + */ + +import React from 'react'; +import fs from 'fs'; +import { serverSideTranslations } from './serverSideTranslations'; +import { globalI18n } from './appWithTranslation'; +import { renderToString } from 'react-dom/server'; +import { appWithTranslation } from './appWithTranslation'; +jest.mock('fs', function () { + return { + existsSync: jest.fn(), + readdirSync: jest.fn(), + statSync: jest.fn() + }; +}); +var DummyApp = appWithTranslation(function () { + return __jsx("div", null, "Hello world"); +}); +var props = { + pageProps: { + _nextI18Next: { + initialLocale: 'en-US', + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr'] + } + } + } + }, + router: { + locale: 'en' + } +}; +var renderDummyComponent = function renderDummyComponent() { + return renderToString(__jsx(DummyApp, props)); +}; +describe('serverSideTranslations', function () { + beforeAll(function () { + Object.assign(process, { + browser: false + }); + delete global.window; + }); + beforeEach(function () { + fs.existsSync.mockReturnValue(true); + fs.readdirSync.mockReturnValue([]); + fs.statSync.mockImplementation(function () { + return { + isDirectory: function isDirectory() { + return false; + } + }; + }); + }); + afterEach(jest.resetAllMocks); + it('throws if initialLocale is not passed', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() { + return _regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return expect(serverSideTranslations(undefined)).rejects.toThrow('Initial locale argument was not passed into serverSideTranslations'); + case 2: + case "end": + return _context.stop(); + } + } + }, _callee); + }))); + describe('When namespacesRequired is not provided', function () { + beforeEach(function () { + fs.readdirSync.mockImplementation(function (path) { + return ['common', "namespace-of-".concat(path.split('/').pop())]; + }); + }); + it('returns all namespaces', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() { + var _props$_nextI18Next, _props$_nextI18Next2; + var props; + return _regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + }); + case 2: + props = _context2.sent; + expect(fs.existsSync).toHaveBeenCalledTimes(4); + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledTimes(2); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect((_props$_nextI18Next = props._nextI18Next) === null || _props$_nextI18Next === void 0 ? void 0 : _props$_nextI18Next.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {} + } + }); + expect((_props$_nextI18Next2 = props._nextI18Next) === null || _props$_nextI18Next2 === void 0 ? void 0 : _props$_nextI18Next2.ns).toEqual(['common', 'namespace-of-en-US']); + case 9: + case "end": + return _context2.stop(); + } + } + }, _callee2); + }))); + it('returns all namespaces with fallbackLng (as string)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() { + var _props$_nextI18Next3, _props$_nextI18Next4; + var props; + return _regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'fr-BE', + fallbackLng: 'fr', + locales: ['nl-BE', 'fr-BE', 'en-US'] + } + }); + case 2: + props = _context3.sent; + expect(fs.existsSync).toHaveBeenCalledTimes(6); + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect(fs.readdirSync).toHaveBeenCalledTimes(4); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect((_props$_nextI18Next3 = props._nextI18Next) === null || _props$_nextI18Next3 === void 0 ? void 0 : _props$_nextI18Next3.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect((_props$_nextI18Next4 = props._nextI18Next) === null || _props$_nextI18Next4 === void 0 ? void 0 : _props$_nextI18Next4.ns).toStrictEqual(['common', 'namespace-of-en-US', 'namespace-of-fr']); + case 11: + case "end": + return _context3.stop(); + } + } + }, _callee3); + }))); + it('returns all namespaces with fallbackLng (as array)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() { + var _props$_nextI18Next5, _props$_nextI18Next6; + var props; + return _regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'en-US', + fallbackLng: ['en', 'fr'], + locales: ['en-US', 'fr-CA'] + } + }); + case 2: + props = _context4.sent; + expect(fs.existsSync).toHaveBeenCalledTimes(8); + expect(fs.readdirSync).toHaveBeenCalledTimes(6); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect((_props$_nextI18Next5 = props._nextI18Next) === null || _props$_nextI18Next5 === void 0 ? void 0 : _props$_nextI18Next5.initialI18nStore).toEqual({ + en: { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + 'en-US': { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect((_props$_nextI18Next6 = props._nextI18Next) === null || _props$_nextI18Next6 === void 0 ? void 0 : _props$_nextI18Next6.ns).toEqual(['common', 'namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']); + case 10: + case "end": + return _context4.stop(); + } + } + }, _callee4); + }))); + it('returns all namespaces with fallbackLng (as object)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() { + var _props$_nextI18Next7, _props$_nextI18Next8; + var props; + return _regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + _context5.next = 2; + return serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'nl-BE', + fallbackLng: { + "default": ['fr'], + 'nl-BE': ['en'] + }, + locales: ['nl-BE', 'fr-BE', 'en-US'] + } + }); + case 2: + props = _context5.sent; + expect(fs.existsSync).toHaveBeenCalledTimes(6); + expect(fs.readdirSync).toHaveBeenCalledTimes(4); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')); + expect((_props$_nextI18Next7 = props._nextI18Next) === null || _props$_nextI18Next7 === void 0 ? void 0 : _props$_nextI18Next7.initialI18nStore).toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + }, + fr: { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {} + } + }); + expect((_props$_nextI18Next8 = props._nextI18Next) === null || _props$_nextI18Next8 === void 0 ? void 0 : _props$_nextI18Next8.ns).toEqual(['common', 'namespace-of-en-US', 'namespace-of-fr']); + case 9: + case "end": + return _context5.stop(); + } + } + }, _callee5); + }))); + it('loads extra locales when extraLocales is provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() { + var _props$_nextI18Next9, _props$_nextI18Next10; + var props; + return _regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + _context6.next = 2; + return serverSideTranslations('de-CH', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-BE', 'nl-BE', 'de-CH'] + } + }, ['en-US', 'fr-BE', 'fr-BE']); + case 2: + props = _context6.sent; + expect(fs.existsSync).toHaveBeenCalledTimes(7); + expect(fs.readdirSync).toHaveBeenCalledTimes(5); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/de-CH')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr-BE')); + expect((_props$_nextI18Next9 = props._nextI18Next) === null || _props$_nextI18Next9 === void 0 ? void 0 : _props$_nextI18Next9.initialI18nStore).toEqual({ + 'de-CH': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + }, + 'en-US': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + }, + 'fr-BE': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {} + } + }); + expect((_props$_nextI18Next10 = props._nextI18Next) === null || _props$_nextI18Next10 === void 0 ? void 0 : _props$_nextI18Next10.ns).toEqual(['common', 'namespace-of-de-CH', 'namespace-of-en-US', 'namespace-of-fr-BE']); + case 10: + case "end": + return _context6.stop(); + } + } + }, _callee6); + }))); + it('does not load extra locales when extraLocales is false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() { + var _props$_nextI18Next11, _props$_nextI18Next12; + var props; + return _regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + _context7.next = 2; + return serverSideTranslations('de-CH', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-BE', 'nl-BE', 'de-CH'] + } + }, false); + case 2: + props = _context7.sent; + expect(fs.existsSync).toHaveBeenCalledTimes(6); + expect(fs.readdirSync).toHaveBeenCalledTimes(4); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/de')); + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en')); + expect((_props$_nextI18Next11 = props._nextI18Next) === null || _props$_nextI18Next11 === void 0 ? void 0 : _props$_nextI18Next11.initialI18nStore).toEqual({ + 'de-CH': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {} + }, + 'en-US': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {} + } + }); + expect((_props$_nextI18Next12 = props._nextI18Next) === null || _props$_nextI18Next12 === void 0 ? void 0 : _props$_nextI18Next12.ns).toEqual(['common', 'namespace-of-de-CH', 'namespace-of-en-US']); + case 9: + case "end": + return _context7.stop(); + } + } + }, _callee7); + }))); + }); + it('does load fallback locales with fallbackLng (as array)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() { + var _props$_nextI18Next13, _props$_nextI18Next14; + var props; + return _regeneratorRuntime.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + _context8.next = 2; + return serverSideTranslations('en-US', ['common'], { + fallbackLng: ['de'], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-AT'] + } + }, false); + case 2: + props = _context8.sent; + expect((_props$_nextI18Next13 = props._nextI18Next) === null || _props$_nextI18Next13 === void 0 ? void 0 : _props$_nextI18Next13.initialI18nStore).toEqual({ + de: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect((_props$_nextI18Next14 = props._nextI18Next) === null || _props$_nextI18Next14 === void 0 ? void 0 : _props$_nextI18Next14.ns).toEqual(['common']); + case 5: + case "end": + return _context8.stop(); + } + } + }, _callee8); + }))); + it('does load fallback locales with fallbackLng (as object)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() { + var _props$_nextI18Next15, _props$_nextI18Next16; + var props; + return _regeneratorRuntime.wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + _context9.next = 2; + return serverSideTranslations('en-US', ['common'], { + fallbackLng: { + 'de-AT': ['de'], + "default": ['en'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-AT'] + } + }, false); + case 2: + props = _context9.sent; + expect((_props$_nextI18Next15 = props._nextI18Next) === null || _props$_nextI18Next15 === void 0 ? void 0 : _props$_nextI18Next15.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect((_props$_nextI18Next16 = props._nextI18Next) === null || _props$_nextI18Next16 === void 0 ? void 0 : _props$_nextI18Next16.ns).toEqual(['common']); + case 5: + case "end": + return _context9.stop(); + } + } + }, _callee9); + }))); + it('does load fallback locales with fallbackLng (as function)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() { + var _props$_nextI18Next17, _props$_nextI18Next18; + var props; + return _regeneratorRuntime.wrap(function _callee10$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + _context10.next = 2; + return serverSideTranslations('en-US', ['common'], { + fallbackLng: function fallbackLng(code) { + return code.split('-')[0]; + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + } + }, false); + case 2: + props = _context10.sent; + expect((_props$_nextI18Next17 = props._nextI18Next) === null || _props$_nextI18Next17 === void 0 ? void 0 : _props$_nextI18Next17.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + expect((_props$_nextI18Next18 = props._nextI18Next) === null || _props$_nextI18Next18 === void 0 ? void 0 : _props$_nextI18Next18.ns).toEqual(['common']); + case 5: + case "end": + return _context10.stop(); + } + } + }, _callee10); + }))); + describe('When nonExplicitSupportedLngs is true', function () { + it('does load fallback locales', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() { + var _props$_nextI18Next19; + var props; + return _regeneratorRuntime.wrap(function _callee11$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + _context11.next = 2; + return serverSideTranslations('en-US', ['common'], { + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'] + }, + nonExplicitSupportedLngs: true + }, false); + case 2: + props = _context11.sent; + expect((_props$_nextI18Next19 = props._nextI18Next) === null || _props$_nextI18Next19 === void 0 ? void 0 : _props$_nextI18Next19.initialI18nStore).toEqual({ + de: { + common: {} + }, + en: { + common: {} + }, + 'en-US': { + common: {} + } + }); + case 4: + case "end": + return _context11.stop(); + } + } + }, _callee11); + }))); + it('does load fallback locales with fallbackLng (as array)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() { + var _props$_nextI18Next20; + var props; + return _regeneratorRuntime.wrap(function _callee12$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + _context12.next = 2; + return serverSideTranslations('en-US', ['common'], { + fallbackLng: ['fr'], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'fr'] + }, + nonExplicitSupportedLngs: true + }, false); + case 2: + props = _context12.sent; + expect((_props$_nextI18Next20 = props._nextI18Next) === null || _props$_nextI18Next20 === void 0 ? void 0 : _props$_nextI18Next20.initialI18nStore).toEqual({ + en: { + common: {} + }, + 'en-US': { + common: {} + }, + fr: { + common: {} + } + }); + case 4: + case "end": + return _context12.stop(); + } + } + }, _callee12); + }))); + it('does load fallback locales with fallbackLng (as object)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13() { + var _props$_nextI18Next21; + var props; + return _regeneratorRuntime.wrap(function _callee13$(_context13) { + while (1) { + switch (_context13.prev = _context13.next) { + case 0: + _context13.next = 2; + return serverSideTranslations('en-US', ['common'], { + fallbackLng: { + "default": ['fr'], + 'en-US': ['de'] + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-DE'] + }, + nonExplicitSupportedLngs: true + }, false); + case 2: + props = _context13.sent; + expect((_props$_nextI18Next21 = props._nextI18Next) === null || _props$_nextI18Next21 === void 0 ? void 0 : _props$_nextI18Next21.initialI18nStore).toEqual({ + de: { + common: {} + }, + en: { + common: {} + }, + 'en-US': { + common: {} + }, + fr: { + common: {} + } + }); + case 4: + case "end": + return _context13.stop(); + } + } + }, _callee13); + }))); + it('does thrown an error with fallbackLng (as function)', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14() { + var config; + return _regeneratorRuntime.wrap(function _callee14$(_context14) { + while (1) { + switch (_context14.prev = _context14.next) { + case 0: + config = { + fallbackLng: function fallbackLng(code) { + return code === 'de-AT' ? 'de' : 'en'; + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-DE'] + }, + nonExplicitSupportedLngs: true + }; + _context14.next = 3; + return expect(serverSideTranslations('de-DE', ['common'], config)).rejects.toThrow('If nonExplicitSupportedLngs is true, no functions are allowed for fallbackLng'); + case 3: + case "end": + return _context14.stop(); + } + } + }, _callee14); + }))); + }); + it('returns props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15() { + var props; + return _regeneratorRuntime.wrap(function _callee15$(_context15) { + while (1) { + switch (_context15.prev = _context15.next) { + case 0: + _context15.next = 2; + return serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + }); + case 2: + props = _context15.sent; + expect(props).toEqual({ + _nextI18Next: { + initialI18nStore: { + 'en-US': {} + }, + initialLocale: 'en-US', + ns: [], + userConfig: { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + } + } + } + }); + case 4: + case "end": + return _context15.stop(); + } + } + }, _callee15); + }))); + it('calls reloadResources when reloadOnPrerender option is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16() { + return _regeneratorRuntime.wrap(function _callee16$(_context16) { + while (1) { + switch (_context16.prev = _context16.next) { + case 0: + renderDummyComponent(); + if (globalI18n) { + globalI18n.reloadResources = jest.fn(); + } + _context16.next = 4; + return serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + }, + reloadOnPrerender: true + }); + case 4: + expect(globalI18n === null || globalI18n === void 0 ? void 0 : globalI18n.reloadResources).toHaveBeenCalledTimes(1); + case 5: + case "end": + return _context16.stop(); + } + } + }, _callee16); + }))); + it('does not call reloadResources when reloadOnPrerender option is false', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17() { + return _regeneratorRuntime.wrap(function _callee17$(_context17) { + while (1) { + switch (_context17.prev = _context17.next) { + case 0: + renderDummyComponent(); + if (globalI18n) { + globalI18n.reloadResources = jest.fn(); + } + _context17.next = 4; + return serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'] + }, + reloadOnPrerender: false + }); + case 4: + expect(globalI18n === null || globalI18n === void 0 ? void 0 : globalI18n.reloadResources).toHaveBeenCalledTimes(0); + case 5: + case "end": + return _context17.stop(); + } + } + }, _callee17); + }))); + it('throws if a function is used for localePath and namespaces are not provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18() { + var localePathFn, config; + return _regeneratorRuntime.wrap(function _callee18$(_context18) { + while (1) { + switch (_context18.prev = _context18.next) { + case 0: + localePathFn = function localePathFn(locale, namespace, missing) { + return "".concat(missing, "/").concat(namespace, "/").concat(locale, ".json"); + }; + config = { + i18n: { + defaultLocale: 'en', + locales: ['en'] + }, + localePath: localePathFn, + ns: ['common'] + }; + _context18.next = 4; + return expect(serverSideTranslations('en-US', undefined, config)).rejects.toMatchObject({ + message: 'Must provide namespacesRequired to serverSideTranslations when using a function as localePath' + }); + case 4: + case "end": + return _context18.stop(); + } + } + }, _callee18); + }))); +}); \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/types.js b/packages/next-i18next/dist/esm/types.js new file mode 100644 index 00000000000..90a05836808 --- /dev/null +++ b/packages/next-i18next/dist/esm/types.js @@ -0,0 +1,4 @@ +/* tslint:disable no-explicit-any */ +import { I18nContext, useTranslation, Trans, withTranslation, DefaultNamespace, Translation } from 'react-i18next'; +import { appWithTranslation, i18n } from './'; +export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, Translation, withTranslation, DefaultNamespace }; \ No newline at end of file diff --git a/packages/next-i18next/dist/esm/utils.js b/packages/next-i18next/dist/esm/utils.js new file mode 100644 index 00000000000..0d1d89230cb --- /dev/null +++ b/packages/next-i18next/dist/esm/utils.js @@ -0,0 +1,22 @@ +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; +import _typeof from "@babel/runtime/helpers/typeof"; +export var getFallbackForLng = function getFallbackForLng(lng, fallbackLng) { + if (typeof fallbackLng === 'string') { + return [fallbackLng]; + } + if (Array.isArray(fallbackLng)) { + return fallbackLng; + } + if (_typeof(fallbackLng) === 'object') { + var fallbackList = fallbackLng[lng]; + var fallbackDefault = fallbackLng["default"]; + return [].concat(_toConsumableArray(fallbackList !== null && fallbackList !== void 0 ? fallbackList : []), _toConsumableArray(fallbackDefault !== null && fallbackDefault !== void 0 ? fallbackDefault : [])); + } + if (typeof fallbackLng === 'function') { + return getFallbackForLng(lng, fallbackLng(lng)); + } + return []; +}; +export var unique = function unique(list) { + return Array.from(new Set(list)); +}; \ No newline at end of file diff --git a/packages/next-i18next/dist/types/appWithTranslation.client.test.d.ts b/packages/next-i18next/dist/types/appWithTranslation.client.test.d.ts new file mode 100644 index 00000000000..9d3efbb8532 --- /dev/null +++ b/packages/next-i18next/dist/types/appWithTranslation.client.test.d.ts @@ -0,0 +1,4 @@ +/** + * @jest-environment jsdom + */ +export {}; diff --git a/packages/next-i18next/dist/types/appWithTranslation.d.ts b/packages/next-i18next/dist/types/appWithTranslation.d.ts new file mode 100644 index 00000000000..d1f83694e72 --- /dev/null +++ b/packages/next-i18next/dist/types/appWithTranslation.d.ts @@ -0,0 +1,10 @@ +import React from 'react'; +import hoistNonReactStatics from 'hoist-non-react-statics'; +import type { AppProps as NextJsAppProps } from 'next/app'; +import { SSRConfig, UserConfig } from './types'; +import { i18n as I18NextClient } from 'i18next'; +export { Trans, useTranslation, withTranslation } from 'react-i18next'; +export declare let globalI18n: I18NextClient | null; +export declare const appWithTranslation: >(WrappedComponent: React.ComponentType, configOverride?: UserConfig | null) => ((props: Props & { + pageProps: Props["pageProps"] & SSRConfig; +}) => JSX.Element) & hoistNonReactStatics.NonReactStatics, {}>; diff --git a/packages/next-i18next/dist/types/appWithTranslation.server.test.d.ts b/packages/next-i18next/dist/types/appWithTranslation.server.test.d.ts new file mode 100644 index 00000000000..3275561ce88 --- /dev/null +++ b/packages/next-i18next/dist/types/appWithTranslation.server.test.d.ts @@ -0,0 +1,4 @@ +/** + * @jest-environment node + */ +export {}; diff --git a/packages/next-i18next/dist/types/config/createConfig.d.ts b/packages/next-i18next/dist/types/config/createConfig.d.ts new file mode 100644 index 00000000000..85876daffbc --- /dev/null +++ b/packages/next-i18next/dist/types/config/createConfig.d.ts @@ -0,0 +1,2 @@ +import { InternalConfig, UserConfig } from '../types'; +export declare const createConfig: (userConfig: UserConfig) => InternalConfig; diff --git a/packages/next-i18next/dist/types/config/createConfig.test.d.ts b/packages/next-i18next/dist/types/config/createConfig.test.d.ts new file mode 100644 index 00000000000..cb0ff5c3b54 --- /dev/null +++ b/packages/next-i18next/dist/types/config/createConfig.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/next-i18next/dist/types/config/defaultConfig.d.ts b/packages/next-i18next/dist/types/config/defaultConfig.d.ts new file mode 100644 index 00000000000..67df87f320a --- /dev/null +++ b/packages/next-i18next/dist/types/config/defaultConfig.d.ts @@ -0,0 +1,22 @@ +export declare const defaultConfig: { + defaultNS: string; + errorStackTraceLimit: number; + i18n: { + defaultLocale: string; + locales: string[]; + }; + readonly initImmediate: boolean; + interpolation: { + escapeValue: boolean; + }; + load: string; + localeExtension: string; + localePath: string; + localeStructure: string; + react: { + useSuspense: boolean; + }; + reloadOnPrerender: boolean; + serializeConfig: boolean; + use: never[]; +}; diff --git a/packages/next-i18next/dist/types/createClient/browser.d.ts b/packages/next-i18next/dist/types/createClient/browser.d.ts new file mode 100644 index 00000000000..1da49e4a673 --- /dev/null +++ b/packages/next-i18next/dist/types/createClient/browser.d.ts @@ -0,0 +1,3 @@ +import { InternalConfig, CreateClientReturn } from '../types'; +declare const _default: (config: InternalConfig) => CreateClientReturn; +export default _default; diff --git a/packages/next-i18next/dist/types/createClient/browser.test.d.ts b/packages/next-i18next/dist/types/createClient/browser.test.d.ts new file mode 100644 index 00000000000..9d3efbb8532 --- /dev/null +++ b/packages/next-i18next/dist/types/createClient/browser.test.d.ts @@ -0,0 +1,4 @@ +/** + * @jest-environment jsdom + */ +export {}; diff --git a/packages/next-i18next/dist/types/createClient/node.d.ts b/packages/next-i18next/dist/types/createClient/node.d.ts new file mode 100644 index 00000000000..1da49e4a673 --- /dev/null +++ b/packages/next-i18next/dist/types/createClient/node.d.ts @@ -0,0 +1,3 @@ +import { InternalConfig, CreateClientReturn } from '../types'; +declare const _default: (config: InternalConfig) => CreateClientReturn; +export default _default; diff --git a/packages/next-i18next/dist/types/createClient/node.test.d.ts b/packages/next-i18next/dist/types/createClient/node.test.d.ts new file mode 100644 index 00000000000..3275561ce88 --- /dev/null +++ b/packages/next-i18next/dist/types/createClient/node.test.d.ts @@ -0,0 +1,4 @@ +/** + * @jest-environment node + */ +export {}; diff --git a/packages/next-i18next/dist/types/index.d.ts b/packages/next-i18next/dist/types/index.d.ts new file mode 100644 index 00000000000..08db8afefca --- /dev/null +++ b/packages/next-i18next/dist/types/index.d.ts @@ -0,0 +1,2 @@ +export { I18nContext, Trans, Translation, useTranslation, withTranslation } from 'react-i18next'; +export { appWithTranslation, globalI18n as i18n } from './appWithTranslation'; diff --git a/packages/next-i18next/dist/types/serverSideTranslations.d.ts b/packages/next-i18next/dist/types/serverSideTranslations.d.ts new file mode 100644 index 00000000000..8c57f843731 --- /dev/null +++ b/packages/next-i18next/dist/types/serverSideTranslations.d.ts @@ -0,0 +1,2 @@ +import { UserConfig, SSRConfig } from './types'; +export declare const serverSideTranslations: (initialLocale: string, namespacesRequired?: string[] | undefined, configOverride?: UserConfig | null, extraLocales?: string[] | false) => Promise; diff --git a/packages/next-i18next/dist/types/serverSideTranslations.test.d.ts b/packages/next-i18next/dist/types/serverSideTranslations.test.d.ts new file mode 100644 index 00000000000..3275561ce88 --- /dev/null +++ b/packages/next-i18next/dist/types/serverSideTranslations.test.d.ts @@ -0,0 +1,4 @@ +/** + * @jest-environment node + */ +export {}; diff --git a/packages/next-i18next/dist/types/types.d.ts b/packages/next-i18next/dist/types/types.d.ts new file mode 100644 index 00000000000..178fdca2d4a --- /dev/null +++ b/packages/next-i18next/dist/types/types.d.ts @@ -0,0 +1,42 @@ +import { I18nContext, useTranslation, Trans, withTranslation, WithTranslation as ReactI18nextWithTranslation, DefaultNamespace, Translation } from 'react-i18next'; +import { InitOptions, i18n as I18NextClient, TFunction as I18NextTFunction } from 'i18next'; +import { appWithTranslation, i18n } from './'; +declare type NextJsI18NConfig = { + defaultLocale: string; + locales: string[]; +}; +export declare type UserConfig = { + i18n: NextJsI18NConfig; + localeExtension?: string; + localePath?: string | ((locale: string, namespace: string, missing: boolean) => string); + localeStructure?: string; + onPreInitI18next?: (i18n: I18n) => void; + reloadOnPrerender?: boolean; + serializeConfig?: boolean; + use?: any[]; +} & InitOptions; +export declare type InternalConfig = Omit & NextJsI18NConfig & { + errorStackTraceLimit: number; + preload: string[]; + supportedLngs: string[]; +}; +export declare type UseTranslation = typeof useTranslation; +export declare type AppWithTranslation = typeof appWithTranslation; +export declare type TFunction = I18NextTFunction; +export declare type I18n = I18NextClient; +export declare type WithTranslationHocType = typeof withTranslation; +export declare type WithTranslation = ReactI18nextWithTranslation; +export declare type InitPromise = Promise; +export declare type CreateClientReturn = { + i18n: I18n; + initPromise: InitPromise; +}; +export declare type SSRConfig = { + _nextI18Next?: { + initialI18nStore: any; + initialLocale: string; + ns: string[]; + userConfig: UserConfig | null; + }; +}; +export { i18n, I18nContext, appWithTranslation, useTranslation, Trans, Translation, withTranslation, DefaultNamespace, }; diff --git a/packages/next-i18next/dist/types/utils.d.ts b/packages/next-i18next/dist/types/utils.d.ts new file mode 100644 index 00000000000..dbcba4c6dfd --- /dev/null +++ b/packages/next-i18next/dist/types/utils.d.ts @@ -0,0 +1,3 @@ +import { FallbackLng } from 'i18next'; +export declare const getFallbackForLng: (lng: string, fallbackLng: false | FallbackLng) => string[]; +export declare const unique: (list: string[]) => string[]; diff --git a/packages/next-i18next/jest.config.js b/packages/next-i18next/jest.config.js new file mode 100644 index 00000000000..769b11fae26 --- /dev/null +++ b/packages/next-i18next/jest.config.js @@ -0,0 +1,19 @@ +module.exports = { + automock: false, + collectCoverage: true, + collectCoverageFrom: [ + 'src/**/*.{js,jsx,ts,tsx}', + ], + moduleDirectories: [ + 'node_modules', + 'src', + ], + moduleNameMapper: { + createClient: '/src/createClient/browser.ts', + }, + testPathIgnorePatterns: [ + '/.next/', + '/dist/', + '/node_modules/', + ], +} diff --git a/packages/next-i18next/package.json b/packages/next-i18next/package.json new file mode 100644 index 00000000000..76e526c77d7 --- /dev/null +++ b/packages/next-i18next/package.json @@ -0,0 +1,145 @@ +{ + "name": "next-i18next", + "version": "12.1.0", + "repository": "git@github.com:i18next/next-i18next.git", + "author": "i18next", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "main": "dist/commonjs/index.js", + "module": "dist/esm/index.js", + "types": "dist/types/types.d.ts", + "license": "MIT", + "engines": { + "node": ">=14" + }, + "description": "The easiest way to translate your NextJs apps.", + "keywords": [ + "react", + "i18next", + "nextjs", + "next", + "translation", + "localisation", + "localization", + "locale" + ], + "scripts": { + "lint2": "eslint src examples", + "clean": "rm -rf ./examples/simple/.next ./examples/ssg/.next ./dist && mkdir dist", + "build:es": "BABEL_ENV=es babel src --extensions '.ts,.tsx' --out-dir dist/es --copy-files", + "build:cjs": "BABEL_ENV=cjs babel src --extensions '.ts,.tsx' --out-dir dist/commonjs --copy-files", + "build:esm": "BABEL_ENV=esm babel src --extensions '.ts,.tsx' --out-dir dist/esm --copy-files", + "build:types": "tsc --noEmit false --declaration --emitDeclarationOnly --outDir dist/types", + "build2": "npm-run-all -s clean build:cjs build:es build:esm build:types", + "build:examples": "npm-run-all -s build:example:*", + "build:example:simple": "cd examples/simple && npm run build", + "build:example:ssg": "cd examples/ssg && npm run build", + "typecheck": "tsc --project ./tsconfig.json --noEmit", + "check-size": "size-limit", + "check-size:why": "size-limit --why", + "check-dist": "npm-run-all -s check-dist:*", + "check-dist:browser-cjs": "es-check --not 'dist/**/*.map.js,dist/commonjs/createClient/package.json,dist/commonjs/**node**.js,dist/commonjs/serverSideTranslations.js' -v es2017 './dist/commonjs/**/*'", + "check-dist:browser-esm": "es-check --not 'dist/**/*.map.js,dist/esm/createClient/package.json,dist/**node**.js,dist/esm/serverSideTranslations.js' -v es2017 --module './dist/esm/**/*'", + "test": "NODE_ENV=test jest --maxWorkers=1 --silent", + "install:examples": "npm-run-all -s install:example:*", + "install:example:simple": "cd examples/simple && npm install", + "install:example:ssg": "cd examples/ssg && npm install", + "move-build-to-examples?": "Hack: see # @link https://github.com/i18next/next-i18next/pull/2012", + "move-build-to-examples": "rimraf ./examples/*/node_modules/next-i18next && cpy './package.json' './*.js' './*.ts' './dist' ./examples/simple/node_modules/next-i18next && cpy './package.json' './*.js' './*.ts' './dist' ./examples/ssg/node_modules/next-i18next", + "test:e2e": "start-server-and-test 'cd examples/simple && npm run start' http://127.0.0.1:3000 cy:run", + "cy:run": "cypress run", + "example": "npm run example:simple", + "example:prod": "npm run example:simple:prod", + "example:simple": "npm run build && cp -r dist examples/simple/node_modules/next-i18next && cd examples/simple && npm run dev", + "example:simple:prod": "npm run build:example:simple && cd examples/simple && npm run start", + "example:ssg": "npm run build && cp -r dist examples/ssg/node_modules/next-i18next && cd examples/ssg && npm run dev", + "example:ssg:prod": "npm run build:example:ssg && cd examples/ssg && npm run start", + "prepublishOnly": "npm run build", + "contributors:check": "all-contributors check", + "contributors:add": "all-contributors add", + "contributors:generate": "all-contributors generate", + "preversion": "npm run test && npm run build && git push", + "postversion": "git push && git push --tags && npm run release", + "release": "gh-release", + "nuke:install": "rimraf '**/node_modules' '**/package-lock.json'" + }, + "husky": { + "hooks": { + "pre-commit": "npm run lint" + } + }, + "devDependencies": { + "@babel/cli": "7.18.10", + "@babel/core": "7.18.10", + "@babel/plugin-proposal-class-properties": "7.18.6", + "@babel/plugin-transform-runtime": "7.18.10", + "@babel/preset-env": "7.18.10", + "@babel/preset-react": "7.18.6", + "@babel/preset-typescript": "7.18.6", + "@size-limit/file": "^8.1.0", + "@size-limit/webpack": "^8.1.0", + "@size-limit/webpack-why": "^8.1.0", + "@testing-library/react": "^13.3.0", + "@types/jest": "^29.2.2", + "@types/node": "^18.7.8", + "@types/react": "^18.0.17", + "@types/react-dom": "^18.0.6", + "@types/testing-library__cypress": "^5.0.9", + "@typescript-eslint/eslint-plugin": "^5.33.1", + "@typescript-eslint/parser": "^5.33.1", + "all-contributors-cli": "^6.20.0", + "babel-core": "7.0.0-bridge.0", + "babel-plugin-add-module-exports": "1.0.4", + "babel-plugin-transform-async-to-generator": "6.24.1", + "cpy-cli": "^4.2.0", + "cypress": "^11.0.1", + "es-check": "^7.0.1", + "eslint": "^8.22.0", + "eslint-plugin-cypress": "^2.12.1", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-jest": "^27.1.4", + "eslint-plugin-prefer-arrow": "^1.2.3", + "eslint-plugin-react": "^7.30.1", + "eslint-plugin-typescript-sort-keys": "^2.1.0", + "gh-release": "6.0.4", + "husky": "^3.0.0", + "i18next": "^22.0.3", + "jest": "^29.3.1", + "jest-environment-jsdom": "^29.3.1", + "next": "^13.0.2", + "npm-run-all": "^4.1.5", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-i18next": "^12.0.0", + "rimraf": "^3.0.2", + "size-limit": "^8.1.0", + "start-server-and-test": "^1.14.0", + "typescript": "^4.7.4", + "webpack": "^5.74.0" + }, + "dependencies": { + "@babel/runtime": "^7.18.9", + "@types/hoist-non-react-statics": "^3.3.1", + "core-js": "^3", + "hoist-non-react-statics": "^3.3.2", + "i18next-fs-backend": "^2.0.0" + }, + "peerDependencies": { + "i18next": "^22.0.3", + "next": ">= 12.0.0", + "react": ">= 17.0.2", + "react-i18next": "^12.0.0" + } +} diff --git a/packages/next-i18next/serverSideTranslations.d.ts b/packages/next-i18next/serverSideTranslations.d.ts new file mode 100644 index 00000000000..b260d3bb1fb --- /dev/null +++ b/packages/next-i18next/serverSideTranslations.d.ts @@ -0,0 +1 @@ +export { serverSideTranslations } from './dist/types/serverSideTranslations' diff --git a/packages/next-i18next/serverSideTranslations.js b/packages/next-i18next/serverSideTranslations.js new file mode 100644 index 00000000000..377f30209b2 --- /dev/null +++ b/packages/next-i18next/serverSideTranslations.js @@ -0,0 +1 @@ +module.exports = require('./dist/commonjs/serverSideTranslations') diff --git a/packages/next-i18next/src/appWithTranslation.client.test.tsx b/packages/next-i18next/src/appWithTranslation.client.test.tsx new file mode 100644 index 00000000000..57df2b7c10f --- /dev/null +++ b/packages/next-i18next/src/appWithTranslation.client.test.tsx @@ -0,0 +1,355 @@ +/** + * @jest-environment jsdom + */ + +import React from 'react' +import fs from 'fs' +import { screen, render } from '@testing-library/react' +import { I18nextProvider } from 'react-i18next' +import createClient from './createClient' + +import { appWithTranslation } from './appWithTranslation' +import { NextRouter } from 'next/router' + +jest.mock('fs', () => ({ + existsSync: jest.fn(), + readdirSync: jest.fn(), +})) + +interface Props { + children: React.ReactNode +} + +const DummyI18nextProvider: React.FC = ({ children }) => ( + <>{children} +) + +jest.mock('react-i18next', () => ({ + I18nextProvider: jest.fn(), + __esmodule: true, +})) + +jest.mock('./createClient', () => jest.fn()) + +const DummyApp = appWithTranslation(() => ( +
Hello world
+), { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'], + }, +}) + +const createProps = (locale = 'en', router: Partial = {}) => ({ + pageProps: { + _nextI18Next: { + initialLocale: locale, + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'], + }, + }, + }, + } as any, + router: { + locale: locale, + route: '/', + ...router, + }, +} as any) + +const defaultRenderProps = createProps() +const renderComponent = (props = defaultRenderProps) => + render( + + ) + +describe('appWithTranslation', () => { + beforeEach(() => { + (fs.existsSync as jest.Mock).mockReturnValue(true); + (fs.readdirSync as jest.Mock).mockReturnValue([]); + (I18nextProvider as jest.Mock).mockImplementation(DummyI18nextProvider) + const actualCreateClient = jest.requireActual('./createClient'); + (createClient as jest.Mock).mockImplementation(actualCreateClient) + }) + afterEach(jest.resetAllMocks) + + it('returns children', () => { + renderComponent() + expect(screen.getByText('Hello world')).toBeTruthy() + }) + + it('respects configOverride', () => { + const DummyAppConfigOverride = appWithTranslation(() => ( +
Hello world
+ ), { + configOverride: 'custom-value', + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'], + }, + } as any) + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + }, + } as any, + } as any + render( + + ) + const [args] = (I18nextProvider as jest.Mock).mock.calls + + expect(screen.getByText('Hello world')).toBeTruthy() + expect(args[0].i18n.options.configOverride).toBe('custom-value') + }) + + it('allows passing configOverride.resources', () => { + const DummyAppConfigOverride = appWithTranslation(() => ( +
Hello world
+ ), { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'], + }, + resources: { + xyz: { + custom: 'resources', + }, + }, + } as any) + render( + + ) + const [args] = (I18nextProvider as jest.Mock).mock.calls + + expect(args[0].i18n.options.resources).toMatchObject({ + xyz: { + custom: 'resources', + }, + }) + }) + + it('throws an error if userConfig and configOverride are both missing', () => { + const DummyAppConfigOverride = appWithTranslation(() => ( +
Hello world
+ )) + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: null, + }, + } as any, + } as any + expect( + () => render( + + ) + ).toThrow('appWithTranslation was called without a next-i18next config') + }) + + it('throws an error if userConfig and configOverride are both missing an i18n property', () => { + const DummyAppConfigOverride = appWithTranslation(() => ( +
Hello world
+ ), {} as any) + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: {}, + }, + } as any, + } as any + expect( + () => render( + + ) + ).toThrow('appWithTranslation was called without config.i18n') + }) + + it('throws an error if userConfig and configOverride are both missing a defaultLocale property', () => { + const DummyAppConfigOverride = appWithTranslation(() => ( +
Hello world
+ ), {i18n: {} as any}) + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: {i18n: {}}, + }, + } as any, + } as any + expect( + () => render( + + ) + ).toThrow('config.i18n does not include a defaultLocale property') + }) + + it('should use the initialLocale property if the router locale is undefined', () => { + const DummyAppConfigOverride = appWithTranslation(() => ( +
Hello world
+ )) + const customProps = { + ...createProps(), + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: {i18n: { + defaultLocale: 'fr', + }}, + }, + } as any, + } as any + + customProps.router = { + ...customProps.router, + locale: undefined, + } + + render( + + ) + + const [args] = (I18nextProvider as jest.Mock).mock.calls + expect(args[0].i18n.language).toBe('en') + }) + + it('should use the userConfig defaltLocale property if the router locale is undefined and initialLocale is undefined', () => { + const DummyAppConfigOverride = appWithTranslation(() => ( +
Hello world
+ )) + const customProps = { + ...createProps(), + + pageProps: { + _nextI18Next: { + initialLocale: undefined, + userConfig: {i18n: { + defaultLocale: 'fr', + }}, + }, + } as any, + } as any + + customProps.router = { + ...customProps.router, + locale: undefined, + } + + render( + + ) + + const [args] = (I18nextProvider as jest.Mock).mock.calls + expect(args[0].i18n.language).toBe('fr') + }) + + it('returns an I18nextProvider', () => { + renderComponent() + expect(I18nextProvider).toHaveBeenCalledTimes(1) + + const [args] = (I18nextProvider as jest.Mock).mock.calls + + expect(I18nextProvider).toHaveBeenCalledTimes(1) + expect(args).toHaveLength(2) + expect(args[0].children).toBeTruthy() + expect(args[0].i18n.addResource).toBeTruthy() + expect(args[0].i18n.language).toBe('en') + expect(args[0].i18n.isInitialized).toBe(true) + + expect(fs.existsSync).toHaveBeenCalledTimes(0) + expect(fs.readdirSync).toHaveBeenCalledTimes(0) + }) + + it('should use locale from router', () => { + renderComponent(createProps('de')) + const [args] = (I18nextProvider as jest.Mock).mock.calls + expect(args[0].i18n.language).toBe('de') + }) + + it('does not re-call createClient on re-renders unless locale or props have changed', () => { + const { rerender } = renderComponent() + expect(createClient).toHaveBeenCalledTimes(1) + rerender( + + ) + expect(createClient).toHaveBeenCalledTimes(1) + const newProps = createProps() + rerender( + + ) + expect(createClient).toHaveBeenCalledTimes(2) + newProps.pageProps._nextI18Next.initialLocale = 'de' + newProps.router.locale = 'de' + rerender( + + ) + expect(createClient).toHaveBeenCalledTimes(3) + }) + + it('assures locale key is set to the right value', () => { + let lng = 'de' + const props = createProps('de') + + const DummyAppWithVar = appWithTranslation(() => ( +
language is: {lng}
+ ), { + i18n: { + defaultLocale: 'en', + locales: ['en', 'de'], + }, + }) + + const { rerender } = render() + + props.router.locale = 'en' + props.pageProps._nextI18Next.initialLocale = 'en' + lng = 'en' + + rerender() + expect(screen.getByText(`language is: ${lng}`)).toBeTruthy() + + props.router.locale = 'de' + props.pageProps._nextI18Next.initialLocale = 'de' + lng = 'de' + + rerender() + expect(screen.getByText(`language is: ${lng}`)).toBeTruthy() + }) +}) diff --git a/packages/next-i18next/src/appWithTranslation.server.test.tsx b/packages/next-i18next/src/appWithTranslation.server.test.tsx new file mode 100644 index 00000000000..4ef2284b023 --- /dev/null +++ b/packages/next-i18next/src/appWithTranslation.server.test.tsx @@ -0,0 +1,91 @@ +/** + * @jest-environment node + */ + +import React from 'react' +import fs from 'fs' +import { I18nextProvider } from 'react-i18next' +import { renderToString } from 'react-dom/server' + +import { appWithTranslation } from './appWithTranslation' +import { AppProps } from 'next/app' + +jest.mock('fs', () => ({ + existsSync: jest.fn(), + readdirSync: jest.fn(), +})) + +interface Props { + children: React.ReactNode +} + +const DummyI18nextProvider: React.FC = ({ children }) => ( + <>{children} +) + +jest.mock('react-i18next', () => ({ + I18nextProvider: jest.fn(), + __esmodule: true, +})) + +const MyApp = ({ Component, pageProps }: AppProps<{ example: string }>) => { + Component + pageProps + return ( +
Hello world
+ ) +} + +const DummyApp = appWithTranslation(MyApp) + +const props = { + pageProps: { + _nextI18Next: { + initialLocale: 'en', + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr'], + }, + }, + }, + } as any, + router: { + locale: 'en', + route: '/', + }, +} as any + +const renderComponent = () => + renderToString( + , + ) + +describe('appWithTranslation', () => { + beforeEach(() => { + (fs.existsSync as jest.Mock).mockReturnValue(true); + (fs.readdirSync as jest.Mock).mockReturnValue([]); + (I18nextProvider as jest.Mock).mockImplementation(DummyI18nextProvider) + }) + afterEach(jest.resetAllMocks) + + + it('returns an I18nextProvider', () => { + renderComponent() + expect(I18nextProvider).toHaveBeenCalledTimes(1) + + const [args] = (I18nextProvider as jest.Mock).mock.calls + + expect(I18nextProvider).toHaveBeenCalledTimes(1) + expect(args).toHaveLength(2) + expect(args[0].children).toBeTruthy() + expect(args[0].i18n.addResource).toBeTruthy() + expect(args[0].i18n.language).toBe('en') + expect(args[0].i18n.isInitialized).toBe(true) + + expect(fs.existsSync).toHaveBeenCalledTimes(3) + expect(fs.readdirSync).toHaveBeenCalledTimes(1) + }) +}) diff --git a/packages/next-i18next/src/appWithTranslation.tsx b/packages/next-i18next/src/appWithTranslation.tsx new file mode 100644 index 00000000000..1cebe4f962d --- /dev/null +++ b/packages/next-i18next/src/appWithTranslation.tsx @@ -0,0 +1,88 @@ +import React, { useMemo } from 'react' +import hoistNonReactStatics from 'hoist-non-react-statics' +import { I18nextProvider } from 'react-i18next' +import type { AppProps as NextJsAppProps } from 'next/app' + +import { createConfig } from './config/createConfig' +import createClient from './createClient' + +import { SSRConfig, UserConfig } from './types' + +import { i18n as I18NextClient } from 'i18next' +export { Trans, useTranslation, withTranslation } from 'react-i18next' + +export let globalI18n: I18NextClient | null = null + +export const appWithTranslation = ( + WrappedComponent: React.ComponentType, + configOverride: UserConfig | null = null, +) => { + const AppWithTranslation = (props: Props & { pageProps: Props['pageProps'] & SSRConfig }) => { + const { _nextI18Next } = props.pageProps + let locale: string | undefined = + _nextI18Next?.initialLocale ?? props?.router?.locale + const ns = _nextI18Next?.ns + + // Memoize the instance and only re-initialize when either: + // 1. The route changes (non-shallowly) + // 2. Router locale changes + // 3. UserConfig override changes + const i18n: I18NextClient | null = useMemo(() => { + if (!_nextI18Next && !configOverride) return null + + const userConfig = configOverride ?? _nextI18Next?.userConfig + + if (!userConfig) { + throw new Error('appWithTranslation was called without a next-i18next config') + } + + if (!userConfig?.i18n) { + throw new Error('appWithTranslation was called without config.i18n') + } + + if (!userConfig?.i18n?.defaultLocale) { + throw new Error('config.i18n does not include a defaultLocale property') + } + + const { initialI18nStore } = _nextI18Next || {} + const resources = + configOverride?.resources ? configOverride.resources : initialI18nStore + + if (!locale) locale = userConfig.i18n.defaultLocale + + const instance = createClient({ + ...createConfig({ + ...userConfig, + lng: locale, + }), + lng: locale, + ns, + resources, + }).i18n + + globalI18n = instance + + return instance + }, [_nextI18Next, locale, configOverride, ns]) + + return i18n !== null ? ( + + + + ) : ( + + ) + } + + return hoistNonReactStatics( + AppWithTranslation, + WrappedComponent, + ) +} diff --git a/packages/next-i18next/src/config/createConfig.test.ts b/packages/next-i18next/src/config/createConfig.test.ts new file mode 100644 index 00000000000..54a8c415560 --- /dev/null +++ b/packages/next-i18next/src/config/createConfig.test.ts @@ -0,0 +1,476 @@ +import fs from 'fs' +import path from 'path' + +import { createConfig } from './createConfig' +import { UserConfig } from '../types' + +jest.mock('fs', () => ({ + existsSync: jest.fn(), + readdirSync: jest.fn(), + statSync: jest.fn(), +})) + +describe('createConfig', () => { + + /** + * @jest-environment node + */ + describe('server side', () => { + beforeAll(() => { + Object.assign(process, { browser: false }) + delete (global as any).window + }) + + describe('when filesystem is as expected', () => { + beforeAll(() => { + (fs.existsSync as jest.Mock).mockReturnValue(true); + (fs.readdirSync as jest.Mock).mockImplementation((locale)=>[`namespace-of-${locale.split('/').pop()}`]); + // eslint-disable-next-line max-len + (fs.statSync as jest.Mock).mockImplementation(()=>({isDirectory:()=>false})) + }) + + it('throws when lng is not provided', () => { + expect(createConfig).toThrow('config.lng was not passed into createConfig') + }) + + it('returns a valid config when only lng is provided', () => { + const config = createConfig({ lng: 'en' } as UserConfig) + + expect((config.backend as any).addPath).toMatch('/public/locales/{{lng}}/{{ns}}.missing.json') + expect((config.backend as any).loadPath).toMatch('/public/locales/{{lng}}/{{ns}}.json') + expect(config.defaultLocale).toBe('en') + expect(config.defaultNS).toBe('common') + expect(config.errorStackTraceLimit).toBe(0) + expect(config.lng).toBe('en') + expect(config.load).toBe('currentOnly') + expect(config.localeExtension).toBe('json') + expect(config.localePath).toBe('./public/locales') + expect(config.localeStructure).toBe('{{lng}}/{{ns}}') + expect(config.locales).toEqual(['en']) + expect(config.ns).toEqual(['namespace-of-en']) + expect(config.preload).toEqual(['en']) + expect(config.use).toEqual([]) + expect(config.react?.useSuspense).toBe(false) + expect(config.interpolation?.escapeValue).toBe(false) + expect(config.interpolation?.format).toBeUndefined() + + expect(fs.existsSync).toHaveBeenCalledTimes(3) + expect(fs.readdirSync).toHaveBeenCalledTimes(1) + }) + + it('gets namespaces from current language + fallback (as string) when ns is not provided', ()=>{ + const config = createConfig({ fallbackLng:'en', lng: 'en-US' } as UserConfig) + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en']) + }) + + it('gets namespaces from current language + fallback (as array) when ns is not provided', ()=>{ + const config = createConfig({ fallbackLng: ['en', 'fr'], lng: 'en-US' } as any) + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']) + }) + + it('gets namespaces from current language + fallback (as object) when ns is not provided', ()=>{ + const fallbackLng = { default: ['fr'], 'en-US': ['en'] } as unknown + const config = createConfig({ fallbackLng, lng: 'en-US' } as UserConfig) + expect(config.ns).toEqual(['namespace-of-en-US', 'namespace-of-en', 'namespace-of-fr']) + }) + + it('deep merges backend', () => { + const config = createConfig({ + backend: { + hello: 'world', + }, + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + lng: 'en', + } as UserConfig) + expect((config.backend as any).hello).toBe('world') + expect((config.backend as any).loadPath).toEqual(path.join(process.cwd(),'/public/locales/{{lng}}/{{ns}}.json')) + }) + + it('deep merges detection', () => { + const config = createConfig({ + detection: { + hello: 'world', + }, + lng: 'en', + } as UserConfig) + expect((config.detection as any).hello).toBe('world') + }) + + describe('fallbackLng', () => { + it('automatically sets if it user does not provide', () => { + const config = createConfig({ + lng: 'en', + } as UserConfig) + + expect(config.fallbackLng).toBe('en') + }) + + it('does not overwrite user provided value', () => { + const config = createConfig({ + fallbackLng: 'hello-world', + lng: 'en', + } as UserConfig) + + expect(config.fallbackLng).toBe('hello-world') + }) + + it('does not overwrite user provided boolean', () => { + const config = createConfig({ + fallbackLng: false, + lng: 'en', + } as UserConfig) + + expect(config.fallbackLng).toBe(false) + }) + }) + }) + + describe('defaultNS validation', () => { + it('when filesystem is missing defaultNS throws an error', () => { + (fs.existsSync as jest.Mock).mockReset(); + (fs.existsSync as jest.Mock).mockReturnValueOnce(false) + + const config = createConfig.bind(null, { + lng: 'en', + } as UserConfig) + + expect(config).toThrow('Default namespace not found at public/locales/en/common.json') + }) + + it('does not throw an error if fallback exists', () => { + (fs.existsSync as jest.Mock).mockReset(); + (fs.existsSync as jest.Mock).mockReturnValueOnce(false) + .mockReturnValueOnce(true) + + const config = createConfig({ + fallbackLng: { + 'en-US': ['en'], + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'], + }, + lng: 'en-US', + } as UserConfig) + + expect(config.fallbackLng).toStrictEqual({ 'en-US': ['en'] }) + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json') + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json') + expect(fs.existsSync).toHaveBeenCalledTimes(4) + }) + + it('does not throw error if fallbackLng has default key and it exists', () => { + (fs.existsSync as jest.Mock).mockReset(); + (fs.existsSync as jest.Mock).mockReturnValueOnce(false) + .mockReturnValueOnce(true) + + createConfig({ + fallbackLng: { + default: ['en'], + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'], + }, + lng: 'en-US', + } as UserConfig) + + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json') + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json') + expect(fs.existsSync).toHaveBeenCalledTimes(4) + }) + + + it('does not throw an error if fallback (as function) exists', () => { + (fs.existsSync as jest.Mock).mockReset(); + (fs.existsSync as jest.Mock).mockReturnValueOnce(false) + .mockReturnValueOnce(true) + + const config = createConfig({ + fallbackLng: (code) => code.split('-')[0], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en', 'en-US'], + }, + lng: 'en-US', + } as UserConfig) + + expect(typeof config.fallbackLng).toBe('function') + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json') + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json') + expect(fs.existsSync).toHaveBeenCalledTimes(4) + }) + + it('does not throw an error if nonExplicitSupportedLngs is true', () => { + (fs.existsSync as jest.Mock).mockReset(); + (fs.existsSync as jest.Mock).mockReturnValueOnce(false) + .mockReturnValueOnce(true) + + const config = createConfig({ + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'], + }, + lng: 'en-US', + nonExplicitSupportedLngs: true, + } as UserConfig) + + expect(typeof config.nonExplicitSupportedLngs).toBe('boolean') + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en-US/common.json') + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json') + expect(fs.existsSync).toHaveBeenCalledTimes(5) + }) + + it('uses user provided prefix/suffix with localeStructure', () => { + (fs.existsSync as jest.Mock).mockReset(); + (fs.existsSync as jest.Mock).mockReturnValueOnce(false) + + const config = createConfig.bind(null, { + interpolation: { + prefix: '^^', + suffix: '$$', + }, + lng: 'en', + localeStructure: '^^lng$$/^^ns$$', + } as UserConfig) + + expect(config).toThrow('Default namespace not found at public/locales/en/common.json') + expect(fs.existsSync).toHaveBeenCalledWith('public/locales/en/common.json') + }) + }) + + describe('hasCustomBackend', () => { + it('returns a config without calling any fs methods', () => { + (fs.existsSync as jest.Mock).mockReset(); + (fs.readdirSync as jest.Mock).mockReset() + + createConfig({ + lng: 'en', use: [{ + type: 'backend', + }] } as UserConfig) + + expect(fs.existsSync).toHaveBeenCalledTimes(0) + expect(fs.readdirSync).toHaveBeenCalledTimes(0) + }) + }) + + describe('ci mode', () => { + it('returns a config without calling any fs methods', () => { + createConfig({ lng: 'cimode' } as UserConfig) + + expect(fs.existsSync).toHaveBeenCalledTimes(0) + expect(fs.readdirSync).toHaveBeenCalledTimes(0) + }) + }) + + describe('with a function for localePath', () => { + const localePathFn: UserConfig['localePath'] = (locale, namespace, missing) => `${missing}/${namespace}/${locale}.json` + + it('returns a config whose localePath works as expected', () => { + (fs.existsSync as jest.Mock).mockReturnValueOnce(true) + const config = createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + lng: 'en', + localePath: localePathFn, + ns: ['common'], + }) + + expect(((config.backend as any).loadPath)('en', 'common')).toBe('false/common/en.json') + expect(((config.backend as any).addPath)('en', 'common')).toBe('true/common/en.json') + }) + + it('when filesystem is missing defaultNS throws an error', () => { + (fs.existsSync as jest.Mock).mockReturnValueOnce(false) + + const config = createConfig.bind(null, { + lng: 'en', + localePath: localePathFn, + } as UserConfig) + + expect(config).toThrow('Default namespace not found at false/common/en.json') + }) + + it('throws an error if namespaces are not provided', () => { + (fs.existsSync as jest.Mock).mockReturnValueOnce(true) + expect(() => createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + lng: 'en', + localePath: localePathFn, + })).toThrow('Must provide all namespaces in ns option if using a function as localePath') + }) + }) + + describe('with default as locale', () => { + beforeAll(() => { + (fs.existsSync as jest.Mock).mockReturnValue(true); + (fs.readdirSync as jest.Mock).mockImplementation((locale)=>[`namespace-of-${locale.split('/').pop()}`]); + // eslint-disable-next-line max-len + (fs.statSync as jest.Mock).mockImplementation(()=>({isDirectory:()=>false})) + }) + // eslint-disable-next-line max-len + // https://nextjs.org/docs/advanced-features/i18n-routing#prefixing-the-default-locale + it('should ignore the default value', () => { + const config = createConfig({ + i18n: { + defaultLocale: 'default', + locales: ['default', 'en', 'de'], + }, + lng: 'de', + }) + expect(config.fallbackLng).toBe('en') + expect(config.preload).toEqual(['en', 'de']) + }) + }) + + describe('when filesystem contains nested namespace structure', () => { + beforeAll(() => { + (fs.existsSync as jest.Mock).mockReset(); + (fs.readdirSync as jest.Mock).mockReset(); + (fs.statSync as jest.Mock).mockReset(); + (fs.existsSync as jest.Mock).mockReturnValue(true) + let level = 0; + (fs.readdirSync as jest.Mock).mockImplementation((locale)=>level === 0 ? ['sub-folder'] : [`namespace-of-${locale.split('/').pop()}`]); + // eslint-disable-next-line max-len + (fs.statSync as jest.Mock).mockImplementation(()=>({isDirectory:()=>++level>1?false:true})) + }) + + it('returns a valid config', () => { + const config = createConfig({ lng: 'en' } as UserConfig) + + expect((config.backend as any).addPath).toMatch('/public/locales/{{lng}}/{{ns}}.missing.json') + expect((config.backend as any).loadPath).toMatch('/public/locales/{{lng}}/{{ns}}.json') + expect(config.defaultLocale).toBe('en') + expect(config.defaultNS).toBe('common') + expect(config.errorStackTraceLimit).toBe(0) + expect(config.lng).toBe('en') + expect(config.load).toBe('currentOnly') + expect(config.localeExtension).toBe('json') + expect(config.localePath).toBe('./public/locales') + expect(config.localeStructure).toBe('{{lng}}/{{ns}}') + expect(config.locales).toEqual(['en']) + expect(config.ns).toEqual(['sub-folder/namespace-of-sub-folder']) + expect(config.preload).toEqual(['en']) + expect(config.use).toEqual([]) + expect(config.react?.useSuspense).toBe(false) + expect(config.interpolation?.escapeValue).toBe(false) + expect(config.interpolation?.format).toBeUndefined() + + expect(fs.existsSync).toHaveBeenCalledTimes(4) + expect(fs.readdirSync).toHaveBeenCalledTimes(2) + expect(fs.statSync).toHaveBeenCalledTimes(2) + }) + }) + }) + + /** + * @jest-environment jsdom + */ + describe('client side', () => { + beforeAll(() => { + Object.assign(process, { browser: true }) + global.window = {} as any + }) + + it('throws when lng is not provided', () => { + expect(createConfig).toThrow('config.lng was not passed into createConfig') + }) + + it('returns a valid config when only lng is provided', () => { + const config = createConfig({ lng: 'en' } as UserConfig) + + expect((config.backend as any).addPath).toMatch('/locales/{{lng}}/{{ns}}.missing.json') + expect((config.backend as any).loadPath).toMatch('/locales/{{lng}}/{{ns}}.json') + expect(config.defaultLocale).toBe('en') + expect(config.defaultNS).toBe('common') + expect(config.errorStackTraceLimit).toBe(0) + expect(config.lng).toBe('en') + expect(config.load).toBe('currentOnly') + expect(config.localeExtension).toBe('json') + expect(config.localePath).toBe('./public/locales') + expect(config.localeStructure).toBe('{{lng}}/{{ns}}') + expect(config.locales).toEqual(['en']) + expect(config.ns).toEqual(['common']) + expect(config.preload).toBeUndefined() + expect(config.use).toEqual([]) + expect(config.react?.useSuspense).toBe(false) + expect(config.interpolation?.escapeValue).toBe(false) + expect(config.interpolation?.format).toBeUndefined() + }) + + it('deep merges backend', () => { + const config = createConfig({ + backend: { + hello: 'world', + }, + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + lng: 'en', + } as UserConfig) + expect((config.backend as any).hello).toBe('world') + expect((config.backend as any).loadPath).toMatch('/locales/{{lng}}/{{ns}}.json') + }) + + it('returns ns as [defaultNS]', () => { + const config = createConfig({ defaultNS: 'core', lng: 'en' } as UserConfig) + expect(config.ns).toEqual(['core']) + }) + + it('returns ns when provided as a string', () => { + const config = createConfig({ lng: 'en', ns: 'core' } as UserConfig) + expect(config.ns).toBe('core') + }) + + it('returns ns when provided as an array', () => { + const config = createConfig({ lng: 'en', ns: ['core', 'page'] } as any) + expect(config.ns).toEqual(['core', 'page']) + }) + + describe('hasCustomBackend', () => { + it('returns the correct configuration', () => { + const config = createConfig({ + backend: { + hello: 'world', + }, + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + lng: 'en', + use: [{ + type: 'backend', + }] } as UserConfig) + expect((config.backend as any)).toEqual({ hello: 'world' }) + }) + }) + + describe('with a function for localePath', () => { + const localePathFn: UserConfig['localePath'] = (locale, namespace, missing) => `${missing}/${namespace}/${locale}.json` + + it('returns a config whose localePath works as expected', () => { + const config = createConfig({ + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + lng: 'en', + localePath: localePathFn, + ns: ['common'], + }) + + expect(((config.backend as any).loadPath)('en', 'common')).toBe('false/common/en.json') + expect(((config.backend as any).addPath)('en', 'common')).toBe('true/common/en.json') + }) + }) + }) +}) diff --git a/packages/next-i18next/src/config/createConfig.ts b/packages/next-i18next/src/config/createConfig.ts new file mode 100644 index 00000000000..10881e02640 --- /dev/null +++ b/packages/next-i18next/src/config/createConfig.ts @@ -0,0 +1,227 @@ +import { defaultConfig } from './defaultConfig' +import { InternalConfig, UserConfig } from '../types' +import { getFallbackForLng, unique } from '../utils' +import { FallbackLngObjList } from 'i18next' + +const deepMergeObjects = ['backend', 'detection'] as (keyof Pick)[] + +export const createConfig = (userConfig: UserConfig): InternalConfig => { + if (typeof userConfig?.lng !== 'string') { + throw new Error('config.lng was not passed into createConfig') + } + + // + // Initial merge of default and user-provided config + // + const { i18n: userI18n, ...userConfigStripped } = userConfig + const { i18n: defaultI18n, ...defaultConfigStripped } = defaultConfig + const combinedConfig = { + ...defaultConfigStripped, + ...userConfigStripped, + ...defaultI18n, + ...userI18n, + } + + const { + defaultNS, + lng, + localeExtension, + localePath, + localeStructure, + nonExplicitSupportedLngs, + } = combinedConfig + + const locales = combinedConfig.locales.filter((l) => l !== 'default') + + /** + * Skips translation file resolution while in cimode + * https://github.com/i18next/next-i18next/pull/851#discussion_r503113620 + */ + if (lng === 'cimode') { + return combinedConfig as InternalConfig + } + + if (typeof combinedConfig.fallbackLng === 'undefined') { + combinedConfig.fallbackLng = combinedConfig.defaultLocale + if (combinedConfig.fallbackLng === 'default') [combinedConfig.fallbackLng] = locales + } + + const { fallbackLng } = combinedConfig + + if (nonExplicitSupportedLngs) { + const createFallbackObject = (acc: FallbackLngObjList, l: string) => { + const [locale] = l.split('-') + acc[l] = [locale] + return acc + } + + if (typeof fallbackLng === 'string') { + combinedConfig.fallbackLng = combinedConfig.locales + .filter(l => l.includes('-')) + .reduce(createFallbackObject, { default: [fallbackLng] }) + } else if (Array.isArray(fallbackLng)) { + combinedConfig.fallbackLng = combinedConfig.locales + .filter(l => l.includes('-')) + .reduce(createFallbackObject, { default: fallbackLng }) + } else if (typeof fallbackLng === 'object') { + combinedConfig.fallbackLng = Object + .entries((combinedConfig.fallbackLng)) + .reduce((acc, [l, f]) => { + acc[l] = l.includes('-') + ? unique([l.split('-')[0], ...f]) + : f + return acc + }, + (fallbackLng as FallbackLngObjList) + ) + } else if (typeof fallbackLng === 'function') { + throw new Error('If nonExplicitSupportedLngs is true, no functions are allowed for fallbackLng') + } + } + + const hasCustomBackend = userConfig?.use?.some((b) => b.type === 'backend') + if (!process.browser && typeof window === 'undefined') { + combinedConfig.preload = locales + + if (!hasCustomBackend) { + const fs = require('fs') + const path = require('path') + + // + // Validate defaultNS + // https://github.com/i18next/next-i18next/issues/358 + // + if (typeof defaultNS === 'string' && typeof lng !== 'undefined') { + if (typeof localePath === 'string') { + const prefix = userConfig?.interpolation?.prefix ?? '{{' + const suffix = userConfig?.interpolation?.suffix ?? '}}' + const defaultLocaleStructure = localeStructure.replace(`${prefix}lng${suffix}`, lng).replace(`${prefix}ns${suffix}`, defaultNS) + const defaultFile = `/${defaultLocaleStructure}.${localeExtension}` + const defaultNSPath = path.join(localePath, defaultFile) + const defaultNSExists = fs.existsSync(defaultNSPath) + const fallback = getFallbackForLng(lng, combinedConfig.fallbackLng) + const defaultFallbackNSExists = fallback.some(f => { + const fallbackFile = defaultFile.replace(lng, f) + const defaultNSPath = path.join(localePath, fallbackFile) + return fs.existsSync(defaultNSPath) + }) + if (!defaultNSExists && !defaultFallbackNSExists && process.env.NODE_ENV !== 'production') { + throw new Error(`Default namespace not found at ${defaultNSPath}`) + } + } else if (typeof localePath === 'function') { + const defaultNSPath = localePath(lng, defaultNS, false) + const defaultNSExists = fs.existsSync(defaultNSPath) + const fallback = getFallbackForLng(lng, combinedConfig.fallbackLng) + const defaultFallbackNSExists = fallback.some(f => { + const defaultNSPath = localePath(f, defaultNS, false) + return fs.existsSync(defaultNSPath) + }) + if (!defaultNSExists && !defaultFallbackNSExists && process.env.NODE_ENV !== 'production') { + throw new Error(`Default namespace not found at ${defaultNSPath}`) + } + } + } + + // + // Set server side backend + // + if (typeof localePath === 'string') { + combinedConfig.backend = { + addPath: path.resolve(process.cwd(), `${localePath}/${localeStructure}.missing.${localeExtension}`), + loadPath: path.resolve(process.cwd(), `${localePath}/${localeStructure}.${localeExtension}`), + } + } else if (typeof localePath === 'function') { + combinedConfig.backend = { + addPath: (locale: string, namespace: string) => + localePath(locale, namespace, true), + loadPath: (locale: string, namespace: string) => + localePath(locale, namespace, false), + } + } else { + throw new Error(`Unsupported localePath type: ${typeof localePath}`) + } + + // + // Set server side preload (namespaces) + // + if (!combinedConfig.ns && typeof lng !== 'undefined') { + if (typeof localePath === 'function') { + throw new Error('Must provide all namespaces in ns option if using a function as localePath') + } + + const getNamespaces = (locales: string[]): string[] => { + const getLocaleNamespaces = (p: string) => { + let ret: string[] = [] + + if (!fs.existsSync(p)) return ret + + fs.readdirSync(p).map( + (file: string) => { + const joinedP = path.join(p, file) + if (fs.statSync(joinedP).isDirectory()) { + const subRet = getLocaleNamespaces(joinedP).map((n) => `${file}/${n}`) + ret = ret.concat(subRet) + return + } + ret.push(file.replace(`.${localeExtension}`, '')) + } + ) + return ret + } + + const namespacesByLocale = locales + .map(locale => getLocaleNamespaces(path.resolve(process.cwd(), `${localePath}/${locale}`))) + + const allNamespaces = [] + for (const localNamespaces of namespacesByLocale) { + allNamespaces.push(...localNamespaces) + } + + return unique(allNamespaces) + } + + combinedConfig.ns = getNamespaces( + unique([lng, ...getFallbackForLng(lng, combinedConfig.fallbackLng)]) + ) + } + } + } else { + + // + // Set client side backend, if there is no custom backend + // + if (!hasCustomBackend) { + if (typeof localePath === 'string') { + combinedConfig.backend = { + addPath: `${localePath}/${localeStructure}.missing.${localeExtension}`, + loadPath: `${localePath}/${localeStructure}.${localeExtension}`, + } + } else if (typeof localePath === 'function') { + combinedConfig.backend = { + addPath: (locale: string, namespace: string) => + localePath(locale, namespace, true), + loadPath: (locale: string, namespace: string) => + localePath(locale, namespace, false), + } + } + } + + if (typeof combinedConfig.ns !== 'string' && !Array.isArray(combinedConfig.ns)) { + combinedConfig.ns = [defaultNS as string] + } + } + + // + // Deep merge with overwrite - goes last + // + deepMergeObjects.forEach((obj) => { + if (userConfig[obj]) { + combinedConfig[obj] = { + ...combinedConfig[obj], + ...userConfig[obj], + } + } + }) + + return combinedConfig as InternalConfig +} diff --git a/packages/next-i18next/src/config/defaultConfig.ts b/packages/next-i18next/src/config/defaultConfig.ts new file mode 100644 index 00000000000..a5774bdfb27 --- /dev/null +++ b/packages/next-i18next/src/config/defaultConfig.ts @@ -0,0 +1,31 @@ +const DEFAULT_LOCALE = 'en' +const LOCALES = ['en'] +const DEFAULT_NAMESPACE = 'common' +const LOCALE_PATH = './public/locales' +const LOCALE_STRUCTURE = '{{lng}}/{{ns}}' +const LOCALE_EXTENSION = 'json' + +export const defaultConfig = { + defaultNS: DEFAULT_NAMESPACE, + errorStackTraceLimit: 0, + i18n: { + defaultLocale: DEFAULT_LOCALE, + locales: LOCALES, + }, + get initImmediate(): boolean { + return process.browser && typeof window !== 'undefined' + }, + interpolation: { + escapeValue: false, + }, + load: 'currentOnly', + localeExtension: LOCALE_EXTENSION, + localePath: LOCALE_PATH, + localeStructure: LOCALE_STRUCTURE, + react: { + useSuspense: false, + }, + reloadOnPrerender: false, + serializeConfig: true, + use: [], +} diff --git a/packages/next-i18next/src/createClient/.eslintrc.json b/packages/next-i18next/src/createClient/.eslintrc.json new file mode 100644 index 00000000000..cf664bafe16 --- /dev/null +++ b/packages/next-i18next/src/createClient/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "rules": { + "import/no-default-export": "off" + } +} diff --git a/packages/next-i18next/src/createClient/browser.test.ts b/packages/next-i18next/src/createClient/browser.test.ts new file mode 100644 index 00000000000..7d54490dd85 --- /dev/null +++ b/packages/next-i18next/src/createClient/browser.test.ts @@ -0,0 +1,34 @@ +/** + * @jest-environment jsdom + */ + +import createClientBrowser from './browser' + +let onPreInitI18nextCalled: any + +const config = { + defaultLocale: 'en', + locales: ['en', 'de'], + onPreInitI18next: (i18n: any) => { + onPreInitI18nextCalled = i18n + }, + use: [], +} as any + +describe('createClientBrowser', () => { + beforeEach(() => { + onPreInitI18nextCalled = null + }) + + it('returns a browser client', () => { + const client = createClientBrowser(config) + expect(typeof client.initPromise.then).toBe('function') + expect(typeof client.i18n.addResource).toBe('function') + expect(typeof (client.i18n as any).translator).toBe('object') + expect( + (client.i18n.options as any).defaultLocale + ).toEqual(config.defaultLocale) + expect((client.i18n.options as any).locales).toEqual(config.locales) + expect(onPreInitI18nextCalled).toEqual(client.i18n) + }) +}) diff --git a/packages/next-i18next/src/createClient/browser.ts b/packages/next-i18next/src/createClient/browser.ts new file mode 100644 index 00000000000..090a6517b71 --- /dev/null +++ b/packages/next-i18next/src/createClient/browser.ts @@ -0,0 +1,21 @@ +import i18n from 'i18next' + +import { InternalConfig, CreateClientReturn, InitPromise } from '../types' + +export default (config: InternalConfig): CreateClientReturn => { + if (config.ns === undefined) config.ns = [] + const instance = i18n.createInstance(config) + let initPromise: InitPromise + + if (!instance.isInitialized) { + config?.use?.forEach(x => instance.use(x)) + if (typeof config.onPreInitI18next === 'function') { + config.onPreInitI18next(instance) + } + initPromise = instance.init(config) + } else { + initPromise = Promise.resolve(i18n.t) + } + + return { i18n: instance, initPromise } +} diff --git a/packages/next-i18next/src/createClient/node.test.ts b/packages/next-i18next/src/createClient/node.test.ts new file mode 100644 index 00000000000..abbf53b159f --- /dev/null +++ b/packages/next-i18next/src/createClient/node.test.ts @@ -0,0 +1,54 @@ +/** + * @jest-environment node + */ + +import createClientNode from './node' + +let onPreInitI18nextCalled: any + +const config = { + defaultLocale: 'en', + locales: ['en', 'de'], + onPreInitI18next: (i18n: any) => { + onPreInitI18nextCalled = i18n + }, + use: [], +} as any + +describe('createClientNode', () => { + let client: { i18n: any, initPromise: any } + + beforeEach(() => { + onPreInitI18nextCalled = null + }) + + it('returns a node client', () => { + client = createClientNode(config) + expect(typeof client.initPromise.then).toBe('function') + expect(typeof client.i18n.addResource).toBe('function') + expect(typeof (client.i18n as any).translator).toBe('object') + expect( + (client.i18n.options as any).defaultLocale + ).toEqual(config.defaultLocale) + expect((client.i18n.options as any).locales).toEqual(config.locales) + expect((client.i18n.options as any).isClone).not.toBe(true) + expect(onPreInitI18nextCalled).toEqual(client.i18n) + }) + + describe('createClientNode a second time should return a clone of i18next', () => { + it('returns a node client', () => { + const secondClient = createClientNode(config) + expect(typeof secondClient.initPromise.then).toBe('function') + expect(typeof secondClient.i18n.addResource).toBe('function') + expect(typeof (secondClient.i18n as any).translator).toBe('object') + expect( + (secondClient.i18n.options as any).defaultLocale + ).toEqual(config.defaultLocale) + expect((secondClient.i18n.options as any).locales).toEqual(config.locales) + expect((secondClient.i18n.options as any).isClone).toBe(true) + expect(secondClient).not.toEqual(client) + expect((secondClient as any).store).toEqual((client as any).store) + expect(onPreInitI18nextCalled).toBeNull() + }) + }) +}) diff --git a/packages/next-i18next/src/createClient/node.ts b/packages/next-i18next/src/createClient/node.ts new file mode 100644 index 00000000000..f7272e8c15f --- /dev/null +++ b/packages/next-i18next/src/createClient/node.ts @@ -0,0 +1,38 @@ +import i18n from 'i18next' +import i18nextFSBackend from 'i18next-fs-backend' + +import { InternalConfig, CreateClientReturn, InitPromise, I18n } from '../types' + +let globalInstance: I18n + +export default (config: InternalConfig): CreateClientReturn => { + if (config.ns === undefined) config.ns = [] + let instance: I18n + if (!globalInstance) { + globalInstance = i18n.createInstance(config) + instance = globalInstance + } else { + instance = globalInstance.cloneInstance({ + ...config, + initImmediate: false, + }) + } + let initPromise: InitPromise + + if (!instance.isInitialized) { + const hasCustomBackend = config?.use?.some((b) => b.type === 'backend') + if (!hasCustomBackend) { + instance.use(i18nextFSBackend) + } + + config?.use?.forEach(x => instance.use(x)) + if (typeof config.onPreInitI18next === 'function') { + config.onPreInitI18next(instance) + } + initPromise = instance.init(config) + } else { + initPromise = Promise.resolve(i18n.t) + } + + return { i18n: instance, initPromise } +} diff --git a/packages/next-i18next/src/createClient/package.json b/packages/next-i18next/src/createClient/package.json new file mode 100644 index 00000000000..1e05149178d --- /dev/null +++ b/packages/next-i18next/src/createClient/package.json @@ -0,0 +1,5 @@ +{ + "name": "next-i18next-create-client", + "browser": "./browser.js", + "main": "./node.js" +} \ No newline at end of file diff --git a/packages/next-i18next/src/index.tsx b/packages/next-i18next/src/index.tsx new file mode 100644 index 00000000000..da8cea6c261 --- /dev/null +++ b/packages/next-i18next/src/index.tsx @@ -0,0 +1,4 @@ +export { I18nContext, Trans, Translation, useTranslation, withTranslation } from 'react-i18next' + +export { appWithTranslation, globalI18n as i18n } from './appWithTranslation' + diff --git a/packages/next-i18next/src/serverSideTranslations.test.tsx b/packages/next-i18next/src/serverSideTranslations.test.tsx new file mode 100644 index 00000000000..548475bd6e8 --- /dev/null +++ b/packages/next-i18next/src/serverSideTranslations.test.tsx @@ -0,0 +1,518 @@ +/** + * @jest-environment node + */ + +import React from 'react' +import fs from 'fs' +import { SSRConfig, UserConfig } from './types' +import { serverSideTranslations } from './serverSideTranslations' +import { globalI18n } from './appWithTranslation' +import { renderToString } from 'react-dom/server' +import { appWithTranslation } from './appWithTranslation' + +jest.mock('fs', () => ({ + existsSync: jest.fn(), + readdirSync: jest.fn(), + statSync: jest.fn(), +})) + +const DummyApp = appWithTranslation(() => ( +
Hello world
+)) + +const props = { + pageProps: { + _nextI18Next: { + initialLocale: 'en-US', + userConfig: { + i18n: { + defaultLocale: 'en', + locales: ['en', 'fr'], + }, + }, + }, + } as SSRConfig, + router: { + locale: 'en', + }, +} as any + +const renderDummyComponent = () => + renderToString( + , + ) + +describe('serverSideTranslations', () => { + beforeAll(() => { + Object.assign(process, { browser: false }) + delete (global as any).window + }) + + beforeEach(() => { + (fs.existsSync as jest.Mock).mockReturnValue(true); + (fs.readdirSync as jest.Mock).mockReturnValue([]); + (fs.statSync as jest.Mock).mockImplementation(()=>({isDirectory:()=>false})) + }) + afterEach(jest.resetAllMocks) + + it('throws if initialLocale is not passed', async () => { + await expect(serverSideTranslations(undefined as any)) + .rejects + .toThrow('Initial locale argument was not passed into serverSideTranslations') + }) + + describe('When namespacesRequired is not provided', () => { + beforeEach(() => { + (fs.readdirSync as jest.Mock).mockImplementation((path) => ['common', `namespace-of-${path.split('/').pop()}`]) + }) + + it('returns all namespaces', async () => { + const props = await serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'], + }, + } as UserConfig) + + expect(fs.existsSync).toHaveBeenCalledTimes(4) + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')) + expect(fs.readdirSync).toHaveBeenCalledTimes(2) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')) + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + }, + }) + expect(props._nextI18Next?.ns).toEqual(['common', 'namespace-of-en-US']) + }) + + it('returns all namespaces with fallbackLng (as string)', async () => { + const props = await serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'fr-BE', + fallbackLng: 'fr', + locales: ['nl-BE', 'fr-BE', 'en-US'], + }, + } as UserConfig) + + expect(fs.existsSync).toHaveBeenCalledTimes(6) + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')) + expect(fs.existsSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')) + expect(fs.readdirSync).toHaveBeenCalledTimes(4) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')) + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {}, + }, + fr: { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {}, + }, + }) + expect(props._nextI18Next?.ns).toStrictEqual(['common', 'namespace-of-en-US', 'namespace-of-fr']) + }) + + it('returns all namespaces with fallbackLng (as array)', async () => { + const props = await serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'en-US', + fallbackLng: ['en', 'fr'], + locales: ['en-US', 'fr-CA'], + }, + } as UserConfig) + + expect(fs.existsSync).toHaveBeenCalledTimes(8) + expect(fs.readdirSync).toHaveBeenCalledTimes(6) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en')) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')) + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + en: { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {}, + }, + 'en-US': { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {}, + }, + fr: { + common: {}, + 'namespace-of-en': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {}, + }, + }) + expect(props._nextI18Next?.ns).toEqual([ + 'common', + 'namespace-of-en-US', + 'namespace-of-en', + 'namespace-of-fr', + ]) + }) + + it('returns all namespaces with fallbackLng (as object)', async () => { + const props = await serverSideTranslations('en-US', undefined, { + i18n: { + defaultLocale: 'nl-BE', + fallbackLng: { default: ['fr'], 'nl-BE': ['en'] }, + locales: ['nl-BE', 'fr-BE', 'en-US'], + }, + } as UserConfig) + + expect(fs.existsSync).toHaveBeenCalledTimes(6) + expect(fs.readdirSync).toHaveBeenCalledTimes(4) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr')) + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + 'en-US': { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {}, + }, + fr: { + common: {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr': {}, + }, + }) + expect(props._nextI18Next?.ns).toEqual([ + 'common', + 'namespace-of-en-US', + 'namespace-of-fr', + ]) + }) + + it('loads extra locales when extraLocales is provided', async () => { + const props = await serverSideTranslations('de-CH', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-BE', 'nl-BE', 'de-CH'], + }, + } as UserConfig, ['en-US', 'fr-BE', 'fr-BE']) + + expect(fs.existsSync).toHaveBeenCalledTimes(7) + expect(fs.readdirSync).toHaveBeenCalledTimes(5) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/de-CH')) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en-US')) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/fr-BE')) + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + 'de-CH': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {}, + }, + 'en-US': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {}, + }, + 'fr-BE': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + 'namespace-of-fr-BE': {}, + }, + }) + expect(props._nextI18Next?.ns).toEqual([ + 'common', + 'namespace-of-de-CH', + 'namespace-of-en-US', + 'namespace-of-fr-BE', + ]) + }) + + it('does not load extra locales when extraLocales is false', async () => { + const props = await serverSideTranslations('de-CH', undefined, { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-BE', 'nl-BE', 'de-CH'], + }, + } as UserConfig, false) + + expect(fs.existsSync).toHaveBeenCalledTimes(6) + expect(fs.readdirSync).toHaveBeenCalledTimes(4) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/de')) + expect(fs.readdirSync).toHaveBeenCalledWith(expect.stringMatching('/public/locales/en')) + + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + 'de-CH': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + }, + 'en-US': { + common: {}, + 'namespace-of-de-CH': {}, + 'namespace-of-en-US': {}, + }, + }) + + expect(props._nextI18Next?.ns).toEqual([ + 'common', + 'namespace-of-de-CH', + 'namespace-of-en-US', + ]) + }) + }) + + it('does load fallback locales with fallbackLng (as array)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: ['de'], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-AT'], + }, + } as UserConfig, false) + + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + de: { + common: {}, + }, + 'en-US': { + common: {}, + }, + }) + + expect(props._nextI18Next?.ns).toEqual([ + 'common', + ]) + }) + + it('does load fallback locales with fallbackLng (as object)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: { 'de-AT': ['de'], default: ['en'] }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-AT'], + }, + } as UserConfig, false) + + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + en: { + common: {}, + }, + 'en-US': { + common: {}, + }, + }) + + expect(props._nextI18Next?.ns).toEqual([ + 'common', + ]) + }) + + it('does load fallback locales with fallbackLng (as function)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: (code) => code.split('-')[0], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'], + }, + } as UserConfig, false) + + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + en: { + common: {}, + }, + 'en-US': { + common: {}, + }, + }) + + expect(props._nextI18Next?.ns).toEqual([ + 'common', + ]) + }) + + describe('When nonExplicitSupportedLngs is true', () => { + + it('does load fallback locales', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US'], + }, + nonExplicitSupportedLngs: true, + } as UserConfig, false) + + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + de: { + common: {}, + }, + en: { + common: {}, + }, + 'en-US': { + common: {}, + }, + }) + }) + + it('does load fallback locales with fallbackLng (as array)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: ['fr'], + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'fr'], + }, + nonExplicitSupportedLngs: true, + } as UserConfig, false) + + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + en: { + common: {}, + }, + 'en-US': { + common: {}, + }, + fr: { + common: {}, + }, + }) + }) + + it('does load fallback locales with fallbackLng (as object)', async () => { + const props = await serverSideTranslations('en-US', ['common'], { + fallbackLng: { + default: ['fr'], + 'en-US': ['de'], + }, + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-DE'], + }, + nonExplicitSupportedLngs: true, + } as UserConfig, false) + + expect(props._nextI18Next?.initialI18nStore) + .toEqual({ + de: { + common: {}, + }, + en: { + common: {}, + }, + 'en-US': { + common: {}, + }, + fr: { + common: {}, + }, + + }) + }) + + it('does thrown an error with fallbackLng (as function)', async () => { + const config: UserConfig = { + fallbackLng: (code) => code === 'de-AT' ? 'de' : 'en', + i18n: { + defaultLocale: 'de', + locales: ['de', 'en-US', 'de-DE'], + }, + nonExplicitSupportedLngs: true, + } + + await expect(serverSideTranslations('de-DE', ['common'], config)) + .rejects.toThrow('If nonExplicitSupportedLngs is true, no functions are allowed for fallbackLng') + }) + }) + + it('returns props', async () => { + const props = await serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'], + }, + } as UserConfig) + + expect(props).toEqual({ + _nextI18Next: { + initialI18nStore: { + 'en-US': {}, + }, + initialLocale: 'en-US', + ns: [], + userConfig: { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'], + }, + }, + }, + }) + }) + + it('calls reloadResources when reloadOnPrerender option is true', async () => { + renderDummyComponent() + + if (globalI18n) { + globalI18n.reloadResources = jest.fn() + } + + await serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'], + }, + reloadOnPrerender: true, + } as UserConfig) + + expect(globalI18n?.reloadResources).toHaveBeenCalledTimes(1) + }) + + it('does not call reloadResources when reloadOnPrerender option is false', async () => { + renderDummyComponent() + + if (globalI18n) { + globalI18n.reloadResources = jest.fn() + } + + await serverSideTranslations('en-US', [], { + i18n: { + defaultLocale: 'en-US', + locales: ['en-US', 'fr-CA'], + }, + reloadOnPrerender: false, + } as UserConfig) + + expect(globalI18n?.reloadResources).toHaveBeenCalledTimes(0) + }) + + it('throws if a function is used for localePath and namespaces are not provided', async () => { + const localePathFn: UserConfig['localePath'] = (locale, namespace, missing) => `${missing}/${namespace}/${locale}.json` + const config: UserConfig = { + i18n: { + defaultLocale: 'en', + locales: ['en'], + }, + localePath: localePathFn, + ns: ['common'], + } + await expect(serverSideTranslations('en-US', undefined, config)) + .rejects.toMatchObject({ message: 'Must provide namespacesRequired to serverSideTranslations when using a function as localePath' }) + }) +}) diff --git a/packages/next-i18next/src/serverSideTranslations.ts b/packages/next-i18next/src/serverSideTranslations.ts new file mode 100644 index 00000000000..c87a59cc89a --- /dev/null +++ b/packages/next-i18next/src/serverSideTranslations.ts @@ -0,0 +1,100 @@ +import fs from 'fs' +import path from 'path' + +import { createConfig } from './config/createConfig' +import createClient from './createClient/node' + +import { globalI18n } from './appWithTranslation' + +import { UserConfig, SSRConfig } from './types' +import { getFallbackForLng, unique } from './utils' + +const DEFAULT_CONFIG_PATH = './next-i18next.config.js' + +export const serverSideTranslations = async ( + initialLocale: string, + namespacesRequired: string[] | undefined = undefined, + configOverride: UserConfig | null = null, + extraLocales: string[] | false = false, +): Promise => { + if (typeof initialLocale !== 'string') { + throw new Error('Initial locale argument was not passed into serverSideTranslations') + } + + let userConfig = configOverride + + if (!userConfig && fs.existsSync(path.resolve(DEFAULT_CONFIG_PATH))) { + userConfig = await import(path.resolve(DEFAULT_CONFIG_PATH)) + } + + if (userConfig === null) { + throw new Error('next-i18next was unable to find a user config') + } + + const config = createConfig({ + ...userConfig, + lng: initialLocale, + }) + + const { + localeExtension, + localePath, + fallbackLng, + reloadOnPrerender, + } = config + + if (reloadOnPrerender) { + await globalI18n?.reloadResources() + } + + const { i18n, initPromise } = createClient({ + ...config, + lng: initialLocale, + }) + + await initPromise + + const initialI18nStore: Record = { + [initialLocale]: {}, + } + + getFallbackForLng(initialLocale, fallbackLng ?? false) + .concat((extraLocales || [])) + .forEach((lng: string) => { + initialI18nStore[lng] = {} + }) + + if (!Array.isArray(namespacesRequired)) { + if (typeof localePath === 'function') { + throw new Error('Must provide namespacesRequired to serverSideTranslations when using a function as localePath') + } + + const getLocaleNamespaces = (path: string) => + fs.existsSync(path) + ? fs.readdirSync(path).map(file => file.replace(`.${localeExtension}`, '')) + : [] + + const namespacesByLocale = Object.keys(initialI18nStore) + .map(locale => getLocaleNamespaces(path.resolve(process.cwd(), `${localePath}/${locale}`))) + .flat() + + namespacesRequired = unique(namespacesByLocale) + } + + namespacesRequired.forEach((ns) => { + for (const locale in initialI18nStore) { + initialI18nStore[locale][ns] = ( + (i18n.services.resourceStore.data[locale] || {})[ns] || {} + ) + } + }) + + return { + _nextI18Next: { + initialI18nStore, + initialLocale, + ns: namespacesRequired, + userConfig: config.serializeConfig ? userConfig : null, + }, + } +} diff --git a/packages/next-i18next/src/types.ts b/packages/next-i18next/src/types.ts new file mode 100644 index 00000000000..684329a0b87 --- /dev/null +++ b/packages/next-i18next/src/types.ts @@ -0,0 +1,67 @@ +/* tslint:disable no-explicit-any */ +import { + I18nContext, + useTranslation, + Trans, + withTranslation, + WithTranslation as ReactI18nextWithTranslation, + DefaultNamespace, + Translation, +} from 'react-i18next' +import { InitOptions, i18n as I18NextClient, TFunction as I18NextTFunction } from 'i18next' +import { appWithTranslation, i18n } from './' + +type NextJsI18NConfig = { + defaultLocale: string + locales: string[] +} + +export type UserConfig = { + i18n: NextJsI18NConfig + localeExtension?: string + localePath?: + string | ((locale: string, namespace: string, missing: boolean) => string) + localeStructure?: string + onPreInitI18next?: (i18n: I18n) => void + reloadOnPrerender?: boolean + serializeConfig?: boolean + use?: any[] +} & InitOptions + +export type InternalConfig = Omit & NextJsI18NConfig & { + errorStackTraceLimit: number + preload: string[] + supportedLngs: string[] +} + +export type UseTranslation = typeof useTranslation +export type AppWithTranslation = typeof appWithTranslation +export type TFunction = I18NextTFunction +export type I18n = I18NextClient +export type WithTranslationHocType = typeof withTranslation +export type WithTranslation = ReactI18nextWithTranslation +export type InitPromise = Promise +export type CreateClientReturn = { + i18n: I18n + initPromise: InitPromise +} + +export type SSRConfig = { + _nextI18Next?: { + initialI18nStore: any + initialLocale: string + ns: string[] + userConfig: UserConfig | null + } +} + +export { + i18n, + I18nContext, + appWithTranslation, + useTranslation, + Trans, + Translation, + withTranslation, + DefaultNamespace, +} diff --git a/packages/next-i18next/src/utils.ts b/packages/next-i18next/src/utils.ts new file mode 100644 index 00000000000..a59b88dc869 --- /dev/null +++ b/packages/next-i18next/src/utils.ts @@ -0,0 +1,28 @@ +import { FallbackLng, FallbackLngObjList } from 'i18next' + +export const getFallbackForLng = ( + lng: string, + fallbackLng: false | FallbackLng +): string[] => { + if (typeof fallbackLng === 'string') { + return [fallbackLng] + } + + if (Array.isArray(fallbackLng)) { + return fallbackLng + } + + if (typeof fallbackLng === 'object') { + const fallbackList = (fallbackLng as FallbackLngObjList)[lng] + const fallbackDefault = (fallbackLng as FallbackLngObjList).default + return [...(fallbackList ?? []), ...fallbackDefault ?? []] + } + + if (typeof fallbackLng === 'function') { + return getFallbackForLng(lng, fallbackLng(lng)) + } + + return [] +} + +export const unique = (list: string[]) => Array.from(new Set(list)) diff --git a/packages/next-i18next/tsconfig.json b/packages/next-i18next/tsconfig.json new file mode 100644 index 00000000000..53664cafcb0 --- /dev/null +++ b/packages/next-i18next/tsconfig.json @@ -0,0 +1,15 @@ +{ + "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" + ] +} diff --git a/yarn.lock b/yarn.lock index ea16f731674..259b8c2807a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -59,6 +59,33 @@ __metadata: languageName: node linkType: hard +"@babel/cli@npm:7.18.10": + version: 7.18.10 + resolution: "@babel/cli@npm:7.18.10" + dependencies: + "@jridgewell/trace-mapping": "npm:^0.3.8" + "@nicolo-ribaudo/chokidar-2": "npm:2.1.8-no-fsevents.3" + chokidar: "npm:^3.4.0" + commander: "npm:^4.0.1" + convert-source-map: "npm:^1.1.0" + fs-readdir-recursive: "npm:^1.1.0" + glob: "npm:^7.2.0" + make-dir: "npm:^2.1.0" + slash: "npm:^2.0.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + dependenciesMeta: + "@nicolo-ribaudo/chokidar-2": + optional: true + chokidar: + optional: true + bin: + babel: ./bin/babel.js + babel-external-helpers: ./bin/babel-external-helpers.js + checksum: 9f18daf40cad3f8ede4c339738eff46ded13715be24ffe056d5f7a6b6192501404c2537e4e397472e9f8403d46df4b0cc09fd554a24c66e0f79fb99d98e5d3f1 + languageName: node + linkType: hard + "@babel/code-frame@npm:^7.0.0, @babel/code-frame@npm:^7.10.4, @babel/code-frame@npm:^7.12.13, @babel/code-frame@npm:^7.18.6, @babel/code-frame@npm:^7.5.5, @babel/code-frame@npm:^7.8.3": version: 7.18.6 resolution: "@babel/code-frame@npm:7.18.6" @@ -68,10 +95,10 @@ __metadata: languageName: node linkType: hard -"@babel/compat-data@npm:^7.17.7, @babel/compat-data@npm:^7.19.4, @babel/compat-data@npm:^7.20.0": - version: 7.20.0 - resolution: "@babel/compat-data@npm:7.20.0" - checksum: 326e505cf33b7182d215d47c1397062b809ebe1299c13e51d3be7cea3e774c73252e9e2dee0993caa19a5a2ff7837926c2e2c7cb9cc8bc97adf458b3e02eea12 +"@babel/compat-data@npm:^7.17.7, @babel/compat-data@npm:^7.18.8, @babel/compat-data@npm:^7.20.0, @babel/compat-data@npm:^7.20.1": + version: 7.20.1 + resolution: "@babel/compat-data@npm:7.20.1" + checksum: acc27c11a616cb7b91dc218b9a0041a1491d1c74057a41fd9c1c27af615b7a2b5bb3f6921c6e8c7e1bfd617a9f2d174d88e3eaa2ed41146e99d98828fea86b78 languageName: node linkType: hard @@ -99,6 +126,29 @@ __metadata: languageName: node linkType: hard +"@babel/core@npm:7.18.10": + version: 7.18.10 + resolution: "@babel/core@npm:7.18.10" + dependencies: + "@ampproject/remapping": "npm:^2.1.0" + "@babel/code-frame": "npm:^7.18.6" + "@babel/generator": "npm:^7.18.10" + "@babel/helper-compilation-targets": "npm:^7.18.9" + "@babel/helper-module-transforms": "npm:^7.18.9" + "@babel/helpers": "npm:^7.18.9" + "@babel/parser": "npm:^7.18.10" + "@babel/template": "npm:^7.18.10" + "@babel/traverse": "npm:^7.18.10" + "@babel/types": "npm:^7.18.10" + convert-source-map: "npm:^1.7.0" + debug: "npm:^4.1.0" + gensync: "npm:^1.0.0-beta.2" + json5: "npm:^2.2.1" + semver: "npm:^6.3.0" + checksum: ab8812d981b3f52e26927ad2323db68470454788cb7e1d970e65131c46794dcf7bae8d405f6ec05fab6be6af223ab1c9db854066ae4b8db614b86a1191681afe + languageName: node + linkType: hard + "@babel/core@npm:7.20.2, @babel/core@npm:^7.1.0, @babel/core@npm:^7.11.6, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.14.0, @babel/core@npm:^7.18.6, @babel/core@npm:^7.19.1, @babel/core@npm:^7.19.6, @babel/core@npm:^7.7.5": version: 7.20.2 resolution: "@babel/core@npm:7.20.2" @@ -136,14 +186,14 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.12.11, @babel/generator@npm:^7.12.5, @babel/generator@npm:^7.14.0, @babel/generator@npm:^7.20.1, @babel/generator@npm:^7.20.2, @babel/generator@npm:^7.7.2": - version: 7.20.2 - resolution: "@babel/generator@npm:7.20.2" +"@babel/generator@npm:^7.12.11, @babel/generator@npm:^7.12.5, @babel/generator@npm:^7.14.0, @babel/generator@npm:^7.18.10, @babel/generator@npm:^7.20.1, @babel/generator@npm:^7.20.2, @babel/generator@npm:^7.7.2": + version: 7.20.4 + resolution: "@babel/generator@npm:7.20.4" dependencies: "@babel/types": "npm:^7.20.2" "@jridgewell/gen-mapping": "npm:^0.3.2" jsesc: "npm:^2.5.1" - checksum: a0ef272b4074f85865e53e0c0061a8e2fbc1e57ca121a94a9838edf47300640be0ecd752beb0dcd13ba145a4c311cdfa59ea2c6d6ac28fdd9a5f1d5661bcfe4b + checksum: 514c68bf9341db7fc51b53e74294ab2014438169b638507e1d09e2d9990c0bc79d7055b090c80e0406f71e422471fba3dc639381efa11a665015d5b678fac6f8 languageName: node linkType: hard @@ -166,7 +216,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-compilation-targets@npm:^7.13.0, @babel/helper-compilation-targets@npm:^7.17.7, @babel/helper-compilation-targets@npm:^7.18.9, @babel/helper-compilation-targets@npm:^7.19.0, @babel/helper-compilation-targets@npm:^7.19.3, @babel/helper-compilation-targets@npm:^7.20.0": +"@babel/helper-compilation-targets@npm:^7.13.0, @babel/helper-compilation-targets@npm:^7.17.7, @babel/helper-compilation-targets@npm:^7.18.9, @babel/helper-compilation-targets@npm:^7.20.0": version: 7.20.0 resolution: "@babel/helper-compilation-targets@npm:7.20.0" dependencies: @@ -227,7 +277,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-define-polyfill-provider@npm:^0.3.3": +"@babel/helper-define-polyfill-provider@npm:^0.3.2, @babel/helper-define-polyfill-provider@npm:^0.3.3": version: 0.3.3 resolution: "@babel/helper-define-polyfill-provider@npm:0.3.3" dependencies: @@ -296,7 +346,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-transforms@npm:^7.12.1, @babel/helper-module-transforms@npm:^7.18.6, @babel/helper-module-transforms@npm:^7.19.6, @babel/helper-module-transforms@npm:^7.20.2": +"@babel/helper-module-transforms@npm:^7.12.1, @babel/helper-module-transforms@npm:^7.18.6, @babel/helper-module-transforms@npm:^7.18.9, @babel/helper-module-transforms@npm:^7.19.6, @babel/helper-module-transforms@npm:^7.20.2": version: 7.20.2 resolution: "@babel/helper-module-transforms@npm:7.20.2" dependencies: @@ -328,10 +378,10 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.13.0, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.16.7, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.18.9, @babel/helper-plugin-utils@npm:^7.19.0, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": - version: 7.19.0 - resolution: "@babel/helper-plugin-utils@npm:7.19.0" - checksum: 1f5ec25de2ec8789cc9df9ca89ff04a1ea48e372c92c4927a38a96aaf87d2ad2a2aa135630105e9f09a5ec37b220285df1a37e31288b0198f83cbf7d02345f3c +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.13.0, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.16.7, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.18.9, @babel/helper-plugin-utils@npm:^7.19.0, @babel/helper-plugin-utils@npm:^7.20.2, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": + version: 7.20.2 + resolution: "@babel/helper-plugin-utils@npm:7.20.2" + checksum: 52745723617d3e4695a4dbec3728736c4f6d512ff382c36047b6d06117d2db059a65258629c5a42d57bed5eec2db7e473b14e524f611b0b04190b5922ea5d9f5 languageName: node linkType: hard @@ -349,20 +399,20 @@ __metadata: languageName: node linkType: hard -"@babel/helper-replace-supers@npm:^7.18.6, @babel/helper-replace-supers@npm:^7.18.9": - version: 7.18.9 - resolution: "@babel/helper-replace-supers@npm:7.18.9" +"@babel/helper-replace-supers@npm:^7.18.6, @babel/helper-replace-supers@npm:^7.19.1": + version: 7.19.1 + resolution: "@babel/helper-replace-supers@npm:7.19.1" dependencies: "@babel/helper-environment-visitor": "npm:^7.18.9" "@babel/helper-member-expression-to-functions": "npm:^7.18.9" "@babel/helper-optimise-call-expression": "npm:^7.18.6" - "@babel/traverse": "npm:^7.18.9" - "@babel/types": "npm:^7.18.9" - checksum: d77a39efeb9b879bf4d4267f2d6452f615f5ecf920f277fbf963dfb8824d464b3fd88d9f82c0a7a109eb19400597fab66e873f70b731ecac22a035a1d384e971 + "@babel/traverse": "npm:^7.19.1" + "@babel/types": "npm:^7.19.0" + checksum: 333242e1f32dfeb3809fd92829f236b08464db1028c19170c734b0b03d253d39660fb5f9264c638e2d067ea24bcac4fb5d3ea34208a67b0ad751b72823861b5a languageName: node linkType: hard -"@babel/helper-simple-access@npm:^7.18.6, @babel/helper-simple-access@npm:^7.20.2": +"@babel/helper-simple-access@npm:^7.19.4, @babel/helper-simple-access@npm:^7.20.2": version: 7.20.2 resolution: "@babel/helper-simple-access@npm:7.20.2" dependencies: @@ -422,7 +472,7 @@ __metadata: languageName: node linkType: hard -"@babel/helpers@npm:^7.12.5, @babel/helpers@npm:^7.20.1": +"@babel/helpers@npm:^7.12.5, @babel/helpers@npm:^7.18.9, @babel/helpers@npm:^7.20.1": version: 7.20.1 resolution: "@babel/helpers@npm:7.20.1" dependencies: @@ -477,9 +527,9 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-async-generator-functions@npm:^7.19.1": - version: 7.19.1 - resolution: "@babel/plugin-proposal-async-generator-functions@npm:7.19.1" +"@babel/plugin-proposal-async-generator-functions@npm:^7.18.10, @babel/plugin-proposal-async-generator-functions@npm:^7.20.1": + version: 7.20.1 + resolution: "@babel/plugin-proposal-async-generator-functions@npm:7.20.1" dependencies: "@babel/helper-environment-visitor": "npm:^7.18.9" "@babel/helper-plugin-utils": "npm:^7.19.0" @@ -487,7 +537,7 @@ __metadata: "@babel/plugin-syntax-async-generators": "npm:^7.8.4" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 84df82ac7576106a4bddbc256e8b6f88f4b919b52dc646319e1232352c168e2c15e6f5c0699341d22068883d294659dd09406f8634a12d36be023c6a859e8e89 + checksum: 70b3a7262a3b4a396751dcde059bce687fda86031c632b08f0427f615a2dd0938c7146b647719c880c2089c8ef5f7ca512fd77ef8a54345aa1ce7128e67525ba languageName: node linkType: hard @@ -503,7 +553,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-class-properties@npm:^7.0.0, @babel/plugin-proposal-class-properties@npm:^7.12.1, @babel/plugin-proposal-class-properties@npm:^7.13.0, @babel/plugin-proposal-class-properties@npm:^7.18.6": +"@babel/plugin-proposal-class-properties@npm:7.18.6, @babel/plugin-proposal-class-properties@npm:^7.0.0, @babel/plugin-proposal-class-properties@npm:^7.12.1, @babel/plugin-proposal-class-properties@npm:^7.13.0, @babel/plugin-proposal-class-properties@npm:^7.18.6": version: 7.18.6 resolution: "@babel/plugin-proposal-class-properties@npm:7.18.6" dependencies: @@ -638,18 +688,18 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-object-rest-spread@npm:^7.0.0, @babel/plugin-proposal-object-rest-spread@npm:^7.12.1, @babel/plugin-proposal-object-rest-spread@npm:^7.19.4": - version: 7.19.4 - resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.19.4" +"@babel/plugin-proposal-object-rest-spread@npm:^7.0.0, @babel/plugin-proposal-object-rest-spread@npm:^7.12.1, @babel/plugin-proposal-object-rest-spread@npm:^7.18.9, @babel/plugin-proposal-object-rest-spread@npm:^7.20.2": + version: 7.20.2 + resolution: "@babel/plugin-proposal-object-rest-spread@npm:7.20.2" dependencies: - "@babel/compat-data": "npm:^7.19.4" - "@babel/helper-compilation-targets": "npm:^7.19.3" - "@babel/helper-plugin-utils": "npm:^7.19.0" + "@babel/compat-data": "npm:^7.20.1" + "@babel/helper-compilation-targets": "npm:^7.20.0" + "@babel/helper-plugin-utils": "npm:^7.20.2" "@babel/plugin-syntax-object-rest-spread": "npm:^7.8.3" - "@babel/plugin-transform-parameters": "npm:^7.18.8" + "@babel/plugin-transform-parameters": "npm:^7.20.1" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: c8afb763382d0f55a3ee3dcd421fcf82364572eed2a76283ca76f93dcd2725575f4b3a9fc947211b180d3361fc6358bec90edad1cf04079e5c92b5c20df45955 + checksum: 82b98344b3e8864952e372c7d0b7bb80ea12ffe37feb5d0ddac8a9fe74b6e59320dc2b2acd321aafd97c019b01fede37de0f4d99756eb290db6ea51745099c7c languageName: node linkType: hard @@ -815,14 +865,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-import-assertions@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-syntax-import-assertions@npm:7.18.6" +"@babel/plugin-syntax-import-assertions@npm:^7.18.6, @babel/plugin-syntax-import-assertions@npm:^7.20.0": + version: 7.20.0 + resolution: "@babel/plugin-syntax-import-assertions@npm:7.20.0" dependencies: - "@babel/helper-plugin-utils": "npm:^7.18.6" + "@babel/helper-plugin-utils": "npm:^7.19.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 0401bca7a83dfda76cc8f69f680be52b72f8f1a875ed70752eccf0b571f19e6300a31277a130034c61de11d19d82f48cdd2daf75efd127d2c218a0bc93c2baff + checksum: aacaffc396ce5d55b577bde778b9aaf8a6fc65e5f0697ae57a8f9020c64c239a50983a4337963eca7909c89a145411be4ec15e02229054f4d0397fa0b9f2e950 languageName: node linkType: hard @@ -1004,33 +1054,33 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-block-scoping@npm:^7.0.0, @babel/plugin-transform-block-scoping@npm:^7.12.12, @babel/plugin-transform-block-scoping@npm:^7.19.4": - version: 7.20.0 - resolution: "@babel/plugin-transform-block-scoping@npm:7.20.0" +"@babel/plugin-transform-block-scoping@npm:^7.0.0, @babel/plugin-transform-block-scoping@npm:^7.12.12, @babel/plugin-transform-block-scoping@npm:^7.18.9, @babel/plugin-transform-block-scoping@npm:^7.20.2": + version: 7.20.2 + resolution: "@babel/plugin-transform-block-scoping@npm:7.20.2" dependencies: - "@babel/helper-plugin-utils": "npm:^7.19.0" + "@babel/helper-plugin-utils": "npm:^7.20.2" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: bb6dbe5f7fad8707058b09c06f6b5669b18b6629d71e5e6efcdf269cde74b8e9694fd849431c4acb4c144b5547129031e92730d0e688fb13106a7d2f936f0c3d + checksum: f045ee1c3a3f4e5276da24caeefc69fa78874f23117e33e1b84b6ebf1d36cb4665567842fada385edd5d2ed07194da3d516ce61b121dce141ceed1fd9b9f8969 languageName: node linkType: hard -"@babel/plugin-transform-classes@npm:^7.0.0, @babel/plugin-transform-classes@npm:^7.12.1, @babel/plugin-transform-classes@npm:^7.19.0": - version: 7.19.0 - resolution: "@babel/plugin-transform-classes@npm:7.19.0" +"@babel/plugin-transform-classes@npm:^7.0.0, @babel/plugin-transform-classes@npm:^7.12.1, @babel/plugin-transform-classes@npm:^7.18.9, @babel/plugin-transform-classes@npm:^7.20.2": + version: 7.20.2 + resolution: "@babel/plugin-transform-classes@npm:7.20.2" dependencies: "@babel/helper-annotate-as-pure": "npm:^7.18.6" - "@babel/helper-compilation-targets": "npm:^7.19.0" + "@babel/helper-compilation-targets": "npm:^7.20.0" "@babel/helper-environment-visitor": "npm:^7.18.9" "@babel/helper-function-name": "npm:^7.19.0" "@babel/helper-optimise-call-expression": "npm:^7.18.6" - "@babel/helper-plugin-utils": "npm:^7.19.0" - "@babel/helper-replace-supers": "npm:^7.18.9" + "@babel/helper-plugin-utils": "npm:^7.20.2" + "@babel/helper-replace-supers": "npm:^7.19.1" "@babel/helper-split-export-declaration": "npm:^7.18.6" globals: "npm:^11.1.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 9e81ecc7c16f5b8af9f849f9c936c27b2fda40f7941210b60c21701a4ce507903b0d06b03181409edd391684cc3e3ed2deef741284a608e8d854d93e46c1fe7b + checksum: dd6e9a4e1dd1257cc6260e22d7a3c882ccce4609d21d15bce7b2cf6e9868bc4e1d0fd7df36d4094863f1a0351b03d4418ad63f400aac2784cec9747c7350aa62 languageName: node linkType: hard @@ -1045,14 +1095,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-destructuring@npm:^7.0.0, @babel/plugin-transform-destructuring@npm:^7.12.1, @babel/plugin-transform-destructuring@npm:^7.19.4": - version: 7.20.0 - resolution: "@babel/plugin-transform-destructuring@npm:7.20.0" +"@babel/plugin-transform-destructuring@npm:^7.0.0, @babel/plugin-transform-destructuring@npm:^7.12.1, @babel/plugin-transform-destructuring@npm:^7.18.9, @babel/plugin-transform-destructuring@npm:^7.20.2": + version: 7.20.2 + resolution: "@babel/plugin-transform-destructuring@npm:7.20.2" dependencies: - "@babel/helper-plugin-utils": "npm:^7.19.0" + "@babel/helper-plugin-utils": "npm:^7.20.2" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 68e846fc7b64312aa65581d106e4bad8a5a3f6e80b6d185d8ecba74b007d6d2002cdaa44bed8573b0f40fe5f41cd395b12606c14f52bda1806b71566588ae6a6 + checksum: 234180c8bbca73ee81de9867ca114e9b7e9e6f814c321ac84a35f07be20ac7b13614a130ff7e979345c90e38282fa1fd427841c9cac70ec6d152feb5f19c254e languageName: node linkType: hard @@ -1149,34 +1199,32 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-modules-amd@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-modules-amd@npm:7.18.6" +"@babel/plugin-transform-modules-amd@npm:^7.18.6, @babel/plugin-transform-modules-amd@npm:^7.19.6": + version: 7.19.6 + resolution: "@babel/plugin-transform-modules-amd@npm:7.19.6" dependencies: - "@babel/helper-module-transforms": "npm:^7.18.6" - "@babel/helper-plugin-utils": "npm:^7.18.6" - babel-plugin-dynamic-import-node: "npm:^2.3.3" + "@babel/helper-module-transforms": "npm:^7.19.6" + "@babel/helper-plugin-utils": "npm:^7.19.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 62a192e30db5ba68e38eba5471cbf5793a629c966be188313497d49dfca014a7cf0b740d02c16395663fde499a153c642f957cf7776b57567c58d1a3876d5d67 + checksum: 875a630257e08155671457f200274e39e0b193d3ed1744496efdf387e0373da91547a2312de0688f242decd0996665cbc740734e9cdd257a01e7af4d62616b25 languageName: node linkType: hard -"@babel/plugin-transform-modules-commonjs@npm:^7.0.0, @babel/plugin-transform-modules-commonjs@npm:^7.13.8, @babel/plugin-transform-modules-commonjs@npm:^7.18.6": - version: 7.18.6 - resolution: "@babel/plugin-transform-modules-commonjs@npm:7.18.6" +"@babel/plugin-transform-modules-commonjs@npm:^7.0.0, @babel/plugin-transform-modules-commonjs@npm:^7.13.8, @babel/plugin-transform-modules-commonjs@npm:^7.18.6, @babel/plugin-transform-modules-commonjs@npm:^7.19.6": + version: 7.19.6 + resolution: "@babel/plugin-transform-modules-commonjs@npm:7.19.6" dependencies: - "@babel/helper-module-transforms": "npm:^7.18.6" - "@babel/helper-plugin-utils": "npm:^7.18.6" - "@babel/helper-simple-access": "npm:^7.18.6" - babel-plugin-dynamic-import-node: "npm:^2.3.3" + "@babel/helper-module-transforms": "npm:^7.19.6" + "@babel/helper-plugin-utils": "npm:^7.19.0" + "@babel/helper-simple-access": "npm:^7.19.4" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 9f0e61ccdb996d335bda1cedb3369de242b470ed884065d20ed593f855354722c46ee8f34c7fedebf0afefbbebbae22d29b8eed5a94e0eb0ef982f16e6f0fce9 + checksum: df94940dd10bbbb4ae27c3adc2cc459dafe5b7baefb6fdffc07f0047fac1db0245bba7fc4236d5f064eba4d6f3acfa870ff686a27946e34701bf9501a46a8f46 languageName: node linkType: hard -"@babel/plugin-transform-modules-systemjs@npm:^7.19.0": +"@babel/plugin-transform-modules-systemjs@npm:^7.18.9, @babel/plugin-transform-modules-systemjs@npm:^7.19.6": version: 7.19.6 resolution: "@babel/plugin-transform-modules-systemjs@npm:7.19.6" dependencies: @@ -1202,7 +1250,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-named-capturing-groups-regex@npm:^7.19.1": +"@babel/plugin-transform-named-capturing-groups-regex@npm:^7.18.6, @babel/plugin-transform-named-capturing-groups-regex@npm:^7.19.1": version: 7.19.1 resolution: "@babel/plugin-transform-named-capturing-groups-regex@npm:7.19.1" dependencies: @@ -1237,14 +1285,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-parameters@npm:^7.0.0, @babel/plugin-transform-parameters@npm:^7.12.1, @babel/plugin-transform-parameters@npm:^7.18.8": - version: 7.18.8 - resolution: "@babel/plugin-transform-parameters@npm:7.18.8" +"@babel/plugin-transform-parameters@npm:^7.0.0, @babel/plugin-transform-parameters@npm:^7.12.1, @babel/plugin-transform-parameters@npm:^7.18.8, @babel/plugin-transform-parameters@npm:^7.20.1": + version: 7.20.3 + resolution: "@babel/plugin-transform-parameters@npm:7.20.3" dependencies: - "@babel/helper-plugin-utils": "npm:^7.18.6" + "@babel/helper-plugin-utils": "npm:^7.20.2" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 7d8c19cbae0ddaf1b7c5205315b3a0ed19884f4732dbf384b35b4710981a678f82bd03a08b089a5fa4f3cd5449701b89d36bd8a95fd341c8fe2d3ac3aea01039 + checksum: 1599b5a8dc72bf52167d715690f0bc8f8cc61ca79d6a64e120205d3b39a76bd59136fbdf76b05e63a0196b8aed090a32f65b470c36eccc09dde564de474d1ed8 languageName: node linkType: hard @@ -1364,6 +1412,22 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-transform-runtime@npm:7.18.10": + version: 7.18.10 + resolution: "@babel/plugin-transform-runtime@npm:7.18.10" + dependencies: + "@babel/helper-module-imports": "npm:^7.18.6" + "@babel/helper-plugin-utils": "npm:^7.18.9" + babel-plugin-polyfill-corejs2: "npm:^0.3.2" + babel-plugin-polyfill-corejs3: "npm:^0.5.3" + babel-plugin-polyfill-regenerator: "npm:^0.4.0" + semver: "npm:^6.3.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 8c0c01c187897eee3e20350f9876389a23a2cb0744d40327fafadf535f38b5c73891ff87048b55d1ced4e6dab8117e124734c0a8eaf51d5681b80bcf21ba6ad8 + languageName: node + linkType: hard + "@babel/plugin-transform-shorthand-properties@npm:^7.0.0, @babel/plugin-transform-shorthand-properties@npm:^7.12.1, @babel/plugin-transform-shorthand-properties@npm:^7.18.6": version: 7.18.6 resolution: "@babel/plugin-transform-shorthand-properties@npm:7.18.6" @@ -1375,7 +1439,7 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-spread@npm:^7.0.0, @babel/plugin-transform-spread@npm:^7.12.1, @babel/plugin-transform-spread@npm:^7.19.0": +"@babel/plugin-transform-spread@npm:^7.0.0, @babel/plugin-transform-spread@npm:^7.12.1, @babel/plugin-transform-spread@npm:^7.18.9, @babel/plugin-transform-spread@npm:^7.19.0": version: 7.19.0 resolution: "@babel/plugin-transform-spread@npm:7.19.0" dependencies: @@ -1456,17 +1520,17 @@ __metadata: languageName: node linkType: hard -"@babel/preset-env@npm:^7.12.11, @babel/preset-env@npm:^7.18.6, @babel/preset-env@npm:^7.19.4": - version: 7.19.4 - resolution: "@babel/preset-env@npm:7.19.4" +"@babel/preset-env@npm:7.18.10": + version: 7.18.10 + resolution: "@babel/preset-env@npm:7.18.10" dependencies: - "@babel/compat-data": "npm:^7.19.4" - "@babel/helper-compilation-targets": "npm:^7.19.3" - "@babel/helper-plugin-utils": "npm:^7.19.0" + "@babel/compat-data": "npm:^7.18.8" + "@babel/helper-compilation-targets": "npm:^7.18.9" + "@babel/helper-plugin-utils": "npm:^7.18.9" "@babel/helper-validator-option": "npm:^7.18.6" "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "npm:^7.18.6" "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "npm:^7.18.9" - "@babel/plugin-proposal-async-generator-functions": "npm:^7.19.1" + "@babel/plugin-proposal-async-generator-functions": "npm:^7.18.10" "@babel/plugin-proposal-class-properties": "npm:^7.18.6" "@babel/plugin-proposal-class-static-block": "npm:^7.18.6" "@babel/plugin-proposal-dynamic-import": "npm:^7.18.6" @@ -1475,7 +1539,7 @@ __metadata: "@babel/plugin-proposal-logical-assignment-operators": "npm:^7.18.9" "@babel/plugin-proposal-nullish-coalescing-operator": "npm:^7.18.6" "@babel/plugin-proposal-numeric-separator": "npm:^7.18.6" - "@babel/plugin-proposal-object-rest-spread": "npm:^7.19.4" + "@babel/plugin-proposal-object-rest-spread": "npm:^7.18.9" "@babel/plugin-proposal-optional-catch-binding": "npm:^7.18.6" "@babel/plugin-proposal-optional-chaining": "npm:^7.18.9" "@babel/plugin-proposal-private-methods": "npm:^7.18.6" @@ -1499,10 +1563,10 @@ __metadata: "@babel/plugin-transform-arrow-functions": "npm:^7.18.6" "@babel/plugin-transform-async-to-generator": "npm:^7.18.6" "@babel/plugin-transform-block-scoped-functions": "npm:^7.18.6" - "@babel/plugin-transform-block-scoping": "npm:^7.19.4" - "@babel/plugin-transform-classes": "npm:^7.19.0" + "@babel/plugin-transform-block-scoping": "npm:^7.18.9" + "@babel/plugin-transform-classes": "npm:^7.18.9" "@babel/plugin-transform-computed-properties": "npm:^7.18.9" - "@babel/plugin-transform-destructuring": "npm:^7.19.4" + "@babel/plugin-transform-destructuring": "npm:^7.18.9" "@babel/plugin-transform-dotall-regex": "npm:^7.18.6" "@babel/plugin-transform-duplicate-keys": "npm:^7.18.9" "@babel/plugin-transform-exponentiation-operator": "npm:^7.18.6" @@ -1512,9 +1576,9 @@ __metadata: "@babel/plugin-transform-member-expression-literals": "npm:^7.18.6" "@babel/plugin-transform-modules-amd": "npm:^7.18.6" "@babel/plugin-transform-modules-commonjs": "npm:^7.18.6" - "@babel/plugin-transform-modules-systemjs": "npm:^7.19.0" + "@babel/plugin-transform-modules-systemjs": "npm:^7.18.9" "@babel/plugin-transform-modules-umd": "npm:^7.18.6" - "@babel/plugin-transform-named-capturing-groups-regex": "npm:^7.19.1" + "@babel/plugin-transform-named-capturing-groups-regex": "npm:^7.18.6" "@babel/plugin-transform-new-target": "npm:^7.18.6" "@babel/plugin-transform-object-super": "npm:^7.18.6" "@babel/plugin-transform-parameters": "npm:^7.18.8" @@ -1522,6 +1586,91 @@ __metadata: "@babel/plugin-transform-regenerator": "npm:^7.18.6" "@babel/plugin-transform-reserved-words": "npm:^7.18.6" "@babel/plugin-transform-shorthand-properties": "npm:^7.18.6" + "@babel/plugin-transform-spread": "npm:^7.18.9" + "@babel/plugin-transform-sticky-regex": "npm:^7.18.6" + "@babel/plugin-transform-template-literals": "npm:^7.18.9" + "@babel/plugin-transform-typeof-symbol": "npm:^7.18.9" + "@babel/plugin-transform-unicode-escapes": "npm:^7.18.10" + "@babel/plugin-transform-unicode-regex": "npm:^7.18.6" + "@babel/preset-modules": "npm:^0.1.5" + "@babel/types": "npm:^7.18.10" + babel-plugin-polyfill-corejs2: "npm:^0.3.2" + babel-plugin-polyfill-corejs3: "npm:^0.5.3" + babel-plugin-polyfill-regenerator: "npm:^0.4.0" + core-js-compat: "npm:^3.22.1" + semver: "npm:^6.3.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 076a6ebd0a1fb872e263be7ad6823c31267601cdc03658271602625ffe02ab6f450685df7f6a165289a1d77b3e6320feca8b4f0e9fb0999a8188aa98813a8071 + languageName: node + linkType: hard + +"@babel/preset-env@npm:^7.12.11, @babel/preset-env@npm:^7.18.6, @babel/preset-env@npm:^7.19.4": + version: 7.20.2 + resolution: "@babel/preset-env@npm:7.20.2" + dependencies: + "@babel/compat-data": "npm:^7.20.1" + "@babel/helper-compilation-targets": "npm:^7.20.0" + "@babel/helper-plugin-utils": "npm:^7.20.2" + "@babel/helper-validator-option": "npm:^7.18.6" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "npm:^7.18.6" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "npm:^7.18.9" + "@babel/plugin-proposal-async-generator-functions": "npm:^7.20.1" + "@babel/plugin-proposal-class-properties": "npm:^7.18.6" + "@babel/plugin-proposal-class-static-block": "npm:^7.18.6" + "@babel/plugin-proposal-dynamic-import": "npm:^7.18.6" + "@babel/plugin-proposal-export-namespace-from": "npm:^7.18.9" + "@babel/plugin-proposal-json-strings": "npm:^7.18.6" + "@babel/plugin-proposal-logical-assignment-operators": "npm:^7.18.9" + "@babel/plugin-proposal-nullish-coalescing-operator": "npm:^7.18.6" + "@babel/plugin-proposal-numeric-separator": "npm:^7.18.6" + "@babel/plugin-proposal-object-rest-spread": "npm:^7.20.2" + "@babel/plugin-proposal-optional-catch-binding": "npm:^7.18.6" + "@babel/plugin-proposal-optional-chaining": "npm:^7.18.9" + "@babel/plugin-proposal-private-methods": "npm:^7.18.6" + "@babel/plugin-proposal-private-property-in-object": "npm:^7.18.6" + "@babel/plugin-proposal-unicode-property-regex": "npm:^7.18.6" + "@babel/plugin-syntax-async-generators": "npm:^7.8.4" + "@babel/plugin-syntax-class-properties": "npm:^7.12.13" + "@babel/plugin-syntax-class-static-block": "npm:^7.14.5" + "@babel/plugin-syntax-dynamic-import": "npm:^7.8.3" + "@babel/plugin-syntax-export-namespace-from": "npm:^7.8.3" + "@babel/plugin-syntax-import-assertions": "npm:^7.20.0" + "@babel/plugin-syntax-json-strings": "npm:^7.8.3" + "@babel/plugin-syntax-logical-assignment-operators": "npm:^7.10.4" + "@babel/plugin-syntax-nullish-coalescing-operator": "npm:^7.8.3" + "@babel/plugin-syntax-numeric-separator": "npm:^7.10.4" + "@babel/plugin-syntax-object-rest-spread": "npm:^7.8.3" + "@babel/plugin-syntax-optional-catch-binding": "npm:^7.8.3" + "@babel/plugin-syntax-optional-chaining": "npm:^7.8.3" + "@babel/plugin-syntax-private-property-in-object": "npm:^7.14.5" + "@babel/plugin-syntax-top-level-await": "npm:^7.14.5" + "@babel/plugin-transform-arrow-functions": "npm:^7.18.6" + "@babel/plugin-transform-async-to-generator": "npm:^7.18.6" + "@babel/plugin-transform-block-scoped-functions": "npm:^7.18.6" + "@babel/plugin-transform-block-scoping": "npm:^7.20.2" + "@babel/plugin-transform-classes": "npm:^7.20.2" + "@babel/plugin-transform-computed-properties": "npm:^7.18.9" + "@babel/plugin-transform-destructuring": "npm:^7.20.2" + "@babel/plugin-transform-dotall-regex": "npm:^7.18.6" + "@babel/plugin-transform-duplicate-keys": "npm:^7.18.9" + "@babel/plugin-transform-exponentiation-operator": "npm:^7.18.6" + "@babel/plugin-transform-for-of": "npm:^7.18.8" + "@babel/plugin-transform-function-name": "npm:^7.18.9" + "@babel/plugin-transform-literals": "npm:^7.18.9" + "@babel/plugin-transform-member-expression-literals": "npm:^7.18.6" + "@babel/plugin-transform-modules-amd": "npm:^7.19.6" + "@babel/plugin-transform-modules-commonjs": "npm:^7.19.6" + "@babel/plugin-transform-modules-systemjs": "npm:^7.19.6" + "@babel/plugin-transform-modules-umd": "npm:^7.18.6" + "@babel/plugin-transform-named-capturing-groups-regex": "npm:^7.19.1" + "@babel/plugin-transform-new-target": "npm:^7.18.6" + "@babel/plugin-transform-object-super": "npm:^7.18.6" + "@babel/plugin-transform-parameters": "npm:^7.20.1" + "@babel/plugin-transform-property-literals": "npm:^7.18.6" + "@babel/plugin-transform-regenerator": "npm:^7.18.6" + "@babel/plugin-transform-reserved-words": "npm:^7.18.6" + "@babel/plugin-transform-shorthand-properties": "npm:^7.18.6" "@babel/plugin-transform-spread": "npm:^7.19.0" "@babel/plugin-transform-sticky-regex": "npm:^7.18.6" "@babel/plugin-transform-template-literals": "npm:^7.18.9" @@ -1529,7 +1678,7 @@ __metadata: "@babel/plugin-transform-unicode-escapes": "npm:^7.18.10" "@babel/plugin-transform-unicode-regex": "npm:^7.18.6" "@babel/preset-modules": "npm:^0.1.5" - "@babel/types": "npm:^7.19.4" + "@babel/types": "npm:^7.20.2" babel-plugin-polyfill-corejs2: "npm:^0.3.3" babel-plugin-polyfill-corejs3: "npm:^0.6.0" babel-plugin-polyfill-regenerator: "npm:^0.4.1" @@ -1537,7 +1686,7 @@ __metadata: semver: "npm:^6.3.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: e0d0960d79c89f79c2e6e6a7afbe2339d30923ee30159e61b83c975018347151b431281bb60c72e862ab637a8963bee3e4db23070305095ccd78a453240c52ad + checksum: fec7c57e1e91306ac529e4cbbad6c0ec8eb966af68ba55cffb8f8e2cbe4e596d84b6c6015889e98828a787bab6d24fde275f4ff184cf959e684e92725039dbaf languageName: node linkType: hard @@ -1569,7 +1718,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-react@npm:^7.12.10, @babel/preset-react@npm:^7.18.6": +"@babel/preset-react@npm:7.18.6, @babel/preset-react@npm:^7.12.10, @babel/preset-react@npm:^7.18.6": version: 7.18.6 resolution: "@babel/preset-react@npm:7.18.6" dependencies: @@ -1585,7 +1734,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-typescript@npm:^7.12.7, @babel/preset-typescript@npm:^7.13.0, @babel/preset-typescript@npm:^7.18.6": +"@babel/preset-typescript@npm:7.18.6, @babel/preset-typescript@npm:^7.12.7, @babel/preset-typescript@npm:^7.13.0, @babel/preset-typescript@npm:^7.18.6": version: 7.18.6 resolution: "@babel/preset-typescript@npm:7.18.6" dependencies: @@ -1624,11 +1773,11 @@ __metadata: linkType: hard "@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.10.4, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.14.5, @babel/runtime@npm:^7.16.3, @babel/runtime@npm:^7.17.2, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.18.9, @babel/runtime@npm:^7.19.0, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.0, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": - version: 7.19.0 - resolution: "@babel/runtime@npm:7.19.0" + version: 7.20.1 + resolution: "@babel/runtime@npm:7.20.1" dependencies: - regenerator-runtime: "npm:^0.13.4" - checksum: 1f8c11a414674a3c30884c9f8d625e69ee63df3c23da854786e9566638371f6395e0839a8dfa6e159e7b30d6333d280fba70710e3379cc42036fe2b97ab9e4f0 + regenerator-runtime: "npm:^0.13.10" + checksum: dab09323346ef2e0db0571a8d9af3bf01d290f0e97100da0874106e4aff794292755716745b593153b9436dc7471e059391cc0bd7ec9e2ec55f03c462247391e languageName: node linkType: hard @@ -1643,7 +1792,7 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.12.11, @babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.13.0, @babel/traverse@npm:^7.14.0, @babel/traverse@npm:^7.16.8, @babel/traverse@npm:^7.18.9, @babel/traverse@npm:^7.19.0, @babel/traverse@npm:^7.20.1, @babel/traverse@npm:^7.7.2": +"@babel/traverse@npm:^7.1.6, @babel/traverse@npm:^7.12.11, @babel/traverse@npm:^7.12.9, @babel/traverse@npm:^7.13.0, @babel/traverse@npm:^7.14.0, @babel/traverse@npm:^7.16.8, @babel/traverse@npm:^7.18.10, @babel/traverse@npm:^7.19.0, @babel/traverse@npm:^7.19.1, @babel/traverse@npm:^7.20.1, @babel/traverse@npm:^7.7.2": version: 7.20.1 resolution: "@babel/traverse@npm:7.20.1" dependencies: @@ -1661,7 +1810,7 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.12.11, @babel/types@npm:^7.12.7, @babel/types@npm:^7.16.8, @babel/types@npm:^7.18.10, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.19.0, @babel/types@npm:^7.19.4, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.2, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.12.11, @babel/types@npm:^7.12.7, @babel/types@npm:^7.16.8, @babel/types@npm:^7.18.10, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.19.0, @babel/types@npm:^7.2.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.2, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": version: 7.20.2 resolution: "@babel/types@npm:7.20.2" dependencies: @@ -2342,6 +2491,42 @@ __metadata: languageName: node linkType: hard +"@cypress/request@npm:^2.88.10": + version: 2.88.10 + resolution: "@cypress/request@npm:2.88.10" + dependencies: + aws-sign2: "npm:~0.7.0" + aws4: "npm:^1.8.0" + caseless: "npm:~0.12.0" + combined-stream: "npm:~1.0.6" + extend: "npm:~3.0.2" + forever-agent: "npm:~0.6.1" + form-data: "npm:~2.3.2" + http-signature: "npm:~1.3.6" + is-typedarray: "npm:~1.0.0" + isstream: "npm:~0.1.2" + json-stringify-safe: "npm:~5.0.1" + mime-types: "npm:~2.1.19" + performance-now: "npm:^2.1.0" + qs: "npm:~6.5.2" + safe-buffer: "npm:^5.1.2" + tough-cookie: "npm:~2.5.0" + tunnel-agent: "npm:^0.6.0" + uuid: "npm:^8.3.2" + checksum: 263508da254780e0f75f8a7410e36508f677b7ed180fd2f2158665d47847d95fe4c6e70e2dfe9de48407939f2454f231cf2cd745c68c1e94185b225168400d91 + languageName: node + linkType: hard + +"@cypress/xvfb@npm:^1.2.4": + version: 1.2.4 + resolution: "@cypress/xvfb@npm:1.2.4" + dependencies: + debug: "npm:^3.1.0" + lodash.once: "npm:^4.1.1" + checksum: 9df125f4f7f9e7fe1fa41fffec4e7da0effea79613192a633b0dfb42b7738a950fe462fa7e9858d1f40a28a8a18a3aa674df791a05546ae9cf78a0ade7749b66 + languageName: node + linkType: hard + "@dabh/diagnostics@npm:^2.0.2": version: 2.0.3 resolution: "@dabh/diagnostics@npm:2.0.3" @@ -2353,10 +2538,17 @@ __metadata: languageName: node linkType: hard -"@discoveryjs/json-ext@npm:^0.5.3": - version: 0.5.6 - resolution: "@discoveryjs/json-ext@npm:0.5.6" - checksum: 790b994543dceaa55a4715c31c4a2f7abded8423c749b2e0ee5baa901a19cbbeef9a266cf6e916e0c4f864b9561436d53e0023d863d10921a6993f2d847bea44 +"@discoveryjs/json-ext@npm:^0.5.3, @discoveryjs/json-ext@npm:^0.5.7": + version: 0.5.7 + resolution: "@discoveryjs/json-ext@npm:0.5.7" + checksum: b6e8ff9be2e0b505f3e06379743f55d04028adbb0170dc191ff020f6e43f86f712e6cceb8a95db7e2c13a7dc6d7419f6b65af353ce662bf520e065b69e232ef7 + languageName: node + linkType: hard + +"@discoveryjs/natural-compare@npm:^1.0.0": + version: 1.1.0 + resolution: "@discoveryjs/natural-compare@npm:1.1.0" + checksum: b0d71a9d5e55a39e87b1d16ef1a06d3caaff3ccb86c735346418b4bc71f347f95bcd1dd563eaedaced4985837c85af04ddcb4663b587c23188e512ffc39338dd languageName: node linkType: hard @@ -3599,6 +3791,22 @@ __metadata: languageName: node linkType: hard +"@hapi/hoek@npm:^9.0.0": + version: 9.3.0 + resolution: "@hapi/hoek@npm:9.3.0" + checksum: 9c5baadfabd79e40e747faf0f5dd740f40aef12a123c475787c7834660c6c46c6228770ed9832847bb858b316031104d1fb07df1644424d0c05ccdccccca2a90 + languageName: node + linkType: hard + +"@hapi/topo@npm:^5.0.0": + version: 5.1.0 + resolution: "@hapi/topo@npm:5.1.0" + dependencies: + "@hapi/hoek": "npm:^9.0.0" + checksum: ff0deb4249848bf9db5c8dd3489a5d07914adb04983066d68b0395f22f82dbf6058ddac950e53d533c1b74102086199a584d5446c9db15061fb99687edfec19f + languageName: node + linkType: hard + "@headlessui/react@npm:1.7.4": version: 1.7.4 resolution: "@headlessui/react@npm:1.7.4" @@ -3672,29 +3880,29 @@ __metadata: languageName: node linkType: hard -"@jest/console@npm:^29.2.1": - version: 29.2.1 - resolution: "@jest/console@npm:29.2.1" +"@jest/console@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/console@npm:29.3.1" dependencies: - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" chalk: "npm:^4.0.0" - jest-message-util: "npm:^29.2.1" - jest-util: "npm:^29.2.1" + jest-message-util: "npm:^29.3.1" + jest-util: "npm:^29.3.1" slash: "npm:^3.0.0" - checksum: 90b5c6e59f5f9a31f6cd4fff30e1b673719fb4f10daf7c040b22f24f4893475f13dd7bcc280b00c7f9be7dc48d4ebc559c38648558dc50e0a71f232970d00fd4 + checksum: f799344be742f908acc268eef292e9f0be987b09ce66181fe8d0f9d8b2ceb79696bdc66cf710c0b0e246215334363c90a43c4984ee112c96702b9234105b14e7 languageName: node linkType: hard -"@jest/core@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/core@npm:29.2.2" +"@jest/core@npm:^29.2.2, @jest/core@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/core@npm:29.3.1" dependencies: - "@jest/console": "npm:^29.2.1" - "@jest/reporters": "npm:^29.2.2" - "@jest/test-result": "npm:^29.2.1" - "@jest/transform": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" + "@jest/console": "npm:^29.3.1" + "@jest/reporters": "npm:^29.3.1" + "@jest/test-result": "npm:^29.3.1" + "@jest/transform": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" ansi-escapes: "npm:^4.2.1" chalk: "npm:^4.0.0" @@ -3702,20 +3910,20 @@ __metadata: exit: "npm:^0.1.2" graceful-fs: "npm:^4.2.9" jest-changed-files: "npm:^29.2.0" - jest-config: "npm:^29.2.2" - jest-haste-map: "npm:^29.2.1" - jest-message-util: "npm:^29.2.1" + jest-config: "npm:^29.3.1" + jest-haste-map: "npm:^29.3.1" + jest-message-util: "npm:^29.3.1" jest-regex-util: "npm:^29.2.0" - jest-resolve: "npm:^29.2.2" - jest-resolve-dependencies: "npm:^29.2.2" - jest-runner: "npm:^29.2.2" - jest-runtime: "npm:^29.2.2" - jest-snapshot: "npm:^29.2.2" - jest-util: "npm:^29.2.1" - jest-validate: "npm:^29.2.2" - jest-watcher: "npm:^29.2.2" + jest-resolve: "npm:^29.3.1" + jest-resolve-dependencies: "npm:^29.3.1" + jest-runner: "npm:^29.3.1" + jest-runtime: "npm:^29.3.1" + jest-snapshot: "npm:^29.3.1" + jest-util: "npm:^29.3.1" + jest-validate: "npm:^29.3.1" + jest-watcher: "npm:^29.3.1" micromatch: "npm:^4.0.4" - pretty-format: "npm:^29.2.1" + pretty-format: "npm:^29.3.1" slash: "npm:^3.0.0" strip-ansi: "npm:^6.0.0" peerDependencies: @@ -3723,76 +3931,76 @@ __metadata: peerDependenciesMeta: node-notifier: optional: true - checksum: 696c9f62e8d149296fec3b293a4f9e7d66dbd66da8862dd7a636b328442a910221e00b2c68e372452295978ec32cf359ac41ad1a6045d44c789fbfb7bb4a79c0 + checksum: 80958491c44120273e08eed60e8f77b2fdef435a97c2bd1aeea27a04039d95e45c35fc9e489a2509a24b603f5f33ea6fe4eaefe593203811d5feb718ff4fb99d languageName: node linkType: hard -"@jest/environment@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/environment@npm:29.2.2" +"@jest/environment@npm:^29.2.2, @jest/environment@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/environment@npm:29.3.1" dependencies: - "@jest/fake-timers": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" + "@jest/fake-timers": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" - jest-mock: "npm:^29.2.2" - checksum: 1f68b56e4fd5a0afdd002f2fc45066d47961ce5acf8d04e578a474da750e76c0e9b5663f9557a2045c237ba248a74a563d679f736c195bef2d39a6b851ca867d + jest-mock: "npm:^29.3.1" + checksum: 4d55705e76ad0998a1ee7c487d07d7c02641553d80e8e608d5b6d5965582179a1e71804d840b08aa1422c0f4e20854822af8245bc7a9e198b23dd37a85228807 languageName: node linkType: hard -"@jest/expect-utils@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/expect-utils@npm:29.2.2" +"@jest/expect-utils@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/expect-utils@npm:29.3.1" dependencies: jest-get-type: "npm:^29.2.0" - checksum: 35062ac517993a1af8dc9ffb2d4c696c0f508f0605af09e88e548a5746a13f4147541ba6d9ce86f869a24546252e99d2e6b7435584e41b6ee3b8b7b822a372df + checksum: b616f71d97331221c0ef1f3efefb5a23428a57e9fafd58ac1fda42516cbd327410f5f18ffa9f02d3f979d73bdbd78ddadb2066890dca1f316d59a79fc45024e1 languageName: node linkType: hard -"@jest/expect@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/expect@npm:29.2.2" +"@jest/expect@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/expect@npm:29.3.1" dependencies: - expect: "npm:^29.2.2" - jest-snapshot: "npm:^29.2.2" - checksum: 4a460acd25154ab6dd2199b2496d686678db958d7805db7af2594b67bdf33ec11fb4eef0ba5a714f147de1247f8c0561e85c55962938286246d42fca0d70e6ff + expect: "npm:^29.3.1" + jest-snapshot: "npm:^29.3.1" + checksum: ecc46e47c9818a56f948a7b0d96f9a739798cf0baaf1c8c920df922d9670974563e99cdb53ed50629e32e4db82a05d1109c76fc381fcf1061e51a0745d8813d3 languageName: node linkType: hard -"@jest/fake-timers@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/fake-timers@npm:29.2.2" +"@jest/fake-timers@npm:^29.2.2, @jest/fake-timers@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/fake-timers@npm:29.3.1" dependencies: - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" "@sinonjs/fake-timers": "npm:^9.1.2" "@types/node": "npm:*" - jest-message-util: "npm:^29.2.1" - jest-mock: "npm:^29.2.2" - jest-util: "npm:^29.2.1" - checksum: da2e6de87bda01a700cbac7838600fa8c0b14673ffb1eaba44f0db902a4911b8802086f8d698994dcd0b6fcdbbd573328522d092f969853fe7376ef45d00d2d3 + jest-message-util: "npm:^29.3.1" + jest-mock: "npm:^29.3.1" + jest-util: "npm:^29.3.1" + checksum: 951e8170ed56dc521bd6a2d6fece1dc91f9dc955fedfa71cbe8c8d334b6ebc5121e21ed86f065d0606e5b45de73aa651ae993a763281e74dc1d3a4d7174db4de languageName: node linkType: hard -"@jest/globals@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/globals@npm:29.2.2" +"@jest/globals@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/globals@npm:29.3.1" dependencies: - "@jest/environment": "npm:^29.2.2" - "@jest/expect": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" - jest-mock: "npm:^29.2.2" - checksum: 13c0a37fd6f135b445dbffc666e5c4b345f405a294b1fb1277dbcaa973f0cfa339b24ba656d6b83e734679abe4c0bf121faee9980e9d1fd6817ebb5a0cfdb824 + "@jest/environment": "npm:^29.3.1" + "@jest/expect": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" + jest-mock: "npm:^29.3.1" + checksum: 3484a6c6ecf25dfc40c9a401300decfea5185a5e4867f8a6d43adbcbbcd6af4e5e6637cbc647a179a37b269d2c646211418b01cbd331e0970c3d59004d47a781 languageName: node linkType: hard -"@jest/reporters@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/reporters@npm:29.2.2" +"@jest/reporters@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/reporters@npm:29.3.1" dependencies: "@bcoe/v8-coverage": "npm:^0.2.3" - "@jest/console": "npm:^29.2.1" - "@jest/test-result": "npm:^29.2.1" - "@jest/transform": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" + "@jest/console": "npm:^29.3.1" + "@jest/test-result": "npm:^29.3.1" + "@jest/transform": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@jridgewell/trace-mapping": "npm:^0.3.15" "@types/node": "npm:*" chalk: "npm:^4.0.0" @@ -3805,9 +4013,9 @@ __metadata: istanbul-lib-report: "npm:^3.0.0" istanbul-lib-source-maps: "npm:^4.0.0" istanbul-reports: "npm:^3.1.3" - jest-message-util: "npm:^29.2.1" - jest-util: "npm:^29.2.1" - jest-worker: "npm:^29.2.1" + jest-message-util: "npm:^29.3.1" + jest-util: "npm:^29.3.1" + jest-worker: "npm:^29.3.1" slash: "npm:^3.0.0" string-length: "npm:^4.0.1" strip-ansi: "npm:^6.0.0" @@ -3817,7 +4025,7 @@ __metadata: peerDependenciesMeta: node-notifier: optional: true - checksum: a417023a0b7737334c58399f5f285ef039b5a9a5e217edda6787b52cd850f0aeeab1150e2d53ddc19b203b7d01b6cea97a01de0b277d22bb98a1bce6397293e0 + checksum: 19f7fa5265aeb8a9be9890769d76527dbc5bd02e56bde5e5c39690605c3fa8978ac8c52a15b3321f0e65e2fb2f4f220b894af16e9180699bfbbd3a42317a9abd languageName: node linkType: hard @@ -3841,27 +4049,27 @@ __metadata: languageName: node linkType: hard -"@jest/test-result@npm:^29.2.1": - version: 29.2.1 - resolution: "@jest/test-result@npm:29.2.1" +"@jest/test-result@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/test-result@npm:29.3.1" dependencies: - "@jest/console": "npm:^29.2.1" - "@jest/types": "npm:^29.2.1" + "@jest/console": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/istanbul-lib-coverage": "npm:^2.0.0" collect-v8-coverage: "npm:^1.0.0" - checksum: c6f37006d4f47d543b160d421a6e9c864d20800caadcae9bf1d8fd65e4d23c891a14d05cf59d53aad77bf1899fdb7b2483d9bdd642f875ef6844fb5268058c7b + checksum: 986b7a0afeb27c81a7351994791f1bc06036033db8023d2f1b9271221c87a4284b00ab8be80ef96993ff7e4f39726a2e350af1bf805c480e730de9b5eaabe3a3 languageName: node linkType: hard -"@jest/test-sequencer@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/test-sequencer@npm:29.2.2" +"@jest/test-sequencer@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/test-sequencer@npm:29.3.1" dependencies: - "@jest/test-result": "npm:^29.2.1" + "@jest/test-result": "npm:^29.3.1" graceful-fs: "npm:^4.2.9" - jest-haste-map: "npm:^29.2.1" + jest-haste-map: "npm:^29.3.1" slash: "npm:^3.0.0" - checksum: 18c6b94e4f8b53ee97ac0da4f6aa032d143d0e85cf44f360df255464e305251e13b9f122cf5e93392d2219315d1c98a96e636965dc5288c160e5c54858e84f1a + checksum: a71e86ab18b4992a5a6abe527d6fa420b21907eec5812e770e3ff1089a89f64f5add3c23c2a7af275221c1270903fd1b9f9afde75ccf58b34792f88ff58d6b81 languageName: node linkType: hard @@ -3888,26 +4096,26 @@ __metadata: languageName: node linkType: hard -"@jest/transform@npm:^29.2.2": - version: 29.2.2 - resolution: "@jest/transform@npm:29.2.2" +"@jest/transform@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/transform@npm:29.3.1" dependencies: "@babel/core": "npm:^7.11.6" - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" "@jridgewell/trace-mapping": "npm:^0.3.15" babel-plugin-istanbul: "npm:^6.1.1" chalk: "npm:^4.0.0" - convert-source-map: "npm:^1.4.0" + convert-source-map: "npm:^2.0.0" fast-json-stable-stringify: "npm:^2.1.0" graceful-fs: "npm:^4.2.9" - jest-haste-map: "npm:^29.2.1" + jest-haste-map: "npm:^29.3.1" jest-regex-util: "npm:^29.2.0" - jest-util: "npm:^29.2.1" + jest-util: "npm:^29.3.1" micromatch: "npm:^4.0.4" pirates: "npm:^4.0.4" slash: "npm:^3.0.0" write-file-atomic: "npm:^4.0.1" - checksum: 906667c8a5b3f2cf242146d42b4876e9c98e0cd9a0e6f5374aaf663fadb532b1e018c604aa4cbac40a9c6b7d14609a446a25cd0147d716a40dc5561bfc838b97 + checksum: 574f94f38832c93f999a4d98507c17e4ca0fc6f1c66866503d80544aa0f6b6a0ecc3c256bfc9643320ce4120050e73afa8738f1309ed0dabf287a476752adf46 languageName: node linkType: hard @@ -3924,9 +4132,9 @@ __metadata: languageName: node linkType: hard -"@jest/types@npm:^29.2.1": - version: 29.2.1 - resolution: "@jest/types@npm:29.2.1" +"@jest/types@npm:^29.2.1, @jest/types@npm:^29.3.1": + version: 29.3.1 + resolution: "@jest/types@npm:29.3.1" dependencies: "@jest/schemas": "npm:^29.0.0" "@types/istanbul-lib-coverage": "npm:^2.0.0" @@ -3934,7 +4142,7 @@ __metadata: "@types/node": "npm:*" "@types/yargs": "npm:^17.0.8" chalk: "npm:^4.0.0" - checksum: c928554654eb010aeed0e461ca10780e6c6ec2baf2663c0d3d5478454f295f520cf1eddbfda8a4c94fde418704cb881f15c9e03def1534e08e5baec74550f0f0 + checksum: d22f39799b4a6e2e152f31dc9c9969b1581ac6561dd49cf22c63dc705d76976b338b2f431dc4e636419fd518f79f391878360741bc14bb452b8739bb45f7253d languageName: node linkType: hard @@ -3949,10 +4157,10 @@ __metadata: languageName: node linkType: hard -"@jridgewell/resolve-uri@npm:^3.0.3": - version: 3.0.3 - resolution: "@jridgewell/resolve-uri@npm:3.0.3" - checksum: 58e91d20cbcde0066d554d80ad1f67f0b10be04ee8056f58c6d689ff78d6099f065308f28695bc42197299549a2adbec4a69e0d88495991ee42e872c65d6c286 +"@jridgewell/resolve-uri@npm:3.1.0, @jridgewell/resolve-uri@npm:^3.0.3": + version: 3.1.0 + resolution: "@jridgewell/resolve-uri@npm:3.1.0" + checksum: 6b641bb7e25bc92a9848898cc91a77a390f393f086297ec2336d911387bdd708919c418e74a22732cfc21d0e7300b94306f437d2e9de5ab58b33ebc6c39d6f9d languageName: node linkType: hard @@ -3973,10 +4181,10 @@ __metadata: languageName: node linkType: hard -"@jridgewell/sourcemap-codec@npm:^1.4.10": - version: 1.4.11 - resolution: "@jridgewell/sourcemap-codec@npm:1.4.11" - checksum: 5bd15cc6458188c73426e1262d0042891e99c212d9e7eab93c0b5bed77bef9fb0ace12cf854e53acac80c1d7df034f4739e960ebd167559e0d3635d374b99b60 +"@jridgewell/sourcemap-codec@npm:1.4.14, @jridgewell/sourcemap-codec@npm:^1.4.10": + version: 1.4.14 + resolution: "@jridgewell/sourcemap-codec@npm:1.4.14" + checksum: 2147ea75c966fed8a7d9ed6679b7e8c380fa790a9bea5a64f4ec1c26d24e44b461aa60fc3b228cea03a46708d9d1bcf19508035bf27ad5e8f63d0998ed1d1117 languageName: node linkType: hard @@ -3990,13 +4198,13 @@ __metadata: languageName: node linkType: hard -"@jridgewell/trace-mapping@npm:^0.3.0, @jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.15, @jridgewell/trace-mapping@npm:^0.3.9": - version: 0.3.15 - resolution: "@jridgewell/trace-mapping@npm:0.3.15" +"@jridgewell/trace-mapping@npm:^0.3.0, @jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.15, @jridgewell/trace-mapping@npm:^0.3.8, @jridgewell/trace-mapping@npm:^0.3.9": + version: 0.3.17 + resolution: "@jridgewell/trace-mapping@npm:0.3.17" dependencies: - "@jridgewell/resolve-uri": "npm:^3.0.3" - "@jridgewell/sourcemap-codec": "npm:^1.4.10" - checksum: a11b95f877537f116c1a2297ad712df69a8928f33076cfc95702cfbb53854e370a6e62447f12f9c495b40ba92b0c0eed6ab18eaf2e7cae7e62d30ffb7975d30b + "@jridgewell/resolve-uri": "npm:3.1.0" + "@jridgewell/sourcemap-codec": "npm:1.4.14" + checksum: 388a2f604c1159dd29fdf3077c2a21fd2d322145f24cade868c0a7c55cfc993f3af82dd2e979438d9f06148c38af780abc7c0aa2eddbb34fab41698bb86d82e1 languageName: node linkType: hard @@ -4386,6 +4594,13 @@ __metadata: languageName: node linkType: hard +"@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents.3": + version: 2.1.8-no-fsevents.3 + resolution: "@nicolo-ribaudo/chokidar-2@npm:2.1.8-no-fsevents.3" + checksum: 4149e0e0b42962e1473c47641b8ed728ab2f87076602fa5ba88379f51c11d168ca0d8fbd5fae9eccc891db51317290deb67958746f2bbded504fa139e98be3a6 + languageName: node + linkType: hard + "@nicolo-ribaudo/eslint-scope-5-internals@npm:5.1.1-v1": version: 5.1.1-v1 resolution: "@nicolo-ribaudo/eslint-scope-5-internals@npm:5.1.1-v1" @@ -4458,40 +4673,171 @@ __metadata: languageName: node linkType: hard -"@omnigraph/json-schema@npm:0.36.5": - version: 0.36.5 - resolution: "@omnigraph/json-schema@npm:0.36.5" +"@octokit/auth-token@npm:^2.4.4": + version: 2.5.0 + resolution: "@octokit/auth-token@npm:2.5.0" dependencies: - "@graphql-mesh/cross-helpers": "npm:0.2.8" - "@graphql-mesh/string-interpolation": "npm:0.3.3" - "@graphql-mesh/types": "npm:0.85.6" - "@graphql-mesh/utils": "npm:0.42.5" - "@graphql-tools/utils": "npm:8.13.1" - "@json-schema-tools/meta-schema": "npm:1.7.0" - "@whatwg-node/fetch": "npm:^0.5.0" - ajv: "npm:8.11.0" - ajv-formats: "npm:2.1.1" - graphql-compose: "npm:9.0.10" - graphql-scalars: "npm:1.20.0" - json-machete: "npm:0.16.0" - lodash.set: "npm:4.3.2" - pascal-case: "npm:3.1.2" - qs: "npm:6.11.0" - to-json-schema: "npm:0.2.5" - tslib: "npm:^2.4.0" - url-join: "npm:4.0.1" - peerDependencies: - graphql: "*" - checksum: b3be8747c804dc62c4b698578750d450891bf5e2dbb0cf7ff47c3f092738c01da4c1992498d6beb0ab66f050b4a41bca670c4d6cec263b347786f3ae97e47989 + "@octokit/types": "npm:^6.0.3" + checksum: 6c24cf0394f89b883055fc1f48f164335c61e897e9396fe155fe92fbb0559df0b1de8c63d496623168b99a96fadd8dcf9e1bedabcfb103f83e23418b191d9e7c languageName: node linkType: hard -"@omnigraph/openapi@npm:0.17.5": - version: 0.17.5 - resolution: "@omnigraph/openapi@npm:0.17.5" +"@octokit/core@npm:^3.5.1": + version: 3.6.0 + resolution: "@octokit/core@npm:3.6.0" dependencies: - "@graphql-mesh/cross-helpers": "npm:0.2.8" - "@graphql-mesh/string-interpolation": "npm:0.3.3" + "@octokit/auth-token": "npm:^2.4.4" + "@octokit/graphql": "npm:^4.5.8" + "@octokit/request": "npm:^5.6.3" + "@octokit/request-error": "npm:^2.0.5" + "@octokit/types": "npm:^6.0.3" + before-after-hook: "npm:^2.2.0" + universal-user-agent: "npm:^6.0.0" + checksum: 91ba1df7a57208ba0fc25fcbab6bce2cc7a144282edfd34c504fe6594fc73eee0a81bc06c3c993301b2db9835fdfb6ed13913312fe11b10d80d17634f6cf4570 + languageName: node + linkType: hard + +"@octokit/endpoint@npm:^6.0.1": + version: 6.0.12 + resolution: "@octokit/endpoint@npm:6.0.12" + dependencies: + "@octokit/types": "npm:^6.0.3" + is-plain-object: "npm:^5.0.0" + universal-user-agent: "npm:^6.0.0" + checksum: c0a7abd87243b7f5f22d6cee3e309952d08d1808c94dd7e60d40aa91111098b9b1c8e2f927bc85b831d6853fa215cbbdbbf807976dc2f40e83605ca1afea5e23 + languageName: node + linkType: hard + +"@octokit/graphql@npm:^4.5.8": + version: 4.8.0 + resolution: "@octokit/graphql@npm:4.8.0" + dependencies: + "@octokit/request": "npm:^5.6.0" + "@octokit/types": "npm:^6.0.3" + universal-user-agent: "npm:^6.0.0" + checksum: 2b5b402af70cefd29bf16bc971cc8a345587dcfa92aa39df798042e968a34a5350cf7a96b24ab74a82eb1be5b6f9e38fd3213a58b564c6acedd39272522e394c + languageName: node + linkType: hard + +"@octokit/openapi-types@npm:^12.11.0": + version: 12.11.0 + resolution: "@octokit/openapi-types@npm:12.11.0" + checksum: cec1e031fc1764afd7dd5e7211bd1fb430d9ed4e1409ee5955a375921ce757705bb711797536a77f732ea12e8ee9a1324c7012dbac54c8bc63b25ebc063f501b + languageName: node + linkType: hard + +"@octokit/plugin-paginate-rest@npm:^2.16.8": + version: 2.21.3 + resolution: "@octokit/plugin-paginate-rest@npm:2.21.3" + dependencies: + "@octokit/types": "npm:^6.40.0" + peerDependencies: + "@octokit/core": ">=2" + checksum: c179e154f078d072c44468536ba8c20b190601d109d8192a43af3afebe808943ecb0bf15bc253251b7220bad5a6e70c1b9c86d7310dbd9369b6bca2e547e66cc + languageName: node + linkType: hard + +"@octokit/plugin-request-log@npm:^1.0.4": + version: 1.0.4 + resolution: "@octokit/plugin-request-log@npm:1.0.4" + peerDependencies: + "@octokit/core": ">=3" + checksum: 862693e73694c31e9eb898b215da91657b8a73ab95291bea10447318b8fba4dd1c02225c4c67ee3fe903b5f62fc38f5f9cfb10debf8f94f599c7c62843d03656 + languageName: node + linkType: hard + +"@octokit/plugin-rest-endpoint-methods@npm:^5.12.0": + version: 5.16.2 + resolution: "@octokit/plugin-rest-endpoint-methods@npm:5.16.2" + dependencies: + "@octokit/types": "npm:^6.39.0" + deprecation: "npm:^2.3.1" + peerDependencies: + "@octokit/core": ">=3" + checksum: d0dd41cf0d63978fe78cf20c838e17c08dc6e17f0135f84824a14906c98ba040f275c0fc55486673a96c29465d8b8d08b6e7cb6c370fb419f24848e6605a09b3 + languageName: node + linkType: hard + +"@octokit/request-error@npm:^2.0.5, @octokit/request-error@npm:^2.1.0": + version: 2.1.0 + resolution: "@octokit/request-error@npm:2.1.0" + dependencies: + "@octokit/types": "npm:^6.0.3" + deprecation: "npm:^2.0.0" + once: "npm:^1.4.0" + checksum: 47264d6e03aff8e5c6773c7ba3151f0765dd852b0479582d07e4acf2ec7761b3de49f8ca2fef3b9c68b44d64d197b4d0c080840969ab2a00eaade38fbb5616d4 + languageName: node + linkType: hard + +"@octokit/request@npm:^5.6.0, @octokit/request@npm:^5.6.3": + version: 5.6.3 + resolution: "@octokit/request@npm:5.6.3" + dependencies: + "@octokit/endpoint": "npm:^6.0.1" + "@octokit/request-error": "npm:^2.1.0" + "@octokit/types": "npm:^6.16.1" + is-plain-object: "npm:^5.0.0" + node-fetch: "npm:^2.6.7" + universal-user-agent: "npm:^6.0.0" + checksum: 05c73ff2386cefee5359cba80eb12c55936260629de8da5c7359d2fe2928a5bfc198f69c54bc705e53814471c66712a6ae33dbb6d5069deb2f5d31757e85f8cf + languageName: node + linkType: hard + +"@octokit/rest@npm:^18.0.9": + version: 18.12.0 + resolution: "@octokit/rest@npm:18.12.0" + dependencies: + "@octokit/core": "npm:^3.5.1" + "@octokit/plugin-paginate-rest": "npm:^2.16.8" + "@octokit/plugin-request-log": "npm:^1.0.4" + "@octokit/plugin-rest-endpoint-methods": "npm:^5.12.0" + checksum: 9b4d5c869b63b49253c790f99a1ad154827ea183c75ac9f55d42c92ba40b0bfb094950a6c324d6152b540ac709e2385435431d89f15c232b647a0c60e6edadc2 + languageName: node + linkType: hard + +"@octokit/types@npm:^6.0.3, @octokit/types@npm:^6.16.1, @octokit/types@npm:^6.39.0, @octokit/types@npm:^6.40.0": + version: 6.41.0 + resolution: "@octokit/types@npm:6.41.0" + dependencies: + "@octokit/openapi-types": "npm:^12.11.0" + checksum: 05c2d20e08578dbd5978e640a55282cbbb8ed0cbdc6ea3707b20572bac4e32a2ca70f9d5c4589fc6d87dd3fee677039a8fab51f1ecce626e519a4b520e2ce9e4 + languageName: node + linkType: hard + +"@omnigraph/json-schema@npm:0.36.5": + version: 0.36.5 + resolution: "@omnigraph/json-schema@npm:0.36.5" + dependencies: + "@graphql-mesh/cross-helpers": "npm:0.2.8" + "@graphql-mesh/string-interpolation": "npm:0.3.3" + "@graphql-mesh/types": "npm:0.85.6" + "@graphql-mesh/utils": "npm:0.42.5" + "@graphql-tools/utils": "npm:8.13.1" + "@json-schema-tools/meta-schema": "npm:1.7.0" + "@whatwg-node/fetch": "npm:^0.5.0" + ajv: "npm:8.11.0" + ajv-formats: "npm:2.1.1" + graphql-compose: "npm:9.0.10" + graphql-scalars: "npm:1.20.0" + json-machete: "npm:0.16.0" + lodash.set: "npm:4.3.2" + pascal-case: "npm:3.1.2" + qs: "npm:6.11.0" + to-json-schema: "npm:0.2.5" + tslib: "npm:^2.4.0" + url-join: "npm:4.0.1" + peerDependencies: + graphql: "*" + checksum: b3be8747c804dc62c4b698578750d450891bf5e2dbb0cf7ff47c3f092738c01da4c1992498d6beb0ab66f050b4a41bca670c4d6cec263b347786f3ae97e47989 + languageName: node + linkType: hard + +"@omnigraph/openapi@npm:0.17.5": + version: 0.17.5 + resolution: "@omnigraph/openapi@npm:0.17.5" + dependencies: + "@graphql-mesh/cross-helpers": "npm:0.2.8" + "@graphql-mesh/string-interpolation": "npm:0.3.3" "@graphql-mesh/types": "npm:0.85.6" "@graphql-mesh/utils": "npm:0.42.5" "@omnigraph/json-schema": "npm:0.36.5" @@ -5228,6 +5574,29 @@ __metadata: languageName: node linkType: hard +"@sideway/address@npm:^4.1.3": + version: 4.1.4 + resolution: "@sideway/address@npm:4.1.4" + dependencies: + "@hapi/hoek": "npm:^9.0.0" + checksum: 28d3017397f1598f4343688fcf609dbe1e1c96ac5b4c00c945b29057101f47ecb7d9ecbe039a0e912dd299a1dd876bc4efe37de91fc315e84811ca5a83c2c604 + languageName: node + linkType: hard + +"@sideway/formula@npm:^3.0.0": + version: 3.0.0 + resolution: "@sideway/formula@npm:3.0.0" + checksum: 0c210798e48f58f10b9ba066f0b3d00098bb0485bac2d4ac01767d25e9f751c3b6890e08a7b123585207294f0024020c7ad81261dee7320fc9efe26b00b7752f + languageName: node + linkType: hard + +"@sideway/pinpoint@npm:^2.0.0": + version: 2.0.0 + resolution: "@sideway/pinpoint@npm:2.0.0" + checksum: 01038f9f2f36c7181f43e2ea1730949681a5498c412c1c92a3a960532d1312e6a020bcab38368783aa42340a09a9e9fc5c1bff7196b32989f77b173fab42f819 + languageName: node + linkType: hard + "@sinclair/typebox@npm:^0.24.1": version: 0.24.19 resolution: "@sinclair/typebox@npm:0.24.19" @@ -5235,6 +5604,13 @@ __metadata: languageName: node linkType: hard +"@sindresorhus/is@npm:^0.14.0": + version: 0.14.0 + resolution: "@sindresorhus/is@npm:0.14.0" + checksum: e1bdaa32fb78c4c018dfc03f642635b417e4022817fb373997731942bc06c6b62b9be7270da4fc6ba19071af7cb724d7ceb1ede13166ff737a86b299ae83c361 + languageName: node + linkType: hard + "@sindresorhus/is@npm:^4.0.0": version: 4.2.0 resolution: "@sindresorhus/is@npm:4.2.0" @@ -5260,7 +5636,7 @@ __metadata: languageName: node linkType: hard -"@size-limit/file@npm:8.1.0": +"@size-limit/file@npm:8.1.0, @size-limit/file@npm:^8.1.0": version: 8.1.0 resolution: "@size-limit/file@npm:8.1.0" dependencies: @@ -5271,6 +5647,30 @@ __metadata: languageName: node linkType: hard +"@size-limit/webpack-why@npm:^8.1.0": + version: 8.1.0 + resolution: "@size-limit/webpack-why@npm:8.1.0" + dependencies: + "@statoscope/webpack-plugin": "npm:^5.24.0" + peerDependencies: + size-limit: 8.1.0 + checksum: fe2e999b87ce5fb9b7ef40b28a965e3d2b50fff1743b30cabc72e45cb3914101eb0461598c3bae3d3e568f5b5305739469d183826e91a7844bc1b1bf9fb0d4c7 + languageName: node + linkType: hard + +"@size-limit/webpack@npm:^8.1.0": + version: 8.1.0 + resolution: "@size-limit/webpack@npm:8.1.0" + dependencies: + escape-string-regexp: "npm:^4.0.0" + nanoid: "npm:^3.3.4" + webpack: "npm:^5.74.0" + peerDependencies: + size-limit: 8.1.0 + checksum: e12f2fd21932a078d4d98f1ab34026bd11ae240eba71a65a6b6173802cbc35750e8da98b9d15d4c2569bcfec1fa226b0d32c366db47a9bf3e90b58f94bd8e30f + languageName: node + linkType: hard + "@soluble/cache-interop@npm:0.11.1, @soluble/cache-interop@npm:^0.11.1": version: 0.11.1 resolution: "@soluble/cache-interop@npm:0.11.1" @@ -5296,6 +5696,167 @@ __metadata: languageName: node linkType: hard +"@statoscope/extensions@npm:5.14.1": + version: 5.14.1 + resolution: "@statoscope/extensions@npm:5.14.1" + checksum: b7ebe5008cbe3ee6b49f9b9fa8b40b7611fc1e208d17256a0332aca8788bf527d9cfcabab22570c1dffa8c9fd707b2ecfb9600c4fec52809e01aec850c21984f + languageName: node + linkType: hard + +"@statoscope/helpers@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/helpers@npm:5.24.0" + dependencies: + "@types/archy": "npm:^0.0.32" + "@types/semver": "npm:^7.3.10" + archy: "npm:~1.0.0" + jora: "npm:^1.0.0-beta.7" + semver: "npm:^7.3.7" + checksum: 778cd5beaa7553f420321f42a7af9d9f99e10806a85f23bf0af437cca4ebff9885d7e6abef3248e64cafef2d8be37b672945441ff3f45e0899df9282bf11a264 + languageName: node + linkType: hard + +"@statoscope/report-writer@npm:5.22.0": + version: 5.22.0 + resolution: "@statoscope/report-writer@npm:5.22.0" + dependencies: + "@discoveryjs/json-ext": "npm:^0.5.7" + checksum: 519c788e8de83963ae1af2bc259a47e4cbd9355e93fe8eb0a690a95cd96e01e898f769acec1930d7ddcfd7e1a40152338ec3b9cc6fe9dcb5c89bf9eb317e6ddf + languageName: node + linkType: hard + +"@statoscope/stats-extension-compressed@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/stats-extension-compressed@npm:5.24.0" + dependencies: + "@statoscope/helpers": "npm:5.24.0" + gzip-size: "npm:^6.0.0" + checksum: d59720829333cf5f7bd8a9f1990ff3bafa4c7f3eea9ed97e93efff85ef94b82c2beea84c67e4c4102b67b9465a6e55da03aab2232f06944e77148610f0e8b7d9 + languageName: node + linkType: hard + +"@statoscope/stats-extension-custom-reports@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/stats-extension-custom-reports@npm:5.24.0" + dependencies: + "@statoscope/extensions": "npm:5.14.1" + "@statoscope/helpers": "npm:5.24.0" + "@statoscope/stats": "npm:5.14.1" + "@statoscope/types": "npm:5.22.0" + checksum: cec06517ca861b0fd45a56870194df12a7be02f2425a2f7dcfd93bc45abfd727968bab4ac17ce0bd8f44792dd1a0972cf6d84f541bb1193e8d4a7971acaf92e2 + languageName: node + linkType: hard + +"@statoscope/stats-extension-package-info@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/stats-extension-package-info@npm:5.24.0" + dependencies: + "@statoscope/helpers": "npm:5.24.0" + checksum: 0c7e5f08fc4cc51c965e81c4c4b1cbc6c10fe827adaa53f7b2aa7fa62d025f75efec9668effc86eeb5762a39d68fc35a64c0c11f787d1c06fc3d3b5d477d2ac3 + languageName: node + linkType: hard + +"@statoscope/stats-extension-stats-validation-result@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/stats-extension-stats-validation-result@npm:5.24.0" + dependencies: + "@statoscope/extensions": "npm:5.14.1" + "@statoscope/helpers": "npm:5.24.0" + "@statoscope/stats": "npm:5.14.1" + "@statoscope/types": "npm:5.22.0" + checksum: bf2bb093fce9fe5e4f646104641fbdea87cdcc627554278bd9f855390e9d144ddddf83c9ec40a4d7bf659bda37f626f858f8129897d0db1664fe1688c14cd0dc + languageName: node + linkType: hard + +"@statoscope/stats@npm:5.14.1": + version: 5.14.1 + resolution: "@statoscope/stats@npm:5.14.1" + checksum: 49984645e94ffcf50d3f5fabd38b1e11952aecd55bbba3587035c0afb05702042cca3f7b7f0256dbbac11a436ab5522f17726fc1d99d89fcb913398bafa146ac + languageName: node + linkType: hard + +"@statoscope/types@npm:5.22.0": + version: 5.22.0 + resolution: "@statoscope/types@npm:5.22.0" + dependencies: + "@statoscope/stats": "npm:5.14.1" + checksum: 78bfba47aff7c9ac6351cb0e057d26ded9ddba48e9eac402820f6651179e47d7032010f1730b0c119783607b78758f781db98bb16d6fb14541b09c5905d054b4 + languageName: node + linkType: hard + +"@statoscope/webpack-model@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/webpack-model@npm:5.24.0" + dependencies: + "@statoscope/extensions": "npm:5.14.1" + "@statoscope/helpers": "npm:5.24.0" + "@statoscope/stats": "npm:5.14.1" + "@statoscope/stats-extension-compressed": "npm:5.24.0" + "@statoscope/stats-extension-custom-reports": "npm:5.24.0" + "@statoscope/stats-extension-package-info": "npm:5.24.0" + "@statoscope/stats-extension-stats-validation-result": "npm:5.24.0" + "@statoscope/types": "npm:5.22.0" + md5: "npm:^2.3.0" + checksum: 54be92ea1694e3f2843aff032d60ec94efd73d77a03a922f2bc916db54f2f0eec231e9a25478fbf7dec044219c03bd08848540848e99cbdec321924706394a6f + languageName: node + linkType: hard + +"@statoscope/webpack-plugin@npm:^5.24.0": + version: 5.24.0 + resolution: "@statoscope/webpack-plugin@npm:5.24.0" + dependencies: + "@discoveryjs/json-ext": "npm:^0.5.7" + "@statoscope/report-writer": "npm:5.22.0" + "@statoscope/stats": "npm:5.14.1" + "@statoscope/stats-extension-compressed": "npm:5.24.0" + "@statoscope/stats-extension-custom-reports": "npm:5.24.0" + "@statoscope/types": "npm:5.22.0" + "@statoscope/webpack-model": "npm:5.24.0" + "@statoscope/webpack-stats-extension-compressed": "npm:5.24.0" + "@statoscope/webpack-stats-extension-package-info": "npm:5.24.0" + "@statoscope/webpack-ui": "npm:5.24.0" + open: "npm:^8.4.0" + peerDependencies: + webpack: ^4.0.0 || ^5.0.0 + checksum: 87dc7b0acb52335fa76057ff531993ee41b5540d10776a722248cdfdbe7053a50d5f01121b89a26255c24698c3468314b2c90b420571a8411da637a88c1201c1 + languageName: node + linkType: hard + +"@statoscope/webpack-stats-extension-compressed@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/webpack-stats-extension-compressed@npm:5.24.0" + dependencies: + "@statoscope/stats": "npm:5.14.1" + "@statoscope/stats-extension-compressed": "npm:5.24.0" + "@statoscope/webpack-model": "npm:5.24.0" + peerDependencies: + webpack: ^4.0.0 || ^5.0.0 + checksum: f54c455bcf1328123c143c72fdd0b0798d1e58c19f4fbd0c9ee09cc76cf68474c45b0a9c6848e2c3ee74f7d95d72fce264c1539ef8b59fcbec2ec628cec4ef84 + languageName: node + linkType: hard + +"@statoscope/webpack-stats-extension-package-info@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/webpack-stats-extension-package-info@npm:5.24.0" + dependencies: + "@statoscope/stats": "npm:5.14.1" + "@statoscope/stats-extension-package-info": "npm:5.24.0" + "@statoscope/webpack-model": "npm:5.24.0" + peerDependencies: + webpack: ^4.0.0 || ^5.0.0 + checksum: 3272832a1b93468f22a2fbe21fdb57e82e9e100bfb5c99a36c37ce99000fd4afa57a94868f790bda4462e33e66f811a9f3220bc3a26e9650c00035c1c967655b + languageName: node + linkType: hard + +"@statoscope/webpack-ui@npm:5.24.0": + version: 5.24.0 + resolution: "@statoscope/webpack-ui@npm:5.24.0" + dependencies: + "@statoscope/types": "npm:5.22.0" + checksum: 4a532a8491a15e0b4ddece92382f695cfdc6a1f0d0993870e8eed087d58c012701781a57475cba79290738cc3407c5f17db2b209de62bed49e59c6927e13b1cd + languageName: node + linkType: hard + "@storybook/addon-actions@npm:6.5.13": version: 6.5.13 resolution: "@storybook/addon-actions@npm:6.5.13" @@ -6736,6 +7297,15 @@ __metadata: languageName: node linkType: hard +"@szmarczak/http-timer@npm:^1.1.2": + version: 1.1.2 + resolution: "@szmarczak/http-timer@npm:1.1.2" + dependencies: + defer-to-connect: "npm:^1.0.1" + checksum: 08c340133b8541c827235c01f6cc02d8a3c5e48d5397f4af6127587793067a12833ed903dae60b406b9644702bb1aedc877c7dacb44afe4d4feb9ac7a6919bee + languageName: node + linkType: hard + "@szmarczak/http-timer@npm:^4.0.5": version: 4.0.6 resolution: "@szmarczak/http-timer@npm:4.0.6" @@ -6830,6 +7400,22 @@ __metadata: languageName: node linkType: hard +"@testing-library/dom@npm:^7.11.0": + version: 7.31.2 + resolution: "@testing-library/dom@npm:7.31.2" + dependencies: + "@babel/code-frame": "npm:^7.10.4" + "@babel/runtime": "npm:^7.12.5" + "@types/aria-query": "npm:^4.2.0" + aria-query: "npm:^4.2.2" + chalk: "npm:^4.1.0" + dom-accessibility-api: "npm:^0.5.6" + lz-string: "npm:^1.4.4" + pretty-format: "npm:^26.6.2" + checksum: 8fbe51e8139952b244c562cbf7803930122516ad715bfb9cb7767949c890a5ba0f9f2e3dc2c9fb7cae441bb88ddeac4c2a04c2053879b180812f53195ad5cc37 + languageName: node + linkType: hard + "@testing-library/jest-dom@npm:5.16.5, @testing-library/jest-dom@npm:^5.16.5": version: 5.16.5 resolution: "@testing-library/jest-dom@npm:5.16.5" @@ -6869,7 +7455,7 @@ __metadata: languageName: node linkType: hard -"@testing-library/react@npm:13.4.0, @testing-library/react@npm:^13.4.0": +"@testing-library/react@npm:13.4.0, @testing-library/react@npm:^13.3.0, @testing-library/react@npm:^13.4.0": version: 13.4.0 resolution: "@testing-library/react@npm:13.4.0" dependencies: @@ -6962,6 +7548,13 @@ __metadata: languageName: node linkType: hard +"@types/archy@npm:^0.0.32": + version: 0.0.32 + resolution: "@types/archy@npm:0.0.32" + checksum: 545fc9a0214a12d904c8552fdf879d70fd99f68ef0d8d3ca26d501c6fcccf24ad5d0ab31f3efb89f568fb2c4e92bea3950bbb02f47e7a73a9d2b8460d8f16515 + languageName: node + linkType: hard + "@types/aria-query@npm:^4.2.0": version: 4.2.2 resolution: "@types/aria-query@npm:4.2.2" @@ -6970,15 +7563,15 @@ __metadata: linkType: hard "@types/babel__core@npm:^7.1.14": - version: 7.1.16 - resolution: "@types/babel__core@npm:7.1.16" + version: 7.1.19 + resolution: "@types/babel__core@npm:7.1.19" dependencies: "@babel/parser": "npm:^7.1.0" "@babel/types": "npm:^7.0.0" "@types/babel__generator": "npm:*" "@types/babel__template": "npm:*" "@types/babel__traverse": "npm:*" - checksum: 5683eb49c69fa110cfcc7b6356a0b282f38e65e36e078f43cde37b68d86d564d9c174494b42517aedb8e9229d94fb5181fb201a52a62e20f87bfecd830987869 + checksum: c357dd2c14cda36b47c48d1690a139e7fe336e856b335b100420821e583895cedaa6dcf4241d7ae6869f0d7113a063f0f2823d8ce3d847ec5b9622cd6363b8ad languageName: node linkType: hard @@ -7002,11 +7595,11 @@ __metadata: linkType: hard "@types/babel__traverse@npm:*, @types/babel__traverse@npm:^7.0.6": - version: 7.14.2 - resolution: "@types/babel__traverse@npm:7.14.2" + version: 7.18.2 + resolution: "@types/babel__traverse@npm:7.18.2" dependencies: "@babel/types": "npm:^7.3.0" - checksum: 0eecb17fef2f4428bc0f15d9fe417b1fba0da08daacb604935940d9b4f8a846a95a2e22938b883fee8c429ab0ea562813c2498bf205669c87515b27c1097d3ad + checksum: 659edbf959df98691eea5232ad11f447245528da6a3dceec6508c2087f326f4809f0e42420c25fa18957faf1519a355d3d3feceb91b9b7b4957475fb7fe4b4c3 languageName: node linkType: hard @@ -7245,7 +7838,7 @@ __metadata: languageName: node linkType: hard -"@types/jest@npm:*, @types/jest@npm:29.2.2": +"@types/jest@npm:*, @types/jest@npm:29.2.2, @types/jest@npm:^29.2.2": version: 29.2.2 resolution: "@types/jest@npm:29.2.2" dependencies: @@ -7280,12 +7873,12 @@ __metadata: languageName: node linkType: hard -"@types/keyv@npm:*": - version: 3.1.3 - resolution: "@types/keyv@npm:3.1.3" +"@types/keyv@npm:*, @types/keyv@npm:^3.1.1": + version: 3.1.4 + resolution: "@types/keyv@npm:3.1.4" dependencies: "@types/node": "npm:*" - checksum: a21e3e820d62969051fbd679a45bd347ff2e35f74d46a3b6910f8dc5239d3786a6d81bb2a142a4c0a0d2612fee4a15f4eb60eee8a8330e475807e4f4e3f18526 + checksum: c1fbfe6e2a8c82656c8fc5782d937c82ed336cdca451c4d7a8d08d245531ad21572024d621b38071d34cfb7461702eea79fcf222a03264f00564d75e78bd348d languageName: node linkType: hard @@ -7326,7 +7919,7 @@ __metadata: languageName: node linkType: hard -"@types/minimist@npm:^1.2.0": +"@types/minimist@npm:^1.2.0, @types/minimist@npm:^1.2.2": version: 1.2.2 resolution: "@types/minimist@npm:1.2.2" checksum: 7fd2a4dc547de09d78c688d79aefcceb54e8c86eb61a5b1a593dfc03bbf1f8589a616ae978585211d078e51abc55b93064b2039c34266db8f277bd6bc03557c3 @@ -7350,7 +7943,7 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:18.11.9": +"@types/node@npm:*, @types/node@npm:18.11.9, @types/node@npm:^18.7.8": version: 18.11.9 resolution: "@types/node@npm:18.11.9" checksum: 7b7d90894dd1ae9b6836e49ace5bdea55cc08806a508e38851e333f1ad77ec81ea6dca58e6a2444ad0471fee965b9908cc1ef06028eebca9c20d54729df98bab @@ -7371,10 +7964,10 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^14.0.0": - version: 14.18.26 - resolution: "@types/node@npm:14.18.26" - checksum: 7ed44aa4a0a0f6574b5c260b00657c3480ee079953faf76659b8300441a68b1d8b503b6212521491a28121463be772d65c713e1de74fbef6fbf8e560425d587b +"@types/node@npm:^14.0.0, @types/node@npm:^14.14.31": + version: 14.18.33 + resolution: "@types/node@npm:14.18.33" + checksum: a8baef540b619dc4b367a9be1a0ea4892617a8f8c25436703364e8e42dae064f46679f0c225cb49826e4cd7172f72257d36a4a154f203a19e8f338ab33934141 languageName: node linkType: hard @@ -7448,7 +8041,7 @@ __metadata: languageName: node linkType: hard -"@types/react-dom@npm:18.0.8, @types/react-dom@npm:^18.0.0": +"@types/react-dom@npm:18.0.8, @types/react-dom@npm:^18.0.0, @types/react-dom@npm:^18.0.6": version: 18.0.8 resolution: "@types/react-dom@npm:18.0.8" dependencies: @@ -7475,7 +8068,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:18.0.25, @types/react@npm:>=16": +"@types/react@npm:*, @types/react@npm:18.0.25, @types/react@npm:>=16, @types/react@npm:^18.0.17": version: 18.0.25 resolution: "@types/react@npm:18.0.25" dependencies: @@ -7518,10 +8111,10 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.3.12": - version: 7.3.12 - resolution: "@types/semver@npm:7.3.12" - checksum: 35ae8150669b266e91d64c514415e69eabedb4d969aa61056b21028d9f35fdb856d745274d163a8c3a72650cd9abbfd78e878a28b79f41894da585a7d7c8229c +"@types/semver@npm:^7.3.10, @types/semver@npm:^7.3.12": + version: 7.3.13 + resolution: "@types/semver@npm:7.3.13" + checksum: a76156ff60ddbd17bf2120c09dca3cd8ac7db4f8d8c69614a9ebc5202f05d1044def7fd8cf77415f7284ea8edfa1092b6e04dac07dc17c94762904c69dd2c85b languageName: node linkType: hard @@ -7532,6 +8125,20 @@ __metadata: languageName: node linkType: hard +"@types/sinonjs__fake-timers@npm:8.1.1": + version: 8.1.1 + resolution: "@types/sinonjs__fake-timers@npm:8.1.1" + checksum: 775ed686e33888ee22fd4f811fb59de2cdc5af41bb821db73c03d07a1da068ebba8e3d626a20dfc2f41fe44188596f3313c79a93a84e33647d3289cc7388cae3 + languageName: node + linkType: hard + +"@types/sizzle@npm:^2.3.2": + version: 2.3.3 + resolution: "@types/sizzle@npm:2.3.3" + checksum: a0b945a0802399b36a46499b6f6ccbf32703dcf54696a69c299daa4ab53c658f7f95efce5d2b15c99ca26ae4d6ff032c909d60d70d2d69c19cf5715168275fd1 + languageName: node + linkType: hard + "@types/source-list-map@npm:*": version: 0.1.2 resolution: "@types/source-list-map@npm:0.1.2" @@ -7553,6 +8160,16 @@ __metadata: languageName: node linkType: hard +"@types/testing-library__cypress@npm:^5.0.9": + version: 5.0.9 + resolution: "@types/testing-library__cypress@npm:5.0.9" + dependencies: + "@testing-library/dom": "npm:^7.11.0" + cypress: "npm:*" + checksum: 8e8345347d85411213bf3a3b99a13a1798fbce8ae9d548eefe2b5b3fce653162e275408cba4f0e64139789024633e2def6ab04d238973bb25bd972261f75b9e7 + languageName: node + linkType: hard + "@types/testing-library__jest-dom@npm:5.14.5, @types/testing-library__jest-dom@npm:^5.9.1": version: 5.14.5 resolution: "@types/testing-library__jest-dom@npm:5.14.5" @@ -7651,7 +8268,16 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.38.0, @typescript-eslint/eslint-plugin@npm:^5.42.0": +"@types/yauzl@npm:^2.9.1": + version: 2.10.0 + resolution: "@types/yauzl@npm:2.10.0" + dependencies: + "@types/node": "npm:*" + checksum: 1ffd30f5095d901c8f9145398b9a26483b71fac13b49c887a5366063a91acf644bc92c83a5b832c3ec7393020df9af076b621c02cb7526e47ffe07ed50a45bf6 + languageName: node + linkType: hard + +"@typescript-eslint/eslint-plugin@npm:^5.33.1, @typescript-eslint/eslint-plugin@npm:^5.38.0, @typescript-eslint/eslint-plugin@npm:^5.42.0": version: 5.42.0 resolution: "@typescript-eslint/eslint-plugin@npm:5.42.0" dependencies: @@ -7674,18 +8300,18 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/experimental-utils@npm:^5.3.0": - version: 5.31.0 - resolution: "@typescript-eslint/experimental-utils@npm:5.31.0" +"@typescript-eslint/experimental-utils@npm:^5.0.0, @typescript-eslint/experimental-utils@npm:^5.3.0": + version: 5.42.0 + resolution: "@typescript-eslint/experimental-utils@npm:5.42.0" dependencies: - "@typescript-eslint/utils": "npm:5.31.0" + "@typescript-eslint/utils": "npm:5.42.0" peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: f2888d1d5f296e5afa5b611c34b0f27a4ef2ca6d6f717e1a8e4ad99c91a175cf0262a6108510ebbe3de570dab10952009e798f4a29d538452e400cc78d5ef15f + checksum: 421f04cdc1364b33022540d9ffdd012fac1159724fb85bb1e8f61c0c72b53f10fe56077dcc1f441a0080a0c8b586e9b07682349df04b97a23d6860dc544ddacb languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.21.0, @typescript-eslint/parser@npm:^5.38.0, @typescript-eslint/parser@npm:^5.42.0": +"@typescript-eslint/parser@npm:^5.21.0, @typescript-eslint/parser@npm:^5.33.1, @typescript-eslint/parser@npm:^5.38.0, @typescript-eslint/parser@npm:^5.42.0": version: 5.42.0 resolution: "@typescript-eslint/parser@npm:5.42.0" dependencies: @@ -7702,16 +8328,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.31.0": - version: 5.31.0 - resolution: "@typescript-eslint/scope-manager@npm:5.31.0" - dependencies: - "@typescript-eslint/types": "npm:5.31.0" - "@typescript-eslint/visitor-keys": "npm:5.31.0" - checksum: 7170121c23e4ea2ae4887c5f5fe078dd5f985302d244a06038e6ba90237e816ce0e9ca0c8a5b96c88548c66f559e14fc3c7e5a78cca59da947664fda4f31614f - languageName: node - linkType: hard - "@typescript-eslint/scope-manager@npm:5.42.0": version: 5.42.0 resolution: "@typescript-eslint/scope-manager@npm:5.42.0" @@ -7739,13 +8355,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:5.31.0": - version: 5.31.0 - resolution: "@typescript-eslint/types@npm:5.31.0" - checksum: bd7cfa2eaa1528837fb2c5cdf7787dbb7185659fb2ae553499a2563bd438eddf1b6ec188432bd481abd3daf00057f5ed327a9d1c58c15abcf045b0911608536b - languageName: node - linkType: hard - "@typescript-eslint/types@npm:5.42.0": version: 5.42.0 resolution: "@typescript-eslint/types@npm:5.42.0" @@ -7753,24 +8362,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.31.0": - version: 5.31.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.31.0" - dependencies: - "@typescript-eslint/types": "npm:5.31.0" - "@typescript-eslint/visitor-keys": "npm:5.31.0" - debug: "npm:^4.3.4" - globby: "npm:^11.1.0" - is-glob: "npm:^4.0.3" - semver: "npm:^7.3.7" - tsutils: "npm:^3.21.0" - peerDependenciesMeta: - typescript: - optional: true - checksum: 25d1b14677bedfe88e5d767014d9b35aa9487b093810e39f8ab5153e4541e504a495fdd408632062429c2304fba066af8d67fcb4db5c35ab5784f10cba2f69ce - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:5.42.0": version: 5.42.0 resolution: "@typescript-eslint/typescript-estree@npm:5.42.0" @@ -7789,22 +8380,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.31.0": - version: 5.31.0 - resolution: "@typescript-eslint/utils@npm:5.31.0" - dependencies: - "@types/json-schema": "npm:^7.0.9" - "@typescript-eslint/scope-manager": "npm:5.31.0" - "@typescript-eslint/types": "npm:5.31.0" - "@typescript-eslint/typescript-estree": "npm:5.31.0" - eslint-scope: "npm:^5.1.1" - eslint-utils: "npm:^3.0.0" - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 822f65cab9580c4c9ffd6d3f73ed212b04658908ce51573bc54c28d889b034eb70fcf99c9cce7fb84d9231671026e8827b7201fdb9ba63a9d0bcdd56adf3bf16 - languageName: node - linkType: hard - "@typescript-eslint/utils@npm:5.42.0, @typescript-eslint/utils@npm:^5.10.0, @typescript-eslint/utils@npm:^5.13.0": version: 5.42.0 resolution: "@typescript-eslint/utils@npm:5.42.0" @@ -7823,16 +8398,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.31.0": - version: 5.31.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.31.0" - dependencies: - "@typescript-eslint/types": "npm:5.31.0" - eslint-visitor-keys: "npm:^3.3.0" - checksum: be5b4f9288c679dadda04a607b41c1332d94077fe537e661807d3316a16d4095be68115b1ee208b5f9e493bd50bb68716398d59da766d0d7d614813a6efb38d6 - languageName: node - linkType: hard - "@typescript-eslint/visitor-keys@npm:5.42.0": version: 5.42.0 resolution: "@typescript-eslint/visitor-keys@npm:5.42.0" @@ -8741,11 +9306,11 @@ __metadata: linkType: hard "acorn@npm:^8.0.0, acorn@npm:^8.0.4, acorn@npm:^8.4.1, acorn@npm:^8.5.0, acorn@npm:^8.7.0, acorn@npm:^8.7.1, acorn@npm:^8.8.0": - version: 8.8.0 - resolution: "acorn@npm:8.8.0" + version: 8.8.1 + resolution: "acorn@npm:8.8.1" bin: acorn: bin/acorn - checksum: 15b10fb381a8a0394a718eba147e120b9d1ae6ed087e61612ee5fda94f98182e5fcd78ef6725c027dc3c5677ce920617c14c359d7777e8ef6a058d2ba113f81f + checksum: f8a84cf59173c5c07cb6b8097c716370f799244189b23d58358eadf9729e0d62660bc11339e03f08517fa33d1ef4b69b84b0bdebe0c0d783acaa8d2c44a66345 languageName: node linkType: hard @@ -8786,6 +9351,16 @@ __metadata: languageName: node linkType: hard +"aggregate-error@npm:^4.0.0": + version: 4.0.1 + resolution: "aggregate-error@npm:4.0.1" + dependencies: + clean-stack: "npm:^4.0.0" + indent-string: "npm:^5.0.0" + checksum: eaec512dfaceb2b1cebad80e81b068c956ec836fa59e72267d74e4cbebae582be55463aa90fb003728e7443880936dd0297a1c0c09eb4b5a05c7adc3267ac368 + languageName: node + linkType: hard + "airbnb-js-shims@npm:^2.2.1": version: 2.2.1 resolution: "airbnb-js-shims@npm:2.2.1" @@ -8890,6 +9465,26 @@ __metadata: languageName: node linkType: hard +"all-contributors-cli@npm:^6.20.0": + version: 6.24.0 + resolution: "all-contributors-cli@npm:6.24.0" + dependencies: + "@babel/runtime": "npm:^7.7.6" + async: "npm:^3.1.0" + chalk: "npm:^4.0.0" + didyoumean: "npm:^1.2.1" + inquirer: "npm:^7.3.3" + json-fixer: "npm:^1.6.8" + lodash: "npm:^4.11.2" + node-fetch: "npm:^2.6.0" + pify: "npm:^5.0.0" + yargs: "npm:^15.0.1" + bin: + all-contributors: dist/cli.js + checksum: d57893e4d82b0e049eb4ddb85f36b40a34e3df197c067f6baf28a83d34ba70c1a97586ac425ddeaa2ed1f5ecf3035743b5c50e7b2339a166979fd3ad997a4146 + languageName: node + linkType: hard + "alphanum-sort@npm:^1.0.2": version: 1.0.2 resolution: "alphanum-sort@npm:1.0.2" @@ -8952,7 +9547,7 @@ __metadata: languageName: node linkType: hard -"ansi-regex@npm:^5.0.1": +"ansi-regex@npm:^5.0.0, ansi-regex@npm:^5.0.1": version: 5.0.1 resolution: "ansi-regex@npm:5.0.1" checksum: 627f94ee7fcc5e03186646ebd11ca2ccd954f3cb48fc6a3f42883db6bbf3df5dfba06d62647b2f72c975349fc072c5c44808b7da26d08a9313a7f304acda2efb @@ -9050,6 +9645,24 @@ __metadata: languageName: node linkType: hard +"application-config-path@npm:^0.1.0": + version: 0.1.0 + resolution: "application-config-path@npm:0.1.0" + checksum: 14acb0c5e7a954b243c6fd46446289dfddc46eff7b2d1132fff619f01b5b9913172ac6cca568101299537ff2b357f6bf25b08f9fe6965b2772b1868d44c95d81 + languageName: node + linkType: hard + +"application-config@npm:^2.0.0": + version: 2.0.0 + resolution: "application-config@npm:2.0.0" + dependencies: + application-config-path: "npm:^0.1.0" + load-json-file: "npm:^6.2.0" + write-json-file: "npm:^4.2.0" + checksum: 840cb202a1f38afd6271c35e27eccd8226de189766a10c0362b4ca33fa376e974fe8ec37e3cdea7cc6c81a183b7021a2c628e1fca0cba54308a72226706ca50d + languageName: node + linkType: hard + "aproba@npm:^1.0.3 || ^2.0.0": version: 2.0.0 resolution: "aproba@npm:2.0.0" @@ -9064,6 +9677,20 @@ __metadata: languageName: node linkType: hard +"arch@npm:^2.2.0": + version: 2.2.0 + resolution: "arch@npm:2.2.0" + checksum: 62f8a11342f4434324d349bcbe5278ca6b2092e3c4a955956ad4373b55b150616be419bff706584644b41a741625530a771077994f1c0bfe022396d01c1210a6 + languageName: node + linkType: hard + +"archy@npm:~1.0.0": + version: 1.0.0 + resolution: "archy@npm:1.0.0" + checksum: 68f2a06546740392b40920ffc97362f22cf26fee02cb448a875c28ae916ac4017169d08ce40ad12fa2d11ea1dc2d32c35fad4219f7f3b14a642497719ce4de83 + languageName: node + linkType: hard + "are-we-there-yet@npm:^2.0.0": version: 2.0.0 resolution: "are-we-there-yet@npm:2.0.0" @@ -9267,6 +9894,13 @@ __metadata: languageName: node linkType: hard +"arrify@npm:^3.0.0": + version: 3.0.0 + resolution: "arrify@npm:3.0.0" + checksum: 7ee13f33945c5a757e70d2e4953bea0e143fd1f9cd3905eabdf444f8399d272dabd66f77fb0839e16a07ff26076ccae0e8177bfcbb17343197322081b5ff1a21 + languageName: node + linkType: hard + "asap@npm:^2.0.6, asap@npm:~2.0.3, asap@npm:~2.0.6": version: 2.0.6 resolution: "asap@npm:2.0.6" @@ -9286,6 +9920,15 @@ __metadata: languageName: node linkType: hard +"asn1@npm:~0.2.3": + version: 0.2.6 + resolution: "asn1@npm:0.2.6" + dependencies: + safer-buffer: "npm:~2.1.0" + checksum: 3c97ac9d83ca097850fd9d4228a0f366e18a7a8fd055d749a15d7018a47ed208a3be48f3cfdacea738b44f4b40b56e943f0607de221bbdec812b74129ecf0c22 + languageName: node + linkType: hard + "asn1js@npm:^3.0.1, asn1js@npm:^3.0.5": version: 3.0.5 resolution: "asn1js@npm:3.0.5" @@ -9297,6 +9940,13 @@ __metadata: languageName: node linkType: hard +"assert-plus@npm:1.0.0, assert-plus@npm:^1.0.0": + version: 1.0.0 + resolution: "assert-plus@npm:1.0.0" + checksum: 38cb6f1d545a2cc3b1c30101324720ae0a659c071615b49274b423d8ca7efaecebc85c128d6dc35a46e4d7c6077385783cb46a1901896e3b7f10f619c7111057 + languageName: node + linkType: hard + "assert@npm:^1.1.1": version: 1.5.0 resolution: "assert@npm:1.5.0" @@ -9376,7 +10026,7 @@ __metadata: languageName: node linkType: hard -"async@npm:^3.2.3": +"async@npm:^3.1.0, async@npm:^3.2.0, async@npm:^3.2.3": version: 3.2.4 resolution: "async@npm:3.2.4" checksum: 9719e38d24e9922c255ee9ae925fb668ef52243f9866a1b59e423a3bb6150a886b3c37287348ceefa09cd3f6fa1a29dcc770eeb70642acb13674363b2d5b2b21 @@ -9462,6 +10112,20 @@ __metadata: languageName: node linkType: hard +"aws-sign2@npm:~0.7.0": + version: 0.7.0 + resolution: "aws-sign2@npm:0.7.0" + checksum: 6af052d2392aee7cc9e63bc3737e282dcd392c1bfb4c97b8aff45b6b02a59d62eb6a084bcc16c67ccdb63924bb17e0aa14d38e12724345a1e4f4d648b768ecd5 + languageName: node + linkType: hard + +"aws4@npm:^1.8.0": + version: 1.11.0 + resolution: "aws4@npm:1.11.0" + checksum: 8904e8f0333080c6b47dd32bfa83c6067ea14aee9d0e078e844fed166769505e2fcc3eabe5dc038f552db441c5606736ffda3b13bd16f41c8e02b8287d3a53ed + languageName: node + linkType: hard + "axe-core@npm:^4.4.3": version: 4.4.3 resolution: "axe-core@npm:4.4.3" @@ -9480,6 +10144,15 @@ __metadata: languageName: node linkType: hard +"axios@npm:^0.21.1": + version: 0.21.4 + resolution: "axios@npm:0.21.4" + dependencies: + follow-redirects: "npm:^1.14.0" + checksum: 3bb41e72f935e007d9d9c146b3fae09ab0b560dffb9e3f9b3598a270dc94311ae2a0e11d418b7d21409ca5477cc29c867ef4d0cd6fc704b91e6958a35c8fedd5 + languageName: node + linkType: hard + "axobject-query@npm:^2.2.0": version: 2.2.0 resolution: "axobject-query@npm:2.2.0" @@ -9487,7 +10160,18 @@ __metadata: languageName: node linkType: hard -"babel-core@npm:^7.0.0-bridge.0": +"babel-code-frame@npm:^6.26.0": + version: 6.26.0 + resolution: "babel-code-frame@npm:6.26.0" + dependencies: + chalk: "npm:^1.1.3" + esutils: "npm:^2.0.2" + js-tokens: "npm:^3.0.2" + checksum: 9487af948c25dfd8995b1078ef9fd14a97b70bb3b7c17507a621b7201412e10301cbe86695d6954b8ba675dbc5485beefc5bf52067d60f7ac582ec040b2a41e7 + languageName: node + linkType: hard + +"babel-core@npm:7.0.0-bridge.0, babel-core@npm:^7.0.0-bridge.0": version: 7.0.0-bridge.0 resolution: "babel-core@npm:7.0.0-bridge.0" peerDependencies: @@ -9496,11 +10180,47 @@ __metadata: languageName: node linkType: hard -"babel-jest@npm:^29.2.2": - version: 29.2.2 - resolution: "babel-jest@npm:29.2.2" +"babel-helper-function-name@npm:^6.24.1": + version: 6.24.1 + resolution: "babel-helper-function-name@npm:6.24.1" + dependencies: + babel-helper-get-function-arity: "npm:^6.24.1" + babel-runtime: "npm:^6.22.0" + babel-template: "npm:^6.24.1" + babel-traverse: "npm:^6.24.1" + babel-types: "npm:^6.24.1" + checksum: a33d7a9beafe9b9f9f6b1a21ddc51967325eb9d996ad11d484f306c1a88c0375fbec43a81932fe8ec5effbfc854c579faf905469c7eee8c18db3faec2070c0a9 + languageName: node + linkType: hard + +"babel-helper-get-function-arity@npm:^6.24.1": + version: 6.24.1 + resolution: "babel-helper-get-function-arity@npm:6.24.1" + dependencies: + babel-runtime: "npm:^6.22.0" + babel-types: "npm:^6.24.1" + checksum: 41e08239f2b07a5a97bb3f82a42590cc081e507bab467e77f02dd8257012e949e4a1341ccfdd2c554baebd590d8bf64968e79496afc2939779dc132afb2b7d4a + languageName: node + linkType: hard + +"babel-helper-remap-async-to-generator@npm:^6.24.1": + version: 6.24.1 + resolution: "babel-helper-remap-async-to-generator@npm:6.24.1" dependencies: - "@jest/transform": "npm:^29.2.2" + babel-helper-function-name: "npm:^6.24.1" + babel-runtime: "npm:^6.22.0" + babel-template: "npm:^6.24.1" + babel-traverse: "npm:^6.24.1" + babel-types: "npm:^6.24.1" + checksum: 4c559bbc1b0e492deaa0a800b8cec8c5d9bb5a2822501cb2e6c4ef541a469b3db2e36dbcccc7ede16e58a63099f87b954339b1eda259a1081c884d659979f5d4 + languageName: node + linkType: hard + +"babel-jest@npm:^29.3.1": + version: 29.3.1 + resolution: "babel-jest@npm:29.3.1" + dependencies: + "@jest/transform": "npm:^29.3.1" "@types/babel__core": "npm:^7.1.14" babel-plugin-istanbul: "npm:^6.1.1" babel-preset-jest: "npm:^29.2.0" @@ -9509,7 +10229,7 @@ __metadata: slash: "npm:^3.0.0" peerDependencies: "@babel/core": ^7.8.0 - checksum: 4ac85c230ddb22a7dbdc30642f1ceb293e4109bacac3cc860b13daa99e02f1c022dd50d806a08a86dff10a02c4c442be8f976cd579bfe1cbbc370a590501403b + checksum: 8736ef7d5dc54375bcbe849ca20aa2ab7b38d48596515ceca85555b6cb45b038850c1c6ad2bb100ddd5d60bbba8ad12f50d25285a50f31ed0cfa28fec27f3aa3 languageName: node linkType: hard @@ -9541,6 +10261,22 @@ __metadata: languageName: node linkType: hard +"babel-messages@npm:^6.23.0": + version: 6.23.0 + resolution: "babel-messages@npm:6.23.0" + dependencies: + babel-runtime: "npm:^6.22.0" + checksum: 9509a410b4727e00662362d7c3e44552cbb3d2bc010ff90d6fc70f75bacb144a34afa156ab3eb2f0de0696eee88ddcd03d7794a5f1df8f0bc67cc140d845ac55 + languageName: node + linkType: hard + +"babel-plugin-add-module-exports@npm:1.0.4": + version: 1.0.4 + resolution: "babel-plugin-add-module-exports@npm:1.0.4" + checksum: 1762a93b758c24647d983a2c3e49bc3c5188617e5d48a1dfbd2fde115a759bd06fa83709063ed35aa24cad803033902a74ae00d713696c342994a5a9574d11f4 + languageName: node + linkType: hard + "babel-plugin-add-react-displayname@npm:^0.0.5": version: 0.0.5 resolution: "babel-plugin-add-react-displayname@npm:0.0.5" @@ -9560,15 +10296,6 @@ __metadata: languageName: node linkType: hard -"babel-plugin-dynamic-import-node@npm:^2.3.3": - version: 2.3.3 - resolution: "babel-plugin-dynamic-import-node@npm:2.3.3" - dependencies: - object.assign: "npm:^4.1.0" - checksum: 1c608f6dcf3cbb31222304bb8ae04ae0ed9b62f09692b29ab98f58cbc318305d9d2926467542b3f7efafb187a39c3fb4ea88562c2d5773d4fec5deb7825b0a36 - languageName: node - linkType: hard - "babel-plugin-extract-import-names@npm:1.6.22": version: 1.6.22 resolution: "babel-plugin-extract-import-names@npm:1.6.22" @@ -9621,7 +10348,7 @@ __metadata: languageName: node linkType: hard -"babel-plugin-polyfill-corejs2@npm:^0.3.3": +"babel-plugin-polyfill-corejs2@npm:^0.3.2, babel-plugin-polyfill-corejs2@npm:^0.3.3": version: 0.3.3 resolution: "babel-plugin-polyfill-corejs2@npm:0.3.3" dependencies: @@ -9658,7 +10385,19 @@ __metadata: languageName: node linkType: hard -"babel-plugin-polyfill-regenerator@npm:^0.4.1": +"babel-plugin-polyfill-corejs3@npm:^0.5.3": + version: 0.5.3 + resolution: "babel-plugin-polyfill-corejs3@npm:0.5.3" + dependencies: + "@babel/helper-define-polyfill-provider": "npm:^0.3.2" + core-js-compat: "npm:^3.21.0" + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: 3b65d6704eb3f81f374d5da1119e9c8d63b74310e44e8a314331ab8bf797a3e19ebf3e73f38ed8c19aa3e8f38b8e87b1adffe848f1c0e039a91dcf042ef6d65f + languageName: node + linkType: hard + +"babel-plugin-polyfill-regenerator@npm:^0.4.0, babel-plugin-polyfill-regenerator@npm:^0.4.1": version: 0.4.1 resolution: "babel-plugin-polyfill-regenerator@npm:0.4.1" dependencies: @@ -9680,6 +10419,13 @@ __metadata: languageName: node linkType: hard +"babel-plugin-syntax-async-functions@npm:^6.8.0": + version: 6.13.0 + resolution: "babel-plugin-syntax-async-functions@npm:6.13.0" + checksum: 600361d654c27472142e2186703baf1fd5f04a482cd49c983ef6e3d40628218260e0ee8237d52ffcd138a934fbfaf3a55b359e67e3b0f0cfbd01fed36504c58a + languageName: node + linkType: hard + "babel-plugin-syntax-trailing-function-commas@npm:^7.0.0-beta.0": version: 7.0.0-beta.0 resolution: "babel-plugin-syntax-trailing-function-commas@npm:7.0.0-beta.0" @@ -9687,6 +10433,17 @@ __metadata: languageName: node linkType: hard +"babel-plugin-transform-async-to-generator@npm:6.24.1": + version: 6.24.1 + resolution: "babel-plugin-transform-async-to-generator@npm:6.24.1" + dependencies: + babel-helper-remap-async-to-generator: "npm:^6.24.1" + babel-plugin-syntax-async-functions: "npm:^6.8.0" + babel-runtime: "npm:^6.22.0" + checksum: cdecd0bbbde8a3208e76199db474de8ea5242aa2f67ac6c890d6e2a30f4d8330e8bdc800d72b3b15dd7fbcf3bbbabccd1dc5e379f453d21752f29c08f6ddc2e5 + languageName: node + linkType: hard + "babel-plugin-transform-async-to-promises@npm:^0.8.18": version: 0.8.18 resolution: "babel-plugin-transform-async-to-promises@npm:0.8.18" @@ -9776,6 +10533,67 @@ __metadata: languageName: node linkType: hard +"babel-runtime@npm:^6.22.0, babel-runtime@npm:^6.26.0": + version: 6.26.0 + resolution: "babel-runtime@npm:6.26.0" + dependencies: + core-js: "npm:^2.4.0" + regenerator-runtime: "npm:^0.11.0" + checksum: 9ff2870582894fa49190a1943e6be5beb659096ea393adab793f9d1733c4f44fd54c19e08f5bcff7416b241ca1ff89ebcea43c3a00daa61255001479e57d7554 + languageName: node + linkType: hard + +"babel-template@npm:^6.24.1": + version: 6.26.0 + resolution: "babel-template@npm:6.26.0" + dependencies: + babel-runtime: "npm:^6.26.0" + babel-traverse: "npm:^6.26.0" + babel-types: "npm:^6.26.0" + babylon: "npm:^6.18.0" + lodash: "npm:^4.17.4" + checksum: 9391ca7fb630cd529846a2c6337193442b09dbeaba01707372880954f28cf4b64a033710b64fe7e82ccccff1afc3ec58a18b8d4eba7d532d118bc19b4ff5e9bf + languageName: node + linkType: hard + +"babel-traverse@npm:^6.24.1, babel-traverse@npm:^6.26.0": + version: 6.26.0 + resolution: "babel-traverse@npm:6.26.0" + dependencies: + babel-code-frame: "npm:^6.26.0" + babel-messages: "npm:^6.23.0" + babel-runtime: "npm:^6.26.0" + babel-types: "npm:^6.26.0" + babylon: "npm:^6.18.0" + debug: "npm:^2.6.8" + globals: "npm:^9.18.0" + invariant: "npm:^2.2.2" + lodash: "npm:^4.17.4" + checksum: aa3e5fff686de0c91e56b70e13d1dbfeac615655e742b01b766e832f6830c5028a9c4d024df95cb119d387a7aaa5d7ce1c2b4568648b3e1a72e054f5ab3a2b07 + languageName: node + linkType: hard + +"babel-types@npm:^6.24.1, babel-types@npm:^6.26.0": + version: 6.26.0 + resolution: "babel-types@npm:6.26.0" + dependencies: + babel-runtime: "npm:^6.26.0" + esutils: "npm:^2.0.2" + lodash: "npm:^4.17.4" + to-fast-properties: "npm:^1.0.3" + checksum: c45910be4283661d3de64a9835ffe9d5130f836ebacb839b9a2ef3b009c6ac3dec04c89fc644af56c60f37571077a6b440bc054527ee33a250ae04bb44291c63 + languageName: node + linkType: hard + +"babylon@npm:^6.18.0": + version: 6.18.0 + resolution: "babylon@npm:6.18.0" + bin: + babylon: ./bin/babylon.js + checksum: c14bfa585d38e24f8d3db8f140b9b69c6da914bf202b64a9001e1b5a036f3047a4bf65ce2dc6f0fde66c955587ca42985ef479e47ede114e2aa84454745bcadd + languageName: node + linkType: hard + "bail@npm:^1.0.0": version: 1.0.5 resolution: "bail@npm:1.0.5" @@ -9842,6 +10660,22 @@ __metadata: languageName: node linkType: hard +"bcrypt-pbkdf@npm:^1.0.0": + version: 1.0.2 + resolution: "bcrypt-pbkdf@npm:1.0.2" + dependencies: + tweetnacl: "npm:^0.14.3" + checksum: 26dacae8fcd8926b2d477eea173937e4fd1255a665435f8c827a016d3939cbe9c2382946cbedcce37e3bdb069716f26be26c663598449dbeb2fefb64eb478df4 + languageName: node + linkType: hard + +"before-after-hook@npm:^2.2.0": + version: 2.2.3 + resolution: "before-after-hook@npm:2.2.3" + checksum: b4606e993ca0d5a613c341098414b6641f7404b4e5eea10b34ffd38b2b33307700758df3578a3fdd6bd56843dcf966dd3b65e94793982414b6f51f1ba571b15d + languageName: node + linkType: hard + "better-opn@npm:^2.1.1": version: 2.1.1 resolution: "better-opn@npm:2.1.1" @@ -9908,7 +10742,14 @@ __metadata: languageName: node linkType: hard -"bluebird@npm:^3.3.5, bluebird@npm:^3.5.5": +"blob-util@npm:^2.0.2": + version: 2.0.2 + resolution: "blob-util@npm:2.0.2" + checksum: 9e67f55a729ba26b7a472c084f7706d0d0eb88c67274cc855854ea2ea6da37c9a190ffb2ae41f154ba5ae14276f3f3ce1a30ef3cf2dd89fb775e2d93da815a36 + languageName: node + linkType: hard + +"bluebird@npm:3.7.2, bluebird@npm:^3.3.5, bluebird@npm:^3.5.5, bluebird@npm:^3.7.2": version: 3.7.2 resolution: "bluebird@npm:3.7.2" checksum: 42df9603102ffbb71c0bc66056a66dce510ba136ab746fb2f783daa71843f14b6f22c2897cb224b556cc5546b9a524c224f6b1505e074310273a5ee5b222e072 @@ -9956,7 +10797,7 @@ __metadata: languageName: node linkType: hard -"boxen@npm:^5.1.2": +"boxen@npm:^5.0.0, boxen@npm:^5.1.2": version: 5.1.2 resolution: "boxen@npm:5.1.2" dependencies: @@ -10171,6 +11012,13 @@ __metadata: languageName: node linkType: hard +"buffer-crc32@npm:~0.2.3": + version: 0.2.13 + resolution: "buffer-crc32@npm:0.2.13" + checksum: 73cebf807d2cb038816676b12900f9c58ca29a4ab4c9ceedd40c0ced55c8da1f74d2b5ee526d5c2a1c17af72129350a2b6c427b420548dc779b3c88edf6829b6 + languageName: node + linkType: hard + "buffer-from@npm:^1.0.0": version: 1.1.2 resolution: "buffer-from@npm:1.1.2" @@ -10203,7 +11051,7 @@ __metadata: languageName: node linkType: hard -"buffer@npm:^5.5.0": +"buffer@npm:^5.5.0, buffer@npm:^5.6.0": version: 5.7.1 resolution: "buffer@npm:5.7.1" dependencies: @@ -10370,6 +11218,21 @@ __metadata: languageName: node linkType: hard +"cacheable-request@npm:^6.0.0": + version: 6.1.0 + resolution: "cacheable-request@npm:6.1.0" + dependencies: + clone-response: "npm:^1.0.2" + get-stream: "npm:^5.1.0" + http-cache-semantics: "npm:^4.0.0" + keyv: "npm:^3.0.0" + lowercase-keys: "npm:^2.0.0" + normalize-url: "npm:^4.1.0" + responselike: "npm:^1.0.2" + checksum: 777106606da8b47e511b8728016cdbe6bc5b701e95ddafa9d7544862ffc1009161a48b7c9384d08b12197771ede2e3e7b28f9423733f402fe249ac629b7be766 + languageName: node + linkType: hard + "cacheable-request@npm:^7.0.2": version: 7.0.2 resolution: "cacheable-request@npm:7.0.2" @@ -10385,6 +11248,13 @@ __metadata: languageName: node linkType: hard +"cachedir@npm:^2.3.0": + version: 2.3.0 + resolution: "cachedir@npm:2.3.0" + checksum: 67b65cb94eebf511ef5533c800504145b6d46baad192d98a1574e77c0d459687cc89a69196207fef8021d25f7ecc8921ced70e5d5184071d11964dcddd8244f4 + languageName: node + linkType: hard + "call-bind@npm:^1.0.0, call-bind@npm:^1.0.2": version: 1.0.2 resolution: "call-bind@npm:1.0.2" @@ -10402,6 +11272,31 @@ __metadata: languageName: node linkType: hard +"caller-callsite@npm:^2.0.0": + version: 2.0.0 + resolution: "caller-callsite@npm:2.0.0" + dependencies: + callsites: "npm:^2.0.0" + checksum: 8a57376aede96599ad5b576f368af64bdf5da8c520df14df73acf541ea144b66943550a7c7926efb3a4a9f04c966191f6d974007e6311e2bddbaa656665ae6b1 + languageName: node + linkType: hard + +"caller-path@npm:^2.0.0": + version: 2.0.0 + resolution: "caller-path@npm:2.0.0" + dependencies: + caller-callsite: "npm:^2.0.0" + checksum: ba072ed2c8c2329c6cf48c13690c4d23622a4b5c2bc10fcb69acdc7b3b8bf6370d4a0e409270bd2a7ffa44c9c85d6a3e84380fdfff28f35be6f8850d075b9648 + languageName: node + linkType: hard + +"callsites@npm:^2.0.0": + version: 2.0.0 + resolution: "callsites@npm:2.0.0" + checksum: 2aa006b4ff8a522759f8e57349e6137138bf8a5a76f0f5c2497e539be125fda5ed2a6fe80c81fedd3e372c8c78804467c2c2d48a0e9c7f190a4e936bfcf5cd7a + languageName: node + linkType: hard + "callsites@npm:^3.0.0": version: 3.1.0 resolution: "callsites@npm:3.1.0" @@ -10447,7 +11342,19 @@ __metadata: languageName: node linkType: hard -"camelcase@npm:6.3.0, camelcase@npm:^6.2.0": +"camelcase-keys@npm:^7.0.0": + version: 7.0.2 + resolution: "camelcase-keys@npm:7.0.2" + dependencies: + camelcase: "npm:^6.3.0" + map-obj: "npm:^4.1.0" + quick-lru: "npm:^5.1.1" + type-fest: "npm:^1.2.1" + checksum: 45c7333f80e8f6ea61ead921a31fa4c754f96caee373bdc27e12221f904a681d86cfe2de28d4a951b6a9764e90df57116393c5d43cecbe73a3af26a5b529bae6 + languageName: node + linkType: hard + +"camelcase@npm:6.3.0, camelcase@npm:^6.2.0, camelcase@npm:^6.3.0": version: 6.3.0 resolution: "camelcase@npm:6.3.0" checksum: 3c802157fc61af58194ed056d1830444ec1268a556bb90c7a3a729db481a897cbfdf86fb9db91b45b5e3b891183024e13bf26c866e8e5a37853ace6fa01b7be1 @@ -10632,6 +11539,18 @@ __metadata: languageName: node linkType: hard +"changelog-parser@npm:^2.0.0": + version: 2.8.1 + resolution: "changelog-parser@npm:2.8.1" + dependencies: + line-reader: "npm:^0.2.4" + remove-markdown: "npm:^0.2.2" + bin: + changelog-parser: bin/cli.js + checksum: a6e7b0fbf9353ca5e80d874abd4854f416dd9c5b0efc731aa7972716629d714c1d7a9e4e998eab67225dfa3252da47304db38fa423b48268d29c1ca2ab6cf39d + languageName: node + linkType: hard + "char-regex@npm:^1.0.2": version: 1.0.2 resolution: "char-regex@npm:1.0.2" @@ -10695,6 +11614,13 @@ __metadata: languageName: node linkType: hard +"charenc@npm:0.0.2": + version: 0.0.2 + resolution: "charenc@npm:0.0.2" + checksum: f823489c8dee45b979f011c2f90b433b5497249fccd6dcda57e7b892ba07ea7772ebd5f65b595596c16a8b1aa5c01bbc194f10c7c14593211adadc7f0d999f9d + languageName: node + linkType: hard + "check-error@npm:^1.0.2": version: 1.0.2 resolution: "check-error@npm:1.0.2" @@ -10702,7 +11628,14 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:>=3.0.0 <4.0.0, chokidar@npm:^3.3.1, chokidar@npm:^3.4.1, chokidar@npm:^3.4.2, chokidar@npm:^3.5.1, chokidar@npm:^3.5.3": +"check-more-types@npm:2.24.0, check-more-types@npm:^2.24.0": + version: 2.24.0 + resolution: "check-more-types@npm:2.24.0" + checksum: b515101f9bb608b740617001aa40c072522458657b567e7deeb387a96de11537d2d6460850b260b78af854d6ca4633f23cebf29952a9a286d1ec00bac939e6a6 + languageName: node + linkType: hard + +"chokidar@npm:>=3.0.0 <4.0.0, chokidar@npm:^3.3.1, chokidar@npm:^3.4.0, chokidar@npm:^3.4.1, chokidar@npm:^3.4.2, chokidar@npm:^3.5.1, chokidar@npm:^3.5.3": version: 3.5.3 resolution: "chokidar@npm:3.5.3" dependencies: @@ -10840,6 +11773,15 @@ __metadata: languageName: node linkType: hard +"clean-stack@npm:^4.0.0": + version: 4.2.0 + resolution: "clean-stack@npm:4.2.0" + dependencies: + escape-string-regexp: "npm:5.0.0" + checksum: 5753ba03151b57a01faeff9191beb94d443bfe532bbea51d60838dbf33100ca260e776f6de0b2183fe4fb931d5102dd23fdcbd4431ddfa8e3bfca7ed005104cd + languageName: node + linkType: hard + "cli-boxes@npm:^2.2.1": version: 2.2.1 resolution: "cli-boxes@npm:2.2.1" @@ -10856,23 +11798,23 @@ __metadata: languageName: node linkType: hard -"cli-spinners@npm:^2.5.0": - version: 2.6.1 - resolution: "cli-spinners@npm:2.6.1" - checksum: 025d2b3b0f89a00b45325389df290c96a9830f14c665d75b71b14a54e871968713db47e891629f3fdc53165dcdafcb7041dcc150ae289f83b9b9a4eeae45d33b +"cli-spinners@npm:^2.2.0, cli-spinners@npm:^2.5.0": + version: 2.7.0 + resolution: "cli-spinners@npm:2.7.0" + checksum: 46b7cce5a56a9c2d062d84947c552f517e1d23eb88afc9f1835851e905f9324bd2f21eebb24a99a3143f508581dcbe372e7528d9adf019f73e01a4bcbee178df languageName: node linkType: hard -"cli-table3@npm:^0.6.1": - version: 0.6.1 - resolution: "cli-table3@npm:0.6.1" +"cli-table3@npm:^0.6.1, cli-table3@npm:~0.6.1": + version: 0.6.3 + resolution: "cli-table3@npm:0.6.3" dependencies: - colors: "npm:1.4.0" + "@colors/colors": "npm:1.5.0" string-width: "npm:^4.2.0" dependenciesMeta: - colors: + "@colors/colors": optional: true - checksum: 1cbc939cb9c788973dd3582c4038de4d0e748981df893f634c263903a2912bac7ee94042f812ec645b867f59d680c8a6701ae84a3a7388d21b96eb943d6b7eeb + checksum: 82fe6f515833019cdb7064c7276a546c5e3fe6bae6a1db4bf4b41e4bdcf9b119b086630f991461ac8556d82330ae5284fc4942a740118be6c8bbfcc69c118d0a languageName: node linkType: hard @@ -11071,7 +12013,7 @@ __metadata: languageName: node linkType: hard -"color-support@npm:^1.1.2": +"color-support@npm:^1.1.2, color-support@npm:^1.1.3": version: 1.1.3 resolution: "color-support@npm:1.1.3" bin: @@ -11121,13 +12063,6 @@ __metadata: languageName: node linkType: hard -"colors@npm:1.4.0": - version: 1.4.0 - resolution: "colors@npm:1.4.0" - checksum: 9a9d21c0cc711299113539f29eebd4daf42a21f12b4bfad56cf76e85e806604f6c4f26ad74dce9c7968be68c7f987bbea58c9f23a99cf55186f524860997c66a - languageName: node - linkType: hard - "colorspace@npm:1.1.x": version: 1.1.4 resolution: "colorspace@npm:1.1.4" @@ -11138,7 +12073,7 @@ __metadata: languageName: node linkType: hard -"combined-stream@npm:^1.0.6, combined-stream@npm:^1.0.8": +"combined-stream@npm:^1.0.6, combined-stream@npm:^1.0.8, combined-stream@npm:~1.0.6": version: 1.0.8 resolution: "combined-stream@npm:1.0.8" dependencies: @@ -11168,13 +12103,20 @@ __metadata: languageName: node linkType: hard -"commander@npm:^4.0.0, commander@npm:^4.1.1": +"commander@npm:^4.0.0, commander@npm:^4.0.1, commander@npm:^4.1.1": version: 4.1.1 resolution: "commander@npm:4.1.1" checksum: 3be44d4e8e108ce5056885db1ee90cf34afe5b1c965829c23b3a47890d27980e101889fe7355accd6ec22cad862abc9f609da6de0c4c061e19d04d098611baf4 languageName: node linkType: hard +"commander@npm:^5.1.0": + version: 5.1.0 + resolution: "commander@npm:5.1.0" + checksum: 121debda8eeb53f3282c6a1d7995027a88ad4c22f9bd31b27a1350d483fc90dabd6dbf613782921b646e68a20ab45ed82adc3b594dbd42b60345e08059f338e4 + languageName: node + linkType: hard + "commander@npm:^6.2.0, commander@npm:^6.2.1": version: 6.2.1 resolution: "commander@npm:6.2.1" @@ -11217,7 +12159,7 @@ __metadata: languageName: node linkType: hard -"common-tags@npm:1.8.2": +"common-tags@npm:1.8.2, common-tags@npm:^1.8.0": version: 1.8.2 resolution: "common-tags@npm:1.8.2" checksum: e1080df9fd8eefd8c4b4a983dc39b41c251d85a05c15991592762ff0c78b433e9ac7bb02518c12a89d1cb33dbb466872fbbb7030ecfc7142b0810747e7859b3b @@ -11300,6 +12242,20 @@ __metadata: languageName: node linkType: hard +"configstore@npm:^5.0.1": + version: 5.0.1 + resolution: "configstore@npm:5.0.1" + dependencies: + dot-prop: "npm:^5.2.0" + graceful-fs: "npm:^4.1.2" + make-dir: "npm:^3.0.0" + unique-string: "npm:^2.0.0" + write-file-atomic: "npm:^3.0.0" + xdg-basedir: "npm:^4.0.0" + checksum: fe87d7301b1887cd459a70f0cddad5e7c6997c29472e984965f906d20142a4526c26c69c08da931d8d94e35ab5c31d7a774418e073ed242417d65d1df1b14152 + languageName: node + linkType: hard + "console-browserify@npm:^1.1.0": version: 1.2.0 resolution: "console-browserify@npm:1.2.0" @@ -11399,12 +12355,17 @@ __metadata: languageName: node linkType: hard -"convert-source-map@npm:^1.4.0, convert-source-map@npm:^1.5.0, convert-source-map@npm:^1.6.0, convert-source-map@npm:^1.7.0": - version: 1.8.0 - resolution: "convert-source-map@npm:1.8.0" - dependencies: - safe-buffer: "npm:~5.1.1" - checksum: 1548dbc3808672aec5942ada45bf57ceb2287ac2566e9935e35d95ffeab562f33ee1221922ec2ea7f3ff4b85828c8247599144069fae81a86e295cc932190dcf +"convert-source-map@npm:^1.1.0, convert-source-map@npm:^1.4.0, convert-source-map@npm:^1.5.0, convert-source-map@npm:^1.6.0, convert-source-map@npm:^1.7.0": + version: 1.9.0 + resolution: "convert-source-map@npm:1.9.0" + checksum: 7c665ec75a792623eff22413a59fb6646770063eb871efe7550cfba4f17177137ea300f964c2763db69355384398de491126fbe064fa83b25e3023b87711b6e4 + languageName: node + linkType: hard + +"convert-source-map@npm:^2.0.0": + version: 2.0.0 + resolution: "convert-source-map@npm:2.0.0" + checksum: 5a2bc5c8cbb87e36d9c33c541eccc1eb61480d72a1cda03ccaf00346479e788994ccbc80bd00874390a9a38c07b68f195991622f4ad8a5b791a0e90870e25450 languageName: node linkType: hard @@ -11466,12 +12427,12 @@ __metadata: languageName: node linkType: hard -"core-js-compat@npm:^3.25.1, core-js-compat@npm:^3.8.1": - version: 3.25.1 - resolution: "core-js-compat@npm:3.25.1" +"core-js-compat@npm:^3.21.0, core-js-compat@npm:^3.22.1, core-js-compat@npm:^3.25.1, core-js-compat@npm:^3.8.1": + version: 3.26.0 + resolution: "core-js-compat@npm:3.26.0" dependencies: - browserslist: "npm:^4.21.3" - checksum: d2ad039228e87d0244211c12a0bdc212e2679118403168629df34203dbf03a2ebcfe56f44809584a33c888d8fb472f985b72305e344648bb7001ca61a89e450f + browserslist: "npm:^4.21.4" + checksum: 21041043f1f4933354cf7fd1145ee53306033b37c737de94485e0e75e91552d03f010f95b4d3b365d0c19d255bdcb837bc0e3845c66ecc29d3f5c6112e6f066f languageName: node linkType: hard @@ -11489,6 +12450,20 @@ __metadata: languageName: node linkType: hard +"core-js@npm:^2.4.0": + version: 2.6.12 + resolution: "core-js@npm:2.6.12" + checksum: 1cab48644f8b5d4c58c9ce82b045d1c683ba0b8025abd7df1b6a91a4dd24c64ea4194cc769849fedc71c0f56e1645cf6bc36808cbadd53b9a6dcb48c821df811 + languageName: node + linkType: hard + +"core-util-is@npm:1.0.2": + version: 1.0.2 + resolution: "core-util-is@npm:1.0.2" + checksum: f6006dfc860ac490b330431be370c58e9b8601d3affe85a08309665970431e12a672ebf1c57799795e145f4fc488c208b2ee992c42fa57faae2649c6f514845e + languageName: node + linkType: hard + "core-util-is@npm:~1.0.0": version: 1.0.3 resolution: "core-util-is@npm:1.0.3" @@ -11531,6 +12506,18 @@ __metadata: languageName: node linkType: hard +"cosmiconfig@npm:^5.2.1": + version: 5.2.1 + resolution: "cosmiconfig@npm:5.2.1" + dependencies: + import-fresh: "npm:^2.0.0" + is-directory: "npm:^0.3.1" + js-yaml: "npm:^3.13.1" + parse-json: "npm:^4.0.0" + checksum: dd54203352063aef228f9f2ee0dbf60fc4ec3371fac6a8afd21cc76e475f0790ba3638c8e12730d9127c18c4c63643d438dbe6e571ed84861d88962950eefd63 + languageName: node + linkType: hard + "cosmiconfig@npm:^6.0.0": version: 6.0.0 resolution: "cosmiconfig@npm:6.0.0" @@ -11556,6 +12543,30 @@ __metadata: languageName: node linkType: hard +"cp-file@npm:^9.1.0": + version: 9.1.0 + resolution: "cp-file@npm:9.1.0" + dependencies: + graceful-fs: "npm:^4.1.2" + make-dir: "npm:^3.0.0" + nested-error-stacks: "npm:^2.0.0" + p-event: "npm:^4.1.0" + checksum: 13a8a619a79227967d478f7dcd824579654d8f0365993654d2d3e1c325a40d66b6e3dba95189bd7dd8fb39471115d64813e55e335a57d008fe9f88151eaaf734 + languageName: node + linkType: hard + +"cpy-cli@npm:^4.2.0": + version: 4.2.0 + resolution: "cpy-cli@npm:4.2.0" + dependencies: + cpy: "npm:^9.0.0" + meow: "npm:^10.1.2" + bin: + cpy: cli.js + checksum: 8f57f91b7cfcc4c413ff3d9f0e39ff853a390e3b9b7a2bd0f46b41d12d03264f16e1998fe46e89a10d3ed7b4c666cc33ba23771ae3163eae2037c3f5d38f756d + languageName: node + linkType: hard + "cpy@npm:^8.1.2": version: 8.1.2 resolution: "cpy@npm:8.1.2" @@ -11573,6 +12584,22 @@ __metadata: languageName: node linkType: hard +"cpy@npm:^9.0.0": + version: 9.0.1 + resolution: "cpy@npm:9.0.1" + dependencies: + arrify: "npm:^3.0.0" + cp-file: "npm:^9.1.0" + globby: "npm:^13.1.1" + junk: "npm:^4.0.0" + micromatch: "npm:^4.0.4" + nested-error-stacks: "npm:^2.1.0" + p-filter: "npm:^3.0.0" + p-map: "npm:^5.3.0" + checksum: f1bc4887f9b9460ca7fc03b6af7e959025d754dfbaddb37c6838aebcafdebb9841d76c1e384623ef182fe5f76de0bff202ff43974d9fae1e95f3dc5b02ede0fd + languageName: node + linkType: hard + "create-ecdh@npm:^4.0.0": version: 4.0.4 resolution: "create-ecdh@npm:4.0.4" @@ -11673,6 +12700,13 @@ __metadata: languageName: node linkType: hard +"crypt@npm:0.0.2": + version: 0.0.2 + resolution: "crypt@npm:0.0.2" + checksum: 241cef46f6ea8512c79ab35812fcc9ee45cd433b516271c1ff8321cd1f1e4d8cfd1b5b68bc9271cc66c8a948e1808ba6aed25c4d2bdefa3a9142ba88b48703fe + languageName: node + linkType: hard + "crypto-browserify@npm:^3.11.0": version: 3.12.0 resolution: "crypto-browserify@npm:3.12.0" @@ -11692,6 +12726,13 @@ __metadata: languageName: node linkType: hard +"crypto-random-string@npm:^2.0.0": + version: 2.0.0 + resolution: "crypto-random-string@npm:2.0.0" + checksum: 6b95ff35ccdc8f2302c008487acfbc164894621cc70ba537c76c8f55315e04cacb6cae6429e76b8cad393529273429b5852cc9acf1ac2095cadd66205e681f3b + languageName: node + linkType: hard + "css-blank-pseudo@npm:^3.0.3": version: 3.0.3 resolution: "css-blank-pseudo@npm:3.0.3" @@ -12000,6 +13041,58 @@ __metadata: languageName: node linkType: hard +"cypress@npm:*, cypress@npm:^11.0.1": + version: 11.0.1 + resolution: "cypress@npm:11.0.1" + dependencies: + "@cypress/request": "npm:^2.88.10" + "@cypress/xvfb": "npm:^1.2.4" + "@types/node": "npm:^14.14.31" + "@types/sinonjs__fake-timers": "npm:8.1.1" + "@types/sizzle": "npm:^2.3.2" + arch: "npm:^2.2.0" + blob-util: "npm:^2.0.2" + bluebird: "npm:^3.7.2" + buffer: "npm:^5.6.0" + cachedir: "npm:^2.3.0" + chalk: "npm:^4.1.0" + check-more-types: "npm:^2.24.0" + cli-cursor: "npm:^3.1.0" + cli-table3: "npm:~0.6.1" + commander: "npm:^5.1.0" + common-tags: "npm:^1.8.0" + dayjs: "npm:^1.10.4" + debug: "npm:^4.3.2" + enquirer: "npm:^2.3.6" + eventemitter2: "npm:6.4.7" + execa: "npm:4.1.0" + executable: "npm:^4.1.1" + extract-zip: "npm:2.0.1" + figures: "npm:^3.2.0" + fs-extra: "npm:^9.1.0" + getos: "npm:^3.2.1" + is-ci: "npm:^3.0.0" + is-installed-globally: "npm:~0.4.0" + lazy-ass: "npm:^1.6.0" + listr2: "npm:^3.8.3" + lodash: "npm:^4.17.21" + log-symbols: "npm:^4.0.0" + minimist: "npm:^1.2.6" + ospath: "npm:^1.2.2" + pretty-bytes: "npm:^5.6.0" + proxy-from-env: "npm:1.0.0" + request-progress: "npm:^3.0.0" + semver: "npm:^7.3.2" + supports-color: "npm:^8.1.1" + tmp: "npm:~0.2.1" + untildify: "npm:^4.0.0" + yauzl: "npm:^2.10.0" + bin: + cypress: bin/cypress + checksum: be096b964a8b2a6f0409638ee6796778a4eaa47836734f00cd21ad41e11d6f3c9cb2de8d4a80a88a7de4fddb137f5a8fdbb9a149b9ce41e2630821b0d4ea6d98 + languageName: node + linkType: hard + "damerau-levenshtein@npm:^1.0.8": version: 1.0.8 resolution: "damerau-levenshtein@npm:1.0.8" @@ -12014,6 +13107,15 @@ __metadata: languageName: node linkType: hard +"dashdash@npm:^1.12.0": + version: 1.14.1 + resolution: "dashdash@npm:1.14.1" + dependencies: + assert-plus: "npm:^1.0.0" + checksum: 4904e050758457a2c9730e8eb783e1d6ba9c16d115aae263762606479ff94eb5272ed4d3e0e8cadebdb666485af89fcfcc369d32fbc4d78e2cd6088c4be436f4 + languageName: node + linkType: hard + "data-uri-to-buffer@npm:3, data-uri-to-buffer@npm:^3.0.1": version: 3.0.1 resolution: "data-uri-to-buffer@npm:3.0.1" @@ -12046,7 +13148,7 @@ __metadata: languageName: node linkType: hard -"dayjs@npm:1.11.6": +"dayjs@npm:1.11.6, dayjs@npm:^1.10.4": version: 1.11.6 resolution: "dayjs@npm:1.11.6" checksum: f59ea45f2438056f10955a979124738906d897fb642b6157ead34b675240a79a1424655f691a35af810248575506459bf65eadd7d51625cdc537bf805a92dea6 @@ -12063,7 +13165,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:2.6.9, debug@npm:^2.2.0, debug@npm:^2.3.3, debug@npm:^2.6.0, debug@npm:^2.6.9": +"debug@npm:2.6.9, debug@npm:^2.2.0, debug@npm:^2.3.3, debug@npm:^2.6.0, debug@npm:^2.6.8, debug@npm:^2.6.9": version: 2.6.9 resolution: "debug@npm:2.6.9" dependencies: @@ -12084,7 +13186,19 @@ __metadata: languageName: node linkType: hard -"debug@npm:^3.0.0, debug@npm:^3.2.7": +"debug@npm:4.3.2": + version: 4.3.2 + resolution: "debug@npm:4.3.2" + dependencies: + ms: "npm:2.1.2" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 329c3fd97ff1d4b7b8683c2d0d353300903e96747306075e1f5bd28a81be385f3ab6420938ce173bba55b7ed3b3499762295d531ff20c730224c5bd7127b105d + languageName: node + linkType: hard + +"debug@npm:^3.0.0, debug@npm:^3.1.0, debug@npm:^3.2.7": version: 3.2.7 resolution: "debug@npm:3.2.7" dependencies: @@ -12110,10 +13224,17 @@ __metadata: languageName: node linkType: hard +"decamelize@npm:^5.0.0": + version: 5.0.1 + resolution: "decamelize@npm:5.0.1" + checksum: 3ab0a369bdbfa50fb6706c266eb602fc5521c710b3aee658bed52d39c9963ebdad049302d6222ae53a28e25715cc389dc858223243f815d7d25aed4b23cae3bd + languageName: node + linkType: hard + "decimal.js@npm:^10.3.1": - version: 10.3.1 - resolution: "decimal.js@npm:10.3.1" - checksum: fd218c68bb7960bbe4b68f477338726d6d9b6ba347ab0f12974f3b16305f5c4a88c601c9897ce6b0fe6d95cf7573d4aa1eb0c16134faf2375f9ab6f2ca515f6c + version: 10.4.2 + resolution: "decimal.js@npm:10.4.2" + checksum: 24f3c0b3a786c35d33e47afd7ff36e92e0fd3ce02c91dc95fa69a270e89982daa1be594f4d35eaf671b13b61b80f165c4c6091d4338eb2711c613c6c975c6a98 languageName: node linkType: hard @@ -12133,6 +13254,15 @@ __metadata: languageName: node linkType: hard +"decompress-response@npm:^3.3.0": + version: 3.3.0 + resolution: "decompress-response@npm:3.3.0" + dependencies: + mimic-response: "npm:^1.0.0" + checksum: 6b6423eebde6911f2bcd1898df0c5b240efe820ebb08cd5e38b27f6962e496cea54d22c984efdcfb98f5b15dc1cdc141c1774e4ed6ea4e0cc1741a7de30a59cb + languageName: node + linkType: hard + "decompress-response@npm:^6.0.0": version: 6.0.0 resolution: "decompress-response@npm:6.0.0" @@ -12201,6 +13331,13 @@ __metadata: languageName: node linkType: hard +"defer-to-connect@npm:^1.0.1": + version: 1.1.3 + resolution: "defer-to-connect@npm:1.1.3" + checksum: 067d9624b545422565c43588a756223bc2d53e909f29e28c0ed39d47ef4ce65f774f6386e968c8a4ca05a7c851e676c863320d9956ece71b1e6bc5359ffb1b49 + languageName: node + linkType: hard + "defer-to-connect@npm:^2.0.0": version: 2.0.1 resolution: "defer-to-connect@npm:2.0.1" @@ -12314,6 +13451,13 @@ __metadata: languageName: node linkType: hard +"deprecation@npm:^2.0.0, deprecation@npm:^2.3.1": + version: 2.3.1 + resolution: "deprecation@npm:2.3.1" + checksum: 4bea60628946a5525bfc9c550e9e2ce34e389128938618f0929b6bed856032a70f82e03231044ce14f7f974d65dddb31bbf0252dd70878d13fe7d83969bcc326 + languageName: node + linkType: hard + "dequal@npm:^2.0.0, dequal@npm:^2.0.3": version: 2.0.3 resolution: "dequal@npm:2.0.3" @@ -12403,17 +13547,17 @@ __metadata: languageName: node linkType: hard -"didyoumean@npm:^1.2.2": +"didyoumean@npm:^1.2.1, didyoumean@npm:^1.2.2": version: 1.2.2 resolution: "didyoumean@npm:1.2.2" checksum: 1cc8f194ff6a14341d6e20257a1219126d8f5a14f8d54fbb58ec7ecedceccb5b1769d863ea0da83b8a86b01ab08ba67b7d90fbb9cdc6e8c4a6794de1d31135fe languageName: node linkType: hard -"diff-sequences@npm:^29.2.0": - version: 29.2.0 - resolution: "diff-sequences@npm:29.2.0" - checksum: 922c9efe2082ad79579efc871722db90a4ea02028ffc3e5eae468eece470672e9a0e43f6c056a4c2bde1d9a7c168a017606eb1484f12d8f1d94e9284c58634c6 +"diff-sequences@npm:^29.3.1": + version: 29.3.1 + resolution: "diff-sequences@npm:29.3.1" + checksum: af271add33f37490d21932cc11e8a72f7c05fba4187c8108bc8420c4091a0483fbe1f8e31c8c3bad8c069516f57cc73639bf89e67fe8874016de4cf0106f8d28 languageName: node linkType: hard @@ -12592,7 +13736,7 @@ __metadata: languageName: node linkType: hard -"dot-prop@npm:^5.1.0": +"dot-prop@npm:^5.1.0, dot-prop@npm:^5.2.0": version: 5.3.0 resolution: "dot-prop@npm:5.3.0" dependencies: @@ -12660,6 +13804,13 @@ __metadata: languageName: node linkType: hard +"duplexer3@npm:^0.1.4": + version: 0.1.5 + resolution: "duplexer3@npm:0.1.5" + checksum: 4c8777b01eecfd898893613b0a16cf3debda10ce12420c4d3172dbfe554b68cf2a4c74eaa46609de823c0087f29458b70a7f3134006a9c73368c57d51967e013 + languageName: node + linkType: hard + "duplexer@npm:0.1.1": version: 0.1.1 resolution: "duplexer@npm:0.1.1" @@ -12667,7 +13818,7 @@ __metadata: languageName: node linkType: hard -"duplexer@npm:^0.1.1, duplexer@npm:^0.1.2": +"duplexer@npm:^0.1.1, duplexer@npm:^0.1.2, duplexer@npm:~0.1.1": version: 0.1.2 resolution: "duplexer@npm:0.1.2" checksum: 6624204ad40403546166a072d0e0ec34df52f8bc48e68bd52894ddca3acd9ad99e3adb14a029e8702c290024b24c2171553b9fbdb0a9503697a2240f3b093cb3 @@ -12686,6 +13837,28 @@ __metadata: languageName: node linkType: hard +"duplexify@npm:^4.1.1": + version: 4.1.2 + resolution: "duplexify@npm:4.1.2" + dependencies: + end-of-stream: "npm:^1.4.1" + inherits: "npm:^2.0.3" + readable-stream: "npm:^3.1.1" + stream-shift: "npm:^1.0.0" + checksum: a06fa1a41c0034524b37437c83598bd7261187298369202928f24f66ff46b6ba0e134e475488c019a8d37e04332b22fd3708c6ea852d2a57ea0ebd488c880712 + languageName: node + linkType: hard + +"ecc-jsbn@npm:~0.1.1": + version: 0.1.2 + resolution: "ecc-jsbn@npm:0.1.2" + dependencies: + jsbn: "npm:~0.1.0" + safer-buffer: "npm:^2.1.0" + checksum: cef3f6f2462c6c5d03dc1ebe1532afee95655c3bb1aa89c89462588355f0168afa6e7c63b0d2e3989493c1e4090fae33b7f4d1b57d76fdcea226f3555b15fbcd + languageName: node + linkType: hard + "edge-runtime@npm:2.0.0": version: 2.0.0 resolution: "edge-runtime@npm:2.0.0" @@ -12837,7 +14010,7 @@ __metadata: languageName: node linkType: hard -"enquirer@npm:^2.3.0": +"enquirer@npm:^2.3.0, enquirer@npm:^2.3.6": version: 2.3.6 resolution: "enquirer@npm:2.3.6" dependencies: @@ -12941,7 +14114,7 @@ __metadata: languageName: node linkType: hard -"es-check@npm:7.0.1": +"es-check@npm:7.0.1, es-check@npm:^7.0.1": version: 7.0.1 resolution: "es-check@npm:7.0.1" dependencies: @@ -13666,6 +14839,13 @@ __metadata: languageName: node linkType: hard +"escape-goat@npm:^2.0.0": + version: 2.1.1 + resolution: "escape-goat@npm:2.1.1" + checksum: f548398b3057f82846fb3e249188052d9d47149afc019b0bf32be91207df8fd00a37c43208e4b14677dc2dd534b9b99ee5b495e73ad725e64bceb70b3ed1f80e + languageName: node + linkType: hard + "escape-html@npm:~1.0.3": version: 1.0.3 resolution: "escape-html@npm:1.0.3" @@ -13673,6 +14853,13 @@ __metadata: languageName: node linkType: hard +"escape-string-regexp@npm:5.0.0": + version: 5.0.0 + resolution: "escape-string-regexp@npm:5.0.0" + checksum: 9c968d6e975030ef1349f1f011348de4b1fe5e13d5e0c407d38ab141d5e8a8b163ba727a9df22f3e796211aa340b73080455d3a1784af90409e2b8afaed02f76 + languageName: node + linkType: hard + "escape-string-regexp@npm:^1.0.2, escape-string-regexp@npm:^1.0.5": version: 1.0.5 resolution: "escape-string-regexp@npm:1.0.5" @@ -13820,6 +15007,17 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-cypress@npm:^2.12.1": + version: 2.12.1 + resolution: "eslint-plugin-cypress@npm:2.12.1" + dependencies: + globals: "npm:^11.12.0" + peerDependencies: + eslint: ">= 3.2.1" + checksum: 4499344be0d7ef3d0331549c3df32cded60cfd4dc920430e7d82f130058b865de60fc9decd702143708f5b4f969dd1576ec22d67745b0c29e6774cb73aeeaa7f + languageName: node + linkType: hard + "eslint-plugin-es@npm:^3.0.0": version: 3.0.1 resolution: "eslint-plugin-es@npm:3.0.1" @@ -13963,6 +15161,15 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-prefer-arrow@npm:^1.2.3": + version: 1.2.3 + resolution: "eslint-plugin-prefer-arrow@npm:1.2.3" + peerDependencies: + eslint: ">=2.0.0" + checksum: 9325563e4ef7d96e61803257e8b4c5270c47e4f3fbb86a4ea080bf3b875054490c0c45fe52326311078cbcaae839158fd1b9070950e6b6d26225c13a5f385e94 + languageName: node + linkType: hard + "eslint-plugin-prettier@npm:^4.2.1": version: 4.2.1 resolution: "eslint-plugin-prettier@npm:4.2.1" @@ -13987,7 +15194,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-react@npm:^7.31.10, eslint-plugin-react@npm:^7.31.7, eslint-plugin-react@npm:^7.31.8": +"eslint-plugin-react@npm:^7.30.1, eslint-plugin-react@npm:^7.31.10, eslint-plugin-react@npm:^7.31.7, eslint-plugin-react@npm:^7.31.8": version: 7.31.10 resolution: "eslint-plugin-react@npm:7.31.10" dependencies: @@ -14074,6 +15281,21 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-typescript-sort-keys@npm:^2.1.0": + version: 2.1.0 + resolution: "eslint-plugin-typescript-sort-keys@npm:2.1.0" + dependencies: + "@typescript-eslint/experimental-utils": "npm:^5.0.0" + json-schema: "npm:^0.4.0" + natural-compare-lite: "npm:^1.4.0" + peerDependencies: + "@typescript-eslint/parser": ^1 || ^2 || ^3 || ^4 || ^5 + eslint: ^5 || ^6 || ^7 || ^8 + typescript: ^3 || ^4 + checksum: da7dfe320768418ac78d09a4c1f760d0c8a213293ddd735b57d4ad6188a2ae4fd032225c00329b87a56e5086a969aacbd2a1e1a97c8f33815e8a30dc69bfbb27 + languageName: node + linkType: hard + "eslint-scope@npm:5.1.1, eslint-scope@npm:^5.1.1": version: 5.1.1 resolution: "eslint-scope@npm:5.1.1" @@ -14145,7 +15367,7 @@ __metadata: languageName: node linkType: hard -"eslint@npm:8.27.0": +"eslint@npm:8.27.0, eslint@npm:^8.22.0": version: 8.27.0 resolution: "eslint@npm:8.27.0" dependencies: @@ -14353,6 +15575,21 @@ __metadata: languageName: node linkType: hard +"event-stream@npm:=3.3.4": + version: 3.3.4 + resolution: "event-stream@npm:3.3.4" + dependencies: + duplexer: "npm:~0.1.1" + from: "npm:~0" + map-stream: "npm:~0.1.0" + pause-stream: "npm:0.0.11" + split: "npm:0.3" + stream-combiner: "npm:~0.0.4" + through: "npm:~2.3.1" + checksum: 86335e11bb279e0576f83b8032d16fb71c844eec21d238e46fae7f5df9c3895191922fb958daa64e5d16d9fa30ca44668bf3ff47003e092f25e3770cab08b2a4 + languageName: node + linkType: hard + "event-target-polyfill@npm:^0.0.3": version: 0.0.3 resolution: "event-target-polyfill@npm:0.0.3" @@ -14367,6 +15604,13 @@ __metadata: languageName: node linkType: hard +"eventemitter2@npm:6.4.7": + version: 6.4.7 + resolution: "eventemitter2@npm:6.4.7" + checksum: 7789fb06f51d0ffd22fef2623451a449eaf38df32c61269024d4a50e42d8878e4e0c5ae1b8d60dd0f0e3cf4d97bfeb3795ce0fa773810610c40745b6eb6fe3c3 + languageName: node + linkType: hard + "eventemitter3@npm:^4.0.4": version: 4.0.7 resolution: "eventemitter3@npm:4.0.7" @@ -14392,10 +15636,44 @@ __metadata: languageName: node linkType: hard -"exec-sh@npm:^0.3.2": - version: 0.3.6 - resolution: "exec-sh@npm:0.3.6" - checksum: 1ba3b4b01bf3522fba2bbd02e2d81d39cf043618151c5f80977a59cae9d4abf7e848c9a2c1d3d4c94850d075967a6bf62b17fd26c561440cd1fab5c9db7bacc9 +"exec-sh@npm:^0.3.2": + version: 0.3.6 + resolution: "exec-sh@npm:0.3.6" + checksum: 1ba3b4b01bf3522fba2bbd02e2d81d39cf043618151c5f80977a59cae9d4abf7e848c9a2c1d3d4c94850d075967a6bf62b17fd26c561440cd1fab5c9db7bacc9 + languageName: node + linkType: hard + +"execa@npm:4.1.0": + version: 4.1.0 + resolution: "execa@npm:4.1.0" + dependencies: + cross-spawn: "npm:^7.0.0" + get-stream: "npm:^5.0.0" + human-signals: "npm:^1.1.1" + is-stream: "npm:^2.0.0" + merge-stream: "npm:^2.0.0" + npm-run-path: "npm:^4.0.0" + onetime: "npm:^5.1.0" + signal-exit: "npm:^3.0.2" + strip-final-newline: "npm:^2.0.0" + checksum: 9d52ae7dfbbf418440ec07b7d7fd294b61d2818c1cbf204c7f25213dcd603c032408e6a4d03fe94baf238a31dd9bf0cbcdc30a541273c2f4f584190c8deb6a95 + languageName: node + linkType: hard + +"execa@npm:5.1.1, execa@npm:^5.0.0, execa@npm:^5.1.1": + version: 5.1.1 + resolution: "execa@npm:5.1.1" + dependencies: + cross-spawn: "npm:^7.0.3" + get-stream: "npm:^6.0.0" + human-signals: "npm:^2.1.0" + is-stream: "npm:^2.0.0" + merge-stream: "npm:^2.0.0" + npm-run-path: "npm:^4.0.1" + onetime: "npm:^5.1.2" + signal-exit: "npm:^3.0.3" + strip-final-newline: "npm:^2.0.0" + checksum: 62053808e15136a18481d24d14f33a8fbf191b15120d5a6f390bedfded1d1980735c92ba49194d03ad818d18bf7aded5f64f4de4129eb180743e7ec563d21d45 languageName: node linkType: hard @@ -14431,20 +15709,12 @@ __metadata: languageName: node linkType: hard -"execa@npm:^5.0.0, execa@npm:^5.1.1": - version: 5.1.1 - resolution: "execa@npm:5.1.1" +"executable@npm:^4.1.1": + version: 4.1.1 + resolution: "executable@npm:4.1.1" dependencies: - cross-spawn: "npm:^7.0.3" - get-stream: "npm:^6.0.0" - human-signals: "npm:^2.1.0" - is-stream: "npm:^2.0.0" - merge-stream: "npm:^2.0.0" - npm-run-path: "npm:^4.0.1" - onetime: "npm:^5.1.2" - signal-exit: "npm:^3.0.3" - strip-final-newline: "npm:^2.0.0" - checksum: 62053808e15136a18481d24d14f33a8fbf191b15120d5a6f390bedfded1d1980735c92ba49194d03ad818d18bf7aded5f64f4de4129eb180743e7ec563d21d45 + pify: "npm:^2.2.0" + checksum: 129ac01296a4dfb2a937f36473424205e241e2019bc4c6b38061bbf0041c4052eaa37c3935b3244bdf0f1db896a6ae324f0a3c70915257cf31fe5d2550831649 languageName: node linkType: hard @@ -14484,16 +15754,16 @@ __metadata: languageName: node linkType: hard -"expect@npm:^29.0.0, expect@npm:^29.2.2": - version: 29.2.2 - resolution: "expect@npm:29.2.2" +"expect@npm:^29.0.0, expect@npm:^29.3.1": + version: 29.3.1 + resolution: "expect@npm:29.3.1" dependencies: - "@jest/expect-utils": "npm:^29.2.2" + "@jest/expect-utils": "npm:^29.3.1" jest-get-type: "npm:^29.2.0" - jest-matcher-utils: "npm:^29.2.2" - jest-message-util: "npm:^29.2.1" - jest-util: "npm:^29.2.1" - checksum: c5a6df37de6c0776e8cfffb190ac3652faa6814e2c8b0731b7937ab85131be49d233e2700436c5bf22307b6f1edb68f82a54f0b79c498afeb782e88456b631c3 + jest-matcher-utils: "npm:^29.3.1" + jest-message-util: "npm:^29.3.1" + jest-util: "npm:^29.3.1" + checksum: bef5c2d537caf674da7a52d4b209949949ddeef8f6c8329ff115b60f6d4ee435515baa0abf13c16a98d8acf2b0898c28c1da092895d6239b2c9ffc1cb2e1bc4d languageName: node linkType: hard @@ -14555,7 +15825,7 @@ __metadata: languageName: node linkType: hard -"extend@npm:^3.0.0": +"extend@npm:^3.0.0, extend@npm:~3.0.2": version: 3.0.2 resolution: "extend@npm:3.0.2" checksum: 312babdc3cfd8d5d003b109f02b8b639e8bdf2262f2f06acebfc3c991d8c004b73c2c10eaaaab00cfb2fb2a760845006806af10945b279d9390eed064505dfdb @@ -14603,6 +15873,37 @@ __metadata: languageName: node linkType: hard +"extract-zip@npm:2.0.1": + version: 2.0.1 + resolution: "extract-zip@npm:2.0.1" + dependencies: + "@types/yauzl": "npm:^2.9.1" + debug: "npm:^4.1.1" + get-stream: "npm:^5.1.0" + yauzl: "npm:^2.10.0" + dependenciesMeta: + "@types/yauzl": + optional: true + bin: + extract-zip: cli.js + checksum: f8ceb6a7ceb8479e53fb5bad515f03cabe946d753f0f9dbfdd1fd9688d43dcb554082e168003e8ba1ccd2417d2c00209ec48ae05a926e7e69ac0974c929e3e87 + languageName: node + linkType: hard + +"extsprintf@npm:1.3.0": + version: 1.3.0 + resolution: "extsprintf@npm:1.3.0" + checksum: afdc88aaa7ad260bd3a4aeabc087aa03de8eaf6346a59685a97943549d8ca54c312b2353e8a4fbe234e59eb202b5b45274a6d959f1309b750bf2a15852ca7485 + languageName: node + linkType: hard + +"extsprintf@npm:^1.2.0": + version: 1.4.1 + resolution: "extsprintf@npm:1.4.1" + checksum: 376d6b312a7196c0f4547afd2e9741c40bd173f8b507155366e8b94dd8f4efe61be424c65e95ad71e0525acb26bc16c39414c147b449649c39d46ba6e356fa83 + languageName: node + linkType: hard + "fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": version: 3.1.3 resolution: "fast-deep-equal@npm:3.1.3" @@ -14743,6 +16044,15 @@ __metadata: languageName: node linkType: hard +"fd-slicer@npm:~1.1.0": + version: 1.1.0 + resolution: "fd-slicer@npm:1.1.0" + dependencies: + pend: "npm:~1.2.0" + checksum: 5a21150eebc8a6fd2c9ef0627295b278710f5f837d183652727c913474baf4032971d0259098cb0696c3e62feacafa4d107f5ebd8db5a310dc1945e4bf25a157 + languageName: node + linkType: hard + "fecha@npm:^4.2.0": version: 4.2.1 resolution: "fecha@npm:4.2.1" @@ -14774,7 +16084,7 @@ __metadata: languageName: node linkType: hard -"figures@npm:^3.0.0": +"figures@npm:^3.0.0, figures@npm:^3.2.0": version: 3.2.0 resolution: "figures@npm:3.2.0" dependencies: @@ -15009,7 +16319,7 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.0": +"follow-redirects@npm:^1.14.0, follow-redirects@npm:^1.15.0": version: 1.15.2 resolution: "follow-redirects@npm:1.15.2" peerDependenciesMeta: @@ -15043,6 +16353,13 @@ __metadata: languageName: node linkType: hard +"forever-agent@npm:~0.6.1": + version: 0.6.1 + resolution: "forever-agent@npm:0.6.1" + checksum: b426cf45f0bdea79970a4320cb550b84d0bcd0530d544e0424456f44272a19641a000ea921f8e58dba5511b71f94d95c80692e3d13ce5f0b766f18426430efd5 + languageName: node + linkType: hard + "fork-ts-checker-webpack-plugin@npm:^4.1.6": version: 4.1.6 resolution: "fork-ts-checker-webpack-plugin@npm:4.1.6" @@ -15129,6 +16446,17 @@ __metadata: languageName: node linkType: hard +"form-data@npm:~2.3.2": + version: 2.3.3 + resolution: "form-data@npm:2.3.3" + dependencies: + asynckit: "npm:^0.4.0" + combined-stream: "npm:^1.0.6" + mime-types: "npm:^2.1.12" + checksum: 0f88d2d298ac7751fbef88eb1148e709727560bbe6ed17ca1fd10745b8b572cdab7d51d934b97ccdc411add4e39afdb414bc400580a348de2d39a49401f3f5ec + languageName: node + linkType: hard + "format@npm:^0.2.0": version: 0.2.2 resolution: "format@npm:0.2.2" @@ -15186,6 +16514,13 @@ __metadata: languageName: node linkType: hard +"from@npm:~0": + version: 0.1.7 + resolution: "from@npm:0.1.7" + checksum: 66723f45c29cf0abd0462c534bfbc389ce088c2f12aa93cc3f802fa36ec92e7790f23d844e800cc3a4aae862787d63fd43c350c31503c8845f932b7c218f12b5 + languageName: node + linkType: hard + "fs-constants@npm:^1.0.0": version: 1.0.0 resolution: "fs-constants@npm:1.0.0" @@ -15239,7 +16574,7 @@ __metadata: languageName: node linkType: hard -"fs-extra@npm:^9.0.0, fs-extra@npm:^9.0.1": +"fs-extra@npm:^9.0.0, fs-extra@npm:^9.0.1, fs-extra@npm:^9.1.0": version: 9.1.0 resolution: "fs-extra@npm:9.1.0" dependencies: @@ -15267,6 +16602,13 @@ __metadata: languageName: node linkType: hard +"fs-readdir-recursive@npm:^1.1.0": + version: 1.1.0 + resolution: "fs-readdir-recursive@npm:1.1.0" + checksum: 23f47d49b3fb245bc0dcb1d313ae6955a8ee688572de4162c9a4d4b9f795007b153ff33926730e2063eb2492fc1e27825d4ce6bdbce89cb3a56a517f18408606 + languageName: node + linkType: hard + "fs-write-stream-atomic@npm:^1.0.8": version: 1.0.10 resolution: "fs-write-stream-atomic@npm:1.0.10" @@ -15379,6 +16721,22 @@ __metadata: languageName: node linkType: hard +"gauge@npm:^v4.0.4": + version: 4.0.4 + resolution: "gauge@npm:4.0.4" + dependencies: + aproba: "npm:^1.0.3 || ^2.0.0" + color-support: "npm:^1.1.3" + console-control-strings: "npm:^1.1.0" + has-unicode: "npm:^2.0.1" + signal-exit: "npm:^3.0.7" + string-width: "npm:^4.2.3" + strip-ansi: "npm:^6.0.1" + wide-align: "npm:^1.1.5" + checksum: 4fc68f770dba9962a326918f33f58f2458eddea08442c2d716238357e4291dee4223a812ce11084b54f928d607e4dfb6f380ba28d435b2721de94a22d5600669 + languageName: node + linkType: hard + "gauge@npm:~2.7.3": version: 2.7.4 resolution: "gauge@npm:2.7.4" @@ -15464,7 +16822,14 @@ __metadata: languageName: node linkType: hard -"get-stream@npm:^4.0.0": +"get-stdin@npm:^7.0.0": + version: 7.0.0 + resolution: "get-stdin@npm:7.0.0" + checksum: e7cd3dc6f3c0fc66e3584b8b0d942a9f22dff012e82a0728c16a8c85a5722e98c4de91dce3c1c46024b7aa66387e861a109cf60d1dc8b53d6e60368bd918a576 + languageName: node + linkType: hard + +"get-stream@npm:^4.0.0, get-stream@npm:^4.1.0": version: 4.1.0 resolution: "get-stream@npm:4.1.0" dependencies: @@ -15473,7 +16838,7 @@ __metadata: languageName: node linkType: hard -"get-stream@npm:^5.1.0": +"get-stream@npm:^5.0.0, get-stream@npm:^5.1.0": version: 5.2.0 resolution: "get-stream@npm:5.2.0" dependencies: @@ -15527,6 +16892,71 @@ __metadata: languageName: node linkType: hard +"getos@npm:^3.2.1": + version: 3.2.1 + resolution: "getos@npm:3.2.1" + dependencies: + async: "npm:^3.2.0" + checksum: 5fe52cec8ab21e41946174f7fc7f9f7ecc767a57a85af35a1775825b00e57a6ec59adafba9a5cb904ebb6799030d5e8204804a7e917f729656c39e57f07aa45f + languageName: node + linkType: hard + +"getpass@npm:^0.1.1": + version: 0.1.7 + resolution: "getpass@npm:0.1.7" + dependencies: + assert-plus: "npm:^1.0.0" + checksum: ffcc370a58a53b0e9e6c5a92db6c7340e3705d84d6bebd448e4afcf7d8a9329cd65be2c3d47ced58c5c8098c3bda21ee65401ba908e3bd37160bec75748a8f54 + languageName: node + linkType: hard + +"gh-release-assets@npm:^2.0.0": + version: 2.0.1 + resolution: "gh-release-assets@npm:2.0.1" + dependencies: + async: "npm:^3.2.0" + mime: "npm:^3.0.0" + progress-stream: "npm:^2.0.0" + pumpify: "npm:^2.0.1" + simple-get: "npm:^4.0.0" + util-extend: "npm:^1.0.1" + checksum: d69a676b1a8fe41ca04ac5f96787bac20f4005cfc4524401f75ee468ecab9bdfefd36becbfefc10931715742d61d1c14b57242fa85fe60b054f7e5c39b48d529 + languageName: node + linkType: hard + +"gh-release@npm:6.0.4": + version: 6.0.4 + resolution: "gh-release@npm:6.0.4" + dependencies: + "@octokit/rest": "npm:^18.0.9" + changelog-parser: "npm:^2.0.0" + deep-extend: "npm:^0.6.0" + gauge: "npm:^v4.0.4" + gh-release-assets: "npm:^2.0.0" + ghauth: "npm:^5.0.0" + github-url-to-object: "npm:^4.0.4" + inquirer: "npm:^8.0.0" + shelljs: "npm:^0.8.4" + update-notifier: "npm:^5.0.0" + yargs: "npm:^17.0.0" + bin: + gh-release: bin/cli.js + checksum: 12c43b9593c50dc2af8ee0ad652217bae7b7e4754b72c6e75816a87afead7f92d1dcb0db4da3feece971058a3e63842b1fa569a6d89bda44593ee75dc6730cd0 + languageName: node + linkType: hard + +"ghauth@npm:^5.0.0": + version: 5.0.1 + resolution: "ghauth@npm:5.0.1" + dependencies: + application-config: "npm:^2.0.0" + node-fetch: "npm:^2.6.0" + ora: "npm:^4.0.5" + read: "npm:^1.0.7" + checksum: 9336bb6bda8d206b13f1b6a96348da4eedea0782fe66eddb96408c48fcd6faf3d93a8f84bcb79f9ed5559859a62a53c7347ce0867ede2c28c7f8e495f6c0e736 + languageName: node + linkType: hard + "git-hooks-list@npm:1.0.3": version: 1.0.3 resolution: "git-hooks-list@npm:1.0.3" @@ -15563,6 +16993,15 @@ __metadata: languageName: node linkType: hard +"github-url-to-object@npm:^4.0.4": + version: 4.0.6 + resolution: "github-url-to-object@npm:4.0.6" + dependencies: + is-url: "npm:^1.1.0" + checksum: 765da19feb8096a1e19432c45c1cb93a5781cd9ca78ae66555a84b6c186677f6e378d1de06fab2b66aa3e76b05c20ab9abdf02232aa75fdcbefab3a30bccd868 + languageName: node + linkType: hard + "glob-parent@npm:^3.1.0": version: 3.1.0 resolution: "glob-parent@npm:3.1.0" @@ -15651,7 +17090,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^7.1.1, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6, glob@npm:^7.2.0": +"glob@npm:^7.0.0, glob@npm:^7.1.1, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.1.6, glob@npm:^7.2.0": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -15674,6 +17113,15 @@ __metadata: languageName: node linkType: hard +"global-dirs@npm:^3.0.0": + version: 3.0.0 + resolution: "global-dirs@npm:3.0.0" + dependencies: + ini: "npm:2.0.0" + checksum: cd99c4b445b2419be7a66facde137c43e146f22941bb6c38b1517239fbd36e7bde19e89aadb43e94377ece02dfb40f5dfe0a5202f540c95c8ef7d1d7813e3477 + languageName: node + linkType: hard + "global-modules@npm:^2.0.0": version: 2.0.0 resolution: "global-modules@npm:2.0.0" @@ -15704,7 +17152,7 @@ __metadata: languageName: node linkType: hard -"globals@npm:^11.1.0": +"globals@npm:^11.1.0, globals@npm:^11.12.0": version: 11.12.0 resolution: "globals@npm:11.12.0" checksum: f404eda4b8f32fb5c1a72edf45123ac85a3ec6441f746ec98f7e77fdea8b0bfa580d3cf9b5f8a1977fa6cbbb10b349212c8b699be414491d08f313d3e6dfe6d9 @@ -15720,6 +17168,13 @@ __metadata: languageName: node linkType: hard +"globals@npm:^9.18.0": + version: 9.18.0 + resolution: "globals@npm:9.18.0" + checksum: af5ab58c79c6297ced24cede6c65c3b7ffd207bd8477acbcd07973a811478d9212614e0e32d389bc0f617fcd06587e6699595f2381e76ef4fa05b40717136ee5 + languageName: node + linkType: hard + "globalthis@npm:^1.0.0": version: 1.0.2 resolution: "globalthis@npm:1.0.2" @@ -15766,7 +17221,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^13.1.2": +"globby@npm:^13.1.1, globby@npm:^13.1.2": version: 13.1.2 resolution: "globby@npm:13.1.2" dependencies: @@ -15828,6 +17283,25 @@ __metadata: languageName: node linkType: hard +"got@npm:^9.6.0": + version: 9.6.0 + resolution: "got@npm:9.6.0" + dependencies: + "@sindresorhus/is": "npm:^0.14.0" + "@szmarczak/http-timer": "npm:^1.1.2" + cacheable-request: "npm:^6.0.0" + decompress-response: "npm:^3.3.0" + duplexer3: "npm:^0.1.4" + get-stream: "npm:^4.1.0" + lowercase-keys: "npm:^1.0.1" + mimic-response: "npm:^1.0.1" + p-cancelable: "npm:^1.0.0" + to-readable-stream: "npm:^1.0.0" + url-parse-lax: "npm:^3.0.0" + checksum: 1cfc615ec5b9b2dde5728e2d0f980acdd61beb63aebb9a96bda6d86b3b1fd07dfb2856732ab94cdffadebc6d376db9819f267a7e4176c929ac93bda06a288a85 + languageName: node + linkType: hard + "graceful-fs@npm:^4.1.11, graceful-fs@npm:^4.1.15, graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.5, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.1.9, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.9": version: 4.2.9 resolution: "graceful-fs@npm:4.2.9" @@ -16112,6 +17586,13 @@ __metadata: languageName: node linkType: hard +"has-yarn@npm:^2.1.0": + version: 2.1.0 + resolution: "has-yarn@npm:2.1.0" + checksum: c897a64dbd842d88f77ce1cc8c672b0e79b567db944f7432ad1dab6f0f03796524fd5798aed550aae0963e2f8305bb284ba00e7d8a715b79b4188bd007b88b62 + languageName: node + linkType: hard + "has@npm:^1.0.3": version: 1.0.3 resolution: "has@npm:1.0.3" @@ -16526,6 +18007,17 @@ __metadata: languageName: node linkType: hard +"http-signature@npm:~1.3.6": + version: 1.3.6 + resolution: "http-signature@npm:1.3.6" + dependencies: + assert-plus: "npm:^1.0.0" + jsprim: "npm:^2.0.2" + sshpk: "npm:^1.14.1" + checksum: ba7c8085475da8a32b3950a615296c46134f09f4c34fc1558828bcfe76ac45d06f89f36068d0ea6de385fd763f0a7bd35511ebf7dded989a7ba83fc7e975228a + languageName: node + linkType: hard + "http-status@npm:1.5.3": version: 1.5.3 resolution: "http-status@npm:1.5.3" @@ -16567,6 +18059,13 @@ __metadata: languageName: node linkType: hard +"human-signals@npm:^1.1.1": + version: 1.1.1 + resolution: "human-signals@npm:1.1.1" + checksum: f1040eb043a9d8f78fab1c8ad1f0555388a915ed460f04a61723a0acf68ffc4b86fb2b374b102ddb2c681dfc9cae7944b2dc73c03759f550d71d3f9b995444ae + languageName: node + linkType: hard + "human-signals@npm:^2.1.0": version: 2.1.0 resolution: "human-signals@npm:2.1.0" @@ -16599,19 +18098,41 @@ __metadata: languageName: node linkType: hard -"i18next-fs-backend@npm:^1.1.5": - version: 1.1.5 - resolution: "i18next-fs-backend@npm:1.1.5" - checksum: 135836099cbef0b63cddf7c4a91d85bc149beebbd17e0d6c80647e5664411138e26b32d827dcfd254697cf5c0921abec9f5e7972289196c8da6385fd86d03fc0 +"husky@npm:^3.0.0": + version: 3.1.0 + resolution: "husky@npm:3.1.0" + dependencies: + chalk: "npm:^2.4.2" + ci-info: "npm:^2.0.0" + cosmiconfig: "npm:^5.2.1" + execa: "npm:^1.0.0" + get-stdin: "npm:^7.0.0" + opencollective-postinstall: "npm:^2.0.2" + pkg-dir: "npm:^4.2.0" + please-upgrade-node: "npm:^3.2.0" + read-pkg: "npm:^5.2.0" + run-node: "npm:^1.0.0" + slash: "npm:^3.0.0" + bin: + husky-run: ./run.js + husky-upgrade: ./lib/upgrader/bin.js + checksum: e23dde3bf6027be3d7d04d3678d53bee1df1feeefc391172c4bfae8e762497914be1a995c98f4eda35d2cfd16e80702695e9c2e63ca07d7a6988e58435d87622 + languageName: node + linkType: hard + +"i18next-fs-backend@npm:^2.0.0": + version: 2.0.0 + resolution: "i18next-fs-backend@npm:2.0.0" + checksum: 0254572bb3f8750d3bfa7c5d8ac0db19f664706d19f80fe4b1a26665af731bd979d6791ef7a73794ba50af76ba12c1f71f5ea859af9a40677ce6beb1a2631bfd languageName: node linkType: hard -"i18next@npm:^22.0.0": - version: 22.0.0 - resolution: "i18next@npm:22.0.0" +"i18next@npm:22.0.4, i18next@npm:^22.0.3": + version: 22.0.4 + resolution: "i18next@npm:22.0.4" dependencies: "@babel/runtime": "npm:^7.17.2" - checksum: 3d389b2cf147430b928b30f3e6967c455d428b5a84276167490cfa4f66c73db5f6e24789b032cde2f4252c0a0a93896aa96f47925d000a87fa1d6efa4e4aad35 + checksum: 5802b9d9cd6b159f202d9c3a4086aaec1c98b2da8817b7d847a15b9878194f94101c9096e10571a3e60e34576408f8d157a99ee5d7edec1563d0a896dbe32431 languageName: node linkType: hard @@ -16716,6 +18237,16 @@ __metadata: languageName: node linkType: hard +"import-fresh@npm:^2.0.0": + version: 2.0.0 + resolution: "import-fresh@npm:2.0.0" + dependencies: + caller-path: "npm:^2.0.0" + resolve-from: "npm:^3.0.0" + checksum: d7b037b9701e8b1d464fbce966cbecfc5a6f12adef4731e8ebc3086dac233909460b65cfc50f9955088ee144bb9db269c77642787b0d8e4d9158e5d470cc914c + languageName: node + linkType: hard + "import-fresh@npm:^3.0.0, import-fresh@npm:^3.1.0, import-fresh@npm:^3.2.1": version: 3.3.0 resolution: "import-fresh@npm:3.3.0" @@ -16742,6 +18273,13 @@ __metadata: languageName: node linkType: hard +"import-lazy@npm:^2.1.0": + version: 2.1.0 + resolution: "import-lazy@npm:2.1.0" + checksum: aeb9aa201f38c92657e6de7dd7156a04abcafa5784f61bc8006e370c9a88670377f74ee41d33ad5f205148011042c717f6d6c964bed7651610b36bd80d7f7ee8 + languageName: node + linkType: hard + "import-lazy@npm:^4.0.0": version: 4.0.0 resolution: "import-lazy@npm:4.0.0" @@ -16784,6 +18322,13 @@ __metadata: languageName: node linkType: hard +"indent-string@npm:^5.0.0": + version: 5.0.0 + resolution: "indent-string@npm:5.0.0" + checksum: 236266380e334d83f79351cd20f94349071fbfc2d2d73b5d07494fefb63e878dcc33cf113047691064e41c6e5d6a6ed2aee5d59f011a80705a4ac338cc99c449 + languageName: node + linkType: hard + "infer-owner@npm:^1.0.3, infer-owner@npm:^1.0.4": version: 1.0.4 resolution: "infer-owner@npm:1.0.4" @@ -16822,6 +18367,13 @@ __metadata: languageName: node linkType: hard +"ini@npm:2.0.0": + version: 2.0.0 + resolution: "ini@npm:2.0.0" + checksum: 5642843f494ec7c3867bbe0b47e7429456e613fe8e301a9f852e06763999216ea2c5ca862b28c6e123bbea789fc1109a325f4efb03a1c912dbe3b6ccc3ebeff5 + languageName: node + linkType: hard + "ini@npm:^1.3.4, ini@npm:^1.3.5, ini@npm:~1.3.0": version: 1.3.8 resolution: "ini@npm:1.3.8" @@ -16836,9 +18388,30 @@ __metadata: languageName: node linkType: hard -"inquirer@npm:^8.2.1": - version: 8.2.4 - resolution: "inquirer@npm:8.2.4" +"inquirer@npm:^7.3.3": + version: 7.3.3 + resolution: "inquirer@npm:7.3.3" + dependencies: + ansi-escapes: "npm:^4.2.1" + chalk: "npm:^4.1.0" + cli-cursor: "npm:^3.1.0" + cli-width: "npm:^3.0.0" + external-editor: "npm:^3.0.3" + figures: "npm:^3.0.0" + lodash: "npm:^4.17.19" + mute-stream: "npm:0.0.8" + run-async: "npm:^2.4.0" + rxjs: "npm:^6.6.0" + string-width: "npm:^4.1.0" + strip-ansi: "npm:^6.0.0" + through: "npm:^2.3.6" + checksum: 7daea33d3ff79e050a421cdf35cd4a8da614496db70cdd7e0576f2c9f5426af407e8ff5662f6fb3a14bc6fe9107c2f51cc6427459246b44b2b0ab69d016b3008 + languageName: node + linkType: hard + +"inquirer@npm:^8.0.0, inquirer@npm:^8.2.1": + version: 8.2.5 + resolution: "inquirer@npm:8.2.5" dependencies: ansi-escapes: "npm:^4.2.1" chalk: "npm:^4.1.1" @@ -16855,7 +18428,7 @@ __metadata: strip-ansi: "npm:^6.0.0" through: "npm:^2.3.6" wrap-ansi: "npm:^7.0.0" - checksum: cfb2c043d74f3517ee20faadc0295eea04fe39808e084c1772a31918fcda0a5c18c341e8f313273bc00dec5e57a7a1d7826234507d1706d335dc174bf001b615 + checksum: 50459c04bf4d6a20e1297eb82bbdf838b0fea6140759103ded99b5af50784fbebecd50f37970cde186829cec4d8f3ad58d975701a1fe03b735a31d4a5a351e63 languageName: node linkType: hard @@ -16870,6 +18443,13 @@ __metadata: languageName: node linkType: hard +"interpret@npm:^1.0.0": + version: 1.4.0 + resolution: "interpret@npm:1.4.0" + checksum: fb5b8a704c431c65d708a18b7d60f36ee2a100c30c381dd5aa02fcd0d92ff90f82a11b00a71acd0586d84e6654c7363a56fca85abb03a4e2bc2caefb44de64ef + languageName: node + linkType: hard + "interpret@npm:^2.2.0": version: 2.2.0 resolution: "interpret@npm:2.2.0" @@ -16877,7 +18457,7 @@ __metadata: languageName: node linkType: hard -"invariant@npm:^2.2.4": +"invariant@npm:^2.2.2, invariant@npm:^2.2.4": version: 2.2.4 resolution: "invariant@npm:2.2.4" dependencies: @@ -17054,7 +18634,7 @@ __metadata: languageName: node linkType: hard -"is-buffer@npm:^1.1.5": +"is-buffer@npm:^1.1.5, is-buffer@npm:~1.1.6": version: 1.1.6 resolution: "is-buffer@npm:1.1.6" checksum: a3857c313fad2bc168a0e0af61d9e8149fe1aa251bc1bb717cf309f8fc3266c2701f82cdf8b224f24e916e32c248da4ead85151ad43c2787090c57b3469f9af7 @@ -17075,7 +18655,7 @@ __metadata: languageName: node linkType: hard -"is-ci@npm:3.0.1, is-ci@npm:^3.0.1": +"is-ci@npm:3.0.1, is-ci@npm:^3.0.0, is-ci@npm:^3.0.1": version: 3.0.1 resolution: "is-ci@npm:3.0.1" dependencies: @@ -17176,6 +18756,13 @@ __metadata: languageName: node linkType: hard +"is-directory@npm:^0.3.1": + version: 0.3.1 + resolution: "is-directory@npm:0.3.1" + checksum: 1db8024dfb4dd088ac4e8b00828d97ebb6812d5cde8ad9670ac6ec4d40f0b17cfe1eb29473dcd5faaf211a912c2e05e8aa944bb79e6d57098c1b8339528e624e + languageName: node + linkType: hard + "is-docker@npm:^2.0.0, is-docker@npm:^2.1.1": version: 2.2.1 resolution: "is-docker@npm:2.2.1" @@ -17317,6 +18904,16 @@ __metadata: languageName: node linkType: hard +"is-installed-globally@npm:^0.4.0, is-installed-globally@npm:~0.4.0": + version: 0.4.0 + resolution: "is-installed-globally@npm:0.4.0" + dependencies: + global-dirs: "npm:^3.0.0" + is-path-inside: "npm:^3.0.2" + checksum: 35a1a89a9b651a208d64aa2ae0278a93c887ac1c5986f6145dcb0e29fbd51d57e6c9dc37c138dbab5fc59f35ee45165be4be05719f6a3f1cf789b7aee9629670 + languageName: node + linkType: hard + "is-interactive@npm:^1.0.0": version: 1.0.0 resolution: "is-interactive@npm:1.0.0" @@ -17361,6 +18958,13 @@ __metadata: languageName: node linkType: hard +"is-npm@npm:^5.0.0": + version: 5.0.0 + resolution: "is-npm@npm:5.0.0" + checksum: 82d63badf3f496c6dffa421af696e9071675f204c44a987da33ea4545f1996e1019dbb444c2ea7ecffd321b98192315dd3971c8088896165044a3f025085d909 + languageName: node + linkType: hard + "is-number-object@npm:^1.0.4": version: 1.0.6 resolution: "is-number-object@npm:1.0.6" @@ -17400,7 +19004,7 @@ __metadata: languageName: node linkType: hard -"is-path-inside@npm:^3.0.3": +"is-path-inside@npm:^3.0.2, is-path-inside@npm:^3.0.3": version: 3.0.3 resolution: "is-path-inside@npm:3.0.3" checksum: ca3976bb491e562794ba9d1884d8679e08a68fbc68bdefabbed393bdb3fefd66958c0b8d166ca6c4b502a5283bcd0bede7a2b223bf740e406db6dcffddc833a5 @@ -17595,7 +19199,7 @@ __metadata: languageName: node linkType: hard -"is-typedarray@npm:^1.0.0": +"is-typedarray@npm:^1.0.0, is-typedarray@npm:~1.0.0": version: 1.0.0 resolution: "is-typedarray@npm:1.0.0" checksum: f918df0d4215dbde9d0d29375cf39e353abe59ef3964862afc87bb6ce503e7439f4131260a7b1777074f5fcc64f659c75a4ce5a93ceb603901375cd0b13eedab @@ -17627,6 +19231,13 @@ __metadata: languageName: node linkType: hard +"is-url@npm:^1.1.0": + version: 1.2.4 + resolution: "is-url@npm:1.2.4" + checksum: a76fc21634a514fecc984b7f61db97d9423077a6e5ff1d19e1ed89bacf04273f66d8e445295fba15540b5a590dc62e1751a209261fc1d32238cdc1acde7f9826 + languageName: node + linkType: hard + "is-utf8@npm:^0.2.0": version: 0.2.1 resolution: "is-utf8@npm:0.2.1" @@ -17694,6 +19305,13 @@ __metadata: languageName: node linkType: hard +"is-yarn-global@npm:^0.3.0": + version: 0.3.0 + resolution: "is-yarn-global@npm:0.3.0" + checksum: 42a5c0819dcfa72e0b71df76242dc9a39269f394ad1a7c50cdc21cc2c146cbda0fe393dbe662e9d51fd856ac6a3354f931f51e4c252780bc496430026c5e6e52 + languageName: node + linkType: hard + "isarray@npm:0.0.1": version: 0.0.1 resolution: "isarray@npm:0.0.1" @@ -17764,6 +19382,13 @@ __metadata: languageName: node linkType: hard +"isstream@npm:~0.1.2": + version: 0.1.2 + resolution: "isstream@npm:0.1.2" + checksum: 0458850e4cc11c29dece587a48a73b44e423738fc8824bfa946f11cc5371ccf94e9e9fcbc4025ced0116c420e08ed3a61cfb14393d2b4c989587888acdd6b0ab + languageName: node + linkType: hard + "istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0": version: 3.2.0 resolution: "istanbul-lib-coverage@npm:3.2.0" @@ -17871,47 +19496,47 @@ __metadata: languageName: node linkType: hard -"jest-circus@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-circus@npm:29.2.2" +"jest-circus@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-circus@npm:29.3.1" dependencies: - "@jest/environment": "npm:^29.2.2" - "@jest/expect": "npm:^29.2.2" - "@jest/test-result": "npm:^29.2.1" - "@jest/types": "npm:^29.2.1" + "@jest/environment": "npm:^29.3.1" + "@jest/expect": "npm:^29.3.1" + "@jest/test-result": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" chalk: "npm:^4.0.0" co: "npm:^4.6.0" dedent: "npm:^0.7.0" is-generator-fn: "npm:^2.0.0" - jest-each: "npm:^29.2.1" - jest-matcher-utils: "npm:^29.2.2" - jest-message-util: "npm:^29.2.1" - jest-runtime: "npm:^29.2.2" - jest-snapshot: "npm:^29.2.2" - jest-util: "npm:^29.2.1" + jest-each: "npm:^29.3.1" + jest-matcher-utils: "npm:^29.3.1" + jest-message-util: "npm:^29.3.1" + jest-runtime: "npm:^29.3.1" + jest-snapshot: "npm:^29.3.1" + jest-util: "npm:^29.3.1" p-limit: "npm:^3.1.0" - pretty-format: "npm:^29.2.1" + pretty-format: "npm:^29.3.1" slash: "npm:^3.0.0" stack-utils: "npm:^2.0.3" - checksum: 6edb359ec43e010dc0f1dd8ecdb6698a4097fa05e7f7da7433b05d9bb97b14e4831bb80f5e24d3db09006e4296caf631385c32209616845537100b6c7aee9ce3 + checksum: 6ec554402037de44c1bf528e19a85d3af022569123ef1af75cc6097d669ef37ba941ea76862bf184ba5064991837dafbdad59a816959c1373ced4d3a5f3bea6f languageName: node linkType: hard -"jest-cli@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-cli@npm:29.2.2" +"jest-cli@npm:^29.2.2, jest-cli@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-cli@npm:29.3.1" dependencies: - "@jest/core": "npm:^29.2.2" - "@jest/test-result": "npm:^29.2.1" - "@jest/types": "npm:^29.2.1" + "@jest/core": "npm:^29.3.1" + "@jest/test-result": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" chalk: "npm:^4.0.0" exit: "npm:^0.1.2" graceful-fs: "npm:^4.2.9" import-local: "npm:^3.0.2" - jest-config: "npm:^29.2.2" - jest-util: "npm:^29.2.1" - jest-validate: "npm:^29.2.2" + jest-config: "npm:^29.3.1" + jest-util: "npm:^29.3.1" + jest-validate: "npm:^29.3.1" prompts: "npm:^2.0.1" yargs: "npm:^17.3.1" peerDependencies: @@ -17921,34 +19546,34 @@ __metadata: optional: true bin: jest: bin/jest.js - checksum: 2cb5e00fccaf7d1a0d7b770f567f07f11c05d3bfdbec528acde2f3a7442f5101f4f662b96d064ee4c6206679fc4bf3f6dcdeb82dceb4e54cb0abb392bb60ff2d + checksum: c3bc2170d383ea5001625771124fd596019908f976b05b00738e67b450aaf66ddfc9f73674160eb109aedc53ebed31792190f5cfaf0e1c7c7cbacb6a618a101c languageName: node linkType: hard -"jest-config@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-config@npm:29.2.2" +"jest-config@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-config@npm:29.3.1" dependencies: "@babel/core": "npm:^7.11.6" - "@jest/test-sequencer": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" - babel-jest: "npm:^29.2.2" + "@jest/test-sequencer": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" + babel-jest: "npm:^29.3.1" chalk: "npm:^4.0.0" ci-info: "npm:^3.2.0" deepmerge: "npm:^4.2.2" glob: "npm:^7.1.3" graceful-fs: "npm:^4.2.9" - jest-circus: "npm:^29.2.2" - jest-environment-node: "npm:^29.2.2" + jest-circus: "npm:^29.3.1" + jest-environment-node: "npm:^29.3.1" jest-get-type: "npm:^29.2.0" jest-regex-util: "npm:^29.2.0" - jest-resolve: "npm:^29.2.2" - jest-runner: "npm:^29.2.2" - jest-util: "npm:^29.2.1" - jest-validate: "npm:^29.2.2" + jest-resolve: "npm:^29.3.1" + jest-runner: "npm:^29.3.1" + jest-util: "npm:^29.3.1" + jest-validate: "npm:^29.3.1" micromatch: "npm:^4.0.4" parse-json: "npm:^5.2.0" - pretty-format: "npm:^29.2.1" + pretty-format: "npm:^29.3.1" slash: "npm:^3.0.0" strip-json-comments: "npm:^3.1.1" peerDependencies: @@ -17959,7 +19584,7 @@ __metadata: optional: true ts-node: optional: true - checksum: 5bcc84338aa904aad6a563da25f328ad05e880c6e165917b90e04953121c355b466f05717c0e0aebfa8a7da0012bdbd3df837c2e8d495e3f0186ad7f44ed76dd + checksum: 1179100a2744dab055e396bce1ccd03fe08a10bcc8225401decd21407d7a2eba170997e58097f81253c7c4601b8a59f70a443622536f4d6408c15b63873aa868 languageName: node linkType: hard @@ -17974,15 +19599,15 @@ __metadata: languageName: node linkType: hard -"jest-diff@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-diff@npm:29.2.1" +"jest-diff@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-diff@npm:29.3.1" dependencies: chalk: "npm:^4.0.0" - diff-sequences: "npm:^29.2.0" + diff-sequences: "npm:^29.3.1" jest-get-type: "npm:^29.2.0" - pretty-format: "npm:^29.2.1" - checksum: 157fa6a57a8023249a8353da73cc99feabaa76828b0b84ffa345518869d85d9dd814d3687020553647485c9e6792c72007e50801063137f77b2f2b862530890c + pretty-format: "npm:^29.3.1" + checksum: b0f9f48938638ca559abb7d3d70c06dd1f44b1f59e1b985614ce661383dd86dd26a92049ec59292438c2e60b98b5b68bc02dcd6365f4e9a725ba0f5cb0c3b91a languageName: node linkType: hard @@ -17995,16 +19620,16 @@ __metadata: languageName: node linkType: hard -"jest-each@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-each@npm:29.2.1" +"jest-each@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-each@npm:29.3.1" dependencies: - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" chalk: "npm:^4.0.0" jest-get-type: "npm:^29.2.0" - jest-util: "npm:^29.2.1" - pretty-format: "npm:^29.2.1" - checksum: 4504fa9aeae54df8ee6937dff4f84d3b285d8efd6c6733c41a8e756f2200af8fc9c7ad8f204b7de7401cfdef244b5f7877a4e0f94045401b285765227e543232 + jest-util: "npm:^29.3.1" + pretty-format: "npm:^29.3.1" + checksum: 10d858d5cb151a7e43029880bd81f416b337e545a20fc2be05854c6a45a25d4224afe4bee03e483e1ee416841c10e3ac66fec4e93b63514de6932c506f4e8cff languageName: node linkType: hard @@ -18017,29 +19642,50 @@ __metadata: "@jest/types": "npm:^29.2.1" "@types/jsdom": "npm:^20.0.0" "@types/node": "npm:*" - jest-mock: "npm:^29.2.2" - jest-util: "npm:^29.2.1" + jest-mock: "npm:^29.2.2" + jest-util: "npm:^29.2.1" + jsdom: "npm:^20.0.0" + peerDependencies: + canvas: ^2.5.0 + peerDependenciesMeta: + canvas: + optional: true + checksum: 1feda17c982df7139cc862b1450b85f41a490dc30a1fd1ab8196939f172df8124d0a1cc89a5d35d38d85918b26c4028a31104da5ef6815d11d5d9d39b2f70b06 + languageName: node + linkType: hard + +"jest-environment-jsdom@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-environment-jsdom@npm:29.3.1" + dependencies: + "@jest/environment": "npm:^29.3.1" + "@jest/fake-timers": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" + "@types/jsdom": "npm:^20.0.0" + "@types/node": "npm:*" + jest-mock: "npm:^29.3.1" + jest-util: "npm:^29.3.1" jsdom: "npm:^20.0.0" peerDependencies: canvas: ^2.5.0 peerDependenciesMeta: canvas: optional: true - checksum: 1feda17c982df7139cc862b1450b85f41a490dc30a1fd1ab8196939f172df8124d0a1cc89a5d35d38d85918b26c4028a31104da5ef6815d11d5d9d39b2f70b06 + checksum: 7d61eb23a79943b9a4746d6a93279038f03019b8a64a6423f4ff9b9f189f414f2d790dc7c0a922114b7f9c9c4543b867d36ac46091e2786dce6f74186602c589 languageName: node linkType: hard -"jest-environment-node@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-environment-node@npm:29.2.2" +"jest-environment-node@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-environment-node@npm:29.3.1" dependencies: - "@jest/environment": "npm:^29.2.2" - "@jest/fake-timers": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" + "@jest/environment": "npm:^29.3.1" + "@jest/fake-timers": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" - jest-mock: "npm:^29.2.2" - jest-util: "npm:^29.2.1" - checksum: 4b0d77dcdb1b0c1b7981bebd5b48952f276a9e00ce7f73c7f62713acc4068c77356e669fa3858456d28e72892468cf9ac7e41db23be2a50fbdf2c15b4be29e38 + jest-mock: "npm:^29.3.1" + jest-util: "npm:^29.3.1" + checksum: 6dd94ce95bc63f32de892932a02deff5914e9d9cad3f8f9276d816cafc4b052d50733dcf4e35c661c6d706aa1456614c9a94e0a508886300ddca48b5575952a3 languageName: node linkType: hard @@ -18075,11 +19721,11 @@ __metadata: languageName: node linkType: hard -"jest-haste-map@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-haste-map@npm:29.2.1" +"jest-haste-map@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-haste-map@npm:29.3.1" dependencies: - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" "@types/graceful-fs": "npm:^4.1.3" "@types/node": "npm:*" anymatch: "npm:^3.0.3" @@ -18087,64 +19733,64 @@ __metadata: fsevents: "npm:^2.3.2" graceful-fs: "npm:^4.2.9" jest-regex-util: "npm:^29.2.0" - jest-util: "npm:^29.2.1" - jest-worker: "npm:^29.2.1" + jest-util: "npm:^29.3.1" + jest-worker: "npm:^29.3.1" micromatch: "npm:^4.0.4" walker: "npm:^1.0.8" dependenciesMeta: fsevents: optional: true - checksum: 27e761705347af62c9b0e14b8daf69b809650252e86f9c99ee22f76b807d0953002c988031fe01d0f869bc499c3172d278fce2c6f5f87623406b37f4f0470b17 + checksum: 264c34fd4b9bb5c84971a9c9d06bc75e14661b75afb995b298ec08a847f18cbedaec42efb3d5e6335e59f69629c42aceda77e4b64cb75d8d8344b39e5c5f26e4 languageName: node linkType: hard -"jest-leak-detector@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-leak-detector@npm:29.2.1" +"jest-leak-detector@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-leak-detector@npm:29.3.1" dependencies: jest-get-type: "npm:^29.2.0" - pretty-format: "npm:^29.2.1" - checksum: 3407e3c8afcdfe5de9d617f2d19d5e66d101e8ade869ac159da40ce0dd870485529f604c14aa39eb3d960b64edc49196dfe321aae37dbf45a6d291e45e005e50 + pretty-format: "npm:^29.3.1" + checksum: faffa6c6411ff9386f170ab3ea008a0c8b1e967ecdd32cfca3adfcdb953be3a655e99bba6bdf895a1ef488b664d8f7fe9b681a24d8336eaf90af54de4d64a741 languageName: node linkType: hard -"jest-matcher-utils@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-matcher-utils@npm:29.2.2" +"jest-matcher-utils@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-matcher-utils@npm:29.3.1" dependencies: chalk: "npm:^4.0.0" - jest-diff: "npm:^29.2.1" + jest-diff: "npm:^29.3.1" jest-get-type: "npm:^29.2.0" - pretty-format: "npm:^29.2.1" - checksum: 080d8222908d10fd1acf778cdff754e72f55e7734e27fdb42b85455278f09690831dec37f9a7e003dd31fadcbde3f7aa32310e1be0862c5b0f44a3d12dd6b19d + pretty-format: "npm:^29.3.1" + checksum: 936ae1fd9fe8a6d0dc31740740ad6cf3c698a16e232d57ee599e7e3040d22efc2063a7a744fb1b6550fb140b3ee7c5aeb46182920e37499e1ab4e2675ddce875 languageName: node linkType: hard -"jest-message-util@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-message-util@npm:29.2.1" +"jest-message-util@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-message-util@npm:29.3.1" dependencies: "@babel/code-frame": "npm:^7.12.13" - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" "@types/stack-utils": "npm:^2.0.0" chalk: "npm:^4.0.0" graceful-fs: "npm:^4.2.9" micromatch: "npm:^4.0.4" - pretty-format: "npm:^29.2.1" + pretty-format: "npm:^29.3.1" slash: "npm:^3.0.0" stack-utils: "npm:^2.0.3" - checksum: 4f5a381782cc0ce37e5837a090cdd14bea0f1704829d8a2ba1e5f282ad27e2c141970f5880a90b9dbdb2e959299d21c9003180a0ea427526f24d431ec7bc96bd + checksum: e1afc9a0ab4fc6c54ae9f6dffe91b8beab433b513011c0bfe457f708109135f67b8e18e71fb41cdd919dc35d89128f59c64cf807db8506b38d30dbd3be605a80 languageName: node linkType: hard -"jest-mock@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-mock@npm:29.2.2" +"jest-mock@npm:^29.2.2, jest-mock@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-mock@npm:29.3.1" dependencies: - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" - jest-util: "npm:^29.2.1" - checksum: 3d379facb92664855f49a0a0e187546722b192bab78e40148dcbe0a8acd6041b17318e3ee8c1107882ef9f058a8999436f6c410461e1ee047b069327cf306bff + jest-util: "npm:^29.3.1" + checksum: fe8a9e41c88ec816b23ea7db16f9586c1265717e6ec043b12aed89c5ba8f2980e96f432236268484d8567c3f63c6b2a8097f2fb5e3f25b1b2e41a47efa1039c9 languageName: node linkType: hard @@ -18174,89 +19820,89 @@ __metadata: languageName: node linkType: hard -"jest-resolve-dependencies@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-resolve-dependencies@npm:29.2.2" +"jest-resolve-dependencies@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-resolve-dependencies@npm:29.3.1" dependencies: jest-regex-util: "npm:^29.2.0" - jest-snapshot: "npm:^29.2.2" - checksum: 098179d9b80b81b6b0891e866d2d7817683c74058f1b77eb6927e74927ccc6439637fc2e8c724a2a23af164ae06e21975366c57afe779054bc789f52dcfd237f + jest-snapshot: "npm:^29.3.1" + checksum: 3220ff119a1c5464caf9eb5f3c5931798a3e08ef1eda6ceff0146ae6fcb49750e341c18138718b27b765d67ea1b869498b8b7e17978a24922ea147a185318bbb languageName: node linkType: hard -"jest-resolve@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-resolve@npm:29.2.2" +"jest-resolve@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-resolve@npm:29.3.1" dependencies: chalk: "npm:^4.0.0" graceful-fs: "npm:^4.2.9" - jest-haste-map: "npm:^29.2.1" + jest-haste-map: "npm:^29.3.1" jest-pnp-resolver: "npm:^1.2.2" - jest-util: "npm:^29.2.1" - jest-validate: "npm:^29.2.2" + jest-util: "npm:^29.3.1" + jest-validate: "npm:^29.3.1" resolve: "npm:^1.20.0" resolve.exports: "npm:^1.1.0" slash: "npm:^3.0.0" - checksum: 4bf3ad8a70439c32e158002dfbedd52b0607d4c3ec1c31ec8c0c40dbe81b966cc1b53fc98dd096b0fe5da44d0b3bd37abfafdd667596fde2ee55b1093d9cd157 + checksum: be51f654d345dc0f3d0c0844ac807eb80dccdff6cf8e58f4626cd5059b89240429f8106a8be8c11febd3fa88dbca6a8e5b2d916b8e97662b6d5e2606019a49f5 languageName: node linkType: hard -"jest-runner@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-runner@npm:29.2.2" +"jest-runner@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-runner@npm:29.3.1" dependencies: - "@jest/console": "npm:^29.2.1" - "@jest/environment": "npm:^29.2.2" - "@jest/test-result": "npm:^29.2.1" - "@jest/transform": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" + "@jest/console": "npm:^29.3.1" + "@jest/environment": "npm:^29.3.1" + "@jest/test-result": "npm:^29.3.1" + "@jest/transform": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" chalk: "npm:^4.0.0" emittery: "npm:^0.13.1" graceful-fs: "npm:^4.2.9" jest-docblock: "npm:^29.2.0" - jest-environment-node: "npm:^29.2.2" - jest-haste-map: "npm:^29.2.1" - jest-leak-detector: "npm:^29.2.1" - jest-message-util: "npm:^29.2.1" - jest-resolve: "npm:^29.2.2" - jest-runtime: "npm:^29.2.2" - jest-util: "npm:^29.2.1" - jest-watcher: "npm:^29.2.2" - jest-worker: "npm:^29.2.1" + jest-environment-node: "npm:^29.3.1" + jest-haste-map: "npm:^29.3.1" + jest-leak-detector: "npm:^29.3.1" + jest-message-util: "npm:^29.3.1" + jest-resolve: "npm:^29.3.1" + jest-runtime: "npm:^29.3.1" + jest-util: "npm:^29.3.1" + jest-watcher: "npm:^29.3.1" + jest-worker: "npm:^29.3.1" p-limit: "npm:^3.1.0" source-map-support: "npm:0.5.13" - checksum: e7ac7ea816ec14160c6b2bb8c3623d6b7e769d7db565e23474b2b4d54515c87fffb15ab39ced02e3144dcb63e70cf42e391bf0c97fe34353482f798bf5ea11c1 + checksum: c7608cd7cd1289164c66abbc7a9a7a7ce06e00b71843e54027c8d4c97ef851c9080b5e9d54d21368afc6a53b5adbb2671095a0b365e66c02c33d447420b74cfc languageName: node linkType: hard -"jest-runtime@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-runtime@npm:29.2.2" +"jest-runtime@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-runtime@npm:29.3.1" dependencies: - "@jest/environment": "npm:^29.2.2" - "@jest/fake-timers": "npm:^29.2.2" - "@jest/globals": "npm:^29.2.2" + "@jest/environment": "npm:^29.3.1" + "@jest/fake-timers": "npm:^29.3.1" + "@jest/globals": "npm:^29.3.1" "@jest/source-map": "npm:^29.2.0" - "@jest/test-result": "npm:^29.2.1" - "@jest/transform": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" + "@jest/test-result": "npm:^29.3.1" + "@jest/transform": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" chalk: "npm:^4.0.0" cjs-module-lexer: "npm:^1.0.0" collect-v8-coverage: "npm:^1.0.0" glob: "npm:^7.1.3" graceful-fs: "npm:^4.2.9" - jest-haste-map: "npm:^29.2.1" - jest-message-util: "npm:^29.2.1" - jest-mock: "npm:^29.2.2" + jest-haste-map: "npm:^29.3.1" + jest-message-util: "npm:^29.3.1" + jest-mock: "npm:^29.3.1" jest-regex-util: "npm:^29.2.0" - jest-resolve: "npm:^29.2.2" - jest-snapshot: "npm:^29.2.2" - jest-util: "npm:^29.2.1" + jest-resolve: "npm:^29.3.1" + jest-snapshot: "npm:^29.3.1" + jest-util: "npm:^29.3.1" slash: "npm:^3.0.0" strip-bom: "npm:^4.0.0" - checksum: d9e3da3d8d00e81bc7fecb78ce2719a48492bdbb09f6ec701ab70e8985e4021d2a2f704106972ec487e174fd94f6d44ec5e16161c0c1656695a2173f08ae5eb6 + checksum: 9e0f1a2a6b08b55a9da11a3e841571c65dbdd6d0883ceab33f4ad4b65011ad59f47f9c27fd21cbd3cc22b01e53f3e54d76f4814c45b17a6b92713903a2207d3e languageName: node linkType: hard @@ -18270,9 +19916,9 @@ __metadata: languageName: node linkType: hard -"jest-snapshot@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-snapshot@npm:29.2.2" +"jest-snapshot@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-snapshot@npm:29.3.1" dependencies: "@babel/core": "npm:^7.11.6" "@babel/generator": "npm:^7.7.2" @@ -18280,25 +19926,25 @@ __metadata: "@babel/plugin-syntax-typescript": "npm:^7.7.2" "@babel/traverse": "npm:^7.7.2" "@babel/types": "npm:^7.3.3" - "@jest/expect-utils": "npm:^29.2.2" - "@jest/transform": "npm:^29.2.2" - "@jest/types": "npm:^29.2.1" + "@jest/expect-utils": "npm:^29.3.1" + "@jest/transform": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/babel__traverse": "npm:^7.0.6" "@types/prettier": "npm:^2.1.5" babel-preset-current-node-syntax: "npm:^1.0.0" chalk: "npm:^4.0.0" - expect: "npm:^29.2.2" + expect: "npm:^29.3.1" graceful-fs: "npm:^4.2.9" - jest-diff: "npm:^29.2.1" + jest-diff: "npm:^29.3.1" jest-get-type: "npm:^29.2.0" - jest-haste-map: "npm:^29.2.1" - jest-matcher-utils: "npm:^29.2.2" - jest-message-util: "npm:^29.2.1" - jest-util: "npm:^29.2.1" + jest-haste-map: "npm:^29.3.1" + jest-matcher-utils: "npm:^29.3.1" + jest-message-util: "npm:^29.3.1" + jest-util: "npm:^29.3.1" natural-compare: "npm:^1.4.0" - pretty-format: "npm:^29.2.1" + pretty-format: "npm:^29.3.1" semver: "npm:^7.3.5" - checksum: 2ad979843c6ef437c6645f0183c79c226b02951aefabe3aad32e94f84d14a06e92c8164d582f9f0c5a5116c8322a518b250af8d4fb31563bf061ff0be6eab740 + checksum: e0dc071df9cb2bf72572dd37802ea1946d04ff4001229d804d3f280cda17b8868cd6e6aa635f4b7067440c623ffe64055fca7e4a81ad75ac722069b4f5532ad4 languageName: node linkType: hard @@ -18316,47 +19962,47 @@ __metadata: languageName: node linkType: hard -"jest-util@npm:^29.0.0, jest-util@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-util@npm:29.2.1" +"jest-util@npm:^29.0.0, jest-util@npm:^29.2.1, jest-util@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-util@npm:29.3.1" dependencies: - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" chalk: "npm:^4.0.0" ci-info: "npm:^3.2.0" graceful-fs: "npm:^4.2.9" picomatch: "npm:^2.2.3" - checksum: d2bb747485b631ec2ba862c1aa181fc94df4e4591c481bf7af4fa6aeb1e3eee27a6e85a6067579a05f65a8ca6ce05e1189dd59edf1853a970239a388bcad23f2 + checksum: c11f92ba490288788c921fcba2a173bf3a73c2573008faedaf227b8e42458816818753f228a3b5adcd52689c2086fb4e5b451db86a96bc673ae3c034a557cf7a languageName: node linkType: hard -"jest-validate@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-validate@npm:29.2.2" +"jest-validate@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-validate@npm:29.3.1" dependencies: - "@jest/types": "npm:^29.2.1" + "@jest/types": "npm:^29.3.1" camelcase: "npm:^6.2.0" chalk: "npm:^4.0.0" jest-get-type: "npm:^29.2.0" leven: "npm:^3.1.0" - pretty-format: "npm:^29.2.1" - checksum: 06e63a74e8cff967ffca7682b152dd09dfb580410370bbae4e844f50efd953fb679f916c8f912a44185882ca79a5efb5d9dc528c9617f86e99c041f3e6b00f26 + pretty-format: "npm:^29.3.1" + checksum: 76986eb0e8ad998053de806fb1809a6f5fd884f7f02a4a3ab33a535d6ad7f15bf29a4022b9ccce61ae11bb032805733cc07d726d9f888d646bb4980b07cd0a6b languageName: node linkType: hard -"jest-watcher@npm:^29.2.2": - version: 29.2.2 - resolution: "jest-watcher@npm:29.2.2" +"jest-watcher@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-watcher@npm:29.3.1" dependencies: - "@jest/test-result": "npm:^29.2.1" - "@jest/types": "npm:^29.2.1" + "@jest/test-result": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" "@types/node": "npm:*" ansi-escapes: "npm:^4.2.1" chalk: "npm:^4.0.0" emittery: "npm:^0.13.1" - jest-util: "npm:^29.2.1" + jest-util: "npm:^29.3.1" string-length: "npm:^4.0.1" - checksum: 118851ce776cceb20403dc0f471ec6ec4e79f073be012a07a7d857390194af7b175e7d083fbca73c77443aa6a9828e7309a9f50bcaa03285398ec4b7a3adbec5 + checksum: 78d13c34e81f6e081d8b20fdf020b0f83cf14990226493ffec615bf94267cc82cd057f125669266e7aa7a748e348f2b61d55b732c1fd12dffc8915dc2ed4c3bf languageName: node linkType: hard @@ -18382,15 +20028,15 @@ __metadata: languageName: node linkType: hard -"jest-worker@npm:^29.2.1": - version: 29.2.1 - resolution: "jest-worker@npm:29.2.1" +"jest-worker@npm:^29.3.1": + version: 29.3.1 + resolution: "jest-worker@npm:29.3.1" dependencies: "@types/node": "npm:*" - jest-util: "npm:^29.2.1" + jest-util: "npm:^29.3.1" merge-stream: "npm:^2.0.0" supports-color: "npm:^8.0.0" - checksum: 6feaeac250274c22e229a6b9bdc60e47e96310fd1d4726669aebe51bf3c8d3f4445c2901c8be0442a829b9b4730aeb5bf25255f8d05d73076b8558ac25f6cb6e + checksum: 14ea04ab9eacd9dd7b5b6245032d9c043c6bad907a76bbfe0f09b3dde93992631df10e3f6463578e38a88812ab7c6edec6e343c3aad0e5378e1063ccc04b96ac languageName: node linkType: hard @@ -18413,6 +20059,47 @@ __metadata: languageName: node linkType: hard +"jest@npm:^29.3.1": + version: 29.3.1 + resolution: "jest@npm:29.3.1" + dependencies: + "@jest/core": "npm:^29.3.1" + "@jest/types": "npm:^29.3.1" + import-local: "npm:^3.0.2" + jest-cli: "npm:^29.3.1" + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + bin: + jest: bin/jest.js + checksum: 6b892f8717de97c38a5b39e0f45f98fe244f0867f8767bc7b4612594a2e863d6bef03caa5f0648427fea4ca5dad2802df627cb16574183a8e5467d22a8e245f2 + languageName: node + linkType: hard + +"joi@npm:^17.4.0": + version: 17.7.0 + resolution: "joi@npm:17.7.0" + dependencies: + "@hapi/hoek": "npm:^9.0.0" + "@hapi/topo": "npm:^5.0.0" + "@sideway/address": "npm:^4.1.3" + "@sideway/formula": "npm:^3.0.0" + "@sideway/pinpoint": "npm:^2.0.0" + checksum: f686a1d4f73605857b9b8e1bc6eb5d85c09805d733b947496a649b4e884a751a55f53006fc6c40c36fe2b484231f8c5973615b0aaf7e5c1109d2ec7916cafc63 + languageName: node + linkType: hard + +"jora@npm:^1.0.0-beta.7": + version: 1.0.0-beta.7 + resolution: "jora@npm:1.0.0-beta.7" + dependencies: + "@discoveryjs/natural-compare": "npm:^1.0.0" + checksum: 483fd6a6c704dd4d61eca2541818ab2bdce7d5f4d27690463847135aa19b8ada125fa3967e07661195ca5ca85d7215f26f43e90ba70df6d94f3196ad7a1035ca + languageName: node + linkType: hard + "jose@npm:4.10.4, jose@npm:^4.1.4, jose@npm:^4.9.3": version: 4.10.4 resolution: "jose@npm:4.10.4" @@ -18448,6 +20135,13 @@ __metadata: languageName: node linkType: hard +"js-tokens@npm:^3.0.2": + version: 3.0.2 + resolution: "js-tokens@npm:3.0.2" + checksum: 59580696b1a9b154aa6be6d73d0991daa1a28c39d6f0a914ef7fdadd467936827b833d436ab35bbfea9d91a90fd97b0dc37fb94fe2d4634255a4e24a84acc654 + languageName: node + linkType: hard + "js-yaml@npm:4.1.0, js-yaml@npm:^4.0.0, js-yaml@npm:^4.1.0": version: 4.1.0 resolution: "js-yaml@npm:4.1.0" @@ -18471,6 +20165,13 @@ __metadata: languageName: node linkType: hard +"jsbn@npm:~0.1.0": + version: 0.1.1 + resolution: "jsbn@npm:0.1.1" + checksum: b30785edca016891c4da40f97916476858a0e14745ebb14ac59162a9110b5a1f80cdd550b80b627234ba63ea16f83e233502625572e7fdd9dcf703c99a0d753e + languageName: node + linkType: hard + "jscodeshift@npm:^0.13.1": version: 0.13.1 resolution: "jscodeshift@npm:0.13.1" @@ -18585,6 +20286,13 @@ __metadata: languageName: node linkType: hard +"json-buffer@npm:3.0.0": + version: 3.0.0 + resolution: "json-buffer@npm:3.0.0" + checksum: 26a96a5875dbbcd4abbef1fc20384645d922117eeaddd266bb0ac6f8fa5714d3da0cf160529e3558f8997065b4e1ef00ae2c4cb1410610b5cfe872156f4e89b9 + languageName: node + linkType: hard + "json-buffer@npm:3.0.1": version: 3.0.1 resolution: "json-buffer@npm:3.0.1" @@ -18592,6 +20300,17 @@ __metadata: languageName: node linkType: hard +"json-fixer@npm:^1.6.8": + version: 1.6.15 + resolution: "json-fixer@npm:1.6.15" + dependencies: + "@babel/runtime": "npm:^7.18.9" + chalk: "npm:^4.1.2" + pegjs: "npm:^0.10.0" + checksum: 5a96ed2f79221ad796ca2d92df858d731b22765e112ed635d1ca5c7dbe6dd9c606cde9b67151053b9145dec254d168d6512d549caf876adf87652ba375b409a3 + languageName: node + linkType: hard + "json-machete@npm:0.16.0": version: 0.16.0 resolution: "json-machete@npm:0.16.0" @@ -18657,6 +20376,13 @@ __metadata: languageName: node linkType: hard +"json-schema@npm:0.4.0, json-schema@npm:^0.4.0": + version: 0.4.0 + resolution: "json-schema@npm:0.4.0" + checksum: 54562ace314c3b4441c8daf87eb45db2a454d19aa0fd402cdf4cda5806e444b9e03c79845a93d9c1bca19694386c40d87282c14749ca02915732a6315b3a54b6 + languageName: node + linkType: hard + "json-stable-stringify-without-jsonify@npm:^1.0.1": version: 1.0.1 resolution: "json-stable-stringify-without-jsonify@npm:1.0.1" @@ -18664,6 +20390,13 @@ __metadata: languageName: node linkType: hard +"json-stringify-safe@npm:~5.0.1": + version: 5.0.1 + resolution: "json-stringify-safe@npm:5.0.1" + checksum: e86f7bb748bb84f73b171bb68c8209a1e68f40d41f943952f746fa4ca3802c1edf4602e86977c2de44eba1e64e4cabe2498f4499003cc471e99db83bfba95898 + languageName: node + linkType: hard + "json5@npm:2.2.1, json5@npm:^2.1.2, json5@npm:^2.1.3, json5@npm:^2.2.0, json5@npm:^2.2.1": version: 2.2.1 resolution: "json5@npm:2.2.1" @@ -18728,6 +20461,18 @@ __metadata: languageName: node linkType: hard +"jsprim@npm:^2.0.2": + version: 2.0.2 + resolution: "jsprim@npm:2.0.2" + dependencies: + assert-plus: "npm:1.0.0" + extsprintf: "npm:1.3.0" + json-schema: "npm:0.4.0" + verror: "npm:1.10.0" + checksum: 2bbd98cec78f380ece961383f0583970efabeffd61b71b80125e45e2e84b28e1e0b6286f0c64e2ed15edda2a5b91618ecca83a359b0295c385110fb47e131aca + languageName: node + linkType: hard + "jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.2": version: 3.3.2 resolution: "jsx-ast-utils@npm:3.3.2" @@ -18745,6 +20490,22 @@ __metadata: languageName: node linkType: hard +"junk@npm:^4.0.0": + version: 4.0.0 + resolution: "junk@npm:4.0.0" + checksum: ef6def8cc4f0ba0a25222a83d9fccd3ea3b9abea72dad106914be9e2856c8f79d0033aca40a42aac1b06ce24deb0dd0233af7313cf970eeb672dcfe7243a9a86 + languageName: node + linkType: hard + +"keyv@npm:^3.0.0": + version: 3.1.0 + resolution: "keyv@npm:3.1.0" + dependencies: + json-buffer: "npm:3.0.0" + checksum: a820d1923a508008cf84894f263d9c29b08d1692f54973894eca647f027288b2fb140605b54df73537d1229f7c3d683eea7b00981d4b0b5346a0ea8a30a2d910 + languageName: node + linkType: hard + "keyv@npm:^4.0.0": version: 4.0.4 resolution: "keyv@npm:4.0.4" @@ -18863,6 +20624,22 @@ __metadata: languageName: node linkType: hard +"latest-version@npm:^5.1.0": + version: 5.1.0 + resolution: "latest-version@npm:5.1.0" + dependencies: + package-json: "npm:^6.3.0" + checksum: 212765a6cc0f19dd0e56957046edc5df33bce7eadf3fcdb0aef079f15c838a645a7ea09064fc9be8a43888a91dfa90f9dfd9adeb658c2635cce70cc9a7c4991a + languageName: node + linkType: hard + +"lazy-ass@npm:1.6.0, lazy-ass@npm:^1.6.0": + version: 1.6.0 + resolution: "lazy-ass@npm:1.6.0" + checksum: 6c3d51e093fd4b23fe2500ce9feea31570beb17bade591e183dc01334e4755957eeb543a6a3322082ba60abb6cb882646f62cb58e40ffd697dca1ac8849a2f4e + languageName: node + linkType: hard + "lazy-universal-dotenv@npm:^3.0.1": version: 3.0.1 resolution: "lazy-universal-dotenv@npm:3.0.1" @@ -18926,6 +20703,13 @@ __metadata: languageName: node linkType: hard +"line-reader@npm:^0.2.4": + version: 0.2.4 + resolution: "line-reader@npm:0.2.4" + checksum: 5ee702e49a142afc3ec180b430a9596fcd0fdf57ea22e294a55a90b3da4299ac626f86846156025507c1d664cac6fd03869f7123e275fffbdb883e7263505bc2 + languageName: node + linkType: hard + "lines-and-columns@npm:^1.1.6": version: 1.1.6 resolution: "lines-and-columns@npm:1.1.6" @@ -18956,6 +20740,27 @@ __metadata: languageName: node linkType: hard +"listr2@npm:^3.8.3": + version: 3.14.0 + resolution: "listr2@npm:3.14.0" + dependencies: + cli-truncate: "npm:^2.1.0" + colorette: "npm:^2.0.16" + log-update: "npm:^4.0.0" + p-map: "npm:^4.0.0" + rfdc: "npm:^1.3.0" + rxjs: "npm:^7.5.1" + through: "npm:^2.3.8" + wrap-ansi: "npm:^7.0.0" + peerDependencies: + enquirer: ">= 2.3.0 < 3" + peerDependenciesMeta: + enquirer: + optional: true + checksum: ef7cf07d2569ce41744738be2370386db617894df0d09109d60aba442ff582c31faa88b46465e497b17bf5d66d79baa8035f394f74979e545f503df9a057bb74 + languageName: node + linkType: hard + "listr2@npm:^4.0.5": version: 4.0.5 resolution: "listr2@npm:4.0.5" @@ -19002,6 +20807,18 @@ __metadata: languageName: node linkType: hard +"load-json-file@npm:^6.2.0": + version: 6.2.0 + resolution: "load-json-file@npm:6.2.0" + dependencies: + graceful-fs: "npm:^4.1.15" + parse-json: "npm:^5.0.0" + strip-bom: "npm:^4.0.0" + type-fest: "npm:^0.6.0" + checksum: d6d8ab4aaacf650c4effc2125819d6f8db8006b69c5a73c74ef47b42aeff656729fd6147afa085fe25068e7ad5cd0ac8a918d471edd57c01d1a90fff24d21ca2 + languageName: node + linkType: hard + "load-tsconfig@npm:^0.2.0": version: 0.2.3 resolution: "load-tsconfig@npm:0.2.3" @@ -19209,6 +21026,13 @@ __metadata: languageName: node linkType: hard +"lodash.once@npm:^4.1.1": + version: 4.1.1 + resolution: "lodash.once@npm:4.1.1" + checksum: 210c440af77b8f34fa8c7a559b4e7de9b9baef1c9d2fc1e9eae1440034cf0030eca115e81abf164ce6039e4872e0b4b5ade7729394e93aa7545094fc46ea2a29 + languageName: node + linkType: hard + "lodash.set@npm:4.3.2": version: 4.3.2 resolution: "lodash.set@npm:4.3.2" @@ -19265,14 +21089,23 @@ __metadata: languageName: node linkType: hard -"lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:~4.17.0": +"lodash@npm:^4.11.2, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.20, lodash@npm:^4.17.21, lodash@npm:^4.17.4, lodash@npm:~4.17.0": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: 3ac18e92108d68f88429fcddee609e42cf2b653583d9bac22308815a4cd6b185b89a0ad0d9b0c670c371d9d6b61571a98fee6b36e1db14e52766ca253ed9cba0 languageName: node linkType: hard -"log-symbols@npm:^4.1.0": +"log-symbols@npm:^3.0.0": + version: 3.0.0 + resolution: "log-symbols@npm:3.0.0" + dependencies: + chalk: "npm:^2.4.2" + checksum: aaaf759780d9e8ce4ae768a3d1715f262266078e730ea46bd3b9e462af6793f4b2738a74b1631dcdfab0d373e49dbc020b249a0463f9affd793e4e5167026078 + languageName: node + linkType: hard + +"log-symbols@npm:^4.0.0, log-symbols@npm:^4.1.0": version: 4.1.0 resolution: "log-symbols@npm:4.1.0" dependencies: @@ -19362,6 +21195,13 @@ __metadata: languageName: node linkType: hard +"lowercase-keys@npm:^1.0.0, lowercase-keys@npm:^1.0.1": + version: 1.0.1 + resolution: "lowercase-keys@npm:1.0.1" + checksum: 10981eeb3dbf143c09206bff4a4e92524437872840375a69c319b4a450390d6622cc7d5af3ef61e2e0ce229361514da2084cdf19c63ad24d2ab576e1c9d3c34f + languageName: node + linkType: hard + "lowercase-keys@npm:^2.0.0": version: 2.0.0 resolution: "lowercase-keys@npm:2.0.0" @@ -19523,7 +21363,7 @@ __metadata: languageName: node linkType: hard -"map-obj@npm:^4.0.0": +"map-obj@npm:^4.0.0, map-obj@npm:^4.1.0": version: 4.3.0 resolution: "map-obj@npm:4.3.0" checksum: f87dd958d20a51488dfc3c933c5a64bad4e33053a05bc2c4c431a99e9cb1a5a6096a39cf2f7f5235c6a4540f534d3ff2ecf63664718b8e28f9da7026deda0833 @@ -19537,6 +21377,13 @@ __metadata: languageName: node linkType: hard +"map-stream@npm:~0.1.0": + version: 0.1.0 + resolution: "map-stream@npm:0.1.0" + checksum: 3eb6020cbbd07226602f849eb95e613087bc1c17a00018f28f1a1f605bc53374fe0554ecac9a841e7a33fc1fd55399a0a01308d90ec73f0693dcae2923969385 + languageName: node + linkType: hard + "map-visit@npm:^1.0.0": version: 1.0.0 resolution: "map-visit@npm:1.0.0" @@ -19590,6 +21437,17 @@ __metadata: languageName: node linkType: hard +"md5@npm:^2.3.0": + version: 2.3.0 + resolution: "md5@npm:2.3.0" + dependencies: + charenc: "npm:0.0.2" + crypt: "npm:0.0.2" + is-buffer: "npm:~1.1.6" + checksum: 9c439bada6744e9f1dd3f3fe4bf996b4382b49acb193f2014c30887213ba9e68a8370bcd077a211ee843310fb9cc5ba5463c0c3a53408c4760ba10e894f19276 + languageName: node + linkType: hard + "mdast-squeeze-paragraphs@npm:^4.0.0": version: 4.0.0 resolution: "mdast-squeeze-paragraphs@npm:4.0.0" @@ -19834,6 +21692,26 @@ __metadata: languageName: node linkType: hard +"meow@npm:^10.1.2": + version: 10.1.5 + resolution: "meow@npm:10.1.5" + dependencies: + "@types/minimist": "npm:^1.2.2" + camelcase-keys: "npm:^7.0.0" + decamelize: "npm:^5.0.0" + decamelize-keys: "npm:^1.1.0" + hard-rejection: "npm:^2.1.0" + minimist-options: "npm:4.1.0" + normalize-package-data: "npm:^3.0.2" + read-pkg-up: "npm:^8.0.0" + redent: "npm:^4.0.0" + trim-newlines: "npm:^4.0.2" + type-fest: "npm:^1.2.2" + yargs-parser: "npm:^20.2.9" + checksum: 691611773245fea2109b89b36f0ceeb6c7e504a396ae8d2f5431f2a4e206e6d3f26e1638ac3d3cf1198adde92ef9d5108eb8c156aa08d1b3ca25c28eba11a0f1 + languageName: node + linkType: hard + "meow@npm:^3.1.0": version: 3.7.0 resolution: "meow@npm:3.7.0" @@ -20410,7 +22288,7 @@ __metadata: languageName: node linkType: hard -"mime-types@npm:^2.1.12, mime-types@npm:^2.1.27, mime-types@npm:^2.1.30, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34": +"mime-types@npm:^2.1.12, mime-types@npm:^2.1.27, mime-types@npm:^2.1.30, mime-types@npm:~2.1.19, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34": version: 2.1.35 resolution: "mime-types@npm:2.1.35" dependencies: @@ -20437,6 +22315,15 @@ __metadata: languageName: node linkType: hard +"mime@npm:^3.0.0": + version: 3.0.0 + resolution: "mime@npm:3.0.0" + bin: + mime: cli.js + checksum: b00613ec79e1f14586c970b6651afca77947f972eca6086ccb614c2b7a1a899d0ec38c6f4418370ecb9d0cebeb4ad300999b6b7f2dcbeaf40f9e0d55874b6c81 + languageName: node + linkType: hard + "mimic-fn@npm:^2.1.0": version: 2.1.0 resolution: "mimic-fn@npm:2.1.0" @@ -20458,7 +22345,7 @@ __metadata: languageName: node linkType: hard -"mimic-response@npm:^1.0.0": +"mimic-response@npm:^1.0.0, mimic-response@npm:^1.0.1": version: 1.0.1 resolution: "mimic-response@npm:1.0.1" checksum: 33f59926ca219581d72d6138f731c0ab09459c83dc01cce629b045cf0f0fc86d2080c0d776f2112dab7c4ef585c1104a3df0b2b8ed31fc6f4d261656f3543d4e @@ -20481,7 +22368,7 @@ __metadata: languageName: node linkType: hard -"min-indent@npm:^1.0.0": +"min-indent@npm:^1.0.0, min-indent@npm:^1.0.1": version: 1.0.1 resolution: "min-indent@npm:1.0.1" checksum: fdf068694f2ea0dff7b228fe67e2da7f08adba57b4165e0255a4db9db0ee9b38db5fe70b986422cc9ae0aed770b36a33d3f4a23a9c1488fe5b38d5fb19a594e7 @@ -20749,7 +22636,7 @@ __metadata: languageName: node linkType: hard -"mute-stream@npm:0.0.8": +"mute-stream@npm:0.0.8, mute-stream@npm:~0.0.4": version: 0.0.8 resolution: "mute-stream@npm:0.0.8" checksum: 93cf7e69722c5c56365fb005bfcb31aa3bbcaeb96098223e8893983a65bd6f025bfb44916a7efb658559e59da2d351c50a8441180e5451443c0e8e5d99a35e1b @@ -20768,11 +22655,11 @@ __metadata: linkType: hard "nan@npm:^2.12.1": - version: 2.15.0 - resolution: "nan@npm:2.15.0" + version: 2.17.0 + resolution: "nan@npm:2.17.0" dependencies: node-gyp: "npm:latest" - checksum: 8e0cfc248c39f5e81af8d3654b9765a2f03bd4c634bf13f9d7121a814756e51022bc52b93787176b4a6b4a9217c00ed939221e6130586b13a880e423607067ce + checksum: d424a730ee926fd928545c29ba19609bc1af03f8210c4465c825ba87070b83c546da2964a14d6acdacca847798184f48d5b8585f061dcb59459b300f2aff09c8 languageName: node linkType: hard @@ -20896,23 +22783,69 @@ __metadata: languageName: node linkType: hard -"next-i18next@npm:12.1.0": - version: 12.1.0 - resolution: "next-i18next@npm:12.1.0" - dependencies: +"next-i18next@workspace:*, next-i18next@workspace:packages/next-i18next": + version: 0.0.0-use.local + resolution: "next-i18next@workspace:packages/next-i18next" + dependencies: + "@babel/cli": "npm:7.18.10" + "@babel/core": "npm:7.18.10" + "@babel/plugin-proposal-class-properties": "npm:7.18.6" + "@babel/plugin-transform-runtime": "npm:7.18.10" + "@babel/preset-env": "npm:7.18.10" + "@babel/preset-react": "npm:7.18.6" + "@babel/preset-typescript": "npm:7.18.6" "@babel/runtime": "npm:^7.18.9" + "@size-limit/file": "npm:^8.1.0" + "@size-limit/webpack": "npm:^8.1.0" + "@size-limit/webpack-why": "npm:^8.1.0" + "@testing-library/react": "npm:^13.3.0" "@types/hoist-non-react-statics": "npm:^3.3.1" + "@types/jest": "npm:^29.2.2" + "@types/node": "npm:^18.7.8" + "@types/react": "npm:^18.0.17" + "@types/react-dom": "npm:^18.0.6" + "@types/testing-library__cypress": "npm:^5.0.9" + "@typescript-eslint/eslint-plugin": "npm:^5.33.1" + "@typescript-eslint/parser": "npm:^5.33.1" + all-contributors-cli: "npm:^6.20.0" + babel-core: "npm:7.0.0-bridge.0" + babel-plugin-add-module-exports: "npm:1.0.4" + babel-plugin-transform-async-to-generator: "npm:6.24.1" core-js: "npm:^3" + cpy-cli: "npm:^4.2.0" + cypress: "npm:^11.0.1" + es-check: "npm:^7.0.1" + eslint: "npm:^8.22.0" + eslint-plugin-cypress: "npm:^2.12.1" + eslint-plugin-import: "npm:^2.26.0" + eslint-plugin-jest: "npm:^27.1.4" + eslint-plugin-prefer-arrow: "npm:^1.2.3" + eslint-plugin-react: "npm:^7.30.1" + eslint-plugin-typescript-sort-keys: "npm:^2.1.0" + gh-release: "npm:6.0.4" hoist-non-react-statics: "npm:^3.3.2" - i18next: "npm:^21.9.1" - i18next-fs-backend: "npm:^1.1.5" - react-i18next: "npm:^11.18.4" - peerDependencies: - next: ">= 10.0.0" - react: ">= 16.8.0" - checksum: 560e1e0d938afd633271eb82f3f3b6cedc70eab742cc49d308e7aaaf91fe58ae7753e68452e7179c5f23fb7cdf70935dbe952505eede490f83526937def80a74 - languageName: node - linkType: hard + husky: "npm:^3.0.0" + i18next: "npm:^22.0.3" + i18next-fs-backend: "npm:^2.0.0" + jest: "npm:^29.3.1" + jest-environment-jsdom: "npm:^29.3.1" + next: "npm:^13.0.2" + npm-run-all: "npm:^4.1.5" + react: "npm:^18.2.0" + react-dom: "npm:^18.2.0" + react-i18next: "npm:^12.0.0" + rimraf: "npm:^3.0.2" + size-limit: "npm:^8.1.0" + start-server-and-test: "npm:^1.14.0" + typescript: "npm:^4.7.4" + webpack: "npm:^5.74.0" + peerDependencies: + i18next: ^22.0.3 + next: ">= 12.0.0" + react: ">= 17.0.2" + react-i18next: ^12.0.0 + languageName: unknown + linkType: soft "next-secure-headers@npm:2.2.0": version: 2.2.0 @@ -20941,7 +22874,7 @@ __metadata: languageName: node linkType: hard -"next@npm:13.0.2": +"next@npm:13.0.2, next@npm:^13.0.2": version: 13.0.2 resolution: "next@npm:13.0.2" dependencies: @@ -21077,7 +23010,7 @@ __metadata: get-tsconfig: "npm:4.2.0" graphql: "npm:16.6.0" happy-dom: "npm:7.6.6" - i18next: "npm:21.10.0" + i18next: "npm:22.0.4" jest: "npm:29.2.2" jest-css-modules-transform: "npm:4.4.2" jose: "npm:4.10.4" @@ -21085,7 +23018,7 @@ __metadata: next: "npm:13.0.2" next-auth: "npm:4.16.2" next-connect: "npm:0.13.0" - next-i18next: "npm:12.1.0" + next-i18next: "workspace:*" next-secure-headers: "npm:2.2.0" next-seo: "npm:5.14.0" next-transpile-modules: "npm:10.0.0" @@ -21098,7 +23031,7 @@ __metadata: react: "npm:18.2.0" react-dom: "npm:18.2.0" react-hook-form: "npm:7.39.1" - react-i18next: "npm:11.18.6" + react-i18next: "npm:12.0.0" rimraf: "npm:3.0.2" rooks: "npm:7.4.1" sass: "npm:1.56.0" @@ -21204,7 +23137,7 @@ __metadata: languageName: node linkType: hard -"node-fetch@npm:2.6.7, node-fetch@npm:^2.5.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.7, node-fetch@npm:^2.x.x": +"node-fetch@npm:2.6.7, node-fetch@npm:^2.5.0, node-fetch@npm:^2.6.0, node-fetch@npm:^2.6.1, node-fetch@npm:^2.6.7, node-fetch@npm:^2.x.x": version: 2.6.7 resolution: "node-fetch@npm:2.6.7" dependencies: @@ -21306,7 +23239,7 @@ __metadata: languageName: node linkType: hard -"normalize-package-data@npm:^3.0.0": +"normalize-package-data@npm:^3.0.0, normalize-package-data@npm:^3.0.2": version: 3.0.3 resolution: "normalize-package-data@npm:3.0.3" dependencies: @@ -21341,6 +23274,13 @@ __metadata: languageName: node linkType: hard +"normalize-url@npm:^4.1.0": + version: 4.5.1 + resolution: "normalize-url@npm:4.5.1" + checksum: 4ab5a90e195941f1c4bb574538858f85d017285b67d05269a35fe0c5c9f217705d476baccc7f6b2599c3156279f9797a00450617da0409b9157dfaed04dbe4fc + languageName: node + linkType: hard + "normalize-url@npm:^6.0.1": version: 6.1.0 resolution: "normalize-url@npm:6.1.0" @@ -21348,7 +23288,7 @@ __metadata: languageName: node linkType: hard -"npm-run-all@npm:4.1.5": +"npm-run-all@npm:4.1.5, npm-run-all@npm:^4.1.5": version: 4.1.5 resolution: "npm-run-all@npm:4.1.5" dependencies: @@ -21378,7 +23318,7 @@ __metadata: languageName: node linkType: hard -"npm-run-path@npm:^4.0.1": +"npm-run-path@npm:^4.0.0, npm-run-path@npm:^4.0.1": version: 4.0.1 resolution: "npm-run-path@npm:4.0.1" dependencies: @@ -21533,7 +23473,7 @@ __metadata: languageName: node linkType: hard -"object.assign@npm:^4.1.0, object.assign@npm:^4.1.2": +"object.assign@npm:^4.1.2": version: 4.1.2 resolution: "object.assign@npm:4.1.2" dependencies: @@ -21711,6 +23651,15 @@ __metadata: languageName: node linkType: hard +"opencollective-postinstall@npm:^2.0.2": + version: 2.0.3 + resolution: "opencollective-postinstall@npm:2.0.3" + bin: + opencollective-postinstall: index.js + checksum: 7a9ec632fe8c046351bbe14add77f1d00e459a5dac2f1ef99126d3170faac5e35b1c16ea41d88e9488c8e0ac4d4378f03cc19b03d8ec976303105541cc793b06 + languageName: node + linkType: hard + "opener@npm:^1.5.2": version: 1.5.2 resolution: "opener@npm:1.5.2" @@ -21760,6 +23709,22 @@ __metadata: languageName: node linkType: hard +"ora@npm:^4.0.5": + version: 4.1.1 + resolution: "ora@npm:4.1.1" + dependencies: + chalk: "npm:^3.0.0" + cli-cursor: "npm:^3.1.0" + cli-spinners: "npm:^2.2.0" + is-interactive: "npm:^1.0.0" + log-symbols: "npm:^3.0.0" + mute-stream: "npm:0.0.8" + strip-ansi: "npm:^6.0.0" + wcwidth: "npm:^1.0.1" + checksum: a6e392774dbf04bbf699e32651c42cc22d28ed4d8d1e0de7c7baad9c7a78382ad90b021f843b63317e5cdc9270c3c5d1712c9f96324d4dfcfcea2f7e98cd635d + languageName: node + linkType: hard + "ora@npm:^5.4.1": version: 5.4.1 resolution: "ora@npm:5.4.1" @@ -21798,6 +23763,13 @@ __metadata: languageName: node linkType: hard +"ospath@npm:^1.2.2": + version: 1.2.2 + resolution: "ospath@npm:1.2.2" + checksum: 7af2d3589331dc338e74f5099cc0023083b11f55b501db9f1ebaf5d480966b18726525d562dcf702d56fa5b4cf072a7a84e887f9642d382cf33353798b3685c1 + languageName: node + linkType: hard + "outdent@npm:^0.5.0": version: 0.5.0 resolution: "outdent@npm:0.5.0" @@ -21814,6 +23786,13 @@ __metadata: languageName: node linkType: hard +"p-cancelable@npm:^1.0.0": + version: 1.1.0 + resolution: "p-cancelable@npm:1.1.0" + checksum: 3644196b4cdbcc68ca791a4a9f3a22800dcfce92aa5d26804642e442a107796fa45b27591bbcbe16613eabdde59b97bbeecc52816354187c1902bab4912c3f5c + languageName: node + linkType: hard + "p-cancelable@npm:^2.0.0": version: 2.1.1 resolution: "p-cancelable@npm:2.1.1" @@ -21846,6 +23825,15 @@ __metadata: languageName: node linkType: hard +"p-filter@npm:^3.0.0": + version: 3.0.0 + resolution: "p-filter@npm:3.0.0" + dependencies: + p-map: "npm:^5.1.0" + checksum: 9f14a355d2bffc12e773047bf35304dc5314f8676f3c1b19e39365966df0e5ba195338af3fe968925d2163dface4cd7bc3fbb435cee951d4b7973504392e76c6 + languageName: node + linkType: hard + "p-finally@npm:^1.0.0": version: 1.0.0 resolution: "p-finally@npm:1.0.0" @@ -21941,6 +23929,15 @@ __metadata: languageName: node linkType: hard +"p-map@npm:^5.1.0, p-map@npm:^5.3.0": + version: 5.5.0 + resolution: "p-map@npm:5.5.0" + dependencies: + aggregate-error: "npm:^4.0.0" + checksum: 671f7c4885986caf8157ddbf5a4dca5ae51d9448445e42e148bfe156aca8925315bee300c529618300b2a1b82f238c0487e69c483425203896751d04f530d649 + languageName: node + linkType: hard + "p-queue@npm:^6.6.2": version: 6.6.2 resolution: "p-queue@npm:6.6.2" @@ -22002,6 +23999,18 @@ __metadata: languageName: node linkType: hard +"package-json@npm:^6.3.0": + version: 6.5.0 + resolution: "package-json@npm:6.5.0" + dependencies: + got: "npm:^9.6.0" + registry-auth-token: "npm:^4.0.0" + registry-url: "npm:^5.0.0" + semver: "npm:^6.2.0" + checksum: e98b44a5bee306aa1834eca25555b3e59a3e1eb5e0ce0b1a1b33cb908e1feb0184b4de9dcd8903c59e9c4c4ed4e5f9c4bd59691306417ae8d9d016a68a10b449 + languageName: node + linkType: hard + "pako@npm:~0.2.0": version: 0.2.9 resolution: "pako@npm:0.2.9" @@ -22331,6 +24340,15 @@ __metadata: languageName: node linkType: hard +"pause-stream@npm:0.0.11": + version: 0.0.11 + resolution: "pause-stream@npm:0.0.11" + dependencies: + through: "npm:~2.3" + checksum: b6248f597ca5d0156b2e11f60fca7d163a05866bf742ad27ec0eaa7a8ee4aa4284d71a6544a70000695e20979351e430c20a441e6c73882e786ac6ca52490c7b + languageName: node + linkType: hard + "pbkdf2@npm:^3.0.3": version: 3.1.2 resolution: "pbkdf2@npm:3.1.2" @@ -22355,6 +24373,22 @@ __metadata: languageName: node linkType: hard +"pegjs@npm:^0.10.0": + version: 0.10.0 + resolution: "pegjs@npm:0.10.0" + bin: + pegjs: bin/pegjs + checksum: bd7706eb2ffa1a8900ecef8c7bec9488d53180ccf601c49ac61afaa4b4818053196ffbccef1f5d0bc6ad96a5aa77f8527f480de118ccc94b53b468dc9ec16c67 + languageName: node + linkType: hard + +"pend@npm:~1.2.0": + version: 1.2.0 + resolution: "pend@npm:1.2.0" + checksum: 623fcbe4b1536d3fe615723cef6e5d937787b44963ee0318efc77534de3224b3b8fa126785ae42dc01459f09ade3d42eac63f68850dd00a1105189493f2227f3 + languageName: node + linkType: hard + "performance-now@npm:^2.1.0": version: 2.1.0 resolution: "performance-now@npm:2.1.0" @@ -22411,7 +24445,7 @@ __metadata: languageName: node linkType: hard -"pify@npm:^2.0.0, pify@npm:^2.3.0": +"pify@npm:^2.0.0, pify@npm:^2.2.0, pify@npm:^2.3.0": version: 2.3.0 resolution: "pify@npm:2.3.0" checksum: 9a3b2aa18d26ed79db45dee98f52675750ad11ced96b45b4884f4d4368217046137e35481146bfc94698f5709fd838d86f1d2d80d958f5f88767e426d29cbc66 @@ -22498,6 +24532,15 @@ __metadata: languageName: node linkType: hard +"please-upgrade-node@npm:^3.2.0": + version: 3.2.0 + resolution: "please-upgrade-node@npm:3.2.0" + dependencies: + semver-compare: "npm:^1.0.0" + checksum: 89a9eaee9e3fbde07cac98f9cd71c6737d99366fd7603ad3b9abb8dffae03b3941ac17d7009ce1e2503950e1c1811f514194f848cc921d3d8b933eeae92930d1 + languageName: node + linkType: hard + "pnp-webpack-plugin@npm:1.6.4": version: 1.6.4 resolution: "pnp-webpack-plugin@npm:1.6.4" @@ -23530,6 +25573,13 @@ __metadata: languageName: node linkType: hard +"prepend-http@npm:^2.0.0": + version: 2.0.0 + resolution: "prepend-http@npm:2.0.0" + checksum: c0e029ce18cb1729846c21b3d41d9a366382a386fd1cd07b498657926ee5a4c1f528c3037229069c0b6a8026e0269724d4813fa89878e28a4cd907b3adc0afa7 + languageName: node + linkType: hard + "prettier-linter-helpers@npm:^1.0.0": version: 1.0.0 resolution: "prettier-linter-helpers@npm:1.0.0" @@ -23557,7 +25607,7 @@ __metadata: languageName: node linkType: hard -"pretty-bytes@npm:5.6.0, pretty-bytes@npm:^5.4.1": +"pretty-bytes@npm:5.6.0, pretty-bytes@npm:^5.4.1, pretty-bytes@npm:^5.6.0": version: 5.6.0 resolution: "pretty-bytes@npm:5.6.0" checksum: daaf20c7847618fd7935051ffa3b6a6583048d09f0b49a31db66fdb792a77d23f5ae554d10ff1136c9f0bc76c9a4a110647955a16139be3d3ad57072dc9274b6 @@ -23587,9 +25637,21 @@ __metadata: version: 4.0.0 resolution: "pretty-error@npm:4.0.0" dependencies: - lodash: "npm:^4.17.20" - renderkid: "npm:^3.0.0" - checksum: f4e4d4a093e47710d64edb914052f75263fc6fdad2433ec9a0208b31f161b719c76caf81ab08c5bb29d520d57387fc49253f860320c4eac3d5cd765bf03a82c2 + lodash: "npm:^4.17.20" + renderkid: "npm:^3.0.0" + checksum: f4e4d4a093e47710d64edb914052f75263fc6fdad2433ec9a0208b31f161b719c76caf81ab08c5bb29d520d57387fc49253f860320c4eac3d5cd765bf03a82c2 + languageName: node + linkType: hard + +"pretty-format@npm:^26.6.2": + version: 26.6.2 + resolution: "pretty-format@npm:26.6.2" + dependencies: + "@jest/types": "npm:^26.6.2" + ansi-regex: "npm:^5.0.0" + ansi-styles: "npm:^4.0.0" + react-is: "npm:^17.0.1" + checksum: 2363cfda6338390c4bd3026c277342ac214bdd18c99d1afd649e7867e8547763198c97265d81b689c3b98dffcadcca315453bbd5ba52d4b15024c8a694c1638d languageName: node linkType: hard @@ -23604,14 +25666,14 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^29.0.0, pretty-format@npm:^29.2.1": - version: 29.2.1 - resolution: "pretty-format@npm:29.2.1" +"pretty-format@npm:^29.0.0, pretty-format@npm:^29.3.1": + version: 29.3.1 + resolution: "pretty-format@npm:29.3.1" dependencies: "@jest/schemas": "npm:^29.0.0" ansi-styles: "npm:^5.0.0" react-is: "npm:^18.0.0" - checksum: 10ed9c96bab2c4b8ac1e1329e504550e6410d7b0a9edfd78541587ee792ee69d8b6b65b397753607b302a13b5c522fcde187cba906b04d75275e8366b82b8104 + checksum: 503343a44ed74584c2e89fe3be6142636477b515179484b25ad3fe0b44f35d8a189cff3b002759d17c9751b1510dbbb4caa3e91ef3432c302de1c8aa78cde0f8 languageName: node linkType: hard @@ -23678,6 +25740,16 @@ __metadata: languageName: node linkType: hard +"progress-stream@npm:^2.0.0": + version: 2.0.0 + resolution: "progress-stream@npm:2.0.0" + dependencies: + speedometer: "npm:~1.0.0" + through2: "npm:~2.0.3" + checksum: ce9dfab7ab6a19185eba7d0ed932ef5cecf4dbf6c230061a44031cb321f90605a23028ed2785357b6b088149d3a62217d237bfeafb2b42c8c2b7ac9c5dc8d264 + languageName: node + linkType: hard + "progress@npm:^2.0.3": version: 2.0.3 resolution: "progress@npm:2.0.3" @@ -23815,6 +25887,13 @@ __metadata: languageName: node linkType: hard +"proxy-from-env@npm:1.0.0": + version: 1.0.0 + resolution: "proxy-from-env@npm:1.0.0" + checksum: d0ecd7fab1f1f556514574efbb3ee03d2a31913a61f24b323280212d73830f4c7fa16b93248168b4c3932b302b48cad46c0a4088831ea5423fb9d390493d15d3 + languageName: node + linkType: hard + "proxy-from-env@npm:^1.0.0, proxy-from-env@npm:^1.1.0": version: 1.1.0 resolution: "proxy-from-env@npm:1.1.0" @@ -23829,6 +25908,17 @@ __metadata: languageName: node linkType: hard +"ps-tree@npm:1.2.0": + version: 1.2.0 + resolution: "ps-tree@npm:1.2.0" + dependencies: + event-stream: "npm:=3.3.4" + bin: + ps-tree: ./bin/ps-tree.js + checksum: 8bf544d58c87e9e628bce26ee6fb8746a290ee25948dda6c037da7d90dd4a99f53ce60a5290521e2e2271947fd42171087bdad718febe119932105552be18864 + languageName: node + linkType: hard + "pseudomap@npm:^1.0.2": version: 1.0.2 resolution: "pseudomap@npm:1.0.2" @@ -23836,10 +25926,10 @@ __metadata: languageName: node linkType: hard -"psl@npm:^1.1.33": - version: 1.8.0 - resolution: "psl@npm:1.8.0" - checksum: cebdf3dcaf1b05ea817ea422e4ea91973c0c54a9deb12112052273c87139f414eeb349dd80aa16cbc969cb5604329dc1e3aa3c8d5748de3e3bd2e1b7debd5c89 +"psl@npm:^1.1.28, psl@npm:^1.1.33": + version: 1.9.0 + resolution: "psl@npm:1.9.0" + checksum: cf1d67518a183700bcbccded8ba7f4340bc5c4dbd81229f1460c656d065b0b653142ce1c5379be32bf170b47c9eecdb499e8a3b15eb472c9462825da55d7f512 languageName: node linkType: hard @@ -23888,6 +25978,17 @@ __metadata: languageName: node linkType: hard +"pumpify@npm:^2.0.1": + version: 2.0.1 + resolution: "pumpify@npm:2.0.1" + dependencies: + duplexify: "npm:^4.1.1" + inherits: "npm:^2.0.3" + pump: "npm:^3.0.0" + checksum: 360cc275eb4ebfb96865b4fa05c9d30834b2e83864787dd1b65c700a8e7e409adeed14540b4584985a1afa2009031f526c73bc03a273c7ad5f538a9d66ed98f4 + languageName: node + linkType: hard + "punycode@npm:1.3.2": version: 1.3.2 resolution: "punycode@npm:1.3.2" @@ -23909,6 +26010,15 @@ __metadata: languageName: node linkType: hard +"pupa@npm:^2.1.1": + version: 2.1.1 + resolution: "pupa@npm:2.1.1" + dependencies: + escape-goat: "npm:^2.0.0" + checksum: 97474d4ed8408551a613b8998b0e4ca281877dc9a9c781cfadee22b2c7497b3f5a49b9192c2c4a71899d1e7d14bee3d1259fec548e776312077cb22849b16209 + languageName: node + linkType: hard + "pvtsutils@npm:^1.3.2": version: 1.3.2 resolution: "pvtsutils@npm:1.3.2" @@ -23950,6 +26060,13 @@ __metadata: languageName: node linkType: hard +"qs@npm:~6.5.2": + version: 6.5.3 + resolution: "qs@npm:6.5.3" + checksum: 6a4be44c9bd3baef6db5d50905a5d305dce4aa11317c27c7599edee3aff835c1d96e582ff5b9205bcb07e8381d9e92de33570d459415c91d243ea926e27b0002 + languageName: node + linkType: hard + "querystring-es3@npm:^0.2.0": version: 0.2.1 resolution: "querystring-es3@npm:0.2.1" @@ -24058,7 +26175,7 @@ __metadata: languageName: node linkType: hard -"rc@npm:^1.2.7": +"rc@npm:1.2.8, rc@npm:^1.2.7, rc@npm:^1.2.8": version: 1.2.8 resolution: "rc@npm:1.2.8" dependencies: @@ -24101,7 +26218,7 @@ __metadata: languageName: node linkType: hard -"react-dom@npm:18.2.0": +"react-dom@npm:18.2.0, react-dom@npm:^18.2.0": version: 18.2.0 resolution: "react-dom@npm:18.2.0" dependencies: @@ -24147,9 +26264,9 @@ __metadata: languageName: node linkType: hard -"react-i18next@npm:11.18.6, react-i18next@npm:^11.18.4": - version: 11.18.6 - resolution: "react-i18next@npm:11.18.6" +"react-i18next@npm:12.0.0, react-i18next@npm:^12.0.0": + version: 12.0.0 + resolution: "react-i18next@npm:12.0.0" dependencies: "@babel/runtime": "npm:^7.14.5" html-parse-stringify: "npm:^3.0.1" @@ -24161,7 +26278,7 @@ __metadata: optional: true react-native: optional: true - checksum: 068a6d20e1e2a41a2fad2f47a31039695c84445eebf4687ac31bb985c4204fcbc7d862ae6d89bfee69e7325b730f49ad42f193f83102363a83c3f6ed14753079 + checksum: 1a33bff70a903b8278bf64f8a9c41268084e4c2f7fa538e80d9a3de7b57c313f28080f5f2546416a525ea28902efe84390c362b8008c606f327a54188d6cba59 languageName: node linkType: hard @@ -24290,7 +26407,7 @@ __metadata: languageName: node linkType: hard -"react@npm:18.2.0": +"react@npm:18.2.0, react@npm:^18.2.0": version: 18.2.0 resolution: "react@npm:18.2.0" dependencies: @@ -24329,6 +26446,17 @@ __metadata: languageName: node linkType: hard +"read-pkg-up@npm:^8.0.0": + version: 8.0.0 + resolution: "read-pkg-up@npm:8.0.0" + dependencies: + find-up: "npm:^5.0.0" + read-pkg: "npm:^6.0.0" + type-fest: "npm:^1.0.1" + checksum: c5180c8d3ebaa448e0b085c5bf68596ea607f7bb1d98aa5d2ca35b9c27b3b917a69b482fbcd9a307ea793ff21a22f49d69d1e0f5c506f6d25b7034c203ca7f44 + languageName: node + linkType: hard + "read-pkg@npm:^1.0.0": version: 1.1.0 resolution: "read-pkg@npm:1.1.0" @@ -24363,6 +26491,18 @@ __metadata: languageName: node linkType: hard +"read-pkg@npm:^6.0.0": + version: 6.0.0 + resolution: "read-pkg@npm:6.0.0" + dependencies: + "@types/normalize-package-data": "npm:^2.4.0" + normalize-package-data: "npm:^3.0.2" + parse-json: "npm:^5.2.0" + type-fest: "npm:^1.0.1" + checksum: 7f7d15d45ff768d5f0dec61a49f1448d7ea349624582a0c6b0731645c378e2451ed1eed88e1229e7ff5415f7d8929a2b6b3d83ea375edf4d318953acc360cc80 + languageName: node + linkType: hard + "read-yaml-file@npm:^1.1.0": version: 1.1.0 resolution: "read-yaml-file@npm:1.1.0" @@ -24375,6 +26515,15 @@ __metadata: languageName: node linkType: hard +"read@npm:^1.0.7": + version: 1.0.7 + resolution: "read@npm:1.0.7" + dependencies: + mute-stream: "npm:~0.0.4" + checksum: 86333b4e5a50e58be12d3b88772539737596a6298b9cbbac5c564b2d3b82ca6dcd9cebeb343180f777a433abb1d46e24914c3256bf043a15061efad7315ed4bb + languageName: node + linkType: hard + "readable-stream@npm:1 || 2, readable-stream@npm:^2.0.0, readable-stream@npm:^2.0.1, readable-stream@npm:^2.0.2, readable-stream@npm:^2.0.6, readable-stream@npm:^2.1.5, readable-stream@npm:^2.2.2, readable-stream@npm:^2.3.3, readable-stream@npm:^2.3.6, readable-stream@npm:~2.3.6": version: 2.3.7 resolution: "readable-stream@npm:2.3.7" @@ -24468,6 +26617,15 @@ __metadata: languageName: node linkType: hard +"rechoir@npm:^0.6.2": + version: 0.6.2 + resolution: "rechoir@npm:0.6.2" + dependencies: + resolve: "npm:^1.1.6" + checksum: 9c739042ee71825d9e72879f89c165e425290bfc1feadb5437716604e33140fdac85970a2dcccbd2932dac6e20f4a277b80c2ecfc4b904a44c49e187fb67293e + languageName: node + linkType: hard + "recrawl-sync@npm:^2.0.3": version: 2.2.1 resolution: "recrawl-sync@npm:2.2.1" @@ -24500,6 +26658,16 @@ __metadata: languageName: node linkType: hard +"redent@npm:^4.0.0": + version: 4.0.0 + resolution: "redent@npm:4.0.0" + dependencies: + indent-string: "npm:^5.0.0" + strip-indent: "npm:^4.0.0" + checksum: a04affcfec9913c2cfda142f7a3f15ff28a46d036ab0630a60d8ea107c2cdf72453b6fbc140cc8dbd0bcf71a6e2d4c918281aaffd4ef3610af897ad30b8988ca + languageName: node + linkType: hard + "redis-errors@npm:^1.0.0, redis-errors@npm:^1.2.0": version: 1.2.0 resolution: "redis-errors@npm:1.2.0" @@ -24552,10 +26720,17 @@ __metadata: languageName: node linkType: hard -"regenerator-runtime@npm:^0.13.4, regenerator-runtime@npm:^0.13.7": - version: 0.13.9 - resolution: "regenerator-runtime@npm:0.13.9" - checksum: db060af0b2ca8bb7f12aea9dcf7416ff80259b39c2ddd38e0bd705b0a7acd9f07be133e543bbf54af1e86253b6fd553e3050fd6b30c3282731dd27560427f065 +"regenerator-runtime@npm:^0.11.0": + version: 0.11.1 + resolution: "regenerator-runtime@npm:0.11.1" + checksum: 14664043fb2f0f41fa9349df06e962fc888657ea05ece28df05729fba0b9ea626e75547e317452454b80ef182bfe69b7c14d6717b0f7eb1c23d4d74aad9e186c + languageName: node + linkType: hard + +"regenerator-runtime@npm:^0.13.10, regenerator-runtime@npm:^0.13.4, regenerator-runtime@npm:^0.13.7": + version: 0.13.10 + resolution: "regenerator-runtime@npm:0.13.10" + checksum: ac83ab4691a061519703e622ee817a0a517a80235d0c76a49ef32848c0d0946d97797d244806490f8f94e05a4b180a295869299b2e44c6f1c625b835703666a6 languageName: node linkType: hard @@ -24637,6 +26812,24 @@ __metadata: languageName: node linkType: hard +"registry-auth-token@npm:^4.0.0": + version: 4.2.2 + resolution: "registry-auth-token@npm:4.2.2" + dependencies: + rc: "npm:1.2.8" + checksum: 770ac732a98c11e269bd9e329c71c89e607a8bd7176f82211190a6cfdcdbf5a847bf1adbcd75fdd1654dfaa1bef4dda25cb740c9c88140dbe35e1ee884093637 + languageName: node + linkType: hard + +"registry-url@npm:^5.0.0": + version: 5.1.0 + resolution: "registry-url@npm:5.1.0" + dependencies: + rc: "npm:^1.2.8" + checksum: cce183aaf895d4a9254c4d3a38d494af0b89144675af4100be0c2dc467104c901adc888928cb2a26e49b8a944f06c33c4d62ec5f540105a2607edbfe2094e7ba + languageName: node + linkType: hard + "regjsgen@npm:^0.6.0": version: 0.6.0 resolution: "regjsgen@npm:0.6.0" @@ -24861,6 +27054,13 @@ __metadata: languageName: node linkType: hard +"remove-markdown@npm:^0.2.2": + version: 0.2.2 + resolution: "remove-markdown@npm:0.2.2" + checksum: 8093f1dcfbeb07721d2772160f03a4366ee0cc07ac3fce1394a4a5792ed1be212d13f640b95e58f83e7710f7c343d5bc5cb0b4c1089567ea304e56a4e5ef7a66 + languageName: node + linkType: hard + "remove-trailing-separator@npm:^1.0.1": version: 1.1.0 resolution: "remove-trailing-separator@npm:1.1.0" @@ -24926,6 +27126,15 @@ __metadata: languageName: node linkType: hard +"request-progress@npm:^3.0.0": + version: 3.0.0 + resolution: "request-progress@npm:3.0.0" + dependencies: + throttleit: "npm:^1.0.0" + checksum: 5c51805595e8d061ed9132adbe6cecc3b7290ba5c8d4f00ba1c65e11972534a49f5dfb428b29a0402905eb6a9e115b36ba43eb878ff95756f14c60f9574d8cd4 + languageName: node + linkType: hard + "require-directory@npm:^2.1.1": version: 2.1.1 resolution: "require-directory@npm:2.1.1" @@ -24977,6 +27186,13 @@ __metadata: languageName: node linkType: hard +"resolve-from@npm:^3.0.0": + version: 3.0.0 + resolution: "resolve-from@npm:3.0.0" + checksum: 58df9c45d84b4d514e33cba93e5582d7fe5b73b915ddbfc80a015d87afa7af094864b07d61a2c07083427b8c549d1a50969f96de7082492840a69b334c1b1bc3 + languageName: node + linkType: hard + "resolve-from@npm:^4.0.0": version: 4.0.0 resolution: "resolve-from@npm:4.0.0" @@ -25007,7 +27223,7 @@ __metadata: languageName: node linkType: hard -"resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.10.1, resolve@npm:^1.14.2, resolve@npm:^1.17.0, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.0, resolve@npm:^1.22.1, resolve@npm:^1.3.2": +"resolve@npm:^1.1.6, resolve@npm:^1.1.7, resolve@npm:^1.10.0, resolve@npm:^1.10.1, resolve@npm:^1.14.2, resolve@npm:^1.17.0, resolve@npm:^1.19.0, resolve@npm:^1.20.0, resolve@npm:^1.22.0, resolve@npm:^1.22.1, resolve@npm:^1.3.2": version: 1.22.1 resolution: "resolve@npm:1.22.1" dependencies: @@ -25030,7 +27246,7 @@ __metadata: languageName: node linkType: hard -"resolve@patch:resolve@npm%3A^1.1.7#optional!builtin, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.10.1#optional!builtin, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin, resolve@patch:resolve@npm%3A^1.17.0#optional!builtin, resolve@patch:resolve@npm%3A^1.19.0#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.1#optional!builtin, resolve@patch:resolve@npm%3A^1.3.2#optional!builtin": +"resolve@patch:resolve@npm%3A^1.1.6#optional!builtin, resolve@patch:resolve@npm%3A^1.1.7#optional!builtin, resolve@patch:resolve@npm%3A^1.10.0#optional!builtin, resolve@patch:resolve@npm%3A^1.10.1#optional!builtin, resolve@patch:resolve@npm%3A^1.14.2#optional!builtin, resolve@patch:resolve@npm%3A^1.17.0#optional!builtin, resolve@patch:resolve@npm%3A^1.19.0#optional!builtin, resolve@patch:resolve@npm%3A^1.20.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.0#optional!builtin, resolve@patch:resolve@npm%3A^1.22.1#optional!builtin, resolve@patch:resolve@npm%3A^1.3.2#optional!builtin": version: 1.22.1 resolution: "resolve@patch:resolve@npm%3A1.22.1#optional!builtin::version=1.22.1&hash=c3c19d" dependencies: @@ -25053,6 +27269,15 @@ __metadata: languageName: node linkType: hard +"responselike@npm:^1.0.2": + version: 1.0.2 + resolution: "responselike@npm:1.0.2" + dependencies: + lowercase-keys: "npm:^1.0.0" + checksum: 239215386286b670a236114a7a1a9b87f901faceffc3aa97ee6ab51fb7ce70262a17b9821e59f816966919ef95c6bd8a57975b1dfdd429c0932cee4344bc50ec + languageName: node + linkType: hard + "responselike@npm:^2.0.0": version: 2.0.0 resolution: "responselike@npm:2.0.0" @@ -25100,7 +27325,7 @@ __metadata: languageName: node linkType: hard -"rimraf@npm:3.0.2, rimraf@npm:^3.0.2": +"rimraf@npm:3.0.2, rimraf@npm:^3.0.0, rimraf@npm:^3.0.2": version: 3.0.2 resolution: "rimraf@npm:3.0.2" dependencies: @@ -25320,6 +27545,15 @@ __metadata: languageName: node linkType: hard +"run-node@npm:^1.0.0": + version: 1.0.0 + resolution: "run-node@npm:1.0.0" + bin: + run-node: run-node + checksum: 5a966899d7ba6d035bb21d2c8eaa2c8f32c847132733921b08763e1c6f7df48102b4c71636cbce2923aa19f2c7a1b61708b3d260527f32b3e3443c52fdb3cafa + languageName: node + linkType: hard + "run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0" @@ -25338,12 +27572,21 @@ __metadata: languageName: node linkType: hard -"rxjs@npm:^7.5.5": - version: 7.5.5 - resolution: "rxjs@npm:7.5.5" +"rxjs@npm:^6.6.0": + version: 6.6.7 + resolution: "rxjs@npm:6.6.7" + dependencies: + tslib: "npm:^1.9.0" + checksum: f593c1d7a24848a2c937d31b806b7940a7fad61902eea6893dad51298f42291585c3339112eec876671a5cd0eb3cf73da14e45a91255440db239c8f640f57ada + languageName: node + linkType: hard + +"rxjs@npm:^7.1.0, rxjs@npm:^7.5.1, rxjs@npm:^7.5.5": + version: 7.5.7 + resolution: "rxjs@npm:7.5.7" dependencies: tslib: "npm:^2.1.0" - checksum: dcb9d0e21cd80ff48b8bb105819aa1f6860943c92023e46c14437c28c18734aa8bfa7019d0cf70731dfe34ea103a8496daf1df5a25d86f56fc69eca29776e542 + checksum: 9f40c5ba7904afbffe4a8c5fec9cb35dbd21cac55e20e004fe405f9712efef11d23a0baa23682a16d448976d5795ed66fd843c5f00329dd6e491676373610a79 languageName: node linkType: hard @@ -25400,7 +27643,7 @@ __metadata: languageName: node linkType: hard -"safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0, safer-buffer@npm:^2.1.0": +"safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0, safer-buffer@npm:^2.0.2, safer-buffer@npm:^2.1.0, safer-buffer@npm:~2.1.0": version: 2.1.2 resolution: "safer-buffer@npm:2.1.2" checksum: d4199666e9e792968c0b88c2c35dd400f56d3eecb9affbcf5207922822eadf30cc06995bae3c5d0a653851bbd40fc0af578bf046bbf734199ce22433ba4da659 @@ -25531,6 +27774,22 @@ __metadata: languageName: node linkType: hard +"semver-compare@npm:^1.0.0": + version: 1.0.0 + resolution: "semver-compare@npm:1.0.0" + checksum: 1d88e82a6e911032911001e4a23c309a1e40ecb2c60332516b8e1a3419ac230af6b09f2eb02cf3370195da961e0b9dea52256eaa68040d1eb38cc013aeb75789 + languageName: node + linkType: hard + +"semver-diff@npm:^3.1.1": + version: 3.1.1 + resolution: "semver-diff@npm:3.1.1" + dependencies: + semver: "npm:^6.3.0" + checksum: 7fe4a37d0ef1738fbd373cb8c739dfb9efc863a61c7ddd559c135f3dd2e38abd24854219be491339e9a1a5becff0c6a32035257e5912756b8859e3d9bc0f568c + languageName: node + linkType: hard + "semver@npm:2 || 3 || 4 || 5, semver@npm:^5.4.1, semver@npm:^5.5.0, semver@npm:^5.6.0": version: 5.7.1 resolution: "semver@npm:5.7.1" @@ -25562,7 +27821,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^6.0.0, semver@npm:^6.1.0, semver@npm:^6.1.1, semver@npm:^6.1.2, semver@npm:^6.3.0": +"semver@npm:^6.0.0, semver@npm:^6.1.0, semver@npm:^6.1.1, semver@npm:^6.1.2, semver@npm:^6.2.0, semver@npm:^6.3.0": version: 6.3.0 resolution: "semver@npm:6.3.0" bin: @@ -25772,6 +28031,19 @@ __metadata: languageName: node linkType: hard +"shelljs@npm:^0.8.4": + version: 0.8.5 + resolution: "shelljs@npm:0.8.5" + dependencies: + glob: "npm:^7.0.0" + interpret: "npm:^1.0.0" + rechoir: "npm:^0.6.2" + bin: + shjs: bin/shjs + checksum: ecf61d3b6d544d405cd5fae2f6004b87744f617bc246ff4fd884c457886f9447299b87a3a20da7e8e4270e6bf7051f2eb872b97c6dfd98ec2b9607f8b717f615 + languageName: node + linkType: hard + "side-channel@npm:^1.0.4": version: 1.0.4 resolution: "side-channel@npm:1.0.4" @@ -25871,7 +28143,7 @@ __metadata: languageName: node linkType: hard -"size-limit@npm:8.1.0": +"size-limit@npm:8.1.0, size-limit@npm:^8.1.0": version: 8.1.0 resolution: "size-limit@npm:8.1.0" dependencies: @@ -26043,6 +28315,15 @@ __metadata: languageName: node linkType: hard +"sort-keys@npm:^4.0.0": + version: 4.2.0 + resolution: "sort-keys@npm:4.2.0" + dependencies: + is-plain-obj: "npm:^2.0.0" + checksum: a2d9fad5899b8f99c8626f51f11b673fb1af7ef8e46f731737f8ccd42bde74d22ae20a3d610fc22b5ddeba1d51c7ae37a8f7682de543028f5055ddfe704a4766 + languageName: node + linkType: hard + "sort-object-keys@npm:^1.1.3": version: 1.1.3 resolution: "sort-object-keys@npm:1.1.3" @@ -26215,6 +28496,13 @@ __metadata: languageName: node linkType: hard +"speedometer@npm:~1.0.0": + version: 1.0.0 + resolution: "speedometer@npm:1.0.0" + checksum: 0b51c7677bd0baee75ecae8dd07ff82fbc9bbbbbfffb697399d061b6c2fca5b544745e280ea3a5e8c06f3b7f89e05f05122f4d14c04ba658f9e7a1b870047191 + languageName: node + linkType: hard + "split-string@npm:^3.0.1, split-string@npm:^3.0.2": version: 3.1.0 resolution: "split-string@npm:3.1.0" @@ -26233,6 +28521,15 @@ __metadata: languageName: node linkType: hard +"split@npm:0.3": + version: 0.3.3 + resolution: "split@npm:0.3.3" + dependencies: + through: "npm:2" + checksum: e6d647479900bd283ebd42cec83021973b4145ea0ab12950da067c6c984dcb28fa0dd3450e9e993528d0704f109265163e56022f6e45460b61ae92e1c46f84cb + languageName: node + linkType: hard + "sponge-case@npm:^1.0.1": version: 1.0.1 resolution: "sponge-case@npm:1.0.1" @@ -26249,6 +28546,27 @@ __metadata: languageName: node linkType: hard +"sshpk@npm:^1.14.1": + version: 1.17.0 + resolution: "sshpk@npm:1.17.0" + dependencies: + asn1: "npm:~0.2.3" + assert-plus: "npm:^1.0.0" + bcrypt-pbkdf: "npm:^1.0.0" + dashdash: "npm:^1.12.0" + ecc-jsbn: "npm:~0.1.1" + getpass: "npm:^0.1.1" + jsbn: "npm:~0.1.0" + safer-buffer: "npm:^2.0.2" + tweetnacl: "npm:~0.14.0" + bin: + sshpk-conv: bin/sshpk-conv + sshpk-sign: bin/sshpk-sign + sshpk-verify: bin/sshpk-verify + checksum: 4160f860f7d754dbd4f5d0b197d1d743cbce1d1fd48752d0d039e6f9668ea917d6caa79a77ada20b80af530214a85c6fe052e2b78d82525374b3cf6efc92332a + languageName: node + linkType: hard + "ssri@npm:^6.0.1": version: 6.0.2 resolution: "ssri@npm:6.0.2" @@ -26304,6 +28622,25 @@ __metadata: languageName: node linkType: hard +"start-server-and-test@npm:^1.14.0": + version: 1.14.0 + resolution: "start-server-and-test@npm:1.14.0" + dependencies: + bluebird: "npm:3.7.2" + check-more-types: "npm:2.24.0" + debug: "npm:4.3.2" + execa: "npm:5.1.1" + lazy-ass: "npm:1.6.0" + ps-tree: "npm:1.2.0" + wait-on: "npm:6.0.0" + bin: + server-test: src/bin/start.js + start-server-and-test: src/bin/start.js + start-test: src/bin/start.js + checksum: 5e84acf26091a1e192031c1d60a9707e979561b2e3c44cf751cdd17b7a9c426d4cce4eb3a99db4856e03e8e1aa00e2e47e6e6d266c0fbce522086437e7f450ed + languageName: node + linkType: hard + "state-toggle@npm:^1.0.0": version: 1.0.3 resolution: "state-toggle@npm:1.0.3" @@ -26345,6 +28682,15 @@ __metadata: languageName: node linkType: hard +"stream-combiner@npm:~0.0.4": + version: 0.0.4 + resolution: "stream-combiner@npm:0.0.4" + dependencies: + duplexer: "npm:~0.1.1" + checksum: 8b245d6d98ee85bb681a255d8ea8d400ae9986bc70d8b8b5cbefa789a5731e57b5ad3fcd88f940522ff24aabc2dd5081311658ab7bd39d18968d6f22b546b866 + languageName: node + linkType: hard + "stream-each@npm:^1.1.0": version: 1.2.3 resolution: "stream-each@npm:1.2.3" @@ -26660,6 +29006,15 @@ __metadata: languageName: node linkType: hard +"strip-indent@npm:^4.0.0": + version: 4.0.0 + resolution: "strip-indent@npm:4.0.0" + dependencies: + min-indent: "npm:^1.0.1" + checksum: 09f7f4debccccec3879131a1d688ddb39d6ce412c07fbda6008b1ebe24691f79b2f565ac4b9299f6a6dd91ed877e70118777bbc629c9af3bfeafe88b8b75ab92 + languageName: node + linkType: hard + "strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" @@ -27335,7 +29690,14 @@ __metadata: languageName: node linkType: hard -"through2@npm:^2.0.0, through2@npm:^2.0.3": +"throttleit@npm:^1.0.0": + version: 1.0.0 + resolution: "throttleit@npm:1.0.0" + checksum: 89d8918bca566995ff14367b6ca6056c4ce4fba6151e43ce34f0cabcaec20464d17ad8461994b15192fc66b71b8c51f26b10a0b4ffa01bb3dd4f19f9bffeb9ba + languageName: node + linkType: hard + +"through2@npm:^2.0.0, through2@npm:^2.0.3, through2@npm:~2.0.3": version: 2.0.5 resolution: "through2@npm:2.0.5" dependencies: @@ -27364,7 +29726,7 @@ __metadata: languageName: node linkType: hard -"through@npm:>=2.2.7 <3, through@npm:^2.3.6, through@npm:^2.3.8": +"through@npm:2, through@npm:>=2.2.7 <3, through@npm:^2.3.6, through@npm:^2.3.8, through@npm:~2.3, through@npm:~2.3.1": version: 2.3.8 resolution: "through@npm:2.3.8" checksum: c9d6883ace26b3c967283827cafdd4ceee6164fa4d3754865f5032dcb564e0cbdea9dc6f43806afa51e1f2863d8e3beca141cbf7b8dcff989982aef69bb851c0 @@ -27459,6 +29821,15 @@ __metadata: languageName: node linkType: hard +"tmp@npm:~0.2.1": + version: 0.2.1 + resolution: "tmp@npm:0.2.1" + dependencies: + rimraf: "npm:^3.0.0" + checksum: 6d7e4d8985fc4b3ee2bc00cd00fb42a9be47d2542d0ebd5fcd9aa69fd9fc337fa949f7a1212cc7d4172559288bef30125787b7b4eca683c2b43c740fcc342a21 + languageName: node + linkType: hard + "tmpl@npm:1.0.5": version: 1.0.5 resolution: "tmpl@npm:1.0.5" @@ -27473,6 +29844,13 @@ __metadata: languageName: node linkType: hard +"to-fast-properties@npm:^1.0.3": + version: 1.0.3 + resolution: "to-fast-properties@npm:1.0.3" + checksum: 99b3da7d55577fb8a6d176297dfa3e6e6a815cbc386cd0d5bb48ff42ea3829c920c0e502dc3d14183ea553befb7304784c83d6d1a20a889a68f5731cdd1e3d52 + languageName: node + linkType: hard + "to-fast-properties@npm:^2.0.0": version: 2.0.0 resolution: "to-fast-properties@npm:2.0.0" @@ -27503,6 +29881,13 @@ __metadata: languageName: node linkType: hard +"to-readable-stream@npm:^1.0.0": + version: 1.0.0 + resolution: "to-readable-stream@npm:1.0.0" + checksum: b6d75eb778554cdef26728feef0066d32b81e84a448e9eac1be5b0cad80f46508f42046ee7eae5be3500412dc96ed3323d23e8432d3a75173c057d29c8263af4 + languageName: node + linkType: hard + "to-regex-range@npm:^2.1.0": version: 2.1.1 resolution: "to-regex-range@npm:2.1.1" @@ -27580,6 +29965,16 @@ __metadata: languageName: node linkType: hard +"tough-cookie@npm:~2.5.0": + version: 2.5.0 + resolution: "tough-cookie@npm:2.5.0" + dependencies: + psl: "npm:^1.1.28" + punycode: "npm:^2.1.1" + checksum: 93504e7af3f117ea2feb8ae14f16931430f0ed94a4d0242d7f8efb9ac16e970731bd660242dd7f0afa20b750eb97affd5053cfc8302f77714d123a7b6f4d60b8 + languageName: node + linkType: hard + "tr46@npm:^1.0.1": version: 1.0.1 resolution: "tr46@npm:1.0.1" @@ -27640,6 +30035,13 @@ __metadata: languageName: node linkType: hard +"trim-newlines@npm:^4.0.2": + version: 4.0.2 + resolution: "trim-newlines@npm:4.0.2" + checksum: caff561fd7b85834905a6e9db42922a826d21d5cfc730a1c9c3ba14c57a7a52c8f744bac2e025d9d5f9ef24facddb377fa8f6cd655904aa979db3a069e8a6aff + languageName: node + linkType: hard + "trim-trailing-lines@npm:^1.0.0": version: 1.1.4 resolution: "trim-trailing-lines@npm:1.1.4" @@ -27864,7 +30266,7 @@ __metadata: languageName: node linkType: hard -"tslib@npm:^1.13.0, tslib@npm:^1.8.1, tslib@npm:^1.9.3": +"tslib@npm:^1.13.0, tslib@npm:^1.8.1, tslib@npm:^1.9.0, tslib@npm:^1.9.3": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: 441af59dc42ad4ae57140e62cb362369620c6076845c2c2b0ecc863c1d719ce24fdbc301e9053433fef43075e061bf84b702318ff1204b496a5bba10baf9eb9f @@ -27968,6 +30370,13 @@ __metadata: languageName: node linkType: hard +"tweetnacl@npm:^0.14.3, tweetnacl@npm:~0.14.0": + version: 0.14.5 + resolution: "tweetnacl@npm:0.14.5" + checksum: bd01b852653d25afd67c3145b4241f93db1fda9753b78d3d848f3eed5f32af4f1e49b6cd44571b32b0498d18a7344ff4033d6b1f76c3732c8cf4b85049f9cf49 + languageName: node + linkType: hard + "type-check@npm:^0.4.0, type-check@npm:~0.4.0": version: 0.4.0 resolution: "type-check@npm:0.4.0" @@ -28042,6 +30451,13 @@ __metadata: languageName: node linkType: hard +"type-fest@npm:^1.0.1, type-fest@npm:^1.2.1, type-fest@npm:^1.2.2": + version: 1.4.0 + resolution: "type-fest@npm:1.4.0" + checksum: 214ce322fc969854349a65a66b891003636ad844de5fd1738e4015e8b71151b8a774121443b1e6dd7792e1bdd9fad1771826244559111c78feb7519f31fa7692 + languageName: node + linkType: hard + "type-is@npm:~1.6.18": version: 1.6.18 resolution: "type-is@npm:1.6.18" @@ -28078,7 +30494,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:4.8.4, typescript@npm:^4.1.3, typescript@npm:^4.6.4": +"typescript@npm:4.8.4, typescript@npm:^4.1.3, typescript@npm:^4.6.4, typescript@npm:^4.7.4": version: 4.8.4 resolution: "typescript@npm:4.8.4" bin: @@ -28098,7 +30514,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@npm%3A4.8.4#optional!builtin, typescript@patch:typescript@npm%3A^4.1.3#optional!builtin, typescript@patch:typescript@npm%3A^4.6.4#optional!builtin": +"typescript@patch:typescript@npm%3A4.8.4#optional!builtin, typescript@patch:typescript@npm%3A^4.1.3#optional!builtin, typescript@patch:typescript@npm%3A^4.6.4#optional!builtin, typescript@patch:typescript@npm%3A^4.7.4#optional!builtin": version: 4.8.4 resolution: "typescript@patch:typescript@npm%3A4.8.4#optional!builtin::version=4.8.4&hash=0102e9" bin: @@ -28264,6 +30680,15 @@ __metadata: languageName: node linkType: hard +"unique-string@npm:^2.0.0": + version: 2.0.0 + resolution: "unique-string@npm:2.0.0" + dependencies: + crypto-random-string: "npm:^2.0.0" + checksum: fbb774926206a5ac78fff1967e20383e4a8bff7f832363ffb5e0c11146bb1db05ff2231caac05773fd331e57ec5863b66261d16a36ec3c850d094cbd38b7947c + languageName: node + linkType: hard + "unist-builder@npm:2.0.3, unist-builder@npm:^2.0.0": version: 2.0.3 resolution: "unist-builder@npm:2.0.3" @@ -28440,6 +30865,13 @@ __metadata: languageName: node linkType: hard +"universal-user-agent@npm:^6.0.0": + version: 6.0.0 + resolution: "universal-user-agent@npm:6.0.0" + checksum: c014b4d3bcedd8b5ffda7d3b730bec6dcf616963be696a20bac0f8d9c9307d494a07e186ef102a20cd038d7f76190faa3ad0256d11b7b26d12a080926cc871e6 + languageName: node + linkType: hard + "universalify@npm:^0.1.0, universalify@npm:^0.1.2": version: 0.1.2 resolution: "universalify@npm:0.1.2" @@ -28489,6 +30921,13 @@ __metadata: languageName: node linkType: hard +"untildify@npm:^4.0.0": + version: 4.0.0 + resolution: "untildify@npm:4.0.0" + checksum: f2541665b5b8923cce426a0ee79cae326c84de93ba3b577343833910d4b5aafd82ea4544814144d64e90e4cdbdf71bf3cc95f2221c4b6005a7219165e0fb369a + languageName: node + linkType: hard + "upath@npm:^1.1.1": version: 1.2.0 resolution: "upath@npm:1.2.0" @@ -28510,6 +30949,28 @@ __metadata: languageName: node linkType: hard +"update-notifier@npm:^5.0.0": + version: 5.1.0 + resolution: "update-notifier@npm:5.1.0" + dependencies: + boxen: "npm:^5.0.0" + chalk: "npm:^4.1.0" + configstore: "npm:^5.0.1" + has-yarn: "npm:^2.1.0" + import-lazy: "npm:^2.1.0" + is-ci: "npm:^2.0.0" + is-installed-globally: "npm:^0.4.0" + is-npm: "npm:^5.0.0" + is-yarn-global: "npm:^0.3.0" + latest-version: "npm:^5.1.0" + pupa: "npm:^2.1.1" + semver: "npm:^7.3.4" + semver-diff: "npm:^3.1.1" + xdg-basedir: "npm:^4.0.0" + checksum: d0928d4264115372efd4d976f690a2a9701dda5fead8669c9edb1e24e1434b55bd0d384aa4ad0123bf9de5613fc7cd3c0e63499ae7f49a82acc6f7f9b45d25ef + languageName: node + linkType: hard + "upper-case-first@npm:^2.0.2": version: 2.0.2 resolution: "upper-case-first@npm:2.0.2" @@ -28568,6 +31029,15 @@ __metadata: languageName: node linkType: hard +"url-parse-lax@npm:^3.0.0": + version: 3.0.0 + resolution: "url-parse-lax@npm:3.0.0" + dependencies: + prepend-http: "npm:^2.0.0" + checksum: f5e84305a7ed1e087bc1c0d263fe05ab432619b4f3ce957a78dcd2b2d989e28b1a3169a7cf8ce9e780e4c45d613f029d38dcf68d7b39b77dbdff197dceb3ac53 + languageName: node + linkType: hard + "url@npm:^0.11.0": version: 0.11.0 resolution: "url@npm:0.11.0" @@ -28608,6 +31078,13 @@ __metadata: languageName: node linkType: hard +"util-extend@npm:^1.0.1": + version: 1.0.3 + resolution: "util-extend@npm:1.0.3" + checksum: 8ddf5ef31c6b735ee93ae97dfacb800c67a3b6d6ed06a146e1c91a381c3a067363991d474adb5f4d704444d0642b8787c58815f5ee9f6c8aa44ac1870aac2098 + languageName: node + linkType: hard + "util.promisify@npm:1.0.0": version: 1.0.0 resolution: "util.promisify@npm:1.0.0" @@ -28760,6 +31237,17 @@ __metadata: languageName: node linkType: hard +"verror@npm:1.10.0": + version: 1.10.0 + resolution: "verror@npm:1.10.0" + dependencies: + assert-plus: "npm:^1.0.0" + core-util-is: "npm:1.0.2" + extsprintf: "npm:^1.2.0" + checksum: ec26653c2110a7c2cfbaf41e3f3e87a5e08cbde81f7a568603c5ae4c9459acef5a1e81cbec551f4b9d0352e4b99121ee891e77c621b8237be9ff3862764d55f5 + languageName: node + linkType: hard + "vfile-location@npm:^3.0.0, vfile-location@npm:^3.2.0": version: 3.2.0 resolution: "vfile-location@npm:3.2.0" @@ -28984,6 +31472,21 @@ __metadata: languageName: node linkType: hard +"wait-on@npm:6.0.0": + version: 6.0.0 + resolution: "wait-on@npm:6.0.0" + dependencies: + axios: "npm:^0.21.1" + joi: "npm:^17.4.0" + lodash: "npm:^4.17.21" + minimist: "npm:^1.2.5" + rxjs: "npm:^7.1.0" + bin: + wait-on: bin/wait-on + checksum: e2d65e6ad5340e0625929be946a3202713de4ee693334c0b7fde6fb1181b55109a514dc38f0c672502a82ea6c216a132828c29e9fe2adba3440fdd67738b02b9 + languageName: node + linkType: hard + "walker@npm:^1.0.7, walker@npm:^1.0.8, walker@npm:~1.0.5": version: 1.0.8 resolution: "walker@npm:1.0.8" @@ -29258,7 +31761,7 @@ __metadata: languageName: node linkType: hard -"webpack@npm:5.74.0, webpack@npm:>=4.43.0 <6.0.0, webpack@npm:^5.9.0": +"webpack@npm:5.74.0, webpack@npm:>=4.43.0 <6.0.0, webpack@npm:^5.74.0, webpack@npm:^5.9.0": version: 5.74.0 resolution: "webpack@npm:5.74.0" dependencies: @@ -29408,7 +31911,7 @@ __metadata: languageName: node linkType: hard -"wide-align@npm:^1.1.0, wide-align@npm:^1.1.2": +"wide-align@npm:^1.1.0, wide-align@npm:^1.1.2, wide-align@npm:^1.1.5": version: 1.1.5 resolution: "wide-align@npm:1.1.5" dependencies: @@ -29549,6 +32052,20 @@ __metadata: languageName: node linkType: hard +"write-json-file@npm:^4.2.0": + version: 4.3.0 + resolution: "write-json-file@npm:4.3.0" + dependencies: + detect-indent: "npm:^6.0.0" + graceful-fs: "npm:^4.1.15" + is-plain-obj: "npm:^2.0.0" + make-dir: "npm:^3.0.0" + sort-keys: "npm:^4.0.0" + write-file-atomic: "npm:^3.0.0" + checksum: 0d52fb44a4f7b3698ad5c00ac0c5f0541e6d1dd2cdd240e744710e5d28ca2583b7713f0e8ad2e41d6d6e1c812363091717139331d265542b8938079e60500053 + languageName: node + linkType: hard + "ws@npm:8.10.0, ws@npm:^8.2.3, ws@npm:^8.3.0, ws@npm:^8.8.0": version: 8.10.0 resolution: "ws@npm:8.10.0" @@ -29565,8 +32082,8 @@ __metadata: linkType: hard "ws@npm:^7.3.1, ws@npm:^7.4.5": - version: 7.5.7 - resolution: "ws@npm:7.5.7" + version: 7.5.9 + resolution: "ws@npm:7.5.9" peerDependencies: bufferutil: ^4.0.1 utf-8-validate: ^5.0.2 @@ -29575,7 +32092,7 @@ __metadata: optional: true utf-8-validate: optional: true - checksum: d67af3da809fbc571486e5e25ed0be62b1d400b8136f4c9e0812c901377dbff5d7e75152c8b478a2ecce643318f3878d216aaa4c44e9e346efb83f609ff59293 + checksum: 5a4f52060e2a65194c324e5506021c998444ef5740365f7f04a59da38d2da5229221f5ab6e7ceee0d5999d03c2c1c73164a5ebdafa481043edeae4c5c42f988c languageName: node linkType: hard @@ -29593,6 +32110,13 @@ __metadata: languageName: node linkType: hard +"xdg-basedir@npm:^4.0.0": + version: 4.0.0 + resolution: "xdg-basedir@npm:4.0.0" + checksum: b2bbef733ae7ee25860b64f83e147ac06ee0f0f360c7cc5b68a948e689d64928a8fe2ed9a07c43369083c8bcc62a88644d03029fd90612b91484b5bb39649733 + languageName: node + linkType: hard + "xdm@npm:^2.0.0": version: 2.1.0 resolution: "xdm@npm:2.1.0" @@ -29751,7 +32275,7 @@ __metadata: languageName: node linkType: hard -"yargs@npm:^15.1.0, yargs@npm:^15.3.1": +"yargs@npm:^15.0.1, yargs@npm:^15.1.0, yargs@npm:^15.3.1": version: 15.4.1 resolution: "yargs@npm:15.4.1" dependencies: @@ -29785,6 +32309,16 @@ __metadata: languageName: node linkType: hard +"yauzl@npm:^2.10.0": + version: 2.10.0 + resolution: "yauzl@npm:2.10.0" + dependencies: + buffer-crc32: "npm:~0.2.3" + fd-slicer: "npm:~1.1.0" + checksum: 760a176211c7380f1c62160406dc2b9e1273515c06adef9b52139bf8258b993fbd01dec121b7464204abc8b4735e2a82f746a28c486bf4847b61e39034bed512 + languageName: node + linkType: hard + "yn@npm:3.1.1": version: 3.1.1 resolution: "yn@npm:3.1.1"