Can developer customize std:Packages ?
like paths of tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": ".",
"paths": {
"std:UserBaseLibs": ["http://npmjs.com/path/project"]
}
}
then we can convenient use std:UserBaseLibs.
I think this is a little strange that allow the developer to custom the standard library. It's should be predefined at the platform level or language spec level.
I don't think it's strange; polyfills/shims do that all the time.
But polyfills and shims are implementing something that in the spec. If you define your own std lib, this is likely going to make your own dialect of JavaScript. Why not just import "libname"?
From the point of view of an engine that lacks a new part of the standard, the polyfill/shim is indeed implementing their own std lib.
So just extends this proposal, make it like this syntax?
https://developers.google.com/web/fundamentals/primers/modules#layered-apis
The
<script
type="module"
src="std:virtual-scroller|https://example.com/virtual-scroller.mjs"
></script>
Or we can extend it use import.std.set("some-proposal-0-stdlib", "https://unpkg.org/....")?
- Add custom resolver support to
import - In userland, implement custom resolver and make
std:resolve to whatever you want
?
Related proposal: https://github.com/domenic/package-name-maps/blob/url-based/README.md by @domenic