@stencil/core 5.0.0-rc.7 → 5.0.0-rc.9

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,9 +1,9 @@
1
1
  import { n as __require } from "./rolldown-runtime-BhDjJH2R.mjs";
2
- import { A as SSR_PROP_REF_PREFIX, D as HYDRATE_ID, E as HYDRATE_CHILD_ID, O as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, k as SSR_PROPS_REGISTRY_KEY, w as CLIENT_BUILD_FLAGS } from "./client-BA_FU9aB.mjs";
2
+ import { A as SSR_PROP_REF_PREFIX, D as HYDRATE_ID, E as HYDRATE_CHILD_ID, O as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, k as SSR_PROPS_REGISTRY_KEY, w as CLIENT_BUILD_FLAGS } from "./client-DkvdNuPu.mjs";
3
3
  import { $ as VALID_CONFIG_OUTPUT_TARGETS, A as DIST_LAZY, D as COPY, E as COLLECTION_MANIFEST_FILE_NAME, J as STANDALONE, L as EVENT_FLAGS, P as DOCS_JSON, Q as TYPES, R as GENERATED_DTS, S as ASSETS, T as COLLECTION_APP_DATA_FILE_NAME, U as LOADER_BUNDLE, X as STYLE_EXT, Y as STATS, a as isBoolean$1, b as unique, c as isFunction, d as isObject, et as WATCH_FLAGS, f as isString$1, g as sortBy, i as fromEntries, l as isIterable, m as noop, p as mergeIntoWith, r as flatOne, t as dashToPascalCase, u as isNumber$1, v as toDashCase, w as COLLECTION, y as toTitleCase, z as GLOBAL_STYLE } from "./helpers-pTCZhNi0.mjs";
4
4
  import { C as isRootPath, D as byteSize, E as stringifyRuntimeData, O as escapeRegExpSpecialCharacters, S as splitLineBreaks, _ as createOnWarnFn, a as getRolldownSourceMapOptions, c as relativizeSourceMap, d as map, f as ok, g as loadTypeScriptDiagnostics, h as loadTypeScriptDiagnostic, i as getInlineSourceMappingUrlLinker, l as rolldownToStencilSourceMap, m as augmentDiagnosticWithNode, n as validateComponentTag, o as getSourceMappingUrlForEndOfFile, r as isRemoteUrl, t as validateComponentModes, u as err, v as isRolldownError, w as formatComponentRuntimeMeta, x as normalizeDiagnostics, y as loadRolldownDiagnostics } from "./validation-C1mr0klL.mjs";
5
5
  import { $ as buildWarn, A as isOutputTargetDocsVscode, B as isValidConfigOutputTarget, C as isOutputTargetDistLazy, D as isOutputTargetDocsCustomElementsManifest, E as isOutputTargetDocsCustom, F as isOutputTargetSsrWasm, G as normalizeFsPath, H as shouldExcludeComponent, I as isOutputTargetStandalone, J as relative$1, K as normalizeFsPathQuery, L as isOutputTargetStats, M as isOutputTargetLoaderBundle, N as isOutputTargetServerRenderer, O as isOutputTargetDocsJson, P as isOutputTargetSsr, Q as buildJsonFileError, R as isOutputTargetTypes, S as isOutputTargetCustom, T as isOutputTargetDocsAgentSkill, U as join$2, V as relativeImport, Y as resolve$2, Z as buildError, a as hasDependency, b as isOutputTargetCollection, d as parsePackageJson, et as catchError, f as readOnlyArrayHasStringMember, g as getComponentsDtsSrcFilePath, h as filterExcludedComponents, i as getTextDocs, it as isGlob, j as isOutputTargetGlobalStyle, k as isOutputTargetDocsReadme, l as isTsFile, m as filterActiveTargets, n as createJsVarName, nt as hasWarning, o as isDtsFile, p as readPackageJson, q as normalizePath, r as generatePreamble, t as addDocBlock, tt as hasError, u as isTsxFile, v as getComponentsFromModules, w as isOutputTargetDocs, x as isOutputTargetCopy, y as isOutputTargetAssets, z as isOutputTargetWww } from "./util-CP6-333M.mjs";
6
- import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-Bsfi3pOs.mjs";
6
+ import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-C59vQZNg.mjs";
7
7
  import ts, { default as ts$1 } from "typescript";
8
8
  import { readFileSync } from "node:fs";
9
9
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
@@ -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.7";
465
- const buildId = "1795178487";
466
- const vermoji = "⛳️";
464
+ const version = "5.0.0-rc.9";
465
+ const buildId = "1795554832";
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.
@@ -1537,13 +1537,22 @@ const CSS_PROP_ANNOTATION_RE = /@(?:cssproperty|cssprop|prop)\b/;
1537
1537
  * than describing the node below its comment.
1538
1538
  */
1539
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);
1540
1548
  /**
1541
1549
  * Whether a comment describes the node immediately following it (a declaration, rule or
1542
- * at-rule). A comment holding annotation tags documents the things it names instead.
1550
+ * at-rule). A comment holding annotation tags documents the things it names instead, and an
1551
+ * `@internal` comment hides the node.
1543
1552
  * @param commentText a postcss `Comment` node's `.text`
1544
1553
  * @returns `true` if the comment is a JSDoc-style description of the next node
1545
1554
  */
