[be] Clean up public exports
Cleans up the public exports for the package itself: * `parseFunctions()` was only used in playground, so this moves the definition there. I had to update playground's dependencies to ensure the babel version matched. * Flattens away the `HIR` const in the export, and exports just 4 functions all at the top-level: `run()`, `compile()`, `printHIR()`, and `printReactiveFunction()`. This will make it very easy to split the core compiler into a separate package from the babel plugin, though i'm not sure it's worth doing that (yet).
Joe Savona committed
Jan 12, 2023 at 12:16 UTC
321d7b7d007f82f737da4056d31428e5f0614e7d
7 files changed
+413
-96
compiler/forget/packages/playground/components/Editor/Output.tsx
+32
-3
@@ -4,16 +4,23 @@
4
* This source code is licensed under the MIT license found in the
5
* LICENSE file in the root directory of this source tree.
6
*/
7
+
8
import generate from "@babel/generator";
9
+import { parse } from "@babel/parser";
10
+import traverse, { NodePath } from "@babel/traverse";
11
+import * as t from "@babel/types";
12
import MonacoEditor from "@monaco-editor/react";
9
-import { HIR } from "babel-plugin-react-forget";
13
+import {
14
+ printHIR,
15
+ printReactiveFunction,
16
+ run,
17
+} from "babel-plugin-react-forget";
18
import prettier from "prettier";
19
import prettierParserBabel from "prettier/parser-babel";
20
import { memo, useMemo, useState } from "react";
21
import type { Store } from "../../lib/stores";
22
import TabbedWindow from "../TabbedWindow";
23
import { monacoOptions } from "./monacoOptions";
16
-const { parseFunctions, printHIR, printReactiveFunction } = HIR;
24
const MemoizedOutput = memo(Output);
25
26
export default MemoizedOutput;
@@ -24,6 +31,27 @@ type Props = {
31
32
type CompilerError = string;
33
34
+function parseFunctions(
35
+ source: string
36
+): Array<NodePath<t.FunctionDeclaration>> {
37
+ try {
38
+ const ast = parse(source, {
39
+ plugins: ["typescript", "jsx"],
40
+ });
41
+ const items: Array<NodePath<t.FunctionDeclaration>> = [];
42
+ traverse(ast, {
43
+ FunctionDeclaration: {
44
+ enter(nodePath) {
45
+ items.push(nodePath);
46
+ },
47
+ },
48
+ });
49
+ return items;
50
+ } catch (e) {
51
+ return [];
52
+ }
53
+}
54
+
55
function compile(source: string): Map<string, React.ReactNode> | CompilerError {
56
try {
57
const astFunctions = parseFunctions(source);
@@ -35,7 +63,7 @@ function compile(source: string): Map<string, React.ReactNode> | CompilerError {
63
const func = astFunctions[0];
64
65
const tabs = new Map<string, React.ReactNode>();
38
- const generator = HIR.run(func);
66
+ const generator = run(func);
67
let ast;
68
while (true) {
69
const next = generator.next();
@@ -95,6 +123,7 @@ function compile(source: string): Map<string, React.ReactNode> | CompilerError {
123
});
124
return reorderedTabs;
125
} catch (e: any) {
126
+ console.error(e);
127
return e.toString();
128
}
129
}
compiler/forget/packages/playground/package.json
+11
-4
@@ -10,7 +10,15 @@
10
"lint": "next lint"
11
},
12
"dependencies": {
13
- "@babel/standalone": "^7.18.4",
13
+ "@babel/core": "^7.19.1",
14
+ "@babel/parser": "^7.19.1",
15
+ "@babel/plugin-syntax-typescript": "^7.18.6",
16
+ "@babel/plugin-transform-block-scoping": "^7.18.9",
17
+ "@babel/plugin-transform-modules-commonjs": "^7.18.6",
18
+ "@babel/preset-react": "^7.18.6",
19
+ "@babel/preset-typescript": "^7.18.6",
20
+ "@babel/traverse": "^7.19.1",
21
+ "@babel/types": "^7.19.0",
22
"@heroicons/react": "^1.0.6",
23
"@hpcc-js/wasm": "^1.15.0",
24
"@monaco-editor/react": "^4.4.6",
@@ -26,7 +34,6 @@
34
"react-dom": "18.2.0"
35
},
36
"devDependencies": {
29
- "@types/babel__standalone": "^7.1.4",
37
"@types/node": "18.11.9",
38
"@types/prettier": "^2.7.1",
39
"@types/react": "18.0.25",
@@ -43,7 +50,7 @@
50
"./**/@babel/parser": "7.7.4",
51
"./**/@babel/types": "7.7.4",
52
"@babel/core": "7.2.0",
46
- "@babel/generator": "7.2.0",
47
- "@babel/traverse": "7.1.6"
53
+ "@babel/traverse": "7.1.6",
54
+ "@babel/generator": "7.2.0"
55
}
56
}
compiler/forget/packages/playground/yarn.lock
+364
-18
@@ -2,6 +2,14 @@
2
# yarn lockfile v1
3
4
5
+"@ampproject/remapping@^2.1.0":
6
+ version "2.2.0"
7
+ resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d"
8
+ integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==
9
+ dependencies:
10
+ "@jridgewell/gen-mapping" "^0.1.0"
11
+ "@jridgewell/trace-mapping" "^0.3.9"
12
+
13
"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.18.6":
14
version "7.18.6"
15
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a"
@@ -9,7 +17,12 @@
17
dependencies:
18
"@babel/highlight" "^7.18.6"
19
12
-"@babel/core@7.2.0", "@babel/core@^7.1.0":
20
+"@babel/compat-data@^7.20.5":
21
+ version "7.20.10"
22
+ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.10.tgz#9d92fa81b87542fff50e848ed585b4212c1d34ec"
23
+ integrity sha512-sEnuDPpOJR/fcafHMjpcpGN5M2jbUGUHwmuWKM/YdPzeEDJg8bgmbcWQFUfE32MQjti1koACvoPVsDe8Uq+idg==
24
+
25
+"@babel/core@7.2.0":
26
version "7.2.0"
27
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.2.0.tgz#a4dd3814901998e93340f0086e9867fefa163ada"
28
integrity sha512-7pvAdC4B+iKjFFp9Ztj0QgBndJ++qaMeonT185wAqUnhipw8idm9Rv1UMyBuKtYjfl6ORNkgEgcsYLfHX/GpLw==
@@ -29,7 +42,28 @@
42
semver "^5.4.1"
43
source-map "^0.5.0"
44
32
-"@babel/generator@7.2.0", "@babel/generator@^7.1.6", "@babel/generator@^7.2.0":
45
+"@babel/core@^7.19.1":
46
+ version "7.20.12"
47
+ resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.12.tgz#7930db57443c6714ad216953d1356dac0eb8496d"
48
+ integrity sha512-XsMfHovsUYHFMdrIHkZphTN/2Hzzi78R08NuHfDBehym2VsPDL6Zn/JAD/JQdnRvbSsbQc4mVaU1m6JgtTEElg==
49
+ dependencies:
50
+ "@ampproject/remapping" "^2.1.0"
51
+ "@babel/code-frame" "^7.18.6"
52
+ "@babel/generator" "^7.20.7"
53
+ "@babel/helper-compilation-targets" "^7.20.7"
54
+ "@babel/helper-module-transforms" "^7.20.11"
55
+ "@babel/helpers" "^7.20.7"
56
+ "@babel/parser" "^7.20.7"
57
+ "@babel/template" "^7.20.7"
58
+ "@babel/traverse" "^7.20.12"
59
+ "@babel/types" "^7.20.7"
60
+ convert-source-map "^1.7.0"
61
+ debug "^4.1.0"
62
+ gensync "^1.0.0-beta.2"
63
+ json5 "^2.2.2"
64
+ semver "^6.3.0"
65
+
66
+"@babel/generator@7.2.0", "@babel/generator@^7.1.6", "@babel/generator@^7.2.0", "@babel/generator@^7.20.7":
67
version "7.2.0"
68
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.2.0.tgz#eaf3821fa0301d9d4aef88e63d4bcc19b73ba16c"
69
integrity sha512-BA75MVfRlFQG2EZgFYIwyT1r6xSkwfP2bdkY/kLZusEYWiJs4xCowab/alaEaT0wSvmVuXGqiefeBlP+7V1yKg==
@@ -40,7 +74,44 @@
74
source-map "^0.5.0"
75
trim-right "^1.0.1"
76
43
-"@babel/helper-function-name@^7.1.0":
77
+"@babel/helper-annotate-as-pure@^7.18.6":
78
+ version "7.18.6"
79
+ resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb"
80
+ integrity sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==
81
+ dependencies:
82
+ "@babel/types" "^7.18.6"
83
+
84
+"@babel/helper-compilation-targets@^7.20.7":
85
+ version "7.20.7"
86
+ resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz#a6cd33e93629f5eb473b021aac05df62c4cd09bb"
87
+ integrity sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ==
88
+ dependencies:
89
+ "@babel/compat-data" "^7.20.5"
90
+ "@babel/helper-validator-option" "^7.18.6"
91
+ browserslist "^4.21.3"
92
+ lru-cache "^5.1.1"
93
+ semver "^6.3.0"
94
+
95
+"@babel/helper-create-class-features-plugin@^7.20.7":
96
+ version "7.20.12"
97
+ resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.20.12.tgz#4349b928e79be05ed2d1643b20b99bb87c503819"
98
+ integrity sha512-9OunRkbT0JQcednL0UFvbfXpAsUXiGjUk0a7sN8fUXX7Mue79cUSMjHGDRRi/Vz9vYlpIhLV5fMD5dKoMhhsNQ==
99
+ dependencies:
100
+ "@babel/helper-annotate-as-pure" "^7.18.6"
101
+ "@babel/helper-environment-visitor" "^7.18.9"
102
+ "@babel/helper-function-name" "^7.19.0"
103
+ "@babel/helper-member-expression-to-functions" "^7.20.7"
104
+ "@babel/helper-optimise-call-expression" "^7.18.6"
105
+ "@babel/helper-replace-supers" "^7.20.7"
106
+ "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0"
107
+ "@babel/helper-split-export-declaration" "^7.18.6"
108
+
109
+"@babel/helper-environment-visitor@^7.18.9":
110
+ version "7.18.9"
111
+ resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be"
112
+ integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==
113
+
114
+"@babel/helper-function-name@^7.1.0", "@babel/helper-function-name@^7.19.0":
115
version "7.19.0"
116
resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz#941574ed5390682e872e52d3f38ce9d1bef4648c"
117
integrity sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==
@@ -48,7 +119,80 @@
119
"@babel/template" "^7.18.10"
120
"@babel/types" "^7.19.0"
121
51
-"@babel/helper-split-export-declaration@^7.0.0":
122
+"@babel/helper-hoist-variables@^7.18.6":
123
+ version "7.18.6"
124
+ resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz#d4d2c8fb4baeaa5c68b99cc8245c56554f926678"
125
+ integrity sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==
126
+ dependencies:
127
+ "@babel/types" "^7.18.6"
128
+
129
+"@babel/helper-member-expression-to-functions@^7.20.7":
130
+ version "7.20.7"
131
+ resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.20.7.tgz#a6f26e919582275a93c3aa6594756d71b0bb7f05"
132
+ integrity sha512-9J0CxJLq315fEdi4s7xK5TQaNYjZw+nDVpVqr1axNGKzdrdwYBD5b4uKv3n75aABG0rCCTK8Im8Ww7eYfMrZgw==
133
+ dependencies:
134
+ "@babel/types" "^7.20.7"
135
+
136
+"@babel/helper-module-imports@^7.18.6":
137
+ version "7.18.6"
138
+ resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz#1e3ebdbbd08aad1437b428c50204db13c5a3ca6e"
139
+ integrity sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==
140
+ dependencies:
141
+ "@babel/types" "^7.18.6"
142
+
143
+"@babel/helper-module-transforms@^7.20.11":
144
+ version "7.20.11"
145
+ resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.20.11.tgz#df4c7af713c557938c50ea3ad0117a7944b2f1b0"
146
+ integrity sha512-uRy78kN4psmji1s2QtbtcCSaj/LILFDp0f/ymhpQH5QY3nljUZCaNWz9X1dEj/8MBdBEFECs7yRhKn8i7NjZgg==
147
+ dependencies:
148
+ "@babel/helper-environment-visitor" "^7.18.9"
149
+ "@babel/helper-module-imports" "^7.18.6"
150
+ "@babel/helper-simple-access" "^7.20.2"
151
+ "@babel/helper-split-export-declaration" "^7.18.6"
152
+ "@babel/helper-validator-identifier" "^7.19.1"
153
+ "@babel/template" "^7.20.7"
154
+ "@babel/traverse" "^7.20.10"
155
+ "@babel/types" "^7.20.7"
156
+
157
+"@babel/helper-optimise-call-expression@^7.18.6":
158
+ version "7.18.6"
159
+ resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz#9369aa943ee7da47edab2cb4e838acf09d290ffe"
160
+ integrity sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==
161
+ dependencies:
162
+ "@babel/types" "^7.18.6"
163
+
164
+"@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.20.2":
165
+ version "7.20.2"
166
+ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz#d1b9000752b18d0877cff85a5c376ce5c3121629"
167
+ integrity sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==
168
+
169
+"@babel/helper-replace-supers@^7.20.7":
170
+ version "7.20.7"
171
+ resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.20.7.tgz#243ecd2724d2071532b2c8ad2f0f9f083bcae331"
172
+ integrity sha512-vujDMtB6LVfNW13jhlCrp48QNslK6JXi7lQG736HVbHz/mbf4Dc7tIRh1Xf5C0rF7BP8iiSxGMCmY6Ci1ven3A==
173
+ dependencies:
174
+ "@babel/helper-environment-visitor" "^7.18.9"
175
+ "@babel/helper-member-expression-to-functions" "^7.20.7"
176
+ "@babel/helper-optimise-call-expression" "^7.18.6"
177
+ "@babel/template" "^7.20.7"
178
+ "@babel/traverse" "^7.20.7"
179
+ "@babel/types" "^7.20.7"
180
+
181
+"@babel/helper-simple-access@^7.20.2":
182
+ version "7.20.2"
183
+ resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz#0ab452687fe0c2cfb1e2b9e0015de07fc2d62dd9"
184
+ integrity sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==
185
+ dependencies:
186
+ "@babel/types" "^7.20.2"
187
+
188
+"@babel/helper-skip-transparent-expression-wrappers@^7.20.0":
189
+ version "7.20.0"
190
+ resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.20.0.tgz#fbe4c52f60518cab8140d77101f0e63a8a230684"
191
+ integrity sha512-5y1JYeNKfvnT8sZcK9DVRtpTbGiomYIHviSP3OQWmDPU3DeH4a1ZlT/N2lyQ5P8egjcRaT/Y9aNqUxK0WsnIIg==
192
+ dependencies:
193
+ "@babel/types" "^7.20.0"
194
+
195
+"@babel/helper-split-export-declaration@^7.0.0", "@babel/helper-split-export-declaration@^7.18.6":
196
version "7.18.6"
197
resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz#7367949bc75b20c6d5a5d4a97bba2824ae8ef075"
198
integrity sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==
@@ -60,11 +204,26 @@
204
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz#181f22d28ebe1b3857fa575f5c290b1aaf659b56"
205
integrity sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==
206
207
+"@babel/helper-string-parser@^7.19.4":
208
+ version "7.19.4"
209
+ resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63"
210
+ integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==
211
+
212
"@babel/helper-validator-identifier@^7.18.6":
213
version "7.18.6"
214
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.18.6.tgz#9c97e30d31b2b8c72a1d08984f2ca9b574d7a076"
215
integrity sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==
216
217
+"@babel/helper-validator-identifier@^7.19.1":
218
+ version "7.19.1"
219
+ resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz#7eea834cf32901ffdc1a7ee555e2f9c27e249ca2"
220
+ integrity sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==
221
+
222
+"@babel/helper-validator-option@^7.18.6":
223
+ version "7.18.6"
224
+ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz#bf0d2b5a509b1f336099e4ff36e1a63aa5db4db8"
225
+ integrity sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==
226
+
227
"@babel/helpers@^7.2.0":
228
version "7.19.0"
229
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.19.0.tgz#f30534657faf246ae96551d88dd31e9d1fa1fc18"
@@ -74,6 +233,15 @@
233
"@babel/traverse" "^7.19.0"
234
"@babel/types" "^7.19.0"
235
236
+"@babel/helpers@^7.20.7":
237
+ version "7.20.7"
238
+ resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.20.7.tgz#04502ff0feecc9f20ecfaad120a18f011a8e6dce"
239
+ integrity sha512-PBPjs5BppzsGaxHQCDKnZ6Gd9s6xl8bBCluz3vEInLGRJmnZan4F6BYCeqtyXqkk4W5IlPmjK4JlOuZkpJ3xZA==
240
+ dependencies:
241
+ "@babel/template" "^7.20.7"
242
+ "@babel/traverse" "^7.20.7"
243
+ "@babel/types" "^7.20.7"
244
+
245
"@babel/highlight@^7.18.6":
246
version "7.18.6"
247
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf"
@@ -93,6 +261,104 @@
261
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.19.1.tgz#6f6d6c2e621aad19a92544cc217ed13f1aac5b4c"
262
integrity sha512-h7RCSorm1DdTVGJf3P2Mhj3kdnkmF/EiysUkzS2TdgAYqyjFdMQJbVuXOBej2SBJaXan/lIVtT6KkGbyyq753A==
263
264
+"@babel/parser@^7.19.1", "@babel/parser@^7.20.7":
265
+ version "7.20.7"
266
+ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.7.tgz#66fe23b3c8569220817d5feb8b9dcdc95bb4f71b"
267
+ integrity sha512-T3Z9oHybU+0vZlY9CiDSJQTD5ZapcW18ZctFMi0MOAl/4BjFF4ul7NVSARLdbGO5vDqy9eQiGTV0LtKfvCYvcg==
268
+
269
+"@babel/plugin-syntax-jsx@^7.18.6":
270
+ version "7.18.6"
271
+ resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0"
272
+ integrity sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==
273
+ dependencies:
274
+ "@babel/helper-plugin-utils" "^7.18.6"
275
+
276
+"@babel/plugin-syntax-typescript@^7.18.6", "@babel/plugin-syntax-typescript@^7.20.0":
277
+ version "7.20.0"
278
+ resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.20.0.tgz#4e9a0cfc769c85689b77a2e642d24e9f697fc8c7"
279
+ integrity sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==
280
+ dependencies:
281
+ "@babel/helper-plugin-utils" "^7.19.0"
282
+
283
+"@babel/plugin-transform-block-scoping@^7.18.9":
284
+ version "7.20.11"
285
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.11.tgz#9f5a3424bd112a3f32fe0cf9364fbb155cff262a"
286
+ integrity sha512-tA4N427a7fjf1P0/2I4ScsHGc5jcHPbb30xMbaTke2gxDuWpUfXDuX1FEymJwKk4tuGUvGcejAR6HdZVqmmPyw==
287
+ dependencies:
288
+ "@babel/helper-plugin-utils" "^7.20.2"
289
+
290
+"@babel/plugin-transform-modules-commonjs@^7.18.6":
291
+ version "7.20.11"
292
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.20.11.tgz#8cb23010869bf7669fd4b3098598b6b2be6dc607"
293
+ integrity sha512-S8e1f7WQ7cimJQ51JkAaDrEtohVEitXjgCGAS2N8S31Y42E+kWwfSz83LYz57QdBm7q9diARVqanIaH2oVgQnw==
294
+ dependencies:
295
+ "@babel/helper-module-transforms" "^7.20.11"
296
+ "@babel/helper-plugin-utils" "^7.20.2"
297
+ "@babel/helper-simple-access" "^7.20.2"
298
+
299
+"@babel/plugin-transform-react-display-name@^7.18.6":
300
+ version "7.18.6"
301
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.18.6.tgz#8b1125f919ef36ebdfff061d664e266c666b9415"
302
+ integrity sha512-TV4sQ+T013n61uMoygyMRm+xf04Bd5oqFpv2jAEQwSZ8NwQA7zeRPg1LMVg2PWi3zWBz+CLKD+v5bcpZ/BS0aA==
303
+ dependencies:
304
+ "@babel/helper-plugin-utils" "^7.18.6"
305
+
306
+"@babel/plugin-transform-react-jsx-development@^7.18.6":
307
+ version "7.18.6"
308
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.18.6.tgz#dbe5c972811e49c7405b630e4d0d2e1380c0ddc5"
309
+ integrity sha512-SA6HEjwYFKF7WDjWcMcMGUimmw/nhNRDWxr+KaLSCrkD/LMDBvWRmHAYgE1HDeF8KUuI8OAu+RT6EOtKxSW2qA==
310
+ dependencies:
311
+ "@babel/plugin-transform-react-jsx" "^7.18.6"
312
+
313
+"@babel/plugin-transform-react-jsx@^7.18.6":
314
+ version "7.20.7"
315
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.20.7.tgz#025d85a1935fd7e19dfdcb1b1d4df34d4da484f7"
316
+ integrity sha512-Tfq7qqD+tRj3EoDhY00nn2uP2hsRxgYGi5mLQ5TimKav0a9Lrpd4deE+fcLXU8zFYRjlKPHZhpCvfEA6qnBxqQ==
317
+ dependencies:
318
+ "@babel/helper-annotate-as-pure" "^7.18.6"
319
+ "@babel/helper-module-imports" "^7.18.6"
320
+ "@babel/helper-plugin-utils" "^7.20.2"
321
+ "@babel/plugin-syntax-jsx" "^7.18.6"
322
+ "@babel/types" "^7.20.7"
323
+
324
+"@babel/plugin-transform-react-pure-annotations@^7.18.6":
325
+ version "7.18.6"
326
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.18.6.tgz#561af267f19f3e5d59291f9950fd7b9663d0d844"
327
+ integrity sha512-I8VfEPg9r2TRDdvnHgPepTKvuRomzA8+u+nhY7qSI1fR2hRNebasZEETLyM5mAUr0Ku56OkXJ0I7NHJnO6cJiQ==
328
+ dependencies:
329
+ "@babel/helper-annotate-as-pure" "^7.18.6"
330
+ "@babel/helper-plugin-utils" "^7.18.6"
331
+
332
+"@babel/plugin-transform-typescript@^7.18.6":
333
+ version "7.20.7"
334
+ resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.20.7.tgz#673f49499cd810ae32a1ea5f3f8fab370987e055"
335
+ integrity sha512-m3wVKEvf6SoszD8pu4NZz3PvfKRCMgk6D6d0Qi9hNnlM5M6CFS92EgF4EiHVLKbU0r/r7ty1hg7NPZwE7WRbYw==
336
+ dependencies:
337
+ "@babel/helper-create-class-features-plugin" "^7.20.7"
338
+ "@babel/helper-plugin-utils" "^7.20.2"
339
+ "@babel/plugin-syntax-typescript" "^7.20.0"
340
+
341
+"@babel/preset-react@^7.18.6":
342
+ version "7.18.6"
343
+ resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.18.6.tgz#979f76d6277048dc19094c217b507f3ad517dd2d"
344
+ integrity sha512-zXr6atUmyYdiWRVLOZahakYmOBHtWc2WGCkP8PYTgZi0iJXDY2CN180TdrIW4OGOAdLc7TifzDIvtx6izaRIzg==
345
+ dependencies:
346
+ "@babel/helper-plugin-utils" "^7.18.6"
347
+ "@babel/helper-validator-option" "^7.18.6"
348
+ "@babel/plugin-transform-react-display-name" "^7.18.6"
349
+ "@babel/plugin-transform-react-jsx" "^7.18.6"
350
+ "@babel/plugin-transform-react-jsx-development" "^7.18.6"
351
+ "@babel/plugin-transform-react-pure-annotations" "^7.18.6"
352
+
353
+"@babel/preset-typescript@^7.18.6":
354
+ version "7.18.6"
355
+ resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.18.6.tgz#ce64be3e63eddc44240c6358daefac17b3186399"
356
+ integrity sha512-s9ik86kXBAnD760aybBucdpnLsAt0jK1xqJn2juOn9lkOvSHV60os5hxoVJsPzMQxvnUJFAlkont2DvvaYEBtQ==
357
+ dependencies:
358
+ "@babel/helper-plugin-utils" "^7.18.6"
359
+ "@babel/helper-validator-option" "^7.18.6"
360
+ "@babel/plugin-transform-typescript" "^7.18.6"
361
+
362
"@babel/runtime-corejs3@^7.10.2":
363
version "7.18.3"
364
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.18.3.tgz#52f0241a31e0ec61a6187530af6227c2846bd60c"
@@ -108,11 +374,6 @@
374
dependencies:
375
regenerator-runtime "^0.13.4"
376
111
-"@babel/standalone@^7.18.4":
112
- version "7.18.5"
113
- resolved "https://registry.yarnpkg.com/@babel/standalone/-/standalone-7.18.5.tgz#69aeb99edacb55c509895d7fa6131ec9dbda7c6d"
114
- integrity sha512-3RlzTl3JSvbY1bvaRmuHf3fM2BSy7IbX0zqpVFjsiGO7678KE/LytwvJN+f5MGrarnUFUz2DNcCdetumWdIAKA==
115
-
377
"@babel/template@^7.1.2", "@babel/template@^7.18.10":
378
version "7.18.10"
379
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.18.10.tgz#6f9134835970d1dbf0835c0d100c9f38de0c5e71"
@@ -122,7 +383,16 @@
383
"@babel/parser" "^7.18.10"
384
"@babel/types" "^7.18.10"
385
125
-"@babel/traverse@7.1.6", "@babel/traverse@^7.1.6", "@babel/traverse@^7.19.0":
386
+"@babel/template@^7.20.7":
387
+ version "7.20.7"
388
+ resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8"
389
+ integrity sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw==
390
+ dependencies:
391
+ "@babel/code-frame" "^7.18.6"
392
+ "@babel/parser" "^7.20.7"
393
+ "@babel/types" "^7.20.7"
394
+
395
+"@babel/traverse@7.1.6", "@babel/traverse@^7.1.6", "@babel/traverse@^7.19.0", "@babel/traverse@^7.20.10", "@babel/traverse@^7.20.12", "@babel/traverse@^7.20.7":
396
version "7.1.6"
397
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.1.6.tgz#c8db9963ab4ce5b894222435482bd8ea854b7b5c"
398
integrity sha512-CXedit6GpISz3sC2k2FsGCUpOhUqKdyL0lqNrImQojagnUMXf8hex4AxYFRuMkNGcvJX5QAFGzB5WJQmSv8SiQ==
@@ -137,6 +407,22 @@
407
globals "^11.1.0"
408
lodash "^4.17.10"
409
410
+"@babel/traverse@^7.19.1":
411
+ version "7.20.12"
412
+ resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.20.12.tgz#7f0f787b3a67ca4475adef1f56cb94f6abd4a4b5"
413
+ integrity sha512-MsIbFN0u+raeja38qboyF8TIT7K0BFzz/Yd/77ta4MsUsmP2RAnidIlwq7d5HFQrH/OZJecGV6B71C4zAgpoSQ==
414
+ dependencies:
415
+ "@babel/code-frame" "^7.18.6"
416
+ "@babel/generator" "^7.20.7"
417
+ "@babel/helper-environment-visitor" "^7.18.9"
418
+ "@babel/helper-function-name" "^7.19.0"
419
+ "@babel/helper-hoist-variables" "^7.18.6"
420
+ "@babel/helper-split-export-declaration" "^7.18.6"
421
+ "@babel/parser" "^7.20.7"
422
+ "@babel/types" "^7.20.7"
423
+ debug "^4.1.0"
424
+ globals "^11.1.0"
425
+
426
"@babel/types@7.7.4":
427
version "7.7.4"
428
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.4.tgz#516570d539e44ddf308c07569c258ff94fde9193"
@@ -163,6 +449,15 @@
449
"@babel/helper-validator-identifier" "^7.18.6"
450
to-fast-properties "^2.0.0"
451
452
+"@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.7":
453
+ version "7.20.7"
454
+ resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.20.7.tgz#54ec75e252318423fc07fb644dc6a58a64c09b7f"
455
+ integrity sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==
456
+ dependencies:
457
+ "@babel/helper-string-parser" "^7.19.4"
458
+ "@babel/helper-validator-identifier" "^7.19.1"
459
+ to-fast-properties "^2.0.0"
460
+
461
"@eslint/eslintrc@^1.3.3":
462
version "1.3.3"
463
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.3.tgz#2b044ab39fdfa75b4688184f9e573ce3c5b0ff95"
@@ -216,6 +511,37 @@
511
dependencies:
512
"@sinclair/typebox" "^0.24.1"
513
514
+"@jridgewell/gen-mapping@^0.1.0":
515
+ version "0.1.1"
516
+ resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz#e5d2e450306a9491e3bd77e323e38d7aff315996"
517
+ integrity sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==
518
+ dependencies:
519
+ "@jridgewell/set-array" "^1.0.0"
520
+ "@jridgewell/sourcemap-codec" "^1.4.10"
521
+
522
+"@jridgewell/resolve-uri@3.1.0":
523
+ version "3.1.0"
524
+ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
525
+ integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==
526
+
527
+"@jridgewell/set-array@^1.0.0":
528
+ version "1.1.2"
529
+ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
530
+ integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==
531
+
532
+"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10":
533
+ version "1.4.14"
534
+ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24"
535
+ integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==
536
+
537
+"@jridgewell/trace-mapping@^0.3.9":
538
+ version "0.3.17"
539
+ resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985"
540
+ integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g==
541
+ dependencies:
542
+ "@jridgewell/resolve-uri" "3.1.0"
543
+ "@jridgewell/sourcemap-codec" "1.4.14"
544
+
545
"@monaco-editor/loader@^1.3.2":
546
version "1.3.2"
547
resolved "https://registry.yarnpkg.com/@monaco-editor/loader/-/loader-1.3.2.tgz#04effbb87052d19cd7d3c9d81c0635490f9bb6d8"
@@ -358,13 +684,6 @@
684
dependencies:
685
tslib "^2.4.0"
686
361
-"@types/babel__standalone@^7.1.4":
362
- version "7.1.4"
363
- resolved "https://registry.yarnpkg.com/@types/babel__standalone/-/babel__standalone-7.1.4.tgz#a0c04d1e1bf519468edde5fb245d97ae31e425ae"
364
- integrity sha512-HijIDmcNl3Wmo0guqjYkQvMzyRCM6zMCkYcdG8f+2X7mPBNa9ikSeaQlWs2Yg18KN1klOJzyupX5BPOf+7ahaw==
365
- dependencies:
366
- "@babel/core" "^7.1.0"
367
-
687
"@types/json5@^0.0.29":
688
version "0.0.29"
689
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
@@ -670,7 +989,7 @@ braces@^3.0.2, braces@~3.0.2:
989
dependencies:
990
fill-range "^7.0.1"
991
673
-browserslist@^4.21.4:
992
+browserslist@^4.21.3, browserslist@^4.21.4:
993
version "4.21.4"
994
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.4.tgz#e7496bbc67b9e39dd0f98565feccdcb0d4ff6987"
995
integrity sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==
@@ -790,6 +1109,11 @@ convert-source-map@^1.1.0:
1109
dependencies:
1110
safe-buffer "~5.1.1"
1111
1112
+convert-source-map@^1.7.0:
1113
+ version "1.9.0"
1114
+ resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f"
1115
+ integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==
1116
+
1117
core-js-pure@^3.20.2:
1118
version "3.23.1"
1119
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.23.1.tgz#0b27e4c3ad46178b84e790dbbb81987218ab82ad"
@@ -1347,6 +1671,11 @@ functions-have-names@^1.2.2:
1671
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
1672
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==
1673
1674
+gensync@^1.0.0-beta.2:
1675
+ version "1.0.0-beta.2"
1676
+ resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
1677
+ integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
1678
+
1679
get-caller-file@^2.0.5:
1680
version "2.0.5"
1681
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
@@ -1779,6 +2108,11 @@ json5@^2.1.0:
2108
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
2109
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
2110
2111
+json5@^2.2.2:
2112
+ version "2.2.3"
2113
+ resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
2114
+ integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
2115
+
2116
"jsx-ast-utils@^2.4.1 || ^3.0.0", jsx-ast-utils@^3.2.1:
2117
version "3.3.0"
2118
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.3.0.tgz#e624f259143b9062c92b6413ff92a164c80d3ccb"
@@ -1849,6 +2183,13 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0:
2183
dependencies:
2184
js-tokens "^3.0.0 || ^4.0.0"
2185
2186
+lru-cache@^5.1.1:
2187
+ version "5.1.1"
2188
+ resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920"
2189
+ integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==
2190
+ dependencies:
2191
+ yallist "^3.0.2"
2192
+
2193
lru-cache@^6.0.0:
2194
version "6.0.0"
2195
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
@@ -2741,6 +3082,11 @@ y18n@^5.0.5:
3082
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
3083
integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==
3084
3085
+yallist@^3.0.2:
3086
+ version "3.1.1"
3087
+ resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd"
3088
+ integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==
3089
+
3090
yallist@^4.0.0:
3091
version "4.0.0"
3092
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
compiler/forget/src/HIR/PrintHIR.ts
+1
-4
@@ -37,10 +37,7 @@ export function printFunction(fn: HIRFunction): string {
37
return output.join("\n");
38
}
39
40
-export default function printHIR(
41
- ir: HIR,
42
- options: Options | null = null
43
-): string {
40
+export function printHIR(ir: HIR, options: Options | null = null): string {
41
let output = [];
42
let indent = " ".repeat(options?.indent ?? 0);
43
const push = (text: string, indent: string = " ") => {
compiler/forget/src/HIR/index.ts
+1
-1
@@ -16,4 +16,4 @@ export {
16
shrink,
17
} from "./HIRBuilder";
18
export { mergeConsecutiveBlocks } from "./MergeConsecutiveBlocks";
19
-export { printFunction } from "./PrintHIR";
19
+export { printFunction, printHIR } from "./PrintHIR";
compiler/forget/src/Utils/logger.ts
+1
-1
@@ -6,7 +6,7 @@
6
*/
7
8
import { HIR, HIRFunction, ReactiveFunction } from "../HIR/HIR";
9
-import printHIR, { printFunction } from "../HIR/PrintHIR";
9
+import { printFunction, printHIR } from "../HIR/PrintHIR";
10
import { printReactiveFunction } from "../ReactiveScopes";
11
12
let ENABLED: boolean = false;
compiler/forget/src/index.ts
+3
-65
@@ -11,70 +11,8 @@ declare global {
11
var __DEV__: boolean | null | undefined;
12
}
13
14
-import { parse } from "@babel/parser";
15
-import traverse, { NodePath } from "@babel/traverse";
16
-import * as t from "@babel/types";
17
-import { compile, run } from "./CompilerPipeline";
18
-import { lower } from "./HIR/BuildHIR";
19
-import { Environment } from "./HIR/HIRBuilder";
20
-import printHIR, { printFunction } from "./HIR/PrintHIR";
21
-import { inferMutableRanges, inferReferenceEffects } from "./Inference";
22
-import { buildReactiveFunction } from "./ReactiveScopes/BuildReactiveFunction";
23
-import { codegenReactiveFunction } from "./ReactiveScopes/CodegenReactiveFunction";
24
-import { flattenReactiveLoops } from "./ReactiveScopes/FlattenReactiveLoops";
25
-import { inferReactiveScopeVariables } from "./ReactiveScopes/InferReactiveScopeVariables";
26
-import { printReactiveFunction } from "./ReactiveScopes/PrintReactiveFunction";
27
-import { propagateScopeDependencies } from "./ReactiveScopes/PropagateScopeDependencies";
28
-import { pruneUnusedLabels } from "./ReactiveScopes/PruneUnusedLabels";
29
-import { pruneUnusedScopes } from "./ReactiveScopes/PruneUnusedScopes";
30
-import { eliminateRedundantPhi } from "./SSA/EliminateRedundantPhi";
31
-import enterSSA from "./SSA/EnterSSA";
32
-import { leaveSSA } from "./SSA/LeaveSSA";
33
-import { inferTypes } from "./TypeInference";
34
-
35
-function parseFunctions(
36
- source: string
37
-): Array<NodePath<t.FunctionDeclaration>> {
38
- try {
39
- const ast = parse(source, {
40
- plugins: ["typescript", "jsx"],
41
- });
42
- const items: Array<NodePath<t.FunctionDeclaration>> = [];
43
- traverse(ast, {
44
- FunctionDeclaration: {
45
- enter(nodePath) {
46
- items.push(nodePath);
47
- },
48
- },
49
- });
50
- return items;
51
- } catch (e) {
52
- return [];
53
- }
54
-}
55
-
56
-export const HIR = {
57
- buildReactiveFunction,
58
- codegenReactiveFunction,
59
- compile,
60
- eliminateRedundantPhi,
61
- enterSSA,
62
- Environment,
63
- flattenReactiveLoops,
64
- inferMutableRanges,
65
- inferReactiveScopeVariables,
66
- inferReferenceEffects,
67
- inferTypes,
68
- leaveSSA,
69
- lower,
70
- parseFunctions,
71
- printFunction,
72
- printHIR,
73
- printReactiveFunction,
74
- propagateScopeDependencies,
75
- pruneUnusedLabels,
76
- pruneUnusedScopes,
77
- run,
78
-};
14
+export { compile, run } from "./CompilerPipeline";
15
+export { printHIR } from "./HIR";
16
+export { printReactiveFunction } from "./ReactiveScopes";
17
18
export default BabelPlugin;