@qualcomm-ui/mdx-vite 2.2.0 → 2.2.1

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.
package/dist/cli.js CHANGED
@@ -5672,8 +5672,8 @@ function cleanDefaultValue(defaultValue) {
5672
5672
  }
5673
5673
  async function scanPages(routesFolder, verbose, excludePatterns = [], baseUrl) {
5674
5674
  const components = [];
5675
- function shouldExclude(dirPath) {
5676
- const dirName = basename(dirPath);
5675
+ function shouldExclude(fileOrDir) {
5676
+ const dirName = basename(fileOrDir);
5677
5677
  return excludePatterns.some((pattern) => {
5678
5678
  if (pattern.includes("*")) {
5679
5679
  const regex = new RegExp(`^${pattern.replace(/\*/g, ".*")}$`);
@@ -5690,7 +5690,9 @@ async function scanPages(routesFolder, verbose, excludePatterns = [], baseUrl) {
5690
5690
  return;
5691
5691
  }
5692
5692
  const entries = await readdir(dirPath, { withFileTypes: true });
5693
- const mdxFiles = entries.filter((f) => f.name.endsWith(".mdx")) ?? [];
5693
+ const mdxFiles = entries.filter(
5694
+ (f) => f.name.endsWith(".mdx") && !shouldExclude(f.name)
5695
+ ) ?? [];
5694
5696
  for (const mdxFile of mdxFiles) {
5695
5697
  const demosFolder = entries.find((f) => f.name === "demos");
5696
5698
  const demosFolderPath = demosFolder ? join3(dirPath, demosFolder.name) : void 0;
@@ -5701,7 +5703,7 @@ async function scanPages(routesFolder, verbose, excludePatterns = [], baseUrl) {
5701
5703
  const url = getPathnameFromPathSegments(segments);
5702
5704
  components.push({
5703
5705
  demosFolder: demosFolderPath,
5704
- id: segments.join("-"),
5706
+ id: segments.join("-").trim(),
5705
5707
  mdxFile: join3(dirPath, mdxFile.name),
5706
5708
  name: segments.at(-1),
5707
5709
  path: dirPath,
@@ -6157,7 +6159,7 @@ async function generatePerPageExports({
6157
6159
  }
6158
6160
  }
6159
6161
  }
6160
- const outfile = `${resolve5(outputPath)}/${kebabCase(page.id)}.md`;
6162
+ const outfile = `${resolve5(outputPath)}/${kebabCase(page.id || page.name)}.md`;
6161
6163
  await writeFile3(outfile, lines.join("\n"), "utf-8");
6162
6164
  const stats = await stat(outfile);
6163
6165
  totalSize += stats.size / 1024;
@@ -6252,7 +6254,7 @@ function addGenerateKnowledgeCommand() {
6252
6254
  "Project description for llms.txt"
6253
6255
  ).option("-v, --verbose", "Enable verbose logging", false).option(
6254
6256
  "--exclude <patterns...>",
6255
- "Exclude folder patterns (supports * wildcards)",
6257
+ "Exclude file or folder patterns (supports * wildcards)",
6256
6258
  []
6257
6259
  ).option("--base-url <url>", "Base URL for component documentation links").option("--metadata <pairs...>", "metadata key-value pairs").option("--clean", "Clean the output path before generating").option("--include-imports", "Include relative import source files", true).action(async (options) => {
6258
6260
  loadEnv();