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