@stencil/core 4.38.3-dev.1764565869.fa9a025 → 4.38.3-dev.1764708888.c031e0a

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 (45) hide show
  1. package/cli/index.cjs +2 -1
  2. package/cli/index.js +2 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/package.json +1 -1
  5. package/compiler/stencil.js +16369 -5558
  6. package/dev-server/client/index.js +1 -1
  7. package/dev-server/client/package.json +1 -1
  8. package/dev-server/connector.html +2 -2
  9. package/dev-server/index.js +1 -1
  10. package/dev-server/package.json +1 -1
  11. package/dev-server/server-process.js +6 -5
  12. package/internal/app-data/index.cjs +1 -0
  13. package/internal/app-data/index.js +1 -0
  14. package/internal/app-data/package.json +1 -1
  15. package/internal/app-globals/package.json +1 -1
  16. package/internal/client/index.js +33 -10
  17. package/internal/client/package.json +1 -1
  18. package/internal/client/patch-browser.js +1 -1
  19. package/internal/hydrate/index.js +35 -5
  20. package/internal/hydrate/package.json +1 -1
  21. package/internal/hydrate/runner.d.ts +12 -0
  22. package/internal/hydrate/runner.js +1357 -1330
  23. package/internal/package.json +1 -1
  24. package/internal/stencil-core/index.d.ts +2 -0
  25. package/internal/stencil-private.d.ts +3 -0
  26. package/internal/stencil-public-compiler.d.ts +13 -0
  27. package/internal/stencil-public-runtime.d.ts +22 -0
  28. package/internal/testing/index.js +30 -4
  29. package/internal/testing/package.json +1 -1
  30. package/mock-doc/index.cjs +226 -226
  31. package/mock-doc/index.js +226 -226
  32. package/mock-doc/package.json +1 -1
  33. package/package.json +4 -1
  34. package/screenshot/index.js +2 -1
  35. package/screenshot/package.json +1 -1
  36. package/screenshot/pixel-match.js +3 -3
  37. package/sys/node/autoprefixer.js +2 -2
  38. package/sys/node/glob.js +1 -1
  39. package/sys/node/index.js +18 -18
  40. package/sys/node/node-fetch.js +1 -1
  41. package/sys/node/package.json +1 -1
  42. package/sys/node/worker.js +1 -1
  43. package/testing/index.js +35 -7
  44. package/testing/package.json +1 -1
  45. package/testing/puppeteer/puppeteer-browser.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Platform v4.38.3-dev.1764565869.fa9a025 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v4.38.3-dev.1764708888.c031e0a | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -146,7 +146,6 @@ var setErrorHandler = (handler) => customError = handler;
146
146
 
147
147
  // src/client/client-load-module.ts
148
148
  var cmpModules = /* @__PURE__ */ new Map();
149
- var MODULE_IMPORT_PREFIX = "./";
150
149
  var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
151
150
  const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
152
151
  const bundleId = cmpMeta.$lazyBundleId$;
@@ -163,12 +162,12 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
163
162
  return module[exportName];
164
163
  }
165
164
  /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
