magic-string
Advanced tools
Comparing version 0.21.2 to 0.21.3
# magic-string changelog | ||
## 0.21.3 | ||
* Clone `indentExclusionRanges` correctly ([#122](https://github.com/Rich-Harris/magic-string/pull/122)) | ||
* Fix more typings ([#122](https://github.com/Rich-Harris/magic-string/pull/122)) | ||
## 0.21.2 | ||
@@ -4,0 +9,0 @@ |
@@ -517,5 +517,3 @@ 'use strict'; | ||
if ( this.indentExclusionRanges ) { | ||
cloned.indentExclusionRanges = typeof this.indentExclusionRanges[0] === 'number' ? | ||
[ this.indentExclusionRanges[0], this.indentExclusionRanges[1] ] : | ||
this.indentExclusionRanges.map( function (range) { return [ range.start, range.end ]; } ); | ||
cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); | ||
} | ||
@@ -522,0 +520,0 @@ |
@@ -515,5 +515,3 @@ import { encode } from 'vlq'; | ||
if ( this.indentExclusionRanges ) { | ||
cloned.indentExclusionRanges = typeof this.indentExclusionRanges[0] === 'number' ? | ||
[ this.indentExclusionRanges[0], this.indentExclusionRanges[1] ] : | ||
this.indentExclusionRanges.map( function (range) { return [ range.start, range.end ]; } ); | ||
cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); | ||
} | ||
@@ -520,0 +518,0 @@ |
@@ -567,5 +567,3 @@ (function (global, factory) { | ||
if ( this.indentExclusionRanges ) { | ||
cloned.indentExclusionRanges = typeof this.indentExclusionRanges[0] === 'number' ? | ||
[ this.indentExclusionRanges[0], this.indentExclusionRanges[1] ] : | ||
this.indentExclusionRanges.map( function (range) { return [ range.start, range.end ]; } ); | ||
cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); | ||
} | ||
@@ -572,0 +570,0 @@ |
@@ -30,3 +30,3 @@ declare module "magic-string" { | ||
getIndentString(): string; | ||
indent(indentStr: string): Bundle; | ||
indent(indentStr?: string): Bundle; | ||
prepend(str: string): Bundle; | ||
@@ -40,9 +40,11 @@ toString(): string; | ||
export type ExclusionRange = [ number, number ]; | ||
export interface MagicStringOptions { | ||
filename: string, | ||
indentExclusionRanges: any; // TODO | ||
indentExclusionRanges: ExclusionRange | Array<ExclusionRange>; | ||
} | ||
export interface IndentOptions { | ||
exclude: any; // TODO | ||
exclude: ExclusionRange | Array<ExclusionRange>; | ||
indentStart: boolean; | ||
@@ -63,7 +65,7 @@ } | ||
clone(): MagicString; | ||
generateMap(options?: Partial<SourceMapOptions>); | ||
generateMap(options?: Partial<SourceMapOptions>): SourceMap; | ||
getIndentString(): string; | ||
indent(options?): MagicString; | ||
indent(indentStr: string, options: IndentOptions): MagicString; | ||
indent(options?: IndentOptions): MagicString; | ||
indent(indentStr?: string, options?: IndentOptions): MagicString; | ||
@@ -70,0 +72,0 @@ move(start: number, end: number, index: number): MagicString; |
@@ -5,3 +5,3 @@ { | ||
"author": "Rich Harris", | ||
"version": "0.21.2", | ||
"version": "0.21.3", | ||
"repository": "https://github.com/rich-harris/magic-string", | ||
@@ -8,0 +8,0 @@ "main": "dist/magic-string.cjs.js", |
@@ -119,5 +119,3 @@ import Chunk from './Chunk.js'; | ||
if ( this.indentExclusionRanges ) { | ||
cloned.indentExclusionRanges = typeof this.indentExclusionRanges[0] === 'number' ? | ||
[ this.indentExclusionRanges[0], this.indentExclusionRanges[1] ] : | ||
this.indentExclusionRanges.map( range => [ range.start, range.end ] ); | ||
cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); | ||
} | ||
@@ -124,0 +122,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
380179
4028