@stencil/core 5.0.0-rc.11 → 5.0.0-rc.13

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.
@@ -1845,7 +1845,7 @@ const validateComponentTag = (tag) => {
1845
1845
  };
1846
1846
  //#endregion
1847
1847
  //#region src/version.ts
1848
- const version = "5.0.0-rc.11";
1848
+ const version = "5.0.0-rc.13";
1849
1849
  //#endregion
1850
1850
  //#region src/compiler/events.ts
1851
1851
  const buildEvents = () => {
@@ -1,3 +1,3 @@
1
- import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-DlA2VsX7.mjs";
1
+ import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-DtRfM4dU.mjs";
2
2
  import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-BR2GYgzY.mjs";
3
3
  export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildHydrateCss, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, foldBuildFlags, generateComponentTypesFile, generateManifest, getScopeId, hasStencilCssComponentsImport, hasStencilGlobalsImport, hasStencilHydrateImport, loadConfig, nodeRequire, optimizeCss, optimizeJs, parseCssOnlyComponents, replaceStencilCssComponentsImport, replaceStencilGlobalsImport, replaceStencilHydrateImport, scopeCss, transpile, transpileSync, ts, validateConfig, validateHydrated, vermoji, version, versions };
@@ -461,9 +461,9 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
461
461
  };
462
462
  //#endregion
463
463
  //#region src/version.ts
464
- const version = "5.0.0-rc.11";
465
- const buildId = "1795624141";
466
- const vermoji = "🚃";
464
+ const version = "5.0.0-rc.13";
465
+ const buildId = "1795734283";
466
+ const vermoji = "🔬";
467
467
  /**
468
468
  * Get the installed version of a tool/dependency.
469
469
  * Handles packages with exports maps that point to subdirectories.
@@ -10943,7 +10943,7 @@ const generateCustomElementType = (componentsDtsRelPath, cmp) => {
10943
10943
  const tagNameAsPascal = dashToPascalCase(cmp.tagName);
10944
10944
  return [
10945
10945
  `import type { Components, JSX } from "${componentsDtsRelPath}";`,
10946
- `import type { HTMLStencilElement } from "@stencil/core/runtime";`,
10946
+ `import type { HTMLStencilElement } from "${dirname$1(componentsDtsRelPath)}/stencil-public-runtime";`,
10947
10947
  ``,
10948
10948
  `interface ${tagNameAsPascal} extends Components.${tagNameAsPascal}, HTMLStencilElement {}`,
10949
10949
  `export const ${tagNameAsPascal}: {`,
@@ -11069,7 +11069,7 @@ const updateStencilTypesImports = (typesDir, dtsFilePath, dtsContent) => {
11069
11069
  if (!coreDtsPath.startsWith(".")) coreDtsPath = `./${coreDtsPath}`;
11070
11070
  coreDtsPath = normalizePath(coreDtsPath);
11071
11071
  if (dtsContent.includes("@stencil/core")) {
11072
- dtsContent = dtsContent.replace(/(from\s*(:?'|"))@stencil\/core\/internal('|")/g, `$1${coreDtsPath}$2`);
11072
+ dtsContent = dtsContent.replace(/(from\s*(:?'|"))@stencil\/core\/runtime('|")/g, `$1${coreDtsPath}$2`);
11073
11073
  dtsContent = dtsContent.replace(/(from\s*(:?'|"))@stencil\/core('|")/g, `$1${coreDtsPath}$2`);
11074
11074
  }
11075
11075
  return dtsContent;
@@ -3887,7 +3887,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
3887
3887
  hostElm["s-cr"] = node;
3888
3888
  node["s-cn"] = true;
3889
3889
  }
3890
- }
3890
+ } else if (childNodeType === "e") node.remove();
3891
3891
  }
3892
3892
  }
3893
3893
  } else if (parentVNode && parentVNode.$tag$ === "style") {
@@ -3976,7 +3976,7 @@ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =
3976
3976
  if (!slottedNode || slottedNode.nodeValue?.startsWith("s.")) return;
3977
3977
  do {
3978
3978
  const sa = slottedNode["getAttribute"] && slottedNode.getAttribute("slot");
3979
- if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode || slottedNode.nodeType === NODE_TYPE.TextNode)) {
3979
+ if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode && !slottedNode.nodeValue?.startsWith("e.") || slottedNode.nodeType === NODE_TYPE.TextNode)) {
3980
3980
  slottedNode["s-sn"] = slotName;
3981
3981
  group.push({
3982
3982
  slot: slotNode,
@@ -5012,17 +5012,23 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
5012
5012
  * parsed so hydration sees its declarative shadow root and children.
5013
5013
  */
