2019-09-13 admin


什么是aster,Centralized aster API.



NPM version Build Status

aster - AST-based code builder

What’s that

aster is reactive builder specialized for code processing and transformations. It’s built with debugging in mind and makes building JavaScript code more reliable and faster.

Why one more

Source maps are a great invention that is meant to simplify life by allowing developers to debug the original code (the one that they actually write, whatever language it is) on production.

However, using them is pretty hard in any of existing build systems whenever you have at least one plugin in your build pipeline - and you most likely do - that doesn’t support emitting them or even consuming from previous step; some plugins even treat code as simple strings discarding all it’s inner logic and structure.

Your code isn’t just a string. It has a soul and rich inner world and aster is built to treat it like that. As result, it provides complex yet easy and fast transformations that are transparent for browser debugger out of the box.

You can think of aster for JS as of rework for CSS.

But I like X builder! Should I throw it out?

Definitely no! aster doesn’t try to fight your favorite build system. It has only one specific area that it’s exceptionally good at - code processing. Everything else (CSS, images, publishing to CDN, etc.) is left for generic builders, and you can use them together.

Currently there are following bindings:

If you wish, you can define aster pipeline as custom task in any existing build system on your own since aster uses RxJS under the hood, which is interoperable with events, streams, promises, callbacks and any other asynchronous primitives and patterns out of the box.


aster is completely modular and main package is just a centralized API wrapper for core parts published as separate modules (check out their documentations for details):


First, install aster as a development dependency:

npm install --save-dev aster

Then, create build script and use it. Example (requires omitted):['src/**/*.js', 'src/**/*.coffee', 'src/**/*.jsx'])
.map(changed(function (src) {
    'if ($cond) return $expr1; else return $expr2;':
      'return <%= cond %> ? <%= expr1 %> : <%= expr2 %>'
.map(umd({exports: 'superLib'}))
.map(aster.dest('dist', {sourceMap: true}))

aster doesn’t provide task runner - npm is already good one, and we don’t want to reinvent the wheel. You can simply define every needed task as separate script, or use aster as part of existing builder as mentioned before.

Creating plugins

Check out aster’s Yeoman generator.

It automizes the process of creating basic skeleton and Github repo for your plugin in few easy steps. When created, you just need to modify index.js and test.js files to reflect your intended plugin’s functionality (detailed hints included right in code).


MIT License


转载请注明:文章转载自 JavaScript中文网 []



javascript if/else or ternary operator is faster?
user9009597Jeff提出了一个问题:Is ternary operator, if-else or logical OR faster in javascript?,或许与您遇到的问题类似。 回答者Andrew Hare给出了该问...
urlmaster是什么 什么是urlmaster,URL, Web, testing urlmaster官网:官网 urlmaster源码仓库:源码仓库 urlmaster下载地址:点此下载 点此下载2 urlmaster使用教程帮助...
config-master是什么 什么是config-master,Load stored configuration data config-master官网:官网 config-master源码仓库:源码仓库 config-maste...
In JS, which is faster: Object&apos;s "in" operator or Array&apos;s indexof?
finishingmoveFishtoaster提出了一个问题:In JS, which is faster: Object’s “in” operator or Array’s indexof?,或许与您遇到的问题类似。 回答者T.J. ...
Mastered in EVENT LOOP
setTimeout(() =&gt; { console.log(&#x27;I am the last one&#x27;) }, 0); function count () { for (var i = 0; i &lt; ...
eastern是什么 什么是eastern,a minimal BDD framework for ESM Modules eastern官网:官网 eastern源码仓库:源码仓库 eastern下载地址:点此下载 点此下载2 eas...
faster-stable-stringify是什么 什么是faster-stable-stringify,Faster deterministic JSON.stringify() without bells and whistles. ...
vtex-masterdata是什么 什么是vtex-masterdata,Helpers to manipulate data from Vtex Masterdata vtex-masterdata官网:官网 vtex-masterd...
Is NodeJs faster than Clojure?
foobar提出了一个问题:Is NodeJs faster than Clojure?,或许与您遇到的问题类似。 回答者Communitydnolen给出了该问题的处理方式: (set! *unchecked-math* true) (...
Why is iterating through an array backwards faster then forwards
mc01samccone提出了一个问题:Why is iterating through an array backwards faster than forwards,或许与您遇到的问题类似。 回答者Bergi给出了该问题的处理方式: B...