diff --git a/app/port/controller/PackageVersionFileController.ts b/app/port/controller/PackageVersionFileController.ts index d68db1ed..9e2b0cee 100644 --- a/app/port/controller/PackageVersionFileController.ts +++ b/app/port/controller/PackageVersionFileController.ts @@ -170,6 +170,23 @@ export class PackageVersionFileController extends AbstractController { } return await this.distRepository.getDistStream(file.dist); } + + @HTTPMethod({ + path: `/npm/:fullname(${FULLNAME_REG_STRING})/:path(.+)`, + method: HTTPMethodEnum.GET, + }) + async rawNpmVer(@Context() ctx: EggContext, + @HTTPParam() fullname: string, + @HTTPParam() path: string, + @HTTPQuery() meta: string) { + let ver = fullname.slice(1).split('@')[1]; + if(ver){ + fullname = fullname.slice(0,-1-ver.length) + }else{ + ver = 'latest' + } + return await this.raw(ctx, fullname, ver, path, meta); + } /** * compatibility with unpkg