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

jecho

v0.2.2

Published

JavaScript remote web debugging tool

Downloads

8

Readme

JECHO

jecho is a client/server remote debugging tool written for Node.js, which aims to ease the (sad) life of the mobile web developer. It can be used with almost every browser, even desktop ones, but in those cases much more powerful debug tools already exist.

Basically you run the jecho server and you'll receive a command line. Whatever string you enter from this command line is then sent to the (eventually) connected client(s) (i.e.: a web page opened in a mobile device). That string is then eval'uated in the browser as JavaScript code and the result sent back to the server, which in turn will display it.

Additionally, a jecho.log() utility is provided to be used from within the web page, so that you can send asynchronous messages to the server. The jecho.log() obviously resembles the console.log() tool, but it isn't powerful that much: the serialization of objects is just a JSON.stringify(obj, undefined, 2).

You can also use the jecho.inspect() method to deliver a small report about the dimensions of the window, the dimensions of an HTML element (i.e. jecho.inspect(document.body);) or a specific CSS property (i.e. jecho.inspect(document.body, "margin-right");).

Features

  • supports bidirectional communication, thanks to WebSockets. The support is provided for the legacy and current WebSocket specifications (tested on iOS 4, 5, 6 and some versions of Android)
  • if for some reasons WebSockets are not supported, then you can still use the jecho.log() thanks to XMLHttpRequest and CORS. In this case you'll not be able to send commands to the browser, but just receive the output from jecho.log
  • command line handled by readline with history (saved in ~/.jecho-history)
  • uses smart eval() - meaning that "var foobar = 67" will create a real, global foobar
  • automatically catches and reports JavaScript errors

Output

Each output line is composed by four elements: a timestamp, the IP address of the client, an indicator and the message.

The indicator element is a symbol with the following meanings:

  • >> a log message has been received from the client (unattended)
  • <> a response to a query has been received by the client
  • >! an error has been captured by the client
  • -- internal message (not from the client)

Please note the undefined and null values are printed as JS UNDEFINED and JS NULL

Limitations

I've it tested roughly in a lot of different environments, but mostly on WebKit based browser. It also works on Firefox and Opera Mini. Expect differences on how browsers handle the serialization of objects (like window.location).

If more than one client connects to the jecho server (you see the number reported in the console prompt), you'll be able to send commands only to the last one which "talked".

Installation

npm install jecho

or download everything and just run npm install

Dependencies: websocket, websocket-server, commander

Note for OSX brew users: npm is not installed along the installation of nodejs (a package manager won't install another package manager). Just run brew install npm and read the provided instructions.

Note for Ubuntu users: everything is fine, except for users of some old 11.x distribution (problems with... Python. Don't ask).

Usage

Run the jecho server with -h to read about a couple of options it accepts.

Insert a JavaScript script tag in the page which you want to enhance with jecho:

<script src="http://<jecho server ip address and port>/jecho.js"></script>
<script>
 jecho.log("Hello from the jecho client!");
 // Will show a nice report on the server console
 jecho.inspect();
</script>

License

(The MIT License)

Copyright (c) 2012 Claudio Cicali [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Credits

Claudio Cicali [email protected], @caludio on Twitter

wcauchois who provided the nice wrapper for the WebSockets fallback