@runtime-type-inspector/repl 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/importmap.js +1 -1
- package/index.html +1 -0
- package/index.mjs +17 -2
- package/package.json +2 -2
package/importmap.js
CHANGED
|
@@ -14,7 +14,7 @@ const imports = {
|
|
|
14
14
|
"fs": importFile("export default {};"),
|
|
15
15
|
"typescript": importFile("export default ts;"), // UMD import
|
|
16
16
|
};
|
|
17
|
-
if (location.host
|
|
17
|
+
if (location.host.includes('runtimetypeinspector.org') || location.port === '7000') {
|
|
18
18
|
imports['@runtime-type-inspector/runtime' ] = './node_modules/@runtime-type-inspector/runtime/index.mjs';
|
|
19
19
|
imports['@runtime-type-inspector/transpiler'] = './node_modules/@runtime-type-inspector/transpiler/index.mjs';
|
|
20
20
|
}
|
package/index.html
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
<option value="expandTypeDepFree">expandTypeDepFree</option>
|
|
22
22
|
</select>
|
|
23
23
|
<button id="repl">REPL</button>
|
|
24
|
+
<button id="repl-runtime" onclick="activateREPLRuntime()">REPL Runtime</button>
|
|
24
25
|
<button id="button-compare-ast" onclick="compareAST()">Compare AST</button>
|
|
25
26
|
<button id="button-set-hash" onclick="setHash()">Set hash</button>
|
|
26
27
|
Left: <input id="left" type="checkbox" checked></input>
|
package/index.mjs
CHANGED
|
@@ -141,6 +141,19 @@ function activateREPL() {
|
|
|
141
141
|
// @ts-ignore
|
|
142
142
|
selectAction.value = "eval";
|
|
143
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* @todo remove import/exports of RTI Runtime, since we are injecting them
|
|
146
|
+
*/
|
|
147
|
+
function activateREPLRuntime() {
|
|
148
|
+
const code = Object.entries(rti)
|
|
149
|
+
.map(([key, val]) => data2code(key, val))
|
|
150
|
+
.join('\n')
|
|
151
|
+
.replace('let warnedTable = {};', 'const warnedTable = createTable();');
|
|
152
|
+
// options.warned needs to be cleared since it contains "tr" values from old session
|
|
153
|
+
const extra = 'clearObject(options.warned)';
|
|
154
|
+
const newCode = [code, extra, getRight()].join('\n');
|
|
155
|
+
setRight(newCode);
|
|
156
|
+
}
|
|
144
157
|
buttonREPL.onclick = activateREPL;
|
|
145
158
|
Object.assign(window, {
|
|
146
159
|
parse,
|
|
@@ -152,7 +165,7 @@ function statsPrint() {
|
|
|
152
165
|
console.table(lastStats);
|
|
153
166
|
}
|
|
154
167
|
/**
|
|
155
|
-
* @param {string} value
|
|
168
|
+
* @param {string} value - New value for left editor.
|
|
156
169
|
*/
|
|
157
170
|
function setLeft(value) {
|
|
158
171
|
if (typeof value !== 'string') {
|
|
@@ -163,7 +176,7 @@ function setLeft(value) {
|
|
|
163
176
|
aceEditorLeft.clearSelection(); // setValue() selects everything, so unselect it now
|
|
164
177
|
}
|
|
165
178
|
/**
|
|
166
|
-
* @param {string} value
|
|
179
|
+
* @param {string} value - New value for right editor.
|
|
167
180
|
*/
|
|
168
181
|
function setRight(value) {
|
|
169
182
|
if (typeof value !== 'string') {
|
|
@@ -470,4 +483,6 @@ export {
|
|
|
470
483
|
expandTypeAll,
|
|
471
484
|
runAction,
|
|
472
485
|
data2code,
|
|
486
|
+
activateREPL,
|
|
487
|
+
activateREPLRuntime,
|
|
473
488
|
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtime-type-inspector/repl",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "REPL of RuntimeTypeInspector.js",
|
|
5
5
|
"main": "index.html",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@runtime-type-inspector/transpiler": "^3.0.
|
|
7
|
+
"@runtime-type-inspector/transpiler": "^3.0.8",
|
|
8
8
|
"ace-builds": "^1.28.0",
|
|
9
9
|
"express": "^4.18.2"
|
|
10
10
|
},
|