{"version":3,"file":"manifest.mjs","names":[],"sources":["../../../../src/middlewares/web/utils/manifest.ts"],"sourcesContent":["import buildDebug from 'debug';\n\nexport type Manifest = {\n  // goes on first place at the header\n  ico: string;\n  css: string[];\n  js: string[];\n};\n\nconst debug = buildDebug('verdaccio:middleware:web:render:manifest');\n\nexport function getManifestValue(\n  manifestItems: string[],\n  manifest,\n  basePath: string = ''\n): string[] {\n  return manifestItems?.map((item) => {\n    debug('resolve item %o', item);\n    const resolvedItem = `${stripTrailingSlash(basePath)}/${stripLeadingSlash(manifest[item])}`;\n    debug('resolved item %o', resolvedItem);\n    return resolvedItem;\n  });\n}\n\nfunction stripTrailingSlash(path: string): string {\n  return path.replace(/\\/$/, '');\n}\n\nfunction stripLeadingSlash(path: string): string {\n  return path.replace(/^\\//, '');\n}\n"],"mappings":";;AASA,IAAM,QAAQ,WAAW,0CAA0C;AAEnE,SAAgB,iBACd,eACA,UACA,WAAmB,IACT;CACV,OAAO,eAAe,KAAK,SAAS;EAClC,MAAM,mBAAmB,IAAI;EAC7B,MAAM,eAAe,GAAG,mBAAmB,QAAQ,EAAE,GAAG,kBAAkB,SAAS,KAAK;EACxF,MAAM,oBAAoB,YAAY;EACtC,OAAO;CACT,CAAC;AACH;AAEA,SAAS,mBAAmB,MAAsB;CAChD,OAAO,KAAK,QAAQ,OAAO,EAAE;AAC/B;AAEA,SAAS,kBAAkB,MAAsB;CAC/C,OAAO,KAAK,QAAQ,OAAO,EAAE;AAC/B"}