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

scriptor

v4.0.0-alpha.1

Published

Scriptor is the ultimate library for dynamically loading, reloading and running scripts without having to restart the process.

Downloads

24

Readme

Scriptor

NPM Version NPM Downloads Codacy Score MIT License

Introduction

Scriptor is the ultimate library for dynamically loading, reloading and running scripts, with built-in support for file watching to automatically reload when necessary.

A script is defined as a file which can be 'required' via CommonJS require function in node and io.js. It can be a .js, .json, and even .node or any other installed extension. For the asynchronous build of Scriptor, custom extensions can even be defined that take advantage of Promises and Coroutines.

Additionally, Scriptor includes a Manager class that helps to coordinate many scripts and even allow them to cross-reference each other to form more complex multi-script applications.

As of Version 2.0, Scriptor now has a command line interface capable of running Scriptor AMD scripts either synchronously or asynchronously. It can effectively replace node in the case of AMD scripts. By default, it uses the custom extension handler to inject the define function and load files.

Purpose

The initial purpose of Scriptor was to create a system for writing simple scripts that generate web pages. It has since become a standalone library.

Topics

Quick Start

npm install scriptor or npm install -g scriptor

Then:

var Scriptor = require('scriptor');

Or for the command line interface:

$scriptor -h

   Usage: scriptor [options] files...

   Options:

     -h, --help               output usage information
     -V, --version            output the version number
     -d, --dir <path>         Directory to run Scriptor in
     -a, --async              Run scripts asynchronously
     -c, --concurrency <n>    Limit script concurrency to n when executed asynchronously (default: max_recursion + 1)
     -q, --close              End the process when all scripts finish
     -w, --watch              Watch scripts for changes and re-run them when changed
     -p, --propagate          Propagate changes upwards when watching scripts
     -l, --long_stack_traces  Display long stack trace for asynchronous errors
     -r, --repeat <n>         Run script n times (in parallel if async)
     -u, --unique             Only run unique scripts (will ignore duplicates in file arguments)
     --debounce <n>           Wait n milliseconds for debounce on file watching events (default: 50ms)
     --use_strict             Enforce strict mode
     --max_listeners <n>      Set the maximum number of listeners on any particular script
     --max_recursion <n>      Set the maximum recursion depth of scripts (default: 9)
     -v, --verbose [n]        Print out extra status information (0 - normal, 1 - info, 2 - verbose)
     --cork                   Cork stdout before calling scripts
     -s, --silent             Do not echo anything
     --no_ext                 Disable use of custom extensions with AMD injection
     --no_signal              Do not intercept process signals
     --no_glob                Do not match glob patterns
     --no_title               Do not set process title

Scriptor Features

Synchronous or Asynchronous

Scriptor comes in two variations. There is the normal, synchronous build, which lazily evaluates scripts, but returns values synchronously.

Then there is the asynchronous build, which not only lazily evaluates scripts, but can load scripts and wait on return values asynchronously using Promises and even run module factories using coroutines.

For the advantages or disadvantages of either, see Here

AMD

Inside a script, Scriptor injects a few extra functions into the global module variable that facilitates Asynchronous Module Definitions (AMD). It is a fully fledged AMD implementation complete with plugin support, lazy evaluation of defined modules, and (in the asynchronous build), fully asynchronous dependency resolution. All of which integrates gracefully with standard Node.js modules and Scriptor itself.

For a full tutorial on how to best use Scriptor with AMD, see Here

Automatic Reloading

Scriptor utilizes file watchers to automatically reload and rename scripts as needed. No need to manually recompile scripts using complex file watcher code. It's all built-in.

References

Scriptor has a way overpowered system that can be used to 'reference' a single evaluation of a script and automatically reload and re-evaluate the reference when the script changes. In addition, Scriptor includes a fully fledged system for merging, transforming and generally manipulating references values while still propagating changes in the originating scripts.

For more information on this feature, see Here

Documentation

Example Code and Useful Recipes

Support

License

The MIT License (MIT)

Copyright (c) 2015 Aaron Trent

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.