1546
- const isNodeDocComment = (commentText) => isJsDocComment(commentText) && !CSS_ANNOTATION_TAG_RE.test(commentText);
1555
+ const isNodeDocComment = (commentText) => isJsDocComment(commentText) && !CSS_ANNOTATION_TAG_RE.test(commentText) && !INTERNAL_TAG_RE.test(commentText);
1547
1556
  /**
1548
1557
  * Strip the leading `*`/`!` marker and per-line `*` prefixes, returning trimmed lines.
1549
1558
  * @param commentText a postcss `Comment` node's `.text`
@@ -1708,7 +1717,10 @@ const parseCssComponentFile = async (filePath, cssText) => {
1708
1717
  }
1709
1718
  }
1710
1719
  collectAttributeRuleDocs(rawRoot, (selector) => defs.get(selector.tag ?? ""), attributeRuleDocs);
1711
- 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
+ }
1712
1724
  for (const node of nodes) {
1713
1725
  if (node.type !== "rule") continue;
1714
1726
  for (const selector of parseSelectorList(node.selector)) {
@@ -1722,8 +1734,9 @@ const parseCssComponentFile = async (filePath, cssText) => {
1722
1734
  if (node.type !== "atrule" || node.name !== "property") continue;
1723
1735
  const propName = node.params.trim();
1724
1736
  if (!propName.startsWith("--")) continue;
1725
- const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
1726
1737
  const prev = nodes[i - 1];
1738
+ const isInternal = prev?.type === "comment" && isInternalDocComment(prev.text);
1739
+ const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
1727
1740
  const docs = prev && prev.type === "comment" && isNodeDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
1728
1741
  for (const def of defs.values()) {
1729
1742
  const existing = def.properties.find((p) => p.name === propName);
@@ -1733,6 +1746,7 @@ const parseCssComponentFile = async (filePath, cssText) => {
1733
1746
  if (initialValue) existing.default ??= initialValue;
1734
1747
  continue;
1735
1748
  }
1749
+ if (isInternal) continue;
1736
1750
  const prop = {
1737
1751
  name: propName,
1738
1752
  docs,
@@ -1756,6 +1770,7 @@ const parseCssComponentFile = async (filePath, cssText) => {
1756
1770
  * @param def the CSS-only component definition the found slots belong to
1757
1771
  */
