@stencil/core 5.0.0-beta.2 → 5.0.0-beta.21

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.
Files changed (35) hide show
  1. package/dist/app-data/index.d.ts +1 -1
  2. package/dist/{client-BRu0GtRn.mjs → client-CVXS3JZ-.mjs} +105 -60
  3. package/dist/compiler/browser.d.ts +110 -79
  4. package/dist/compiler/browser.js +571 -269
  5. package/dist/compiler/index.d.mts +110 -2
  6. package/dist/compiler/index.mjs +3 -3
  7. package/dist/compiler/utils/index.d.mts +1 -1
  8. package/dist/{compiler-C8yf59oh.mjs → compiler-ApS_Tn_4.mjs} +4460 -2742
  9. package/dist/declarations/stencil-public-compiler.d.ts +144 -120
  10. package/dist/declarations/stencil-public-docs.d.ts +23 -0
  11. package/dist/declarations/stencil-public-runtime.d.ts +60 -58
  12. package/dist/{index-BopBfjPu.d.mts → index-B9-Byy8z.d.mts} +142 -118
  13. package/dist/{index-BXAcVN2j.d.ts → index-BHciXst1.d.ts} +57 -55
  14. package/dist/{index-DmHmu3y0.d.mts → index-Dz1G9pWZ.d.mts} +2 -2
  15. package/dist/index.d.mts +3 -0
  16. package/dist/index.mjs +1 -1
  17. package/dist/jsx-runtime.mjs +1 -1
  18. package/dist/{node-75gQKkFz.mjs → node-Bz2SOK7_.mjs} +6 -35
  19. package/dist/runtime/client/lazy.js +228 -180
  20. package/dist/runtime/client/runtime.d.ts +67 -66
  21. package/dist/runtime/client/runtime.js +228 -180
  22. package/dist/runtime/index.d.ts +4 -5
  23. package/dist/runtime/index.js +226 -178
  24. package/dist/runtime/server/index.d.mts +11 -11
  25. package/dist/runtime/server/index.mjs +287 -220
  26. package/dist/runtime/server/runner.d.mts +4 -4
  27. package/dist/runtime/server/runner.mjs +82 -54
  28. package/dist/signals/index.d.ts +11 -2
  29. package/dist/signals/index.js +11 -1
  30. package/dist/sys/node/index.d.mts +1 -1
  31. package/dist/sys/node/index.mjs +1 -1
  32. package/dist/sys/node/worker.mjs +2 -2
  33. package/dist/testing/index.d.mts +129 -112
  34. package/dist/testing/index.mjs +244 -193
  35. package/package.json +8 -4
@@ -3,14 +3,15 @@ import { MockWindow, setupGlobal } from "@stencil/mock-doc";
3
3
  import "typescript";
4
4
  import fs from "node:fs";
5
5
  import "picomatch";
6
- import { effect, effect as effect$1, signal } from "@preact/signals-core";
6
+ import * as SignalsCore from "@preact/signals-core";
7
7
  import path, { basename, dirname } from "path";
8
+ import resolve from "resolve";
8
9
  import "postcss";
9
- import "postcss-safe-parser";
10
+ import "postcss-nesting";
10
11
  import "postcss-selector-parser";
12
+ import "postcss-safe-parser";
11
13
  import "magic-string";
12
14
  import "rolldown";
13
- import resolve from "resolve";
14
15
  import "rolldown/utils";
15
16
  import "terser";
16
17
  import "css-what";
@@ -32,7 +33,7 @@ import "@rollup/pluginutils";
32
33
  import { createHash } from "crypto";
33
34
  import { afterAll, vi } from "vitest";
34
35
  //#region src/version.ts
35
- const version = "5.0.0-beta.2";
36
+ const version = "5.0.0-beta.21";
36
37
  const MEMBER_FLAGS = {
37
38
  String: 1,
38
39
  Number: 2,
@@ -379,6 +380,10 @@ const trimFalsy = (data) => {
379
380
  */
380
381
  const isDef = (v) => v != null && v !== void 0;
381
382
  /**
383
+ * This is just a no-op, don't expect it to do anything.
384
+ */
385
+ const noop = () => {};
386
+ /**
382
387
  * Check whether a value is a 'complex type', defined here as an object or a
383
388
  * function.
384
389
  *
@@ -640,7 +645,7 @@ const Env = {};
640
645
  //#endregion
641
646
  //#region src/testing/platform/testing-constants.ts
642
647
  const styles = /* @__PURE__ */ new Map();
643
- const modeResolutionChain = [];
648
+ const modeResolver = [];
644
649
  /**
645
650
  * A mapping of custom element tags (e.g. `my-component`) to their constructor
646
651
  */
@@ -2110,7 +2115,19 @@ const hydrateScopedToShadow = () => {
2110
2115
  registerStyle(scopeId, convertScopedToShadow(styleElements[i].innerHTML), allowCS);
2111
2116
  }
2112
2117
  };
2118
+ //#endregion
2119
+ //#region src/runtime/signals-core.ts
2120
+ const getCore = () => globalThis[Symbol.for("stencil.preact-signals-core")] ??= SignalsCore;
2121
+ const effect = (fn, options) => getCore().effect(fn, options);
2122
+ function signal(value, options) {
2123
+ return getCore().signal(value, options);
2124
+ }
2113
2125
  const getRegistry = () => customElements;
2126
+ /**
2127
+ * @param elm a defined component host
2128
+ * @returns the registry the host's class was defined in, else the active registry
2129
+ */
2130
+ const getHostRegistry = (elm) => elm.constructor._registry ?? getRegistry();
2114
2131
  //#endregion
2115
2132
  //#region src/runtime/vdom/set-accessor.ts
2116
2133
  /**
@@ -2154,7 +2171,7 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
2154
2171
  attrMap.get(memberName)?.();
2155
2172
  if (!signalAttrDisposers.has(elm)) signalAttrDisposers.set(elm, attrMap);
2156
2173
  let prevVal = oldValue;
2157
- attrMap.set(memberName, effect$1(() => {
2174
+ attrMap.set(memberName, effect(() => {
2158
2175
  const curVal = newValue.value;
2159
2176
  setAccessor(elm, memberName, prevVal, curVal, isSvg, flags);
2160
2177
  prevVal = curVal;
@@ -2234,10 +2251,10 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialR
2234
2251
  const isComplex = isComplexType(newValue);
2235
2252
  if (!BUILD.lazyLoad) {
2236
2253
  const isStandardAttr = ln.startsWith("aria-") || ln.startsWith("data-");
2237
- if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && typeof customElements !== "undefined" && !customElements.get(elm.tagName.toLowerCase())) {
2254
+ if (!isProp && !isStandardAttr && elm.tagName?.includes("-") && elm.tagName !== "SLOT-FB" && !customElements.get(elm.tagName.toLowerCase())) {
2238
2255
  if (!elm["s-pp"]) elm["s-pp"] = /* @__PURE__ */ new Map();
2239
2256
  elm["s-pp"].set(memberName, newValue);
2240
- return;
2257
+ if (isComplex || /[A-Z]/.test(memberName)) return;
2241
2258
  }
