@intlayer/chokidar 8.1.11 → 8.2.0

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.
Files changed (104) hide show
  1. package/dist/assets/installSkills/skills/astro.md +1 -1
  2. package/dist/assets/installSkills/skills/cli.md +2 -2
  3. package/dist/cjs/cli.cjs +1 -1
  4. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +1 -1
  5. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  6. package/dist/cjs/createType/createModuleAugmentation.cjs +3 -3
  7. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  8. package/dist/cjs/init/utils/configManipulation.cjs +1 -1
  9. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
  10. package/dist/cjs/installMCP/installMCP.cjs +2 -0
  11. package/dist/cjs/installMCP/installMCP.cjs.map +1 -0
  12. package/dist/cjs/installSkills/index.cjs +1 -1
  13. package/dist/cjs/installSkills/index.cjs.map +1 -1
  14. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +1 -1
  15. package/dist/cjs/loadDictionaries/log.cjs +1 -1
  16. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  17. package/dist/cjs/prepareIntlayer.cjs +1 -1
  18. package/dist/cjs/utils/getPathHash.cjs +2 -0
  19. package/dist/cjs/utils/getPathHash.cjs.map +1 -0
  20. package/dist/cjs/utils/index.cjs +1 -1
  21. package/dist/cjs/watcher.cjs +1 -1
  22. package/dist/cjs/watcher.cjs.map +1 -1
  23. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1 -2
  24. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  25. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +1 -1
  26. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
  27. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -1
  28. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  29. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +1 -1
  30. package/dist/esm/cli.mjs +1 -1
  31. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +1 -1
  32. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
  33. package/dist/esm/createType/createModuleAugmentation.mjs +9 -9
  34. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
  35. package/dist/esm/init/utils/configManipulation.mjs +1 -1
  36. package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
  37. package/dist/esm/installMCP/installMCP.mjs +2 -0
  38. package/dist/esm/installMCP/installMCP.mjs.map +1 -0
  39. package/dist/esm/installSkills/index.mjs +1 -1
  40. package/dist/esm/installSkills/index.mjs.map +1 -1
  41. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +1 -1
  42. package/dist/esm/loadDictionaries/log.mjs +2 -2
  43. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  44. package/dist/esm/prepareIntlayer.mjs +1 -1
  45. package/dist/esm/utils/getPathHash.mjs +2 -0
  46. package/dist/esm/utils/getPathHash.mjs.map +1 -0
  47. package/dist/esm/utils/index.mjs +1 -1
  48. package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -1
  49. package/dist/esm/utils/runParallel/ps.mjs.map +1 -1
  50. package/dist/esm/utils/runParallel/wmic.mjs.map +1 -1
  51. package/dist/esm/watcher.mjs +1 -1
  52. package/dist/esm/watcher.mjs.map +1 -1
  53. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +1 -2
  54. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
  55. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs +1 -1
  56. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -1
  57. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +1 -1
  58. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  59. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +1 -1
  60. package/dist/types/build.d.ts +0 -5
  61. package/dist/types/cli.d.ts +8 -5
  62. package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -1
  63. package/dist/types/fetchDistantDictionaries.d.ts +0 -1
  64. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  65. package/dist/types/init/utils/configManipulation.d.ts +0 -12
  66. package/dist/types/init/utils/configManipulation.d.ts.map +1 -1
  67. package/dist/types/installMCP/installMCP.d.ts +11 -0
  68. package/dist/types/installMCP/installMCP.d.ts.map +1 -0
  69. package/dist/types/installSkills/index.d.ts +23 -49
  70. package/dist/types/installSkills/index.d.ts.map +1 -1
  71. package/dist/types/loadDictionaries/log.d.ts.map +1 -1
  72. package/dist/types/utils/getPathHash.d.ts +5 -0
  73. package/dist/types/utils/getPathHash.d.ts.map +1 -0
  74. package/dist/types/utils/index.d.ts +2 -2
  75. package/dist/types/watcher.d.ts.map +1 -1
  76. package/dist/types/writeContentDeclaration/transformJSFile.d.ts +1 -26
  77. package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -1
  78. package/dist/types/writeContentDeclaration/transformJSONFile.d.ts.map +1 -1
  79. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  80. package/package.json +3 -17
  81. package/dist/cjs/index.cjs +0 -1
  82. package/dist/cjs/transformFiles/extractDictionaryKey.cjs +0 -2
  83. package/dist/cjs/transformFiles/extractDictionaryKey.cjs.map +0 -1
  84. package/dist/cjs/transformFiles/index.cjs +0 -1
  85. package/dist/cjs/transformFiles/transformFiles.cjs +0 -2
  86. package/dist/cjs/transformFiles/transformFiles.cjs.map +0 -1
  87. package/dist/cjs/utils/getFileHash.cjs +0 -2
  88. package/dist/cjs/utils/getFileHash.cjs.map +0 -1
  89. package/dist/esm/index.mjs +0 -1
  90. package/dist/esm/transformFiles/extractDictionaryKey.mjs +0 -2
  91. package/dist/esm/transformFiles/extractDictionaryKey.mjs.map +0 -1
  92. package/dist/esm/transformFiles/index.mjs +0 -1
  93. package/dist/esm/transformFiles/transformFiles.mjs +0 -2
  94. package/dist/esm/transformFiles/transformFiles.mjs.map +0 -1
  95. package/dist/esm/utils/getFileHash.mjs +0 -2
  96. package/dist/esm/utils/getFileHash.mjs.map +0 -1
  97. package/dist/types/index.d.ts +0 -57
  98. package/dist/types/transformFiles/extractDictionaryKey.d.ts +0 -5
  99. package/dist/types/transformFiles/extractDictionaryKey.d.ts.map +0 -1
  100. package/dist/types/transformFiles/index.d.ts +0 -3
  101. package/dist/types/transformFiles/transformFiles.d.ts +0 -24
  102. package/dist/types/transformFiles/transformFiles.d.ts.map +0 -1
  103. package/dist/types/utils/getFileHash.d.ts +0 -5
  104. package/dist/types/utils/getFileHash.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformFiles.mjs","names":[],"sources":["../../../src/transformFiles/transformFiles.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport fs from 'node:fs/promises';\nimport { basename, dirname, extname, join, relative, resolve } from 'node:path';\nimport {\n ANSIColors,\n colorizePath,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { camelCaseToKebabCase } from '@intlayer/config/utils';\nimport { generateKey } from '@intlayer/core/utils';\nimport type { Dictionary, IntlayerConfig } from '@intlayer/types';\nimport { Node, Project, type SourceFile, SyntaxKind } from 'ts-morph';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport { writeContentDeclaration } from '../writeContentDeclaration';\nimport { extractDictionaryKey } from './extractDictionaryKey';\n\n// ==========================================\n// Shared Utilities (exported for reuse in babel plugin)\n// ==========================================\n\n/**\n * Attributes that should be extracted for localization\n */\nexport const ATTRIBUTES_TO_EXTRACT = [\n 'title',\n 'placeholder',\n 'alt',\n 'aria-label',\n 'label',\n];\n\n/**\n * Default function to determine if a string should be extracted for localization\n */\nexport const shouldExtract = (text: string): boolean => {\n const trimmed = text.trim();\n if (!trimmed) return false;\n if (!trimmed.includes(' ')) return false;\n // Starts with Capital letter\n if (!/^[A-Z]/.test(trimmed)) return false;\n // Filter out template logic identifiers (simple check)\n if (trimmed.startsWith('{') || trimmed.startsWith('v-')) return false;\n return true;\n};\n\n/**\n * Translation node structure used in multilingual dictionaries\n */\ntype TranslationNode = {\n nodeType: 'translation';\n translation: Record<string, string>;\n};\n\nconst writeContentHelper = async (\n extractedContent: Record<string, string>,\n componentKey: string,\n filePath: string,\n configuration: IntlayerConfig,\n outputDir?: string\n) => {\n const { defaultLocale } = configuration.internationalization;\n const { baseDir, fileExtensions } = configuration.content;\n\n const isPerLocaleFile = configuration?.dictionary?.locale;\n\n const dirName = outputDir ? resolve(outputDir) : dirname(filePath);\n const ext = extname(filePath);\n const baseName = basename(filePath, ext);\n const contentBaseName = baseName.charAt(0).toLowerCase() + baseName.slice(1);\n\n const contentFilePath = join(\n dirName,\n `${contentBaseName}.${fileExtensions[0]}`\n );\n const relativeContentFilePath = relative(baseDir, contentFilePath);\n\n let dictionary: Dictionary;\n\n if (isPerLocaleFile) {\n // Per-locale format: simple string content with locale property\n dictionary = {\n key: componentKey,\n content: extractedContent,\n locale: defaultLocale,\n filePath: relativeContentFilePath,\n };\n } else {\n // Multilingual format: content wrapped in translation nodes, no locale property\n const multilingualContent: Record<string, TranslationNode> = {};\n for (const [key, value] of Object.entries(extractedContent)) {\n multilingualContent[key] = {\n nodeType: 'translation',\n translation: {\n [defaultLocale]: value,\n },\n };\n }\n\n dictionary = {\n key: componentKey,\n content: multilingualContent,\n filePath: relativeContentFilePath,\n };\n }\n\n const relativeDir = relative(baseDir, dirName);\n await writeContentDeclaration(dictionary, configuration, {\n newDictionariesPath: relativeDir,\n });\n\n return contentFilePath;\n};\n\ntype TsReplacement = {\n node: Node;\n key: string;\n type: 'jsx-text' | 'jsx-attribute' | 'string-literal';\n};\n\nconst extractTsContent = (\n sourceFile: SourceFile,\n existingKeys: Set<string>\n): {\n extractedContent: Record<string, string>;\n replacements: TsReplacement[];\n} => {\n const extractedContent: Record<string, string> = {};\n const replacements: TsReplacement[] = [];\n\n sourceFile.forEachDescendant((node) => {\n // 1. JSX Text\n if (Node.isJsxText(node)) {\n const text = node.getText();\n if (shouldExtract(text)) {\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n extractedContent[key] = text.replace(/\\s+/g, ' ').trim();\n replacements.push({ node, key, type: 'jsx-text' });\n }\n }\n\n // 2. JSX Attributes\n else if (Node.isJsxAttribute(node)) {\n const name = node.getNameNode().getText();\n if (ATTRIBUTES_TO_EXTRACT.includes(name)) {\n const initializer = node.getInitializer();\n if (Node.isStringLiteral(initializer)) {\n const text = initializer.getLiteralValue();\n if (shouldExtract(text)) {\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n extractedContent[key] = text.trim();\n replacements.push({ node, key, type: 'jsx-attribute' });\n }\n }\n }\n }\n\n // 3. String Literals (Variables, Arrays, etc.)\n else if (Node.isStringLiteral(node)) {\n const text = node.getLiteralValue();\n if (shouldExtract(text)) {\n const parent = node.getParent();\n\n // Skip if inside ImportDeclaration\n if (\n parent?.getKindName() === 'ImportDeclaration' ||\n parent?.getKindName() === 'ImportSpecifier' ||\n parent?.getKindName() === 'ModuleSpecifier'\n ) {\n return;\n }\n\n // Skip if it's a JSX Attribute value (handled above)\n if (Node.isJsxAttribute(parent)) return;\n\n // Skip console.log\n if (Node.isCallExpression(parent)) {\n const expression = parent.getExpression();\n if (expression.getText().includes('console.log')) return;\n }\n\n // Skip Object Keys: { key: \"value\" } -> \"key\" is PropertyAssignment name if not computed\n if (Node.isPropertyAssignment(parent)) {\n if (parent.getNameNode() === node) return; // It's the key\n }\n\n const key = generateKey(text, existingKeys);\n existingKeys.add(key);\n extractedContent[key] = text.trim();\n replacements.push({ node, key, type: 'string-literal' });\n }\n }\n });\n\n return { extractedContent, replacements };\n};\n\n// ==========================================\n// React (TS-Morph) Strategy\n// ==========================================\n\nconst processTsxFile = async (\n filePath: string,\n componentKey: string,\n packageName: PackageName,\n project: Project,\n save: boolean = true\n) => {\n let sourceFile: SourceFile;\n try {\n sourceFile = project.addSourceFileAtPath(filePath);\n } catch {\n sourceFile = project.getSourceFileOrThrow(filePath);\n }\n\n const isSolid = packageName === 'solid-intlayer';\n\n const existingKeys = new Set<string>();\n const { extractedContent, replacements } = extractTsContent(\n sourceFile,\n existingKeys\n );\n\n if (Object.keys(extractedContent).length === 0) return null;\n\n for (const { node, key, type } of replacements) {\n const contentAccess = isSolid ? `content().${key}` : `content.${key}`;\n\n if (type === 'jsx-text' && Node.isJsxText(node)) {\n node.replaceWithText(`{${contentAccess}}`);\n } else if (type === 'jsx-attribute' && Node.isJsxAttribute(node)) {\n node.setInitializer(`{${contentAccess}.value}`);\n } else if (type === 'string-literal' && Node.isStringLiteral(node)) {\n // For React/JS variables, we usually want the value\n node.replaceWithText(`${contentAccess}.value`);\n }\n }\n\n // Inject hook\n const importDecl = sourceFile.getImportDeclaration(\n (d) => d.getModuleSpecifierValue() === packageName\n );\n if (!importDecl) {\n sourceFile.addImportDeclaration({\n namedImports: ['useIntlayer'],\n moduleSpecifier: packageName,\n });\n } else if (\n !importDecl.getNamedImports().some((n) => n.getName() === 'useIntlayer')\n ) {\n importDecl.addNamedImport('useIntlayer');\n }\n\n // Insert hook at start of component\n sourceFile.getFunctions().forEach((f) => {\n f.getBody()\n ?.asKind(SyntaxKind.Block)\n ?.insertStatements(0, `const content = useIntlayer(\"${componentKey}\");`);\n });\n\n // Also handle const/arrow components\n sourceFile.getVariableDeclarations().forEach((v) => {\n const init = v.getInitializer();\n if (Node.isArrowFunction(init) || Node.isFunctionExpression(init)) {\n const body = init.getBody();\n if (Node.isBlock(body)) {\n // Heuristic: check if it returns JSX or uses hooks\n if (\n body.getText().includes('return') ||\n body.getText().includes('use')\n ) {\n body.insertStatements(\n 0,\n `const content = useIntlayer(\"${componentKey}\");`\n );\n }\n }\n }\n });\n\n if (save) {\n await sourceFile.save();\n }\n return extractedContent;\n};\n\n// ==========================================\n// 5. Main Dispatcher\n// ==========================================\n\nexport type PackageName =\n | 'next-intlayer'\n | 'react-intlayer'\n | 'vue-intlayer'\n | 'svelte-intlayer'\n | 'preact-intlayer'\n | 'solid-intlayer'\n | 'angular-intlayer'\n | 'express-intlayer';\n\nexport type ExtractIntlayerOptions = {\n configOptions?: GetConfigurationOptions;\n outputDir?: string;\n codeOnly?: boolean;\n declarationOnly?: boolean;\n};\n\nexport const extractIntlayer = async (\n filePath: string,\n packageName: PackageName,\n options?: ExtractIntlayerOptions,\n project?: Project\n) => {\n const saveComponent = !options?.declarationOnly;\n const writeContent = !options?.codeOnly;\n\n const configuration = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(configuration);\n const { baseDir } = configuration.content;\n\n // Setup Project for TS/React files if needed\n const _project =\n project || new Project({ skipAddingFilesFromTsConfig: true });\n\n const baseName = extractDictionaryKey(\n filePath,\n (await fs.readFile(filePath)).toString()\n );\n const componentKey = camelCaseToKebabCase(baseName);\n const ext = extname(filePath);\n\n let extractedContent: Record<string, string> | null = null;\n\n if (ext === '.vue') {\n try {\n const { processVueFile } = await import('@intlayer/vue-transformer');\n extractedContent = await processVueFile(\n filePath,\n componentKey,\n packageName,\n {\n generateKey,\n shouldExtract,\n extractTsContent,\n },\n saveComponent\n );\n } catch (error: any) {\n if (\n error.code === 'ERR_MODULE_NOT_FOUND' ||\n error.message?.includes('Cannot find module')\n ) {\n throw new Error(\n `Please install ${colorizePath('@intlayer/vue-transformer', ANSIColors.YELLOW)} to process Vue files.`\n );\n }\n throw error;\n }\n } else if (ext === '.svelte') {\n try {\n const { processSvelteFile } = (await import(\n '@intlayer/svelte-transformer'\n )) as any;\n extractedContent = await processSvelteFile(\n filePath,\n componentKey,\n packageName,\n {\n generateKey,\n shouldExtract,\n extractTsContent,\n },\n saveComponent\n );\n } catch (error: any) {\n if (\n error.code === 'ERR_MODULE_NOT_FOUND' ||\n error.message?.includes('Cannot find module')\n ) {\n throw new Error(\n `Please install ${colorizePath('@intlayer/svelte-transformer', ANSIColors.YELLOW)} to process Svelte files.`\n );\n }\n throw error;\n }\n } else if (['.tsx', '.jsx', '.ts', '.js'].includes(ext)) {\n extractedContent = await processTsxFile(\n filePath,\n componentKey,\n packageName,\n _project,\n saveComponent\n );\n }\n\n if (!extractedContent) {\n appLogger(`No extractable text found in ${baseName}`);\n return;\n }\n\n // Shared Write Logic\n if (writeContent) {\n const contentFilePath = await writeContentHelper(\n extractedContent,\n componentKey,\n filePath,\n configuration,\n options?.outputDir\n );\n\n const relativeContentFilePath = relative(\n configuration.content.baseDir,\n contentFilePath\n );\n appLogger(`Created content file: ${colorizePath(relativeContentFilePath)}`);\n }\n\n // Optional: Format\n if (saveComponent) {\n try {\n const formatCommand = detectFormatCommand(configuration);\n if (formatCommand) {\n execSync(formatCommand.replace('{{file}}', filePath), {\n stdio: 'ignore', // Silent\n cwd: baseDir,\n });\n }\n } catch {\n // Ignore format errors\n }\n\n appLogger(\n `Updated component: ${colorizePath(relative(baseDir, filePath))}`\n );\n }\n};\n\nexport const transformFiles = async (\n filePaths: string[],\n packageName: PackageName,\n options?: ExtractIntlayerOptions\n) => {\n const configuration = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(configuration);\n\n const project = new Project({\n skipAddingFilesFromTsConfig: true,\n });\n\n for (const filePath of filePaths) {\n try {\n await extractIntlayer(filePath, packageName, options, project);\n } catch (error) {\n appLogger(`Failed to transform ${filePath}: ${(error as Error).message}`);\n }\n }\n};\n"],"mappings":"stBA2BA,MAAa,EAAwB,CACnC,QACA,cACA,MACA,aACA,QACD,CAKY,EAAiB,GAA0B,CACtD,IAAM,EAAU,EAAK,MAAM,CAO3B,MADA,EALI,CAAC,GACD,CAAC,EAAQ,SAAS,IAAI,EAEtB,CAAC,SAAS,KAAK,EAAQ,EAEvB,EAAQ,WAAW,IAAI,EAAI,EAAQ,WAAW,KAAK,GAYnD,EAAqB,MACzB,EACA,EACA,EACA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I,EAAQ,CAC1B,4BAA6B,GAC9B,CAAC,CAEF,IAAK,IAAM,KAAY,EACrB,GAAI,CACF,MAAM,EAAgB,EAAU,EAAa,EAAS,EAAQ,OACvD,EAAO,CACd,EAAU,uBAAuB,EAAS,IAAK,EAAgB,UAAU"}
@@ -1,2 +0,0 @@
1
- import e from"crypto-js";const t=t=>e.SHA3(t).toString(e.enc.Base64).replace(/[^A-Z\d]/gi,``).substring(0,20);export{t as getFileHash};
2
- //# sourceMappingURL=getFileHash.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getFileHash.mjs","names":[],"sources":["../../../src/utils/getFileHash.ts"],"sourcesContent":["import crypto from 'crypto-js';\n\nexport const getFileHash = (filePath: string) => {\n const hash = crypto.SHA3(filePath);\n\n return hash\n .toString(crypto.enc.Base64)\n .replace(/[^A-Z\\d]/gi, '')\n .substring(0, 20);\n};\n"],"mappings":"yBAEA,MAAa,EAAe,GACb,EAAO,KAAK,EAAS,CAG/B,SAAS,EAAO,IAAI,OAAO,CAC3B,QAAQ,aAAc,GAAG,CACzB,UAAU,EAAG,GAAG"}
@@ -1,57 +0,0 @@
1
- import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.js";
2
- import { processContentDeclaration } from "./buildIntlayerDictionary/processContentDeclaration.js";
3
- import { cleanOutputDir } from "./cleanOutputDir.js";
4
- import { CreateDictionaryEntryPointOptions, createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.js";
5
- import { generateDictionaryListContent } from "./createDictionaryEntryPoint/generateDictionaryListContent.js";
6
- import { getBuiltDictionariesPath } from "./createDictionaryEntryPoint/getBuiltDictionariesPath.js";
7
- import { getBuiltDynamicDictionariesPath } from "./createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.js";
8
- import { getBuiltFetchDictionariesPath } from "./createDictionaryEntryPoint/getBuiltFetchDictionariesPath.js";
9
- import { getBuiltRemoteDictionariesPath } from "./createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.js";
10
- import { getBuiltUnmergedDictionariesPath } from "./createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.js";
11
- import { createModuleAugmentation, getTypeName } from "./createType/createModuleAugmentation.js";
12
- import { createTypes, generateTypeScriptType } from "./createType/createType.js";
13
- import { formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput } from "./formatDictionary.js";
14
- import { DictionariesStatus, loadDictionaries } from "./loadDictionaries/loadDictionaries.js";
15
- import { formatLocalDictionaries, loadContentDeclarations } from "./loadDictionaries/loadContentDeclaration.js";
16
- import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.js";
17
- import { formatDistantDictionaries, loadRemoteDictionaries } from "./loadDictionaries/loadRemoteDictionaries.js";
18
- import { prepareIntlayer } from "./prepareIntlayer.js";
19
- import { isCachedConfigurationUpToDate, writeConfiguration } from "./writeConfiguration/index.js";
20
- import { detectExportedComponentName } from "./writeContentDeclaration/detectExportedComponentName.js";
21
- import { DictionaryStatus } from "./writeContentDeclaration/dictionaryStatus.js";
22
- import { transformJSFile } from "./writeContentDeclaration/transformJSFile.js";
23
- import { writeContentDeclaration } from "./writeContentDeclaration/writeContentDeclaration.js";
24
- import { writeJSFile } from "./writeContentDeclaration/writeJSFile.js";
25
- import "./build.js";
26
- import { detectFormatCommand } from "./detectFormatCommand.js";
27
- import { Extension, Format, getExtensionFromFormat, getFormatFromExtension } from "./utils/getFormatFromExtension.js";
28
- import { getContentDeclarationFileTemplate } from "./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.js";
29
- import { initIntlayer } from "./init/index.js";
30
- import { Platform, SKILLS, SKILLS_METADATA, Skill, installSkills } from "./installSkills/index.js";
31
- import { listDictionaries, listDictionariesWithStats } from "./listDictionariesPath.js";
32
- import { DiffMode, ListGitFilesOptions, ListGitLinesOptions, listGitFiles, listGitLines } from "./listGitFiles.js";
33
- import { ListProjectsOptions, listProjects } from "./listProjects.js";
34
- import { extractDictionaryKey } from "./transformFiles/extractDictionaryKey.js";
35
- import { ATTRIBUTES_TO_EXTRACT, ExtractIntlayerOptions, PackageName, extractIntlayer, shouldExtract, transformFiles } from "./transformFiles/transformFiles.js";
36
- import "./cli.js";
37
- import { autoDecorateContent } from "./utils/autoDecorateContent.js";
38
- import { BuildFilesListOptions, buildFilesList } from "./utils/buildFilesList.js";
39
- import { JSONObject, JsonChunk, assembleJSON, chunkJSON, reconstructFromSingleChunk } from "./utils/chunkJSON.js";
40
- import { formatLocale, formatPath } from "./utils/formatter.js";
41
- import { getChunk } from "./utils/getChunk.js";
42
- import { getComponentTransformPattern, getComponentTransformPatternSync } from "./utils/getComponentTransformPattern.js";
43
- import { getFileHash } from "./utils/getFileHash.js";
44
- import { mergeChunks } from "./utils/mergeChunks.js";
45
- import { parallelize } from "./utils/parallelize.js";
46
- import { Queue, pLimit } from "./utils/pLimit.js";
47
- import { getGlobalLimiter, getTaskLimiter, parallelizeGlobal } from "./utils/parallelizeGlobal.js";
48
- import { reduceObjectFormat } from "./utils/reduceObjectFormat.js";
49
- import { resolveObjectPromises } from "./utils/resolveObjectPromises.js";
50
- import { runOnce } from "./utils/runOnce.js";
51
- import { ParallelHandle, runParallel } from "./utils/runParallel/index.js";
52
- import { sortAlphabetically } from "./utils/sortAlphabetically.js";
53
- import { splitTextByLines } from "./utils/splitTextByLine.js";
54
- import { verifyIdenticObjectFormat } from "./utils/verifyIdenticObjectFormat.js";
55
- import "./utils/index.js";
56
- import { buildAndWatchIntlayer, watch } from "./watcher.js";
57
- export { ATTRIBUTES_TO_EXTRACT, BuildFilesListOptions, CreateDictionaryEntryPointOptions, DictionariesStatus, DictionaryStatus, DiffMode, Extension, ExtractIntlayerOptions, Format, JSONObject, JsonChunk, ListGitFilesOptions, ListGitLinesOptions, ListProjectsOptions, PackageName, ParallelHandle, Platform, Queue, SKILLS, SKILLS_METADATA, Skill, assembleJSON, autoDecorateContent, buildAndWatchIntlayer, buildDictionary, buildFilesList, chunkJSON, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, detectFormatCommand, extractDictionaryKey, extractIntlayer, formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput, formatDistantDictionaries, formatLocalDictionaries, formatLocale, formatPath, generateDictionaryListContent, generateTypeScriptType, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getChunk, getComponentTransformPattern, getComponentTransformPatternSync, getContentDeclarationFileTemplate, getExtensionFromFormat, getFileHash, getFormatFromExtension, getGlobalLimiter, getTaskLimiter, getTypeName, initIntlayer, installSkills, isCachedConfigurationUpToDate, listDictionaries, listDictionariesWithStats, listGitFiles, listGitLines, listProjects, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, mergeChunks, pLimit, parallelize, parallelizeGlobal, prepareIntlayer, processContentDeclaration, reconstructFromSingleChunk, reduceObjectFormat, resolveObjectPromises, runOnce, runParallel, shouldExtract, sortAlphabetically, splitTextByLines, transformFiles, transformJSFile, verifyIdenticObjectFormat, watch, writeConfiguration, writeContentDeclaration, writeJSFile };
@@ -1,5 +0,0 @@
1
- //#region src/transformFiles/extractDictionaryKey.d.ts
2
- declare const extractDictionaryKey: (filePath: string, fileText: string) => string;
3
- //#endregion
4
- export { extractDictionaryKey };
5
- //# sourceMappingURL=extractDictionaryKey.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extractDictionaryKey.d.ts","names":[],"sources":["../../../src/transformFiles/extractDictionaryKey.ts"],"mappings":";cAGa,oBAAA,GACX,QAAA,UACA,QAAA"}
@@ -1,3 +0,0 @@
1
- import { extractDictionaryKey } from "./extractDictionaryKey.js";
2
- import { ATTRIBUTES_TO_EXTRACT, ExtractIntlayerOptions, PackageName, extractIntlayer, shouldExtract, transformFiles } from "./transformFiles.js";
3
- export { ATTRIBUTES_TO_EXTRACT, ExtractIntlayerOptions, PackageName, extractDictionaryKey, extractIntlayer, shouldExtract, transformFiles };
@@ -1,24 +0,0 @@
1
- import { GetConfigurationOptions } from "@intlayer/config/node";
2
- import { Project } from "ts-morph";
3
-
4
- //#region src/transformFiles/transformFiles.d.ts
5
- /**
6
- * Attributes that should be extracted for localization
7
- */
8
- declare const ATTRIBUTES_TO_EXTRACT: string[];
9
- /**
10
- * Default function to determine if a string should be extracted for localization
11
- */
12
- declare const shouldExtract: (text: string) => boolean;
13
- type PackageName = 'next-intlayer' | 'react-intlayer' | 'vue-intlayer' | 'svelte-intlayer' | 'preact-intlayer' | 'solid-intlayer' | 'angular-intlayer' | 'express-intlayer';
14
- type ExtractIntlayerOptions = {
15
- configOptions?: GetConfigurationOptions;
16
- outputDir?: string;
17
- codeOnly?: boolean;
18
- declarationOnly?: boolean;
19
- };
20
- declare const extractIntlayer: (filePath: string, packageName: PackageName, options?: ExtractIntlayerOptions, project?: Project) => Promise<void>;
21
- declare const transformFiles: (filePaths: string[], packageName: PackageName, options?: ExtractIntlayerOptions) => Promise<void>;
22
- //#endregion
23
- export { ATTRIBUTES_TO_EXTRACT, ExtractIntlayerOptions, PackageName, extractIntlayer, shouldExtract, transformFiles };
24
- //# sourceMappingURL=transformFiles.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transformFiles.d.ts","names":[],"sources":["../../../src/transformFiles/transformFiles.ts"],"mappings":";;;;;;AA2BA;cAAa,qBAAA;;;;cAWA,aAAA,GAAiB,IAAA;AAAA,KAiQlB,WAAA;AAAA,KAUA,sBAAA;EACV,aAAA,GAAgB,uBAAA;EAChB,SAAA;EACA,QAAA;EACA,eAAA;AAAA;AAAA,cAGW,eAAA,GACX,QAAA,UACA,WAAA,EAAa,WAAA,EACb,OAAA,GAAU,sBAAA,EACV,OAAA,GAAU,OAAA,KAAO,OAAA;AAAA,cA8HN,cAAA,GACX,SAAA,YACA,WAAA,EAAa,WAAA,EACb,OAAA,GAAU,sBAAA,KAAsB,OAAA"}
@@ -1,5 +0,0 @@
1
- //#region src/utils/getFileHash.d.ts
2
- declare const getFileHash: (filePath: string) => string;
3
- //#endregion
4
- export { getFileHash };
5
- //# sourceMappingURL=getFileHash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getFileHash.d.ts","names":[],"sources":["../../../src/utils/getFileHash.ts"],"mappings":";cAEa,WAAA,GAAe,QAAA"}