@vue/compiler-ssr
Advanced tools
Comparing version 3.0.0-alpha.10 to 3.0.0-alpha.11
@@ -21,3 +21,3 @@ 'use strict'; | ||
const SSR_GET_DYNAMIC_MODEL_PROPS = Symbol(`ssrGetDynamicModelProps`); | ||
const SSR_RENDER_PORTAL = Symbol(`ssrRenderPortal`); | ||
const SSR_RENDER_TELEPORT = Symbol(`ssrRenderTeleport`); | ||
const SSR_RENDER_SUSPENSE = Symbol(`ssrRenderSuspense`); | ||
@@ -38,3 +38,3 @@ const ssrHelpers = { | ||
[SSR_GET_DYNAMIC_MODEL_PROPS]: `ssrGetDynamicModelProps`, | ||
[SSR_RENDER_PORTAL]: `ssrRenderPortal`, | ||
[SSR_RENDER_TELEPORT]: `ssrRenderTeleport`, | ||
[SSR_RENDER_SUSPENSE]: `ssrRenderSuspense` | ||
@@ -127,25 +127,32 @@ }; | ||
const SSRErrorMessages = { | ||
[65 /* X_SSR_CUSTOM_DIRECTIVE_NO_TRANSFORM */]: `Custom directive is missing corresponding SSR transform and will be ignored.`, | ||
[66 /* X_SSR_UNSAFE_ATTR_NAME */]: `Unsafe attribute name for SSR.`, | ||
[67 /* X_SSR_NO_PORTAL_TARGET */]: `No target prop on portal element.` | ||
[64 /* X_SSR_CUSTOM_DIRECTIVE_NO_TRANSFORM */]: `Custom directive is missing corresponding SSR transform and will be ignored.`, | ||
[65 /* X_SSR_UNSAFE_ATTR_NAME */]: `Unsafe attribute name for SSR.`, | ||
[66 /* X_SSR_NO_TELEPORT_TARGET */]: `No target prop on teleport element.` | ||
}; | ||
// Note: this is a 2nd-pass codegen transform. | ||
function ssrProcessPortal(node, context) { | ||
function ssrProcessTeleport(node, context) { | ||
const targetProp = compilerDom.findProp(node, 'target'); | ||
if (!targetProp) { | ||
context.onError(createSSRCompilerError(67 /* X_SSR_NO_PORTAL_TARGET */, node.loc)); | ||
context.onError(createSSRCompilerError(66 /* X_SSR_NO_TELEPORT_TARGET */, node.loc)); | ||
return; | ||
} | ||
let target; | ||
if (targetProp.type === 6 /* ATTRIBUTE */ && targetProp.value) { | ||
target = compilerDom.createSimpleExpression(targetProp.value.content, true); | ||
if (targetProp.type === 6 /* ATTRIBUTE */) { | ||
target = | ||
targetProp.value && compilerDom.createSimpleExpression(targetProp.value.content, true); | ||
} | ||
else if (targetProp.type === 7 /* DIRECTIVE */ && targetProp.exp) { | ||
else { | ||
target = targetProp.exp; | ||
} | ||
else { | ||
context.onError(createSSRCompilerError(67 /* X_SSR_NO_PORTAL_TARGET */, targetProp.loc)); | ||
if (!target) { | ||
context.onError(createSSRCompilerError(66 /* X_SSR_NO_TELEPORT_TARGET */, targetProp.loc)); | ||
return; | ||
} | ||
const disabledProp = compilerDom.findProp(node, 'disabled', false, true /* allow empty */); | ||
const disabled = disabledProp | ||
? disabledProp.type === 6 /* ATTRIBUTE */ | ||
? `true` | ||
: disabledProp.exp || `false` | ||
: `false`; | ||
const contentRenderFn = compilerDom.createFunctionExpression([`_push`], undefined, // Body is added later | ||
@@ -156,5 +163,7 @@ true, // newline | ||
contentRenderFn.body = processChildrenAsStatement(node.children, context); | ||
context.pushStatement(compilerDom.createCallExpression(context.helper(SSR_RENDER_PORTAL), [ | ||
context.pushStatement(compilerDom.createCallExpression(context.helper(SSR_RENDER_TELEPORT), [ | ||
`_push`, | ||
contentRenderFn, | ||
target, | ||
disabled, | ||
`_parent` | ||
@@ -278,4 +287,4 @@ ])); | ||
const component = componentTypeMap.get(node); | ||
if (component === compilerDom.PORTAL) { | ||
return ssrProcessPortal(node, context); | ||
if (component === compilerDom.TELEPORT) { | ||
return ssrProcessTeleport(node, context); | ||
} | ||
@@ -465,3 +474,3 @@ else if (component === compilerDom.SUSPENSE) { | ||
else if (prop.name === 'slot') { | ||
context.onError(compilerDom.createCompilerError(45 /* X_V_SLOT_MISPLACED */, prop.loc)); | ||
context.onError(compilerDom.createCompilerError(44 /* X_V_SLOT_MISPLACED */, prop.loc)); | ||
} | ||
@@ -478,3 +487,3 @@ else if (isTextareaWithValue(node, prop) && prop.exp) { | ||
// no corresponding ssr directive transform found. | ||
context.onError(createSSRCompilerError(65 /* X_SSR_CUSTOM_DIRECTIVE_NO_TRANSFORM */, prop.loc)); | ||
context.onError(createSSRCompilerError(64 /* X_SSR_CUSTOM_DIRECTIVE_NO_TRANSFORM */, prop.loc)); | ||
} | ||
@@ -518,3 +527,3 @@ else if (!hasDynamicVBind) { | ||
else { | ||
context.onError(createSSRCompilerError(66 /* X_SSR_UNSAFE_ATTR_NAME */, key.loc)); | ||
context.onError(createSSRCompilerError(65 /* X_SSR_UNSAFE_ATTR_NAME */, key.loc)); | ||
} | ||
@@ -719,3 +728,3 @@ } | ||
if (value) { | ||
context.onError(compilerDom.createDOMCompilerError(62 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc)); | ||
context.onError(compilerDom.createDOMCompilerError(61 /* X_V_MODEL_UNNECESSARY_VALUE */, value.loc)); | ||
} | ||
@@ -763,3 +772,3 @@ } | ||
case 'file': | ||
context.onError(compilerDom.createDOMCompilerError(61 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc)); | ||
context.onError(compilerDom.createDOMCompilerError(60 /* X_V_MODEL_ON_FILE_INPUT_ELEMENT */, dir.loc)); | ||
break; | ||
@@ -786,3 +795,3 @@ default: | ||
else { | ||
context.onError(compilerDom.createDOMCompilerError(59 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc)); | ||
context.onError(compilerDom.createDOMCompilerError(58 /* X_V_MODEL_ON_INVALID_ELEMENT */, dir.loc)); | ||
} | ||
@@ -807,3 +816,3 @@ return res; | ||
if (!dir.exp) { | ||
context.onError(compilerDom.createDOMCompilerError(63 /* X_V_SHOW_NO_EXPRESSION */)); | ||
context.onError(compilerDom.createDOMCompilerError(62 /* X_V_SHOW_NO_EXPRESSION */)); | ||
} | ||
@@ -810,0 +819,0 @@ return { |
{ | ||
"name": "@vue/compiler-ssr", | ||
"version": "3.0.0-alpha.10", | ||
"version": "3.0.0-alpha.11", | ||
"description": "@vue/compiler-ssr", | ||
@@ -30,5 +30,5 @@ "main": "dist/compiler-ssr.cjs.js", | ||
"dependencies": { | ||
"@vue/shared": "3.0.0-alpha.10", | ||
"@vue/compiler-dom": "3.0.0-alpha.10" | ||
"@vue/shared": "3.0.0-alpha.11", | ||
"@vue/compiler-dom": "3.0.0-alpha.11" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40468
854
+ Added@vue/compiler-core@3.0.0-alpha.11(transitive)
+ Added@vue/compiler-dom@3.0.0-alpha.11(transitive)
+ Added@vue/shared@3.0.0-alpha.11(transitive)
- Removed@vue/compiler-core@3.0.0-alpha.10(transitive)
- Removed@vue/compiler-dom@3.0.0-alpha.10(transitive)
- Removed@vue/shared@3.0.0-alpha.10(transitive)
Updated@vue/shared@3.0.0-alpha.11