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

strictjs-runtime

v2.0.13

Published

A lightweight low-level runtime for StrictJS with WebAssembly support.

Readme

StrictJS Runtime

A high-performance, low-level JavaScript runtime with WebAssembly at its core — bringing strict typing, memory safety, and near-native performance to any JavaScript environment.

npm version License: MIT PRs Welcome


📦 Overview

StrictJS Runtime is an experimental, production-ready runtime that bridges the gap between JavaScript's flexibility and systems-level performance. Built on WebAssembly, it provides strict data structures, memory-safe operations, and SIMD/GPU acceleration — all while maintaining seamless integration with your existing JavaScript codebase.

Why Choose StrictJS?

| Challenge | JavaScript | StrictJS Runtime | |-----------|------------|------------------| | Memory Management | Garbage-collected, unpredictable | Predictable, manual control when needed | | Type Safety | Dynamic, error-prone | Runtime-enforced, strict typing | | Performance | JIT limitations | WASM-optimized, near-native speed | | Data Structures | Dynamic, overhead-heavy | Compact, memory-efficient | | Parallel Computing | Single-threaded | Multi-threading, SIMD, GPU support | | AI/ML Workloads | Slow, memory-intensive | Optimized tensors, matrix operations |


✨ Key Features

  • 🚀 Blazing Performance – WebAssembly core with near-native execution speed
  • 🧠 Memory Safety – Predictable memory layout with zero-cost abstractions
  • 🎯 Strict Typing – 40+ heap types including primitives, tensors, and neural network structures
  • ⚡ Hardware Acceleration – Built-in SIMD and GPU compute support
  • 🔄 Multi-threading – Native thread pools and parallel task execution
  • 📊 Scientific Computing – Tensors, matrices, vectors with BLAS-like operations
  • 🤖 AI/ML Ready – Optimized for embeddings, attention mechanisms, and quantized operations
  • 🌐 Universal Runtime – Works everywhere JavaScript runs

📋 Table of Contents


🔧 Installation

NPM

npm install strictjs-runtime

PNPM

pnpm add strictjs-runtime

Yarn

yarn add strictjs-runtime

CDN (Browser)

<script type="module">
  import strictInit from 'https://unpkg.com/strictjs-runtime@latest/index.js';
  // Initialize and use
</script>

🚀 Quick Start

Basic Initialization

import strictInit from 'strictjs-runtime';

// Initialize the runtime (auto-detects environment)
const runtime = await strictInit();

// Destructure the APIs you need
const { 
  StrictArray, 
  StrictObject, 
  StrictFunction,
  HeapType,
  Schema,
  createTensor
} = runtime;

Working with Strict Arrays

// Create a typed array of 32-bit floats
const floats = new StrictArray(HeapType.F32, 5);

// Set values
floats.setValue(0, 3.14);
floats.setValue(1, 2.718);
floats.setValue(2, 1.618);

// Get values
console.log(floats.getValue(0)); // 3.140000104904175 (F32 precision)

// Perform operations
console.log(floats.sum());    // Sum of all elements
console.log(floats.average()); // Average value
console.log(floats.min());     // Minimum value
console.log(floats.max());     // Maximum value

Creating Scientific Data Structures

// Create a 2x3 tensor (matrix)
const tensor = createTensor(HeapType.F32, new Uint32Array([2, 3]));

// Create a vector of length 10
const vector = createVector(HeapType.F64, 10);

// Create a 3x3 matrix
const matrix = createMatrix(HeapType.F32, 3, 3);

// Create special arrays
const zeros = createZeros(HeapType.F32, 100);      // All zeros
const ones = createOnes(HeapType.F32, 100);        // All ones
const range = createRange(HeapType.F32, 0, 10, 2); // [0, 2, 4, 6, 8]

Type-Safe Objects with Schemas

// Define a schema
const userSchema = new Schema();
userSchema.addField('id', 'u32');
userSchema.addField('name', 'string');
userSchema.addField('age', 'u8');
userSchema.addField('isActive', 'bool');
userSchema.addField('balance', 'f64');

// Create an object with the schema
const user = new StrictObject(userSchema);

// Set fields with type checking
user.setField('id', 123456);
user.setField('name', 'Alice Johnson');
user.setField('age', 28);
user.setField('isActive', true);
user.setField('balance', 999.99);

// Get fields with proper type conversion
console.log(user.getFieldAsNumber('id'));      // 123456
console.log(user.getFieldAsString('name'));    // "Alice Johnson"
console.log(user.getFieldAsBoolean('isActive')); // true

Type-Safe Functions

// Create a type-safe function
const add = new StrictFunction(
  (a, b) => a + b,           // JavaScript function
  [HeapType.U8, HeapType.U8], // Argument types
  HeapType.U8                  // Return type
);

// Call with automatic type checking
console.log(add.call([5, 10])); // 15

// Overflow is handled safely (U8 wraps at 255)
console.log(add.call([200, 100])); // 44 (300 % 256)

// Create more complex functions
const multiply = new StrictFunction(
  (x, y) => x * y,
  [HeapType.F32, HeapType.F32],
  HeapType.F32
);

console.log(multiply.call([3.14, 2.0])); // 6.28

🧠 Core Concepts

Heap Types

StrictJS provides 40+ heap types organized into categories:

| Category | Types | Description | |----------|-------|-------------| | Primitives | U8, I8, U16, I16, U32, I32, U64, I64, F32, F64, Bool | Basic scalar types | | Strings | Str, Str16 | UTF-8 and UTF-16 strings | | Containers | Array, Map, Struct | Collection types | | Tensors | TensorF32, TensorF64, TensorI32, TensorU8, TensorI8, TensorI16, TensorU16 | N-dimensional arrays | | Matrices | MatrixF32, MatrixF64, MatrixC32, MatrixC64 | 2D matrices | | Vectors | VectorF32, VectorF64, VectorI32 | 1D vectors | | ML/AI | SparseMatrix, Quantized8, Quantized16, Embedding, Attention, WeightF32, BiasF32, GradientF32, Activation | Neural network structures | | Accelerated | GPUTensor, SIMDVector | Hardware-optimized types |

Memory Management

StrictJS uses a shared memory model where data lives in the WebAssembly heap:

import { get_memory } from 'strictjs-runtime';

// Access the underlying WASM memory
const memory = get_memory();
const view = new Uint8Array(memory.buffer);

// Direct memory access (advanced use)
const array = new StrictArray(HeapType.U8, 100);
// ... work with array
const data = array.toUint8Array(); // Get as TypedArray

📚 API Reference

Core Classes

| Class | Description | |-------|-------------| | StrictNumber | Type-safe number with specified heap type | | StrictString | Fixed-size string with encoding options | | StrictBoolean | Boolean wrapper | | StrictBigInt | BigInt wrapper for 64-bit integers | | StrictArray | Typed array with element-wise operations | | StrictObject | Schema-validated object | | StrictFunction | Type-checked function wrapper | | StrictPromise | Type-aware promise wrapper |

Control Flow

| Class | Description | |-------|-------------| | StrictForLoop | Optimized for-loop with batching | | StrictWhileLoop | Condition-based loop with convergence detection | | StrictTimeout | Type-safe timer | | StrictAsync | Async task manager with priorities |

Parallel Computing

| Class | Description | |-------|-------------| | ThreadManager | Manages thread pools and parallel execution | | ThreadPool | Worker pool for concurrent tasks | | ThreadTask | Individual task with priority and state |

Hardware Acceleration

| Class | Description | |-------|-------------| | GPUMemoryManager | GPU buffer management | | JsGPUType | GPU-compatible type wrapper | | JsSIMDType | SIMD vector type wrapper |

Factory Functions

| Function | Description | |----------|-------------| | createTensor(heap, shape) | Create n-dimensional tensor | | createVector(heap, length) | Create 1D vector | | createMatrix(heap, rows, cols) | Create 2D matrix | | createZeros(heap, length) | Zero-initialized array | | createOnes(heap, length) | One-initialized array | | createRange(heap, start, end, step) | Range generator | | strict_fetch(url, return_type) | Type-safe fetch | | init_thread_manager(config) | Initialize thread manager |

Enums

