pkgxdev / libpkgx

`import`… but with pkging powers
https://npmjs.com/libpkgx
Apache License 2.0
62 stars 11 forks source link

fix external deps #17

Closed jhheider closed 1 year ago

jhheider commented 1 year ago

This isn't exactly pretty, but it fixes this problem:

echo 'import * as tea from "https://raw.github.com/teaxyz/lib/v0.3.0/mod.ts"' >foo.ts && deno check --unstable foo.ts
error: Relative import path "is-what" not prefixed with / or ./ or ../
    at https://raw.githubusercontent.com/teaxyz/lib/v0.3.0/src/utils/semver.ts:1:35

echo 'import * as tea from "../tea/lib/mod.ts"' >foo.ts && deno check --unstable foo.ts
Check file:///Users/jacob/foo/foo.ts

Basically, import maps don't externalize, meaning any consumer needs to provide our deps... that part seems deeply incorrect.

jhheider commented 1 year ago

Looking at the tests... I'm not actually sure how it worked before...

mxcl commented 1 year ago

I don't think it's unreasonable that consumers of the deno portion are expected to add our deps to their import map.

So this isn’t so much a fix as an opinion on how we should expect deno users to use libtea.

All the same though, this is more “just works” for sure.

Looking at the tests... I'm not actually sure how it worked before...

the import map is in deno.json

mxcl commented 1 year ago

quite possibly we should just do this.

one reason I am hesitant is it allows eg. tea/cli to define which version of eg. is-what is used rather than potentially having multiple.

I dunno. maybe that's a dumb concern.

jhheider commented 1 year ago

It was an unexpected outcome for me, certainly. I don't know off the top of my head of another Deno dep that requires side dependencies in this way.

mxcl commented 1 year ago

I don't know off the top of my head of another Deno dep that requires side dependencies in this way.

yeah good point. ugh.

mxcl commented 1 year ago

k, I'm fixing this