5014
5014
  const pending = /* @__PURE__ */ new Set();
5015
+ /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
5016
+ const parsed = /* @__PURE__ */ new WeakSet();
5015
5017
  let observer;
5016
5018
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
5017
5019
  /**
5018
- * The parser has finished with `elm` once it, or any ancestor, has a following sibling.
5019
- * @param elm the element to check
5020
- * @returns whether the element's subtree is fully parsed
5020
+ * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
5021
+ * finished with the host once it's there (only whitespace, e.g. from `prettyHtml`, may follow -
5022
+ * as a single text node, since the parser merges adjacent text).
5023
+ * Hosts without one (e.g. from an older server) are held until the document has loaded.
5024
+ * @param elm the SSR host
5025
+ * @returns whether the host's subtree is fully parsed
5021
5026
  */
5022
5027
  const isParsed = (elm) => {
5023
- if (win.document.readyState !== "loading") return true;
5024
- for (let n = elm; n; n = parentOf(n)) if (n.nextSibling) return true;
5025
- return false;
5028
+ if (parsed.has(elm) || win.document.readyState !== "loading") return true;
5029
+ let n = elm.lastChild;
5030
+ if (n?.nodeType === NODE_TYPE.TextNode) n = n.previousSibling;
5031
+ return n?.nodeType === NODE_TYPE.CommentNode && n.nodeValue === `e.${elm.getAttribute("s-id")}` && !!parsed.add(elm);
5026
5032
  };
5027
5033
  const hasPendingAncestor = (elm) => {
5028
5034
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
@@ -3881,7 +3881,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
3881
3881
  hostElm["s-cr"] = node;
3882
3882
  node["s-cn"] = true;
3883
3883
  }
3884
- }
3884
+ } else if (childNodeType === "e") node.remove();
3885
3885
  }
3886
3886
  }
3887
3887
  } else if (parentVNode && parentVNode.$tag$ === "style") {
@@ -3970,7 +3970,7 @@ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =
3970
3970
  if (!slottedNode || slottedNode.nodeValue?.startsWith("s.")) return;
3971
3971
  do {
3972
3972
  const sa = slottedNode["getAttribute"] && slottedNode.getAttribute("slot");
3973
- if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode || slottedNode.nodeType === NODE_TYPE.TextNode)) {
3973
+ if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode && !slottedNode.nodeValue?.startsWith("e.") || slottedNode.nodeType === NODE_TYPE.TextNode)) {
3974
3974
  slottedNode["s-sn"] = slotName;
3975
3975
  group.push({
3976
3976
  slot: slotNode,
@@ -5006,17 +5006,23 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
5006
5006
  * parsed so hydration sees its declarative shadow root and children.
5007
5007
  */
5008
5008
  const pending = /* @__PURE__ */ new Set();
5009
+ /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
5010
+ const parsed = /* @__PURE__ */ new WeakSet();
5009
5011
  let observer;
5010
5012
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
5011
5013
  /**
5012
- * The parser has finished with `elm` once it, or any ancestor, has a following sibling.
5013
- * @param elm the element to check
5014
- * @returns whether the element's subtree is fully parsed
5014
+ * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
5015
+ * finished with the host once it's there (only whitespace, e.g. from `prettyHtml`, may follow -
5016
+ * as a single text node, since the parser merges adjacent text).
5017
+ * Hosts without one (e.g. from an older server) are held until the document has loaded.
5018
+ * @param elm the SSR host
5019
+ * @returns whether the host's subtree is fully parsed
5015
5020
  */
5016
5021
  const isParsed = (elm) => {
5017
- if (win.document.readyState !== "loading") return true;
5018
- for (let n = elm; n; n = parentOf(n)) if (n.nextSibling) return true;
5019
- return false;
5022
+ if (parsed.has(elm) || win.document.readyState !== "loading") return true;
5023
+ let n = elm.lastChild;
5024
+ if (n?.nodeType === NODE_TYPE.TextNode) n = n.previousSibling;
5025
+ return n?.nodeType === NODE_TYPE.CommentNode && n.nodeValue === `e.${elm.getAttribute("s-id")}` && !!parsed.add(elm);
5020
5026
  };
5021
5027
  const hasPendingAncestor = (elm) => {
5022
5028
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
@@ -3753,7 +3753,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
3753
3753
  hostElm["s-cr"] = node;
3754
3754
  node["s-cn"] = true;
3755
3755
  }
3756
- }
3756
+ } else if (childNodeType === "e") node.remove();
3757
3757
  }
