jass-vue 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +43 -0
  4. data/lib/jass/vue.rb +12 -0
  5. data/lib/jass/vue/version.rb +5 -0
  6. data/vendor/node_modules/arr-diff/index.js +58 -0
  7. data/vendor/node_modules/arr-diff/package.json +49 -0
  8. data/vendor/node_modules/arr-flatten/index.js +22 -0
  9. data/vendor/node_modules/arr-flatten/package.json +76 -0
  10. data/vendor/node_modules/array-unique/index.js +28 -0
  11. data/vendor/node_modules/array-unique/package.json +37 -0
  12. data/vendor/node_modules/braces/index.js +399 -0
  13. data/vendor/node_modules/braces/package.json +83 -0
  14. data/vendor/node_modules/de-indent/index.js +45 -0
  15. data/vendor/node_modules/de-indent/package.json +25 -0
  16. data/vendor/node_modules/de-indent/test.js +30 -0
  17. data/vendor/node_modules/estree-walker/dist/estree-walker.es.js +55 -0
  18. data/vendor/node_modules/estree-walker/dist/estree-walker.es6.js +59 -0
  19. data/vendor/node_modules/estree-walker/dist/estree-walker.umd.js +65 -0
  20. data/vendor/node_modules/estree-walker/package.json +33 -0
  21. data/vendor/node_modules/estree-walker/src/estree-walker.js +49 -0
  22. data/vendor/node_modules/expand-brackets/index.js +163 -0
  23. data/vendor/node_modules/expand-brackets/package.json +62 -0
  24. data/vendor/node_modules/expand-range/index.js +43 -0
  25. data/vendor/node_modules/expand-range/package.json +73 -0
  26. data/vendor/node_modules/extglob/index.js +178 -0
  27. data/vendor/node_modules/extglob/package.json +60 -0
  28. data/vendor/node_modules/filename-regex/index.js +10 -0
  29. data/vendor/node_modules/filename-regex/package.json +50 -0
  30. data/vendor/node_modules/fill-range/index.js +408 -0
  31. data/vendor/node_modules/fill-range/package.json +61 -0
  32. data/vendor/node_modules/for-in/index.js +16 -0
  33. data/vendor/node_modules/for-in/package.json +68 -0
  34. data/vendor/node_modules/for-own/index.js +19 -0
  35. data/vendor/node_modules/for-own/package.json +70 -0
  36. data/vendor/node_modules/glob-base/index.js +51 -0
  37. data/vendor/node_modules/glob-base/package.json +52 -0
  38. data/vendor/node_modules/glob-parent/index.js +10 -0
  39. data/vendor/node_modules/glob-parent/package.json +35 -0
  40. data/vendor/node_modules/glob-parent/test.js +28 -0
  41. data/vendor/node_modules/he/bin/he +148 -0
  42. data/vendor/node_modules/he/he.js +342 -0
  43. data/vendor/node_modules/he/man/he.1 +78 -0
  44. data/vendor/node_modules/he/package.json +56 -0
  45. data/vendor/node_modules/is-buffer/index.js +21 -0
  46. data/vendor/node_modules/is-buffer/package.json +51 -0
  47. data/vendor/node_modules/is-dotfile/index.js +14 -0
  48. data/vendor/node_modules/is-dotfile/package.json +69 -0
  49. data/vendor/node_modules/is-equal-shallow/index.js +27 -0
  50. data/vendor/node_modules/is-equal-shallow/package.json +54 -0
  51. data/vendor/node_modules/is-extendable/index.js +13 -0
  52. data/vendor/node_modules/is-extendable/package.json +51 -0
  53. data/vendor/node_modules/is-extglob/index.js +11 -0
  54. data/vendor/node_modules/is-extglob/package.json +48 -0
  55. data/vendor/node_modules/is-glob/index.js +14 -0
  56. data/vendor/node_modules/is-glob/package.json +60 -0
  57. data/vendor/node_modules/is-number/index.js +19 -0
  58. data/vendor/node_modules/is-number/package.json +59 -0
  59. data/vendor/node_modules/is-posix-bracket/index.js +10 -0
  60. data/vendor/node_modules/is-posix-bracket/package.json +64 -0
  61. data/vendor/node_modules/is-primitive/index.js +13 -0
  62. data/vendor/node_modules/is-primitive/package.json +46 -0
  63. data/vendor/node_modules/isarray/index.js +5 -0
  64. data/vendor/node_modules/isarray/package.json +45 -0
  65. data/vendor/node_modules/isarray/test.js +20 -0
  66. data/vendor/node_modules/isobject/index.js +14 -0
  67. data/vendor/node_modules/isobject/package.json +67 -0
  68. data/vendor/node_modules/kind-of/index.js +116 -0
  69. data/vendor/node_modules/kind-of/package.json +90 -0
  70. data/vendor/node_modules/magic-string/dist/magic-string.cjs.js +1287 -0
  71. data/vendor/node_modules/magic-string/dist/magic-string.es.js +1283 -0
  72. data/vendor/node_modules/magic-string/dist/magic-string.umd.js +1339 -0
  73. data/vendor/node_modules/magic-string/package.json +60 -0
  74. data/vendor/node_modules/magic-string/src/Bundle.js +263 -0
  75. data/vendor/node_modules/magic-string/src/Chunk.js +154 -0
  76. data/vendor/node_modules/magic-string/src/MagicString.js +618 -0
  77. data/vendor/node_modules/magic-string/src/index-legacy.js +6 -0
  78. data/vendor/node_modules/magic-string/src/index.js +4 -0
  79. data/vendor/node_modules/magic-string/src/utils/Mappings.js +117 -0
  80. data/vendor/node_modules/magic-string/src/utils/SourceMap.js +21 -0
  81. data/vendor/node_modules/magic-string/src/utils/Stats.js +18 -0
  82. data/vendor/node_modules/magic-string/src/utils/btoa.js +13 -0
  83. data/vendor/node_modules/magic-string/src/utils/getLocator.js +35 -0
  84. data/vendor/node_modules/magic-string/src/utils/getRelativePath.js +18 -0
  85. data/vendor/node_modules/magic-string/src/utils/guessIndent.js +25 -0
  86. data/vendor/node_modules/magic-string/src/utils/hasOwnProp.js +1 -0
  87. data/vendor/node_modules/magic-string/src/utils/isObject.js +5 -0
  88. data/vendor/node_modules/micromatch/index.js +431 -0
  89. data/vendor/node_modules/micromatch/lib/chars.js +67 -0
  90. data/vendor/node_modules/micromatch/lib/expand.js +304 -0
  91. data/vendor/node_modules/micromatch/lib/glob.js +193 -0
  92. data/vendor/node_modules/micromatch/lib/utils.js +149 -0
  93. data/vendor/node_modules/micromatch/package.json +114 -0
  94. data/vendor/node_modules/normalize-path/index.js +19 -0
  95. data/vendor/node_modules/normalize-path/package.json +78 -0
  96. data/vendor/node_modules/object.omit/index.js +40 -0
  97. data/vendor/node_modules/object.omit/package.json +67 -0
  98. data/vendor/node_modules/parse-glob/index.js +156 -0
  99. data/vendor/node_modules/parse-glob/package.json +62 -0
  100. data/vendor/node_modules/preserve/index.js +54 -0
  101. data/vendor/node_modules/preserve/package.json +48 -0
  102. data/vendor/node_modules/preserve/test.js +48 -0
  103. data/vendor/node_modules/randomatic/index.js +82 -0
  104. data/vendor/node_modules/randomatic/node_modules/is-number/index.js +22 -0
  105. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/index.js +116 -0
  106. data/vendor/node_modules/randomatic/node_modules/is-number/node_modules/kind-of/package.json +90 -0
  107. data/vendor/node_modules/randomatic/node_modules/is-number/package.json +83 -0
  108. data/vendor/node_modules/randomatic/node_modules/kind-of/index.js +119 -0
  109. data/vendor/node_modules/randomatic/node_modules/kind-of/package.json +90 -0
  110. data/vendor/node_modules/randomatic/package.json +78 -0
  111. data/vendor/node_modules/regex-cache/index.js +68 -0
  112. data/vendor/node_modules/regex-cache/package.json +64 -0
  113. data/vendor/node_modules/remove-trailing-separator/index.js +17 -0
  114. data/vendor/node_modules/remove-trailing-separator/package.json +37 -0
  115. data/vendor/node_modules/repeat-element/index.js +18 -0
  116. data/vendor/node_modules/repeat-element/package.json +44 -0
  117. data/vendor/node_modules/repeat-string/index.js +70 -0
  118. data/vendor/node_modules/repeat-string/package.json +77 -0
  119. data/vendor/node_modules/rollup-plugin-vue2/dist/rollup-plugin-vue2.common.js +164 -0
  120. data/vendor/node_modules/rollup-plugin-vue2/dist/rollup-plugin-vue2.es.js +160 -0
  121. data/vendor/node_modules/rollup-plugin-vue2/package.json +50 -0
  122. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js +223 -0
  123. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es.js +214 -0
  124. data/vendor/node_modules/rollup-pluginutils/dist/pluginutils.es6.js +217 -0
  125. data/vendor/node_modules/rollup-pluginutils/package.json +40 -0
  126. data/vendor/node_modules/rollup-pluginutils/src/addExtension.js +6 -0
  127. data/vendor/node_modules/rollup-pluginutils/src/attachScopes.js +147 -0
  128. data/vendor/node_modules/rollup-pluginutils/src/createFilter.js +33 -0
  129. data/vendor/node_modules/rollup-pluginutils/src/index.js +4 -0
  130. data/vendor/node_modules/rollup-pluginutils/src/makeLegalIdentifier.js +15 -0
  131. data/vendor/node_modules/rollup-pluginutils/src/utils/ensureArray.js +5 -0
  132. data/vendor/node_modules/vlq/dist/vlq.js +91 -0
  133. data/vendor/node_modules/vlq/package.json +27 -0
  134. data/vendor/node_modules/vlq/src/vlq.js +78 -0
  135. data/vendor/node_modules/vue-template-compiler/browser.js +5237 -0
  136. data/vendor/node_modules/vue-template-compiler/build.js +4835 -0
  137. data/vendor/node_modules/vue-template-compiler/index.js +18 -0
  138. data/vendor/node_modules/vue-template-compiler/package.json +27 -0
  139. data/vendor/node_modules/vue-template-es2015-compiler/buble.js +14112 -0
  140. data/vendor/node_modules/vue-template-es2015-compiler/index.js +24 -0
  141. data/vendor/node_modules/vue-template-es2015-compiler/package.json +28 -0
  142. data/vendor/package.json +9 -0
  143. data/vendor/yarn.lock +268 -0
  144. metadata +242 -0
