{"version":3,"file":"admin-vite-aliases.mjs","sources":["../../../../src/node/core/admin-vite-aliases.ts"],"sourcesContent":["import { ADMIN_VITE_ALIAS_MODULES, ADMIN_VITE_SINGLETON_MODULES } from './admin-vite-alias-modules';\nimport { getModulePath, getModulePathFrom } from './resolve-module';\n\n/**\n * Vite resolve.alias entries for the admin bundle.\n *\n * Admin alias modules resolve from @strapi/admin's closure. CodeMirror singletons resolve\n * from @strapi/design-system's closure (the real consumer), tolerantly: optional/transitive\n * CodeMirror packages that cannot be resolved are skipped rather than crashing the build\n *\n * @internal\n */\nexport const buildAdminViteResolveAliases = (): Record<string, string> =>\n  Object.fromEntries([\n    ...ADMIN_VITE_ALIAS_MODULES.map((mod) => [mod, getModulePath(mod)] as const),\n    ...buildSingletonAliasEntries(),\n  ]);\n\n/**\n * Resolve the CodeMirror singleton aliases from @strapi/design-system's closure, skipping any\n * package that cannot be resolved (e.g. optional or transitive CodeMirror packages not installed).\n *\n * @internal\n */\nexport const buildSingletonAliasEntries = (): Array<readonly [string, string]> => {\n  const entries: Array<readonly [string, string]> = [];\n\n  for (const mod of ADMIN_VITE_SINGLETON_MODULES) {\n    try {\n      entries.push([mod, getModulePathFrom('@strapi/design-system', mod)] as const);\n    } catch {\n      // Optional/transitive CodeMirror package not resolvable here — skip it rather than\n      // throwing, so a missing singleton never breaks the admin build.\n    }\n  }\n\n  return entries;\n};\n\n/**\n * Names of the CodeMirror singletons that actually resolve from @strapi/design-system's closure.\n *\n * Mirrors buildSingletonAliasEntries so optimizeDeps.include stays in lockstep with resolve.alias:\n * a singleton that cannot be aliased must not be forced into pre-bundling either, or Vite chokes\n * on an unresolvable optimizeDeps.include entry.\n *\n * @internal\n */\nexport const getResolvableSingletonModules = (): string[] =>\n  buildSingletonAliasEntries().map(([mod]) => mod);\n"],"names":["buildAdminViteResolveAliases","Object","fromEntries","ADMIN_VITE_ALIAS_MODULES","map","mod","getModulePath","buildSingletonAliasEntries","entries","ADMIN_VITE_SINGLETON_MODULES","push","getModulePathFrom","getResolvableSingletonModules"],"mappings":";;;;AAGA;;;;;;;;AAQC,IACM,MAAMA,4BAAAA,GAA+B,IAC1CC,MAAAA,CAAOC,WAAW,CAAC;WACdC,wBAAAA,CAAyBC,GAAG,CAAC,CAACC,GAAAA,GAAQ;AAACA,gBAAAA,GAAAA;gBAAKC,aAAAA,CAAcD,GAAAA;AAAK,aAAA,CAAA;AAC/DE,QAAAA,GAAAA,0BAAAA;KACJ;AAEH;;;;;UAMaA,0BAAAA,GAA6B,IAAA;AACxC,IAAA,MAAMC,UAA4C,EAAE;IAEpD,KAAK,MAAMH,OAAOI,4BAAAA,CAA8B;QAC9C,IAAI;AACFD,YAAAA,OAAAA,CAAQE,IAAI,CAAC;AAACL,gBAAAA,GAAAA;AAAKM,gBAAAA,iBAAAA,CAAkB,uBAAA,EAAyBN,GAAAA;AAAK,aAAA,CAAA;AACrE,QAAA,CAAA,CAAE,OAAM;;;AAGR,QAAA;AACF,IAAA;IAEA,OAAOG,OAAAA;AACT;AAEA;;;;;;;;IASO,MAAMI,6BAAAA,GAAgC,IAC3CL,0BAAAA,EAAAA,CAA6BH,GAAG,CAAC,CAAC,CAACC,GAAAA,CAAI,GAAKA,GAAAA;;;;"}