You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The structure is similar to the transformer; `generate.ts` implements the `generate` function and `CodegenContext`, and the `generators` directory contains code generation functions for each node.
Since the declarations of templates and import statements are done outside the render function, these are generated as `preamble` and added to the beginning of the code.
The implementation is located in [packages/compiler-vapor/src/generators/block.ts](https://github.com/vuejs/core-vapor/blob/30583b9ee1c696d3cb836f0bfd969793e57e849d/packages/compiler-vapor/src/generators/block.ts).
72
+
The implementation is located in [packages/compiler-vapor/src/generators/block.ts](https://github.com/vuejs/vue-vapor/blob/30583b9ee1c696d3cb836f0bfd969793e57e849d/packages/compiler-vapor/src/generators/block.ts).
We can see that it includes information like `id` and template index.\
89
89
Using this information, we generate code with `genChildren`.
90
90
91
91
## genChildren
92
92
93
-
`genChildren` is implemented in [packages/compiler-vapor/src/generators/template.ts](https://github.com/vuejs/core-vapor/blob/30583b9ee1c696d3cb836f0bfd969793e57e849d/packages/compiler-vapor/src/generators/template.ts).
93
+
`genChildren` is implemented in [packages/compiler-vapor/src/generators/template.ts](https://github.com/vuejs/vue-vapor/blob/30583b9ee1c696d3cb836f0bfd969793e57e849d/packages/compiler-vapor/src/generators/template.ts).
Copy file name to clipboardExpand all lines: src/compiler-overview-ir.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ We'll first look at the `IR` before proceeding to read the source code of the `t
13
13
While the `SFCDescriptor` and `AST` were essentially structured versions of the user's (web application developer's) input code, the `IR` can be thought of as the "structured version of the output code." \
14
14
The definition of `IR` can be found in `ir/index.ts`.
The template, script, and style each inherit from an object called `SFCBlock`, and this `SFCBlock` contains information such as `content`, which represents its content, `attrs`, which represents attributes like lang, setup, scoped, etc., and `loc`, which indicates where in the whole SFC it is located.
Similarly, the script is represented by an object called `SFCScriptBlock`. \
25
25
This includes a flag indicating whether it is setup or not, information about the modules being imported, and the AST of the script (JS, TS) that is the content of the block.
The `compiler.parse` in `compiler` comes from options, and this is actually the template parser in `compiler-core`.
163
163
@@ -174,19 +174,19 @@ In other words, `compiler-core` is in a more general position rather than implem
174
174
175
175
Through this parsing process, we can get the rough structure of `template`, `script`, `style`, etc., so we then branch and perform detailed parsing for each.
0 commit comments