Skip to main content

Module render

Module render 

Source
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§

NodeRenderer
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())
RenderCache
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
RenderMapping
css modules mapping of a render (:export / :import())
RenderMemo
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 !important and 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§

RenderOptions
render options (RenderOptions): the parser options hold the render options