{"version":3,"file":"prepare-build-artifacts.mjs","names":[],"sources":["../../../src/libs/compile/prepare-build-artifacts.ts"],"sourcesContent":["import type { Config } from \"../../types/config.js\";\nimport processBuildArtifacts from \"../cli/services/process-build-artifacts.js\";\nimport { createTranslator } from \"../i18n/index.js\";\nimport type { TranslationStore } from \"../i18n/types.js\";\nimport handlePluginRuntimeHooks from \"../plugins/hooks/handle-runtime.js\";\nimport type {\n\tLucidConfigDefinition,\n\tRuntimeBuildArtifacts,\n} from \"../runtime/types.js\";\n\nconst prepareBuildArtifacts = async (props: {\n\tconfig: Config;\n\ttranslationStore: TranslationStore;\n\tdefinition: LucidConfigDefinition;\n\tsilent?: boolean;\n\tconfigPath: string;\n\toutputPath: string;\n\toutputRelativeConfigPath: string;\n\tcustomArtifactTypes?: string[];\n}): Promise<RuntimeBuildArtifacts> => {\n\tconst translate = createTranslator({\n\t\tstore: props.translationStore,\n\t\tlocale: \"en\",\n\t});\n\tconst pluginBuildArtifactsRes = await handlePluginRuntimeHooks({\n\t\tconfig: props.config,\n\t\ttranslationStore: props.translationStore,\n\t\tdefinition: props.definition,\n\t\tsilent: props.silent,\n\t\tconfigPath: props.configPath,\n\t\toutputPath: props.outputPath,\n\t\toutputRelativeConfigPath: props.outputRelativeConfigPath,\n\t});\n\n\tif (pluginBuildArtifactsRes.error || !pluginBuildArtifactsRes.data) {\n\t\tthrow new Error(\n\t\t\ttranslate.english(pluginBuildArtifactsRes.error.message) ??\n\t\t\t\t\"Lucid build failed while preparing plugin artifacts.\",\n\t\t);\n\t}\n\n\treturn processBuildArtifacts({\n\t\tartifacts: pluginBuildArtifactsRes.data,\n\t\toutDir: props.outputPath,\n\t\tsilent: props.silent ?? false,\n\t\tcustomArtifactTypes: props.customArtifactTypes,\n\t});\n};\n\nexport default prepareBuildArtifacts;\n"],"mappings":"uKAUA,MAAM,EAAwB,KAAO,IASC,CACrC,IAAM,EAAY,EAAiB,CAClC,MAAO,EAAM,iBACb,OAAQ,IACT,CAAC,EACK,EAA0B,MAAM,EAAyB,CAC9D,OAAQ,EAAM,OACd,iBAAkB,EAAM,iBACxB,WAAY,EAAM,WAClB,OAAQ,EAAM,OACd,WAAY,EAAM,WAClB,WAAY,EAAM,WAClB,yBAA0B,EAAM,wBACjC,CAAC,EAED,GAAI,EAAwB,OAAS,CAAC,EAAwB,KAC7D,MAAU,MACT,EAAU,QAAQ,EAAwB,MAAM,OAAO,GACtD,sDACF,EAGD,OAAO,EAAsB,CAC5B,UAAW,EAAwB,KACnC,OAAQ,EAAM,WACd,OAAQ,EAAM,QAAU,GACxB,oBAAqB,EAAM,mBAC5B,CAAC,CACF"}