@intlayer/chokidar 5.8.0-canary.0 → 5.8.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.
@@ -22,20 +22,15 @@ __export(createType_exports, {
22
22
  generateTypeScriptType: () => generateTypeScriptType
23
23
  });
24
24
  module.exports = __toCommonJS(createType_exports);
25
+ var import_config = require("@intlayer/config");
25
26
  var import_fs = require("fs");
26
27
  var import_path = require("path");
27
- var import_config = require("@intlayer/config");
28
28
  const requireUncached = (module2) => {
29
29
  delete import_config.ESMxCJSRequire.cache[import_config.ESMxCJSRequire.resolve(module2)];
30
30
  return (0, import_config.ESMxCJSRequire)(module2);
31
31
  };
32
32
  const generateTypeScriptType = (dictionary) => {
33
- const jsonString = JSON.stringify(dictionary, null, 2).replace(/"([^"]+)":/g, (_, key) => {
34
- if (/^[$A-Za-z_][0-9A-Za-z_$]*$/.test(key)) {
35
- return `${key}:`;
36
- }
37
- return `"${key}":`;
38
- });
33
+ const jsonString = JSON.stringify(dictionary, null, 2);
39
34
  return `/* eslint-disable */
40
35
  export default ${jsonString} as const;
41
36
  `;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createType.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { resolve } from 'path';\nimport {\n getConfiguration,\n ESMxCJSRequire,\n IntlayerConfig,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\n\nconst requireUncached = (module: string) => {\n delete ESMxCJSRequire.cache[ESMxCJSRequire.resolve(module)];\n return ESMxCJSRequire(module);\n};\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2)\n // Remove quotes from keys only if they are valid identifiers.\n .replace(/\"([^\"]+)\":/g, (_, key) => {\n // Valid identifier: must start with a letter, underscore, or dollar sign,\n // followed by letters, digits, underscores, or dollar signs.\n if (/^[$A-Za-z_][0-9A-Za-z_$]*$/.test(key)) {\n return `${key}:`;\n }\n // Otherwise, keep the quotes\n return `\"${key}\":`;\n });\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = (\n dictionariesPaths: string[],\n configuration: IntlayerConfig = getConfiguration()\n): string[] => {\n const { typesDir } = configuration.content;\n const resultTypesPaths: string[] = [];\n\n // Create type folders if they don't exist\n if (!existsSync(typesDir)) {\n mkdirSync(typesDir, { recursive: true });\n }\n\n for (const dictionaryPath of dictionariesPaths) {\n const dictionary: Dictionary = requireUncached(dictionaryPath);\n\n if (!dictionary.key) {\n // Skip dictionary if it doesn't have a key, if not exported as default etc\n continue;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n writeFileSync(outputPath, typeDefinition);\n\n resultTypesPaths.push(outputPath);\n }\n\n return resultTypesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqD;AACrD,kBAAwB;AACxB,oBAIO;AAGP,MAAM,kBAAkB,CAACA,YAAmB;AAC1C,SAAO,6BAAe,MAAM,6BAAe,QAAQA,OAAM,CAAC;AAC1D,aAAO,8BAAeA,OAAM;AAC9B;AAEO,MAAM,yBAAyB,CAAC,eAA2B;AAChE,QAAM,aAAa,KAAK,UAAU,YAAY,MAAM,CAAC,EAElD,QAAQ,eAAe,CAAC,GAAG,QAAQ;AAGlC,QAAI,6BAA6B,KAAK,GAAG,GAAG;AAC1C,aAAO,GAAG,GAAG;AAAA,IACf;AAEA,WAAO,IAAI,GAAG;AAAA,EAChB,CAAC;AAEH,SAAO;AAAA,iBAAwC,UAAU;AAAA;AAC3D;AAIO,MAAM,cAAc,CACzB,mBACA,oBAAgC,gCAAiB,MACpC;AACb,QAAM,EAAE,SAAS,IAAI,cAAc;AACnC,QAAM,mBAA6B,CAAC;AAGpC,MAAI,KAAC,sBAAW,QAAQ,GAAG;AACzB,6BAAU,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EACzC;AAEA,aAAW,kBAAkB,mBAAmB;AAC9C,UAAM,aAAyB,gBAAgB,cAAc;AAE7D,QAAI,CAAC,WAAW,KAAK;AAEnB;AAAA,IACF;AAEA,UAAM,iBAAyB,uBAAuB,UAAU;AAEhE,UAAM,iBAAqB,qBAAQ,UAAU,GAAG,WAAW,GAAG,KAAK;AAEnE,iCAAc,YAAY,cAAc;AAExC,qBAAiB,KAAK,UAAU;AAAA,EAClC;AAEA,SAAO;AACT;","names":["module"]}
