Skip to content
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

Interested in adding esmurl to @unjs #3

Closed
jcbhmr opened this issue Jul 8, 2023 · 0 comments
Closed

Interested in adding esmurl to @unjs #3

jcbhmr opened this issue Jul 8, 2023 · 0 comments

Comments

@jcbhmr
Copy link

jcbhmr commented Jul 8, 2023

I don't know if this is the right place to ask/inquire about this. 😬

https://github.com/jcbhmr/esmurl
👆 I made that and I'm "shopping" for a larger organization to transfer it to. I came across @unjs. I don't know if @unjs is accepting new packages or what the procedure is or literally anything at all. 🤷‍♂️ Hence the discussion!

This is what it lets you do:

// https://cdn.com/lib.js         👇 This import.meta is serialized into the self-contained URL
const workerURL = esmurl(import.meta, async () => {
  //                                👇 This is properly resolved to https://cdn.com/more.js even
  //                                      though it's being stringified and put into a blob: URL
  const moreLibCode = await import("./more.js")
  onmessage = e => postMessage(moreLibCode.compute(e.data))
})
const worker = new Worker(workerURL, { type: "module" })

And it even works with bundlers! It does so by regex-magicing all the import() into __import__() and then at runtime resolving any __import__("./more.js") via the user-provided import.meta object's importMeta.url

Why do I want to foist this onto an organization? If I am on vacation or something, somebody else can still do stuff! ...and I think it's a cool way to immediately boost eyes on such an infant project. 😅

see also #2

@jcbhmr jcbhmr changed the title Interested in adding repo to @unjs Interested in adding esmurl to @unjs Jul 8, 2023
@jcbhmr jcbhmr closed this as not planned Won't fix, can't repro, duplicate, stale Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant