-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨[Feature request] Support for unpkg-like auto-redirection capabilities #674
Comments
我们已经看到你的反馈,如果是功能缺陷,可以提供一下重现该问题的方式;如果是新功能需求,我们会尽快加入讨论。同时我们非常期待你可以加入我们的贡献者行列,让项目可以长期可持续发展。 |
https://www.yuque.com/egg/cnpm/files 目前支持的 files api,可以看看。 |
$ curl https://registry.npmmirror.com/@opentiny/vue-theme/~3.11/files/theme-tool.js
Redirecting to <a href="/@opentiny/vue-theme/3.11.6/files/theme-tool.js">/@opentiny/vue-theme/3.11.6/files/theme-tool.js</a>.% 看起来是支持的 |
是请求 https://registry.npmmirror.com/@opentiny/vue-theme/~3.11/files/theme-tool 的时候,重定向到 https://registry.npmmirror.com/@opentiny/vue-theme/~3.11/files/theme-tool.js |
importmap 是配置在前端,由浏览器来支持的吧? |
看了下,应该不是 importmap,这是在浏览器侧就支持转换了,更像是后缀名的自动补齐: https://unpkg.com/@opentiny/vue-theme@3.14.1/theme-tool → https://unpkg.com/@opentiny/vue-theme@3.14.1/theme-tool.js |
去看下 unpkg 的文档是不是有类似的约定? |
@chilingling 直接来 PR 吧~ |
我试试 |
closes #674 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Implemented a feature to handle compatibility with unpkg by searching for and redirecting to possible file entries if the requested file is not found. - **Tests** - Added a new test case to ensure the redirection to possible file entries functions correctly. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
@chilingling 感谢开源贡献!已经成功 |
【特性描述】
支持类似 unpkg 的自动重定向能力。
如:
https://unpkg.com/@opentiny/vue-theme@~3.11/theme-tool -> https://unpkg.com/@opentiny/vue-theme@3.11.6/theme-tool.js
https://unpkg.com/@opentiny/vue-theme@~3.11/theme -> https://unpkg.com/@opentiny/vue-theme@3.11.6/theme/index.js
【使用场景】
在 import map 相关的场景中使用。比如:
importmap:
使用:
即支持 MDN 中 import map 提到的路径前缀 并自动重定向能力。
感谢 ❤
The text was updated successfully, but these errors were encountered: