@stencil/core 5.0.0-beta.26 → 5.0.0-beta.27

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 { E as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, w as CLIENT_BUILD_FLAGS } from "./client-CVXS3JZ-.mjs";
2
+ import { E as SERVER_BUILD_FLAGS, T as HYDRATED_CSS, w as CLIENT_BUILD_FLAGS } from "./client-9wOO56Ye.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-Cpp3qc3u.mjs";
4
4
  import { E as escapeRegExpSpecialCharacters, S as formatComponentRuntimeMeta, T as byteSize, _ as loadRolldownDiagnostics, a as getSourceMappingUrlForEndOfFile, b as splitLineBreaks, c as err, f as augmentDiagnosticWithNode, g as isRolldownError, h as createOnWarnFn, i as getInlineSourceMappingUrlLinker, l as map, m as loadTypeScriptDiagnostics, n as validateComponentTag, p as loadTypeScriptDiagnostic, r as isRemoteUrl, s as rolldownToStencilSourceMap, t as validateComponentModes, u as ok, w as stringifyRuntimeData, x as isRootPath, y as normalizeDiagnostics } from "./validation-DAdGTrys.mjs";
5
5
  import { $ as catchError, A as isOutputTargetDocsVscode, B as relativeImport, C as isOutputTargetDistLazy, D as isOutputTargetDocsCustomElementsManifest, E as isOutputTargetDocsCustom, F as isOutputTargetStandalone, G as normalizeFsPathQuery, H as join$2, I as isOutputTargetStats, J as resolve$2, K as normalizePath, L as isOutputTargetTypes, M as isOutputTargetLoaderBundle, N as isOutputTargetSsr, O as isOutputTargetDocsJson, P as isOutputTargetSsrWasm, Q as buildWarn, R as isOutputTargetWww, S as isOutputTargetCustom, T as isOutputTargetDocsAgentSkill, V as shouldExcludeComponent, W as normalizeFsPath, X as buildError, Z as buildJsonFileError, a as hasDependency, b as isOutputTargetCollection, d as parsePackageJson, et as hasError, f as readOnlyArrayHasStringMember, g as getComponentsDtsSrcFilePath, h as filterExcludedComponents, i as getTextDocs, j as isOutputTargetGlobalStyle, k as isOutputTargetDocsReadme, l as isTsFile, m as filterActiveTargets, n as createJsVarName, o as isDtsFile, p as readPackageJson, q as relative$1, r as generatePreamble, rt as isGlob, t as addDocBlock, tt as hasWarning, u as isTsxFile, v as getComponentsFromModules, w as isOutputTargetDocs, x as isOutputTargetCopy, y as isOutputTargetAssets, z as isValidConfigOutputTarget } from "./util-IKfWWLJo.mjs";
6
- import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-Bz2SOK7_.mjs";
6
+ import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-DomivDBh.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-beta.26";
465
- const buildId = "1792014462";
466
- const vermoji = "🎁";
464
+ const version = "5.0.0-beta.27";
465
+ const buildId = "1793294198";
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.
@@ -665,6 +665,7 @@ const resetModuleLegacy = (moduleFile) => {
665
665
  moduleFile.externalImports.length = 0;
666
666
  moduleFile.isCollectionDependency = false;
667
667
  moduleFile.localImports.length = 0;
668
+ moduleFile.functionalComponentDeps.length = 0;
668
669
  moduleFile.originalCollectionComponentPath = null;
669
670
  moduleFile.originalImports.length = 0;
670
671
  moduleFile.hasVdomXlink = false;
@@ -1560,6 +1561,20 @@ const parsePropertyAtRuleDescriptors = (node) => {
1560
1561
  initialValue
1561
1562
  };
1562
1563
  };
1564
+ /** `--name: docs`, `--name - docs` (as `@attr`/`@slot` use) or `--name docs`. */
1565
+ const CUSTOM_PROPERTY_TAG_RE = /^(--[\w-]+)\s*(?::|-(?=\s))?(.*)$/;
1566
+ /**
1567
+ * @param text the text after a `@prop`/`@cssprop` tag
1568
+ * @returns the custom property name and description, or `undefined` if `text` doesn't start
1569
+ * with a custom property name
1570
+ */
1571
+ const parseCustomPropertyTag = (text) => {
1572
+ const match = text.trim().match(CUSTOM_PROPERTY_TAG_RE);
1573
+ return match ? {
1574
+ name: match[1],
1575
+ docs: match[2].trim()
1576
+ } : void 0;
1577
+ };
1563
1578
  //#endregion
1564
1579
  //#region src/compiler/css-components/parse-css-component.ts
1565
1580
  /**
@@ -1607,6 +1622,7 @@ const parseCssComponentFile = async (filePath, cssText) => {
1607
1622
  }
1608
1623
  const defs = /* @__PURE__ */ new Map();
1609
1624
  const rawNodes = rawRoot.nodes;
