{"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<BaseContext, 'appDir' | 'runtimeDir'>): Promise<AppFile | undefined> => {\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,eAAAA,GAAkB;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,eAAAA,CAAiB;AAClC,QAAA,MAAMK,WAAWC,IAAAA,CAAKC,IAAI,CAACJ,MAAAA,EAAQ,OAAO,OAAA,EAASC,IAAAA,CAAAA;QAEnD,IAAI,MAAMI,WAAWH,QAAAA,CAAAA,EAAW;YAC9B,OAAO;gBACLC,IAAAA,EAAMD,QAAAA;AACNI,gBAAAA,UAAAA,EAAYC,6BAAAA,CAA8BJ,IAAAA,CAAKK,QAAQ,CAACT,UAAAA,EAAYG,QAAAA,CAAAA;AACtE,aAAA;AACF,QAAA;AACF,IAAA;IAEA,OAAOO,SAAAA;AACT;;;;"}