Socket
Socket
Sign inDemoInstall

@vue/compiler-ssr

Package Overview
Dependencies
Maintainers
16
Versions
226
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/compiler-ssr - npm Package Compare versions

Comparing version 3.0.0-beta.20 to 3.0.0-beta.21

59

dist/compiler-ssr.cjs.js

@@ -24,2 +24,3 @@ 'use strict';

const SSR_RENDER_SUSPENSE = Symbol(`ssrRenderSuspense`);
const SSR_RESOLVE_CSS_VARS = Symbol(`ssrResolveCssVars`);
const ssrHelpers = {

@@ -41,3 +42,4 @@ [SSR_INTERPOLATE]: `ssrInterpolate`,

[SSR_RENDER_TELEPORT]: `ssrRenderTeleport`,
[SSR_RENDER_SUSPENSE]: `ssrRenderSuspense`
[SSR_RENDER_SUSPENSE]: `ssrRenderSuspense`,
[SSR_RESOLVE_CSS_VARS]: `ssrResolveCssVars`
};

@@ -527,3 +529,3 @@ // Note: these are helpers imported from @vue/server-renderer

const { key, value } = props[j];
if (key.type === 4 /* SIMPLE_EXPRESSION */ && key.isStatic) {
if (compilerDom.isStaticExp(key)) {
let attrName = key.content;

@@ -657,2 +659,14 @@ // static key attr

const context = createSSRTransformContext(ast, options);
// inject <style vars> resolution
// we do this instead of inlining the expression to ensure the vars are
// only resolved once per render
if (options.ssrCssVars) {
const varsExp = compilerDom.processExpression(compilerDom.createSimpleExpression(options.ssrCssVars, false), compilerDom.createTransformContext(compilerDom.createRoot([]), options));
context.body.push(compilerDom.createCompoundExpression([
`const _cssVars = ${ssrHelpers[SSR_RESOLVE_CSS_VARS]}(`,
varsExp,
options.scopeId ? `, ${JSON.stringify(options.scopeId)}` : ``,
`)`
]));
}
const isFragment = ast.children.length > 1 && ast.children.some(c => !compilerDom.isText(c));

@@ -919,2 +933,42 @@ processChildren(ast.children, context, isFragment);

const ssrInjectCssVars = (node, context) => {
if (!context.ssrCssVars) {
return;
}
// _cssVars is initailized once per render function
// the code is injected in ssrCodegenTrasnform when creating the
// ssr transform context
if (node.type === 0 /* ROOT */) {
context.identifiers._cssVars = 1;
}
const parent = context.parent;
if (!parent || parent.type !== 0 /* ROOT */) {
return;
}
context.helper(SSR_RESOLVE_CSS_VARS);
if (node.type === 10 /* IF_BRANCH */) {
for (const child of node.children) {
injectCssVars(child);
}
}
else {
injectCssVars(node);
}
};
function injectCssVars(node) {
if (node.type === 1 /* ELEMENT */ &&
(node.tagType === 0 /* ELEMENT */ ||
node.tagType === 1 /* COMPONENT */) &&
!compilerDom.findDir(node, 'for')) {
node.props.push({
type: 7 /* DIRECTIVE */,
name: 'bind',
arg: undefined,
exp: compilerDom.createSimpleExpression(`_cssVars`, false),
modifiers: [],
loc: compilerDom.locStub
});
}
}
function compile(template, options = {}) {

@@ -946,2 +1000,3 @@ options = {

ssrInjectFallthroughAttrs,
ssrInjectCssVars,
ssrTransformElement,

@@ -948,0 +1003,0 @@ ssrTransformComponent,

6

package.json
{
"name": "@vue/compiler-ssr",
"version": "3.0.0-beta.20",
"version": "3.0.0-beta.21",
"description": "@vue/compiler-ssr",

@@ -30,5 +30,5 @@ "main": "dist/compiler-ssr.cjs.js",

"dependencies": {
"@vue/shared": "3.0.0-beta.20",
"@vue/compiler-dom": "3.0.0-beta.20"
"@vue/shared": "3.0.0-beta.21",
"@vue/compiler-dom": "3.0.0-beta.21"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc