explaingit

geekyjunk/stitchr

Analysis updated 2026-05-18

0TypeScriptAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

An experimental TypeScript JavaScript bundler that traces local CommonJS require() calls, assigns module IDs, and writes a self-contained output bundle.

Mindmap

mindmap
  root((Stitchr))
    Bundling Steps
      Parse Entry File
      Traverse Require Calls
      Assign Module IDs
      Rewrite Paths
      Write Bundle
    Features
      Dependency Graph View
      Circular Dep Detection
      Extensionless Imports
    Limitations
      No npm Packages
      No ESM Support
      No Source Maps
    Tech
      TypeScript
      Babel
      Node.js
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Bundle a local CommonJS JavaScript project into a single self-contained file to run with Node.

USE CASE 2

Inspect the resolved dependency graph of a JavaScript project as JSON.

USE CASE 3

Study how a JavaScript bundler works by reading a minimal, well-structured reference implementation.

USE CASE 4

Fork and extend this early-stage codebase to experiment with building a custom bundler.

What is it built with?

TypeScriptNode.jsBabel

How does it compare?

geekyjunk/stitchrairirang/airirang-builderaisurfer/mcp_ui_app_example
Stars000
LanguageTypeScriptTypeScriptTypeScript
Setup difficultyeasymoderatemoderate
Complexity3/53/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Stitchr is an experimental tool for bundling JavaScript files, written in TypeScript. Its purpose is to take a JavaScript project with multiple files that depend on each other, trace all the connections between them, and combine everything into a single output file that can run on its own. This is the same basic idea behind well-known tools like Webpack or Rollup, but Stitchr is a learning project rather than a production bundler. The way it works: you point Stitchr at an entry file, the tool parses that file to find any require() calls that load other local files, follows those to their files, and repeats until it has visited every file in the dependency chain. It then assigns each file a numeric ID, rewrites the require() calls to use those IDs, and wraps everything in a small runtime that handles module loading, caching, and execution order. The bundler is used from the command line. You run stitchr build <entry-file> and the output lands at dist/bundle.js by default. A flag is available to print the resolved dependency graph as JSON, useful for seeing exactly which files were discovered and in what order. At its current early stage, Stitchr only handles local CommonJS require() calls. It does not yet resolve packages from the npm ecosystem, does not handle ES module import syntax, and does not support dynamic require() calls. The roadmap lists those features as future work, along with source maps and automated tests. The project is released under the ISC license, a permissive open-source license that allows free use, modification, and distribution.

Copy-paste prompts

Prompt 1
I'm building a JavaScript bundler and want to traverse CommonJS require() calls. Show me how to use Babel's AST traversal to find and extract all require() string arguments from a source file.
Prompt 2
Explain how a module registry and numeric ID system work in a bundler: why replace file paths with IDs, and how does the runtime use them to load modules in the right order?
Prompt 3
I want to detect circular dependencies during dependency graph traversal. Write a TypeScript function using depth-first search that detects cycles and logs a warning for each one found.
Prompt 4
How do I add source map support to a JavaScript bundler? What data do I need to collect during parsing, and what format does a .map file use?

Frequently asked questions

What is stitchr?

An experimental TypeScript JavaScript bundler that traces local CommonJS require() calls, assigns module IDs, and writes a self-contained output bundle.

What language is stitchr written in?

Mainly TypeScript. The stack also includes TypeScript, Node.js, Babel.

What license does stitchr use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is stitchr to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is stitchr for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub geekyjunk on gitmyhub

Verify against the repo before relying on details.