Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Participation in the new version of the system #78

Open
Hookyns opened this issue Oct 22, 2022 · 60 comments
Open

Participation in the new version of the system #78

Hookyns opened this issue Oct 22, 2022 · 60 comments
Labels
help wanted Extra attention is needed

Comments

@Hookyns
Copy link
Owner

Hookyns commented Oct 22, 2022

Sign here who wants to participate in the alpha of the new major version. I will invite you to the private project when it is ready. 🎉

@Hookyns Hookyns added the help wanted Extra attention is needed label Oct 22, 2022
@hra4h03
Copy link

hra4h03 commented Oct 25, 2022

I am excited to see the new version of this library. I am willing to participate in the alpha of the new major version.

@Hookyns Hookyns pinned this issue Oct 25, 2022
@Hookyns Hookyns changed the title Participation in Alpha Participation in v1.0.0 Alpha Oct 31, 2022
@lsarrazi
Copy link

lsarrazi commented Nov 5, 2022

Hi, I want to investigate the potential of this library and would be happy to participate

@jsternadel
Copy link

Sign me up. I've been testing doing recursive model hydration with data from the Jira API. So far it looks very promising with the exclusion of one bug with getCtor but that looks like its been flagged as fixed in v1. I'd be happy to run the alpha through my use case.

@nduc
Copy link

nduc commented Nov 22, 2022

Looking to see if I can leverage this for my Remix project. There's an issue with transmitting the class from backend to the front end via the useLoaderData(). I'm hoping to leverage this to send the meta data along so when it gets to the other side the class/object can be reconstructed.

@aj-bartocci
Copy link

I would like to be able to help with the alpha version. I was looking to use this package for generic classes which does not seem to be possible in the current version but will be in the new version (#30). My use case being to help create documentation from the actual source code to produce 'live' docs rather than manually documenting things.

@soya-miruku
Copy link

i would to be able to use alpha on this

@Hookyns
Copy link
Owner Author

Hookyns commented Jan 2, 2023

Hi guys, TY for your interest! 🎉

I'm late with the alpha, working hard on it. 🏭
I've invented new and better callsites (new way how to pass generic type arguments through project) so I'm rewriting some base stuff which results in not working project. I expect it to be ready by the end of next week.

I've already prepared website and documentation (first basic version).

Project will remain private for a while, I'll invite you into the organization and send you link to discord server, so you can get proper support and I can get some feedback I hope. 🙂

@caass
Copy link

caass commented Jan 5, 2023

Hi! I'd love to participate in the alpha :)

@Hookyns
Copy link
Owner Author

Hookyns commented Jan 16, 2023

Late (again), but it will be this week. 🎉

I'm stucked on one strange issue caused by strange conditions. I'm finally able to reproduce it. Now I have to fix it.

@nduc
Copy link

nduc commented Jan 17, 2023

I was just looking at another repo for something else and it has a link to moddle. It might be of use to this project or someone else looking to reconstruct JSON to object. In my case I needed a way to convert an object to JSON and send it across the wire. Then reconstruct the object once it arrives on the client side.
BTW, I appreciate the hard work you're putting into your project!

@Pandapip1
Copy link

I'm willing to participate

@Hookyns
Copy link
Owner Author

Hookyns commented Jan 23, 2023

I've granted you access to the organization and mentioned you in an issue.

@paluchi
Copy link

paluchi commented Jan 28, 2023

@Hookyns Please add me to the alpha!

@DSoko2
Copy link

DSoko2 commented Feb 1, 2023

Great project, thanks for your work @Hookyns! I'd love to join the alpha, too! :)

@gssplm
Copy link

gssplm commented Feb 3, 2023

First of all thx for your awesome work! You saved me hours of work! I would like to join the alpha too!

@cesaric
Copy link

cesaric commented Feb 14, 2023

Hi, I'd love to participate in the alpha!

@cedrikaagaard
Copy link

Hey! I'd also like to join the alpha :)

@chaddgrimm
Copy link

Count me in!

@nmnsnv
Copy link

nmnsnv commented Apr 7, 2023

Hi!
I would love to join and check the alpha!

@tutok
Copy link

tutok commented May 12, 2023

Hi, I really like what you are doing, looking for a similar solution for a long time, may I join too?

@jackhegarty
Copy link

Hi, I'm interested in participating as well if it's not too late!

@ppoulard
Copy link

ppoulard commented Jul 3, 2023

I was just looking at another repo for something else and it has a link to moddle. It might be of use to this project or someone else looking to reconstruct JSON to object. In my case I needed a way to convert an object to JSON and send it across the wire. Then reconstruct the object once it arrives on the client side. BTW, I appreciate the hard work you're putting into your project!

@nduc For that purpose, you may be interested in @badcafe/jsonizer : https://badcafe.github.io/jsonizer/#/README but you will have to call JSON.stringify() and JSON.parse() yourself.

I'm also working on its companion library @badcafe/asynchronizer but it is not yet released (planned for september 2023), which is an RPC lib that will let you call functions without worrying how to serialize parameters (and return values) in one side and how to deserialize them on the other side. Works with various channels : HTTP, WebSocket, Workers, nodejs clusters, etc with broadcast and multicast features, support for binary and streaming, and with nice binding to REST for the HTTP channel.

@ppoulard
Copy link

ppoulard commented Jul 3, 2023

Hi, I'm interested in participating too if possible !

@mindplay-dk
Copy link

Is this project still happening? If so, I'm also interested.

I have extensive experience with reflection in PHP and C#, if that matters - I've written DI containers in both languages, and I also wrote one of the earliest annotation libraries for PHP. Where I'm stuck with TypeScript is there seems to be no good approach to dependency injection containers without reflection - I've spent years on-and-off trying to solve this with types, I've looked at every DI container with types, and it just doesn't seem feasible. I started tinkering with deepkit.io and I don't find their reflection approach at all useful.

So yeah, quite interested in testing this. :-)

