Debian Codegraph @

packages/babel-core/src/transform-file-browser.ts

raw
1 // duplicated from transform-file so we do not have to import anything here
2 type TransformFile = {
3 (filename: string, callback: (error: Error, file: null) => void): void;
4 (
5 filename: string,
6 opts: any,
7 callback: (error: Error, file: null) => void,
8 ): void;
9 };
10
11 export const transformFile: TransformFile = function transformFile(
12 filename,
13 opts,
14 callback?: (error: Error, file: null) => void,
15 ) {
16 if (typeof opts === "function") {
17 callback = opts;
18 }
19
20 callback(new Error("Transforming files is not supported in browsers"), null);
21 };
22
23 export function transformFileSync(): never {
24 throw new Error("Transforming files is not supported in browsers");
25 }
26
27 export function transformFileAsync() {
28 return Promise.reject(
29 new Error("Transforming files is not supported in browsers"),
30 );
31 }