1 | # magic-string changelog
|
2 |
|
3 | ## 0.23.0
|
4 |
|
5 | * Use `sourcemap-codec` for improved performance ([#133](https://github.com/Rich-Harris/magic-string/pull/133))
|
6 |
|
7 | ## 0.22.5
|
8 |
|
9 | * Add TypeScript interfaces used by rollup ([#131](https://github.com/Rich-Harris/magic-string/pull/131))
|
10 | * Remove src directory from npm package
|
11 |
|
12 | ## 0.22.4
|
13 |
|
14 | * `contentOnly` and `storeName` are both optional
|
15 |
|
16 | ## 0.22.3
|
17 |
|
18 | * Add `original` to TS definitions
|
19 |
|
20 | ## 0.22.2
|
21 |
|
22 | * Avoid `declare module` ([#127](https://github.com/Rich-Harris/magic-string/pull/127))
|
23 |
|
24 | ## 0.22.1
|
25 |
|
26 | * Update TypeScript definitions ([#124](https://github.com/Rich-Harris/magic-string/pull/124))
|
27 |
|
28 | ## 0.22.0
|
29 |
|
30 | * Prevent `overwrite` state corruption ([#115](https://github.com/Rich-Harris/magic-string/issues/115))
|
31 | * Various bugfixes ([#126](https://github.com/Rich-Harris/magic-string/pull/126))
|
32 |
|
33 | ## 0.21.3
|
34 |
|
35 | * Clone `indentExclusionRanges` correctly ([#122](https://github.com/Rich-Harris/magic-string/pull/122))
|
36 | * Fix more typings ([#122](https://github.com/Rich-Harris/magic-string/pull/122))
|
37 |
|
38 | ## 0.21.2
|
39 |
|
40 | * Add `default` property referencing self in index-legacy.js, to work around TypeScript bug ([#121](https://github.com/Rich-Harris/magic-string/pull/121))
|
41 |
|
42 | ## 0.21.1
|
43 |
|
44 | * Add typings file to package
|
45 |
|
46 | ## 0.21.0
|
47 |
|
48 | * Add TypeScript bindings ([#119](https://github.com/Rich-Harris/magic-string/pull/119))
|
49 |
|
50 | ## 0.20.0
|
51 |
|
52 | * The fourth argument to `overwrite` is a `{storeName, contentOnly}` options object. `storeName: true` is equivalent to `true` before. `contentOnly` will preserve existing appends/prepends to the chunk in question
|
53 |
|
54 | ## 0.19.1
|
55 |
|
56 | * Prevent overwrites across a split point (i.e. following a `move`)
|
57 | * Implement `remove` separately to `overwrite`
|
58 |
|
59 | ## 0.19.0
|
60 |
|
61 | * More accurate bundle sourcemaps ([#114](https://github.com/Rich-Harris/magic-string/pull/114))
|
62 |
|
63 | ## 0.18.0
|
64 |
|
65 | * Optimisation – remove empty chunks following `overwrite` or `remove` ([#113](https://github.com/Rich-Harris/magic-string/pull/113))
|
66 |
|
67 | ## 0.17.0
|
68 |
|
69 | * Add `appendLeft`, `appendRight`, `prependLeft`, `prependRight` methods ([#109](https://github.com/Rich-Harris/magic-string/issues/109))
|
70 | * `insertLeft` and `insertRight` are deprecated in favour of `appendLeft` and `prependRight` respectively
|
71 |
|
72 | ## 0.16.0
|
73 |
|
74 | * Include inserts in range for `overwrite` and `remove` operations ([#89](https://github.com/Rich-Harris/magic-string/pull/89))
|
75 | * Make options optional for `bundle.generateMap(...)` ([#73](https://github.com/Rich-Harris/magic-string/pull/73))
|
76 |
|
77 | ## 0.15.2
|
78 |
|
79 | * Generate correct bundle sourcemap with prepended/appended content
|
80 |
|
81 | ## 0.15.1
|
82 |
|
83 | * Minor sourcemap fixes
|
84 |
|
85 | ## 0.15.0
|
86 |
|
87 | * Use named export of `Bundle` in ES build, so ES consumers of magic-string can tree-shake it out
|
88 |
|
89 | ## 0.14.0
|
90 |
|
91 | * Throw if overwrite of zero-length range is attempted
|
92 | * Correctly handle redundant move operations
|
93 |
|
94 | ## 0.13.1
|
95 |
|
96 | * Fix a bevy of `s.slice()` issues ([#62](https://github.com/Rich-Harris/magic-string/pull/62))
|
97 |
|
98 | ## 0.13.0
|
99 |
|
100 | * Breaking: `insertAfter` is now `insertLeft`, `insertBefore` is now `insertRight`
|
101 | * Breaking: `insert` is no longer available. Use `insertLeft` and `insertRight`
|
102 | * Significant performance improvements
|
103 |
|
104 | ## 0.12.1
|
105 |
|
106 | * Fix sourcemap generation with `insertAfter` and `insertBefore`
|
107 |
|
108 | ## 0.12.0
|
109 |
|
110 | * Add `insertAfter` and `insertBefore` methods
|
111 |
|
112 | ## 0.11.4
|
113 |
|
114 | * Fix two regression bugs with `trim()`
|
115 | * More informative error message on illegal removals
|
116 |
|
117 | ## 0.11.3
|
118 |
|
119 | * Fix trim methods to ensure correct sourcemaps with trimmed content ([#53](https://github.com/Rich-Harris/magic-string/pull/53))
|
120 |
|
121 | ## 0.11.2
|
122 |
|
123 | * Support sourcemaps with moved content
|
124 |
|
125 | ## 0.11.1
|
126 |
|
127 | * Use `findIndex` helper for 0.12 support
|
128 |
|
129 | ## 0.11.0
|
130 |
|
131 | * Add experimental `move()` method
|
132 | * Refactor internals to support `move()`
|
133 |
|
134 | ## 0.10.2
|
135 |
|
136 | * Do not overwrite inserts at the end of patched ranges ([#35](https://github.com/Rich-Harris/magic-string/pull/35))
|
137 |
|
138 | ## 0.10.1
|
139 |
|
140 | * Zero-length inserts are not removed on adjacent overwrites
|
141 |
|
142 | ## 0.10.0
|
143 |
|
144 | * Complete rewrite, resulting in ~40x speed increase ([#30](https://github.com/Rich-Harris/magic-string/pull/30))
|
145 | * Breaking – `magicString.locate` and `locateOrigin` are deprecated
|
146 | * More forgiving rules about contiguous patches, and which ranges are valid with `magicString.slice(...)`
|
147 |
|
148 | ## 0.9.1
|
149 |
|
150 | * Update deps
|
151 |
|
152 | ## 0.9.0
|
153 |
|
154 | * Update build process
|
155 |
|
156 | ## 0.8.0
|
157 |
|
158 | * Add an ES6 build, change default UMD build to CommonJS (but keeping existing UMD build with bundled dependencies)
|
159 | * Make properties non-enumerable, for cleaner logging
|
160 | * Update dependencies
|
161 |
|
162 | ## 0.7.0
|
163 |
|
164 | * The `names` array is populated when generating sourcemaps, and mappings include name indices where appropriate ([#16](https://github.com/Rich-Harris/magic-string/issues/16))
|
165 | * Replaced content is mapped correctly in sourcemaps ([#15](https://github.com/Rich-Harris/magic-string/issues/15))
|
166 |
|
167 | ## 0.6.6
|
168 |
|
169 | * Adjust mappings correctly when removing replaced content
|
170 | * Error correctly when removed characters are used as slice anchors
|
171 |
|
172 | ## 0.6.5
|
173 |
|
174 | * Fix `jsnext:main` in package.json
|
175 |
|
176 | ## 0.6.4
|
177 |
|
178 | * Fix bug with positive integer coercion
|
179 |
|
180 | ## 0.6.3
|
181 |
|
182 | * Intro content is correctly indented
|
183 | * Content following an intro with trailing newline is correctly indented
|
184 |
|
185 | ## 0.6.2
|
186 |
|
187 | * Noop indents are still chainable (fixes bug introduced in 0.6.1)
|
188 |
|
189 | ## 0.6.1
|
190 |
|
191 | * Indenting with an empty string is a noop
|
192 |
|
193 | ## 0.6.0
|
194 |
|
195 | * Use rollup for bundling, instead of esperanto
|
196 |
|
197 | ## 0.5.3
|
198 |
|
199 | * Correct sourcemap generation with bundles containing varied separators
|
200 | * `s.clone()` clones indent exclusion ranges and sourcemap locations
|
201 |
|
202 | ## 0.5.2
|
203 |
|
204 | * `s.slice()` accepts negative numbers, and the second argument can be omitted (means 'original string length'), just like `String.prototype.slice`
|
205 | * More informative error message when trying to overwrite content illegally
|
206 |
|
207 | ## 0.5.1
|
208 |
|
209 | * Allow bundle separator to be the empty string
|
210 | * Indenting is handled correctly with empty string separator
|
211 |
|
212 | ## 0.5.0
|
213 |
|
214 | * `s.replace()` is deprecated in favour of `s.overwrite()` (identical signature)
|
215 | * `bundle.addSource()` can take a `MagicString` instance as its sole argument, for convenience
|
216 | * The `options` in `new MagicString(str, options)` can include `filename` and `indentExclusionRanges` options, which will be used when bundling
|
217 | * New method: `s.snip( start, end )`
|
218 |
|
219 | ## 0.4.9
|
220 |
|
221 | * `file` option is optional when generating a bundle sourcemap
|
222 |
|
223 | ## 0.4.7
|
224 |
|
225 | * Repeated insertions at position 0 behave the same as other positions ([#10](https://github.com/Rich-Harris/magic-string/pull/10))
|
226 |
|
227 | ## 0.4.6
|
228 |
|
229 | * Overlapping ranges can be removed
|
230 | * Non-string content is rejected ([#9](https://github.com/Rich-Harris/magic-string/pull/9))
|
231 |
|
232 | ## 0.4.5
|
233 |
|
234 | * Implement `source.addSourcemapLocation()`
|
235 |
|
236 | ## 0.4.4
|
237 |
|
238 | * Another Windows fix, this time for file paths when bundling
|
239 |
|
240 | ## 0.4.3
|
241 |
|
242 | * Handle Windows-style CRLF newlines when determining whether a line is empty
|
243 |
|
244 | ## 0.4.2
|
245 |
|
246 | * Fix typo in package.json (d'oh again)
|
247 | * Use only relative paths for internal modules - makes bundling with dependents (i.e. esperanto) possible
|
248 |
|
249 | ## 0.4.1
|
250 |
|
251 | * Includes correct files in npm package (d'oh)
|
252 |
|
253 | ## 0.4.0
|
254 |
|
255 | * Using experimental Esperanto feature ([esperantojs/esperanto#68](https://github.com/esperantojs/esperanto/issues/68)) to generate version with `vlq` dependency included
|
256 |
|
257 | ## 0.3.1
|
258 |
|
259 | * Fixes a bug whereby multiple insertions at the same location would cause text to repeat ([#5](https://github.com/Rich-Harris/magic-string/issues/5))
|
260 |
|
261 | ## 0.3.0
|
262 |
|
263 | * Breaking change - `source.indentStr` is `null` if no lines are indented. Use `source.getIndentString()` for the old behaviour (guess, and if no lines are indented, return `\t`)
|
264 | * `bundle.getIndentString()` ignores sources with no indented lines when guessing indentation ([#3](https://github.com/Rich-Harris/magic-string/issues/3))
|
265 |
|
266 | ## 0.2.7
|
267 |
|
268 | * `source.trimLines()` removes empty lines from start/end of source, leaving other whitespace untouched
|
269 | * Indentation is not added to an empty source
|
270 |
|
271 | ## 0.2.6
|
272 |
|
273 | * Performance improvement - adjustments are only made when necessary
|
274 |
|
275 | ## 0.2.5
|
276 |
|
277 | * Single spaces are ignored when guessing indentation - experience shows these are more likely to be e.g. JSDoc comments than actual indentation
|
278 | * `bundle.addSource()` can take an `indentExclusionRanges` option
|
279 |
|
280 | ## 0.2.4
|
281 |
|
282 | * Empty lines are not indented
|
283 |
|
284 | ## 0.2.3
|
285 |
|
286 | * Fixes edge case with bundle sourcemaps
|
287 |
|
288 | ## 0.2.2
|
289 |
|
290 | * Make `sources` paths in sourcemaps relative to `options.file`
|
291 |
|
292 | ## 0.2.1
|
293 |
|
294 | * Minor fix for `bundle.indent()`
|
295 |
|
296 | ## 0.2.0
|
297 |
|
298 | * Implement `MagicString.Bundle` for concatenating magic strings
|
299 |
|
300 | ## 0.1.10
|
301 |
|
302 | * Fix sourcemap encoding
|
303 |
|
304 | ## 0.1.9
|
305 |
|
306 | * Better performance when indenting large chunks of code
|
307 |
|
308 | ## 0.1.8
|
309 |
|
310 | * Sourcemaps generated with `s.generateMap()` have a `toUrl()` method that generates a DataURI
|
311 |
|
312 | ## 0.1.7
|
313 |
|
314 | * Implement `s.insert( index, content )` - roughly equivalent to `s.replace( index, index, content )`
|
315 |
|
316 | ## 0.1.6
|
317 |
|
318 | * Version bump for npm's benefit
|
319 |
|
320 | ## 0.1.5
|
321 |
|
322 | * `s.indent({ exclude: [ x, y ] })` prevents lines between (original) characters `x` and `y` from being indented. Multiple exclusion ranges are also supported (e.g. `exclude: [[a, b], [c, d]]`)
|
323 |
|
324 | ## 0.1.4
|
325 |
|
326 | * `s.locate()` doesn't throw out-of-bound error if index is equal to original string's length
|
327 |
|
328 | ## 0.1.3
|
329 |
|
330 | * `s.trim()` returns `this` (i.e. is chainable)
|
331 |
|
332 | ## 0.1.2
|
333 |
|
334 | * Implement `s.slice()`
|
335 |
|
336 | ## 0.1.1
|
337 |
|
338 | * Implement `s.trim()`
|
339 |
|
340 | ## 0.1.0
|
341 |
|
342 | * First release
|