@lwc/ssr-runtime 8.12.3 → 8.12.4

Sign up to get free protection for your applications and to get access to all the features.
package/LICENSE.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  MIT LICENSE
4
4
 
5
- Copyright (c) 2024, Salesforce, Inc.
5
+ Copyright (c) 2025, Salesforce, Inc.
6
6
  All rights reserved.
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
package/dist/index.cjs.js CHANGED
@@ -631,7 +631,7 @@ function setHooks(hooks) {
631
631
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
632
632
  */
633
633
  const DEFAULT_SSR_MODE = 'sync';
634
- /** version: 8.12.3 */
634
+ /** version: 8.12.4 */
635
635
 
636
636
  /*
637
637
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1218,24 +1218,6 @@ const mutationTracker = new MutationTracker();
1218
1218
  * SPDX-License-Identifier: MIT
1219
1219
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1220
1220
  */
1221
- /**
1222
- * Filters out the following types of properties that should not be set.
1223
- * - Properties that are not public.
1224
- * - Properties that are not global.
1225
- * - Properties that are global but are internally overridden.
1226
- */
1227
- function filterProperties(props, publicFields, privateFields) {
1228
- const propsToAssign = create(null);
1229
- for (const propName of keys(props)) {
1230
- const attrName = htmlPropertyToAttribute(propName);
1231
- if (publicFields.has(propName) ||
1232
- ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
1233
- !privateFields.has(propName))) {
1234
- propsToAssign[propName] = props[propName];
1235
- }
1236
- }
1237
- return propsToAssign;
1238
- }
1239
1221
  /**
1240
1222
  * Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
1241
1223
  */
@@ -1371,10 +1353,21 @@ class LightningElement {
1371
1353
  _LightningElement_classList.set(this, null);
1372
1354
  assign(this, propsAvailableAtConstruction);
1373
1355
  }
1374
- [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
1356
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicFields, privateFields) {
1375
1357
  __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1376
1358
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
1377
- assign(this, props);
1359
+ // Avoid setting the following types of properties that should not be set:
1360
+ // - Properties that are not public.
1361
+ // - Properties that are not global.
1362
+ // - Properties that are global but are internally overridden.
1363
+ for (const propName of keys(props)) {
1364
+ const attrName = htmlPropertyToAttribute(propName);
1365
+ if (publicFields.has(propName) ||
1366
+ ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
1367
+ !privateFields.has(propName))) {
1368
+ this[propName] = props[propName];
1369
+ }
1370
+ }
1378
1371
  }
