npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gulp-futurejs-compile

v0.0.1

Published

Gulp plugin for compiling FutureScript

Downloads

8

Readme

gulp-futurejs-compile

npm

Compile FutureScript as part of your Gulp build process.

Usage

var fus = require('gulp-futurejs-compile');

gulp.task('futurejs', function() {
  gulp.src('./src/*.fus')
    .pipe(fus(opts).on('error', gutil.log))
    .pipe(gulp.dest('./public/'))
});

Error handling

gulp-futurejs-compile will emit an error for cases such as invalid Marko syntax. If uncaught, the error will crash gulp.

You will need to attach a listener (i.e. .on('error')) for the error event emitted by gulp-futurejs-compile:

var fusStream = fus();

// Attach listener
fusStream.on('error', function(err) {});

In addition, you may utilize gulp-util's logging function:

var gutil = require('gulp-util');

// ...

var fusStream = fus();

// Attach listener
fusStream.on('error', gutil.log);

Since .on(...) returns this, you can make you can compact it as inline code:


gulp.src('./src/*.fus')
  .pipe(fus({preserveWhitespace: true}).on('error', gutil.log))
  // ...

Options

The options object supports the same options as the standard FutureScript compiler

Input object:

{
    code: <string>,
    path: <string>,
    level: <OutputLevel>,
    generatesStyles: <boolean>,
    outputCodeReadability: <number>
}

Either code or path (or both) must be set.

path means the path of the file the code belongs to (or you want the code to behave as if

it is located at the path, for source maps and other use).

If code is set, it won't read code from path, otherwise it will read code from path.

level is optional defaulting to OutputLevel.compile.

generatesStyles is optional defaulting to false. If true, then level can't be less than

OutputLevel.exports. It categorizes code parts into styles. Useful in syntax highlighting.

outputCodeReadability is optional defaulting to 0. It must be between 0 (including) and 1 (including), for example, 0.3, 0.8.

Output object:

{
    version: <string>,
    exports: <string array>,
    styles: <array of arrays>,
    targets: <Target array>
}

targets is an array of objects of virtual type Target. Target type structure:

{
    code: <string>,
    codeType: <OutputCodeType>,
    sourceMap: <string>
}

sourceMap will be absent if level < OutputLevel.sourceMap. The whole targets field will be absent if level < OutputLevel.compile.

exports will be absent if level < OutputLevel.exports. This property lists all exports' names (note that the name of the default export is "default"). Will be an empty array if no export.

styles will be absent if generatesStyles is false. If present, it's an array of arrays. A styles example is [[0, 1], [3, 0]], which means the first segment's start index is 0 (this should always be 0) and its style is 1 (which means keyword), and the second segment's start index is 3 and its style is 0 (which means normal). Style is a number instead of a real color name, because the real color should be customizable, also because sometimes we use underline, bold, italic, etc. to show a style. We even don't use names keyword or normal because it's sometimes hard to define a kind in accurate, irrevocable words. I can now only confirm the use of the first 4 styles: 0: normal, 1: keyword, 2: string, 3: comment It can't be larger than 15, except for extended style. Is the limit too small? No, it's by design, because if there're too many then the meanings will be less likely to be fixed.

Note: the targets array always has only 1 element. Why it's an array is for future use.

Note: Besides main style, there's extended style: a combination of different categories.

This is useful when adding italic or underline to a code fragment that already has many styles.

It uses flags, each of which has 16 possible values, so it's compatible with the main style.

The first category (bit 0-3) is the main style (note that it can also be displayed as italic or underline, depending on the theme).

The second category (bit 4-7) is mainly for italic (only two lowest values used).

The third category (bit 8-11) is mainly for underline (only two lowest values used).

There may be additional categories for future use.

For example, if the style is 16, it means normal, italic If the style is 274, it means string, italic, underline

TODO

Fully comply with Gulp plugin guidelines AKA write some tests

License

MIT License