Coder Social home page Coder Social logo

I have a module, now what? about deno_graph HOT 5 OPEN

denoland avatar denoland commented on May 4, 2024
I have a module, now what?

from deno_graph.

Comments (5)

bartlomieju avatar bartlomieju commented on May 4, 2024 1

deno_graph is used for static analysis of the code, it doesn't have functionality to execute code. If you want to execute modules you need to use deno_core crate with ModuleLoader

from deno_graph.

bartlomieju avatar bartlomieju commented on May 4, 2024 1

What I'm trying to do is to essentially import a file which is not typescript or javascript and transpile it on the fly. It seems like that ModuleLoader.load function could handle that but that I'm going to have to make a rust executable and essentially embed deno_core to do it...

I see, there were proposals for JavaScript APIs for loader in deno but they didn't go anywhere: denoland/deno#1739

I'm wondering are there plans to make this load api available in typescript?

Currently not, it's considered low priority at the moment.

Are you open to a PR for the above? It looks like, without really digging into it, that implementing the above Deno.load to be a function which just imlements a ModuleLoader for a createGraph result wouldn't be too hard...

I don't agree, this is going to be very hard to implement, but PRs are always welcome; maybe it will spark another conversation about custom loaders.

from deno_graph.

kitsonk avatar kitsonk commented on May 4, 2024 1

Don't forget, there is a built in module loading functionality that loads code in its own context and is part of the web platform called web workers.

from deno_graph.

justinmchase avatar justinmchase commented on May 4, 2024

Does deno_core not have a typescript module? https://deno.land/x/deno_core

Or, how would one use deno_core.load?

I am looking for something such as:

const specifier = "http://example.foo"
const graph = await denoGraph.createGraph(specifier, {
  load: // custom graph loading, emits js...
})

const { foo } = Deno.load(graph)

from deno_graph.

justinmchase avatar justinmchase commented on May 4, 2024

What I'm trying to do is to essentially import a file which is not typescript or javascript and transpile it on the fly. It seems like that ModuleLoader.load function could handle that but that I'm going to have to make a rust executable and essentially embed deno_core to do it...

I'm wondering are there plans to make this load api available in typescript? Are you open to a PR for the above? It looks like, without really digging into it, that implementing the above Deno.load to be a function which just imlements a ModuleLoader for a createGraph result wouldn't be too hard...

from deno_graph.

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.