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

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-BYvfR_Hx.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-CvPPhnWO.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.28";
465
+ const buildId = "1793723538";
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) => {
@@ -6454,8 +6507,24 @@ let callbackIds = 0;
6454
6507
  const pending = new Map();
6455
6508
  const callbacks = new Map();
6456
6509
 
6510
+ const constructWorker = (workerPath, workerName) => {
6511
+ try {
6512
+ return new Worker(workerPath, {name:workerName});
6513
+ } catch (e) {
6514
+ // Worker() rejects a cross-origin URL (e.g. a library loaded from a CDN) - bootstrap it
6515
+ // from a same-origin Blob instead
6516
+ const blob = new Blob(['importScripts(' + JSON.stringify(workerPath) + ')'], { type: 'text/javascript' });
6517
+ const url = URL.createObjectURL(blob);
6518
+ try {
6519
+ return new Worker(url, {name:workerName});
6520
+ } finally {
6521
+ URL.revokeObjectURL(url);
6522
+ }
6523
+ }
6524
+ };
6525
+
6457
6526
  export const createWorker = (workerPath, workerName, workerMsgId) => {
6458
- const worker = new Worker(workerPath, {name:workerName});
6527
+ const worker = constructWorker(workerPath, workerName);
6459
6528
 
6460
6529
  worker.addEventListener('message', ({data}) => {
6461
6530
  if (data) {
@@ -9549,10 +9618,22 @@ const stylesToMarkdown = (styles) => {
9549
9618
  if (styles.length === 0) return content;
9550
9619
  content.push(`## CSS Custom Properties`);
9551
9620
  content.push(``);
9621
+ const hasRegistrations = styles.some((s) => s.syntax || s.default);
9622
+ const code = (text) => text ? `\`${text}\`` : "";
9552
9623
  const table = new MarkdownTable();
9553
- table.addHeader(["Name", "Description"]);
9624
+ table.addHeader(hasRegistrations ? [
9625
+ "Name",
9626
+ "Description",
9627
+ "Syntax",
9628
+ "Default"
9629
+ ] : ["Name", "Description"]);
9554
9630
  styles.forEach((style) => {
9555
- table.addRow([`\`${style.name}\``, style.docs]);
9631
+ const row = [code(style.name), style.docs];
9632
+ table.addRow(hasRegistrations ? [
9633
+ ...row,
9634
+ code(style.syntax),
9635
+ code(style.default)
9636
+ ] : row);
9556
9637
  });
9557
9638
  content.push(...table.toMarkdown());
9558
9639
  content.push(``);
@@ -14481,12 +14562,18 @@ const gatherVdomMeta = (m, args, typeChecker) => {
14481
14562
  };
14482
14563
  //#endregion
14483
14564
  //#region src/compiler/transformers/static-to-meta/call-expression.ts
14484
- const parseCallExpression = (m, node, typeChecker) => {
14565
+ /**
14566
+ * @param m the module or component to record vdom metadata on
14567
+ * @param node the call expression to parse
14568
+ * @param typeChecker used to resolve functional components / JSX-returning calls to their source
14569
+ * @param moduleFile the module to record those dependencies on; defaults to `m` when it's a module
14570
+ */
14571
+ const parseCallExpression = (m, node, typeChecker, moduleFile = "functionalComponentDeps" in m ? m : void 0) => {
14485
14572
  if (node.arguments != null && node.arguments.length > 0) {
14486
- if (ts.isIdentifier(node.expression)) visitCallExpressionArgs(m, node.expression, node.arguments, typeChecker);
14573
+ if (ts.isIdentifier(node.expression)) visitCallExpressionArgs(m, node.expression, node.arguments, typeChecker, moduleFile);
14487
14574
  else if (ts.isPropertyAccessExpression(node.expression)) {
14488
14575
  const n = node.expression.name;
14489
- if (ts.isIdentifier(n) && n) visitCallExpressionArgs(m, n, node.arguments, typeChecker);
14576
+ if (ts.isIdentifier(n) && n) visitCallExpressionArgs(m, n, node.arguments, typeChecker, moduleFile);
14490
14577
  }
14491
14578
  } else if (ts.isPropertyAccessExpression(node.expression)) {
14492
14579
  if (ts.isIdentifier(node.expression.name)) {
@@ -14496,24 +14583,20 @@ const parseCallExpression = (m, node, typeChecker) => {
14496
14583
  if (!declarations || declarations.length === 0) return;
14497
14584
  const sourceFile = declarations[0].getSourceFile();
14498
14585
  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
- }
14586
+ addFunctionalComponentDep(moduleFile, sourceFile);
14504
14587
  }
14505
14588
  }
14506
14589
  };
14507
- const visitCallExpressionArgs = (m, callExpressionName, args, typeChecker) => {
14590
+ const visitCallExpressionArgs = (m, callExpressionName, args, typeChecker, moduleFile) => {
14508
14591
  const fnName = callExpressionName.escapedText;
14509
14592
  if (fnName === "h" || fnName === "__stencil_h" || fnName === "createElement") {
14510
- visitCallExpressionArg(m, args[0], typeChecker);
14593
+ visitCallExpressionArg(m, args[0], typeChecker, moduleFile);
14511
14594
  if (fnName === "h" || fnName === "__stencil_h") gatherVdomMeta(m, args, typeChecker);
14512
14595
  } else if (fnName === "jsx" || fnName === "jsxs" || fnName === "_jsx" || fnName === "_jsxs") {
14513
- visitCallExpressionArg(m, args[0], typeChecker);
14596
+ visitCallExpressionArg(m, args[0], typeChecker, moduleFile);
14514
14597
  gatherVdomMeta(m, args, typeChecker);
14515
14598
  if (args.length > 2 && args[2]) m.hasVdomKey = true;
14516
- } else if (args.length > 1 && fnName === "createElementNS") visitCallExpressionArg(m, args[1], typeChecker);
14599
+ } else if (args.length > 1 && fnName === "createElementNS") visitCallExpressionArg(m, args[1], typeChecker, moduleFile);
14517
14600
  else if (fnName === "require" && args.length > 0 && m.originalImports) {
14518
14601
  const arg = args[0];
14519
14602
  if (ts.isStringLiteral(arg)) {
@@ -14521,7 +14604,7 @@ const visitCallExpressionArgs = (m, callExpressionName, args, typeChecker) => {
14521
14604
  }
14522
14605
  }
14523
14606
  };
14524
- const visitCallExpressionArg = (m, arg, typeChecker) => {
14607
+ const visitCallExpressionArg = (m, arg, typeChecker, moduleFile) => {
14525
14608
  if (ts.isStringLiteral(arg)) {
14526
14609
  let tag = arg.text;
14527
14610
  if (typeof tag === "string") {
@@ -14529,31 +14612,31 @@ const visitCallExpressionArg = (m, arg, typeChecker) => {
14529
14612
  m.htmlTagNames.push(tag);
14530
14613
  if (tag.includes("-")) m.potentialCmpRefs.push(tag);
14531
14614
  }
14532
- } else if (typeChecker && ts.isIdentifier(arg)) resolveFunctionalComponentDep(m, arg, typeChecker);
14615
+ } else if (typeChecker && ts.isIdentifier(arg)) resolveFunctionalComponentDep(moduleFile, arg, typeChecker);
14533
14616
  };
14534
14617
  /**
14535
14618
  * Resolves a functional component identifier to its source file and tracks it
14536
14619
  * as a dependency so that build-conditionals can be properly propagated.
14620
+ * Follows import / re-export aliases through to the declaring file.
14537
14621
  *
14538
- * @param m the module or component metadata to track the dependency on
14622
+ * @param moduleFile the module to track the dependency on
14539
14623
  * @param identifier the identifier node representing the functional component
14540
14624
  * @param typeChecker the TypeScript type checker for symbol resolution
14541
14625
  */
14542
- const resolveFunctionalComponentDep = (m, identifier, typeChecker) => {
14626
+ const resolveFunctionalComponentDep = (moduleFile, identifier, typeChecker) => {
14627
+ if (!moduleFile) return;
14543
14628
  try {
14544
14629
  const symbol = typeChecker.getSymbolAtLocation(identifier);
14545
14630
  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
- }
14631
+ const sourceFile = (symbol.flags & ts.SymbolFlags.Alias ? typeChecker.getAliasedSymbol(symbol) : symbol).declarations?.[0]?.getSourceFile();
14632
+ if (sourceFile) addFunctionalComponentDep(moduleFile, sourceFile);
14555
14633
  } catch {}
14556
14634
  };
14635
+ const addFunctionalComponentDep = (moduleFile, sourceFile) => {
14636
+ const deps = moduleFile?.functionalComponentDeps;
14637
+ const sourceFilePath = normalizePath(sourceFile.fileName);
14638
+ if (deps && !deps.includes(sourceFilePath)) deps.push(sourceFilePath);
14639
+ };
14557
14640
  //#endregion
14558
14641
  //#region src/compiler/transformers/add-component-meta-static.ts
14559
14642
  /**
@@ -16895,6 +16978,13 @@ function findReExport(sourceFile, className) {
16895
16978
  }
16896
16979
  }
16897
16980
  /**
16981
+ * @param sourceFile the (barrel) source file to scan
16982
+ * @returns the module specifiers of its `export * from './x'` statements, in order
16983
+ */
16984
+ function findStarReExportSpecifiers(sourceFile) {
16985
+ return sourceFile.statements.flatMap((stmt) => ts.isExportDeclaration(stmt) && !stmt.exportClause && !stmt.isTypeOnly && stmt.moduleSpecifier && ts.isStringLiteral(stmt.moduleSpecifier) ? [stmt.moduleSpecifier.text] : []);
16986
+ }
16987
+ /**
16898
16988
  * Finds `name`'s import in `sourceFile` and returns its module and origin name (before any `as`
16899
16989
  * aliasing; `'default'` for a default import).
16900
16990
  * @param sourceFile the source file to scan for a matching import
@@ -17021,12 +17111,20 @@ function findClassInJsModule(config, compilerCtx, source, className, hopsRemaini
17021
17111
  };
17022
17112
  }
17023
17113
  if (hopsRemaining <= 0) return;
17114
+ const readReExported = (moduleSpecifier) => {
17115
+ const resolvedFileName = tsResolveModuleName(config, compilerCtx, moduleSpecifier, source.fileName)?.resolvedModule?.resolvedFileName;
17116
+ return resolvedFileName ? readJsSourceFile(config, resolvedFileName) : void 0;
17117
+ };
17024
17118
  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);
17119
+ if (reExport) {
17120
+ const nextSource = readReExported(reExport.moduleSpecifier);
17121
+ return nextSource && findClassInJsModule(config, compilerCtx, nextSource, reExport.localName, hopsRemaining - 1);
17122
+ }
17123
+ for (const moduleSpecifier of findStarReExportSpecifiers(source)) {
17124
+ const nextSource = readReExported(moduleSpecifier);
17125
+ const found = nextSource && findClassInJsModule(config, compilerCtx, nextSource, className, hopsRemaining - 1);
17126
+ if (found) return found;
17127
+ }
17030
17128
  }
17031
17129
  /**
17032
17130
  * Filters `dedupeMembers` down to entries not already present in `staticMembers`
@@ -17121,7 +17219,8 @@ function convertDiskSourceFileDecorators(sourceFile, config, target = ts.ScriptT
17121
17219
  /**
17122
17220
  * Resolves an `extends` target through a module specifier: resolves the
17123
17221
  * 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
17222
+ * own ancestors) to `dependentClasses`. Follows one level of re-export (barrel file, named or
17223
+ * `export *`) when the
17125
17224
  * declaration isn't found directly in the resolved module.
17126
17225
  * @param compilerCtx the current compiler context
17127
17226
  * @param buildCtx the current build context
@@ -17142,7 +17241,9 @@ function resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration,
17142
17241
  let keepLooking = true;
17143
17242
  const foundFile = tsResolveModuleName(buildCtx.config, compilerCtx, moduleSpecifier, currentSource.fileName);
17144
17243
  if (!foundFile?.resolvedModule || !className) return;
17145
- let foundSource = compilerCtx.moduleMap.get(foundFile.resolvedModule.resolvedFileName)?.staticSourceFile;
17244
+ const resolvedFileName = foundFile.resolvedModule.resolvedFileName;
17245
+ let foundSource = compilerCtx.moduleMap.get(resolvedFileName)?.staticSourceFile;
17246
+ if (!foundSource && isJsFile(currentSource.fileName) && isJsFile(resolvedFileName)) foundSource = readJsSourceFile(buildCtx.config, resolvedFileName);
17146
17247
  if (!foundSource) {
17147
17248
  foundSource = tsGetSourceFile(buildCtx.config, foundFile);
17148
17249
  if (!foundSource) {
@@ -17156,7 +17257,7 @@ function resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration,
17156
17257
  }
17157
17258
  const matchedStatement = findStatementByName(foundSource, className);
17158
17259
  if (!matchedStatement) {
17159
- const reExport = barrelHopsRemaining > 0 ? findReExport(foundSource, className) : void 0;
17260
+ const reExport = barrelHopsRemaining > 0 ? findReExport(foundSource, className) ?? findStarReExportOf(buildCtx.config, compilerCtx, foundSource, className) : void 0;
17160
17261
  if (reExport) return resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration, foundSource, reExport.moduleSpecifier, reExport.localName, dependentClasses, typeChecker, ogModule, targetScriptTarget, barrelHopsRemaining - 1, originalModuleSpecifier, originalContainingFile);
17161
17262
  const err = buildWarn(buildCtx.diagnostics);
17162
17263
  err.messageText = `Unable to find "${className}" in the imported module "${moduleSpecifier}".
@@ -17166,12 +17267,22 @@ function resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration,
17166
17267
  }
17167
17268
  let foundClassDeclaration = matchedStatement ? ts.isClassDeclaration(matchedStatement) ? matchedStatement : void 0 : void 0;
17168
17269
  let foundClassSource = foundSource;
17169
- if (!foundClassDeclaration && matchedStatement) {
17270
+ const findInJsEntry = () => {
17271
+ if (!isDtsFile(foundSource.fileName) || isLocalModule(originalModuleSpecifier)) return;
17272
+ const jsSource = resolveModuleJsEntry(buildCtx.config, compilerCtx, originalModuleSpecifier, originalContainingFile);
17273
+ return jsSource && findClassInJsModule(buildCtx.config, compilerCtx, jsSource, className);
17274
+ };
17275
+ if (foundClassDeclaration) {
17276
+ const foundInJs = findInJsEntry();
17277
+ if (foundInJs) {
17278
+ foundClassDeclaration = foundInJs.classNode;
17279
+ foundClassSource = foundInJs.sourceFile;
17280
+ }
17281
+ } else if (matchedStatement) {
17170
17282
  foundClassDeclaration = findClassWalk(matchedStatement);
17171
17283
  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);
17284
+ if (!foundClassDeclaration) {
17285
+ const foundInJs = findInJsEntry();
17175
17286
  if (foundInJs) {
17176
17287
  foundClassDeclaration = foundInJs.classNode;
17177
17288
  foundClassSource = foundInJs.sourceFile;
@@ -17189,6 +17300,27 @@ function resolveAndProcessExtendedClass(compilerCtx, buildCtx, classDeclaration,
17189
17300
  }
17190
17301
  return foundClassDeclaration;
17191
17302
  }
17303
+ /**
17304
+ * Finds the first `export * from './x'` in `barrel` whose target declares `className` directly.
17305
+ * @param config the current Stencil validated config
17306
+ * @param compilerCtx the current compiler context
17307
+ * @param barrel the source file to scan
17308
+ * @param className the declaration name to look for
17309
+ * @returns the re-export to follow, in `findReExport`'s shape, or `undefined`
17310
+ */
17311
+ function findStarReExportOf(config, compilerCtx, barrel, className) {
17312
+ for (const moduleSpecifier of findStarReExportSpecifiers(barrel)) {
17313
+ const resolved = tsResolveModuleName(config, compilerCtx, moduleSpecifier, barrel.fileName);
17314
+ const fileName = resolved?.resolvedModule?.resolvedFileName;
17315
+ if (!fileName) continue;
17316
+ const target = compilerCtx.moduleMap.get(fileName)?.staticSourceFile ?? (isJsFile(fileName) ? readJsSourceFile(config, fileName) : tsGetSourceFile(config, resolved));
17317
+ if (target && findStatementByName(target, className)) return {
17318
+ moduleSpecifier,
17319
+ localName: className
17320
+ };
17321
+ }
17322
+ }
17323
+ const isJsFile = (fileName) => /\.[cm]?js$/.test(fileName);
17192
17324
  function convertDtsToJs(declarationSourceFile, compilerCtx) {
17193
17325
  const jsPath = normalizePath(declarationSourceFile.replace(/\.d\.ts$/, ".js").replace("/types/", "/collection/"));
17194
17326
  return compilerCtx.moduleMap.get(jsPath)?.staticSourceFile;
@@ -17625,7 +17757,7 @@ function reclassifyGlobalTypeReferences(members, declaringSf, declaringPath, res
17625
17757
  }
17626
17758
  /**
17627
17759
  * 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
17760
+ * re-export (barrel file, named or `export *`) via `resolveImport` - matching `compiler-ctx-merge.ts`'s equivalent
17629
17761
  * one-hop fallback (see `findReExport` in `shared.ts` for why it's capped at one hop).
17630
17762
  *
17631
17763
  * @param sf the source file to search
@@ -17642,20 +17774,25 @@ function findDeclarationOrReExport(sf, path, name, resolveImport) {
17642
17774
  sourceFile: sf,
17643
17775
  path
17644
17776
  };
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
17777
+ const findIn = (moduleSpecifier, localName) => {
17778
+ const resolved = resolveImport(moduleSpecifier, path);
17779
+ if (!resolved) return void 0;
17780
+ const { code, path: resolvedPath } = resolved;
17781
+ const isTs = resolvedPath.endsWith(".tsx") || resolvedPath.endsWith(".ts");
17782
+ const reExportSf = ts.createSourceFile(resolvedPath, code, ts.ScriptTarget.ESNext, true, isTs ? ts.ScriptKind.TSX : ts.ScriptKind.JS);
17783
+ const statement = findStatementByName(reExportSf, localName);
17784
+ return statement && {
17785
+ statement,
17786
+ sourceFile: reExportSf,
17787
+ path: resolvedPath
17788
+ };
17658
17789
  };
17790
+ const reExport = findReExport(sf, name);
17791
+ if (reExport) return findIn(reExport.moduleSpecifier, reExport.localName);
17792
+ for (const moduleSpecifier of findStarReExportSpecifiers(sf)) {
17793
+ const found = findIn(moduleSpecifier, name);
17794
+ if (found) return found;
17795
+ }
17659
17796
  }
17660
17797
  /**
17661
17798
  * Recursively resolves a class's `extends` heritage into a flat, deduplicated
@@ -18231,7 +18368,7 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
18231
18368
  };
18232
18369
  if (!isCollectionDependency) validateComponentMembers(cmpNode, buildCtx);
18233
18370
  const visitComponentChildNode = (node) => {
18234
- if (ts.isCallExpression(node)) parseCallExpression(cmp, node, typeChecker);
18371
+ if (ts.isCallExpression(node)) parseCallExpression(cmp, node, typeChecker, moduleFile);
18235
18372
  else if (ts.isStringLiteral(node)) parseStringLiteral(cmp, node);
18236
18373
  node.forEachChild(visitComponentChildNode);
18237
18374
  };
@@ -18314,18 +18451,32 @@ const parseAssetsDirs = (staticMembers, componentFilePath) => {
18314
18451
  //#region src/compiler/transformers/static-to-meta/import.ts
18315
18452
  const parseModuleImport = (config, compilerCtx, buildCtx, moduleFile, dirPath, importNode, resolveCollections) => {
18316
18453
  if (importNode.moduleSpecifier && ts.isStringLiteral(importNode.moduleSpecifier)) {
18317
- let importPath = importNode.moduleSpecifier.text;
18454
+ const importPath = importNode.moduleSpecifier.text;
18318
18455
  if (!moduleFile.originalImports.includes(importPath)) moduleFile.originalImports.push(importPath);
18319
18456
  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);
18457
+ const localPath = resolveLocalImportPath(dirPath, importPath);
18458
+ if (localPath) moduleFile.localImports.push(localPath);
18459
+ else addExternalImport(config, compilerCtx, buildCtx, moduleFile, moduleFile.sourceFilePath, importPath, resolveCollections, !importNode.importClause);
18460
+ }
18461
+ };
18462
+ /**
18463
+ * Record a local `export … from './x'` re-export as a local import, so build conditionals
18464
+ * propagate through barrel files. Bare-specifier re-exports are left alone.
18465
+ *
18466
+ * @param moduleFile the module containing the re-export
18467
+ * @param dirPath the module's (normalized) directory
18468
+ * @param exportNode the export declaration
18469
+ */
18470
+ const parseModuleReExport = (moduleFile, dirPath, exportNode) => {
18471
+ if (exportNode.moduleSpecifier && ts.isStringLiteral(exportNode.moduleSpecifier)) {
18472
+ const localPath = resolveLocalImportPath(dirPath, exportNode.moduleSpecifier.text);
18473
+ if (localPath && !moduleFile.localImports.includes(localPath)) moduleFile.localImports.push(localPath);
18327
18474
  }
18328
18475
  };
18476
+ const resolveLocalImportPath = (dirPath, importPath) => {
18477
+ if (isAbsolute$1(importPath)) return normalizePath(importPath);
18478
+ if (importPath.startsWith(".")) return normalizePath(join$2(dirPath, importPath));
18479
+ };
18329
18480
  //#endregion
18330
18481
  //#region src/compiler/transformers/static-to-meta/parse-static.ts
18331
18482
  /**
@@ -18408,6 +18559,9 @@ const updateModule = (config, compilerCtx, buildCtx, tsSourceFile, sourceFileTex
18408
18559
  } else if (ts.isImportDeclaration(node)) {
18409
18560
  parseModuleImport(config, compilerCtx, buildCtx, moduleFile, srcDirPath, node, true);
18410
18561
  return;
18562
+ } else if (ts.isExportDeclaration(node)) {
18563
+ parseModuleReExport(moduleFile, srcDirPath, node);
18564
+ return;
18411
18565
  } else if (ts.isCallExpression(node)) parseCallExpression(moduleFile, node, typeChecker);
18412
18566
  else if (ts.isStringLiteral(node)) parseStringLiteral(moduleFile, node);
18413
18567
  else if (ts.isVariableStatement(node)) node.declarationList.declarations.forEach((declaration) => {
@@ -24671,7 +24825,8 @@ const prerenderEnsureDir = (sys, prerenderCtx, p) => {
24671
24825
  * 2. A doc-commented `--foo: value;` declaration inside the component's "root" rule - `:host`
24672
24826
  * for `shadow`/`scoped` encapsulation, or the component's own tag selector for `none`.
24673
24827
  * 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.
24828
+ * surfaced as `syntax`/`default`. Not scoped - `@property` is a global registration. For a
24829
+ * property already documented by 1 or 2, it still supplies `syntax`/`default`.
24675
24830
  *
24676
24831
  * @param styleDocs the array to hold formatted CSS docstrings
24677
24832
  * @param styleText the CSS text we're working with
@@ -24732,10 +24887,17 @@ function parseScopedAndNativeStyleDocs(styleDocs, styleText, mode, tag, encapsul
24732
24887
  });
24733
24888
  root.walkAtRules("property", (node) => {
24734
24889
  const propName = node.params.trim();
24735
- if (!propName.startsWith("--") || hasName(propName)) return;
24890
+ if (!propName.startsWith("--")) return;
24736
24891
  const { syntax, initialValue } = parsePropertyAtRuleDescriptors(node);
24737
24892
  const prev = node.prev();
24738
24893
  const docs = prev && prev.type === "comment" && isJsDocComment(prev.text) ? normalizeJsDocText(prev.text) : "";
24894
+ const existing = styleDocs.find((styleDoc) => styleDoc.name === propName);
24895
+ if (existing) {
24896
+ existing.docs ||= docs;
24897
+ if (syntax) existing.syntax ??= syntax;
24898
+ if (initialValue) existing.default ??= initialValue;
24899
+ return;
24900
+ }
24739
24901
  styleDocs.push({
24740
24902
  name: propName,
24741
24903
  docs,
@@ -24762,12 +24924,10 @@ function parseCssComment(styleDocs, comment, mode) {
24762
24924
  }).join(" ").replace(/\t/g, " ").trim();
24763
24925
  while (comment.includes(" ")) comment = comment.replace(" ", " ");
24764
24926
  comment.split(CSS_PROP_ANNOTATION_RE).forEach((d) => {
24765
- const cssDocument = d.trim();
24766
- if (!cssDocument.startsWith(`--`)) return;
24767
- const splt = cssDocument.split(`:`);
24927
+ const prop = parseCustomPropertyTag(d);
24928
+ if (!prop) return;
24768
24929
  const styleDoc = {
24769
- name: splt[0].trim(),
24770
- docs: (splt.shift() && splt.join(`:`)).trim(),
24930
+ ...prop,
24771
24931
  annotation: "prop",
24772
24932
  mode
24773
24933
  };
@@ -25186,9 +25346,9 @@ const validateTsConfig = async (config, sys) => {
25186
25346
  if (results.watchOptions) tsconfig.watchOptions = results.watchOptions;
25187
25347
  if (results.options) {
25188
25348
  tsconfig.compilerOptions = results.options;
25189
- if ((tsconfig.compilerOptions.target ?? ts.ScriptTarget.ES2017) < ts.ScriptTarget.ES2017) {
25349
+ if ((tsconfig.compilerOptions.target ?? ts.ScriptTarget.ES2022) < ts.ScriptTarget.ES2022) {
25190
25350
  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.`;
25351
+ 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
25352
  }
25193
25353
  if (tsconfig.compilerOptions.module !== ts.ModuleKind.ESNext && !config._isTesting) {
25194
25354
  const warn = buildWarn(tsconfig.diagnostics);
@@ -26409,6 +26569,7 @@ const convertStaticToMeta = (config, compilerCtx, buildCtx, typeChecker, collect
26409
26569
  const visitNode = (node) => {
26410
26570
  if (ts.isClassDeclaration(node)) return parseStaticComponentMeta(compilerCtx, typeChecker, node, moduleFile, buildCtx, transformOpts);
26411
26571
  else if (ts.isImportDeclaration(node)) parseModuleImport(config, compilerCtx, buildCtx, moduleFile, dirPath, node, !transformOpts.isolatedModules);
26572
+ else if (ts.isExportDeclaration(node)) parseModuleReExport(moduleFile, dirPath, node);
26412
26573
  else if (ts.isCallExpression(node)) parseCallExpression(moduleFile, node, typeChecker);
26413
26574
  else if (ts.isStringLiteral(node)) parseStringLiteral(moduleFile, node);
26414
26575
  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
  /**
@@ -4460,7 +4462,7 @@ interface TranspileOptions {
4460
4462
  * transpile time — config-driven flags that are not derived from component
4461
4463
  * scanning or runtime environment detection.
4462
4464
  */
4463
- type BuildOverrideKeys = 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals' | 'lightDomPatches' | 'slotChildNodes' | 'slotCloneNode' | 'slotDomMutations' | 'slotTextContent' | 'lifecycleDOMEvents' | 'initializeNextTick';
4465
+ type BuildOverrideKeys = 'isDev' | 'isTesting' | 'hotModuleReplacement' | 'signalBacking' | 'vdomSignals' | 'lightDomPatches' | 'slotChildNodes' | 'slotCloneNode' | 'slotDomMutations' | 'slotTextContent' | 'lifecycleDOMEvents' | 'initializeNextTick';
4464
4466
  /**
4465
4467
  * Subset of Stencil's BUILD feature flags that can be overridden at transpile
4466
4468
  * time. Derived from {@link BuildConditionals} via `Pick` so the field list
@@ -1,5 +1,9 @@
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-BogZpjP2.mjs";
2
2
  //#region src/client/client-build.d.ts
3
+ /**
4
+ * `isDev` / `isTesting` are getters, not copies: the transpile path (e.g. `@stencil/unplugin`)
5
+ * sets `BUILD.*` overrides from each component module, which runs after this module is evaluated.
6
+ */
3
7
  declare const Build: UserBuildConditionals;
4
8
  //#endregion
5
9
  //#region src/client/client-log.d.ts