@Hookyns
Copy link
Owner Author

Hookyns commented Jul 6, 2023

Is this project still happening? If so, I'm also interested.

I have extensive experience with reflection in PHP and C#, if that matters - I've written DI containers in both languages, and I also wrote one of the earliest annotation libraries for PHP. Where I'm stuck with TypeScript is there seems to be no good approach to dependency injection containers without reflection - I've spent years on-and-off trying to solve this with types, I've looked at every DI container with types, and it just doesn't seem feasible. I started tinkering with deepkit.io and I don't find their reflection approach at all useful.

So yeah, quite interested in testing this. :-)

Sure! 🙂

DI was the main reason why I started to work on this.
Here is my implementation of DI based on this project; quite outdated, it's just prototype, because this become the main project I want to finish first to build a lot of other things that need reflection.

@mindplay-dk
Copy link

Yeah, a DI container is the main reason I want reflection too. My ideas about a DI container is quite different from the "main stream" - quite a lot of non-features. I wrote at least 5 DI containers before settling on this. 😅

@Hookyns
Copy link
Owner Author

Hookyns commented Aug 8, 2023

how did you pull that off??

As we discussed earlier, Typegen is completely standalone tool which just take .ts files as input and generate static metadata library (I call it a typelib) as output; it's not part of the build process.

It's based on alpha's transformer. I just had to create the tool and rewrite some parts, it took just about 4 weeks of work and I'm a week behind with the prototype against expectations. 🤷

It's rly just a prototype. It only generate the typelib which you can use statically (Metadata.getTypes() and Metadata.getModules()). It's not possible to use the getType<SomeType>() yet. To allow usage of getType it will require a transformer as part of the build process, but it will be super simple transformer and it can be written for every build tool (esbuild, swc, tsc); it does not require TypeChecker (well TypeChecker will give you better results for inferred types so for SWC and esbuild there is not going to be full support of inferrence).

I need at least another month to get it into alpha phase.

@mindplay-dk
Copy link

well TypeChecker will give you better results for inferred types so for SWC and esbuild there is not going to be full support of inferrence

oh, okay, I thought you were trying to say you had come up with a solution.

so it's still going to be a limited version for SWC and ESBuild.

I'm still not sure if I think this is a good idea. I mean, imagine you ship something like a DI container or router that depends on this runtime, and you're showing cool examples like router.get("/path", (req, res) => ...) and it just doesn't work with popular bundlers. It's going to be weird. Every library will need caveats in the README to explain why the examples don't actually work with the popular bundlers - hardly anyone uses tsc.

and I understand why it's the best we can do.

but I still wonder if maybe it would be possible to integrate the official TS compiler into something like Vite... I guess if all of these tools are designed to work file-by-file, it's just not going to be possible? man, that's so frustrating. 😔

@Hookyns
Copy link
Owner Author

Hookyns commented Aug 8, 2023

but I still wonder if maybe it would be possible to integrate the official TS compiler into something like Vite..