3758
3758
  }
3759
3759
  } else if (parentVNode && parentVNode.$tag$ === "style") {
@@ -3842,7 +3842,7 @@ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =
3842
3842
  if (!slottedNode || slottedNode.nodeValue?.startsWith("s.")) return;
3843
3843
  do {
3844
3844
  const sa = slottedNode["getAttribute"] && slottedNode.getAttribute("slot");
3845
- if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode || slottedNode.nodeType === NODE_TYPE.TextNode)) {
3845
+ if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode && !slottedNode.nodeValue?.startsWith("e.") || slottedNode.nodeType === NODE_TYPE.TextNode)) {
3846
3846
  slottedNode["s-sn"] = slotName;
3847
3847
  group.push({
3848
3848
  slot: slotNode,
@@ -4878,17 +4878,23 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
4878
4878
  * parsed so hydration sees its declarative shadow root and children.
4879
4879
  */
4880
4880
  const pending = /* @__PURE__ */ new Set();
4881
+ /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
4882
+ const parsed = /* @__PURE__ */ new WeakSet();
4881
4883
  let observer;
4882
4884
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
4883
4885
  /**
4884
- * The parser has finished with `elm` once it, or any ancestor, has a following sibling.
4885
- * @param elm the element to check
4886
- * @returns whether the element's subtree is fully parsed
4886
+ * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
4887
+ * finished with the host once it's there (only whitespace, e.g. from `prettyHtml`, may follow -
4888
+ * as a single text node, since the parser merges adjacent text).
4889
+ * Hosts without one (e.g. from an older server) are held until the document has loaded.
4890
+ * @param elm the SSR host
4891
+ * @returns whether the host's subtree is fully parsed
4887
4892
  */
4888
4893
  const isParsed = (elm) => {
4889
- if (win.document.readyState !== "loading") return true;
4890
- for (let n = elm; n; n = parentOf(n)) if (n.nextSibling) return true;
4891
- return false;
4894
+ if (parsed.has(elm) || win.document.readyState !== "loading") return true;
4895
+ let n = elm.lastChild;
4896
+ if (n?.nodeType === NODE_TYPE.TextNode) n = n.previousSibling;
4897
+ return n?.nodeType === NODE_TYPE.CommentNode && n.nodeValue === `e.${elm.getAttribute("s-id")}` && !!parsed.add(elm);
4892
4898
  };
4893
4899
  const hasPendingAncestor = (elm) => {
4894
4900
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
@@ -3523,7 +3523,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
3523
3523
  hostElm["s-cr"] = node;
3524
3524
  node["s-cn"] = true;
3525
3525
  }
3526
- }
3526
+ } else if (childNodeType === "e") node.remove();
3527
3527
  }
3528
3528
  }
