transform-file.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.transformFile = transformFile;
  6. exports.transformFileAsync = transformFileAsync;
  7. exports.transformFileSync = transformFileSync;
  8. function _gensync() {
  9. const data = require("gensync");
  10. _gensync = function () {
  11. return data;
  12. };
  13. return data;
  14. }
  15. var _index = require("./config/index.js");
  16. var _index2 = require("./transformation/index.js");
  17. var fs = require("./gensync-utils/fs.js");
  18. ({});
  19. const transformFileRunner = _gensync()(function* (filename, opts) {
  20. const options = Object.assign({}, opts, {
  21. filename
  22. });
  23. const config = yield* (0, _index.default)(options);
  24. if (config === null) return null;
  25. const code = yield* fs.readFile(filename, "utf8");
  26. return yield* (0, _index2.run)(config, code);
  27. });
  28. function transformFile(...args) {
  29. transformFileRunner.errback(...args);
  30. }
  31. function transformFileSync(...args) {
  32. return transformFileRunner.sync(...args);
  33. }
  34. function transformFileAsync(...args) {
  35. return transformFileRunner.async(...args);
  36. }
  37. 0 && 0;
  38. //# sourceMappingURL=transform-file.js.map