2242
2259
  }
2243
2260
  if ((isProp || isComplex && newValue !== null) && !isSvg) try {
@@ -2355,6 +2372,7 @@ function sortedAttrNames(attrNames) {
2355
2372
  let scopeId;
2356
2373
  let contentRef;
2357
2374
  let hostTagName;
2375
+ let hostRegistry;
2358
2376
  let useNativeShadowDom = false;
2359
2377
  let checkSlotFallbackVisibility = false;
2360
2378
  let checkSlotRelocate = false;
@@ -2371,16 +2389,33 @@ const signalNodeDisposers = /* @__PURE__ */ new WeakMap();
2371
2389
  const disposeSignalVNode = (vnode) => {
2372
2390
  const elm = vnode.$elm$;
2373
2391
  if (elm) {
2374
- const dispose = signalNodeDisposers.get(elm);
2375
- if (dispose) {
2376
- dispose();
2377
- signalNodeDisposers.delete(elm);
2378
- }
2392
+ disposeTextSignal(elm);
2379
2393
  disposeAllSignalAttrs(elm);
2380
2394
  }
2381
2395
  vnode.$children$?.forEach(disposeSignalVNode);
2382
2396
  };
2383
2397
  /**
2398
+ * Tear down a text node's signal subscription, if it has one.
2399
+ * @param textNode the text node to unsubscribe
2400
+ */
2401
+ const disposeTextSignal = (textNode) => {
2402
+ const dispose = signalNodeDisposers.get(textNode);
2403
+ if (dispose) {
2404
+ dispose();
2405
+ signalNodeDisposers.delete(textNode);
2406
+ }
2407
+ };
2408
+ /**
2409
+ * Subscribe a text node to a signal, keeping its `data` in sync on every change.
2410
+ * @param textNode the text node to keep in sync
2411
+ * @param textSig the signal to subscribe to
2412
+ */
2413
+ const wireTextSignal = (textNode, textSig) => {
2414
+ signalNodeDisposers.set(textNode, effect(() => {
2415
+ textNode.data = String(textSig.value);
2416
+ }));
2417
+ };
2418
+ /**
2384
2419
  * Create a DOM Node corresponding to one of the children of a given VNode.
2385
2420
  *
2386
2421
  * @param oldParentVNode the parent VNode from the previous render
@@ -2402,13 +2437,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
2402
2437
  if (BUILD.isDev && newVNode.$elm$) consoleDevError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${String(newVNode.$tag$)}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
2403
2438
  if (BUILD.vdomText && newVNode.$text$ != null) {
2404
2439
  elm = newVNode.$elm$ = win.document.createTextNode(newVNode.$text$);
2405
- if (BUILD.vdomSignals && newVNode.$signal$) {
2406
- const textSig = newVNode.$signal$;
2407
- const textNode = elm;
2408
- signalNodeDisposers.set(textNode, effect$1(() => {
2409
- textNode.data = String(textSig.value);
2410
- }));
2411
- }
2440
+ if (BUILD.vdomSignals && newVNode.$signal$) wireTextSignal(elm, newVNode.$signal$);
2412
2441
  } else if (BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotReference) {
2413
2442
  elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : win.document.createTextNode("");
2414
2443
  if (typeof newVNode.$attrs$?.slot === "string") elm["s-sa"] = newVNode.$attrs$.slot;
@@ -2417,8 +2446,7 @@ const createElm = (oldParentVNode, newParentVNode, childIndex) => {
2417
2446
  if (BUILD.svg && !isSvgMode) isSvgMode = newVNode.$tag$ === "svg";
2418
2447
  if (!win.document) throw new Error("No DOM environment available for rendering.");
2419
2448
  const tag = !useNativeShadowDom && BUILD.slotRelocation && newVNode.$flags$ & VNODE_FLAGS.isSlotFallback ? "slot-fb" : newVNode.$tag$;
2420
- const _reg = getRegistry();
2421
- const registryOpts = _reg !== win.customElements && tag.includes("-") ? { customElementRegistry: _reg } : void 0;
2449
+ const registryOpts = hostRegistry !== win.customElements && tag.includes("-") ? { customElementRegistry: hostRegistry } : void 0;
2422
2450
  elm = newVNode.$elm$ = BUILD.svg && isSvgMode ? win.document.createElementNS(SVG_NS, tag) : win.document.createElement(tag, registryOpts);
2423
2451
  if (BUILD.svg && isSvgMode && newVNode.$tag$ === "foreignObject") isSvgMode = false;
2424
2452
  if (BUILD.vdomAttribute) updateElement(null, newVNode, isSvgMode);
@@ -2676,7 +2704,7 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = fal
2676
2704
  }
2677
2705
  if (BUILD.vdomKey && idxInOld >= 0) {
2678
2706
  elmToMove = oldCh[idxInOld];
2679
- if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
2707
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
2680
2708
  else {
2681
2709
  patch(elmToMove, newStartVnode, isInitialRender);
2682
2710
  oldCh[idxInOld] = void 0;
@@ -2769,7 +2797,17 @@ const patch = (oldVNode, newVNode, isInitialRender = false) => {
2769
2797
  else if (BUILD.hydrateClientSide && isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) newVNode.$children$ = oldChildren;
2770
2798
  if (BUILD.svg && isSvgMode && tag === "svg") isSvgMode = false;
2771
2799
  } else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) defaultHolder.parentNode.textContent = text;
2772
- else if (BUILD.vdomText && oldVNode.$text$ !== text) elm.data = text;
2800
+ else if (BUILD.vdomText) {
2801
+ if (BUILD.vdomSignals && newVNode.$signal$) {
2802
+ if (newVNode.$signal$ !== oldVNode.$signal$) {
2803
+ disposeTextSignal(elm);
2804
+ wireTextSignal(elm, newVNode.$signal$);
2805
+ }
2806
+ } else {
2807
+ if (BUILD.vdomSignals && oldVNode.$signal$) disposeTextSignal(elm);
2808
+ if (oldVNode.$text$ !== text) elm.data = text;
2809
+ }
2810
+ }
2773
2811
  };
2774
2812
  /**
2775
2813
  * Component-global information about nodes which are either currently being
@@ -2957,6 +2995,7 @@ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
2957
2995
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
2958
2996
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
2959
2997
  hostTagName = hostElm.tagName;
2998
+ hostRegistry = getHostRegistry(hostElm);
2960
2999
  if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) throw new Error(`The <Host> must be the single root component.
2961
3000
  Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
2962
3001
 
@@ -3109,11 +3148,12 @@ const markFirstConnected = (hostRef) => {
3109
3148
  * autoloader, where the ancestor tag may not be defined yet.
3110
3149
  *
3111
3150
  * @param ancestorElm the nearest Stencil ancestor element
3151
+ * @param registry the registry the waiting component is defined in
3112
3152
  */
3113
- const awaitAncestorConnected = async (ancestorElm) => {
3153
+ const awaitAncestorConnected = async (ancestorElm, registry) => {
3114
3154
  let ancestorHostRef = getHostRef(ancestorElm);
3115
3155
  if (!BUILD.lazyLoad && !ancestorHostRef) {
3116
- await getRegistry().whenDefined(ancestorElm.tagName.toLowerCase());
3156
+ await registry.whenDefined(ancestorElm.tagName.toLowerCase());
3117
3157
  ancestorHostRef = getHostRef(ancestorElm);
3118
3158
  }
3119
3159
  if (ancestorHostRef && !(ancestorHostRef.$flags$ & HOST_FLAGS.hasFiredConnected)) await ensureFirstConnectPromise(ancestorHostRef);
@@ -3469,8 +3509,7 @@ const initializeSignals = (elm, hostRef, cmpMeta) => {
3469
3509
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
3470
3510
  for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) {
3471
3511
  if (!(memberFlags & MEMBER_FLAGS.PropLike)) continue;
3472
- const initialVal = hostRef.$instanceValues$.get(memberName);
3473
- const sig = signal(initialVal);
3512
+ const sig = signal(hostRef.$instanceValues$.get(memberName));
3474
3513
  hostRef.$signalValues$.set(memberName, sig);
3475
3514
  let prevScheduleVal = sig.peek();
3476
3515
  disposers.push(effect(() => {
@@ -3598,9 +3637,7 @@ const h = (nodeName, vnodeData, ...children) => {
3598
3637
  if (classData && !(BUILD.vdomSignals && isSignalLike(classData))) vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
3599
3638
  }
3600
3639
  }
3601
- if (BUILD.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be the single root component. Make sure:
3602
- - You are NOT using hostData() and <Host> in the same component.
3603
- - <Host> is used once, and it's the single root component of the render() function.`);
3640
+ if (BUILD.isDev && vNodeChildren.some(isHost)) consoleDevError(`The <Host> must be used once, and be the single root component of the render() function.`);
3604
3641
  if (BUILD.vdomFunctional && typeof nodeName === "function") return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
3605
3642
  const vnode = newVNode(nodeName, null);
3606
3643
  vnode.$attrs$ = vnodeData;
@@ -4365,7 +4402,7 @@ const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector)
4365
4402
  else return shallowPart.trim();
4366
4403
  }).join(", ");
4367
4404
  };
4368
- const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer");
4405
+ const isScopableAtRule = (selector) => selector.startsWith("@media") || selector.startsWith("@supports") || selector.startsWith("@page") || selector.startsWith("@document") || selector.startsWith("@layer") || selector.startsWith("@container");
4369
4406
  const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
4370
4407
  return processRules(cssText, (rule) => {
4371
4408
  let selector = rule.selector;
@@ -4484,7 +4521,7 @@ const scopeCss = (cssText, scopeId, commentOriginalSelector) => {
4484
4521
  };
4485
4522
  //#endregion
4486
4523
  //#region src/runtime/mode.ts
4487
- const computeMode = (elm) => modeResolutionChain.map((h) => h(elm)).find((m) => !!m);
4524
+ const computeMode = (elm) => modeResolver.map((h) => h(elm)).find((m) => !!m);
4488
4525
  const getMode = (ref) => getHostRef(ref)?.$modeName$;
4489
4526
  //#endregion
4490
4527
  //#region src/runtime/normalize-watchers.ts
@@ -4549,23 +4586,14 @@ const normalizeWatchers = (raw) => {
4549
4586
  *
4550
4587
  * @param propValue the new value to coerce to some type
4551
4588
  * @param propType the type of the prop, expressed as a binary number
4552
- * @param isFormAssociated whether the component is form-associated (optional)
4553
4589
  * @returns the parsed/coerced value
4554
4590
  */
4555
- const parsePropertyValue = (propValue, propType, isFormAssociated) => {
4591
+ const parsePropertyValue = (propValue, propType) => {
4556
4592
  if (propValue != null && !isComplexType(propValue)) {
4557
4593
  /**
4558
4594
  * ensure this value is of the correct prop type
4559
4595
  */
4560
- if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) {
4561
- /**
4562
- * For form-associated components, according to HTML spec, the presence of any boolean attribute
4563
- * (regardless of its value, even "false") should make the property true.
4564
- * For non-form-associated components, we maintain the legacy behavior where "false" becomes false.
4565
- */
4566
- if (BUILD.formAssociated && isFormAssociated && typeof propValue === "string") return propValue === "" || !!propValue;
4567
- else return propValue === "false" ? false : propValue === "" || !!propValue;
4568
- }
4596
+ if (BUILD.propBoolean && propType & MEMBER_FLAGS.Boolean) return propValue === "" || !!propValue;
4569
4597
  /**
4570
4598
  * force it to be a number
4571
4599
  */
@@ -4607,7 +4635,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4607
4635
  if (BUILD.signalBacking) {
4608
4636
  const sig = hostRef?.$signalValues$?.get(propName);
4609
4637
  if (sig !== void 0) {
4610
- const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0], BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4638
+ const parsed = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
4611
4639
  if (BUILD.serializer && BUILD.reflect && cmpMeta.$attrsToReflect$ && cmpMeta.$serializers$?.[propName]) {
4612
4640
  const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
4613
4641
  applySerializers(hostRef, cmpMeta, propName, parsed, BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm);
@@ -4625,7 +4653,7 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4625
4653
  const oldVal = hostRef.$instanceValues$.get(propName);
4626
4654
  const flags = hostRef.$flags$;
4627
4655
  const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
4628
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0], BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4656
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
4629
4657
  const didValueChange = newVal !== oldVal && !(Number.isNaN(oldVal) && Number.isNaN(newVal));
4630
4658
  if ((!BUILD.lazyLoad || !(flags & HOST_FLAGS.isConstructingInstance) || oldVal === void 0) && didValueChange) {
4631
4659
  hostRef.$instanceValues$.set(propName, newVal);
@@ -4674,6 +4702,22 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
4674
4702
  */
4675
4703
  const reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
4676
4704
  /**
4705
+ * Hand values written to a lazy component's element before its instance existed to the
4706
+ * instance's own `@Prop` setters. Must run as soon as the instance is constructed, so that
4707
+ * whenever `$lazyInstance$` is set, reads through it agree with the element's last write.
4708
+ *
4709
+ * @param hostRef the runtime bookkeeping object of a freshly constructed lazy instance
4710
+ * @param cmpMeta runtime metadata for the component (with any run-time only setters flagged)
4711
+ */
4712
+ const replayPendingSetterValues = (hostRef, cmpMeta) => {
4713
+ const instance = hostRef.$lazyInstance$;
4714
+ if (!instance) return;
4715
+ for (const [memberName, [memberFlags]] of Object.entries(cmpMeta.$members$ ?? {})) if (memberFlags & MEMBER_FLAGS.Setter && hostRef.$instanceValues$.has(memberName)) {
4716
+ const pendingValue = hostRef.$instanceValues$.get(memberName);
4717
+ if (instance[memberName] !== pendingValue) instance[memberName] = pendingValue;
4718
+ }
4719
+ };
4720
+ /**
4677
4721
  * Attach a series of runtime constructs to a compiled Stencil component
4678
4722
  * constructor, including getters and setters for the `@Prop` and `@State`
4679
4723
  * decorators, callbacks for when attributes change, and so on.
@@ -4730,9 +4774,8 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4730
4774
  if (BUILD.lazyLoad) {
4731
4775
  if ((cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Getter) === 0) return getValue(this, memberName);
4732
4776
  const ref = getHostRef(this);
4733
- const instance = ref ? ref.$lazyInstance$ : prototype;
4734
- if (!instance) return;
4735
- return instance[memberName];
4777
+ if (!ref) return prototype[memberName];
4778
+ return ref.$lazyInstance$ ? ref.$lazyInstance$[memberName] : getValue(this, memberName);
4736
4779
  }
4737
4780
  if (!BUILD.lazyLoad) return origGetter ? origGetter.apply(this) : getValue(this, memberName);
4738
4781
  },
@@ -4747,7 +4790,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4747
4790
  }
4748
4791
  if (origSetter) {
4749
4792
  if (typeof (memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName]) === "undefined" && ref.$instanceValues$.get(memberName)) newValue = ref.$instanceValues$.get(memberName);
4750
- origSetter.apply(this, [parsePropertyValue(newValue, memberFlags, BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated))]);
4793
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
4751
4794
  newValue = memberFlags & MEMBER_FLAGS.State ? this[memberName] : ref.$hostElement$[memberName];
4752
4795
  setValue(this, memberName, newValue, cmpMeta);
4753
4796
  return;
@@ -4759,21 +4802,15 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4759
4802
  if (BUILD.lazyLoad) {
4760
4803
  if ((flags & PROXY_FLAGS.isElementConstructor) === 0 || (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter) === 0) {
4761
4804
  setValue(this, memberName, newValue, cmpMeta);
4762
- if (flags & PROXY_FLAGS.isElementConstructor && !ref.$lazyInstance$) ref.$fetchedCbList$.push(() => {
4763
- if (cmpMeta.$members$[memberName][0] & MEMBER_FLAGS.Setter && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) ref.$lazyInstance$[memberName] = newValue;
4764
- });
4765
4805
  return;
4766
4806
  }
4767
- const setterSetVal = () => {
4807
+ const parsedValue = parsePropertyValue(newValue, memberFlags);
4808
+ if (ref.$lazyInstance$) {
4768
4809
  const currentValue = ref.$lazyInstance$[memberName];
4769
4810
  if (!ref.$instanceValues$.get(memberName) && currentValue) ref.$instanceValues$.set(memberName, currentValue);
4770
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags, BUILD.formAssociated && !!(cmpMeta.$flags$ & CMP_FLAGS.formAssociated));
4811
+ ref.$lazyInstance$[memberName] = parsedValue;
4771
4812
  setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
4772
- };
4773
- if (ref.$lazyInstance$) setterSetVal();
4774
- else ref.$fetchedCbList$.push(() => {
4775
- setterSetVal();
4776
- });
4813
+ } else ref.$instanceValues$.set(memberName, parsedValue);
4777
4814
  }
4778
4815
  } });
4779
4816
  } else if (BUILD.lazyLoad && BUILD.method && flags & PROXY_FLAGS.isElementConstructor && memberFlags & MEMBER_FLAGS.Method) Object.defineProperty(prototype, memberName, { value(...args) {
@@ -4825,7 +4862,10 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
4825
4862
  const isBooleanTarget = propMemberFlags & MEMBER_FLAGS.Boolean;
4826
4863
  if (BUILD.reflect && propMemberFlags & MEMBER_FLAGS.ReflectAttr && propMemberFlags & MEMBER_FLAGS.Any && !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) return;
4827
4864
  const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
4828
- if (isBooleanTarget) newValue = !(newValue === null || newValue === "false");
4865
+ if (isBooleanTarget) {
4866
+ if (BUILD.isDev && newValue === "false") consoleDevWarn(`<${cmpMeta.$tagName$} ${attrName}="false">: boolean attributes are true when present, regardless of value. Remove the attribute or set the "${propName}" property to false instead.`);
4867
+ newValue = newValue !== null;
4868
+ }
4829
4869
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
4830
4870
  if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) this[propName] = newValue;
4831
4871
  });
@@ -4888,9 +4928,12 @@ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
4888
4928
  } catch (e) {
4889
4929
  consoleError(e, elm);
4890
4930
  }
4891
- if (BUILD.member) hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4931
+ if (BUILD.member) {
4932
+ hostRef.$flags$ &= ~HOST_FLAGS.isConstructingInstance;
4933
+ replayPendingSetterValues(hostRef, cmpMeta);
4934
+ }
4892
4935
  endNewInstance();
4893
- if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$);
4936
+ if (BUILD.asyncLoading && hostRef.$ancestorComponent$) await awaitAncestorConnected(hostRef.$ancestorComponent$, getHostRegistry(elm));
4894
4937
  if (!(BUILD.slotRelocation && cmpMeta.$flags$ & CMP_FLAGS.hasSlotRelocation)) {
4895
4938
  fireConnectedCallback(hostRef.$lazyInstance$, elm);
4896
4939
  if (BUILD.asyncLoading) markFirstConnected(hostRef);
@@ -4990,9 +5033,16 @@ const connectedCallback = (elm) => {
4990
5033
  }
4991
5034
  if (BUILD.asyncLoading) {
4992
5035
  let ancestorComponent = elm;
4993
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) if (BUILD.hydrateClientSide && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
4994
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
4995
- break;
5036
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
5037
+ if (BUILD.hydrateClientSide && !ancestorComponent["s-p"] && ancestorComponent.nodeType === NODE_TYPE.ElementNode && ancestorComponent.hasAttribute("s-id")) {
5038
+ ancestorComponent["s-p"] = [];
5039
+ ancestorComponent["s-rc"] = [];
5040
+ ancestorComponent["s-pc"] = [];
5041
+ }
5042
+ if (ancestorComponent["s-p"]) {
5043
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
5044
+ break;
5045
+ }
4996
5046
  }
4997
5047
  }
4998
5048
  if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
@@ -5108,48 +5158,45 @@ const hmrStandalone = async (hostElement, cmpMeta, hmrVersionId) => {
5108
5158
  `${modulePath}?s-hmr=${hmrVersionId}`
5109
5159
  );
5110
5160
  const NewClass = Object.values(newModule).find((v) => typeof v === "function" && v.is === cmpMeta.$tagName$) ?? newModule.default;
5111
- if (!NewClass) return;
5112
- const ctor = customElements.get(cmpMeta.$tagName$);
5113
- if (ctor) {
5114
- for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
5115
- if (key === "constructor") continue;
5116
- Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
5117
- }
5118
- const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
5119
- if (styleDesc) {
5120
- Object.defineProperty(ctor, "style", styleDesc);
5121
- const newStyle = NewClass.style;
5122
- if (newStyle) {
5123
- const scopeId = getScopeId(cmpMeta);
5124
- const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
5125
- console.log("[stencil-hmr] registerStyle", {
5126
- tag: cmpMeta.$tagName$,
5127
- scopeId,
5128
- isShadow,
5129
- cssLen: newStyle.length
5130
- });
5131
- registerStyle(scopeId, newStyle, isShadow);
5132
- }
5133
- }
5134
- }
5135
- const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
5136
- document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
5137
- const hostRef = getHostRef(el);
5138
- if (BUILD.hostListener && hostRef?.$rmListeners$) {
5139
- hostRef.$rmListeners$.map((rmListener) => rmListener());
5140
- hostRef.$rmListeners$ = void 0;
5141
- addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
5142
- }
5143
- if (!isShadow && hostRef) {
5144
- console.log("[stencil-hmr] calling attachStyles for", cmpMeta.$tagName$);
5145
- attachStyles(hostRef);
5146
- }
5147
- forceUpdate(el);
5148
- });
5161
+ if (NewClass) hmrApplyClass(cmpMeta, NewClass);
5149
5162
  } catch (e) {
5150
5163
  console.error(`[Stencil HMR] Failed to reload <${cmpMeta.$tagName$}>`, e);
5151
5164
  }
5152
5165
  };
5166
+ /**
5167
+ * Patch a re-executed component class onto the registered one and re-render every live instance.
5168
+ * Shared by the standalone re-import above and bundlers that re-execute the module themselves
5169
+ * (webpack/rspack `module.hot`), which reach it via the constructor's `s-hmr-apply` hook.
5170
+ *
5171
+ * @param cmpMeta runtime metadata for the component
5172
+ * @param NewClass the component's newly executed class
5173
+ */
5174
+ const hmrApplyClass = (cmpMeta, NewClass) => {
5175
+ const ctor = customElements.get(cmpMeta.$tagName$);
5176
+ const isShadow = !!(cmpMeta.$flags$ & CMP_FLAGS.shadowDomEncapsulation);
5177
+ if (ctor && ctor !== NewClass) {
5178
+ for (const key of Object.getOwnPropertyNames(NewClass.prototype)) {
5179
+ if (key === "constructor") continue;
5180
+ Object.defineProperty(ctor.prototype, key, Object.getOwnPropertyDescriptor(NewClass.prototype, key));
5181
+ }
5182
+ const styleDesc = Object.getOwnPropertyDescriptor(NewClass, "style");
5183
+ if (styleDesc) {
5184
+ Object.defineProperty(ctor, "style", styleDesc);
5185
+ const newStyle = NewClass.style;
5186
+ if (newStyle) registerStyle(getScopeId(cmpMeta), newStyle, isShadow);
5187
+ }
5188
+ }
5189
+ document.querySelectorAll(cmpMeta.$tagName$).forEach((el) => {
5190
+ const hostRef = getHostRef(el);
5191
+ if (BUILD.hostListener && hostRef?.$rmListeners$) {
5192
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
5193
+ hostRef.$rmListeners$ = void 0;
5194
+ addHostEventListeners(el, hostRef, cmpMeta.$listeners$);
5195
+ }
5196
+ if (!isShadow && hostRef) attachStyles(hostRef);
5197
+ forceUpdate(el);
5198
+ });
5199
+ };
5153
5200
  //#endregion
5154
5201
  //#region src/runtime/bootstrap-loader.ts
5155
5202
  const bootstrapLazy = (lazyBundles, options = {}) => {
@@ -5567,8 +5614,8 @@ const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, in
5567
5614
  //#endregion
5568
5615
  //#region src/testing/platform/index.ts
5569
5616
  const setMode = (handler) => {
5570
- modeResolutionChain.length = 0;
5571
- modeResolutionChain.push(handler);
5617
+ modeResolver.length = 0;
5618
+ modeResolver.push(handler);
5572
5619
  };
5573
5620
  const needsScopedSSR = () => scopedSSR;
5574
5621
  let scopedSSR = false;
@@ -5647,79 +5694,6 @@ const buildEvents = () => {
5647
5694
  };
5648
5695
  };
5649
5696
  //#endregion
5650
- //#region src/compiler/app-core/app-data.ts
5651
- /**
5652
- * Generate a {@link BuildFeatures} entity, based on the provided component metadata
5653
- * @param cmps a collection of component compiler metadata, used to set values on the generated build features object
5654
- * @returns the generated build features entity
5655
- */
5656
- const getBuildFeatures = (cmps) => {
5657
- const slot = cmps.some((c) => c.htmlTagNames.includes("slot"));
5658
- const shadowDom = cmps.some((c) => c.encapsulation === "shadow");
5659
- const slotRelocation = cmps.some((c) => c.encapsulation !== "shadow" && c.htmlTagNames.includes("slot"));
5660
- const f = {
5661
- allRenderFn: cmps.every((c) => c.hasRenderFn),
5662
- formAssociated: cmps.some((c) => c.formAssociated),
5663
- deserializer: cmps.some((c) => c.hasDeserializer),
5664
- element: cmps.some((c) => c.hasElement),
5665
- event: cmps.some((c) => c.hasEvent),
5666
- hasRenderFn: cmps.some((c) => c.hasRenderFn),
5667
- lifecycle: cmps.some((c) => c.hasLifecycle),
5668
- asyncLoading: true,
5669
- hostListener: cmps.some((c) => c.hasListener),
5670
- hostListenerTargetWindow: cmps.some((c) => c.hasListenerTargetWindow),
5671
- hostListenerTargetDocument: cmps.some((c) => c.hasListenerTargetDocument),
5672
- hostListenerTargetBody: cmps.some((c) => c.hasListenerTargetBody),
5673
- hostListenerTarget: cmps.some((c) => c.hasListenerTarget),
5674
- member: cmps.some((c) => c.hasMember),
5675
- method: cmps.some((c) => c.hasMethod),
5676
- mode: cmps.some((c) => c.hasMode),
5677
- observeAttribute: cmps.some((c) => c.hasAttribute || c.hasWatchCallback || c.hasDeserializer),
5678
- prop: cmps.some((c) => c.hasProp),
5679
- propBoolean: cmps.some((c) => c.hasPropBoolean),
5680
- propChangeCallback: cmps.some((c) => c.hasWatchCallback || c.hasDeserializer || c.hasSerializer),
5681
- propNumber: cmps.some((c) => c.hasPropNumber),
5682
- propString: cmps.some((c) => c.hasPropString),
5683
- propMutable: cmps.some((c) => c.hasPropMutable),
5684
- reflect: cmps.some((c) => c.hasReflect || c.hasSerializer),
5685
- scoped: cmps.some((c) => c.encapsulation === "scoped"),
5686
- serializer: cmps.some((c) => c.hasSerializer),
5687
- shadowDom,
5688
- shadowDelegatesFocus: shadowDom && cmps.some((c) => c.shadowDelegatesFocus),
5689
- shadowModeClosed: shadowDom && cmps.some((c) => c.shadowMode === "closed"),
5690
- shadowSlotAssignmentManual: shadowDom && cmps.some((c) => c.slotAssignment === "manual"),
5691
- shadowClonable: shadowDom && cmps.some((c) => c.shadowClonable),
5692
- shadowSerializable: shadowDom && cmps.some((c) => c.shadowSerializable),
5693
- slot,
5694
- slotRelocation,
5695
- state: cmps.some((c) => c.hasState),
5696
- style: cmps.some((c) => c.hasStyle),
5697
- svg: cmps.some((c) => c.htmlTagNames.includes("svg")),
5698
- updatable: cmps.some((c) => c.isUpdateable),
5699
- vdomAttribute: cmps.some((c) => c.hasVdomAttribute),
5700
- vdomXlink: cmps.some((c) => c.hasVdomXlink),
5701
- vdomClass: cmps.some((c) => c.hasVdomClass),
5702
- vdomFunctional: cmps.some((c) => c.hasVdomFunctional),
5703
- vdomKey: cmps.some((c) => c.hasVdomKey),
5704
- vdomListener: cmps.some((c) => c.hasVdomListener),
5705
- vdomPropOrAttr: cmps.some((c) => c.hasVdomPropOrAttr),
5706
- vdomPropOrAttrPrefix: cmps.some((c) => c.hasVdomPropOrAttrPrefix),
5707
- vdomRef: cmps.some((c) => c.hasVdomRef),
5708
- vdomRender: cmps.some((c) => c.hasVdomRender),
5709
- vdomStyle: cmps.some((c) => c.hasVdomStyle),
5710
- vdomText: cmps.some((c) => c.hasVdomText),
5711
- vdomSignals: cmps.some((c) => c.hasSignalsImport),
5712
- taskQueue: true,
5713
- patchAll: cmps.some((c) => c.hasPatchAll),
5714
- patchChildren: cmps.some((c) => c.hasPatchChildren),
5715
- patchClone: cmps.some((c) => c.hasPatchClone),
5716
- patchInsert: cmps.some((c) => c.hasPatchInsert)
5717
- };
5718
- f.vdomAttribute = f.vdomAttribute || f.reflect;
5719
- f.vdomPropOrAttr = f.vdomPropOrAttr || f.reflect;
5720
- return f;
5721
- };
5722
- //#endregion
5723
5697
  //#region src/compiler/sys/resolve/resolve-utils.ts
5724
5698
  const getModuleId = (orgImport) => {
5725
5699
  if (orgImport.startsWith("~")) orgImport = orgImport.substring(1);
@@ -5809,6 +5783,92 @@ const createCustomResolverAsync = (sys, inMemoryFs, exts) => {
5809
5783
  extensions: exts
5810
5784
  };
5811
5785
  };
5786
+ //#endregion
5787
+ //#region src/compiler/app-core/app-data.ts
5788
+ /**
5789
+ * Generate a {@link BuildFeatures} entity, based on the provided component metadata
5790
+ * @param cmps a collection of component compiler metadata, used to set values on the generated build features object
5791
+ * @returns the generated build features entity
5792
+ */
5793
+ const getBuildFeatures = (cmps) => {
5794
+ const slot = cmps.some((c) => c.htmlTagNames.includes("slot"));
5795
+ const shadowDom = cmps.some((c) => c.encapsulation === "shadow");
5796
+ const slotRelocation = cmps.some((c) => c.encapsulation !== "shadow" && c.htmlTagNames.includes("slot"));
5797
+ const f = {
5798
+ allRenderFn: cmps.every((c) => c.hasRenderFn),
5799
+ formAssociated: cmps.some((c) => c.formAssociated),
5800
+ deserializer: cmps.some((c) => c.hasDeserializer),
5801
+ element: cmps.some((c) => c.hasElement),
5802
+ event: cmps.some((c) => c.hasEvent),
5803
+ hasRenderFn: cmps.some((c) => c.hasRenderFn),
5804
+ lifecycle: cmps.some((c) => c.hasLifecycle),
5805
+ asyncLoading: true,
5806
+ hostListener: cmps.some((c) => c.hasListener),
5807
+ hostListenerTargetWindow: cmps.some((c) => c.hasListenerTargetWindow),
5808
+ hostListenerTargetDocument: cmps.some((c) => c.hasListenerTargetDocument),
5809
+ hostListenerTargetBody: cmps.some((c) => c.hasListenerTargetBody),
5810
+ hostListenerTarget: cmps.some((c) => c.hasListenerTarget),
5811
+ member: cmps.some((c) => c.hasMember),
5812
+ method: cmps.some((c) => c.hasMethod),
5813
+ mode: cmps.some((c) => c.hasMode),
5814
+ observeAttribute: cmps.some((c) => c.hasAttribute || c.hasWatchCallback || c.hasDeserializer),
5815
+ prop: cmps.some((c) => c.hasProp),
5816
+ propBoolean: cmps.some((c) => c.hasPropBoolean),
5817
+ propChangeCallback: cmps.some((c) => c.hasWatchCallback || c.hasDeserializer || c.hasSerializer),
5818
+ propNumber: cmps.some((c) => c.hasPropNumber),
5819
+ propString: cmps.some((c) => c.hasPropString),
5820
+ propMutable: cmps.some((c) => c.hasPropMutable),
5821
+ reflect: cmps.some((c) => c.hasReflect || c.hasSerializer),
5822
+ scoped: cmps.some((c) => c.encapsulation === "scoped"),
5823
+ serializer: cmps.some((c) => c.hasSerializer),
5824
+ shadowDom,
5825
+ shadowDelegatesFocus: shadowDom && cmps.some((c) => c.shadowDelegatesFocus),
5826
+ shadowModeClosed: shadowDom && cmps.some((c) => c.shadowMode === "closed"),
5827
+ shadowSlotAssignmentManual: shadowDom && cmps.some((c) => c.slotAssignment === "manual"),
5828
+ shadowClonable: shadowDom && cmps.some((c) => c.shadowClonable),
5829
+ shadowSerializable: shadowDom && cmps.some((c) => c.shadowSerializable),
5830
+ slot,
5831
+ slotRelocation,
5832
+ state: cmps.some((c) => c.hasState),
5833
+ style: cmps.some((c) => c.hasStyle),
5834
+ svg: cmps.some((c) => c.htmlTagNames.includes("svg")),
5835
+ updatable: cmps.some((c) => c.isUpdateable),
5836
+ vdomAttribute: cmps.some((c) => c.hasVdomAttribute),
5837
+ vdomXlink: cmps.some((c) => c.hasVdomXlink),
5838
+ vdomClass: cmps.some((c) => c.hasVdomClass),
5839
+ vdomFunctional: cmps.some((c) => c.hasVdomFunctional),
5840
+ vdomKey: cmps.some((c) => c.hasVdomKey),
5841
+ vdomListener: cmps.some((c) => c.hasVdomListener),
5842
+ vdomPropOrAttr: cmps.some((c) => c.hasVdomPropOrAttr),
5843
+ vdomPropOrAttrPrefix: cmps.some((c) => c.hasVdomPropOrAttrPrefix),
5844
+ vdomRef: cmps.some((c) => c.hasVdomRef),
5845
+ vdomRender: cmps.some((c) => c.hasVdomRender),
5846
+ vdomStyle: cmps.some((c) => c.hasVdomStyle),
5847
+ vdomText: cmps.some((c) => c.hasVdomText),
5848
+ vdomSignals: cmps.some((c) => c.hasSignalsImport),
5849
+ taskQueue: true,
5850
+ patchAll: cmps.some((c) => c.hasPatchAll),
5851
+ patchChildren: cmps.some((c) => c.hasPatchChildren),
5852
+ patchClone: cmps.some((c) => c.hasPatchClone),
5853
+ patchInsert: cmps.some((c) => c.hasPatchInsert)
5854
+ };
5855
+ f.vdomAttribute = f.vdomAttribute || f.reflect;
5856
+ f.vdomPropOrAttr = f.vdomPropOrAttr || f.reflect;
5857
+ return f;
5858
+ };
5859
+ //#endregion
5860
+ //#region src/compiler/style/component-global-styles.ts
5861
+ /**
5862
+ * Match `@import` of a `stencil-*` virtual import in any form CSS allows or a preprocessor emits:
5863
+ * quoted or not, bare or `url()`-wrapped, and with or without whitespace after `@import` (Sass's
5864
+ * compressed output drops it). Capture group 2 holds any trailing modifiers, e.g. `layer(name)`.
5865
+ * @param name the virtual import to match
5866
+ * @returns a global regex
5867
+ */
5868
+ const stencilVirtualImportRe = (name) => new RegExp(`@import(?:\\s+|(?=['"]|url\\())(?:url\\(\\s*)?(['"]?)${name}(?![\\w-])\\1\\s*\\)?([^;]*);?`, "g");
5869
+ stencilVirtualImportRe("stencil-component-globals");
5870
+ stencilVirtualImportRe("stencil-hydrate");
5871
+ stencilVirtualImportRe("stencil-css-components");
5812
5872
  new RegExp(`^(${[.../* @__PURE__ */ new Set([
5813
5873
  "child_process",
5814
5874
  "cluster",
@@ -7357,15 +7417,6 @@ const createSystem = (c) => {
7357
7417
  }
7358
7418
  return results;
7359
7419
  };
7360
- /**
7361
- * `self` is the global namespace object used within a web worker.
7362
- * `window` is the browser's global namespace object (I reorganized this to check the reference on that second)
7363
- * `global` is Node's global namespace object. https://nodejs.org/api/globals.html#globals_global
7364
- *
7365
- * loading in this order should allow workers, which are most common, then browser,
7366
- * then Node to grab the reference to fetch correctly.
7367
- */
7368
- const fetch = typeof self !== "undefined" ? self?.fetch : typeof window !== "undefined" ? window?.fetch : typeof global !== "undefined" ? global?.fetch : void 0;
7369
7420
  const writeFile = async (p, data) => writeFileSync(p, data);
7370
7421
  const tmpDirSync = () => "/.tmp";
7371
7422
  const tick = Promise.resolve();
@@ -7376,6 +7427,7 @@ const createSystem = (c) => {
7376
7427
  if (typeof hashLength === "number") hashHex = hashHex.slice(0, hashLength);
7377
7428
  return hashHex;
7378
7429
  };
7430
+ const generateFileHash = async (filePath, hashLength) => generateContentHash(readFileSync(filePath), hashLength);
7379
7431
  const copy = async (copyTasks, srcDir) => {
7380
7432
  const results = {
7381
7433
  diagnostics: [],
@@ -7385,9 +7437,6 @@ const createSystem = (c) => {
7385
7437
  logger.info("todo, copy task", copyTasks.length, srcDir);
7386
7438
  return results;
7387
7439
  };
7388
- const getEnvironmentVar = (key) => {
7389
- return process$1?.env[key];
7390
- };
7391
7440
  const getLocalModulePath = (opts) => join(opts.rootDir, "node_modules", opts.moduleId, opts.path);
7392
7441
  const getRemoteModuleUrl = (opts) => {
7393
7442
  const npmBaseUrl = "https://cdn.jsdelivr.net/npm/";
@@ -7403,13 +7452,14 @@ const createSystem = (c) => {
7403
7452
  access,
7404
7453
  accessSync,
7405
7454
  addDestroy,
7455
+ checkVersion: async () => noop,
7406
7456
  copyFile,
7407
7457
  createDir,
7408
7458
  createDirSync,
7409
7459
  homeDir,
7410
7460
  isTTY,
7411
- getEnvironmentVar,
7412
7461
  destroy,
7462
+ dynamicImport: (p) => import(p),
7413
7463
  encodeToBase64,
7414
7464
  exit: async (exitCode) => logger.warn(`exit ${exitCode}`),
7415
7465
  getCurrentDirectory,
@@ -7420,6 +7470,7 @@ const createSystem = (c) => {
7420
7470
  isSymbolicLink,
7421
7471
  nextTick,
7422
7472
  normalizePath: normalize,
7473
+ onProcessInterrupt: noop,
7423
7474
  platformPath: path,
7424
7475
  readDir,
7425
7476
  readDirSync,
@@ -7429,7 +7480,6 @@ const createSystem = (c) => {
7429
7480
  realpathSync,
7430
7481
  removeDestroy,
7431
7482
  rename,
7432
- fetch,
7433
7483
  resolvePath,
7434
7484
  removeDir,
7435
7485
  removeDirSync,
@@ -7444,6 +7494,7 @@ const createSystem = (c) => {
7444
7494
  writeFile,
7445
7495
  writeFileSync,
7446
7496
  generateContentHash,
7497
+ generateFileHash,
7447
7498
  createWorkerController: null,
7448
7499
  details: {
7449
7500
  cpuModel: "",