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