@intlayer/chokidar 8.6.0 → 8.6.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.
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.cjs","names":["configuration","ANSIColors","ENGLISH"],"sources":["../../../src/utils/formatter.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport configuration from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath } from '@intlayer/config/logger';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport const formatPath = (\n path: string | string[],\n color?: ANSIColors | false\n) =>\n [path]\n .flat()\n .map((path) =>\n path.startsWith('/') ? relative(configuration.system.baseDir, path) : path\n )\n .map((relativePath) =>\n color === false ? relativePath : colorizePath(relativePath, color)\n )\n .join(`, `);\n\nexport const formatLocale = (\n locale: LocalesValues | LocalesValues[],\n color: ANSIColors | false = ANSIColors.GREEN\n) =>\n [locale]\n .flat()\n .map((locale) => `${getLocaleName(locale, ENGLISH)} (${locale})`)\n .map((text) => (color === false ? text : colorize(text, color)))\n .join(`, `);\n"],"mappings":";;;;;;;;;;;;AAQA,MAAa,cACX,MACA,UAEA,CAAC,KAAK,CACH,MAAM,CACN,KAAK,SACJ,KAAK,WAAW,IAAI,2BAAYA,+BAAc,OAAO,SAAS,KAAK,GAAG,KACvE,CACA,KAAK,iBACJ,UAAU,QAAQ,yDAA4B,cAAc,MAAM,CACnE,CACA,KAAK,KAAK;AAEf,MAAa,gBACX,QACA,QAA4BC,wBAAW,UAEvC,CAAC,OAAO,CACL,MAAM,CACN,KAAK,WAAW,kDAAiB,QAAQC,gCAAQ,CAAC,IAAI,OAAO,GAAG,CAChE,KAAK,SAAU,UAAU,QAAQ,6CAAgB,MAAM,MAAM,CAAE,CAC/D,KAAK,KAAK"}
1
+ {"version":3,"file":"formatter.cjs","names":["configuration","ANSIColors","ENGLISH"],"sources":["../../../src/utils/formatter.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport configuration from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n type ANSIColorsType,\n colorize,\n colorizePath,\n} from '@intlayer/config/logger';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport const formatPath = (\n path: string | string[],\n color?: ANSIColorsType | false\n) =>\n [path]\n .flat()\n .map((path) =>\n path.startsWith('/') ? relative(configuration.system.baseDir, path) : path\n )\n .map((relativePath) =>\n color === false ? relativePath : colorizePath(relativePath, color)\n )\n .join(`, `);\n\nexport const formatLocale = (\n locale: LocalesValues | LocalesValues[],\n color: ANSIColorsType | false = ANSIColors.GREEN\n) =>\n [locale]\n .flat()\n .map((locale) => `${getLocaleName(locale, ENGLISH)} (${locale})`)\n .map((text) => (color === false ? text : colorize(text, color)))\n .join(`, `);\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,cACX,MACA,UAEA,CAAC,KAAK,CACH,MAAM,CACN,KAAK,SACJ,KAAK,WAAW,IAAI,2BAAYA,+BAAc,OAAO,SAAS,KAAK,GAAG,KACvE,CACA,KAAK,iBACJ,UAAU,QAAQ,yDAA4B,cAAc,MAAM,CACnE,CACA,KAAK,KAAK;AAEf,MAAa,gBACX,QACA,QAAgCC,wBAAW,UAE3C,CAAC,OAAO,CACL,MAAM,CACN,KAAK,WAAW,kDAAiB,QAAQC,gCAAQ,CAAC,IAAI,OAAO,GAAG,CAChE,KAAK,SAAU,UAAU,QAAQ,6CAAgB,MAAM,MAAM,CAAE,CAC/D,KAAK,KAAK"}
@@ -1,21 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_utils_parallelize = require('./parallelize.cjs');
4
+ let _intlayer_types_nodeType = require("@intlayer/types/nodeType");
2
5
 
3
6
  //#region src/utils/getUsedNodeTypes.ts
4
- /**
5
- * NodeType strings that correspond to plugins that can be conditionally
6
- * removed from the bundle when unused.
7
- */
8
- const PLUGIN_NODE_TYPES = [
9
- "translation",
10
- "enumeration",
11
- "condition",
12
- "insertion",
13
- "gender",
14
- "nested",
15
- "file",
16
- "markdown",
17
- "html"
18
- ];
19
7
  /** Recursively collect every `nodeType` string found in a value. */
20
8
  const collectNodeTypes = (value, result) => {
21
9
  if (!value || typeof value !== "object") return;
@@ -39,50 +27,42 @@ const getUsedNodeTypes = (dictionaries) => {
39
27
  const result = /* @__PURE__ */ new Set();
40
28
  const dicts = Array.isArray(dictionaries) ? dictionaries : Object.values(dictionaries);
41
29
  for (const dict of dicts) collectNodeTypes(dict.content, result);
42
- return result;
30
+ return [...result];
31
+ };
32
+ const getUnusedNodeTypes = (dictionaries) => {
33
+ const usedNodeTypes = getUsedNodeTypes(dictionaries);
34
+ return _intlayer_types_nodeType.PLUGIN_NODE_TYPES.filter((nodeType) => !usedNodeTypes.includes(nodeType));
35
+ };
36
+ const getUsedNodeTypesAsync = async (dictionaries) => {
37
+ const results = await require_utils_parallelize.parallelize(Array.isArray(dictionaries) ? dictionaries : Object.values(dictionaries), async (dictionary) => {
38
+ const result = /* @__PURE__ */ new Set();
39
+ collectNodeTypes(dictionary.content, result);
40
+ return result;
41
+ });
42
+ const finalResult = /* @__PURE__ */ new Set();
43
+ for (const res of results) for (const val of res) finalResult.add(val);
44
+ return [...finalResult];
45
+ };
46
+ const getUnusedNodeTypesAsync = async (dictionaries) => {
47
+ const usedNodeTypes = await getUsedNodeTypesAsync(dictionaries);
48
+ return _intlayer_types_nodeType.PLUGIN_NODE_TYPES.filter((nodeType) => !usedNodeTypes.includes(nodeType));
43
49
  };
44
50
  /**
45
51
  * Converts a NodeType key to its corresponding env-var name.
46
52
  *
47
53
  * @example
48
- * nodeTypeToEnvVar('enumeration') // 'INTLAYER_NODE_TYPE_ENUMERATION'
54
+ * formatNodeTypeToEnvVar(['enumeration']) // { 'INTLAYER_NODE_TYPE_ENUMERATION': 'false' }
55
+ * formatNodeTypeToEnvVar(['enumeration'], true) // { 'process.env.INTLAYER_NODE_TYPE_ENUMERATION': 'false' }
49
56
  */
50
- const nodeTypeToEnvVar = (nodeType) => `INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`;
51
- /**
52
- * Returns a record mapping each **unused** NodeType to `'false'` so build
53
- * plugins can dead-code-eliminate the corresponding plugin from the bundle.
54
- *
55
- * Keys are bare env-var names (`INTLAYER_NODE_TYPE_*`).
56
- * Build plugins that need `process.env.*` keys (Vite `define`, webpack
57
- * `DefinePlugin`, Lynx `source.define`) should prefix them and wrap values
58
- * with `JSON.stringify`; Next.js `env:` can use the record directly.
59
- *
60
- * Only NodeTypes that are confirmed absent from all dictionaries get the
61
- * `'false'` value; used (or unknown) types are omitted so they default to
62
- * `true` inside `getPlugins` / `getBasePlugins`.
63
- *
64
- * @param usedNodeTypes - Set returned by `getUsedNodeTypes`.
65
- * @returns Record keyed by `INTLAYER_NODE_TYPE_*` → `'false'`.
66
- *
67
- * @example
68
- * // When only 'translation' is used:
69
- * getNodeTypeDefineVars(new Set(['translation']))
70
- * // {
71
- * // INTLAYER_NODE_TYPE_ENUMERATION: 'false',
72
- * // INTLAYER_NODE_TYPE_CONDITION: 'false',
73
- * // ...
74
- * // }
75
- */
76
- const getNodeTypeDefineVars = (usedNodeTypes) => {
77
- if (usedNodeTypes.size === 0) return {};
78
- const result = {};
79
- for (const nodeType of PLUGIN_NODE_TYPES) if (!usedNodeTypes.has(nodeType)) result[nodeTypeToEnvVar(nodeType)] = "false";
80
- return result;
81
- };
57
+ const formatNodeTypeToEnvVar = (nodeTypes, addProcessEnv = false) => nodeTypes.reduce((acc, nodeType) => {
58
+ acc[addProcessEnv ? `process.env.INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}` : `INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`] = "\"false\"";
59
+ return acc;
60
+ }, {});
82
61
 
83
62
  //#endregion
84
- exports.PLUGIN_NODE_TYPES = PLUGIN_NODE_TYPES;
85
- exports.getNodeTypeDefineVars = getNodeTypeDefineVars;
63
+ exports.formatNodeTypeToEnvVar = formatNodeTypeToEnvVar;
64
+ exports.getUnusedNodeTypes = getUnusedNodeTypes;
65
+ exports.getUnusedNodeTypesAsync = getUnusedNodeTypesAsync;
86
66
  exports.getUsedNodeTypes = getUsedNodeTypes;
87
- exports.nodeTypeToEnvVar = nodeTypeToEnvVar;
67
+ exports.getUsedNodeTypesAsync = getUsedNodeTypesAsync;
88
68
  //# sourceMappingURL=getUsedNodeTypes.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUsedNodeTypes.cjs","names":[],"sources":["../../../src/utils/getUsedNodeTypes.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\n\n/**\n * NodeType strings that correspond to plugins that can be conditionally\n * removed from the bundle when unused.\n */\nexport const PLUGIN_NODE_TYPES = [\n 'translation',\n 'enumeration',\n 'condition',\n 'insertion',\n 'gender',\n 'nested',\n 'file',\n 'markdown',\n 'html',\n] as const;\n\nexport type PluginNodeType = (typeof PLUGIN_NODE_TYPES)[number];\n\n/** Recursively collect every `nodeType` string found in a value. */\nconst collectNodeTypes = (value: unknown, result: Set<string>): void => {\n if (!value || typeof value !== 'object') return;\n\n if (Array.isArray(value)) {\n for (const item of value) collectNodeTypes(item, result);\n return;\n }\n\n const obj = value as Record<string, unknown>;\n\n if (typeof obj.nodeType === 'string') {\n result.add(obj.nodeType);\n }\n\n for (const key of Object.keys(obj)) {\n collectNodeTypes(obj[key], result);\n }\n};\n\n/**\n * Returns the set of NodeType strings actually used across the given\n * built dictionaries.\n *\n * @example\n * const used = getUsedNodeTypes(getDictionaries(config));\n * // Set { 'translation', 'enumeration' }\n */\nexport const getUsedNodeTypes = (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): Set<string> => {\n const result = new Set<string>();\n const dicts = Array.isArray(dictionaries)\n ? dictionaries\n : Object.values(dictionaries);\n\n for (const dict of dicts) {\n collectNodeTypes(dict.content, result);\n }\n\n return result;\n};\n\n/**\n * Converts a NodeType key to its corresponding env-var name.\n *\n * @example\n * nodeTypeToEnvVar('enumeration') // 'INTLAYER_NODE_TYPE_ENUMERATION'\n */\nexport const nodeTypeToEnvVar = (nodeType: string): string =>\n `INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`;\n\n/**\n * Returns a record mapping each **unused** NodeType to `'false'` so build\n * plugins can dead-code-eliminate the corresponding plugin from the bundle.\n *\n * Keys are bare env-var names (`INTLAYER_NODE_TYPE_*`).\n * Build plugins that need `process.env.*` keys (Vite `define`, webpack\n * `DefinePlugin`, Lynx `source.define`) should prefix them and wrap values\n * with `JSON.stringify`; Next.js `env:` can use the record directly.\n *\n * Only NodeTypes that are confirmed absent from all dictionaries get the\n * `'false'` value; used (or unknown) types are omitted so they default to\n * `true` inside `getPlugins` / `getBasePlugins`.\n *\n * @param usedNodeTypes - Set returned by `getUsedNodeTypes`.\n * @returns Record keyed by `INTLAYER_NODE_TYPE_*` → `'false'`.\n *\n * @example\n * // When only 'translation' is used:\n * getNodeTypeDefineVars(new Set(['translation']))\n * // {\n * // INTLAYER_NODE_TYPE_ENUMERATION: 'false',\n * // INTLAYER_NODE_TYPE_CONDITION: 'false',\n * // ...\n * // }\n */\nexport const getNodeTypeDefineVars = (\n usedNodeTypes: Set<string>\n): Record<string, string> => {\n // No dictionaries found yet → safe default: keep all plugins\n if (usedNodeTypes.size === 0) return {};\n\n const result: Record<string, string> = {};\n\n for (const nodeType of PLUGIN_NODE_TYPES) {\n if (!usedNodeTypes.has(nodeType)) {\n result[nodeTypeToEnvVar(nodeType)] = 'false';\n }\n }\n\n return result;\n};\n"],"mappings":";;;;;;;AAMA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAKD,MAAM,oBAAoB,OAAgB,WAA8B;AACtE,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AAEzC,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,OAAK,MAAM,QAAQ,MAAO,kBAAiB,MAAM,OAAO;AACxD;;CAGF,MAAM,MAAM;AAEZ,KAAI,OAAO,IAAI,aAAa,SAC1B,QAAO,IAAI,IAAI,SAAS;AAG1B,MAAK,MAAM,OAAO,OAAO,KAAK,IAAI,CAChC,kBAAiB,IAAI,MAAM,OAAO;;;;;;;;;;AAYtC,MAAa,oBACX,iBACgB;CAChB,MAAM,yBAAS,IAAI,KAAa;CAChC,MAAM,QAAQ,MAAM,QAAQ,aAAa,GACrC,eACA,OAAO,OAAO,aAAa;AAE/B,MAAK,MAAM,QAAQ,MACjB,kBAAiB,KAAK,SAAS,OAAO;AAGxC,QAAO;;;;;;;;AAST,MAAa,oBAAoB,aAC/B,sBAAsB,SAAS,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;AA2B9C,MAAa,yBACX,kBAC2B;AAE3B,KAAI,cAAc,SAAS,EAAG,QAAO,EAAE;CAEvC,MAAM,SAAiC,EAAE;AAEzC,MAAK,MAAM,YAAY,kBACrB,KAAI,CAAC,cAAc,IAAI,SAAS,CAC9B,QAAO,iBAAiB,SAAS,IAAI;AAIzC,QAAO"}
1
+ {"version":3,"file":"getUsedNodeTypes.cjs","names":["PLUGIN_NODE_TYPES","parallelize"],"sources":["../../../src/utils/getUsedNodeTypes.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport { PLUGIN_NODE_TYPES } from '@intlayer/types/nodeType';\nimport { parallelize } from './parallelize';\n\nexport type PluginNodeType = (typeof PLUGIN_NODE_TYPES)[number];\n\n/** Recursively collect every `nodeType` string found in a value. */\nconst collectNodeTypes = (value: unknown, result: Set<string>): void => {\n if (!value || typeof value !== 'object') return;\n\n if (Array.isArray(value)) {\n for (const item of value) collectNodeTypes(item, result);\n return;\n }\n\n const obj = value as Record<string, unknown>;\n\n if (typeof obj.nodeType === 'string') {\n result.add(obj.nodeType);\n }\n\n for (const key of Object.keys(obj)) {\n collectNodeTypes(obj[key], result);\n }\n};\n\n/**\n * Returns the set of NodeType strings actually used across the given\n * built dictionaries.\n *\n * @example\n * const used = getUsedNodeTypes(getDictionaries(config));\n * // Set { 'translation', 'enumeration' }\n */\nexport const getUsedNodeTypes = (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): PluginNodeType[] => {\n const result = new Set<PluginNodeType>();\n const dicts = Array.isArray(dictionaries)\n ? dictionaries\n : Object.values(dictionaries);\n\n for (const dict of dicts) {\n collectNodeTypes(dict.content, result);\n }\n\n return [...result];\n};\n\nexport const getUnusedNodeTypes = (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): PluginNodeType[] => {\n const usedNodeTypes = getUsedNodeTypes(dictionaries);\n\n return PLUGIN_NODE_TYPES.filter(\n (nodeType) => !usedNodeTypes.includes(nodeType)\n );\n};\n\nexport const getUsedNodeTypesAsync = async (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): Promise<PluginNodeType[]> => {\n const dicts = Array.isArray(dictionaries)\n ? dictionaries\n : Object.values(dictionaries);\n\n const results = await parallelize(dicts, async (dictionary) => {\n const result = new Set<PluginNodeType>();\n\n collectNodeTypes(dictionary.content, result as Set<string>);\n\n return result;\n });\n\n const finalResult = new Set<PluginNodeType>();\n\n for (const res of results) {\n for (const val of res) {\n finalResult.add(val);\n }\n }\n\n return [...finalResult];\n};\n\nexport const getUnusedNodeTypesAsync = async (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): Promise<PluginNodeType[]> => {\n const usedNodeTypes = await getUsedNodeTypesAsync(dictionaries);\n\n return PLUGIN_NODE_TYPES.filter(\n (nodeType) => !usedNodeTypes.includes(nodeType)\n );\n};\n\n/**\n * Converts a NodeType key to its corresponding env-var name.\n *\n * @example\n * formatNodeTypeToEnvVar(['enumeration']) // { 'INTLAYER_NODE_TYPE_ENUMERATION': 'false' }\n * formatNodeTypeToEnvVar(['enumeration'], true) // { 'process.env.INTLAYER_NODE_TYPE_ENUMERATION': 'false' }\n */\nexport const formatNodeTypeToEnvVar = (\n nodeTypes: string[],\n addProcessEnv: boolean = false\n): Record<string, string> =>\n nodeTypes.reduce(\n (acc, nodeType) => {\n acc[\n addProcessEnv\n ? `process.env.INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`\n : `INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`\n ] = '\"false\"';\n return acc;\n },\n {} as Record<string, string>\n );\n"],"mappings":";;;;;;;AAOA,MAAM,oBAAoB,OAAgB,WAA8B;AACtE,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AAEzC,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,OAAK,MAAM,QAAQ,MAAO,kBAAiB,MAAM,OAAO;AACxD;;CAGF,MAAM,MAAM;AAEZ,KAAI,OAAO,IAAI,aAAa,SAC1B,QAAO,IAAI,IAAI,SAAS;AAG1B,MAAK,MAAM,OAAO,OAAO,KAAK,IAAI,CAChC,kBAAiB,IAAI,MAAM,OAAO;;;;;;;;;;AAYtC,MAAa,oBACX,iBACqB;CACrB,MAAM,yBAAS,IAAI,KAAqB;CACxC,MAAM,QAAQ,MAAM,QAAQ,aAAa,GACrC,eACA,OAAO,OAAO,aAAa;AAE/B,MAAK,MAAM,QAAQ,MACjB,kBAAiB,KAAK,SAAS,OAAO;AAGxC,QAAO,CAAC,GAAG,OAAO;;AAGpB,MAAa,sBACX,iBACqB;CACrB,MAAM,gBAAgB,iBAAiB,aAAa;AAEpD,QAAOA,2CAAkB,QACtB,aAAa,CAAC,cAAc,SAAS,SAAS,CAChD;;AAGH,MAAa,wBAAwB,OACnC,iBAC8B;CAK9B,MAAM,UAAU,MAAMC,sCAJR,MAAM,QAAQ,aAAa,GACrC,eACA,OAAO,OAAO,aAAa,EAEU,OAAO,eAAe;EAC7D,MAAM,yBAAS,IAAI,KAAqB;AAExC,mBAAiB,WAAW,SAAS,OAAsB;AAE3D,SAAO;GACP;CAEF,MAAM,8BAAc,IAAI,KAAqB;AAE7C,MAAK,MAAM,OAAO,QAChB,MAAK,MAAM,OAAO,IAChB,aAAY,IAAI,IAAI;AAIxB,QAAO,CAAC,GAAG,YAAY;;AAGzB,MAAa,0BAA0B,OACrC,iBAC8B;CAC9B,MAAM,gBAAgB,MAAM,sBAAsB,aAAa;AAE/D,QAAOD,2CAAkB,QACtB,aAAa,CAAC,cAAc,SAAS,SAAS,CAChD;;;;;;;;;AAUH,MAAa,0BACX,WACA,gBAAyB,UAEzB,UAAU,QACP,KAAK,aAAa;AACjB,KACE,gBACI,kCAAkC,SAAS,aAAa,KACxD,sBAAsB,SAAS,aAAa,MAC9C;AACJ,QAAO;GAET,EAAE,CACH"}
@@ -21,25 +21,26 @@ const require_utils_runParallel_index = require('./runParallel/index.cjs');
21
21
  const require_utils_sortAlphabetically = require('./sortAlphabetically.cjs');
22
22
  const require_utils_verifyIdenticObjectFormat = require('./verifyIdenticObjectFormat.cjs');
23
23
 
24
- exports.PLUGIN_NODE_TYPES = require_utils_getUsedNodeTypes.PLUGIN_NODE_TYPES;
25
24
  exports.Queue = require_utils_pLimit.Queue;
26
25
  exports.assembleJSON = require_utils_chunkJSON.assembleJSON;
27
26
  exports.autoDecorateContent = require_utils_autoDecorateContent.autoDecorateContent;
28
27
  exports.buildComponentFilesList = require_utils_buildComponentFilesList.buildComponentFilesList;
29
28
  exports.chunkJSON = require_utils_chunkJSON.chunkJSON;
30
29
  exports.formatLocale = require_utils_formatter.formatLocale;
30
+ exports.formatNodeTypeToEnvVar = require_utils_getUsedNodeTypes.formatNodeTypeToEnvVar;
31
31
  exports.formatPath = require_utils_formatter.formatPath;
32
32
  exports.getChunk = require_utils_getChunk.getChunk;
33
33
  exports.getContentExtension = require_utils_getContentExtension.getContentExtension;
34
34
  exports.getExtensionFromFormat = require_utils_getFormatFromExtension.getExtensionFromFormat;
35
35
  exports.getFormatFromExtension = require_utils_getFormatFromExtension.getFormatFromExtension;
36
36
  exports.getGlobalLimiter = require_utils_parallelizeGlobal.getGlobalLimiter;
37
- exports.getNodeTypeDefineVars = require_utils_getUsedNodeTypes.getNodeTypeDefineVars;
38
37
  exports.getPathHash = require_utils_getPathHash.getPathHash;
39
38
  exports.getTaskLimiter = require_utils_parallelizeGlobal.getTaskLimiter;
39
+ exports.getUnusedNodeTypes = require_utils_getUsedNodeTypes.getUnusedNodeTypes;
40
+ exports.getUnusedNodeTypesAsync = require_utils_getUsedNodeTypes.getUnusedNodeTypesAsync;
40
41
  exports.getUsedNodeTypes = require_utils_getUsedNodeTypes.getUsedNodeTypes;
42
+ exports.getUsedNodeTypesAsync = require_utils_getUsedNodeTypes.getUsedNodeTypesAsync;
41
43
  exports.mergeChunks = require_utils_mergeChunks.mergeChunks;
42
- exports.nodeTypeToEnvVar = require_utils_getUsedNodeTypes.nodeTypeToEnvVar;
43
44
  exports.pLimit = require_utils_pLimit.pLimit;
44
45
  exports.parallelize = require_utils_parallelize.parallelize;
45
46
  exports.parallelizeGlobal = require_utils_parallelizeGlobal.parallelizeGlobal;
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.mjs","names":[],"sources":["../../../src/utils/formatter.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport configuration from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath } from '@intlayer/config/logger';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport const formatPath = (\n path: string | string[],\n color?: ANSIColors | false\n) =>\n [path]\n .flat()\n .map((path) =>\n path.startsWith('/') ? relative(configuration.system.baseDir, path) : path\n )\n .map((relativePath) =>\n color === false ? relativePath : colorizePath(relativePath, color)\n )\n .join(`, `);\n\nexport const formatLocale = (\n locale: LocalesValues | LocalesValues[],\n color: ANSIColors | false = ANSIColors.GREEN\n) =>\n [locale]\n .flat()\n .map((locale) => `${getLocaleName(locale, ENGLISH)} (${locale})`)\n .map((text) => (color === false ? text : colorize(text, color)))\n .join(`, `);\n"],"mappings":";;;;;;;;AAQA,MAAa,cACX,MACA,UAEA,CAAC,KAAK,CACH,MAAM,CACN,KAAK,SACJ,KAAK,WAAW,IAAI,GAAG,SAAS,cAAc,OAAO,SAAS,KAAK,GAAG,KACvE,CACA,KAAK,iBACJ,UAAU,QAAQ,eAAe,aAAa,cAAc,MAAM,CACnE,CACA,KAAK,KAAK;AAEf,MAAa,gBACX,QACA,QAA4B,WAAW,UAEvC,CAAC,OAAO,CACL,MAAM,CACN,KAAK,WAAW,GAAG,cAAc,QAAQ,QAAQ,CAAC,IAAI,OAAO,GAAG,CAChE,KAAK,SAAU,UAAU,QAAQ,OAAO,SAAS,MAAM,MAAM,CAAE,CAC/D,KAAK,KAAK"}
1
+ {"version":3,"file":"formatter.mjs","names":[],"sources":["../../../src/utils/formatter.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport configuration from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n type ANSIColorsType,\n colorize,\n colorizePath,\n} from '@intlayer/config/logger';\nimport { getLocaleName } from '@intlayer/core/localization';\nimport { ENGLISH } from '@intlayer/types/locales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\n\nexport const formatPath = (\n path: string | string[],\n color?: ANSIColorsType | false\n) =>\n [path]\n .flat()\n .map((path) =>\n path.startsWith('/') ? relative(configuration.system.baseDir, path) : path\n )\n .map((relativePath) =>\n color === false ? relativePath : colorizePath(relativePath, color)\n )\n .join(`, `);\n\nexport const formatLocale = (\n locale: LocalesValues | LocalesValues[],\n color: ANSIColorsType | false = ANSIColors.GREEN\n) =>\n [locale]\n .flat()\n .map((locale) => `${getLocaleName(locale, ENGLISH)} (${locale})`)\n .map((text) => (color === false ? text : colorize(text, color)))\n .join(`, `);\n"],"mappings":";;;;;;;;AAYA,MAAa,cACX,MACA,UAEA,CAAC,KAAK,CACH,MAAM,CACN,KAAK,SACJ,KAAK,WAAW,IAAI,GAAG,SAAS,cAAc,OAAO,SAAS,KAAK,GAAG,KACvE,CACA,KAAK,iBACJ,UAAU,QAAQ,eAAe,aAAa,cAAc,MAAM,CACnE,CACA,KAAK,KAAK;AAEf,MAAa,gBACX,QACA,QAAgC,WAAW,UAE3C,CAAC,OAAO,CACL,MAAM,CACN,KAAK,WAAW,GAAG,cAAc,QAAQ,QAAQ,CAAC,IAAI,OAAO,GAAG,CAChE,KAAK,SAAU,UAAU,QAAQ,OAAO,SAAS,MAAM,MAAM,CAAE,CAC/D,KAAK,KAAK"}
@@ -1,19 +1,7 @@
1
+ import { parallelize } from "./parallelize.mjs";
2
+ import { PLUGIN_NODE_TYPES } from "@intlayer/types/nodeType";
3
+
1
4
  //#region src/utils/getUsedNodeTypes.ts
2
- /**
3
- * NodeType strings that correspond to plugins that can be conditionally
4
- * removed from the bundle when unused.
5
- */
6
- const PLUGIN_NODE_TYPES = [
7
- "translation",
8
- "enumeration",
9
- "condition",
10
- "insertion",
11
- "gender",
12
- "nested",
13
- "file",
14
- "markdown",
15
- "html"
16
- ];
17
5
  /** Recursively collect every `nodeType` string found in a value. */
18
6
  const collectNodeTypes = (value, result) => {
19
7
  if (!value || typeof value !== "object") return;
@@ -37,47 +25,38 @@ const getUsedNodeTypes = (dictionaries) => {
37
25
  const result = /* @__PURE__ */ new Set();
38
26
  const dicts = Array.isArray(dictionaries) ? dictionaries : Object.values(dictionaries);
39
27
  for (const dict of dicts) collectNodeTypes(dict.content, result);
40
- return result;
28
+ return [...result];
29
+ };
30
+ const getUnusedNodeTypes = (dictionaries) => {
31
+ const usedNodeTypes = getUsedNodeTypes(dictionaries);
32
+ return PLUGIN_NODE_TYPES.filter((nodeType) => !usedNodeTypes.includes(nodeType));
33
+ };
34
+ const getUsedNodeTypesAsync = async (dictionaries) => {
35
+ const results = await parallelize(Array.isArray(dictionaries) ? dictionaries : Object.values(dictionaries), async (dictionary) => {
36
+ const result = /* @__PURE__ */ new Set();
37
+ collectNodeTypes(dictionary.content, result);
38
+ return result;
39
+ });
40
+ const finalResult = /* @__PURE__ */ new Set();
41
+ for (const res of results) for (const val of res) finalResult.add(val);
42
+ return [...finalResult];
43
+ };
44
+ const getUnusedNodeTypesAsync = async (dictionaries) => {
45
+ const usedNodeTypes = await getUsedNodeTypesAsync(dictionaries);
46
+ return PLUGIN_NODE_TYPES.filter((nodeType) => !usedNodeTypes.includes(nodeType));
41
47
  };
42
48
  /**
43
49
  * Converts a NodeType key to its corresponding env-var name.
44
50
  *
45
51
  * @example
46
- * nodeTypeToEnvVar('enumeration') // 'INTLAYER_NODE_TYPE_ENUMERATION'
47
- */
48
- const nodeTypeToEnvVar = (nodeType) => `INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`;
49
- /**
50
- * Returns a record mapping each **unused** NodeType to `'false'` so build
51
- * plugins can dead-code-eliminate the corresponding plugin from the bundle.
52
- *
53
- * Keys are bare env-var names (`INTLAYER_NODE_TYPE_*`).
54
- * Build plugins that need `process.env.*` keys (Vite `define`, webpack
55
- * `DefinePlugin`, Lynx `source.define`) should prefix them and wrap values
56
- * with `JSON.stringify`; Next.js `env:` can use the record directly.
57
- *
58
- * Only NodeTypes that are confirmed absent from all dictionaries get the
59
- * `'false'` value; used (or unknown) types are omitted so they default to
60
- * `true` inside `getPlugins` / `getBasePlugins`.
61
- *
62
- * @param usedNodeTypes - Set returned by `getUsedNodeTypes`.
63
- * @returns Record keyed by `INTLAYER_NODE_TYPE_*` → `'false'`.
64
- *
65
- * @example
66
- * // When only 'translation' is used:
67
- * getNodeTypeDefineVars(new Set(['translation']))
68
- * // {
69
- * // INTLAYER_NODE_TYPE_ENUMERATION: 'false',
70
- * // INTLAYER_NODE_TYPE_CONDITION: 'false',
71
- * // ...
72
- * // }
52
+ * formatNodeTypeToEnvVar(['enumeration']) // { 'INTLAYER_NODE_TYPE_ENUMERATION': 'false' }
53
+ * formatNodeTypeToEnvVar(['enumeration'], true) // { 'process.env.INTLAYER_NODE_TYPE_ENUMERATION': 'false' }
73
54
  */
74
- const getNodeTypeDefineVars = (usedNodeTypes) => {
75
- if (usedNodeTypes.size === 0) return {};
76
- const result = {};
77
- for (const nodeType of PLUGIN_NODE_TYPES) if (!usedNodeTypes.has(nodeType)) result[nodeTypeToEnvVar(nodeType)] = "false";
78
- return result;
79
- };
55
+ const formatNodeTypeToEnvVar = (nodeTypes, addProcessEnv = false) => nodeTypes.reduce((acc, nodeType) => {
56
+ acc[addProcessEnv ? `process.env.INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}` : `INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`] = "\"false\"";
57
+ return acc;
58
+ }, {});
80
59
 
81
60
  //#endregion
82
- export { PLUGIN_NODE_TYPES, getNodeTypeDefineVars, getUsedNodeTypes, nodeTypeToEnvVar };
61
+ export { formatNodeTypeToEnvVar, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync };
83
62
  //# sourceMappingURL=getUsedNodeTypes.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUsedNodeTypes.mjs","names":[],"sources":["../../../src/utils/getUsedNodeTypes.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\n\n/**\n * NodeType strings that correspond to plugins that can be conditionally\n * removed from the bundle when unused.\n */\nexport const PLUGIN_NODE_TYPES = [\n 'translation',\n 'enumeration',\n 'condition',\n 'insertion',\n 'gender',\n 'nested',\n 'file',\n 'markdown',\n 'html',\n] as const;\n\nexport type PluginNodeType = (typeof PLUGIN_NODE_TYPES)[number];\n\n/** Recursively collect every `nodeType` string found in a value. */\nconst collectNodeTypes = (value: unknown, result: Set<string>): void => {\n if (!value || typeof value !== 'object') return;\n\n if (Array.isArray(value)) {\n for (const item of value) collectNodeTypes(item, result);\n return;\n }\n\n const obj = value as Record<string, unknown>;\n\n if (typeof obj.nodeType === 'string') {\n result.add(obj.nodeType);\n }\n\n for (const key of Object.keys(obj)) {\n collectNodeTypes(obj[key], result);\n }\n};\n\n/**\n * Returns the set of NodeType strings actually used across the given\n * built dictionaries.\n *\n * @example\n * const used = getUsedNodeTypes(getDictionaries(config));\n * // Set { 'translation', 'enumeration' }\n */\nexport const getUsedNodeTypes = (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): Set<string> => {\n const result = new Set<string>();\n const dicts = Array.isArray(dictionaries)\n ? dictionaries\n : Object.values(dictionaries);\n\n for (const dict of dicts) {\n collectNodeTypes(dict.content, result);\n }\n\n return result;\n};\n\n/**\n * Converts a NodeType key to its corresponding env-var name.\n *\n * @example\n * nodeTypeToEnvVar('enumeration') // 'INTLAYER_NODE_TYPE_ENUMERATION'\n */\nexport const nodeTypeToEnvVar = (nodeType: string): string =>\n `INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`;\n\n/**\n * Returns a record mapping each **unused** NodeType to `'false'` so build\n * plugins can dead-code-eliminate the corresponding plugin from the bundle.\n *\n * Keys are bare env-var names (`INTLAYER_NODE_TYPE_*`).\n * Build plugins that need `process.env.*` keys (Vite `define`, webpack\n * `DefinePlugin`, Lynx `source.define`) should prefix them and wrap values\n * with `JSON.stringify`; Next.js `env:` can use the record directly.\n *\n * Only NodeTypes that are confirmed absent from all dictionaries get the\n * `'false'` value; used (or unknown) types are omitted so they default to\n * `true` inside `getPlugins` / `getBasePlugins`.\n *\n * @param usedNodeTypes - Set returned by `getUsedNodeTypes`.\n * @returns Record keyed by `INTLAYER_NODE_TYPE_*` → `'false'`.\n *\n * @example\n * // When only 'translation' is used:\n * getNodeTypeDefineVars(new Set(['translation']))\n * // {\n * // INTLAYER_NODE_TYPE_ENUMERATION: 'false',\n * // INTLAYER_NODE_TYPE_CONDITION: 'false',\n * // ...\n * // }\n */\nexport const getNodeTypeDefineVars = (\n usedNodeTypes: Set<string>\n): Record<string, string> => {\n // No dictionaries found yet → safe default: keep all plugins\n if (usedNodeTypes.size === 0) return {};\n\n const result: Record<string, string> = {};\n\n for (const nodeType of PLUGIN_NODE_TYPES) {\n if (!usedNodeTypes.has(nodeType)) {\n result[nodeTypeToEnvVar(nodeType)] = 'false';\n }\n }\n\n return result;\n};\n"],"mappings":";;;;;AAMA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAKD,MAAM,oBAAoB,OAAgB,WAA8B;AACtE,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AAEzC,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,OAAK,MAAM,QAAQ,MAAO,kBAAiB,MAAM,OAAO;AACxD;;CAGF,MAAM,MAAM;AAEZ,KAAI,OAAO,IAAI,aAAa,SAC1B,QAAO,IAAI,IAAI,SAAS;AAG1B,MAAK,MAAM,OAAO,OAAO,KAAK,IAAI,CAChC,kBAAiB,IAAI,MAAM,OAAO;;;;;;;;;;AAYtC,MAAa,oBACX,iBACgB;CAChB,MAAM,yBAAS,IAAI,KAAa;CAChC,MAAM,QAAQ,MAAM,QAAQ,aAAa,GACrC,eACA,OAAO,OAAO,aAAa;AAE/B,MAAK,MAAM,QAAQ,MACjB,kBAAiB,KAAK,SAAS,OAAO;AAGxC,QAAO;;;;;;;;AAST,MAAa,oBAAoB,aAC/B,sBAAsB,SAAS,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;AA2B9C,MAAa,yBACX,kBAC2B;AAE3B,KAAI,cAAc,SAAS,EAAG,QAAO,EAAE;CAEvC,MAAM,SAAiC,EAAE;AAEzC,MAAK,MAAM,YAAY,kBACrB,KAAI,CAAC,cAAc,IAAI,SAAS,CAC9B,QAAO,iBAAiB,SAAS,IAAI;AAIzC,QAAO"}
1
+ {"version":3,"file":"getUsedNodeTypes.mjs","names":[],"sources":["../../../src/utils/getUsedNodeTypes.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\nimport { PLUGIN_NODE_TYPES } from '@intlayer/types/nodeType';\nimport { parallelize } from './parallelize';\n\nexport type PluginNodeType = (typeof PLUGIN_NODE_TYPES)[number];\n\n/** Recursively collect every `nodeType` string found in a value. */\nconst collectNodeTypes = (value: unknown, result: Set<string>): void => {\n if (!value || typeof value !== 'object') return;\n\n if (Array.isArray(value)) {\n for (const item of value) collectNodeTypes(item, result);\n return;\n }\n\n const obj = value as Record<string, unknown>;\n\n if (typeof obj.nodeType === 'string') {\n result.add(obj.nodeType);\n }\n\n for (const key of Object.keys(obj)) {\n collectNodeTypes(obj[key], result);\n }\n};\n\n/**\n * Returns the set of NodeType strings actually used across the given\n * built dictionaries.\n *\n * @example\n * const used = getUsedNodeTypes(getDictionaries(config));\n * // Set { 'translation', 'enumeration' }\n */\nexport const getUsedNodeTypes = (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): PluginNodeType[] => {\n const result = new Set<PluginNodeType>();\n const dicts = Array.isArray(dictionaries)\n ? dictionaries\n : Object.values(dictionaries);\n\n for (const dict of dicts) {\n collectNodeTypes(dict.content, result);\n }\n\n return [...result];\n};\n\nexport const getUnusedNodeTypes = (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): PluginNodeType[] => {\n const usedNodeTypes = getUsedNodeTypes(dictionaries);\n\n return PLUGIN_NODE_TYPES.filter(\n (nodeType) => !usedNodeTypes.includes(nodeType)\n );\n};\n\nexport const getUsedNodeTypesAsync = async (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): Promise<PluginNodeType[]> => {\n const dicts = Array.isArray(dictionaries)\n ? dictionaries\n : Object.values(dictionaries);\n\n const results = await parallelize(dicts, async (dictionary) => {\n const result = new Set<PluginNodeType>();\n\n collectNodeTypes(dictionary.content, result as Set<string>);\n\n return result;\n });\n\n const finalResult = new Set<PluginNodeType>();\n\n for (const res of results) {\n for (const val of res) {\n finalResult.add(val);\n }\n }\n\n return [...finalResult];\n};\n\nexport const getUnusedNodeTypesAsync = async (\n dictionaries: Record<string, Dictionary> | Dictionary[]\n): Promise<PluginNodeType[]> => {\n const usedNodeTypes = await getUsedNodeTypesAsync(dictionaries);\n\n return PLUGIN_NODE_TYPES.filter(\n (nodeType) => !usedNodeTypes.includes(nodeType)\n );\n};\n\n/**\n * Converts a NodeType key to its corresponding env-var name.\n *\n * @example\n * formatNodeTypeToEnvVar(['enumeration']) // { 'INTLAYER_NODE_TYPE_ENUMERATION': 'false' }\n * formatNodeTypeToEnvVar(['enumeration'], true) // { 'process.env.INTLAYER_NODE_TYPE_ENUMERATION': 'false' }\n */\nexport const formatNodeTypeToEnvVar = (\n nodeTypes: string[],\n addProcessEnv: boolean = false\n): Record<string, string> =>\n nodeTypes.reduce(\n (acc, nodeType) => {\n acc[\n addProcessEnv\n ? `process.env.INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`\n : `INTLAYER_NODE_TYPE_${nodeType.toUpperCase()}`\n ] = '\"false\"';\n return acc;\n },\n {} as Record<string, string>\n );\n"],"mappings":";;;;;AAOA,MAAM,oBAAoB,OAAgB,WAA8B;AACtE,KAAI,CAAC,SAAS,OAAO,UAAU,SAAU;AAEzC,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,OAAK,MAAM,QAAQ,MAAO,kBAAiB,MAAM,OAAO;AACxD;;CAGF,MAAM,MAAM;AAEZ,KAAI,OAAO,IAAI,aAAa,SAC1B,QAAO,IAAI,IAAI,SAAS;AAG1B,MAAK,MAAM,OAAO,OAAO,KAAK,IAAI,CAChC,kBAAiB,IAAI,MAAM,OAAO;;;;;;;;;;AAYtC,MAAa,oBACX,iBACqB;CACrB,MAAM,yBAAS,IAAI,KAAqB;CACxC,MAAM,QAAQ,MAAM,QAAQ,aAAa,GACrC,eACA,OAAO,OAAO,aAAa;AAE/B,MAAK,MAAM,QAAQ,MACjB,kBAAiB,KAAK,SAAS,OAAO;AAGxC,QAAO,CAAC,GAAG,OAAO;;AAGpB,MAAa,sBACX,iBACqB;CACrB,MAAM,gBAAgB,iBAAiB,aAAa;AAEpD,QAAO,kBAAkB,QACtB,aAAa,CAAC,cAAc,SAAS,SAAS,CAChD;;AAGH,MAAa,wBAAwB,OACnC,iBAC8B;CAK9B,MAAM,UAAU,MAAM,YAJR,MAAM,QAAQ,aAAa,GACrC,eACA,OAAO,OAAO,aAAa,EAEU,OAAO,eAAe;EAC7D,MAAM,yBAAS,IAAI,KAAqB;AAExC,mBAAiB,WAAW,SAAS,OAAsB;AAE3D,SAAO;GACP;CAEF,MAAM,8BAAc,IAAI,KAAqB;AAE7C,MAAK,MAAM,OAAO,QAChB,MAAK,MAAM,OAAO,IAChB,aAAY,IAAI,IAAI;AAIxB,QAAO,CAAC,GAAG,YAAY;;AAGzB,MAAa,0BAA0B,OACrC,iBAC8B;CAC9B,MAAM,gBAAgB,MAAM,sBAAsB,aAAa;AAE/D,QAAO,kBAAkB,QACtB,aAAa,CAAC,cAAc,SAAS,SAAS,CAChD;;;;;;;;;AAUH,MAAa,0BACX,WACA,gBAAyB,UAEzB,UAAU,QACP,KAAK,aAAa;AACjB,KACE,gBACI,kCAAkC,SAAS,aAAa,KACxD,sBAAsB,SAAS,aAAa,MAC9C;AACJ,QAAO;GAET,EAAE,CACH"}
@@ -9,7 +9,7 @@ import { getChunk } from "./getChunk.mjs";
9
9
  import { assembleJSON, chunkJSON, reconstructFromSingleChunk } from "./chunkJSON.mjs";
10
10
  import { getContentExtension } from "./getContentExtension.mjs";
11
11
  import { getExtensionFromFormat, getFormatFromExtension } from "./getFormatFromExtension.mjs";
12
- import { PLUGIN_NODE_TYPES, getNodeTypeDefineVars, getUsedNodeTypes, nodeTypeToEnvVar } from "./getUsedNodeTypes.mjs";
12
+ import { formatNodeTypeToEnvVar, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync } from "./getUsedNodeTypes.mjs";
13
13
  import { mergeChunks } from "./mergeChunks.mjs";
14
14
  import { getGlobalLimiter, getTaskLimiter, parallelizeGlobal } from "./parallelizeGlobal.mjs";
15
15
  import { reduceObjectFormat } from "./reduceObjectFormat.mjs";
@@ -20,4 +20,4 @@ import { runParallel } from "./runParallel/index.mjs";
20
20
  import { sortAlphabetically } from "./sortAlphabetically.mjs";
21
21
  import { verifyIdenticObjectFormat } from "./verifyIdenticObjectFormat.mjs";
22
22
 
23
- export { PLUGIN_NODE_TYPES, Queue, assembleJSON, autoDecorateContent, buildComponentFilesList, chunkJSON, formatLocale, formatPath, getChunk, getContentExtension, getExtensionFromFormat, getFormatFromExtension, getGlobalLimiter, getNodeTypeDefineVars, getPathHash, getTaskLimiter, getUsedNodeTypes, mergeChunks, nodeTypeToEnvVar, pLimit, parallelize, parallelizeGlobal, reconstructFromSingleChunk, reduceObjectFormat, resolveObjectPromises, resolveRelativePath, runOnce, runParallel, sortAlphabetically, splitTextByLines, verifyIdenticObjectFormat };
23
+ export { Queue, assembleJSON, autoDecorateContent, buildComponentFilesList, chunkJSON, formatLocale, formatNodeTypeToEnvVar, formatPath, getChunk, getContentExtension, getExtensionFromFormat, getFormatFromExtension, getGlobalLimiter, getPathHash, getTaskLimiter, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, mergeChunks, pLimit, parallelize, parallelizeGlobal, reconstructFromSingleChunk, reduceObjectFormat, resolveObjectPromises, resolveRelativePath, runOnce, runParallel, sortAlphabetically, splitTextByLines, verifyIdenticObjectFormat };
@@ -1,8 +1,9 @@
1
1
  import { LocalesValues } from "@intlayer/types/module_augmentation";
2
+ import { ANSIColorsType } from "@intlayer/config/logger";
2
3
 
3
4
  //#region src/utils/formatter.d.ts
4
- declare const formatPath: (path: string | string[], color?: ANSIColors | false) => string;
5
- declare const formatLocale: (locale: LocalesValues | LocalesValues[], color?: ANSIColors | false) => string;
5
+ declare const formatPath: (path: string | string[], color?: ANSIColorsType | false) => string;
6
+ declare const formatLocale: (locale: LocalesValues | LocalesValues[], color?: ANSIColorsType | false) => string;
6
7
  //#endregion
7
8
  export { formatLocale, formatPath };
8
9
  //# sourceMappingURL=formatter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatter.d.ts","names":[],"sources":["../../../src/utils/formatter.ts"],"mappings":";;;cAQa,UAAA,GACX,IAAA,qBACA,KAAA,GAAQ,UAAA;AAAA,cAYG,YAAA,GACX,MAAA,EAAQ,aAAA,GAAgB,aAAA,IACxB,KAAA,GAAO,UAAA"}
1
+ {"version":3,"file":"formatter.d.ts","names":[],"sources":["../../../src/utils/formatter.ts"],"mappings":";;;;cAYa,UAAA,GACX,IAAA,qBACA,KAAA,GAAQ,cAAA;AAAA,cAYG,YAAA,GACX,MAAA,EAAQ,aAAA,GAAgB,aAAA,IACxB,KAAA,GAAO,cAAA"}
@@ -1,11 +1,7 @@
1
1
  import { Dictionary } from "@intlayer/types/dictionary";
2
+ import { PLUGIN_NODE_TYPES } from "@intlayer/types/nodeType";
2
3
 
3
4
  //#region src/utils/getUsedNodeTypes.d.ts
4
- /**
5
- * NodeType strings that correspond to plugins that can be conditionally
6
- * removed from the bundle when unused.
7
- */
8
- declare const PLUGIN_NODE_TYPES: readonly ["translation", "enumeration", "condition", "insertion", "gender", "nested", "file", "markdown", "html"];
9
5
  type PluginNodeType = (typeof PLUGIN_NODE_TYPES)[number];
10
6
  /**
11
7
  * Returns the set of NodeType strings actually used across the given
@@ -15,40 +11,18 @@ type PluginNodeType = (typeof PLUGIN_NODE_TYPES)[number];
15
11
  * const used = getUsedNodeTypes(getDictionaries(config));
16
12
  * // Set { 'translation', 'enumeration' }
17
13
  */
18
- declare const getUsedNodeTypes: (dictionaries: Record<string, Dictionary> | Dictionary[]) => Set<string>;
14
+ declare const getUsedNodeTypes: (dictionaries: Record<string, Dictionary> | Dictionary[]) => PluginNodeType[];
15
+ declare const getUnusedNodeTypes: (dictionaries: Record<string, Dictionary> | Dictionary[]) => PluginNodeType[];
16
+ declare const getUsedNodeTypesAsync: (dictionaries: Record<string, Dictionary> | Dictionary[]) => Promise<PluginNodeType[]>;
17
+ declare const getUnusedNodeTypesAsync: (dictionaries: Record<string, Dictionary> | Dictionary[]) => Promise<PluginNodeType[]>;
19
18
  /**
20
19
  * Converts a NodeType key to its corresponding env-var name.
21
20
  *
22
21
  * @example
23
- * nodeTypeToEnvVar('enumeration') // 'INTLAYER_NODE_TYPE_ENUMERATION'
24
- */
25
- declare const nodeTypeToEnvVar: (nodeType: string) => string;
26
- /**
27
- * Returns a record mapping each **unused** NodeType to `'false'` so build
28
- * plugins can dead-code-eliminate the corresponding plugin from the bundle.
29
- *
30
- * Keys are bare env-var names (`INTLAYER_NODE_TYPE_*`).
31
- * Build plugins that need `process.env.*` keys (Vite `define`, webpack
32
- * `DefinePlugin`, Lynx `source.define`) should prefix them and wrap values
33
- * with `JSON.stringify`; Next.js `env:` can use the record directly.
34
- *
35
- * Only NodeTypes that are confirmed absent from all dictionaries get the
36
- * `'false'` value; used (or unknown) types are omitted so they default to
37
- * `true` inside `getPlugins` / `getBasePlugins`.
38
- *
39
- * @param usedNodeTypes - Set returned by `getUsedNodeTypes`.
40
- * @returns Record keyed by `INTLAYER_NODE_TYPE_*` → `'false'`.
41
- *
42
- * @example
43
- * // When only 'translation' is used:
44
- * getNodeTypeDefineVars(new Set(['translation']))
45
- * // {
46
- * // INTLAYER_NODE_TYPE_ENUMERATION: 'false',
47
- * // INTLAYER_NODE_TYPE_CONDITION: 'false',
48
- * // ...
49
- * // }
22
+ * formatNodeTypeToEnvVar(['enumeration']) // { 'INTLAYER_NODE_TYPE_ENUMERATION': 'false' }
23
+ * formatNodeTypeToEnvVar(['enumeration'], true) // { 'process.env.INTLAYER_NODE_TYPE_ENUMERATION': 'false' }
50
24
  */
51
- declare const getNodeTypeDefineVars: (usedNodeTypes: Set<string>) => Record<string, string>;
25
+ declare const formatNodeTypeToEnvVar: (nodeTypes: string[], addProcessEnv?: boolean) => Record<string, string>;
52
26
  //#endregion
53
- export { PLUGIN_NODE_TYPES, PluginNodeType, getNodeTypeDefineVars, getUsedNodeTypes, nodeTypeToEnvVar };
27
+ export { PluginNodeType, formatNodeTypeToEnvVar, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync };
54
28
  //# sourceMappingURL=getUsedNodeTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUsedNodeTypes.d.ts","names":[],"sources":["../../../src/utils/getUsedNodeTypes.ts"],"mappings":";;;;;AAMA;;cAAa,iBAAA;AAAA,KAYD,cAAA,WAAyB,iBAAA;;AAArC;;;;;AA8BA;;cAAa,gBAAA,GACX,YAAA,EAAc,MAAA,SAAe,UAAA,IAAc,UAAA,OAC1C,GAAA;;;;;;;cAmBU,gBAAA,GAAoB,QAAA;;;;;;;AAAjC;;;;;AA4BA;;;;;;;;;;;;;;cAAa,qBAAA,GACX,aAAA,EAAe,GAAA,aACd,MAAA"}
1
+ {"version":3,"file":"getUsedNodeTypes.d.ts","names":[],"sources":["../../../src/utils/getUsedNodeTypes.ts"],"mappings":";;;;KAIY,cAAA,WAAyB,iBAAA;;AAArC;;;;;AA8BA;;cAAa,gBAAA,GACX,YAAA,EAAc,MAAA,SAAe,UAAA,IAAc,UAAA,OAC1C,cAAA;AAAA,cAaU,kBAAA,GACX,YAAA,EAAc,MAAA,SAAe,UAAA,IAAc,UAAA,OAC1C,cAAA;AAAA,cAQU,qBAAA,GACX,YAAA,EAAc,MAAA,SAAe,UAAA,IAAc,UAAA,OAC1C,OAAA,CAAQ,cAAA;AAAA,cAwBE,uBAAA,GACX,YAAA,EAAc,MAAA,SAAe,UAAA,IAAc,UAAA,OAC1C,OAAA,CAAQ,cAAA;;;;;;;;cAeE,sBAAA,GACX,SAAA,YACA,aAAA,eACC,MAAA"}
@@ -6,7 +6,7 @@ import { formatLocale, formatPath } from "./formatter.js";
6
6
  import { getChunk } from "./getChunk.js";
7
7
  import { getContentExtension } from "./getContentExtension.js";
8
8
  import { getPathHash } from "./getPathHash.js";
9
- import { PLUGIN_NODE_TYPES, PluginNodeType, getNodeTypeDefineVars, getUsedNodeTypes, nodeTypeToEnvVar } from "./getUsedNodeTypes.js";
9
+ import { PluginNodeType, formatNodeTypeToEnvVar, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync } from "./getUsedNodeTypes.js";
10
10
  import { mergeChunks } from "./mergeChunks.js";
11
11
  import { parallelize } from "./parallelize.js";
12
12
  import { Queue, pLimit } from "./pLimit.js";
@@ -19,4 +19,4 @@ import { ParallelHandle, runParallel } from "./runParallel/index.js";
19
19
  import { sortAlphabetically } from "./sortAlphabetically.js";
20
20
  import { splitTextByLines } from "./splitTextByLine.js";
21
21
  import { verifyIdenticObjectFormat } from "./verifyIdenticObjectFormat.js";
22
- export { Extension, Format, JSONObject, JsonChunk, PLUGIN_NODE_TYPES, ParallelHandle, PluginNodeType, Queue, assembleJSON, autoDecorateContent, buildComponentFilesList, chunkJSON, formatLocale, formatPath, getChunk, getContentExtension, getExtensionFromFormat, getFormatFromExtension, getGlobalLimiter, getNodeTypeDefineVars, getPathHash, getTaskLimiter, getUsedNodeTypes, mergeChunks, nodeTypeToEnvVar, pLimit, parallelize, parallelizeGlobal, reconstructFromSingleChunk, reduceObjectFormat, resolveObjectPromises, resolveRelativePath, runOnce, runParallel, sortAlphabetically, splitTextByLines, verifyIdenticObjectFormat };
22
+ export { Extension, Format, JSONObject, JsonChunk, ParallelHandle, PluginNodeType, Queue, assembleJSON, autoDecorateContent, buildComponentFilesList, chunkJSON, formatLocale, formatNodeTypeToEnvVar, formatPath, getChunk, getContentExtension, getExtensionFromFormat, getFormatFromExtension, getGlobalLimiter, getPathHash, getTaskLimiter, getUnusedNodeTypes, getUnusedNodeTypesAsync, getUsedNodeTypes, getUsedNodeTypesAsync, mergeChunks, pLimit, parallelize, parallelizeGlobal, reconstructFromSingleChunk, reduceObjectFormat, resolveObjectPromises, resolveRelativePath, runOnce, runParallel, sortAlphabetically, splitTextByLines, verifyIdenticObjectFormat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/chokidar",
3
- "version": "8.6.0",
3
+ "version": "8.6.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": [
@@ -109,19 +109,18 @@
109
109
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
110
110
  },
111
111
  "dependencies": {
112
- "@babel/parser": "7.29.0",
113
- "@intlayer/api": "8.6.0",
114
- "@intlayer/config": "8.6.0",
115
- "@intlayer/core": "8.6.0",
116
- "@intlayer/dictionaries-entry": "8.6.0",
117
- "@intlayer/remote-dictionaries-entry": "8.6.0",
118
- "@intlayer/types": "8.6.0",
119
- "@intlayer/unmerged-dictionaries-entry": "8.6.0",
112
+ "@intlayer/api": "8.6.1",
113
+ "@intlayer/config": "8.6.1",
114
+ "@intlayer/core": "8.6.1",
115
+ "@intlayer/dictionaries-entry": "8.6.1",
116
+ "@intlayer/remote-dictionaries-entry": "8.6.1",
117
+ "@intlayer/types": "8.6.1",
118
+ "@intlayer/unmerged-dictionaries-entry": "8.6.1",
120
119
  "chokidar": "3.6.0",
121
120
  "defu": "6.1.4",
122
121
  "fast-glob": "3.3.3",
123
122
  "recast": "^0.23.11",
124
- "simple-git": "3.32.3",
123
+ "simple-git": "3.33.0",
125
124
  "zod-to-ts": "2.0.0"
126
125
  },
127
126
  "devDependencies": {