@@ -0,0 +1,1339 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define(factory) :
4
+ (global.MagicString = factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ function Chunk ( start, end, content ) {
8
+ this.start = start;
9
+ this.end = end;
10
+ this.original = content;
11
+
12
+ this.intro = '';
13
+ this.outro = '';
14
+
15
+ this.content = content;
16
+ this.storeName = false;
17
+ this.edited = false;
18
+
19
+ // we make these non-enumerable, for sanity while debugging
20
+ Object.defineProperties( this, {
21
+ previous: { writable: true, value: null },
22
+ next: { writable: true, value: null }
23
+ });
24
+ }
25
+
26
+ Chunk.prototype = {
27
+ appendLeft: function appendLeft ( content ) {
28
+ this.outro += content;
29
+ },
30
+
31
+ appendRight: function appendRight ( content ) {
32
+ this.intro = this.intro + content;
33
+ },
34
+
35
+ clone: function clone () {
36
+ var chunk = new Chunk( this.start, this.end, this.original );
37
+
38
+ chunk.intro = this.intro;
39
+ chunk.outro = this.outro;
40
+ chunk.content = this.content;
41
+ chunk.storeName = this.storeName;
42
+ chunk.edited = this.edited;
43
+
44
+ return chunk;
45
+ },
46
+
47
+ contains: function contains ( index ) {
48
+ return this.start < index && index < this.end;
49
+ },
50
+
51
+ eachNext: function eachNext ( fn ) {
52
+ var chunk = this;
53
+ while ( chunk ) {
54
+ fn( chunk );
55
+ chunk = chunk.next;
56
+ }
57
+ },
58
+
59
+ eachPrevious: function eachPrevious ( fn ) {
60
+ var chunk = this;
61
+ while ( chunk ) {
62
+ fn( chunk );
63
+ chunk = chunk.previous;
64
+ }
65
+ },
66
+
67
+ edit: function edit ( content, storeName ) {
68
+ this.content = content;
69
+ this.intro = '';
70
+ this.outro = '';
71
+ this.storeName = storeName;
72
+
73
+ this.edited = true;
74
+
75
+ return this;
76
+ },
77
+
78
+ prependLeft: function prependLeft ( content ) {
79
+ this.outro = content + this.outro;
80
+ },
81
+
82
+ prependRight: function prependRight ( content ) {
83
+ this.intro = content + this.intro;
84
+ },
85
+
86
+ split: function split ( index ) {
87
+ var sliceIndex = index - this.start;
88
+
89
+ var originalBefore = this.original.slice( 0, sliceIndex );
90
+ var originalAfter = this.original.slice( sliceIndex );
91
+
92
+ this.original = originalBefore;
93
+
94
+ var newChunk = new Chunk( index, this.end, originalAfter );
95
+ newChunk.outro = this.outro;
96
+ this.outro = '';
97
+
98
+ this.end = index;
99
+
100
+ if ( this.edited ) {
101
+ // TODO is this block necessary?...
102
+ newChunk.edit( '', false );
103
+ this.content = '';
104
+ } else {
105
+ this.content = originalBefore;
106
+ }
107
+
108
+ newChunk.next = this.next;
109
+ if ( newChunk.next ) { newChunk.next.previous = newChunk; }
110
+ newChunk.previous = this;
111
+ this.next = newChunk;
112
+
113
+ return newChunk;
114
+ },
115
+
116
+ toString: function toString () {
117
+ return this.intro + this.content + this.outro;
118
+ },
119
+
120
+ trimEnd: function trimEnd ( rx ) {
121
+ this.outro = this.outro.replace( rx, '' );
122
+ if ( this.outro.length ) { return true; }
123
+
124
+ var trimmed = this.content.replace( rx, '' );
125
+
126
+ if ( trimmed.length ) {
127
+ if ( trimmed !== this.content ) {
128
+ this.split( this.start + trimmed.length ).edit( '', false );
129
+ }
130
+
131
+ return true;
132
+ } else {
133
+ this.edit( '', false );
134
+
135
+ this.intro = this.intro.replace( rx, '' );
136
+ if ( this.intro.length ) { return true; }
137
+ }
138
+ },
139
+
140
+ trimStart: function trimStart ( rx ) {
141
+ this.intro = this.intro.replace( rx, '' );
142
+ if ( this.intro.length ) { return true; }
143
+
144
+ var trimmed = this.content.replace( rx, '' );
145
+
146
+ if ( trimmed.length ) {
147
+ if ( trimmed !== this.content ) {
148
+ this.split( this.end - trimmed.length );
149
+ this.edit( '', false );
150
+ }
151
+
152
+ return true;
153
+ } else {
154
+ this.edit( '', false );
155
+
156
+ this.outro = this.outro.replace( rx, '' );
157
+ if ( this.outro.length ) { return true; }
158
+ }
159
+ }
160
+ };
161
+
162
+ var _btoa;
163
+
164
+ if ( typeof window !== 'undefined' && typeof window.btoa === 'function' ) {
165
+ _btoa = window.btoa;
166
+ } else if ( typeof Buffer === 'function' ) {
167
+ _btoa = function (str) { return new Buffer( str ).toString( 'base64' ); };
168
+ } else {
169
+ _btoa = function () {
170
+ throw new Error( 'Unsupported environment: `window.btoa` or `Buffer` should be supported.' );
171
+ };
172
+ }
173
+
174
+ var btoa = _btoa;
175
+
176
+ function SourceMap ( properties ) {
177
+ this.version = 3;
178
+
179
+ this.file = properties.file;
180
+ this.sources = properties.sources;
181
+ this.sourcesContent = properties.sourcesContent;
182
+ this.names = properties.names;
183
+ this.mappings = properties.mappings;
184
+ }
185
+
186
+ SourceMap.prototype = {
187
+ toString: function toString () {
188
+ return JSON.stringify( this );
189
+ },
190
+
191
+ toUrl: function toUrl () {
192
+ return 'data:application/json;charset=utf-8;base64,' + btoa( this.toString() );
193
+ }
194
+ };
195
+
196
+ function guessIndent ( code ) {
197
+ var lines = code.split( '\n' );
198
+
199
+ var tabbed = lines.filter( function (line) { return /^\t+/.test( line ); } );
200
+ var spaced = lines.filter( function (line) { return /^ {2,}/.test( line ); } );
201
+
202
+ if ( tabbed.length === 0 && spaced.length === 0 ) {
203
+ return null;
204
+ }
205
+
206
+ // More lines tabbed than spaced? Assume tabs, and
207
+ // default to tabs in the case of a tie (or nothing
208
+ // to go on)
209
+ if ( tabbed.length >= spaced.length ) {
210
+ return '\t';
211
+ }
212
+
213
+ // Otherwise, we need to guess the multiple
214
+ var min = spaced.reduce( function ( previous, current ) {
215
+ var numSpaces = /^ +/.exec( current )[0].length;
216
+ return Math.min( numSpaces, previous );
217
+ }, Infinity );
218
+
219
+ return new Array( min + 1 ).join( ' ' );
220
+ }
221
+
222
+ function getRelativePath ( from, to ) {
223
+ var fromParts = from.split( /[\/\\]/ );
224
+ var toParts = to.split( /[\/\\]/ );
225
+
226
+ fromParts.pop(); // get dirname
227
+
228
+ while ( fromParts[0] === toParts[0] ) {
229
+ fromParts.shift();
230
+ toParts.shift();
231
+ }
232
+
233
+ if ( fromParts.length ) {
234
+ var i = fromParts.length;
235
+ while ( i-- ) { fromParts[i] = '..'; }
236
+ }
237
+
238
+ return fromParts.concat( toParts ).join( '/' );
239
+ }
240
+
241
+ var toString = Object.prototype.toString;
242
+
243
+ function isObject ( thing ) {
244
+ return toString.call( thing ) === '[object Object]';
245
+ }
246
+
247
+ function getLocator ( source ) {
248
+ var originalLines = source.split( '\n' );
249
+
250
+ var start = 0;
251
+ var lineRanges = originalLines.map( function ( line, i ) {
252
+ var end = start + line.length + 1;
253
+ var range = { start: start, end: end, line: i };
254
+
255
+ start = end;
256
+ return range;
257
+ });
258
+
259
+ var i = 0;
260
+
261
+ function rangeContains ( range, index ) {
262
+ return range.start <= index && index < range.end;
263
+ }
264
+
265
+ function getLocation ( range, index ) {
266
+ return { line: range.line, column: index - range.start };
267
+ }
268
+
269
+ return function locate ( index ) {
270
+ var range = lineRanges[i];
271
+
272
+ var d = index >= range.end ? 1 : -1;
273
+
274
+ while ( range ) {
275
+ if ( rangeContains( range, index ) ) { return getLocation( range, index ); }
276
+
277
+ i += d;
278
+ range = lineRanges[i];
279
+ }
280
+ };
281
+ }
282
+
283
+ var charToInteger = {};
284
+ var integerToChar = {};
285
+
286
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split( '' ).forEach( function ( char, i ) {
287
+ charToInteger[ char ] = i;
288
+ integerToChar[ i ] = char;
289
+ });
290
+
291
+
292
+
293
+ function encode ( value ) {
294
+ var result, i;
295
+
296
+ if ( typeof value === 'number' ) {
297
+ result = encodeInteger( value );
298
+ } else {
299
+ result = '';
300
+ for ( i = 0; i < value.length; i += 1 ) {
301
+ result += encodeInteger( value[i] );
302
+ }
303
+ }
304
+
305
+ return result;
306
+ }
307
+
308
+ function encodeInteger ( num ) {
309
+ var result = '', clamped;
310
+
311
+ if ( num < 0 ) {
312
+ num = ( -num << 1 ) | 1;
313
+ } else {
314
+ num <<= 1;
315
+ }
316
+
317
+ do {
318
+ clamped = num & 31;
319
+ num >>= 5;
320
+
321
+ if ( num > 0 ) {
322
+ clamped |= 32;
323
+ }
324
+
325
+ result += integerToChar[ clamped ];
326
+ } while ( num > 0 );
327
+
328
+ return result;
329
+ }
330
+
331
+ function Mappings ( hires ) {
332
+ var this$1 = this;
333
+
334
+ var offsets = {
335
+ generatedCodeColumn: 0,
336
+ sourceIndex: 0,
337
+ sourceCodeLine: 0,
338
+ sourceCodeColumn: 0,
339
+ sourceCodeName: 0
340
+ };
341
+
342
+ var generatedCodeLine = 0;
343
+ var generatedCodeColumn = 0;
344
+
345
+ this.raw = [];
346
+ var rawSegments = this.raw[ generatedCodeLine ] = [];
347
+
348
+ var pending = null;
349
+
350
+ this.addEdit = function ( sourceIndex, content, original, loc, nameIndex ) {
351
+ if ( content.length ) {
352
+ rawSegments.push([
353
+ generatedCodeColumn,
354
+ sourceIndex,
355
+ loc.line,
356
+ loc.column,
357
+ nameIndex ]);
358
+ } else if ( pending ) {
359
+ rawSegments.push( pending );
360
+ }
361
+
362
+ this$1.advance( content );
363
+ pending = null;
364
+ };
365
+
366
+ this.addUneditedChunk = function ( sourceIndex, chunk, original, loc, sourcemapLocations ) {
367
+ var originalCharIndex = chunk.start;
368
+ var first = true;
369
+
370
+ while ( originalCharIndex < chunk.end ) {
371
+ if ( hires || first || sourcemapLocations[ originalCharIndex ] ) {
372
+ rawSegments.push([
373
+ generatedCodeColumn,
374
+ sourceIndex,
375
+ loc.line,
376
+ loc.column,
377
+ -1
378
+ ]);
379
+ }
380
+
381
+ if ( original[ originalCharIndex ] === '\n' ) {
382
+ loc.line += 1;
383
+ loc.column = 0;
384
+ generatedCodeLine += 1;
385
+ this$1.raw[ generatedCodeLine ] = rawSegments = [];
386
+ generatedCodeColumn = 0;
387
+ } else {
388
+ loc.column += 1;
389
+ generatedCodeColumn += 1;
390
+ }
391
+
392
+ originalCharIndex += 1;
393
+ first = false;
394
+ }
395
+
396
+ pending = [
397
+ generatedCodeColumn,
398
+ sourceIndex,
399
+ loc.line,
400
+ loc.column,
401
+ -1 ];
402
+ };
403
+
404
+ this.advance = function (str) {
405
+ if ( !str ) { return; }
406
+
407
+ var lines = str.split( '\n' );
408
+ var lastLine = lines.pop();
409
+
410
+ if ( lines.length ) {
411
+ generatedCodeLine += lines.length;
412
+ this$1.raw[ generatedCodeLine ] = rawSegments = [];
413
+ generatedCodeColumn = lastLine.length;
414
+ } else {
415
+ generatedCodeColumn += lastLine.length;
416
+ }
417
+ };
418
+
419
+ this.encode = function () {
420
+ return this$1.raw.map( function (segments) {
421
+ var generatedCodeColumn = 0;
422
+
423
+ return segments.map( function (segment) {
424
+ var arr = [
425
+ segment[0] - generatedCodeColumn,
426
+ segment[1] - offsets.sourceIndex,
427
+ segment[2] - offsets.sourceCodeLine,
428
+ segment[3] - offsets.sourceCodeColumn
429
+ ];
430
+
431
+ generatedCodeColumn = segment[0];
432
+ offsets.sourceIndex = segment[1];
433
+ offsets.sourceCodeLine = segment[2];
434
+ offsets.sourceCodeColumn = segment[3];
435
+
436
+ if ( ~segment[4] ) {
437
+ arr.push( segment[4] - offsets.sourceCodeName );
438
+ offsets.sourceCodeName = segment[4];
439
+ }
440
+
441
+ return encode( arr );
442
+ }).join( ',' );
443
+ }).join( ';' );
444
+ };
445
+ }
446
+
447
+ var Stats = function Stats () {
448
+ Object.defineProperties( this, {
449
+ startTimes: { value: {} }
450
+ });
451
+ };
452
+
453
+ Stats.prototype.time = function time ( label ) {
454
+ this.startTimes[ label ] = process.hrtime();
455
+ };
456
+
457
+ Stats.prototype.timeEnd = function timeEnd ( label ) {
458
+ var elapsed = process.hrtime( this.startTimes[ label ] );
459
+
460
+ if ( !this[ label ] ) { this[ label ] = 0; }
461
+ this[ label ] += elapsed[0] * 1e3 + elapsed[1] * 1e-6;
462
+ };
463
+
464
+ var warned = {
465
+ insertLeft: false,
466
+ insertRight: false
467
+ };
468
+
469
+ function MagicString$1 ( string, options ) {
470
+ if ( options === void 0 ) options = {};
471
+
472
+ var chunk = new Chunk( 0, string.length, string );
473
+
474
+ Object.defineProperties( this, {
475
+ original: { writable: true, value: string },
476
+ outro: { writable: true, value: '' },
477
+ intro: { writable: true, value: '' },
478
+ firstChunk: { writable: true, value: chunk },
479
+ lastChunk: { writable: true, value: chunk },
480
+ lastSearchedChunk: { writable: true, value: chunk },
481
+ byStart: { writable: true, value: {} },
482
+ byEnd: { writable: true, value: {} },
483
+ filename: { writable: true, value: options.filename },
484
+ indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
485
+ sourcemapLocations: { writable: true, value: {} },
486
+ storedNames: { writable: true, value: {} },
487
+ indentStr: { writable: true, value: guessIndent( string ) }
488
+ });
489
+
490
+ this.byStart[ 0 ] = chunk;
491
+ this.byEnd[ string.length ] = chunk;
492
+ }
493
+
494
+ MagicString$1.prototype = {
495
+ addSourcemapLocation: function addSourcemapLocation ( char ) {
496
+ this.sourcemapLocations[ char ] = true;
497
+ },
498
+
499
+ append: function append ( content ) {
500
+ if ( typeof content !== 'string' ) { throw new TypeError( 'outro content must be a string' ); }
501
+
502
+ this.outro += content;
503
+ return this;
504
+ },
505
+
506
+ appendLeft: function appendLeft ( index, content ) {
507
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
508
+
509
+ this._split( index );
510
+
511
+ var chunk = this.byEnd[ index ];
512
+
513
+ if ( chunk ) {
514
+ chunk.appendLeft( content );
515
+ } else {
516
+ this.intro += content;
517
+ }
518
+
519
+ return this;
520
+ },
521
+
522
+ appendRight: function appendRight ( index, content ) {
523
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
524
+
525
+ this._split( index );
526
+
527
+ var chunk = this.byStart[ index ];
528
+
529
+ if ( chunk ) {
530
+ chunk.appendRight( content );
531
+ } else {
532
+ this.outro += content;
533
+ }
534
+
535
+ return this;
536
+ },
537
+
538
+ clone: function clone () {
539
+ var cloned = new MagicString$1( this.original, { filename: this.filename });
540
+
541
+ var originalChunk = this.firstChunk;
542
+ var clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
543
+
544
+ while ( originalChunk ) {
545
+ cloned.byStart[ clonedChunk.start ] = clonedChunk;
546
+ cloned.byEnd[ clonedChunk.end ] = clonedChunk;
547
+
548
+ var nextOriginalChunk = originalChunk.next;
549
+ var nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
550
+
551
+ if ( nextClonedChunk ) {
552
+ clonedChunk.next = nextClonedChunk;
553
+ nextClonedChunk.previous = clonedChunk;
554
+
555
+ clonedChunk = nextClonedChunk;
556
+ }
557
+
558
+ originalChunk = nextOriginalChunk;
559
+ }
560
+
561
+ cloned.lastChunk = clonedChunk;
562
+
563
+ if ( this.indentExclusionRanges ) {
564
+ cloned.indentExclusionRanges = typeof this.indentExclusionRanges[0] === 'number' ?
565
+ [ this.indentExclusionRanges[0], this.indentExclusionRanges[1] ] :
566
+ this.indentExclusionRanges.map( function (range) { return [ range.start, range.end ]; } );
567
+ }
568
+
569
+ Object.keys( this.sourcemapLocations ).forEach( function (loc) {
570
+ cloned.sourcemapLocations[ loc ] = true;
571
+ });
572
+
573
+ return cloned;
574
+ },
575
+
576
+ generateMap: function generateMap ( options ) {
577
+ var this$1 = this;
578
+
579
+ options = options || {};
580
+
581
+ var sourceIndex = 0;
582
+ var names = Object.keys( this.storedNames );
583
+ var mappings = new Mappings( options.hires );
584
+
585
+ var locate = getLocator( this.original );
586
+
587
+ if ( this.intro ) {
588
+ mappings.advance( this.intro );
589
+ }
590
+
591
+ this.firstChunk.eachNext( function (chunk) {
592
+ var loc = locate( chunk.start );
593
+
594
+ if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
595
+
596
+ if ( chunk.edited ) {
597
+ mappings.addEdit( sourceIndex, chunk.content, chunk.original, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
598
+ } else {
599
+ mappings.addUneditedChunk( sourceIndex, chunk, this$1.original, loc, this$1.sourcemapLocations );
600
+ }
601
+
602
+ if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
603
+ });
604
+
605
+ var map = new SourceMap({
606
+ file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
607
+ sources: [ options.source ? getRelativePath( options.file || '', options.source ) : null ],
608
+ sourcesContent: options.includeContent ? [ this.original ] : [ null ],
609
+ names: names,
610
+ mappings: mappings.encode()
611
+ });
612
+ return map;
613
+ },
614
+
615
+ getIndentString: function getIndentString () {
616
+ return this.indentStr === null ? '\t' : this.indentStr;
617
+ },
618
+
619
+ indent: function indent ( indentStr, options ) {
620
+ var this$1 = this;
621
+
622
+ var pattern = /^[^\r\n]/gm;
623
+
624
+ if ( isObject( indentStr ) ) {
625
+ options = indentStr;
626
+ indentStr = undefined;
627
+ }
628
+
629
+ indentStr = indentStr !== undefined ? indentStr : ( this.indentStr || '\t' );
630
+
631
+ if ( indentStr === '' ) { return this; } // noop
632
+
633
+ options = options || {};
634
+
635
+ // Process exclusion ranges
636
+ var isExcluded = {};
637
+
638
+ if ( options.exclude ) {
639
+ var exclusions = typeof options.exclude[0] === 'number' ? [ options.exclude ] : options.exclude;
640
+ exclusions.forEach( function (exclusion) {
641
+ for ( var i = exclusion[0]; i < exclusion[1]; i += 1 ) {
642
+ isExcluded[i] = true;
643
+ }
644
+ });
645
+ }
646
+
647
+ var shouldIndentNextCharacter = options.indentStart !== false;
648
+ var replacer = function (match) {
649
+ if ( shouldIndentNextCharacter ) { return ("" + indentStr + match); }
650
+ shouldIndentNextCharacter = true;
651
+ return match;
652
+ };
653
+
654
+ this.intro = this.intro.replace( pattern, replacer );
655
+
656
+ var charIndex = 0;
657
+
658
+ var chunk = this.firstChunk;
659
+
660
+ while ( chunk ) {
661
+ var end = chunk.end;
662
+
663
+ if ( chunk.edited ) {
664
+ if ( !isExcluded[ charIndex ] ) {
665
+ chunk.content = chunk.content.replace( pattern, replacer );
666
+
667
+ if ( chunk.content.length ) {
668
+ shouldIndentNextCharacter = chunk.content[ chunk.content.length - 1 ] === '\n';
669
+ }
670
+ }
671
+ } else {
672
+ charIndex = chunk.start;
673
+
674
+ while ( charIndex < end ) {
675
+ if ( !isExcluded[ charIndex ] ) {
676
+ var char = this$1.original[ charIndex ];
677
+
678
+ if ( char === '\n' ) {
679
+ shouldIndentNextCharacter = true;
680
+ } else if ( char !== '\r' && shouldIndentNextCharacter ) {
681
+ shouldIndentNextCharacter = false;
682
+
683
+ if ( charIndex === chunk.start ) {
684
+ chunk.prependRight( indentStr );
685
+ } else {
686
+ var rhs = chunk.split( charIndex );
687
+ rhs.prependRight( indentStr );
688
+
689
+ this$1.byStart[ charIndex ] = rhs;
690
+ this$1.byEnd[ charIndex ] = chunk;
691
+
692
+ chunk = rhs;
693
+ }
694
+ }
695
+ }
696
+
697
+ charIndex += 1;
698
+ }
699
+ }
700
+
701
+ charIndex = chunk.end;
702
+ chunk = chunk.next;
703
+ }
704
+
705
+ this.outro = this.outro.replace( pattern, replacer );
706
+
707
+ return this;
708
+ },
709
+
710
+ insert: function insert () {
711
+ throw new Error( 'magicString.insert(...) is deprecated. Use insertRight(...) or insertLeft(...)' );
712
+ },
713
+
714
+ insertLeft: function insertLeft ( index, content ) {
715
+ if ( !warned.insertLeft ) {
716
+ console.warn( 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead' ); // eslint-disable-line no-console
717
+ warned.insertLeft = true;
718
+ }
719
+
720
+ return this.appendLeft( index, content );
721
+ },
722
+
723
+ insertRight: function insertRight ( index, content ) {
724
+ if ( !warned.insertRight ) {
725
+ console.warn( 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead' ); // eslint-disable-line no-console
726
+ warned.insertRight = true;
727
+ }
728
+
729
+ return this.prependRight( index, content );
730
+ },
731
+
732
+ move: function move ( start, end, index ) {
733
+ if ( index >= start && index <= end ) { throw new Error( 'Cannot move a selection inside itself' ); }
734
+
735
+ this._split( start );
736
+ this._split( end );
737
+ this._split( index );
738
+
739
+ var first = this.byStart[ start ];
740
+ var last = this.byEnd[ end ];
741
+
742
+ var oldLeft = first.previous;
743
+ var oldRight = last.next;
744
+
745
+ var newRight = this.byStart[ index ];
746
+ if ( !newRight && last === this.lastChunk ) { return this; }
747
+ var newLeft = newRight ? newRight.previous : this.lastChunk;
748
+
749
+ if ( oldLeft ) { oldLeft.next = oldRight; }
750
+ if ( oldRight ) { oldRight.previous = oldLeft; }
751
+
752
+ if ( newLeft ) { newLeft.next = first; }
753
+ if ( newRight ) { newRight.previous = last; }
754
+
755
+ if ( !first.previous ) { this.firstChunk = last.next; }
756
+ if ( !last.next ) {
757
+ this.lastChunk = first.previous;
758
+ this.lastChunk.next = null;
759
+ }
760
+
761
+ first.previous = newLeft;
762
+ last.next = newRight;
763
+
764
+ if ( !newLeft ) { this.firstChunk = first; }
765
+ if ( !newRight ) { this.lastChunk = last; }
766
+
767
+ return this;
768
+ },
769
+
770
+ overwrite: function overwrite ( start, end, content, storeName ) {
771
+ var this$1 = this;
772
+
773
+ if ( typeof content !== 'string' ) { throw new TypeError( 'replacement content must be a string' ); }
774
+
775
+ while ( start < 0 ) { start += this$1.original.length; }
776
+ while ( end < 0 ) { end += this$1.original.length; }
777
+
778
+ if ( end > this.original.length ) { throw new Error( 'end is out of bounds' ); }
779
+ if ( start === end ) { throw new Error( 'Cannot overwrite a zero-length range – use insertLeft or insertRight instead' ); }
780
+
781
+ this._split( start );
782
+ this._split( end );
783
+
784
+ if ( storeName ) {
785
+ var original = this.original.slice( start, end );
786
+ this.storedNames[ original ] = true;
787
+ }
788
+
789
+ var first = this.byStart[ start ];
790
+ var last = this.byEnd[ end ];
791
+
792
+ if ( first ) {
793
+ if ( end > first.end && first.next !== this.byStart[ first.end ] ) {
794
+ throw new Error( 'Cannot overwrite across a split point' );
795
+ }
796
+
797
+ first.edit( content, storeName );
798
+
799
+ if ( last ) {
800
+ first.next = last.next;
801
+ } else {
802
+ first.next = null;
803
+ this.lastChunk = first;
804
+ }
805
+
806
+ first.original = this.original.slice( start, end );
807
+ first.end = end;
808
+ }
809
+
810
+ else {
811
+ // must be inserting at the end
812
+ var newChunk = new Chunk( start, end, '' ).edit( content, storeName );
813
+
814
+ // TODO last chunk in the array may not be the last chunk, if it's moved...
815
+ last.next = newChunk;
816
+ newChunk.previous = last;
817
+ }
818
+
819
+ return this;
820
+ },
821
+
822
+ prepend: function prepend ( content ) {
823
+ if ( typeof content !== 'string' ) { throw new TypeError( 'outro content must be a string' ); }
824
+
825
+ this.intro = content + this.intro;
826
+ return this;
827
+ },
828
+
829
+ prependLeft: function prependLeft ( index, content ) {
830
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
831
+
832
+ this._split( index );
833
+
834
+ var chunk = this.byEnd[ index ];
835
+
836
+ if ( chunk ) {
837
+ chunk.prependLeft( content );
838
+ } else {
839
+ this.intro = content + this.intro;
840
+ }
841
+
842
+ return this;
843
+ },
844
+
845
+ prependRight: function prependRight ( index, content ) {
846
+ if ( typeof content !== 'string' ) { throw new TypeError( 'inserted content must be a string' ); }
847
+
848
+ this._split( index );
849
+
850
+ var chunk = this.byStart[ index ];
851
+
852
+ if ( chunk ) {
853
+ chunk.prependRight( content );
854
+ } else {
855
+ this.outro = content + this.outro;
856
+ }
857
+
858
+ return this;
859
+ },
860
+
861
+ remove: function remove ( start, end ) {
862
+ var this$1 = this;
863
+
864
+ while ( start < 0 ) { start += this$1.original.length; }
865
+ while ( end < 0 ) { end += this$1.original.length; }
866
+
867
+ if ( start === end ) { return this; }
868
+
869
+ if ( start < 0 || end > this.original.length ) { throw new Error( 'Character is out of bounds' ); }
870
+ if ( start > end ) { throw new Error( 'end must be greater than start' ); }
871
+
872
+ this._split( start );
873
+ this._split( end );
874
+
875
+ var chunk = this.byStart[ start ];
876
+
877
+ while ( chunk ) {
878
+ chunk.intro = '';
879
+ chunk.outro = '';
880
+ chunk.edit( '' );
881
+
882
+ chunk = end > chunk.end ? this$1.byStart[ chunk.end ] : null;
883
+ }
884
+
885
+ return this;
886
+ },
887
+
888
+ slice: function slice ( start, end ) {
889
+ var this$1 = this;
890
+ if ( start === void 0 ) start = 0;
891
+ if ( end === void 0 ) end = this.original.length;
892
+
893
+ while ( start < 0 ) { start += this$1.original.length; }
894
+ while ( end < 0 ) { end += this$1.original.length; }
895
+
896
+ var result = '';
897
+
898
+ // find start chunk
899
+ var chunk = this.firstChunk;
900
+ while ( chunk && ( chunk.start > start || chunk.end <= start ) ) {
901
+
902
+ // found end chunk before start
903
+ if ( chunk.start < end && chunk.end >= end ) {
904
+ return result;
905
+ }
906
+
907
+ chunk = chunk.next;
908
+ }
909
+
910
+ if ( chunk && chunk.edited && chunk.start !== start ) { throw new Error(("Cannot use replaced character " + start + " as slice start anchor.")); }
911
+
912
+ var startChunk = chunk;
913
+ while ( chunk ) {
914
+ if ( chunk.intro && ( startChunk !== chunk || chunk.start === start ) ) {
915
+ result += chunk.intro;
916
+ }
917
+
918
+ var containsEnd = chunk.start < end && chunk.end >= end;
919
+ if ( containsEnd && chunk.edited && chunk.end !== end ) { throw new Error(("Cannot use replaced character " + end + " as slice end anchor.")); }
920
+
921
+ var sliceStart = startChunk === chunk ? start - chunk.start : 0;
922
+ var sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
923
+
924
+ result += chunk.content.slice( sliceStart, sliceEnd );
925
+
926
+ if ( chunk.outro && ( !containsEnd || chunk.end === end ) ) {
927
+ result += chunk.outro;
928
+ }
929
+
930
+ if ( containsEnd ) {
931
+ break;
932
+ }
933
+
934
+ chunk = chunk.next;
935
+ }
936
+
937
+ return result;
938
+ },
939
+
940
+ // TODO deprecate this? not really very useful
941
+ snip: function snip ( start, end ) {
942
+ var clone = this.clone();
943
+ clone.remove( 0, start );
944
+ clone.remove( end, clone.original.length );
945
+
946
+ return clone;
947
+ },
948
+
949
+ _split: function _split ( index ) {
950
+ var this$1 = this;
951
+
952
+ if ( this.byStart[ index ] || this.byEnd[ index ] ) { return; }
953
+
954
+ var chunk = this.lastSearchedChunk;
955
+ var searchForward = index > chunk.end;
956
+
957
+ while ( true ) {
958
+ if ( chunk.contains( index ) ) { return this$1._splitChunk( chunk, index ); }
959
+
960
+ chunk = searchForward ?
961
+ this$1.byStart[ chunk.end ] :
962
+ this$1.byEnd[ chunk.start ];
963
+ }
964
+ },
965
+
966
+ _splitChunk: function _splitChunk ( chunk, index ) {
967
+ if ( chunk.edited && chunk.content.length ) { // zero-length edited chunks are a special case (overlapping replacements)
968
+ var loc = getLocator( this.original )( index );
969
+ throw new Error( ("Cannot split a chunk that has already been edited (" + (loc.line) + ":" + (loc.column) + " – \"" + (chunk.original) + "\")") );
970
+ }
971
+
972
+ var newChunk = chunk.split( index );
973
+
974
+ this.byEnd[ index ] = chunk;
975
+ this.byStart[ index ] = newChunk;
976
+ this.byEnd[ newChunk.end ] = newChunk;
977
+
978
+ if ( chunk === this.lastChunk ) { this.lastChunk = newChunk; }
979
+
980
+ this.lastSearchedChunk = chunk;
981
+ return true;
982
+ },
983
+
984
+ toString: function toString () {
985
+ var str = this.intro;
986
+
987
+ var chunk = this.firstChunk;
988
+ while ( chunk ) {
989
+ str += chunk.toString();
990
+ chunk = chunk.next;
991
+ }
992
+
993
+ return str + this.outro;
994
+ },
995
+
996
+ trimLines: function trimLines () {
997
+ return this.trim('[\\r\\n]');
998
+ },
999
+
1000
+ trim: function trim ( charType ) {
1001
+ return this.trimStart( charType ).trimEnd( charType );
1002
+ },
1003
+
1004
+ trimEnd: function trimEnd ( charType ) {
1005
+ var this$1 = this;
1006
+
1007
+ var rx = new RegExp( ( charType || '\\s' ) + '+$' );
1008
+
1009
+ this.outro = this.outro.replace( rx, '' );
1010
+ if ( this.outro.length ) { return this; }
1011
+
1012
+ var chunk = this.lastChunk;
1013
+
1014
+ do {
1015
+ var end = chunk.end;
1016
+ var aborted = chunk.trimEnd( rx );
1017
+
1018
+ // if chunk was trimmed, we have a new lastChunk
1019
+ if ( chunk.end !== end ) {
1020
+ this$1.lastChunk = chunk.next;
1021
+
1022
+ this$1.byEnd[ chunk.end ] = chunk;
1023
+ this$1.byStart[ chunk.next.start ] = chunk.next;
1024
+ }
1025
+
1026
+ if ( aborted ) { return this$1; }
1027
+ chunk = chunk.previous;
1028
+ } while ( chunk );
1029
+
1030
+ return this;
1031
+ },
1032
+
1033
+ trimStart: function trimStart ( charType ) {
1034
+ var this$1 = this;
1035
+
1036
+ var rx = new RegExp( '^' + ( charType || '\\s' ) + '+' );
1037
+
1038
+ this.intro = this.intro.replace( rx, '' );
1039
+ if ( this.intro.length ) { return this; }
1040
+
1041
+ var chunk = this.firstChunk;
1042
+
1043
+ do {
1044
+ var end = chunk.end;
1045
+ var aborted = chunk.trimStart( rx );
1046
+
1047
+ if ( chunk.end !== end ) {
1048
+ // special case...
1049
+ if ( chunk === this$1.lastChunk ) { this$1.lastChunk = chunk.next; }
1050
+
1051
+ this$1.byEnd[ chunk.end ] = chunk;
1052
+ this$1.byStart[ chunk.next.start ] = chunk.next;
1053
+ }
1054
+
1055
+ if ( aborted ) { return this$1; }
1056
+ chunk = chunk.next;
1057
+ } while ( chunk );
1058
+
1059
+ return this;
1060
+ }
1061
+ };
1062
+
1063
+ var hasOwnProp = Object.prototype.hasOwnProperty;
1064
+
1065
+ function Bundle ( options ) {
1066
+ if ( options === void 0 ) options = {};
1067
+
1068
+ this.intro = options.intro || '';
1069
+ this.separator = options.separator !== undefined ? options.separator : '\n';
1070
+
1071
+ this.sources = [];
1072
+
1073
+ this.uniqueSources = [];
1074
+ this.uniqueSourceIndexByFilename = {};
1075
+ }
1076
+
1077
+ Bundle.prototype = {
1078
+ addSource: function addSource ( source ) {
1079
+ if ( source instanceof MagicString$1 ) {
1080
+ return this.addSource({
1081
+ content: source,
1082
+ filename: source.filename,
1083
+ separator: this.separator
1084
+ });
1085
+ }
1086
+
1087
+ if ( !isObject( source ) || !source.content ) {
1088
+ throw new Error( 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`' );
1089
+ }
1090
+
1091
+ [ 'filename', 'indentExclusionRanges', 'separator' ].forEach( function (option) {
1092
+ if ( !hasOwnProp.call( source, option ) ) { source[ option ] = source.content[ option ]; }
1093
+ });
1094
+
1095
+ if ( source.separator === undefined ) { // TODO there's a bunch of this sort of thing, needs cleaning up
1096
+ source.separator = this.separator;
1097
+ }
1098
+
1099
+ if ( source.filename ) {
1100
+ if ( !hasOwnProp.call( this.uniqueSourceIndexByFilename, source.filename ) ) {
1101
+ this.uniqueSourceIndexByFilename[ source.filename ] = this.uniqueSources.length;
1102
+ this.uniqueSources.push({ filename: source.filename, content: source.content.original });
1103
+ } else {
1104
+ var uniqueSource = this.uniqueSources[ this.uniqueSourceIndexByFilename[ source.filename ] ];
1105
+ if ( source.content.original !== uniqueSource.content ) {
1106
+ throw new Error( ("Illegal source: same filename (" + (source.filename) + "), different contents") );
1107
+ }
1108
+ }
1109
+ }
1110
+
1111
+ this.sources.push( source );
1112
+ return this;
1113
+ },
1114
+
1115
+ append: function append ( str, options ) {
1116
+ this.addSource({
1117
+ content: new MagicString$1( str ),
1118
+ separator: ( options && options.separator ) || ''
1119
+ });
1120
+
1121
+ return this;
1122
+ },
1123
+
1124
+ clone: function clone () {
1125
+ var bundle = new Bundle({
1126
+ intro: this.intro,
1127
+ separator: this.separator
1128
+ });
1129
+
1130
+ this.sources.forEach( function (source) {
1131
+ bundle.addSource({
1132
+ filename: source.filename,
1133
+ content: source.content.clone(),
1134
+ separator: source.separator
1135
+ });
1136
+ });
1137
+
1138
+ return bundle;
1139
+ },
1140
+
1141
+ generateMap: function generateMap ( options ) {
1142
+ var this$1 = this;
1143
+ if ( options === void 0 ) options = {};
1144
+
1145
+ var names = [];
1146
+ this.sources.forEach( function (source) {
1147
+ Object.keys( source.content.storedNames ).forEach( function (name) {
1148
+ if ( !~names.indexOf( name ) ) { names.push( name ); }
1149
+ });
1150
+ });
1151
+
1152
+ var mappings = new Mappings( options.hires );
1153
+
1154
+ if ( this.intro ) {
1155
+ mappings.advance( this.intro );
1156
+ }
1157
+
1158
+ this.sources.forEach( function ( source, i ) {
1159
+ if ( i > 0 ) {
1160
+ mappings.advance( this$1.separator );
1161
+ }
1162
+
1163
+ var sourceIndex = source.filename ? this$1.uniqueSourceIndexByFilename[ source.filename ] : -1;
1164
+ var magicString = source.content;
1165
+ var locate = getLocator( magicString.original );
1166
+
1167
+ if ( magicString.intro ) {
1168
+ mappings.advance( magicString.intro );
1169
+ }
1170
+
1171
+ magicString.firstChunk.eachNext( function (chunk) {
1172
+ var loc = locate( chunk.start );
1173
+
1174
+ if ( chunk.intro.length ) { mappings.advance( chunk.intro ); }
1175
+
1176
+ if ( source.filename ) {
1177
+ if ( chunk.edited ) {
1178
+ mappings.addEdit( sourceIndex, chunk.content, chunk.original, loc, chunk.storeName ? names.indexOf( chunk.original ) : -1 );
1179
+ } else {
1180
+ mappings.addUneditedChunk( sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations );
1181
+ }
1182
+ }
1183
+
1184
+ else {
1185
+ mappings.advance( chunk.content );
1186
+ }
1187
+
1188
+ if ( chunk.outro.length ) { mappings.advance( chunk.outro ); }
1189
+ });
1190
+
1191
+ if ( magicString.outro ) {
1192
+ mappings.advance( magicString.outro );
1193
+ }
1194
+ });
1195
+
1196
+ return new SourceMap({
1197
+ file: ( options.file ? options.file.split( /[\/\\]/ ).pop() : null ),
1198
+ sources: this.uniqueSources.map( function (source) {
1199
+ return options.file ? getRelativePath( options.file, source.filename ) : source.filename;
1200
+ }),
1201
+ sourcesContent: this.uniqueSources.map( function (source) {
1202
+ return options.includeContent ? source.content : null;
1203
+ }),
1204
+ names: names,
1205
+ mappings: mappings.encode()
1206
+ });
1207
+ },
1208
+
1209
+ getIndentString: function getIndentString () {
1210
+ var indentStringCounts = {};
1211
+
1212
+ this.sources.forEach( function (source) {
1213
+ var indentStr = source.content.indentStr;
1214
+
1215
+ if ( indentStr === null ) { return; }
1216
+
1217
+ if ( !indentStringCounts[ indentStr ] ) { indentStringCounts[ indentStr ] = 0; }
1218
+ indentStringCounts[ indentStr ] += 1;
1219
+ });
1220
+
1221
+ return ( Object.keys( indentStringCounts ).sort( function ( a, b ) {
1222
+ return indentStringCounts[a] - indentStringCounts[b];
1223
+ })[0] ) || '\t';
1224
+ },
1225
+
1226
+ indent: function indent ( indentStr ) {
1227
+ var this$1 = this;
1228
+
1229
+ if ( !arguments.length ) {
1230
+ indentStr = this.getIndentString();
1231
+ }
1232
+
1233
+ if ( indentStr === '' ) { return this; } // noop
1234
+
1235
+ var trailingNewline = !this.intro || this.intro.slice( -1 ) === '\n';
1236
+
1237
+ this.sources.forEach( function ( source, i ) {
1238
+ var separator = source.separator !== undefined ? source.separator : this$1.separator;
1239
+ var indentStart = trailingNewline || ( i > 0 && /\r?\n$/.test( separator ) );
1240
+
1241
+ source.content.indent( indentStr, {
1242
+ exclude: source.indentExclusionRanges,
1243
+ indentStart: indentStart//: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator )
1244
+ });
1245
+
1246
+ // TODO this is a very slow way to determine this
1247
+ trailingNewline = source.content.toString().slice( 0, -1 ) === '\n';
1248
+ });
1249
+
1250
+ if ( this.intro ) {
1251
+ this.intro = indentStr + this.intro.replace( /^[^\n]/gm, function ( match, index ) {
1252
+ return index > 0 ? indentStr + match : match;
1253
+ });
1254
+ }
1255
+
1256
+ return this;
1257
+ },
1258
+
1259
+ prepend: function prepend ( str ) {
1260
+ this.intro = str + this.intro;
1261
+ return this;
1262
+ },
1263
+
1264
+ toString: function toString () {
1265
+ var this$1 = this;
1266
+
1267
+ var body = this.sources.map( function ( source, i ) {
1268
+ var separator = source.separator !== undefined ? source.separator : this$1.separator;
1269
+ var str = ( i > 0 ? separator : '' ) + source.content.toString();
1270
+
1271
+ return str;
1272
+ }).join( '' );
1273
+
1274
+ return this.intro + body;
1275
+ },
1276
+
1277
+ trimLines: function trimLines () {
1278
+ return this.trim('[\\r\\n]');
1279
+ },
1280
+
1281
+ trim: function trim ( charType ) {
1282
+ return this.trimStart( charType ).trimEnd( charType );
1283
+ },
1284
+
1285
+ trimStart: function trimStart ( charType ) {
1286
+ var this$1 = this;
1287
+
1288
+ var rx = new RegExp( '^' + ( charType || '\\s' ) + '+' );
1289
+ this.intro = this.intro.replace( rx, '' );
1290
+
1291
+ if ( !this.intro ) {
1292
+ var source;
1293
+ var i = 0;
1294
+
1295
+ do {
1296
+ source = this$1.sources[i];
1297
+
1298
+ if ( !source ) {
1299
+ break;
1300
+ }
1301
+
1302
+ source.content.trimStart( charType );
1303
+ i += 1;
1304
+ } while ( source.content.toString() === '' ); // TODO faster way to determine non-empty source?
1305
+ }
1306
+
1307
+ return this;
1308
+ },
1309
+
1310
+ trimEnd: function trimEnd ( charType ) {
1311
+ var this$1 = this;
1312
+
1313
+ var rx = new RegExp( ( charType || '\\s' ) + '+$' );
1314
+
1315
+ var source;
1316
+ var i = this.sources.length - 1;
1317
+
1318
+ do {
1319
+ source = this$1.sources[i];
1320
+
1321
+ if ( !source ) {
1322
+ this$1.intro = this$1.intro.replace( rx, '' );
1323
+ break;
1324
+ }
1325
+
1326
+ source.content.trimEnd( charType );
1327
+ i -= 1;
1328
+ } while ( source.content.toString() === '' ); // TODO faster way to determine non-empty source?
1329
+
1330
+ return this;
1331
+ }
1332
+ };
1333
+
1334
+ MagicString$1.Bundle = Bundle;
1335
+
1336
+ return MagicString$1;
1337
+
1338
+ })));
1339
+ //# sourceMappingURL=magic-string.umd.js.map