aboutsummaryrefslogtreecommitdiff
path: root/node_modules/@babel/core/src/transform-file.ts
diff options
context:
space:
mode:
authorJoel Kronqvist <joel.h.kronqvist@gmail.com>2022-03-05 19:02:27 +0200
committerJoel Kronqvist <joel.h.kronqvist@gmail.com>2022-03-05 19:02:27 +0200
commit5d309ff52cd399a6b71968a6b9a70c8ac0b98981 (patch)
tree360f7eb50f956e2367ef38fa1fc6ac7ac5258042 /node_modules/@babel/core/src/transform-file.ts
parentb500a50f1b97d93c98b36ed9a980f8188d648147 (diff)
downloadLYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.tar.gz
LYLLRuoka-5d309ff52cd399a6b71968a6b9a70c8ac0b98981.zip
Added node_modules for the updating to work properly.
Diffstat (limited to 'node_modules/@babel/core/src/transform-file.ts')
-rw-r--r--node_modules/@babel/core/src/transform-file.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/node_modules/@babel/core/src/transform-file.ts b/node_modules/@babel/core/src/transform-file.ts
new file mode 100644
index 0000000..4be0e16
--- /dev/null
+++ b/node_modules/@babel/core/src/transform-file.ts
@@ -0,0 +1,40 @@
+import gensync from "gensync";
+
+import loadConfig from "./config";
+import type { InputOptions, ResolvedConfig } from "./config";
+import { run } from "./transformation";
+import type { FileResult, FileResultCallback } from "./transformation";
+import * as fs from "./gensync-utils/fs";
+
+type transformFileBrowserType = typeof import("./transform-file-browser");
+type transformFileType = typeof import("./transform-file");
+
+// Kind of gross, but essentially asserting that the exports of this module are the same as the
+// exports of transform-file-browser, since this file may be replaced at bundle time with
+// transform-file-browser.
+({} as any as transformFileBrowserType as transformFileType);
+
+type TransformFile = {
+ (filename: string, callback: FileResultCallback): void;
+ (
+ filename: string,
+ opts: InputOptions | undefined | null,
+ callback: FileResultCallback,
+ ): void;
+};
+
+const transformFileRunner = gensync<
+ (filename: string, opts?: InputOptions) => FileResult | null
+>(function* (filename, opts: InputOptions) {
+ const options = { ...opts, filename };
+
+ const config: ResolvedConfig | null = yield* loadConfig(options);
+ if (config === null) return null;
+
+ const code = yield* fs.readFile(filename, "utf8");
+ return yield* run(config, code);
+});
+
+export const transformFile = transformFileRunner.errback as TransformFile;
+export const transformFileSync = transformFileRunner.sync;
+export const transformFileAsync = transformFileRunner.async;