enable downlevelIteration build option in typescript

This commit is contained in:
lxsang
2021-05-11 15:05:28 +02:00
parent 2fc1a8cee4
commit 1d55e82259
20 changed files with 594 additions and 16 deletions

View File

@ -2,6 +2,7 @@
AntOSDK: development API for AntOS based applications/projects
## Change logs
- 0.0.7: enable typescript downlevelIteration compile option
- 0.0.6: add GUI application for building a JSON build file
- 0.0.5: add API that supports running Linux commands on server
- 0.0.4: support automatic locale generation

View File

@ -0,0 +1,70 @@
class LinuxJob extends AntOSDKBaseJob {
constructor(data)
{
super(data);
}
execute()
{
switch (this.job.cmd) {
case 'linux-exec':
/**
* Execute a linux command with the
* help of a server side lua API
* script
*/
this.exec();
break;
default:
const err_msg = `Unkown job ${this.job.cmd}`;
this.log_error(err_msg);
return this.error(err_msg);
}
}
exec()
{
const path = "pkg://libantosdk/core/lua/api.lua".abspath(this.job.root);
const url = API.REST.replace("http","ws") + "/system/apigateway?ws=1";
try{
const socket = new WebSocket(url);
socket.onerror = (e)=> {
this.log_error(e.toString());
this.error(e);
socket.close();
};
socket.onclose = (e) => {
this.log_info("Connection closed");
this.result("Done");
};
socket.onopen = (e) => {
// send the command
const cmd = {
path: path,
parameters: {
action: "exec",
args: this.job.data
}
};
socket.send(JSON.stringify(cmd));
};
socket.onmessage = (e) => {
const json = JSON.parse(e.data);
if(json.error)
{
this.log_error(json.error);
}
else
{
this.log_print(json.result);
}
}
}
catch(error)
{
this.log_error(error.toString());
return this.error(error);
}
}
}
API.jobhandle["linux-exec"] = LinuxJob;

View File

@ -0,0 +1,31 @@
local args=...
local result = function(data)
return { error = false, result = data }
end
local error = function(msg)
return {error = msg, result = false}
end
local handle = {}
handle.exec = function(data)
local cmd = data.cmd
if data.pwd then
cmd = "cd "..require("vfs").ospath(data.pwd).. " && "..cmd
end
cmd = cmd.." 2>&1"
local pipe = io.popen(cmd)
for line in pipe:lines() do
echo(JSON.encode(result(line)))
end
pipe:close()
return result("Done: ["..cmd.."]")
end
if args.action and handle[args.action] then
return handle[args.action](args.args)
else
return error("Invalid action parameter")
end

View File

@ -92,6 +92,7 @@ class TSJob extends AntOSDKBaseJob {
const program = ts.createProgram(files, {
"target": "es6",
"skipLibCheck": true,
"downlevelIteration": true
}, host);
const result = program.emit();
const diagnostics = result.diagnostics.concat((ts.getPreEmitDiagnostics(program)));

View File

@ -0,0 +1,32 @@
afx-app-window[data-id = "SDKBuilder"] afx-resizer {
border-left: 1px solid #656565;
background-color:transparent;
}
afx-app-window[data-id = "SDKBuilder"] div[data-id="container"] {
overflow-y: auto;
overflow-x: hidden;
user-select: text;
}
afx-app-window[data-id = "SDKBuilder"] div[data-id="container"] pre {
margin: 3px;
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
font-family: monospace;
}
afx-app-window[data-id = "SDKBuilder"] div[data-id="container"] pre.sdk-log-error {
color: red;
}
afx-app-window[data-id = "SDKBuilder"] div[data-id="container"] pre.sdk-log-warn {
color: orange;
}
afx-app-window[data-id = "SDKBuilder"] div[data-id="container"] pre.sdk-log-info {
color: green;
}

View File

@ -7,7 +7,7 @@
"author": "Xuan Sang LE",
"email": "mrsang@iohub.dev"
},
"version": "0.0.6-a",
"version": "0.0.7-a",
"category": "Development",
"iconclass": "fa fa-cog",
"mimes": [

View File

@ -0,0 +1,30 @@
<afx-app-window apptitle="__(AntOSDK Builder)" width="600" height="500" data-id="SDKBuilder">
<afx-hbox>
<afx-vbox data-width="150">
<div data-height="10"></div>
<afx-list-view data-id="target-list"></afx-list-view>
<div data-height="5"></div>
<afx-hbox data-height="23" style="text-align: left;">
<afx-button data-id="btnopen" data-width="25" iconclass ="bi bi-file-arrow-up-fill"></afx-button>
<afx-button data-id="btnrefresh" data-width="25" iconclass ="fa fa-refresh"></afx-button>
<afx-button data-id="btnbuild" text="__(Run)"></afx-button>
<div data-width="5"></div>
</afx-hbox>
<div data-height="10"></div>
</afx-vbox>
<afx-resizer data-width="3"></afx-resizer>
<afx-vbox data-id="right-pannel">
<div data-height="10"></div>
<afx-hbox data-id="wrapper">
<div data-width="10"></div>
<div data-id="container"></div>
</afx-hbox>
<div data-height="5"></div>
<afx-hbox data-height="23" style="text-align: right;">
<afx-button data-id="btnclear" iconclass="fa fa-trash" text="__(Clear log)"></afx-button>
<div data-width="5"></div>
</afx-hbox>
<div data-height="10"></div>
</afx-vbox>
</afx-hbox>
</afx-app-window>