Skip to content

Commit

Permalink
feat: add generator plugin for endpoints returning signals (#2639)
Browse files Browse the repository at this point in the history
* feat: add generator plugin for endpoints returning signals

The generator-plugin-signals enables the generator
to transform implementation of generated endpoints
containing methods that return a signal instances in
a way to create and return the correct signal instance
instead of Promise.

The added plugin ensures that an endpoint containing
a mixture of methods returning signal instances and
other supported types has correct implementation for
each method. It also ensures the implementation of
endpoints without any methods returning a signal
remains unchanged.

Fixes #2628
  • Loading branch information
taefi authored Aug 7, 2024
1 parent bbdc4ad commit 2a523c5
Show file tree
Hide file tree
Showing 57 changed files with 4,074 additions and 2,147 deletions.
1,054 changes: 584 additions & 470 deletions package-lock.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ static class PluginsProcessor extends ConfigList.Processor<Plugin> {
new Plugin("@vaadin/hilla-generator-plugin-barrel"),
new Plugin("@vaadin/hilla-generator-plugin-model"),
new Plugin("@vaadin/hilla-generator-plugin-push"),
new Plugin("@vaadin/hilla-generator-plugin-signals"),
new Plugin("@vaadin/hilla-generator-plugin-subtypes"));

PluginsProcessor() {
Expand Down
68 changes: 68 additions & 0 deletions packages/java/tests/csrf-context/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion packages/java/tests/csrf-context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@vaadin/hilla-generator-plugin-client": "file:../../../ts/generator-plugin-client",
"@vaadin/hilla-generator-plugin-model": "file:../../../ts/generator-plugin-model",
"@vaadin/hilla-generator-plugin-push": "file:../../../ts/generator-plugin-push",
"@vaadin/hilla-generator-plugin-signals": "file:../../../ts/generator-plugin-signals",
"@vaadin/hilla-generator-plugin-subtypes": "file:../../../ts/generator-plugin-subtypes",
"@vaadin/hilla-generator-utils": "file:../../../ts/generator-utils",
"@vitejs/plugin-react": "4.3.1",
Expand Down Expand Up @@ -73,6 +74,7 @@
"@vaadin/hilla-generator-plugin-client": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-model": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-push": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-signals": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-subtypes": "24.5.0-alpha5",
"@vaadin/hilla-generator-utils": "24.5.0-alpha5",
"@vitejs/plugin-react": "4.3.1",
Expand All @@ -89,7 +91,7 @@
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
},
"hash": "4e5197eb924bb53e5f53c7083cb6a2e68cb30a8855d3318faa307e06fd268d04"
"hash": "51b8d36251c1be71e3520cccf3ae9507a253839d0ed5f85a7be39600062c8b0d"
},
"overrides": {
"@vaadin/common-frontend": "$@vaadin/common-frontend",
Expand All @@ -104,6 +106,7 @@
"@vaadin/hilla-generator-plugin-client": "$@vaadin/hilla-generator-plugin-client",
"@vaadin/hilla-generator-plugin-model": "$@vaadin/hilla-generator-plugin-model",
"@vaadin/hilla-generator-plugin-push": "$@vaadin/hilla-generator-plugin-push",
"@vaadin/hilla-generator-plugin-signals": "$@vaadin/hilla-generator-plugin-signals",
"@vaadin/hilla-generator-utils": "$@vaadin/hilla-generator-utils",
"@vaadin/router": "$@vaadin/router",
"@vaadin/hilla-lit-form": "$@vaadin/hilla-lit-form",
Expand Down
68 changes: 68 additions & 0 deletions packages/java/tests/csrf/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion packages/java/tests/csrf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@vaadin/hilla-generator-plugin-client": "file:../../../ts/generator-plugin-client",
"@vaadin/hilla-generator-plugin-model": "file:../../../ts/generator-plugin-model",
"@vaadin/hilla-generator-plugin-push": "file:../../../ts/generator-plugin-push",
"@vaadin/hilla-generator-plugin-signals": "file:../../../ts/generator-plugin-signals",
"@vaadin/hilla-generator-plugin-subtypes": "file:../../../ts/generator-plugin-subtypes",
"@vaadin/hilla-generator-utils": "file:../../../ts/generator-utils",
"@vitejs/plugin-react": "4.3.1",
Expand Down Expand Up @@ -73,6 +74,7 @@
"@vaadin/hilla-generator-plugin-client": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-model": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-push": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-signals": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-subtypes": "24.5.0-alpha5",
"@vaadin/hilla-generator-utils": "24.5.0-alpha5",
"@vitejs/plugin-react": "4.3.1",
Expand All @@ -89,7 +91,7 @@
"workbox-core": "7.1.0",
"workbox-precaching": "7.1.0"
},
"hash": "4e5197eb924bb53e5f53c7083cb6a2e68cb30a8855d3318faa307e06fd268d04"
"hash": "51b8d36251c1be71e3520cccf3ae9507a253839d0ed5f85a7be39600062c8b0d"
},
"overrides": {
"@vaadin/common-frontend": "$@vaadin/common-frontend",
Expand All @@ -105,6 +107,7 @@
"@vaadin/hilla-generator-plugin-client": "$@vaadin/hilla-generator-plugin-client",
"@vaadin/hilla-generator-plugin-model": "$@vaadin/hilla-generator-plugin-model",
"@vaadin/hilla-generator-plugin-push": "$@vaadin/hilla-generator-plugin-push",
"@vaadin/hilla-generator-plugin-signals": "$@vaadin/hilla-generator-plugin-signals",
"@vaadin/hilla-generator-utils": "$@vaadin/hilla-generator-utils",
"@vaadin/hilla-lit-form": "$@vaadin/hilla-lit-form",
"@vaadin/icon": "$@vaadin/icon",
Expand Down
3 changes: 3 additions & 0 deletions packages/java/tests/gradle/single-module-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@vaadin/hilla-generator-plugin-client": "file:../../../../ts/generator-plugin-client",
"@vaadin/hilla-generator-plugin-model": "file:../../../../ts/generator-plugin-model",
"@vaadin/hilla-generator-plugin-push": "file:../../../../ts/generator-plugin-push",
"@vaadin/hilla-generator-plugin-signals": "file:../../../../ts/generator-plugin-signals",
"@vaadin/hilla-generator-plugin-subtypes": "file:../../../../ts/generator-plugin-subtypes",
"@vaadin/hilla-generator-utils": "file:../../../../ts/generator-utils",
"@vitejs/plugin-react": "4.2.1",
Expand Down Expand Up @@ -71,6 +72,7 @@
"@vaadin/hilla-generator-plugin-model": "$@vaadin/hilla-generator-plugin-model",
"@vaadin/hilla-generator-plugin-barrel": "$@vaadin/hilla-generator-plugin-barrel",
"@vaadin/hilla-generator-plugin-push": "$@vaadin/hilla-generator-plugin-push",
"@vaadin/hilla-generator-plugin-signals": "$@vaadin/hilla-generator-plugin-signals",
"@vaadin/hilla-generator-core": "$@vaadin/hilla-generator-core",
"@vaadin/hilla-generator-plugin-client": "$@vaadin/hilla-generator-plugin-client",
"@vaadin/hilla-generator-utils": "$@vaadin/hilla-generator-utils",
Expand All @@ -93,6 +95,7 @@
"@vaadin/hilla-generator-plugin-client": "24.4.0-alpha5",
"@vaadin/hilla-generator-plugin-model": "24.4.0-alpha5",
"@vaadin/hilla-generator-plugin-push": "24.4.0-alpha5",
"@vaadin/hilla-generator-plugin-signals": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.0-alpha5",
"@vaadin/hilla-generator-utils": "24.4.0-alpha5",
"@vaadin/hilla-lit-form": "24.4.0-alpha5",
Expand Down
3 changes: 3 additions & 0 deletions packages/java/tests/gradle/single-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@vaadin/hilla-generator-plugin-client": "file:../../../../ts/generator-plugin-client",
"@vaadin/hilla-generator-plugin-model": "file:../../../../ts/generator-plugin-model",
"@vaadin/hilla-generator-plugin-push": "file:../../../../ts/generator-plugin-push",
"@vaadin/hilla-generator-plugin-signals": "file:../../../../ts/generator-plugin-signals",
"@vaadin/hilla-generator-plugin-subtypes": "file:../../../../ts/generator-plugin-subtypes",
"@vaadin/hilla-generator-utils": "file:../../../../ts/generator-utils",
"@vitejs/plugin-react": "4.2.1",
Expand Down Expand Up @@ -64,6 +65,7 @@
"@vaadin/hilla-generator-plugin-model": "$@vaadin/hilla-generator-plugin-model",
"@vaadin/hilla-generator-plugin-barrel": "$@vaadin/hilla-generator-plugin-barrel",
"@vaadin/hilla-generator-plugin-push": "$@vaadin/hilla-generator-plugin-push",
"@vaadin/hilla-generator-plugin-signals": "$@vaadin/hilla-generator-plugin-signals",
"@vaadin/hilla-generator-core": "$@vaadin/hilla-generator-core",
"@vaadin/hilla-generator-plugin-client": "$@vaadin/hilla-generator-plugin-client",
"@vaadin/hilla-generator-utils": "$@vaadin/hilla-generator-utils",
Expand Down Expand Up @@ -91,6 +93,7 @@
"@vaadin/hilla-generator-plugin-client": "24.4.0-alpha7",
"@vaadin/hilla-generator-plugin-model": "24.4.0-alpha7",
"@vaadin/hilla-generator-plugin-push": "24.4.0-alpha7",
"@vaadin/hilla-generator-plugin-signals": "24.5.0-alpha5",
"@vaadin/hilla-generator-plugin-subtypes": "24.4.0-alpha7",
"@vaadin/hilla-generator-utils": "24.4.0-alpha7",
"@vaadin/hilla-lit-form": "24.4.0-alpha7",
Expand Down
Loading

0 comments on commit 2a523c5

Please sign in to comment.