@i18n-micro/types-generator 1.1.6 → 1.1.7

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.
@@ -3,6 +3,12 @@ export interface GeneratorOptions {
3
3
  translationDir: string;
4
4
  outputFile?: string;
5
5
  }
6
+ /**
7
+ * Emit a TS property name from a translation key.
8
+ * JSON.stringify covers quotes/newlines/null bytes; U+2028/U+2029 need an extra escape
9
+ * so the .d.ts stays safe when embedded in older JS tooling.
10
+ */
11
+ export declare function formatKeyProperty(key: string): string;
6
12
  /**
7
13
  * Generates a string with TypeScript types for translation keys.
8
14
  * Does not write a file, only returns content.
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/core/generator.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4C/E;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB9E"}
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/core/generator.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAOD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAIrD;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgD/E;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB9E"}
@@ -1,3 +1,7 @@
1
+ /**
2
+ * True for plain objects suitable as translation maps (not arrays, Date, null, etc.).
3
+ */
4
+ export declare function isPlainTranslationObject(value: unknown): value is Record<string, unknown>;
1
5
  /**
2
6
  * Recursively traverses a JSON object and creates a flat list of dot-separated keys.
3
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/core/parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,SAAK,GAAG,MAAM,EAAE,CAqB/E"}
1
+ {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/core/parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,SAAK,GAAG,MAAM,EAAE,CAwB/E"}
@@ -0,0 +1,14 @@
1
+ let e=require("node:fs"),t=require("node:path"),n=require("globby");function r(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function i(e,t=``){if(!r(e))return[];let n=[];for(let a in e){if(!Object.hasOwn(e,a))continue;let o=e[a],s=t?`${t}.${a}`:a;r(o)?n.push(...i(o,s)):n.push(s)}return n}function a(e){return e.charCodeAt(0)===65279?e.slice(1):e}function o(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}async function s(s){let c=(0,t.resolve)(s.srcDir,s.translationDir),l=await(0,n.globby)(`**/*.json`,{cwd:c,absolute:!0,ignore:[`node_modules/**`,`dist/**`,`.nuxt/**`]}),u=new Set;for(let t of l)try{let n=JSON.parse(a((0,e.readFileSync)(t,`utf-8`)));if(!r(n)){console.warn(`[i18n-types] Skipping ${t}: root value must be a plain JSON object`);continue}let o=i(n);for(let e of o)u.add(e)}catch(e){console.warn(`[i18n-types] Failed to parse ${t}:`,e)}return`/* prettier-ignore */
2
+ // @ts-nocheck
3
+ // Generated by @i18n-micro/types-generator
4
+ // DO NOT EDIT THIS FILE MANUALLY
5
+
6
+ import '@i18n-micro/types';
7
+
8
+ declare module '@i18n-micro/types' {
9
+ export interface DefineLocaleMessage {
10
+ ${Array.from(u).sort().map(e=>` ${o(e)}: string;`).join(`
11
+ `)}
12
+ }
13
+ }
14
+ `}async function c(n){let r=await s(n),i=n.outputFile||(0,t.resolve)(n.srcDir,`i18n-micro.d.ts`),a=(0,t.dirname)(i);try{(0,e.mkdirSync)(a,{recursive:!0})}catch{}return(0,e.writeFileSync)(i,r,`utf-8`),i}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
@@ -2,18 +2,28 @@ import { mkdirSync as e, readFileSync as t, writeFileSync as n } from "node:fs";
2
2
  import { dirname as r, resolve as i } from "node:path";
3
3
  import { globby as a } from "globby";
4
4
  //#region src/core/parser.ts
5
- function o(e, t = "") {
5
+ function o(e) {
6
+ return typeof e == "object" && !!e && !Array.isArray(e) && Object.getPrototypeOf(e) === Object.prototype;
7
+ }
8
+ function s(e, t = "") {
9
+ if (!o(e)) return [];
6
10
  let n = [];
7
11
  for (let r in e) {
8
12
  if (!Object.hasOwn(e, r)) continue;
9
13
  let i = e[r], a = t ? `${t}.${r}` : r;
10
- typeof i == "object" && i && !Array.isArray(i) ? n.push(...o(i, a)) : n.push(a);
14
+ o(i) ? n.push(...s(i, a)) : n.push(a);
11
15
  }
12
16
  return n;
13
17
  }
14
18
  //#endregion
15
19
  //#region src/core/generator.ts
16
- async function s(e) {
20
+ function c(e) {
21
+ return e.charCodeAt(0) === 65279 ? e.slice(1) : e;
22
+ }
23
+ function l(e) {
24
+ return JSON.stringify(e).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
25
+ }
26
+ async function u(e) {
17
27
  let n = i(e.srcDir, e.translationDir), r = await a("**/*.json", {
18
28
  cwd: n,
19
29
  absolute: !0,
@@ -22,10 +32,15 @@ async function s(e) {
22
32
  "dist/**",
23
33
  ".nuxt/**"
24
34
  ]
25
- }), s = /* @__PURE__ */ new Set();
35
+ }), u = /* @__PURE__ */ new Set();
26
36
  for (let e of r) try {
27
- let n = o(JSON.parse(t(e, "utf-8")));
28
- for (let e of n) s.add(e);
37
+ let n = JSON.parse(c(t(e, "utf-8")));
38
+ if (!o(n)) {
39
+ console.warn(`[i18n-types] Skipping ${e}: root value must be a plain JSON object`);
40
+ continue;
41
+ }
42
+ let r = s(n);
43
+ for (let e of r) u.add(e);
29
44
  } catch (t) {
30
45
  console.warn(`[i18n-types] Failed to parse ${e}:`, t);
31
46
  }
@@ -38,17 +53,17 @@ import '@i18n-micro/types';
38
53
 
39
54
  declare module '@i18n-micro/types' {
40
55
  export interface DefineLocaleMessage {
41
- ${Array.from(s).sort().map((e) => ` '${e}': string;`).join("\n")}
56
+ ${Array.from(u).sort().map((e) => ` ${l(e)}: string;`).join("\n")}
42
57
  }
43
58
  }
44
59
  `;
