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

@aladas-org/json-preprocessor

v0.0.5

Published

JSON preprocessor

Readme

json-preprocessor 0.0.4

1. Purpose

This is a JSON Preprocessor designed initially to work in tandem with @aladas-org/P5-patterns but it should be usable with other projects. By design the input of this Preprocessor is fully compatible with regular JSON. The advantage is to preserve the benefit of tools like JSON validators , on the other hand there is no possibility of Traditional preprocessor directives such as Comments (except maybe a trick like { "// Sample comment": "" }, taking care to not reuse the same key which is indeed a distortion).

2. Release notes

  • 2.1. Version 0.0.5 Update of comments header in json_preprocessor.js

3. How to run the demo

  • 3.1. Install NodeJS from https://nodejs.org/en

  • 3.2. Open a Command Line interpreter (CLI)

    • Click on Window menu icon (in the bottom left corner) then input cmd.exe in the Search field
  • 3.3. Import json-preprocessor repository

    • Use this command: git clone https://github.com/ALADAS-org/json-preprocessor.git
  • 3.4. Download the prerequisites (Express.js)

    • Use this command: npm install
  • 3.5. Start local Http server

    • Use this command: run.bat
    • This starts a local Http server at url http://127.0.0.1:8080/
    • This local Http server provides access to static files under public folder
  • 3.6. Launch Demo

    • Double click on the demo shortcut
    • This shortcut is a URL (http://127.0.0.1:8080/) which opens the index.html under public folder
    • The result is displayed in the console of DevTools (browser's inspector): to display it, use CTRL SHIFT i shortcut.

4. Preprocessor directives

  • 4.1. @include directive

    • 4.1.1. Define Constants
      Constants are defined in an include file (e.g. public\includes\color_palette_basic.json)
      To define a Constant use the @constants directive then define elements within @constants which is an Array of Key/Value pairs (name and value are the required Key/Value field names)
    "@constants": [ { "name": "red", "value": "#ff0000" }, ... ]
    • 4.1.2. Import Constants
    • Use the @include directive (and provide the src key to locate the path to the include file),
    • Then you can use the Named Constants by prefixing their Name with a $ (e.g. $red)
    {
    	"name": "Inclusion test",
    	"description": "inclusion test for color_palette",
    	"@include": { "src": "./includes/color_palette_basic.json", "type": "COLOR_PALETTE" },
    	"Shapes": {	"0": { "bgColor": "$red" }, ... }
    }
    • After Preprocessing: Named Constants (eg. $red) replaced by their Value (eg. #ff0000)
    {   ...
    	"Shapes": {	"0": { "bgColor": "#ff0000" }, ... }
    }

5. Preprocessor API

  • 5.1. JsonPP class
    • 5.1.1. JsonPP.Run()

      • This is the main service of the JsonPP API. See example in public\demo.js (loaded by index.html)
      let url = "http://127.0.0.1:8080/include_test.json";
      let json_data = await fetch( url ).then(res => res.json());
      
      console.log("   >> -------- BEFORE Preprocessing --------");	
      console.log(JSON.stringify(json_data));
      
      // 'JsonPP' class is provided in `public\src\json_preprocessor.js` 
      // and in `dist\json_preprocessor.js` for distribution purpose
      let json_data_pp = await JsonPP.Run(json_data); 
      console.log("   >> -------- AFTER Preprocessing --------");
      console.log(JSON.stringify(json_data_pp));