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

Is there a way to get the content of the asset without calling import()? #18

Open
justinmchase opened this issue Oct 12, 2022 · 1 comment

Comments

@justinmchase
Copy link

Suppose I just wanted to get the string or bytes of the asset and then interpret it, how would that be done?

I'm just imagining this as a way to dynamically compile DSLs or custom languages such as:

example.js
import { ExampleLang } from "./lang.js"
import asset Foo from "./foo.ex"

const lang = new ExampleLang()
export const foo = await lang.compile(Foo);

lang.js

export class ExampleLang {
  async compile(asset) {
    const content = fetch(asset) // how do you do this?
    const result = interpret(content);
    return result
  }
}

Is this within the scope of this proposal?

@dead-claudia
Copy link

Implicitly, yes, for several of the examples depend on it. Would like to see a few more details on this, though - seems nonsensical to just delegate to fetch for this.

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

2 participants