UNPKG

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