1
+ {"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createType.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n getConfiguration,\n IntlayerConfig,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { resolve } from 'path';\n\nconst requireUncached = (module: string) => {\n delete ESMxCJSRequire.cache[ESMxCJSRequire.resolve(module)];\n return ESMxCJSRequire(module);\n};\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = (\n dictionariesPaths: string[],\n configuration: IntlayerConfig = getConfiguration()\n): string[] => {\n const { typesDir } = configuration.content;\n const resultTypesPaths: string[] = [];\n\n // Create type folders if they don't exist\n if (!existsSync(typesDir)) {\n mkdirSync(typesDir, { recursive: true });\n }\n\n for (const dictionaryPath of dictionariesPaths) {\n const dictionary: Dictionary = requireUncached(dictionaryPath);\n\n if (!dictionary.key) {\n // Skip dictionary if it doesn't have a key, if not exported as default etc\n continue;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n writeFileSync(outputPath, typeDefinition);\n\n resultTypesPaths.push(outputPath);\n }\n\n return resultTypesPaths;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAIO;AAEP,gBAAqD;AACrD,kBAAwB;AAExB,MAAM,kBAAkB,CAACA,YAAmB;AAC1C,SAAO,6BAAe,MAAM,6BAAe,QAAQA,OAAM,CAAC;AAC1D,aAAO,8BAAeA,OAAM;AAC9B;AAEO,MAAM,yBAAyB,CAAC,eAA2B;AAChE,QAAM,aAAa,KAAK,UAAU,YAAY,MAAM,CAAC;AAErD,SAAO;AAAA,iBAAwC,UAAU;AAAA;AAC3D;AAIO,MAAM,cAAc,CACzB,mBACA,oBAAgC,gCAAiB,MACpC;AACb,QAAM,EAAE,SAAS,IAAI,cAAc;AACnC,QAAM,mBAA6B,CAAC;AAGpC,MAAI,KAAC,sBAAW,QAAQ,GAAG;AACzB,6BAAU,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EACzC;AAEA,aAAW,kBAAkB,mBAAmB;AAC9C,UAAM,aAAyB,gBAAgB,cAAc;AAE7D,QAAI,CAAC,WAAW,KAAK;AAEnB;AAAA,IACF;AAEA,UAAM,iBAAyB,uBAAuB,UAAU;AAEhE,UAAM,iBAAqB,qBAAQ,UAAU,GAAG,WAAW,GAAG,KAAK;AAEnE,iCAAc,YAAY,cAAc;AAExC,qBAAiB,KAAK,UAAU;AAAA,EAClC;AAEA,SAAO;AACT;","names":["module"]}
@@ -1,20 +1,15 @@
1
- import { existsSync, mkdirSync, writeFileSync } from "fs";
2
- import { resolve } from "path";
3
1
  import {
4
- getConfiguration,
5
- ESMxCJSRequire
2
+ ESMxCJSRequire,
3
+ getConfiguration
6
4
  } from "@intlayer/config";
5
+ import { existsSync, mkdirSync, writeFileSync } from "fs";
6
+ import { resolve } from "path";
7
7
  const requireUncached = (module) => {
8
8
  delete ESMxCJSRequire.cache[ESMxCJSRequire.resolve(module)];
9
9
  return ESMxCJSRequire(module);
10
10
  };
