Git Product home page Git Product logo

denoc's Introduction

What is it

denoc is a minimal tool that adds support for Deno to a codebase that targets Node.js. It takes as input a codebase targeting Node.js and produces a Deno compatible version. The setup is explicit, but simple and powerful.

Config

With denoc, the user has full responsiblity of managing their Deno dependencies and to structure their codebase in a way with clean cut APIs where implementations are available for both Node.js and Deno.

Add a denoc field to your package.json:

"denoc": {
  "outDir": "deno_dist",
  "include": ["src", "glob/**/*"],
  "exclude": ["src/ignored.ts", "ignored"],
  "skip": ["node-only-module"],
  "map": {
    "os": "https://deno.land/[email protected]/node/os.ts",
    "src/node1.ts": "src/deno1.ts"
    "src/node2.ts": "https://deno.land/x/deno2.ts",
    "crypto": "src/deno_crypto.ts",
  },
  "copy": ["README.md"],
},
Field Description
outDir Output directory where Deno compatible source files will be emitted
include Array of files/dirs/globs of sources
exclude Array of files/dirs/globs that negates include. Import statements for these files will be ignored unless mapped to another file (see dependency mapping)
files Array of source files (use as an alternative for include/exclude)
allow Array of dependencies that will be forwarded (for example dependencies used in a mapped alternative local source file)
skip Array of dependencies that will be skipped (for example modules exporting objects available in the Deno global scope)
map Dependency mapping (see dependency mapping)
copy Array of files to copy to outDir

Dependency mapping

Dependency mapping is used to swap out Node.js implementations for Deno compatible versions with the same API. Local source files or node_module dependencies can be swapped out for other local source files or published Deno modules, in any combination, mix and match. Source files mentioned here will take precendence over exclude.

Comparison with denoify

denoc is an opinionated version of https://github.com/garronej/denoify. denoify supports polyfills of Node.js builtins, uses replacers to automatically select Deno compatible versions, and supports custom replacers that can be as complicated as the user wants. denoc doesn't do any of that stuff. The user selects dependencies explicitly, and needs to explicitly declare any replacement implementations.

denoc's People

Contributors

marcushultman avatar

Watchers

 avatar

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.