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

aspectscript

v0.1.1

Published

AspectScript runtime, instrumentation, and CLI tooling

Downloads

200

Readme

AspectScript

An implementation of the AspectScript extension language for JavaScript, based on the AOSD 2010 paper "AspectScript: Expressive Aspects for the Web".

Quick start (npm)

Install:

npm install aspectscript

JavaScript example

const AJS = require("aspectscript");
const PCs = AJS.Pointcuts;

AJS.before(PCs.event("purchase"), function (jp) {
  console.log("purchase observed:", jp.orderId, jp.total);
});

AJS.event("purchase", { orderId: "A-100", total: 42 }, function () {
  console.log("inside purchase block");
});

TypeScript example

import AspectScript = require("aspectscript");

const AJS = AspectScript;
const PCs = AJS.Pointcuts;

AJS.around(PCs.event("audit"), (jp) => {
  console.log("audit event:", jp.action);
  return jp.proceed();
});

AJS.event("audit", { action: "DELETE_USER" }, () => {
  console.log("business logic");
});

Running instrumented scripts (exec, call, get, set, ...)

Use the CLI runner so your file is instrumented automatically:

npx aspectscript run your-script.js

What is included

  • A runtime and source instrumenter for AspectScript.
  • A Node-based test runner that executes the original tests/test*.js suite while ignoring legacy load(...) lines.
  • A CLI command (aspectscript) for running scripts and tests.
  • TypeScript type definitions (index.d.ts).
  • A static playground in docs/ with:
    • editable examples
    • execution output
    • join point tracing

Local usage

Install dependencies:

npm install

Run the test suite:

npm test

Run with cache statistics:

node run-tests.js --cache-stats

Run only failed tests from the previous run:

npm run test:failed

Run any script/example file with AspectScript runtime + instrumentation:

npm run run:script -- tests/test-ex.js

Run and export execution trace as JSON:

npm run run:script -- tests/test-ex.js --trace-json trace.json

Disable transform cache for a run:

npm run run:script -- tests/test-ex.js --no-cache
node run-tests.js --no-cache

Run paper-aligned conformance examples:

npm run test:conformance

Use the CLI command:

npx aspectscript run tests/test-ex.js
npx aspectscript test
npx aspectscript test --failed

Serve the playground locally from docs/:

cd docs
python3 -m http.server 4173

Then open http://127.0.0.1:4173.

GitHub guide

For a full command-line and GitHub usage guide, see GITHUB_USAGE.md. For practical examples/patterns, see PATTERNS.md. For package publishing readiness, see NPM_PUBLISH.md.

Current test status

The current implementation passes 105 of 105 legacy tests.