WARNING: This is a pre-release that might be broken in some ways. Stay tuned.
This tool takes as input a TypeScript codebase that was meant to target node and/or the web and spits out a modified version of the source files that are ready to be deployed as a Deno module.
A way to import node modules in Deno projects. For that purpose you can try CommonJS module Loading
Modules that have been made cross-runtime using Denoify:
At this stage of it's development, Denoify set quite restrictive requirements:
@types/node
installed to use your module ? If yes then, unfortunately, your module is not denoifiable as it is. Even if you are allowed to use (some, not all) node builtins such as fs
, path
or event
you will need to remove all Node reference from your exposed API before you can use Denoify. You can't for example expose a class that extends EventEmitter
or if you do you will have to export a type definition for EventEmitter
. Note that Denoify work recursively meaning that you can fork your dependencies repo and Denoify them yourself.
However, depending on how deep your dependency tree goes it might not be feasible.
These are the milestone that, when achieved, will enable Denoify to work transparently on most NPM modules:
require()
and fs
( synchronously or not ) for dynamically accessing files of the project ( files that sits in the node_modules directory in Node ). Note that fs
for the most part is already functional but the problem arises when trying to access files that are not present on the disk. In Deno unlike in Node, the packages files are not present on the disk at runtime. Fetching them synchronously is not a satisfactory solution for obvious reasons. We can do it the way Browserify is doing it but this approach works only if the paths can be analyzed statically. The solution would be to provide a way for the user to define the files that are susceptible to be accessed synchronously at runtime or by default pre-loading everything in a single files if the project is using require
or fs
. DefinitelyTyped
( also applicable for @types/node
). Check out this repo to see in practice how to set up Denoify in your project.
denoify_ci is a template repo that automate the boring and tedious tasks of:
package.json
Node
and Deno
version before publishing.