index.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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, "loadPartialConfigSync", {
  73. enumerable: true,
  74. get: function () {
  75. return _config.loadPartialConfigSync;
  76. }
  77. });
  78. Object.defineProperty(exports, "loadPartialConfigAsync", {
  79. enumerable: true,
  80. get: function () {
  81. return _config.loadPartialConfigAsync;
  82. }
  83. });
  84. Object.defineProperty(exports, "loadOptions", {
  85. enumerable: true,
  86. get: function () {
  87. return _config.loadOptions;
  88. }
  89. });
  90. Object.defineProperty(exports, "loadOptionsSync", {
  91. enumerable: true,
  92. get: function () {
  93. return _config.loadOptionsSync;
  94. }
  95. });
  96. Object.defineProperty(exports, "loadOptionsAsync", {
  97. enumerable: true,
  98. get: function () {
  99. return _config.loadOptionsAsync;
  100. }
  101. });
  102. Object.defineProperty(exports, "transform", {
  103. enumerable: true,
  104. get: function () {
  105. return _transform.transform;
  106. }
  107. });
  108. Object.defineProperty(exports, "transformSync", {
  109. enumerable: true,
  110. get: function () {
  111. return _transform.transformSync;
  112. }
  113. });
  114. Object.defineProperty(exports, "transformAsync", {
  115. enumerable: true,
  116. get: function () {
  117. return _transform.transformAsync;
  118. }
  119. });
  120. Object.defineProperty(exports, "transformFile", {
  121. enumerable: true,
  122. get: function () {
  123. return _transformFile.transformFile;
  124. }
  125. });
  126. Object.defineProperty(exports, "transformFileSync", {
  127. enumerable: true,
  128. get: function () {
  129. return _transformFile.transformFileSync;
  130. }
  131. });
  132. Object.defineProperty(exports, "transformFileAsync", {
  133. enumerable: true,
  134. get: function () {
  135. return _transformFile.transformFileAsync;
  136. }
  137. });
  138. Object.defineProperty(exports, "transformFromAst", {
  139. enumerable: true,
  140. get: function () {
  141. return _transformAst.transformFromAst;
  142. }
  143. });
  144. Object.defineProperty(exports, "transformFromAstSync", {
  145. enumerable: true,
  146. get: function () {
  147. return _transformAst.transformFromAstSync;
  148. }
  149. });
  150. Object.defineProperty(exports, "transformFromAstAsync", {
  151. enumerable: true,
  152. get: function () {
  153. return _transformAst.transformFromAstAsync;
  154. }
  155. });
  156. Object.defineProperty(exports, "parse", {
  157. enumerable: true,
  158. get: function () {
  159. return _parse.parse;
  160. }
  161. });
  162. Object.defineProperty(exports, "parseSync", {
  163. enumerable: true,
  164. get: function () {
  165. return _parse.parseSync;
  166. }
  167. });
  168. Object.defineProperty(exports, "parseAsync", {
  169. enumerable: true,
  170. get: function () {
  171. return _parse.parseAsync;
  172. }
  173. });
  174. exports.types = exports.OptionManager = exports.DEFAULT_EXTENSIONS = void 0;
  175. var _file = _interopRequireDefault(require("./transformation/file/file"));
  176. var _buildExternalHelpers = _interopRequireDefault(require("./tools/build-external-helpers"));
  177. var _files = require("./config/files");
  178. var _package = require("../package.json");
  179. var _environment = require("./config/helpers/environment");
  180. function _types() {
  181. const data = _interopRequireWildcard(require("@babel/types"));
  182. _types = function () {
  183. return data;
  184. };
  185. return data;
  186. }
  187. Object.defineProperty(exports, "types", {
  188. enumerable: true,
  189. get: function () {
  190. return _types();
  191. }
  192. });
  193. function _parser() {
  194. const data = require("@babel/parser");
  195. _parser = function () {
  196. return data;
  197. };
  198. return data;
  199. }
  200. function _traverse() {
  201. const data = _interopRequireDefault(require("@babel/traverse"));
  202. _traverse = function () {
  203. return data;
  204. };
  205. return data;
  206. }
  207. function _template() {
  208. const data = _interopRequireDefault(require("@babel/template"));
  209. _template = function () {
  210. return data;
  211. };
  212. return data;
  213. }
  214. var _item = require("./config/item");
  215. var _config = require("./config");
  216. var _transform = require("./transform");
  217. var _transformFile = require("./transform-file");
  218. var _transformAst = require("./transform-ast");
  219. var _parse = require("./parse");
  220. function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
  221. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
  222. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  223. const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]);
  224. exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;
  225. class OptionManager {
  226. init(opts) {
  227. return (0, _config.loadOptions)(opts);
  228. }
  229. }
  230. exports.OptionManager = OptionManager;
  231. function Plugin(alias) {
  232. throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`);
  233. }