framework-2021
framework-2021 copied to clipboard
Add components with props, htmlx (v1.2)
Pre-requisites:
-
Template literals & tagged letrals: write your own template parser:
- simple interpolation
- every param transformed (strings are enclosed in qoutes, numerics are multiplied, objects/arrays stringified, functions =>
FuncName())
- Data Structures: write your own DOM tree and HTML renderer
- RegExp: write your own HTML parser (HTML string => tree)
Task:
- Function calls => HTMLX
- Each function => component with props
- https://parceljs.org/transforms.html
- https://babeljs.io/docs/en/babel-plugin-syntax-jsx
- https://github.com/pomber/didact/pull/15/files
-
/** @jsx Didact.createElement */ - https://github.com/alangpierce/sucrase
- JSX Quasi-Literal
- https://github.com/trueadm/t7
- minimalistic jsx + lightweight observables for state
- have source code structured (fw, components, utils, data store)
- have parametrized components
Как работает JS: абстрактные синтаксические деревья, парсинг и его оптимизация https://habr.com/ru/company/ruvds/blog/415269/