---
title: "magic-string 1.4.2 Breaking Changes on npm | Since.dev"
description: "What each magic-string release removed, renamed or changed: 31 breaking changes in 9 versions on npm, each with its source."
canonical_url: https://since.dev/packages/npm/magic-string
last_updated: 2026-12-04
---

# magic-string breaking changes

magic-string 1.4.2 (September 23, 2026) is its newest release with breaking changes, 2 of them. The first: Removed MagicString.indentExclusionRanges. Every breaking API change we have recorded in magic-string on npm: 31 breaking changes in 9 versions. Below, its 9 versions with breaking changes, newest first, removals and renames first, each with its source.

Updated December 4, 2026

Latest version `1.4.5`. [Source repository](https://github.com/Rich-Harris/magic-string)

Packages on npm run on Node.js. [Node.js end of life dates](https://since.dev/calendar/nodejs.md).

- From [0.30.0](#v-0-30-0) to [1.4.2](#v-1-4-2): 26 breaking changes in 6 versions.
- From [0.26.0](#v-0-26-0) to [1.4.2](#v-1-4-2): 29 breaking changes in 8 versions.

## magic-string 1.4.2 breaking changes

magic-string 1.4.2, released September 23, 2026: 2 breaking changes.

- **Removed** `MagicString.indentExclusionRanges`  

MagicString.indentExclusionRanges was removed in magic-string 1.4.2 [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.4.2)
- **Signature changed** `MagicString.original`  

Was original: string; now readonly original: string. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.4.2)

## magic-string 1.4.0 breaking changes

magic-string 1.4.0, released September 15, 2026: 2 breaking changes.

- **Signature changed** `MagicString.move`  

Was move(start: number, end: number, index: number): this; now move(start: number, end: number, index: number, affinity?: "left" | "right"): this. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.4.0)
- **Signature changed** `SourceMap.constructor`  

Was constructor(properties: DecodedSourceMap); now constructor(properties: DecodedSourceMap | (Omit\<DecodedSourceMap, "mappings"> & {mappings: string;})). [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.4.0)

## magic-string 1.3.1 breaking changes

magic-string 1.3.1, released September 10, 2026: 3 breaking changes.

- **Signature changed** `Bundle.generateDecodedMap`  

Was generateDecodedMap(options?: SourceMapOptions): DecodedSourceMapOrMissingContent; now generateDecodedMap(options?: BundleSourceMapOptions): DecodedSourceMapOrMissingContent. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.3.1)
- **Signature changed** `Bundle.generateMap`  

Was generateMap(options?: SourceMapOptions): Omit\<SourceMap, "sourcesContent"> & {sourcesContent: Array\<string | null>;}; now generateMap(options?: BundleSourceMapOptions): Omit\<SourceMap, "sourcesContent"> & {sourcesContent: Array\<string... [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.3.1)
- **Signature changed** `SourceMapOptions.hires`  

Was hires?: boolean | "boundary"; now hires?: boolean | "boundary" | "experimental-range". [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.3.1)

## magic-string 1.2.3 breaking changes

magic-string 1.2.3, released August 26, 2026: 1 breaking change.

- **Behavior changed**  

Negative indices smaller than -length now clamp to the start instead of wrapping around repeatedly. Code that relied on the wrapping output should check its indices. [github.com](https://github.com/Rich-Harris/magic-string/releases/tag/v1.2.3)

## magic-string 1.2.1 breaking changes

magic-string 1.2.1, released August 19, 2026: 2 breaking changes.

- **Behavior changed**  

An overlapping move now throws an error where it previously corrupted the chunk list silently. Code that performs overlapping moves may now fail at runtime. [github.com](https://github.com/Rich-Harris/magic-string/releases/tag/v1.2.1)
- **Behavior changed** `Bundle.isEmpty`  

Bundle#isEmpty now counts separators, so a bundle holding only separators is no longer reported as empty. Check code that relies on the previous result. [github.com](https://github.com/Rich-Harris/magic-string/releases/tag/v1.2.1)

## magic-string 1.0.0 breaking changes

magic-string 1.0.0, released July 16, 2026: 16 breaking changes.

- **Configuration changed**  

The package ships only ESM now and the CJS, UMD and IIFE builds are gone, so code that loads it with require or as a global script must switch to ESM imports. [github.com](https://github.com/Rich-Harris/magic-string/releases/tag/v1.0.0)
- **Signature changed** `Bundle.addSource`  

Was addSource(source: MagicString | {filename?: string; content: MagicString; ignoreList?: boolean}): this; now addSource(source: MagicString | BundleSourceDescription): this. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)
- **Signature changed** `Bundle.generateDecodedMap`  

Was generateDecodedMap(options?: SourceMapOptions): Omit\<DecodedSourceMap, 'sourcesContent'> & {sourcesContent: Array\<string | null>}; now generateDecodedMap(options?: SourceMapOptions): DecodedSourceMapOrMissingContent. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)
- **Signature changed** `Bundle.indentExclusionRanges`  

Was indentExclusionRanges: ExclusionRange | Array\<ExclusionRange>; now indentExclusionRanges: ExclusionRange | ExclusionRange\[\] | undefined. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)
- **Signature changed** `DecodedSourceMap.file`  

Was file: string; now file?: string. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)
- **Signature changed** `DecodedSourceMap.sourcesContent`  

Was sourcesContent?: string\[\]; now sourcesContent?: Array\<string | null>. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)
- **Signature changed** `default.constructor`  

