@vue/server-renderer
Advanced tools
Comparing version 3.1.3 to 3.1.4
@@ -10,2 +10,27 @@ 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
// leading comma for empty string "" | ||
@@ -204,3 +229,3 @@ const shouldIgnoreProp = shared.makeMap(`,key,ref,innerHTML,textContent`); | ||
if (!hasCloned) { | ||
attrs = { ...attrs }; | ||
attrs = Object.assign({}, attrs); | ||
hasCloned = true; | ||
@@ -222,3 +247,3 @@ } | ||
if (!hasCloned) | ||
attrs = { ...attrs }; | ||
attrs = Object.assign({}, attrs); | ||
attrs[slotScopeId.trim()] = ''; | ||
@@ -371,24 +396,26 @@ } | ||
const { isVNode } = vue.ssrUtils; | ||
async function unrollBuffer(buffer) { | ||
if (buffer.hasAsync) { | ||
let ret = ''; | ||
for (let i = 0; i < buffer.length; i++) { | ||
let item = buffer[i]; | ||
if (shared.isPromise(item)) { | ||
item = await item; | ||
function unrollBuffer(buffer) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (buffer.hasAsync) { | ||
let ret = ''; | ||
for (let i = 0; i < buffer.length; i++) { | ||
let item = buffer[i]; | ||
if (shared.isPromise(item)) { | ||
item = yield item; | ||
} | ||
if (shared.isString(item)) { | ||
ret += item; | ||
} | ||
else { | ||
ret += yield unrollBuffer(item); | ||
} | ||
} | ||
if (shared.isString(item)) { | ||
ret += item; | ||
} | ||
else { | ||
ret += await unrollBuffer(item); | ||
} | ||
return ret; | ||
} | ||
return ret; | ||
} | ||
else { | ||
// sync buffer can be more efficiently unrolled without unnecessary await | ||
// ticks | ||
return unrollBufferSync(buffer); | ||
} | ||
else { | ||
// sync buffer can be more efficiently unrolled without unnecessary await | ||
// ticks | ||
return unrollBufferSync(buffer); | ||
} | ||
}); | ||
} | ||
@@ -409,48 +436,54 @@ function unrollBufferSync(buffer) { | ||
} | ||
async function renderToString(input, context = {}) { | ||
if (isVNode(input)) { | ||
// raw vnode, wrap with app (for context) | ||
return renderToString(vue.createApp({ render: () => input }), context); | ||
} | ||
// 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 resolveTeleports(context); | ||
return unrollBuffer(buffer); | ||
function renderToString(input, context = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (isVNode(input)) { | ||
// raw vnode, wrap with app (for context) | ||
return renderToString(vue.createApp({ render: () => input }), context); | ||
} | ||
// 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 = yield renderComponentVNode(vnode); | ||
yield resolveTeleports(context); | ||
return unrollBuffer(buffer); | ||
}); | ||
} | ||
async function resolveTeleports(context) { | ||
if (context.__teleportBuffers) { | ||
context.teleports = context.teleports || {}; | ||
for (const key in context.__teleportBuffers) { | ||
// note: it's OK to await sequentially here because the Promises were | ||
// created eagerly in parallel. | ||
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key]))); | ||
function resolveTeleports(context) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (context.__teleportBuffers) { | ||
context.teleports = context.teleports || {}; | ||
for (const key in context.__teleportBuffers) { | ||
// note: it's OK to await sequentially here because the Promises were | ||
// created eagerly in parallel. | ||
context.teleports[key] = yield unrollBuffer((yield Promise.all(context.__teleportBuffers[key]))); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
const { isVNode: isVNode$1 } = vue.ssrUtils; | ||
async function unrollBuffer$1(buffer, stream) { | ||
if (buffer.hasAsync) { | ||
for (let i = 0; i < buffer.length; i++) { | ||
let item = buffer[i]; | ||
if (shared.isPromise(item)) { | ||
item = await item; | ||
function unrollBuffer$1(buffer, stream) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (buffer.hasAsync) { | ||
for (let i = 0; i < buffer.length; i++) { | ||
let item = buffer[i]; | ||
if (shared.isPromise(item)) { | ||
item = yield item; | ||
} | ||
if (shared.isString(item)) { | ||
stream.push(item); | ||
} | ||
else { | ||
yield unrollBuffer$1(item, stream); | ||
} | ||
} | ||
if (shared.isString(item)) { | ||
stream.push(item); | ||
} | ||
else { | ||
await unrollBuffer$1(item, stream); | ||
} | ||
} | ||
} | ||
else { | ||
// sync buffer can be more efficiently unrolled without unnecessary await | ||
// ticks | ||
unrollBufferSync$1(buffer, stream); | ||
} | ||
else { | ||
// sync buffer can be more efficiently unrolled without unnecessary await | ||
// ticks | ||
unrollBufferSync$1(buffer, stream); | ||
} | ||
}); | ||
} | ||
@@ -817,9 +850,11 @@ function unrollBufferSync$1(buffer, stream) { | ||
async function ssrRenderSuspense(push, { default: renderContent }) { | ||
if (renderContent) { | ||
renderContent(); | ||
} | ||
else { | ||
push(`<!---->`); | ||
} | ||
function ssrRenderSuspense(push, { default: renderContent }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (renderContent) { | ||
renderContent(); | ||
} | ||
else { | ||
push(`<!---->`); | ||
} | ||
}); | ||
} | ||
@@ -826,0 +861,0 @@ |
@@ -10,2 +10,27 @@ 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
} | ||
// leading comma for empty string "" | ||
@@ -201,3 +226,3 @@ const shouldIgnoreProp = shared.makeMap(`,key,ref,innerHTML,textContent`); | ||
if (!hasCloned) { | ||
attrs = { ...attrs }; | ||
attrs = Object.assign({}, attrs); | ||
hasCloned = true; | ||
@@ -219,3 +244,3 @@ } | ||
if (!hasCloned) | ||
attrs = { ...attrs }; | ||
attrs = Object.assign({}, attrs); | ||
attrs[slotScopeId.trim()] = ''; | ||
@@ -368,24 +393,26 @@ } | ||
const { isVNode } = vue.ssrUtils; | ||
async function unrollBuffer(buffer) { | ||
if (buffer.hasAsync) { | ||
let ret = ''; | ||
for (let i = 0; i < buffer.length; i++) { | ||
let item = buffer[i]; | ||
if (shared.isPromise(item)) { | ||
item = await item; | ||
function unrollBuffer(buffer) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (buffer.hasAsync) { | ||
let ret = ''; | ||
for (let i = 0; i < buffer.length; i++) { | ||
let item = buffer[i]; | ||
if (shared.isPromise(item)) { | ||
item = yield item; | ||
} | ||
if (shared.isString(item)) { | ||
ret += item; | ||
} | ||
else { | ||
ret += yield unrollBuffer(item); | ||
} | ||
} | ||
if (shared.isString(item)) { | ||
ret += item; | ||
} | ||
else { | ||
ret += await unrollBuffer(item); | ||
} | ||
return ret; | ||
} | ||
return ret; | ||
} | ||
else { | ||
// sync buffer can be more efficiently unrolled without unnecessary await | ||
// ticks | ||
return unrollBufferSync(buffer); | ||
} | ||
else { | ||
// sync buffer can be more efficiently unrolled without unnecessary await | ||
// ticks | ||
return unrollBufferSync(buffer); | ||
} | ||
}); | ||
} | ||
@@ -406,48 +433,54 @@ function unrollBufferSync(buffer) { | ||
} | ||
async function renderToString(input, context = {}) { | ||
if (isVNode(input)) { | ||
// raw vnode, wrap with app (for context) | ||
return renderToString(vue.createApp({ render: () => input }), context); | ||
} | ||
// 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 resolveTeleports(context); | ||
return unrollBuffer(buffer); | ||
function renderToString(input, context = {}) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (isVNode(input)) { | ||
// raw vnode, wrap with app (for context) | ||
return renderToString(vue.createApp({ render: () => input }), context); | ||
} | ||
// 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 = yield renderComponentVNode(vnode); | ||
yield resolveTeleports(context); | ||
return unrollBuffer(buffer); | ||
}); | ||
} | ||
async function resolveTeleports(context) { | ||
if (context.__teleportBuffers) { | ||
context.teleports = context.teleports || {}; | ||
for (const key in context.__teleportBuffers) { | ||
// note: it's OK to await sequentially here because the Promises were | ||
// created eagerly in parallel. | ||
context.teleports[key] = await unrollBuffer((await Promise.all(context.__teleportBuffers[key]))); | ||
function resolveTeleports(context) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (context.__teleportBuffers) { | ||
context.teleports = context.teleports || {}; | ||
for (const key in context.__teleportBuffers) { | ||
// note: it's OK to await sequentially here because the Promises were | ||
// created eagerly in parallel. | ||
context.teleports[key] = yield unrollBuffer((yield Promise.all(context.__teleportBuffers[key]))); | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
const { isVNode: isVNode$1 } = vue.ssrUtils; | ||
async function unrollBuffer$1(buffer, stream) { | ||
if (buffer.hasAsync) { | ||
for (let i = 0; i < buffer.length; i++) { | ||
let item = buffer[i]; | ||
if (shared.isPromise(item)) { | ||
item = await item; | ||
function unrollBuffer$1(buffer, stream) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (buffer.hasAsync) { | ||
for (let i = 0; i < buffer.length; i++) { | ||
let item = buffer[i]; | ||
if (shared.isPromise(item)) { | ||
item = yield item; | ||
} | ||
if (shared.isString(item)) { | ||
stream.push(item); | ||
} | ||
else { | ||
yield unrollBuffer$1(item, stream); | ||
} | ||
} | ||
if (shared.isString(item)) { | ||
stream.push(item); | ||
} | ||
else { | ||
await unrollBuffer$1(item, stream); | ||
} | ||
} | ||
} | ||
else { | ||
// sync buffer can be more efficiently unrolled without unnecessary await | ||
// ticks | ||
unrollBufferSync$1(buffer, stream); | ||
} | ||
else { | ||
// sync buffer can be more efficiently unrolled without unnecessary await | ||
// ticks | ||
unrollBufferSync$1(buffer, stream); | ||
} | ||
}); | ||
} | ||
@@ -570,9 +603,11 @@ function unrollBufferSync$1(buffer, stream) { | ||
async function ssrRenderSuspense(push, { default: renderContent }) { | ||
if (renderContent) { | ||
renderContent(); | ||
} | ||
else { | ||
push(`<!---->`); | ||
} | ||
function ssrRenderSuspense(push, { default: renderContent }) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (renderContent) { | ||
renderContent(); | ||
} | ||
else { | ||
push(`<!---->`); | ||
} | ||
}); | ||
} | ||
@@ -579,0 +614,0 @@ |
{ | ||
"name": "@vue/server-renderer", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"description": "@vue/server-renderer", | ||
@@ -31,8 +31,8 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"vue": "3.1.3" | ||
"vue": "3.1.4" | ||
}, | ||
"dependencies": { | ||
"@vue/shared": "3.1.3", | ||
"@vue/compiler-ssr": "3.1.3" | ||
"@vue/shared": "3.1.4", | ||
"@vue/compiler-ssr": "3.1.4" | ||
} | ||
} |
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
63107
1583
+ Added@vue/compiler-core@3.1.4(transitive)
+ Added@vue/compiler-dom@3.1.4(transitive)
+ Added@vue/compiler-ssr@3.1.4(transitive)
+ Added@vue/reactivity@3.1.4(transitive)
+ Added@vue/runtime-core@3.1.4(transitive)
+ Added@vue/runtime-dom@3.1.4(transitive)
+ Added@vue/shared@3.1.4(transitive)
+ Addedvue@3.1.4(transitive)
- Removed@vue/compiler-core@3.1.3(transitive)
- Removed@vue/compiler-dom@3.1.3(transitive)
- Removed@vue/compiler-ssr@3.1.3(transitive)
- Removed@vue/reactivity@3.1.3(transitive)
- Removed@vue/runtime-core@3.1.3(transitive)
- Removed@vue/runtime-dom@3.1.3(transitive)
- Removed@vue/shared@3.1.3(transitive)
- Removedvue@3.1.3(transitive)
Updated@vue/compiler-ssr@3.1.4
Updated@vue/shared@3.1.4