jlaamanen / flayer Goto Github PK
View Code? Open in Web Editor NEWExpose your backend functions to be directly called by your frontend
License: MIT License
Expose your backend functions to be directly called by your frontend
License: MIT License
Resolving even the most simple functions take 10-20 seconds to generate. Also the generation is blocking the server from responding to other requests.
Find out the worst bottleneck(s) in type resolver and try to fix them somehow.
Support callback functions on invocations or invocation results.
Basis for the support is already there, but should still be implemented:
callback
messages for the functions in functionMap
When installing Flayer to the SvelteKit starter and running package generation in hooks.server.ts
, the client package generation errors out, because it doesn't correctly determine the function locations. This is because func-loc
relies on Node.js's Inspector, and when starting a session, Debugger.scriptParsed
event returns a weird URL under the root. For example:
# Determined function path:
/src/modules/test.ts
# What it actually should look like (using Mac path as an example):
/Users/me/projects/sveltekit-flayer-project/src/modules/test.ts
Try if there is a nice way to add runtime schema validation e.g. via Zod.
The "type set" doesn't seem to merge duplicate TS types in more complicated examples - the same type/interface may exist in the set multiple times, causing an error.
Build caching doesn't work when users who don't have proper rights open a PR. Caching uses GitHub packages for now, because Docker buildx caching only for local images doesn't work.
A couple of alternatives:
On the server side, it'd be nice to have visuals for the available modules & functions. Maybe this should be made optional/configurable?
Maybe something like this (although the package root name would only be known in generatePackage
?):
Flayer started on port 1234
Modules:
๐ฆ "server-pkg/hello"
โโ ๐ข getStuff
โโ ๐ข getSomethingElse
โโ ๐ข setSomething
๐ฆ "server-pkg/hello/subModule"
โโ ๐ข getFoobar
Also some better logging for generating the client package would be nice, with some coloring
Client packages generated in 12345 ms to <path>
Add more sections to the readme, e.g.
getSession
, setSession
, destroySession
secret
)It seems to be bit of a chore to always have to include the auto-generated package along with the other source code that it's based on. It is possible to .gitignore
the server-pkg directory now, but you'd need to generate the package locally whenever you clone a project, and if the package didn't exist, you couldn't run npm install
on the client-side because of the missing dependency.
Maybe it should be recommended to add a separate script for generating the package, and executing it on postinstall
on the server-side package.json
?
Add full SvelteKit support and write an example.
One caveat of Flayer is that it cannot take advantage of HTTP request caching, because all messaging happens via WebSocket. There should probably be some kind of configurable cache control on the client side package.
Before releasing 0.1.0, it would be very useful to have E2E tests for all examples to more easily catch regressions.
npm link
docker compose up -d --wait
)Handle errors of two levels:
On user errors, it's possible to access the original error class name via error.constructor.name
, but is it of any use? I doubt you could easily make it work with instanceof
checks on the frontend side, unless all the error types are included in the codegen...
Internal Flayer errors should use the FlayerError
class, so it'd be easier for users to handle them differently with instanceof
List all exposed functions either somehow from the generated client-side package, or its own "catalog"
message type.
It would be very useful to get the list of all available functions (along with all the typings & JSDoc) especially for the dev tools extension (#5) for trying out individual functions as easily as possible.
Could it be a security threat to list all the functions? They are visible in the generated client-side package anyway. All the admin functions would also be visible, as there isn't a way to exclude them.
It would be nice to be able to track function invocations and callbacks with a dedicated dev tool. All the data is accessible in the network tab already under "WS" filter, so this should be possible.
Requires a hefty amount of UX design and work.
There are some problems when trying to make a server use a client package created by Flayer. The client package is ESM which shouldn't be a huge problem, but there also seemed to be some other problems.
Current implementation bundles all resolved types into one file without namespacing, making it impossible to have multiple different types with similar names. The types should somehow be namespaced, or maybe somehow inlined to make this work.
Seems like a marginal use case, but there quite possibly are viable use cases where different types share the same name, and it's confusing to the users that this wouldn't work.
Not to be confused with the bug #3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.