summaryrefslogtreecommitdiff
path: root/node_modules/sucrase/dist/esm/parser/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/sucrase/dist/esm/parser/index.js')
-rw-r--r--node_modules/sucrase/dist/esm/parser/index.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/node_modules/sucrase/dist/esm/parser/index.js b/node_modules/sucrase/dist/esm/parser/index.js
new file mode 100644
index 0000000..5074ae4
--- /dev/null
+++ b/node_modules/sucrase/dist/esm/parser/index.js
@@ -0,0 +1,31 @@
+
+
+import {augmentError, initParser, state} from "./traverser/base";
+import {parseFile} from "./traverser/index";
+
+export class File {
+
+
+
+ constructor(tokens, scopes) {
+ this.tokens = tokens;
+ this.scopes = scopes;
+ }
+}
+
+export function parse(
+ input,
+ isJSXEnabled,
+ isTypeScriptEnabled,
+ isFlowEnabled,
+) {
+ if (isFlowEnabled && isTypeScriptEnabled) {
+ throw new Error("Cannot combine flow and typescript plugins.");
+ }
+ initParser(input, isJSXEnabled, isTypeScriptEnabled, isFlowEnabled);
+ const result = parseFile();
+ if (state.error) {
+ throw augmentError(state.error);
+ }
+ return result;
+}