123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.transformFileAsync = exports.transformFileSync = exports.transformFile = void 0;
- function _gensync() {
- const data = _interopRequireDefault(require("gensync"));
- _gensync = function () {
- return data;
- };
- return data;
- }
- var _config = _interopRequireDefault(require("./config"));
- var _transformation = require("./transformation");
- var fs = _interopRequireWildcard(require("./gensync-utils/fs"));
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
- 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; }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- ({});
- const transformFileRunner = (0, _gensync().default)(function* (filename, opts) {
- const options = Object.assign({}, opts, {
- filename
- });
- const config = yield* (0, _config.default)(options);
- if (config === null) return null;
- const code = yield* fs.readFile(filename, "utf8");
- return yield* (0, _transformation.run)(config, code);
- });
- const transformFile = transformFileRunner.errback;
- exports.transformFile = transformFile;
- const transformFileSync = transformFileRunner.sync;
- exports.transformFileSync = transformFileSync;
- const transformFileAsync = transformFileRunner.async;
- exports.transformFileAsync = transformFileAsync;
|