5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 09:00:38 +08:00
Commit Graph

31 Commits

Author SHA1 Message Date
Jeremy Jay
c4fdfd6415
Fix miscellaneous bindings and typescript export bugs (#3978)
* Do not attempt to export fields that cannot be json-encoded

* update changelog w/ PR

* also skip UnsafePointers

* WIP to allow conversion from Go generic types to typescript

* support for non-primitive generics also :)

* fix generic types in parameters / return args

* fixes a namespacing bug when mapping to pointer to struct

* fixing invalid knownstructs

* found a place it mattered, pushing the star replacement to the generate side

* descend as much as necessary to find structs

caught these examples in http.Request.TLS:

PeerCertificates []*x509.Certificate
VerifiedChains [][]*x509.Certificate

* accidently reverted other fix

* switch syntax for typescript record outputs

prior syntax is primarily useful for naming keys
so not useful here, and this syntax avoids square
brackets in output which greatly simplifies
generation for Go generics

* better handle edge cases for nested arrays and slices

* lots o tests

* update changelog

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2025-01-13 20:14:54 +11:00
Jeremy Jay
7566ed4ba6
Do not attempt to export fields that cannot be json-encoded (#3975)
Some checks are pending
Build + Test v2 / Test Templates (1.22, ubuntu-22.04, vanilla-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-22.04, vue) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-22.04, vue-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, lit) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, lit-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, plain) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, preact) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, preact-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, react) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, react-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, svelte) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, svelte-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, vanilla) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, vanilla-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, vue) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, ubuntu-24.04, vue-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, lit) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, lit-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, plain) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, preact) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, preact-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, react) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, react-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, svelte) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, svelte-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, vanilla) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, vanilla-ts) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, vue) (push) Blocked by required conditions
Build + Test v2 / Test Templates (1.22, windows-latest, vue-ts) (push) Blocked by required conditions
Upload Source Documents / Push files to Crowdin (push) Waiting to run
* Do not attempt to export fields that cannot be json-encoded

* update changelog w/ PR

* also skip UnsafePointers

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2025-01-10 15:11:13 +11:00
Jeremy Jay
fe1f23b0fd
If a field is exported, generate json even in the absence of tags (#3678)
* if no JSON tag, check if field is exported

* add no-tags binding test case

* update changelog for #3678
2024-08-14 07:49:08 +10:00
Andrey Pshenkin
b9de31e38e
Add support for interface generation and enums (#3047)
* Add support to output ts models as interfaces

* Add support to generate enums from golang

* cleanup logs

* add missing documentation

* fix package names for enum. Fix processing enums that are in separate packages

* revert golang 1.21

* Fix spelling

* Add support for simplified version of Enum for typescriptify

* update docs

* removed unused logs

* Add tests. Fix imported enums types in models

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2023-11-26 06:50:49 +11:00
Lea Anthony
9ce0ddb4f8 [chore] lint fixes 2023-11-12 12:30:49 +11:00
Oleg Gulevskyy
ca8a1fab36
Ability to define prefix / suffix for TS module (#2101)
* add tspostfix and tsprefix flags + organise under struct

* postifx -> suffix

* tsPrefix options on bindings struct

* pass prefix and suffix to the executable

* add support for CLI flags for generating module

* method to set TSpref/suff to bindings

* use passed ts prefix for typescriptify

* add brief Readme udpate to include new flags

* create reusable common flags

* use common flags instead of hardcoded text

* support tsprefix & suffix for dev

* add tsPrefix & tsSuffix for build cmd

* take pref & suff in account when gen d.ts

* export colorsful log functions into utils for reuse

* detect and warn the user about usage of reserved keyword

* fmt

* add TrimSpace on fn input

* refactor utils -> logutils

* add bindings -> ts_generation options to wailsjson parse

* use wailsjson for ts generation

* update warning message + extract to func

* remove suff/pref info from readme

* update json schema

* add tests for prefix and suffix case

* rename suffix method

* Update v2/internal/typescriptify/typescriptify.go

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>

* Update website/static/schemas/config.v2.json

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>

* Update website/static/schemas/config.v2.json

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>

* update changelog

* Minor tweaks

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-11-24 21:33:58 +11:00
ParkourLiu
dc65f77baf
repair panic (#1999)
* repair panic

* Add empty struct field test

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-22 21:04:49 +11:00
Lea Anthony
2d4f7f4de8
Sort structs in models.ts. Fixes #1958 (#1961) 2022-10-14 07:50:22 +11:00
Lea Anthony
6a3b89d212
fix: exemption typo 2022-10-01 19:03:20 +10:00
JulioDRF
40e326a708
Fix binding generation special cases (#1902)
* Make binding.go easier to test

* Fix non-deterministic namespace order for bindings

* Add binding tests

* Fix nested import structs, non-string map keys, and escape invalid variable names

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-10-01 15:49:51 +10:00
Lea Anthony
052b9222c1
Add garble support (#1793)
Co-authored-by: AlbinoDrought <sean@albinodrought.com>
Co-authored-by: stffabi <stffabi@users.noreply.github.com>
2022-09-13 10:05:37 +10:00
Valentin Trinqué
cf3c65f0cc
Fix registration of exposed fields (#1727) 2022-08-11 08:41:37 +10:00
Lea Anthony
84b6273baf
Bugfix/incorrect bindings (#1383)
* Print struct path

* Better handling of anon structs
2022-05-05 23:07:33 +10:00
Lea Anthony
43f8a1f773 fix: blank namespaces, unknown structs 2022-04-06 19:13:10 +10:00
Lea Anthony
55855ccc4d fix: duplicate model generation 2022-04-05 21:30:55 +10:00
Lea Anthony
eb97f53124 Feature: Don't generate models.ts if there are no models. 2022-04-05 21:30:55 +10:00
Lea Anthony
625eca27f6 Feature: TS namespaces 2022-04-05 18:11:56 +10:00
Lea Anthony
bb2da2f810 Chore: remove debug output 2022-04-04 21:19:36 +10:00
Lea Anthony
6b38f0c68e
Improved TS Generation (#1310)
Improve TS Generation
2022-04-04 21:01:00 +10:00
Lea Anthony
2f2a7a567a [v2] Fix vscode output + default template 2021-09-25 14:44:23 +10:00
Lea Anthony
ac4c17ca09 [windows] Generate bindings + models 2021-08-31 19:51:43 +10:00
Lea Anthony
c5d9fd1a0d [windows-x] Generate TS models 2021-08-28 14:51:40 +10:00
Lea Anthony
a7c5064a33 [windows-x] Generate runtime wrapper in project, initial model binding, better error handling in calls, assetdir fix, 2021-08-27 21:11:03 +10:00
Lea Anthony
e6b40b55c4
Add nil guard for binding 2021-01-31 21:10:30 +11:00
Lea Anthony
c9c3c9ab90
Don't bind startup/shutdown methods 2021-01-27 21:12:17 +11:00
Lea Anthony
fe87463b78
Move Bind() into app config 2021-01-26 07:04:12 +11:00
Lea Anthony
742e4ba2cb
Remove WailsInit and WailsShutdown methodsr 2021-01-14 11:07:06 +11:00
Lea Anthony
5d41aad539
Misc lint fixes 2021-01-03 21:31:19 +11:00
Lea Anthony
53b54a8e52
Revert logger package 2020-10-09 10:33:11 +11:00
Lea Anthony
0403e0a783
Make logger a public package 2020-10-09 10:30:01 +11:00
Travis McLane
c158fd369a Merge commit 'a213e8bcd1d8e4e5c764978879d875d2d55dd400' as 'v2' 2020-09-15 19:52:54 -05:00