@stencil/core 5.0.0-alpha.6 → 5.0.0-alpha.7

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,8 +1,8 @@
1
1
  import { n as __require } from "./chunk-z9aeyW2b.mjs";
2
- import { D as HYDRATED_CSS, p as scopeCss } from "./client-fWOou5EW.mjs";
3
- import { $ as WATCH_FLAGS, A as DIST_LAZY, C as ASSETS, D as COPY, E as COLLECTION_MANIFEST_FILE_NAME, I as EVENT_FLAGS, J as STATS, L as GENERATED_DTS, N as DOCS_JSON, P as DOCS_README, Q as VALID_CONFIG_OUTPUT_TARGETS, R as GLOBAL_STYLE, T as COLLECTION_APP_DATA_FILE_NAME, Y as STENCIL_REBUNDLE, Z as TYPES, _ as sortBy, a as fromEntries, b as toTitleCase, d as isNumber$1, f as isObject, h as noop, i as flatOne, l as isFunction, m as mergeIntoWith, n as dashToPascalCase, o as isBoolean$1, p as isString$1, q as STANDALONE, u as isIterable, x as unique, y as toDashCase } from "./regular-expression-DUdhF3Ei.mjs";
4
- import { $ as loadTypeScriptDiagnostics, A as isOutputTargetCollection, B as isOutputTargetGlobalStyle, Ct as formatComponentRuntimeMeta, E as getComponentsDtsSrcFilePath, Et as byteSize, F as isOutputTargetDocsCustom, G as isOutputTargetStats, H as isOutputTargetSsr, I as isOutputTargetDocsCustomElementsManifest, J as isValidConfigOutputTarget, K as isOutputTargetTypes, L as isOutputTargetDocsJson, M as isOutputTargetCustom, N as isOutputTargetDistLazy, O as getComponentsFromModules, P as isOutputTargetDocs, Q as loadTypeScriptDiagnostic, R as isOutputTargetDocsReadme, S as ok, St as isGlob, T as filterExcludedComponents, Tt as stringifyRuntimeData, U as isOutputTargetSsrWasm, V as isOutputTargetLoaderBundle, W as isOutputTargetStandalone, Y as relativeImport, Z as augmentDiagnosticWithNode, _ as getSourceMappingUrlForEndOfFile, _t as catchError, a as getTextDocs, at as relative$1, b as err, ct as isRolldownError, d as isTsxFile, dt as normalizeDiagnostics, et as join$2, f as parsePackageJson, ft as splitLineBreaks, g as getInlineSourceMappingUrlLinker, gt as buildWarn, h as isRemoteUrl, ht as buildJsonFileError, i as generatePreamble, it as normalizePath, j as isOutputTargetCopy, k as isOutputTargetAssets, lt as loadRolldownDiagnostics, m as readPackageJson, mt as buildError, n as addDocBlock, nt as normalizeFsPath, o as hasDependency, ot as resolve$2, p as readOnlyArrayHasStringMember, q as isOutputTargetWww, r as createJsVarName, rt as normalizeFsPathQuery, s as isDtsFile, st as createOnWarnFn, t as validateComponentTag, u as isTsFile, vt as hasError, w as filterActiveTargets, x as map, xt as isRootPath, y as rolldownToStencilSourceMap, yt as hasWarning, z as isOutputTargetDocsVscode } from "./validation-2QipI30K.mjs";
5
- import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-klLZLdDe.mjs";
2
+ import { D as HYDRATED_CSS, p as scopeCss } from "./client-Dd-NB5Ei.mjs";
3
+ import { $ as VALID_CONFIG_OUTPUT_TARGETS, C as ASSETS, D as COLLECTION_MANIFEST_FILE_NAME, E as COLLECTION_APP_DATA_FILE_NAME, F as DOCS_README, J as STANDALONE, L as EVENT_FLAGS, O as COPY, P as DOCS_JSON, Q as TYPES, R as GENERATED_DTS, T as COLLECTION, U as LOADER_BUNDLE, X as STYLE_EXT, Y as STATS, _ as sortBy, a as fromEntries, b as toTitleCase, d as isNumber$1, et as WATCH_FLAGS, f as isObject, h as noop, i as flatOne, j as DIST_LAZY, l as isFunction, m as mergeIntoWith, n as dashToPascalCase, o as isBoolean$1, p as isString$1, u as isIterable, x as unique, y as toDashCase, z as GLOBAL_STYLE } from "./regular-expression-CFVJOTUh.mjs";
4
+ import { $ as loadTypeScriptDiagnostics, A as isOutputTargetCollection, B as isOutputTargetGlobalStyle, Ct as formatComponentRuntimeMeta, E as getComponentsDtsSrcFilePath, Et as byteSize, F as isOutputTargetDocsCustom, G as isOutputTargetStats, H as isOutputTargetSsr, I as isOutputTargetDocsCustomElementsManifest, J as isValidConfigOutputTarget, K as isOutputTargetTypes, L as isOutputTargetDocsJson, M as isOutputTargetCustom, N as isOutputTargetDistLazy, O as getComponentsFromModules, P as isOutputTargetDocs, Q as loadTypeScriptDiagnostic, R as isOutputTargetDocsReadme, S as ok, St as isGlob, T as filterExcludedComponents, Tt as stringifyRuntimeData, U as isOutputTargetSsrWasm, V as isOutputTargetLoaderBundle, W as isOutputTargetStandalone, Y as relativeImport, Z as augmentDiagnosticWithNode, _ as getSourceMappingUrlForEndOfFile, _t as catchError, a as getTextDocs, at as relative$1, b as err, ct as isRolldownError, d as isTsxFile, dt as normalizeDiagnostics, et as join$2, f as parsePackageJson, ft as splitLineBreaks, g as getInlineSourceMappingUrlLinker, gt as buildWarn, h as isRemoteUrl, ht as buildJsonFileError, i as generatePreamble, it as normalizePath, j as isOutputTargetCopy, k as isOutputTargetAssets, lt as loadRolldownDiagnostics, m as readPackageJson, mt as buildError, n as addDocBlock, nt as normalizeFsPath, o as hasDependency, ot as resolve$2, p as readOnlyArrayHasStringMember, q as isOutputTargetWww, r as createJsVarName, rt as normalizeFsPathQuery, s as isDtsFile, st as createOnWarnFn, t as validateComponentTag, u as isTsFile, vt as hasError, w as filterActiveTargets, x as map, xt as isRootPath, y as rolldownToStencilSourceMap, yt as hasWarning, z as isOutputTargetDocsVscode } from "./validation-ByxKj8bC.mjs";
5
+ import { i as CustomElementsExportBehaviorOptions, o as buildEvents, r as createNodeLogger, t as createNodeSys } from "./node-10UamZmn.mjs";
6
6
  import ts, { default as ts$1 } from "typescript";
7
7
  import { readFileSync } from "node:fs";
8
8
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
@@ -28,8 +28,8 @@ import { createJiti } from "jiti";
28
28
  import * as process$1 from "process";
29
29
  import { dataToEsm } from "@rollup/pluginutils";
30
30
  //#region src/version.ts
