@lwc/ssr-runtime 8.10.0 → 8.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +60 -39
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +60 -39
- package/dist/index.js.map +1 -1
- package/dist/render.d.ts +6 -6
- package/dist/styles.d.ts +4 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -258,24 +258,44 @@ defineProperties,
|
|
258
258
|
defineProperty,
|
259
259
|
/** Detached {@linkcode Object.entries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries MDN Reference}. */
|
260
260
|
entries,
|
261
|
+
/** Detached {@linkcode Object.freeze}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze MDN Reference}. */
|
262
|
+
freeze,
|
263
|
+
/** Detached {@linkcode Object.fromEntries}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/fromEntries MDN Reference}. */
|
264
|
+
fromEntries,
|
265
|
+
/** Detached {@linkcode Object.getOwnPropertyDescriptor}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor MDN Reference}. */
|
266
|
+
getOwnPropertyDescriptor: getOwnPropertyDescriptor$1,
|
267
|
+
/** Detached {@linkcode Object.getOwnPropertyDescriptors}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptors MDN Reference}. */
|
268
|
+
getOwnPropertyDescriptors,
|
261
269
|
/** Detached {@linkcode Object.getOwnPropertyNames}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames MDN Reference}. */
|
262
270
|
getOwnPropertyNames: getOwnPropertyNames$1,
|
271
|
+
/** Detached {@linkcode Object.getOwnPropertySymbols}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols MDN Reference}. */
|
272
|
+
getOwnPropertySymbols: getOwnPropertySymbols$1,
|
273
|
+
/** Detached {@linkcode Object.getPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getPrototypeOf MDN Reference}. */
|
274
|
+
getPrototypeOf: getPrototypeOf$1,
|
263
275
|
/** Detached {@linkcode Object.hasOwnProperty}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty MDN Reference}. */
|
264
276
|
hasOwnProperty: hasOwnProperty$1,
|
277
|
+
/** Detached {@linkcode Object.isFrozen}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen MDN Reference}. */
|
278
|
+
isFrozen,
|
265
279
|
/** Detached {@linkcode Object.keys}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys MDN Reference}. */
|
266
|
-
keys
|
280
|
+
keys,
|
281
|
+
/** Detached {@linkcode Object.seal}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/seal MDN Reference}. */
|
282
|
+
seal,
|
283
|
+
/** Detached {@linkcode Object.setPrototypeOf}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf MDN Reference}. */
|
284
|
+
setPrototypeOf, } = Object;
|
267
285
|
const {
|
268
286
|
/** Detached {@linkcode Array.isArray}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray MDN Reference}. */
|
269
|
-
isArray: isArray$1
|
287
|
+
isArray: isArray$1,
|
288
|
+
/** Detached {@linkcode Array.from}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from MDN Reference}. */
|
289
|
+
from: ArrayFrom, } = Array;
|
270
290
|
// For some reason, JSDoc don't get picked up for multiple renamed destructured constants (even
|
271
291
|
// though it works fine for one, e.g. isArray), so comments for these are added to the export
|
272
292
|
// statement, rather than this declaration.
|
273
|
-
const { join: ArrayJoin, map: ArrayMap, forEach, // Weird anomaly!
|
293
|
+
const { concat: ArrayConcat$1, copyWithin: ArrayCopyWithin, every: ArrayEvery, fill: ArrayFill, filter: ArrayFilter, find: ArrayFind, findIndex: ArrayFindIndex, includes: ArrayIncludes, indexOf: ArrayIndexOf, join: ArrayJoin, map: ArrayMap, pop: ArrayPop, push: ArrayPush$1, reduce: ArrayReduce, reverse: ArrayReverse, shift: ArrayShift, slice: ArraySlice, some: ArraySome, sort: ArraySort, splice: ArraySplice, unshift: ArrayUnshift, forEach, // Weird anomaly!
|
274
294
|
} = Array.prototype;
|
275
295
|
/** Detached {@linkcode String.fromCharCode}; see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode MDN Reference}. */
|
276
296
|
const { fromCharCode: StringFromCharCode } = String;
|
277
297
|
// No JSDocs here - see comment for Array.prototype
|
278
|
-
const { charCodeAt: StringCharCodeAt, replace: StringReplace, toLowerCase: StringToLowerCase} = String.prototype;
|
298
|
+
const { charAt: StringCharAt, charCodeAt: StringCharCodeAt, replace: StringReplace, split: StringSplit, slice: StringSlice, toLowerCase: StringToLowerCase, trim: StringTrim, } = String.prototype;
|
279
299
|
/**
|
280
300
|
* Determines whether the argument is `undefined`.
|
281
301
|
* @param obj Value to test
|
@@ -567,18 +587,6 @@ function setHooks(hooks) {
|
|
567
587
|
hooksAreSet = true;
|
568
588
|
sanitizeHtmlContent = hooks.sanitizeHtmlContent;
|
569
589
|
}
|
570
|
-
function flattenStylesheets(stylesheets) {
|
571
|
-
const list = [];
|
572
|
-
for (const stylesheet of stylesheets) {
|
573
|
-
if (!isArray$1(stylesheet)) {
|
574
|
-
list.push(stylesheet);
|
575
|
-
}
|
576
|
-
else {
|
577
|
-
list.push(...flattenStylesheets(stylesheet));
|
578
|
-
}
|
579
|
-
}
|
580
|
-
return list;
|
581
|
-
}
|
582
590
|
|
583
591
|
/*
|
584
592
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -587,7 +595,7 @@ function flattenStylesheets(stylesheets) {
|
|
587
595
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
588
596
|
*/
|
589
597
|
const DEFAULT_SSR_MODE = 'sync';
|
590
|
-
/** version: 8.
|
598
|
+
/** version: 8.11.0 */
|
591
599
|
|
592
600
|
/*
|
593
601
|
* Copyright (c) 2024, Salesforce, Inc.
|
@@ -1068,12 +1076,12 @@ function* renderAttrs(instance, attrs, hostScopeToken, scopeToken) {
|
|
1068
1076
|
function renderAttrsNoYield(emit, instance, attrs, hostScopeToken, scopeToken) {
|
1069
1077
|
emit(renderAttrsPrivate(instance, attrs, hostScopeToken, scopeToken));
|
1070
1078
|
}
|
1071
|
-
function* fallbackTmpl(_props, _attrs,
|
1079
|
+
function* fallbackTmpl(_props, _attrs, _shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
|
1072
1080
|
if (Cmp.renderMode !== 'light') {
|
1073
1081
|
yield '<template shadowrootmode="open"></template>';
|
1074
1082
|
}
|
1075
1083
|
}
|
1076
|
-
function fallbackTmplNoYield(emit, _props, _attrs,
|
1084
|
+
function fallbackTmplNoYield(emit, _props, _attrs, _shadowSlottedContent, _lightSlottedContent, Cmp, _instance) {
|
1077
1085
|
if (Cmp.renderMode !== 'light') {
|
1078
1086
|
emit('<template shadowrootmode="open"></template>');
|
1079
1087
|
}
|
@@ -1082,22 +1090,21 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
|
|
1082
1090
|
if (typeof tagName !== 'string') {
|
1083
1091
|
throw new Error(`tagName must be a string, found: ${tagName}`);
|
1084
1092
|
}
|
1085
|
-
|
1086
|
-
const generateMarkup = SYMBOL__GENERATE_MARKUP in Component ? Component[SYMBOL__GENERATE_MARKUP] : Component;
|
1093
|
+
const generateMarkup = Component[SYMBOL__GENERATE_MARKUP];
|
1087
1094
|
let markup = '';
|
1088
1095
|
const emit = (segment) => {
|
1089
1096
|
markup += segment;
|
1090
1097
|
};
|
1091
1098
|
if (mode === 'asyncYield') {
|
1092
|
-
for await (const segment of generateMarkup(tagName, props, null, null)) {
|
1099
|
+
for await (const segment of generateMarkup(tagName, props, null, null, null)) {
|
1093
1100
|
markup += segment;
|
1094
1101
|
}
|
1095
1102
|
}
|
1096
1103
|
else if (mode === 'async') {
|
1097
|
-
await generateMarkup(emit, tagName, props, null, null);
|
1104
|
+
await generateMarkup(emit, tagName, props, null, null, null);
|
1098
1105
|
}
|
1099
1106
|
else if (mode === 'sync') {
|
1100
|
-
generateMarkup(emit, tagName, props, null, null);
|
1107
|
+
generateMarkup(emit, tagName, props, null, null, null);
|
1101
1108
|
}
|
1102
1109
|
else {
|
1103
1110
|
throw new Error(`Invalid mode: ${mode}`);
|
@@ -1159,27 +1166,41 @@ function validateStyleTextContents(contents) {
|
|
1159
1166
|
* SPDX-License-Identifier: MIT
|
1160
1167
|
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
|
1161
1168
|
*/
|
1162
|
-
|
1163
|
-
|
1164
|
-
if (stylesheets) {
|
1165
|
-
|
1169
|
+
// Traverse in the same order as `flattenStylesheets` but without creating unnecessary additional arrays
|
1170
|
+
function traverseStylesheets(stylesheets, callback) {
|
1171
|
+
if (isArray$1(stylesheets)) {
|
1172
|
+
for (let i = 0; i < stylesheets.length; i++) {
|
1173
|
+
traverseStylesheets(stylesheets[i], callback);
|
1174
|
+
}
|
1175
|
+
}
|
1176
|
+
else if (stylesheets) {
|
1177
|
+
callback(stylesheets);
|
1166
1178
|
}
|
1167
|
-
return false;
|
1168
1179
|
}
|
1169
|
-
function
|
1180
|
+
function hasScopedStaticStylesheets(Component) {
|
1181
|
+
let scoped = false;
|
1182
|
+
traverseStylesheets(Component.stylesheets, (stylesheet) => {
|
1183
|
+
scoped ||= !!stylesheet.$scoped$;
|
1184
|
+
});
|
1185
|
+
return scoped;
|
1186
|
+
}
|
1187
|
+
function renderStylesheets(defaultStylesheets, defaultScopedStylesheets, staticStylesheets, scopeToken, Component, hasScopedTemplateStyles) {
|
1170
1188
|
const hasAnyScopedStyles = hasScopedTemplateStyles || hasScopedStaticStylesheets(Component);
|
1189
|
+
const { renderMode } = Component;
|
1171
1190
|
let result = '';
|
1172
|
-
const
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
const token = stylesheet.$scoped$ ? scopeToken : undefined;
|
1177
|
-
const useActualHostSelector = !stylesheet.$scoped$ || Component.renderMode !== 'light';
|
1191
|
+
const renderStylesheet = (stylesheet) => {
|
1192
|
+
const { $scoped$: scoped } = stylesheet;
|
1193
|
+
const token = scoped ? scopeToken : undefined;
|
1194
|
+
const useActualHostSelector = !scoped || renderMode !== 'light';
|
1178
1195
|
const useNativeDirPseudoclass = true;
|
1179
1196
|
const styleContents = stylesheet(token, useActualHostSelector, useNativeDirPseudoclass);
|
1180
1197
|
validateStyleTextContents(styleContents);
|
1181
|
-
|
1182
|
-
|
1198
|
+
// TODO [#2869]: `<style>`s should not have scope token classes
|
1199
|
+
result += `<style${hasAnyScopedStyles ? ` class="${scopeToken}"` : ''} type="text/css">${styleContents}</style>`;
|
1200
|
+
};
|
1201
|
+
traverseStylesheets(defaultStylesheets, renderStylesheet);
|
1202
|
+
traverseStylesheets(defaultScopedStylesheets, renderStylesheet);
|
1203
|
+
traverseStylesheets(staticStylesheets, renderStylesheet);
|
1183
1204
|
return result;
|
1184
1205
|
}
|
1185
1206
|
|
@@ -1837,5 +1858,5 @@ function createContextProvider(adapter) {
|
|
1837
1858
|
}
|
1838
1859
|
|
1839
1860
|
export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, filterProperties, freezeTemplate, getComponentDef, getReadOnlyProxy, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
|
1840
|
-
/** version: 8.
|
1861
|
+
/** version: 8.11.0 */
|
1841
1862
|
//# sourceMappingURL=index.js.map
|