babel-plugin-estrela
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "babel-plugin-estrela", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A babel plugin to process estrela jsx/tsx files", | ||
@@ -22,4 +22,6 @@ "main": "dist/index.js", | ||
"@types/babel__core": "^7.1.19", | ||
"esbuild": "^0.14.38", | ||
"rimraf": "^3.0.2", | ||
"ts-node": "^10.7.0" | ||
} | ||
} |
@@ -5,2 +5,37 @@ # babel-plugin-estrela | ||
### Estrela code example | ||
```tsx | ||
import { onDestroy } from 'estrela'; | ||
const App = () => { | ||
// create a number state with initial value equal to 0. | ||
let count = 0; | ||
// create an updater interval function. | ||
const interval = setInterval(() => count++, 1000); | ||
// clean interval on destroy this component. | ||
onDestroy(() => clearInterval(interval)); | ||
// return JSX element. | ||
return <div>Count is { count * 2 }</div> | ||
} | ||
``` | ||
It will convert the code above to: | ||
```js | ||
import { h as _jsx, createProxyState as _$$ } from 'estrela/internal'; | ||
import { state, onDestroy } from 'estrela'; | ||
const App = () => { | ||
const _$ = /*#__PURE__*/_$$(); | ||
_$.count = 0; | ||
setInterval(() => _$.count++, 1000); | ||
onDestroy(() => clearInterval(interval)); | ||
return /*#__PURE__*/h('div', null, 'Count is ', [_$.$.count, _count => _count * 2]); | ||
} | ||
``` | ||
## Install | ||
@@ -17,3 +52,3 @@ | ||
```bash | ||
$ yarn add -dev babel-plugin-estrela | ||
$ yarn add babel-plugin-estrela --dev | ||
``` | ||
@@ -23,2 +58,2 @@ | ||
For more Estrela information, visit the github page at https://github.com/estrelajs/estrela/. | ||
For more Estrela information, visit the github page at https://github.com/estrelajs/estrela/. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35683
57
5