awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
Rich-Harris avatar

Rich-Harris/magic-string

0
View on GitHub↗

Magic String

magic-string is a low-level JavaScript library designed for compilers and bundlers to perform source code transformations. It serves as a string transformation utility and source map manipulation library that allows for modifying text while automatically tracking character offsets.

The library enables the modification of source code strings through insertions, replacements, and removals without losing the relationship to original source positions. It specifically provides mechanisms to generate mapping files that link transformed output text back to original source file coordinates.

Capabilities include adjusting text indentation while excluding specific character ranges and concatenating multiple modified strings into a single bundle with a shared mapping file. The tool also supports replacing text patterns and analyzing string state.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Features

  • Transformation Libraries - Serves as a fundamental library for compilers and bundlers to perform source code transformations and track mapping data.
  • Offset Tracking - Tracks character offsets during text modifications to maintain precise alignment between original and transformed source code.
  • Sourcemap Management - Generates standardized sourcemaps that link transformed output text back to original source file coordinates.
  • String Edit Queues - Implements deferred string materialization to optimize performance by queuing edits before generating the final output.
  • Source Map Generators - Creates mapping files with configurable resolution to link generated output back to original source files.
  • Source-Aware Transformations - Provides a utility for inserting, replacing, and indenting text without losing the relationship to original source positions.
  • Offset-Tracking Text Transformations - Changes content by inserting, removing, or replacing text while tracking original character offsets for consistency.
  • Offset-Aware String Modifications - Updates text within strings while tracking original character offsets to ensure accurate source mapping.
  • Offset-Preserving Text Insertions - Appends or prepends content at specific character positions to keep insertions associated with the correct original range.
  • Source Code Transformation Engines - Modifies JavaScript source code strings by inserting or replacing text while preserving accurate character offset tracking.
  • Build Tooling - Provides a low-level utility for compilers and bundlers to merge modified strings into a single output file.
  • Range-Aware - Adds or adjusts whitespace prefixes in text files while excluding specific ranges from the modification.
  • Range-Aware Indentation Logic - Adds indentation to lines of text while excluding specific character ranges from the process.
  • Range-Excluding Source Indentation - Prefixes lines with specific strings or guessed indentation while excluding defined character ranges.
  • Range-Excluding Indentations - Allows prefixing lines with indentation strings while ignoring specified character ranges to maintain layout.
  • Mapped String Concatenations - Merges multiple modified strings into a single bundle while preserving individual mapping data for each segment.
  • Source Bundle Concatenations - Combines several modified strings into a single bundle using unified indentation and a shared mapping file.
  • Sourcemap Offset Concatenations - Provides additive mapping concatenation to merge multiple offset maps into a single bundle while shifting coordinates.
  • String Pattern Replacements - Executes string or regular expression replacements based on the content of the original source text.
  • Immutable Range Awareness - Calculates indentation shifts while ignoring specified character ranges marked as immutable to preserve layout.
2,668 stars·116 forks·JavaScript·mit·22 views

Star history

Star history chart for rich-harris/magic-stringStar history chart for rich-harris/magic-string

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

Frequently asked questions

What does rich-harris/magic-string do?

magic-string is a low-level JavaScript library designed for compilers and bundlers to perform source code transformations. It serves as a string transformation utility and source map manipulation library that allows for modifying text while automatically tracking character offsets.

What are the main features of rich-harris/magic-string?

The main features of rich-harris/magic-string are: Transformation Libraries, Offset Tracking, Sourcemap Management, String Edit Queues, Source Map Generators, Source-Aware Transformations, Offset-Tracking Text Transformations, Offset-Aware String Modifications.

Which projects share features with rich-harris/magic-string?

Projects with overlapping indexed features include: react/metro — Metro is a JavaScript bundler designed for React Native environments. It functions as a system for resolving… mozilla/source-map — This project is a source map implementation library used for generating, parsing, and consuming source maps. It… rollup/plugins — This is a collection of official extensions for the Rollup bundling process. These plugins serve as module… browserify/browserify-handbook — The browserify-handbook is a comprehensive documentation guide for Browserify, a CommonJS module bundler and… browserify/browserify — Browserify is a build utility that enables the use of CommonJS module patterns within client-side JavaScript… substack/node-browserify — This project is a CommonJS module bundler and resolver designed to combine interdependent JavaScript files into a…

Projects sharing features with Magic String

These projects share indexed features with Magic String. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • react/metroreact avatar

    react/metro

    5,608View on GitHub↗

    Metro is a JavaScript bundler designed for React Native environments. It functions as a system for resolving dependencies, transforming source code, and packaging JavaScript and assets into bundles for execution. The project includes a development bundler server that hosts assets via HTTP and provides hot module replacement. It features a module resolver that handles platform-specific file extensions and a source code transformer that converts code into tree structures for optimization and minification. The toolset covers programmatic bundle generation, source map creation, and file system c

    JavaScriptbundlerjavascriptreact-native
    View on GitHub↗5,608
  • mozilla/source-mapmozilla avatar

    mozilla/source-map

    3,728View on GitHub↗

    This project is a source map implementation library used for generating, parsing, and consuming source maps. It provides the functional components necessary to link transformed or minified code back to original source files, acting as a tool for code transformation debugging. The library includes a source map composer for building trees of code snippets that automatically produce output strings and mappings. It also functions as a source map merger, providing mechanisms to chain and merge multiple maps to resolve multi-step code transformations across different build stages. The project cove

    JavaScript
    View on GitHub↗3,728
  • rollup/pluginsrollup avatar

    rollup/plugins

    3,750View on GitHub↗

    This is a collection of official extensions for the Rollup bundling process. These plugins serve as module transformers, resolution managers, and bundle optimizers designed to modify how JavaScript modules are processed, resolved, and optimized. The suite provides specialized capabilities for modern web transpilation, converting TypeScript, JSX, Flow, and GraphQL into compatible JavaScript. It distinguishes itself through extensive non-JavaScript asset integration, allowing the import of JSON, YAML, CSV, and image files as JavaScript modules or data URIs, and providing support for bundling We

    JavaScriptpluginsrolluprollup-plugins
    View on GitHub↗3,750
  • browserify/browserify-handbookbrowserify avatar

    browserify/browserify-handbook

    4,595View on GitHub↗

    The browserify-handbook is a comprehensive documentation guide for Browserify, a CommonJS module bundler and JavaScript build tool. It explains how to compile Node.js style modules into single JavaScript files for execution within web browsers. The guide covers the generation of universal module definition bundles that function across Node, AMD, and browser environments. It also details the use of browser-compatible polyfills for Node.js built-in modules to ensure cross-platform compatibility. The manual describes capabilities for source code transformation, frontend build automation, and we

    JavaScript
    View on GitHub↗4,595
Compare all 30 related projects→