@stencil/core 5.0.0-beta.20 → 5.0.0-beta.22

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.
@@ -1844,7 +1844,7 @@ const validateComponentTag = (tag) => {
1844
1844
  };
1845
1845
  //#endregion
1846
1846
  //#region src/version.ts
1847
- const version = "5.0.0-beta.20";
1847
+ const version = "5.0.0-beta.22";
1848
1848
  //#endregion
1849
1849
  //#region src/compiler/events.ts
1850
1850
  const buildEvents = () => {
@@ -2643,14 +2643,14 @@ const getTranspileCssConfig = (compileOpts, importData, results) => {
2643
2643
  };
2644
2644
  const getTranspileConfigOpt = (value, validValues, defaultValue) => {
2645
2645
  if (value === null || value === "null") return null;
2646
- value = isString$1(value) ? value.toLowerCase().trim() : null;
2646
+ value = isString$1(value) ? value.toLowerCase().trim() : void 0;
2647
2647
  if (validValues.has(value)) return value;
2648
2648
  return defaultValue;
2649
2649
  };
2650
2650
  const VALID_EXPORT = /* @__PURE__ */ new Set(["customelement", "module"]);
2651
- const VALID_METADATA = /* @__PURE__ */ new Set(["compilerstatic", null]);
2651
+ const VALID_METADATA = /* @__PURE__ */ new Set(["compilerstatic"]);
2652
2652
  const VALID_MODULE = /* @__PURE__ */ new Set(["cjs", "esm"]);
2653
- const VALID_PROXY = /* @__PURE__ */ new Set(["defineproperty", null]);
2653
+ const VALID_PROXY = /* @__PURE__ */ new Set(["defineproperty"]);
2654
2654
  const VALID_STYLE = /* @__PURE__ */ new Set(["static"]);
2655
2655
  const VALID_STYLE_IMPORT_DATA = /* @__PURE__ */ new Set(["queryparams"]);
2656
2656
  const VALID_TARGET = /* @__PURE__ */ new Set([
@@ -2830,7 +2830,7 @@ const validateReadmeOutputTarget = (config, outputTarget) => {
2830
2830
  if (!isAbsolute(outputTarget.dir)) outputTarget.dir = join$1(config.rootDir, outputTarget.dir);
2831
2831
  if (outputTarget.footer == null) outputTarget.footer = NOTE;
2832
2832
  outputTarget.strict = !!outputTarget.strict;
2833
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
2833
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
2834
2834
  return outputTarget;
2835
2835
  };
2836
2836
  const validateJsonDocsOutputTarget = (config, diagnostics, outputTarget) => {
@@ -2842,7 +2842,7 @@ const validateJsonDocsOutputTarget = (config, diagnostics, outputTarget) => {
2842
2842
  if (isString$1(outputTarget.typesFile) && !isAbsolute(outputTarget.typesFile)) outputTarget.typesFile = join$1(config.rootDir, outputTarget.typesFile);
2843
2843
  else if (outputTarget.typesFile !== null && outputTarget.file.endsWith(".json")) outputTarget.typesFile = outputTarget.file.replace(/\.json$/, ".d.ts");
2844
2844
  outputTarget.strict = !!outputTarget.strict;
2845
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
2845
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
2846
2846
  return outputTarget;
2847
2847
  };
2848
2848
  const validateCustomDocsOutputTarget = (config, diagnostics, outputTarget) => {
@@ -2851,7 +2851,7 @@ const validateCustomDocsOutputTarget = (config, diagnostics, outputTarget) => {
2851
2851
  err.messageText = `docs-custom outputTarget missing the "generator" function`;
2852
2852
  }
2853
2853
  outputTarget.strict = !!outputTarget.strict;
2854
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
2854
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
2855
2855
  return outputTarget;
2856
2856
  };
2857
2857
  const validateVScodeDocsOutputTarget = (config, diagnostics, outputTarget) => {
@@ -2859,21 +2859,21 @@ const validateVScodeDocsOutputTarget = (config, diagnostics, outputTarget) => {
2859
2859
  const err = buildError(diagnostics);
2860
2860
  err.messageText = `docs-vscode outputTarget missing the "file" path`;
2861
2861
  }
2862
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
2862
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
2863
2863
  return outputTarget;
2864
2864
  };
2865
2865
  const DEFAULT_AGENT_SKILL_DIR = "dist/skill";
2866
2866
  const validateAgentSkillOutputTarget = (config, outputTarget) => {
2867
2867
  outputTarget.dir = getAbsolutePath(config, outputTarget.dir || DEFAULT_AGENT_SKILL_DIR);
2868
2868
  outputTarget.name = toSkillName(outputTarget.name || config.fsNamespace);
2869
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
2869
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
2870
2870
  return outputTarget;
2871
2871
  };
2872
2872
  const validateCustomElementsManifestOutputTarget = (config, outputTarget) => {
2873
2873
  if (!isString$1(outputTarget.file)) outputTarget.file = "custom-elements.json";
2874
2874
  if (!isAbsolute(outputTarget.file)) outputTarget.file = join$1(config.rootDir, outputTarget.file);
2875
2875
  outputTarget.strict = !!outputTarget.strict;
2876
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
2876
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
2877
2877
  return outputTarget;
2878
2878
  };
2879
2879
  //#endregion
@@ -15440,13 +15440,13 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
15440
15440
  hasPatchClone: false,
15441
15441
  hasPatchInsert: false
15442
15442
  };
15443
- const visitComponentChildNode = (node, ctx) => {
15444
- validateComponentMembers(node, ctx);
15443
+ if (!isCollectionDependency) validateComponentMembers(cmpNode, buildCtx);
15444
+ const visitComponentChildNode = (node) => {
15445
15445
  if (ts$1.isCallExpression(node)) parseCallExpression(cmp, node, typeChecker);
15446
15446
  else if (ts$1.isStringLiteral(node)) parseStringLiteral(cmp, node);
15447
- node.forEachChild((child) => visitComponentChildNode(child, ctx));
15447
+ node.forEachChild(visitComponentChildNode);
15448
15448
  };
15449
- visitComponentChildNode(cmpNode, buildCtx);
15449
+ visitComponentChildNode(cmpNode);
15450
15450
  parseClassMethods(classMethods, cmp);
15451
15451
  cmp.hasModernPropertyDecls = detectModernPropDeclarations(cmpNode) || doesExtend;
15452
15452
  cmp.htmlAttrNames = unique(cmp.htmlAttrNames);
@@ -15464,31 +15464,32 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
15464
15464
  return cmpNode;
15465
15465
  };
15466
15466
  /**
15467
- * Check whether a class declaration is a Stencil component, i.e. it's
15468
- * decorated with `@Component({ tag: ... })`.
15469
- * @param classNode the class declaration to check
15470
- * @returns whether `classNode` is a Stencil component class
15467
+ * Warn about members a Stencil component class should not define.
15468
+ * @param cmpNode the component class declaration
15469
+ * @param buildCtx the current build context, used to surface diagnostics
15471
15470
  */
15472
- const isStencilComponentClass = (classNode) => {
15473
- const decorator = ts$1.getDecorators(classNode)?.[0];
15474
- return decorator != null && ts$1.isCallExpression(decorator.expression) && decorator.expression.arguments.length === 1 && ts$1.isObjectLiteralExpression(decorator.expression.arguments[0]) && decorator.expression.arguments[0].properties.some((prop) => ts$1.isPropertyAssignment(prop) && prop.name.getText() === "tag");
15475
- };
15476
- const validateComponentMembers = (node, buildCtx) => {
15477
- /**
15478
- * validate if:
15479
- */
15480
- if (ts$1.isGetAccessorDeclaration(node) && ts$1.isIdentifier(node.name) && typeof node.name.escapedText === "string" && BLACKLISTED_COMPONENT_METHODS.includes(node.name.escapedText) && node.parent && ts$1.isClassDeclaration(node.parent) && isStencilComponentClass(node.parent)) {
15481
- const propName = node.name.escapedText;
15482
- const componentName = node.parent.name.getText();
15483
- const err = buildWarn(buildCtx.diagnostics);
15484
- err.messageText = `The component "${componentName}" has a getter called "${propName}". This getter is reserved for use by Stencil components and should not be defined by the user.`;
15485
- augmentDiagnosticWithNode(err, node);
15486
- }
15487
- if (ts$1.isMethodDeclaration(node) && ts$1.isIdentifier(node.name) && node.name.escapedText === "componentShouldUpdate" && node.parameters.length > 1 && node.parent && ts$1.isClassDeclaration(node.parent) && isStencilComponentClass(node.parent)) {
15488
- const componentName = node.parent.name.getText();
15489
- const err = buildWarn(buildCtx.diagnostics);
15490
- err.messageText = `The component "${componentName}" defines "componentShouldUpdate" with ${node.parameters.length} parameters. As of Stencil v5, "componentShouldUpdate" is called once per render with a single "changes" argument (a map of prop/state names to "{ newVal, oldVal }") instead of once per prop with "(newVal, oldVal, propName)". This method will still compile, but any extra parameters will be "undefined" at runtime.`;
15491
- augmentDiagnosticWithNode(err, node);
15471
+ const validateComponentMembers = (cmpNode, buildCtx) => {
15472
+ const componentName = cmpNode.name?.text ?? "";
15473
+ for (const member of cmpNode.members) {
15474
+ if (!member.name || !ts$1.isIdentifier(member.name)) continue;
15475
+ const memberName = member.name.text;
15476
+ /**
15477
+ * the component has a getter called "shadowRoot"
15478
+ */
15479
+ if (ts$1.isGetAccessorDeclaration(member) && BLACKLISTED_COMPONENT_METHODS.includes(memberName)) {
15480
+ const err = buildWarn(buildCtx.diagnostics);
15481
+ err.messageText = `The component "${componentName}" has a getter called "${memberName}". This getter is reserved for use by Stencil components and should not be defined by the user.`;
15482
+ augmentDiagnosticWithNode(err, ts$1.getOriginalNode(member));
15483
+ }
15484
+ /**
15485
+ * the component defines a "componentShouldUpdate" method with more than one parameter,
15486
+ * which was the pre-v5 per-prop signature "(newVal, oldVal, propName)"
15487
+ */
15488
+ if (ts$1.isMethodDeclaration(member) && memberName === "componentShouldUpdate" && member.parameters.length > 1) {
15489
+ const err = buildWarn(buildCtx.diagnostics);
15490
+ err.messageText = `The component "${componentName}" defines "componentShouldUpdate" with ${member.parameters.length} parameters. As of Stencil v5, "componentShouldUpdate" is called once per render with a single "changes" argument (a map of prop/state names to "{ newVal, oldVal }") instead of once per prop with "(newVal, oldVal, propName)". This method will still compile, but any extra parameters will be "undefined" at runtime.`;
15491
+ augmentDiagnosticWithNode(err, ts$1.getOriginalNode(member));
15492
+ }
15492
15493
  }
15493
15494
  };
15494
15495
  const parseVirtualProps = (docs) => {
@@ -1,4 +1,4 @@
1
- import { $ as CompilerFsStats, $n as WorkerMainController, $t as OutputTargetBuild, A as BuildOverrides, An as ResolveModuleIdResults, At as HotModuleReplacement, B as CompilerEventBuildLog, Bn as SsrFactoryOptions, Bt as Logger, C as BuildEmitEvents, Cn as PluginTransformResults, Cr as JsonDocsStyle, Ct as DevServerEditor, D as BuildOnEventRemove, Dn as PrerenderResults, Dr as JsonDocsValue, Dt as HistoryApiFallback, E as BuildNoChangeResults, En as PrerenderOptions, Er as JsonDocsUsage, Et as FsWatchResults, F as Compiler, Fn as SerializeDocumentOptions, Ft as LazyRequire, G as CompilerEventFileAdd, Gn as TransformOptions, Gt as OptimizeCssInput, H as CompilerEventBuildStart, Hn as StencilDevServerConfig, Ht as LoggerTimeSpan, I as CompilerBuildResults, In as ServiceWorkerConfig, It as LightDomPatches, J as CompilerEventFsChange, Jn as TranspileResults, Jt as OptimizeJsOutput, K as CompilerEventFileDelete, Kn as TranspileOnlyResults, Kt as OptimizeCssOutput, L as CompilerBuildStart, Ln as SitemapXmpOpts, Lt as LoadConfigInit, M as CliInitOptions, Mn as RobotsTxtOpts, Mt as HydrateFactoryOptions, N as CompileScriptMinifyOptions, Nn as RobotsTxtResults, Nt as HydratedFlag, O as BuildOnEvents, On as PrerenderStartOptions, Or as StyleDoc, Ot as HmrGlobalStyleUpdate, P as CompileTarget, Pn as RolldownConfig, Pt as LOG_LEVELS, Q as CompilerFileWatcherEvent, Qn as WatcherCloseResults, Qt as OutputTargetBaseNext, R as CompilerDependency, Rn as SitemapXmpResults, Rt as LoadConfigResults, S as AutoprefixerOptions, Sn as PluginCtx, Sr as JsonDocsSlot, St as DevServerConfig, T as BuildLog, Tn as PrerenderHydrateOptions, Tr as JsonDocsTypeLibrary, Tt as DocsReadmeCustomColumn, U as CompilerEventDirAdd, Un as StencilDocsConfig, Ut as ModeConfig, V as CompilerEventBuildNoChange, Vn as StencilConfig, Vt as LoggerLineUpdater, W as CompilerEventDirDelete, Wn as SystemDetails, Wt as NodeResolveConfig, X as CompilerFileWatcher, Xn as ValidatedConfig, Xt as OutputTargetAssets, Y as CompilerEventName, Yn as UnvalidatedConfig, Yt as OutputTarget, Z as CompilerFileWatcherCallback, Zn as ValidatedOutputTargetWww, Zt as OutputTargetBase, _ as PrintLine, _n as OutputTargetWww, _r as JsonDocsListener, _t as CopyTask, a as ComponentCompilerEvent, an as OutputTargetDocsCustom, at as CompilerSystemRealpathResults, b as SsrResults, bn as PlatformPath, br as JsonDocsPart, bt as CustomElementsExportBehaviorOptions, c as ComponentCompilerMethod, cn as OutputTargetDocsReadme, ct as CompilerSystemRemoveFileResults, d as ComponentCompilerTypeReferences, dn as OutputTargetLoaderBundle, dr as JsonDocMethodParameter, dt as CompilerSystemWriteFileResults, en as OutputTargetCollection, er as WorkerOptions, et as CompilerRequest, f as ComponentGlobalStyle, fn as OutputTargetSsr, fr as JsonDocs, ft as CompilerWatcher, g as PrerenderUrlResults, gn as OutputTargetTypes, gr as JsonDocsEvent, gt as CopyResults, h as PackageJsonData, hn as OutputTargetStats, hr as JsonDocsDependencyGraph, ht as ConfigCompat, i as CompilerWorkerContext, in as OutputTargetDocsAgentSkill, it as CompilerSystemCreateDirectoryResults, j as BuildResultsComponentGraph, jn as ResolveModuleOptions, jt as HydrateDocumentOptions, k as BuildOutput, kn as ResolveModuleIdOptions, kr as FsWriteResults, kt as HmrStyleUpdate, l as ComponentCompilerProperty, ln as OutputTargetDocsVscode, lr as UserBuildConditionals, lt as CompilerSystemRenameResults, m as LazyBundlesRuntimeData, mn as OutputTargetStandalone, mr as JsonDocsCustomState, mt as ConfigBundle, nn as OutputTargetCustom, nt as CompilerSystem, o as ComponentCompilerListener, on as OutputTargetDocsCustomElementsManifest, ot as CompilerSystemRemoveDirectoryOptions, pn as OutputTargetSsrWasm, pr as JsonDocsComponent, pt as Config, q as CompilerEventFileUpdate, qn as TranspileOptions, qt as OptimizeJsInput, r as CompilerCtx, rn as OutputTargetDistLazy, rt as CompilerSystemCreateDirectoryOptions, s as ComponentCompilerMeta, sn as OutputTargetDocsJson, st as CompilerSystemRemoveDirectoryResults, t as BuildCtx, tn as OutputTargetCopy, tt as CompilerRequestResponse, u as ComponentCompilerState, un as OutputTargetGlobalStyle, ut as CompilerSystemRenamedPath, vn as PageReloadStrategy, vr as JsonDocsMethod, vt as Credentials, w as BuildEvents, wn as PrerenderConfig, wr as JsonDocsTag, wt as Diagnostic, x as WorkerMsgHandler, xn as Plugin, xr as JsonDocsProp, xt as DevServer, yn as ParsedPath, yr as JsonDocsMethodReturn, yt as CustomElementsExportBehavior, z as CompilerEventBuildFinish, zn as SsrDocumentOptions, zt as LogLevel } from "../index-B9-Byy8z.mjs";
1
+ import { $ as CompilerFsStats, $n as WorkerMainController, $t as OutputTargetBuild, A as BuildOverrides, An as ResolveModuleIdResults, At as HotModuleReplacement, B as CompilerEventBuildLog, Bn as SsrFactoryOptions, Bt as Logger, C as BuildEmitEvents, Cn as PluginTransformResults, Cr as JsonDocsStyle, Ct as DevServerEditor, D as BuildOnEventRemove, Dn as PrerenderResults, Dr as JsonDocsValue, Dt as HistoryApiFallback, E as BuildNoChangeResults, En as PrerenderOptions, Er as JsonDocsUsage, Et as FsWatchResults, F as Compiler, Fn as SerializeDocumentOptions, Ft as LazyRequire, G as CompilerEventFileAdd, Gn as TransformOptions, Gt as OptimizeCssInput, H as CompilerEventBuildStart, Hn as StencilDevServerConfig, Ht as LoggerTimeSpan, I as CompilerBuildResults, In as ServiceWorkerConfig, It as LightDomPatches, J as CompilerEventFsChange, Jn as TranspileResults, Jt as OptimizeJsOutput, K as CompilerEventFileDelete, Kn as TranspileOnlyResults, Kt as OptimizeCssOutput, L as CompilerBuildStart, Ln as SitemapXmpOpts, Lt as LoadConfigInit, M as CliInitOptions, Mn as RobotsTxtOpts, Mt as HydrateFactoryOptions, N as CompileScriptMinifyOptions, Nn as RobotsTxtResults, Nt as HydratedFlag, O as BuildOnEvents, On as PrerenderStartOptions, Or as StyleDoc, Ot as HmrGlobalStyleUpdate, P as CompileTarget, Pn as RolldownConfig, Pt as LOG_LEVELS, Q as CompilerFileWatcherEvent, Qn as WatcherCloseResults, Qt as OutputTargetBaseNext, R as CompilerDependency, Rn as SitemapXmpResults, Rt as LoadConfigResults, S as AutoprefixerOptions, Sn as PluginCtx, Sr as JsonDocsSlot, St as DevServerConfig, T as BuildLog, Tn as PrerenderHydrateOptions, Tr as JsonDocsTypeLibrary, Tt as DocsReadmeCustomColumn, U as CompilerEventDirAdd, Un as StencilDocsConfig, Ut as ModeConfig, V as CompilerEventBuildNoChange, Vn as StencilConfig, Vt as LoggerLineUpdater, W as CompilerEventDirDelete, Wn as SystemDetails, Wt as NodeResolveConfig, X as CompilerFileWatcher, Xn as ValidatedConfig, Xt as OutputTargetAssets, Y as CompilerEventName, Yn as UnvalidatedConfig, Yt as OutputTarget, Z as CompilerFileWatcherCallback, Zn as ValidatedOutputTargetWww, Zt as OutputTargetBase, _ as PrintLine, _n as OutputTargetWww, _r as JsonDocsListener, _t as CopyTask, a as ComponentCompilerEvent, an as OutputTargetDocsCustom, at as CompilerSystemRealpathResults, b as SsrResults, bn as PlatformPath, br as JsonDocsPart, bt as CustomElementsExportBehaviorOptions, c as ComponentCompilerMethod, cn as OutputTargetDocsReadme, ct as CompilerSystemRemoveFileResults, d as ComponentCompilerTypeReferences, dn as OutputTargetLoaderBundle, dr as JsonDocMethodParameter, dt as CompilerSystemWriteFileResults, en as OutputTargetCollection, er as WorkerOptions, et as CompilerRequest, f as ComponentGlobalStyle, fn as OutputTargetSsr, fr as JsonDocs, ft as CompilerWatcher, g as PrerenderUrlResults, gn as OutputTargetTypes, gr as JsonDocsEvent, gt as CopyResults, h as PackageJsonData, hn as OutputTargetStats, hr as JsonDocsDependencyGraph, ht as ConfigCompat, i as CompilerWorkerContext, in as OutputTargetDocsAgentSkill, it as CompilerSystemCreateDirectoryResults, j as BuildResultsComponentGraph, jn as ResolveModuleOptions, jt as HydrateDocumentOptions, k as BuildOutput, kn as ResolveModuleIdOptions, kr as FsWriteResults, kt as HmrStyleUpdate, l as ComponentCompilerProperty, ln as OutputTargetDocsVscode, lr as UserBuildConditionals, lt as CompilerSystemRenameResults, m as LazyBundlesRuntimeData, mn as OutputTargetStandalone, mr as JsonDocsCustomState, mt as ConfigBundle, nn as OutputTargetCustom, nt as CompilerSystem, o as ComponentCompilerListener, on as OutputTargetDocsCustomElementsManifest, ot as CompilerSystemRemoveDirectoryOptions, pn as OutputTargetSsrWasm, pr as JsonDocsComponent, pt as Config, q as CompilerEventFileUpdate, qn as TranspileOptions, qt as OptimizeJsInput, r as CompilerCtx, rn as OutputTargetDistLazy, rt as CompilerSystemCreateDirectoryOptions, s as ComponentCompilerMeta, sn as OutputTargetDocsJson, st as CompilerSystemRemoveDirectoryResults, t as BuildCtx, tn as OutputTargetCopy, tt as CompilerRequestResponse, u as ComponentCompilerState, un as OutputTargetGlobalStyle, ut as CompilerSystemRenamedPath, vn as PageReloadStrategy, vr as JsonDocsMethod, vt as Credentials, w as BuildEvents, wn as PrerenderConfig, wr as JsonDocsTag, wt as Diagnostic, x as WorkerMsgHandler, xn as Plugin, xr as JsonDocsProp, xt as DevServer, yn as ParsedPath, yr as JsonDocsMethodReturn, yt as CustomElementsExportBehavior, z as CompilerEventBuildFinish, zn as SsrDocumentOptions, zt as LogLevel } from "../index-ZTa5XM0M.mjs";
2
2
  import ts from "typescript";
3
3
  import { Plugin as Plugin$1 } from "rolldown";
4
4
  //#region src/version.d.ts
@@ -1,3 +1,3 @@
1
- import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-CUsOl_Kw.mjs";
1
+ import { A as version, C as hasStencilHydrateImport, D as parseCssOnlyComponents, E as replaceStencilHydrateImport, M as scopeCss, O as buildId, S as hasStencilGlobalsImport, T as replaceStencilGlobalsImport, _ as cmpMetaToDocsComponent, a as createPrerenderer, b as buildHydrateCss, c as createWorkerContext, d as nodeRequire, f as optimizeCss, g as generateManifest, h as generateComponentTypesFile, i as createSystem, j as versions, k as vermoji, l as createWorkerMessageHandler, m as validateHydrated, n as transpile, o as loadConfig, p as validateConfig, r as transpileSync, s as createCompiler, t as ts, u as optimizeJs, v as getScopeId, w as replaceStencilCssComponentsImport, x as hasStencilCssComponentsImport, y as foldBuildFlags } from "../compiler-CShHxskG.mjs";
2
2
  import { a as LOG_LEVELS, i as CustomElementsExportBehaviorOptions } from "../node-Bz2SOK7_.mjs";
3
3
  export { CustomElementsExportBehaviorOptions, LOG_LEVELS, buildHydrateCss, buildId, cmpMetaToDocsComponent, createCompiler, createPrerenderer, createSystem, createWorkerContext, createWorkerMessageHandler, foldBuildFlags, generateComponentTypesFile, generateManifest, getScopeId, hasStencilCssComponentsImport, hasStencilGlobalsImport, hasStencilHydrateImport, loadConfig, nodeRequire, optimizeCss, optimizeJs, parseCssOnlyComponents, replaceStencilCssComponentsImport, replaceStencilGlobalsImport, replaceStencilHydrateImport, scopeCss, transpile, transpileSync, ts, validateConfig, validateHydrated, vermoji, version, versions };
@@ -1,4 +1,4 @@
1
- import { $i as CUSTOM, $r as filterActiveTargets, Ai as buildWarn, Ar as ModeValidationError, Bi as loadTypeScriptDiagnostics, Br as isJsFile, Ca as TYPES, Ci as isOutputTargetWww, Da as XLINK_NS, Di as TASK_CANCELED_MSG, Ea as WWW, Ei as shouldExcludeComponent, Fi as escapeHtml, Fr as createJsVarName, Gi as formatLazyBundleRuntimeMeta, Gr as readOnlyArrayHasStringMember, Hi as isRolldownError, Hr as isTsFile, Ii as normalizeDiagnostics, Ir as generatePreamble, Ji as CMP_FLAGS, Jr as getSourceMappingUrlForEndOfFile, Ki as stringifyRuntimeData, Kr as readPackageJson, Li as splitLineBreaks, Lr as getTextDocs, Mi as hasError, Mr as validateComponentTag, Ni as hasWarning, Nr as ParsePackageJsonResult, Oi as buildError, Pi as shouldIgnoreError, Pr as addDocBlock, Qi as COPY, Qr as FilterComponentsResult, Ri as augmentDiagnosticWithNode, Rr as hasDependency, Sa as SVG_NS, Si as isOutputTargetTypes, Ta as WATCH_FLAGS, Ti as relativeImport, Ui as loadRolldownDiagnostics, Ur as isTsxFile, Vi as createOnWarnFn, Vr as isJsxFile, Wi as formatComponentRuntimeMeta, Wr as parsePackageJson, Xi as COLLECTION_APP_DATA_FILE_NAME, Xr as rolldownToStencilSourceMap, Yi as COLLECTION, Yr as getSourceMappingUrlLinker, Zi as COLLECTION_MANIFEST_FILE_NAME, Zr as result_d_exports, _a as SSR, _i as isOutputTargetLoaderBundle, aa as DOCS_JSON, ai as isOutputTargetCollection, ba as STATS, bi as isOutputTargetStandalone, ca as EVENT_FLAGS, ci as isOutputTargetDistLazy, da as HOST_FLAGS, di as isOutputTargetDocsCustom, ea as DEFAULT_STYLE_MODE, ei as filterExcludedComponents, fa as HTML_NS, fi as isOutputTargetDocsCustomElementsManifest, ga as NODE_TYPES, gi as isOutputTargetGlobalStyle, ha as MEMBER_FLAGS, hi as isOutputTargetDocsVscode, ia as DOCS_CUSTOM_ELEMENTS_MANIFEST, ii as isOutputTargetAssets, ji as catchError, jr as validateComponentModes, ki as buildJsonFileError, la as GENERATED_DTS, li as isOutputTargetDocs, ma as LOADER_BUNDLE, mi as isOutputTargetDocsReadme, na as DOCS_AGENT_SKILL, ni as getComponentsDtsTypesFilePath, oa as DOCS_README, oi as isOutputTargetCopy, pa as LISTENER_FLAGS, pi as isOutputTargetDocsJson, qi as ASSETS, qr as getInlineSourceMappingUrlLinker, ra as DOCS_CUSTOM, ri as getComponentsFromModules, sa as DOCS_VSCODE, si as isOutputTargetCustom, ta as DIST_LAZY, ti as getComponentsDtsSrcFilePath, ua as GLOBAL_STYLE, ui as isOutputTargetDocsAgentSkill, va as SSR_WASM, vi as isOutputTargetSsr, wa as VALID_CONFIG_OUTPUT_TARGETS, wi as isValidConfigOutputTarget, xa as STYLE_EXT, xi as isOutputTargetStats, ya as STANDALONE, yi as isOutputTargetSsrWasm, zi as loadTypeScriptDiagnostic, zr as isDtsFile } from "../../index-B9-Byy8z.mjs";
1
+ import { $i as CUSTOM, $r as filterActiveTargets, Ai as buildWarn, Ar as ModeValidationError, Bi as loadTypeScriptDiagnostics, Br as isJsFile, Ca as TYPES, Ci as isOutputTargetWww, Da as XLINK_NS, Di as TASK_CANCELED_MSG, Ea as WWW, Ei as shouldExcludeComponent, Fi as escapeHtml, Fr as createJsVarName, Gi as formatLazyBundleRuntimeMeta, Gr as readOnlyArrayHasStringMember, Hi as isRolldownError, Hr as isTsFile, Ii as normalizeDiagnostics, Ir as generatePreamble, Ji as CMP_FLAGS, Jr as getSourceMappingUrlForEndOfFile, Ki as stringifyRuntimeData, Kr as readPackageJson, Li as splitLineBreaks, Lr as getTextDocs, Mi as hasError, Mr as validateComponentTag, Ni as hasWarning, Nr as ParsePackageJsonResult, Oi as buildError, Pi as shouldIgnoreError, Pr as addDocBlock, Qi as COPY, Qr as FilterComponentsResult, Ri as augmentDiagnosticWithNode, Rr as hasDependency, Sa as SVG_NS, Si as isOutputTargetTypes, Ta as WATCH_FLAGS, Ti as relativeImport, Ui as loadRolldownDiagnostics, Ur as isTsxFile, Vi as createOnWarnFn, Vr as isJsxFile, Wi as formatComponentRuntimeMeta, Wr as parsePackageJson, Xi as COLLECTION_APP_DATA_FILE_NAME, Xr as rolldownToStencilSourceMap, Yi as COLLECTION, Yr as getSourceMappingUrlLinker, Zi as COLLECTION_MANIFEST_FILE_NAME, Zr as result_d_exports, _a as SSR, _i as isOutputTargetLoaderBundle, aa as DOCS_JSON, ai as isOutputTargetCollection, ba as STATS, bi as isOutputTargetStandalone, ca as EVENT_FLAGS, ci as isOutputTargetDistLazy, da as HOST_FLAGS, di as isOutputTargetDocsCustom, ea as DEFAULT_STYLE_MODE, ei as filterExcludedComponents, fa as HTML_NS, fi as isOutputTargetDocsCustomElementsManifest, ga as NODE_TYPES, gi as isOutputTargetGlobalStyle, ha as MEMBER_FLAGS, hi as isOutputTargetDocsVscode, ia as DOCS_CUSTOM_ELEMENTS_MANIFEST, ii as isOutputTargetAssets, ji as catchError, jr as validateComponentModes, ki as buildJsonFileError, la as GENERATED_DTS, li as isOutputTargetDocs, ma as LOADER_BUNDLE, mi as isOutputTargetDocsReadme, na as DOCS_AGENT_SKILL, ni as getComponentsDtsTypesFilePath, oa as DOCS_README, oi as isOutputTargetCopy, pa as LISTENER_FLAGS, pi as isOutputTargetDocsJson, qi as ASSETS, qr as getInlineSourceMappingUrlLinker, ra as DOCS_CUSTOM, ri as getComponentsFromModules, sa as DOCS_VSCODE, si as isOutputTargetCustom, ta as DIST_LAZY, ti as getComponentsDtsSrcFilePath, ua as GLOBAL_STYLE, ui as isOutputTargetDocsAgentSkill, va as SSR_WASM, vi as isOutputTargetSsr, wa as VALID_CONFIG_OUTPUT_TARGETS, wi as isValidConfigOutputTarget, xa as STYLE_EXT, xi as isOutputTargetStats, ya as STANDALONE, yi as isOutputTargetSsrWasm, zi as loadTypeScriptDiagnostic, zr as isDtsFile } from "../../index-ZTa5XM0M.mjs";
2
2
  //#region src/utils/byte-size.d.ts
3
3
  /**
4
4
  * Used to learn the size of a string in bytes.
@@ -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.20";
465
- const buildId = "1791812865";
466
- const vermoji = "🚕";
464
+ const version = "5.0.0-beta.22";
465
+ const buildId = "1791847427";
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.
@@ -5179,6 +5179,86 @@ const getScopeId = (tagName, mode) => {
5179
5179
  return "sc-" + tagName + (mode && mode !== "$" ? "-" + mode : "");
5180
5180
  };
5181
5181
  //#endregion
5182
+ //#region src/compiler/style/transform-stylesheet.ts
5183
+ /**
5184
+ * Run a stylesheet through the plugin (e.g. Sass) and CSS-to-ESM transforms, memoized in
5185
+ * `compilerCtx.cssTransformCache` so every consumer of the same stylesheet shares one computation.
5186
+ *
5187
+ * @param config a user-supplied configuration
5188
+ * @param compilerCtx the current compiler context
5189
+ * @param buildCtx the current build context
5190
+ * @param id the stylesheet's path, annotated with its import data as query params - the cache key
5191
+ * @param data the import data serialized into `id`
5192
+ * @returns the cache entry, or `null` if the stylesheet could not be read
5193
+ */
5194
+ const transformStylesheet = async (config, compilerCtx, buildCtx, id, data) => {
5195
+ if (compilerCtx.cssTransformCache.has(id)) return compilerCtx.cssTransformCache.get(id) ?? null;
5196
+ if (!compilerCtx.worker) return null;
5197
+ const filePath = normalizeFsPath(id);
5198
+ const code = await compilerCtx.fs.readFile(filePath);
5199
+ if (typeof code !== "string") {
5200
+ compilerCtx.cssTransformCache.set(id, null);
5201
+ return null;
5202
+ }
5203
+ const pluginTransforms = await runPluginTransformsEsmImports(config, compilerCtx, buildCtx, code, filePath);
5204
+ const cssInput = data.tag ? pluginTransforms.code : inlineRelativeCssUrlAssets(pluginTransforms.code, filePath);
5205
+ const cssTransformOutput = await compilerCtx.worker.transformCssToEsm({
5206
+ file: pluginTransforms.id,
5207
+ input: cssInput,
5208
+ tag: data.tag,
5209
+ tags: buildCtx.components.map((c) => c.tagName),
5210
+ addTagTransformers: !!buildCtx.config.compat.additionalTagTransformers,
5211
+ encapsulation: data.encapsulation,
5212
+ mode: data.mode,
5213
+ sourceMap: config.sourceMap,
5214
+ minify: config.minifyCss,
5215
+ autoprefixer: config.autoprefixCss,
5216
+ docs: config.outputTargets.some(isOutputTargetDocs)
5217
+ });
5218
+ const entry = {
5219
+ pluginTransformId: pluginTransforms.id,
5220
+ pluginTransformCode: pluginTransforms.code,
5221
+ pluginTransformDependencies: pluginTransforms.dependencies,
5222
+ pluginTransformDiagnostics: pluginTransforms.diagnostics,
5223
+ cssTransformOutput
5224
+ };
5225
+ compilerCtx.cssTransformCache.set(id, entry);
5226
+ return entry;
5227
+ };
5228
+ /**
5229
+ * 3rd-party stylesheets with relative `url(./font.ttf)` (font-face `src`, a background-image, ...)
5230
+ * have nowhere to resolve that path once this CSS is self-injected as a CSSStyleSheet:
5231
+ * there's no bundler output location for it to be relative *to*.
5232
+ * Inlining the referenced file as a `data:` URI sidesteps needing one - no separate asset
5233
+ * to serve, works the same regardless of how/where the final bundle is deployed.
5234
+ */
5235
+ const CSS_URL_RE = /url\(\s*(['"]?)([^'"()]+)\1\s*\)/g;
5236
+ const CSS_URL_ASSET_MIME_TYPES = {
5237
+ ttf: "font/ttf",
5238
+ otf: "font/otf",
5239
+ woff: "font/woff",
5240
+ woff2: "font/woff2",
5241
+ eot: "application/vnd.ms-fontobject",
5242
+ png: "image/png",
5243
+ jpg: "image/jpeg",
5244
+ jpeg: "image/jpeg",
5245
+ gif: "image/gif",
5246
+ svg: "image/svg+xml"
5247
+ };
5248
+ const inlineRelativeCssUrlAssets = (cssText, cssFilePath) => cssText.replace(CSS_URL_RE, (original, _quote, url) => {
5249
+ if (/^(data:|[a-z][a-z0-9+.-]*:|\/\/|\/)/i.test(url)) return original;
5250
+ const cleanUrl = url.split(/[?#]/)[0];
5251
+ const ext = cleanUrl.split(".").pop()?.toLowerCase();
5252
+ const mimeType = ext && CSS_URL_ASSET_MIME_TYPES[ext];
5253
+ if (!mimeType) return original;
5254
+ try {
5255
+ const assetPath = resolve(dirname(cssFilePath), cleanUrl);
5256
+ return `url("data:${mimeType};base64,${readFileSync(assetPath).toString("base64")}")`;
5257
+ } catch {
5258
+ return original;
5259
+ }
5260
+ });
5261
+ //#endregion
5182
5262
  //#region src/compiler/transformers/stencil-import-path.ts
5183
5263
  /**
5184
5264
  * Serialize data about a style import to an annotated path, where
@@ -5298,35 +5378,7 @@ const extTransformsPlugin = (config, compilerCtx, buildCtx) => {
5298
5378
  if (data != null) {
5299
5379
  const filePath = normalizeFsPath(id);
5300
5380
  const wasCached = compilerCtx.cssTransformCache.has(id);
5301
- if (!wasCached) {
5302
- const code = await compilerCtx.fs.readFile(filePath);
5303
- if (typeof code !== "string") compilerCtx.cssTransformCache.set(id, null);
5304
- else {
5305
- const pluginTransforms = await runPluginTransformsEsmImports(config, compilerCtx, buildCtx, code, filePath);
5306
- const cssInput = data.tag ? pluginTransforms.code : inlineRelativeCssUrlAssets(pluginTransforms.code, filePath);
5307
- const cssTransformResults = await compilerCtx.worker.transformCssToEsm({
5308
- file: pluginTransforms.id,
5309
- input: cssInput,
5310
- tag: data.tag,
5311
- tags: buildCtx.components.map((c) => c.tagName),
5312
- addTagTransformers: !!buildCtx.config.compat.additionalTagTransformers,
5313
- encapsulation: data.encapsulation,
5314
- mode: data.mode,
5315
- sourceMap: config.sourceMap,
5316
- minify: config.minifyCss,
5317
- autoprefixer: config.autoprefixCss,
5318
- docs: config.outputTargets.some(isOutputTargetDocs)
5319
- });
5320
- compilerCtx.cssTransformCache.set(id, {
5321
- pluginTransformId: pluginTransforms.id,
5322
- pluginTransformCode: pluginTransforms.code,
5323
- pluginTransformDependencies: pluginTransforms.dependencies,
5324
- pluginTransformDiagnostics: pluginTransforms.diagnostics,
5325
- cssTransformOutput: cssTransformResults
5326
- });
5327
- }
5328
- }
5329
- const cacheEntry = compilerCtx.cssTransformCache.get(id);
5381
+ const cacheEntry = await transformStylesheet(config, compilerCtx, buildCtx, id, data);
5330
5382
  if (wasCached) cacheHits++;
5331
5383
  if (cacheEntry == null) return null;
5332
5384
  /**
@@ -5401,39 +5453,6 @@ const extTransformsPlugin = (config, compilerCtx, buildCtx) => {
5401
5453
  }
5402
5454
  };
5403
5455
  };
5404
- /**
5405
- * 3rd-party stylesheets with relative `url(./font.ttf)` (font-face `src`, a background-image, ...)
5406
- * have nowhere to resolve that path once this CSS is self-injected as a CSSStyleSheet:
5407
- * there's no bundler output location for it to be relative *to*.
5408
- * Inlining the referenced file as a `data:` URI sidesteps needing one - no separate asset
5409
- * to serve, works the same regardless of how/where the final bundle is deployed.
5410
- */
5411
- const CSS_URL_RE = /url\(\s*(['"]?)([^'"()]+)\1\s*\)/g;
5412
- const CSS_URL_ASSET_MIME_TYPES = {
5413
- ttf: "font/ttf",
5414
- otf: "font/otf",
5415
- woff: "font/woff",
5416
- woff2: "font/woff2",
5417
- eot: "application/vnd.ms-fontobject",
5418
- png: "image/png",
5419
- jpg: "image/jpeg",
5420
- jpeg: "image/jpeg",
5421
- gif: "image/gif",
5422
- svg: "image/svg+xml"
5423
- };
5424
- const inlineRelativeCssUrlAssets = (cssText, cssFilePath) => cssText.replace(CSS_URL_RE, (original, _quote, url) => {
5425
- if (/^(data:|[a-z][a-z0-9+.-]*:|\/\/|\/)/i.test(url)) return original;
5426
- const cleanUrl = url.split(/[?#]/)[0];
5427
- const ext = cleanUrl.split(".").pop()?.toLowerCase();
5428
- const mimeType = ext && CSS_URL_ASSET_MIME_TYPES[ext];
5429
- if (!mimeType) return original;
5430
- try {
5431
- const assetPath = resolve(dirname(cssFilePath), cleanUrl);
5432
- return `url("data:${mimeType};base64,${readFileSync(assetPath).toString("base64")}")`;
5433
- } catch {
5434
- return original;
5435
- }
5436
- });
5437
5456
  //#endregion
5438
5457
  //#region src/compiler/bundle/file-load-plugin.ts
5439
5458
  const RESOLVE_EXTENSIONS = [
@@ -9955,6 +9974,46 @@ const componentToDeclaration = (component) => {
9955
9974
  };
9956
9975
  };
9957
9976
  //#endregion
9977
+ //#region src/compiler/docs/collect-style-docs.ts
9978
+ /**
9979
+ * Populate `styleDocs` for every component from its external stylesheets. Stylesheets a bundler
9980
+ * has already transformed are read from `compilerCtx.cssTransformCache`; the rest are transformed
9981
+ * here, so style docs don't depend on a bundling output target having run.
9982
+ *
9983
+ * @param config the configuration associated with the current Stencil task run
9984
+ * @param compilerCtx the current compiler context
9985
+ * @param buildCtx the build context for the current Stencil task run
9986
+ */
9987
+ const collectStyleDocs = async (config, compilerCtx, buildCtx) => {
9988
+ const cached = /* @__PURE__ */ new Map();
9989
+ for (const [id, entry] of compilerCtx.cssTransformCache) {
9990
+ const { data } = parseImportPath(id);
9991
+ if (entry && data?.tag) cached.set(cacheKey(id, data.tag, data.mode), entry);
9992
+ }
9993
+ const collect = async (cmp, mode, externalStyle) => {
9994
+ let entry = cached.get(cacheKey(externalStyle.absolutePath, cmp.tagName, mode)) ?? cached.get(cacheKey(externalStyle.originalComponentPath, cmp.tagName, mode));
9995
+ if (!entry) {
9996
+ const data = {
9997
+ tag: cmp.tagName,
9998
+ mode,
9999
+ encapsulation: cmp.encapsulation
10000
+ };
10001
+ const id = `${externalStyle.absolutePath}?${new URLSearchParams(data)}`;
10002
+ const transformed = await transformStylesheet(config, compilerCtx, buildCtx, id, data);
10003
+ if (!transformed) return;
10004
+ entry = transformed;
10005
+ const diagnostics = [...entry.pluginTransformDiagnostics, ...entry.cssTransformOutput.diagnostics];
10006
+ buildCtx.diagnostics.push(...diagnostics);
10007
+ if (hasError(diagnostics)) compilerCtx.cssTransformCache.delete(id);
10008
+ for (const dep of entry.pluginTransformDependencies) compilerCtx.addWatchFile(dep);
10009
+ }
10010
+ cmp.styleDocs ||= [];
10011
+ mergeIntoWith(cmp.styleDocs, entry.cssTransformOutput.styleDocs, (docs) => `${docs.name},${docs.mode}`);
10012
+ };
10013
+ await Promise.all(buildCtx.components.filter((cmp) => !cmp.internal && !cmp.isCollectionDependency).flatMap((cmp) => (cmp.styles ?? []).flatMap((style) => (style.externalStyles ?? []).map((externalStyle) => collect(cmp, style.modeName, externalStyle)))));
10014
+ };
10015
+ const cacheKey = (path, tag, mode) => `${normalizeFsPath(path)}\n${tag}\n${mode}`;
10016
+ //#endregion
9958
10017
  //#region src/compiler/docs/custom/index.ts
9959
10018
  const generateCustomDocs = async (config, docsData, outputTargets) => {
9960
10019
  const customOutputTargets = outputTargets.filter(isOutputTargetDocsCustom);
@@ -10247,48 +10306,6 @@ const getDefaultReadme = (docsData) => {
10247
10306
  ""
10248
10307
  ].join("\n");
10249
10308
  };
10250
- /**
10251
- * Extract the existing CSS Custom Properties section from a README file.
10252
- * This is used to preserve CSS props documentation when running `stencil docs`
10253
- * without building styles.
10254
- *
10255
- * @param compilerCtx the current compiler context
10256
- * @param readmePath the path to the README file to read
10257
- * @returns array of CSS custom properties styles, or undefined if none found
10258
- */
10259
- const extractExistingCssProps = async (compilerCtx, readmePath) => {
10260
- try {
10261
- const cssPropsSectionMatch = (await compilerCtx.fs.readFile(readmePath)).match(/## CSS Custom Properties\s*\n\s*\n([\s\S]*?)(?=\n##|\n-{4,}|$)/);
10262
- if (!cssPropsSectionMatch) return;
10263
- const cssPropsSection = cssPropsSectionMatch[1];
10264
- const styles = [];
10265
- const lines = cssPropsSection.split("\n");
10266
- let inTable = false;
10267
- for (const line of lines) {
10268
- const trimmedLine = line.trim();
10269
- if (trimmedLine.startsWith("| Name") || trimmedLine.startsWith("| ---")) {
10270
- inTable = true;
10271
- continue;
10272
- }
10273
- if (inTable && trimmedLine.startsWith("|")) {
10274
- const parts = trimmedLine.split("|").map((p) => p.trim()).filter((p) => p);
10275
- if (parts.length >= 2) {
10276
- const name = parts[0].replace(/`/g, "").trim();
10277
- const docs = parts[1].trim();
10278
- if (name.startsWith("--")) styles.push({
10279
- name,
10280
- docs,
10281
- annotation: "prop",
10282
- mode: void 0
10283
- });
10284
- }
10285
- }
10286
- }
10287
- return styles.length > 0 ? styles : void 0;
10288
- } catch {
10289
- return;
10290
- }
10291
- };
10292
10309
  //#endregion
10293
10310
  //#region src/compiler/docs/readme/index.ts
10294
10311
  const generateReadmeDocs = async (config, compilerCtx, docsData, outputTargets) => {
@@ -10405,15 +10422,8 @@ const outputDocs = async (config, compilerCtx, buildCtx) => {
10405
10422
  const docsOutputTargets = filterActiveTargets(config.outputTargets.filter((o) => isOutputTargetDocsReadme(o) || isOutputTargetDocsJson(o) || isOutputTargetDocsCustom(o) || isOutputTargetDocsVscode(o) || isOutputTargetDocsCustomElementsManifest(o) || isOutputTargetDocsAgentSkill(o)), config.devMode);
10406
10423
  if (docsOutputTargets.length === 0) return;
10407
10424
  await buildCtx.stylesPromise;
10425
+ await collectStyleDocs(config, compilerCtx, buildCtx);
10408
10426
  const docsData = await generateDocData(config, compilerCtx, buildCtx);
10409
- if (config.outputTargets.every((target) => target.type === "docs-readme" || target.type === "docs-json" || target.type === "docs-custom" || target.type === "docs-vscode" || target.type === "docs-custom-elements-manifest" || target.type === "docs-agent-skill")) await Promise.all(docsData.components.map(async (component) => {
10410
- if (component.styles.length === 0) {
10411
- const readmeDir = docsOutputTargets.find(isOutputTargetDocsReadme)?.dir || config.srcDir;
10412
- const readmePath = normalizePath(readmeDir) === normalizePath(config.srcDir) ? component.readmePath : join$2(readmeDir, component.readmePath.replace(config.srcDir, ""));
10413
- const existingCssProps = await extractExistingCssProps(compilerCtx, readmePath);
10414
- if (existingCssProps) component.styles = existingCssProps;
10415
- }
10416
- }));
10417
10427
  await Promise.all([
10418
10428
  generateReadmeDocs(config, compilerCtx, docsData, docsOutputTargets),
10419
10429
  generateJsonDocs(config, compilerCtx, docsData, docsOutputTargets),
@@ -12778,11 +12788,9 @@ const generateSsrFactory = async (config, compilerCtx, buildCtx) => {
12778
12788
  format: "cjs",
12779
12789
  esModule: false,
12780
12790
  strict: false,
12781
- intro: SSR_FACTORY_INTRO,
12782
- outro: SSR_FACTORY_OUTRO,
12783
12791
  codeSplitting: false
12784
12792
  });
12785
- if (!buildCtx.hasError && rolldownOutput != null && Array.isArray(rolldownOutput.output)) return rolldownOutput.output[0].code;
12793
+ if (!buildCtx.hasError && rolldownOutput != null && Array.isArray(rolldownOutput.output)) return SSR_FACTORY_INTRO + rolldownOutput.output[0].code + SSR_FACTORY_OUTRO;
12786
12794
  }
12787
12795
  } catch (e) {
12788
12796
  catchError(buildCtx.diagnostics, e);
@@ -18174,13 +18182,13 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
18174
18182
  hasPatchClone: false,
18175
18183
  hasPatchInsert: false
18176
18184
  };
18177
- const visitComponentChildNode = (node, ctx) => {
18178
- validateComponentMembers(node, ctx);
18185
+ if (!isCollectionDependency) validateComponentMembers(cmpNode, buildCtx);
18186
+ const visitComponentChildNode = (node) => {
18179
18187
  if (ts.isCallExpression(node)) parseCallExpression(cmp, node, typeChecker);
18180
18188
  else if (ts.isStringLiteral(node)) parseStringLiteral(cmp, node);
18181
- node.forEachChild((child) => visitComponentChildNode(child, ctx));
18189
+ node.forEachChild(visitComponentChildNode);
18182
18190
  };
18183
- visitComponentChildNode(cmpNode, buildCtx);
18191
+ visitComponentChildNode(cmpNode);
18184
18192
  parseClassMethods(classMethods, cmp);
18185
18193
  cmp.hasModernPropertyDecls = detectModernPropDeclarations(cmpNode) || doesExtend;
18186
18194
  cmp.htmlAttrNames = unique(cmp.htmlAttrNames);
@@ -18198,31 +18206,32 @@ const parseStaticComponentMeta = (compilerCtx, typeChecker, cmpNode, moduleFile,
18198
18206
  return cmpNode;
18199
18207
  };
18200
18208
  /**
18201
- * Check whether a class declaration is a Stencil component, i.e. it's
18202
- * decorated with `@Component({ tag: ... })`.
18203
- * @param classNode the class declaration to check
18204
- * @returns whether `classNode` is a Stencil component class
18209
+ * Warn about members a Stencil component class should not define.
18210
+ * @param cmpNode the component class declaration
18211
+ * @param buildCtx the current build context, used to surface diagnostics
18205
18212
  */
18206
- const isStencilComponentClass = (classNode) => {
18207
- const decorator = ts.getDecorators(classNode)?.[0];
18208
- return decorator != null && ts.isCallExpression(decorator.expression) && decorator.expression.arguments.length === 1 && ts.isObjectLiteralExpression(decorator.expression.arguments[0]) && decorator.expression.arguments[0].properties.some((prop) => ts.isPropertyAssignment(prop) && prop.name.getText() === "tag");
18209
- };
18210
- const validateComponentMembers = (node, buildCtx) => {
18211
- /**
18212
- * validate if:
18213
- */
18214
- if (ts.isGetAccessorDeclaration(node) && ts.isIdentifier(node.name) && typeof node.name.escapedText === "string" && BLACKLISTED_COMPONENT_METHODS.includes(node.name.escapedText) && node.parent && ts.isClassDeclaration(node.parent) && isStencilComponentClass(node.parent)) {
18215
- const propName = node.name.escapedText;
18216
- const componentName = node.parent.name.getText();
18217
- const err = buildWarn(buildCtx.diagnostics);
18218
- err.messageText = `The component "${componentName}" has a getter called "${propName}". This getter is reserved for use by Stencil components and should not be defined by the user.`;
18219
- augmentDiagnosticWithNode(err, node);
18220
- }
18221
- if (ts.isMethodDeclaration(node) && ts.isIdentifier(node.name) && node.name.escapedText === "componentShouldUpdate" && node.parameters.length > 1 && node.parent && ts.isClassDeclaration(node.parent) && isStencilComponentClass(node.parent)) {
18222
- const componentName = node.parent.name.getText();
18223
- const err = buildWarn(buildCtx.diagnostics);
18224
- err.messageText = `The component "${componentName}" defines "componentShouldUpdate" with ${node.parameters.length} parameters. As of Stencil v5, "componentShouldUpdate" is called once per render with a single "changes" argument (a map of prop/state names to "{ newVal, oldVal }") instead of once per prop with "(newVal, oldVal, propName)". This method will still compile, but any extra parameters will be "undefined" at runtime.`;
18225
- augmentDiagnosticWithNode(err, node);
18213
+ const validateComponentMembers = (cmpNode, buildCtx) => {
18214
+ const componentName = cmpNode.name?.text ?? "";
18215
+ for (const member of cmpNode.members) {
18216
+ if (!member.name || !ts.isIdentifier(member.name)) continue;
18217
+ const memberName = member.name.text;
18218
+ /**
18219
+ * the component has a getter called "shadowRoot"
18220
+ */
18221
+ if (ts.isGetAccessorDeclaration(member) && BLACKLISTED_COMPONENT_METHODS.includes(memberName)) {
18222
+ const err = buildWarn(buildCtx.diagnostics);
18223
+ err.messageText = `The component "${componentName}" has a getter called "${memberName}". This getter is reserved for use by Stencil components and should not be defined by the user.`;
18224
+ augmentDiagnosticWithNode(err, ts.getOriginalNode(member));
18225
+ }
18226
+ /**
18227
+ * the component defines a "componentShouldUpdate" method with more than one parameter,
18228
+ * which was the pre-v5 per-prop signature "(newVal, oldVal, propName)"
18229
+ */
18230
+ if (ts.isMethodDeclaration(member) && memberName === "componentShouldUpdate" && member.parameters.length > 1) {
18231
+ const err = buildWarn(buildCtx.diagnostics);
18232
+ err.messageText = `The component "${componentName}" defines "componentShouldUpdate" with ${member.parameters.length} parameters. As of Stencil v5, "componentShouldUpdate" is called once per render with a single "changes" argument (a map of prop/state names to "{ newVal, oldVal }") instead of once per prop with "(newVal, oldVal, propName)". This method will still compile, but any extra parameters will be "undefined" at runtime.`;
18233
+ augmentDiagnosticWithNode(err, ts.getOriginalNode(member));
18234
+ }
18226
18235
  }
18227
18236
  };
18228
18237
  const parseVirtualProps = (docs) => {
@@ -21262,7 +21271,7 @@ const validateReadmeOutputTarget = (config, outputTarget) => {
21262
21271
  if (!isAbsolute$1(outputTarget.dir)) outputTarget.dir = join$2(config.rootDir, outputTarget.dir);
21263
21272
  if (outputTarget.footer == null) outputTarget.footer = NOTE;
21264
21273
  outputTarget.strict = !!outputTarget.strict;
21265
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
21274
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
21266
21275
  return outputTarget;
21267
21276
  };
21268
21277
  const validateJsonDocsOutputTarget = (config, diagnostics, outputTarget) => {
@@ -21274,7 +21283,7 @@ const validateJsonDocsOutputTarget = (config, diagnostics, outputTarget) => {
21274
21283
  if (isString$1(outputTarget.typesFile) && !isAbsolute$1(outputTarget.typesFile)) outputTarget.typesFile = join$2(config.rootDir, outputTarget.typesFile);
21275
21284
  else if (outputTarget.typesFile !== null && outputTarget.file.endsWith(".json")) outputTarget.typesFile = outputTarget.file.replace(/\.json$/, ".d.ts");
21276
21285
  outputTarget.strict = !!outputTarget.strict;
21277
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
21286
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
21278
21287
  return outputTarget;
21279
21288
  };
21280
21289
  const validateCustomDocsOutputTarget = (config, diagnostics, outputTarget) => {
@@ -21283,7 +21292,7 @@ const validateCustomDocsOutputTarget = (config, diagnostics, outputTarget) => {
21283
21292
  err.messageText = `docs-custom outputTarget missing the "generator" function`;
21284
21293
  }
21285
21294
  outputTarget.strict = !!outputTarget.strict;
21286
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
21295
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
21287
21296
  return outputTarget;
21288
21297
  };
21289
21298
  const validateVScodeDocsOutputTarget = (config, diagnostics, outputTarget) => {
@@ -21291,21 +21300,21 @@ const validateVScodeDocsOutputTarget = (config, diagnostics, outputTarget) => {
21291
21300
  const err = buildError(diagnostics);
21292
21301
  err.messageText = `docs-vscode outputTarget missing the "file" path`;
21293
21302
  }
21294
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
21303
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
21295
21304
  return outputTarget;
21296
21305
  };
21297
21306
  const DEFAULT_AGENT_SKILL_DIR = "dist/skill";
21298
21307
  const validateAgentSkillOutputTarget = (config, outputTarget) => {
21299
21308
  outputTarget.dir = getAbsolutePath(config, outputTarget.dir || DEFAULT_AGENT_SKILL_DIR);
21300
21309
  outputTarget.name = toSkillName(outputTarget.name || config.fsNamespace);
21301
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
21310
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
21302
21311
  return outputTarget;
21303
21312
  };
21304
21313
  const validateCustomElementsManifestOutputTarget = (config, outputTarget) => {
21305
21314
  if (!isString$1(outputTarget.file)) outputTarget.file = "custom-elements.json";
21306
21315
  if (!isAbsolute$1(outputTarget.file)) outputTarget.file = join$2(config.rootDir, outputTarget.file);
21307
21316
  outputTarget.strict = !!outputTarget.strict;
21308
- if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = !config._docsFlag;
21317
+ if (!isBoolean$1(outputTarget.skipInDev)) outputTarget.skipInDev = true;
21309
21318
  return outputTarget;
21310
21319
  };
21311
21320
  //#endregion
@@ -26326,14 +26335,14 @@ const getTranspileCssConfig = (compileOpts, importData, results) => {
26326
26335
  };
26327
26336
  const getTranspileConfigOpt = (value, validValues, defaultValue) => {
26328
26337
  if (value === null || value === "null") return null;
26329
- value = isString$1(value) ? value.toLowerCase().trim() : null;
26338
+ value = isString$1(value) ? value.toLowerCase().trim() : void 0;
26330
26339
  if (validValues.has(value)) return value;
26331
26340
  return defaultValue;
26332
26341
  };
26333
26342
  const VALID_EXPORT = /* @__PURE__ */ new Set(["customelement", "module"]);
26334
- const VALID_METADATA = /* @__PURE__ */ new Set(["compilerstatic", null]);
26343
+ const VALID_METADATA = /* @__PURE__ */ new Set(["compilerstatic"]);
26335
26344
  const VALID_MODULE = /* @__PURE__ */ new Set(["cjs", "esm"]);
26336
- const VALID_PROXY = /* @__PURE__ */ new Set(["defineproperty", null]);
26345
+ const VALID_PROXY = /* @__PURE__ */ new Set(["defineproperty"]);
26337
26346
  const VALID_STYLE = /* @__PURE__ */ new Set(["static"]);
26338
26347
  const VALID_STYLE_IMPORT_DATA = /* @__PURE__ */ new Set(["queryparams"]);
26339
26348
  const VALID_TARGET = /* @__PURE__ */ new Set([
@@ -2101,11 +2101,6 @@ interface Config extends StencilConfig {
2101
2101
  tsWatchOptions?: any;
2102
2102
  _isValidated?: boolean;
2103
2103
  _isTesting?: boolean;
2104
- /**
2105
- * Internal flag set when --docs CLI flag is used.
2106
- * Forces docs output targets to build even in dev mode.
2107
- */
2108
- _docsFlag?: boolean;
2109
2104
  /**
2110
2105
  * Whether running in a CI environment (disables interactive features, adjusts worker count)
2111
2106
  */
@@ -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-B9-Byy8z.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-ZTa5XM0M.mjs";
2
2
  //#region src/client/client-build.d.ts
3
3
  declare const Build: UserBuildConditionals;
4
4
  //#endregion
@@ -2141,11 +2141,6 @@ interface Config extends StencilConfig {
2141
2141
  tsWatchOptions?: any;
2142
2142
  _isValidated?: boolean;
2143
2143
  _isTesting?: boolean;
2144
- /**
2145
- * Internal flag set when --docs CLI flag is used.
2146
- * Forces docs output targets to build even in dev mode.
2147
- */
2148
- _docsFlag?: boolean;
2149
2144
  /**
2150
2145
  * Whether running in a CI environment (disables interactive features, adjusts worker count)
2151
2146
  */
@@ -103,35 +103,6 @@ const BUILD = {
103
103
  asyncQueue: false
104
104
  };
105
105
  BUILD.isDev, BUILD.isTesting;
106
- const MEMBER_FLAGS = {
107
- String: 1,
108
- Number: 2,
109
- Boolean: 4,
110
- Any: 8,
111
- Unknown: 16,
112
- State: 32,
113
- Method: 64,
114
- Event: 128,
115
- Element: 256,
116
- ReflectAttr: 512,
117
- Mutable: 1024,
118
- Getter: 2048,
119
- Setter: 4096,
120
- Prop: 31,
121
- HasAttribute: 31,
122
- PropLike: 63
123
- };
124
- //#endregion
125
- //#region src/client/client-host-ref.ts
126
- /**
127
- * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
128
- *
129
- * @param ref the runtime ref of interest
130
- * @returns the Host reference (if found) or undefined
131
- */
132
- const getHostRef = (ref) => {
133
- if (ref.__s_ghr) return ref.__s_ghr();
134
- };
135
106
  //#endregion
136
107
  //#region src/client/client-log.ts
137
108
  const STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : ["%cstencil", "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"];
@@ -173,13 +144,12 @@ BUILD.lazyLoad || globalThis.HTMLElement;
173
144
  * @returns the `ReadonlySignal` for the prop, or `null` if not found / not signal-backed
174
145
  */
175
146
  const getSignal = (elm, prop) => {
176
- const hostRef = getHostRef(elm);
177
- if (!hostRef?.$signalValues$) {
147
+ const signals = elm[STENCIL_SIGNALS_SYMBOL];
148
+ if (!signals) {
178
149
  if (BUILD.isDev) consoleDevWarn(`getSignal('${prop}'): element <${elm.tagName.toLowerCase()}> is not signal-backed. Ensure signalBacking is true in stencil.config.ts.`);
179
150
  return null;
180
151
  }
181
- if (!((hostRef.$cmpMeta$?.$members$?.[prop]?.[0] ?? 0) & MEMBER_FLAGS.Prop)) return null;
182
- return hostRef.$signalValues$.get(prop) ?? null;
152
+ return signals.get(prop) ?? null;
183
153
  };
184
154
  /**
185
155
  * Marks a class method as a reactive effect. Wraps the method in `effect()` after
@@ -1,4 +1,4 @@
1
- import { Bt as Logger, nt as CompilerSystem } from "../../index-B9-Byy8z.mjs";
1
+ import { Bt as Logger, nt as CompilerSystem } from "../../index-ZTa5XM0M.mjs";
2
2
  //#region src/sys/node/logger/index.d.ts
3
3
  /**
4
4
  * Create a logger to run in a Node environment
@@ -1,4 +1,4 @@
1
- import { l as createWorkerMessageHandler } from "../../compiler-CUsOl_Kw.mjs";
1
+ import { l as createWorkerMessageHandler } from "../../compiler-CShHxskG.mjs";
2
2
  import { t as createNodeSys } from "../../node-Bz2SOK7_.mjs";
3
3
  //#region src/sys/node/node-worker-thread.ts
4
4
  /**
@@ -1276,11 +1276,6 @@ interface Config extends StencilConfig {
1276
1276
  tsWatchOptions?: any;
1277
1277
  _isValidated?: boolean;
1278
1278
  _isTesting?: boolean;
1279
- /**
1280
- * Internal flag set when --docs CLI flag is used.
1281
- * Forces docs output targets to build even in dev mode.
1282
- */
1283
- _docsFlag?: boolean;
1284
1279
  /**
1285
1280
  * Whether running in a CI environment (disables interactive features, adjusts worker count)
1286
1281
  */
@@ -33,7 +33,7 @@ import "@rollup/pluginutils";
33
33
  import { createHash } from "crypto";
34
34
  import { afterAll, vi } from "vitest";
35
35
  //#region src/version.ts
36
- const version = "5.0.0-beta.20";
36
+ const version = "5.0.0-beta.22";
37
37
  const MEMBER_FLAGS = {
38
38
  String: 1,
39
39
  Number: 2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "5.0.0-beta.20",
3
+ "version": "5.0.0-beta.22",
4
4
  "description": "A Compiler for Web Components and Progressive Web Apps",
5
5
  "keywords": [
6
6
  "components",
@@ -126,9 +126,9 @@
126
126
  "terser": "^5.50.0",
127
127
  "tinyglobby": "^0.2.17",
128
128
  "typescript": ">5.0.0 <7.0.0",
129
- "@stencil/cli": "5.0.0-beta.20",
130
- "@stencil/mock-doc": "5.0.0-beta.20",
131
- "@stencil/dev-server": "5.0.0-beta.20"
129
+ "@stencil/cli": "5.0.0-beta.22",
130
+ "@stencil/dev-server": "5.0.0-beta.22",
131
+ "@stencil/mock-doc": "5.0.0-beta.22"
132
132
  },
133
133
  "devDependencies": {
134
134
  "@ionic/prettier-config": "^4.0.0",