Add browser versions of the transform files.

This commit is contained in:
Logan Smyth
2017-10-01 23:23:47 -07:00
parent eae76e5b89
commit f02e6847cf
3 changed files with 22 additions and 1 deletions

View File

@@ -22,7 +22,9 @@
"compiler"
],
"browser": {
"./lib/config/loading/files/index.js": "./lib/config/loading/files/index-browser.js"
"./lib/config/loading/files/index.js": "./lib/config/loading/files/index-browser.js",
"./lib/transform-file.js": "./lib/transform-file-browser.js",
"./lib/transform-file-sync.js": "./lib/transform-file-sync-browser.js"
},
"dependencies": {
"babel-code-frame": "7.0.0-beta.2",

View File

@@ -0,0 +1,14 @@
// @flow
import type { FileResult } from "./transformation";
export default function transformFile(
filename: string,
opts?: Object = {},
callback: (?Error, FileResult | null) => void,
) {
if (typeof opts === "function") {
callback = opts;
}
callback(new Error("Transforming files is not supported in browsers"), null);
}

View File

@@ -0,0 +1,5 @@
// @flow
export default function transformFileSync() {
throw new Error("Transforming files is not supported in browsers");
}