Socket
Socket
Sign inDemoInstall

@vue/server-renderer

Package Overview
Dependencies
Maintainers
1
Versions
231
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/server-renderer - npm Package Compare versions

Comparing version 3.0.0-alpha.6 to 3.0.0-alpha.7

56

dist/server-renderer.cjs.js

@@ -355,5 +355,7 @@ 'use strict';

return {
buffer,
hasAsync() {
return hasAsync;
getBuffer() {
// If the current component's buffer contains any Promise from async children,
// then it must return a Promise too. Otherwise this is a component that
// contains only sync children so we can avoid the async book-keeping overhead.
return hasAsync ? Promise.all(buffer) : buffer;
},

@@ -390,3 +392,2 @@ push(item) {

async function renderToString(input, context = {}) {
let buffer;
if (isVNode(input)) {

@@ -396,19 +397,9 @@ // raw vnode, wrap with app (for context)

}
else {
// rendering an app
const vnode = vue.createVNode(input._component, input._props);
vnode.appContext = input._context;
// provide the ssr context to the tree
input.provide(vue.ssrContextKey, context);
buffer = await renderComponentVNode(vnode);
}
// resolve portals
if (context.__portalBuffers) {
context.portals = context.portals || {};
for (const key in context.__portalBuffers) {
// note: it's OK to await sequentially here because the Promises were
// created eagerly in parallel.
context.portals[key] = unrollBuffer(await context.__portalBuffers[key]);
}
}
// rendering an app
const vnode = vue.createVNode(input._component, input._props);
vnode.appContext = input._context;
// provide the ssr context to the tree
input.provide(vue.ssrContextKey, context);
const buffer = await renderComponentVNode(vnode);
await resolvePortals(context);
return unrollBuffer(buffer);

@@ -451,3 +442,3 @@ }

const comp = instance.type;
const { buffer, push, hasAsync } = createBuffer();
const { getBuffer, push } = createBuffer();
if (isFunction(comp)) {

@@ -474,6 +465,3 @@ renderVNode(push, renderComponentRoot(instance), instance);

}
// If the current component's buffer contains any Promise from async children,
// then it must return a Promise too. Otherwise this is a component that
// contains only sync children so we can avoid the async book-keeping overhead.
return hasAsync() ? Promise.all(buffer) : buffer;
return getBuffer();
}

@@ -570,10 +558,18 @@ function renderVNode(push, vnode, parentComponent) {

}
const { buffer, push, hasAsync } = createBuffer();
const { getBuffer, push } = createBuffer();
renderVNodeChildren(push, vnode.children, parentComponent);
const context = parentComponent.appContext.provides[vue.ssrContextKey];
const portalBuffers = context.__portalBuffers || (context.__portalBuffers = {});
portalBuffers[target] = hasAsync()
? Promise.all(buffer)
: buffer;
portalBuffers[target] = getBuffer();
}
async function resolvePortals(context) {
if (context.__portalBuffers) {
context.portals = context.portals || {};
for (const key in context.__portalBuffers) {
// note: it's OK to await sequentially here because the Promises were
// created eagerly in parallel.
context.portals[key] = unrollBuffer(await context.__portalBuffers[key]);
}
}
}

@@ -580,0 +576,0 @@ function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent) {

@@ -319,5 +319,7 @@ 'use strict';

return {
buffer,
hasAsync() {
return hasAsync;
getBuffer() {
// If the current component's buffer contains any Promise from async children,
// then it must return a Promise too. Otherwise this is a component that
// contains only sync children so we can avoid the async book-keeping overhead.
return hasAsync ? Promise.all(buffer) : buffer;
},

@@ -354,3 +356,2 @@ push(item) {

async function renderToString(input, context = {}) {
let buffer;
if (isVNode(input)) {

@@ -360,19 +361,9 @@ // raw vnode, wrap with app (for context)

}
else {
// rendering an app
const vnode = vue.createVNode(input._component, input._props);
vnode.appContext = input._context;
// provide the ssr context to the tree
input.provide(vue.ssrContextKey, context);
buffer = await renderComponentVNode(vnode);
}
// resolve portals
if (context.__portalBuffers) {
context.portals = context.portals || {};
for (const key in context.__portalBuffers) {
// note: it's OK to await sequentially here because the Promises were
// created eagerly in parallel.
context.portals[key] = unrollBuffer(await context.__portalBuffers[key]);
}
}
// rendering an app
const vnode = vue.createVNode(input._component, input._props);
vnode.appContext = input._context;
// provide the ssr context to the tree
input.provide(vue.ssrContextKey, context);
const buffer = await renderComponentVNode(vnode);
await resolvePortals(context);
return unrollBuffer(buffer);

@@ -412,3 +403,3 @@ }

const comp = instance.type;
const { buffer, push, hasAsync } = createBuffer();
const { getBuffer, push } = createBuffer();
if (isFunction(comp)) {

@@ -435,6 +426,3 @@ renderVNode(push, renderComponentRoot(instance), instance);

}
// If the current component's buffer contains any Promise from async children,
// then it must return a Promise too. Otherwise this is a component that
// contains only sync children so we can avoid the async book-keeping overhead.
return hasAsync() ? Promise.all(buffer) : buffer;
return getBuffer();
}

@@ -531,10 +519,18 @@ function renderVNode(push, vnode, parentComponent) {

}
const { buffer, push, hasAsync } = createBuffer();
const { getBuffer, push } = createBuffer();
renderVNodeChildren(push, vnode.children, parentComponent);
const context = parentComponent.appContext.provides[vue.ssrContextKey];
const portalBuffers = context.__portalBuffers || (context.__portalBuffers = {});
portalBuffers[target] = hasAsync()
? Promise.all(buffer)
: buffer;
portalBuffers[target] = getBuffer();
}
async function resolvePortals(context) {
if (context.__portalBuffers) {
context.portals = context.portals || {};
for (const key in context.__portalBuffers) {
// note: it's OK to await sequentially here because the Promises were
// created eagerly in parallel.
context.portals[key] = unrollBuffer(await context.__portalBuffers[key]);
}
}
}

@@ -541,0 +537,0 @@ function ssrRenderSlot(slots, slotName, slotProps, fallbackRenderFn, push, parentComponent) {

{
"name": "@vue/server-renderer",
"version": "3.0.0-alpha.6",
"version": "3.0.0-alpha.7",
"description": "@vue/server-renderer",

@@ -30,7 +30,7 @@ "main": "index.js",

"peerDependencies": {
"vue": "3.0.0-alpha.6"
"vue": "3.0.0-alpha.7"
},
"dependencies": {
"@vue/compiler-ssr": "3.0.0-alpha.6"
"@vue/compiler-ssr": "3.0.0-alpha.7"
}
}
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