Replies: 1 comment 1 reply
-
ok wow thats some funny timing. The deno 1.45 release introduced "workspaces". It seems like this could possibly solve my issue if I am able to import from a package within itself (and then have jsr publish resolve those back into usable imports. I was able to get a basic version of this working, the general jist is this: // ./deno.jsonc
{
"workspaces": {
"members": ["./packages/core", "./packages/cli"]
}
} // ./packages/core/deno.jsonc
{
"name": "@forager/core",
"exports": {
".": "./src/mod.ts",
"./errors.ts": "./src/errors.ts"
}
} // ./packages/core/lib/util.ts
export * as errors from '@forager/core/errors.ts' I havent yet proven if this will do the right 'magic' when this publishes to jsr to unwind these kinds of exports. Two pain points here though:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
per the deno docs import maps are currently only usable by "applications" in deno. This means that any library development must stick to a
deps.ts
pattern, and not use import maps for any other niceties. For me personally, that main nicety is the ability to use project oriented root paths, which makes refactors a lot easier to manage.I feel that it should still be possible for library maintainers to use import maps since they offer a lot of value to development. A possible solution to this problem is a transpilation between deno publish and jsr that resolves import maps back into bare specifiers. Something like the following:
where the argument is optional, defaulting to deno.json imports if they exist. Then an import map specifier like so:
and a source file like this:
might resolve to something like this:
I came to this conclusion because I cant really see a world where changing the import map spec to support nest is something that could be solved in any reasonable timeline since its tied into web specifications. The only possible downside to this approach I see is that code that is retrieved from jsr isnt exactly the same as the code that it references on a github commit, which possible would break the provenance that jsr offers as one of its core advantages over npm
Beta Was this translation helpful? Give feedback.
All reactions