jass 0.9.1

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