thyscript 1.0.0
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/bin/thy-node.js +332 -0
- package/bin/thy.js +828 -0
- package/bin/thys.js +25 -0
- package/examples/calculator.thy +274 -0
- package/examples/calculator.thy.js +628 -0
- package/examples/hello.thy +34 -0
- package/examples/login.thy +382 -0
- package/examples/login.thy.js +710 -0
- package/package.json +54 -0
- package/scripts/_class.js +18 -0
- package/scripts/_class2.js +11 -0
- package/scripts/_class3.js +21 -0
- package/scripts/_dstruct.js +20 -0
- package/scripts/_dstruct2.js +24 -0
- package/scripts/_scaffold.js +16 -0
- package/scripts/_scaffold2.js +16 -0
- package/scripts/_scaffold3.js +26 -0
- package/scripts/_tpl_compile.js +13 -0
- package/scripts/_tpl_test.js +9 -0
- package/scripts/_typeof.js +26 -0
- package/scripts/_typeof2.js +25 -0
- package/scripts/patch_genmethod.js +44 -0
- package/scripts/smoke_test.js +167 -0
- package/scripts/smoke_test2.js +151 -0
- package/scripts/test_control_panel.js +58 -0
- package/src/compiler/CodeGenerator.js +1449 -0
- package/src/compiler/JITCompiler.js +325 -0
- package/src/database/DatabaseEngine.js +931 -0
- package/src/errors/ErrorDetector.js +305 -0
- package/src/errors/ErrorMessages.js +497 -0
- package/src/index.js +169 -0
- package/src/lexer/Lexer.js +342 -0
- package/src/lexer/TokenTypes.js +1234 -0
- package/src/memory/MemoryManager.js +283 -0
- package/src/parser/AST.js +606 -0
- package/src/parser/Parser.js +1942 -0
- package/src/runtime/ThyRuntime.js +265 -0
- package/src/runtime/stdlib/ArrayLib.js +207 -0
- package/src/runtime/stdlib/FileLib.js +168 -0
- package/src/runtime/stdlib/MathLib.js +411 -0
- package/src/runtime/stdlib/StringLib.js +387 -0
- package/src/server/ControlPanel.js +1188 -0
- package/src/server/HTMLCSSEngine.js +866 -0
- package/src/server/SecurityEngine.js +714 -0
- package/src/server/ServerEngine.js +738 -0
- package/tests/test1_math.thy +82 -0
- package/tests/test2_oop.thy +133 -0
- package/tests/test3_server.thy +143 -0
- package/tests/test4_functions.thy +159 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
async function testControlPanel() {
|
|
4
|
+
console.log('1. Testing Dashboard Web UI HTML...');
|
|
5
|
+
const r1 = await fetch('http://localhost:7777/');
|
|
6
|
+
const html = await r1.text();
|
|
7
|
+
console.log('Dashboard HTML Length:', html.length, 'Contains Control Panel:', html.includes('ThyScript Control Panel'));
|
|
8
|
+
|
|
9
|
+
console.log('\n2. Testing /api/system...');
|
|
10
|
+
const r2 = await fetch('http://localhost:7777/api/system');
|
|
11
|
+
const sys = await r2.json();
|
|
12
|
+
console.log('System CPU:', sys.metrics.cpu.model, 'Cores:', sys.metrics.cpu.cores);
|
|
13
|
+
console.log('System RAM Used:', sys.metrics.memory.usedMB, '/', sys.metrics.memory.totalMB, 'MB (' + sys.metrics.memory.usagePercent + '%)');
|
|
14
|
+
console.log('Networks found:', sys.networks.map(n => n.interface + ' -> ' + n.address).join(', '));
|
|
15
|
+
|
|
16
|
+
console.log('\n3. Testing /api/files...');
|
|
17
|
+
const r3 = await fetch('http://localhost:7777/api/files');
|
|
18
|
+
const files = await r3.json();
|
|
19
|
+
console.log('Files Found in Workspace:', files.count);
|
|
20
|
+
files.files.slice(0, 5).forEach(f => console.log(' -', f.path, '(' + f.sizeBytes + ' bytes)'));
|
|
21
|
+
|
|
22
|
+
console.log('\n4. Testing /api/run-code (On-The-Fly in Memory, ZERO COMPILE TO DISK)...');
|
|
23
|
+
const testCode = [
|
|
24
|
+
'const table a = 777',
|
|
25
|
+
'const table b = 333',
|
|
26
|
+
'const table total = calculate(a + b)',
|
|
27
|
+
'print("š Live On-The-Fly Output from Computer Utama!")',
|
|
28
|
+
'print("777 + 333 = " + total)'
|
|
29
|
+
].join('\n');
|
|
30
|
+
|
|
31
|
+
const r4 = await fetch('http://localhost:7777/api/run-code', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
headers: { 'Content-Type': 'application/json' },
|
|
34
|
+
body: JSON.stringify({ code: testCode, name: 'remote_eval.thy' })
|
|
35
|
+
});
|
|
36
|
+
const runRes = await r4.json();
|
|
37
|
+
console.log('Run Code Success:', runRes.success);
|
|
38
|
+
console.log('Timings:', runRes.timings);
|
|
39
|
+
console.log('Memory Delta:', runRes.memoryDeltaKB, 'KB');
|
|
40
|
+
console.log('Logs captured:');
|
|
41
|
+
runRes.logs.forEach(l => console.log(' [' + l.type + ']', l.message));
|
|
42
|
+
|
|
43
|
+
console.log('\n5. Testing /api/run-file on examples/hello.thy...');
|
|
44
|
+
const r5 = await fetch('http://localhost:7777/api/run-file', {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
headers: { 'Content-Type': 'application/json' },
|
|
47
|
+
body: JSON.stringify({ filePath: 'examples/hello.thy' })
|
|
48
|
+
});
|
|
49
|
+
const fileRes = await r5.json();
|
|
50
|
+
console.log('Run File Success:', fileRes.success);
|
|
51
|
+
console.log('Total Time:', fileRes.timings.totalMs, 'ms');
|
|
52
|
+
console.log('Logs:');
|
|
53
|
+
fileRes.logs.slice(0, 5).forEach(l => console.log(' [' + l.type + ']', l.message));
|
|
54
|
+
|
|
55
|
+
console.log('\nš === CONTROL PANEL VERIFIED 100% WORKING & ACCESSIBLE! ===');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
testControlPanel().catch(console.error);
|