@next-box/i18n 0.1.1 → 0.1.3

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.
Files changed (62) hide show
  1. package/README.md +3 -1
  2. package/dist/cjs/client.cjs +2 -1
  3. package/dist/cjs/client.cjs.map +1 -1
  4. package/dist/cjs/components/I18nProvider.cjs +3 -0
  5. package/dist/cjs/components/I18nProvider.cjs.map +1 -0
  6. package/dist/cjs/components/Md.cjs +3 -0
  7. package/dist/cjs/components/Md.cjs.map +1 -0
  8. package/dist/cjs/constants.cjs +2 -0
  9. package/dist/cjs/constants.cjs.map +1 -0
  10. package/dist/cjs/helpers/injectVariables.cjs +2 -0
  11. package/dist/cjs/helpers/injectVariables.cjs.map +1 -0
  12. package/dist/cjs/helpers/loadConfig.cjs +2 -0
  13. package/dist/cjs/helpers/loadConfig.cjs.map +1 -0
  14. package/dist/cjs/index.cjs +1 -1
  15. package/dist/cjs/index.cjs.map +1 -1
  16. package/dist/cjs/macros.cjs +1 -1
  17. package/dist/cjs/macros.cjs.map +1 -1
  18. package/dist/cjs/main.cjs +2 -0
  19. package/dist/cjs/main.cjs.map +1 -0
  20. package/dist/esm/client.mjs +2 -1
  21. package/dist/esm/client.mjs.map +1 -1
  22. package/dist/esm/components/I18nProvider.mjs +3 -0
  23. package/dist/esm/components/I18nProvider.mjs.map +1 -0
  24. package/dist/esm/components/Md.mjs +3 -0
  25. package/dist/esm/components/Md.mjs.map +1 -0
  26. package/dist/esm/constants.mjs +2 -0
  27. package/dist/esm/constants.mjs.map +1 -0
  28. package/dist/esm/helpers/injectVariables.mjs +2 -0
  29. package/dist/esm/helpers/injectVariables.mjs.map +1 -0
  30. package/dist/esm/helpers/loadConfig.mjs +2 -0
  31. package/dist/esm/helpers/loadConfig.mjs.map +1 -0
  32. package/dist/esm/index.mjs +1 -1
  33. package/dist/esm/index.mjs.map +1 -1
  34. package/dist/esm/macros.mjs +1 -1
  35. package/dist/esm/macros.mjs.map +1 -1
  36. package/dist/esm/main.mjs +2 -0
  37. package/dist/esm/main.mjs.map +1 -0
  38. package/dist/production.analysis.txt +10 -10
  39. package/dist/types/cjs/client.d.cts.map +1 -1
  40. package/dist/types/cjs/components/I18nProvider.d.cts.map +1 -1
  41. package/dist/types/cjs/components/Md.d.cts.map +1 -1
  42. package/dist/types/cjs/helpers/injectVariables.d.cts.map +1 -1
  43. package/dist/types/cjs/main.d.cts.map +1 -1
  44. package/dist/types/esm/client.d.ts.map +1 -1
  45. package/dist/types/esm/components/I18nProvider.d.ts.map +1 -1
  46. package/dist/types/esm/components/Md.d.ts.map +1 -1
  47. package/dist/types/esm/helpers/injectVariables.d.ts.map +1 -1
  48. package/dist/types/esm/main.d.ts.map +1 -1
  49. package/dist/types/tsconfig.build.tsbuildinfo +1 -1
  50. package/package.json +13 -12
  51. package/rollup.config.mjs +1 -9
  52. package/src/client.ts +2 -0
  53. package/src/components/I18nProvider.tsx +2 -0
  54. package/src/components/Md.test.tsx +34 -32
  55. package/src/components/Md.tsx +2 -0
  56. package/src/helpers/injectVariables.test.ts +37 -0
  57. package/src/helpers/injectVariables.ts +3 -4
  58. package/src/macros.test.ts +34 -21
  59. package/src/main.test.ts +98 -62
  60. package/src/main.ts +0 -2
  61. package/src/types.ts +1 -1
  62. package/tsconfig.json +3 -0
package/README.md CHANGED
@@ -197,8 +197,10 @@ The `md` macro is designed to be used with the `Md` markdown render component an
197
197
  The example below illustrates how to use the `md` macro, `I18nProvider`, and `Md` component together.
198
198
 
