Skip to content

Commit

Permalink
Update PackageVersionFileController.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
i18nsite authored Oct 18, 2024
1 parent d0ecb02 commit a650902
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions app/port/controller/PackageVersionFileController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,28 @@ export class PackageVersionFileController extends AbstractController {
}

@HTTPMethod({
path: `/:fullname@:versionSpec/:path(.+)`,
path: `/npm/:fullname@:versionSpec/:path(.+)`,
method: HTTPMethodEnum.GET,
})
async rawNpm(@Context() ctx: EggContext,
async rawNpmVer(@Context() ctx: EggContext,
@HTTPParam() fullname: string,
@HTTPParam() versionSpec: string,
@HTTPParam() path: string,
@HTTPQuery() meta: string) {
return await this.raw(ctx, fullname, versionSpec, path, meta);
}

@HTTPMethod({
path: `/npm/:fullname/:path(.+)`,
method: HTTPMethodEnum.GET,
})
async rawNpm(@Context() ctx: EggContext,
@HTTPParam() fullname: string,
@HTTPParam() path: string,
@HTTPQuery() meta: string) {
return await this.raw(ctx, fullname, "latest", path, meta);
}

/**
* compatibility with unpkg
* 1. try to match alias entry. e.g. accessing `index.js` or `index.json` using /index
Expand Down

0 comments on commit a650902

Please sign in to comment.