1758
1772
  const collectAutoDetectedSlots = (container, def) => {
1773
+ const internal = /* @__PURE__ */ new Set();
1759
1774
  for (const nested of container.nodes) {
1760
1775
  if (nested.type !== "rule") continue;
1761
1776
  const names = /* @__PURE__ */ new Set();
@@ -1766,9 +1781,14 @@ const collectAutoDetectedSlots = (container, def) => {
1766
1781
  } catch {
1767
1782
  continue;
1768
1783
  }
1784
+ const prev = nested.prev();
1785
+ const isInternal = prev?.type === "comment" && isInternalDocComment(prev.text);
1769
1786
  for (const name of names) {
1770
- if (def.slots.some((s) => s.name === name)) continue;
1771
- const prev = nested.prev();
1787
+ if (internal.has(name) || def.slots.some((s) => s.name === name)) continue;
1788
+ if (isInternal) {
1789
+ internal.add(name);
1790
+ continue;
1791
+ }
1772
1792
  const docs = prev && prev.type === "comment" && isNodeDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
1773
1793
  def.slots.push({
1774
1794
  name,
@@ -1866,8 +1886,8 @@ const collectAutoDetectedAttributes = (selector, def) => {
1866
1886
  };
1867
1887
  /**
1868
1888
  * Record the JSDoc comment directly above each of `container`'s child rules as the description
1869
- * of the attributes in that rule's leading compound selector. The first documented rule for an
1870
- * 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.
1871
1891
  * @param container a container whose direct child rules to scan
1872
1892
  * @param defFor the component a child rule's selector belongs to, if any
1873
1893
  * @param out collected descriptions, per component, by attribute name
@@ -1875,14 +1895,16 @@ const collectAutoDetectedAttributes = (selector, def) => {
1875
1895
  const collectAttributeRuleDocs = (container, defFor, out) => {
1876
1896
  for (const node of container.nodes) {
1877
1897
  const prev = node.prev();
1878
- if (node.type !== "rule" || prev?.type !== "comment" || !isNodeDocComment(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;
1879
1901
  let selectors;
1880
1902
  try {
1881
1903
  selectors = parseSelectorList(node.selector);
1882
1904
  } catch {
1883
1905
  continue;
1884
1906
  }
1885
- const docs = normalizeJsDocText(prev.text);
1907
+ const docs = isInternal ? null : normalizeJsDocText(prev.text);
1886
1908
  for (const selector of selectors) {
1887
1909
  const def = defFor(selector);
1888
1910
  if (!def) continue;
@@ -8986,8 +9008,57 @@ const ProgressTask = {
8986
9008
  const AUTO_GENERATE_COMMENT = `<!-- Auto Generated Below -->`;
8987
9009
  const NOTE = `*Built with [StencilJS](https://stenciljs.com/)*`;
8988
9010
  //#endregion
9011
+ //#region src/compiler/docs/jsdoc-links.ts
9012
+ /**
9013
+ * Matches JSDoc inline link tags that reference a URL, in the
9014
+ * `[label]{@link url}`, `{@link url|label}` or `{@link url label}` form.
9015
+ */
9016
+ const JSDOC_URL_LINK_REGEX = /(?:\[([^\]]*)\])?\{@link\s+(https?:\/\/[^\s|}]+)(?:\s*[|\s]\s*([^}]*?))?\s*\}/g;
9017
+ /**
9018
+ * Converts JSDoc inline link tags that reference a URL into markdown links.
9019
+ *
9020
+ * Documentation output targets (docs-readme, docs-json, docs-vscode) treat their
9021
+ * `docs` fields as markdown, so URL-based `{@link}` tags are converted so they
9022
+ * render as links.
9023
+ *
9024
+ * Symbol links like `{@link MyClass#foo}` are left untouched, since resolving them
9025
+ * to a URL would require type information the docs generators do not have.
9026
+ *
9027
+ * @param text the JSDoc text to convert
9028
+ * @returns the text with URL-based `{@link}` tags converted to markdown links
9029
+ */
9030
+ const convertJsdocLinksToMarkdown = (text) => {
9031
+ if (!text || !text.includes("{@link")) return text;
9032
+ return text.replace(JSDOC_URL_LINK_REGEX, (_match, prefixLabel, url, label) => {
9033
+ return `[${prefixLabel?.trim() || label?.trim() || url}](${url})`;
9034
+ });
9035
+ };
9036
+ /**
9037
+ * Converts URL-based `{@link}` tags in the text of JSDoc tag infos (e.g. the texts
9038
+ * behind `@deprecated` or `@returns`) into markdown links, so tag-derived docs
9039
+ * fields render as links too.
9040
+ * @param tags the JSDoc tag infos to convert
9041
+ * @returns new tag infos with URL-based `{@link}` tags converted to markdown links
9042
+ */
9043
+ const convertJsdocTagsToMarkdown = (tags) => {
9044
+ return tags.map((tag) => ({
9045
+ ...tag,
9046
+ text: convertJsdocLinksToMarkdown(tag.text)
9047
+ }));
9048
+ };
9049
+ //#endregion
8989
9050
  //#region src/compiler/docs/generate-doc-data.ts
8990
9051
  /**
9052
+ * Converts the text and tag texts of a component's JSDoc into markdown, so every
9053
+ * docs field derived from it renders URL-based `{@link}` tags as markdown links.
9054
+ * @param jsdoc the JSDoc to convert
9055
+ * @returns the converted JSDoc
9056
+ */
9057
+ const convertCompilerJsDoc = (jsdoc) => ({
9058
+ text: convertJsdocLinksToMarkdown(jsdoc.text),
9059
+ tags: convertJsdocTagsToMarkdown(jsdoc.tags)
9060
+ });
9061
+ /**
8991
9062
  * Generate metadata that will be used to generate any given documentation-related
8992
9063
  * output target(s)
8993
9064
  *
@@ -9038,32 +9109,35 @@ const getDocsComponents = async (config, compilerCtx, buildCtx) => {
9038
9109
  const usagesDir = normalizePath(join$2(dirPath, "usage"));
9039
9110
  const readme = await getUserReadmeContent(compilerCtx, readmePath);
9040
9111
  const usage = await generateUsages(compilerCtx, usagesDir);
9041
- return moduleFile.cmps.filter((cmp) => !cmp.internal && !cmp.isCollectionDependency).map((cmp) => ({
9042
- dirPath,
9043
- filePath: normalizePath(relative$1(config.rootDir, filePath), false),
9044
- fileName: basename$1(filePath),
9045
- readmePath,
9046
- usagesDir,
9047
- tag: cmp.tagName,
9048
- readme,
9049
- overview: cmp.docs.text,
9050
- usage,
9051
- docs: generateDocs(readme, cmp.docs),
9052
- docsTags: cmp.docs.tags,
9053
- encapsulation: getDocsEncapsulation(cmp),
9054
- dependents: cmp.directDependents,
9055
- dependencies: cmp.directDependencies,
9056
- dependencyGraph: buildDocsDepGraph(cmp, buildCtx.components),
9057
- deprecation: getDocsDeprecationText(cmp.docs.tags),
9058
- props: getDocsProperties(cmp),
9059
- methods: getDocsMethods(cmp.methods),
9060
- events: getDocsEvents(cmp.events),
9061
- styles: getDocsStyles(cmp),
9062
- slots: getDocsSlots(cmp.htmlSlots, cmp.docs.tags),
9063
- parts: getDocsParts(cmp.htmlParts, cmp.docs.tags),
9064
- customStates: getDocsCustomStates(cmp),
9065
- listeners: getDocsListeners(cmp.listeners)
9066
- }));
9112
+ return moduleFile.cmps.filter((cmp) => !cmp.internal && !cmp.isCollectionDependency).map((cmp) => {
9113
+ const docs = convertCompilerJsDoc(cmp.docs);
9114
+ return {
9115
+ dirPath,
9116
+ filePath: normalizePath(relative$1(config.rootDir, filePath), false),
9117
+ fileName: basename$1(filePath),
9118
+ readmePath,
9119
+ usagesDir,
9120
+ tag: cmp.tagName,
9121
+ readme,
9122
+ overview: docs.text,
9123
+ usage,
9124
+ docs: generateDocs(readme, docs),
9125
+ docsTags: docs.tags,
9126
+ encapsulation: getDocsEncapsulation(cmp),
9127
+ dependents: cmp.directDependents,
9128
+ dependencies: cmp.directDependencies,
9129
+ dependencyGraph: buildDocsDepGraph(cmp, buildCtx.components),
9130
+ deprecation: getDocsDeprecationText(docs.tags),
9131
+ props: getDocsProperties(cmp),
9132
+ methods: getDocsMethods(cmp.methods),
9133
+ events: getDocsEvents(cmp.events),
9134
+ styles: getDocsStyles(cmp),
9135
+ slots: getDocsSlots(cmp.htmlSlots, docs.tags),
9136
+ parts: getDocsParts(cmp.htmlParts, docs.tags),
9137
+ customStates: getDocsCustomStates(cmp),
9138
+ listeners: getDocsListeners(cmp.listeners)
9139
+ };
9140
+ });
9067
9141
  }));
9068
9142
  return sortBy(flatOne(results), (cmp) => cmp.tag);
9069
9143
  };
@@ -9081,6 +9155,7 @@ const getCssOnlyDocsComponents = async (config, compilerCtx, buildCtx) => {
9081
9155
  const usagesDir = normalizePath(join$2(dirPath, "usage"));
9082
9156
  const readme = await getUserReadmeContent(compilerCtx, readmePath);
9083
9157
  const usage = await generateUsages(compilerCtx, usagesDir);
9158
+ const docs = convertCompilerJsDoc(cmp.docs);
9084
9159
  return {
9085
9160
  dirPath,
9086
9161
  filePath: normalizePath(relative$1(config.rootDir, filePath), false),
@@ -9089,21 +9164,21 @@ const getCssOnlyDocsComponents = async (config, compilerCtx, buildCtx) => {
9089
9164
  usagesDir,
9090
9165
  tag: cmp.tagName,
9091
9166
  readme,
9092
- overview: cmp.docs.text,
9167
+ overview: docs.text,
9093
9168
  usage,
9094
- docs: generateDocs(readme, cmp.docs),
9095
- docsTags: cmp.docs.tags,
9169
+ docs: generateDocs(readme, docs),
9170
+ docsTags: docs.tags,
9096
9171
  encapsulation: getDocsEncapsulation(cmp),
9097
9172
  dependents: cmp.directDependents,
9098
9173
  dependencies: cmp.directDependencies,
9099
9174
  dependencyGraph: buildDocsDepGraph(cmp, buildCtx.components),
9100
- deprecation: getDocsDeprecationText(cmp.docs.tags),
9175
+ deprecation: getDocsDeprecationText(docs.tags),
9101
9176
  props: getDocsProperties(cmp),
9102
9177
  methods: getDocsMethods(cmp.methods),
9103
9178
  events: getDocsEvents(cmp.events),
9104
9179
  styles: getDocsStyles(cmp),
9105
- slots: getDocsSlots(cmp.htmlSlots, cmp.docs.tags),
9106
- parts: getDocsParts(cmp.htmlParts, cmp.docs.tags),
9180
+ slots: getDocsSlots(cmp.htmlSlots, docs.tags),
9181
+ parts: getDocsParts(cmp.htmlParts, docs.tags),
9107
9182
  customStates: getDocsCustomStates(cmp),
9108
9183
  listeners: getDocsListeners(cmp.listeners),
9109
9184
  cssOnly: true
@@ -9153,23 +9228,26 @@ const getDocsProperties = (cmpMeta) => {
9153
9228
  * @returns the derived metadata
9154
9229
  */
9155
9230
  const getRealProperties = (properties) => {
9156
- return properties.filter((member) => !member.internal).map((member) => ({
9157
- name: member.name,
9158
- type: member.complexType.resolved,
9159
- complexType: member.complexType,
9160
- mutable: member.mutable,
9161
- attr: member.attribute,
9162
- reflectToAttr: !!member.reflect,
9163
- docs: member.docs.text,
9164
- docsTags: member.docs.tags,
9165
- default: member.defaultValue,
9166
- deprecation: getDocsDeprecationText(member.docs.tags),
9167
- values: parseTypeIntoValues(member.complexType.resolved),
9168
- optional: member.optional,
9169
- required: member.required,
9170
- getter: member.getter,
9171
- setter: member.setter
9172
- }));
9231
+ return properties.filter((member) => !member.internal).map((member) => {
9232
+ const docs = convertCompilerJsDoc(member.docs);
9233
+ return {
9234
+ name: member.name,
9235
+ type: member.complexType.resolved,
9236
+ complexType: member.complexType,
9237
+ mutable: member.mutable,
9238
+ attr: member.attribute,
9239
+ reflectToAttr: !!member.reflect,
9240
+ docs: docs.text,
9241
+ docsTags: docs.tags,
9242
+ default: member.defaultValue,
9243
+ deprecation: getDocsDeprecationText(docs.tags),
9244
+ values: parseTypeIntoValues(member.complexType.resolved),
9245
+ optional: member.optional,
9246
+ required: member.required,
9247
+ getter: member.getter,
9248
+ setter: member.setter
9249
+ };
9250
+ });
9173
9251
  };
9174
9252
  /**
9175
9253
  * Generate a collection of JSDoc metadata for props on a component
@@ -9183,7 +9261,7 @@ const getVirtualProperties = (virtualProps) => {
9183
9261
  mutable: false,
9184
9262
  attr: member.name,
9185
9263
  reflectToAttr: false,
9186
- docs: member.docs,
9264
+ docs: convertJsdocLinksToMarkdown(member.docs),
9187
9265
  docsTags: [],
9188
9266
  default: void 0,
9189
9267
  deprecation: void 0,
@@ -9234,32 +9312,38 @@ const parseTypeIntoValues = (type) => {
9234
9312
  return [];
9235
9313
  };
9236
9314
  const getDocsMethods = (methods) => {
9237
- return sortBy(methods, (member) => member.name).filter((member) => !member.internal).map((member) => ({
9238
- name: member.name,
9239
- returns: {
9240
- type: member.complexType.return,
9241
- docs: member.docs.tags.filter((t) => t.name === "return" || t.name === "returns").map((t) => t.text).join("\n")
9242
- },
9243
- complexType: member.complexType,
9244
- signature: `${member.name}${member.complexType.signature}`,
9245
- parameters: member.complexType.parameters,
9246
- docs: member.docs.text,
9247
- docsTags: member.docs.tags,
9248
- deprecation: getDocsDeprecationText(member.docs.tags)
9249
- }));
9315
+ return sortBy(methods, (member) => member.name).filter((member) => !member.internal).map((member) => {
9316
+ const docs = convertCompilerJsDoc(member.docs);
9317
+ return {
9318
+ name: member.name,
9319
+ returns: {
9320
+ type: member.complexType.return,
9321
+ docs: docs.tags.filter((t) => t.name === "return" || t.name === "returns").map((t) => t.text).join("\n")
9322
+ },
9323
+ complexType: member.complexType,
9324
+ signature: `${member.name}${member.complexType.signature}`,
9325
+ parameters: member.complexType.parameters,
9326
+ docs: docs.text,
9327
+ docsTags: docs.tags,
9328
+ deprecation: getDocsDeprecationText(docs.tags)
9329
+ };
9330
+ });
9250
9331
  };
9251
9332
  const getDocsEvents = (events) => {
9252
- return sortBy(events, (eventMeta) => eventMeta.name.toLowerCase()).filter((eventMeta) => !eventMeta.internal).map((eventMeta) => ({
9253
- event: eventMeta.name,
9254
- detail: eventMeta.complexType.resolved,
9255
- bubbles: eventMeta.bubbles,
9256
- complexType: eventMeta.complexType,
9257
- cancelable: eventMeta.cancelable,
9258
- composed: eventMeta.composed,
9259
- docs: eventMeta.docs.text,
9260
- docsTags: eventMeta.docs.tags,
9261
- deprecation: getDocsDeprecationText(eventMeta.docs.tags)
9262
- }));
9333
+ return sortBy(events, (eventMeta) => eventMeta.name.toLowerCase()).filter((eventMeta) => !eventMeta.internal).map((eventMeta) => {
9334
+ const docs = convertCompilerJsDoc(eventMeta.docs);
9335
+ return {
9336
+ event: eventMeta.name,
9337
+ detail: eventMeta.complexType.resolved,
9338
+ bubbles: eventMeta.bubbles,
9339
+ complexType: eventMeta.complexType,
9340
+ cancelable: eventMeta.cancelable,
9341
+ composed: eventMeta.composed,
9342
+ docs: docs.text,
9343
+ docsTags: docs.tags,
9344
+ deprecation: getDocsDeprecationText(docs.tags)
9345
+ };
9346
+ });
9263
9347
  };
9264
9348
  /**
9265
9349
  * Transforms the {@link d.StyleDoc} metadata for a component into a {@link d.JsonDocsStyle}, providing sensible
@@ -9273,7 +9357,7 @@ const getDocsStyles = (cmpMeta) => {
9273
9357
  return {
9274
9358
  name: compilerStyleDoc.name,
9275
9359
  annotation: compilerStyleDoc.annotation || "",
9276
- docs: compilerStyleDoc.docs || "",
9360
+ docs: convertJsdocLinksToMarkdown(compilerStyleDoc.docs || ""),
9277
9361
  mode: compilerStyleDoc.mode && compilerStyleDoc.mode !== "$" ? compilerStyleDoc.mode : void 0,
9278
9362
  ...compilerStyleDoc.syntax && { syntax: compilerStyleDoc.syntax },
9279
9363
  ...compilerStyleDoc.default && { default: compilerStyleDoc.default }
@@ -9332,7 +9416,7 @@ const getDocsCustomStates = (cmpMeta) => {
9332
9416
  return sortBy(cmpMeta.attachInternalsCustomStates.map((state) => ({
9333
9417
  name: state.name,
9334
9418
  initialValue: state.initialValue,
9335
- docs: state.docs || ""
9419
+ docs: convertJsdocLinksToMarkdown(state.docs || "")
9336
9420
  })), (state) => state.name);
9337
9421
  };
9338
9422
  /**
@@ -9349,10 +9433,10 @@ const getDocsCustomStates = (cmpMeta) => {
9349
9433
  const cmpMetaToDocsComponent = (cmp, filePath, rootDir = process.cwd()) => {
9350
9434
  const normalizedFilePath = normalizePath(filePath);
9351
9435
  const dirPath = normalizePath(dirname$1(normalizedFilePath));
9352
- const docs = cmp.docs ?? {
9436
+ const docs = convertCompilerJsDoc(cmp.docs ?? {
9353
9437
  text: "",
9354
9438
  tags: []
9355
- };
9439
+ });
9356
9440
  return {
9357
9441
  dirPath,
9358
9442
  filePath: normalizePath(relative$1(rootDir, normalizedFilePath), false),
@@ -25440,8 +25524,9 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
25440
25524
  root.walkAtRules("property", (node) => {
25441
25525
  const propName = node.params.trim();
25442
25526
  if (!propName.startsWith("--")) return;
25443
- const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
25444
25527
  const prev = node.prev();
25528
+ const isInternal = prev?.type === "comment" && isInternalDocComment(prev.text);
25529
+ const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
25445
25530
  const docs = prev && prev.type === "comment" && isNodeDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
25446
25531
  const existing = styleDocs.find((styleDoc) => styleDoc.name === propName);
25447
25532
  if (existing) {
@@ -25450,6 +25535,7 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
25450
25535
  if (initialValue) existing.default ??= initialValue;
25451
25536
  return;
25452
25537
  }
25538
+ if (isInternal) return;
25453
25539
  styleDocs.push({
25454
25540
  name: propName,
25455
25541
  docs,
@@ -27178,8 +27264,27 @@ const transpileModule = (config, input, transformOpts) => {
27178
27264
  if (tsCompilerOptions.jsx != null && !isAutomaticRuntime && !isString$1(tsCompilerOptions.jsxFragmentFactory)) tsCompilerOptions.jsxFragmentFactory = "Fragment";
27179
27265
  if (tsCompilerOptions.paths && !isString$1(tsCompilerOptions.baseUrl)) tsCompilerOptions.baseUrl = ".";
27180
27266
  const sourceFile = ts.createSourceFile(sourceFilePath, input, tsCompilerOptions.target);
27181
- const program = ts.createProgram([sourceFilePath], tsCompilerOptions, {
27182
- getSourceFile: (fileName) => normalizePath(fileName) === normalizePath(sourceFilePath) ? sourceFile : void 0,
27267
+ const importedSources = /* @__PURE__ */ new Map();
27268
+ const resolveImport = input.includes("resolveVar(") ? transformOpts.resolveImport : void 0;
27269
+ const resolveViaCallback = (specifier, containingFile) => {
27270
+ let resolved = null;
27271
+ try {
27272
+ resolved = resolveImport(specifier, containingFile, { kind: "type-info" });
27273
+ } catch {}
27274
+ if (!resolved) return void 0;
27275
+ const extension = getResolvedExtension(resolved.path);
27276
+ if (!extension) return void 0;
27277
+ const resolvedFileName = normalizePath(resolved.path.split("?")[0]);
27278
+ if (resolvedFileName !== normalizePath(sourceFilePath) && !importedSources.has(resolvedFileName)) importedSources.set(resolvedFileName, ts.createSourceFile(resolvedFileName, resolved.code, tsCompilerOptions.target, true));
27279
+ return {
27280
+ resolvedFileName,
27281
+ extension,
27282
+ isExternalLibraryImport: false
27283
+ };
27284
+ };
27285
+ if (resolveImport) tsCompilerOptions.noResolve = false;
27286
+ const compilerHost = {
27287
+ getSourceFile: (fileName) => normalizePath(fileName) === normalizePath(sourceFilePath) ? sourceFile : importedSources.get(normalizePath(fileName)),
27183
27288
  writeFile: (name, text) => {
27184
27289
  if (name.endsWith(".js.map") || name.endsWith(".mjs.map")) results.map = text;
27185
27290
  else if (name.endsWith(".js") || name.endsWith(".mjs")) results.code = text;
@@ -27189,11 +27294,13 @@ const transpileModule = (config, input, transformOpts) => {
27189
27294
  getCanonicalFileName: (fileName) => fileName,
27190
27295
  getCurrentDirectory: () => transformOpts.currentDirectory || (typeof process !== "undefined" ? process.cwd() : "/"),
27191
27296
  getNewLine: () => ts.sys && ts.sys.newLine || "\n",
27192
- fileExists: (fileName) => normalizePath(fileName) === normalizePath(sourceFilePath),
27297
+ fileExists: (fileName) => normalizePath(fileName) === normalizePath(sourceFilePath) || importedSources.has(normalizePath(fileName)),
27193
27298
  readFile: () => "",
27194
27299
  directoryExists: () => true,
27195
- getDirectories: () => []
27196
- });
27300
+ getDirectories: () => [],
27301
+ ...resolveImport ? { resolveModuleNameLiterals: (moduleLiterals, containingFile) => moduleLiterals.map((literal) => ({ resolvedModule: resolveViaCallback(literal.text, containingFile) })) } : {}
27302
+ };
27303
+ const program = ts.createProgram([sourceFilePath], tsCompilerOptions, compilerHost);
27197
27304
  const typeChecker = program.getTypeChecker();
27198
27305
  const transformers = {
27199
27306
  before: [
@@ -27210,18 +27317,36 @@ const transpileModule = (config, input, transformOpts) => {
27210
27317
  }
27211
27318
  if (transformOpts.componentExport === "customelement" || transformOpts.componentExport === "module") transformers.after.push(nativeComponentTransform(compilerCtx, transformOpts, buildCtx));
27212
27319
  else transformers.after.push(lazyComponentTransform(compilerCtx, transformOpts, buildCtx));
27213
- program.emit(void 0, void 0, void 0, false, transformers);
27320
+ program.emit(sourceFile, void 0, void 0, false, transformers);
27214
27321
  if (transformOpts.buildOverrides && results.code) {
27215
27322
  const mutations = Object.entries(transformOpts.buildOverrides).filter(([, v]) => v !== void 0).map(([k, v]) => `__stencilBUILD.${k}=${v};`).join("");
27216
27323
  if (mutations) results.code = `import{BUILD as __stencilBUILD}from"${STENCIL_APP_DATA_ID}";\n${mutations}\n` + results.code;
27217
27324
  }
27218
- const tsDiagnostics = [...program.getSyntacticDiagnostics()];
27325
+ const tsDiagnostics = [...program.getSyntacticDiagnostics(sourceFile)];
27219
27326
  if (config.validateTypes) tsDiagnostics.push(...program.getOptionsDiagnostics());
27220
27327
  buildCtx.diagnostics.push(...loadTypeScriptDiagnostics(tsDiagnostics));
27221
27328
  results.diagnostics.push(...buildCtx.diagnostics);
27222
27329
  results.moduleFile = compilerCtx.moduleMap.get(results.sourceFilePath);
27223
27330
  return results;
27224
27331
  };
27332
+ /**
27333
+ * Maps a `resolveImport` result path to the TypeScript extension the program should parse it
27334
+ * as. Only TypeScript sources are taken - `noLib`/no `allowJs` means anything else would be
27335
+ * dropped by the program anyway, so it stays unresolved exactly as it did before.
27336
+ *
27337
+ * @param path the resolved path returned by the `resolveImport` callback
27338
+ * @returns the matching `ts.Extension`, or `undefined` if the file can't add type info
27339
+ */
27340
+ const getResolvedExtension = (path) => {
27341
+ const bare = path.split("?")[0];
27342
+ if (bare.endsWith(".d.ts")) return ts.Extension.Dts;
27343
+ if (bare.endsWith(".d.mts")) return ts.Extension.Dmts;
27344
+ if (bare.endsWith(".d.cts")) return ts.Extension.Dcts;
27345
+ if (bare.endsWith(".tsx")) return ts.Extension.Tsx;
27346
+ if (bare.endsWith(".mts")) return ts.Extension.Mts;
27347
+ if (bare.endsWith(".cts")) return ts.Extension.Cts;
27348
+ if (bare.endsWith(".ts")) return ts.Extension.Ts;
27349
+ };
27225
27350
  const getScriptTargetKind = (transformOpts) => {
27226
27351
  const target = transformOpts.target && transformOpts.target.toUpperCase();
27227
27352
  if (isNumber$1(ts.ScriptTarget[target])) return ts.ScriptTarget[target];
@@ -4442,10 +4442,18 @@ interface TranspileOptions {
4442
4442
  */
4443
4443
  additionalTagTransformers?: boolean;
4444
4444
  /**
4445
- * Callback used to resolve parent-class source for inheritance-chain analysis.
4446
- * Called when a component's `extends` clause references a class from another
4447
- * module. Return the resolved absolute path and source text of that module,
4448
- * or `null` to skip inheritance resolution for that specifier.
4445
+ * Callback used to resolve imported source during a single-file transpile.
4446
+ * Return the resolved absolute path and source text of that module, or `null`
4447
+ * to leave the specifier unresolved.
4448
+ *
4449
+ * It is called in two situations, told apart by `context.kind`:
4450
+ * - **inheritance** (`context` is `undefined`): a component's `extends` clause
4451
+ * references a class from another module, so the compiler can merge the
4452
+ * parent's metadata.
4453
+ * - **`'type-info'`**: the file uses `resolveVar()`, so the compiler follows its
4454
+ * imports (and theirs) to read constants declared elsewhere. The returned
4455
+ * module is only used for type information - it is never emitted or treated
4456
+ * as a base class.
4449
4457
  *
4450
4458
  * @example
4451
4459
  * ```ts
@@ -4457,7 +4465,7 @@ interface TranspileOptions {
4457
4465
  * });
4458
4466
  * ```
4459
4467
  */
4460
- resolveImport?: (specifier: string, importer: string) => {
4468
+ resolveImport?: (specifier: string, importer: string, context?: ResolveImportContext) => {
4461
4469
  code: string;
4462
4470
  path: string;
4463
4471
  } | null;
@@ -4521,7 +4529,7 @@ interface TransformOptions {
4521
4529
  /**
4522
4530
  * @see {@link TranspileOptions.resolveImport}
4523
4531
  */
4524
- resolveImport?: (specifier: string, importer: string) => {
4532
+ resolveImport?: (specifier: string, importer: string, context?: ResolveImportContext) => {
4525
4533
  code: string;
4526
4534
  path: string;
4527
4535
  } | null;
@@ -4530,6 +4538,16 @@ interface TransformOptions {
4530
4538
  /** @see {@link TranspileOptions.buildOverrides} */
4531
4539
  buildOverrides?: BuildOverrides;
4532
4540
  }
4541
+ /**
4542
+ * Extra information passed as the third argument of {@link TranspileOptions.resolveImport}.
4543
+ */
4544
+ interface ResolveImportContext {
4545
+ /**
4546
+ * `'type-info'` when the module is only needed for type information (e.g. `resolveVar()`
4547
+ * reading a constant declared in another file).
4548
+ */
4549
+ kind: 'type-info';
4550
+ }
4533
4551
  interface CompileScriptMinifyOptions {
4534
4552
  target?: CompileTarget;
4535
4553
  pretty?: boolean;
@@ -4574,4 +4592,4 @@ interface PluginCtx {
4574
4592
  diagnostics: Diagnostic[];
4575
4593
  }
4576
4594
  //#endregion
4577
- export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildOverrides, BuildResultsComponentGraph, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigCompat, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, DocsReadmeCustomColumn, FsWatchResults, HistoryApiFallback, HmrGlobalStyleUpdate, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LightDomPatches, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, ModeConfig, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetAssets, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCollection, OutputTargetCopy, OutputTargetCustom, OutputTargetDistLazy, OutputTargetDocsAgentSkill, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetGlobalStyle, OutputTargetLoaderBundle, OutputTargetSsr, OutputTargetSsrWasm, OutputTargetStandalone, OutputTargetStats, OutputTargetTypes, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, Plugin, PluginCtx, PluginTransformResults, PrerenderConfig, PrerenderHydrateOptions, PrerenderOptions, PrerenderResults, PrerenderStartOptions, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, SsrDocumentOptions, SsrFactoryOptions, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, ValidatedOutputTargetWww, WatcherCloseResults, WorkerMainController, WorkerOptions };
4595
+ export { AutoprefixerOptions, BuildEmitEvents, BuildEvents, BuildLog, BuildNoChangeResults, BuildOnEventRemove, BuildOnEvents, BuildOutput, BuildOverrides, BuildResultsComponentGraph, CliInitOptions, CompileScriptMinifyOptions, CompileTarget, Compiler, CompilerBuildResults, CompilerBuildStart, CompilerDependency, CompilerEventBuildFinish, CompilerEventBuildLog, CompilerEventBuildNoChange, CompilerEventBuildStart, CompilerEventDirAdd, CompilerEventDirDelete, CompilerEventFileAdd, CompilerEventFileDelete, CompilerEventFileUpdate, CompilerEventFsChange, CompilerEventName, CompilerFileWatcher, CompilerFileWatcherCallback, CompilerFileWatcherEvent, CompilerFsStats, CompilerRequest, CompilerRequestResponse, CompilerSystem, CompilerSystemCreateDirectoryOptions, CompilerSystemCreateDirectoryResults, CompilerSystemRealpathResults, CompilerSystemRemoveDirectoryOptions, CompilerSystemRemoveDirectoryResults, CompilerSystemRemoveFileResults, CompilerSystemRenameResults, CompilerSystemRenamedPath, CompilerSystemWriteFileResults, CompilerWatcher, Config, ConfigBundle, ConfigCompat, CopyResults, CopyTask, Credentials, CustomElementsExportBehavior, CustomElementsExportBehaviorOptions, DevServer, DevServerConfig, DevServerEditor, Diagnostic, DocsReadmeCustomColumn, FsWatchResults, HistoryApiFallback, HmrGlobalStyleUpdate, HmrStyleUpdate, HotModuleReplacement, HydrateDocumentOptions, HydrateFactoryOptions, HydratedFlag, JsonDocMethodParameter, JsonDocs, JsonDocsComponent, JsonDocsCustomState, JsonDocsDependencyGraph, JsonDocsEvent, JsonDocsListener, JsonDocsMethod, JsonDocsMethodReturn, JsonDocsPart, JsonDocsProp, JsonDocsSlot, JsonDocsStyle, JsonDocsTag, JsonDocsTypeLibrary, JsonDocsUsage, JsonDocsValue, LOG_LEVELS, LazyRequire, LightDomPatches, LoadConfigInit, LoadConfigResults, LogLevel, Logger, LoggerLineUpdater, LoggerTimeSpan, ModeConfig, NodeResolveConfig, OptimizeCssInput, OptimizeCssOutput, OptimizeJsInput, OptimizeJsOutput, OutputTarget, OutputTargetAssets, OutputTargetBase, OutputTargetBaseNext, OutputTargetBuild, OutputTargetCollection, OutputTargetCopy, OutputTargetCustom, OutputTargetDistLazy, OutputTargetDocsAgentSkill, OutputTargetDocsCustom, OutputTargetDocsCustomElementsManifest, OutputTargetDocsJson, OutputTargetDocsReadme, OutputTargetDocsVscode, OutputTargetGlobalStyle, OutputTargetLoaderBundle, OutputTargetSsr, OutputTargetSsrWasm, OutputTargetStandalone, OutputTargetStats, OutputTargetTypes, OutputTargetWww, PageReloadStrategy, ParsedPath, PlatformPath, Plugin, PluginCtx, PluginTransformResults, PrerenderConfig, PrerenderHydrateOptions, PrerenderOptions, PrerenderResults, PrerenderStartOptions, ResolveImportContext, ResolveModuleIdOptions, ResolveModuleIdResults, ResolveModuleOptions, RobotsTxtOpts, RobotsTxtResults, RolldownConfig, SerializeDocumentOptions, ServiceWorkerConfig, SitemapXmpOpts, SitemapXmpResults, SsrDocumentOptions, SsrFactoryOptions, StencilConfig, StencilDevServerConfig, StencilDocsConfig, StyleDoc, SystemDetails, TransformOptions, TranspileOnlyResults, TranspileOptions, TranspileResults, UnvalidatedConfig, ValidatedConfig, ValidatedOutputTargetWww, WatcherCloseResults, WorkerMainController, WorkerOptions };