3529
3529
  } else if (parentVNode && parentVNode.$tag$ === "style") {
@@ -3612,7 +3612,7 @@ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =
3612
3612
  if (!slottedNode || slottedNode.nodeValue?.startsWith("s.")) return;
3613
3613
  do {
3614
3614
  const sa = slottedNode["getAttribute"] && slottedNode.getAttribute("slot");
3615
- if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode || slottedNode.nodeType === NODE_TYPE.TextNode)) {
3615
+ if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode && !slottedNode.nodeValue?.startsWith("e.") || slottedNode.nodeType === NODE_TYPE.TextNode)) {
3616
3616
  slottedNode["s-sn"] = slotName;
3617
3617
  group.push({
3618
3618
  slot: slotNode,
@@ -4648,17 +4648,23 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
4648
4648
  * parsed so hydration sees its declarative shadow root and children.
4649
4649
  */
4650
4650
  const pending = /* @__PURE__ */ new Set();
4651
+ /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
4652
+ const parsed = /* @__PURE__ */ new WeakSet();
4651
4653
  let observer;
4652
4654
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
4653
4655
  /**
4654
- * The parser has finished with `elm` once it, or any ancestor, has a following sibling.
4655
- * @param elm the element to check
4656
- * @returns whether the element's subtree is fully parsed
4656
+ * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
4657
+ * finished with the host once it's there (only whitespace, e.g. from `prettyHtml`, may follow -
4658
+ * as a single text node, since the parser merges adjacent text).
4659
+ * Hosts without one (e.g. from an older server) are held until the document has loaded.
4660
+ * @param elm the SSR host
4661
+ * @returns whether the host's subtree is fully parsed
4657
4662
  */
4658
4663
  const isParsed = (elm) => {
4659
- if (win.document.readyState !== "loading") return true;
4660
- for (let n = elm; n; n = parentOf(n)) if (n.nextSibling) return true;
4661
- return false;
4664
+ if (parsed.has(elm) || win.document.readyState !== "loading") return true;
4665
+ let n = elm.lastChild;
4666
+ if (n?.nodeType === NODE_TYPE.TextNode) n = n.previousSibling;
4667
+ return n?.nodeType === NODE_TYPE.CommentNode && n.nodeValue === `e.${elm.getAttribute("s-id")}` && !!parsed.add(elm);
4662
4668
  };
4663
4669
  const hasPendingAncestor = (elm) => {
4664
4670
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
@@ -5241,6 +5247,7 @@ const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
5241
5247
  if (hostElm.shadowRoot) hostElm["s-cr"].remove();
5242
5248
  else hostElm["s-cr"].nodeValue = `r.${hostId}`;
5243
5249
  }
5250
+ hostElm.appendChild(doc.createComment(`e.${hostId}`));
5244
5251
  if (vnode.$children$ != null) {
5245
5252
  const depth = 0;
5246
5253
  vnode.$children$.forEach((vnodeChild, index) => {
@@ -7954,7 +7954,7 @@ function isWithinWhitespaceSensitive(node) {
7954
7954
  function isRemovedComment(node, opts) {
7955
7955
  if (node.nodeType !== 8 || !opts.removeHtmlComments) return false;
7956
7956
  const nodeValue = node.nodeValue;
7957
- return !(nodeValue?.startsWith("r.") || nodeValue?.startsWith("o.") || nodeValue?.startsWith("s.") || nodeValue?.startsWith("t."));
7957
+ return !(nodeValue?.startsWith("r.") || nodeValue?.startsWith("o.") || nodeValue?.startsWith("s.") || nodeValue?.startsWith("t.") || nodeValue?.startsWith("e."));
7958
7958
  }
7959
7959
  /**
7960
7960
  * Determine whether a list of child nodes contains at least one comment that is
@@ -1,4 +1,4 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-DlA2VsX7.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-DtRfM4dU.mjs";
2
2
  import { t as createNodeSys } from "../../node-BR2GYgzY.mjs";
3
3
  //#region src/sys/node/node-worker-thread.ts
4
4
  /**
@@ -33,7 +33,7 @@ import "@rollup/pluginutils";
33
33
  import { createHash } from "crypto";
34
34
  import { afterAll, vi } from "vitest";
35
35
  //#region src/version.ts
36
- const version = "5.0.0-rc.11";
36
+ const version = "5.0.0-rc.13";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
@@ -4279,7 +4279,7 @@ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes
4279
4279
  hostElm["s-cr"] = node;
4280
4280
  node["s-cn"] = true;
4281
4281
  }
4282
- }
4282
+ } else if (childNodeType === "e") node.remove();
4283
4283
  }
4284
4284
  }
4285
4285
  } else if (parentVNode && parentVNode.$tag$ === "style") {
@@ -4368,7 +4368,7 @@ const addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =
4368
4368
  if (!slottedNode || slottedNode.nodeValue?.startsWith("s.")) return;
4369
4369
  do {
4370
4370
  const sa = slottedNode["getAttribute"] && slottedNode.getAttribute("slot");
4371
- if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode || slottedNode.nodeType === NODE_TYPE.TextNode)) {
4371
+ if ((slottedNode["getAttribute"] && slottedNode.getAttribute("s-sn")) === slotName || (sa || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && !sa && (slottedNode.nodeType === NODE_TYPE.CommentNode && !slottedNode.nodeValue?.startsWith("e.") || slottedNode.nodeType === NODE_TYPE.TextNode)) {
4372
4372
  slottedNode["s-sn"] = slotName;
4373
4373
  group.push({
4374
4374
  slot: slotNode,
@@ -5389,17 +5389,23 @@ const hmrApplyClass = (cmpMeta, NewClass) => {
5389
5389
  * parsed so hydration sees its declarative shadow root and children.
5390
5390
  */
5391
5391
  const pending = /* @__PURE__ */ new Set();
5392
+ /** SSR hosts seen parsed: hydration may since have moved or removed their end marker */
5393
+ const parsed = /* @__PURE__ */ new WeakSet();
5392
5394
  let observer;
5393
5395
  const parentOf = (node) => node.parentNode ?? (node.nodeType === NODE_TYPE.DocumentFragment ? node.host : null);
5394
5396
  /**
5395
- * The parser has finished with `elm` once it, or any ancestor, has a following sibling.
5396
- * @param elm the element to check
5397
- * @returns whether the element's subtree is fully parsed
5397
+ * The server writes a `HOST_END_ID` comment as an SSR host's last child, so the parser has
5398
+ * finished with the host once it's there (only whitespace, e.g. from `prettyHtml`, may follow -
5399
+ * as a single text node, since the parser merges adjacent text).
5400
+ * Hosts without one (e.g. from an older server) are held until the document has loaded.
5401
+ * @param elm the SSR host
5402
+ * @returns whether the host's subtree is fully parsed
5398
5403
  */
5399
5404
  const isParsed = (elm) => {
5400
- if (win.document.readyState !== "loading") return true;
5401
- for (let n = elm; n; n = parentOf(n)) if (n.nextSibling) return true;
5402
- return false;
5405
+ if (parsed.has(elm) || win.document.readyState !== "loading") return true;
5406
+ let n = elm.lastChild;
5407
+ if (n?.nodeType === NODE_TYPE.TextNode) n = n.previousSibling;
5408
+ return n?.nodeType === NODE_TYPE.CommentNode && n.nodeValue === `e.${elm.getAttribute("s-id")}` && !!parsed.add(elm);
5403
5409
  };
5404
5410
  const hasPendingAncestor = (elm) => {
5405
5411
  for (let n = parentOf(elm); n; n = parentOf(n)) if (pending.has(n)) return true;
@@ -5820,6 +5826,7 @@ const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
5820
5826
  if (hostElm.shadowRoot) hostElm["s-cr"].remove();
5821
5827
  else hostElm["s-cr"].nodeValue = `r.${hostId}`;
5822
5828
  }
5829
+ hostElm.appendChild(doc.createComment(`e.${hostId}`));
5823
5830
  if (vnode.$children$ != null) {
5824
5831
  const depth = 0;
5825
5832
  vnode.$children$.forEach((vnodeChild, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-rc.11",
3
+ "version": "5.0.0-rc.13",
4
4
  "description": "A Compiler for Web Components and Progressive Web Apps",
5
5
  "keywords": [
6
6
  "components",
@@ -126,9 +126,9 @@
126
126
  "terser": "^5.50.0",
127
127
  "tinyglobby": "^0.2.17",
128
128
  "typescript": ">5.0.0 <7.0.0",
129
- "@stencil/cli": "5.0.0-rc.11",
130
- "@stencil/dev-server": "5.0.0-rc.11",
131
- "@stencil/mock-doc": "5.0.0-rc.11"
129
+ "@stencil/cli": "5.0.0-rc.13",
130
+ "@stencil/mock-doc": "5.0.0-rc.13",
131
+ "@stencil/dev-server": "5.0.0-rc.13"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",