I think I have a possible solution for this too but I don't know what the performance will be. It may be even worse than switching to plain old tsc. But it's not a priority for me. I think that the planned supported features (for swc and esbuild) will be sufficient for about 50 % of use-cases which is still infinitely more than what's possible now. 🙂 And you can still say that users have to enable strict mode (noImplicitAny to be specific), then it will work without any issues.

But it will have a solution in the future thanks to Donny's STC.

EDIT:
And I still don't see any issues with the DI. I always have to specify type to tell the system what type I want.

class SomeService {
    constructor(logger: ILogger, router: Router, somethingElse: SomethingElse) {}
    orMethodInjection(something: ISomething) {}
}

with registration like (super simple & naive implementation):

import { Metadata } from "./metadata.typelib";

class ServiceCollection {
    addSingleton(serviceType: Type, serviceImplementation: Type): void {}
    addTransient(serviceType: Type, serviceImplementation: Type): void {}
}

const sc = new ServiceCollection();
const serviceImplementations = Metadata.getTypes().filter(t => t.isClass() && !t.isAbstract() && t.name.endsWith("Service"));

for (let implementation of serviceImplementations) {
    sc.addTransient(implementation.implements.find(i => i.name.endsWith("Service")) , implementation);
}

There is no need to infer anything.

@Hookyns
Copy link
Owner Author

Hookyns commented Sep 4, 2023

Here is a preview with esbuild, using the new Typegen and esbuild plugin.

Typegen is still a prototype (pre-alpha version) and the esbuild plugin is just a proof of concept, but I progress quickly.

@ruizmarc
Copy link

ruizmarc commented Oct 2, 2023

Hi! Amazing job! I would love to give a try to the alpha version :)

@samchon
Copy link

samchon commented Oct 16, 2023

Hello, I'm developer of typia, and wanna see how tst-reflect supports SWC/EsBuild

@alexzhang1030
Copy link

Great work 🙌 I also want to join the alpha channel👀

@surtr-isaz
Copy link

I'd like to participate =)

@sasa-djuric
Copy link

Hi, I'm interested in participating.

@theoludwig
Copy link

Please, I would like to test. 😄

@NedStar72
Copy link

Please, I want it too

@VasiliyIsaichkin
Copy link

Hi, I too have a very burning interest in such a thing

@NickSeagull
Copy link

Hey, thanks a lot for this project!

Sign me up for the alpha too please, if you need contributors I'm willing to contribute too 😄

@M-jerez
Copy link

M-jerez commented Feb 2, 2024

Hi @Hookyns I would be interested to participate and contribute.
Besides seems like you have a few group of brains interested some very good can come up if we all collaborate.

I'm the author of https://mion.io/

Good Job 🚀⭐️

@Hookyns
Copy link
Owner Author

Hookyns commented Feb 3, 2024

Hello guys,

I'll make the repo public soon.
Packages are on npm so you can test it. Keep in mind that it's still alpha version. It still doesn't support everything. I'm still working on Rust implementation of simple semantic analyser so functionality of getType<T>() is still limited.

You can visit rttist.org and docs.
It is still work-in-progress, but base instructions (and esbuild plugin) should work.

Post your feedback.

Here is the latest demo.

PS: I will greatly appreciate a PR to improve the docs!

@dsdavis4
Copy link

dsdavis4 commented Feb 8, 2024

Can I try out the alpha version?

@only-cliches
Copy link

Sign me up!

@VaughnVernon
Copy link

Would you please include me? Thanks!

@andreacioni
Copy link

Hi, can you please invite me?

@seo-rii
Copy link

seo-rii commented May 6, 2024

Can I also join in? Thank you!

@moodmosaic
Copy link

@Hookyns, count me in please👍

@tyler-mitchell
Copy link

Looking forward to checking out the new version 🔥

@Papipo
Copy link

Papipo commented Aug 30, 2024

Can I use this to generate Teal types from TS ones? (Writing my own generator) I so, please add me to the repo. Otherwise, if you know of any tool I can use for this task please tell me. Thanks!

@Hookyns
Copy link
Owner Author

Hookyns commented Aug 30, 2024

Can I use this to generate Teal types from TS ones? (Writing my own generator) I so, please add me to the repo. Otherwise, if you know of any tool I can use for this task please tell me. Thanks!

Hello @Papipo,
Yes, you can. It generates some kind of database of types. You can select them and do whatever you want with them. You'll have access to modules, types contained in those modules, classes, functions, interfaces, type aliases, methods of classes/objects, properties etc.

