W
Wasp-lang•5mo ago
isaiah

Wasp Compiler

A detailed explanation of what the wasp compiler does.
10 Replies
kapa.ai
kapa.ai•5mo ago
Hi @isaiah. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The Wasp compiler is a crucial part of the Wasp framework. It is responsible for parsing Wasp code and generating JavaScript code based on it. The compiler consists of two main phases: the Analyzer (or Parser) and the Generator. The Analyzer parses Wasp code and creates an Abstract Syntax Tree (AST), which is then provided to the Generator. The Generator, in turn, generates JavaScript code based on the AST. The Wasp compiler is built with Haskell, and it's designed to understand your code and perform a lot of tasks for you. For instance, you can define your app in the Wasp config, and the compiler will handle features like login and signup with Auth UI components, full-stack type safety, e-mail sending, async processing jobs, React Query powered data fetching, security best practices, and more. You don't need to write any code for these features, Wasp will take care of it for you. The Wasp compiler also maintains the code for you, so you don't have to worry about keeping up with the latest security best practices. As Wasp updates, so does your app. In terms of its architecture, the Wasp compiler is designed to be flexible and adaptable. For instance, there has been discussion about the possibility of enabling the compiler to take JSON as an input, which directly maps to the AST. This would allow for multiple frontends, as long as they can generate the JSON correctly. Sources: - Wasp Docs (https://wasp-lang.dev/docs) - Github Issue #141 (https://github.com/wasp-lang/wasp/issues/141) - Github Issue #299 (https://github.com/wasp-lang/wasp/issues/299) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @isaiah, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
isaiah
isaiah•5mo ago
@kapa.ai Can you be more detailed on how Wasp does this:
The Wasp compiler also maintains the code for you, so you don't have to worry about keeping up with the latest security best practices. As Wasp updates, so does your app.
kapa.ai
kapa.ai•5mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- The Wasp compiler's ability to maintain your code and keep it updated with the latest security best practices is a result of its design and the features it provides. When you define your app in the Wasp config, the compiler generates the necessary code for various features. These features include login and signup with Auth UI components, full-stack type safety, e-mail sending, async processing jobs, React Query powered data fetching, and security best practices. The key point here is that you don't have to write any code for these features. The Wasp compiler generates and maintains this code for you. This means that when Wasp updates, and there are changes or improvements to these features (including security best practices), the Wasp compiler will generate the updated code for your app. However, the exact mechanism of how Wasp updates your app's code when there's a new version of Wasp isn't explicitly detailed in the provided knowledge sources. For more specific details, you might want to refer to the official Wasp documentation or their GitHub repository. Source: Wasp Docs (https://wasp-lang.dev/docs) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @isaiah, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
isaiah
isaiah•5mo ago
@kapa.ai What if I want to update my devDependencies like Prisma?
kapa.ai
kapa.ai•5mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Based on the knowledge sources provided, there has been a discussion about allowing users to create dev dependencies for their Wasp projects. This could be useful in scenarios where a developer wants to install a dev tool into a Wasp project that's not part of Wasp, like a linter, or when they want to pull in TypeScript type definitions which are not required as main dependencies. However, it's not clear from the sources whether this feature has been implemented yet. There are also questions about how Wasp should handle a situation where a user adds a dependency and a devDependency to the same package. For Prisma specifically, there's a closed issue about moving all Prisma-related operations and packages to the project's top level, which would make the prisma package a project dependency. This suggests that currently, Prisma is a part of the Wasp framework and not something that users can add as a devDependency themselves. For more specific details or updates on this feature, you might want to refer to the official Wasp documentation or their GitHub repository. Sources: - Github Issue #456 (https://github.com/wasp-lang/wasp/issues/456) - Github Issue #1596 (https://github.com/wasp-lang/wasp/issues/1596) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @isaiah, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
isaiah
isaiah•5mo ago
@kapa.ai What if I want to update my devDependencies like Prisma?
kapa.ai
kapa.ai•5mo ago
Let me check the knowledge base for you. One moment! :books: ---------------------- Based on the knowledge sources provided, there has been a discussion about allowing users to specify some NPM dependency versions themselves. This could be useful in scenarios where a user needs to update a dependency like Prisma to a newer version for specific features or compatibility reasons. However, it's not clear from the sources whether this feature has been implemented yet. There are also concerns about users potentially causing issues by using versions of dependencies that haven't been tested with Wasp. For Prisma specifically, there have been several issues related to updating Prisma to newer versions. These updates were handled by the Wasp team and included in new releases of Wasp. This suggests that currently, updating devDependencies like Prisma is handled by the Wasp team and not something that users can do themselves. For more specific details or updates on this feature, you might want to refer to the official Wasp documentation or their GitHub repository. Sources: - Github Issue #645 (https://github.com/wasp-lang/wasp/issues/645) - Github Issue #194 (https://github.com/wasp-lang/wasp/issues/194) - Github Issue #359 (https://github.com/wasp-lang/wasp/issues/359) - Github Issue #629 (https://github.com/wasp-lang/wasp/issues/629) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @isaiah, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
martinsos
martinsos•5mo ago
@isaiah there are specific deps that can't be updated, like React or Prisma, because Wasp relies on them heavily. So their versions are locked together with the Wasp version. Btw here is a pretty cool diagram of how compiler works 😄 https://github.com/wasp-lang/wasp/blob/main/waspc/images/waspc-implementation-diagram.png
GitHub
wasp/waspc/images/waspc-implementation-diagram.png at main · wasp-l...
The fastest way to develop full-stack web apps with React & Node.js. - wasp-lang/wasp
isaiah
isaiah•5mo ago
I'm just curious if kapa.ai has some info that you can't find in the github repo 😅 . As for for updating Prisma, I already did experiments with it so I know it's not gonna work. I just asked kapa.ai again because of reading this line "The Wasp compiler's ability to maintain your code and keep it updated with the latest security best practices is a result of its design and the features it provides."
martinsos
martinsos•5mo ago
Yeah hm it said that a bit boldly didn't it :D. I guess its ability to do taht is there if you keep updating Wasp, not by itself of course :D. Kapa has info from GH repo + Discord questions + docs, that is it. + the web I guess.
Want results from more Discord servers?
Add your server