31
- const version = "5.0.0-alpha.6";
32
- const buildId = "1779811269";
31
+ const version = "5.0.0-alpha.7";
32
+ const buildId = "1780784182";
33
33
  const vermoji = "❓";
34
34
  /**
35
35
  * Get the installed version of a tool/dependency.
@@ -484,7 +484,7 @@ const getModuleImports = (moduleMap, filePath, importedModules) => {
484
484
  return importedModules;
485
485
  };
486
486
  /**
487
- * Config-driven extras flags that a collection lib author may have set explicitly.
487
+ * Config-driven flags that a collection lib author may have set explicitly.
488
488
  * These are the only flags propagated from a collection's buildFlags into the consumer's
489
489
  * build - everything else is a component-derived flag that the consumer recomputes itself
490
490
  * by scanning all components (including those from the collection).
@@ -503,7 +503,7 @@ const COLLECTION_CONFIG_FLAGS = new Set([
503
503
  ]);
504
504
  /**
505
505
  * Merge config-driven build flags from consumed collections into the active build conditionals.
506
- * Only flags explicitly set via the lib author's stencil.config extras are merged - component-
506
+ * Only flags explicitly set via the lib author's stencil.config are merged - component-
507
507
  * derived flags are excluded because the consumer recomputes them from source.
508
508
  *
509
509
  * **This function mutates the build conditionals argument**
@@ -537,7 +537,7 @@ const updateBuildConditionals = (config, b) => {
537
537
  b.constructableCSS = !b.hotModuleReplacement || !!config._isTesting;
538
538
  b.asyncLoading = !!(b.asyncLoading || b.lazyLoad || b.taskQueue || b.initializeNextTick);
539
539
  b.cssAnnotations = true;
540
- const ldp = config.extras.lightDomPatches ?? true;
540
+ const ldp = config.compat.lightDomPatches ?? true;
541
541
  if (b.slotRelocation && ldp !== false) {
542
542
  b.lightDomPatches = ldp === true;
543
543
  b.slotChildNodes = ldp === true || typeof ldp === "object" && !!ldp.childNodes;
@@ -551,9 +551,9 @@ const updateBuildConditionals = (config, b) => {
551
551
  b.slotDomMutations = false;
552
552
  b.slotTextContent = false;
553
553
  }
554
- b.lifecycleDOMEvents = !!(b.isDebug || config._isTesting || config.extras.lifecycleDOMEvents);
555
- b.signalBacking = !!config.extras?.signalBacking;
556
- b.vdomSignals = b.vdomSignals || !!(config.extras?.signalBacking || config.extras?.vdomSignals);
554
+ b.lifecycleDOMEvents = !!(b.isDebug || config._isTesting || config.compat.lifecycleDOMEvents);
555
+ b.signalBacking = !!config.signalBacking;
556
+ b.vdomSignals = b.vdomSignals || !!config.signalBacking;
557
557
  b.invisiblePrehydration = typeof config.invisiblePrehydration === "undefined" ? true : config.invisiblePrehydration;
558
558
  if (config.hydratedFlag) {
559
559
  b.hydratedAttribute = config.hydratedFlag.selector === "attribute";
@@ -2111,7 +2111,7 @@ const generateAppDataModule = (build, config) => {
2111
2111
  };
2112
2112
  const serializeCollectionManifest = (config, compilerCtx, buildCtx) => {
2113
2113
  const buildFlags = getBuildFeatures(buildCtx.moduleFiles.filter((mod) => !mod.isCollectionDependency).flatMap((mod) => mod.cmps));
2114
- const ldp = config.extras?.lightDomPatches ?? true;
2114
+ const ldp = config.compat?.lightDomPatches ?? true;
2115
2115
  if (buildFlags.slotRelocation && ldp !== false) {
2116
2116
  buildFlags.lightDomPatches = ldp === true;
2117
2117
  buildFlags.slotChildNodes = ldp === true || typeof ldp === "object" && !!ldp.childNodes;
@@ -2125,8 +2125,8 @@ const serializeCollectionManifest = (config, compilerCtx, buildCtx) => {
2125
2125
  buildFlags.slotDomMutations = false;
2126
2126
  buildFlags.slotTextContent = false;
2127
2127
  }
2128
- buildFlags.lifecycleDOMEvents = !!config.extras?.lifecycleDOMEvents;
2129
- buildFlags.initializeNextTick = !!config.extras?.initializeNextTick;
2128
+ buildFlags.lifecycleDOMEvents = !!config.compat?.lifecycleDOMEvents;
2129
+ buildFlags.initializeNextTick = !!config.compat?.initializeNextTick;
2130
2130
  buildFlags.asyncQueue = config.taskQueue === "congestionAsync";
2131
2131
  if (config.hydratedFlag) {
2132
2132
  buildFlags.hydratedAttribute = config.hydratedFlag.selector === "attribute";
@@ -3734,7 +3734,7 @@ const extTransformsPlugin = (config, compilerCtx, buildCtx) => {
3734
3734
  input: pluginTransforms.code,
3735
3735
  tag: data.tag,
3736
3736
  tags: buildCtx.components.map((c) => c.tagName),
3737
- addTagTransformers: !!buildCtx.config.extras.additionalTagTransformers,
3737
+ addTagTransformers: !!buildCtx.config.compat.additionalTagTransformers,
3738
3738
  encapsulation: data.encapsulation,
3739
3739
  mode: data.mode,
3740
3740
  sourceMap: config.sourceMap,
@@ -5529,7 +5529,7 @@ const getSingleStyle = (cmp, style, buildCtx) => {
5529
5529
  return null;
5530
5530
  };
5531
5531
  const addTagTransform$1 = (cssCode, buildCtx) => {
5532
- if (!buildCtx.config.extras.additionalTagTransformers) return ts.factory.createNoSubstitutionTemplateLiteral(cssCode);
5532
+ if (!buildCtx.config.compat.additionalTagTransformers) return ts.factory.createNoSubstitutionTemplateLiteral(cssCode);
5533
5533
  return addTagTransformToCssTsAST(cssCode, buildCtx.components.map((c) => c.tagName));
5534
5534
  };
5535
5535
  const createStyleLiteral$1 = (cmp, style, buildCtx) => {
@@ -6007,7 +6007,7 @@ const generateLazyModules = async (config, compilerCtx, buildCtx, outputTargetTy
6007
6007
  const bundleModules = await Promise.all(entryComponentsResults.map((rolldownResult) => {
6008
6008
  return generateLazyEntryModule(config, compilerCtx, buildCtx, rolldownResult, outputTargetType, destinations, sourceTarget, shouldMinify, isBrowserBuild);
6009
6009
  }));
6010
- if (config.extras.enableImportInjection && !isBrowserBuild) addStaticImports(rolldownResults, bundleModules);
6010
+ if (config.compat.enableImportInjection && !isBrowserBuild) addStaticImports(rolldownResults, bundleModules);
6011
6011
  else if (isBrowserBuild) rolldownResults.filter(isStencilCoreResult).forEach((chunk) => {
6012
6012
  chunk.code = chunk.code.replace("/*!__STENCIL_STATIC_IMPORT_SWITCH__*/", "");
6013
6013
  });
