ai-localize-validators 1.0.0 → 1.0.1

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/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationError, ValidationWarning, ValidationResult } from '@ai-localize/shared';
1
+ import { ValidationError, ValidationWarning, ValidationResult } from 'ai-localize-shared';
2
2
 
3
3
  declare class MissingKeyValidator {
4
4
  private localesDir;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ValidationError, ValidationWarning, ValidationResult } from '@ai-localize/shared';
1
+ import { ValidationError, ValidationWarning, ValidationResult } from 'ai-localize-shared';
2
2
 
3
3
  declare class MissingKeyValidator {
4
4
  private localesDir;
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ module.exports = __toCommonJS(index_exports);
41
41
  // src/missing-key-validator.ts
42
42
  var fs = __toESM(require("fs"));
43
43
  var path = __toESM(require("path"));
44
- var import_shared = require("@ai-localize/shared");
44
+ var import_ai_localize_shared = require("ai-localize-shared");
45
45
  var MissingKeyValidator = class {
46
46
  constructor(localesDir, defaultLanguage = "en", targetLanguages = []) {
47
47
  this.localesDir = localesDir;
@@ -59,12 +59,12 @@ var MissingKeyValidator = class {
59
59
  const nsFiles = fs.readdirSync(defaultDir).filter((f) => f.endsWith(".json"));
60
60
  const langs = this.targetLanguages.length > 0 ? this.targetLanguages : fs.readdirSync(this.localesDir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== this.defaultLanguage).map((e) => e.name);
61
61
  for (const nsFile of nsFiles) {
62
- const defaultEntries = (0, import_shared.readJsonSafe)(path.join(defaultDir, nsFile));
62
+ const defaultEntries = (0, import_ai_localize_shared.readJsonSafe)(path.join(defaultDir, nsFile));
63
63
  if (!defaultEntries) continue;
64
64
  const namespace = nsFile.replace(".json", "");
65
65
  for (const lang of langs) {
66
66
  const targetPath = path.join(this.localesDir, lang, nsFile);
67
- const targetEntries = (0, import_shared.readJsonSafe)(targetPath) || {};
67
+ const targetEntries = (0, import_ai_localize_shared.readJsonSafe)(targetPath) || {};
68
68
  for (const key of Object.keys(defaultEntries)) {
69
69
  if (!(key in targetEntries) || targetEntries[key] === "") {
70
70
  const fullKey = `${namespace}.${key}`;
@@ -82,7 +82,7 @@ var MissingKeyValidator = class {
82
82
  // src/duplicate-key-validator.ts
83
83
  var fs2 = __toESM(require("fs"));
84
84
  var path2 = __toESM(require("path"));
85
- var import_shared2 = require("@ai-localize/shared");
85
+ var import_ai_localize_shared2 = require("ai-localize-shared");
86
86
  var DuplicateKeyValidator = class {
87
87
  constructor(localesDir, defaultLanguage = "en") {
88
88
  this.localesDir = localesDir;
@@ -97,7 +97,7 @@ var DuplicateKeyValidator = class {
97
97
  if (!fs2.existsSync(defaultDir)) return { errors, duplicates };
98
98
  const nsFiles = fs2.readdirSync(defaultDir).filter((f) => f.endsWith(".json"));
99
99
  for (const nsFile of nsFiles) {
100
- const entries = (0, import_shared2.readJsonSafe)(path2.join(defaultDir, nsFile));
100
+ const entries = (0, import_ai_localize_shared2.readJsonSafe)(path2.join(defaultDir, nsFile));
101
101
  if (!entries) continue;
102
102
  const namespace = nsFile.replace(".json", "");
103
103
  const valueMap = /* @__PURE__ */ new Map();
@@ -122,7 +122,7 @@ var DuplicateKeyValidator = class {
122
122
  // src/placeholder-validator.ts
123
123
  var fs3 = __toESM(require("fs"));
124
124
  var path3 = __toESM(require("path"));
125
- var import_shared3 = require("@ai-localize/shared");
125
+ var import_ai_localize_shared3 = require("ai-localize-shared");
126
126
  var PATTERNS = [/\{\{([^}]+)\}\}/g, /\{([^}]+)\}/g, /%\(([^)]+)\)s/g, /%(\w+)/g];
127
127
  var PlaceholderValidator = class {
128
128
  constructor(localesDir, defaultLanguage = "en") {
@@ -138,11 +138,11 @@ var PlaceholderValidator = class {
138
138
  const nsFiles = fs3.readdirSync(defaultDir).filter((f) => f.endsWith(".json"));
139
139
  const langs = fs3.readdirSync(this.localesDir, { withFileTypes: true }).filter((e) => e.isDirectory() && e.name !== this.defaultLanguage).map((e) => e.name);
140
140
  for (const nsFile of nsFiles) {
141
- const defaultEntries = (0, import_shared3.readJsonSafe)(path3.join(defaultDir, nsFile));
141
+ const defaultEntries = (0, import_ai_localize_shared3.readJsonSafe)(path3.join(defaultDir, nsFile));
142
142
  if (!defaultEntries) continue;
143
143
  const namespace = nsFile.replace(".json", "");
144
144
  for (const lang of langs) {
145
- const targetEntries = (0, import_shared3.readJsonSafe)(path3.join(this.localesDir, lang, nsFile)) || {};
145
+ const targetEntries = (0, import_ai_localize_shared3.readJsonSafe)(path3.join(this.localesDir, lang, nsFile)) || {};
146
146
  for (const [key, defaultVal] of Object.entries(defaultEntries)) {
147
147
  const targetVal = targetEntries[key];
148
148
  if (!targetVal) continue;
@@ -172,7 +172,7 @@ var PlaceholderValidator = class {
172
172
  // src/unused-key-validator.ts
173
173
  var fs4 = __toESM(require("fs"));
174
174
  var path4 = __toESM(require("path"));
175
- var import_shared4 = require("@ai-localize/shared");
175
+ var import_ai_localize_shared4 = require("ai-localize-shared");
176
176
  var UnusedKeyValidator = class {
177
177
  constructor(localesDir, sourceDir, defaultLanguage = "en") {
178
178
  this.localesDir = localesDir;
@@ -203,13 +203,13 @@ var UnusedKeyValidator = class {
203
203
  if (!fs4.existsSync(defaultDir)) return keys;
204
204
  for (const file of fs4.readdirSync(defaultDir).filter((f) => f.endsWith(".json"))) {
205
205
  const ns = file.replace(".json", "");
206
- const entries = (0, import_shared4.readJsonSafe)(path4.join(defaultDir, file)) || {};
206
+ const entries = (0, import_ai_localize_shared4.readJsonSafe)(path4.join(defaultDir, file)) || {};
207
207
  for (const key of Object.keys(entries)) keys.push(`${ns}.${key}`);
208
208
  }
209
209
  return keys;
210
210
  }
211
211
  collectSourceContent() {
212
- const files = (0, import_shared4.collectFiles)(this.sourceDir, ["ts", "tsx", "js", "jsx", "vue", "html"], ["node_modules", "dist"]);
212
+ const files = (0, import_ai_localize_shared4.collectFiles)(this.sourceDir, ["ts", "tsx", "js", "jsx", "vue", "html"], ["node_modules", "dist"]);
213
213
  let content = "";
214
214
  for (const f of files) {
215
215
  try {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/missing-key-validator.ts
2
2
  import * as fs from "fs";
3
3
  import * as path from "path";
4
- import { readJsonSafe } from "@ai-localize/shared";
4
+ import { readJsonSafe } from "ai-localize-shared";
5
5
  var MissingKeyValidator = class {
6
6
  constructor(localesDir, defaultLanguage = "en", targetLanguages = []) {
7
7
  this.localesDir = localesDir;
@@ -42,7 +42,7 @@ var MissingKeyValidator = class {
42
42
  // src/duplicate-key-validator.ts
43
43
  import * as fs2 from "fs";
44
44
  import * as path2 from "path";
45
- import { readJsonSafe as readJsonSafe2 } from "@ai-localize/shared";
45
+ import { readJsonSafe as readJsonSafe2 } from "ai-localize-shared";
46
46
  var DuplicateKeyValidator = class {
47
47
  constructor(localesDir, defaultLanguage = "en") {
48
48
  this.localesDir = localesDir;
@@ -82,7 +82,7 @@ var DuplicateKeyValidator = class {
82
82
  // src/placeholder-validator.ts
83
83
  import * as fs3 from "fs";
84
84
  import * as path3 from "path";
85
- import { readJsonSafe as readJsonSafe3 } from "@ai-localize/shared";
85
+ import { readJsonSafe as readJsonSafe3 } from "ai-localize-shared";
86
86
  var PATTERNS = [/\{\{([^}]+)\}\}/g, /\{([^}]+)\}/g, /%\(([^)]+)\)s/g, /%(\w+)/g];
87
87
  var PlaceholderValidator = class {
88
88
  constructor(localesDir, defaultLanguage = "en") {
@@ -132,7 +132,7 @@ var PlaceholderValidator = class {
132
132
  // src/unused-key-validator.ts
133
133
  import * as fs4 from "fs";
134
134
  import * as path4 from "path";
135
- import { readJsonSafe as readJsonSafe4, collectFiles } from "@ai-localize/shared";
135
+ import { readJsonSafe as readJsonSafe4, collectFiles } from "ai-localize-shared";
136
136
  var UnusedKeyValidator = class {
137
137
  constructor(localesDir, sourceDir, defaultLanguage = "en") {
138
138
  this.localesDir = localesDir;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-localize-validators",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Locale file validation engine",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -13,7 +13,7 @@
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "ai-localize-shared": "1.0.0"
16
+ "ai-localize-shared": "1.0.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "tsup": "^8.0.1",
@@ -1,7 +1,7 @@
1
1
  import * as fs from "fs";
2
2
  import * as path from "path";
3
- import type { ValidationError } from "@ai-localize/shared";
4
- import { readJsonSafe } from "@ai-localize/shared";
3
+ import type { ValidationError } from "ai-localize-shared";
4
+ import { readJsonSafe } from "ai-localize-shared";
5
5
 
6
6
  export class DuplicateKeyValidator {
7
7
  constructor(private localesDir: string, private defaultLanguage = "en") {}
@@ -1,4 +1,4 @@
1
- import type { ValidationResult } from "@ai-localize/shared";
1
+ import type { ValidationResult } from "ai-localize-shared";
2
2
  import { MissingKeyValidator } from "./missing-key-validator.js";
3
3
  import { DuplicateKeyValidator } from "./duplicate-key-validator.js";
4
4
  import { PlaceholderValidator } from "./placeholder-validator.js";
@@ -1,7 +1,7 @@
1
1
  import * as fs from "fs";
2
2
  import * as path from "path";
3
- import type { ValidationError } from "@ai-localize/shared";
4
- import { readJsonSafe } from "@ai-localize/shared";
3
+ import type { ValidationError } from "ai-localize-shared";
4
+ import { readJsonSafe } from "ai-localize-shared";
5
5
 
6
6
  export class MissingKeyValidator {
7
7
  constructor(
@@ -1,7 +1,7 @@
1
1
  import * as fs from "fs";
2
2
  import * as path from "path";
3
- import type { ValidationError } from "@ai-localize/shared";
4
- import { readJsonSafe } from "@ai-localize/shared";
3
+ import type { ValidationError } from "ai-localize-shared";
4
+ import { readJsonSafe } from "ai-localize-shared";
5
5
 
6
6
  const PATTERNS = [/\{\{([^}]+)\}\}/g, /\{([^}]+)\}/g, /%\(([^)]+)\)s/g, /%(\w+)/g];
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as fs from "fs";
2
2
  import * as path from "path";
3
- import type { ValidationWarning } from "@ai-localize/shared";
4
- import { readJsonSafe, collectFiles } from "@ai-localize/shared";
3
+ import type { ValidationWarning } from "ai-localize-shared";
4
+ import { readJsonSafe, collectFiles } from "ai-localize-shared";
5
5
 
6
6
  export class UnusedKeyValidator {
7
7
  constructor(