Was constructor(str: string, options?: MagicStringOptions); now constructor(string: string, options?: MagicStringOptions). [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)
- **Signature changed** `default.indentExclusionRanges`  

Was indentExclusionRanges: ExclusionRange | Array\<ExclusionRange>; now indentExclusionRanges: MagicStringOptions\["indentExclusionRanges"\]. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)
- **Signature changed** `default.replace`  

Was replace(regex: RegExp | string, replacement: string | ((substring: string, ...args: any\[\]) => string)): this; now replace(searchValue: string | RegExp, replacement: string | ReplacementFunction): this. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)
- **Signature changed** `default.replaceAll`  

Was replaceAll(regex: RegExp | string, replacement: string | ((substring: string, ...args: any\[\]) => string)): this; now replaceAll(searchValue: string | RegExp, replacement: string | ReplacementFunction): this. [npmjs.com](https://www.npmjs.com/package/magic-string/v/1.0.0)

And 6 more in this version. [Sign up to see every change](https://app.since.dev/login?mode=signup&src=package-page)

## Older versions

3 older versions.

### magic-string 0.30.0 breaking changes

magic-string 0.30.0, released February 22, 2023: 1 breaking change.

- **Signature changed** `Bundle.addSource`  

Was addSource(source: MagicString | {filename?: string, content: MagicString}): Bundle; now addSource(source: MagicString | {filename?: string, content: MagicString, ignoreList?: boolean}): Bundle. [npmjs.com](https://www.npmjs.com/package/magic-string/v/0.30.0)

### magic-string 0.28.0 breaking changes

magic-string 0.28.0, released February 11, 2023: 2 breaking changes.

- **Signature changed** `DecodedSourceMap.sourcesContent`  

Was sourcesContent: string\[\]; now sourcesContent: (string | null)\[\]. [npmjs.com](https://www.npmjs.com/package/magic-string/v/0.28.0)
- **Signature changed** `SourceMap.sourcesContent`  

Was sourcesContent: string\[\]; now sourcesContent: (string | null)\[\]. [npmjs.com](https://www.npmjs.com/package/magic-string/v/0.28.0)

### magic-string 0.26.0 breaking changes

magic-string 0.26.0, released March 3, 2022: 2 breaking changes.

- **Removed**  

Node.js v10 is no longer supported. Users on Node.js v10 must upgrade their runtime before using this version. [github.com](https://github.com/Rich-Harris/magic-string/commit/6f09557faca7e6ca3032eff35d8a85d60277f115)
- **Behavior changed**  

The ESM build output is now written with a .mjs extension instead of .js. Code that imports the old ESM file paths must update them. [github.com](https://github.com/Rich-Harris/magic-string/commit/62d6e85a79aa553346349bb354f7c6c96a7627eb)

## Check your code

These are the changes. To see which of them reach your code, [scan a public repository](https://since.dev/scan.md), or have your coding agent call `check_code` with your manifest or lockfile over [MCP](https://since.dev/docs.md#mcp). [The API](https://since.dev/docs.md#api) reads every change in every version. A fix pull request opens for the changes that reach a connected repository. Nothing merges or deploys.

## Put your code on continuous maintenance.

Scan a public repository now, or give your agent one line.

[Scan a repository](https://since.dev/scan.md). Any public GitHub repository. No sign-in.

### Tell your agent what changed since it was trained.

`claude mcp add --transport http since https://api.since.dev/mcp`

[Get an API key](https://app.since.dev/login?mode=signup)

Codex, Cursor and any MCP client use https://api.since.dev/mcp.

---

Every page on this site as Markdown: https://since.dev/sitemap.md. For agents: https://since.dev/llms.txt.
