transform-file-browser.ts 821 B

12345678910111213141516171819202122232425262728293031
  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. export const transformFile: TransformFile = function transformFile(
  11. filename,
  12. opts,
  13. callback?: (error: Error, file: null) => void,
  14. ) {
  15. if (typeof opts === "function") {
  16. callback = opts;
  17. }
  18. callback(new Error("Transforming files is not supported in browsers"), null);
  19. };
  20. export function transformFileSync(): never {
  21. throw new Error("Transforming files is not supported in browsers");
  22. }
  23. export function transformFileAsync() {
  24. return Promise.reject(
  25. new Error("Transforming files is not supported in browsers"),
  26. );
  27. }