@@ -6310,7 +6310,7 @@ const generateCjs = async (config, compilerCtx, buildCtx, rolldownBuild, outputT
6310
6310
  sourcemap: config.sourceMap,
6311
6311
  plugins: [lazyBundleIdPlugin(buildCtx, config, false, 8, ".cjs")]
6312
6312
  };
6313
- if (config.extras.enableImportInjection) esmOpts.dynamicImportInCjs = false;
6313
+ if (config.compat.enableImportInjection) esmOpts.dynamicImportInCjs = false;
6314
6314
  const results = await generateRolldownOutput(rolldownBuild, esmOpts, config, buildCtx.entryModules);
6315
6315
  if (results != null) {
6316
6316
  buildCtx.commonJsComponentBundle = await generateLazyModules(config, compilerCtx, buildCtx, outputTargetType, cjsOutputs.map((o) => o.cjsDir).filter((cjsDir) => typeof cjsDir === "string"), results, "es2017", false);
@@ -6444,7 +6444,7 @@ const getLazyBuildConditionals = (config, cmps, staticHydrationStyles = false) =
6444
6444
  build.hydrateServerSide = false;
6445
6445
  build.asyncQueue = config.taskQueue === "congestionAsync";
6446
6446
  build.taskQueue = config.taskQueue !== "immediate";
6447
- build.initializeNextTick = config.extras.initializeNextTick;
6447
+ build.initializeNextTick = config.compat.initializeNextTick;
6448
6448
  build.staticHydrationStyles = staticHydrationStyles;
6449
6449
  build.hydrateClientSide = config.outputTargets.some(isOutputTargetSsr);
6450
6450
  updateBuildConditionals(config, build);
@@ -6556,7 +6556,7 @@ const getCustomBeforeTransformers$2 = (config, compilerCtx, buildCtx) => {
6556
6556
  };
6557
6557
  const customBeforeTransformers = [updateStencilCoreImports(transformOpts.coreImportPath)];
6558
6558
  if (config.transformAliasedImportPaths) customBeforeTransformers.push(rewriteAliasedSourceFileImportPaths);
6559
- if (buildCtx.config.extras.additionalTagTransformers) customBeforeTransformers.push(addTagTransform$2(compilerCtx, buildCtx));
6559
+ if (buildCtx.config.compat.additionalTagTransformers) customBeforeTransformers.push(addTagTransform$2(compilerCtx, buildCtx));
6560
6560
  customBeforeTransformers.push(lazyComponentTransform(compilerCtx, transformOpts, buildCtx), removeCollectionImports(compilerCtx));
6561
6561
  return customBeforeTransformers;
6562
6562
  };
@@ -6757,7 +6757,7 @@ var BuildContext = class {
6757
6757
  isRebuild = false;
6758
6758
  moduleFiles = [];
6759
6759
  outputs = [];
6760
- packageJson = {};
6760
+ packageJson = null;
6761
6761
  packageJsonFilePath = null;
6762
6762
  pendingCopyTasks = [];
6763
6763
  requiresFullBuild = true;
@@ -7962,19 +7962,88 @@ const generateReadme = async (config, compilerCtx, readmeOutputs, docsData, cmps
7962
7962
  if (readmeOutput.dir) {
7963
7963
  const relativeReadmePath = relative$1(config.srcDir, docsData.readmePath);
7964
7964
  const readmeOutputPath = join$2(readmeOutput.dir, relativeReadmePath);
7965
- const readmeContent = generateMarkdown(readmeOutput.overwriteExisting === true ? userContent : normalizePath(readmeOutput.dir) !== normalizePath(config.srcDir) ? readmeOutput.overwriteExisting === "if-missing" && await compilerCtx.fs.access(readmeOutputPath) || (readmeOutput.overwriteExisting ?? false) === false ? await getUserReadmeContent(compilerCtx, readmeOutputPath) : userContent : userContent, docsData, cmps, readmeOutput, config);
7966
- if ((await compilerCtx.fs.writeFile(readmeOutputPath, readmeContent)).changedContent) if (isUpdate) config.logger.info(`updated readme docs: ${docsData.tag}`);
7965
+ const readmeContent = generateMarkdown(await resolveUserContent(compilerCtx, readmeOutput, readmeOutputPath, config, userContent), docsData, cmps, readmeOutput, config);
7966
+ if ((await compilerCtx.fs.readFile(readmeOutputPath))?.replace(/\r/g, "") === readmeContent.replace(/\r/g, "")) return;
7967
+ await compilerCtx.fs.writeFile(readmeOutputPath, readmeContent);
7968
+ if (isUpdate) config.logger.info(`updated readme docs: ${docsData.tag}`);
7967
7969
  else config.logger.info(`created readme docs: ${docsData.tag}`);
7968
7970
  }
7969
7971
  }));
7970
7972
  };
