index.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.Plugin = Plugin;
  6. Object.defineProperty(exports, "File", {
  7. enumerable: true,
  8. get: function () {
  9. return _file.default;
  10. }
  11. });
  12. Object.defineProperty(exports, "buildExternalHelpers", {
  13. enumerable: true,
  14. get: function () {
  15. return _buildExternalHelpers.default;
  16. }
  17. });
  18. Object.defineProperty(exports, "resolvePlugin", {
  19. enumerable: true,
  20. get: function () {
  21. return _files.resolvePlugin;
  22. }
  23. });
  24. Object.defineProperty(exports, "resolvePreset", {
  25. enumerable: true,
  26. get: function () {
  27. return _files.resolvePreset;
  28. }
  29. });
  30. Object.defineProperty(exports, "version", {
  31. enumerable: true,
  32. get: function () {
  33. return _package.version;
  34. }
  35. });
  36. Object.defineProperty(exports, "getEnv", {
  37. enumerable: true,
  38. get: function () {
  39. return _environment.getEnv;
  40. }
  41. });
  42. Object.defineProperty(exports, "tokTypes", {
  43. enumerable: true,
  44. get: function () {
  45. return _parser().tokTypes;
  46. }
  47. });
  48. Object.defineProperty(exports, "traverse", {
  49. enumerable: true,
  50. get: function () {
  51. return _traverse().default;
  52. }
  53. });
  54. Object.defineProperty(exports, "template", {
  55. enumerable: true,
  56. get: function () {
  57. return _template().default;
  58. }
  59. });
  60. Object.defineProperty(exports, "createConfigItem", {
  61. enumerable: true,
  62. get: function () {
  63. return _item.createConfigItem;
  64. }
  65. });
  66. Object.defineProperty(exports, "loadPartialConfig", {
  67. enumerable: true,
  68. get: function () {
  69. return _config.loadPartialConfig;
  70. }
  71. });
  72. Object.defineProperty(exports, "loadOptions", {
  73. enumerable: true,
  74. get: function () {
  75. return _config.loadOptions;
  76. }
  77. });
  78. Object.defineProperty(exports, "transform", {
  79. enumerable: true,
  80. get: function () {
  81. return _transform.transform;
  82. }
  83. });
  84. Object.defineProperty(exports, "transformSync", {
  85. enumerable: true,
  86. get: function () {
  87. return _transform.transformSync;
  88. }
  89. });
  90. Object.defineProperty(exports, "transformAsync", {
  91. enumerable: true,
  92. get: function () {
  93. return _transform.transformAsync;
  94. }
  95. });
  96. Object.defineProperty(exports, "transformFile", {
  97. enumerable: true,
  98. get: function () {
  99. return _transformFile.transformFile;
  100. }
  101. });
  102. Object.defineProperty(exports, "transformFileSync", {
  103. enumerable: true,
  104. get: function () {
  105. return _transformFile.transformFileSync;
  106. }
  107. });
  108. Object.defineProperty(exports, "transformFileAsync", {
  109. enumerable: true,
  110. get: function () {
  111. return _transformFile.transformFileAsync;
  112. }
  113. });
  114. Object.defineProperty(exports, "transformFromAst", {
  115. enumerable: true,
  116. get: function () {
  117. return _transformAst.transformFromAst;
  118. }
  119. });
  120. Object.defineProperty(exports, "transformFromAstSync", {
  121. enumerable: true,
  122. get: function () {
  123. return _transformAst.transformFromAstSync;
  124. }
  125. });
  126. Object.defineProperty(exports, "transformFromAstAsync", {
  127. enumerable: true,
  128. get: function () {
  129. return _transformAst.transformFromAstAsync;
  130. }
  131. });
  132. Object.defineProperty(exports, "parse", {
  133. enumerable: true,
  134. get: function () {
  135. return _parse.parse;
  136. }
  137. });
  138. Object.defineProperty(exports, "parseSync", {
  139. enumerable: true,
  140. get: function () {
  141. return _parse.parseSync;
  142. }
  143. });
  144. Object.defineProperty(exports, "parseAsync", {
  145. enumerable: true,
  146. get: function () {
  147. return _parse.parseAsync;
  148. }
  149. });
  150. exports.types = exports.OptionManager = exports.DEFAULT_EXTENSIONS = void 0;
  151. var _file = _interopRequireDefault(require("./transformation/file/file"));
  152. var _buildExternalHelpers = _interopRequireDefault(require("./tools/build-external-helpers"));
  153. var _files = require("./config/files");
  154. var _package = require("../package.json");
  155. var _environment = require("./config/helpers/environment");
  156. function _types() {
  157. const data = _interopRequireWildcard(require("@babel/types"));
  158. _types = function () {
  159. return data;
  160. };
  161. return data;
  162. }
  163. Object.defineProperty(exports, "types", {
  164. enumerable: true,
  165. get: function () {
  166. return _types();
  167. }
  168. });
  169. function _parser() {
  170. const data = require("@babel/parser");
  171. _parser = function () {
  172. return data;
  173. };
  174. return data;
  175. }
  176. function _traverse() {
  177. const data = _interopRequireDefault(require("@babel/traverse"));
  178. _traverse = function () {
  179. return data;
  180. };
  181. return data;
  182. }
  183. function _template() {
  184. const data = _interopRequireDefault(require("@babel/template"));
  185. _template = function () {
  186. return data;
  187. };
  188. return data;
  189. }
  190. var _item = require("./config/item");
  191. var _config = require("./config");
  192. var _transform = require("./transform");
  193. var _transformFile = require("./transform-file");
  194. var _transformAst = require("./transform-ast");
  195. var _parse = require("./parse");
  196. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
  197. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  198. const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]);
  199. exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;
  200. class OptionManager {
  201. init(opts) {
  202. return (0, _config.loadOptions)(opts);
  203. }
  204. }
  205. exports.OptionManager = OptionManager;
  206. function Plugin(alias) {
  207. throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`);
  208. }