I created a demo of such generator for you.
In that demo, there are two folders (two projects), some-ts-project and tl-generator; ignore other stuff in the root directory.

In the tl-generator there is the index.ts file which is super simple cmd tool. It requires path to typelib (metadata generated from some TS project; generated by the rttist - new tool from Alpha version) and path to output directory for generated LUA files (generating files to FS is not implemented in the demo). I use ts-node to run that script. It's in the root package.json file.

@Papipo
Copy link

Papipo commented Sep 2, 2024

Amazing! Can I get access to the repo? Thanks!

BTW, how does this lib compare to ts-morph? I have been using it but I think the DX is not as pleasant as it could be.

@Hookyns
Copy link
Owner Author

Hookyns commented Sep 2, 2024

Amazing! Can I get access to the repo? Thanks!

BTW, how does this lib compare to ts-morph? I have been using it but I think the DX is not as pleasant as it could be.

ts-morph is wrapper for TS compiler API. It helps you manipulate the TS source code. With RTTIST you do nothing with the source code, I do that for you; I traverse the TS code, handle different TS versions, find all types, all their properties, methods, decorators etc. and I create one file with metadata about all the types. Then I provide you runtime API you can use to read that metadata file. So you will use RTTIST cli that will generate metadata from a TS project and you can work with it at runtime. It's typical reflection as you may know from eg. C#, Java, Go etc.

With this, you can access metadata about all the types in the project:

const allTypesInWholeProject: Type[] = Metadata.getTypes();

So you can write a node.js script that will read your TS project, you'll receive all the TS metadata and you can just generate LUA files using the node:fs API.

Bit more info in the docs. Still WIP.

Definition of Type and Module and eg. base Object type (Taken from .d.ts inside rttist package. Not documented yet.)
class ObjectLikeTypeBase extends Type {
    /**
     * Returns array of properties.
     */
    getProperties(): ReadonlyArray<PropertyInfo>;
    /**
     * Returns property matched by name.
     */
    getProperty(name: string | number | symbol): PropertyInfo | undefined;
    /**
     * Returns array of indexes.
     */
    getIndexes(): ReadonlyArray<IndexInfo>;
    /**
     * Returns array of methods.
     */
    getMethods(): ReadonlyArray<MethodInfo>;
    /**
     * Returns method matched by name.
     */
    getMethod(name: string | number | symbol): MethodInfo | undefined;
}

class MethodInfo {
    /**
     * Name of the method.
     */
    get name(): MemberName;
    /**
     * Method is optional.
     */
    get optional(): boolean;
    /**
     * Access modifier.
     */
    get accessModifier(): AccessModifier;

    /**
     * Returns array of decorators.
     */
    getDecorators(): ReadonlyArray<DecoratorInfo>;
    /**
     * Returns array of method signatures.
     */
    getSignatures(): ReadonlyArray<SignatureInfo>;
    toString(): string;
}

class SignatureInfo {
    /**
     * Return type of the method.
     */
    get returnType(): Type;

    /**
     * Returns parameters of the signature.
     */
    getParameters(): ReadonlyArray<ParameterInfo>;
    /**
     * Returns array of type parameters.
     */
    getTypeParameters(): ReadonlyArray<TypeParameterType>;
    toString(): string;
}

class ParameterInfo {
    /**
     * Name of the parameter.
     */
    readonly name: string;
    /**
     * Parameter is optional.
     */
    readonly optional: boolean;
    /**
     * Parameter is the rest rest parameter.
     */
    readonly rest: boolean;
    /**
     * Type of the parameter.
     */
    get type(): Type;

    /**
     * Returns array of decorators.
     */
    getDecorators(): ReadonlyArray<DecoratorInfo>;
    toString(): string;
}