| Enum | Values | |------|--------| | HeapType | U8, I32, F32, F64, TensorF32, etc. | | OptimizationMode | Sequential, Batched, GPU, SIMD, Auto | | StringEncoding | Utf8, Utf16, Ascii | | TaskPriority | Low, Normal, High, Critical | | ThreadPriority | Low, Normal, High, Critical | | ThreadState | Idle, Running, Paused, Completed, Error |


🔬 Advanced Usage

Multi-threading with ThreadManager

const { init_thread_manager, HeapType } = await strictInit();

// Initialize thread manager with config
const manager = init_thread_manager({
  max_threads: 4,
  default_priority: 'Normal'
});

// Create a thread pool
manager.createPool('compute', 4);

// Submit parallel tasks
const results = await manager.parallelMap(
  [1, 2, 3, 4, 5, 6, 7, 8],
  (x) => x * x,
  HeapType.U32,
  'compute'
);

console.log(results); // [1, 4, 9, 16, 25, 36, 49, 64]

GPU Computing

const { createGPUType, GPUMemoryManager, HeapType } = await strictInit();

// Create GPU-compatible type
const gpuFloat = createGPUType('f32');

// Initialize GPU memory manager
const gpuMem = new GPUMemoryManager();

// Create GPU buffer
const bufferId = gpuMem.createBuffer(
  gpuFloat,
  1024, // size in bytes
  new GPUBufferUsage(0x01 | 0x02) // MAP_WRITE | COPY_SRC
);

// Get buffer info
const info = gpuMem.getBufferInfo(bufferId);
console.log(info.toString());

SIMD Operations

const { createSIMDType, getSIMDTypeForUseCase } = await strictInit();

// Create SIMD type for 32-bit floats
const simdF32 = createSIMDType('f32x4');

// Or get optimized type for specific use case
const simdForAudio = getSIMDTypeForUseCase('audio-processing');

console.log(simdF32.elementCount()); // 4 (lanes)
console.log(simdF32.totalSize());    // 16 bytes
console.log(simdF32.supportedOperations());
// ['add', 'sub', 'mul', 'div', 'sqrt', 'min', 'max', ...]

Neural Network Operations

const { StrictArray, HeapType } = await strictInit();

// Create weight matrix and bias
const weights = createMatrix(HeapType.F32, 784, 256); // Input layer
const bias = createVector(HeapType.F32, 256);

// Create input tensor (batch of 32 images)
const input = createTensor(HeapType.F32, new Uint32Array([32, 784]));

// Perform forward pass with ReLU activation
input.activation('relu');

// Apply convolution (for CNN layers)
const kernel = createMatrix(HeapType.F32, 3, 3);
const convolved = input.convolution(kernel);

// Batch normalization
convolved.batchNormalization(1e-5);

// Quantize for deployment
const quantized = convolved.quantize(8); // 8-bit quantization

Working with Typed Arrays

// Convert between StrictArray and native TypedArrays
const f32array = new StrictArray(HeapType.F32, 10);

// To Float32Array
const float32View = f32array.toFloat32Array();

// From Float32Array
const externalData = new Float32Array([1, 2, 3, 4, 5]);
const strictArray = StrictArray.fromFloat32Array(HeapType.F32, externalData);

// To Uint8Array (raw bytes)
const bytes = f32array.toUint8Array();

// From Uint8Array
const reconstructed = StrictArray.fromUint8Array(HeapType.F32, bytes);

Error Handling

try {
  const array = new StrictArray(HeapType.U8, 10);
  
  // This will throw - index out of bounds
  array.setValue(20, 100);
} catch (error) {
  console.error('StrictJS Error:', error.message);
}

// Functions validate arguments at runtime
const safeAdd = new StrictFunction(
  (a, b) => a + b,
  [HeapType.U8, HeapType.U8],
  HeapType.U8
);

try {
  // This will throw - wrong argument type
  safeAdd.call(["5", 10]);
} catch (error) {
  console.error('Type validation failed:', error.message);
}

⚡ Performance

StrictJS Runtime achieves high performance through:

  1. WebAssembly Core – Compiled to machine code, not interpreted
  2. Zero-Copy Operations – Data stays in WASM heap
  3. SIMD Acceleration – Process 4-16 elements per instruction
  4. GPU Compute – Offload to graphics processor
  5. Parallel Execution – Multi-threaded task distribution
  6. Memory Locality – Cache-friendly data layouts

Benchmarks

