mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Update parser and bindings generation
Update tests
This commit is contained in:
@@ -102,7 +102,8 @@ func sanitiseJSVarName(name string) string {
|
||||
return name
|
||||
}
|
||||
|
||||
func GenerateBinding(structName string, method *BoundMethod) (string, []string) {
|
||||
func GenerateBinding(structName string, method *BoundMethod) (string, []string, []string) {
|
||||
var namespacedStructs []string
|
||||
var models []string
|
||||
result := strings.ReplaceAll(bindingTemplate, "{{structName}}", structName)
|
||||
result = strings.ReplaceAll(result, "{{methodName}}", method.Name)
|
||||
@@ -114,11 +115,16 @@ func GenerateBinding(structName string, method *BoundMethod) (string, []string)
|
||||
result = strings.ReplaceAll(result, "Comments", comments)
|
||||
var params string
|
||||
for _, input := range method.Inputs {
|
||||
inputName := sanitiseJSVarName(input.Name)
|
||||
pkgName := getPackageName(input)
|
||||
if pkgName != "" {
|
||||
models = append(models, pkgName)
|
||||
if input.Type.IsStruct {
|
||||
nsStruct := input.NamespacedStructType()
|
||||
namespacedStructs = append(namespacedStructs, nsStruct)
|
||||
}
|
||||
}
|
||||
params += " * @param " + sanitiseJSVarName(input.Name) + " {" + input.JSType() + "}\n"
|
||||
params += " * @param " + inputName + " {" + input.JSType() + "}\n"
|
||||
}
|
||||
params = strings.TrimSuffix(params, "\n")
|
||||
if len(params) == 0 {
|
||||
@@ -156,6 +162,10 @@ func GenerateBinding(structName string, method *BoundMethod) (string, []string)
|
||||
if jsType == "error" {
|
||||
jsType = "void"
|
||||
}
|
||||
if output.Type.IsStruct {
|
||||
namespacedStructs = append(namespacedStructs, output.NamespacedStructType())
|
||||
jsType = output.NamespacedStructVariable()
|
||||
}
|
||||
returns += jsType + ", "
|
||||
}
|
||||
returns = strings.TrimSuffix(returns, ", ")
|
||||
@@ -163,7 +173,7 @@ func GenerateBinding(structName string, method *BoundMethod) (string, []string)
|
||||
}
|
||||
result = strings.ReplaceAll(result, " * @returns {Promise<string>}", returns)
|
||||
|
||||
return result, lo.Uniq(models)
|
||||
return result, lo.Uniq(models), lo.Uniq(namespacedStructs)
|
||||
}
|
||||
|
||||
func getPackageName(input *Parameter) string {
|
||||
@@ -217,6 +227,7 @@ func GenerateBindings(bindings map[string]map[string][]*BoundMethod) map[string]
|
||||
sort.Strings(packageNames)
|
||||
for _, packageName := range packageNames {
|
||||
var allModels []string
|
||||
var allNamespacedStructs []string
|
||||
|
||||
packageBindings := bindings[packageName]
|
||||
structNames := lo.Keys(packageBindings)
|
||||
@@ -239,7 +250,8 @@ window.go = window.go || {};
|
||||
return methods[i].Name < methods[j].Name
|
||||
})
|
||||
for _, method := range methods {
|
||||
thisBinding, models := GenerateBinding(structName, method)
|
||||
thisBinding, models, namespacedStructs := GenerateBinding(structName, method)
|
||||
allNamespacedStructs = append(allNamespacedStructs, namespacedStructs...)
|
||||
allModels = append(allModels, models...)
|
||||
result[normalisedPackageNames[packageName]] += thisBinding
|
||||
}
|
||||
@@ -247,19 +259,14 @@ window.go = window.go || {};
|
||||
}
|
||||
result[normalisedPackageNames[packageName]] += "};\n"
|
||||
|
||||
// add imports
|
||||
/* if len(allModels) > 0 {
|
||||
allModels := lo.Uniq(allModels)
|
||||
var models []string
|
||||
for _, model := range allModels {
|
||||
models = append(models, normalisedPackageNames[model])
|
||||
}
|
||||
sort.Strings(models)
|
||||
result[normalisedPackageNames[packageName]] += "\n"
|
||||
imports := "import {" + strings.Join(models, ", ") + "} from './models';\n"
|
||||
result[normalisedPackageNames[packageName]] = imports + result[normalisedPackageNames[packageName]]
|
||||
}
|
||||
*/
|
||||
if len(allNamespacedStructs) > 0 {
|
||||
typedefs := "/**\n"
|
||||
for _, namespacedStruct := range lo.Uniq(allNamespacedStructs) {
|
||||
typedefs += " * @typedef {import('./models')." + namespacedStruct + "} " + strings.ReplaceAll(namespacedStruct, ".", "") + "\n"
|
||||
}
|
||||
typedefs += " */\n\n"
|
||||
result[normalisedPackageNames[packageName]] = typedefs + result[normalisedPackageNames[packageName]]
|
||||
}
|
||||
|
||||
result[normalisedPackageNames[packageName]] = header + result[normalisedPackageNames[packageName]]
|
||||
}
|
||||
|
||||
@@ -41,6 +41,23 @@ type Parameter struct {
|
||||
Type *ParameterType
|
||||
}
|
||||
|
||||
func (p *Parameter) NamespacedStructType() string {
|
||||
var typeName string
|
||||
if p.Type.Package != "" {
|
||||
parts := strings.Split(p.Type.Package, "/")
|
||||
typeName = parts[len(parts)-1] + "."
|
||||
}
|
||||
return typeName + p.Type.Name
|
||||
}
|
||||
func (p *Parameter) NamespacedStructVariable() string {
|
||||
var typeName string
|
||||
if p.Type.Package != "" {
|
||||
parts := strings.Split(p.Type.Package, "/")
|
||||
typeName = parts[len(parts)-1]
|
||||
}
|
||||
return typeName + p.Type.Name
|
||||
}
|
||||
|
||||
func (p *Parameter) JSType() string {
|
||||
// Convert type to javascript equivalent type
|
||||
var typeName string
|
||||
@@ -57,11 +74,8 @@ func (p *Parameter) JSType() string {
|
||||
|
||||
// if the type is a struct, we need to add the package name
|
||||
if p.Type.IsStruct {
|
||||
if p.Type.Package != "" {
|
||||
parts := strings.Split(p.Type.Package, "/")
|
||||
typeName = parts[len(parts)-1] + "." + typeName
|
||||
// TODO: Check if this is a duplicate package name
|
||||
}
|
||||
typeName = p.NamespacedStructType()
|
||||
typeName = strings.ReplaceAll(typeName, ".", "")
|
||||
}
|
||||
|
||||
// Add slice suffix
|
||||
|
||||
+7
-5
@@ -2,7 +2,10 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {main} from './models';
|
||||
/**
|
||||
* @typedef {import('./models').main.Person} mainPerson
|
||||
*/
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
@@ -14,15 +17,14 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.NewPerson
|
||||
* NewPerson creates a new person
|
||||
* @param name {string}
|
||||
* @returns {Promise<main.Person | null>}
|
||||
* @returns {Promise<mainPerson>}
|
||||
**/
|
||||
NewPerson: function(name) { wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
NewPerson: function(name) { return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+6
-4
@@ -2,7 +2,10 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {services} from './models';
|
||||
/**
|
||||
* @typedef {import('./models').services.Address} servicesAddress
|
||||
*/
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.services = {
|
||||
@@ -12,9 +15,8 @@ window.go.services = {
|
||||
* OtherService.Yay
|
||||
*
|
||||
*
|
||||
* @returns {Promise<services.Address | null>}
|
||||
* @returns {Promise<servicesAddress>}
|
||||
**/
|
||||
Yay: function() { wails.CallByID(302702907, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Yay: function() { return wails.CallByID(302702907, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
OtherService: {
|
||||
|
||||
@@ -23,6 +23,6 @@ window.go.main = {
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
**/
|
||||
Hello: function() { wails.CallByID(4249972365, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Hello: function() { return wails.CallByID(4249972365, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
OtherService: {
|
||||
|
||||
@@ -23,6 +23,6 @@ window.go.main = {
|
||||
*
|
||||
* @returns {Promise<void>}
|
||||
**/
|
||||
Hello: function() { wails.CallByID(4249972365, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Hello: function() { return wails.CallByID(4249972365, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {main} from './models';
|
||||
/**
|
||||
* @typedef {import('./models').main.Person} mainPerson
|
||||
*/
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
@@ -14,15 +17,14 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.NewPerson
|
||||
* NewPerson creates a new person
|
||||
* @param name {string}
|
||||
* @returns {Promise<main.Person | null>}
|
||||
* @returns {Promise<mainPerson>}
|
||||
**/
|
||||
NewPerson: function(name) { wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
NewPerson: function(name) { return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+6
-4
@@ -2,7 +2,10 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {services} from './models';
|
||||
/**
|
||||
* @typedef {import('./models').services.Address} servicesAddress
|
||||
*/
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.services = {
|
||||
@@ -12,9 +15,8 @@ window.go.services = {
|
||||
* OtherService.Yay
|
||||
*
|
||||
*
|
||||
* @returns {Promise<services.Address | null>}
|
||||
* @returns {Promise<servicesAddress>}
|
||||
**/
|
||||
Yay: function() { wails.CallByID(469445984, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Yay: function() { return wails.CallByID(469445984, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {main} from './models';
|
||||
/**
|
||||
* @typedef {import('./models').main.Person} mainPerson
|
||||
*/
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
@@ -14,7 +17,7 @@ window.go.main = {
|
||||
* @param _in {number[]}
|
||||
* @returns {Promise<void>}
|
||||
**/
|
||||
ArrayInt: function(_in) { wails.CallByID(3862002418, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
ArrayInt: function(_in) { return wails.CallByID(3862002418, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.BoolInBoolOut
|
||||
@@ -22,7 +25,7 @@ window.go.main = {
|
||||
* @param _in {boolean}
|
||||
* @returns {Promise<boolean>}
|
||||
**/
|
||||
BoolInBoolOut: function(_in) { wails.CallByID(2424639793, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
BoolInBoolOut: function(_in) { return wails.CallByID(2424639793, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Float32InFloat32Out
|
||||
@@ -30,7 +33,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
Float32InFloat32Out: function(_in) { wails.CallByID(3132595881, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Float32InFloat32Out: function(_in) { return wails.CallByID(3132595881, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Float64InFloat64Out
|
||||
@@ -38,7 +41,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
Float64InFloat64Out: function(_in) { wails.CallByID(2182412247, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Float64InFloat64Out: function(_in) { return wails.CallByID(2182412247, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Greet
|
||||
@@ -46,7 +49,7 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Int16InIntOut
|
||||
@@ -54,7 +57,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
Int16InIntOut: function(_in) { wails.CallByID(3306292566, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Int16InIntOut: function(_in) { return wails.CallByID(3306292566, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Int16PointerInAndOutput
|
||||
@@ -62,7 +65,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
Int16PointerInAndOutput: function(_in) { wails.CallByID(1754277916, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Int16PointerInAndOutput: function(_in) { return wails.CallByID(1754277916, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Int32InIntOut
|
||||
@@ -70,7 +73,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
Int32InIntOut: function(_in) { wails.CallByID(1909469092, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Int32InIntOut: function(_in) { return wails.CallByID(1909469092, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Int32PointerInAndOutput
|
||||
@@ -78,7 +81,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
Int32PointerInAndOutput: function(_in) { wails.CallByID(4251088558, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Int32PointerInAndOutput: function(_in) { return wails.CallByID(4251088558, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Int64InIntOut
|
||||
@@ -86,7 +89,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
Int64InIntOut: function(_in) { wails.CallByID(1343888303, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Int64InIntOut: function(_in) { return wails.CallByID(1343888303, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Int64PointerInAndOutput
|
||||
@@ -94,7 +97,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
Int64PointerInAndOutput: function(_in) { wails.CallByID(2205561041, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Int64PointerInAndOutput: function(_in) { return wails.CallByID(2205561041, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Int8InIntOut
|
||||
@@ -102,7 +105,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
Int8InIntOut: function(_in) { wails.CallByID(572240879, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Int8InIntOut: function(_in) { return wails.CallByID(572240879, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.Int8PointerInAndOutput
|
||||
@@ -110,7 +113,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
Int8PointerInAndOutput: function(_in) { wails.CallByID(2189402897, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Int8PointerInAndOutput: function(_in) { return wails.CallByID(2189402897, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.IntInIntOut
|
||||
@@ -118,7 +121,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
IntInIntOut: function(_in) { wails.CallByID(642881729, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
IntInIntOut: function(_in) { return wails.CallByID(642881729, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.IntPointerInAndOutput
|
||||
@@ -126,7 +129,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
IntPointerInAndOutput: function(_in) { wails.CallByID(1066151743, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
IntPointerInAndOutput: function(_in) { return wails.CallByID(1066151743, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.IntPointerInputNamedOutputs
|
||||
@@ -134,7 +137,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null, void>}
|
||||
**/
|
||||
IntPointerInputNamedOutputs: function(_in) { wails.CallByID(2718999663, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
IntPointerInputNamedOutputs: function(_in) { return wails.CallByID(2718999663, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.MapIntInt
|
||||
@@ -142,7 +145,7 @@ window.go.main = {
|
||||
* @param _in {map}
|
||||
* @returns {Promise<void>}
|
||||
**/
|
||||
MapIntInt: function(_in) { wails.CallByID(2386486356, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
MapIntInt: function(_in) { return wails.CallByID(2386486356, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.MapIntPointerInt
|
||||
@@ -150,7 +153,7 @@ window.go.main = {
|
||||
* @param _in {map}
|
||||
* @returns {Promise<void>}
|
||||
**/
|
||||
MapIntPointerInt: function(_in) { wails.CallByID(550413585, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
MapIntPointerInt: function(_in) { return wails.CallByID(550413585, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.MapIntSliceInt
|
||||
@@ -158,7 +161,7 @@ window.go.main = {
|
||||
* @param _in {map}
|
||||
* @returns {Promise<void>}
|
||||
**/
|
||||
MapIntSliceInt: function(_in) { wails.CallByID(2900172572, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
MapIntSliceInt: function(_in) { return wails.CallByID(2900172572, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.MapIntSliceIntInMapIntSliceIntOut
|
||||
@@ -166,7 +169,7 @@ window.go.main = {
|
||||
* @param _in {map}
|
||||
* @returns {Promise<map>}
|
||||
**/
|
||||
MapIntSliceIntInMapIntSliceIntOut: function(_in) { wails.CallByID(881980169, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
MapIntSliceIntInMapIntSliceIntOut: function(_in) { return wails.CallByID(881980169, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.NoInputsStringOut
|
||||
@@ -174,7 +177,7 @@ window.go.main = {
|
||||
*
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
NoInputsStringOut: function() { wails.CallByID(1075577233, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
NoInputsStringOut: function() { return wails.CallByID(1075577233, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.PointerBoolInBoolOut
|
||||
@@ -182,7 +185,7 @@ window.go.main = {
|
||||
* @param _in {boolean | null}
|
||||
* @returns {Promise<boolean | null>}
|
||||
**/
|
||||
PointerBoolInBoolOut: function(_in) { wails.CallByID(3589606958, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
PointerBoolInBoolOut: function(_in) { return wails.CallByID(3589606958, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.PointerFloat32InFloat32Out
|
||||
@@ -190,7 +193,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
PointerFloat32InFloat32Out: function(_in) { wails.CallByID(224675106, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
PointerFloat32InFloat32Out: function(_in) { return wails.CallByID(224675106, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.PointerFloat64InFloat64Out
|
||||
@@ -198,7 +201,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
PointerFloat64InFloat64Out: function(_in) { wails.CallByID(2124953624, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
PointerFloat64InFloat64Out: function(_in) { return wails.CallByID(2124953624, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.PointerMapIntInt
|
||||
@@ -206,7 +209,7 @@ window.go.main = {
|
||||
* @param _in {map | null}
|
||||
* @returns {Promise<void>}
|
||||
**/
|
||||
PointerMapIntInt: function(_in) { wails.CallByID(3516977899, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
PointerMapIntInt: function(_in) { return wails.CallByID(3516977899, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.PointerStringInStringOut
|
||||
@@ -214,7 +217,7 @@ window.go.main = {
|
||||
* @param _in {string | null}
|
||||
* @returns {Promise<string | null>}
|
||||
**/
|
||||
PointerStringInStringOut: function(_in) { wails.CallByID(229603958, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
PointerStringInStringOut: function(_in) { return wails.CallByID(229603958, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.StringArrayInputNamedOutput
|
||||
@@ -222,7 +225,7 @@ window.go.main = {
|
||||
* @param _in {string[]}
|
||||
* @returns {Promise<string[]>}
|
||||
**/
|
||||
StringArrayInputNamedOutput: function(_in) { wails.CallByID(3678582682, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
StringArrayInputNamedOutput: function(_in) { return wails.CallByID(3678582682, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.StringArrayInputNamedOutputs
|
||||
@@ -230,7 +233,7 @@ window.go.main = {
|
||||
* @param _in {string[]}
|
||||
* @returns {Promise<string[], void>}
|
||||
**/
|
||||
StringArrayInputNamedOutputs: function(_in) { wails.CallByID(319259595, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
StringArrayInputNamedOutputs: function(_in) { return wails.CallByID(319259595, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.StringArrayInputStringArrayOut
|
||||
@@ -238,7 +241,7 @@ window.go.main = {
|
||||
* @param _in {string[]}
|
||||
* @returns {Promise<string[]>}
|
||||
**/
|
||||
StringArrayInputStringArrayOut: function(_in) { wails.CallByID(383995060, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
StringArrayInputStringArrayOut: function(_in) { return wails.CallByID(383995060, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.StringArrayInputStringOut
|
||||
@@ -246,31 +249,31 @@ window.go.main = {
|
||||
* @param _in {string[]}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
StringArrayInputStringOut: function(_in) { wails.CallByID(1091960237, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
StringArrayInputStringOut: function(_in) { return wails.CallByID(1091960237, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.StructInputStructOutput
|
||||
*
|
||||
* @param _in {main.Person}
|
||||
* @returns {Promise<main.Person>}
|
||||
* @param _in {mainPerson}
|
||||
* @returns {Promise<mainPerson>}
|
||||
**/
|
||||
StructInputStructOutput: function(_in) { wails.CallByID(3835643147, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
StructInputStructOutput: function(_in) { return wails.CallByID(3835643147, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.StructPointerInputErrorOutput
|
||||
*
|
||||
* @param _in {main.Person | null}
|
||||
* @param _in {mainPerson | null}
|
||||
* @returns {Promise<void>}
|
||||
**/
|
||||
StructPointerInputErrorOutput: function(_in) { wails.CallByID(2447692557, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
StructPointerInputErrorOutput: function(_in) { return wails.CallByID(2447692557, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.StructPointerInputStructPointerOutput
|
||||
*
|
||||
* @param _in {main.Person | null}
|
||||
* @returns {Promise<main.Person | null>}
|
||||
* @param _in {mainPerson | null}
|
||||
* @returns {Promise<mainPerson>}
|
||||
**/
|
||||
StructPointerInputStructPointerOutput: function(_in) { wails.CallByID(2943477349, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
StructPointerInputStructPointerOutput: function(_in) { return wails.CallByID(2943477349, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UInt16InUIntOut
|
||||
@@ -278,7 +281,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
UInt16InUIntOut: function(_in) { wails.CallByID(3401034892, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UInt16InUIntOut: function(_in) { return wails.CallByID(3401034892, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UInt16PointerInAndOutput
|
||||
@@ -286,7 +289,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
UInt16PointerInAndOutput: function(_in) { wails.CallByID(1236957573, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UInt16PointerInAndOutput: function(_in) { return wails.CallByID(1236957573, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UInt32InUIntOut
|
||||
@@ -294,7 +297,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
UInt32InUIntOut: function(_in) { wails.CallByID(1160383782, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UInt32InUIntOut: function(_in) { return wails.CallByID(1160383782, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UInt32PointerInAndOutput
|
||||
@@ -302,7 +305,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
UInt32PointerInAndOutput: function(_in) { wails.CallByID(1739300671, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UInt32PointerInAndOutput: function(_in) { return wails.CallByID(1739300671, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UInt64InUIntOut
|
||||
@@ -310,7 +313,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
UInt64InUIntOut: function(_in) { wails.CallByID(793803239, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UInt64InUIntOut: function(_in) { return wails.CallByID(793803239, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UInt64PointerInAndOutput
|
||||
@@ -318,7 +321,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
UInt64PointerInAndOutput: function(_in) { wails.CallByID(1403757716, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UInt64PointerInAndOutput: function(_in) { return wails.CallByID(1403757716, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UInt8InUIntOut
|
||||
@@ -326,7 +329,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
UInt8InUIntOut: function(_in) { wails.CallByID(2988345717, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UInt8InUIntOut: function(_in) { return wails.CallByID(2988345717, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UInt8PointerInAndOutput
|
||||
@@ -334,7 +337,7 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
UInt8PointerInAndOutput: function(_in) { wails.CallByID(518250834, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UInt8PointerInAndOutput: function(_in) { return wails.CallByID(518250834, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UIntInUIntOut
|
||||
@@ -342,7 +345,7 @@ window.go.main = {
|
||||
* @param _in {number}
|
||||
* @returns {Promise<number>}
|
||||
**/
|
||||
UIntInUIntOut: function(_in) { wails.CallByID(2836661285, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UIntInUIntOut: function(_in) { return wails.CallByID(2836661285, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.UIntPointerInAndOutput
|
||||
@@ -350,7 +353,6 @@ window.go.main = {
|
||||
* @param _in {number | null}
|
||||
* @returns {Promise<number | null>}
|
||||
**/
|
||||
UIntPointerInAndOutput: function(_in) { wails.CallByID(1367187362, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
UIntPointerInAndOutput: function(_in) { return wails.CallByID(1367187362, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,6 +13,6 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
+7
-5
@@ -2,7 +2,10 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {main} from './models';
|
||||
/**
|
||||
* @typedef {import('./models').main.Person} mainPerson
|
||||
*/
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
@@ -14,15 +17,14 @@ window.go.main = {
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.NewPerson
|
||||
* NewPerson creates a new person
|
||||
* @param name {string}
|
||||
* @returns {Promise<main.Person | null>}
|
||||
* @returns {Promise<mainPerson>}
|
||||
**/
|
||||
NewPerson: function(name) { wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
NewPerson: function(name) { return wails.CallByID(1661412647, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+6
-4
@@ -2,7 +2,10 @@
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import {services} from './models';
|
||||
/**
|
||||
* @typedef {import('./models').services.Address} servicesAddress
|
||||
*/
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.services = {
|
||||
@@ -12,9 +15,8 @@ window.go.services = {
|
||||
* OtherService.Yay
|
||||
*
|
||||
*
|
||||
* @returns {Promise<services.Address | null>}
|
||||
* @returns {Promise<servicesAddress>}
|
||||
**/
|
||||
Yay: function() { wails.CallByID(302702907, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
Yay: function() { return wails.CallByID(302702907, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
APP_NAME: "test"
|
||||
|
||||
tasks:
|
||||
|
||||
pre-build:
|
||||
summary: Pre-build hooks
|
||||
|
||||
post-build:
|
||||
summary: Post-build hooks
|
||||
|
||||
install-frontend-deps:
|
||||
summary: Install frontend dependencies
|
||||
dir: frontend
|
||||
sources:
|
||||
- package.json
|
||||
- package-lock.json
|
||||
generates:
|
||||
- node_modules/*
|
||||
preconditions:
|
||||
- sh: npm version
|
||||
msg: "Looks like npm isn't installed. Npm is part of the Node installer: https://nodejs.org/en/download/"
|
||||
cmds:
|
||||
- npm install
|
||||
|
||||
build-frontend:
|
||||
summary: Build the frontend project
|
||||
dir: frontend
|
||||
deps:
|
||||
- install-frontend-deps
|
||||
cmds:
|
||||
- npm run build
|
||||
|
||||
build:darwin:
|
||||
summary: Builds the application
|
||||
platforms:
|
||||
- darwin
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- task: build-frontend
|
||||
- go build -gcflags=all="-N -l" -o bin/testapp
|
||||
- task: post-build
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
|
||||
build:windows:
|
||||
summary: Builds the application for Windows
|
||||
platforms:
|
||||
- windows
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- task: build-frontend
|
||||
- go build -gcflags=all="-N -l" -o bin/testapp.exe
|
||||
- task: post-build
|
||||
|
||||
build:
|
||||
summary: Builds the application
|
||||
cmds:
|
||||
- task: build:darwin
|
||||
- task: build:windows
|
||||
|
||||
generate-icons:
|
||||
summary: Generates Windows `.ico` and Mac `.icns` files from an image
|
||||
dir: build
|
||||
cmds:
|
||||
# Generates both .ico and .icns files
|
||||
- wails generate icons -input appicon.png
|
||||
|
||||
build-app-prod-darwin:
|
||||
summary: Creates a production build of the application
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- task: build-frontend
|
||||
- GOOS=darwin GOARCH={{.ARCH}} go build -tags production -ldflags="-w -s" -o build/bin/{{.APP_NAME}}
|
||||
- task: post-build
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
vars:
|
||||
ARCH: $GOARCH
|
||||
|
||||
|
||||
create-app-bundle:
|
||||
summary: Builds a `.app` bundle
|
||||
cmds:
|
||||
- mkdir -p {{.APP_NAME}}.app/Contents/{MacOS,Resources}
|
||||
- cp build/icons.icns {{.APP_NAME}}.app/Contents/Resources
|
||||
- cp build/bin/{{.APP_NAME}} {{.APP_NAME}}.app/Contents/MacOS
|
||||
- cp build/Info.plist {{.APP_NAME}}.app/Contents
|
||||
|
||||
package-darwin-arm64:
|
||||
summary: Packages a production build of the application into a `.app` bundle
|
||||
platform: darwin
|
||||
deps:
|
||||
- task: build-app-prod-darwin
|
||||
vars:
|
||||
ARCH: arm64
|
||||
- generate-icons
|
||||
cmds:
|
||||
- task: create-app-bundle
|
||||
|
||||
generate:syso:
|
||||
dir: build
|
||||
platform: windows
|
||||
cmds:
|
||||
- wails generate syso -arch {{.ARCH}} -icon icon.ico -manifest wails.exe.manifest -info info.json -out ../wails.syso
|
||||
vars:
|
||||
ARCH: $GOARCH
|
||||
|
||||
package:windows:
|
||||
summary: Packages a production build of the application into a `.exe` bundle
|
||||
platform: windows
|
||||
deps:
|
||||
- generate-icons
|
||||
cmds:
|
||||
- task: generate:syso
|
||||
vars:
|
||||
ARCH: amd64
|
||||
- go build -tags production -ldflags="-w -s -H windowsgui" -o bin/{{.APP_NAME}}.exe
|
||||
- powershell Remove-item wails.syso
|
||||
@@ -0,0 +1,32 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>My Product Name</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>test</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.test</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>This is a comment</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icons</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) 2023 My Company Name</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsLocalNetworking</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>My Product Name</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>test</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.test</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>This is a comment</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icons</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) 2023 My Company Name</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
Binary file not shown.
@@ -0,0 +1 @@
|
||||
# Wails + Svelte
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user