class Type {
    static readonly Invalid: Type;
    static readonly NonPrimitiveObject: Type;
    static readonly Any: Type;
    static readonly Unknown: Type;
    static readonly Void: Type;
    static readonly Never: Type;
    static readonly Null: Type;
    static readonly Undefined: Type;
    static readonly String: Type;
    static readonly Number: Type;
    static readonly BigInt: Type;
    static readonly Boolean: Type;
    static readonly True: Type;
    static readonly False: Type;
    static readonly Date: Type;
    static readonly Error: Type;
    static readonly Symbol: Type;
    static readonly UniqueSymbol: Type;
    static readonly RegExp: Type;
    static readonly Int8Array: Type;
    static readonly Uint8Array: Type;
    static readonly Uint8ClampedArray: Type;
    static readonly Int16Array: Type;
    static readonly Uint16Array: Type;
    static readonly Int32Array: Type;
    static readonly Uint32Array: Type;
    static readonly Float32Array: Type;
    static readonly Float64Array: Type;
    static readonly BigInt64Array: Type;
    static readonly BigUint64Array: Type;
    static readonly ArrayDefinition: Type;
    static readonly TupleDefinition: Type;
    static readonly ReadonlyArrayDefinition: Type;
    static readonly MapDefinition: Type;
    static readonly WeakMapDefinition: Type;
    static readonly SetDefinition: Type;
    static readonly WeakSetDefinition: Type;
    static readonly PromiseDefinition: Type;
    static readonly GeneratorDefinition: Type;
    static readonly AsyncGeneratorDefinition: Type;
    static readonly IteratorDefinition: Type;
    static readonly IterableDefinition: Type;
    static readonly IterableIteratorDefinition: Type;
    static readonly AsyncIteratorDefinition: Type;
    static readonly AsyncIterableDefinition: Type;
    static readonly AsyncIterableIteratorDefinition: Type;
    static readonly ArrayBuffer: Type;
    static readonly SharedArrayBuffer: Type;
    static readonly Atomics: Type;
    static readonly DataView: Type;
    static readonly Type: Type;
    static readonly Module: Type;

    /**
     * Type identifier.
     */
    get id(): TypeIdentifier;
    get displayName(): string;
    /**
     * Kind of the type.
     */
    get kind(): TypeKind;
    /**
     * Module which declare type represented by the this Type instance.
     */
    get module(): Module;
    /**
     * Name of the type.
     */
    get name(): string;
    /**
     * Type is exported from its Module.
     */
    get exported(): boolean;
    /**
     * Type has iterator, is iterable.
     */
    get iterable(): boolean;
    /**
     * Type is nullable so null and undefined are valid values for the type.
     */
    get nullable(): boolean;
    /**
     * Definition of the generic type.
     * @internal Hidden in Type; Should be visible only by GenericTypeDefinition<>.
     */
    get genericTypeDefinition(): GenericType<Type> | undefined;

    /**
     * Returns true if type is equal to type passed as type argument.
     */
    is<T>(): boolean;
    /**
     * Returns true if types are equal.
     * @param target
     */
    is<TType extends Type>(target: TType): target is TType;
    /**
     * Returns array of generic type arguments.
     * @internal Exposed by {@link GenericType}.
     */
    getTypeArguments(): ReadonlyArray<Type>;
    /**
     * Check whether the type is generic.
     */
    isGenericType(): this is GenericType<typeof this>;
    /**
     * Check whether the type is definition of the generic type.
     */
    isGenericTypeDefinition(): this is GenericType<typeof this>;
    /**
     * Check whether the type is generic type parameter.
     */
    isTypeParameter(): this is TypeParameterType;
    /**
     * Returns a value indicating whether the Type is container for unified Types or not.
     */
    isUnion(): this is UnionType;
    /**
     * Returns a value indicating whether the Type is container for intersecting Types or not.
     */
    isIntersection(): this is IntersectionType;
    /**
     * Returns a value indicating whether the Type is a class or not.
     */
    isClass(): this is ClassType;
    /**
     * Returns a value indicating whether the Type is a interface or not.
     */
    isInterface(): this is InterfaceType;
    /**
     * Returns a value indicating whether the Type is a interface or not.
     */
    isTypeAlias(): this is TypeAliasType;
    /**
     * Returns a value indicating whether the Type is an literal or not.
     */
    isLiteral(): this is LiteralType;
    /**
     * Returns true if type is union or intersection of types
     */
    isUnionOrIntersection(): this is UnionType | IntersectionType;
    /**
     * Check if this type is an Array.
     */
    isArray(): this is ArrayType;
    /**
     * Check if this type is a Tuple.
     */
    isTuple(): this is TupleType;
    /**
     * Determines whether the object represented by the current Type is an Enum.
     * @return {boolean}
     */
    isEnum(): this is EnumType;
    /**
     * Determines whether the object represented by the current Type is an Conditional type.
     * @return {boolean}
     */
    isConditional(): this is ConditionalType;
    /**
     * Determines whether the object represented by the current Type is an object-like type.
     */
    isObjectLike(): this is ObjectLikeTypeBase;
    /**
     * Determines whether the object represented by the current Type is an Object type.
     */
    isObject(): this is ObjectType;
    /**
     * Determines whether the object represented by the current Type is an Template type.
     */
    isTemplate(): this is TemplateType;
    /**
     * Determines whether the object represented by the current Type is a Function type.
     */
    isFunction(): this is FunctionType;
    /**
     * Determines whether the object represented by the current Type is one of the predefined ES symbols.
     */
    isESSymbol(): this is ESSymbolType;
    /**
     * Determines whether the object represented by the current Type is an unique symbol.
     */
    isUniqueSymbol(): this is UniqueSymbolType;
    /**
     * Returns true whether current Type is instantiable.
     */
    isInstantiable(): boolean;
    /**
     * Check if this is a primitive type ("string", "number", "boolean" etc.).
     */
    isPrimitive(): boolean;
    /**
     * Check if this type is a string.
     */
    isString(): boolean;
    /**
     * Check if this type is a number.
     */
    isNumber(): boolean;
    /**
     * Check if this type is a bigint.
     */
    isBigInt(): boolean;
    /**
     * Check if this type is a boolean.
     */
    isBoolean(): boolean;
    /**
     * Check if this type is an "any".
     */
    isAny(): boolean;
    /**
     * Check if this type is an "never".
     */
    isNever(): boolean;
    /**
     * Check if this type is an "void".
     */
    isVoid(): boolean;
    /**
     * Check if this type is an "undefined".
     */
    isUndefined(): boolean;
    /**
     * Check if this type is an "null".
     */
    isNull(): boolean;
    /**
     * Returns string representation of the type.
     * @returns {string} Returns string in format "Kind{fullName}"
     */
    toString(): string;
}
class Module {
    /**
     * Module for all the native types.
     */
    static readonly Native: Module;
    /**
     * Module for dynamic types without specific module.
     */
    static readonly Dynamic: Module;
    /**
     * Unknown module.
     */
    static readonly Invalid: Module;

