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 🙏

© 2025 – Pkg Stats / Ryan Hefner

vinyl-phantomic

v0.0.9

Published

Pipe stdin to Phantom.JS and console messages to stdout

Readme

Vinyl Phantomic

Forked from mantoni's wonderful phantomic module.

SemVer License

  • Pipes vinyl streams to PhantomJS
  • Accept .js and .html files. css and custom file handlers forthcoming.
  • Writes script console output to stdout
  • Writes script errors to stderr
  • Exit code 0 if nothing threw, otherwise 1

Probably not working right now

  • The command-line API

Todo

  • Bring back sourcemap support!
  • Better client configuration options.
  • Faster loading by caching phantomjs instances and refreshing the page, only create a new instance if it crashes.
  • Custom file type handlers:
    • Possible actions will include concat in page, execute script, serve a file, and control Phantom directly.
    • Use predicate functions/streams (not just file extensions) to decide which action to take on a file.
  • Continuous file loading - right now, vinyl-phantomic doesn't load anything until the input stream closes.
    • Possibly serve each vinyl file individually and load it into the page.
    • Insert html code into the document, serve script and css files with <script> and <css> tags.
    • Loading shiz via websockets?
  • Run tests on other browsers, not just Phantom.
    • Actual browsers, including Chrome, Safari, and IE.
    • Zombie.js
    • Casper.js (navigation and scripting for phantomjs.) This will be very useful when you can stream commands to Phantom.
  • Update some of the code and modules so it's more concise and up-to-date.
  • Write some tests showing different uses of vinyl-phantomic, e.g.
    • Gulp tests
    • Browserify
    • Different testing frameworks
  • Fix and test the command line API. I don't use it so I have been neglecting it... shame on me. ;_;
  • Make vinyl-phantomic be more gulp-plugin-y: https://github.com/gulpjs/gulp/blob/master/docs/writing-a-plugin/README.md
  • More robust handling of when to exit a phantom stream. Right now it has lots of timers... I don't think there is an obvious, better solution.

Pull requests welcome!

Install

npm install vinyl-phantomic

Usage

Vinyl-Phantomic includes PhantomJS as a dependency. On windows I still had to include a copy of phantomjs.exe in the directory I was running the node script from.

Exit detection

By default, phantomic will report an error if anything was logged to console.error. Program termination is detected by observing delays in the event queue and the last log statement that was received.

To make exit detection more reliable, brout can be used. If brout is part of the given script, run phantomic with --brout to install handlers for the out, err and exit events. Also make sure process.exit(code) is called.

API

You can use phantomic from your own node scripts like this:

var phantom = require('vinyl-phantomic');
var gulp = require('gulp');

// Take streams of html, css, and JS files:
gulp.src([
  'tests/*.js',
  'tests/*.html'
])

// pipe them to vinyl-phantomic
.pipe(phantom({
  debug : false,
  port  : 8080,
  brout : false
}, function (code) {
  // callback when complete
  // FIXME: this should probably just be the stream end, not a seperate callback.
  process.exit(code);
})

// and watch the errors fly!
.pipe(process.stdout);

Run the test cases

$ npm install
$ gulp test

Compatibility

  • Node 0.10 or later
  • PhantomJS 1.9

License

MIT