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 🙏

© 2024 – Pkg Stats / Ryan Hefner

phantomic

v1.5.2

Published

Pipe stdin to Phantom.JS and console messages to stdout

Downloads

1,132

Readme

Phantomic

SemVer License

  • Pipes stdin to PhantomJS
  • Writes script console output to stdout
  • Writes script errors to stderr
  • Exit code 0 if nothing threw, otherwise 1

Install

npm install -g phantomic

Usage

Phantomic does not include PhantomJS itself. Make sure the phantomjs executable is in your PATH or specify with --phantomjs.

Usage: phantomic [options] [file]

Options:
    --debug                Launch the WebKit debugger in a browser
    --port <num>           Explicit port binding for temporary web server. If
                           no port is specified, a random free port is used.
    --phantomjs <path>     Use specified phantomjs binary
    --web-security <bool>  Enables PhantomJS web security and forbids
                           cross-domain XHR (default is true)
    --brout                Assume brout is part of the JS
    --ignore-ssl-errors <bool>  Tell PhantomJS to ignore SSL certificate errors
                                when network requests are made (default is false)
    --viewport-width <num>      Tell PhantomJS about the desired viewport width
    --viewport-height <num>     Tell PhantomJS about the desired viewport
                                height

Pipe any script to phantomic:

phantomic < ./test.js

Opening a file:

phantomic ./test.js

If you are using phantomic from a Makefile with a local install, you will have to include it in the PATH:

BIN = ./node_modules/.bin
PATH := $(BIN):$(PATH)

test:
  browserify ./test.js | phantomic

Debugging

Put a debugger; statement somewhere and run:

phantomic --debug < ./test.js

This will open the WebKit inspector in your browser.

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 phantomic = require('phantomic');

phantomic(process.stdin, {
  debug : false,
  port  : 0,
  brout : false,
  'web-security': false,
  'ignore-ssl-errors': true,
  'viewport-width': 1024,
  'viewport-height': 768
}, function (code) {
  process.exit(code);
}).pipe(process.stdout);

Run the test cases

npm install
make

Compatibility

  • Node 0.10 or later
  • PhantomJS 1.9 / 2.0

License

MIT