feat: ssr support for <style vars>
This commit is contained in:
@@ -204,10 +204,11 @@ export function generate(
|
||||
genFunctionPreamble(ast, context)
|
||||
}
|
||||
|
||||
// enter render function
|
||||
// binding optimizations
|
||||
const optimizeSources = options.bindingMetadata
|
||||
? `, $props, $setup, $data, $options`
|
||||
: ``
|
||||
// enter render function
|
||||
if (!ssr) {
|
||||
if (genScopeId) {
|
||||
push(`const render = ${PURE_ANNOTATION}_withId(`)
|
||||
|
||||
@@ -126,6 +126,11 @@ export interface TransformOptions {
|
||||
* `ssrRender` option instead of `render`.
|
||||
*/
|
||||
ssr?: boolean
|
||||
/**
|
||||
* SFC <style vars> injection string
|
||||
* needed to render inline CSS variables on component root
|
||||
*/
|
||||
ssrCssVars?: string
|
||||
/**
|
||||
* Optional binding metadata analyzed from script - used to optimize
|
||||
* binding access when `prefixIdentifiers` is enabled.
|
||||
|
||||
@@ -120,6 +120,7 @@ export function createTransformContext(
|
||||
expressionPlugins = [],
|
||||
scopeId = null,
|
||||
ssr = false,
|
||||
ssrCssVars = ``,
|
||||
bindingMetadata = {},
|
||||
onError = defaultOnError
|
||||
}: TransformOptions
|
||||
@@ -136,6 +137,7 @@ export function createTransformContext(
|
||||
expressionPlugins,
|
||||
scopeId,
|
||||
ssr,
|
||||
ssrCssVars,
|
||||
bindingMetadata,
|
||||
onError,
|
||||
|
||||
@@ -148,7 +150,7 @@ export function createTransformContext(
|
||||
imports: new Set(),
|
||||
temps: 0,
|
||||
cached: 0,
|
||||
identifiers: {},
|
||||
identifiers: Object.create(null),
|
||||
scopes: {
|
||||
vFor: 0,
|
||||
vSlot: 0,
|
||||
|
||||
Reference in New Issue
Block a user