@intlayer/engine 9.5.12 → 9.7.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.
- package/dist/assets/installSkills/skills/cli.md +28 -1
- package/dist/assets/installSkills/skills/compat.md +1 -1
- package/dist/assets/installSkills/skills/dev-tools.md +8 -6
- package/dist/cjs/build.cjs +12 -2
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +12 -11
- package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
- package/dist/cjs/buildIntlayerDictionary/index.cjs +4 -1
- package/dist/cjs/buildIntlayerDictionary/rebuildUnmergedDictionaries.cjs +23 -0
- package/dist/cjs/buildIntlayerDictionary/rebuildUnmergedDictionaries.cjs.map +1 -0
- package/dist/cjs/cli.cjs +12 -0
- package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
- package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +1 -1
- package/dist/cjs/handleContentDeclarationFileChange.cjs +1 -1
- package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -1
- package/dist/cjs/init/cms.cjs +18 -0
- package/dist/cjs/init/cms.cjs.map +1 -1
- package/dist/cjs/init/index.cjs +23 -10
- package/dist/cjs/init/index.cjs.map +1 -1
- package/dist/cjs/init/utils/configManipulation.cjs +28 -0
- package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
- package/dist/cjs/init/utils/contentLayout.cjs +61 -0
- package/dist/cjs/init/utils/contentLayout.cjs.map +1 -0
- package/dist/cjs/init/utils/index.cjs +1 -0
- package/dist/cjs/init/utils/packageManager.cjs +1 -1
- package/dist/cjs/init/utils/packageManager.cjs.map +1 -1
- package/dist/cjs/installMCP/installMCP.cjs +35 -25
- package/dist/cjs/installMCP/installMCP.cjs.map +1 -1
- package/dist/cjs/installSkills/index.cjs +26 -1
- package/dist/cjs/installSkills/index.cjs.map +1 -1
- package/dist/cjs/listDictionariesPath.cjs +2 -5
- package/dist/cjs/listDictionariesPath.cjs.map +1 -1
- package/dist/cjs/listGitFiles.cjs +3 -5
- package/dist/cjs/listGitFiles.cjs.map +1 -1
- package/dist/cjs/listProjects.cjs +1 -2
- package/dist/cjs/listProjects.cjs.map +1 -1
- package/dist/cjs/loadDictionaries/index.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
- package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
- package/dist/cjs/utils/buildComponentFilesList.cjs +18 -30
- package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -1
- package/dist/cjs/utils/chunkJSON.cjs +1 -1
- package/dist/cjs/utils/chunkJSON.cjs.map +1 -1
- package/dist/cjs/utils/index.cjs +2 -0
- package/dist/cjs/utils/isDirectoryExcluded.cjs +36 -0
- package/dist/cjs/utils/isDirectoryExcluded.cjs.map +1 -0
- package/dist/cjs/watcher.cjs +5 -2
- package/dist/cjs/watcher.cjs.map +1 -1
- package/dist/cjs/writeConfiguration/index.cjs +23 -0
- package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/index.cjs +6 -0
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +20 -13
- package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/renderContentDeclaration.cjs +213 -0
- package/dist/cjs/writeContentDeclaration/renderContentDeclaration.cjs.map +1 -0
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +5 -51
- package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +2 -31
- package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs.map +1 -1
- package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +2 -8
- package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs.map +1 -1
- package/dist/esm/build.mjs +7 -5
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +12 -12
- package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
- package/dist/esm/buildIntlayerDictionary/index.mjs +3 -2
- package/dist/esm/buildIntlayerDictionary/rebuildUnmergedDictionaries.mjs +22 -0
- package/dist/esm/buildIntlayerDictionary/rebuildUnmergedDictionaries.mjs.map +1 -0
- package/dist/esm/cli.mjs +5 -3
- package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
- package/dist/esm/handleAdditionalContentDeclarationFile.mjs +1 -1
- package/dist/esm/handleContentDeclarationFileChange.mjs +1 -1
- package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +1 -1
- package/dist/esm/init/cms.mjs +19 -2
- package/dist/esm/init/cms.mjs.map +1 -1
- package/dist/esm/init/index.mjs +24 -11
- package/dist/esm/init/index.mjs.map +1 -1
- package/dist/esm/init/utils/configManipulation.mjs +28 -1
- package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
- package/dist/esm/init/utils/contentLayout.mjs +58 -0
- package/dist/esm/init/utils/contentLayout.mjs.map +1 -0
- package/dist/esm/init/utils/index.mjs +2 -2
- package/dist/esm/init/utils/packageManager.mjs +1 -1
- package/dist/esm/init/utils/packageManager.mjs.map +1 -1
- package/dist/esm/installMCP/installMCP.mjs +35 -25
- package/dist/esm/installMCP/installMCP.mjs.map +1 -1
- package/dist/esm/installSkills/index.mjs +27 -3
- package/dist/esm/installSkills/index.mjs.map +1 -1
- package/dist/esm/listDictionariesPath.mjs +2 -5
- package/dist/esm/listDictionariesPath.mjs.map +1 -1
- package/dist/esm/listGitFiles.mjs +1 -1
- package/dist/esm/listGitFiles.mjs.map +1 -1
- package/dist/esm/listProjects.mjs +1 -1
- package/dist/esm/listProjects.mjs.map +1 -1
- package/dist/esm/loadDictionaries/index.mjs +1 -1
- package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
- package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
- package/dist/esm/utils/buildComponentFilesList.mjs +19 -31
- package/dist/esm/utils/buildComponentFilesList.mjs.map +1 -1
- package/dist/esm/utils/chunkJSON.mjs +1 -1
- package/dist/esm/utils/chunkJSON.mjs.map +1 -1
- package/dist/esm/utils/index.mjs +2 -1
- package/dist/esm/utils/isDirectoryExcluded.mjs +35 -0
- package/dist/esm/utils/isDirectoryExcluded.mjs.map +1 -0
- package/dist/esm/utils/runParallel/pidTree.mjs +3 -3
- package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -1
- package/dist/esm/utils/runParallel/ps.mjs +2 -2
- package/dist/esm/utils/runParallel/ps.mjs.map +1 -1
- package/dist/esm/utils/runParallel/wmic.mjs +2 -2
- package/dist/esm/utils/runParallel/wmic.mjs.map +1 -1
- package/dist/esm/watcher.mjs +5 -2
- package/dist/esm/watcher.mjs.map +1 -1
- package/dist/esm/writeConfiguration/index.mjs +23 -1
- package/dist/esm/writeConfiguration/index.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/index.mjs +2 -1
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +20 -13
- package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/renderContentDeclaration.mjs +208 -0
- package/dist/esm/writeContentDeclaration/renderContentDeclaration.mjs.map +1 -0
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +5 -51
- package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +2 -31
- package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs.map +1 -1
- package/dist/esm/writeContentDeclaration/writeYamlFile.mjs +2 -8
- package/dist/esm/writeContentDeclaration/writeYamlFile.mjs.map +1 -1
- package/dist/types/build.d.ts +5 -3
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +6 -0
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
- package/dist/types/buildIntlayerDictionary/index.d.ts +3 -2
- package/dist/types/buildIntlayerDictionary/rebuildUnmergedDictionaries.d.ts +14 -0
- package/dist/types/buildIntlayerDictionary/rebuildUnmergedDictionaries.d.ts.map +1 -0
- package/dist/types/cli.d.ts +6 -4
- package/dist/types/fetchDistantDictionaries.d.ts +1 -1
- package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
- package/dist/types/init/cms.d.ts +6 -0
- package/dist/types/init/cms.d.ts.map +1 -1
- package/dist/types/init/index.d.ts +15 -14
- package/dist/types/init/index.d.ts.map +1 -1
- package/dist/types/init/utils/configManipulation.d.ts +8 -0
- package/dist/types/init/utils/configManipulation.d.ts.map +1 -1
- package/dist/types/init/utils/contentLayout.d.ts +42 -0
- package/dist/types/init/utils/contentLayout.d.ts.map +1 -0
- package/dist/types/init/utils/index.d.ts +2 -2
- package/dist/types/init/utils/packageManager.d.ts +9 -3
- package/dist/types/init/utils/packageManager.d.ts.map +1 -1
- package/dist/types/installMCP/installMCP.d.ts +4 -0
- package/dist/types/installMCP/installMCP.d.ts.map +1 -1
- package/dist/types/installSkills/index.d.ts +6 -0
- package/dist/types/installSkills/index.d.ts.map +1 -1
- package/dist/types/listDictionariesPath.d.ts +1 -1
- package/dist/types/listDictionariesPath.d.ts.map +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +1 -1
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
- package/dist/types/utils/buildComponentFilesList.d.ts +6 -6
- package/dist/types/utils/buildComponentFilesList.d.ts.map +1 -1
- package/dist/types/utils/chunkJSON.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +2 -1
- package/dist/types/utils/isDirectoryExcluded.d.ts +15 -0
- package/dist/types/utils/isDirectoryExcluded.d.ts.map +1 -0
- package/dist/types/watcher.d.ts.map +1 -1
- package/dist/types/writeConfiguration/index.d.ts +13 -0
- package/dist/types/writeConfiguration/index.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/index.d.ts +2 -1
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts +8 -2
- package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/renderContentDeclaration.d.ts +61 -0
- package/dist/types/writeContentDeclaration/renderContentDeclaration.d.ts.map +1 -0
- package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeMarkdownFile.d.ts.map +1 -1
- package/dist/types/writeContentDeclaration/writeYamlFile.d.ts.map +1 -1
- package/package.json +18 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeContentDeclaration.mjs","names":[],"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, extname, join, resolve } from 'node:path';\nimport { isDeepStrictEqual } from 'node:util';\nimport { COMPILER_NO_METADATA } from '@intlayer/config/defaultValues';\nimport {\n getFilteredLocalesDictionary,\n getPerLocaleDictionary,\n} from '@intlayer/core/plugins';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport {\n type Extension,\n getFormatFromExtension,\n} from '../utils/getFormatFromExtension';\nimport { readDictionariesFromDisk } from '../utils/readDictionariesFromDisk';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { processContentDeclarationContent } from './processContentDeclarationContent';\nimport { transformJSONFile } from './transformJSONFile';\nimport { writeJSFile } from './writeJSFile';\nimport { writeMarkdownFile } from './writeMarkdownFile';\nimport { writeYamlFile } from './writeYamlFile';\n\nconst formatContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n localeList?: LocalesValues[]\n) => {\n /**\n * Clean Markdown, Insertion, File, etc. node metadata\n */\n const processedDictionary =\n await processContentDeclarationContent(dictionary);\n\n let content = processedDictionary.content;\n\n /**\n * Filter locales content\n */\n\n if (dictionary.locale) {\n content = getPerLocaleDictionary(\n processedDictionary,\n dictionary.locale\n ).content;\n } else if (localeList) {\n content = getFilteredLocalesDictionary(\n processedDictionary,\n localeList\n ).content;\n }\n\n let pluginFormatResult: any = {\n ...dictionary,\n content,\n } satisfies Dictionary;\n\n /**\n * Format the dictionary with the plugins\n */\n\n for await (const plugin of configuration.plugins ?? []) {\n if (plugin.formatOutput) {\n const formattedResult = await plugin.formatOutput?.({\n dictionary: pluginFormatResult,\n configuration,\n });\n\n if (formattedResult) {\n pluginFormatResult = formattedResult;\n }\n }\n }\n\n const isDictionaryFormat =\n pluginFormatResult.content && pluginFormatResult.key;\n\n if (!isDictionaryFormat) return pluginFormatResult;\n\n // Build result from the original dictionary so that extra user-defined fields\n // (e.g. custom frontmatter in markdown files) are preserved.\n // Strip internal-only fields that must never appear in persisted output.\n const INTERNAL_FIELDS = new Set([\n '$schema',\n 'filePath',\n 'localId',\n 'localIds',\n 'projectIds',\n ]);\n\n const preservedFields = Object.fromEntries(\n Object.entries(dictionary as Record<string, unknown>).filter(\n ([k]) => !INTERNAL_FIELDS.has(k)\n )\n );\n\n let result: Dictionary = {\n ...preservedFields,\n content,\n } as Dictionary;\n\n /**\n * Add $schema to JSON dictionaries\n */\n const extension = (\n dictionary.filePath ? extname(dictionary.filePath) : '.json'\n ) as Extension;\n const format = getFormatFromExtension(extension);\n\n if (\n format === 'json' &&\n pluginFormatResult.content &&\n pluginFormatResult.key\n ) {\n result = {\n $schema: 'https://intlayer.org/schema.json',\n ...result,\n };\n }\n\n return result;\n};\n\ntype WriteContentDeclarationOptions = {\n newDictionariesPath?: string;\n localeList?: LocalesValues[];\n fallbackLocale?: Locale;\n};\n\nconst defaultOptions = {\n newDictionariesPath: 'intlayer-dictionaries',\n} satisfies WriteContentDeclarationOptions;\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n options?: WriteContentDeclarationOptions\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { system, compiler } = configuration;\n const { baseDir } = system;\n\n const noMetadata = compiler?.noMetadata ?? COMPILER_NO_METADATA;\n const { newDictionariesPath, localeList } = {\n ...defaultOptions,\n ...options,\n };\n\n const newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\n const unmergedDictionariesRecord = readDictionariesFromDisk<\n Record<string, Dictionary[]>\n >(configuration.system.unmergedDictionariesDir);\n const unmergedDictionaries = unmergedDictionariesRecord[\n dictionary.key\n ] as Dictionary[];\n\n const existingDictionary = unmergedDictionaries?.find(\n (el) => el.localId === dictionary.localId\n );\n\n const formattedContentDeclaration = await formatContentDeclaration(\n dictionary,\n configuration,\n localeList\n );\n\n if (existingDictionary?.filePath) {\n // Compare existing dictionary content with new dictionary content\n const isSameContent = isDeepStrictEqual(existingDictionary, dictionary);\n\n const filePath = resolve(\n configuration.system.baseDir,\n existingDictionary.filePath\n );\n\n // Up to date, nothing to do\n if (isSameContent) {\n return {\n status: 'up-to-date',\n path: filePath,\n };\n }\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return { status: 'updated', path: filePath };\n }\n\n if (dictionary.filePath) {\n const filePath = resolve(configuration.system.baseDir, dictionary.filePath);\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return { status: 'created', path: filePath };\n }\n\n // No existing dictionary, write to new location\n const contentDeclarationPath = join(\n newDictionaryLocationPath,\n `${dictionary.key}.content.json`\n );\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n};\n\nconst writeFileWithDirectories = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n noMetadata?: boolean\n): Promise<void> => {\n // Extract the directory from the file path\n const dir = dirname(absoluteFilePath);\n\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n\n const extension = extname(absoluteFilePath);\n\n if (extension === '.md' || extension === '.mdx') {\n await writeMarkdownFile(absoluteFilePath, dictionary, configuration);\n return;\n }\n\n if (extension === '.yaml' || extension === '.yml') {\n await writeYamlFile(absoluteFilePath, dictionary, configuration);\n return;\n }\n\n // Handle JSON, JSONC, and JSON5 via the AST transformer\n if (['.json', '.jsonc', '.json5'].includes(extension)) {\n let fileContent = '{}';\n\n if (existsSync(absoluteFilePath)) {\n try {\n fileContent = await readFile(absoluteFilePath, 'utf-8');\n } catch {\n // ignore read errors, start with empty object\n }\n }\n\n const transformedContent = transformJSONFile(\n fileContent,\n dictionary,\n noMetadata\n );\n\n // We use standard writeFile because transformedContent is already a string\n const tempDir = configuration.system?.tempDir;\n if (tempDir) {\n await mkdir(tempDir, { recursive: true });\n }\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n try {\n await writeFile(tempPath, transformedContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // Ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n return;\n }\n\n const knownJsExtensions = new Set([\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ]);\n\n if (!knownJsExtensions.has(extension)) {\n // Unknown extension (e.g. .po managed by a plugin) — skip; the plugin\n // owns this file format and writeJSFile / prettier would corrupt it.\n return;\n }\n\n await writeJSFile(absoluteFilePath, dictionary, configuration, noMetadata);\n\n // remove the cache as content has changed\n // Will force a new preparation of the intlayer on next build\n try {\n const sentinelPath = join(\n configuration.system.cacheDir,\n 'intlayer-prepared.lock'\n );\n await rm(sentinelPath, { recursive: true });\n } catch {}\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"writeContentDeclaration.mjs","names":[],"sources":["../../../src/writeContentDeclaration/writeContentDeclaration.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, extname, join, resolve } from 'node:path';\nimport { isDeepStrictEqual } from 'node:util';\nimport { COMPILER_NO_METADATA } from '@intlayer/config/defaultValues';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport { readDictionariesFromDisk } from '../utils/readDictionariesFromDisk';\nimport type { DictionaryStatus } from './dictionaryStatus';\nimport { formatContentDeclaration } from './renderContentDeclaration';\nimport { transformJSONFile } from './transformJSONFile';\nimport { writeJSFile } from './writeJSFile';\nimport { writeMarkdownFile } from './writeMarkdownFile';\nimport { writeYamlFile } from './writeYamlFile';\n\ntype WriteContentDeclarationOptions = {\n newDictionariesPath?: string;\n localeList?: LocalesValues[];\n fallbackLocale?: Locale;\n};\n\nconst defaultOptions = {\n newDictionariesPath: 'intlayer-dictionaries',\n} satisfies WriteContentDeclarationOptions;\n\nexport const writeContentDeclaration = async (\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n options?: WriteContentDeclarationOptions\n): Promise<{ status: DictionaryStatus; path: string }> => {\n const { system, compiler } = configuration;\n const { baseDir } = system;\n\n const noMetadata = compiler?.noMetadata ?? COMPILER_NO_METADATA;\n const { newDictionariesPath, localeList } = {\n ...defaultOptions,\n ...options,\n };\n\n const newDictionaryLocationPath = join(baseDir, newDictionariesPath);\n\n const unmergedDictionariesRecord = readDictionariesFromDisk<\n Record<string, Dictionary[]>\n >(configuration.system.unmergedDictionariesDir);\n const unmergedDictionaries = unmergedDictionariesRecord[\n dictionary.key\n ] as Dictionary[];\n\n const existingDictionary = unmergedDictionaries?.find(\n (el) => el.localId === dictionary.localId\n );\n\n const formattedContentDeclaration = await formatContentDeclaration(\n dictionary,\n { configuration, localeList }\n );\n\n if (existingDictionary?.filePath) {\n // Compare existing dictionary content with new dictionary content\n const isSameContent = isDeepStrictEqual(existingDictionary, dictionary);\n\n const filePath = resolve(\n configuration.system.baseDir,\n existingDictionary.filePath\n );\n\n // Up to date, nothing to do\n if (isSameContent) {\n return {\n status: 'up-to-date',\n path: filePath,\n };\n }\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return { status: 'updated', path: filePath };\n }\n\n if (dictionary.filePath) {\n const filePath = resolve(configuration.system.baseDir, dictionary.filePath);\n\n await writeFileWithDirectories(\n filePath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return { status: 'created', path: filePath };\n }\n\n // No existing dictionary, write to new location\n const contentDeclarationPath = join(\n newDictionaryLocationPath,\n `${dictionary.key}.content.json`\n );\n\n await writeFileWithDirectories(\n contentDeclarationPath,\n formattedContentDeclaration,\n configuration,\n noMetadata\n );\n\n return {\n status: 'imported',\n path: contentDeclarationPath,\n };\n};\n\nconst writeFileWithDirectories = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig,\n noMetadata?: boolean\n): Promise<void> => {\n // Extract the directory from the file path\n const dir = dirname(absoluteFilePath);\n\n // Create the directory recursively\n await mkdir(dir, { recursive: true });\n\n const extension = extname(absoluteFilePath);\n\n if (extension === '.md' || extension === '.mdx') {\n await writeMarkdownFile(absoluteFilePath, dictionary, configuration);\n return;\n }\n\n if (extension === '.yaml' || extension === '.yml') {\n await writeYamlFile(absoluteFilePath, dictionary, configuration);\n return;\n }\n\n // Handle JSON, JSONC, and JSON5 via the AST transformer\n if (['.json', '.jsonc', '.json5'].includes(extension)) {\n let fileContent = '{}';\n\n if (existsSync(absoluteFilePath)) {\n try {\n fileContent = await readFile(absoluteFilePath, 'utf-8');\n } catch {\n // ignore read errors, start with empty object\n }\n }\n\n const transformedContent = transformJSONFile(\n fileContent,\n dictionary,\n noMetadata\n );\n\n // We use standard writeFile because transformedContent is already a string\n const tempDir = configuration.system?.tempDir;\n if (tempDir) {\n await mkdir(tempDir, { recursive: true });\n }\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n try {\n await writeFile(tempPath, transformedContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // Ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n\n return;\n }\n\n const knownJsExtensions = new Set([\n '.ts',\n '.tsx',\n '.js',\n '.jsx',\n '.mjs',\n '.cjs',\n ]);\n\n if (!knownJsExtensions.has(extension)) {\n // Unknown extension (e.g. .po managed by a plugin) — skip; the plugin\n // owns this file format and writeJSFile / prettier would corrupt it.\n return;\n }\n\n await writeJSFile(absoluteFilePath, dictionary, configuration, noMetadata);\n\n // remove the cache as content has changed\n // Will force a new preparation of the intlayer on next build\n try {\n const sentinelPath = join(\n configuration.system.cacheDir,\n 'intlayer-prepared.lock'\n );\n await rm(sentinelPath, { recursive: true });\n } catch {}\n};\n"],"mappings":"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"}
|
|
@@ -1,41 +1,12 @@
|
|
|
1
1
|
import { detectFormatCommand } from "../detectFormatCommand.mjs";
|
|
2
|
+
import { renderMarkdownContentDeclaration } from "./renderContentDeclaration.mjs";
|
|
2
3
|
import { basename, dirname, join } from "node:path";
|
|
3
|
-
import { MARKDOWN } from "@intlayer/types/nodeType";
|
|
4
4
|
import { mkdir, rename, rm, writeFile } from "node:fs/promises";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
6
6
|
|
|
7
7
|
//#region src/writeContentDeclaration/writeMarkdownFile.ts
|
|
8
|
-
const stringifyYamlFrontmatter = (fields) => Object.entries(fields).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => {
|
|
9
|
-
if (Array.isArray(value)) return `${key}:\n${value.map((item) => ` - ${JSON.stringify(item)}`).join("\n")}`;
|
|
10
|
-
if (typeof value === "string" && (value.includes(":") || value.includes("\n") || value.includes("#"))) return `${key}: ${JSON.stringify(value)}`;
|
|
11
|
-
return `${key}: ${value}`;
|
|
12
|
-
}).join("\n");
|
|
13
|
-
const getMarkdownBody = (content) => {
|
|
14
|
-
const lines = content.split(/\r?\n/);
|
|
15
|
-
const firstNonEmptyIndex = lines.findIndex((line) => line.trim() !== "");
|
|
16
|
-
if (firstNonEmptyIndex === -1 || lines[firstNonEmptyIndex]?.trim() !== "---") return content;
|
|
17
|
-
let endIndex = -1;
|
|
18
|
-
for (let i = firstNonEmptyIndex + 1; i < lines.length; i++) if (lines[i]?.trim() === "---") {
|
|
19
|
-
endIndex = i;
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
if (endIndex === -1) return content;
|
|
23
|
-
return lines.slice(endIndex + 1).join("\n").trimStart();
|
|
24
|
-
};
|
|
25
|
-
const EXCLUDED_FRONTMATTER_KEYS = /* @__PURE__ */ new Set([
|
|
26
|
-
"content",
|
|
27
|
-
"$schema",
|
|
28
|
-
"filePath",
|
|
29
|
-
"localId",
|
|
30
|
-
"localIds",
|
|
31
|
-
"projectIds"
|
|
32
|
-
]);
|
|
33
8
|
const writeMarkdownFile = async (absoluteFilePath, dictionary, configuration) => {
|
|
34
|
-
const
|
|
35
|
-
const markdownRaw = typeof content === "object" && content?.nodeType === MARKDOWN ? content[MARKDOWN] ?? "" : "";
|
|
36
|
-
const markdownBody = getMarkdownBody(markdownRaw);
|
|
37
|
-
const frontmatterFields = Object.fromEntries(Object.entries(dictionary).filter(([k, v]) => !EXCLUDED_FRONTMATTER_KEYS.has(k) && v !== void 0));
|
|
38
|
-
const fileContent = `---\n${stringifyYamlFrontmatter(frontmatterFields)}\n---\n\n${markdownBody}`;
|
|
9
|
+
const fileContent = renderMarkdownContentDeclaration(dictionary);
|
|
39
10
|
const dir = dirname(absoluteFilePath);
|
|
40
11
|
await mkdir(dir, { recursive: true });
|
|
41
12
|
const tempDir = configuration.system?.tempDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeMarkdownFile.mjs","names":[],"sources":["../../../src/writeContentDeclaration/writeMarkdownFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport {
|
|
1
|
+
{"version":3,"file":"writeMarkdownFile.mjs","names":[],"sources":["../../../src/writeContentDeclaration/writeMarkdownFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport { renderMarkdownContentDeclaration } from './renderContentDeclaration';\n\nexport const writeMarkdownFile = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Promise<void> => {\n const fileContent = renderMarkdownContentDeclaration(dictionary);\n\n const dir = dirname(absoluteFilePath);\n await mkdir(dir, { recursive: true });\n\n const tempDir = configuration.system?.tempDir;\n if (tempDir) await mkdir(tempDir, { recursive: true });\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n\n try {\n await writeFile(tempPath, fileContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n};\n"],"mappings":";;;;;;;AAQA,MAAa,oBAAoB,OAC/B,kBACA,YACA,kBACkB;CAClB,MAAM,cAAc,iCAAiC,UAAU;CAE/D,MAAM,MAAM,QAAQ,gBAAgB;CACpC,MAAM,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;CAEpC,MAAM,UAAU,cAAc,QAAQ;CACtC,IAAI,SAAS,MAAM,MAAM,SAAS,EAAE,WAAW,KAAK,CAAC;CAErD,MAAM,eAAe,GAAG,SAAS,gBAAgB,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE;CACxG,MAAM,WAAW,UACb,KAAK,SAAS,YAAY,IAC1B,GAAG,iBAAiB,GAAG;CAE3B,IAAI;EACF,MAAM,UAAU,UAAU,aAAa,OAAO;EAC9C,MAAM,OAAO,UAAU,gBAAgB;CACzC,SAAS,OAAO;EACd,IAAI;GACF,MAAM,GAAG,UAAU,EAAE,OAAO,KAAK,CAAC;EACpC,QAAQ,CAER;EACA,MAAM;CACR;CAEA,MAAM,gBAAgB,oBAAoB,aAAa;CACvD,IAAI,eACF,IAAI;EACF,SAAS,cAAc,QAAQ,YAAY,gBAAgB,GAAG;GAC5D,OAAO;GACP,KAAK,cAAc,OAAO;EAC5B,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;CACrB;AAEJ"}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { detectFormatCommand } from "../detectFormatCommand.mjs";
|
|
2
|
+
import { renderYamlContentDeclaration } from "./renderContentDeclaration.mjs";
|
|
2
3
|
import { basename, dirname, join } from "node:path";
|
|
3
4
|
import { mkdir, rename, rm, writeFile } from "node:fs/promises";
|
|
4
5
|
import { execSync } from "node:child_process";
|
|
5
|
-
import { stringifyYaml } from "@intlayer/core/utils";
|
|
6
6
|
|
|
7
7
|
//#region src/writeContentDeclaration/writeYamlFile.ts
|
|
8
|
-
const EXCLUDED_YAML_KEYS = /* @__PURE__ */ new Set([
|
|
9
|
-
"$schema",
|
|
10
|
-
"id",
|
|
11
|
-
"filePath"
|
|
12
|
-
]);
|
|
13
8
|
const writeYamlFile = async (absoluteFilePath, dictionary, configuration) => {
|
|
14
|
-
const
|
|
15
|
-
const fileContent = stringifyYaml(filtered);
|
|
9
|
+
const fileContent = renderYamlContentDeclaration(dictionary);
|
|
16
10
|
const dir = dirname(absoluteFilePath);
|
|
17
11
|
await mkdir(dir, { recursive: true });
|
|
18
12
|
const tempDir = configuration.system?.tempDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeYamlFile.mjs","names":[],"sources":["../../../src/writeContentDeclaration/writeYamlFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport
|
|
1
|
+
{"version":3,"file":"writeYamlFile.mjs","names":[],"sources":["../../../src/writeContentDeclaration/writeYamlFile.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { mkdir, rename, rm, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { detectFormatCommand } from '../detectFormatCommand';\nimport { renderYamlContentDeclaration } from './renderContentDeclaration';\n\nexport const writeYamlFile = async (\n absoluteFilePath: string,\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Promise<void> => {\n const fileContent = renderYamlContentDeclaration(dictionary);\n\n const dir = dirname(absoluteFilePath);\n await mkdir(dir, { recursive: true });\n\n const tempDir = configuration.system?.tempDir;\n if (tempDir) await mkdir(tempDir, { recursive: true });\n\n const tempFileName = `${basename(absoluteFilePath)}.${Date.now()}-${Math.random().toString(36).slice(2)}.tmp`;\n const tempPath = tempDir\n ? join(tempDir, tempFileName)\n : `${absoluteFilePath}.${tempFileName}`;\n\n try {\n await writeFile(tempPath, fileContent, 'utf-8');\n await rename(tempPath, absoluteFilePath);\n } catch (error) {\n try {\n await rm(tempPath, { force: true });\n } catch {\n // ignore\n }\n throw error;\n }\n\n const formatCommand = detectFormatCommand(configuration);\n if (formatCommand) {\n try {\n execSync(formatCommand.replace('{{file}}', absoluteFilePath), {\n stdio: 'inherit',\n cwd: configuration.system.baseDir,\n });\n } catch (error) {\n console.error(error);\n }\n }\n};\n"],"mappings":";;;;;;;AAQA,MAAa,gBAAgB,OAC3B,kBACA,YACA,kBACkB;CAClB,MAAM,cAAc,6BAA6B,UAAU;CAE3D,MAAM,MAAM,QAAQ,gBAAgB;CACpC,MAAM,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;CAEpC,MAAM,UAAU,cAAc,QAAQ;CACtC,IAAI,SAAS,MAAM,MAAM,SAAS,EAAE,WAAW,KAAK,CAAC;CAErD,MAAM,eAAe,GAAG,SAAS,gBAAgB,EAAE,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE;CACxG,MAAM,WAAW,UACb,KAAK,SAAS,YAAY,IAC1B,GAAG,iBAAiB,GAAG;CAE3B,IAAI;EACF,MAAM,UAAU,UAAU,aAAa,OAAO;EAC9C,MAAM,OAAO,UAAU,gBAAgB;CACzC,SAAS,OAAO;EACd,IAAI;GACF,MAAM,GAAG,UAAU,EAAE,OAAO,KAAK,CAAC;EACpC,QAAQ,CAER;EACA,MAAM;CACR;CAEA,MAAM,gBAAgB,oBAAoB,aAAa;CACvD,IAAI,eACF,IAAI;EACF,SAAS,cAAc,QAAQ,YAAY,gBAAgB,GAAG;GAC5D,OAAO;GACP,KAAK,cAAc,OAAO;EAC5B,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;CACrB;AAEJ"}
|
package/dist/types/build.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { BuildDictionariesOptions, buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.js";
|
|
1
|
+
import { BuildDictionariesOptions, addStoredSiblingDictionaries, buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.js";
|
|
2
2
|
import { processContentDeclaration } from "./buildIntlayerDictionary/processContentDeclaration.js";
|
|
3
|
+
import { rebuildUnmergedDictionaries } from "./buildIntlayerDictionary/rebuildUnmergedDictionaries.js";
|
|
3
4
|
import "./buildIntlayerDictionary/index.js";
|
|
4
5
|
import { cleanOutputDir } from "./cleanOutputDir.js";
|
|
5
6
|
import { CreateDictionaryEntryPointOptions, createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.js";
|
|
@@ -22,11 +23,12 @@ import "./loadDictionaries/index.js";
|
|
|
22
23
|
import { prepareIntlayer } from "./prepareIntlayer.js";
|
|
23
24
|
import { INTLAYER_WATCH_ENV_VAR, PrepareIntlayerServerOptions, getIsDevWatcherCommand, getIsServerDevelopment, prepareIntlayerServer } from "./prepareIntlayerServer.js";
|
|
24
25
|
import { readDictionariesFromDisk } from "./utils/readDictionariesFromDisk.js";
|
|
25
|
-
import { isCachedConfigurationUpToDate, writeConfiguration } from "./writeConfiguration/index.js";
|
|
26
|
+
import { BuiltEditorOverride, isCachedConfigurationUpToDate, overrideBuiltEditorConfiguration, writeConfiguration } from "./writeConfiguration/index.js";
|
|
26
27
|
import { detectExportedComponentName } from "./writeContentDeclaration/detectExportedComponentName.js";
|
|
27
28
|
import { DictionaryStatus } from "./writeContentDeclaration/dictionaryStatus.js";
|
|
29
|
+
import { RenderContentDeclarationOptions, RenderedContentDeclaration, formatContentDeclaration, isRenderableContentDeclarationPath, renderContentDeclaration, renderMarkdownContentDeclaration, renderYamlContentDeclaration } from "./writeContentDeclaration/renderContentDeclaration.js";
|
|
28
30
|
import { transformJSFile } from "./writeContentDeclaration/transformJSFile.js";
|
|
29
31
|
import { writeContentDeclaration } from "./writeContentDeclaration/writeContentDeclaration.js";
|
|
30
32
|
import { writeJSFile } from "./writeContentDeclaration/writeJSFile.js";
|
|
31
33
|
import "./writeContentDeclaration/index.js";
|
|
32
|
-
export { BuildDictionariesOptions, CreateDictionaryEntryPointOptions, DictionariesStatus, DictionaryStatus, INTLAYER_WATCH_ENV_VAR, PrepareIntlayerServerOptions, buildDictionary, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, ensureIntlayerBundle, formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput, formatDistantDictionaries, formatDomains, formatLocalDictionaries, formatRewriteRules, generateDictionaryListContent, generateTypeScriptType, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getIsDevWatcherCommand, getIsServerDevelopment, getTypeName, isCachedConfigurationUpToDate, loadContentDeclaration, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, prepareIntlayer, prepareIntlayerServer, processContentDeclaration, readDictionariesFromDisk, transformJSFile, writeConfiguration, writeContentDeclaration, writeJSFile };
|
|
34
|
+
export { BuildDictionariesOptions, BuiltEditorOverride, CreateDictionaryEntryPointOptions, DictionariesStatus, DictionaryStatus, INTLAYER_WATCH_ENV_VAR, PrepareIntlayerServerOptions, RenderContentDeclarationOptions, RenderedContentDeclaration, addStoredSiblingDictionaries, buildDictionary, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, ensureIntlayerBundle, formatContentDeclaration, formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput, formatDistantDictionaries, formatDomains, formatLocalDictionaries, formatRewriteRules, generateDictionaryListContent, generateTypeScriptType, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getIsDevWatcherCommand, getIsServerDevelopment, getTypeName, isCachedConfigurationUpToDate, isRenderableContentDeclarationPath, loadContentDeclaration, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, overrideBuiltEditorConfiguration, prepareIntlayer, prepareIntlayerServer, processContentDeclaration, readDictionariesFromDisk, rebuildUnmergedDictionaries, renderContentDeclaration, renderMarkdownContentDeclaration, renderYamlContentDeclaration, transformJSFile, writeConfiguration, writeContentDeclaration, writeJSFile };
|
|
@@ -10,6 +10,12 @@ export type BuildDictionariesOptions = Partial<{
|
|
|
10
10
|
importOtherDictionaries: boolean;
|
|
11
11
|
env: 'prod' | 'dev';
|
|
12
12
|
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Appends the already-built declarations sharing a key with
|
|
15
|
+
* `localDictionaries` (other `localId`), so a partial rebuild does not drop
|
|
16
|
+
* the declarations coming from other content files.
|
|
17
|
+
*/
|
|
18
|
+
export declare const addStoredSiblingDictionaries: (localDictionaries: Dictionary[], configuration: IntlayerConfig) => Dictionary[];
|
|
13
19
|
/**
|
|
14
20
|
* This function transpile the bundled code to to make dictionaries as JSON files
|
|
15
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildIntlayerDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/buildIntlayerDictionary.ts"],"mappings":";;;;;;;YAuBY,2BAA2B;EACrC,gBAAgB;EAChB;EACA
|
|
1
|
+
{"version":3,"file":"buildIntlayerDictionary.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/buildIntlayerDictionary.ts"],"mappings":";;;;;;;YAuBY,2BAA2B;EACrC,gBAAgB;EAChB;EACA;;;;;;;qBAcW,+BAA4B,mBACpB,cAAY,eAChB,mBACd;;;;qBAgBU,kBAAe,0BACA,cAAY,eACvB,gBAAc,UACnB,6BAAwB;wBAAxB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { BuildDictionariesOptions, buildDictionary } from "./buildIntlayerDictionary.js";
|
|
1
|
+
import { BuildDictionariesOptions, addStoredSiblingDictionaries, buildDictionary } from "./buildIntlayerDictionary.js";
|
|
2
2
|
import { processContentDeclaration } from "./processContentDeclaration.js";
|
|
3
|
-
|
|
3
|
+
import { rebuildUnmergedDictionaries } from "./rebuildUnmergedDictionaries.js";
|
|
4
|
+
export { BuildDictionariesOptions, addStoredSiblingDictionaries, buildDictionary, processContentDeclaration, rebuildUnmergedDictionaries };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IntlayerConfig } from "@intlayer/types/config";
|
|
2
|
+
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
|
+
//#region src/buildIntlayerDictionary/rebuildUnmergedDictionaries.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Reloads a content declaration file and rewrites only the unmerged
|
|
6
|
+
* dictionaries of its keys. Used by the editor server right after writing a
|
|
7
|
+
* source file, so the next read reflects the write without waiting for the
|
|
8
|
+
* app watcher (which still owns the merged / dynamic / type outputs).
|
|
9
|
+
*
|
|
10
|
+
* @returns The reloaded declarations of the file.
|
|
11
|
+
*/
|
|
12
|
+
export declare const rebuildUnmergedDictionaries: (contentDeclarationPath: string, configuration: IntlayerConfig) => Promise<Dictionary[]>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//# sourceMappingURL=rebuildUnmergedDictionaries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rebuildUnmergedDictionaries.d.ts","names":[],"sources":["../../../src/buildIntlayerDictionary/rebuildUnmergedDictionaries.ts"],"mappings":";;;;;;;;;;;qBAca,8BAA2B,gCACR,eACf,mBACd,QAAQ"}
|
package/dist/types/cli.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { prepareIntlayer } from "./prepareIntlayer.js";
|
|
2
2
|
import { detectExportedComponentName } from "./writeContentDeclaration/detectExportedComponentName.js";
|
|
3
3
|
import { DictionaryStatus } from "./writeContentDeclaration/dictionaryStatus.js";
|
|
4
|
+
import { RenderContentDeclarationOptions, RenderedContentDeclaration, formatContentDeclaration, isRenderableContentDeclarationPath, renderContentDeclaration, renderMarkdownContentDeclaration, renderYamlContentDeclaration } from "./writeContentDeclaration/renderContentDeclaration.js";
|
|
4
5
|
import { transformJSFile } from "./writeContentDeclaration/transformJSFile.js";
|
|
5
6
|
import { writeContentDeclaration } from "./writeContentDeclaration/writeContentDeclaration.js";
|
|
6
7
|
import { writeJSFile } from "./writeContentDeclaration/writeJSFile.js";
|
|
@@ -14,13 +15,14 @@ import { DocumentationRouter, DocumentationRouterType, getDocumentationUrl } fro
|
|
|
14
15
|
import { NEXT_INTLAYER_BABEL_CONFIG_CONTENT } from "./init/utils/nextCompilerBabel.js";
|
|
15
16
|
import { hasUrlRoutingFramework } from "./init/utils/urlRoutingFramework.js";
|
|
16
17
|
import "./init/utils/index.js";
|
|
17
|
-
import {
|
|
18
|
+
import { CATALOG_MESSAGE_FORMATS, CONTENT_FORMATS_BY_LAYOUT, CatalogMessageFormat, ContentFormat, ContentLayout, ContentLayoutSetup, getContentLayoutSetup } from "./init/utils/contentLayout.js";
|
|
19
|
+
import { InitOptions, getDefaultApplicationURL, initIntlayer, logInitSuccessMessage } from "./init/index.js";
|
|
18
20
|
import { UpgradeIntlayerPackagesOptions, UpgradeIntlayerPackagesResult, upgradeIntlayerPackages } from "./init/upgradeIntlayerPackages.js";
|
|
19
21
|
import { installLSP } from "./installLSP.js";
|
|
20
|
-
import { PLATFORMS, PLATFORMS_METADATA, Platform, PlatformMetadata, SKILLS, SKILLS_METADATA, Skill, getInitialSkills, installSkills } from "./installSkills/index.js";
|
|
21
|
-
import { MCPTransport, installMCP } from "./installMCP/installMCP.js";
|
|
22
|
+
import { PLATFORMS, PLATFORMS_METADATA, Platform, PlatformMetadata, SKILLS, SKILLS_METADATA, Skill, detectPlatform, getInitialSkills, installSkills } from "./installSkills/index.js";
|
|
23
|
+
import { MCPTransport, MCP_TRANSPORTS, installMCP } from "./installMCP/installMCP.js";
|
|
22
24
|
import { listDictionaries, listDictionariesWithStats } from "./listDictionariesPath.js";
|
|
23
25
|
import { DiffMode, ListGitFilesOptions, ListGitLinesOptions, listGitFiles, listGitLines } from "./listGitFiles.js";
|
|
24
26
|
import { ListProjectsOptions, getGitRootDir, listProjects } from "./listProjects.js";
|
|
25
27
|
import { logConfigDetails } from "./logConfigDetails.js";
|
|
26
|
-
export { COMPAT_I18N_LIBRARIES, type CmsCredentials, type CompatI18nLibrary,
|
|
28
|
+
export { CATALOG_MESSAGE_FORMATS, COMPAT_I18N_LIBRARIES, CONTENT_FORMATS_BY_LAYOUT, CatalogMessageFormat, type CmsCredentials, type CompatI18nLibrary, ContentFormat, ContentLayout, ContentLayoutSetup, DictionaryStatus, DiffMode, DocumentationRouter, type DocumentationRouterType, InitOptions, ListGitFilesOptions, ListGitLinesOptions, ListProjectsOptions, MCPTransport, MCP_TRANSPORTS, NEXT_INTLAYER_BABEL_CONFIG_CONTENT, PLATFORMS, PLATFORMS_METADATA, type PackageManager, Platform, PlatformMetadata, RenderContentDeclarationOptions, RenderedContentDeclaration, type RoutingMode, SKILLS, SKILLS_METADATA, Skill, UpgradeIntlayerPackagesOptions, UpgradeIntlayerPackagesResult, detectCompatI18nLibraries, detectExportedComponentName, detectFormatCommand, detectPackageManager, detectPlatform, enableEditorInConfig, findLockFileDir, formatContentDeclaration, getContentDeclarationFileTemplate, getContentLayoutSetup, getDefaultApplicationURL, getDocumentationUrl, getGitRootDir, getInitialSkills, hasLintTooling, hasUrlRoutingFramework, initIntlayer, installLSP, installMCP, installPackages, installSkills, isRenderableContentDeclarationPath, listDictionaries, listDictionariesWithStats, listGitFiles, listGitLines, listProjects, logConfigDetails, logInitSuccessMessage, prepareIntlayer, renderContentDeclaration, renderMarkdownContentDeclaration, renderYamlContentDeclaration, setupCmsCredentials, transformJSFile, upgradeIntlayerPackages, writeCmsCredentialsToEnv, writeContentDeclaration, writeJSFile };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DictionariesStatus } from "./loadDictionaries/loadDictionaries.js";
|
|
2
2
|
import "./loadDictionaries/index.js";
|
|
3
|
-
import { DictionaryAPI } from "@intlayer/
|
|
3
|
+
import { DictionaryAPI } from "@intlayer/api";
|
|
4
4
|
//#region src/fetchDistantDictionaries.d.ts
|
|
5
5
|
type FetchDistantDictionariesOptions = {
|
|
6
6
|
dictionaryKeys: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchDistantDictionaries.d.ts","names":[],"sources":["../../src/fetchDistantDictionaries.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"fetchDistantDictionaries.d.ts","names":[],"sources":["../../src/fetchDistantDictionaries.ts"],"mappings":";;;;KAmDK;EACH;EACA;EACA;;;;;EAKA;;;;;EAKA;;;;;EAKA;;;;;EAKA;;;;;;;;;;;qBAYW,2BAAwB,SAC1B,iCAA+B,kBACtB,QAAQ,kCACzB,QAAQ"}
|
package/dist/types/init/cms.d.ts
CHANGED
|
@@ -53,6 +53,12 @@ export declare const setRoutingStorageOnlyInConfig: (rootDir: string) => Promise
|
|
|
53
53
|
* or `undefined` when none was found.
|
|
54
54
|
*/
|
|
55
55
|
export declare const setCompilerOutputInConfig: (rootDir: string, outputTemplate: string) => Promise<string | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* Sets `dictionary.locale` to the default locale in the project's Intlayer
|
|
58
|
+
* configuration file. Returns the config file that was updated, or `undefined`
|
|
59
|
+
* when none was found.
|
|
60
|
+
*/
|
|
61
|
+
export declare const setDictionaryLocaleInConfig: (rootDir: string) => Promise<string | undefined>;
|
|
56
62
|
/**
|
|
57
63
|
* Completes the CMS setup once credentials are received from the login flow:
|
|
58
64
|
* writes them to the environment file and enables the editor in the Intlayer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cms.d.ts","names":[],"sources":["../../../src/init/cms.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"cms.d.ts","names":[],"sources":["../../../src/init/cms.ts"],"mappings":";;;;;;qBAkBa;;YAgBD;EACV;EACA;;;;;;;qBAwBW,cAAW,oBAA4B;;;;;;;qBA0CvC,2BAAwB,mBACpB,UAAA,gBACa,mBAC3B;;;;;;;;qBAmCU,uBAAoB,oBAE9B;;;;;qBAwCU,yBAAsB,iBAClB,MACT,gBACL;;;;;qBAuBU,yBAAsB,iBAClB,yBAEd;;;;;;qBA4BU,gCAA6B,oBAEvC;;;;;;qBA2BU,4BAAyB,iBACrB,2BAEd;;;;;;qBA4BU,8BAA2B,oBAErC;;;;;;qBAwBU,sBAAmB,iBACf,aACF,mBACZ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RoutingMode } from "./utils/configManipulation.js";
|
|
2
2
|
import { DocumentationRouter, DocumentationRouterType, getDocumentationUrl } from "./documentationRouter.js";
|
|
3
3
|
import "./utils/index.js";
|
|
4
|
+
import { CatalogMessageFormat, ContentFormat, ContentLayout } from "./utils/contentLayout.js";
|
|
4
5
|
//#region src/init/index.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* Resolves the default dev-server URL of the detected framework, used as the
|
|
@@ -9,16 +10,6 @@ import "./utils/index.js";
|
|
|
9
10
|
* their own dev port wins.
|
|
10
11
|
*/
|
|
11
12
|
export declare const getDefaultApplicationURL: (dependencies: Record<string, string>) => string;
|
|
12
|
-
/**
|
|
13
|
-
* How the interactive init organizes autogenerated content (compiler output /
|
|
14
|
-
* autofill):
|
|
15
|
-
* - `per-component` — multilingual `.content` files co-located with components
|
|
16
|
-
* (the configuration template default).
|
|
17
|
-
* - `centralized` — per-locale JSON dictionaries under `/locales/{locale}/`.
|
|
18
|
-
* - `json-namespaces` — plain per-locale JSON namespace files kept in sync
|
|
19
|
-
* through `@intlayer/sync-json-plugin`.
|
|
20
|
-
*/
|
|
21
|
-
export type ContentStrategy = 'per-component' | 'centralized' | 'json-namespaces';
|
|
22
13
|
/**
|
|
23
14
|
* OPTIONS
|
|
24
15
|
*/
|
|
@@ -66,12 +57,22 @@ export type InitOptions = {
|
|
|
66
57
|
*/
|
|
67
58
|
enableProxy?: boolean;
|
|
68
59
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* syncJSON plugin
|
|
60
|
+
* How content declarations are organized. `.content` layouts set
|
|
61
|
+
* `compiler.output` (and `dictionary.locale` for `per-locale`); catalog
|
|
62
|
+
* layouts register the syncJSON / syncPO plugin. When omitted, the
|
|
72
63
|
* configuration template default is kept.
|
|
73
64
|
*/
|
|
74
|
-
|
|
65
|
+
contentLayout?: ContentLayout;
|
|
66
|
+
/**
|
|
67
|
+
* File format of the content declarations, used with `contentLayout`. A
|
|
68
|
+
* format the layout does not accept falls back to the layout default.
|
|
69
|
+
*/
|
|
70
|
+
contentFormat?: ContentFormat;
|
|
71
|
+
/**
|
|
72
|
+
* Message syntax of JSON catalogs (centralized / namespaces layouts), written
|
|
73
|
+
* to the syncJSON `format` option. Defaults to `icu`.
|
|
74
|
+
*/
|
|
75
|
+
contentMessageFormat?: CatalogMessageFormat;
|
|
75
76
|
};
|
|
76
77
|
/**
|
|
77
78
|
* MAIN LOGIC
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/init/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/init/index.ts"],"mappings":";;;;;;;;;;;qBAmFa,2BAAwB,cACrB;;;;YAgBJ;EACV;;EAEA;;;;;EAKA;;EAEA;;EAEA;;EAEA;;;;;;;EAOA;;EAEA;;;;;;EAMA;;;;;;EAMA,cAAc;;;;;;;EAOd;;;;;;;EAOA,gBAAgB;;;;;EAKhB,gBAAgB;;;;;EAKhB,uBAAuB;;;;;qBAMZ,eAAY,iBAAyB,UAAY,gBAAW;;;qBAylC5D,wBAAqB"}
|
|
@@ -34,6 +34,14 @@ export declare const setIntlayerConfigRoutingStorageOnly: (content: string, exte
|
|
|
34
34
|
* string.
|
|
35
35
|
*/
|
|
36
36
|
export declare const setIntlayerConfigCompilerOutput: (content: string, extension: string, outputTemplate: string) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Sets `dictionary.locale` in an Intlayer configuration file to the configured
|
|
39
|
+
* `internationalization.defaultLocale`, making new content declarations
|
|
40
|
+
* per-locale. The default locale expression is copied as-is (e.g.
|
|
41
|
+
* `Locales.ENGLISH`), falling back to `'en'` when it cannot be read.
|
|
42
|
+
* Idempotent. Supports `.ts`, `.mjs`, `.js`, `.cjs` and `.json` configs.
|
|
43
|
+
*/
|
|
44
|
+
export declare const setIntlayerConfigDictionaryLocale: (content: string, extension: string) => string;
|
|
37
45
|
/**
|
|
38
46
|
* Enables the Intlayer visual editor in a configuration file: sets
|
|
39
47
|
* `editor.enabled` to `true` and wires `clientId` / `clientSecret` to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configManipulation.d.ts","names":[],"sources":["../../../../src/init/utils/configManipulation.ts"],"mappings":";;;;YAYY,cAAc;;;;;;;;qBA0Fb,+BAA4B,iBACxB,mBACE,MACX;;;;;;qBAuCK,+BAA4B,iBACxB,mBACE;;;;;;;;qBA+CN,sCAAmC,iBAC/B;;;;;;;;;qBAgDJ,kCAA+B,iBAC3B,mBACE;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"configManipulation.d.ts","names":[],"sources":["../../../../src/init/utils/configManipulation.ts"],"mappings":";;;;YAYY,cAAc;;;;;;;;qBA0Fb,+BAA4B,iBACxB,mBACE,MACX;;;;;;qBAuCK,+BAA4B,iBACxB,mBACE;;;;;;;;qBA+CN,sCAAmC,iBAC/B;;;;;;;;;qBAgDJ,kCAA+B,iBAC3B,mBACE;;;;;;;;qBAyCN,oCAAiC,iBAC7B;;;;;;;;;qBAyDJ,6BAA0B;;;;;;;;qBA+Q1B,wBAAqB;qBAIrB,mBAAgB,iBACZ;qBAoBJ,oBAAiB,iBACb;qBAoBJ,mBAAgB,iBACZ;;;;;;;;;;;;;qBA2EJ,oBAAiB,iBACb;;;;;;;qBA2EJ,yBAAsB;qBAgBtB,mBAAgB;;;;;qBA6DhB,6BAA0B,iBACtB;;;;;;qBA8BJ,kCAA+B,iBAC3B,mBACE,cACH;;;;;;;;;;qBAiCH,sCAAmC,iBAC/B,oBACG,2BACO;;;;;qBAqGd,mCAAgC,iBAC5B;;;;;qBAcJ,gCAA6B;;;;;qBA+D7B,iCAA8B,iBAC1B;;;;;;;qBAgBJ,8BAA2B,iBACvB;;;;;;qBAgQJ,qCAAkC,iBAC9B,mBACE,YACL"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { CompatSyncConfig } from "./packageManager.js";
|
|
2
|
+
//#region src/init/utils/contentLayout.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* How content declarations are organized in the project:
|
|
5
|
+
* - `multilingual` — `./{fileName}.content.{ts,json}` next to the component,
|
|
6
|
+
* every locale in the same file.
|
|
7
|
+
* - `per-locale` — `./{fileName}.{locale}.content.{ts,json}` next to the
|
|
8
|
+
* component, one file per locale.
|
|
9
|
+
* - `centralized` — a single `/locales/{locale}.{json,po}` catalog per locale,
|
|
10
|
+
* synced through a sync plugin.
|
|
11
|
+
* - `namespaces` — `/locales/{locale}/{namespace}.{json,po}` catalogs, synced
|
|
12
|
+
* through a sync plugin.
|
|
13
|
+
*/
|
|
14
|
+
export type ContentLayout = 'multilingual' | 'per-locale' | 'centralized' | 'namespaces';
|
|
15
|
+
/** File format of the content declarations / catalogs. */
|
|
16
|
+
export type ContentFormat = 'ts' | 'json' | 'po';
|
|
17
|
+
/**
|
|
18
|
+
* Message syntax of a JSON catalog (plurals, interpolation…), written to the
|
|
19
|
+
* syncJSON `format` option. Ordered as offered, the first one being the default.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CATALOG_MESSAGE_FORMATS: readonly ['icu', 'i18next', 'vue-i18n', 'intlayer'];
|
|
22
|
+
/** Message syntax of a JSON catalog. */
|
|
23
|
+
export type CatalogMessageFormat = (typeof CATALOG_MESSAGE_FORMATS)[number];
|
|
24
|
+
/** Formats accepted by each content layout, the first one being the default. */
|
|
25
|
+
export declare const CONTENT_FORMATS_BY_LAYOUT: Record<ContentLayout, readonly ContentFormat[]>;
|
|
26
|
+
/** Configuration changes implied by a content layout. */
|
|
27
|
+
export type ContentLayoutSetup = {
|
|
28
|
+
/** `compiler.output` template, for layouts based on `.content` files. */
|
|
29
|
+
compilerOutput?: string;
|
|
30
|
+
/** Whether `dictionary.locale` must be set (per-locale declarations). */
|
|
31
|
+
isPerLocale: boolean;
|
|
32
|
+
/** Sync plugin to register, for layouts based on plain catalogs. */
|
|
33
|
+
syncConfig?: CompatSyncConfig;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Resolves the configuration changes for a content layout and format. A format
|
|
37
|
+
* the layout does not accept falls back to the layout default. The message
|
|
38
|
+
* format only applies to JSON catalogs (centralized / namespaces).
|
|
39
|
+
*/
|
|
40
|
+
export declare const getContentLayoutSetup: (layout: ContentLayout, format?: ContentFormat, messageFormat?: CatalogMessageFormat) => ContentLayoutSetup;
|
|
41
|
+
//#endregion
|
|
42
|
+
//# sourceMappingURL=contentLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentLayout.d.ts","names":[],"sources":["../../../../src/init/utils/contentLayout.ts"],"mappings":";;;;;;;;;;;;;YAaY;;YAOA;;;;;qBAMC;;YAQD,+BAA+B;;qBAG9B,2BAA2B,OACtC,wBACS;;YASC;;EAEV;;EAEA;;EAEA,aAAa;;;;;;;qBAQF,wBAAqB,QACxB,eAAa,SACZ,eAAa,gBACP,yBACd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { COMPAT_I18N_LIBRARIES, COMPAT_PACKAGE_REPLACEMENTS, CompatI18nLibrary, CompatSyncConfig, CompatVitePluginConfig, DetectMissingPackagesOptions, IntlayerPackageAnalysis, MINIMUM_ESLINT_MAJOR, PENDING_COMPAT_ADAPTERS, PackageManager, detectCompatI18nLibraries, detectMissingIntlayerPackages, detectPackageManager, findLockFileDir, hasLegacyEslint, hasLintTooling, installPackages, isIntlayerPackageName, moveCompatPackagesToDevDependencies, normalizeVersion, runPackageInstall } from "./packageManager.js";
|
|
2
|
-
import { RoutingMode, enableIntlayerEditorConfig, getMetroConfigTemplate, hasIntlayerVitePlugin, replaceViteConfigPluginImportSource, setIntlayerConfigCompilerOutput, setIntlayerConfigEnableProxy, setIntlayerConfigRoutingMode, setIntlayerConfigRoutingStorageOnly, updateAstroConfig, updateIntlayerConfigWithSyncPlugin, updateMetroConfig, updateNextConfig, updateNextConfigForNextI18next, updateNextConfigForNextIntl, updateNextConfigForNextTranslate, updateNuxtConfig, updateNuxtConfigForNuxtjsI18n, updateViteConfig, updateViteConfigForCompatPlugin, updateViteConfigForVueI18n } from "./configManipulation.js";
|
|
2
|
+
import { RoutingMode, enableIntlayerEditorConfig, getMetroConfigTemplate, hasIntlayerVitePlugin, replaceViteConfigPluginImportSource, setIntlayerConfigCompilerOutput, setIntlayerConfigDictionaryLocale, setIntlayerConfigEnableProxy, setIntlayerConfigRoutingMode, setIntlayerConfigRoutingStorageOnly, updateAstroConfig, updateIntlayerConfigWithSyncPlugin, updateMetroConfig, updateNextConfig, updateNextConfigForNextI18next, updateNextConfigForNextIntl, updateNextConfigForNextTranslate, updateNuxtConfig, updateNuxtConfigForNuxtjsI18n, updateViteConfig, updateViteConfigForCompatPlugin, updateViteConfigForVueI18n } from "./configManipulation.js";
|
|
3
3
|
import { ensureNamedImport, firstInsertIndex, isModuleScopeBinding } from "./astImports.js";
|
|
4
4
|
import { BACKEND_INTLAYER_PACKAGES } from "./backendPackages.js";
|
|
5
5
|
import { JsonLocalePattern, JsonLocalePatternType, LinguiCatalogPattern, NextIntlMessagesPattern, detectJsonLocalePattern, detectLinguiCatalogPattern, detectNextIntlMessagesPattern, ensureDirectory, exists, readFileFromRoot, writeFileToRoot } from "./fileSystem.js";
|
|
@@ -11,4 +11,4 @@ import { NEXT_INTLAYER_BABEL_CONFIG_CONTENT, setupNextCompilerBabelConfig } from
|
|
|
11
11
|
import { findTsConfigFiles } from "./tsConfig.js";
|
|
12
12
|
import { hasUrlRoutingFramework } from "./urlRoutingFramework.js";
|
|
13
13
|
import { isVersionAtLeast } from "./version.js";
|
|
14
|
-
export { BACKEND_INTLAYER_PACKAGES, COMPAT_I18N_LIBRARIES, COMPAT_PACKAGE_REPLACEMENTS, CompatI18nLibrary, CompatSyncConfig, CompatVitePluginConfig, DetectMissingPackagesOptions, GITHUB_FILL_WORKFLOW_PATH, GITHUB_TEST_WORKFLOW_PATH, GithubWorkflowFile, GithubWorkflowsContext, GithubWorkflowsOptions, IntlayerDependency, IntlayerDependencyUpgrade, IntlayerPackageAnalysis, JsonLocalePattern, JsonLocalePatternType, LINT_PLUGIN_PACKAGE_NAME, LinguiCatalogPattern, MINIMUM_ESLINT_MAJOR, NEXT_INTLAYER_BABEL_CONFIG_CONTENT, NextIntlMessagesPattern, OxlintConfig, PENDING_COMPAT_ADAPTERS, PackageJsonIntlayerDependencies, PackageManager, RoutingMode, addIntlayerRulesToOxlintConfig, detectCompatI18nLibraries, detectJsonLocalePattern, detectLinguiCatalogPattern, detectMissingIntlayerPackages, detectNextIntlMessagesPattern, detectPackageManager, enableIntlayerEditorConfig, ensureDirectory, ensureNamedImport, exists, fetchLatestPackageVersion, findLockFileDir, findPackageJsonFiles, findTsConfigFiles, firstInsertIndex, getGithubWorkflows, getIntlayerDependencies, getIntlayerDependencyUpgrades, getMetroConfigTemplate, hasIntlayerVitePlugin, hasLegacyEslint, hasLintTooling, hasUrlRoutingFramework, installPackages, isIntlayerPackageName, isModuleScopeBinding, isVersionAtLeast, listIntlayerDependencies, moveCompatPackagesToDevDependencies, normalizeVersion, parseJSONWithComments, readFileFromRoot, replaceViteConfigPluginImportSource, resolveGithubWorkflowsContext, runPackageInstall, setIntlayerConfigCompilerOutput, setIntlayerConfigEnableProxy, setIntlayerConfigRoutingMode, setIntlayerConfigRoutingStorageOnly, setupNextCompilerBabelConfig, toRange, updateAstroConfig, updateIntlayerConfigWithSyncPlugin, updateMetroConfig, updateNextConfig, updateNextConfigForNextI18next, updateNextConfigForNextIntl, updateNextConfigForNextTranslate, updateNuxtConfig, updateNuxtConfigForNuxtjsI18n, updateViteConfig, updateViteConfigForCompatPlugin, updateViteConfigForVueI18n, writeFileToRoot, writeIntlayerDependencyUpgrades };
|
|
14
|
+
export { BACKEND_INTLAYER_PACKAGES, COMPAT_I18N_LIBRARIES, COMPAT_PACKAGE_REPLACEMENTS, CompatI18nLibrary, CompatSyncConfig, CompatVitePluginConfig, DetectMissingPackagesOptions, GITHUB_FILL_WORKFLOW_PATH, GITHUB_TEST_WORKFLOW_PATH, GithubWorkflowFile, GithubWorkflowsContext, GithubWorkflowsOptions, IntlayerDependency, IntlayerDependencyUpgrade, IntlayerPackageAnalysis, JsonLocalePattern, JsonLocalePatternType, LINT_PLUGIN_PACKAGE_NAME, LinguiCatalogPattern, MINIMUM_ESLINT_MAJOR, NEXT_INTLAYER_BABEL_CONFIG_CONTENT, NextIntlMessagesPattern, OxlintConfig, PENDING_COMPAT_ADAPTERS, PackageJsonIntlayerDependencies, PackageManager, RoutingMode, addIntlayerRulesToOxlintConfig, detectCompatI18nLibraries, detectJsonLocalePattern, detectLinguiCatalogPattern, detectMissingIntlayerPackages, detectNextIntlMessagesPattern, detectPackageManager, enableIntlayerEditorConfig, ensureDirectory, ensureNamedImport, exists, fetchLatestPackageVersion, findLockFileDir, findPackageJsonFiles, findTsConfigFiles, firstInsertIndex, getGithubWorkflows, getIntlayerDependencies, getIntlayerDependencyUpgrades, getMetroConfigTemplate, hasIntlayerVitePlugin, hasLegacyEslint, hasLintTooling, hasUrlRoutingFramework, installPackages, isIntlayerPackageName, isModuleScopeBinding, isVersionAtLeast, listIntlayerDependencies, moveCompatPackagesToDevDependencies, normalizeVersion, parseJSONWithComments, readFileFromRoot, replaceViteConfigPluginImportSource, resolveGithubWorkflowsContext, runPackageInstall, setIntlayerConfigCompilerOutput, setIntlayerConfigDictionaryLocale, setIntlayerConfigEnableProxy, setIntlayerConfigRoutingMode, setIntlayerConfigRoutingStorageOnly, setupNextCompilerBabelConfig, toRange, updateAstroConfig, updateIntlayerConfigWithSyncPlugin, updateMetroConfig, updateNextConfig, updateNextConfigForNextI18next, updateNextConfigForNextIntl, updateNextConfigForNextTranslate, updateNuxtConfig, updateNuxtConfigForNuxtjsI18n, updateViteConfig, updateViteConfigForCompatPlugin, updateViteConfigForVueI18n, writeFileToRoot, writeIntlayerDependencyUpgrades };
|
|
@@ -14,10 +14,11 @@ export type CompatSyncConfig = {
|
|
|
14
14
|
*/
|
|
15
15
|
plugin?: 'json' | 'po';
|
|
16
16
|
/**
|
|
17
|
-
* JSON format matching the compat library's conventions
|
|
18
|
-
* `
|
|
17
|
+
* JSON message format matching the compat library's conventions (or
|
|
18
|
+
* `'intlayer'` for plain Intlayer catalogs). Ignored when `plugin` is `'po'`
|
|
19
|
+
* (PO catalogs are always serialized as gettext).
|
|
19
20
|
*/
|
|
20
|
-
format: 'icu' | 'i18next' | 'vue-i18n';
|
|
21
|
+
format: 'icu' | 'i18next' | 'vue-i18n' | 'intlayer';
|
|
21
22
|
/**
|
|
22
23
|
* Source path template using ${locale} and ${key} placeholders.
|
|
23
24
|
* Rendered as a template literal in the generated config.
|
|
@@ -132,6 +133,11 @@ export type DetectMissingPackagesOptions = {
|
|
|
132
133
|
* The project's development dependencies (from `package.json` `devDependencies`).
|
|
133
134
|
*/
|
|
134
135
|
devDependencies?: Record<string, string>;
|
|
136
|
+
/**
|
|
137
|
+
* Skip `eslint-plugin-intlayer`, even when the project lints. Set when the
|
|
138
|
+
* lint step is not part of the setup.
|
|
139
|
+
*/
|
|
140
|
+
skipLintPlugin?: boolean;
|
|
135
141
|
};
|
|
136
142
|
/** An existing i18n library Intlayer ships a compat adapter for. */
|
|
137
143
|
export type CompatI18nLibrary = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageManager.d.ts","names":[],"sources":["../../../../src/init/utils/packageManager.ts"],"mappings":";;YAMY;;;;;YAMA;;;;;;;EAOV;;;;;EAKA
|
|
1
|
+
{"version":3,"file":"packageManager.d.ts","names":[],"sources":["../../../../src/init/utils/packageManager.ts"],"mappings":";;YAMY;;;;;YAMA;;;;;;;EAOV;;;;;;EAMA;;;;;EAKA;;;;;;;;;;;;;;;EAeA;;;;;;;YAQU;;EAEV;;EAEA;;;;;;;;EAQA;;IAEE;;IAEA;;;;YAKQ;;EAEV;;EAEA;;EAEA;;;;;;EAMA,kBAAkB;;;;;;EAMlB,wBAAwB;;;;;;EAMxB;;;;;;;;qBASW,yBAAyB;;;;;;qBAiDzB,uBAAoB,oBAAsB;;;;;;qBAY1C,kBAAe;;;;;;;YA2ChB;;;;;;EAMV;;;;;;EAMA,eAAe;;;;EAIf,kBAAkB;;;;;EAKlB;;;YAIU;;EAEV;;;;;;EAMA;;;;;EAKA,cAAc;;;;;;;;qBASH,gCAAgC;;;;;qBA+GhC,6BAA6B;;;;;;;;qBAc7B,sCAAmC,aACjC;;;;;;;;;;qBA8BF,4BAAyB,cACtB;;qBAOH;;;;;;;;;qBAUA,kBAAe,cACZ;;;;;;;;;;;qBAiBH,iBAAc,cAAkB;qBAIhC,gCAA6B,iBACvB,wBAAsB,UAC9B,iCACR;;;;;qBAyZU,kBAAe,iBACX,oBACG,gBACF,gBAAc;;;;;;;;;;qBAgBnB,wBAAqB;;;;;;;;qBAarB,mBAAgB;;;;;;qBAahB,oBAAiB,iBACb,gBACC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { Platform } from "../installSkills/index.js";
|
|
2
2
|
//#region src/installMCP/installMCP.d.ts
|
|
3
3
|
export type MCPTransport = 'stdio' | 'sse';
|
|
4
|
+
/** Transports accepted by `intlayer init mcp --transport`. */
|
|
5
|
+
export declare const MCP_TRANSPORTS: MCPTransport[];
|
|
4
6
|
/**
|
|
5
7
|
* Installs the Intlayer MCP server configuration for a specific platform.
|
|
8
|
+
* Every platform is configured at the project level (Claude Code included,
|
|
9
|
+
* through `.mcp.json`), so nothing outside the project is modified.
|
|
6
10
|
*/
|
|
7
11
|
export declare const installMCP: (projectRoot: string, platform: Platform, transport: MCPTransport) => Promise<string>;
|
|
8
12
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installMCP.d.ts","names":[],"sources":["../../../src/installMCP/installMCP.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"installMCP.d.ts","names":[],"sources":["../../../src/installMCP/installMCP.ts"],"mappings":";;YAIY;;qBAGC,gBAAgB;;;;;;qBA4DhB,aAAU,qBACF,UACT,UAAQ,WACP,iBACV"}
|
|
@@ -46,6 +46,12 @@ export interface PlatformMetadata {
|
|
|
46
46
|
export declare const PLATFORMS_METADATA: Record<string, PlatformMetadata>;
|
|
47
47
|
export type Platform = keyof typeof PLATFORMS_METADATA;
|
|
48
48
|
export declare const PLATFORMS: Platform[];
|
|
49
|
+
/**
|
|
50
|
+
* Detects the AI platform in use. The environment of the running tool wins;
|
|
51
|
+
* otherwise the first platform whose config folder (`.claude`, `.cursor`…)
|
|
52
|
+
* exists in the project root is returned.
|
|
53
|
+
*/
|
|
54
|
+
export declare const detectPlatform: (projectRoot: string) => Platform | undefined;
|
|
49
55
|
/**
|
|
50
56
|
* Installs skills using the "Agent Skills" directory standard.
|
|
51
57
|
* Standard: <PROJECT_ROOT>/<CONFIG_DIR>/skills/<SKILL_NAME>/SKILL.md
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/installSkills/index.ts"],"mappings":";;;;qBASa;WACX;WACA;WACA;WAEA;WACA;WACA;WAEA;WAEA;WACA;WACA;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;YAIU,qBAAqB;qBAEpB,QAAyC;;;;;;;qBAqFzC,mBAAgB,cACb,2BACb;iBAUc;EACf;EACA;EACA;;;;;qBAMW,oBAAoB,eAAe;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/installSkills/index.ts"],"mappings":";;;;qBASa;WACX;WACA;WACA;WAEA;WACA;WACA;WAEA;WAEA;WACA;WACA;WAEA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;WACA;;YAIU,qBAAqB;qBAEpB,QAAyC;;;;;;;qBAqFzC,mBAAgB,cACb,2BACb;iBAUc;EACf;EACA;EACA;;;;;qBAMW,oBAAoB,eAAe;YA8JpC,wBAAwB;qBAEvB,WAA+C;;;;;;qBA4B/C,iBAAc,wBAA0B;;;;;qBAuHxC,gBAAa,qBACL,UACT,UAAQ,QACV,YACP"}
|
|
@@ -8,7 +8,7 @@ import { IntlayerConfig } from "@intlayer/types/config";
|
|
|
8
8
|
export declare const listDictionaries: (configuration: IntlayerConfig) => Promise<string[]>;
|
|
9
9
|
export declare const listDictionariesWithStats: (configuration: IntlayerConfig) => Promise<{
|
|
10
10
|
path: string;
|
|
11
|
-
stats: import("fs").Stats;
|
|
11
|
+
stats: import("node:fs").Stats;
|
|
12
12
|
}[]>;
|
|
13
13
|
//#endregion
|
|
14
14
|
//# sourceMappingURL=listDictionariesPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listDictionariesPath.d.ts","names":[],"sources":["../../src/listDictionariesPath.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"listDictionariesPath.d.ts","names":[],"sources":["../../src/listDictionariesPath.ts"],"mappings":";;;;;;;qBAWa,mBAAgB,eACZ,mBACd;qBAsCU,4BAAyB,eACrB,mBAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DictionariesStatus } from "./loadDictionaries.js";
|
|
2
2
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
3
|
-
import { DictionaryAPI } from "@intlayer/
|
|
3
|
+
import { DictionaryAPI } from "@intlayer/api";
|
|
4
4
|
//#region src/loadDictionaries/loadRemoteDictionaries.d.ts
|
|
5
5
|
export declare const formatDistantDictionaries: (dictionaries: (DictionaryAPI | Dictionary)[]) => Dictionary[];
|
|
6
6
|
export declare const loadRemoteDictionaries: (configuration?: import("@intlayer/types").IntlayerConfig, onStatusUpdate?: (status: DictionariesStatus[]) => void, options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadRemoteDictionaries.d.ts","names":[],"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"loadRemoteDictionaries.d.ts","names":[],"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"mappings":";;;;qBAWa,4BAAyB,eACrB,gBAAgB,kBAC9B;qBAOU,yBAAsB,0CAAA,gBAAA,kBAEf,QAAQ,+BAA6B;EAErD;EACA;EACA,WAAW,OAAO;MAEnB,QAAQ"}
|
|
@@ -7,18 +7,18 @@ import { IntlayerConfig } from "@intlayer/types/config";
|
|
|
7
7
|
* patterns, negation patterns embedded in `traversePattern`, and optional
|
|
8
8
|
* dot-file inclusion.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* `codeDir` entries are more precise than the exclude patterns: a `codeDir`
|
|
11
|
+
* inside an excluded directory (e.g. a design-system `dist` or a package in
|
|
12
|
+
* `node_modules`) is scanned as its own root, so the exclusion only applies
|
|
13
|
+
* below it.
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* // Single root with excludes
|
|
17
17
|
* const files = buildComponentFilesList(config);
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
|
-
* // Design-system
|
|
21
|
-
* // intlayer.config.ts: { content: { codeDir: ['node_modules/my-ds/
|
|
20
|
+
* // Design-system build output is still scanned
|
|
21
|
+
* // intlayer.config.ts: { content: { codeDir: ['node_modules/my-ds/dist'] } }
|
|
22
22
|
* const files = buildComponentFilesList(config);
|
|
23
23
|
*/
|
|
24
24
|
export declare const buildComponentFilesList: (config: IntlayerConfig, excludePattern?: string[]) => string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildComponentFilesList.d.ts","names":[],"sources":["../../../src/utils/buildComponentFilesList.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"buildComponentFilesList.d.ts","names":[],"sources":["../../../src/utils/buildComponentFilesList.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;qBAwEa,0BAAuB,QAC1B,gBAAc"}
|