@stencil/core 5.0.0-rc.6 → 5.0.0-rc.8

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.6";
1848
+ const version = "5.0.0-rc.8";
1849
1849
  //#endregion
1850
1850
  //#region src/compiler/events.ts
1851
1851
  const buildEvents = () => {
@@ -3888,6 +3888,33 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
3888
3888
  */
3889
3889
  const isJsDocComment = (commentText) => commentText.startsWith("*") || commentText.startsWith("!");
3890
3890
  /**
3891
+ * An explicit `@prop` annotation tag in a CSS docstring. `@cssprop`/`@cssproperty` are also
3892
+ * recognized as synonyms (the more common names in other web-component-analyzer/docgen
3893
+ * ecosystems).
3894
+ */
3895
+ const CSS_PROP_ANNOTATION_RE = /@(?:cssproperty|cssprop|prop)\b/;
3896
+ /**
3897
+ * An annotation tag that documents something by name (`@prop --x`, `@slot name`, ...) rather
3898
+ * than describing the node below its comment.
3899
+ */
3900
+ const CSS_ANNOTATION_TAG_RE = /@(?:component|cssproperty|cssprop|prop|attr|slot)\b/;
3901
+ const INTERNAL_TAG_RE = /@internal\b/;
3902
+ /**
3903
+ * Whether a comment marks the node immediately following it as internal - excluded from docs,
3904
+ * matching `@internal` on component members.
3905
+ * @param commentText a postcss `Comment` node's `.text`
3906
+ * @returns `true` if the comment is a JSDoc-style comment holding an `@internal` tag
3907
+ */
3908
+ const isInternalDocComment = (commentText) => isJsDocComment(commentText) && INTERNAL_TAG_RE.test(commentText);
3909
+ /**
3910
+ * Whether a comment describes the node immediately following it (a declaration, rule or
3911
+ * at-rule). A comment holding annotation tags documents the things it names instead, and an
3912
+ * `@internal` comment hides the node.
3913
+ * @param commentText a postcss `Comment` node's `.text`
3914
+ * @returns `true` if the comment is a JSDoc-style description of the next node
3915
+ */
3916
+ const isNodeDocComment = (commentText) => isJsDocComment(commentText) && !CSS_ANNOTATION_TAG_RE.test(commentText) && !INTERNAL_TAG_RE.test(commentText);
3917
+ /**
3891
3918
  * Strip the leading `*`/`!` marker and per-line `*` prefixes, returning trimmed lines.
3892
3919
  * @param commentText a postcss `Comment` node's `.text`
3893
3920
  * @returns the comment's lines, delimiters and leading `*`s stripped
@@ -4001,7 +4028,7 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
4001
4028
  const child = children[i];
4002
4029
  if (child.type !== "decl" || !child.prop.startsWith("--") || hasName(child.prop)) continue;
4003
4030
  const prev = children[i - 1];
4004
- if (!prev || prev.type !== "comment" || !isJsDocComment(prev.text)) continue;
4031
+ if (!prev || prev.type !== "comment" || !isNodeDocComment(prev.text)) continue;
4005
4032
  styleDocs.push({
4006
4033
  name: child.prop,
4007
4034
  docs: normalizeJsDocText(prev.text),
@@ -4013,9 +4040,10 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
4013
4040
  root.walkAtRules("property", (node) => {
4014
4041
  const propName = node.params.trim();
4015
4042
  if (!propName.startsWith("--")) return;
4016
- const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
4017
4043
  const prev = node.prev();
4018
- const docs = prev && prev.type === "comment" && isJsDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
4044
+ const isInternal = prev?.type === "comment" && isInternalDocComment(prev.text);
4045
+ const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
4046
+ const docs = prev && prev.type === "comment" && isNodeDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
4019
4047
  const existing = styleDocs.find((styleDoc) => styleDoc.name === propName);
4020
4048
  if (existing) {
4021
4049
  existing.docs ||= docs;
@@ -4023,6 +4051,7 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
4023
4051
  if (initialValue) existing.default ??= initialValue;
4024
4052
  return;
4025
4053
  }
4054
+ if (isInternal) return;
4026
4055
  styleDocs.push({
4027
4056
  name: propName,
4028
4057
  docs,
@@ -4068,12 +4097,6 @@ const CSS_DOC_START = /\/\*(\*|!)/;
4068
4097
  * Closing syntax for a CSS docstring
4069
4098
  */
4070
4099
  const CSS_DOC_END = "*/";
4071
- /**
4072
- * The `@prop` annotation we support within CSS docstrings. `@cssprop`/`@cssproperty` are also
4073
- * recognized as synonyms (the more common names in other web-component-analyzer/docgen
4074
- * ecosystems).
4075
- */
4076
- const CSS_PROP_ANNOTATION_RE = /@(?:cssproperty|cssprop|prop)\b/;
4077
4100
  //#endregion
4078
4101
  //#region src/compiler/sys/browser-stubs/browserslist.ts
4079
4102
  const browserslist = (_query) => [];
@@ -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-BBM6aOyJ.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-C9TOL5Mj.mjs";
2
2
  import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-Bsfi3pOs.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.6";
465
- const buildId = "1795174424";
466
- const vermoji = "🚨";
464
+ const version = "5.0.0-rc.8";
465
+ const buildId = "1795181580";
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.
@@ -1527,6 +1527,33 @@ const propertyToStyleDoc = (prop) => ({
1527
1527
  */
1528
1528
  const isJsDocComment = (commentText) => commentText.startsWith("*") || commentText.startsWith("!");
1529
1529
  /**
1530
+ * An explicit `@prop` annotation tag in a CSS docstring. `@cssprop`/`@cssproperty` are also
1531
+ * recognized as synonyms (the more common names in other web-component-analyzer/docgen
1532
+ * ecosystems).
1533
+ */
1534
+ const CSS_PROP_ANNOTATION_RE = /@(?:cssproperty|cssprop|prop)\b/;
1535
+ /**
1536
+ * An annotation tag that documents something by name (`@prop --x`, `@slot name`, ...) rather
1537
+ * than describing the node below its comment.
1538
+ */
1539
+ const CSS_ANNOTATION_TAG_RE = /@(?:component|cssproperty|cssprop|prop|attr|slot)\b/;
1540
+ const INTERNAL_TAG_RE = /@internal\b/;
1541
+ /**
1542
+ * Whether a comment marks the node immediately following it as internal - excluded from docs,
1543
+ * matching `@internal` on component members.
1544
+ * @param commentText a postcss `Comment` node's `.text`
1545
+ * @returns `true` if the comment is a JSDoc-style comment holding an `@internal` tag
1546
+ */
1547
+ const isInternalDocComment = (commentText) => isJsDocComment(commentText) && INTERNAL_TAG_RE.test(commentText);
1548
+ /**
1549
+ * Whether a comment describes the node immediately following it (a declaration, rule or
1550
+ * at-rule). A comment holding annotation tags documents the things it names instead, and an
1551
+ * `@internal` comment hides the node.
1552
+ * @param commentText a postcss `Comment` node's `.text`
1553
+ * @returns `true` if the comment is a JSDoc-style description of the next node
1554
+ */
1555
+ const isNodeDocComment = (commentText) => isJsDocComment(commentText) && !CSS_ANNOTATION_TAG_RE.test(commentText) && !INTERNAL_TAG_RE.test(commentText);
1556
+ /**
1530
1557
  * Strip the leading `*`/`!` marker and per-line `*` prefixes, returning trimmed lines.
1531
1558
  * @param commentText a postcss `Comment` node's `.text`
1532
1559
  * @returns the comment's lines, delimiters and leading `*`s stripped
@@ -1690,7 +1717,10 @@ const parseCssComponentFile = async (filePath, cssText) => {
1690
1717
  }
1691
1718
  }
1692
1719
  collectAttributeRuleDocs(rawRoot, (selector) => defs.get(selector.tag ?? ""), attributeRuleDocs);
1693
- for (const [def, docsByName] of attributeRuleDocs) for (const attr of def.attributes) if (attr.source === "auto") attr.docs = docsByName.get(attr.name) ?? attr.docs;
1720
+ for (const [def, docsByName] of attributeRuleDocs) {
1721
+ def.attributes = def.attributes.filter((attr) => attr.source !== "auto" || docsByName.get(attr.name) !== null);
1722
+ for (const attr of def.attributes) if (attr.source === "auto") attr.docs = docsByName.get(attr.name) ?? attr.docs;
1723
+ }
1694
1724
  for (const node of nodes) {
1695
1725
  if (node.type !== "rule") continue;
1696
1726
  for (const selector of parseSelectorList(node.selector)) {
@@ -1704,9 +1734,10 @@ const parseCssComponentFile = async (filePath, cssText) => {
1704
1734
  if (node.type !== "atrule" || node.name !== "property") continue;
1705
1735
  const propName = node.params.trim();
1706
1736
  if (!propName.startsWith("--")) continue;
1707
- const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
1708
1737
  const prev = nodes[i - 1];
1709
- const docs = prev && prev.type === "comment" && isJsDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
1738
+ const isInternal = prev?.type === "comment" && isInternalDocComment(prev.text);
1739
+ const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
1740
+ const docs = prev && prev.type === "comment" && isNodeDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
1710
1741
  for (const def of defs.values()) {
1711
1742
  const existing = def.properties.find((p) => p.name === propName);
1712
1743
  if (existing) {
@@ -1715,6 +1746,7 @@ const parseCssComponentFile = async (filePath, cssText) => {
1715
1746
  if (initialValue) existing.default ??= initialValue;
1716
1747
  continue;
1717
1748
  }
1749
+ if (isInternal) continue;
1718
1750
  const prop = {
1719
1751
  name: propName,
1720
1752
  docs,
@@ -1738,6 +1770,7 @@ const parseCssComponentFile = async (filePath, cssText) => {
1738
1770
  * @param def the CSS-only component definition the found slots belong to
1739
1771
  */
1740
1772
  const collectAutoDetectedSlots = (container, def) => {
1773
+ const internal = /* @__PURE__ */ new Set();
1741
1774
  for (const nested of container.nodes) {
1742
1775
  if (nested.type !== "rule") continue;
1743
1776
  const names = /* @__PURE__ */ new Set();
@@ -1748,10 +1781,15 @@ const collectAutoDetectedSlots = (container, def) => {
1748
1781
  } catch {
1749
1782
  continue;
1750
1783
  }
1784
+ const prev = nested.prev();
1785
+ const isInternal = prev?.type === "comment" && isInternalDocComment(prev.text);
1751
1786
  for (const name of names) {
1752
- if (def.slots.some((s) => s.name === name)) continue;
1753
- const prev = nested.prev();
1754
- const docs = prev && prev.type === "comment" && isJsDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
1787
+ if (internal.has(name) || def.slots.some((s) => s.name === name)) continue;
1788
+ if (isInternal) {
1789
+ internal.add(name);
1790
+ continue;
1791
+ }
1792
+ const docs = prev && prev.type === "comment" && isNodeDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
1755
1793
  def.slots.push({
1756
1794
  name,
1757
1795
  docs,
@@ -1848,8 +1886,8 @@ const collectAutoDetectedAttributes = (selector, def) => {
1848
1886
  };
1849
1887
  /**
1850
1888
  * Record the JSDoc comment directly above each of `container`'s child rules as the description
1851
- * of the attributes in that rule's leading compound selector. The first documented rule for an
1852
- * attribute wins.
1889
+ * of the attributes in that rule's leading compound selector, or `null` for an `@internal`
1890
+ * comment. The first documented rule for an attribute wins.
1853
1891
  * @param container a container whose direct child rules to scan
1854
1892
  * @param defFor the component a child rule's selector belongs to, if any
1855
1893
  * @param out collected descriptions, per component, by attribute name
@@ -1857,14 +1895,16 @@ const collectAutoDetectedAttributes = (selector, def) => {
1857
1895
  const collectAttributeRuleDocs = (container, defFor, out) => {
1858
1896
  for (const node of container.nodes) {
1859
1897
  const prev = node.prev();
1860
- if (node.type !== "rule" || prev?.type !== "comment" || !isJsDocComment(prev.text)) continue;
1898
+ if (node.type !== "rule" || prev?.type !== "comment") continue;
1899
+ const isInternal = isInternalDocComment(prev.text);
1900
+ if (!isInternal && !isNodeDocComment(prev.text)) continue;
1861
1901
  let selectors;
1862
1902
  try {
1863
1903
  selectors = parseSelectorList(node.selector);
1864
1904
  } catch {
1865
1905
  continue;
1866
1906
  }
1867
- const docs = normalizeJsDocText(prev.text);
1907
+ const docs = isInternal ? null : normalizeJsDocText(prev.text);
1868
1908
  for (const selector of selectors) {
1869
1909
  const def = defFor(selector);
1870
1910
  if (!def) continue;
@@ -1887,7 +1927,7 @@ const collectAutoDetectedCustomProperties = (container, def) => {
1887
1927
  if (child.type !== "decl" || !child.prop.startsWith("--")) continue;
1888
1928
  if (def.properties.some((p) => p.name === child.prop)) continue;
1889
1929
  const prev = children[i - 1];
1890
- if (!prev || prev.type !== "comment" || !isJsDocComment(prev.text)) continue;
1930
+ if (!prev || prev.type !== "comment" || !isNodeDocComment(prev.text)) continue;
1891
1931
  def.properties.push({
1892
1932
  name: child.prop,
1893
1933
  docs: normalizeJsDocText(prev.text),
@@ -25410,7 +25450,7 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
25410
25450
  const child = children[i];
25411
25451
  if (child.type !== "decl" || !child.prop.startsWith("--") || hasName(child.prop)) continue;
25412
25452
  const prev = children[i - 1];
25413
- if (!prev || prev.type !== "comment" || !isJsDocComment(prev.text)) continue;
25453
+ if (!prev || prev.type !== "comment" || !isNodeDocComment(prev.text)) continue;
25414
25454
  styleDocs.push({
25415
25455
  name: child.prop,
25416
25456
  docs: normalizeJsDocText(prev.text),
@@ -25422,9 +25462,10 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
25422
25462
  root.walkAtRules("property", (node) => {
25423
25463
  const propName = node.params.trim();
25424
25464
  if (!propName.startsWith("--")) return;
25425
- const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
25426
25465
  const prev = node.prev();
25427
- const docs = prev && prev.type === "comment" && isJsDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
25466
+ const isInternal = prev?.type === "comment" && isInternalDocComment(prev.text);
25467
+ const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
25468
+ const docs = prev && prev.type === "comment" && isNodeDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
25428
25469
  const existing = styleDocs.find((styleDoc) => styleDoc.name === propName);
25429
25470
  if (existing) {
25430
25471
  existing.docs ||= docs;
@@ -25432,6 +25473,7 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
25432
25473
  if (initialValue) existing.default ??= initialValue;
25433
25474
  return;
25434
25475
  }
25476
+ if (isInternal) return;
25435
25477
  styleDocs.push({
25436
25478
  name: propName,
25437
25479
  docs,
@@ -25477,12 +25519,6 @@ const CSS_DOC_START = /\/\*(\*|!)/;
25477
25519
  * Closing syntax for a CSS docstring
25478
25520
  */
25479
25521
  const CSS_DOC_END = "*/";
25480
- /**
25481
- * The `@prop` annotation we support within CSS docstrings. `@cssprop`/`@cssproperty` are also
25482
- * recognized as synonyms (the more common names in other web-component-analyzer/docgen
25483
- * ecosystems).
25484
- */
25485
- const CSS_PROP_ANNOTATION_RE = /@(?:cssproperty|cssprop|prop)\b/;
25486
25522
  //#endregion
25487
25523
  //#region src/compiler/style/css-to-esm.ts
25488
25524
  /**
@@ -1,4 +1,4 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-BBM6aOyJ.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-C9TOL5Mj.mjs";
2
2
  import { t as createNodeSys } from "../../node-Bsfi3pOs.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.6";
36
+ const version = "5.0.0-rc.8";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-rc.6",
3
+ "version": "5.0.0-rc.8",
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.6",
130
- "@stencil/mock-doc": "5.0.0-rc.6",
131
- "@stencil/dev-server": "5.0.0-rc.6"
129
+ "@stencil/mock-doc": "5.0.0-rc.8",
130
+ "@stencil/cli": "5.0.0-rc.8",
131
+ "@stencil/dev-server": "5.0.0-rc.8"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",