x
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ type Language struct {
|
||||
}
|
||||
|
||||
var plugin_dir = utils.ExecPath + "/plugins"
|
||||
var release = "20230731"
|
||||
var release = "20230732"
|
||||
|
||||
var languages = []Language{
|
||||
{
|
||||
|
||||
+15
-8
@@ -217,7 +217,7 @@ func AddNodePlugin(path, name string) error {
|
||||
f.Suffix = ".js"
|
||||
f.Type = "node"
|
||||
f.Path = path
|
||||
f.Handle = func(s common.Sender, f func(vm *goja.Runtime)) interface{} {
|
||||
f.Handle = func(s common.Sender, _ func(vm *goja.Runtime)) interface{} {
|
||||
console := &Console{UUID: uuid}
|
||||
s.SetPluginID(uuid)
|
||||
plt := s.GetImType()
|
||||
@@ -263,13 +263,20 @@ func AddNodePlugin(path, name string) error {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
scanner := bufio.NewScanner(stderr)
|
||||
for scanner.Scan() {
|
||||
data := scanner.Text()
|
||||
fmt.Println(data)
|
||||
console.Error(data)
|
||||
// if _, err := file.WriteString(data + "\n"); err != nil {
|
||||
// fmt.Printf("写入文件失败:%v\n", err)
|
||||
// }
|
||||
if f.OnStart {
|
||||
for scanner.Scan() {
|
||||
fmt.Println(scanner.Text())
|
||||
}
|
||||
} else {
|
||||
lines := []string{}
|
||||
for scanner.Scan() {
|
||||
data := scanner.Text()
|
||||
lines = append(lines, data)
|
||||
}
|
||||
if len(lines) != 0 {
|
||||
console.Error(strings.Join(lines, "\n"))
|
||||
}
|
||||
|
||||
}
|
||||
}()
|
||||
processes.Store(cmd, s)
|
||||
|
||||
+9
-17
@@ -375,29 +375,21 @@ class Bucket {
|
||||
return v;
|
||||
}
|
||||
reverseTransform(value) {
|
||||
if (typeof value === "number" || typeof value === "boolean") {
|
||||
return value.toString();
|
||||
if (typeof value === "number") {
|
||||
if (value % 1 === 0) {
|
||||
return `d:${value}`;
|
||||
}
|
||||
return `f:${value}`;
|
||||
}
|
||||
if (typeof value === "boolean") {
|
||||
return `b:${value}`;
|
||||
}
|
||||
if (typeof value === "object" && value !== null) {
|
||||
return "o:" + JSON.stringify(value);
|
||||
}
|
||||
if (value === undefined || value === null) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!isNaN(parseFloat(value))) {
|
||||
return "f:" + parseFloat(value);
|
||||
}
|
||||
if (!isNaN(parseInt(value))) {
|
||||
return "d:" + parseInt(value);
|
||||
}
|
||||
if (value === "true" || value === "false") {
|
||||
return "b:" + (value === "true");
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
async get(key, defaultValue = undefined) {
|
||||
|
||||
+9
-17
@@ -425,29 +425,21 @@ class Bucket {
|
||||
}
|
||||
|
||||
reverseTransform(value: any): string {
|
||||
if (typeof value === "number" || typeof value === "boolean") {
|
||||
return value.toString();
|
||||
if (typeof value === "number") {
|
||||
if (value % 1 === 0) {
|
||||
return `d:${value}`;
|
||||
}
|
||||
return `f:${value}`;
|
||||
}
|
||||
if (typeof value === "boolean") {
|
||||
return `b:${value}`;
|
||||
}
|
||||
if (typeof value === "object" && value !== null) {
|
||||
return "o:" + JSON.stringify(value);
|
||||
}
|
||||
if (value === undefined || value === null) {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
if (!value) {
|
||||
return "";
|
||||
}
|
||||
if (!isNaN(parseFloat(value))) {
|
||||
return "f:" + parseFloat(value);
|
||||
}
|
||||
if (!isNaN(parseInt(value))) {
|
||||
return "d:" + parseInt(value);
|
||||
}
|
||||
if (value === "true" || value === "false") {
|
||||
return "b:" + (value === "true");
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user