GithubHelp home page GithubHelp logo

distify's Introduction

distify

Experimental browserify-based (mostly backwards-compatible) AST-aware module packager.

Idea

Architecture

Browserify transforms exist in two categories:

  1. nonjs-to-js transforms (henceforth "converters"). * The source cannot be expressed in terms of an esprima-compatible AST because they're not js. * e.g.: handlebars/underscore templates compilers, coffeeify, jadeify, etc.

  2. js-to-js transforms (not converters, henceforth "legacy transforms"). * The source can be expressed in terms of an esprima AST because they're js. * These most often do use an AST as intermediate step, but it's not shared. * babelify, brfs (inlines fs.readFileSync() calls), aliasify (remaps require calls), envify (inlines process.env values), deAMDify, etc.

Internally, browserify has three legacy transforms:

  1. detective. Collects require calls.
  2. insert-module-globals. Wraps modules in an IIFE with references to __filename, __dirname, process and Buffer - if needed.
  3. syntax-error. Syntax checks files โ€“ uses acorn's own errors to present helpful messages with line numbers.

Converters are exogenous inputs into the build pipeline. However, Legacy transforms are AST transformations that can benefit from skipping the AST-building step.

  + nonjs-to-js: If Acorn can't read it, these turn it
  | into something that it can. Includes the above mentioned, plus:
  |   * Turning `.json` files into `module.exports=JSON_CONTENT`.
  |   * BOM and shebang stripping.
  |
  |                 : 1. acorn
  |                 : 2. babel transforms
  |                 : 3. babel code gen
  |                 :
  v                 !~~~~~~~~~~~~~~~~!
converters -> JS -> !  AST  ->  JS+  ! -> legacy transforms -> packaging
                    !________________!                            ^
                    ^                                             |
                    |                                   * bundle splitting,
                    |                                   * source maps, etc.
                    |
                    |
                    * babel & it's ES6/7 transforms
                    * user defined transforms
                    * internal transforms rewritten as babel plugins
                    * other transforms like: bundle-collapser, aliasify

distify's People

Contributors

zertosh avatar

Watchers

 avatar  avatar  avatar  avatar

distify's Issues

Is this used?

I was working on a project with the same name and seems you was faster to publish it on npm than me. From looking at the code, it looks like there is no real world usage.

If you agree, could you please npm unpublish your package and let me publish mine there? ๐Ÿ˜

Thanks!!! ๐Ÿฐ

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.