-
Notifications
You must be signed in to change notification settings - Fork 365
Add support for custom CDN URLs #16885
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
Conversation
| }; | ||
| } | ||
| if (cdn instanceof Object) { | ||
| if (cdn.requiresExactVersion && moduleVersion.startsWith('^')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this PR, how about we change the format of the package json to just strings, jsdelivr.com and unpkg.com and for these we look at the value and hard code the requireExactVersion and requiresExtension.
If its something else, then we leave it as some default.
However this might not work for mirror jsdeliv sites. then again, we haven't had any requests for mirrored sites, hence I'm inclined to avoid having a more complex package.json and go with just strings.
What to you think?
Does this work for the site you're using?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking a look!
Does this work for the site you're using?
No, currently the CDN I target only supports jsdelivr.com format - but I am checking if this can be changed. Out of big CDNs cdnjs.com also requires an exact version and .js suffix (and compared to jsdelivr.com does not have redirects at all), although to support cdnjs the format should also include / instead of @ for version specifier.
Another option would be giving some kind of a format string, like:
https://cdnjs.cloudflare.com/ajax/libs/<library>/<version>/<file>
This would keep the package.json to accept only strings, while allowing for a degree of customization. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Done in 21e9798. For strings I followed the pattern in vscode-pull-request-github and while at it I fixed a typo over there (microsoft/vscode-pull-request-github#7540).
|
@krassowski thank you very much, this is great |


Fixes #16875
The completion support in JSON editor is preserved:
Invalid URLs are validated:
Custom jsdelivr style CDNs are supported:
Markdown description includes explanation for the supported template values:
Things I am not sure about: