@qualcomm-ui/mdx-vite 2.16.2 → 2.17.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
@@ -520,9 +520,9 @@ var require_help = __commonJS({
520
520
  * @param {Help} helper
521
521
  * @returns string[]
522
522
  */
523
- formatItemList(heading, items, helper) {
523
+ formatItemList(heading2, items, helper) {
524
524
  if (items.length === 0) return [];
525
- return [helper.styleTitle(heading), ...items, ""];
525
+ return [helper.styleTitle(heading2), ...items, ""];
526
526
  }
527
527
  /**
528
528
  * Group items by their help group heading.
@@ -1002,8 +1002,8 @@ var require_option = __commonJS({
1002
1002
  * @param {string} heading
1003
1003
  * @return {Option}
1004
1004
  */
1005
- helpGroup(heading) {
1006
- this.helpGroupHeading = heading;
1005
+ helpGroup(heading2) {
1006
+ this.helpGroupHeading = heading2;
1007
1007
  return this;
1008
1008
  }
1009
1009
  /**
@@ -3099,9 +3099,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3099
3099
  * @param {string} [heading]
3100
3100
  * @return {Command | string}
3101
3101
  */
3102
- helpGroup(heading) {
3103
- if (heading === void 0) return this._helpGroupHeading ?? "";
3104
- this._helpGroupHeading = heading;
3102
+ helpGroup(heading2) {
3103
+ if (heading2 === void 0) return this._helpGroupHeading ?? "";
3104
+ this._helpGroupHeading = heading2;
3105
3105
  return this;
3106
3106
  }
3107
3107
  /**
@@ -3117,9 +3117,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3117
3117
  * @param {string} [heading]
3118
3118
  * @returns {Command | string}
3119
3119
  */
3120
- commandsGroup(heading) {
3121
- if (heading === void 0) return this._defaultCommandGroup ?? "";
3122
- this._defaultCommandGroup = heading;
3120
+ commandsGroup(heading2) {
3121
+ if (heading2 === void 0) return this._defaultCommandGroup ?? "";
3122
+ this._defaultCommandGroup = heading2;
3123
3123
  return this;
3124
3124
  }
3125
3125
  /**
@@ -3135,9 +3135,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3135
3135
  * @param {string} [heading]
3136
3136
  * @returns {Command | string}
3137
3137
  */
3138
- optionsGroup(heading) {
3139
- if (heading === void 0) return this._defaultOptionGroup ?? "";
3140
- this._defaultOptionGroup = heading;
3138
+ optionsGroup(heading2) {
3139
+ if (heading2 === void 0) return this._defaultOptionGroup ?? "";
3140
+ this._defaultOptionGroup = heading2;
3141
3141
  return this;
3142
3142
  }
3143
3143
  /**
@@ -3921,7 +3921,7 @@ var DocPropsIndexer = class {
3921
3921
  }
3922
3922
  assembleProp(prop, id) {
3923
3923
  const name = prop.name;
3924
- const heading = {
3924
+ const heading2 = {
3925
3925
  headingLevel: 4,
3926
3926
  id,
3927
3927
  tagName: "a",
@@ -3929,7 +3929,7 @@ var DocPropsIndexer = class {
3929
3929
  };
3930
3930
  const comment = prop.comment;
3931
3931
  if (!comment) {
3932
- return { content: [], heading, richContent: [] };
3932
+ return { content: [], heading: heading2, richContent: [] };
3933
3933
  }
3934
3934
  const content = {
3935
3935
  tagName: "p",
@@ -3937,7 +3937,7 @@ var DocPropsIndexer = class {
3937
3937
  comment.summary.map((entry) => entry.text.replaceAll("\n", " ")).join("")
3938
3938
  ]
3939
3939
  };
3940
- return { content: [content], heading, richContent: [] };
3940
+ return { content: [content], heading: heading2, richContent: [] };
3941
3941
  }
3942
3942
  };
3943
3943
 
@@ -4404,8 +4404,109 @@ var alertToEmphasis = {
4404
4404
  warning: "warning"
4405
4405
  };
4406
4406
 
4407
+ // src/docs-plugin/remark/remark-extract-meta.ts
4408
+ import { SKIP, visit as visit4 } from "unist-util-visit";
4409
+ function parseValue(value) {
4410
+ const trimmed = value.trim();
4411
+ if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
4412
+ const inner = trimmed.slice(1, -1);
4413
+ return inner.split(",").map((item) => item.trim()).filter(Boolean);
4414
+ }
4415
+ return trimmed;
4416
+ }
4417
+ function parseMetaContent(content) {
4418
+ const result = {};
4419
+ const lines = content.split("\n");
4420
+ for (const line of lines) {
4421
+ const trimmed = line.trim();
4422
+ if (!trimmed || trimmed === ":::") {
4423
+ continue;
4424
+ }
4425
+ const colonIndex = trimmed.indexOf(":");
4426
+ if (colonIndex === -1) {
4427
+ continue;
4428
+ }
4429
+ const key = trimmed.slice(0, colonIndex).trim();
4430
+ const value = trimmed.slice(colonIndex + 1).trim();
4431
+ if (key && value) {
4432
+ result[key] = parseValue(value);
4433
+ }
4434
+ }
4435
+ return result;
4436
+ }
4437
+ function parseTermsContent(content) {
4438
+ return content.split("\n").map((line) => line.trim()).filter((line) => line && line !== ":::");
4439
+ }
4440
+ var remarkExtractMeta = (metadata = {}) => {
4441
+ return (tree) => {
4442
+ const nodesToRemove = [];
4443
+ visit4(tree, "paragraph", (node, index, parent) => {
4444
+ if (!parent || index === void 0) {
4445
+ return;
4446
+ }
4447
+ const firstChild = node.children[0];
4448
+ if (firstChild?.type !== "text") {
4449
+ return;
4450
+ }
4451
+ const text = firstChild.value;
4452
+ const metaMatch = text.match(/^:::\s*meta\s*/);
4453
+ const termsMatch = text.match(/^:::\s*terms\s*/);
4454
+ if (!metaMatch && !termsMatch) {
4455
+ return;
4456
+ }
4457
+ const openMatch = metaMatch || termsMatch;
4458
+ const isTermsBlock = !!termsMatch;
4459
+ if (text.includes(":::") && text.lastIndexOf(":::") > openMatch[0].length) {
4460
+ const afterOpen = text.slice(openMatch[0].length);
4461
+ const closeIndex = afterOpen.lastIndexOf(":::");
4462
+ const content = afterOpen.slice(0, closeIndex);
4463
+ if (isTermsBlock) {
4464
+ const terms = parseTermsContent(content);
4465
+ if (terms.length > 0) {
4466
+ const existing = metadata.terms;
4467
+ metadata.terms = Array.isArray(existing) ? [...existing, ...terms] : terms;
4468
+ }
4469
+ } else {
4470
+ const parsed = parseMetaContent(content);
4471
+ Object.assign(metadata, parsed);
4472
+ }
4473
+ nodesToRemove.push({ index, parent });
4474
+ return SKIP;
4475
+ }
4476
+ let fullText = text;
4477
+ for (let i = 1; i < node.children.length; i++) {
4478
+ const child = node.children[i];
4479
+ if (child.type === "text") {
4480
+ fullText += child.value;
4481
+ }
4482
+ }
4483
+ const afterOpenFull = fullText.slice(openMatch[0].length);
4484
+ const closeIndexFull = afterOpenFull.lastIndexOf(":::");
4485
+ if (closeIndexFull !== -1) {
4486
+ const content = afterOpenFull.slice(0, closeIndexFull);
4487
+ if (isTermsBlock) {
4488
+ const terms = parseTermsContent(content);
4489
+ if (terms.length > 0) {
4490
+ const existing = metadata.terms;
4491
+ metadata.terms = Array.isArray(existing) ? [...existing, ...terms] : terms;
4492
+ }
4493
+ } else {
4494
+ const parsed = parseMetaContent(content);
4495
+ Object.assign(metadata, parsed);
4496
+ }
4497
+ nodesToRemove.push({ index, parent });
4498
+ return SKIP;
4499
+ }
4500
+ });
4501
+ for (let i = nodesToRemove.length - 1; i >= 0; i--) {
4502
+ const { index, parent } = nodesToRemove[i];
4503
+ parent.children.splice(index, 1);
4504
+ }
4505
+ };
4506
+ };
4507
+
4407
4508
  // src/docs-plugin/remark/remark-frontmatter-interpolation.ts
4408
- import { visit as visit4 } from "unist-util-visit";
4509
+ import { visit as visit5 } from "unist-util-visit";
4409
4510
  var FRONTMATTER_PATTERN = /^\s*frontmatter\.(\w+)\s*$/;
4410
4511
  function isMdxExpression(node) {
4411
4512
  const n = node;
@@ -4413,7 +4514,7 @@ function isMdxExpression(node) {
4413
4514
  }
4414
4515
  var remarkFrontmatterInterpolation = (frontmatter) => {
4415
4516
  return (tree) => {
4416
- visit4(tree, (node, index, parent) => {
4517
+ visit5(tree, (node, index, parent) => {
4417
4518
  if (!isMdxExpression(node) || index === void 0 || !parent) {
4418
4519
  return;
4419
4520
  }
@@ -4479,8 +4580,8 @@ var MarkdownIndexer = class {
4479
4580
  this.resetSection();
4480
4581
  this.headingLevels = headingLevels;
4481
4582
  }
4482
- appendTocItem(heading) {
4483
- this._toc.push(heading);
4583
+ appendTocItem(heading2) {
4584
+ this._toc.push(heading2);
4484
4585
  }
4485
4586
  warn(...data) {
4486
4587
  if (process.env.DEBUG) {
@@ -4515,11 +4616,11 @@ var MarkdownIndexer = class {
4515
4616
  this.sections.push(clone(this.currentSection));
4516
4617
  this.resetSection();
4517
4618
  }
4518
- const heading = this.parseHeading(element);
4619
+ const heading2 = this.parseHeading(element);
4519
4620
  if (!isRootHeading) {
4520
- this.appendTocItem(heading);
4621
+ this.appendTocItem(heading2);
4521
4622
  }
4522
- this.currentSection.heading = heading;
4623
+ this.currentSection.heading = heading2;
4523
4624
  return;
4524
4625
  }
4525
4626
  this.currentSection.richContent.push(element);
@@ -4532,7 +4633,7 @@ var MarkdownIndexer = class {
4532
4633
  }
4533
4634
  }
4534
4635
  parseMarkdown(fileContents, frontmatter) {
4535
- const file = unified3().use(remarkMdx2).use(remarkRemoveJsx).use(remarkRemoveMermaidCodeBlocks).use(remarkParse3).use(remarkGfm).use(remarkAlerts).use(remarkFrontmatterInterpolation, frontmatter).use(remarkRehype).use(rehypeStringify).processSync(fileContents);
4636
+ const file = unified3().use(remarkMdx2).use(remarkRemoveJsx).use(remarkRemoveMermaidCodeBlocks).use(remarkParse3).use(remarkGfm).use(remarkAlerts).use(remarkFrontmatterInterpolation, frontmatter).use(remarkExtractMeta, {}).use(remarkRehype).use(rehypeStringify).processSync(fileContents);
4536
4637
  let contents = file.toString();
4537
4638
  contents = contents.substring(contents.indexOf("<h1>"));
4538
4639
  const htmlAst = unified3().data("settings", { fragment: true }).use(rehypeParse).use(rehypeStringify).use(rehypeSlug).processSync(contents);
@@ -4901,7 +5002,7 @@ function getRemixFlatRoutesSegments(name, index, paramPrefixChar = "$") {
4901
5002
  let routeSegments = [];
4902
5003
  let i = 0;
4903
5004
  let routeSegment = "";
4904
- let state = "START";
5005
+ let state2 = "START";
4905
5006
  let subState = "NORMAL";
4906
5007
  let hasPlus = false;
4907
5008
  if (name.endsWith("_layout")) {
@@ -4928,7 +5029,7 @@ function getRemixFlatRoutesSegments(name, index, paramPrefixChar = "$") {
4928
5029
  };
4929
5030
  while (i < name.length) {
4930
5031
  const char = name[i];
4931
- switch (state) {
5032
+ switch (state2) {
4932
5033
  case "START":
4933
5034
  if (routeSegment.includes(paramPrefixChar) && !(routeSegment.startsWith(paramPrefixChar) || routeSegment.startsWith(`(${paramPrefixChar}`))) {
4934
5035
  throw new Error(
@@ -4942,12 +5043,12 @@ function getRemixFlatRoutesSegments(name, index, paramPrefixChar = "$") {
4942
5043
  }
4943
5044
  pushRouteSegment(routeSegment);
4944
5045
  routeSegment = "";
4945
- state = "PATH";
5046
+ state2 = "PATH";
4946
5047
  continue;
4947
5048
  // restart without advancing index
4948
5049
  case "PATH":
4949
5050
  if (isPathSeparator(char) && subState === "NORMAL") {
4950
- state = "START";
5051
+ state2 = "START";
4951
5052
  break;
4952
5053
  } else if (char === "[") {
4953
5054
  subState = "ESCAPE";
@@ -5398,120 +5499,19 @@ function loadEnvironmentConfigs(options = {}) {
5398
5499
 
5399
5500
  // src/ai-knowledge/generator/knowledge-generator.ts
5400
5501
  import AdmZip from "adm-zip";
5401
- import chalk3 from "chalk";
5502
+ import chalk4 from "chalk";
5402
5503
  import { minimatch } from "minimatch";
5403
5504
  import { mkdir, readdir, readFile as readFile4, rm, stat, writeFile } from "node:fs/promises";
5404
- import { basename as basename2, dirname as dirname3, join as join6, relative as relative2, resolve as resolve4 } from "node:path";
5405
- import remarkFrontmatter2 from "remark-frontmatter";
5505
+ import { basename as basename2, dirname as dirname3, join as join7, relative as relative2, resolve as resolve5 } from "node:path";
5506
+ import remarkFrontmatter3 from "remark-frontmatter";
5406
5507
  import remarkMdx3 from "remark-mdx";
5407
5508
  import remarkParse4 from "remark-parse";
5408
5509
  import remarkParseFrontmatter2 from "remark-parse-frontmatter";
5409
5510
  import remarkStringify4 from "remark-stringify";
5410
5511
  import { unified as unified5 } from "unified";
5411
- import { visit as visit11 } from "unist-util-visit";
5512
+ import { visit as visit18 } from "unist-util-visit";
5412
5513
  import { kebabCase as kebabCase3 } from "@qualcomm-ui/utils/change-case";
5413
5514
 
5414
- // src/docs-plugin/remark/remark-extract-meta.ts
5415
- import { SKIP, visit as visit5 } from "unist-util-visit";
5416
- function parseValue(value) {
5417
- const trimmed = value.trim();
5418
- if (trimmed.startsWith("[") && trimmed.endsWith("]")) {
5419
- const inner = trimmed.slice(1, -1);
5420
- return inner.split(",").map((item) => item.trim()).filter(Boolean);
5421
- }
5422
- return trimmed;
5423
- }
5424
- function parseMetaContent(content) {
5425
- const result = {};
5426
- const lines = content.split("\n");
5427
- for (const line of lines) {
5428
- const trimmed = line.trim();
5429
- if (!trimmed || trimmed === ":::") {
5430
- continue;
5431
- }
5432
- const colonIndex = trimmed.indexOf(":");
5433
- if (colonIndex === -1) {
5434
- continue;
5435
- }
5436
- const key = trimmed.slice(0, colonIndex).trim();
5437
- const value = trimmed.slice(colonIndex + 1).trim();
5438
- if (key && value) {
5439
- result[key] = parseValue(value);
5440
- }
5441
- }
5442
- return result;
5443
- }
5444
- function parseTermsContent(content) {
5445
- return content.split("\n").map((line) => line.trim()).filter((line) => line && line !== ":::");
5446
- }
5447
- var remarkExtractMeta = (metadata = {}) => {
5448
- return (tree) => {
5449
- const nodesToRemove = [];
5450
- visit5(tree, "paragraph", (node, index, parent) => {
5451
- if (!parent || index === void 0) {
5452
- return;
5453
- }
5454
- const firstChild = node.children[0];
5455
- if (firstChild?.type !== "text") {
5456
- return;
5457
- }
5458
- const text = firstChild.value;
5459
- const metaMatch = text.match(/^:::\s*meta\s*/);
5460
- const termsMatch = text.match(/^:::\s*terms\s*/);
5461
- if (!metaMatch && !termsMatch) {
5462
- return;
5463
- }
5464
- const openMatch = metaMatch || termsMatch;
5465
- const isTermsBlock = !!termsMatch;
5466
- if (text.includes(":::") && text.lastIndexOf(":::") > openMatch[0].length) {
5467
- const afterOpen = text.slice(openMatch[0].length);
5468
- const closeIndex = afterOpen.lastIndexOf(":::");
5469
- const content = afterOpen.slice(0, closeIndex);
5470
- if (isTermsBlock) {
5471
- const terms = parseTermsContent(content);
5472
- if (terms.length > 0) {
5473
- const existing = metadata.terms;
5474
- metadata.terms = Array.isArray(existing) ? [...existing, ...terms] : terms;
5475
- }
5476
- } else {
5477
- const parsed = parseMetaContent(content);
5478
- Object.assign(metadata, parsed);
5479
- }
5480
- nodesToRemove.push({ index, parent });
5481
- return SKIP;
5482
- }
5483
- let fullText = text;
5484
- for (let i = 1; i < node.children.length; i++) {
5485
- const child = node.children[i];
5486
- if (child.type === "text") {
5487
- fullText += child.value;
5488
- }
5489
- }
5490
- const afterOpenFull = fullText.slice(openMatch[0].length);
5491
- const closeIndexFull = afterOpenFull.lastIndexOf(":::");
5492
- if (closeIndexFull !== -1) {
5493
- const content = afterOpenFull.slice(0, closeIndexFull);
5494
- if (isTermsBlock) {
5495
- const terms = parseTermsContent(content);
5496
- if (terms.length > 0) {
5497
- const existing = metadata.terms;
5498
- metadata.terms = Array.isArray(existing) ? [...existing, ...terms] : terms;
5499
- }
5500
- } else {
5501
- const parsed = parseMetaContent(content);
5502
- Object.assign(metadata, parsed);
5503
- }
5504
- nodesToRemove.push({ index, parent });
5505
- return SKIP;
5506
- }
5507
- });
5508
- for (let i = nodesToRemove.length - 1; i >= 0; i--) {
5509
- const { index, parent } = nodesToRemove[i];
5510
- parent.children.splice(index, 1);
5511
- }
5512
- };
5513
- };
5514
-
5515
5515
  // src/ai-knowledge/generator/config.ts
5516
5516
  var currentConfig = null;
5517
5517
  function setConfig(config3) {
@@ -5997,11 +5997,292 @@ ${propsToDefinitionList(outputs)}`);
5997
5997
  }
5998
5998
  };
5999
5999
 
6000
- // src/ai-knowledge/generator/npm-install-tabs-plugin.ts
6000
+ // src/ai-knowledge/generator/filter-text-directives.ts
6001
+ import { visit as visit14 } from "unist-util-visit";
6002
+
6003
+ // src/docs-plugin/docs-plugin.ts
6004
+ import chalk3 from "chalk";
6005
+ import chokidar from "chokidar";
6006
+ import { glob } from "glob";
6007
+ import { readFileSync as readFileSync2 } from "node:fs";
6008
+ import { join as join6, resolve as resolve4 } from "node:path";
6009
+ import prettyMilliseconds from "pretty-ms";
6010
+ var isDev = process.env.NODE_ENV === "development";
6011
+ var VIRTUAL_MODULE_ID = "\0@qualcomm-ui/mdx-vite-plugin";
6012
+ var PluginState = class {
6013
+ buildCount = 0;
6014
+ config = null;
6015
+ configFilePath = "";
6016
+ docPropsFilePath = "";
6017
+ exports = { basePath: "", enabled: false, pages: [] };
6018
+ indexer;
6019
+ configLoader = null;
6020
+ knowledgeConfig = void 0;
6021
+ routesDir;
6022
+ servers = [];
6023
+ timeout = void 0;
6024
+ exportsTimeout = void 0;
6025
+ watching = false;
6026
+ cwd;
6027
+ init(cwd2) {
6028
+ this.cwd = cwd2;
6029
+ }
6030
+ getCwd() {
6031
+ return this.cwd;
6032
+ }
6033
+ get docPropsDirectory() {
6034
+ if (!this.docPropsFilePath) {
6035
+ return "";
6036
+ }
6037
+ return this.docPropsFilePath.substring(
6038
+ 0,
6039
+ this.docPropsFilePath.lastIndexOf("/")
6040
+ );
6041
+ }
6042
+ get siteData() {
6043
+ const { filePath: _filePath, ...config3 } = this.config ?? {};
6044
+ return {
6045
+ config: config3,
6046
+ exports: this.exports,
6047
+ navItems: state.indexer.navItems,
6048
+ pageDocProps: state.indexer.pageDocProps,
6049
+ pageMap: state.indexer.pageMap,
6050
+ searchIndex: state.indexer.searchIndex
6051
+ };
6052
+ }
6053
+ resolveDocProps() {
6054
+ if (!this.docPropsFilePath) {
6055
+ return {};
6056
+ }
6057
+ try {
6058
+ return JSON.parse(readFileSync2(this.docPropsFilePath, "utf-8"))?.props;
6059
+ } catch (e) {
6060
+ console.debug(
6061
+ "Invalid doc props file. Unable to parse JSON. Please check the file"
6062
+ );
6063
+ return {};
6064
+ }
6065
+ }
6066
+ createIndexer(config3) {
6067
+ this.config = config3;
6068
+ this.configFilePath = config3.filePath;
6069
+ this.docPropsFilePath = config3.typeDocProps ? fixPath(resolve4(this.cwd, config3.typeDocProps)) : "";
6070
+ this.routesDir = fixPath(resolve4(config3.appDirectory, config3.pageDirectory));
6071
+ this.knowledgeConfig = config3.knowledge;
6072
+ this.indexer = new SearchIndexer({
6073
+ ...config3,
6074
+ srcDir: fixPath(resolve4(this.cwd, config3.appDirectory)),
6075
+ typeDocProps: this.resolveDocProps()
6076
+ });
6077
+ const exportsConfig = config3.knowledge?.global?.exports;
6078
+ const exportsEnabled = exportsConfig?.enabled ?? false;
6079
+ const exportsPath = exportsConfig?.staticPath ?? "exports/md";
6080
+ this.exports = {
6081
+ basePath: exportsEnabled ? `/${exportsPath}` : "",
6082
+ enabled: exportsEnabled,
6083
+ pages: []
6084
+ };
6085
+ }
6086
+ buildIndex(shouldLog) {
6087
+ const files = glob.sync(
6088
+ [`${this.routesDir}/**/*.mdx`, `${this.routesDir}/**/*.tsx`],
6089
+ {
6090
+ absolute: true,
6091
+ cwd: this.cwd
6092
+ }
6093
+ );
6094
+ if (!files.length) {
6095
+ return [];
6096
+ }
6097
+ const startTime = Date.now();
6098
+ const compiledMdxFiles = this.indexer.buildIndex(files, shouldLog);
6099
+ if (isDev && shouldLog) {
6100
+ console.debug(
6101
+ `${chalk3.magenta.bold(`@qualcomm-ui/mdx-vite/docs-plugin:`)} Compiled search index in: ${chalk3.blueBright.bold(prettyMilliseconds(Date.now() - startTime))}${state.indexer.cachedFileCount ? chalk3.greenBright.bold(` (${state.indexer.cachedFileCount}/${state.indexer.mdxFileCount} files cached)`) : ""}`
6102
+ );
6103
+ }
6104
+ return compiledMdxFiles;
6105
+ }
6106
+ /**
6107
+ * When the user adds or removes mdx files, we re-index the site. This function
6108
+ * handles module invalidation so that virtual file imports are refreshed as
6109
+ * expected by the consumer's dev server.
6110
+ */
6111
+ sendUpdate() {
6112
+ for (const server of this.servers) {
6113
+ const virtualModule = server.moduleGraph.getModuleById(VIRTUAL_MODULE_ID);
6114
+ if (virtualModule) {
6115
+ server.moduleGraph.invalidateModule(virtualModule);
6116
+ server.reloadModule(virtualModule);
6117
+ }
6118
+ }
6119
+ }
6120
+ handleChange(opts = {}) {
6121
+ clearTimeout(this.timeout);
6122
+ this.timeout = setTimeout(() => {
6123
+ this.buildIndex(true);
6124
+ this.sendUpdate();
6125
+ opts?.onComplete?.();
6126
+ }, 300);
6127
+ }
6128
+ initWatchers(configFile) {
6129
+ if (this.watching) {
6130
+ return;
6131
+ }
6132
+ this.initConfigWatcher(configFile);
6133
+ this.watching = true;
6134
+ }
6135
+ initConfigWatcher(configFile) {
6136
+ const paths = [this.configFilePath];
6137
+ if (this.docPropsFilePath) {
6138
+ paths.push(this.docPropsFilePath);
6139
+ }
6140
+ chokidar.watch(paths, {
6141
+ cwd: this.cwd
6142
+ }).on("change", () => {
6143
+ console.debug(`qui-docs config changed, reloading plugin`);
6144
+ this.configLoader = new ConfigLoader({ configFile });
6145
+ const resolvedConfig = this.configLoader.loadConfig();
6146
+ this.configFilePath = resolvedConfig.filePath;
6147
+ this.createIndexer(resolvedConfig);
6148
+ this.handleChange({
6149
+ onComplete: () => {
6150
+ this.servers.forEach(
6151
+ (server) => server.ws.send({ type: "full-reload" })
6152
+ );
6153
+ }
6154
+ });
6155
+ });
6156
+ }
6157
+ async generateExports(publicDir) {
6158
+ if (!this.exports.enabled || !this.knowledgeConfig?.global) {
6159
+ return;
6160
+ }
6161
+ const globalConfig = this.knowledgeConfig.global;
6162
+ const exportsConfig = globalConfig.exports ?? {};
6163
+ const exportsPath = exportsConfig.staticPath ?? "exports/md";
6164
+ const outputPath = join6(publicDir, exportsPath);
6165
+ const manifestPath = exportsConfig.manifestPath ?? "exports";
6166
+ const manifestOutputPath = join6(publicDir, manifestPath);
6167
+ const startTime = Date.now();
6168
+ const pageIds = await generate({
6169
+ baseUrl: globalConfig.baseUrl,
6170
+ clean: true,
6171
+ docPropsPath: this.docPropsFilePath || void 0,
6172
+ exclude: exportsConfig.exclude ?? globalConfig.exclude,
6173
+ extraFiles: exportsConfig.extraFiles ?? globalConfig.extraFiles,
6174
+ frontmatter: exportsConfig.frontmatter ?? globalConfig.frontmatter,
6175
+ generateBulkZip: exportsConfig.generateBulkZip ?? true,
6176
+ generateManifest: exportsConfig.generateManifest ?? true,
6177
+ manifestOutputPath,
6178
+ metadata: exportsConfig.metadata ?? globalConfig.metadata,
6179
+ outputMode: "per-page",
6180
+ outputPath,
6181
+ pageTitlePrefix: exportsConfig.pageTitlePrefix ?? globalConfig.pageTitlePrefix,
6182
+ routeDir: this.routesDir,
6183
+ sections: exportsConfig.sections
6184
+ });
6185
+ this.exports.pages = pageIds;
6186
+ console.debug(
6187
+ `${chalk3.magenta.bold(`@qualcomm-ui/mdx-vite/docs-plugin:`)} Generated Markdown exports in: ${chalk3.blueBright.bold(prettyMilliseconds(Date.now() - startTime))}`
6188
+ );
6189
+ }
6190
+ debouncedGenerateExports(publicDir) {
6191
+ if (!this.exports.enabled) {
6192
+ return;
6193
+ }
6194
+ clearTimeout(this.exportsTimeout);
6195
+ this.exportsTimeout = setTimeout(() => {
6196
+ void this.generateExports(publicDir);
6197
+ }, 500);
6198
+ }
6199
+ };
6200
+ var state = new PluginState();
6201
+
6202
+ // src/docs-plugin/mdx-plugins.ts
6203
+ import rehypeShiki from "@shikijs/rehype";
6204
+ import {
6205
+ transformerNotationDiff,
6206
+ transformerNotationErrorLevel,
6207
+ transformerNotationFocus,
6208
+ transformerNotationHighlight,
6209
+ transformerNotationWordHighlight,
6210
+ transformerRemoveNotationEscape,
6211
+ transformerRenderIndentGuides
6212
+ } from "@shikijs/transformers";
6213
+ import { merge } from "lodash-es";
6214
+ import { quiCustomDarkTheme } from "@qualcomm-ui/mdx-common";
6215
+
6216
+ // src/exports.ts
6217
+ import rehypeMdxCodeProps from "rehype-mdx-code-props";
6218
+ import remarkFrontmatter2 from "remark-frontmatter";
6219
+ import remarkGfm2 from "remark-gfm";
6220
+ import remarkMdxFrontmatter from "remark-mdx-frontmatter";
6221
+
6222
+ // src/docs-plugin/rehype/rehype-sectionize.ts
6223
+ import { heading } from "hast-util-heading";
6224
+ import { headingRank as headingRank2 } from "hast-util-heading-rank";
6225
+
6226
+ // src/docs-plugin/remark/remark-code-tabs.ts
6001
6227
  import { visit as visit8 } from "unist-util-visit";
6228
+
6229
+ // src/docs-plugin/remark/remark-frontmatter-description.ts
6230
+ import { visit as visit9 } from "unist-util-visit";
6231
+
6232
+ // src/docs-plugin/remark/remark-frontmatter-title.ts
6233
+ import { visit as visit10 } from "unist-util-visit";
6234
+
6235
+ // src/docs-plugin/remark/remark-self-link-headings.ts
6236
+ import { toString as toString2 } from "mdast-util-to-string";
6237
+ import { visit as visit11 } from "unist-util-visit";
6238
+
6239
+ // src/docs-plugin/remark/remark-spoilers.ts
6240
+ import { visit as visit12 } from "unist-util-visit";
6241
+ function getSpoilerStartMatch(text) {
6242
+ return text.match(/^:::\s*spoiler\s*(.*)$/);
6243
+ }
6244
+ function getSpoilerEndMatch(text) {
6245
+ return text.trim() === ":::";
6246
+ }
6247
+ function isSpoilerBlock(text) {
6248
+ return !!getSpoilerStartMatch(text) || getSpoilerEndMatch(text);
6249
+ }
6250
+
6251
+ // src/docs-plugin/remark/remark-steps.ts
6252
+ import { visit as visit13 } from "unist-util-visit";
6253
+ function getStepStartMatch(text) {
6254
+ return text.match(/^:::\s*steps(?:\s+(h[1-6](?:-h[1-6])?))?\s*$/);
6255
+ }
6256
+ function getStepEndMatch(text) {
6257
+ return text.match(/^:::\s*\/steps\s*$/);
6258
+ }
6259
+ function isStepBlock(text) {
6260
+ return !!(getStepStartMatch(text) || getStepEndMatch(text));
6261
+ }
6262
+
6263
+ // src/docs-plugin/shiki/shiki-transformer-preview-block.ts
6264
+ import { dedent } from "@qualcomm-ui/utils/dedent";
6265
+
6266
+ // src/ai-knowledge/generator/filter-text-directives.ts
6267
+ var filterTextDirectives = () => {
6268
+ return (tree, _file, done) => {
6269
+ visit14(tree, "text", (node) => {
6270
+ const value = node.value?.trim?.();
6271
+ if (value && (isStepBlock(value) || isSpoilerBlock(value))) {
6272
+ Object.assign(node, {
6273
+ value: ``
6274
+ });
6275
+ }
6276
+ });
6277
+ done();
6278
+ };
6279
+ };
6280
+
6281
+ // src/ai-knowledge/generator/npm-install-tabs-plugin.ts
6282
+ import { visit as visit15 } from "unist-util-visit";
6002
6283
  var formatNpmInstallTabs = () => {
6003
6284
  return (tree, _file, done) => {
6004
- visit8(
6285
+ visit15(
6005
6286
  tree,
6006
6287
  "mdxJsxFlowElement",
6007
6288
  (node, index, parent) => {
@@ -6030,7 +6311,7 @@ var formatNpmInstallTabs = () => {
6030
6311
  };
6031
6312
 
6032
6313
  // src/ai-knowledge/generator/qds-theme-plugin.ts
6033
- import { visit as visit9 } from "unist-util-visit";
6314
+ import { visit as visit16 } from "unist-util-visit";
6034
6315
  function themeDataToJson(data, cssPropertyName) {
6035
6316
  if (!data || typeof data !== "object") {
6036
6317
  return "";
@@ -6089,7 +6370,7 @@ async function formatThemeNodes() {
6089
6370
  }
6090
6371
  };
6091
6372
  return () => (tree, _file, done) => {
6092
- visit9(tree, "mdxJsxFlowElement", (node) => {
6373
+ visit16(tree, "mdxJsxFlowElement", (node) => {
6093
6374
  const handler = node.name && handlers[node.name];
6094
6375
  if (!handler) {
6095
6376
  return;
@@ -6121,10 +6402,10 @@ async function formatThemeNodes() {
6121
6402
  }
6122
6403
 
6123
6404
  // src/ai-knowledge/generator/section-extractor.ts
6124
- import { toString as toString2 } from "mdast-util-to-string";
6405
+ import { toString as toString3 } from "mdast-util-to-string";
6125
6406
  import remarkStringify3 from "remark-stringify";
6126
6407
  import { unified as unified4 } from "unified";
6127
- import { visit as visit10 } from "unist-util-visit";
6408
+ import { visit as visit17 } from "unist-util-visit";
6128
6409
  import { kebabCase as kebabCase2 } from "@qualcomm-ui/utils/change-case";
6129
6410
  var SectionExtractor = class {
6130
6411
  depths;
@@ -6156,8 +6437,8 @@ var SectionExtractor = class {
6156
6437
  continue;
6157
6438
  }
6158
6439
  if (node.type === "heading") {
6159
- const heading = node;
6160
- if (!this.depths.has(heading.depth)) {
6440
+ const heading2 = node;
6441
+ if (!this.depths.has(heading2.depth)) {
6161
6442
  if (pendingSection) {
6162
6443
  pendingSection.nodes.push(node);
6163
6444
  } else {
@@ -6170,11 +6451,11 @@ var SectionExtractor = class {
6170
6451
  continue;
6171
6452
  }
6172
6453
  finalizeSection();
6173
- while (headerStack.length > 0 && headerStack[headerStack.length - 1].depth >= heading.depth) {
6454
+ while (headerStack.length > 0 && headerStack[headerStack.length - 1].depth >= heading2.depth) {
6174
6455
  headerStack.pop();
6175
6456
  }
6176
- const headingText = toString2(heading);
6177
- headerStack.push({ depth: heading.depth, text: headingText });
6457
+ const headingText = toString3(heading2);
6458
+ headerStack.push({ depth: heading2.depth, text: headingText });
6178
6459
  pendingSection = {
6179
6460
  headerPath: headerStack.map((h) => h.text),
6180
6461
  nodes: [],
@@ -6212,6 +6493,7 @@ var SectionExtractor = class {
6212
6493
  code: codeNode.value,
6213
6494
  language: codeNode.lang ?? ""
6214
6495
  });
6496
+ } else if (node.type === "text" && (isStepBlock(node.value.trim()) || isSpoilerBlock(node.value.trim()))) {
6215
6497
  } else {
6216
6498
  contentNodes.push(node);
6217
6499
  }
@@ -6280,9 +6562,9 @@ var SectionExtractor = class {
6280
6562
  */
6281
6563
  transformLinks() {
6282
6564
  return () => (tree) => {
6283
- visit10(tree, "link", (node) => {
6565
+ visit17(tree, "link", (node) => {
6284
6566
  let text = "";
6285
- visit10(node, "text", (textNode) => {
6567
+ visit17(node, "text", (textNode) => {
6286
6568
  text += textNode.value;
6287
6569
  });
6288
6570
  Object.assign(node, {
@@ -6393,14 +6675,14 @@ var KnowledgeGenerator = class {
6393
6675
  }
6394
6676
  const entries = await readdir(dirPath, { withFileTypes: true });
6395
6677
  const mdxFiles = entries.filter(
6396
- (f) => f.name.endsWith(".mdx") && !shouldExclude(join6(dirPath, f.name))
6678
+ (f) => f.name.endsWith(".mdx") && !shouldExclude(join7(dirPath, f.name))
6397
6679
  ) ?? [];
6398
6680
  const pageIdPrefix = this.config.pageIdPrefix ?? "";
6399
6681
  for (const mdxFile of mdxFiles) {
6400
6682
  const demosFolder = entries.find((f) => f.name === "demos");
6401
- const demosFolderPath = demosFolder ? join6(dirPath, demosFolder.name) : void 0;
6683
+ const demosFolderPath = demosFolder ? join7(dirPath, demosFolder.name) : void 0;
6402
6684
  const segments = getPathSegmentsFromFileName(
6403
- join6(dirPath, mdxFile.name),
6685
+ join7(dirPath, mdxFile.name),
6404
6686
  this.config.routeDir
6405
6687
  );
6406
6688
  const url = getPathnameFromPathSegments(segments);
@@ -6408,7 +6690,7 @@ var KnowledgeGenerator = class {
6408
6690
  demosFolder: demosFolderPath,
6409
6691
  filePath: dirPath,
6410
6692
  id: `${pageIdPrefix ? `${pageIdPrefix}-` : ""}${segments.join("-").trim()}`,
6411
- mdxFile: join6(dirPath, mdxFile.name),
6693
+ mdxFile: join7(dirPath, mdxFile.name),
6412
6694
  name: segments.at(-1),
6413
6695
  pathname: url,
6414
6696
  url: this.config.baseUrl ? new URL(url, this.config.baseUrl).toString() : void 0
@@ -6419,7 +6701,7 @@ var KnowledgeGenerator = class {
6419
6701
  }
6420
6702
  }
6421
6703
  for (const entry of entries) {
6422
- const fullPath = join6(dirPath, entry.name);
6704
+ const fullPath = join7(dirPath, entry.name);
6423
6705
  const stats = await stat(fullPath);
6424
6706
  if (stats.isDirectory()) {
6425
6707
  await scanDirectory(fullPath);
@@ -6431,7 +6713,7 @@ var KnowledgeGenerator = class {
6431
6713
  }
6432
6714
  formatFrontmatterExpressions(frontmatter) {
6433
6715
  return () => (tree) => {
6434
- visit11(
6716
+ visit18(
6435
6717
  tree,
6436
6718
  "mdxFlowExpression",
6437
6719
  (node, index, parent) => {
@@ -6471,7 +6753,7 @@ var KnowledgeGenerator = class {
6471
6753
  if (!baseUrl || this.config.outputMode !== "per-page") {
6472
6754
  return;
6473
6755
  }
6474
- visit11(tree, "link", (node) => {
6756
+ visit18(tree, "link", (node) => {
6475
6757
  if (node.url.startsWith("/")) {
6476
6758
  node.url = `${baseUrl}${node.url}`;
6477
6759
  } else if (node.url.startsWith("./#") && pageUrl) {
@@ -6515,7 +6797,7 @@ var KnowledgeGenerator = class {
6515
6797
  * into Markdown, resolving relative links, and cleaning up formatting.
6516
6798
  */
6517
6799
  async processMdxContent(mdxContent, pageInfo, frontmatter) {
6518
- const processor = unified5().use(remarkParse4).use(remarkMdx3).use(remarkFrontmatter2, ["yaml"]).use(this.propFormatter.propsToMarkdownList()).use(this.formatFrontmatterExpressions(frontmatter)).use(await formatThemeNodes()).use(formatDemos(pageInfo.demosFolder)).use(this.transformRelativeUrls(pageInfo.url));
6800
+ const processor = unified5().use(remarkParse4).use(remarkMdx3).use(remarkFrontmatter3, ["yaml"]).use(this.propFormatter.propsToMarkdownList()).use(this.formatFrontmatterExpressions(frontmatter)).use(await formatThemeNodes()).use(formatDemos(pageInfo.demosFolder)).use(filterTextDirectives).use(this.transformRelativeUrls(pageInfo.url));
6519
6801
  this.applyPlugins(pageInfo, processor);
6520
6802
  processor.use(remarkStringify4);
6521
6803
  return await processor.run(processor.parse(mdxContent));
@@ -6526,7 +6808,7 @@ var KnowledgeGenerator = class {
6526
6808
  if (this.config.verbose) {
6527
6809
  console.log(`Processing page: ${pageInfo.name}`);
6528
6810
  }
6529
- const processor = unified5().use(remarkParse4).use(remarkMdx3).use(formatNpmInstallTabs).use(remarkFrontmatter2, ["yaml"]).use(remarkParseFrontmatter2).use(remarkStringify4);
6811
+ const processor = unified5().use(remarkParse4).use(remarkMdx3).use(formatNpmInstallTabs).use(remarkFrontmatter3, ["yaml"]).use(remarkParseFrontmatter2).use(remarkStringify4);
6530
6812
  const parsed = await processor.process(mdxContent);
6531
6813
  const frontmatter = parsed.data?.frontmatter || {};
6532
6814
  const ast = await this.processMdxContent(
@@ -6534,7 +6816,7 @@ var KnowledgeGenerator = class {
6534
6816
  pageInfo,
6535
6817
  frontmatter
6536
6818
  );
6537
- const removeJsxProcessor = unified5().use(remarkMdx3).use(remarkFrontmatter2, ["yaml"]).use(remarkRemoveJsx).use(remarkStringify4);
6819
+ const removeJsxProcessor = unified5().use(remarkMdx3).use(remarkFrontmatter3, ["yaml"]).use(remarkRemoveJsx).use(remarkStringify4);
6538
6820
  const sectionAst = removeJsxProcessor.runSync(ast);
6539
6821
  const removedJsx = String(removeJsxProcessor.stringify(sectionAst));
6540
6822
  const rawContent = removedJsx.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "").replace(/(^#{1,6} .*\\<[^>]+)>/gm, "$1\\>");
@@ -6604,7 +6886,7 @@ var KnowledgeGenerator = class {
6604
6886
  extraFiles.map(async (extraFile) => {
6605
6887
  let contents = extraFile.contents;
6606
6888
  if (extraFile.processAsMdx) {
6607
- const removeJsxProcessor = unified5().use(remarkParse4).use(remarkMdx3).use(remarkFrontmatter2, ["yaml"]).use(remarkRemoveJsx).use(this.transformRelativeUrls()).use(remarkStringify4);
6889
+ const removeJsxProcessor = unified5().use(remarkParse4).use(remarkMdx3).use(remarkFrontmatter3, ["yaml"]).use(remarkRemoveJsx).use(this.transformRelativeUrls()).use(remarkStringify4);
6608
6890
  contents = String(await removeJsxProcessor.process(contents));
6609
6891
  }
6610
6892
  const lines = [];
@@ -6624,7 +6906,7 @@ var KnowledgeGenerator = class {
6624
6906
  lines.push("");
6625
6907
  const fileContent = lines.join("\n");
6626
6908
  const fileName = `${kebabCase3(extraFile.id)}.md`;
6627
- const outfile = `${resolve4(this.config.outputPath)}/${fileName}`;
6909
+ const outfile = `${resolve5(this.config.outputPath)}/${fileName}`;
6628
6910
  await writeFile(outfile, fileContent, "utf-8");
6629
6911
  const stats = await stat(outfile);
6630
6912
  totalSize += stats.size / 1024;
@@ -6727,7 +7009,7 @@ var KnowledgeGenerator = class {
6727
7009
  lines.push("");
6728
7010
  const fileContent = lines.join("\n");
6729
7011
  const fileName = `${kebabCase3(page.id || page.name)}.md`;
6730
- const outfile = `${resolve4(this.config.outputPath)}/${fileName}`;
7012
+ const outfile = `${resolve5(this.config.outputPath)}/${fileName}`;
6731
7013
  await writeFile(outfile, fileContent, "utf-8");
6732
7014
  const stats = await stat(outfile);
6733
7015
  totalSize += stats.size / 1024;
@@ -6763,7 +7045,7 @@ var KnowledgeGenerator = class {
6763
7045
  );
6764
7046
  }
6765
7047
  console.log(
6766
- `Generated ${count + extraFilesResult.count} files(s) in ${chalk3.magenta.bold(`${Math.round(performance.now() - start + extraFilesResult.duration)}ms`)} at ${chalk3.blue.bold(this.config.outputPath)} - ${(totalSize + extraFilesResult.totalSize).toFixed(1)} KB`
7048
+ `Generated ${count + extraFilesResult.count} files(s) in ${chalk4.magenta.bold(`${Math.round(performance.now() - start + extraFilesResult.duration)}ms`)} at ${chalk4.blue.bold(this.config.outputPath)} - ${(totalSize + extraFilesResult.totalSize).toFixed(1)} KB`
6767
7049
  );
6768
7050
  }
6769
7051
  computeAggregateHash(entries) {
@@ -6785,7 +7067,7 @@ var KnowledgeGenerator = class {
6785
7067
  await mkdir(outputPath, { recursive: true }).catch(() => {
6786
7068
  });
6787
7069
  await writeFile(
6788
- join6(outputPath, "manifest.json"),
7070
+ join7(outputPath, "manifest.json"),
6789
7071
  JSON.stringify(manifest, null, 2),
6790
7072
  "utf-8"
6791
7073
  );
@@ -6794,10 +7076,10 @@ var KnowledgeGenerator = class {
6794
7076
  async generateBulkZip(outputPath, entries) {
6795
7077
  await mkdir(outputPath, { recursive: true }).catch(() => {
6796
7078
  });
6797
- const zipPath = join6(outputPath, "bulk.zip");
7079
+ const zipPath = join7(outputPath, "bulk.zip");
6798
7080
  const zip = new AdmZip();
6799
7081
  for (const entry of entries) {
6800
- const filePath = join6(this.config.outputPath, entry.path);
7082
+ const filePath = join7(this.config.outputPath, entry.path);
6801
7083
  const content = await readFile4(filePath);
6802
7084
  zip.addFile(entry.path, content);
6803
7085
  }
@@ -6830,7 +7112,7 @@ var KnowledgeGenerator = class {
6830
7112
  totalSections: allSections.length,
6831
7113
  version: 1
6832
7114
  };
6833
- const sectionsPath = join6(
7115
+ const sectionsPath = join7(
6834
7116
  outputPath,
6835
7117
  sectionsConfig.outputPath ?? "sections.json"
6836
7118
  );
@@ -6839,7 +7121,7 @@ var KnowledgeGenerator = class {
6839
7121
  await writeFile(sectionsPath, JSON.stringify(output, null, 2), "utf-8");
6840
7122
  if (this.config.verbose) {
6841
7123
  console.log(
6842
- `Generated ${allSections.length} sections at ${chalk3.blue.bold(sectionsPath)}`
7124
+ `Generated ${allSections.length} sections at ${chalk4.blue.bold(sectionsPath)}`
6843
7125
  );
6844
7126
  }
6845
7127
  }
@@ -6889,7 +7171,7 @@ Generated knowledge for ${configs.length} environment(s)`
6889
7171
  // src/ai-knowledge/open-web-ui/download-knowledge.ts
6890
7172
  import dotenv from "dotenv";
6891
7173
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
6892
- import { resolve as resolve5 } from "node:path";
7174
+ import { resolve as resolve6 } from "node:path";
6893
7175
 
6894
7176
  // src/ai-knowledge/open-web-ui/api.ts
6895
7177
  function isErrorResponse(response) {
@@ -7000,7 +7282,7 @@ var FilesApi = class {
7000
7282
  if (status.status === "completed" || status.status === "failed") {
7001
7283
  return status;
7002
7284
  }
7003
- await new Promise((resolve10) => setTimeout(resolve10, intervalMs));
7285
+ await new Promise((resolve11) => setTimeout(resolve11, intervalMs));
7004
7286
  }
7005
7287
  throw new Error(`File processing timed out after ${maxAttempts} attempts`);
7006
7288
  }
@@ -7214,7 +7496,7 @@ function addDownloadKnowledgeCommand() {
7214
7496
  const content = await filesApi.getDataContent(file.id);
7215
7497
  if (content?.content) {
7216
7498
  await writeFile2(
7217
- resolve5(opts.outputDir, fileName),
7499
+ resolve6(opts.outputDir, fileName),
7218
7500
  content.content,
7219
7501
  "utf-8"
7220
7502
  );
@@ -7230,7 +7512,7 @@ function addDownloadKnowledgeCommand() {
7230
7512
  import { createHash as createHash3 } from "node:crypto";
7231
7513
  import { writeFileSync } from "node:fs";
7232
7514
  import { access as access2, readdir as readdir2, readFile as readFile5, stat as stat2 } from "node:fs/promises";
7233
- import { resolve as resolve6 } from "node:path";
7515
+ import { resolve as resolve7 } from "node:path";
7234
7516
  import { setTimeout as setTimeout2 } from "node:timers/promises";
7235
7517
  import ora from "ora";
7236
7518
 
@@ -7437,7 +7719,7 @@ var Uploader = class {
7437
7719
  const files = await Promise.all(
7438
7720
  fileNames.map(async (name) => ({
7439
7721
  contents: await readFile5(
7440
- resolve6(this.config.knowledgeFilePath, name),
7722
+ resolve7(this.config.knowledgeFilePath, name),
7441
7723
  "utf-8"
7442
7724
  ),
7443
7725
  name
@@ -7489,7 +7771,7 @@ var Uploader = class {
7489
7771
  try {
7490
7772
  const fileId = knowledgeFile.id;
7491
7773
  const fileString = await readFile5(
7492
- resolve6(this.config.knowledgeFilePath, name),
7774
+ resolve7(this.config.knowledgeFilePath, name),
7493
7775
  "utf-8"
7494
7776
  );
7495
7777
  const spinner2 = ora(`Updating ${name}`).start();
@@ -7504,7 +7786,7 @@ var Uploader = class {
7504
7786
  }
7505
7787
  const spinner = ora(`Uploading ${name}`).start();
7506
7788
  const fileBuffer = await readFile5(
7507
- resolve6(this.config.knowledgeFilePath, name)
7789
+ resolve7(this.config.knowledgeFilePath, name)
7508
7790
  );
7509
7791
  let uploadedFileId = void 0;
7510
7792
  try {
@@ -7542,7 +7824,7 @@ var Uploader = class {
7542
7824
  }
7543
7825
  }
7544
7826
  async uploadKnowledge() {
7545
- const resolvedPath = resolve6(this.config.knowledgeFilePath);
7827
+ const resolvedPath = resolve7(this.config.knowledgeFilePath);
7546
7828
  if (!await access2(resolvedPath).then(() => true).catch(() => false)) {
7547
7829
  throw new Error(`File or folder not found at ${resolvedPath}`);
7548
7830
  }
@@ -7629,7 +7911,7 @@ Uploaded to ${successCount} integration(s)${failureCount > 0 ? `, ${failureCount
7629
7911
  const files = await uploader.filesApi.search("*");
7630
7912
  console.debug(`found ${files.length} files`);
7631
7913
  writeFileSync(
7632
- resolve6(uploader.config.knowledgeFilePath, "files.json"),
7914
+ resolve7(uploader.config.knowledgeFilePath, "files.json"),
7633
7915
  JSON.stringify(files, null, 2),
7634
7916
  "utf-8"
7635
7917
  );
@@ -7672,9 +7954,9 @@ Uploaded to ${successCount} integration(s)${failureCount > 0 ? `, ${failureCount
7672
7954
  }
7673
7955
 
7674
7956
  // src/docs-plugin/generate-page-map.ts
7675
- import { glob } from "glob";
7957
+ import { glob as glob2 } from "glob";
7676
7958
  import { writeFile as writeFile3 } from "node:fs/promises";
7677
- import { resolve as resolve7 } from "node:path";
7959
+ import { resolve as resolve8 } from "node:path";
7678
7960
  import { cwd } from "node:process";
7679
7961
  function addGeneratePageMapCommand() {
7680
7962
  program.command("generate-page-map").description(
@@ -7695,14 +7977,14 @@ function addGeneratePageMapCommand() {
7695
7977
  const configLoader = new ConfigLoader({ configFile: options.configFile });
7696
7978
  const resolvedConfig = configLoader.loadConfig();
7697
7979
  const routesDir = fixPath(
7698
- resolve7(resolvedConfig.appDirectory, resolvedConfig.pageDirectory)
7980
+ resolve8(resolvedConfig.appDirectory, resolvedConfig.pageDirectory)
7699
7981
  );
7700
7982
  const indexer = new SearchIndexer({
7701
7983
  ...resolvedConfig,
7702
- srcDir: fixPath(resolve7(cwd(), resolvedConfig.appDirectory)),
7984
+ srcDir: fixPath(resolve8(cwd(), resolvedConfig.appDirectory)),
7703
7985
  typeDocProps: {}
7704
7986
  });
7705
- const files = glob.sync(
7987
+ const files = glob2.sync(
7706
7988
  [`${routesDir}/**/*.mdx`, `${routesDir}/**/*.tsx`],
7707
7989
  {
7708
7990
  absolute: true,
@@ -7711,7 +7993,7 @@ function addGeneratePageMapCommand() {
7711
7993
  );
7712
7994
  indexer.buildIndex(files, true);
7713
7995
  await writeFile3(
7714
- resolve7(cwd(), options.output),
7996
+ resolve8(cwd(), options.output),
7715
7997
  JSON.stringify(indexer.pageMap, null, 2),
7716
7998
  "utf-8"
7717
7999
  );
@@ -7726,16 +8008,16 @@ function addGeneratePageMapCommand() {
7726
8008
  }
7727
8009
 
7728
8010
  // src/react-demo-plugin/generate-lazy-demo-map.ts
7729
- import { glob as glob2 } from "glob";
8011
+ import { glob as glob3 } from "glob";
7730
8012
  import { uniqBy } from "lodash-es";
7731
8013
  import { writeFile as writeFile4 } from "node:fs/promises";
7732
- import { resolve as resolve9 } from "node:path";
7733
- import { dedent } from "@qualcomm-ui/utils/dedent";
8014
+ import { resolve as resolve10 } from "node:path";
8015
+ import { dedent as dedent2 } from "@qualcomm-ui/utils/dedent";
7734
8016
 
7735
8017
  // src/react-demo-plugin/demo-plugin-utils.ts
7736
- import chalk4 from "chalk";
7737
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
7738
- import { dirname as dirname4, join as join7, relative as relative3, resolve as resolve8, sep } from "node:path";
8018
+ import chalk5 from "chalk";
8019
+ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
8020
+ import { dirname as dirname4, join as join8, relative as relative3, resolve as resolve9, sep } from "node:path";
7739
8021
  import * as ts2 from "typescript";
7740
8022
  import { pascalCase } from "@qualcomm-ui/utils/change-case";
7741
8023
  function extractPageId(filePath, routesDir) {
@@ -7749,7 +8031,7 @@ function extractPageId(filePath, routesDir) {
7749
8031
  }
7750
8032
  function isDemoFile(filePath) {
7751
8033
  try {
7752
- return filePath.includes("/demos/") && filePath.endsWith(".tsx") && !readFileSync2(filePath).includes("export default");
8034
+ return filePath.includes("/demos/") && filePath.endsWith(".tsx") && !readFileSync3(filePath).includes("export default");
7753
8035
  } catch (error) {
7754
8036
  return false;
7755
8037
  }
@@ -7760,7 +8042,7 @@ async function scanForDemoPages({
7760
8042
  demoPattern = "src/routes/**/demos/*.tsx",
7761
8043
  routesDir = "src/routes"
7762
8044
  }) {
7763
- const demoFiles = (await glob2(demoPattern)).filter((file) => isDemoFile(file));
8045
+ const demoFiles = (await glob3(demoPattern)).filter((file) => isDemoFile(file));
7764
8046
  return uniqBy(
7765
8047
  demoFiles.map((file) => ({
7766
8048
  pageId: extractPageId(file, routesDir),
@@ -7774,7 +8056,7 @@ function generateLazyDemoLoader(demoPages) {
7774
8056
  return ` "${routePath}": () =>
7775
8057
  import("virtual:qui-demo-scope/page:${pageId}")`;
7776
8058
  }).sort().join(",\n");
7777
- return dedent`
8059
+ return dedent2`
7778
8060
  /* eslint-disable */
7779
8061
 
7780
8062
  // This file is generated automatically. Don't edit it directly.
@@ -7792,7 +8074,7 @@ function generateLazyDemoLoader(demoPages) {
7792
8074
  }
7793
8075
  async function generateLazyDemoMap(options) {
7794
8076
  const routesDir = options.routesDir;
7795
- const outputPath = resolve9(options.output);
8077
+ const outputPath = resolve10(options.output);
7796
8078
  console.log(`Scanning for demo pages in: ${routesDir}`);
7797
8079
  const demoPages = await scanForDemoPages({ routesDir });
7798
8080
  console.log(`Found ${demoPages.length} pages with demos`);