| Operation | JavaScript | StrictJS | Speedup | |-----------|------------|----------|---------| | Array sum (1M elements) | 3.2ms | 0.8ms | 4x | | Matrix multiply (100x100) | 15ms | 2.1ms | 7x | | FFT (1024 samples) | 1.5ms | 0.3ms | 5x | | Image convolution (3x3) | 8ms | 1.2ms | 6.6x | | Batch normalization | 12ms | 1.8ms | 6.7x |


📁 Examples

Game Development (Physics)

const { StrictArray, HeapType, createVector } = await strictInit();

// Physics simulation with particles
class ParticleSystem {
  constructor(count) {
    this.positions = createVector(HeapType.F32, count * 3);
    this.velocities = createVector(HeapType.F32, count * 3);
    this.forces = createVector(HeapType.F32, count * 3);
    this.count = count;
  }
  
  update(dt) {
    // Euler integration
    for (let i = 0; i < this.count; i++) {
      const idx = i * 3;
      
      // v += f * dt
      this.velocities.setValue(idx, 
        this.velocities.getValue(idx) + this.forces.getValue(idx) * dt
      );
      
      // p += v * dt
      this.positions.setValue(idx,
        this.positions.getValue(idx) + this.velocities.getValue(idx) * dt
      );
    }
  }
}

Real-time Data Processing

const { ThreadManager, createZeros } = await strictInit();

class StreamProcessor {
  constructor() {
    this.manager = init_thread_manager({ max_threads: 4 });
    this.buffer = createZeros(HeapType.F32, 1024);
  }
  
  async process(data) {
    // Parallel processing of data chunks
    const chunkSize = data.length / 4;
    const chunks = [];
    
    for (let i = 0; i < 4; i++) {
      const start = i * chunkSize;
      const end = start + chunkSize;
      chunks.push(data.slice(start, end));
    }
    
    return this.manager.parallelMap(
      chunks,
      (chunk) => this.processChunk(chunk),
      HeapType.F32
    );
  }
  
  processChunk(chunk) {
    // Signal processing, FFT, etc.
    // Runs in separate thread
    return chunk.map(x => Math.sin(x) * Math.cos(x));
  }
}

🤝 Contributing

We welcome contributions! See our Contributing Guide for details.

Development Setup

# Clone repository
git clone https://github.com/Kenneth732/strictJS.git
cd strictJS/runtime

# Install dependencies
npm install

# Build WASM module
npm run build

# Run tests
npm test

Project Structure

strictjs-runtime/
├── src/              # Rust source code
├── pkg/              # Compiled WASM output
├── index.js          # Main loader
├── test.js           # Tests
└── README.md         # This file

🗺️ Roadmap

Version 2.x (Current)

  • ✅ Core data structures (arrays, objects, functions)
  • ✅ SIMD operations
  • ✅ GPU compute support
  • ✅ Multi-threading
  • ✅ Neural network types
  • ✅ Schema validation

Version 3.x (Planned)

  • 🔄 JIT compilation for hot paths
  • 🔄 WebGPU integration
  • 🔄 Distributed computing across workers
  • 🔄 Persistent storage layer
  • 🔄 Language-level syntax (StrictJS language)

Version 4.x (Future)

  • 🔮 Full framework (like React + StrictJS)
  • 🔮 Native mobile support
  • 🔮 WASM component model integration
  • 🔮 Zero-copy streaming data

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🌟 Support


🙏 Acknowledgments

Built with:


💡 Inspiration

StrictJS draws inspiration from:

  • Rust – Memory safety without garbage collection
  • C – Predictable performance and control
  • TypeScript – Type systems in JavaScript
  • WebGL/WebGPU – Hardware acceleration
  • TensorFlow – ML/AI optimization

⚖️ When to Use StrictJS

Good Fit ✅

  • Real-time applications (games, simulations)
  • Data processing pipelines
  • Scientific computing
  • Machine learning inference
  • Audio/video processing
  • Cryptography
  • Physics engines

Not Ideal ❌

  • Simple CRUD applications
  • DOM manipulation heavy apps
  • Rapid prototyping
  • Tiny scripts

Made with ❤️ by Kenneth Mburu and contributors

"Wherever JavaScript runs, StrictJS can run too."