45
60
  }
46
- async function c(t) {
47
- let a = await s(t), o = t.outputFile || i(t.srcDir, "i18n-micro.d.ts"), c = r(o);
61
+ async function d(t) {
62
+ let a = await u(t), o = t.outputFile || i(t.srcDir, "i18n-micro.d.ts"), s = r(o);
48
63
  try {
49
- e(c, { recursive: !0 });
64
+ e(s, { recursive: !0 });
50
65
  } catch {}
51
66
  return n(o, a, "utf-8"), o;
52
67
  }
53
68
  //#endregion
54
- export { s as n, o as r, c as t };
69
+ export { o as a, s as i, d as n, u as r, l as t };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./generator-Cqp8Bpki.cjs");let t=require("node:path"),n=require("chokidar"),r=require("unplugin");var i=null,a=null;function o(e,t){return function(...n){a&&clearTimeout(a),a=setTimeout(()=>{a&&clearTimeout(a),a=null,e(...n)},t)}}var s=(0,r.createUnplugin)(r=>({name:`i18n-micro-types-generator`,async buildStart(){try{await e.t(r)}catch(e){console.warn(`[i18n-types] Failed to generate types:`,e)}if(process.env.NODE_ENV===`development`||process.env.NODE_ENV!==`production`){let a=(0,t.resolve)(r.srcDir,r.translationDir),s=o(async()=>{try{await e.t(r)}catch(e){console.warn(`[i18n-types] Failed to regenerate types:`,e)}},300);i=(0,n.watch)(a,{ignoreInitial:!0,ignored:e=>/(?:^|[/\\])(?:node_modules|dist|\.nuxt)(?:[/\\]|$)/.test(e)}),i.on(`all`,async(e,t)=>{t.endsWith(`.json`)&&s()})}},buildEnd(){i&&=(i.close(),null),a&&=(clearTimeout(a),null)}}));exports.I18nTypesPlugin=s,exports.flattenKeys=e.r,exports.generateTypes=e.t,exports.getTypesString=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./generator-BonabDld.cjs");let t=require("node:path"),n=require("chokidar"),r=require("unplugin");var i=null,a=null;function o(e,t){return function(...n){a&&clearTimeout(a),a=setTimeout(()=>{a&&clearTimeout(a),a=null,e(...n)},t)}}var s=(0,r.createUnplugin)(r=>({name:`i18n-micro-types-generator`,async buildStart(){try{await e.n(r)}catch(e){console.warn(`[i18n-types] Failed to generate types:`,e)}if(process.env.NODE_ENV===`development`||process.env.NODE_ENV!==`production`){let a=(0,t.resolve)(r.srcDir,r.translationDir),s=o(async()=>{try{await e.n(r)}catch(e){console.warn(`[i18n-types] Failed to regenerate types:`,e)}},300);i=(0,n.watch)(a,{ignoreInitial:!0,ignored:e=>/(?:^|[/\\])(?:node_modules|dist|\.nuxt)(?:[/\\]|$)/.test(e)}),i.on(`all`,async(e,t)=>{t.endsWith(`.json`)&&s()})}},buildEnd(){i&&=(i.close(),null),a&&=(clearTimeout(a),null)}}));exports.I18nTypesPlugin=s,exports.flattenKeys=e.i,exports.formatKeyProperty=e.t,exports.generateTypes=e.n,exports.getTypesString=e.r,exports.isPlainTranslationObject=e.a;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { GeneratorOptions } from './core/generator';
2
- export { generateTypes, getTypesString } from './core/generator';
3
- export { flattenKeys } from './core/parser';
2
+ export { formatKeyProperty, generateTypes, getTypesString } from './core/generator';
3
+ export { flattenKeys, isPlainTranslationObject } from './core/parser';
4
4
  export { I18nTypesPlugin } from './unplugin';