199
199
  ```tsx
200
+ 'use client';
201
+
200
202
  import { md } from '@next-box/i18n/macros' with { type: 'macro' };
201
- import { I18nProvider, Md } from '@next-box/i18n';
203
+ import { I18nProvider, Md } from '@next-box/i18n/client';
202
204
  import { componentMapper } from './componentMapper.ts';
203
205
 
204
206
  export const Component = () => {
@@ -1,2 +1,3 @@
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,{value:{componentMapper:n,...t},children:r}),exports.Md=({children:t,componentMapper:p,variables:c,...s})=>{const{componentMapper:i,...l}=r.use(o);return e.jsx(n,{options:{overrides:{...i,...p},...l,...s},children:a(t,c)})};
1
+ "use client";
2
+ "use strict";var e=require("./components/I18nProvider.cjs"),r=require("./components/Md.cjs");exports.I18nContext=e.I18nContext,exports.I18nProvider=e.I18nProvider,exports.Md=r.Md;
2
3
  //# sourceMappingURL=client.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.cjs","sources":["../../src/components/I18nProvider.tsx","../../src/helpers/injectVariables.ts","../../src/components/Md.tsx"],"sourcesContent":["import { type MarkdownToJSX } from 'markdown-to-jsx';\nimport { type FC, 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: FC<I18nProviderProps> = ({ children, componentMapper, ...markdownToJsxOptions }) => {\n return <I18nContext value={{ componentMapper, ...markdownToJsxOptions }}>{children}</I18nContext>;\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 FC, use } 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: FC<MdProps> = ({\n children,\n componentMapper: componentMapperOverrides,\n variables,\n ...markdownToJsxOptionOverrides\n}) => {\n const { componentMapper, ...markdownToJsxOptions } = use(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","value","componentMapperOverrides","markdownToJsxOptionOverrides","use","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,6CDA6C,EAAGQ,WAAUZ,qBAAoBa,KAC3EC,EAAAA,IAAChB,EAAAA,CAAYiB,MAAO,CAAEf,qBAAoBa,GAAyBD,SAAAA,eEC7C,EAC7BA,WACAZ,gBAAiBgB,EACjBX,eACGY,MAEH,MAAMjB,gBAAEA,KAAoBa,GAAyBK,EAAAA,IAAIpB,GAEzD,OACEgB,EAAAA,IAACK,EAAAA,CACCC,QAAS,CACPC,UAAW,IAAKrB,KAAoBgB,MACjCH,KACAI,GAGJd,SAAAA,EAAgBS,EAAUP"}
1
+ {"version":3,"file":"client.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ "use strict";var e=require("react/jsx-runtime");const r=require("react").createContext({componentMapper:{}});exports.I18nContext=r,exports.I18nProvider=({children:t,componentMapper:n,...o})=>e.jsx(r,{value:{componentMapper:n,...o},children:t});
3
+ //# sourceMappingURL=I18nProvider.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"I18nProvider.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ "use strict";var e=require("react/jsx-runtime"),r=require("markdown-to-jsx"),i=require("react"),n=require("./I18nProvider.cjs"),s=require("../helpers/injectVariables.cjs");exports.Md=({children:t,componentMapper:o,variables:a,...c})=>{const{componentMapper:p,...u}=i.use(n.I18nContext);return e.jsx(r,{options:{overrides:{...p,...o},...u,...c},children:s.injectVariables(t,a)})};
3
+ //# sourceMappingURL=Md.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Md.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,2 @@
1
+ "use strict";exports.CONFIG_FILENAME=".i18n-macro.config.json";
2
+ //# sourceMappingURL=constants.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.cjs","sources":["../../src/constants.ts"],"sourcesContent":["export const CONFIG_FILENAME = '.i18n-macro.config.json';\n"],"names":[],"mappings":"qCAA+B"}
@@ -0,0 +1,2 @@
1
+ "use strict";const r=/{{[^\s{}]+}}/g,e=/{{ *([^ }]*) *}}/;exports.injectVariables=(n,t)=>t?n.replaceAll(r,r=>{const n=r.replace(e,"$1"),a=t[n];if(void 0!==a)return String(a);throw new Error(`Markdown contains un-replaced variable '${n}'`)}):n;
2
+ //# sourceMappingURL=injectVariables.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectVariables.cjs","sources":["../../../src/helpers/injectVariables.ts"],"sourcesContent":["const extractTemplateVariables = /{{[^\\s{}]+}}/g;\nconst extractVarName = /{{ *([^ }]*) *}}/;\n\nexport const injectVariables = (markdown: string, variables?: Record<string, string | number>): string =>\n variables\n ? markdown.replaceAll(extractTemplateVariables, (match: string) => {\n const varName = match.replace(extractVarName, '$1');\n const replacementValue = variables[varName];\n\n if (replacementValue !== undefined) {\n return String(replacementValue);\n }\n\n throw new Error(`Markdown contains un-replaced variable '${varName}'`);\n })\n : markdown;\n"],"names":["extractTemplateVariables","extractVarName","markdown","variables","replaceAll","match","varName","replace","replacementValue","undefined","String","Error"],"mappings":"aAAA,MAAMA,EAA2B,gBAC3BC,EAAiB,2CAEQ,CAACC,EAAkBC,IAChDA,EACID,EAASE,WAAWJ,EAA2BK,IAC7C,MAAMC,EAAUD,EAAME,QAAQN,EAAgB,MACxCO,EAAmBL,EAAUG,GAEnC,QAAyBG,IAArBD,EACF,OAAOE,OAAOF,GAGhB,MAAM,IAAIG,MAAM,2CAA2CL,QAE7DJ"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("node:fs"),r=require("node:path"),s=require("../constants.cjs");const t=process.cwd();exports.loadConfig=()=>{let c={};try{c=JSON.parse(e.readFileSync(r.resolve(t,s.CONFIG_FILENAME),{encoding:"utf8"}))}catch{}return c};
2
+ //# sourceMappingURL=loadConfig.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadConfig.cjs","sources":["../../../src/helpers/loadConfig.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONFIG_FILENAME } from '#constants.ts';\nimport { type MacrosConfig } from '#types.ts';\n\nconst cwd = process.cwd();\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(readFileSync(resolve(cwd, CONFIG_FILENAME), { encoding: 'utf8' })) as Partial<MacrosConfig>;\n } catch {\n // no catch\n }\n\n return config;\n};\n"],"names":["cwd","process","config","JSON","parse","readFileSync","resolve","CONFIG_FILENAME","encoding"],"mappings":"2FAKA,MAAMA,EAAMC,QAAQD,yBAEM,KACxB,IAAIE,EAAgC,CAAA,EAEpC,IAGEA,EAASC,KAAKC,MAAMC,EAAAA,aAAaC,EAAAA,QAAQN,EAAKO,EAAAA,iBAAkB,CAAEC,SAAU,SAC9E,CAAE,MAEF,CAEA,OAAON"}
@@ -1,2 +1,2 @@
1
- "use strict";var r=require("zcb");exports.createI18n=e=>{const t=r.createConfigReader(e);return{t:(r,e)=>t.read(r,e),tt:(r,e)=>{const o=t.read(r,e);if(void 0===o)throw new Error(`Path "${String(r)}" did not resolve to a value`);return o}}};
1
+ "use strict";var e=require("./main.cjs");exports.createI18n=e.createI18n;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/main.ts"],"sourcesContent":["import { type Get } from 'type-fest';\nimport { 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): Get<U, P> => {\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 === undefined) {\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","undefined","Error","String"],"mappings":"qDAI6CA,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,QAAeK,IAAXD,EACF,MAAM,IAAIE,MAAM,SAASC,OAAOJ,kCAGlC,OAAOC"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("node:fs"),r=require("node:path");const n=process.cwd(),{NEXT_PUBLIC_LANGUAGE_CODE:o}=process.env;exports.md=c=>{if(!c)throw new Error("md expected a path, but received none");let t=process.cwd(),{markdownDir:s}=(()=>{let o={};try{o=JSON.parse(e.readFileSync(r.resolve(n,".i18n-macro.config.json"),{encoding:"utf8"}))}catch{}return o})();s&&(o&&(s=s.replaceAll("{{NEXT_PUBLIC_LANGUAGE_CODE}}",()=>o)),t=r.resolve(t,s));const d=r.resolve(t,c);return e.readFileSync(d,{encoding:"utf8"}).trim()};
1
+ "use strict";var e=require("node:fs"),r=require("node:path"),o=require("./helpers/loadConfig.cjs");const{NEXT_PUBLIC_LANGUAGE_CODE:n}=process.env;exports.md=s=>{if(!s)throw new Error("md expected a path, but received none");let t=process.cwd(),{markdownDir:c}=o.loadConfig();c&&(n&&(c=c.replaceAll("{{NEXT_PUBLIC_LANGUAGE_CODE}}",()=>n)),t=r.resolve(t,c));const d=r.resolve(t,s);return e.readFileSync(d,{encoding:"utf8"}).trim()};
2
2
  //# sourceMappingURL=macros.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"macros.cjs","sources":["../../src/constants.ts","../../src/helpers/loadConfig.ts","../../src/macros.ts"],"sourcesContent":["export const CONFIG_FILENAME = '.i18n-macro.config.json';\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONFIG_FILENAME } from '#constants.ts';\nimport { type MacrosConfig } from '#types.ts';\n\nconst cwd = process.cwd();\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(readFileSync(resolve(cwd, CONFIG_FILENAME), { encoding: 'utf8' })) as Partial<MacrosConfig>;\n } catch {\n // no catch\n }\n\n return config;\n};\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"],"names":["cwd","process","NEXT_PUBLIC_LANGUAGE_CODE","env","path","Error","dir","markdownDir","config","JSON","parse","readFileSync","resolve","encoding","loadConfig","replaceAll","fullPath","trim"],"mappings":"6DAAO,MCKDA,EAAMC,QAAQD,OCDdE,0BAAEA,GAA8BD,QAAQE,eAETC,IACnC,IAAKA,EACH,MAAM,IAAIC,MAAM,yCAGlB,IAAIC,EAAML,QAAQD,OACdO,YAAEA,GDLkB,MACxB,IAAIC,EAAgC,CAAA,EAEpC,IAGEA,EAASC,KAAKC,MAAMC,EAAAA,aAAaC,EAAAA,QAAQZ,EDbd,2BCaqC,CAAEa,SAAU,SAC9E,CAAE,MAEF,CAEA,OAAOL,GCNeM,GAElBP,IACEL,IACFK,EAAcA,EAAYQ,WAAW,gCAAiC,IAAMb,IAG9EI,EAAMM,EAAAA,QAAQN,EAAKC,IAGrB,MAAMS,EAAWJ,EAAAA,QAAQN,EAAKF,GAK9B,OAAOO,EAAAA,aAAaK,EAAU,CAAEH,SAAU,SAAUI"}
1
+ {"version":3,"file":"macros.cjs","sources":["../../src/macros.ts"],"sourcesContent":["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"],"names":["NEXT_PUBLIC_LANGUAGE_CODE","process","env","path","Error","dir","cwd","markdownDir","loadConfig","replaceAll","resolve","fullPath","readFileSync","encoding","trim"],"mappings":"mGAIA,MAAMA,0BAAEA,GAA8BC,QAAQC,eAETC,IACnC,IAAKA,EACH,MAAM,IAAIC,MAAM,yCAGlB,IAAIC,EAAMJ,QAAQK,OACdC,YAAEA,GAAgBC,eAElBD,IACEP,IACFO,EAAcA,EAAYE,WAAW,gCAAiC,IAAMT,IAG9EK,EAAMK,EAAAA,QAAQL,EAAKE,IAGrB,MAAMI,EAAWD,EAAAA,QAAQL,EAAKF,GAK9B,OAAOS,EAAAA,aAAaD,EAAU,CAAEE,SAAU,SAAUC"}
@@ -0,0 +1,2 @@
1
+ "use strict";var r=require("zcb");exports.createI18n=e=>{const t=r.createConfigReader(e);return{t:(r,e)=>t.read(r,e),tt:(r,e)=>{const o=t.read(r,e);if(void 0===o)throw new Error(`Path "${String(r)}" did not resolve to a value`);return o}}};
2
+ //# sourceMappingURL=main.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.cjs","sources":["../../src/main.ts"],"sourcesContent":["import { type Get } from 'type-fest';\nimport { 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): Get<U, P> => {\n const result = reader.read(path, variables);\n\n if (result === undefined) {\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","undefined","Error","String"],"mappings":"qDAI6CA,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,GAEjC,QAAeK,IAAXD,EACF,MAAM,IAAIE,MAAM,SAASC,OAAOJ,kCAGlC,OAAOC"}
@@ -1,2 +1,3 @@
1
- import{jsx as r}from"react/jsx-runtime";import{createContext as e,use as o}from"react";import n from"markdown-to-jsx";const p=e({componentMapper:{}}),t=({children:e,componentMapper:o,...n})=>r(p,{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};
1
+ "use client";
2
+ export{I18nContext,I18nProvider}from"./components/I18nProvider.mjs";export{Md}from"./components/Md.mjs";
2
3
  //# sourceMappingURL=client.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","sources":["../../src/components/I18nProvider.tsx","../../src/helpers/injectVariables.ts","../../src/components/Md.tsx"],"sourcesContent":["import { type MarkdownToJSX } from 'markdown-to-jsx';\nimport { type FC, 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: FC<I18nProviderProps> = ({ children, componentMapper, ...markdownToJsxOptions }) => {\n return <I18nContext value={{ componentMapper, ...markdownToJsxOptions }}>{children}</I18nContext>;\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 FC, use } 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: FC<MdProps> = ({\n children,\n componentMapper: componentMapperOverrides,\n variables,\n ...markdownToJsxOptionOverrides\n}) => {\n const { componentMapper, ...markdownToJsxOptions } = use(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","value","extractTemplateVariables","extractVarName","injectVariables","markdown","variables","replaceAll","match","varName","replace","replacementValue","Error","Md","componentMapperOverrides","markdownToJsxOptionOverrides","use","MarkdownToJsx","options","overrides"],"mappings":"sHAGO,MAAMA,EAAcC,EAIzB,CACAC,gBAAiB,CAAA,IAQNC,EAAsC,EAAGC,WAAUF,qBAAoBG,KAC3EC,EAACN,EAAAA,CAAYO,MAAO,CAAEL,qBAAoBG,GAAyBD,SAAAA,ICjBtEI,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,EAAkB,EAC7Bf,WACAF,gBAAiBkB,EACjBR,eACGS,MAEH,MAAMnB,gBAAEA,KAAoBG,GAAyBiB,EAAItB,GAEzD,OACEM,EAACiB,EAAAA,CACCC,QAAS,CACPC,UAAW,IAAKvB,KAAoBkB,MACjCf,KACAgB,GAGJX,SAAAA,EAAgBN,EAAUQ"}
1
+ {"version":3,"file":"client.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{jsx as e}from"react/jsx-runtime";import{createContext as r}from"react";const o=r({componentMapper:{}}),p=({children:r,componentMapper:p,...n})=>e(o,{value:{componentMapper:p,...n},children:r});export{o as I18nContext,p as I18nProvider};
3
+ //# sourceMappingURL=I18nProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"I18nProvider.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{jsx as r}from"react/jsx-runtime";import o from"markdown-to-jsx";import{use as e}from"react";import{I18nContext as t}from"./I18nProvider.mjs";import{injectVariables as m}from"../helpers/injectVariables.mjs";const i=({children:i,componentMapper:n,variables:p,...s})=>{const{componentMapper:a,...c}=e(t);return r(o,{options:{overrides:{...a,...n},...c,...s},children:m(i,p)})};export{i as Md};
3
+ //# sourceMappingURL=Md.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Md.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,2 @@
1
+ const o=".i18n-macro.config.json";export{o as CONFIG_FILENAME};
2
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","sources":["../../src/constants.ts"],"sourcesContent":["export const CONFIG_FILENAME = '.i18n-macro.config.json';\n"],"names":["CONFIG_FILENAME"],"mappings":"AAAO,MAAMA,EAAkB"}
@@ -0,0 +1,2 @@
1
+ const r=/{{[^\s{}]+}}/g,e=/{{ *([^ }]*) *}}/,n=(n,o)=>o?n.replaceAll(r,r=>{const n=r.replace(e,"$1"),a=o[n];if(void 0!==a)return String(a);throw new Error(`Markdown contains un-replaced variable '${n}'`)}):n;export{n as injectVariables};
2
+ //# sourceMappingURL=injectVariables.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectVariables.mjs","sources":["../../../src/helpers/injectVariables.ts"],"sourcesContent":["const extractTemplateVariables = /{{[^\\s{}]+}}/g;\nconst extractVarName = /{{ *([^ }]*) *}}/;\n\nexport const injectVariables = (markdown: string, variables?: Record<string, string | number>): string =>\n variables\n ? markdown.replaceAll(extractTemplateVariables, (match: string) => {\n const varName = match.replace(extractVarName, '$1');\n const replacementValue = variables[varName];\n\n if (replacementValue !== undefined) {\n return String(replacementValue);\n }\n\n throw new Error(`Markdown contains un-replaced variable '${varName}'`);\n })\n : markdown;\n"],"names":["extractTemplateVariables","extractVarName","injectVariables","markdown","variables","replaceAll","match","varName","replace","replacementValue","undefined","String","Error"],"mappings":"AAAA,MAAMA,EAA2B,gBAC3BC,EAAiB,mBAEVC,EAAkB,CAACC,EAAkBC,IAChDA,EACID,EAASE,WAAWL,EAA2BM,IAC7C,MAAMC,EAAUD,EAAME,QAAQP,EAAgB,MACxCQ,EAAmBL,EAAUG,GAEnC,QAAyBG,IAArBD,EACF,OAAOE,OAAOF,GAGhB,MAAM,IAAIG,MAAM,2CAA2CL,QAE7DJ"}
@@ -0,0 +1,2 @@
1
+ import{readFileSync as o}from"node:fs";import{resolve as t}from"node:path";import{CONFIG_FILENAME as r}from"../constants.mjs";const e=process.cwd(),n=()=>{let n={};try{n=JSON.parse(o(t(e,r),{encoding:"utf8"}))}catch{}return n};export{n as loadConfig};
2
+ //# sourceMappingURL=loadConfig.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadConfig.mjs","sources":["../../../src/helpers/loadConfig.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONFIG_FILENAME } from '#constants.ts';\nimport { type MacrosConfig } from '#types.ts';\n\nconst cwd = process.cwd();\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(readFileSync(resolve(cwd, CONFIG_FILENAME), { encoding: 'utf8' })) as Partial<MacrosConfig>;\n } catch {\n // no catch\n }\n\n return config;\n};\n"],"names":["cwd","process","loadConfig","config","JSON","parse","readFileSync","resolve","CONFIG_FILENAME","encoding"],"mappings":"8HAKA,MAAMA,EAAMC,QAAQD,MAEPE,EAAa,KACxB,IAAIC,EAAgC,CAAA,EAEpC,IAGEA,EAASC,KAAKC,MAAMC,EAAaC,EAAQP,EAAKQ,GAAkB,CAAEC,SAAU,SAC9E,CAAE,MAEF,CAEA,OAAON"}
@@ -1,2 +1,2 @@
1
- import{createConfigReader as r}from"zcb";const t=t=>{const o=r(t);return{t:(r,t)=>o.read(r,t),tt:(r,t)=>{const e=o.read(r,t);if(void 0===e)throw new Error(`Path "${String(r)}" did not resolve to a value`);return e}}};export{t as createI18n};
1
+ export{createI18n}from"./main.mjs";
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/main.ts"],"sourcesContent":["import { type Get } from 'type-fest';\nimport { 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): Get<U, P> => {\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 === undefined) {\n throw new Error(`Path \"${String(path)}\" did not resolve to a value`);\n }\n\n return result;\n },\n };\n};\n"],"names":["createI18n","i18n","reader","createConfigReader","t","key","variables","read","tt","path","result","undefined","Error","String"],"mappings":"yCAIO,MAAMA,EAAgCC,IAC3C,MAAMC,EAASC,EAAsBF,GAErC,MAAO,CAGLG,EAAG,CAACC,EAAaC,IAA8CJ,EAAOK,KAAKF,EAAKC,GAChFE,GAAI,CAAoBC,EAASH,KAC/B,MAAMI,EAASR,EAAOK,KAAKE,EAAMH,GAIjC,QAAeK,IAAXD,EACF,MAAM,IAAIE,MAAM,SAASC,OAAOJ,kCAGlC,OAAOC"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import{readFileSync as e}from"node:fs";import{resolve as r}from"node:path";const o=process.cwd(),{NEXT_PUBLIC_LANGUAGE_CODE:t}=process.env,n=n=>{if(!n)throw new Error("md expected a path, but received none");let c=process.cwd(),{markdownDir:p}=(()=>{let t={};try{t=JSON.parse(e(r(o,".i18n-macro.config.json"),{encoding:"utf8"}))}catch{}return t})();p&&(t&&(p=p.replaceAll("{{NEXT_PUBLIC_LANGUAGE_CODE}}",()=>t)),c=r(c,p));const s=r(c,n);return e(s,{encoding:"utf8"}).trim()};export{n as md};
1
+ import{readFileSync as e}from"node:fs";import{resolve as r}from"node:path";import{loadConfig as o}from"./helpers/loadConfig.mjs";const{NEXT_PUBLIC_LANGUAGE_CODE:t}=process.env,n=n=>{if(!n)throw new Error("md expected a path, but received none");let p=process.cwd(),{markdownDir:m}=o();m&&(t&&(m=m.replaceAll("{{NEXT_PUBLIC_LANGUAGE_CODE}}",()=>t)),p=r(p,m));const c=r(p,n);return e(c,{encoding:"utf8"}).trim()};export{n as md};
2
2
  //# sourceMappingURL=macros.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"macros.mjs","sources":["../../src/constants.ts","../../src/helpers/loadConfig.ts","../../src/macros.ts"],"sourcesContent":["export const CONFIG_FILENAME = '.i18n-macro.config.json';\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { CONFIG_FILENAME } from '#constants.ts';\nimport { type MacrosConfig } from '#types.ts';\n\nconst cwd = process.cwd();\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(readFileSync(resolve(cwd, CONFIG_FILENAME), { encoding: 'utf8' })) as Partial<MacrosConfig>;\n } catch {\n // no catch\n }\n\n return config;\n};\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"],"names":["cwd","process","NEXT_PUBLIC_LANGUAGE_CODE","env","md","path","Error","dir","markdownDir","config","JSON","parse","readFileSync","resolve","encoding","loadConfig","replaceAll","fullPath","trim"],"mappings":"2EAAO,MCKDA,EAAMC,QAAQD,OCDdE,0BAAEA,GAA8BD,QAAQE,IAEjCC,EAAwBC,IACnC,IAAKA,EACH,MAAM,IAAIC,MAAM,yCAGlB,IAAIC,EAAMN,QAAQD,OACdQ,YAAEA,GDLkB,MACxB,IAAIC,EAAgC,CAAA,EAEpC,IAGEA,EAASC,KAAKC,MAAMC,EAAaC,EAAQb,EDbd,2BCaqC,CAAEc,SAAU,SAC9E,CAAE,MAEF,CAEA,OAAOL,GCNeM,GAElBP,IACEN,IACFM,EAAcA,EAAYQ,WAAW,gCAAiC,IAAMd,IAG9EK,EAAMM,EAAQN,EAAKC,IAGrB,MAAMS,EAAWJ,EAAQN,EAAKF,GAK9B,OAAOO,EAAaK,EAAU,CAAEH,SAAU,SAAUI"}
