Skip to content

Commit

Permalink
chore: update default playground code
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix-ru committed Nov 15, 2023
1 parent 2df878b commit 569e380
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ All-In-One Vue compiler written in Rust.

Currently in early development, and the closest goal is to reach feature-parity with the current [Vue SFC compiler](https://sfc.vuejs.org).

## Progress till MVP ![](https://geps.dev/progress/72)
## Progress till MVP ![](https://geps.dev/progress/74)
A minimal target of this project includes:
- Vue 3 code generation;
- [unplugin](https://github.com/unjs/unplugin) integration;
Expand All @@ -17,12 +17,13 @@ A minimal target of this project includes:
- Performance comparison.

## Is it correct?
This project uses [Vue SFC playground](https://sfc.vuejs.org) as its reference to compare the output. As of April 2023, fervid is capable of producing the DEV code almost identical to the official compiler, except for:
- [WIP] Context variables. This includes usages like `{{ foo + bar.buzz }}` or `<div v-if="isShown">`.
These usages require a JavaScript parser and transformer like SWC and support for them in fervid is currently ongoing.
This project uses [Vue SFC playground](https://sfc.vuejs.org) as its reference to compare the output.
As of November 2023, fervid is capable of producing the DEV and PROD code almost identical to the official compiler, with some differences in:
- Context variables. This includes usages like `{{ foo + bar.buzz }}` or `<div v-if="isShown">`.
These usages require a JavaScript parser and transformer like SWC and support for them in fervid is almost complete.
- [WIP] Patch flags. These are used to help Vue runtime when diffing the VNodes. If a VNode only has one prop which is dynamic, and all the other props and text are static, this needs to be conveyed to Vue for fast updates. I am currently researching how they are originally implemented.

To check correctness of fervid, you can compare the [run log](run.log) to the output of playground. For doing so, go to https://sfc.vuejs.org and paste in the contents of [crates/fervid/benches/fixtures/input.vue](crates/fervid/benches/fixtures/input.vue).
To check correctness of fervid, you can compare the [playground output](https://phoenix-ru.github.io/fervid/) to the output of [official compiler](https://play.vuejs.org).

Please note that "correctness" of output will depend on the version of Vue, as Vue team may change the output and/or behaviour of the compiler. This is a big challenge for fervid.

Expand Down
5 changes: 3 additions & 2 deletions crates/fervid_wasm/web/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import * as monaco from 'https://cdn.jsdelivr.net/npm/monaco-editor@0.41.0/esm/v

const INITIAL =
`<template>
<div>
<h1>
Hello {{ name }}!
</div>
</h1>
<input v-model="name">
</template>
<script setup>
Expand Down

0 comments on commit 569e380

Please sign in to comment.