@i18n-micro/types-generator 1.1.2 → 1.1.4

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 CHANGED
@@ -20,10 +20,7 @@ Add to `nuxt.config.ts`:
20
20
 
21
21
  ```typescript
22
22
  export default defineNuxtConfig({
23
- modules: [
24
- 'nuxt-i18n-micro',
25
- '@i18n-micro/types-generator/nuxt',
26
- ],
23
+ modules: ['nuxt-i18n-micro', '@i18n-micro/types-generator/nuxt'],
27
24
  })
28
25
  ```
29
26
 
@@ -59,4 +56,3 @@ See [full documentation](../../docs/integrations/types-generator.md) for detaile
59
56
  ## License
60
57
 
61
58
  MIT
62
-
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./generator-CAQjf5De.cjs"),s=require("node:path"),c=require("chokidar"),u=require("unplugin");let r=null,e=null;function y(t,n){return function(...o){const a=()=>{e&&clearTimeout(e),e=null,t(...o)};e&&clearTimeout(e),e=setTimeout(a,n)}}const g=u.createUnplugin(t=>({name:"i18n-micro-types-generator",async buildStart(){try{await i.generateTypes(t)}catch(n){console.warn("[i18n-types] Failed to generate types:",n)}if(process.env.NODE_ENV==="development"||process.env.NODE_ENV!=="production"){const n=s.resolve(t.srcDir,t.translationDir),l=y(async()=>{try{await i.generateTypes(t)}catch(o){console.warn("[i18n-types] Failed to regenerate types:",o)}},300);r=c.watch(n,{ignoreInitial:!0,ignored:["node_modules/**","dist/**",".nuxt/**"]}),r.on("all",async(o,a)=>{a.endsWith(".json")&&l()})}},buildEnd(){r&&(r.close(),r=null),e&&(clearTimeout(e),e=null)}}));exports.flattenKeys=i.flattenKeys;exports.generateTypes=i.generateTypes;exports.getTypesString=i.getTypesString;exports.I18nTypesPlugin=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./generator-CAQjf5De.cjs"),l=require("node:path"),c=require("chokidar"),u=require("unplugin");let i=null,e=null;function y(t,r){return function(...n){const a=()=>{e&&clearTimeout(e),e=null,t(...n)};e&&clearTimeout(e),e=setTimeout(a,r)}}const g=u.createUnplugin(t=>({name:"i18n-micro-types-generator",async buildStart(){try{await o.generateTypes(t)}catch(r){console.warn("[i18n-types] Failed to generate types:",r)}if(process.env.NODE_ENV==="development"||process.env.NODE_ENV!=="production"){const r=l.resolve(t.srcDir,t.translationDir),s=y(async()=>{try{await o.generateTypes(t)}catch(n){console.warn("[i18n-types] Failed to regenerate types:",n)}},300);i=c.watch(r,{ignoreInitial:!0,ignored:n=>/(?:^|[/\\])(?:node_modules|dist|\.nuxt)(?:[/\\]|$)/.test(n)}),i.on("all",async(n,a)=>{a.endsWith(".json")&&s()})}},buildEnd(){i&&(i.close(),i=null),e&&(clearTimeout(e),e=null)}}));exports.flattenKeys=o.flattenKeys;exports.generateTypes=o.generateTypes;exports.getTypesString=o.getTypesString;exports.I18nTypesPlugin=g;
package/dist/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  import { g as l } from "./generator-CSjBe25p.js";
2
- import { f as w, a as v } from "./generator-CSjBe25p.js";
3
- import { resolve as c } from "node:path";
4
- import s from "chokidar";
2
+ import { f as h, a as v } from "./generator-CSjBe25p.js";
3
+ import { resolve as s } from "node:path";
4
+ import { watch as c } from "chokidar";
5
5
  import { createUnplugin as u } from "unplugin";
6
- let r = null, e = null;
7
- function m(t, n) {
8
- return function(...o) {
6
+ let o = null, e = null;
7
+ function m(t, r) {
8
+ return function(...n) {
9
9
  const i = () => {
10
- e && clearTimeout(e), e = null, t(...o);
10
+ e && clearTimeout(e), e = null, t(...n);
11
11
  };
12
- e && clearTimeout(e), e = setTimeout(i, n);
12
+ e && clearTimeout(e), e = setTimeout(i, r);
13
13
  };
14
14
  }
15
15
  const g = u((t) => ({
@@ -17,32 +17,32 @@ const g = u((t) => ({
17
17
  async buildStart() {
18
18
  try {
19
19
  await l(t);
20
- } catch (n) {
21
- console.warn("[i18n-types] Failed to generate types:", n);
20
+ } catch (r) {
21
+ console.warn("[i18n-types] Failed to generate types:", r);
22
22
  }
23
23
  if (process.env.NODE_ENV === "development" || process.env.NODE_ENV !== "production") {
24
- const n = c(t.srcDir, t.translationDir), a = m(async () => {
24
+ const r = s(t.srcDir, t.translationDir), a = m(async () => {
25
25
  try {
26
26
  await l(t);
27
- } catch (o) {
28
- console.warn("[i18n-types] Failed to regenerate types:", o);
27
+ } catch (n) {
28
+ console.warn("[i18n-types] Failed to regenerate types:", n);
29
29
  }
30
30
  }, 300);
31
- r = s.watch(n, {
31
+ o = c(r, {
32
32
  ignoreInitial: !0,
33
- ignored: ["node_modules/**", "dist/**", ".nuxt/**"]
34
- }), r.on("all", async (o, i) => {
33
+ ignored: (n) => /(?:^|[/\\])(?:node_modules|dist|\.nuxt)(?:[/\\]|$)/.test(n)
34
+ }), o.on("all", async (n, i) => {
35
35
  i.endsWith(".json") && a();
36
36
  });
37
37
  }
38
38
  },
39
39
  buildEnd() {
40
- r && (r.close(), r = null), e && (clearTimeout(e), e = null);
40
+ o && (o.close(), o = null), e && (clearTimeout(e), e = null);
41
41
  }
42
42
  }));
43
43
  export {
44
44
  g as I18nTypesPlugin,
45
- w as flattenKeys,
45
+ h as flattenKeys,
46
46
  l as generateTypes,
47
47
  v as getTypesString
48
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"unplugin.d.ts","sourceRoot":"","sources":["../src/unplugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,kBAAkB,CAAA;AAkBvE,eAAO,MAAM,eAAe,gEAgD1B,CAAA"}
1
+ {"version":3,"file":"unplugin.d.ts","sourceRoot":"","sources":["../src/unplugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,kBAAkB,CAAA;AAkBvE,eAAO,MAAM,eAAe,gEAiD1B,CAAA"}
package/package.json CHANGED
@@ -1,22 +1,36 @@
1
1
  {
2
2
  "name": "@i18n-micro/types-generator",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Type generator for i18n-micro translation keys",
5
- "type": "module",
6
- "sideEffects": false,
5
+ "keywords": [
6
+ "i18n",
7
+ "nuxt",
8
+ "translation",
9
+ "type-generator",
10
+ "typescript"
11
+ ],
12
+ "homepage": "https://github.com/s00d/nuxt-i18n-micro/tree/main/packages/types-generator#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/s00d/nuxt-i18n-micro/issues"
15
+ },
7
16
  "license": "MIT",
17
+ "author": {
18
+ "name": "s00d",
19
+ "email": "Virus191288@gmail.com",
20
+ "url": "https://s00d.github.io/"
21
+ },
8
22
  "repository": {
9
23
  "type": "git",
10
24
  "url": "git+https://github.com/s00d/nuxt-i18n-micro.git",
11
25
  "directory": "packages/types-generator"
12
26
  },
13
- "homepage": "https://github.com/s00d/nuxt-i18n-micro/tree/main/packages/types-generator#readme",
14
- "bugs": {
15
- "url": "https://github.com/s00d/nuxt-i18n-micro/issues"
16
- },
17
- "engines": {
18
- "node": ">=18.17.0"
19
- },
27
+ "files": [
28
+ "dist",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "type": "module",
33
+ "sideEffects": false,
20
34
  "main": "./dist/index.cjs",
21
35
  "types": "./dist/index.d.ts",
22
36
  "exports": {
@@ -44,48 +58,32 @@
44
58
  },
45
59
  "./package.json": "./package.json"
46
60
  },
47
- "files": [
48
- "dist",
49
- "README.md",
50
- "LICENSE"
51
- ],
52
61
  "publishConfig": {
53
62
  "access": "public"
54
63
  },
55
- "keywords": [
56
- "i18n",
57
- "typescript",
58
- "type-generator",
59
- "translation",
60
- "nuxt"
61
- ],
62
- "author": {
63
- "name": "s00d",
64
- "email": "Virus191288@gmail.com",
65
- "url": "https://s00d.github.io/"
66
- },
67
64
  "dependencies": {
68
- "chokidar": "^3.6.0",
65
+ "chokidar": "^4.0.3",
69
66
  "globby": "^14.1.0",
70
- "unplugin": "^1.16.1"
71
- },
72
- "peerDependencies": {
73
- "@nuxt/kit": "^3.18.1 || ^4.0.0"
67
+ "unplugin": "^1.16.1 || ^2.0.0 || ^3.3.0"
74
68
  },
75
69
  "devDependencies": {
76
- "@types/jest": "^29.5.14",
77
70
  "@types/node": "^20.19.26",
78
- "jest": "^29.7.0",
79
71
  "publint": "^0.3.17",
80
- "ts-jest": "^29.4.6",
81
72
  "typescript": "^5.9.3",
82
- "vite": "^7.3.1",
83
- "vite-plugin-dts": "^4.5.4"
73
+ "vite": "^7.3.6",
74
+ "vite-plugin-dts": "^4.5.4",
75
+ "vitest": "^4.1.10"
76
+ },
77
+ "peerDependencies": {
78
+ "@nuxt/kit": "^3.18.1 || ^4.0.0"
79
+ },
80
+ "engines": {
81
+ "node": ">=18.17.0"
84
82
  },
85
83
  "scripts": {
86
84
  "build": "vite build",
87
85
  "check:package": "publint",
88
- "test": "jest",
86
+ "test": "vitest run",
89
87
  "typecheck": "tsc --noEmit"
90
88
  }
91
89
  }