Coder Social home page Coder Social logo

Comments (4)

jedel1043 avatar jedel1043 commented on April 30, 2024

Ah, that's easy to fix! We just need to add a path property to the Module struct (or possibly only to SourceTextModule, but I could see it being useful to set a synthetic module to a fake path), and have it being set at creation time.

Should probably be a good idea to also add this to Source, since it should be a pretty straightforward change. Then, we could expose a Referrer::path() -> Option<&Path> method for ease of use.

from boa.

jedel1043 avatar jedel1043 commented on April 30, 2024

To clarify, the exact implementation steps would be:

  1. Expose the path property of the Source type with a getter.
  2. Modify ModuleRepr and source::Inner to have a path: PathBuf property, and set it on their respective parse methods from the path property of Source.
  3. Add a new path method to Referrer that gets a reference to the path property of Source and Module.

from boa.

hansl avatar hansl commented on April 30, 2024

So it would be the responsibility of the ModuleLoader to implement (or not) resolution of specifiers?

from boa.

jedel1043 avatar jedel1043 commented on April 30, 2024

Yes, simply because the core engine shouldn't have a notion of a "filesystem", since that would break the sandboxing we have in place for it. Implementors of ModuleLoader can decide if they want to preserve the sandbox or if they want to allow filesystem calls.

from boa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.