165
+ const hmr = BUILD5.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : "";
166
+ const dynamicImportPath = `./${bundleId}.entry.js${hmr}`;
166
167
  return import(
167
168
  /* @vite-ignore */
168
- /* webpackInclude: /\.entry\.js$/ */
169
- /* webpackExclude: /\.system\.entry\.js$/ */
170
- /* webpackMode: "lazy" */
171
- `./${bundleId}.entry.js${BUILD5.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : ""}`
169
+ /* webpackIgnore: true */
170
+ dynamicImportPath
172
171
  ).then(
173
172
  (importedModule) => {
174
173
  if (!BUILD5.hotModuleReplacement) {
@@ -1306,6 +1305,9 @@ var hydrateScopedToShadow = () => {
1306
1305
  // src/runtime/vdom/h.ts
1307
1306
  import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
1308
1307
  var h = (nodeName, vnodeData, ...children) => {
1308
+ if (typeof nodeName === "string") {
1309
+ nodeName = transformTag(nodeName);
1310
+ }
1309
1311
  let child = null;
1310
1312
  let key = null;
1311
1313
  let slotName = null;
@@ -1488,7 +1490,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1488
1490
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1489
1491
  const node = childRenderNode.$elm$;
1490
1492
  if (!shadowRoot) {
1491
- node["s-hn"] = tagName.toUpperCase();
1493
+ node["s-hn"] = transformTag(tagName).toUpperCase();
1492
1494
  if (childRenderNode.$tag$ === "slot") {
1493
1495
  node["s-cr"] = hostElm["s-cr"];
1494
1496
  }
@@ -3082,7 +3084,7 @@ render() {
3082
3084
  if (BUILD20.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3083
3085
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
3084
3086
  for (const childNode of children) {
3085
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
3087
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"] && childNode.nodeType === 1 /* ElementNode */) {
3086
3088
  if (isInitialLoad && childNode["s-ih"] == null) {
3087
3089
  childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
3088
3090
  }
@@ -3922,7 +3924,10 @@ var disconnectedCallback = async (elm) => {
3922
3924
 
3923
3925
  // src/runtime/bootstrap-custom-element.ts
3924
3926
  var defineCustomElement = (Cstr, compactMeta) => {
3925
- customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
3927
+ customElements.define(
3928
+ transformTag(compactMeta[1]),
3929
+ proxyCustomElement(Cstr, compactMeta)
3930
+ );
3926
3931
  };
3927
3932
  var proxyCustomElement = (Cstr, compactMeta) => {
3928
3933
  const cmpMeta = {
@@ -4113,7 +4118,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
4113
4118
  if (BUILD28.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
4114
4119
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
4115
4120
  }
4116
- const tagName = BUILD28.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
4121
+ const tagName = BUILD28.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : transformTag(cmpMeta.$tagName$);
4117
4122
  const HostElement = class extends HTMLElement {
4118
4123
  // StencilLazyHost
4119
4124
  constructor(self) {
@@ -4331,6 +4336,22 @@ function render(vnode, container) {
4331
4336
  renderVdom(ref, vnode);
4332
4337
  }
4333
4338
 
4339
+ // src/runtime/tag-transform.ts
4340
+ var tagTransformer = void 0;
4341
+ function transformTag(tag) {
4342
+ if (!tagTransformer) return tag;
4343
+ return tagTransformer(tag);
4344
+ }
4345
+ function setTagTransformer(transformer) {
4346
+ if (tagTransformer) {
4347
+ console.warn(`
4348
+ A tagTransformer has already been set.
4349
+ Overwriting it may lead to error and unexpected results if your components have already been defined.
4350
+ `);
4351
+ }
4352
+ tagTransformer = transformer;
4353
+ }
4354
+
4334
4355
  // src/runtime/vdom/vdom-annotations.ts
4335
4356
  var insertVdomAnnotations = (doc, staticComponents) => {
4336
4357
  if (doc != null) {
@@ -4531,12 +4552,14 @@ export {
4531
4552
  setPlatformHelpers,
4532
4553
  setPlatformOptions,
4533
4554
  setScopedSSR,
4555
+ setTagTransformer,
4534
4556
  setValue,
4535
4557
  styles,
4536
4558
  supportsConstructableStylesheets,
4537
4559
  supportsListenerOptions,
4538
4560
  supportsMutableAdoptedStyleSheets,
4539
4561
  supportsShadow,
4562
+ transformTag,
4540
4563
  win,
4541
4564
  writeTask
4542
4565
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/client",
3
- "version": "4.38.3-dev.1764565869.fa9a025",
3
+ "version": "4.38.3-dev.1764708888.c031e0a",
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,5 +1,5 @@
1
1
  /*
2
- Stencil Client Patch Browser v4.38.3-dev.1764565869.fa9a025 | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Patch Browser v4.38.3-dev.1764708888.c031e0a | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/client/client-patch-browser.ts
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Platform v4.38.3-dev.1764565869.fa9a025 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Platform v4.38.3-dev.1764708888.c031e0a | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -1070,6 +1070,9 @@ var hydrateScopedToShadow = () => {
1070
1070
  // src/runtime/vdom/h.ts
1071
1071
  import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
1072
1072
  var h = (nodeName, vnodeData, ...children) => {
1073
+ if (typeof nodeName === "string") {
1074
+ nodeName = transformTag(nodeName);
1075
+ }
1073
1076
  let child = null;
1074
1077
  let key = null;
1075
1078
  let slotName = null;
@@ -1252,7 +1255,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1252
1255
  const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1253
1256
  const node = childRenderNode.$elm$;
1254
1257
  if (!shadowRoot) {
1255
- node["s-hn"] = tagName.toUpperCase();
1258
+ node["s-hn"] = transformTag(tagName).toUpperCase();
1256
1259
  if (childRenderNode.$tag$ === "slot") {
1257
1260
  node["s-cr"] = hostElm["s-cr"];
1258
1261
  }
@@ -2846,7 +2849,7 @@ render() {
2846
2849
  if (BUILD14.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2847
2850
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
2848
2851
  for (const childNode of children) {
2849
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
2852
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"] && childNode.nodeType === 1 /* ElementNode */) {
2850
2853
  if (isInitialLoad && childNode["s-ih"] == null) {
2851
2854
  childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
2852
2855
  }
@@ -3686,7 +3689,10 @@ var disconnectedCallback = async (elm) => {
3686
3689
 
3687
3690
  // src/runtime/bootstrap-custom-element.ts
3688
3691
  var defineCustomElement = (Cstr, compactMeta) => {
3689
- customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
3692
+ customElements.define(
3693
+ transformTag(compactMeta[1]),
3694
+ proxyCustomElement(Cstr, compactMeta)
3695
+ );
3690
3696
  };
3691
3697
  var proxyCustomElement = (Cstr, compactMeta) => {
3692
3698
  const cmpMeta = {
@@ -3877,7 +3883,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3877
3883
  if (BUILD22.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3878
3884
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
3879
3885
  }
3880
- const tagName = BUILD22.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
3886
+ const tagName = BUILD22.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : transformTag(cmpMeta.$tagName$);
3881
3887
  const HostElement = class extends HTMLElement {
3882
3888
  // StencilLazyHost
3883
3889
  constructor(self) {
@@ -4078,6 +4084,22 @@ function Mixin(...mixins) {
4078
4084
  // src/runtime/nonce.ts
4079
4085
  var setNonce = (nonce) => plt.$nonce$ = nonce;
4080
4086
 
4087
+ // src/runtime/tag-transform.ts
4088
+ var tagTransformer = void 0;
4089
+ function transformTag(tag) {
4090
+ if (!tagTransformer) return tag;
4091
+ return tagTransformer(tag);
4092
+ }
4093
+ function setTagTransformer(transformer) {
4094
+ if (tagTransformer) {
4095
+ console.warn(`
4096
+ A tagTransformer has already been set.
4097
+ Overwriting it may lead to error and unexpected results if your components have already been defined.
4098
+ `);
4099
+ }
4100
+ tagTransformer = transformer;
4101
+ }
4102
+
4081
4103
  // src/runtime/vdom/vdom-annotations.ts
4082
4104
  var insertVdomAnnotations = (doc, staticComponents) => {
4083
4105
  if (doc != null) {
@@ -4652,9 +4674,15 @@ var isMemberInElement = (elm, memberName) => {
4652
4674
  var registerComponents = (Cstrs) => {
4653
4675
  for (const Cstr of Cstrs) {
4654
4676
  const exportName = Cstr.cmpMeta.$tagName$;
4677
+ const transformedTagName = everywhere.tagTransform(exportName);
4655
4678
  cmpModules.set(exportName, {
4656
4679
  [exportName]: Cstr
4657
4680
  });
4681
+ if (transformedTagName !== exportName) {
4682
+ cmpModules.set(transformedTagName, {
4683
+ [transformedTagName]: Cstr
4684
+ });
4685
+ }
4658
4686
  }
4659
4687
  };
4660
4688
  var win = window;
@@ -4803,12 +4831,14 @@ export {
4803
4831
  setNonce,
4804
4832
  setPlatformHelpers,
4805
4833
  setScopedSSR,
4834
+ setTagTransformer,
4806
4835
  setValue,
4807
4836
  styles,
4808
4837
  supportsConstructableStylesheets,
4809
4838
  supportsListenerOptions,
4810
4839
  supportsMutableAdoptedStyleSheets,
4811
4840
  supportsShadow,
4841
+ transformTag,
4812
4842
  win,
4813
4843
  writeTask
4814
4844
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/hydrate",
3
- "version": "4.38.3-dev.1764565869.fa9a025",
3
+ "version": "4.38.3-dev.1764708888.c031e0a",
4
4
  "description": "Stencil internal hydrate platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true
@@ -3,6 +3,7 @@
3
3
  import { Readable } from 'node:stream';
4
4
 
5
5
  export declare function createWindowFromHtml(templateHtml: string, uniqueId: string): any;
6
+ export type TagTransformer = (tag: string) => string;
6
7
  /**
7
8
  * Serialize a value to a string that can be deserialized later.
8
9
  * @param {unknown} value - The value to serialize.
@@ -271,5 +272,16 @@ export declare function renderToString(html: string | any, options: SerializeDoc
271
272
  export declare function hydrateDocument(doc: any | string, options?: HydrateDocumentOptions): Promise<HydrateResults>;
272
273
  export declare function hydrateDocument(doc: any | string, options: HydrateDocumentOptions | undefined, asStream?: boolean): Readable;
273
274
  export declare function serializeDocumentToString(doc: Document, opts: HydrateFactoryOptions): string;
275
+ /**
276
+ * Transforms a tag name using the current tag transformer
277
+ * @param tag - the tag to transform e.g. `my-tag`
278
+ * @returns the transformed tag e.g. `new-my-tag`
279
+ */
280
+ export declare function transformTag<T extends string>(tag: T): T;
281
+ /**
282
+ * Sets the tag transformer to be used when rendering custom elements
283
+ * @param transformer the transformer function to use. Must return a string
284
+ */
285
+ export declare function setTagTransformer(transformer: TagTransformer): void;
274
286
 
275
287
  export {};