7973
+ /**
7974
+ * Generate a single README for multiple components that share a directory and
7975
+ * therefore share a single readme.md file.
7976
+ *
7977
+ * Each component gets an '## `tag`' section; existing section headings are
7978
+ * shifted from h2 to h3 so they nest correctly under that heading.
7979
+ *
7980
+ * @param config a validated Stencil config
7981
+ * @param compilerCtx the current compiler context
7982
+ * @param readmeOutputs docs-readme output targets
7983
+ * @param cmps the components to include in the README (typically components that share a directory)
7984
+ * @param allCmps metadata for all the components in the project, used to generate dependency lists
7985
+ */
7986
+ const generateMergedReadme = async (config, compilerCtx, readmeOutputs, cmps, allCmps) => {
7987
+ const primaryCmp = cmps[0];
7988
+ const isUpdate = !!primaryCmp.readme;
7989
+ const userContent = isUpdate ? primaryCmp.readme : getDefaultReadme(primaryCmp);
7990
+ await Promise.all(readmeOutputs.map(async (readmeOutput) => {
7991
+ if (readmeOutput.dir) {
7992
+ const relativeReadmePath = relative$1(config.srcDir, primaryCmp.readmePath);
7993
+ const readmeOutputPath = join$2(readmeOutput.dir, relativeReadmePath);
7994
+ const readmeContent = generateMergedMarkdown(await resolveUserContent(compilerCtx, readmeOutput, readmeOutputPath, config, userContent), cmps, allCmps, readmeOutput, config);
7995
+ if ((await compilerCtx.fs.readFile(readmeOutputPath))?.replace(/\r/g, "") === readmeContent.replace(/\r/g, "")) return;
7996
+ await compilerCtx.fs.writeFile(readmeOutputPath, readmeContent);
7997
+ const tags = cmps.map((c) => c.tag).join(", ");
7998
+ if (isUpdate) config.logger.info(`updated readme docs: ${tags}`);
7999
+ else config.logger.info(`created readme docs: ${tags}`);
8000
+ }
8001
+ }));
8002
+ };
7971
8003
  const generateMarkdown = (userContent, cmp, cmps, readmeOutput, config) => {
7972
- const dependencies = readmeOutput.dependencies !== false ? depsToMarkdown(cmp, cmps, config) : [];
7973
8004
  return [
7974
8005
  userContent || "",
7975
8006
  AUTO_GENERATE_COMMENT,
7976
8007
  "",
7977
8008
  "",
8009
+ ...generateComponentBody(cmp, cmps, readmeOutput, config),
8010
+ `----------------------------------------------`,
8011
+ "",
8012
+ readmeOutput.footer,
8013
+ ""
8014
+ ].join("\n");
8015
+ };
8016
+ const generateMergedMarkdown = (userContent, cmps, allCmps, readmeOutput, config) => {
8017
+ const sections = [];
8018
+ for (const cmp of cmps) {
8019
+ const body = generateComponentBody(cmp, allCmps, readmeOutput, config);
8020
+ if (body.length === 0) continue;
8021
+ const shiftedBody = body.map((line) => line.replace(/^## /, "### "));
8022
+ sections.push(`## \`${cmp.tag}\``, "", ...shiftedBody, "");
8023
+ }
8024
+ return [
8025
+ userContent || "",
8026
+ AUTO_GENERATE_COMMENT,
8027
+ "",
8028
+ "",
8029
+ ...sections,
8030
+ `----------------------------------------------`,
8031
+ "",
8032
+ readmeOutput.footer,
8033
+ ""
8034
+ ].join("\n");
8035
+ };
8036
+ /**
8037
+ * Returns the auto-generated lines for a single component (no header/footer).
8038
+ * @param cmp the component documentation data
8039
+ * @param cmps all components documentation data
8040
+ * @param readmeOutput the readme output target config
8041
+ * @param config the Stencil config
8042
+ * @returns an array of strings representing the auto-generated lines for the component
8043
+ */
8044
+ const generateComponentBody = (cmp, cmps, readmeOutput, config) => {
8045
+ const dependencies = readmeOutput.dependencies !== false ? depsToMarkdown(cmp, cmps, config) : [];
8046
+ return [
7978
8047
  ...getDocsDeprecation(cmp),
7979
8048
  ...overviewToMarkdown(cmp.overview),
7980
8049
  ...usageToMarkdown(cmp.usage),
@@ -7985,12 +8054,26 @@ const generateMarkdown = (userContent, cmp, cmps, readmeOutput, config) => {
7985
8054
  ...partsToMarkdown(cmp.parts),
7986
8055
  ...customStatesToMarkdown(cmp.customStates),
7987
8056
  ...stylesToMarkdown(cmp.styles),
7988
- ...dependencies,
7989
- `----------------------------------------------`,
7990
- "",
7991
- readmeOutput.footer,
7992
- ""
7993
- ].join("\n");
8057
+ ...dependencies
8058
+ ];
8059
+ };
8060
+ /**
8061
+ * Resolves the user-written content (above AUTO_GENERATE_COMMENT) to use when
8062
+ * generating a readme, respecting the `overwriteExisting` option and whether
8063
+ * the output dir differs from the source dir.
8064
+ * @param compilerCtx the current compiler context
8065
+ * @param readmeOutput the readme output target config
8066
+ * @param readmeOutputPath the full path to the output readme file
8067
+ * @param config the Stencil config
8068
+ * @param userContent the content located above AUTO_GENERATE_COMMENT in the existing readme, or a default template if no existing readme
8069
+ * @returns the content to use as the "user content" (content above AUTO_GENERATE_COMMENT) for the new readme
8070
+ */
8071
+ const resolveUserContent = async (compilerCtx, readmeOutput, readmeOutputPath, config, userContent) => {
8072
+ if (readmeOutput.overwriteExisting === true) return userContent;
8073
+ if (normalizePath(readmeOutput.dir) !== normalizePath(config.srcDir)) {
8074
+ if (readmeOutput.overwriteExisting === "if-missing" && await compilerCtx.fs.access(readmeOutputPath) || (readmeOutput.overwriteExisting ?? false) === false) return getUserReadmeContent(compilerCtx, readmeOutputPath);
8075
+ }
8076
+ return userContent;
7994
8077
  };
7995
8078
  const getDocsDeprecation = (cmp) => {
7996
8079
  if (cmp.deprecation !== void 0) return [`> **[DEPRECATED]** ${cmp.deprecation}`, ""];
@@ -8058,9 +8141,13 @@ const generateReadmeDocs = async (config, compilerCtx, docsData, outputTargets)
8058
8141
  const readmeOutputTargets = outputTargets.filter(isOutputTargetDocsReadme);
8059
8142
  if (readmeOutputTargets.length === 0) return;
8060
8143
  if (readmeOutputTargets.some((o) => o.strict)) strictCheckDocs(config, docsData);
8061
- await Promise.all(docsData.components.map((cmpData) => {
8062
- return generateReadme(config, compilerCtx, readmeOutputTargets, cmpData, docsData.components);
8063
- }));
8144
+ const byReadmePath = /* @__PURE__ */ new Map();
8145
+ for (const cmpData of docsData.components) {
8146
+ const group = byReadmePath.get(cmpData.readmePath);
8147
+ if (group) group.push(cmpData);
8148
+ else byReadmePath.set(cmpData.readmePath, [cmpData]);
8149
+ }
8150
+ await Promise.all(Array.from(byReadmePath.values()).map((group) => group.length === 1 ? generateReadme(config, compilerCtx, readmeOutputTargets, group[0], docsData.components) : generateMergedReadme(config, compilerCtx, readmeOutputTargets, group, docsData.components)));
8064
8151
  };
8065
8152
  const strictCheckDocs = (config, docsData) => {
8066
8153
  docsData.components.forEach((component) => {
@@ -8209,7 +8296,7 @@ const outputGlobalStyle = async (config, compilerCtx, buildCtx) => {
8209
8296
  if (!css) return;
8210
8297
  const writePromises = [];
8211
8298
  const primaryPath = join$2(outputTarget.dir, outputTarget.fileName);
8212
- writePromises.push(compilerCtx.fs.writeFile(primaryPath, css));
8299
+ writePromises.push(compilerCtx.fs.writeFile(primaryPath, css, { outputTargetType: outputTarget.type }));
8213
8300
  if (outputTarget.copyToLoaderBrowser && loaderBundleTargets.length > 0) for (const loaderTarget of loaderBundleTargets) {
8214
8301
  const compatPath = join$2(join$2(loaderTarget.buildDir, namespace), outputTarget.fileName);
8215
8302
  writePromises.push(compilerCtx.fs.writeFile(compatPath, css));
@@ -9117,11 +9204,11 @@ const generateComponentTypesFile = (config, buildCtx, areTypesInternal) => {
9117
9204
  * Only generate event detail types for components that have events.
9118
9205
  */
9119
9206
  componentEventDetailTypes.push(generateEventDetailTypes(cmp));
9120
- return generateComponentTypes(cmp, typeImportData, areTypesInternal, !!config.extras?.signalBacking);
9207
+ return generateComponentTypes(cmp, typeImportData, areTypesInternal, !!config.signalBacking);
9121
9208
  });
9122
9209
  c.push(COMPONENTS_DTS_HEADER);
9123
9210
  c.push(`import { HTMLStencilElement, JSXBase } from "@stencil/core/runtime";`);
9124
- if (config.extras?.signalBacking) {
9211
+ if (config.signalBacking) {
9125
9212
  c.push(`import { STENCIL_SIGNALS_SYMBOL, type ReadonlySignal } from "@stencil/core/signals";`);
9126
9213
  c.push(`export { STENCIL_SIGNALS_SYMBOL } from "@stencil/core/signals";`);
9127
9214
  }
@@ -9438,7 +9525,7 @@ const injectManifest = async (buildCtx, serviceWorker, workbox) => {
9438
9525
  };
9439
9526
  const hasServiceWorkerChanges = (config, buildCtx) => {
9440
9527
  if (config.devMode && !config.generateServiceWorker) return false;
9441
- return config.outputTargets.filter(isOutputTargetWww).filter((o) => o.serviceWorker && o.serviceWorker.swSrc).some((outputTarget) => {
9528
+ return config.outputTargets.filter(isOutputTargetWww).filter((o) => o.serviceWorker?.swSrc).some((outputTarget) => {
9442
9529
  return buildCtx.filesChanged.some((fileChanged) => {
9443
9530
  if (outputTarget.serviceWorker) return basename$1(fileChanged).toLowerCase() === basename$1(outputTarget.serviceWorker.swSrc).toLowerCase();
9444
9531
  return false;
@@ -9509,11 +9596,9 @@ const generateServiceWorkerUrl = (outputTarget, serviceWorker) => {
9509
9596
  //#endregion
9510
9597
  //#region src/compiler/html/inject-sw-script.ts
9511
9598
  const updateIndexHtmlServiceWorker = async (config, buildCtx, doc, outputTarget) => {
9512
- const serviceWorker = outputTarget.serviceWorker;
9513
- if (serviceWorker !== false) {
9514
- if (serviceWorker && serviceWorker.unregister || !serviceWorker && config.devMode) injectUnregisterServiceWorker(doc);
9515
- else if (serviceWorker) await injectRegisterServiceWorker(buildCtx, outputTarget, doc);
9516
- }
9599
+ const serviceWorker = outputTarget.serviceWorker ?? null;
9600
+ if (serviceWorker && serviceWorker.unregister || !serviceWorker && config.devMode) injectUnregisterServiceWorker(doc);
9601
+ else if (serviceWorker) await injectRegisterServiceWorker(buildCtx, outputTarget, doc);
9517
9602
  };
9518
9603
  const injectRegisterServiceWorker = async (buildCtx, outputTarget, doc) => {
9519
9604
  const serviceWorker = getRegisterSwScript(doc, buildCtx, generateServiceWorkerUrl(outputTarget, outputTarget.serviceWorker));
@@ -10051,7 +10136,7 @@ const getCustomBeforeTransformers$1 = (config, compilerCtx, buildCtx) => {
10051
10136
  };
10052
10137
  const customBeforeTransformers = [updateStencilCoreImports(transformOpts.coreImportPath)];
10053
10138
  if (config.transformAliasedImportPaths) customBeforeTransformers.push(rewriteAliasedSourceFileImportPaths);
10054
- if (buildCtx.config.extras.additionalTagTransformers) customBeforeTransformers.push(addTagTransform$2(compilerCtx, buildCtx));
10139
+ if (buildCtx.config.compat.additionalTagTransformers) customBeforeTransformers.push(addTagTransform$2(compilerCtx, buildCtx));
10055
10140
  customBeforeTransformers.push(ssrComponentTransform(compilerCtx, transformOpts, buildCtx), removeCollectionImports(compilerCtx));
10056
10141
  return customBeforeTransformers;
10057
10142
  };
@@ -11077,7 +11162,7 @@ const addSingleStyleGetter = (classMembers, cmp, style, buildCtx) => {
11077
11162
  }
11078
11163
  };
11079
11164
  const addTagTransform = (cssCode, buildCtx) => {
11080
- if (!buildCtx.config.extras.additionalTagTransformers) return ts.factory.createNoSubstitutionTemplateLiteral(cssCode);
11165
+ if (!buildCtx.config.compat.additionalTagTransformers) return ts.factory.createNoSubstitutionTemplateLiteral(cssCode);
11081
11166
  return addTagTransformToCssTsAST(cssCode, buildCtx.components.map((c) => c.tagName));
11082
11167
  };
11083
11168
  const createStyleLiteral = (cmp, style, buildCtx) => {
@@ -11441,7 +11526,7 @@ const getStandaloneBuildConditionals = (config, cmps) => {
11441
11526
  build.hydrateServerSide = false;
11442
11527
  build.asyncQueue = config.taskQueue === "congestionAsync";
11443
11528
  build.taskQueue = config.taskQueue !== "immediate";
11444
- build.initializeNextTick = config.extras.initializeNextTick;
11529
+ build.initializeNextTick = config.compat.initializeNextTick;
11445
11530
  updateBuildConditionals(config, build);
11446
11531
  build.devTools = false;
11447
11532
  return build;
@@ -11676,7 +11761,7 @@ const getCustomBeforeTransformers = (config, compilerCtx, components, outputTarg
11676
11761
  };
11677
11762
  const customBeforeTransformers = [addDefineCustomElementFunctions(compilerCtx, components, outputTarget, config.devMode), updateStencilCoreImports(transformOpts.coreImportPath)];
11678
11763
  if (config.transformAliasedImportPaths) customBeforeTransformers.push(rewriteAliasedSourceFileImportPaths);
11679
- if (buildCtx.config.extras.additionalTagTransformers) customBeforeTransformers.push(addTagTransform$2(compilerCtx, buildCtx));
11764
+ if (buildCtx.config.compat.additionalTagTransformers) customBeforeTransformers.push(addTagTransform$2(compilerCtx, buildCtx));
11680
11765
  customBeforeTransformers.push(nativeComponentTransform(compilerCtx, transformOpts, buildCtx), proxyCustomElement(compilerCtx, transformOpts), removeCollectionImports(compilerCtx));
11681
11766
  return customBeforeTransformers;
11682
11767
  };
@@ -15861,6 +15946,7 @@ const generateBuildResults = (config, compilerCtx, buildCtx) => {
15861
15946
  hasSuccessfulBuild: compilerCtx.hasSuccessfulBuild,
15862
15947
  isRebuild: buildCtx.isRebuild,
15863
15948
  namespace: config.namespace,
15949
+ fsNamespace: config.fsNamespace,
15864
15950
  outputs: compilerCtx.fs.getBuildOutputs(),
15865
15951
  components: buildCtx.components.slice(),
15866
15952
  rootDir: config.rootDir,
@@ -16493,7 +16579,7 @@ const writeExportMaps = (config, buildCtx) => {
16493
16579
  */
16494
16580
  const generateRootExport = (config, buildCtx, loaderBundle, standalone, types) => {
16495
16581
  if (!loaderBundle && !standalone) return;
16496
- const currentImport = (buildCtx.packageJson.exports?.["."])?.import;
16582
+ const currentImport = ((buildCtx.packageJson?.exports)?.["."])?.import;
16497
16583
  if (!(currentImport && isValidRootExport(config, currentImport, loaderBundle, standalone))) {
16498
16584
  const primaryDir = loaderBundle?.dir ?? standalone?.dir;
16499
16585
  if (primaryDir) {
@@ -16873,15 +16959,6 @@ const hasScriptExt = (filePath) => {
16873
16959
  const ext = getExt(filePath);
16874
16960
  return ext ? SCRIPT_EXT.includes(ext) : false;
16875
16961
  };
16876
- const STYLE_EXT = [
16877
- "css",
16878
- "scss",
16879
- "sass",
16880
- "pcss",
16881
- "styl",
16882
- "stylus",
16883
- "less"
16884
- ];
16885
16962
  /**
16886
16963
  * Helper to check if a filepath has a style extension
16887
16964
  *
@@ -16929,7 +17006,17 @@ const hasStyleChanges = (buildCtx) => buildCtx.filesChanged.some(hasStyleExt);
16929
17006
  */
16930
17007
  const hasHtmlChanges = (config, buildCtx) => {
16931
17008
  const srcDirPrefix = config.srcDir + "/";
16932
- return buildCtx.filesChanged.some((f) => f.toLowerCase().endsWith(".html") && f.startsWith(srcDirPrefix));
17009
+ const isHtmlOrUsageMd = (f) => {
17010
+ if (!f.startsWith(srcDirPrefix)) return false;
17011
+ const lower = f.toLowerCase();
17012
+ return lower.endsWith(".html") || lower.endsWith(".md") && f.includes("/usage/");
17013
+ };
17014
+ if (buildCtx.filesChanged.some(isHtmlOrUsageMd)) return true;
17015
+ if (buildCtx.filesDeleted.some(isHtmlOrUsageMd)) return true;
17016
+ const isUsageDir = (d) => d.startsWith(srcDirPrefix) && /\/usage\/?$/.test(d);
17017
+ if (buildCtx.dirsDeleted.some(isUsageDir)) return true;
17018
+ const isSrcTsx = (f) => f.startsWith(srcDirPrefix) && f.toLowerCase().endsWith(".tsx");
17019
+ return buildCtx.filesAdded.some(isSrcTsx) || buildCtx.filesDeleted.some(isSrcTsx);
16933
17020
  };
16934
17021
  /**
16935
17022
  * Checks if a path is ignored by the watch configuration
@@ -18114,17 +18201,13 @@ const validatePrerender = (config, diagnostics, outputTarget) => {
18114
18201
  * configuration we want to validate. **Note**: the `.serviceWorker` object
18115
18202
  * _will be mutated_ if it is present.
18116
18203
  */
18117
- const validateServiceWorker = (config, outputTarget) => {
18118
- if (outputTarget.serviceWorker === false) return;
18119
- if (config.devMode && !config.generateServiceWorker) {
18120
- outputTarget.serviceWorker = null;
18121
- return;
18122
- }
18123
- if (outputTarget.serviceWorker === null) {
18204
+ function validateServiceWorker(config, outputTarget) {
18205
+ if (!outputTarget.serviceWorker) {
18124
18206
  outputTarget.serviceWorker = null;
18125
18207
  return;
18126
18208
  }
18127
- if (!outputTarget.serviceWorker && config.devMode) {
18209
+ if (outputTarget.serviceWorker === true) outputTarget.serviceWorker = {};
18210
+ if (config.devMode && !config.generateServiceWorker) {
18128
18211
  outputTarget.serviceWorker = null;
18129
18212
  return;
18130
18213
  }
@@ -18144,7 +18227,7 @@ const validateServiceWorker = (config, outputTarget) => {
18144
18227
  outputTarget.serviceWorker.dontCacheBustURLsMatching = /p-\w{8}/;
18145
18228
  if (isString$1(outputTarget.serviceWorker.swSrc) && !isAbsolute$1(outputTarget.serviceWorker.swSrc)) outputTarget.serviceWorker.swSrc = join$2(config.rootDir, outputTarget.serviceWorker.swSrc);
18146
18229
  if (isString$1(outputTarget.serviceWorker.swDest) && !isAbsolute$1(outputTarget.serviceWorker.swDest)) outputTarget.serviceWorker.swDest = join$2(outputTarget.appDir ?? "", outputTarget.serviceWorker.swDest);
18147
- };
18230
+ }
18148
18231
  /**
18149
18232
  * Add file glob patterns to the `globIgnores` for files we don't want to cache
18150
18233
  * with the service worker.
@@ -18160,15 +18243,7 @@ const DEFAULT_FILENAME = "sw.js";
18160
18243
  //#endregion
18161
18244
  //#region src/compiler/config/outputs/validate-www.ts
18162
18245
  const validateWww = (config, diagnostics, userOutputs) => {
18163
- const AUTO_GENERATED_TYPES = [
18164
- TYPES,
18165
- STENCIL_REBUNDLE,
18166
- GLOBAL_STYLE,
18167
- ASSETS
18168
- ];
18169
- const hasOutputTargets = userOutputs.some((o) => !AUTO_GENERATED_TYPES.includes(o.type));
18170
18246
  const userWwwOutputs = userOutputs.filter(isOutputTargetWww);
18171
- if (!hasOutputTargets) userWwwOutputs.push({ type: "www" });
18172
18247
  const hasLoaderBundle = userOutputs.some(isOutputTargetLoaderBundle);
18173
18248
  const hasStandalone = userOutputs.some(isOutputTargetStandalone);
18174
18249
  const defaultBundleMode = !hasLoaderBundle && hasStandalone ? "standalone" : "loader";
@@ -18260,6 +18335,13 @@ const validateOutputTargets = (config, diagnostics) => {
18260
18335
  err.messageText = `Invalid outputTarget type "${outputTarget.type}". Valid outputTarget types include: ${VALID_CONFIG_OUTPUT_TARGETS.map((t) => `"${t}"`).join(", ")}`;
18261
18336
  }
18262
18337
  });
18338
+ const IMPLICIT_TYPES = [
18339
+ TYPES,
18340
+ COLLECTION,
18341
+ GLOBAL_STYLE,
18342
+ ASSETS
18343
+ ];
18344
+ if (!userOutputs.some((o) => !IMPLICIT_TYPES.includes(o.type))) userOutputs.push({ type: LOADER_BUNDLE });
18263
18345
  autoGenerateOutputs(config, userOutputs, diagnostics);
18264
18346
  config.outputTargets = [
18265
18347
  ...validateTypes(config, userOutputs),
@@ -18303,7 +18385,7 @@ const autoGenerateOutputs = (config, userOutputs, diagnostics) => {
18303
18385
  if (!hasExplicitAssets) userOutputs.push({ type: ASSETS });
18304
18386
  if (config.devMode) return;
18305
18387
  if (!hasExplicitTypes) userOutputs.push({ type: TYPES });
18306
- if (!hasExplicitCollection) userOutputs.push({ type: STENCIL_REBUNDLE });
18388
+ if (!hasExplicitCollection) userOutputs.push({ type: COLLECTION });
18307
18389
  };
18308
18390
  //#endregion
18309
18391
  //#region src/compiler/config/validate-dev-server.ts
@@ -18448,6 +18530,17 @@ const validateHydrated = (config) => {
18448
18530
  };
18449
18531
  //#endregion
18450
18532
  //#region src/compiler/config/validate-namespace.ts
18533
+ const deriveDefaultNamespace = (rootDir, sys) => {
18534
+ try {
18535
+ const pkgContent = sys.readFileSync(join$1(rootDir, "package.json"));
18536
+ if (pkgContent) {
18537
+ const name = JSON.parse(pkgContent)?.name;
18538
+ if (isString$1(name) && name.length >= 3) return name.replace(/^@[^/]+\//, "");
18539
+ }
18540
+ } catch {}
18541
+ const dirName = basename$1(rootDir);
18542
+ return dirName.length >= 3 ? dirName : "App";
18543
+ };
18451
18544
  /**
18452
18545
  * Ensures that the `namespace` and `fsNamespace` properties on a project's
18453
18546
  * Stencil config are valid strings. A valid namespace means:
@@ -18458,15 +18551,18 @@ const validateHydrated = (config) => {
18458
18551
  *
18459
18552
  * If any conditions are not met, a diagnostic is added to the provided array.
18460
18553
  *
18461
- * If a namespace is not provided, the default value is `App`.
18554
+ * If a namespace is not provided, it is derived from the package.json `name` field,
18555
+ * falling back to the root directory name, then `App` as a last resort.
18462
18556
  *
18463
18557
  * @param namespace The namespace to validate
18464
18558
  * @param fsNamespace The fsNamespace to validate
18465
18559
  * @param diagnostics The array of diagnostics to add to if the namespace is invalid
18560
+ * @param rootDir The project root directory, used for package.json lookup
18561
+ * @param sys The compiler system, used to read package.json
18466
18562
  * @returns The validated namespace and fsNamespace
18467
18563
  */
18468
- const validateNamespace = (namespace, fsNamespace, diagnostics) => {
18469
- namespace = isString$1(namespace) ? namespace : "App";
18564
+ const validateNamespace = (namespace, fsNamespace, diagnostics, rootDir, sys) => {
18565
+ namespace = isString$1(namespace) ? namespace : rootDir && sys ? deriveDefaultNamespace(rootDir, sys) : "App";
18470
18566
  namespace = namespace.trim();
18471
18567
  const invalidNamespaceChars = namespace.replace(/(\w)|(-)|(\$)/g, "");
18472
18568
  if (invalidNamespaceChars !== "") {
@@ -18496,14 +18592,6 @@ const validateNamespace = (namespace, fsNamespace, diagnostics) => {
18496
18592
  fsNamespace
18497
18593
  };
18498
18594
  };
18499
- const validateDistNamespace = (config, diagnostics) => {
18500
- if ((config.outputTargets ?? []).some(isOutputTargetLoaderBundle)) {
18501
- if (!isString$1(config.namespace) || config.namespace.toLowerCase() === "app") {
18502
- const err = buildError(diagnostics);
18503
- err.messageText = `When generating a distribution it is recommended to choose a unique namespace rather than the default setting "App". Please updated the "namespace" config property within the stencil config.`;
18504
- }
18505
- }
18506
- };
18507
18595
  //#endregion
18508
18596
  //#region src/compiler/config/validate-paths.ts
18509
18597
  /**
@@ -18629,11 +18717,30 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
18629
18717
  logger.setLevel(logLevel);
18630
18718
  const devMode = isBoolean$1(config.devMode) ? config.devMode : false;
18631
18719
  config._isTesting = !!(process.env.VITEST || process.env.PLAYWRIGHT_TEST || process.env.TEST_WORKER_INDEX || process.env.TEST_PARALLEL_INDEX || process.env.NODE_ENV === "test");
18720
+ const sys = config.sys ?? bootstrapConfig.sys ?? createNodeSys({ logger });
18721
+ if ((!isString$1(config.globalStyle) || !isString$1(config.globalScript)) && typeof sys.accessSync === "function") {
18722
+ const preRootDir = typeof config.rootDir !== "string" ? "/" : config.rootDir;
18723
+ const srcDir = typeof config.srcDir === "string" ? isAbsolute$1(config.srcDir) ? config.srcDir : join$1(preRootDir, config.srcDir) : join$1(preRootDir, "src");
18724
+ if (!isString$1(config.globalStyle)) for (const ext of STYLE_EXT) {
18725
+ const candidate = join$1(srcDir, `global.${ext}`);
18726
+ if (sys.accessSync(candidate)) {
18727
+ config.globalStyle = candidate;
18728
+ break;
18729
+ }
18730
+ }
18731
+ if (!isString$1(config.globalScript)) for (const ext of ["ts", "js"]) {
18732
+ const candidate = join$1(srcDir, `global.${ext}`);
18733
+ if (sys.accessSync(candidate)) {
18734
+ config.globalScript = candidate;
18735
+ break;
18736
+ }
18737
+ }
18738
+ }
18632
18739
  const validatedConfig = {
18633
18740
  devServer: {},
18634
18741
  ...config,
18635
18742
  devMode,
18636
- extras: config.extras || {},
18743
+ compat: config.compat || {},
18637
18744
  generateExportMaps: isBoolean$1(config.generateExportMaps) ? config.generateExportMaps : false,
18638
18745
  hydratedFlag: validateHydrated(config),
18639
18746
  logLevel,
@@ -18643,20 +18750,20 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
18643
18750
  outputTargets: config.outputTargets ?? [],
18644
18751
  rolldownConfig: validateRolldownConfig(config),
18645
18752
  sourceMap: config.sourceMap === true || devMode && (config.sourceMap === "dev" || typeof config.sourceMap === "undefined"),
18646
- sys: config.sys ?? bootstrapConfig.sys ?? createNodeSys({ logger }),
18753
+ sys,
18647
18754
  docs: validateDocs(config, logger),
18648
18755
  transformAliasedImportPaths: isBoolean$1(userConfig.transformAliasedImportPaths) ? userConfig.transformAliasedImportPaths : true,
18649
- ...validateNamespace(config.namespace, config.fsNamespace, diagnostics),
18756
+ ...validateNamespace(config.namespace, config.fsNamespace, diagnostics, config.rootDir, sys),
18650
18757
  ...validatePaths(config)
18651
18758
  };
18652
18759
  if (validatedConfig.buildLogFilePath) logger.setLogFilePath(validatedConfig.buildLogFilePath);
18653
- validatedConfig.extras.enableImportInjection = validatedConfig.extras.enableImportInjection !== false;
18654
- validatedConfig.extras.lifecycleDOMEvents = !!validatedConfig.extras.lifecycleDOMEvents;
18655
- validatedConfig.extras.initializeNextTick = !!validatedConfig.extras.initializeNextTick;
18656
- validatedConfig.extras.additionalTagTransformers = validatedConfig.extras.additionalTagTransformers === true || !devMode && validatedConfig.extras.additionalTagTransformers === "prod";
18657
- const ldp = validatedConfig.extras.lightDomPatches;
18658
- if (ldp === void 0) validatedConfig.extras.lightDomPatches = true;
18659
- else if (typeof ldp !== "boolean" && typeof ldp !== "object") validatedConfig.extras.lightDomPatches = true;
18760
+ validatedConfig.compat.enableImportInjection = validatedConfig.compat.enableImportInjection !== false;
18761
+ validatedConfig.compat.lifecycleDOMEvents = !!validatedConfig.compat.lifecycleDOMEvents;
18762
+ validatedConfig.compat.initializeNextTick = !!validatedConfig.compat.initializeNextTick;
18763
+ validatedConfig.compat.additionalTagTransformers = validatedConfig.compat.additionalTagTransformers === true || !devMode && validatedConfig.compat.additionalTagTransformers === "prod";
18764
+ const ldp = validatedConfig.compat.lightDomPatches;
18765
+ if (ldp === void 0) validatedConfig.compat.lightDomPatches = true;
18766
+ else if (typeof ldp !== "boolean" && typeof ldp !== "object") validatedConfig.compat.lightDomPatches = true;
18660
18767
  setBooleanConfig(validatedConfig, "watch", false);
18661
18768
  setBooleanConfig(validatedConfig, "profile", validatedConfig.devMode);
18662
18769
  setBooleanConfig(validatedConfig, "writeLog", false);
@@ -18676,7 +18783,6 @@ const validateConfig = (userConfig = {}, bootstrapConfig) => {
18676
18783
  if (!Array.isArray(validatedConfig.collections)) validatedConfig.collections = [];
18677
18784
  validateWorkers(validatedConfig);
18678
18785
  setBooleanConfig(validatedConfig, "devInspector", validatedConfig.devMode);
18679
- if (!validatedConfig._isTesting) validateDistNamespace(validatedConfig, diagnostics);
18680
18786
  setBooleanConfig(validatedConfig, "enableCache", true);
18681
18787
  if (!Array.isArray(validatedConfig.watchIgnoredRegex) && validatedConfig.watchIgnoredRegex != null) validatedConfig.watchIgnoredRegex = [validatedConfig.watchIgnoredRegex];
18682
18788
  validatedConfig.watchIgnoredRegex = (validatedConfig.watchIgnoredRegex || []).reduce((arr, reg) => {
@@ -21334,7 +21440,7 @@ const createCompiler = async (userConfig) => {
21334
21440
  };
21335
21441
  //#endregion
21336
21442
  //#region src/compiler/sys/typescript/typescript-config.ts
21337
- const validateTsConfig = async (config, sys, init) => {
21443
+ const validateTsConfig = async (config, sys) => {
21338
21444
  const tsconfig = {
21339
21445
  path: "",
21340
21446
  compilerOptions: {},
@@ -21346,7 +21452,7 @@ const validateTsConfig = async (config, sys, init) => {
21346
21452
  diagnostics: []
21347
21453
  };
21348
21454
  try {
21349
- const readTsConfig = await getTsConfigPath(config, sys, init);
21455
+ const readTsConfig = await getTsConfigPath(config, sys);
21350
21456
  if (!readTsConfig) {
21351
21457
  const diagnostic = buildError(tsconfig.diagnostics);
21352
21458
  diagnostic.header = `Missing tsconfig.json`;
@@ -21391,13 +21497,7 @@ const validateTsConfig = async (config, sys, init) => {
21391
21497
  if (results.watchOptions) tsconfig.watchOptions = results.watchOptions;
21392
21498
  if (results.options) {
21393
21499
  tsconfig.compilerOptions = results.options;
21394
- const target = tsconfig.compilerOptions.target ?? ts.ScriptTarget.ES2017;
21395
- if ([
21396
- ts.ScriptTarget.ES3,
21397
- ts.ScriptTarget.ES5,
21398
- ts.ScriptTarget.ES2015,
21399
- ts.ScriptTarget.ES2016
21400
- ].includes(target)) {
21500
+ if ((tsconfig.compilerOptions.target ?? ts.ScriptTarget.ES2017) < ts.ScriptTarget.ES2017) {
21401
21501
  const warn = buildWarn(tsconfig.diagnostics);
21402
21502
  warn.messageText = `Stencil requires the tsconfig.json “target” setting to be “es2017” or higher. ES5 build output is no longer supported.`;
21403
21503
  }
@@ -21414,7 +21514,7 @@ const validateTsConfig = async (config, sys, init) => {
21414
21514
  }
21415
21515
  return tsconfig;
21416
21516
  };
21417
- const getTsConfigPath = async (config, sys, init) => {
21517
+ const getTsConfigPath = async (config, sys) => {
21418
21518
  const tsconfig = {
21419
21519
  path: "",
21420
21520
  content: ""
@@ -21424,27 +21524,31 @@ const getTsConfigPath = async (config, sys, init) => {
21424
21524
  else tsconfig.path = join$2(config.rootDir, "tsconfig.json");
21425
21525
  tsconfig.content = await sys.readFile(tsconfig.path);
21426
21526
  if (!isString$1(tsconfig.content)) {
21427
- if (!init.initTsConfig) return null;
21428
21527
  tsconfig.path = join$2(config.rootDir, "tsconfig.json");
21429
21528
  tsconfig.content = createDefaultTsConfig(config);
21430
21529
  await sys.writeFile(tsconfig.path, tsconfig.content);
21431
21530
  }
21531
+ if (!isString$1(config.configPath)) {
21532
+ const componentsDtsPath = getComponentsDtsSrcFilePath(config);
21533
+ if (!isString$1(await sys.readFile(componentsDtsPath))) await sys.writeFile(componentsDtsPath, "/* auto-generated by stencil */\nexport {};\n");
21534
+ }
21432
21535
  tsconfig.path = normalizePath(tsconfig.path);
21433
21536
  return tsconfig;
21434
21537
  };
21435
21538
  const createDefaultTsConfig = (config) => JSON.stringify({
21436
21539
  compilerOptions: {
21437
- allowSyntheticDefaultImports: true,
21438
21540
  experimentalDecorators: true,
21439
- lib: ["dom", "es2015"],
21440
- moduleResolution: "node",
21441
- module: "esnext",
21442
- target: "es2017",
21443
- jsx: "react",
21444
- jsxFactory: "h",
21445
- jsxFragmentFactory: "Fragment",
21446
- sourceMap: config.sourceMap,
21447
- inlineSources: config.sourceMap
21541
+ strict: true,
21542
+ target: "ES2022",
21543
+ module: "ESNext",
21544
+ moduleResolution: "bundler",
21545
+ lib: ["ES2022", "DOM"],
21546
+ jsx: "react-jsx",
21547
+ jsxImportSource: "@stencil/core",
21548
+ resolveJsonModule: true,
21549
+ allowJs: true,
21550
+ rootDir: "./",
21551
+ outDir: "./dist"
21448
21552
  },
21449
21553
  include: [relative$1(config.rootDir, config.srcDir)]
21450
21554
  }, null, 2);
@@ -21518,7 +21622,7 @@ const loadConfig = async (init = {}) => {
21518
21622
  if (hasError(results.diagnostics)) return results;
21519
21623
  results.config = validated.config;
21520
21624
  if (!hasError(results.diagnostics)) {
21521
- const tsConfigResults = await validateTsConfig(results.config, sys, init);
21625
+ const tsConfigResults = await validateTsConfig(results.config, sys);
21522
21626
  results.diagnostics.push(...tsConfigResults.diagnostics);
21523
21627
  results.config.tsconfig = tsConfigResults.path;
21524
21628
  results.config.tsCompilerOptions = tsConfigResults.compilerOptions;