1625
+ const attributeRuleDocs = /* @__PURE__ */ new Map();
1610
1626
  for (let i = 0; i < rawNodes.length; i++) {
1611
1627
  const node = rawNodes[i];
1612
1628
  if (node.type !== "comment" || !isJsDocComment(node.text)) continue;
@@ -1657,6 +1673,7 @@ const parseCssComponentFile = async (filePath, cssText) => {
1657
1673
  defs.set(baseTag, def);
1658
1674
  collectAutoDetectedCustomProperties(next, def);
1659
1675
  collectAutoDetectedSlots(next, def);
1676
+ collectAttributeRuleDocs(next, (selector) => selector.nonTagParts[0] === "nesting" ? def : void 0, attributeRuleDocs);
1660
1677
  }
1661
1678
  if (defs.size === 0) return {
1662
1679
  defs: [],
@@ -1671,6 +1688,8 @@ const parseCssComponentFile = async (filePath, cssText) => {
1671
1688
  collectAutoDetectedAttributes(selector, def);
1672
1689
  }
1673
1690
  }
1691
+ collectAttributeRuleDocs(rawRoot, (selector) => defs.get(selector.tag ?? ""), attributeRuleDocs);
1692
+ for (const [def, docsByName] of attributeRuleDocs) for (const attr of def.attributes) if (attr.source === "auto") attr.docs = docsByName.get(attr.name) ?? attr.docs;
1674
1693
  for (const node of nodes) {
1675
1694
  if (node.type !== "rule") continue;
1676
1695
  for (const selector of parseSelectorList(node.selector)) {
@@ -1688,7 +1707,13 @@ const parseCssComponentFile = async (filePath, cssText) => {
1688
1707
  const prev = nodes[i - 1];
1689
1708
  const docs = prev && prev.type === "comment" && isJsDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
1690
1709
  for (const def of defs.values()) {
1691
- if (def.properties.some((p) => p.name === propName)) continue;
1710
+ const existing = def.properties.find((p) => p.name === propName);
1711
+ if (existing) {
1712
+ existing.docs ||= docs;
1713
+ if (syntax) existing.syntax ??= syntax;
1714
+ if (initialValue) existing.default ??= initialValue;
1715
+ continue;
1716
+ }
1692
1717
  const prop = {
1693
1718
  name: propName,
1694
1719
  docs,
@@ -1820,6 +1845,34 @@ const collectAutoDetectedAttributes = (selector, def) => {
1820
1845
  });
1821
1846
  }
1822
1847
  };
1848
+ /**
1849
+ * Record the JSDoc comment directly above each of `container`'s child rules as the description
1850
+ * of the attributes in that rule's leading compound selector. The first documented rule for an
1851
+ * attribute wins.
1852
+ * @param container a container whose direct child rules to scan
1853
+ * @param defFor the component a child rule's selector belongs to, if any
1854
+ * @param out collected descriptions, per component, by attribute name
1855
+ */
1856
+ const collectAttributeRuleDocs = (container, defFor, out) => {
1857
+ for (const node of container.nodes) {
1858
+ const prev = node.prev();
1859
+ if (node.type !== "rule" || prev?.type !== "comment" || !isJsDocComment(prev.text)) continue;
1860
+ let selectors;
1861
+ try {
1862
+ selectors = parseSelectorList(node.selector);
1863
+ } catch {
1864
+ continue;
1865
+ }
1866
+ const docs = normalizeJsDocText(prev.text);
1867
+ for (const selector of selectors) {
1868
+ const def = defFor(selector);
1869
+ if (!def) continue;
1870
+ const docsByName = out.get(def) ?? /* @__PURE__ */ new Map();
1871
+ out.set(def, docsByName);
1872
+ for (const attr of selector.attributes) if (!docsByName.has(attr.name)) docsByName.set(attr.name, docs);
1873
+ }
1874
+ }
1875
+ };
1823
1876
  const mergeLiteralUnion = (existingType, value) => {
1824
1877
  const literal = JSON.stringify(value);
1825
1878
  const escapeHatch = " | (string & {})";
@@ -1895,12 +1948,9 @@ const buildDefFromJsDocBlock = (block) => {
1895
1948
  continue;
1896
1949
  }
1897
1950
  if (PROP_TAG_NAMES.has(tag.name)) {
1898
- const colonIndex = tag.text.indexOf(":");
1899
- const name = (colonIndex === -1 ? tag.text : tag.text.slice(0, colonIndex)).trim();
1900
- const docs = colonIndex === -1 ? "" : tag.text.slice(colonIndex + 1).trim();
1901
- if (name.startsWith("--")) properties.push({
1902
- name,
1903
- docs,
1951
+ const prop = parseCustomPropertyTag(tag.text);
1952
+ if (prop) properties.push({
1953
+ ...prop,
1904
1954
  source: "explicit"
1905
1955
  });
1906
1956
  continue;
@@ -2186,15 +2236,18 @@ const updateComponentBuildConditionals = (moduleMap, cmps) => {
2186
2236
  cmp.potentialCmpRefs = unique(cmp.potentialCmpRefs);
2187
2237
  });
2188
2238
  };
2239
+ /** Extension-less local imports may name a file or a directory's `index` file. */
2240
+ const MODULE_PATH_SUFFIXES = [
2241
+ "",
2242
+ ".tsx",
2243
+ ".ts",
2244
+ ".js",
2245
+ "/index.tsx",
2246
+ "/index.ts",
2247
+ "/index.js"
2248
+ ];
2189
2249
  const getModuleImports = (moduleMap, filePath, importedModules) => {
2190
- let moduleFile = moduleMap.get(filePath);
2191
- if (moduleFile == null) {
2192
- moduleFile = moduleMap.get(filePath + ".tsx");
2193
- if (moduleFile == null) {
2194
- moduleFile = moduleMap.get(filePath + ".ts");
2195
- if (moduleFile == null) moduleFile = moduleMap.get(filePath + ".js");
2196
- }
2197
- }
2250
+ const moduleFile = MODULE_PATH_SUFFIXES.map((suffix) => moduleMap.get(filePath + suffix)).find((m) => m != null);
2198
2251
  if (moduleFile != null && !importedModules.some((m) => m.sourceFilePath === moduleFile.sourceFilePath)) {
2199
2252
  importedModules.push(moduleFile);
2200
2253
  moduleFile.localImports.forEach((localImport) => {
@@ -9549,10 +9602,22 @@ const stylesToMarkdown = (styles) => {
9549
9602
  if (styles.length === 0) return content;
9550
9603
  content.push(`## CSS Custom Properties`);
9551
9604
  content.push(``);
9605
+ const hasRegistrations = styles.some((s) => s.syntax || s.default);
9606
+ const code = (text) => text ? `\`${text}\`` : "";
9552
9607
  const table = new MarkdownTable();
9553
- table.addHeader(["Name", "Description"]);
9608
+ table.addHeader(hasRegistrations ? [
9609
+ "Name",
9610
+ "Description",
9611
+ "Syntax",
9612
+ "Default"
9613
+ ] : ["Name", "Description"]);
9554
9614
  styles.forEach((style) => {
9555
- table.addRow([`\`${style.name}\``, style.docs]);
9615
+ const row = [code(style.name), style.docs];
9616
+ table.addRow(hasRegistrations ? [
9617
+ ...row,
9618
+ code(style.syntax),
9619
+ code(style.default)
9620
+ ] : row);
9556
9621
  });
9557
9622
  content.push(...table.toMarkdown());
9558
9623
  content.push(``);
@@ -14481,12 +14546,18 @@ const gatherVdomMeta = (m, args, typeChecker) => {
14481
14546
  };
14482
14547
  //#endregion
14483
14548
  //#region src/compiler/transformers/static-to-meta/call-expression.ts
14484
- const parseCallExpression = (m, node, typeChecker) => {
14549
+ /**
14550
+ * @param m the module or component to record vdom metadata on
14551
+ * @param node the call expression to parse
14552
+ * @param typeChecker used to resolve functional components / JSX-returning calls to their source
14553
+ * @param moduleFile the module to record those dependencies on; defaults to `m` when it's a module
14554
+ */
14555
+ const parseCallExpression = (m, node, typeChecker, moduleFile = "functionalComponentDeps" in m ? m : void 0) => {
14485
14556
  if (node.arguments != null && node.arguments.length > 0) {
14486
- if (ts.isIdentifier(node.expression)) visitCallExpressionArgs(m, node.expression, node.arguments, typeChecker);
14557
+ if (ts.isIdentifier(node.expression)) visitCallExpressionArgs(m, node.expression, node.arguments, typeChecker, moduleFile);
14487
14558
  else if (ts.isPropertyAccessExpression(node.expression)) {
14488
14559
  const n = node.expression.name;
14489
- if (ts.isIdentifier(n) && n) visitCallExpressionArgs(m, n, node.arguments, typeChecker);
14560
+ if (ts.isIdentifier(n) && n) visitCallExpressionArgs(m, n, node.arguments, typeChecker, moduleFile);
14490
14561
  }
14491
14562
  } else if (ts.isPropertyAccessExpression(node.expression)) {
14492
14563
  if (ts.isIdentifier(node.expression.name)) {
@@ -14496,24 +14567,20 @@ const parseCallExpression = (m, node, typeChecker) => {
14496
14567
  if (!declarations || declarations.length === 0) return;
14497
14568
  const sourceFile = declarations[0].getSourceFile();
14498
14569
  if (!sourceFile) return;
14499
- const sourceFilePath = normalizePath(sourceFile.fileName);
14500
- const moduleFile = m;
14501
- if (moduleFile.functionalComponentDeps) {
14502
- if (!moduleFile.functionalComponentDeps.includes(sourceFilePath)) moduleFile.functionalComponentDeps.push(sourceFilePath);
14503
- }
14570
+ addFunctionalComponentDep(moduleFile, sourceFile);
14504
14571
  }
14505
14572
  }
14506
14573
  };
14507
- const visitCallExpressionArgs = (m, callExpressionName, args, typeChecker) => {
14574
+ const visitCallExpressionArgs = (m, callExpressionName, args, typeChecker, moduleFile) => {
14508
14575
  const fnName = callExpressionName.escapedText;
14509
14576
  if (fnName === "h" || fnName === "__stencil_h" || fnName === "createElement") {
14510
- visitCallExpressionArg(m, args[0], typeChecker);
14577
+ visitCallExpressionArg(m, args[0], typeChecker, moduleFile);
14511
14578
  if (fnName === "h" || fnName === "__stencil_h") gatherVdomMeta(m, args, typeChecker);
14512
14579
  } else if (fnName === "jsx" || fnName === "jsxs" || fnName === "_jsx" || fnName === "_jsxs") {
14513
- visitCallExpressionArg(m, args[0], typeChecker);
14580
+ visitCallExpressionArg(m, args[0], typeChecker, moduleFile);
14514
14581
  gatherVdomMeta(m, args, typeChecker);
14515
14582
  if (args.length > 2 && args[2]) m.hasVdomKey = true;
14516
- } else if (args.length > 1 && fnName === "createElementNS") visitCallExpressionArg(m, args[1], typeChecker);
14583
+ } else if (args.length > 1 && fnName === "createElementNS") visitCallExpressionArg(m, args[1], typeChecker, moduleFile);
14517
14584
  else if (fnName === "require" && args.length > 0 && m.originalImports) {
14518
14585
  const arg = args[0];
14519
14586
  if (ts.isStringLiteral(arg)) {
@@ -14521,7 +14588,7 @@ const visitCallExpressionArgs = (m, callExpressionName, args, typeChecker) => {
14521
14588
  }
14522
14589
  }
14523
14590
  };
14524
- const visitCallExpressionArg = (m, arg, typeChecker) => {
14591
+ const visitCallExpressionArg = (m, arg, typeChecker, moduleFile) => {
14525
14592
  if (ts.isStringLiteral(arg)) {
14526
14593
  let tag = arg.text;
14527
14594
  if (typeof tag === "string") {
@@ -14529,31 +14596,31 @@ const visitCallExpressionArg = (m, arg, typeChecker) => {
14529
14596
  m.htmlTagNames.push(tag);
14530
14597
  if (tag.includes("-")) m.potentialCmpRefs.push(tag);
14531
14598
  }
14532
- } else if (typeChecker && ts.isIdentifier(arg)) resolveFunctionalComponentDep(m, arg, typeChecker);
14599
+ } else if (typeChecker && ts.isIdentifier(arg)) resolveFunctionalComponentDep(moduleFile, arg, typeChecker);
14533
14600
  };
14534
14601
  /**
14535
14602
  * Resolves a functional component identifier to its source file and tracks it
14536
14603
  * as a dependency so that build-conditionals can be properly propagated.
14604
+ * Follows import / re-export aliases through to the declaring file.
14537
14605
  *
14538
- * @param m the module or component metadata to track the dependency on
14606
+ * @param moduleFile the module to track the dependency on
14539
14607
  * @param identifier the identifier node representing the functional component
14540
14608
  * @param typeChecker the TypeScript type checker for symbol resolution
14541
14609
  */
14542
- const resolveFunctionalComponentDep = (m, identifier, typeChecker) => {
14610
+ const resolveFunctionalComponentDep = (moduleFile, identifier, typeChecker) => {
14611
+ if (!moduleFile) return;
14543
14612
  try {
14544
14613
  const symbol = typeChecker.getSymbolAtLocation(identifier);
14545
14614
  if (!symbol) return;
14546
- const declarations = (typeChecker.getAliasedSymbol(symbol) || symbol).declarations;
14547
- if (!declarations || declarations.length === 0) return;
14548
- const sourceFile = declarations[0].getSourceFile();
14549
- if (!sourceFile) return;
14550
- const sourceFilePath = normalizePath(sourceFile.fileName);
14551
- const moduleFile = m;
14552
- if (moduleFile.functionalComponentDeps) {
14553
- if (!moduleFile.functionalComponentDeps.includes(sourceFilePath)) moduleFile.functionalComponentDeps.push(sourceFilePath);
14554
- }
14615
+ const sourceFile = (symbol.flags & ts.SymbolFlags.Alias ? typeChecker.getAliasedSymbol(symbol) : symbol).declarations?.[0]?.getSourceFile();
14616
+ if (sourceFile) addFunctionalComponentDep(moduleFile, sourceFile);
14555
14617
  } catch {}
14556
14618
  };
14619
+ const addFunctionalComponentDep = (moduleFile, sourceFile) => {
14620
+ const deps = moduleFile?.functionalComponentDeps;
14621
+ const sourceFilePath = normalizePath(sourceFile.fileName);
14622
+ if (deps && !deps.includes(sourceFilePath)) deps.push(sourceFilePath);
14623
+ };
14557
14624
  //#endregion
14558
14625
  //#region src/compiler/transformers/add-component-meta-static.ts
14559
14626
  /**
@@ -16895,6 +16962,13 @@ function findReExport(sourceFile, className) {
16895
16962
  }
16896
16963
  }
16897
16964
  /**
16965
+ * @param sourceFile the (barrel) source file to scan
16966
+ * @returns the module specifiers of its `export * from './x'` statements, in order
16967
+ */
16968
+ function findStarReExportSpecifiers(sourceFile) {
16969
+ return sourceFile.statements.flatMap((stmt) => ts.isExportDeclaration(stmt) && !stmt.exportClause && !stmt.isTypeOnly && stmt.moduleSpecifier && ts.isStringLiteral(stmt.moduleSpecifier) ? [stmt.moduleSpecifier.text] : []);
16970
+ }
16971
+ /**
16898
16972
  * Finds `name`'s import in `sourceFile` and returns its module and origin name (before any `as`
16899
16973
  * aliasing; `'default'` for a default import).
16900
16974
  * @param sourceFile the source file to scan for a matching import
@@ -17021,12 +17095,20 @@ function findClassInJsModule(config, compilerCtx, source, className, hopsRemaini
17021
17095
  };
17022
17096
  }
17023
17097
  if (hopsRemaining <= 0) return;
17098
+ const readReExported = (moduleSpecifier) => {
17099
+ const resolvedFileName = tsResolveModuleName(config, compilerCtx, moduleSpecifier, source.fileName)?.resolvedModule?.resolvedFileName;
17100
+ return resolvedFileName ? readJsSourceFile(config, resolvedFileName) : void 0;
17101
+ };
17024
17102
  const reExport = findReExport(source, className);
17025
- if (!reExport) return;
17026
- const resolvedFileName = tsResolveModuleName(config, compilerCtx, reExport.moduleSpecifier, source.fileName)?.resolvedModule?.resolvedFileName;
17027
- const nextSource = resolvedFileName && readJsSourceFile(config, resolvedFileName);
17028
- if (!nextSource) return;
17029
- return findClassInJsModule(config, compilerCtx, nextSource, reExport.localName, hopsRemaining - 1);
17103
+ if (reExport) {
17104
+ const nextSource = readReExported(reExport.moduleSpecifier);
17105
+ return nextSource && findClassInJsModule(config, compilerCtx, nextSource, reExport.localName, hopsRemaining - 1);
17106
+ }
17107
+ for (const moduleSpecifier of findStarReExportSpecifiers(source)) {
17108
+ const nextSource = readReExported(moduleSpecifier);
17109
+ const found = nextSource && findClassInJsModule(config, compilerCtx, nextSource, className, hopsRemaining - 1);
17110
+ if (found) return found;
17111
+ }
17030
17112
  }
17031
17113
  /**
17032
17114
  * Filters `dedupeMembers` down to entries not already present in `staticMembers`
@@ -17121,7 +17203,8 @@ function convertDiskSourceFileDecorators(sourceFile, config, target = ts.ScriptT
17121
17203
  /**
17122
17204
  * Resolves an `extends` target through a module specifier: resolves the
17123
17205
  * module, finds the named class/mixin-factory export, and adds it (and its
17124
- * own ancestors) to `dependentClasses`. Follows one level of re-export (barrel file) when the
17206
+ * own ancestors) to `dependentClasses`. Follows one level of re-export (barrel file, named or
17207
+ * `export *`) when the
17125
17208
  * declaration isn't found directly in the resolved module.
17126
17209
  * @param compilerCtx the current compiler context
17127
17210
  * @param buildCtx the current build context
@@ -17142,7 +17225,9 @@ function resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration,
17142
17225
  let keepLooking = true;
17143
17226
  const foundFile = tsResolveModuleName(buildCtx.config, compilerCtx, moduleSpecifier, currentSource.fileName);
17144
17227
  if (!foundFile?.resolvedModule || !className) return;
17145
- let foundSource = compilerCtx.moduleMap.get(foundFile.resolvedModule.resolvedFileName)?.staticSourceFile;
17228
+ const resolvedFileName = foundFile.resolvedModule.resolvedFileName;
17229
+ let foundSource = compilerCtx.moduleMap.get(resolvedFileName)?.staticSourceFile;
17230
+ if (!foundSource && isJsFile(currentSource.fileName) && isJsFile(resolvedFileName)) foundSource = readJsSourceFile(buildCtx.config, resolvedFileName);
17146
17231
  if (!foundSource) {
17147
17232
  foundSource = tsGetSourceFile(buildCtx.config, foundFile);
17148
17233
  if (!foundSource) {
@@ -17156,7 +17241,7 @@ function resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration,
17156
17241
  }
17157
17242
  const matchedStatement = findStatementByName(foundSource, className);
17158
17243
  if (!matchedStatement) {
17159
- const reExport = barrelHopsRemaining > 0 ? findReExport(foundSource, className) : void 0;
17244
+ const reExport = barrelHopsRemaining > 0 ? findReExport(foundSource, className) ?? findStarReExportOf(buildCtx.config, compilerCtx, foundSource, className) : void 0;
17160
17245
  if (reExport) return resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration, foundSource, reExport.moduleSpecifier, reExport.localName, dependentClasses, typeChecker, ogModule, targetScriptTarget, barrelHopsRemaining - 1, originalModuleSpecifier, originalContainingFile);
17161
17246
  const err = buildWarn(buildCtx.diagnostics);
17162
17247
  err.messageText = `Unable to find "${className}" in the imported module "${moduleSpecifier}".
@@ -17166,12 +17251,22 @@ function resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration,
17166
17251
  }
17167
17252
  let foundClassDeclaration = matchedStatement ? ts.isClassDeclaration(matchedStatement) ? matchedStatement : void 0 : void 0;
17168
17253
  let foundClassSource = foundSource;
17169
- if (!foundClassDeclaration && matchedStatement) {
17254
+ const findInJsEntry = () => {
17255
+ if (!isDtsFile(foundSource.fileName) || isLocalModule(originalModuleSpecifier)) return;
17256
+ const jsSource = resolveModuleJsEntry(buildCtx.config, compilerCtx, originalModuleSpecifier, originalContainingFile);
17257
+ return jsSource && findClassInJsModule(buildCtx.config, compilerCtx, jsSource, className);
17258
+ };
17259
+ if (foundClassDeclaration) {
17260
+ const foundInJs = findInJsEntry();
17261
+ if (foundInJs) {
17262
+ foundClassDeclaration = foundInJs.classNode;
17263
+ foundClassSource = foundInJs.sourceFile;
17264
+ }
17265
+ } else if (matchedStatement) {
17170
17266
  foundClassDeclaration = findClassWalk(matchedStatement);
17171
17267
  keepLooking = false;
17172
- if (!foundClassDeclaration && isDtsFile(foundSource.fileName) && !isLocalModule(originalModuleSpecifier)) {
17173
- const jsSource = resolveModuleJsEntry(buildCtx.config, compilerCtx, originalModuleSpecifier, originalContainingFile);
17174
- const foundInJs = jsSource && findClassInJsModule(buildCtx.config, compilerCtx, jsSource, className);
17268
+ if (!foundClassDeclaration) {
17269
+ const foundInJs = findInJsEntry();
17175
17270
  if (foundInJs) {
17176
17271
  foundClassDeclaration = foundInJs.classNode;
17177
17272
  foundClassSource = foundInJs.sourceFile;
@@ -17189,6 +17284,27 @@ function resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration,
17189
17284
  }
17190
17285
  return foundClassDeclaration;
17191
17286
  }
17287
+ /**
17288
+ * Finds the first `export * from './x'` in `barrel` whose target declares `className` directly.
17289
+ * @param config the current Stencil validated config
17290
+ * @param compilerCtx the current compiler context
17291
+ * @param barrel the source file to scan
17292
+ * @param className the declaration name to look for
17293
+ * @returns the re-export to follow, in `findReExport`'s shape, or `undefined`
17294
+ */
17295
+ function findStarReExportOf(config, compilerCtx, barrel, className) {
17296
+ for (const moduleSpecifier of findStarReExportSpecifiers(barrel)) {
17297
+ const resolved = tsResolveModuleName(config, compilerCtx, moduleSpecifier, barrel.fileName);
17298
+ const fileName = resolved?.resolvedModule?.resolvedFileName;
17299
+ if (!fileName) continue;
17300
+ const target = compilerCtx.moduleMap.get(fileName)?.staticSourceFile ?? (isJsFile(fileName) ? readJsSourceFile(config, fileName) : tsGetSourceFile(config, resolved));
17301
+ if (target && findStatementByName(target, className)) return {
17302
+ moduleSpecifier,
17303
+ localName: className
17304
+ };
17305
+ }
17306
+ }
17307
+ const isJsFile = (fileName) => /\.[cm]?js$/.test(fileName);
17192
17308
  function convertDtsToJs(declarationSourceFile, compilerCtx) {
17193
17309
  const jsPath = normalizePath(declarationSourceFile.replace(/\.d\.ts$/, ".js").replace("/types/", "/collection/"));
17194
17310
  return compilerCtx.moduleMap.get(jsPath)?.staticSourceFile;
@@ -17625,7 +17741,7 @@ function reclassifyGlobalTypeReferences(members, declaringSf, declaringPath, res
17625
17741
  }
17626
17742
  /**
17627
17743
  * Looks for `name` as a direct top-level declaration in `sf`; if not found, follows one level of
17628
- * re-export (barrel file) via `resolveImport` - matching `compiler-ctx-merge.ts`'s equivalent
17744
+ * re-export (barrel file, named or `export *`) via `resolveImport` - matching `compiler-ctx-merge.ts`'s equivalent
17629
17745
  * one-hop fallback (see `findReExport` in `shared.ts` for why it's capped at one hop).
17630
17746
  *
17631
17747
  * @param sf the source file to search
@@ -17642,20 +17758,25 @@ function findDeclarationOrReExport(sf, path, name, resolveImport) {
17642
17758
  sourceFile: sf,
17643
17759
  path
17644
17760
  };
17645
- const reExport = findReExport(sf, name);
17646
- if (!reExport) return void 0;
17647
- const resolved = resolveImport(reExport.moduleSpecifier, path);
17648
- if (!resolved) return void 0;
17649
- const { code, path: resolvedPath } = resolved;
17650
- const isTs = resolvedPath.endsWith(".tsx") || resolvedPath.endsWith(".ts");
17651
- const reExportSf = ts.createSourceFile(resolvedPath, code, ts.ScriptTarget.ESNext, true, isTs ? ts.ScriptKind.TSX : ts.ScriptKind.JS);
17652
- const statement = findStatementByName(reExportSf, reExport.localName);
17653
- if (!statement) return void 0;
17654
- return {
17655
- statement,
17656
- sourceFile: reExportSf,
17657
- path: resolvedPath
17761
+ const findIn = (moduleSpecifier, localName) => {
17762
+ const resolved = resolveImport(moduleSpecifier, path);
17763
+ if (!resolved) return void 0;
17764
+ const { code, path: resolvedPath } = resolved;
17765
+ const isTs = resolvedPath.endsWith(".tsx") || resolvedPath.endsWith(".ts");
17766
+ const reExportSf = ts.createSourceFile(resolvedPath, code, ts.ScriptTarget.ESNext, true, isTs ? ts.ScriptKind.TSX : ts.ScriptKind.JS);
17767
+ const statement = findStatementByName(reExportSf, localName);
17768
+ return statement && {
17769
+ statement,
17770
+ sourceFile: reExportSf,
17771
+ path: resolvedPath
17772
+ };
17658
17773
  };
17774
+ const reExport = findReExport(sf, name);
17775
+ if (reExport) return findIn(reExport.moduleSpecifier, reExport.localName);
17776
+ for (const moduleSpecifier of findStarReExportSpecifiers(sf)) {
17777
+ const found = findIn(moduleSpecifier, name);
17778
+ if (found) return found;
17779
+ }
17659
17780
  }
17660
17781
  /**
17661
17782
  * Recursively resolves a class's `extends` heritage into a flat, deduplicated
@@ -18231,7 +18352,7 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
18231
18352
  };
18232
18353
  if (!isCollectionDependency) validateComponentMembers(cmpNode, buildCtx);
18233
18354
  const visitComponentChildNode = (node) => {
18234
- if (ts.isCallExpression(node)) parseCallExpression(cmp, node, typeChecker);
18355
+ if (ts.isCallExpression(node)) parseCallExpression(cmp, node, typeChecker, moduleFile);
18235
18356
  else if (ts.isStringLiteral(node)) parseStringLiteral(cmp, node);
18236
18357
  node.forEachChild(visitComponentChildNode);
18237
18358
  };
@@ -18314,18 +18435,32 @@ const parseAssetsDirs = (staticMembers, componentFilePath) => {
18314
18435
  //#region src/compiler/transformers/static-to-meta/import.ts
18315
18436
  const parseModuleImport = (config, compilerCtx, buildCtx, moduleFile, dirPath, importNode, resolveCollections) => {
18316
18437
  if (importNode.moduleSpecifier && ts.isStringLiteral(importNode.moduleSpecifier)) {
18317
- let importPath = importNode.moduleSpecifier.text;
18438
+ const importPath = importNode.moduleSpecifier.text;
18318
18439
  if (!moduleFile.originalImports.includes(importPath)) moduleFile.originalImports.push(importPath);
18319
18440
  if (importPath === "@stencil/core/signals") moduleFile.hasSignalsImport = true;
18320
- if (isAbsolute$1(importPath)) {
18321
- importPath = normalizePath(importPath);
18322
- moduleFile.localImports.push(importPath);
18323
- } else if (importPath.startsWith(".")) {
18324
- importPath = normalizePath(join$2(dirPath, importPath));
18325
- moduleFile.localImports.push(importPath);
18326
- } else addExternalImport(config, compilerCtx, buildCtx, moduleFile, moduleFile.sourceFilePath, importPath, resolveCollections, !importNode.importClause);
18441
+ const localPath = resolveLocalImportPath(dirPath, importPath);
18442
+ if (localPath) moduleFile.localImports.push(localPath);
18443
+ else addExternalImport(config, compilerCtx, buildCtx, moduleFile, moduleFile.sourceFilePath, importPath, resolveCollections, !importNode.importClause);
18444
+ }
18445
+ };
18446
+ /**
18447
+ * Record a local `export … from './x'` re-export as a local import, so build conditionals
18448
+ * propagate through barrel files. Bare-specifier re-exports are left alone.
18449
+ *
18450
+ * @param moduleFile the module containing the re-export
18451
+ * @param dirPath the module's (normalized) directory
18452
+ * @param exportNode the export declaration
18453
+ */
18454
+ const parseModuleReExport = (moduleFile, dirPath, exportNode) => {
18455
+ if (exportNode.moduleSpecifier && ts.isStringLiteral(exportNode.moduleSpecifier)) {
18456
+ const localPath = resolveLocalImportPath(dirPath, exportNode.moduleSpecifier.text);
18457
+ if (localPath && !moduleFile.localImports.includes(localPath)) moduleFile.localImports.push(localPath);
18327
18458
  }
18328
18459
  };
18460
+ const resolveLocalImportPath = (dirPath, importPath) => {
18461
+ if (isAbsolute$1(importPath)) return normalizePath(importPath);
18462
+ if (importPath.startsWith(".")) return normalizePath(join$2(dirPath, importPath));
18463
+ };
18329
18464
  //#endregion
18330
18465
  //#region src/compiler/transformers/static-to-meta/parse-static.ts
18331
18466
  /**
@@ -18408,6 +18543,9 @@ const updateModule = (config, compilerCtx, buildCtx, tsSourceFile, sourceFileTex
18408
18543
  } else if (ts.isImportDeclaration(node)) {
18409
18544
  parseModuleImport(config, compilerCtx, buildCtx, moduleFile, srcDirPath, node, true);
18410
18545
  return;
18546
+ } else if (ts.isExportDeclaration(node)) {
18547
+ parseModuleReExport(moduleFile, srcDirPath, node);
18548
+ return;
18411
18549
  } else if (ts.isCallExpression(node)) parseCallExpression(moduleFile, node, typeChecker);
18412
18550
  else if (ts.isStringLiteral(node)) parseStringLiteral(moduleFile, node);
18413
18551
  else if (ts.isVariableStatement(node)) node.declarationList.declarations.forEach((declaration) => {
@@ -24671,7 +24809,8 @@ const prerenderEnsureDir = (sys, prerenderCtx, p) => {
24671
24809
  * 2. A doc-commented `--foo: value;` declaration inside the component's "root" rule - `:host`
24672
24810
  * for `shadow`/`scoped` encapsulation, or the component's own tag selector for `none`.
24673
24811
  * 3. A native `@property --foo { ... }` at-rule, with the `syntax`/`initial-value` descriptors
24674
- * surfaced as `syntax`/`default`. Not scoped - `@property` is a global registration.
24812
+ * surfaced as `syntax`/`default`. Not scoped - `@property` is a global registration. For a
24813
+ * property already documented by 1 or 2, it still supplies `syntax`/`default`.
24675
24814
  *
24676
24815
  * @param styleDocs the array to hold formatted CSS docstrings
24677
24816
  * @param styleText the CSS text we're working with
@@ -24732,10 +24871,17 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
24732
24871
  });
24733
24872
  root.walkAtRules("property", (node) => {
24734
24873
  const propName = node.params.trim();
24735
- if (!propName.startsWith("--") || hasName(propName)) return;
24874
+ if (!propName.startsWith("--")) return;
24736
24875
  const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
24737
24876
  const prev = node.prev();
24738
24877
  const docs = prev && prev.type === "comment" && isJsDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
24878
+ const existing = styleDocs.find((styleDoc) => styleDoc.name === propName);
24879
+ if (existing) {
24880
+ existing.docs ||= docs;
24881
+ if (syntax) existing.syntax ??= syntax;
24882
+ if (initialValue) existing.default ??= initialValue;
24883
+ return;
24884
+ }
24739
24885
  styleDocs.push({
24740
24886
  name: propName,
24741
24887
  docs,
@@ -24762,12 +24908,10 @@ function parseCssComment(styleDocs, comment, mode) {
24762
24908
  }).join(" ").replace(/\t/g, " ").trim();
24763
24909
  while (comment.includes(" ")) comment = comment.replace(" ", " ");
24764
24910
  comment.split(CSS_PROP_ANNOTATION_RE).forEach((d) => {
24765
- const cssDocument = d.trim();
24766
- if (!cssDocument.startsWith(`--`)) return;
24767
- const splt = cssDocument.split(`:`);
24911
+ const prop = parseCustomPropertyTag(d);
24912
+ if (!prop) return;
24768
24913
  const styleDoc = {
24769
- name: splt[0].trim(),
24770
- docs: (splt.shift() && splt.join(`:`)).trim(),
24914
+ ...prop,
24771
24915
  annotation: "prop",
24772
24916
  mode
24773
24917
  };
@@ -25186,9 +25330,9 @@ const validateTsConfig = async (config, sys) => {
25186
25330
  if (results.watchOptions) tsconfig.watchOptions = results.watchOptions;
25187
25331
  if (results.options) {
25188
25332
  tsconfig.compilerOptions = results.options;
25189
- if ((tsconfig.compilerOptions.target ?? ts.ScriptTarget.ES2017) < ts.ScriptTarget.ES2017) {
25333
+ if ((tsconfig.compilerOptions.target ?? ts.ScriptTarget.ES2022) < ts.ScriptTarget.ES2022) {
25190
25334
  const warn = buildWarn(tsconfig.diagnostics);
25191
- warn.messageText = `Stencil requires the tsconfig.json “target” setting to be “es2017” or higher. ES5 build output is no longer supported.`;
25335
+ warn.messageText = `Stencil requires the tsconfig.json “target” setting to be “es2022” or higher, matching its supported browsers. Lower targets compile to larger, older syntax.`;
25192
25336
  }
25193
25337
  if (tsconfig.compilerOptions.module !== ts.ModuleKind.ESNext && !config._isTesting) {
25194
25338
  const warn = buildWarn(tsconfig.diagnostics);
@@ -26409,6 +26553,7 @@ const convertStaticToMeta = (config, compilerCtx, buildCtx, typeChecker, collect
26409
26553
  const visitNode = (node) => {
26410
26554
  if (ts.isClassDeclaration(node)) return parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile, buildCtx, transformOpts);
26411
26555
  else if (ts.isImportDeclaration(node)) parseModuleImport(config, compilerCtx, buildCtx, moduleFile, dirPath, node, !transformOpts.isolatedModules);
26556
+ else if (ts.isExportDeclaration(node)) parseModuleReExport(moduleFile, dirPath, node);
26412
26557
  else if (ts.isCallExpression(node)) parseCallExpression(moduleFile, node, typeChecker);
26413
26558
  else if (ts.isStringLiteral(node)) parseStringLiteral(moduleFile, node);
26414
26559
  return ts.visitEachChild(node, visitNode, transformCtx);
@@ -3316,7 +3316,9 @@ interface CopyTask {
3316
3316
  /**
3317
3317
  * Additional glob patterns to exclude from the copy operation, merged with
3318
3318
  * the built-in defaults: `__mocks__`, `__fixtures__`, `dist`, hidden dirs,
3319
- * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`.
3319
+ * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`. For a directory
3320
+ * `src`, patterns match paths relative to that directory; an explicitly
3321
+ * named `src` file is never ignored.
3320
3322
  */
3321
3323
  ignore?: string[];
3322
3324
  /**
@@ -1,4 +1,4 @@
1
- import { ar as RafCallback, cr as TagTransformer, lr as UserBuildConditionals, n as ChildType, nr as ErrorHandler, p as HostElement, rr as FunctionalComponent, sr as ResolutionHandler, ur as VNode, v as PropsType, y as RuntimeRef } from "./index-C41EOWaQ.mjs";
1
+ import { ar as RafCallback, cr as TagTransformer, lr as UserBuildConditionals, n as ChildType, nr as ErrorHandler, p as HostElement, rr as FunctionalComponent, sr as ResolutionHandler, ur as VNode, v as PropsType, y as RuntimeRef } from "./index-DMJOS1Fo.mjs";
2
2
  //#region src/client/client-build.d.ts
3
3
  declare const Build: UserBuildConditionals;
4
4
  //#endregion
@@ -3356,7 +3356,9 @@ interface CopyTask {
3356
3356
  /**
3357
3357
  * Additional glob patterns to exclude from the copy operation, merged with
3358
3358
  * the built-in defaults: `__mocks__`, `__fixtures__`, `dist`, hidden dirs,
3359
- * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`.
3359
+ * `.ds_store`, `.gitignore`, `desktop.ini`, `thumbs.db`. For a directory
3360
+ * `src`, patterns match paths relative to that directory; an explicitly
3361
+ * named `src` file is never ignored.
3360
3362
  */
3361
3363
  ignore?: string[];
3362
3364
  /**
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-CVXS3JZ-.mjs";
1
+ import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-9wOO56Ye.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  //#region src/client/client-decorators.ts
4
4
  /**
@@ -1,3 +1,3 @@
1
- import { n as jsxDEV, r as jsxs, t as jsx } from "./client-CVXS3JZ-.mjs";
1
+ import { n as jsxDEV, r as jsxs, t as jsx } from "./client-9wOO56Ye.mjs";
2
2
  import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
3
  export { Fragment, jsx, jsxDEV, jsxs };