5
5
  //# sourceMappingURL=index.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type { GeneratorOptions } from './core/generator';
2
- export { generateTypes, getTypesString } from './core/generator';
3
- export { flattenKeys } from './core/parser';
2
+ export { formatKeyProperty, generateTypes, getTypesString } from './core/generator';
3
+ export { flattenKeys, isPlainTranslationObject } from './core/parser';
4
4
  export { I18nTypesPlugin } from './unplugin';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACnF,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
package/dist/index.mjs CHANGED
@@ -1,17 +1,17 @@
1
- import { n as e, r as t, t as n } from "./generator-BRNo9fkZ.js";
2
- import { resolve as r } from "node:path";
3
- import { watch as i } from "chokidar";
4
- import { createUnplugin as a } from "unplugin";
1
+ import { a as e, i as t, n, r, t as i } from "./generator-CWXsEVLn.js";
2
+ import { resolve as a } from "node:path";
3
+ import { watch as o } from "chokidar";
4
+ import { createUnplugin as s } from "unplugin";
5
5
  //#region src/unplugin.ts
6
- var o = null, s = null;
7
- function c(e, t) {
6
+ var c = null, l = null;
7
+ function u(e, t) {
8
8
  return function(...n) {
9
- s && clearTimeout(s), s = setTimeout(() => {
10
- s && clearTimeout(s), s = null, e(...n);
9
+ l && clearTimeout(l), l = setTimeout(() => {
10
+ l && clearTimeout(l), l = null, e(...n);
11
11
  }, t);
12
12
  };
13
13
  }
14
- var l = a((e) => ({
14
+ var d = s((e) => ({
15
15
  name: "i18n-micro-types-generator",
16
16
  async buildStart() {
17
17
  try {
@@ -20,24 +20,24 @@ var l = a((e) => ({
20
20
  console.warn("[i18n-types] Failed to generate types:", e);
21
21
  }
22
22
  if (process.env.NODE_ENV === "development" || process.env.NODE_ENV !== "production") {
23
- let t = r(e.srcDir, e.translationDir), a = c(async () => {
23
+ let t = a(e.srcDir, e.translationDir), r = u(async () => {
24
24
  try {
25
25
  await n(e);
26
26
  } catch (e) {
27
27
  console.warn("[i18n-types] Failed to regenerate types:", e);
28
28
  }
29
29
  }, 300);
30
- o = i(t, {
30
+ c = o(t, {
31
31
  ignoreInitial: !0,
32
32
  ignored: (e) => /(?:^|[/\\])(?:node_modules|dist|\.nuxt)(?:[/\\]|$)/.test(e)
33
- }), o.on("all", async (e, t) => {
34
- t.endsWith(".json") && a();
33
+ }), c.on("all", async (e, t) => {
34
+ t.endsWith(".json") && r();
35
35
  });
36
36
  }
37
37
  },
38
38
  buildEnd() {
39
- o &&= (o.close(), null), s &&= (clearTimeout(s), null);
39
+ c &&= (c.close(), null), l &&= (clearTimeout(l), null);
40
40
  }
41
41
  }));
42
42
  //#endregion
43
- export { l as I18nTypesPlugin, t as flattenKeys, n as generateTypes, e as getTypesString };
43
+ export { d as I18nTypesPlugin, t as flattenKeys, i as formatKeyProperty, n as generateTypes, r as getTypesString, e as isPlainTranslationObject };
package/dist/nuxt.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generator-Cqp8Bpki.cjs");let t=require("@nuxt/kit");var n=(0,t.defineNuxtModule)({meta:{name:`@i18n-micro/types-generator`,configKey:`i18nTypes`},defaults:{translationDir:`locales`},async setup(n,r){let i=r.options.i18n,a=n.translationDir||i?.translationDir||`locales`;(0,t.addTypeTemplate)({filename:`types/i18n-micro.d.ts`,getContents:async()=>{try{return await e.n({srcDir:r.options.rootDir,translationDir:a})}catch(e){return console.warn(`[i18n-types] Failed to generate types:`,e),`// Failed to generate types: ${e instanceof Error?e.message:String(e)}`}}}),r.hook(`builder:watch`,async(e,t)=>{let n=t.replace(/\\/g,`/`),i=a.replace(/\\/g,`/`);n.includes(i)&&n.endsWith(`.json`)&&await r.callHook(`builder:generateApp`)})}});exports.default=n;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generator-BonabDld.cjs");let t=require("@nuxt/kit");var n=(0,t.defineNuxtModule)({meta:{name:`@i18n-micro/types-generator`,configKey:`i18nTypes`},defaults:{translationDir:`locales`},async setup(n,r){let i=r.options.i18n,a=n.translationDir||i?.translationDir||`locales`,o=n.outputFile;typeof o==`string`&&o.length>0&&console.warn("[i18n-types] `i18nTypes.outputFile` is ignored in Nuxt; generated types are written to `.nuxt/types/i18n-micro.d.ts`."),r.options.typescript.hoist||=[],r.options.typescript.hoist.includes(`@i18n-micro/types`)||r.options.typescript.hoist.push(`@i18n-micro/types`),(0,t.addTypeTemplate)({filename:`types/i18n-micro.d.ts`,getContents:async()=>{try{return await e.r({srcDir:r.options.rootDir,translationDir:a})}catch(e){return console.warn(`[i18n-types] Failed to generate types:`,e),`// Failed to generate types: ${e instanceof Error?e.message:String(e)}`}}}),r.hook(`builder:watch`,async(e,t)=>{let n=t.replace(/\\/g,`/`),i=a.replace(/\\/g,`/`);n.includes(i)&&n.endsWith(`.json`)&&await r.callHook(`builder:generateApp`)})}});exports.default=n;
package/dist/nuxt.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface I18nTypesGeneratorOptions {
2
+ /** Translation directory relative to the project root. Defaults to `i18n.translationDir` or `'locales'`. */
2
3
  translationDir?: string;
3
- outputFile?: string;
4
4
  }
5
5
  declare const _default: import('@nuxt/schema').NuxtModule<I18nTypesGeneratorOptions, I18nTypesGeneratorOptions, false>;
6
6
  export default _default;
package/dist/nuxt.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export interface I18nTypesGeneratorOptions {
2
+ /** Translation directory relative to the project root. Defaults to `i18n.translationDir` or `'locales'`. */
2
3
  translationDir?: string;
3
- outputFile?: string;
4
4
  }
5
5
  declare const _default: import('@nuxt/schema').NuxtModule<I18nTypesGeneratorOptions, I18nTypesGeneratorOptions, false>;
6
6
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"nuxt.d.ts","sourceRoot":"","sources":["../src/nuxt.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB;IACxC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;;AAED,wBA+CE"}
1
+ {"version":3,"file":"nuxt.d.ts","sourceRoot":"","sources":["../src/nuxt.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,yBAAyB;IACxC,4GAA4G;IAC5G,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;;AAED,wBA2DE"}
package/dist/nuxt.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e } from "./generator-BRNo9fkZ.js";
1
+ import { r as e } from "./generator-CWXsEVLn.js";
2
2
  import { addTypeTemplate as t, defineNuxtModule as n } from "@nuxt/kit";
3
3
  //#region src/nuxt.ts
4
4
  var r = n({
@@ -8,8 +8,8 @@ var r = n({
8
8
  },
9
9
  defaults: { translationDir: "locales" },
10
10
  async setup(n, r) {
11
- let i = r.options.i18n, a = n.translationDir || i?.translationDir || "locales";
12
- t({
11
+ let i = r.options.i18n, a = n.translationDir || i?.translationDir || "locales", o = n.outputFile;
12
+ typeof o == "string" && o.length > 0 && console.warn("[i18n-types] `i18nTypes.outputFile` is ignored in Nuxt; generated types are written to `.nuxt/types/i18n-micro.d.ts`."), r.options.typescript.hoist ||= [], r.options.typescript.hoist.includes("@i18n-micro/types") || r.options.typescript.hoist.push("@i18n-micro/types"), t({
13
13
  filename: "types/i18n-micro.d.ts",
14
14
  getContents: async () => {
15
15
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-micro/types-generator",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "Type generator for i18n-micro translation keys",
5
5
  "keywords": [
6
6
  "i18n",
@@ -1,14 +0,0 @@
1
- let e=require("node:fs"),t=require("node:path"),n=require("globby");function r(e,t=``){let n=[];for(let i in e){if(!Object.hasOwn(e,i))continue;let a=e[i],o=t?`${t}.${i}`:i;typeof a==`object`&&a&&!Array.isArray(a)?n.push(...r(a,o)):n.push(o)}return n}async function i(i){let a=(0,t.resolve)(i.srcDir,i.translationDir),o=await(0,n.globby)(`**/*.json`,{cwd:a,absolute:!0,ignore:[`node_modules/**`,`dist/**`,`.nuxt/**`]}),s=new Set;for(let t of o)try{let n=r(JSON.parse((0,e.readFileSync)(t,`utf-8`)));for(let e of n)s.add(e)}catch(e){console.warn(`[i18n-types] Failed to parse ${t}:`,e)}return`/* prettier-ignore */
2
- // @ts-nocheck
3
- // Generated by @i18n-micro/types-generator
4
- // DO NOT EDIT THIS FILE MANUALLY
5
-
6
- import '@i18n-micro/types';
7
-
8
- declare module '@i18n-micro/types' {
9
- export interface DefineLocaleMessage {
10
- ${Array.from(s).sort().map(e=>` '${e}': string;`).join(`
11
- `)}
12
- }
13
- }
14
- `}async function a(n){let r=await i(n),a=n.outputFile||(0,t.resolve)(n.srcDir,`i18n-micro.d.ts`),o=(0,t.dirname)(a);try{(0,e.mkdirSync)(o,{recursive:!0})}catch{}return(0,e.writeFileSync)(a,r,`utf-8`),a}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});