You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We always want loadData() to be a blocking call, as we use that code to
read the data JS files so that we can do further processing.
However, since data JS paths are dynamic, we must use import() which is
required to be an async call.
For bootstrapping purposes, this means there is no way to block markdown
processing to begin before the Dovecot markdown plugin is ready. This is
because markdown-it code MUST NOT use async code, so we need to load all the
data (via loadData()) before it can be initialized. Dovecot markdown code
also requires VitePress paths to be available in global config object, so the
only place we can realistically add the Dovecot markdown processing is via the
"config" markdown option. Unfortunately, the internal VitePress code does not
call this function with await, so there is simply no way to block processing
via this mechanism.
Solution- the import-sync nodejs package allows import behavior to be done
synchronously.
This allows us to no longer need to pre-configure the dovecot markdown plugin,
as the loadData() calls can now be called on-demand inside of the plugin. Thus,
we can guarantee that the Dovecot markdown plugin is initialized at the time
the first page is processed by VitePress now.
0 commit comments