@stencil/core 4.27.0 → 4.27.1

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Platform v4.27.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v4.27.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -180,7 +180,6 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
180
180
  // src/client/client-window.ts
181
181
  import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
182
182
  var win = typeof window !== "undefined" ? window : {};
183
- var doc = win.document || { head: {} };
184
183
  var H = win.HTMLElement || class {
185
184
  };
186
185
  var plt = {
@@ -197,9 +196,10 @@ var setPlatformHelpers = (helpers) => {
197
196
  };
198
197
  var supportsShadow = BUILD6.shadowDom;
199
198
  var supportsListenerOptions = /* @__PURE__ */ (() => {
199
+ var _a;
200
200
  let supportsListenerOptions2 = false;
201
201
  try {
202
- doc.addEventListener(
202
+ (_a = win.document) == null ? void 0 : _a.addEventListener(
203
203
  "e",
204
204
  null,
205
205
  Object.defineProperty({}, "passive", {
@@ -315,9 +315,9 @@ var isComplexType = (o) => {
315
315
  };
316
316
 
317
317
  // src/utils/query-nonce-meta-tag-content.ts
318
- function queryNonceMetaTagContent(doc2) {
318
+ function queryNonceMetaTagContent(doc) {
319
319
  var _a, _b, _c;
320
- return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
320
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
321
321
  }
322
322
 
323
323
  // src/utils/regular-expression.ts
@@ -1145,8 +1145,8 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1145
1145
  delete hostElm["s-sc"];
1146
1146
  }
1147
1147
  }
1148
- if (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size) {
1149
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1148
+ if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
1149
+ initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1150
1150
  }
1151
1151
  hostElm[HYDRATE_ID] = hostId;
1152
1152
  hostElm.removeAttribute(HYDRATE_ID);
@@ -1472,8 +1472,8 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1472
1472
  childVNode.$name$ = slotName || null;
1473
1473
  childVNode.$tag$ = "slot";
1474
1474
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1475
- if (BUILD12.shadowDom && shadowRootNodes) {
1476
- const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1475
+ if (BUILD12.shadowDom && shadowRootNodes && win.document) {
1476
+ const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1477
1477
  if (childVNode.$name$) {
1478
1478
  childVNode.$elm$.setAttribute("name", slotName);
1479
1479
  }
@@ -1956,10 +1956,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1956
1956
  var _a;
1957
1957
  const scopeId2 = getScopeId(cmpMeta, mode);
1958
1958
  const style = styles.get(scopeId2);
1959
- if (!BUILD16.attachStyles) {
1959
+ if (!BUILD16.attachStyles || !win.document) {
1960
1960
  return scopeId2;
1961
1961
  }
1962
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
1962
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
1963
1963
  if (style) {
1964
1964
  if (typeof style === "string") {
1965
1965
  styleContainerNode = styleContainerNode.head || styleContainerNode;
@@ -1972,9 +1972,9 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1972
1972
  if (BUILD16.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1973
1973
  styleElm.innerHTML = style;
1974
1974
  } else {
1975
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
1975
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || win.document.createElement("style");
1976
1976
  styleElm.innerHTML = style;
1977
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1977
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1978
1978
  if (nonce != null) {
1979
1979
  styleElm.setAttribute("nonce", nonce);
1980
1980
  }
@@ -2042,7 +2042,10 @@ var attachStyles = (hostRef) => {
2042
2042
  var getScopeId = (cmp, mode) => "sc-" + (BUILD16.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2043
2043
  var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2044
2044
  var hydrateScopedToShadow = () => {
2045
- const styles2 = doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2045
+ if (!win.document) {
2046
+ return;
2047
+ }
2048
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2046
2049
  let i2 = 0;
2047
2050
  for (; i2 < styles2.length; i2++) {
2048
2051
  registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
@@ -2259,9 +2262,9 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2259
2262
  );
2260
2263
  }
2261
2264
  if (BUILD19.vdomText && newVNode2.$text$ !== null) {
2262
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
2265
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
2263
2266
  } else if (BUILD19.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
2264
- elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
2267
+ elm = newVNode2.$elm$ = BUILD19.isDebug || BUILD19.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : win.document.createTextNode("");
2265
2268
  if (BUILD19.vdomAttribute) {
2266
2269
  updateElement(null, newVNode2, isSvgMode);
2267
2270
  }
@@ -2269,10 +2272,15 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2269
2272
  if (BUILD19.svg && !isSvgMode) {
2270
2273
  isSvgMode = newVNode2.$tag$ === "svg";
2271
2274
  }
2272
- elm = newVNode2.$elm$ = BUILD19.svg ? doc.createElementNS(
2275
+ if (!win.document) {
2276
+ throw new Error(
2277
+ "You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component."
2278
+ );
2279
+ }
2280
+ elm = newVNode2.$elm$ = BUILD19.svg ? win.document.createElementNS(
2273
2281
  isSvgMode ? SVG_NS : HTML_NS,
2274
2282
  !useNativeShadowDom && BUILD19.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
2275
- ) : doc.createElement(
2283
+ ) : win.document.createElement(
2276
2284
  !useNativeShadowDom && BUILD19.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
2277
2285
  );
2278
2286
  if (BUILD19.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
@@ -2707,8 +2715,8 @@ render() {
2707
2715
  markSlotContentForRelocation(rootVnode.$elm$);
2708
2716
  for (const relocateData of relocateNodes) {
2709
2717
  const nodeToRelocate = relocateData.$nodeToRelocate$;
2710
- if (!nodeToRelocate["s-ol"]) {
2711
- const orgLocationNode = BUILD19.isDebug || BUILD19.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
2718
+ if (!nodeToRelocate["s-ol"] && win.document) {
2719
+ const orgLocationNode = BUILD19.isDebug || BUILD19.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : win.document.createTextNode("");
2712
2720
  orgLocationNode["s-nr"] = nodeToRelocate;
2713
2721
  insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
2714
2722
  }
@@ -2779,12 +2787,18 @@ render() {
2779
2787
  }
2780
2788
  contentRef = void 0;
2781
2789
  };
2782
- var slotReferenceDebugNode = (slotVNode) => doc.createComment(
2783
- `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
2784
- );
2785
- var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
2786
- `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
2787
- );
2790
+ var slotReferenceDebugNode = (slotVNode) => {
2791
+ var _a;
2792
+ return (_a = win.document) == null ? void 0 : _a.createComment(
2793
+ `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
2794
+ );
2795
+ };
2796
+ var originalLocationDebugNode = (nodeToRelocate) => {
2797
+ var _a;
2798
+ return (_a = win.document) == null ? void 0 : _a.createComment(
2799
+ `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
2800
+ );
2801
+ };
2788
2802
 
2789
2803
  // src/runtime/update-component.ts
2790
2804
  var attachToAncestor = (hostRef, ancestorComponent) => {
@@ -3463,7 +3477,10 @@ var connectedCallback = (elm) => {
3463
3477
  }
3464
3478
  };
3465
3479
  var setContentReference = (elm) => {
3466
- const contentRefElm = elm["s-cr"] = doc.createComment(
3480
+ if (!win.document) {
3481
+ return;
3482
+ }
3483
+ const contentRefElm = elm["s-cr"] = win.document.createComment(
3467
3484
  BUILD24.isDebug ? `content-ref (host=${elm.localName})` : ""
3468
3485
  );
3469
3486
  contentRefElm["s-cn"] = true;
@@ -3637,18 +3654,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3637
3654
  performance.mark("st:app:start");
3638
3655
  }
3639
3656
  installDevTools();
3657
+ if (!win.document) {
3658
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
3659
+ return;
3660
+ }
3640
3661
  const endBootstrap = createTime("bootstrapLazy");
3641
3662
  const cmpTags = [];
3642
3663
  const exclude = options.exclude || [];
3643
3664
  const customElements2 = win.customElements;
3644
- const head = doc.head;
3665
+ const head = win.document.head;
3645
3666
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
3646
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
3667
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
3647
3668
  const deferredConnectedCallbacks = [];
3648
3669
  let appLoadFallback;
3649
3670
  let isBootstrapping = true;
3650
3671
  Object.assign(plt, options);
3651
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
3672
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
3652
3673
  if (BUILD27.asyncQueue) {
3653
3674
  if (options.syncQueue) {
3654
3675
  plt.$flags$ |= 4 /* queueSync */;
@@ -3798,7 +3819,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3798
3819
  }
3799
3820
  if (dataStyles.innerHTML.length) {
3800
3821
  dataStyles.setAttribute("data-styles", "");
3801
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
3822
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
3802
3823
  if (nonce != null) {
3803
3824
  dataStyles.setAttribute("nonce", nonce);
3804
3825
  }
@@ -3824,7 +3845,7 @@ var Fragment = (_, children) => children;
3824
3845
  // src/runtime/host-listener.ts
3825
3846
  import { BUILD as BUILD28 } from "@stencil/core/internal/app-data";
3826
3847
  var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
3827
- if (BUILD28.hostListener && listeners) {
3848
+ if (BUILD28.hostListener && listeners && win.document) {
3828
3849
  if (BUILD28.hostListenerTargetParent) {
3829
3850
  if (attachParentListeners) {
3830
3851
  listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
@@ -3833,7 +3854,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
3833
3854
  }
3834
3855
  }
3835
3856
  listeners.map(([flags, name, method]) => {
3836
- const target = BUILD28.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
3857
+ const target = BUILD28.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
3837
3858
  const handler = hostListenerProxy(hostRef, method);
3838
3859
  const opts = hostListenerOpts(flags);
3839
3860
  plt.ael(target, name, handler, opts);
@@ -3857,12 +3878,19 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
3857
3878
  consoleError(e, hostRef.$hostElement$);
3858
3879
  }
3859
3880
  };
3860
- var getHostListenerTarget = (elm, flags) => {
3861
- if (BUILD28.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
3862
- if (BUILD28.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
3863
- if (BUILD28.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
3864
- if (BUILD28.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement)
3881
+ var getHostListenerTarget = (doc, elm, flags) => {
3882
+ if (BUILD28.hostListenerTargetDocument && flags & 4 /* TargetDocument */) {
3883
+ return doc;
3884
+ }
3885
+ if (BUILD28.hostListenerTargetWindow && flags & 8 /* TargetWindow */) {
3886
+ return win;
3887
+ }
3888
+ if (BUILD28.hostListenerTargetBody && flags & 16 /* TargetBody */) {
3889
+ return doc.body;
3890
+ }
3891
+ if (BUILD28.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement) {
3865
3892
  return elm.parentElement;
3893
+ }
3866
3894
  return elm;
3867
3895
  };
3868
3896
  var hostListenerOpts = (flags) => supportsListenerOptions ? {
@@ -3877,12 +3905,12 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
3877
3905
  var setPlatformOptions = (opts) => Object.assign(plt, opts);
3878
3906
 
3879
3907
  // src/runtime/vdom/vdom-annotations.ts
3880
- var insertVdomAnnotations = (doc2, staticComponents) => {
3881
- if (doc2 != null) {
3882
- const docData = STENCIL_DOC_DATA in doc2 ? doc2[STENCIL_DOC_DATA] : { ...DEFAULT_DOC_DATA };
3908
+ var insertVdomAnnotations = (doc, staticComponents) => {
3909
+ if (doc != null) {
3910
+ const docData = STENCIL_DOC_DATA in doc ? doc[STENCIL_DOC_DATA] : { ...DEFAULT_DOC_DATA };
3883
3911
  docData.staticComponents = new Set(staticComponents);
3884
3912
  const orgLocationNodes = [];
3885
- parseVNodeAnnotations(doc2, doc2.body, docData, orgLocationNodes);
3913
+ parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
3886
3914
  orgLocationNodes.forEach((orgLocationNode) => {
3887
3915
  var _a;
3888
3916
  if (orgLocationNode != null && orgLocationNode["s-nr"]) {
@@ -3908,11 +3936,11 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
3908
3936
  return;
3909
3937
  }
3910
3938
  }
3911
- const commentBeforeTextNode = doc2.createComment(childId);
3939
+ const commentBeforeTextNode = doc.createComment(childId);
3912
3940
  commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
3913
3941
  insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
3914
3942
  } else if (nodeRef.nodeType === 8 /* CommentNode */) {
3915
- const commentBeforeTextNode = doc2.createComment(childId);
3943
+ const commentBeforeTextNode = doc.createComment(childId);
3916
3944
  commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`;
3917
3945
  nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
3918
3946
  }
@@ -3931,7 +3959,7 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
3931
3959
  });
3932
3960
  }
3933
3961
  };
3934
- var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
3962
+ var parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
3935
3963
  var _a;
3936
3964
  if (node == null) {
3937
3965
  return;
@@ -3947,13 +3975,13 @@ var parseVNodeAnnotations = (doc2, node, docData, orgLocationNodes) => {
3947
3975
  const cmpData = {
3948
3976
  nodeIds: 0
3949
3977
  };
3950
- insertVNodeAnnotations(doc2, childNode, hostRef.$vnode$, docData, cmpData);
3978
+ insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
3951
3979
  }
3952
- parseVNodeAnnotations(doc2, childNode, docData, orgLocationNodes);
3980
+ parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
3953
3981
  });
3954
3982
  }
3955
3983
  };
3956
- var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
3984
+ var insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
3957
3985
  if (vnode != null) {
3958
3986
  const hostId = ++docData.hostIds;
3959
3987
  hostElm.setAttribute(HYDRATE_ID, hostId);
@@ -3963,7 +3991,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
3963
3991
  if (vnode.$children$ != null) {
3964
3992
  const depth = 0;
3965
3993
  vnode.$children$.forEach((vnodeChild, index) => {
3966
- insertChildVNodeAnnotations(doc2, vnodeChild, cmpData, hostId, depth, index);
3994
+ insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
3967
3995
  });
3968
3996
  }
3969
3997
  if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
@@ -3984,7 +4012,7 @@ var insertVNodeAnnotations = (doc2, hostElm, vnode, docData, cmpData) => {
3984
4012
  }
3985
4013
  }
3986
4014
  };
3987
- var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, index) => {
4015
+ var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
3988
4016
  const childElm = vnodeChild.$elm$;
3989
4017
  if (childElm == null) {
3990
4018
  return;
@@ -4003,7 +4031,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
4003
4031
  const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
4004
4032
  if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
4005
4033
  const textNodeId = `${TEXT_NODE_ID}.${childId}`;
4006
- const commentBeforeTextNode = doc2.createComment(textNodeId);
4034
+ const commentBeforeTextNode = doc.createComment(textNodeId);
4007
4035
  insertBefore(parentNode, commentBeforeTextNode, childElm);
4008
4036
  }
4009
4037
  } else if (childElm.nodeType === 8 /* CommentNode */) {
@@ -4016,7 +4044,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
4016
4044
  if (vnodeChild.$children$ != null) {
4017
4045
  const childDepth = depth + 1;
4018
4046
  vnodeChild.$children$.forEach((vnode, index2) => {
4019
- insertChildVNodeAnnotations(doc2, vnode, cmpData, hostId, childDepth, index2);
4047
+ insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index2);
4020
4048
  });
4021
4049
  }
4022
4050
  };
@@ -4041,7 +4069,6 @@ export {
4041
4069
  createEvent,
4042
4070
  defineCustomElement,
4043
4071
  disconnectedCallback,
4044
- doc,
4045
4072
  forceModeUpdate,
4046
4073
  forceUpdate,
4047
4074
  getAssetPath,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/client",
3
- "version": "4.27.0",
3
+ "version": "4.27.1",
4
4
  "description": "Stencil internal client platform to be imported by the Stencil Compiler and internal runtime. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "exports": "./index.js",
@@ -1,10 +1,10 @@
1
1
  /*
2
- Stencil Client Patch Browser v4.27.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Patch Browser v4.27.1 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/client/client-patch-browser.ts
6
6
  import { BUILD, NAMESPACE } from "@stencil/core/internal/app-data";
7
- import { consoleDevInfo, doc, H, promiseResolve } from "@stencil/core";
7
+ import { consoleDevInfo, H, promiseResolve, win } from "@stencil/core";
8
8
  var patchBrowser = () => {
9
9
  if (BUILD.isDev && !BUILD.isTesting) {
10
10
  consoleDevInfo("Running in development mode.");
@@ -12,7 +12,7 @@ var patchBrowser = () => {
12
12
  if (BUILD.cloneNodeFix) {
13
13
  patchCloneNodeFix(H.prototype);
14
14
  }
15
- const scriptElm = BUILD.scriptDataOpts ? Array.from(doc.querySelectorAll("script")).find(
15
+ const scriptElm = BUILD.scriptDataOpts ? win.document && Array.from(win.document.querySelectorAll("script")).find(
16
16
  (s) => new RegExp(`/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute("data-stencil-namespace") === NAMESPACE
17
17
  ) : null;
18
18
  const importMeta = import.meta.url;