MCPcopy Create free account
hub / github.com/RubyLouvre/anu / transformFile

Function transformFile

test/babel.js:22513–22538  ·  view source on GitHub ↗
(filename, opts, callback)

Source from the content-addressed store, hash-verified

22511 var transformFromAst = exports.transformFromAst = pipeline.transformFromAst.bind(pipeline);
22512
22513 function transformFile(filename, opts, callback) {
22514 if (typeof opts === "function") {
22515 callback = opts;
22516 opts = {};
22517 }
22518
22519 opts.filename = filename;
22520
22521 _fs2.default.readFile(filename, function (err, code) {
22522 var result = void 0;
22523
22524 if (!err) {
22525 try {
22526 result = transform(code, opts);
22527 } catch (_err) {
22528 err = _err;
22529 }
22530 }
22531
22532 if (err) {
22533 callback(err);
22534 } else {
22535 callback(null, result);
22536 }
22537 });
22538 }
22539
22540 function transformFileSync(filename) {
22541 var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

Callers

nothing calls this directly

Calls 1

transformFunction · 0.85

Tested by

no test coverage detected