    /**
     * The name of the module.
     * @description It is filename of the module in the most of the cases.
     */
    readonly name: string;
    /**
     * The path of the module.
     */
    readonly path: string;
    /**
     * Module identifier.
     */
    get id(): ModuleIdentifier;

    /**
     * Returns array of modules required by this Module.
     * @description These are all the imported modules.
     */
    getChildren(): ReadonlyArray<Module>;
    /**
     * Returns array of types from the module.
     */
    getTypes(): ReadonlyArray<Type>;
    /**
     * Imports module and returns exported object.
     */
    import(): Promise<undefined | {
        [exportName: string]: any;
    }>;
}

@Papipo
Copy link

Papipo commented Sep 2, 2024

I see there is in progress support for vite. In fact my use case is with Vue SFCs: I am writing the UI of a game using them and I want to grab its Props interface to aid in the development of the backend game rules, which will be written in Teal. So right now I am using @vue/compiler-sfc to extract the scriptSetup.

@Hookyns
Copy link
Owner Author

Hookyns commented Sep 2, 2024

I see there is in progress support for vite. In fact my use case is with Vue SFCs: I am writing the UI of a game using them and I want to grab its Props interface to aid in the development of the backend game rules, which will be written in Teal. So right now I am using @vue/compiler-sfc to extract the scriptSetup.

@Papipo Does it have to be "real-time"? I mean, does it have to be generated with the HMR/fast-reload while you develop your Vue app? Or can it be CLI tool that you'll run here and there?

Can you prepare some demo project on StackBlitz? How does your components look like, how the props are defined and what the output should be?

@Papipo
Copy link

Papipo commented Sep 2, 2024

For now I am going with a CLI but honestly I thought about using a watcher at some point. Not sure if I will be coding both the FE at the same time, but it might happen.

For now the approach is to code the FE in Vue, as I can use storybook or in general fake payloads, and only then, transform the entry point Props interface into Teal types to start coding the backend, but we'll see (the project is a year old but only now I've decided to go this route). After all, it's the FE who dictates what props it needs.

I'll try to give you a sample repo but that'll have to wait at least a week because I am on vacation for the rest of the week.

BTW, if you are curious, I plan to use Elixir for the host app, Luerl (an implementation of lua to be run in the BEAM) to run the game engine/rules (lua via teal compiler) and LiveVue to update the Vue props via a websocket (hence the requirement to transform types, for pure sanity). We'll see if it works as intended 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests