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,93 @@
1
+ var core = require('./core');
2
+ var fs = require('fs');
3
+ var path = require('path');
4
+ var caller = require('./caller.js');
5
+ var nodeModulesPaths = require('./node-modules-paths.js');
6
+
7
+ module.exports = function (x, options) {
8
+ if (typeof x !== 'string') {
9
+ throw new TypeError('Path must be a string.');
10
+ }
11
+ var opts = options || {};
12
+ var isFile = opts.isFile || function (file) {
13
+ try {
14
+ var stat = fs.statSync(file);
15
+ } catch (e) {
16
+ if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false;
17
+ throw e;
18
+ }
19
+ return stat.isFile() || stat.isFIFO();
20
+ };
21
+ var readFileSync = opts.readFileSync || fs.readFileSync;
22
+
23
+ var extensions = opts.extensions || ['.js'];
24
+ var y = opts.basedir || path.dirname(caller());
25
+
26
+ opts.paths = opts.paths || [];
27
+
28
+ if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
29
+ var res = path.resolve(y, x);
30
+ if (x === '..' || x.slice(-1) === '/') res += '/';
31
+ var m = loadAsFileSync(res) || loadAsDirectorySync(res);
32
+ if (m) return m;
33
+ } else {
34
+ var n = loadNodeModulesSync(x, y);
35
+ if (n) return n;
36
+ }
37
+
38
+ if (core[x]) return x;
39
+
40
+ var err = new Error("Cannot find module '" + x + "' from '" + y + "'");
41
+ err.code = 'MODULE_NOT_FOUND';
42
+ throw err;
43
+
44
+ function loadAsFileSync(x) {
45
+ if (isFile(x)) {
46
+ return x;
47
+ }
48
+
49
+ for (var i = 0; i < extensions.length; i++) {
50
+ var file = x + extensions[i];
51
+ if (isFile(file)) {
52
+ return file;
53
+ }
54
+ }
55
+ }
56
+
57
+ function loadAsDirectorySync(x) {
58
+ var pkgfile = path.join(x, '/package.json');
59
+ if (isFile(pkgfile)) {
60
+ try {
61
+ var body = readFileSync(pkgfile, 'UTF8');
62
+ var pkg = JSON.parse(body);
63
+
64
+ if (opts.packageFilter) {
65
+ pkg = opts.packageFilter(pkg, x);
66
+ }
67
+
68
+ if (pkg.main) {
69
+ if (pkg.main === '.' || pkg.main === './') {
70
+ pkg.main = 'index';
71
+ }
72
+ var m = loadAsFileSync(path.resolve(x, pkg.main));
73
+ if (m) return m;
74
+ var n = loadAsDirectorySync(path.resolve(x, pkg.main));
75
+ if (n) return n;
76
+ }
77
+ } catch (e) {}
78
+ }
79
+
80
+ return loadAsFileSync(path.join(x, '/index'));
81
+ }
82
+
83
+ function loadNodeModulesSync(x, start) {
84
+ var dirs = nodeModulesPaths(start, opts);
85
+ for (var i = 0; i < dirs.length; i++) {
86
+ var dir = dirs[i];
87
+ var m = loadAsFileSync(path.join(dir, '/', x));
88
+ if (m) return m;
89
+ var n = loadAsDirectorySync(path.join(dir, '/', x));
90
+ if (n) return n;
91
+ }
92
+ }
93
+ };
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "resolve",
3
+ "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously",
4
+ "version": "1.6.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git://github.com/browserify/node-resolve.git"
8
+ },
9
+ "main": "index.js",
10
+ "keywords": [
11
+ "resolve",
12
+ "require",
13
+ "node",
14
+ "module"
15
+ ],
16
+ "scripts": {
17
+ "prepublish": "safe-publish-latest",
18
+ "lint": "eslint .",
19
+ "tests-only": "tape test/*.js",
20
+ "pretest": "npm run lint",
21
+ "test": "npm run --silent tests-only"
22
+ },
23
+ "devDependencies": {
24
+ "@ljharb/eslint-config": "^12.2.1",
25
+ "eslint": "^4.19.0",
26
+ "object-keys": "^1.0.11",
27
+ "safe-publish-latest": "^1.1.1",
28
+ "tap": "0.4.13",
29
+ "tape": "^4.9.0"
30
+ },
31
+ "license": "MIT",
32
+ "author": {
33
+ "name": "James Halliday",
34
+ "email": "mail@substack.net",
35
+ "url": "http://substack.net"
36
+ },
37
+ "dependencies": {
38
+ "path-parse": "^1.0.5"
39
+ }
40
+ }
@@ -0,0 +1,804 @@
1
+ 'use strict';
2
+
3
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
+
5
+ var fs = require('fs');
6
+ var path = require('path');
7
+ var rollupPluginutils = require('rollup-pluginutils');
8
+ var estreeWalker = require('estree-walker');
9
+ var MagicString = _interopDefault(require('magic-string'));
10
+ var resolve = require('resolve');
11
+
12
+ var HELPERS_ID = '\0commonjsHelpers';
13
+
14
+ var HELPERS = "\nexport var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nexport function commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');\n}\n\nexport function unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nexport function createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}";
15
+
16
+ var PREFIX = '\0commonjs-proxy:';
17
+ var EXTERNAL = '\0commonjs-external:';
18
+
19
+ function isFile ( file ) {
20
+ try {
21
+ var stats = fs.statSync( file );
22
+ return stats.isFile();
23
+ } catch ( err ) {
24
+ return false;
25
+ }
26
+ }
27
+
28
+ function addJsExtensionIfNecessary ( file ) {
29
+ if ( isFile( file ) ) { return file; }
30
+
31
+ file += '.js';
32
+ if ( isFile( file ) ) { return file; }
33
+
34
+ return null;
35
+ }
36
+
37
+ var absolutePath = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
38
+
39
+ function isAbsolute ( path$$1 ) {
40
+ return absolutePath.test( path$$1 );
41
+ }
42
+
43
+ function defaultResolver ( importee, importer ) {
44
+ // absolute paths are left untouched
45
+ if ( isAbsolute( importee ) ) { return addJsExtensionIfNecessary( path.resolve( importee ) ); }
46
+
47
+ // if this is the entry point, resolve against cwd
48
+ if ( importer === undefined ) { return addJsExtensionIfNecessary( path.resolve( process.cwd(), importee ) ); }
49
+
50
+ // external modules are skipped at this stage
51
+ if ( importee[0] !== '.' ) { return null; }
52
+
53
+ return addJsExtensionIfNecessary( path.resolve( path.dirname( importer ), importee ) );
54
+ }
55
+
56
+ function isReference ( node, parent ) {
57
+ if ( parent.type === 'MemberExpression' ) { return parent.computed || node === parent.object; }
58
+
59
+ // disregard the `bar` in { bar: foo }
60
+ if ( parent.type === 'Property' && node !== parent.value ) { return false; }
61
+
62
+ // disregard the `bar` in `class Foo { bar () {...} }`
63
+ if ( parent.type === 'MethodDefinition' ) { return false; }
64
+
65
+ // disregard the `bar` in `export { foo as bar }`
66
+ if ( parent.type === 'ExportSpecifier' && node !== parent.local ) { return false; }
67
+
68
+ return true;
69
+ }
70
+
71
+ function flatten ( node ) {
72
+ var parts = [];
73
+
74
+ while ( node.type === 'MemberExpression' ) {
75
+ if ( node.computed ) { return null; }
76
+
77
+ parts.unshift( node.property.name );
78
+ node = node.object;
79
+ }
80
+
81
+ if ( node.type !== 'Identifier' ) { return null; }
82
+
83
+ var name = node.name;
84
+ parts.unshift( name );
85
+
86
+ return { name: name, keypath: parts.join( '.' ) };
87
+ }
88
+
89
+ function extractNames ( node ) {
90
+ var names = [];
91
+ extractors[ node.type ]( names, node );
92
+ return names;
93
+ }
94
+
95
+ var extractors = {
96
+ Identifier: function Identifier ( names, node ) {
97
+ names.push( node.name );
98
+ },
99
+
100
+ ObjectPattern: function ObjectPattern ( names, node ) {
101
+ node.properties.forEach( function (prop) {
102
+ extractors[ prop.value.type ]( names, prop.value );
103
+ });
104
+ },
105
+
106
+ ArrayPattern: function ArrayPattern ( names, node ) {
107
+ node.elements.forEach( function (element) {
108
+ if ( element ) { extractors[ element.type ]( names, element ); }
109
+ });
110
+ },
111
+
112
+ RestElement: function RestElement ( names, node ) {
113
+ extractors[ node.argument.type ]( names, node.argument );
114
+ },
115
+
116
+ AssignmentPattern: function AssignmentPattern ( names, node ) {
117
+ extractors[ node.left.type ]( names, node.left );
118
+ }
119
+ };
120
+
121
+
122
+ function isTruthy ( node ) {
123
+ if ( node.type === 'Literal' ) { return !!node.value; }
124
+ if ( node.type === 'ParenthesizedExpression' ) { return isTruthy( node.expression ); }
125
+ if ( node.operator in operators ) { return operators[ node.operator ]( node ); }
126
+ }
127
+
128
+ function isFalsy ( node ) {
129
+ return not( isTruthy( node ) );
130
+ }
131
+
132
+ function not ( value ) {
133
+ return value === undefined ? value : !value;
134
+ }
135
+
136
+ function equals ( a, b, strict ) {
137
+ if ( a.type !== b.type ) { return undefined; }
138
+ if ( a.type === 'Literal' ) { return strict ? a.value === b.value : a.value == b.value; }
139
+ }
140
+
141
+ var operators = {
142
+ '==': function (x) {
143
+ return equals( x.left, x.right, false );
144
+ },
145
+
146
+ '!=': function (x) { return not( operators['==']( x ) ); },
147
+
148
+ '===': function (x) {
149
+ return equals( x.left, x.right, true );
150
+ },
151
+
152
+ '!==': function (x) { return not( operators['===']( x ) ); },
153
+
154
+ '!': function (x) { return isFalsy( x.argument ); },
155
+
156
+ '&&': function (x) { return isTruthy( x.left ) && isTruthy( x.right ); },
157
+
158
+ '||': function (x) { return isTruthy( x.left ) || isTruthy( x.right ); }
159
+ };
160
+
161
+ function getName ( id ) {
162
+ var name = rollupPluginutils.makeLegalIdentifier( path.basename( id, path.extname( id ) ) );
163
+ if (name !== 'index') {
164
+ return name;
165
+ } else {
166
+ var segments = path.dirname( id ).split( path.sep );
167
+ return rollupPluginutils.makeLegalIdentifier( segments[segments.length - 1] );
168
+ }
169
+ }
170
+
171
+ var reserved = 'abstract arguments boolean break byte case catch char class const continue debugger default delete do double else enum eval export extends false final finally float for function goto if implements import in instanceof int interface let long native new null package private protected public return short static super switch synchronized this throw throws transient true try typeof var void volatile while with yield'.split( ' ' );
172
+ var blacklist = { __esModule: true };
173
+ reserved.forEach( function (word) { return blacklist[ word ] = true; } );
174
+
175
+ var exportsPattern = /^(?:module\.)?exports(?:\.([a-zA-Z_$][a-zA-Z_$0-9]*))?$/;
176
+
177
+ var firstpassGlobal = /\b(?:require|module|exports|global)\b/;
178
+ var firstpassNoGlobal = /\b(?:require|module|exports)\b/;
179
+ var importExportDeclaration = /^(?:Import|Export(?:Named|Default))Declaration/;
180
+ var functionType = /^(?:FunctionDeclaration|FunctionExpression|ArrowFunctionExpression)$/;
181
+
182
+ function deconflict ( scope, globals, identifier ) {
183
+ var i = 1;
184
+ var deconflicted = identifier;
185
+
186
+ while ( scope.contains( deconflicted ) || globals.has( deconflicted ) || deconflicted in blacklist ) { deconflicted = identifier + "_" + (i++); }
187
+ scope.declarations[ deconflicted ] = true;
188
+
189
+ return deconflicted;
190
+ }
191
+
192
+ function tryParse ( parse, code, id ) {
193
+ try {
194
+ return parse( code, { allowReturnOutsideFunction: true });
195
+ } catch ( err ) {
196
+ err.message += " in " + id;
197
+ throw err;
198
+ }
199
+ }
200
+
201
+ function checkFirstpass (code, ignoreGlobal) {
202
+ var firstpass = ignoreGlobal ? firstpassNoGlobal : firstpassGlobal;
203
+ return firstpass.test(code);
204
+ }
205
+
206
+ function checkEsModule ( parse, code, id ) {
207
+ var ast = tryParse( parse, code, id );
208
+
209
+ // if there are top-level import/export declarations, this is ES not CommonJS
210
+ var hasDefaultExport = false;
211
+ var isEsModule = false;
212
+ for ( var i = 0, list = ast.body; i < list.length; i += 1 ) {
213
+ var node = list[i];
214
+
215
+ if ( node.type === 'ExportDefaultDeclaration' )
216
+ { hasDefaultExport = true; }
217
+ if ( importExportDeclaration.test( node.type ) )
218
+ { isEsModule = true; }
219
+ }
220
+
221
+ return { isEsModule: isEsModule, hasDefaultExport: hasDefaultExport, ast: ast };
222
+ }
223
+
224
+ function transformCommonjs ( parse, code, id, isEntry, ignoreGlobal, ignoreRequire, customNamedExports, sourceMap, allowDynamicRequire, astCache ) {
225
+ var ast = astCache || tryParse( parse, code, id );
226
+
227
+ var magicString = new MagicString( code );
228
+
229
+ var required = {};
230
+ // Because objects have no guaranteed ordering, yet we need it,
231
+ // we need to keep track of the order in a array
232
+ var sources = [];
233
+
234
+ var uid = 0;
235
+
236
+ var scope = rollupPluginutils.attachScopes( ast, 'scope' );
237
+ var uses = { module: false, exports: false, global: false, require: false };
238
+
239
+ var lexicalDepth = 0;
240
+ var programDepth = 0;
241
+
242
+ var globals = new Set();
243
+
244
+ var HELPERS_NAME = deconflict( scope, globals, 'commonjsHelpers' ); // TODO technically wrong since globals isn't populated yet, but ¯\_(ツ)_/¯
245
+
246
+ var namedExports = {};
247
+
248
+ // TODO handle transpiled modules
249
+ var shouldWrap = /__esModule/.test( code );
250
+
251
+ function isRequireStatement ( node ) {
252
+ if ( !node ) { return; }
253
+ if ( node.type !== 'CallExpression' ) { return; }
254
+ if ( node.callee.name !== 'require' || scope.contains( 'require' ) ) { return; }
255
+ if ( node.arguments.length !== 1 || (node.arguments[0].type !== 'Literal' && (node.arguments[0].type !== 'TemplateLiteral' || node.arguments[0].expressions.length > 0) ) ) { return; } // TODO handle these weird cases?
256
+ if ( ignoreRequire( node.arguments[0].value ) ) { return; }
257
+
258
+ return true;
259
+ }
260
+
261
+ function getRequired ( node, name ) {
262
+ var source = node.arguments[0].type === 'Literal' ? node.arguments[0].value : node.arguments[0].quasis[0].value.cooked;
263
+
264
+ var existing = required[ source ];
265
+ if ( existing === undefined ) {
266
+ sources.push( source );
267
+
268
+ if ( !name ) {
269
+ do { name = "require$$" + (uid++); }
270
+ while ( scope.contains( name ) );
271
+ }
272
+
273
+ required[ source ] = { source: source, name: name, importsDefault: false };
274
+ }
275
+
276
+ return required[ source ];
277
+ }
278
+
279
+ // do a first pass, see which names are assigned to. This is necessary to prevent
280
+ // illegally replacing `var foo = require('foo')` with `import foo from 'foo'`,
281
+ // where `foo` is later reassigned. (This happens in the wild. CommonJS, sigh)
282
+ var assignedTo = new Set();
283
+ estreeWalker.walk( ast, {
284
+ enter: function enter ( node ) {
285
+ if ( node.type !== 'AssignmentExpression' ) { return; }
286
+ if ( node.left.type === 'MemberExpression' ) { return; }
287
+
288
+ extractNames( node.left ).forEach( function (name) {
289
+ assignedTo.add( name );
290
+ });
291
+ }
292
+ });
293
+
294
+ estreeWalker.walk( ast, {
295
+ enter: function enter ( node, parent ) {
296
+ if ( sourceMap ) {
297
+ magicString.addSourcemapLocation( node.start );
298
+ magicString.addSourcemapLocation( node.end );
299
+ }
300
+
301
+ // skip dead branches
302
+ if ( parent && ( parent.type === 'IfStatement' || parent.type === 'ConditionalExpression' ) ) {
303
+ if ( node === parent.consequent && isFalsy( parent.test ) ) { return this.skip(); }
304
+ if ( node === parent.alternate && isTruthy( parent.test ) ) { return this.skip(); }
305
+ }
306
+
307
+ if ( node._skip ) { return this.skip(); }
308
+
309
+ programDepth += 1;
310
+
311
+ if ( node.scope ) { scope = node.scope; }
312
+ if ( functionType.test( node.type ) ) { lexicalDepth += 1; }
313
+
314
+ // if toplevel return, we need to wrap it
315
+ if ( node.type === 'ReturnStatement' && lexicalDepth === 0 ) {
316
+ shouldWrap = true;
317
+ }
318
+
319
+ // rewrite `this` as `commonjsHelpers.commonjsGlobal`
320
+ if ( node.type === 'ThisExpression' && lexicalDepth === 0 ) {
321
+ uses.global = true;
322
+ if ( !ignoreGlobal ) { magicString.overwrite( node.start, node.end, (HELPERS_NAME + ".commonjsGlobal"), { storeName: true } ); }
323
+ return;
324
+ }
325
+
326
+ // rewrite `typeof module`, `typeof module.exports` and `typeof exports` (https://github.com/rollup/rollup-plugin-commonjs/issues/151)
327
+ if ( node.type === 'UnaryExpression' && node.operator === 'typeof' ) {
328
+ var flattened = flatten( node.argument );
329
+ if ( !flattened ) { return; }
330
+
331
+ if ( scope.contains( flattened.name ) ) { return; }
332
+
333
+ if ( flattened.keypath === 'module.exports' || flattened.keypath === 'module' || flattened.keypath === 'exports' ) {
334
+ magicString.overwrite( node.start, node.end, "'object'", { storeName: false } );
335
+ }
336
+ }
337
+
338
+ // rewrite `require` (if not already handled) `global` and `define`, and handle free references to
339
+ // `module` and `exports` as these mean we need to wrap the module in commonjsHelpers.createCommonjsModule
340
+ if ( node.type === 'Identifier' ) {
341
+ if ( isReference( node, parent ) && !scope.contains( node.name ) ) {
342
+ if ( node.name in uses ) {
343
+ if ( node.name === 'require' ) {
344
+ if ( allowDynamicRequire ) { return; }
345
+ magicString.overwrite( node.start, node.end, (HELPERS_NAME + ".commonjsRequire"), { storeName: true } );
346
+ }
347
+
348
+ uses[ node.name ] = true;
349
+ if ( node.name === 'global' && !ignoreGlobal ) {
350
+ magicString.overwrite( node.start, node.end, (HELPERS_NAME + ".commonjsGlobal"), { storeName: true } );
351
+ }
352
+
353
+ // if module or exports are used outside the context of an assignment
354
+ // expression, we need to wrap the module
355
+ if ( node.name === 'module' || node.name === 'exports' ) {
356
+ shouldWrap = true;
357
+ }
358
+ }
359
+
360
+ if ( node.name === 'define' ) {
361
+ magicString.overwrite( node.start, node.end, 'undefined', { storeName: true } );
362
+ }
363
+
364
+ globals.add( node.name );
365
+ }
366
+
367
+ return;
368
+ }
369
+
370
+ // Is this an assignment to exports or module.exports?
371
+ if ( node.type === 'AssignmentExpression' ) {
372
+ if ( node.left.type !== 'MemberExpression' ) { return; }
373
+
374
+ var flattened$1 = flatten( node.left );
375
+ if ( !flattened$1 ) { return; }
376
+
377
+ if ( scope.contains( flattened$1.name ) ) { return; }
378
+
379
+ var match = exportsPattern.exec( flattened$1.keypath );
380
+ if ( !match || flattened$1.keypath === 'exports' ) { return; }
381
+
382
+ uses[ flattened$1.name ] = true;
383
+
384
+ // we're dealing with `module.exports = ...` or `[module.]exports.foo = ...` –
385
+ // if this isn't top-level, we'll need to wrap the module
386
+ if ( programDepth > 3 ) { shouldWrap = true; }
387
+
388
+ node.left._skip = true;
389
+
390
+ if ( flattened$1.keypath === 'module.exports' && node.right.type === 'ObjectExpression' ) {
391
+ return node.right.properties.forEach( function (prop) {
392
+ if ( prop.computed || prop.key.type !== 'Identifier' ) { return; }
393
+ var name = prop.key.name;
394
+ if ( name === rollupPluginutils.makeLegalIdentifier( name ) ) { namedExports[ name ] = true; }
395
+ });
396
+ }
397
+
398
+ if ( match[1] ) { namedExports[ match[1] ] = true; }
399
+ return;
400
+ }
401
+
402
+ // if this is `var x = require('x')`, we can do `import x from 'x'`
403
+ if ( node.type === 'VariableDeclarator' && node.id.type === 'Identifier' && isRequireStatement( node.init ) ) {
404
+ // for now, only do this for top-level requires. maybe fix this in future
405
+ if ( scope.parent ) { return; }
406
+
407
+ // edge case — CJS allows you to assign to imports. ES doesn't
408
+ if ( assignedTo.has( node.id.name ) ) { return; }
409
+
410
+ var r$1 = getRequired( node.init, node.id.name );
411
+ r$1.importsDefault = true;
412
+
413
+ if ( r$1.name === node.id.name ) {
414
+ node._shouldRemove = true;
415
+ }
416
+ }
417
+
418
+ if ( !isRequireStatement( node ) ) { return; }
419
+
420
+ var r = getRequired( node );
421
+
422
+ if ( parent.type === 'ExpressionStatement' ) {
423
+ // is a bare import, e.g. `require('foo');`
424
+ magicString.remove( parent.start, parent.end );
425
+ } else {
426
+ r.importsDefault = true;
427
+ magicString.overwrite( node.start, node.end, r.name );
428
+ }
429
+
430
+ node.callee._skip = true;
431
+ },
432
+
433
+ leave: function leave ( node ) {
434
+ programDepth -= 1;
435
+ if ( node.scope ) { scope = scope.parent; }
436
+ if ( functionType.test( node.type ) ) { lexicalDepth -= 1; }
437
+
438
+ if ( node.type === 'VariableDeclaration' ) {
439
+ var keepDeclaration = false;
440
+ var c = node.declarations[0].start;
441
+
442
+ for ( var i = 0; i < node.declarations.length; i += 1 ) {
443
+ var declarator = node.declarations[i];
444
+
445
+ if ( declarator._shouldRemove ) {
446
+ magicString.remove( c, declarator.end );
447
+ } else {
448
+ if ( !keepDeclaration ) {
449
+ magicString.remove( c, declarator.start );
450
+ keepDeclaration = true;
451
+ }
452
+
453
+ c = declarator.end;
454
+ }
455
+ }
456
+
457
+ if ( !keepDeclaration ) {
458
+ magicString.remove( node.start, node.end );
459
+ }
460
+ }
461
+ }
462
+ });
463
+
464
+ if ( !sources.length && !uses.module && !uses.exports && !uses.require && ( ignoreGlobal || !uses.global ) ) {
465
+ if ( Object.keys( namedExports ).length ) {
466
+ throw new Error( ("Custom named exports were specified for " + id + " but it does not appear to be a CommonJS module") );
467
+ }
468
+ return null; // not a CommonJS module
469
+ }
470
+
471
+ var includeHelpers = shouldWrap || uses.global || uses.require;
472
+ var importBlock = ( includeHelpers ? [ ("import * as " + HELPERS_NAME + " from '" + HELPERS_ID + "';") ] : [] ).concat(
473
+ sources.map( function (source) {
474
+ // import the actual module before the proxy, so that we know
475
+ // what kind of proxy to build
476
+ return ("import '" + source + "';");
477
+ }),
478
+ sources.map( function (source) {
479
+ var ref = required[ source ];
480
+ var name = ref.name;
481
+ var importsDefault = ref.importsDefault;
482
+ return ("import " + (importsDefault ? (name + " from ") : "") + "'" + PREFIX + source + "';");
483
+ })
484
+ ).join( '\n' ) + '\n\n';
485
+
486
+ var namedExportDeclarations = [];
487
+ var wrapperStart = '';
488
+ var wrapperEnd = '';
489
+
490
+ var moduleName = deconflict( scope, globals, getName( id ) );
491
+ if ( !isEntry ) {
492
+ var exportModuleExports = {
493
+ str: ("export { " + moduleName + " as __moduleExports };"),
494
+ name: '__moduleExports'
495
+ };
496
+
497
+ namedExportDeclarations.push( exportModuleExports );
498
+ }
499
+
500
+ var name = getName( id );
501
+
502
+ function addExport ( x ) {
503
+ var deconflicted = deconflict( scope, globals, name );
504
+
505
+ var declaration = deconflicted === name ?
506
+ ("export var " + x + " = " + moduleName + "." + x + ";") :
507
+ ("var " + deconflicted + " = " + moduleName + "." + x + ";\nexport { " + deconflicted + " as " + x + " };");
508
+
509
+ namedExportDeclarations.push({
510
+ str: declaration,
511
+ name: x
512
+ });
513
+ }
514
+
515
+ if ( customNamedExports ) { customNamedExports.forEach( addExport ); }
516
+
517
+ var defaultExportPropertyAssignments = [];
518
+ var hasDefaultExport = false;
519
+
520
+ if ( shouldWrap ) {
521
+ var args = "module" + (uses.exports ? ', exports' : '');
522
+
523
+ wrapperStart = "var " + moduleName + " = " + HELPERS_NAME + ".createCommonjsModule(function (" + args + ") {\n";
524
+ wrapperEnd = "\n});";
525
+ } else {
526
+ var names = [];
527
+
528
+ ast.body.forEach( function (node) {
529
+ if ( node.type === 'ExpressionStatement' && node.expression.type === 'AssignmentExpression' ) {
530
+ var left = node.expression.left;
531
+ var flattened = flatten( left );
532
+
533
+ if ( !flattened ) { return; }
534
+
535
+ var match = exportsPattern.exec( flattened.keypath );
536
+ if ( !match ) { return; }
537
+
538
+ if ( flattened.keypath === 'module.exports' ) {
539
+ hasDefaultExport = true;
540
+ magicString.overwrite( left.start, left.end, ("var " + moduleName) );
541
+ } else {
542
+ var name = match[1];
543
+ var deconflicted = deconflict( scope, globals, name );
544
+
545
+ names.push({ name: name, deconflicted: deconflicted });
546
+
547
+ magicString.overwrite( node.start, left.end, ("var " + deconflicted) );
548
+
549
+ var declaration = name === deconflicted ?
550
+ ("export { " + name + " };") :
551
+ ("export { " + deconflicted + " as " + name + " };");
552
+
553
+ if ( name !== 'default' ) {
554
+ namedExportDeclarations.push({
555
+ str: declaration,
556
+ name: name
557
+ });
558
+ delete namedExports[name];
559
+ }
560
+
561
+ defaultExportPropertyAssignments.push( (moduleName + "." + name + " = " + deconflicted + ";") );
562
+ }
563
+ }
564
+ });
565
+
566
+ if ( !hasDefaultExport ) {
567
+ wrapperEnd = "\n\nvar " + moduleName + " = {\n" + (names.map( function (ref) {
568
+ var name = ref.name;
569
+ var deconflicted = ref.deconflicted;
570
+
571
+ return ("\t" + name + ": " + deconflicted);
572
+ } ).join( ',\n' )) + "\n};";
573
+ }
574
+ }
575
+ Object.keys( namedExports )
576
+ .filter( function (key) { return !blacklist[ key ]; } )
577
+ .forEach( addExport );
578
+
579
+ var defaultExport = /__esModule/.test( code ) ?
580
+ ("export default " + HELPERS_NAME + ".unwrapExports(" + moduleName + ");") :
581
+ ("export default " + moduleName + ";");
582
+
583
+ var named = namedExportDeclarations
584
+ .filter( function (x) { return x.name !== 'default' || !hasDefaultExport; } )
585
+ .map( function (x) { return x.str; } );
586
+
587
+ var exportBlock = '\n\n' + [ defaultExport ]
588
+ .concat( named )
589
+ .concat( hasDefaultExport ? defaultExportPropertyAssignments : [] )
590
+ .join( '\n' );
591
+
592
+ magicString.trim()
593
+ .prepend( importBlock + wrapperStart )
594
+ .trim()
595
+ .append( wrapperEnd + exportBlock );
596
+
597
+ code = magicString.toString();
598
+ var map = sourceMap ? magicString.generateMap() : null;
599
+
600
+ return { code: code, map: map };
601
+ }
602
+
603
+ function getCandidatesForExtension ( resolved, extension ) {
604
+ return [
605
+ resolved + extension,
606
+ resolved + path.sep + "index" + extension
607
+ ];
608
+ }
609
+
610
+ function getCandidates ( resolved, extensions ) {
611
+ return extensions.reduce(
612
+ function ( paths, extension ) { return paths.concat( getCandidatesForExtension ( resolved, extension ) ); },
613
+ [resolved]
614
+ );
615
+ }
616
+
617
+ // Return the first non-falsy result from an array of
618
+ // maybe-sync, maybe-promise-returning functions
619
+ function first ( candidates ) {
620
+ return function () {
621
+ var args = [], len = arguments.length;
622
+ while ( len-- ) args[ len ] = arguments[ len ];
623
+
624
+ return candidates.reduce( function ( promise, candidate ) {
625
+ return promise.then( function (result) { return result != null ?
626
+ result :
627
+ Promise.resolve( candidate.apply( void 0, args ) ); } );
628
+ }, Promise.resolve() );
629
+ };
630
+ }
631
+
632
+ function startsWith ( str, prefix ) {
633
+ return str.slice( 0, prefix.length ) === prefix;
634
+ }
635
+
636
+
637
+ function commonjs ( options ) {
638
+ if ( options === void 0 ) options = {};
639
+
640
+ var extensions = options.extensions || ['.js'];
641
+ var filter = rollupPluginutils.createFilter( options.include, options.exclude );
642
+ var ignoreGlobal = options.ignoreGlobal;
643
+
644
+ var customNamedExports = {};
645
+ if ( options.namedExports ) {
646
+ Object.keys( options.namedExports ).forEach( function (id) {
647
+ var resolvedId;
648
+
649
+ try {
650
+ resolvedId = resolve.sync( id, { basedir: process.cwd() });
651
+ } catch ( err ) {
652
+ resolvedId = path.resolve( id );
653
+ }
654
+
655
+ customNamedExports[ resolvedId ] = options.namedExports[ id ];
656
+ });
657
+ }
658
+
659
+ var esModulesWithoutDefaultExport = [];
660
+
661
+ var allowDynamicRequire = !!options.ignore; // TODO maybe this should be configurable?
662
+
663
+ var ignoreRequire = typeof options.ignore === 'function' ?
664
+ options.ignore :
665
+ Array.isArray( options.ignore ) ? function (id) { return ~options.ignore.indexOf( id ); } :
666
+ function () { return false; };
667
+
668
+ var entryModuleIdsPromise = null;
669
+
670
+ function resolveId ( importee, importer ) {
671
+ if ( importee === HELPERS_ID ) { return importee; }
672
+
673
+ if ( importer && startsWith( importer, PREFIX ) ) { importer = importer.slice( PREFIX.length ); }
674
+
675
+ var isProxyModule = startsWith( importee, PREFIX );
676
+ if ( isProxyModule ) { importee = importee.slice( PREFIX.length ); }
677
+
678
+ return resolveUsingOtherResolvers( importee, importer ).then( function (resolved) {
679
+ if ( resolved ) { return isProxyModule ? PREFIX + resolved : resolved; }
680
+
681
+ resolved = defaultResolver( importee, importer );
682
+
683
+ if ( isProxyModule ) {
684
+ if ( resolved ) { return PREFIX + resolved; }
685
+ return EXTERNAL + importee; // external
686
+ }
687
+
688
+ return resolved;
689
+ });
690
+ }
691
+
692
+ var sourceMap = options.sourceMap !== false;
693
+
694
+ var commonjsModules = new Map();
695
+ var resolveUsingOtherResolvers;
696
+
697
+ return {
698
+ name: 'commonjs',
699
+
700
+ options: function options ( options$1 ) {
701
+ var resolvers = ( options$1.plugins || [] )
702
+ .map( function (plugin) {
703
+ if ( plugin.resolveId === resolveId ) {
704
+ // substitute CommonJS resolution logic
705
+ return function ( importee, importer ) {
706
+ if ( importee[0] !== '.' || !importer ) { return; } // not our problem
707
+
708
+ var resolved = path.resolve( path.dirname( importer ), importee );
709
+ var candidates = getCandidates( resolved, extensions );
710
+
711
+ for ( var i = 0; i < candidates.length; i += 1 ) {
712
+ try {
713
+ var stats = fs.statSync( candidates[i] );
714
+ if ( stats.isFile() ) { return candidates[i]; }
715
+ } catch ( err ) { /* noop */ }
716
+ }
717
+ };
718
+ }
719
+
720
+ return plugin.resolveId;
721
+ })
722
+ .filter( Boolean );
723
+
724
+ var isExternal = function (id) { return options$1.external ?
725
+ Array.isArray( options$1.external ) ? ~options$1.external.indexOf( id ) :
726
+ options$1.external(id) :
727
+ false; };
728
+
729
+ resolvers.unshift( function (id) { return isExternal( id ) ? false : null; } );
730
+
731
+ resolveUsingOtherResolvers = first( resolvers );
732
+
733
+ var entryModules = [].concat( options$1.input || options$1.entry );
734
+ entryModuleIdsPromise = Promise.all(
735
+ entryModules.map( function (entry) { return resolveId( entry ); })
736
+ );
737
+ },
738
+
739
+ resolveId: resolveId,
740
+
741
+ load: function load ( id ) {
742
+ if ( id === HELPERS_ID ) { return HELPERS; }
743
+
744
+ // generate proxy modules
745
+ if ( startsWith( id, EXTERNAL ) ) {
746
+ var actualId = id.slice( EXTERNAL.length );
747
+ var name = getName( actualId );
748
+
749
+ return ("import " + name + " from " + (JSON.stringify( actualId )) + "; export default " + name + ";");
750
+ }
751
+
752
+ if ( startsWith( id, PREFIX ) ) {
753
+ var actualId$1 = id.slice( PREFIX.length );
754
+ var name$1 = getName( actualId$1 );
755
+
756
+ if (commonjsModules.has( actualId$1 ))
757
+ { return ("import { __moduleExports } from " + (JSON.stringify( actualId$1 )) + "; export default __moduleExports;"); }
758
+ else if (esModulesWithoutDefaultExport.indexOf(actualId$1) !== -1)
759
+ { return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default " + name$1 + ";"); }
760
+ else
761
+ { return ("import * as " + name$1 + " from " + (JSON.stringify( actualId$1 )) + "; export default ( " + name$1 + " && " + name$1 + "['default'] ) || " + name$1 + ";"); }
762
+ }
763
+ },
764
+
765
+ transform: function transform ( code, id ) {
766
+ var this$1 = this;
767
+
768
+ if ( !filter( id ) ) { return null; }
769
+ if ( extensions.indexOf( path.extname( id ) ) === -1 ) { return null; }
770
+
771
+ return entryModuleIdsPromise.then( function (entryModuleIds) {
772
+ var ref = checkEsModule( this$1.parse, code, id );
773
+ var isEsModule = ref.isEsModule;
774
+ var hasDefaultExport = ref.hasDefaultExport;
775
+ var ast = ref.ast;
776
+ if ( isEsModule ) {
777
+ if ( !hasDefaultExport )
778
+ { esModulesWithoutDefaultExport.push( id ); }
779
+ return;
780
+ }
781
+
782
+ // it is not an ES module but not a commonjs module, too.
783
+ if ( !checkFirstpass( code, ignoreGlobal ) ) {
784
+ esModulesWithoutDefaultExport.push( id );
785
+ return;
786
+ }
787
+
788
+ var transformed = transformCommonjs( this$1.parse, code, id, entryModuleIds.indexOf(id) !== -1, ignoreGlobal, ignoreRequire, customNamedExports[ id ], sourceMap, allowDynamicRequire, ast );
789
+ if ( !transformed ) {
790
+ esModulesWithoutDefaultExport.push( id );
791
+ return;
792
+ }
793
+
794
+ commonjsModules.set( id, true );
795
+ return transformed;
796
+ }).catch(function (err) {
797
+ this$1.error(err, err.loc);
798
+ });
799
+ }
800
+ };
801
+ }
802
+
803
+ module.exports = commonjs;
804
+ //# sourceMappingURL=rollup-plugin-commonjs.cjs.js.map