11
11
  const generateTypeScriptType = (dictionary) => {
12
- const jsonString = JSON.stringify(dictionary, null, 2).replace(/"([^"]+)":/g, (_, key) => {
13
- if (/^[$A-Za-z_][0-9A-Za-z_$]*$/.test(key)) {
14
- return `${key}:`;
15
- }
16
- return `"${key}":`;
17
- });
12
+ const jsonString = JSON.stringify(dictionary, null, 2);
18
13
  return `/* eslint-disable */
19
14
  export default ${jsonString} as const;
20
15
  `;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createType.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { resolve } from 'path';\nimport {\n getConfiguration,\n ESMxCJSRequire,\n IntlayerConfig,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\n\nconst requireUncached = (module: string) => {\n delete ESMxCJSRequire.cache[ESMxCJSRequire.resolve(module)];\n return ESMxCJSRequire(module);\n};\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2)\n // Remove quotes from keys only if they are valid identifiers.\n .replace(/\"([^\"]+)\":/g, (_, key) => {\n // Valid identifier: must start with a letter, underscore, or dollar sign,\n // followed by letters, digits, underscores, or dollar signs.\n if (/^[$A-Za-z_][0-9A-Za-z_$]*$/.test(key)) {\n return `${key}:`;\n }\n // Otherwise, keep the quotes\n return `\"${key}\":`;\n });\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = (\n dictionariesPaths: string[],\n configuration: IntlayerConfig = getConfiguration()\n): string[] => {\n const { typesDir } = configuration.content;\n const resultTypesPaths: string[] = [];\n\n // Create type folders if they don't exist\n if (!existsSync(typesDir)) {\n mkdirSync(typesDir, { recursive: true });\n }\n\n for (const dictionaryPath of dictionariesPaths) {\n const dictionary: Dictionary = requireUncached(dictionaryPath);\n\n if (!dictionary.key) {\n // Skip dictionary if it doesn't have a key, if not exported as default etc\n continue;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n writeFileSync(outputPath, typeDefinition);\n\n resultTypesPaths.push(outputPath);\n }\n\n return resultTypesPaths;\n};\n"],"mappings":"AAAA,SAAS,YAAY,WAAW,qBAAqB;AACrD,SAAS,eAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAGP,MAAM,kBAAkB,CAAC,WAAmB;AAC1C,SAAO,eAAe,MAAM,eAAe,QAAQ,MAAM,CAAC;AAC1D,SAAO,eAAe,MAAM;AAC9B;AAEO,MAAM,yBAAyB,CAAC,eAA2B;AAChE,QAAM,aAAa,KAAK,UAAU,YAAY,MAAM,CAAC,EAElD,QAAQ,eAAe,CAAC,GAAG,QAAQ;AAGlC,QAAI,6BAA6B,KAAK,GAAG,GAAG;AAC1C,aAAO,GAAG,GAAG;AAAA,IACf;AAEA,WAAO,IAAI,GAAG;AAAA,EAChB,CAAC;AAEH,SAAO;AAAA,iBAAwC,UAAU;AAAA;AAC3D;AAIO,MAAM,cAAc,CACzB,mBACA,gBAAgC,iBAAiB,MACpC;AACb,QAAM,EAAE,SAAS,IAAI,cAAc;AACnC,QAAM,mBAA6B,CAAC;AAGpC,MAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,cAAU,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EACzC;AAEA,aAAW,kBAAkB,mBAAmB;AAC9C,UAAM,aAAyB,gBAAgB,cAAc;AAE7D,QAAI,CAAC,WAAW,KAAK;AAEnB;AAAA,IACF;AAEA,UAAM,iBAAyB,uBAAuB,UAAU;AAEhE,UAAM,aAAqB,QAAQ,UAAU,GAAG,WAAW,GAAG,KAAK;AAEnE,kBAAc,YAAY,cAAc;AAExC,qBAAiB,KAAK,UAAU;AAAA,EAClC;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/transpiler/dictionary_to_type/createType.ts"],"sourcesContent":["import {\n ESMxCJSRequire,\n getConfiguration,\n IntlayerConfig,\n} from '@intlayer/config';\nimport type { Dictionary } from '@intlayer/core';\nimport { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { resolve } from 'path';\n\nconst requireUncached = (module: string) => {\n delete ESMxCJSRequire.cache[ESMxCJSRequire.resolve(module)];\n return ESMxCJSRequire(module);\n};\n\nexport const generateTypeScriptType = (dictionary: Dictionary) => {\n const jsonString = JSON.stringify(dictionary, null, 2);\n\n return `/* eslint-disable */\\nexport default ${jsonString} as const;\\n`;\n};\n/**\n * This function generates a TypeScript type definition from a JSON object\n */\nexport const createTypes = (\n dictionariesPaths: string[],\n configuration: IntlayerConfig = getConfiguration()\n): string[] => {\n const { typesDir } = configuration.content;\n const resultTypesPaths: string[] = [];\n\n // Create type folders if they don't exist\n if (!existsSync(typesDir)) {\n mkdirSync(typesDir, { recursive: true });\n }\n\n for (const dictionaryPath of dictionariesPaths) {\n const dictionary: Dictionary = requireUncached(dictionaryPath);\n\n if (!dictionary.key) {\n // Skip dictionary if it doesn't have a key, if not exported as default etc\n continue;\n }\n\n const typeDefinition: string = generateTypeScriptType(dictionary);\n\n const outputPath: string = resolve(typesDir, `${dictionary.key}.ts`);\n\n writeFileSync(outputPath, typeDefinition);\n\n resultTypesPaths.push(outputPath);\n }\n\n return resultTypesPaths;\n};\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,YAAY,WAAW,qBAAqB;AACrD,SAAS,eAAe;AAExB,MAAM,kBAAkB,CAAC,WAAmB;AAC1C,SAAO,eAAe,MAAM,eAAe,QAAQ,MAAM,CAAC;AAC1D,SAAO,eAAe,MAAM;AAC9B;AAEO,MAAM,yBAAyB,CAAC,eAA2B;AAChE,QAAM,aAAa,KAAK,UAAU,YAAY,MAAM,CAAC;AAErD,SAAO;AAAA,iBAAwC,UAAU;AAAA;AAC3D;AAIO,MAAM,cAAc,CACzB,mBACA,gBAAgC,iBAAiB,MACpC;AACb,QAAM,EAAE,SAAS,IAAI,cAAc;AACnC,QAAM,mBAA6B,CAAC;AAGpC,MAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,cAAU,UAAU,EAAE,WAAW,KAAK,CAAC;AAAA,EACzC;AAEA,aAAW,kBAAkB,mBAAmB;AAC9C,UAAM,aAAyB,gBAAgB,cAAc;AAE7D,QAAI,CAAC,WAAW,KAAK;AAEnB;AAAA,IACF;AAEA,UAAM,iBAAyB,uBAAuB,UAAU;AAEhE,UAAM,aAAqB,QAAQ,UAAU,GAAG,WAAW,GAAG,KAAK;AAEnE,kBAAc,YAAY,cAAc;AAExC,qBAAiB,KAAK,UAAU;AAAA,EAClC;AAEA,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"createType.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_type/createType.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU,WAc5D,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,mBAAmB,MAAM,EAAE,EAC3B,gBAAe,cAAmC,KACjD,MAAM,EA2BR,CAAC"}
