5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 07:43:11 +08:00
Commit Graph

52 Commits

Author SHA1 Message Date
Fabio Massaioli
37673eb24d
[v3] Fix binding generator bugs and prepare for Go 1.24 (#4045)
* Rename predicates source file

* Overhaul and document type predicates

* Fix model collection logic for named types

* Fix map key type rendering

* Fix map creation code

* Fix rendering of structs that implement marshaler interfaces

* Fix type cycle detection to take type args into account

* Fix enum and typeparam field initialisation

* Improve unsupported type warnings

* Remove internal models file

* Deduplicate template code

* Accept generic aliases in static analyser

* Support new `encoding/json` flag `omitzero`

* Handle special cases when rendering generic aliases

* Update npm test dependencies

* Test class aliases and implicit private dependencies

* Test marshaler combinations

* Test map key types

* Remove bad map keys from unrelated tests

* Test service discovery through generic aliases

* Test generic aliases

* Test warning messages

* Disable go1.24 tests

* Update changelog

* Restore rendering of injected lines in index file

* Test directives

* Add wails:ignore directive

* Fix typo

* Move injections to the bottom of service files

* Handle errors from closing files

* Do not emit messages when services define only lifecycle methods

* Add internal directive for services and models

* Update changelog

* Fix error in service templates

* Test internal directive on services/models

* Fix error in index template

* Base testdata updates

* Testdata for class aliases and implicit private dependencies

* Testdata for marshaler combinations

* Testdata for map key types

* Testdata for bad map key fixes

* Add weakly typed enums aka alias constants

* Testdata for enum and typeparam field fixes

* Testdata for generic aliases

* Testdata for warning messages

* Testdata for directives

* Testdata for weakly typed enums

* Update binding example

* Update services example

* Remove go1.24 testdata

* Update cli doc

* Fix analyser tests

* Fix windows tests... hopefully

* go mod tidy on examples

* Update bindings guide

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2025-02-09 09:44:34 +11:00
Fabio Massaioli
f01b4b9a21
[v3] Fix binding generator bugs (#4001)
* Add some clarifying comments

* Remove special handling of window parameters

* Improve internal method exclusion

* Add test for internal method exclusion

* Remove useless blank field from app options

This is a leftover from an older version of the static analyser. It should have been removed long ago.

* Remove redundant godebug setting

gotypesalias=1 is the default starting with go1.23

* Use new range for syntax to simplify code

* Remove generator dependency on github.com/samber/lo

* Ensure generator testing tasks do not use the test cache

* Rename cyclic types test

* Test for cyclic imports

* Fix import cycle between model files

* Sort class aliases after their aliased class

* Test class aliases

* Fix length of default value for array types

* Test array initialization

* Add changelog

* Update changelog

* Fix contrived marking technique in model sorting algorithm

* Update binding example

* Update test data

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2025-01-17 18:56:07 +11:00
Fabio Massaioli
939d22d670
[v3] Enforce stricter typing for generated bindings (#3498)
* Subject generator output to stricter TS linting

* Fix runtime support code typing

* Relax tsconfig for templates

* Update test data

* Update binding example
2024-05-19 23:28:45 +10:00
Fabio Massaioli
90b7ea944d
[v3] New binding generator (#3468)
* Support variadic arguments and slice, pointer types

* Fix computation of type namespaces

* Improve comments and general formatting

* Set default values correctly for composite types

* Add templates for bindings

Additionally:
* fixes generation of tuple return type
* improves imports and namespacing in JS mode
* general cleanup of generated code

* Simplify import list construction

* Refactor type generation code

Improves support for unknown types (encoded as any) and maps (using
Typescript index signatures)

* Support slices with pointer elements

* Match encoding/json behaviour in struct parser

* Update tests and example

* Add tests for complex method signatures and json tag parsing

* Add test `function_multiple_files`

* Attempt looking up idents with missing denotation

* Update test data

* fix quoted bool field

* Test quoted booleans

* Delete old parser code

* Remove old test data

* Update bindgen flags

* Makes call by ID the default

* Add package loading code

* Add static analyser

* Temporarily ignore binding generation code

* Add complex slice expressions test

* Fix variable reference analysis

* Unwrap casts to interface types

* Complete code comments

* Refactor static analyser

* Restrict options struct usage

* Update tests

* Fix method selector sink and source processing

* Improve Set API

* Add package info collector

* Rename analyser package to analyse

* Improve template functions

* Add index file templates

* Add glue code for binding generation

* Refactor collection and rendering code

* Implement binding generator

* Implement global index generation

* Improve marshaler and alias handling

* Use package path in binding calls by name

* Implement model collection and rendering

* Fix wrong exit condition in analyser

* Fix enum rendering

* Generate shortcuts for all packages.

* Implement generator tests

* Ignore non-pointer bound types

* Treat main package specially

* Compute stats

* Plug new API into generate command

* Support all named types

* Update JS runtime

* Report dual role types

* Remove go1.22 syntax

* Fix type assertion in TS bindings

* encoding/json compliance for arrays and slices

* Ignore got files in testdata

* Cleanup type rendering mechanism

* Update JS runtime

* Implement generic models

* Add missing field in renderer initialisation

* Improve generic creation code

* Add generic model test

* Add error reporting infrastructure

* Support configurable file names

* Detect file naming collisions

* Print final error report

* New shortcut file structure + collision detection

* Update test layout and data

* Autoconfiguration for analyser tests

* Live progress reporting

* Update code comments

* Fix model doc rendering

* Simplify name resolution

* Add test for out of tree types

* Fix generic creation code

* Fix potential collisions between methods and models

* Fix generic class alias rendering

* Report model discovery in debug mode

* Add interface mode for JS

* Collect interface method comments

* Add interface methods test

* Unwrap generic instantiations in method receivers

* Fix rendering of nullable types in interface mode

* Fix rendering of class aliases

* Expose promise cancel method to typescript

* Update test data

* Update binding example

* Fix rendering of aliased quoted type params

* Move to strongly typed bindings

* Implement lightweight analyser

* Update test cases

* Update binding example

* Add complex instantiation test

* Load full dependency tree

* Rewrite collector

* Update renderer to match new collector

* Update generator to match new collector

* Update test data

* Update binding example

* Configure includes and injections by language

* Improve system path resolution

* Support rich conditions in inject/include directives

* Fix error handling in Generator.Generate

* Retrieve compiled go file paths from fileset

* Do not rely on struct info in struct flattening algorithm

* Fix doc comment for findDeclaraion

* Fix bugs in embedded field handling

* Fix bugs and comments in package collection

* Remove useless fields from ServiceInfo

* Fix empty line at the beginning of TS indexes

* Remove global index and shortcuts

* Remove generation tests for individual packages

* Enforce lower-case file names

* Update test data

* Improve error reporting

* Update binding example

* Reintroduce go1.22 syntax

* Improve relative import path computation

* Improve alias support

* Add alias test

* Update test data

* Remove no services error

* Rename global analyser test

* Add workaround and test for bug in typeutil.Map

* Update test data

* Do not split fully qualified names

* Update typeutil package and remove workaround

* Unify alias/named type handling

* Fix rendering of generic named class aliases

* Fix rendering of array types

* Minor tweaks and cleanups

* Rmove namespaced export construct

* Update test data

* Update binding example

* Break type cycles

* Fix typo in comment

* Fix creation code for cyclic types

* Fix type of variadic params in interface mode

* Update test data

* Fix bad whitespace

* Refactor type assertions inside bound methods

* Update test data

* Rename field application.Options.Bind to Services

* Rename parser package to generator

* Update binding example

* Update test data

* Update generator readme

* Add typescript test harness

* Move test output to new subfolder

* Fix code generation bugs

* Use .js extensions in TS mode imports

* Update test data

* Revert default generator output dir to frontend/bindings

* Bump runtime package version

* Update templates

* Update changelog

* Improve newline handling

---------

Co-authored-by: Andreas Bichinger <andreas.bichinger@gmail.com>
2024-05-19 20:40:44 +10:00
Fabio Massaioli
45b2681dfc
[v3] Fix binding generator output and import paths (#3334)
* Fix relative import path computation

* Fix models output path

* Add option to generate bindings using bundled runtime

* Update binding example

* Fix testdata

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-22 21:18:04 +11:00
Fabio Massaioli
2b9891da2c
[v3] Update and fix runtime JS API (#3295)
* Cleanup bundled runtime entry point

* Fix JS representation of Screen struct

* Expose IsFocused method in Window interface

* Update JS window API

* Fix cleanup of WML listeners

* Bundle runtime as ES module

* Update runtime dependencies

* Update runtime types and events

* Update bundled runtime

* Update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2024-03-20 20:30:14 +11:00
Lea Anthony
b325381ca0 Normalise app/webview options
Update deps
2024-03-17 20:57:46 +11:00
Lea Anthony
bc0a9b2e52 Add BundledAssetFileServer for bundled /wails/runtime.js. Update examples. 2024-03-17 15:08:30 +11:00
Lea Anthony
161444107a Support linux systrays, of sorts... 2024-03-06 16:59:13 -06:00
stffabi
bfe9a9d015 [runtime] Add cancelation of bound method calls and context passing 2024-03-04 10:34:14 +01:00
stffabi
65251cdafa [v3, assetServer] Remove fs.FS from options and always use a http.Handler 2024-02-16 07:38:27 +01:00
stffabi
b37d0f1cf4 [windows] Improved focus handling
Make sure the webview is focused on initial show if the window
is focused and make behaviour consistent with macOS
2023-12-30 23:34:53 +01:00
Lea Anthony
371e57588f
Update bindings example 2023-12-16 20:57:00 +11:00
Travis McLane
c6ecbd56e5 [v3 examples/bindings] correct binding output + example
- disable output of `import <model> from models` line
- update README to generate bindings in usable location for HTML
- update HTML to reference bindings correctly
- update javascript to call and process the bound Greet function
2023-10-31 17:24:00 -05:00
Travis McLane
1b850662ed [v3 example/bindings] enable DevTools 2023-10-31 17:15:16 -05:00
Lea Anthony
d1c3f8af7a [darwin] Fix menu icon 2023-10-22 14:34:04 +11:00
Lea Anthony
8e0671306a
Mac examples + readme updated 2023-10-17 20:25:36 +11:00
Lea Anthony
3a23ad1382
Fix example building. Update workflow 2023-10-15 10:43:39 +11:00
Lea Anthony
4c75b288bb
Add BrowserOpenURL and BrowserOpenFile to App.
Better WML assets for demo
Fix dialog responses.
Add `wml-openurl`
Rename: data-wml -> wml
Fix Alpha Feedback URL
2023-10-11 20:23:59 +11:00
Lea Anthony
3d88bf8795
Fix context menu issues.
Fix WindowID for requests on windows.
Add `Windows.ApplicationStarted` event
2023-10-10 21:48:47 +11:00
Lea Anthony
839a9ff498
Update bindings example 2023-10-09 17:37:21 +11:00
Lea Anthony
9ffc06d42e
Update Task to v3.31.0. Update deps. 2023-10-09 10:39:09 +11:00
Travis McLane
ccccea1e50 [v3] go mod tidy 2023-10-06 15:03:36 -05:00
Lea Anthony
ce6d587771
Fix multiple window weirdness. Update deps 2023-10-05 20:54:12 +11:00
Lea Anthony
8eb62fb483
Update bindings example 2023-09-04 21:01:00 +10:00
Lea Anthony
4a62b6a5c7 Support Mac in wails doctor 2023-09-03 10:30:31 +10:00
Lea Anthony
cecbc156d5
Update deps 2023-09-01 20:14:06 +10:00
Lea Anthony
5e1f29eda3
[v3] Support //wails:methodID <uint32> directive in bound method comments. 2023-08-27 21:16:30 +10:00
Lea Anthony
e5571defb7
[v3] Support bound methodID aliases. Support []any for bindings generation. Use CallByID in bindings. 2023-08-27 20:39:35 +10:00
Lea Anthony
125d8a6f78
[v3] Update Task to v3.29.1. 2023-08-27 17:14:36 +10:00
Lea Anthony
0745aea4d6
[v3] Move to integer call ids for bound methods. 2023-08-19 14:25:36 +10:00
Lea Anthony
ee29faecbf
Log if native Go webview loader is used 2023-08-12 16:36:08 +10:00
Lea Anthony
15f602f867
Move v2 assetserver to v3 2023-08-12 14:16:53 +10:00
Lea Anthony
39af86e59d
Improve project creation.
Add `template.json` to templates.
Update dependencies.
2023-08-09 21:30:06 +10:00
Lea Anthony
c9ce17a4d5
[v3] Fix Assets options in templates 2023-07-21 08:24:38 +10:00
Travis McLane
de2e78b507 [v3 linux] purego implementation 2023-06-23 21:50:51 -05:00
Lea Anthony
4ee75e93c9
[v3] Improve examples 2023-06-06 20:41:28 +10:00
Lea Anthony
7e2d2a29a1 [v3 windows] Initial webview2 working 2023-05-30 16:33:34 +08:00
Lea Anthony
0b3559abfe [v3] Fix examples 2023-05-30 16:31:51 +08:00
Lea Anthony
773389ee5e [v3] Update examples to use correct options. 2023-05-30 16:31:51 +08:00
dependabot[bot]
e3816e714e
Bump golang.org/x/net in /v3/examples/binding (#2472)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20220722155237-a158d28d115b to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/commits/v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-09 20:07:11 +11:00
Lea Anthony
26530a0f5a Fix reserve word check.
Add model generation.
Warn if field is unexported in the Go struct
2023-03-07 19:48:30 +11:00
Lea Anthony
7340247e25 Create bindings file per package
Improved bindings tests
2023-03-07 18:22:33 +11:00
Lea Anthony
868b769e7f Initial bindings generation 2023-03-01 21:31:29 +11:00
Lea Anthony
443ea46d1d Example bindings 2023-02-27 20:05:54 +11:00
Lea Anthony
00c458f948 Implement basic binding 2023-02-26 20:49:29 +11:00
Lea Anthony
f9ffe915f2 Add bindings hook 2023-02-26 15:06:05 +11:00
Lea Anthony
93aa8345dc
[v3] Improved parser for bound structs 2023-02-17 21:01:16 +11:00
Lea Anthony
e1279a054f
[v3] Improved parser for bound structs 2023-02-17 20:57:31 +11:00
Lea Anthony
c415c1b321
Added Wails ML experiment
added Window.Close to js runtime
2023-02-15 20:58:57 +11:00