UNPKG

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