@lwc/ssr-runtime 8.17.0-alpha.1 → 8.17.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 CHANGED
@@ -624,7 +624,7 @@ function normalizeTabIndex(value) {
624
624
  const shouldNormalize = value > 0 && typeof value !== 'boolean';
625
625
  return shouldNormalize ? 0 : value;
626
626
  }
627
- /** version: 8.16.2 */
627
+ /** version: 8.17.0 */
628
628
 
629
629
  /*
630
630
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1575,14 +1575,37 @@ function fallbackTmplNoYield(emit, shadowSlottedContent, _lightSlottedContent, _
1575
1575
  }
1576
1576
  }
1577
1577
  class RenderContext {
1578
- constructor(styleDedupePrefix, styleDedupeIsEnabled) {
1578
+ constructor(styleDedupe) {
1579
1579
  this.stylesheetToId = new WeakMap();
1580
1580
  this.nextId = 0;
1581
- this.styleDedupeIsEnabled = styleDedupeIsEnabled;
1582
- this.styleDedupePrefix = styleDedupePrefix;
1581
+ if (styleDedupe || styleDedupe === '') {
1582
+ this.styleDedupePrefix = typeof styleDedupe === 'string' ? styleDedupe : '';
1583
+ this.styleDedupeIsEnabled = true;
1584
+ }
1585
+ else {
1586
+ this.styleDedupePrefix = '';
1587
+ this.styleDedupeIsEnabled = false;
1588
+ }
1583
1589
  }
1584
1590
  }
1585
- async function serverSideRenderComponent(tagName, Component, props = {}, styleDedupePrefix = '', styleDedupeIsEnabled = false, mode = DEFAULT_SSR_MODE) {
1591
+ /**
1592
+ * Create a string representing an LWC component for server-side rendering.
1593
+ * @param tagName The HTML tag name of the component
1594
+ * @param Component The `LightningElement` component constructor
1595
+ * @param props HTML attributes to provide for the root component
1596
+ * @param styleDedupe Provide a string key or `true` to enable style deduping via the `<lwc-style>`
1597
+ * helper. The key is used to avoid collisions of global IDs.
1598
+ * @param mode SSR render mode. Can be 'sync', 'async' or 'asyncYield'. Must match the render mode
1599
+ * used to compile your component.
1600
+ * @returns String representation of the component
1601
+ */
1602
+ async function serverSideRenderComponent(tagName, Component, props = {}, styleDedupe = false, mode = DEFAULT_SSR_MODE) {
1603
+ // TODO [#5309]: Remove this warning after a single release
1604
+ if (process.env.NODE_ENV !== 'production') {
1605
+ if (arguments.length === 6 || !['sync', 'async', 'asyncYield'].includes(mode)) {
1606
+ throw new Error("The signature for @lwc/ssr-runtime's `renderComponent` has changed. There is now only one parameter for style dedupe.");
1607
+ }
1608
+ }
1586
1609
  if (typeof tagName !== 'string') {
1587
1610
  throw new Error(`tagName must be a string, found: ${tagName}`);
1588
1611
  }
@@ -1591,7 +1614,7 @@ async function serverSideRenderComponent(tagName, Component, props = {}, styleDe
1591
1614
  const emit = (segment) => {
1592
1615
  markup += segment;
1593
1616
  };
1594
- emit.cxt = new RenderContext(styleDedupePrefix, styleDedupeIsEnabled);
1617
+ emit.cxt = new RenderContext(styleDedupe);
1595
1618
  if (!generateMarkup) {
1596
1619
  // If a non-component is accidentally provided, render an empty template
1597
1620
  emit(`<${tagName}>`);
@@ -1899,5 +1922,5 @@ exports.track = track;
1899
1922
  exports.unwrap = unwrap$1;
1900
1923
  exports.validateStyleTextContents = validateStyleTextContents;
1901
1924
  exports.wire = wire;
1902
- /** version: 8.16.2 */
1925
+ /** version: 8.17.0 */
1903
1926
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.js CHANGED
@@ -620,7 +620,7 @@ function normalizeTabIndex(value) {
620
620
  const shouldNormalize = value > 0 && typeof value !== 'boolean';
621
621
  return shouldNormalize ? 0 : value;
622
622
  }
623
- /** version: 8.16.2 */
623
+ /** version: 8.17.0 */
624
624
 
625
625
  /*
626
626
  * Copyright (c) 2024, Salesforce, Inc.
@@ -1571,14 +1571,37 @@ function fallbackTmplNoYield(emit, shadowSlottedContent, _lightSlottedContent, _
1571
1571
  }
1572
1572
  }
1573
1573
  class RenderContext {
1574
- constructor(styleDedupePrefix, styleDedupeIsEnabled) {
1574
+ constructor(styleDedupe) {
1575
1575
  this.stylesheetToId = new WeakMap();
1576
1576
  this.nextId = 0;
1577
- this.styleDedupeIsEnabled = styleDedupeIsEnabled;
1578
- this.styleDedupePrefix = styleDedupePrefix;
1577
+ if (styleDedupe || styleDedupe === '') {
1578
+ this.styleDedupePrefix = typeof styleDedupe === 'string' ? styleDedupe : '';
1579
+ this.styleDedupeIsEnabled = true;
1580
+ }
1581
+ else {
1582
+ this.styleDedupePrefix = '';
1583
+ this.styleDedupeIsEnabled = false;
1584
+ }
1579
1585
  }
1580
1586
  }
1581
- async function serverSideRenderComponent(tagName, Component, props = {}, styleDedupePrefix = '', styleDedupeIsEnabled = false, mode = DEFAULT_SSR_MODE) {
1587
+ /**
1588
+ * Create a string representing an LWC component for server-side rendering.
1589
+ * @param tagName The HTML tag name of the component
1590
+ * @param Component The `LightningElement` component constructor
1591
+ * @param props HTML attributes to provide for the root component
1592
+ * @param styleDedupe Provide a string key or `true` to enable style deduping via the `<lwc-style>`
1593
+ * helper. The key is used to avoid collisions of global IDs.
1594
+ * @param mode SSR render mode. Can be 'sync', 'async' or 'asyncYield'. Must match the render mode
1595
+ * used to compile your component.
1596
+ * @returns String representation of the component
1597
+ */
1598
+ async function serverSideRenderComponent(tagName, Component, props = {}, styleDedupe = false, mode = DEFAULT_SSR_MODE) {
1599
+ // TODO [#5309]: Remove this warning after a single release
1600
+ if (process.env.NODE_ENV !== 'production') {
1601
+ if (arguments.length === 6 || !['sync', 'async', 'asyncYield'].includes(mode)) {
1602
+ throw new Error("The signature for @lwc/ssr-runtime's `renderComponent` has changed. There is now only one parameter for style dedupe.");
1603
+ }
1604
+ }
1582
1605
  if (typeof tagName !== 'string') {
1583
1606
  throw new Error(`tagName must be a string, found: ${tagName}`);
1584
1607
  }
@@ -1587,7 +1610,7 @@ async function serverSideRenderComponent(tagName, Component, props = {}, styleDe
1587
1610
  const emit = (segment) => {
1588
1611
  markup += segment;
1589
1612
  };
1590
- emit.cxt = new RenderContext(styleDedupePrefix, styleDedupeIsEnabled);
1613
+ emit.cxt = new RenderContext(styleDedupe);
1591
1614
  if (!generateMarkup) {
1592
1615
  // If a non-component is accidentally provided, render an empty template
1593
1616
  emit(`<${tagName}>`);
@@ -1849,5 +1872,5 @@ function createContextProvider(adapter) {
1849
1872
  }
1850
1873
 
1851
1874
  export { ClassList, LightningElement, SYMBOL__DEFAULT_TEMPLATE, SYMBOL__GENERATE_MARKUP, SYMBOL__SET_INTERNALS, api, connectContext, createContextProvider, createElement, establishContextfulRelationship, fallbackTmpl, fallbackTmplNoYield, freezeTemplate, getComponentDef, hasScopedStaticStylesheets, hot, htmlEscape, isComponentConstructor, mutationTracker, normalizeClass, normalizeTabIndex, 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 };
1852
- /** version: 8.16.2 */
1875
+ /** version: 8.17.0 */
1853
1876
  //# sourceMappingURL=index.js.map
package/dist/render.d.ts CHANGED
@@ -53,11 +53,22 @@ interface ComponentWithGenerateMarkup extends LightningElementConstructor {
53
53
  }
54
54
  export declare class RenderContext {
55
55
  styleDedupeIsEnabled: boolean;
56
- stylesheetToId: WeakMap<Stylesheet, string>;
57
56
  styleDedupePrefix: string;
57
+ stylesheetToId: WeakMap<Stylesheet, string>;
58
58
  nextId: number;
59
- constructor(styleDedupePrefix: string, styleDedupeIsEnabled: boolean);
59
+ constructor(styleDedupe: string | boolean);
60
60
  }
61
- export declare function serverSideRenderComponent(tagName: string, Component: ComponentWithGenerateMarkup, props?: Properties, styleDedupePrefix?: string, styleDedupeIsEnabled?: boolean, mode?: CompilationMode): Promise<string>;
61
+ /**
62
+ * Create a string representing an LWC component for server-side rendering.
63
+ * @param tagName The HTML tag name of the component
64
+ * @param Component The `LightningElement` component constructor
65
+ * @param props HTML attributes to provide for the root component
66
+ * @param styleDedupe Provide a string key or `true` to enable style deduping via the `<lwc-style>`
67
+ * helper. The key is used to avoid collisions of global IDs.
68
+ * @param mode SSR render mode. Can be 'sync', 'async' or 'asyncYield'. Must match the render mode
69
+ * used to compile your component.
70
+ * @returns String representation of the component
71
+ */
72
+ export declare function serverSideRenderComponent(tagName: string, Component: ComponentWithGenerateMarkup, props?: Properties, styleDedupe?: string | boolean, mode?: CompilationMode): Promise<string>;
62
73
  export {};
63
74
  //# sourceMappingURL=render.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.17.0-alpha.1",
7
+ "version": "8.17.0",
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.17.0-alpha.1",
52
- "@lwc/engine-core": "8.17.0-alpha.1",
51
+ "@lwc/shared": "8.17.0",
52
+ "@lwc/engine-core": "8.17.0",
53
53
  "observable-membrane": "2.0.0"
54
54
  }
55
- }
55
+ }