@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
1 lines • 3.23 kB
Source Map (JSON)
{"version":3,"file":"generateConfigurationContent.cjs","names":[],"sources":["../../../src/writeConfiguration/generateConfigurationContent.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types/config';\n\nexport const generateConfigurationContent = (\n configuration: IntlayerConfig,\n format: 'cjs' | 'esm'\n): string => {\n const {\n internationalization,\n routing,\n editor,\n log,\n system,\n content,\n ai,\n dictionary,\n build,\n compiler,\n } = configuration;\n\n let fileContent = '';\n\n fileContent += `const internationalization = ${JSON.stringify(internationalization, null, 2)};\\n`;\n fileContent += `const routing = ${JSON.stringify(routing, null, 2)};\\n`;\n fileContent += `const editor = ${JSON.stringify(editor, null, 2)};\\n`;\n fileContent += `const log = ${JSON.stringify(log, null, 2)};\\n`;\n fileContent += `const system = ${JSON.stringify(system, null, 2)};\\n`;\n fileContent += `const content = ${JSON.stringify(content, null, 2)};\\n`;\n fileContent += `const ai = ${JSON.stringify(ai, null, 2)};\\n`;\n fileContent += `const dictionary = ${JSON.stringify(dictionary, null, 2)};\\n`;\n fileContent += `const build = ${JSON.stringify(build, null, 2)};\\n`;\n fileContent += `const compiler = ${JSON.stringify(compiler, null, 2)};\\n`;\n fileContent += `const configuration = { internationalization, routing, editor, log, system, content, ai, dictionary, build, compiler };\\n`;\n\n if (format === 'esm') {\n fileContent += `\\nexport { internationalization, routing, editor, log, system, content, ai, dictionary, build, compiler, configuration };\\n`;\n fileContent += `export default configuration;\\n`;\n } else {\n fileContent += `\\nmodule.exports.internationalization = internationalization;\\n`;\n fileContent += `module.exports.routing = routing;\\n`;\n fileContent += `module.exports.editor = editor;\\n`;\n fileContent += `module.exports.log = log;\\n`;\n fileContent += `module.exports.system = system;\\n`;\n fileContent += `module.exports.content = content;\\n`;\n fileContent += `module.exports.ai = ai;\\n`;\n fileContent += `module.exports.dictionary = dictionary;\\n`;\n fileContent += `module.exports.build = build;\\n`;\n fileContent += `module.exports.compiler = compiler;\\n`;\n fileContent += `module.exports = configuration;\\n`;\n }\n\n return fileContent;\n};\n"],"mappings":";;;AAEA,MAAa,gCACX,eACA,WACW;CACX,MAAM,EACJ,sBACA,SACA,QACA,KACA,QACA,SACA,IACA,YACA,OACA,aACE;CAEJ,IAAI,cAAc;CAElB,eAAe,gCAAgC,KAAK,UAAU,sBAAsB,MAAM,CAAC,EAAE;CAC7F,eAAe,mBAAmB,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE;CACnE,eAAe,kBAAkB,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE;CACjE,eAAe,eAAe,KAAK,UAAU,KAAK,MAAM,CAAC,EAAE;CAC3D,eAAe,kBAAkB,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE;CACjE,eAAe,mBAAmB,KAAK,UAAU,SAAS,MAAM,CAAC,EAAE;CACnE,eAAe,cAAc,KAAK,UAAU,IAAI,MAAM,CAAC,EAAE;CACzD,eAAe,sBAAsB,KAAK,UAAU,YAAY,MAAM,CAAC,EAAE;CACzE,eAAe,iBAAiB,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE;CAC/D,eAAe,oBAAoB,KAAK,UAAU,UAAU,MAAM,CAAC,EAAE;CACrE,eAAe;CAEf,IAAI,WAAW,OAAO;EACpB,eAAe;EACf,eAAe;CACjB,OAAO;EACL,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;EACf,eAAe;CACjB;CAEA,OAAO;AACT"}