1379
1372
  get className() {
1380
1373
  return __classPrivateFieldGet(this, _LightningElement_props, "f").class ?? '';
@@ -1591,14 +1584,27 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
1591
1584
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1592
1585
  */
1593
1586
  /**
1594
- * Given an object, render it for use as a text content node.
1587
+ * Given an object, render it for use as a text content node. Not that this applies to individual text nodes,
1588
+ * not the concatenated result of multiple adjacent text nodes.
1595
1589
  * @param value
1596
1590
  */
1597
- function massageTextContent(value) {
1591
+ function normalizeTextContent(value) {
1598
1592
  // Using non strict equality to align with original implementation (ex. undefined == null)
1599
1593
  // See: https://github.com/salesforce/lwc/blob/348130f/packages/%40lwc/engine-core/src/framework/api.ts#L548
1600
1594
  return value == null ? '' : String(value);
1601
1595
  }
1596
+ /**
1597
+ * Given a string, render it for use as text content in HTML. Notably this escapes HTML and renders as
1598
+ * a ZWJ is empty. Intended to be used on the result of concatenating multiple adjacent text nodes together.
1599
+ * @param value
1600
+ */
1601
+ function renderTextContent(value) {
1602
+ // We are at the end of a series of text nodes - flush to a concatenated string
1603
+ // We only render the ZWJ if there were actually any dynamic text nodes rendered
1604
+ // The ZWJ is just so hydration can compare the SSR'd dynamic text content against
1605
+ // the CSR'd text content.
1606
+ return value === '' ? '\u200D' : htmlEscape(value);
1607
+ }
1602
1608
 
1603
1609
  /*
1604
1610
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1798,7 +1804,6 @@ exports.createElement = createElement;
1798
1804
  exports.establishContextfulRelationship = establishContextfulRelationship;
1799
1805
  exports.fallbackTmpl = fallbackTmpl;
1800
1806
  exports.fallbackTmplNoYield = fallbackTmplNoYield;
1801
- exports.filterProperties = filterProperties;
1802
1807
  exports.freezeTemplate = freezeTemplate;
1803
1808
  exports.getComponentDef = getComponentDef;
1804
1809
  exports.getReadOnlyProxy = getReadOnlyProxy;
@@ -1806,9 +1811,9 @@ exports.hasScopedStaticStylesheets = hasScopedStaticStylesheets;
1806
1811
  exports.hot = hot;
1807
1812
  exports.htmlEscape = htmlEscape;
1808
1813
  exports.isComponentConstructor = isComponentConstructor;
1809
- exports.massageTextContent = massageTextContent;
1810
1814
  exports.mutationTracker = mutationTracker;
1811
1815
  exports.normalizeClass = normalizeClass;
1816
+ exports.normalizeTextContent = normalizeTextContent;
1812
1817
  exports.parseFragment = parseFragment;
1813
1818
  exports.parseSVGFragment = parseSVGFragment;
1814
1819
  exports.readonly = readonly;
@@ -1819,6 +1824,7 @@ exports.renderAttrs = renderAttrs;
1819
1824
  exports.renderAttrsNoYield = renderAttrsNoYield;
1820
1825
  exports.renderComponent = serverSideRenderComponent;
1821
1826
  exports.renderStylesheets = renderStylesheets;
1827
+ exports.renderTextContent = renderTextContent;
1822
1828
  exports.renderer = renderer;
1823
1829
  exports.sanitizeAttribute = sanitizeAttribute;
1824
1830
  exports.serverSideRenderComponent = serverSideRenderComponent;
@@ -1833,5 +1839,5 @@ exports.track = track;
1833
1839
  exports.unwrap = unwrap$1;
1834
1840
  exports.validateStyleTextContents = validateStyleTextContents;
1835
1841
  exports.wire = wire;
1836
- /** version: 8.12.3 */
1842
+ /** version: 8.12.4 */
1837
1843
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -4,9 +4,8 @@ export { ClassList } from './class-list';
4
4
  export { getReadOnlyProxy } from './get-read-only-proxy';
5
5
  export { LightningElement, LightningElementConstructor, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, } from './lightning-element';
6
6
  export { mutationTracker } from './mutation-tracker';
7
- export { filterProperties } from './reflection';
8
7
  export { fallbackTmpl, fallbackTmplNoYield, GenerateMarkupFn, renderAttrs, renderAttrsNoYield, serverSideRenderComponent, serverSideRenderComponent as renderComponent, } from './render';
9
- export { massageTextContent } from './render-text-content';
8
+ export { normalizeTextContent, renderTextContent } from './render-text-content';
10
9
  export { hasScopedStaticStylesheets, renderStylesheets } from './styles';
11
10
  export { toIteratorDirective } from './to-iterator-directive';
12
11
  export { validateStyleTextContents } from './validate-style-text-contents';
package/dist/index.js CHANGED
@@ -627,7 +627,7 @@ function setHooks(hooks) {
627
627
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
628
628
  */
629
629
  const DEFAULT_SSR_MODE = 'sync';
630
- /** version: 8.12.3 */
630
+ /** version: 8.12.4 */
631
631
 
632
632
  /*
633
633
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1214,24 +1214,6 @@ const mutationTracker = new MutationTracker();
1214
1214
  * SPDX-License-Identifier: MIT
1215
1215
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1216
1216
  */
1217
- /**
1218
- * Filters out the following types of properties that should not be set.
1219
- * - Properties that are not public.
1220
- * - Properties that are not global.
1221
- * - Properties that are global but are internally overridden.
1222
- */
1223
- function filterProperties(props, publicFields, privateFields) {
1224
- const propsToAssign = create(null);
1225
- for (const propName of keys(props)) {
1226
- const attrName = htmlPropertyToAttribute(propName);
1227
- if (publicFields.has(propName) ||
1228
- ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
1229
- !privateFields.has(propName))) {
1230
- propsToAssign[propName] = props[propName];
1231
- }
1232
- }
1233
- return propsToAssign;
1234
- }
1235
1217
  /**
1236
1218
  * Descriptor for IDL attribute reflections that merely reflect the string, e.g. `title`.
1237
1219
  */
@@ -1367,10 +1349,21 @@ class LightningElement {
1367
1349
  _LightningElement_classList.set(this, null);
1368
1350
  assign(this, propsAvailableAtConstruction);
1369
1351
  }
1370
- [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs) {
1352
+ [(_LightningElement_props = new WeakMap(), _LightningElement_attrs = new WeakMap(), _LightningElement_classList = new WeakMap(), SYMBOL__SET_INTERNALS)](props, attrs, publicFields, privateFields) {
1371
1353
  __classPrivateFieldSet(this, _LightningElement_props, props, "f");
1372
1354
  __classPrivateFieldSet(this, _LightningElement_attrs, attrs, "f");
1373
- assign(this, props);
1355
+ // Avoid setting the following types of properties that should not be set:
1356
+ // - Properties that are not public.
1357
+ // - Properties that are not global.
1358
+ // - Properties that are global but are internally overridden.
1359
+ for (const propName of keys(props)) {
1360
+ const attrName = htmlPropertyToAttribute(propName);
1361
+ if (publicFields.has(propName) ||
1362
+ ((REFLECTIVE_GLOBAL_PROPERTY_SET.has(propName) || isAriaAttribute(attrName)) &&
1363
+ !privateFields.has(propName))) {
1364
+ this[propName] = props[propName];
1365
+ }
1366
+ }
1374
1367
  }
1375
1368
  get className() {
1376
1369
  return __classPrivateFieldGet(this, _LightningElement_props, "f").class ?? '';
@@ -1587,14 +1580,27 @@ async function serverSideRenderComponent(tagName, Component, props = {}, mode =
1587
1580
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1588
1581
  */
1589
1582
  /**
1590
- * Given an object, render it for use as a text content node.
1583
+ * Given an object, render it for use as a text content node. Not that this applies to individual text nodes,
1584
+ * not the concatenated result of multiple adjacent text nodes.
1591
1585
  * @param value
1592
1586
  */
1593
- function massageTextContent(value) {
1587
+ function normalizeTextContent(value) {
1594
1588
  // Using non strict equality to align with original implementation (ex. undefined == null)
1595
1589
  // See: https://github.com/salesforce/lwc/blob/348130f/packages/%40lwc/engine-core/src/framework/api.ts#L548
1596
1590
  return value == null ? '' : String(value);
1597
1591
  }
1592
+ /**
1593
+ * Given a string, render it for use as text content in HTML. Notably this escapes HTML and renders as
1594
+ * a ZWJ is empty. Intended to be used on the result of concatenating multiple adjacent text nodes together.
1595
+ * @param value
1596
+ */
1597
+ function renderTextContent(value) {
1598
+ // We are at the end of a series of text nodes - flush to a concatenated string
1599
+ // We only render the ZWJ if there were actually any dynamic text nodes rendered
1600
+ // The ZWJ is just so hydration can compare the SSR'd dynamic text content against
1601
+ // the CSR'd text content.
1602
+ return value === '' ? '\u200D' : htmlEscape(value);
1603
+ }
1598
1604
 
1599
1605
  /*
1600
1606
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1782,6 +1788,6 @@ function createContextProvider(adapter) {
1782
1788
  };
1783
1789
  }
1784
1790
 
1785
- 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, massageTextContent, mutationTracker, normalizeClass, 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 };
1786
- /** version: 8.12.3 */
1791
+ export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef, getReadOnlyProxy, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, normalizeClass, normalizeTextContent, parseFragment, parseSVGFragment, readonly, registerComponent, registerDecorators, registerTemplate, renderAttrs, renderAttrsNoYield, serverSideRenderComponent as renderComponent, renderStylesheets, renderTextContent, renderer, sanitizeAttribute, sanitizeHtmlContent, serverSideRenderComponent, setFeatureFlag, setFeatureFlagForTest, setHooks, swapComponent, swapStyle, swapTemplate, toIteratorDirective, track, unwrap$1 as unwrap, validateStyleTextContents, wire };
1792
+ /** version: 8.12.4 */
1787
1793
  //# sourceMappingURL=index.js.map
@@ -29,7 +29,7 @@ export declare class LightningElement implements PropsAvailableAtConstruction {
29
29
  isConnected: boolean;
30
30
  tagName: string;
31
31
  constructor(propsAvailableAtConstruction: PropsAvailableAtConstruction & Properties);
32
- [SYMBOL__SET_INTERNALS](props: Properties, attrs: Attributes): void;
32
+ [SYMBOL__SET_INTERNALS](props: Properties, attrs: Attributes, publicFields: Set<string>, privateFields: Set<string>): void;
33
33
  get className(): any;
34
34
  set className(newVal: any);
35
35
  get classList(): ClassList;
@@ -1,9 +1,2 @@
1
- /**
2
- * Filters out the following types of properties that should not be set.
3
- * - Properties that are not public.
4
- * - Properties that are not global.
5
- * - Properties that are global but are internally overridden.
6
- */
7
- export declare function filterProperties(props: Record<string, unknown>, publicFields: Set<string>, privateFields: Set<string>): Record<string, unknown>;
8
1
  export declare const descriptors: Record<string, PropertyDescriptor>;
9
2
  //# sourceMappingURL=reflection.d.ts.map
@@ -1,6 +1,13 @@
1
1
  /**
2
- * Given an object, render it for use as a text content node.
2
+ * Given an object, render it for use as a text content node. Not that this applies to individual text nodes,
3
+ * not the concatenated result of multiple adjacent text nodes.
3
4
  * @param value
4
5
  */
5
- export declare function massageTextContent(value: unknown): string;
6
+ export declare function normalizeTextContent(value: unknown): string;
7
+ /**
8
+ * Given a string, render it for use as text content in HTML. Notably this escapes HTML and renders as
9
+ * a ZWJ is empty. Intended to be used on the result of concatenating multiple adjacent text nodes together.
10
+ * @param value
11
+ */
12
+ export declare function renderTextContent(value: string): string;
6
13
  //# sourceMappingURL=render-text-content.d.ts.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
5
5
  ],
6
6
  "name": "@lwc/ssr-runtime",
7
- "version": "8.12.3",
7
+ "version": "8.12.4",
8
8
  "description": "Runtime complement to @lwc/ssr-compiler",
9
9
  "keywords": [
10
10
  "lwc",
@@ -48,8 +48,8 @@
48
48
  }
49
49
  },
50
50
  "devDependencies": {
51
- "@lwc/shared": "8.12.3",
52
- "@lwc/engine-core": "8.12.3",
51
+ "@lwc/shared": "8.12.4",
52
+ "@lwc/engine-core": "8.12.4",
53
53
  "observable-membrane": "2.0.0"
54
54
  }
55
55
  }