Expand description
Port of src/printer/render.ts.
The rendered css is written to a utf-8 Writer. The typescript renderer memoizes identical declarations and
constructs (RenderMemo): the rendering only depends on the token structure, the port renders them each time
(same output).
Structs§
- Node
Renderer - renders nodes with the same options (
NodeRenderer): the size of the rendered node - Reducer
- token reducer: the comments are removed according to the options (
createReducer()) - Render
Cache - render state shared by the nodes and the tokens of a render: the memo, valid for the options it was created for, and the resolved source file names of the source map
- Render
Mapping - css modules mapping of a render (
:export/:import()) - Render
Memo - rendered strings shared by the renderer (
RenderMemo): identical declarations and identical constructs (colors, functions, parentheses, binary expressions, …) are rendered once. a memo is only shared by renders that use the same options. the source map locations are not memoized: they are computed from the rendered string
Enums§
- Rendered
- a rendered string: a memoized string is shared, not copied
Functions§
- declaration_
renders - number of declaration values rendered on this thread: an identical declaration is rendered once per render
- do_
render - render an ast (
doRender()) - do_
render_ with - render an ast with the rendered values of a memo shared with other renders that use the same options (see
NodeRenderer). without a memo, a memo is acquired and released - filter_
values - remove the whitespace that is not needed: before
!important, after a function - move_
location - update the position (
move()): the offsets are computed from the rendered string, its utf-16 code units are read in place (no copy) - output_
capacity - capacity of the buffer a node is rendered to
- render_
declaration_ value - render the value tokens of a declaration with the reducer. with
minify_values, the whitespace before!importantand after a function is dropped - render_
value - render a token with the options (
renderValue()) - render_
value_ default - render a token with the default options
- render_
value_ with - render a token. identical constructs (colors and tokens with sub tokens: functions, parentheses, binary
expressions, …) are rendered once per render, see
RenderMemo - resolve_
render_ options - copy of the options with the defaults of the missing options
Type Aliases§
- Render
Options - render options (
RenderOptions): the parser options hold the render options