1
+ {"version":3,"file":"macros.mjs","sources":["../../src/macros.ts"],"sourcesContent":["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"],"names":["NEXT_PUBLIC_LANGUAGE_CODE","process","env","md","path","Error","dir","cwd","markdownDir","loadConfig","replaceAll","resolve","fullPath","readFileSync","encoding","trim"],"mappings":"iIAIA,MAAMA,0BAAEA,GAA8BC,QAAQC,IAEjCC,EAAwBC,IACnC,IAAKA,EACH,MAAM,IAAIC,MAAM,yCAGlB,IAAIC,EAAML,QAAQM,OACdC,YAAEA,GAAgBC,IAElBD,IACER,IACFQ,EAAcA,EAAYE,WAAW,gCAAiC,IAAMV,IAG9EM,EAAMK,EAAQL,EAAKE,IAGrB,MAAMI,EAAWD,EAAQL,EAAKF,GAK9B,OAAOS,EAAaD,EAAU,CAAEE,SAAU,SAAUC"}
@@ -0,0 +1,2 @@
1
+ import{createConfigReader as r}from"zcb";const t=t=>{const o=r(t);return{t:(r,t)=>o.read(r,t),tt:(r,t)=>{const e=o.read(r,t);if(void 0===e)throw new Error(`Path "${String(r)}" did not resolve to a value`);return e}}};export{t as createI18n};
2
+ //# sourceMappingURL=main.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.mjs","sources":["../../src/main.ts"],"sourcesContent":["import { type Get } from 'type-fest';\nimport { 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): Get<U, P> => {\n const result = reader.read(path, variables);\n\n if (result === undefined) {\n throw new Error(`Path \"${String(path)}\" did not resolve to a value`);\n }\n\n return result;\n },\n };\n};\n"],"names":["createI18n","i18n","reader","createConfigReader","t","key","variables","read","tt","path","result","undefined","Error","String"],"mappings":"yCAIO,MAAMA,EAAgCC,IAC3C,MAAMC,EAASC,EAAsBF,GAErC,MAAO,CAGLG,EAAG,CAACC,EAAaC,IAA8CJ,EAAOK,KAAKF,EAAKC,GAChFE,GAAI,CAAoBC,EAASH,KAC/B,MAAMI,EAASR,EAAOK,KAAKE,EAAMH,GAEjC,QAAeK,IAAXD,EACF,MAAM,IAAIE,MAAM,SAASC,OAAOJ,kCAGlC,OAAOC"}
@@ -1,31 +1,31 @@
1
1
  -----------------------------