1
+ {"version":3,"file":"createType.d.ts","sourceRoot":"","sources":["../../../../src/transpiler/dictionary_to_type/createType.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AASjD,eAAO,MAAM,sBAAsB,GAAI,YAAY,UAAU,WAI5D,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,mBAAmB,MAAM,EAAE,EAC3B,gBAAe,cAAmC,KACjD,MAAM,EA2BR,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/chokidar",
3
- "version": "5.8.0-canary.0",
3
+ "version": "5.8.1",
4
4
  "private": false,
5
5
  "description": "Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.",
6
6
  "keywords": [
@@ -68,12 +68,12 @@
68
68
  "fast-glob": "^3.3.3",
69
69
  "p-limit": "^3.1.0",
70
70
  "simple-git": "^3.27.0",
71
- "@intlayer/api": "5.8.0-canary.0",
72
- "@intlayer/config": "5.8.0-canary.0",
73
- "@intlayer/core": "5.8.0-canary.0",
74
- "@intlayer/unmerged-dictionaries-entry": "5.8.0-canary.0",
75
- "intlayer": "5.8.0-canary.0",
76
- "@intlayer/dictionaries-entry": "5.8.0-canary.0"
71
+ "@intlayer/config": "5.8.1",
72
+ "@intlayer/core": "5.8.1",
73
+ "@intlayer/api": "5.8.1",
74
+ "@intlayer/dictionaries-entry": "5.8.1",
75
+ "intlayer": "5.8.1",
76
+ "@intlayer/unmerged-dictionaries-entry": "5.8.1"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@changesets/cli": "2.29.5",
@@ -91,19 +91,19 @@
91
91
  "tsup": "^8.5.0",
92
92
  "typescript": "^5.9.2",
93
93
  "vitest": "^3.2.2",
94
+ "@intlayer/backend": "5.8.1",
94
95
  "@utils/eslint-config": "1.0.4",
95
- "@utils/ts-config-types": "1.0.4",
96
96
  "@utils/ts-config": "1.0.4",
97
97
  "@utils/tsup-config": "1.0.4",
98
- "@intlayer/backend": "5.8.0-canary.0"
98
+ "@utils/ts-config-types": "1.0.4"
99
99
  },
100
100
  "peerDependencies": {
101
101
  "fast-glob": "^3.3.3",
102
102
  "react": ">=16.0.0",
103
- "@intlayer/config": "5.8.0-canary.0",
104
- "intlayer": "5.8.0-canary.0",
105
- "@intlayer/api": "5.8.0-canary.0",
106
- "@intlayer/core": "5.8.0-canary.0"
103
+ "@intlayer/api": "5.8.1",
104
+ "@intlayer/core": "5.8.1",
105
+ "intlayer": "5.8.1",
106
+ "@intlayer/config": "5.8.1"
107
107
  },
108
108
  "engines": {
109
109
  "node": ">=14.18"