@next-box/i18n 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/client.cjs +1 -1
- package/dist/cjs/client.cjs.map +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/macros.cjs.map +1 -1
- package/dist/esm/client.mjs +1 -1
- package/dist/esm/client.mjs.map +1 -1
- package/dist/esm/macros.mjs.map +1 -1
- package/dist/types/cjs/components/I18nProvider.d.cts +10 -11
- package/dist/types/cjs/components/I18nProvider.d.cts.map +1 -1
- package/dist/types/cjs/components/Md.d.cts +4 -5
- package/dist/types/cjs/components/Md.d.cts.map +1 -1
- package/dist/types/cjs/helpers/injectVariables.d.cts.map +1 -1
- package/dist/types/cjs/macros.d.cts.map +1 -1
- package/dist/types/cjs/main.d.cts.map +1 -1
- package/dist/types/cjs/types.d.cts +0 -2
- package/dist/types/cjs/types.d.cts.map +1 -1
- package/dist/types/esm/components/I18nProvider.d.ts +10 -11
- package/dist/types/esm/components/I18nProvider.d.ts.map +1 -1
- package/dist/types/esm/components/Md.d.ts +4 -5
- package/dist/types/esm/components/Md.d.ts.map +1 -1
- package/dist/types/esm/helpers/injectVariables.d.ts.map +1 -1
- package/dist/types/esm/macros.d.ts.map +1 -1
- package/dist/types/esm/main.d.ts.map +1 -1
- package/dist/types/esm/types.d.ts +0 -2
- package/dist/types/esm/types.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/components/I18nProvider.tsx +6 -7
- package/src/components/Md.test.tsx +5 -3
- package/src/components/Md.tsx +4 -5
- package/src/types.ts +0 -5
package/README.md
CHANGED
|
@@ -177,12 +177,12 @@ The `markdownDir` path supports a template variable `NEXT_PUBLIC_LANGUAGE_CODE`,
|
|
|
177
177
|
|
|
178
178
|
The `md` macro is designed to be used with the `Md` markdown render component and `I18nProvider` context provider. `Md` transforms markdown into React components, while `I18nProvider` provides a way to share a component mapper and `markdown-to-jsx` options between instances of `Md`.
|
|
179
179
|
|
|
180
|
-
> Under the hood, the library uses the `markdown-to-jsx` npm package to transform markdown into JSX.
|
|
180
|
+
> Under the hood, the library uses the `markdown-to-jsx` npm package to transform markdown into JSX. See [the package's documentation](https://github.com/quantizor/markdown-to-jsx) for more information on its configuration options. Our `componentMapper` prop maps to the `markdown-to-jsx` `overrides` option.
|
|
181
181
|
|
|
182
182
|
The contrived example below illustrates how to use the `md` macro, `I18nProvider`, and `Md` component together.
|
|
183
183
|
|
|
184
184
|
```tsx
|
|
185
|
-
import { md } from '@next-box/i18n/macros' with {type: 'macro'};
|
|
185
|
+
import { md } from '@next-box/i18n/macros' with { type: 'macro' };
|
|
186
186
|
import { I18nProvider, Md } from '@next-box/i18n';
|
|
187
187
|
import { componentMapper } from './componentMapper.ts';
|
|
188
188
|
|
package/dist/cjs/client.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),n=require("markdown-to-jsx");const o=r.createContext({componentMapper:{}}),t=/{{[^\s{}]+}}/g,p=/{{ *([^ }]*) *}}/,a=(e,r)=>r?e.replaceAll(t,
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),n=require("markdown-to-jsx");const o=r.createContext({componentMapper:{}}),t=/{{[^\s{}]+}}/g,p=/{{ *([^ }]*) *}}/,a=(e,r)=>r?e.replaceAll(t,e=>{const n=e.replace(p,"$1"),o=r[n];if(o)return o;throw new Error(`Markdown contains un-replaced variable '${n}'`)}):e;exports.I18nContext=o,exports.I18nProvider=({children:r,componentMapper:n,...t})=>e.jsx(o.Provider,{value:{componentMapper:n,...t},children:r}),exports.Md=({children:t,componentMapper:p,variables:c,...s})=>{const{componentMapper:i,...l}=r.useContext(o);return e.jsx(n,{options:{overrides:{...i,...p},...l,...s},children:a(t,c)})};
|
|
2
2
|
//# sourceMappingURL=client.cjs.map
|
package/dist/cjs/client.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.cjs","sources":["../i18n/src//components/I18nProvider.tsx","../i18n/src//helpers/injectVariables.ts","../i18n/src//components/Md.tsx"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"client.cjs","sources":["../i18n/src//components/I18nProvider.tsx","../i18n/src//helpers/injectVariables.ts","../i18n/src//components/Md.tsx"],"sourcesContent":["import { type MarkdownToJSX } from 'markdown-to-jsx';\nimport { type JSX, type ReactNode, createContext } from 'react';\n\nexport const I18nContext = createContext<\n {\n componentMapper: MarkdownToJSX.Overrides;\n } & Omit<MarkdownToJSX.Options, 'overrides'>\n>({\n componentMapper: {},\n});\n\nexport type I18nProviderProps = {\n children: ReactNode;\n componentMapper: MarkdownToJSX.Overrides;\n} & Omit<MarkdownToJSX.Options, 'overrides'>;\n\nexport const I18nProvider = ({\n children,\n componentMapper,\n ...markdownToJsxOptions\n}: I18nProviderProps): JSX.Element => {\n return <I18nContext.Provider value={{ componentMapper, ...markdownToJsxOptions }}>{children}</I18nContext.Provider>;\n};\n","const extractTemplateVariables = /{{[^\\s{}]+}}/g;\nconst extractVarName = /{{ *([^ }]*) *}}/;\n\nexport const injectVariables = (markdown: string, variables?: Record<string, string | number>): string =>\n variables\n ? // @ts-expect-error lib config needs updating\n markdown.replaceAll(extractTemplateVariables, (match: string) => {\n const varName = match.replace(extractVarName, '$1');\n const replacementValue = variables[varName];\n\n if (replacementValue) {\n return replacementValue;\n }\n\n throw new Error(`Markdown contains un-replaced variable '${varName}'`);\n })\n : markdown;\n","import MarkdownToJsx, { type MarkdownToJSX } from 'markdown-to-jsx';\nimport { type JSX, useContext } from 'react';\nimport { I18nContext } from '#components/I18nProvider.tsx';\nimport { injectVariables } from '#helpers/injectVariables.ts';\n\nexport type MdProps = {\n // The markdown to convert into JSX.\n children: string;\n // An object of key/value pairs, with the key being the\n // name of the html tag that maps to supported markdown or\n // the name of a React component, and the value being a\n // React component. This prop is designed as an override\n // for the componentMapper passed into the I18nProvider.\n componentMapper?: MarkdownToJSX.Overrides;\n // An object of key/value pairs for content with template variables.\n variables?: Record<string, string | number>;\n} & Omit<MarkdownToJSX.Options, 'overrides'>;\n\nexport const Md = ({\n children,\n componentMapper: componentMapperOverrides,\n variables,\n ...markdownToJsxOptionOverrides\n}: MdProps): JSX.Element => {\n const { componentMapper, ...markdownToJsxOptions } = useContext(I18nContext);\n\n return (\n <MarkdownToJsx\n options={{\n overrides: { ...componentMapper, ...componentMapperOverrides },\n ...markdownToJsxOptions,\n ...markdownToJsxOptionOverrides,\n }}\n >\n {injectVariables(children, variables)}\n </MarkdownToJsx>\n );\n};\n"],"names":["I18nContext","createContext","componentMapper","extractTemplateVariables","extractVarName","injectVariables","markdown","variables","replaceAll","match","varName","replace","replacementValue","Error","children","markdownToJsxOptions","_jsx","Provider","value","componentMapperOverrides","markdownToJsxOptionOverrides","useContext","MarkdownToJsx","options","overrides"],"mappings":"gGAGO,MAAMA,EAAcC,EAAAA,cAIzB,CACAC,gBAAiB,CAAA,ICRbC,EAA2B,gBAC3BC,EAAiB,mBAEVC,EAAkB,CAACC,EAAkBC,IAChDA,EAEID,EAASE,WAAWL,EAA2BM,IAC7C,MAAMC,EAAUD,EAAME,QAAQP,EAAgB,MACxCQ,EAAmBL,EAAUG,GAEnC,GAAIE,EACF,OAAOA,EAGT,MAAM,IAAIC,MAAM,2CAA2CH,QAE7DJ,6CDAsB,EAC1BQ,WACAZ,qBACGa,KAEIC,EAAAA,IAAChB,EAAYiB,SAAQ,CAACC,MAAO,CAAEhB,qBAAoBa,GAAyBD,SAAAA,eEHnE,EAChBA,WACAZ,gBAAiBiB,EACjBZ,eACGa,MAEH,MAAMlB,gBAAEA,KAAoBa,GAAyBM,EAAAA,WAAWrB,GAEhE,OACEgB,EAAAA,IAACM,EAAAA,CACCC,QAAS,CACPC,UAAW,IAAKtB,KAAoBiB,MACjCJ,KACAK,GAGJf,SAAAA,EAAgBS,EAAUP"}
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../i18n/src//main.ts"],"sourcesContent":["import { type AnyRecord, type Path, createConfigReader } from 'zcb';\nimport { type CreateI18nResult } from '#types.ts';\n\nexport const createI18n = <U extends object>(i18n: U): CreateI18nResult<U> => {\n const reader = createConfigReader<U>(i18n);\n\n return {\n // @ts-expect-error intentionally ignoring the type checking here as\n // function is supposed to be untyped.\n t: (key: string, variables?: AnyRecord): string | undefined => reader.read(key, variables),\n tt: <P extends Path<U>>(path: P, variables?: AnyRecord) => {\n const result = reader.read(path, variables);\n\n // This can resolve to a falsy value at runtime\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!result) {\n throw new Error(`Path \"${String(path)}\" did not resolve to a value`);\n }\n\n return result;\n },\n };\n};\n"],"names":["i18n","reader","createConfigReader","t","key","variables","read","tt","path","result","Error","String"],"mappings":"qDAG6CA,IAC3C,MAAMC,EAASC,
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../i18n/src//main.ts"],"sourcesContent":["import { type AnyRecord, type Path, createConfigReader } from 'zcb';\nimport { type CreateI18nResult } from '#types.ts';\n\nexport const createI18n = <U extends object>(i18n: U): CreateI18nResult<U> => {\n const reader = createConfigReader<U>(i18n);\n\n return {\n // @ts-expect-error intentionally ignoring the type checking here as\n // function is supposed to be untyped.\n t: (key: string, variables?: AnyRecord): string | undefined => reader.read(key, variables),\n tt: <P extends Path<U>>(path: P, variables?: AnyRecord) => {\n const result = reader.read(path, variables);\n\n // This can resolve to a falsy value at runtime\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!result) {\n throw new Error(`Path \"${String(path)}\" did not resolve to a value`);\n }\n\n return result;\n },\n };\n};\n"],"names":["i18n","reader","createConfigReader","t","key","variables","read","tt","path","result","Error","String"],"mappings":"qDAG6CA,IAC3C,MAAMC,EAASC,EAAAA,mBAAsBF,GAErC,MAAO,CAGLG,EAAG,CAACC,EAAaC,IAA8CJ,EAAOK,KAAKF,EAAKC,GAChFE,GAAI,CAAoBC,EAASH,KAC/B,MAAMI,EAASR,EAAOK,KAAKE,EAAMH,GAIjC,IAAKI,EACH,MAAM,IAAIC,MAAM,SAASC,OAAOH,kCAGlC,OAAOC"}
|
package/dist/cjs/macros.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macros.cjs","sources":["../i18n/src//constants.ts","../i18n/src//macros.ts","../i18n/src//helpers/loadConfig.ts"],"sourcesContent":["export const CONFIG_FILENAME = '.i18n-macro.config.json';\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { loadConfig } from '#helpers/loadConfig.ts';\n\nconst { NEXT_PUBLIC_LANGUAGE_CODE } = process.env;\n\nexport const md = <P extends string>(path: P): P => {\n if (!path) {\n throw new Error('md expected a path, but received none');\n }\n\n let dir = process.cwd();\n let { markdownDir } = loadConfig();\n\n if (markdownDir) {\n if (NEXT_PUBLIC_LANGUAGE_CODE) {\n markdownDir = markdownDir.replaceAll('{{NEXT_PUBLIC_LANGUAGE_CODE}}', NEXT_PUBLIC_LANGUAGE_CODE);\n }\n\n dir = resolve(dir, markdownDir);\n }\n\n const fullPath = resolve(dir, path);\n // @ts-expect-error `md` function runs and build time and its return value\n // replaces the `md` invocation. We are forcing the return type to be the\n // input type to aid type inference when using `createI18n` and its\n // `tt` content resolvers.\n return readFileSync(fullPath, { encoding: 'utf8' }).trim();\n};\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONFIG_FILENAME } from '#constants.ts';\nimport { type MacrosConfig } from '#types.ts';\n\nexport const loadConfig = (): Partial<MacrosConfig> => {\n let config: Partial<MacrosConfig> = {};\n\n try {\n // JSON.parse returns an any time\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n config = JSON.parse(\n readFileSync(resolve(process.cwd(), CONFIG_FILENAME), { encoding: 'utf8' }),\n ) as Partial<MacrosConfig>;\n } catch {\n // no catch\n }\n\n return config;\n};\n"],"names":["NEXT_PUBLIC_LANGUAGE_CODE","process","env","path","Error","dir","cwd","markdownDir","config","JSON","parse","readFileSync","resolve","encoding","loadConfig","replaceAll","fullPath","trim"],"mappings":"6DAAO,MCIDA,0BAAEA,GAA8BC,QAAQC,eAETC,IACnC,IAAKA,EACH,MAAM,IAAIC,MAAM,yCAGlB,IAAIC,EAAMJ,QAAQK,OACdC,YAAEA,GCPkB,MACxB,IAAIC,EAAgC,
|
|
1
|
+
{"version":3,"file":"macros.cjs","sources":["../i18n/src//constants.ts","../i18n/src//macros.ts","../i18n/src//helpers/loadConfig.ts"],"sourcesContent":["export const CONFIG_FILENAME = '.i18n-macro.config.json';\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { loadConfig } from '#helpers/loadConfig.ts';\n\nconst { NEXT_PUBLIC_LANGUAGE_CODE } = process.env;\n\nexport const md = <P extends string>(path: P): P => {\n if (!path) {\n throw new Error('md expected a path, but received none');\n }\n\n let dir = process.cwd();\n let { markdownDir } = loadConfig();\n\n if (markdownDir) {\n if (NEXT_PUBLIC_LANGUAGE_CODE) {\n markdownDir = markdownDir.replaceAll('{{NEXT_PUBLIC_LANGUAGE_CODE}}', NEXT_PUBLIC_LANGUAGE_CODE);\n }\n\n dir = resolve(dir, markdownDir);\n }\n\n const fullPath = resolve(dir, path);\n // @ts-expect-error `md` function runs and build time and its return value\n // replaces the `md` invocation. We are forcing the return type to be the\n // input type to aid type inference when using `createI18n` and its\n // `tt` content resolvers.\n return readFileSync(fullPath, { encoding: 'utf8' }).trim();\n};\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONFIG_FILENAME } from '#constants.ts';\nimport { type MacrosConfig } from '#types.ts';\n\nexport const loadConfig = (): Partial<MacrosConfig> => {\n let config: Partial<MacrosConfig> = {};\n\n try {\n // JSON.parse returns an any time\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n config = JSON.parse(\n readFileSync(resolve(process.cwd(), CONFIG_FILENAME), { encoding: 'utf8' }),\n ) as Partial<MacrosConfig>;\n } catch {\n // no catch\n }\n\n return config;\n};\n"],"names":["NEXT_PUBLIC_LANGUAGE_CODE","process","env","path","Error","dir","cwd","markdownDir","config","JSON","parse","readFileSync","resolve","encoding","loadConfig","replaceAll","fullPath","trim"],"mappings":"6DAAO,MCIDA,0BAAEA,GAA8BC,QAAQC,eAETC,IACnC,IAAKA,EACH,MAAM,IAAIC,MAAM,yCAGlB,IAAIC,EAAMJ,QAAQK,OACdC,YAAEA,GCPkB,MACxB,IAAIC,EAAgC,CAAA,EAEpC,IAGEA,EAASC,KAAKC,MACZC,EAAAA,aAAaC,EAAAA,QAAQX,QAAQK,MFZJ,2BEY6B,CAAEO,SAAU,SAEtE,CAAE,MAEF,CAEA,OAAOL,GDNeM,GAElBP,IACEP,IACFO,EAAcA,EAAYQ,WAAW,gCAAiCf,IAGxEK,EAAMO,EAAAA,QAAQP,EAAKE,IAGrB,MAAMS,EAAWJ,EAAAA,QAAQP,EAAKF,GAK9B,OAAOQ,EAAAA,aAAaK,EAAU,CAAEH,SAAU,SAAUI"}
|
package/dist/esm/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{createContext as e,useContext as o}from"react";import n from"markdown-to-jsx";const p=e({componentMapper:{}}),t=({children:e,componentMapper:o,...n})=>r(p.Provider,{value:{componentMapper:o,...n},children:e}),a=/{{[^\s{}]+}}/g,c=/{{ *([^ }]*) *}}/,i=(r,e)=>e?r.replaceAll(a,
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{createContext as e,useContext as o}from"react";import n from"markdown-to-jsx";const p=e({componentMapper:{}}),t=({children:e,componentMapper:o,...n})=>r(p.Provider,{value:{componentMapper:o,...n},children:e}),a=/{{[^\s{}]+}}/g,c=/{{ *([^ }]*) *}}/,i=(r,e)=>e?r.replaceAll(a,r=>{const o=r.replace(c,"$1"),n=e[o];if(n)return n;throw new Error(`Markdown contains un-replaced variable '${o}'`)}):r,m=({children:e,componentMapper:t,variables:a,...c})=>{const{componentMapper:m,...l}=o(p);return r(n,{options:{overrides:{...m,...t},...l,...c},children:i(e,a)})};export{p as I18nContext,t as I18nProvider,m as Md};
|
|
2
2
|
//# sourceMappingURL=client.mjs.map
|
package/dist/esm/client.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","sources":["../i18n/src//components/I18nProvider.tsx","../i18n/src//helpers/injectVariables.ts","../i18n/src//components/Md.tsx"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"client.mjs","sources":["../i18n/src//components/I18nProvider.tsx","../i18n/src//helpers/injectVariables.ts","../i18n/src//components/Md.tsx"],"sourcesContent":["import { type MarkdownToJSX } from 'markdown-to-jsx';\nimport { type JSX, type ReactNode, createContext } from 'react';\n\nexport const I18nContext = createContext<\n {\n componentMapper: MarkdownToJSX.Overrides;\n } & Omit<MarkdownToJSX.Options, 'overrides'>\n>({\n componentMapper: {},\n});\n\nexport type I18nProviderProps = {\n children: ReactNode;\n componentMapper: MarkdownToJSX.Overrides;\n} & Omit<MarkdownToJSX.Options, 'overrides'>;\n\nexport const I18nProvider = ({\n children,\n componentMapper,\n ...markdownToJsxOptions\n}: I18nProviderProps): JSX.Element => {\n return <I18nContext.Provider value={{ componentMapper, ...markdownToJsxOptions }}>{children}</I18nContext.Provider>;\n};\n","const extractTemplateVariables = /{{[^\\s{}]+}}/g;\nconst extractVarName = /{{ *([^ }]*) *}}/;\n\nexport const injectVariables = (markdown: string, variables?: Record<string, string | number>): string =>\n variables\n ? // @ts-expect-error lib config needs updating\n markdown.replaceAll(extractTemplateVariables, (match: string) => {\n const varName = match.replace(extractVarName, '$1');\n const replacementValue = variables[varName];\n\n if (replacementValue) {\n return replacementValue;\n }\n\n throw new Error(`Markdown contains un-replaced variable '${varName}'`);\n })\n : markdown;\n","import MarkdownToJsx, { type MarkdownToJSX } from 'markdown-to-jsx';\nimport { type JSX, useContext } from 'react';\nimport { I18nContext } from '#components/I18nProvider.tsx';\nimport { injectVariables } from '#helpers/injectVariables.ts';\n\nexport type MdProps = {\n // The markdown to convert into JSX.\n children: string;\n // An object of key/value pairs, with the key being the\n // name of the html tag that maps to supported markdown or\n // the name of a React component, and the value being a\n // React component. This prop is designed as an override\n // for the componentMapper passed into the I18nProvider.\n componentMapper?: MarkdownToJSX.Overrides;\n // An object of key/value pairs for content with template variables.\n variables?: Record<string, string | number>;\n} & Omit<MarkdownToJSX.Options, 'overrides'>;\n\nexport const Md = ({\n children,\n componentMapper: componentMapperOverrides,\n variables,\n ...markdownToJsxOptionOverrides\n}: MdProps): JSX.Element => {\n const { componentMapper, ...markdownToJsxOptions } = useContext(I18nContext);\n\n return (\n <MarkdownToJsx\n options={{\n overrides: { ...componentMapper, ...componentMapperOverrides },\n ...markdownToJsxOptions,\n ...markdownToJsxOptionOverrides,\n }}\n >\n {injectVariables(children, variables)}\n </MarkdownToJsx>\n );\n};\n"],"names":["I18nContext","createContext","componentMapper","I18nProvider","children","markdownToJsxOptions","_jsx","Provider","value","extractTemplateVariables","extractVarName","injectVariables","markdown","variables","replaceAll","match","varName","replace","replacementValue","Error","Md","componentMapperOverrides","markdownToJsxOptionOverrides","useContext","MarkdownToJsx","options","overrides"],"mappings":"6HAGO,MAAMA,EAAcC,EAIzB,CACAC,gBAAiB,CAAA,IAQNC,EAAe,EAC1BC,WACAF,qBACGG,KAEIC,EAACN,EAAYO,SAAQ,CAACC,MAAO,CAAEN,qBAAoBG,GAAyBD,SAAAA,ICrB/EK,EAA2B,gBAC3BC,EAAiB,mBAEVC,EAAkB,CAACC,EAAkBC,IAChDA,EAEID,EAASE,WAAWL,EAA2BM,IAC7C,MAAMC,EAAUD,EAAME,QAAQP,EAAgB,MACxCQ,EAAmBL,EAAUG,GAEnC,GAAIE,EACF,OAAOA,EAGT,MAAM,IAAIC,MAAM,2CAA2CH,QAE7DJ,ECEOQ,EAAK,EAChBhB,WACAF,gBAAiBmB,EACjBR,eACGS,MAEH,MAAMpB,gBAAEA,KAAoBG,GAAyBkB,EAAWvB,GAEhE,OACEM,EAACkB,EAAAA,CACCC,QAAS,CACPC,UAAW,IAAKxB,KAAoBmB,MACjChB,KACAiB,GAGJX,SAAAA,EAAgBP,EAAUS"}
|
package/dist/esm/macros.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macros.mjs","sources":["../i18n/src//constants.ts","../i18n/src//macros.ts","../i18n/src//helpers/loadConfig.ts"],"sourcesContent":["export const CONFIG_FILENAME = '.i18n-macro.config.json';\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { loadConfig } from '#helpers/loadConfig.ts';\n\nconst { NEXT_PUBLIC_LANGUAGE_CODE } = process.env;\n\nexport const md = <P extends string>(path: P): P => {\n if (!path) {\n throw new Error('md expected a path, but received none');\n }\n\n let dir = process.cwd();\n let { markdownDir } = loadConfig();\n\n if (markdownDir) {\n if (NEXT_PUBLIC_LANGUAGE_CODE) {\n markdownDir = markdownDir.replaceAll('{{NEXT_PUBLIC_LANGUAGE_CODE}}', NEXT_PUBLIC_LANGUAGE_CODE);\n }\n\n dir = resolve(dir, markdownDir);\n }\n\n const fullPath = resolve(dir, path);\n // @ts-expect-error `md` function runs and build time and its return value\n // replaces the `md` invocation. We are forcing the return type to be the\n // input type to aid type inference when using `createI18n` and its\n // `tt` content resolvers.\n return readFileSync(fullPath, { encoding: 'utf8' }).trim();\n};\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONFIG_FILENAME } from '#constants.ts';\nimport { type MacrosConfig } from '#types.ts';\n\nexport const loadConfig = (): Partial<MacrosConfig> => {\n let config: Partial<MacrosConfig> = {};\n\n try {\n // JSON.parse returns an any time\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n config = JSON.parse(\n readFileSync(resolve(process.cwd(), CONFIG_FILENAME), { encoding: 'utf8' }),\n ) as Partial<MacrosConfig>;\n } catch {\n // no catch\n }\n\n return config;\n};\n"],"names":["NEXT_PUBLIC_LANGUAGE_CODE","process","env","md","path","Error","dir","cwd","markdownDir","config","JSON","parse","readFileSync","resolve","encoding","loadConfig","replaceAll","fullPath","trim"],"mappings":"2EAAO,MCIDA,0BAAEA,GAA8BC,QAAQC,IAEjCC,EAAwBC,IACnC,IAAKA,EACH,MAAM,IAAIC,MAAM,yCAGlB,IAAIC,EAAML,QAAQM,OACdC,YAAEA,GCPkB,MACxB,IAAIC,EAAgC,
|
|
1
|
+
{"version":3,"file":"macros.mjs","sources":["../i18n/src//constants.ts","../i18n/src//macros.ts","../i18n/src//helpers/loadConfig.ts"],"sourcesContent":["export const CONFIG_FILENAME = '.i18n-macro.config.json';\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { loadConfig } from '#helpers/loadConfig.ts';\n\nconst { NEXT_PUBLIC_LANGUAGE_CODE } = process.env;\n\nexport const md = <P extends string>(path: P): P => {\n if (!path) {\n throw new Error('md expected a path, but received none');\n }\n\n let dir = process.cwd();\n let { markdownDir } = loadConfig();\n\n if (markdownDir) {\n if (NEXT_PUBLIC_LANGUAGE_CODE) {\n markdownDir = markdownDir.replaceAll('{{NEXT_PUBLIC_LANGUAGE_CODE}}', NEXT_PUBLIC_LANGUAGE_CODE);\n }\n\n dir = resolve(dir, markdownDir);\n }\n\n const fullPath = resolve(dir, path);\n // @ts-expect-error `md` function runs and build time and its return value\n // replaces the `md` invocation. We are forcing the return type to be the\n // input type to aid type inference when using `createI18n` and its\n // `tt` content resolvers.\n return readFileSync(fullPath, { encoding: 'utf8' }).trim();\n};\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONFIG_FILENAME } from '#constants.ts';\nimport { type MacrosConfig } from '#types.ts';\n\nexport const loadConfig = (): Partial<MacrosConfig> => {\n let config: Partial<MacrosConfig> = {};\n\n try {\n // JSON.parse returns an any time\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n config = JSON.parse(\n readFileSync(resolve(process.cwd(), CONFIG_FILENAME), { encoding: 'utf8' }),\n ) as Partial<MacrosConfig>;\n } catch {\n // no catch\n }\n\n return config;\n};\n"],"names":["NEXT_PUBLIC_LANGUAGE_CODE","process","env","md","path","Error","dir","cwd","markdownDir","config","JSON","parse","readFileSync","resolve","encoding","loadConfig","replaceAll","fullPath","trim"],"mappings":"2EAAO,MCIDA,0BAAEA,GAA8BC,QAAQC,IAEjCC,EAAwBC,IACnC,IAAKA,EACH,MAAM,IAAIC,MAAM,yCAGlB,IAAIC,EAAML,QAAQM,OACdC,YAAEA,GCPkB,MACxB,IAAIC,EAAgC,CAAA,EAEpC,IAGEA,EAASC,KAAKC,MACZC,EAAaC,EAAQZ,QAAQM,MFZJ,2BEY6B,CAAEO,SAAU,SAEtE,CAAE,MAEF,CAEA,OAAOL,GDNeM,GAElBP,IACER,IACFQ,EAAcA,EAAYQ,WAAW,gCAAiChB,IAGxEM,EAAMO,EAAQP,EAAKE,IAGrB,MAAMS,EAAWJ,EAAQP,EAAKF,GAK9B,OAAOQ,EAAaK,EAAU,CAAEH,SAAU,SAAUI"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type
|
|
3
|
-
import { type ComponentMapper } from '#types.cts';
|
|
1
|
+
import { type MarkdownToJSX } from 'markdown-to-jsx';
|
|
2
|
+
import { type JSX, type ReactNode } from 'react';
|
|
4
3
|
export declare const I18nContext: import("react").Context<{
|
|
5
|
-
componentMapper:
|
|
4
|
+
componentMapper: MarkdownToJSX.Overrides;
|
|
6
5
|
} & Omit<Partial<{
|
|
7
|
-
createElement: (tag: Parameters<
|
|
6
|
+
createElement: (tag: Parameters<MarkdownToJSX.CreateElement>[0], props: JSX.IntrinsicAttributes, ...children: ReactNode[]) => ReactNode;
|
|
8
7
|
disableAutoLink: boolean;
|
|
9
8
|
disableParsingRawHTML: boolean;
|
|
10
9
|
enforceAtxHeadings: boolean;
|
|
@@ -14,15 +13,15 @@ export declare const I18nContext: import("react").Context<{
|
|
|
14
13
|
namedCodesToUnicode: {
|
|
15
14
|
[key: string]: string;
|
|
16
15
|
};
|
|
17
|
-
overrides:
|
|
18
|
-
renderRule: (next: () => ReactNode, node:
|
|
19
|
-
sanitizer: (value: string, tag:
|
|
16
|
+
overrides: MarkdownToJSX.Overrides;
|
|
17
|
+
renderRule: (next: () => ReactNode, node: MarkdownToJSX.ParserResult, renderChildren: MarkdownToJSX.RuleOutput, state: MarkdownToJSX.State) => ReactNode;
|
|
18
|
+
sanitizer: (value: string, tag: MarkdownToJSX.HTMLTags, attribute: string) => string | null;
|
|
20
19
|
slugify: (input: string, defaultFn: (input: string) => string) => string;
|
|
21
20
|
wrapper: import("react").ElementType | null;
|
|
22
|
-
}
|
|
21
|
+
}>, "overrides">>;
|
|
23
22
|
export type I18nProviderProps = {
|
|
24
23
|
children: ReactNode;
|
|
25
|
-
componentMapper:
|
|
26
|
-
} & Omit<
|
|
24
|
+
componentMapper: MarkdownToJSX.Overrides;
|
|
25
|
+
} & Omit<MarkdownToJSX.Options, 'overrides'>;
|
|
27
26
|
export declare const I18nProvider: ({ children, componentMapper, ...markdownToJsxOptions }: I18nProviderProps) => JSX.Element;
|
|
28
27
|
//# sourceMappingURL=I18nProvider.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18nProvider.d.cts","sourceRoot":"","sources":["../../../../src/components/I18nProvider.ctsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"I18nProvider.d.cts","sourceRoot":"","sources":["../../../../src/components/I18nProvider.ctsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAEhE,eAAO,MAAM,WAAW;qBAEH,aAAa,CAAC,SAAS;;qGAkBy2U,GAAI;;;;;;;;;;;;;;;iBAdv5U,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,aAAa,CAAC,SAAS,CAAC;CAC1C,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAE7C,eAAO,MAAM,YAAY,GAAI,wDAI1B,iBAAiB,KAAG,GAAG,CAAC,OAE1B,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
3
|
-
import { type ComponentMapper } from '#types.cts';
|
|
1
|
+
import { type MarkdownToJSX } from 'markdown-to-jsx';
|
|
2
|
+
import { type JSX } from 'react';
|
|
4
3
|
export type MdProps = {
|
|
5
4
|
children: string;
|
|
6
|
-
componentMapper?:
|
|
5
|
+
componentMapper?: MarkdownToJSX.Overrides;
|
|
7
6
|
variables?: Record<string, string | number>;
|
|
8
|
-
} & Omit<
|
|
7
|
+
} & Omit<MarkdownToJSX.Options, 'overrides'>;
|
|
9
8
|
export declare const Md: ({ children, componentMapper: componentMapperOverrides, variables, ...markdownToJsxOptionOverrides }: MdProps) => JSX.Element;
|
|
10
9
|
//# sourceMappingURL=Md.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Md.d.cts","sourceRoot":"","sources":["../../../../src/components/Md.ctsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Md.d.cts","sourceRoot":"","sources":["../../../../src/components/Md.ctsx"],"names":[],"mappings":"AAAA,OAAsB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,KAAK,GAAG,EAAc,MAAM,OAAO,CAAC;AAI7C,MAAM,MAAM,OAAO,GAAG;IAEpB,QAAQ,EAAE,MAAM,CAAC;IAMjB,eAAe,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC;IAE1C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAC7C,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAE7C,eAAO,MAAM,EAAE,GAAI,qGAKhB,OAAO,KAAG,GAAG,CAAC,OAchB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectVariables.d.cts","sourceRoot":"","sources":["../../../../src/helpers/injectVariables.cts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"injectVariables.d.cts","sourceRoot":"","sources":["../../../../src/helpers/injectVariables.cts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAG,MAalF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macros.d.cts","sourceRoot":"","sources":["../../../src/macros.cts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,GAAI,CAAC,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"macros.d.cts","sourceRoot":"","sources":["../../../src/macros.cts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,KAAG,CAsB9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.cts","sourceRoot":"","sources":["../../../src/main.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"main.d.cts","sourceRoot":"","sources":["../../../src/main.cts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,KAAG,gBAAgB,CAAC,CAAC,CAmBxE,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type ComponentType } from 'react';
|
|
2
1
|
import { type AnyRecord, type ConfigReader } from 'zcb';
|
|
3
|
-
export type ComponentMapper = Record<string, ComponentType<any>>;
|
|
4
2
|
export type CreateI18nResult<U extends object> = {
|
|
5
3
|
t: (key: string, variables?: AnyRecord) => string | undefined;
|
|
6
4
|
tt: ConfigReader<U>['read'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/types.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/types.cts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAExD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IAI/C,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,KAAK,MAAM,GAAG,SAAS,CAAC;IAM9D,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAMzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type
|
|
3
|
-
import { type ComponentMapper } from '#types.ts';
|
|
1
|
+
import { type MarkdownToJSX } from 'markdown-to-jsx';
|
|
2
|
+
import { type JSX, type ReactNode } from 'react';
|
|
4
3
|
export declare const I18nContext: import("react").Context<{
|
|
5
|
-
componentMapper:
|
|
4
|
+
componentMapper: MarkdownToJSX.Overrides;
|
|
6
5
|
} & Omit<Partial<{
|
|
7
|
-
createElement: (tag: Parameters<
|
|
6
|
+
createElement: (tag: Parameters<MarkdownToJSX.CreateElement>[0], props: JSX.IntrinsicAttributes, ...children: ReactNode[]) => ReactNode;
|
|
8
7
|
disableAutoLink: boolean;
|
|
9
8
|
disableParsingRawHTML: boolean;
|
|
10
9
|
enforceAtxHeadings: boolean;
|
|
@@ -14,15 +13,15 @@ export declare const I18nContext: import("react").Context<{
|
|
|
14
13
|
namedCodesToUnicode: {
|
|
15
14
|
[key: string]: string;
|
|
16
15
|
};
|
|
17
|
-
overrides:
|
|
18
|
-
renderRule: (next: () => ReactNode, node:
|
|
19
|
-
sanitizer: (value: string, tag:
|
|
16
|
+
overrides: MarkdownToJSX.Overrides;
|
|
17
|
+
renderRule: (next: () => ReactNode, node: MarkdownToJSX.ParserResult, renderChildren: MarkdownToJSX.RuleOutput, state: MarkdownToJSX.State) => ReactNode;
|
|
18
|
+
sanitizer: (value: string, tag: MarkdownToJSX.HTMLTags, attribute: string) => string | null;
|
|
20
19
|
slugify: (input: string, defaultFn: (input: string) => string) => string;
|
|
21
20
|
wrapper: import("react").ElementType | null;
|
|
22
|
-
}
|
|
21
|
+
}>, "overrides">>;
|
|
23
22
|
export type I18nProviderProps = {
|
|
24
23
|
children: ReactNode;
|
|
25
|
-
componentMapper:
|
|
26
|
-
} & Omit<
|
|
24
|
+
componentMapper: MarkdownToJSX.Overrides;
|
|
25
|
+
} & Omit<MarkdownToJSX.Options, 'overrides'>;
|
|
27
26
|
export declare const I18nProvider: ({ children, componentMapper, ...markdownToJsxOptions }: I18nProviderProps) => JSX.Element;
|
|
28
27
|
//# sourceMappingURL=I18nProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/I18nProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/I18nProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAEhE,eAAO,MAAM,WAAW;qBAEH,aAAa,CAAC,SAAS;;qGAkBy2U,GAAI;;;;;;;;;;;;;;;iBAdv5U,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,aAAa,CAAC,SAAS,CAAC;CAC1C,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAE7C,eAAO,MAAM,YAAY,GAAI,wDAI1B,iBAAiB,KAAG,GAAG,CAAC,OAE1B,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type
|
|
3
|
-
import { type ComponentMapper } from '#types.ts';
|
|
1
|
+
import { type MarkdownToJSX } from 'markdown-to-jsx';
|
|
2
|
+
import { type JSX } from 'react';
|
|
4
3
|
export type MdProps = {
|
|
5
4
|
children: string;
|
|
6
|
-
componentMapper?:
|
|
5
|
+
componentMapper?: MarkdownToJSX.Overrides;
|
|
7
6
|
variables?: Record<string, string | number>;
|
|
8
|
-
} & Omit<
|
|
7
|
+
} & Omit<MarkdownToJSX.Options, 'overrides'>;
|
|
9
8
|
export declare const Md: ({ children, componentMapper: componentMapperOverrides, variables, ...markdownToJsxOptionOverrides }: MdProps) => JSX.Element;
|
|
10
9
|
//# sourceMappingURL=Md.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Md.d.ts","sourceRoot":"","sources":["../../../../src/components/Md.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"Md.d.ts","sourceRoot":"","sources":["../../../../src/components/Md.tsx"],"names":[],"mappings":"AAAA,OAAsB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,KAAK,GAAG,EAAc,MAAM,OAAO,CAAC;AAI7C,MAAM,MAAM,OAAO,GAAG;IAEpB,QAAQ,EAAE,MAAM,CAAC;IAMjB,eAAe,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC;IAE1C,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CAC7C,GAAG,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAE7C,eAAO,MAAM,EAAE,GAAI,qGAKhB,OAAO,KAAG,GAAG,CAAC,OAchB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injectVariables.d.ts","sourceRoot":"","sources":["../../../../src/helpers/injectVariables.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"injectVariables.d.ts","sourceRoot":"","sources":["../../../../src/helpers/injectVariables.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,EAAE,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAG,MAalF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macros.d.ts","sourceRoot":"","sources":["../../../src/macros.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,GAAI,CAAC,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"macros.d.ts","sourceRoot":"","sources":["../../../src/macros.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,EAAE,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,KAAG,CAsB9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,KAAG,gBAAgB,CAAC,CAAC,CAmBxE,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type ComponentType } from 'react';
|
|
2
1
|
import { type AnyRecord, type ConfigReader } from 'zcb';
|
|
3
|
-
export type ComponentMapper = Record<string, ComponentType<any>>;
|
|
4
2
|
export type CreateI18nResult<U extends object> = {
|
|
5
3
|
t: (key: string, variables?: AnyRecord) => string | undefined;
|
|
6
4
|
tt: ConfigReader<U>['read'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,KAAK,CAAC;AAExD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IAI/C,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,SAAS,KAAK,MAAM,GAAG,SAAS,CAAC;IAM9D,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAMzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|