2
2
  Rollup File Analysis
3
3
  -----------------------------
4
- bundle size: 1.321 KB
4
+ bundle size: 1.275 KB
5
5
  original size: 1.612 KB
6
- code reduction: 18.05 %
6
+ code reduction: 20.91 %
7
7
  module count: 3
8
8
 
9
9
  █████████████████████████████████░░░░░░░░░░░░░░░░░
10
10
  file: /src/macros.ts
11
- bundle space: 66.01 %
12
- rendered size: 872 Bytes
11
+ bundle space: 66.2 %
12
+ rendered size: 844 Bytes
13
13
  original size: 958 Bytes
14
- code reduction: 8.98 %
14
+ code reduction: 11.9 %
15
15
  dependents: 0
16
16
 
17
- ███████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
17
+ ██████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
18
18
  file: /src/helpers/loadConfig.ts
19
- bundle space: 30.2 %
20
- rendered size: 399 Bytes
19
+ bundle space: 29.88 %
20
+ rendered size: 381 Bytes
21
21
  original size: 596 Bytes
22
- code reduction: 33.05 %
22
+ code reduction: 36.07 %
23
23
  dependents: 1
24
24
  - /src/macros.ts
25
25
 
26
26
  █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
27
27
  file: /src/constants.ts
28
- bundle space: 3.79 %
28
+ bundle space: 3.92 %
29
29
  rendered size: 50 Bytes
30
30
  original size: 58 Bytes
31
31
  code reduction: 13.79 %
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.cts","sourceRoot":"","sources":["../../../src/client.cts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"client.d.cts","sourceRoot":"","sources":["../../../src/client.cts"],"names":[],"mappings":"AAEA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
@@ -1 +1 @@
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,EAAE,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAE/D,eAAO,MAAM,WAAW;qBAEH,aAAa,CAAC,SAAS;;qHAcu4W,GAAI;;;;;;;;;;;;;;;;;;;iBAVr7W,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,EAAE,EAAE,CAAC,iBAAiB,CAE9C,CAAC"}
1
+ {"version":3,"file":"I18nProvider.d.cts","sourceRoot":"","sources":["../../../../src/components/I18nProvider.ctsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAE/D,eAAO,MAAM,WAAW;qBAEH,aAAa,CAAC,SAAS;;qHAcg5W,GAAI;;;;;;;;;;;;;;;;;;;iBAV97W,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,EAAE,EAAE,CAAC,iBAAiB,CAE9C,CAAC"}
@@ -1 +1 @@
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,EAAE,EAAO,MAAM,OAAO,CAAC;AAIrC,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,EAAE,EAAE,CAAC,OAAO,CAmB1B,CAAC"}
1
+ {"version":3,"file":"Md.d.cts","sourceRoot":"","sources":["../../../../src/components/Md.ctsx"],"names":[],"mappings":"AAEA,OAAsB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,EAAO,MAAM,OAAO,CAAC;AAIrC,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,EAAE,EAAE,CAAC,OAAO,CAmB1B,CAAC"}
@@ -1 +1 @@
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
+ {"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,MAYlF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.cts","sourceRoot":"","sources":["../../../src/main.cts"],"names":[],"mappings":"AAEA,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
+ {"version":3,"file":"main.d.cts","sourceRoot":"","sources":["../../../src/main.cts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,KAAG,gBAAgB,CAAC,CAAC,CAiBxE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client.ts"],"names":[],"mappings":"AAEA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC"}
@@ -1 +1 @@
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,EAAE,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAE/D,eAAO,MAAM,WAAW;qBAEH,aAAa,CAAC,SAAS;;qHAcu4W,GAAI;;;;;;;;;;;;;;;;;;;iBAVr7W,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,EAAE,EAAE,CAAC,iBAAiB,CAE9C,CAAC"}
1
+ {"version":3,"file":"I18nProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/I18nProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAE/D,eAAO,MAAM,WAAW;qBAEH,aAAa,CAAC,SAAS;;qHAcg5W,GAAI;;;;;;;;;;;;;;;;;;;iBAV97W,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,EAAE,EAAE,CAAC,iBAAiB,CAE9C,CAAC"}
@@ -1 +1 @@
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,EAAE,EAAO,MAAM,OAAO,CAAC;AAIrC,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,EAAE,EAAE,CAAC,OAAO,CAmB1B,CAAC"}
1
+ {"version":3,"file":"Md.d.ts","sourceRoot":"","sources":["../../../../src/components/Md.tsx"],"names":[],"mappings":"AAEA,OAAsB,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,EAAO,MAAM,OAAO,CAAC;AAIrC,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,EAAE,EAAE,CAAC,OAAO,CAmB1B,CAAC"}
@@ -1 +1 @@
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
+ {"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,MAYlF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":"AAEA,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
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,eAAO,MAAM,UAAU,GAAI,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,KAAG,gBAAgB,CAAC,CAAC,CAiBxE,CAAC"}