{"version":3,"file":"admin-customisations.mjs","sources":["../../../../src/node/core/admin-customisations.ts"],"sourcesContent":["import path from 'node:path';\nimport { convertSystemPathToModulePath, pathExists } from './files';\nimport type { BaseContext } from '../types';\n\nconst ADMIN_APP_FILES = ['app.js', 'app.mjs', 'app.ts', 'app.jsx', 'app.tsx'];\n\ninterface AdminCustomisations {\n config?: {\n locales?: string[];\n };\n bootstrap?: (...args: any[]) => any;\n}\n\ninterface AppFile {\n /**\n * The system path to the file\n */\n path: string;\n /**\n * The module path to the file i.e. how you would import it\n */\n modulePath: string;\n}\n\nconst loadUserAppFile = async ({\n runtimeDir,\n appDir,\n}: Pick): Promise => {\n for (const file of ADMIN_APP_FILES) {\n const filePath = path.join(appDir, 'src', 'admin', file);\n\n if (await pathExists(filePath)) {\n return {\n path: filePath,\n modulePath: convertSystemPathToModulePath(path.relative(runtimeDir, filePath)),\n };\n }\n }\n\n return undefined;\n};\n\nexport { loadUserAppFile };\nexport type { AdminCustomisations, AppFile };\n"],"names":["ADMIN_APP_FILES","loadUserAppFile","runtimeDir","appDir","file","filePath","path","join","pathExists","modulePath","convertSystemPathToModulePath","relative","undefined"],"mappings":";;;AAIA,MAAMA,eAAkB,GAAA;AAAC,IAAA,QAAA;AAAU,IAAA,SAAA;AAAW,IAAA,QAAA;AAAU,IAAA,SAAA;AAAW,IAAA;AAAU,CAAA;AAoB7E,MAAMC,kBAAkB,OAAO,EAC7BC,UAAU,EACVC,MAAM,EACqC,GAAA;IAC3C,KAAK,MAAMC,QAAQJ,eAAiB,CAAA;AAClC,QAAA,MAAMK,WAAWC,IAAKC,CAAAA,IAAI,CAACJ,MAAAA,EAAQ,OAAO,OAASC,EAAAA,IAAAA,CAAAA;QAEnD,IAAI,MAAMI,WAAWH,QAAW,CAAA,EAAA;YAC9B,OAAO;gBACLC,IAAMD,EAAAA,QAAAA;AACNI,gBAAAA,UAAAA,EAAYC,6BAA8BJ,CAAAA,IAAAA,CAAKK,QAAQ,CAACT,UAAYG,EAAAA,QAAAA,CAAAA;AACtE,aAAA;AACF;AACF;IAEA,OAAOO,SAAAA;AACT;;;;"}