proposal-built-in-modules icon indicating copy to clipboard operation
proposal-built-in-modules copied to clipboard

Can developer customize std:Packages ?

Open Aqours opened this issue 7 years ago • 7 comments

like paths of tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "std:UserBaseLibs": ["http://npmjs.com/path/project"]
    }
}

then we can convenient use std:UserBaseLibs.

Aqours avatar Aug 01 '18 03:08 Aqours

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.

Jack-Works avatar Aug 01 '18 07:08 Jack-Works

I don't think it's strange; polyfills/shims do that all the time.

ljharb avatar Aug 01 '18 07:08 ljharb

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"?

Jack-Works avatar Aug 01 '18 08:08 Jack-Works

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.

ljharb avatar Aug 01 '18 15:08 ljharb

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/....")?

Jack-Works avatar Aug 02 '18 01:08 Jack-Works

  1. Add custom resolver support to import
  2. In userland, implement custom resolver and make std: resolve to whatever you want

?

AlicanC avatar Sep 25 '18 21:09 AlicanC

Related proposal: https://github.com/domenic/package-name-maps/blob/url-based/README.md by @domenic

littledan avatar Oct 09 '18 19:10 littledan