@qualcomm-ui/mdx-vite 3.0.2 → 3.1.0
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 +29 -30
- package/dist/cli.js.map +3 -3
- package/dist/docs-plugin/markdown/knowledge/knowledge-exporter.d.ts +5 -1
- package/dist/docs-plugin/markdown/knowledge/knowledge-exporter.d.ts.map +1 -1
- package/dist/docs-plugin/markdown/knowledge/section-extractor.d.ts +0 -5
- package/dist/docs-plugin/markdown/knowledge/section-extractor.d.ts.map +1 -1
- package/dist/docs-plugin/markdown/knowledge/types.d.ts +8 -0
- package/dist/docs-plugin/markdown/knowledge/types.d.ts.map +1 -1
- package/dist/docs-plugin/markdown/remark-pipeline.d.ts +2 -2
- package/dist/docs-plugin/markdown/remark-pipeline.d.ts.map +1 -1
- package/dist/docs-plugin/plugin-state.d.ts +1 -0
- package/dist/docs-plugin/plugin-state.d.ts.map +1 -1
- package/dist/docs-plugin/remark/remark-frontmatter-title.d.ts +3 -4
- package/dist/docs-plugin/remark/remark-frontmatter-title.d.ts.map +1 -1
- package/dist/docs-plugin/search-indexer.d.ts.map +1 -1
- package/dist/index.js +118 -101
- package/dist/index.js.map +3 -3
- package/dist/tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { KnowledgePages, KnowledgeSections } from "@qualcomm-ui/mdx-common";
|
|
2
2
|
import type { KnowledgeExtraFile, KnowledgeFrontmatterConfig, PagesExportConfig, SectionExportConfig } from "../../config";
|
|
3
3
|
import type { MdxFileReader } from "../markdown-file-reader";
|
|
4
|
+
import type { KnowledgePageCache } from "./types";
|
|
4
5
|
export interface KnowledgeExporterConfig {
|
|
5
6
|
baseUrl?: string;
|
|
6
7
|
docPropsPath?: string;
|
|
@@ -18,13 +19,16 @@ export interface KnowledgeExporterConfig {
|
|
|
18
19
|
* Does not write files — the caller handles persistence.
|
|
19
20
|
*/
|
|
20
21
|
export declare class KnowledgeExporter {
|
|
22
|
+
private readonly cache;
|
|
21
23
|
private readonly config;
|
|
22
24
|
private readonly fileReader;
|
|
23
25
|
private readonly propFormatter;
|
|
24
|
-
constructor(config: KnowledgeExporterConfig, fileReader: MdxFileReader);
|
|
26
|
+
constructor(config: KnowledgeExporterConfig, fileReader: MdxFileReader, cache?: KnowledgePageCache);
|
|
25
27
|
generate(): Promise<{
|
|
28
|
+
cachedPageCount: number;
|
|
26
29
|
pages: KnowledgePages;
|
|
27
30
|
sections: KnowledgeSections;
|
|
31
|
+
totalPageCount: number;
|
|
28
32
|
}>;
|
|
29
33
|
private scanPages;
|
|
30
34
|
private formatFrontmatterExpressions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knowledge-exporter.d.ts","sourceRoot":"","sources":["../../../../src/docs-plugin/markdown/knowledge/knowledge-exporter.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,cAAc,EACd,iBAAiB,
|
|
1
|
+
{"version":3,"file":"knowledge-exporter.d.ts","sourceRoot":"","sources":["../../../../src/docs-plugin/markdown/knowledge/knowledge-exporter.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,cAAc,EACd,iBAAiB,EAIlB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,KAAK,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAKrB,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAA;AAY1D,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,SAAS,CAAA;AAGhB,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAA;IACjC,WAAW,CAAC,EAAE,0BAA0B,CAAA;IACxC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,iBAAiB,CAAA;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,mBAAmB,CAAA;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;gBAG3C,MAAM,EAAE,uBAAuB,EAC/B,UAAU,EAAE,aAAa,EACzB,KAAK,CAAC,EAAE,kBAAkB;IAYtB,QAAQ,IAAI,OAAO,CAAC;QACxB,eAAe,EAAE,MAAM,CAAA;QACvB,KAAK,EAAE,cAAc,CAAA;QACrB,QAAQ,EAAE,iBAAiB,CAAA;QAC3B,cAAc,EAAE,MAAM,CAAA;KACvB,CAAC;YAuIY,SAAS;IAwEvB,OAAO,CAAC,4BAA4B;IAkDpC,OAAO,CAAC,qBAAqB;YAcf,iBAAiB;YAyBjB,cAAc;YAgDd,iBAAiB;CAkDhC"}
|
|
@@ -46,11 +46,6 @@ export declare class SectionExtractor {
|
|
|
46
46
|
private buildSectionEntry;
|
|
47
47
|
private extractTerms;
|
|
48
48
|
private parseTermsBlock;
|
|
49
|
-
/**
|
|
50
|
-
* Convert links to inline code. URLs are not relevant for text embeddings
|
|
51
|
-
* and will muddy the vector storage.
|
|
52
|
-
*/
|
|
53
|
-
private transformLinks;
|
|
54
49
|
private nodesToRawContent;
|
|
55
50
|
private nodesToContent;
|
|
56
51
|
private generateSectionId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"section-extractor.d.ts","sourceRoot":"","sources":["../../../../src/docs-plugin/markdown/knowledge/section-extractor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAqB,IAAI,EAAoB,MAAM,OAAO,CAAA;AAOtE,OAAO,KAAK,EAEV,SAAS,EACT,WAAW,EACX,YAAY,EAGb,MAAM,yBAAyB,CAAA;AAOhC,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IAEjB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAeD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,GAAG,EAAE,WAAW,EAAE,CAAA;CACnB;
|
|
1
|
+
{"version":3,"file":"section-extractor.d.ts","sourceRoot":"","sources":["../../../../src/docs-plugin/markdown/knowledge/section-extractor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAqB,IAAI,EAAoB,MAAM,OAAO,CAAA;AAOtE,OAAO,KAAK,EAEV,SAAS,EACT,WAAW,EACX,YAAY,EAGb,MAAM,yBAAyB,CAAA;AAOhC,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IAEjB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IAEzB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAeD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,YAAY,EAAE,CAAA;IACxB,GAAG,EAAE,WAAW,EAAE,CAAA;CACnB;AA+BD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;IACzC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;gBAEzB,OAAO,CAAC,EAAE,uBAAuB;IAO7C;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,gBAAgB;IA2FzD;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,IAAI;IA6B7D,OAAO,CAAC,iBAAiB;IAmEzB,OAAO,CAAC,YAAY;IAwCpB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,iBAAiB;CAG1B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Root } from "mdast";
|
|
2
|
+
import type { PageEntry, SectionEntry } from "@qualcomm-ui/mdx-common";
|
|
2
3
|
import type { QuiComment } from "@qualcomm-ui/typedoc-common";
|
|
3
4
|
export interface ImportedModule {
|
|
4
5
|
content: string;
|
|
@@ -40,4 +41,11 @@ export interface MdxFlowExpression {
|
|
|
40
41
|
type: "mdxFlowExpression";
|
|
41
42
|
value: string;
|
|
42
43
|
}
|
|
44
|
+
export interface KnowledgePageCacheEntry {
|
|
45
|
+
contentHash: string;
|
|
46
|
+
pageEntry: PageEntry | null;
|
|
47
|
+
processedPage: ProcessedPage;
|
|
48
|
+
sections: SectionEntry[];
|
|
49
|
+
}
|
|
50
|
+
export type KnowledgePageCache = Map<string, KnowledgePageCacheEntry>;
|
|
43
51
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/docs-plugin/markdown/knowledge/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,OAAO,CAAA;AAE/B,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,6BAA6B,CAAA;AAE3D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAA;IACnB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CACtC;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAA;IAClB,iEAAiE;IACjE,UAAU,EAAE,IAAI,CAAA;IAChB,KAAK,EAAE,MA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WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAA;IAClB,iEAAiE;IACjE,UAAU,EAAE,IAAI,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,mBAAmB,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAA;IAC3B,aAAa,EAAE,aAAa,CAAA;IAC5B,QAAQ,EAAE,YAAY,EAAE,CAAA;CACzB;AAED,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PluggableList
|
|
1
|
+
import { type PluggableList } from "unified";
|
|
2
2
|
import type { PageFrontmatter } from "@qualcomm-ui/mdx-common";
|
|
3
3
|
export interface RemarkPipelineOptions {
|
|
4
4
|
/** GitHub-style alert blocks. */
|
|
@@ -32,5 +32,5 @@ export interface RemarkPipelineOptions {
|
|
|
32
32
|
* Creates a configured unified remark processor. The caller can further extend
|
|
33
33
|
* the returned processor with `.use()` (e.g. to add remarkRehype for HTML output).
|
|
34
34
|
*/
|
|
35
|
-
export declare function createRemarkProcessor(options?: RemarkPipelineOptions): Processor<
|
|
35
|
+
export declare function createRemarkProcessor(options?: RemarkPipelineOptions): import("unified").Processor<import("mdast").Root, undefined, undefined, undefined, undefined>;
|
|
36
36
|
//# sourceMappingURL=remark-pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-pipeline.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/markdown/remark-pipeline.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"remark-pipeline.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/markdown/remark-pipeline.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,KAAK,aAAa,EAAU,MAAM,SAAS,CAAA;AAEnD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAU5D,MAAM,WAAW,qBAAqB;IACpC,iCAAiC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;IAC/C,uDAAuD;IACvD,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,sDAAsD;IACtD,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,8DAA8D;IAC9D,sBAAsB,CAAC,EAAE,eAAe,CAAA;IACxC,yCAAyC;IACzC,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IACtB,oEAAoE;IACpE,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,kCAAkC;IAClC,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,qBAA0B,iGAiDxE"}
|
|
@@ -27,6 +27,7 @@ export declare class PluginState {
|
|
|
27
27
|
indexer: SearchIndexer;
|
|
28
28
|
configLoader: ConfigLoader | null;
|
|
29
29
|
knowledgeConfig: ResolvedQuiDocsConfig["knowledge"];
|
|
30
|
+
private knowledgePageCache;
|
|
30
31
|
pages: KnowledgePages | null;
|
|
31
32
|
sections: KnowledgeSections | null;
|
|
32
33
|
routesDir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-state.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/plugin-state.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,MAAM,CAAA;AAEvC,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAEjB,QAAQ,EACT,MAAM,yBAAyB,CAAA;AAGhC,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,UAAU,CAAA;AACnD,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAC,KAAK,eAAe,EAAgB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"plugin-state.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/plugin-state.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,MAAM,CAAA;AAEvC,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAEjB,QAAQ,EACT,MAAM,yBAAyB,CAAA;AAGhC,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,UAAU,CAAA;AACnD,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAA;AACnD,OAAO,EAAC,KAAK,eAAe,EAAgB,MAAM,YAAY,CAAA;AAI9D,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAA;AAK9C,eAAO,MAAM,wBAAwB,mCAAmC,CAAA;AACxE,eAAO,MAAM,wBAAwB,sCAAsC,CAAA;AAC3E,eAAO,MAAM,yBAAyB,gDACS,CAAA;AAE/C,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,EAAE,CAAA;CACpB;AAED;;GAEG;AACH,qBAAa,WAAW;IACtB,UAAU,EAAE,MAAM,CAAI;IACtB,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAO;IAC3C,cAAc,EAAE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CAWR"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Root } from "mdast";
|
|
2
2
|
import type { Plugin } from "unified";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* purposes.
|
|
4
|
+
* Replaces the first h1 heading in the document with a `PageHeader`
|
|
5
|
+
* JSX element. This allows the page title to be enhanced with extra features
|
|
6
|
+
* like a since tag or a copy markdown button.
|
|
8
7
|
*/
|
|
9
8
|
export declare const remarkFrontmatterTitle: Plugin<[], Root>;
|
|
10
9
|
//# sourceMappingURL=remark-frontmatter-title.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-frontmatter-title.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/remark-frontmatter-title.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,IAAI,EAAC,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"remark-frontmatter-title.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/remark-frontmatter-title.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkB,IAAI,EAAC,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAGnC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,CAuBnD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-indexer.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/search-indexer.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,OAAO,EAEP,OAAO,EACP,WAAW,EAEZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAG7D,OAAO,KAAK,EAAC,oBAAoB,EAA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D,OAAO,CAAC,aAAa,CAAY;IAEjC,IAAI,QAAQ,IAAI,OAAO,EAAE,CAExB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IACD,OAAO,CAAC,QAAQ,CAAc;IAE9B,IAAI,WAAW,IAAI,WAAW,EAAE,CAE/B;IACD,OAAO,CAAC,YAAY,CAAoB;IAExC,KAAK,IAAI,IAAI;gBAOX,MAAM,EAAE,oBAAoB,EAC5B,WAAW,UAAO,EAElB,MAAM,GAAE;QACN,eAAe,CAAC,EAAE,eAAe,CAAA;QACjC,aAAa,CAAC,EAAE,aAAa,CAAA;QAC7B,UAAU,CAAC,EAAE,UAAU,CAAA;QACvB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;KAC/B;IA+BR;;;OAGG;IACH,OAAO,CAAC,YAAY;IAgEpB;;;OAGG;IACH,OAAO,CAAC,cAAc;IA2ItB,OAAO,CAAC,qBAAqB;IAiB7B,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,cAAc;IAqBtB,UAAU,CACR,aAAa,EAAE,MAAM,EAAE,EACvB,WAAW,GAAE,OAAc,GAC1B,eAAe,EAAE;CA6CrB"}
|
package/dist/index.js
CHANGED
|
@@ -981,39 +981,24 @@ var remarkFrontmatterInterpolation = (frontmatter) => {
|
|
|
981
981
|
};
|
|
982
982
|
|
|
983
983
|
// src/docs-plugin/remark/remark-frontmatter-title.ts
|
|
984
|
-
import { visit as visit6 } from "unist-util-visit";
|
|
985
|
-
function isMdxTextExpression(node) {
|
|
986
|
-
const n = node;
|
|
987
|
-
return n.type === "mdxTextExpression" && typeof n.value === "string";
|
|
988
|
-
}
|
|
984
|
+
import { EXIT, visit as visit6 } from "unist-util-visit";
|
|
989
985
|
var remarkFrontmatterTitle = () => {
|
|
990
986
|
return (tree) => {
|
|
991
987
|
visit6(
|
|
992
988
|
tree,
|
|
993
989
|
"heading",
|
|
994
990
|
(node, index, parent) => {
|
|
995
|
-
if (index === void 0 || !parent) {
|
|
996
|
-
return;
|
|
997
|
-
}
|
|
998
|
-
const hasFrontmatterTitle = node.children.some(
|
|
999
|
-
(child) => isMdxTextExpression(child) && child.value.trim() === "frontmatter.title"
|
|
1000
|
-
);
|
|
1001
|
-
if (!hasFrontmatterTitle) {
|
|
991
|
+
if (index === void 0 || !parent || node.depth !== 1) {
|
|
1002
992
|
return;
|
|
1003
993
|
}
|
|
1004
994
|
const wrappedNode = {
|
|
1005
|
-
attributes: [
|
|
1006
|
-
{
|
|
1007
|
-
name: "data-page-title",
|
|
1008
|
-
type: "mdxJsxAttribute",
|
|
1009
|
-
value: ""
|
|
1010
|
-
}
|
|
1011
|
-
],
|
|
995
|
+
attributes: [],
|
|
1012
996
|
children: node.children,
|
|
1013
|
-
name:
|
|
997
|
+
name: "PageHeader",
|
|
1014
998
|
type: "mdxJsxFlowElement"
|
|
1015
999
|
};
|
|
1016
1000
|
parent.children[index] = wrappedNode;
|
|
1001
|
+
return EXIT;
|
|
1017
1002
|
}
|
|
1018
1003
|
);
|
|
1019
1004
|
};
|
|
@@ -1301,7 +1286,7 @@ function createRemarkProcessor(options = {}) {
|
|
|
1301
1286
|
|
|
1302
1287
|
// src/docs-plugin/markdown/knowledge/knowledge-exporter.ts
|
|
1303
1288
|
import { minimatch as minimatch2 } from "minimatch";
|
|
1304
|
-
import { readdir
|
|
1289
|
+
import { readdir } from "node:fs/promises";
|
|
1305
1290
|
import { join as join5, relative } from "node:path";
|
|
1306
1291
|
import { visit as visit16 } from "unist-util-visit";
|
|
1307
1292
|
|
|
@@ -2427,6 +2412,24 @@ import remarkGfm2 from "remark-gfm";
|
|
|
2427
2412
|
import remarkStringify3 from "remark-stringify";
|
|
2428
2413
|
import { unified as unified3 } from "unified";
|
|
2429
2414
|
import { visit as visit15 } from "unist-util-visit";
|
|
2415
|
+
function transformLinks() {
|
|
2416
|
+
return () => (tree) => {
|
|
2417
|
+
visit15(tree, "link", (node) => {
|
|
2418
|
+
let text = "";
|
|
2419
|
+
visit15(node, "text", (textNode) => {
|
|
2420
|
+
text += textNode.value;
|
|
2421
|
+
});
|
|
2422
|
+
Object.assign(node, {
|
|
2423
|
+
children: void 0,
|
|
2424
|
+
type: "inlineCode",
|
|
2425
|
+
url: void 0,
|
|
2426
|
+
value: text
|
|
2427
|
+
});
|
|
2428
|
+
});
|
|
2429
|
+
};
|
|
2430
|
+
}
|
|
2431
|
+
var rawProcessor = unified3().use(remarkGfm2).use(remarkStringify3);
|
|
2432
|
+
var contentProcessor = unified3().use(remarkGfm2).use(transformLinks()).use(remarkStringify3);
|
|
2430
2433
|
var SectionExtractor = class {
|
|
2431
2434
|
depths;
|
|
2432
2435
|
minContentLength;
|
|
@@ -2618,36 +2621,14 @@ var SectionExtractor = class {
|
|
|
2618
2621
|
const content = closeIndex !== -1 ? afterOpen.slice(0, closeIndex) : afterOpen;
|
|
2619
2622
|
return content.split("\n").map((line) => line.trim()).filter((line) => line && line !== ":::");
|
|
2620
2623
|
}
|
|
2621
|
-
/**
|
|
2622
|
-
* Convert links to inline code. URLs are not relevant for text embeddings
|
|
2623
|
-
* and will muddy the vector storage.
|
|
2624
|
-
*/
|
|
2625
|
-
transformLinks() {
|
|
2626
|
-
return () => (tree) => {
|
|
2627
|
-
visit15(tree, "link", (node) => {
|
|
2628
|
-
let text = "";
|
|
2629
|
-
visit15(node, "text", (textNode) => {
|
|
2630
|
-
text += textNode.value;
|
|
2631
|
-
});
|
|
2632
|
-
Object.assign(node, {
|
|
2633
|
-
children: void 0,
|
|
2634
|
-
type: "inlineCode",
|
|
2635
|
-
url: void 0,
|
|
2636
|
-
value: text
|
|
2637
|
-
});
|
|
2638
|
-
});
|
|
2639
|
-
};
|
|
2640
|
-
}
|
|
2641
2624
|
nodesToRawContent(nodes) {
|
|
2642
2625
|
const tree = { children: nodes, type: "root" };
|
|
2643
|
-
|
|
2644
|
-
return processor.stringify(tree);
|
|
2626
|
+
return rawProcessor.stringify(tree);
|
|
2645
2627
|
}
|
|
2646
2628
|
nodesToContent(nodes) {
|
|
2647
2629
|
const tree = { children: structuredClone(nodes), type: "root" };
|
|
2648
|
-
const
|
|
2649
|
-
|
|
2650
|
-
return processor.stringify(transformed);
|
|
2630
|
+
const transformed = contentProcessor.runSync(tree);
|
|
2631
|
+
return contentProcessor.stringify(transformed);
|
|
2651
2632
|
}
|
|
2652
2633
|
generateSectionId(headerPath) {
|
|
2653
2634
|
return headerPath.map((h) => slugify(h)).join("-");
|
|
@@ -2656,10 +2637,12 @@ var SectionExtractor = class {
|
|
|
2656
2637
|
|
|
2657
2638
|
// src/docs-plugin/markdown/knowledge/knowledge-exporter.ts
|
|
2658
2639
|
var KnowledgeExporter = class {
|
|
2640
|
+
cache;
|
|
2659
2641
|
config;
|
|
2660
2642
|
fileReader;
|
|
2661
2643
|
propFormatter;
|
|
2662
|
-
constructor(config, fileReader) {
|
|
2644
|
+
constructor(config, fileReader, cache) {
|
|
2645
|
+
this.cache = cache ?? /* @__PURE__ */ new Map();
|
|
2663
2646
|
this.config = config;
|
|
2664
2647
|
this.fileReader = fileReader;
|
|
2665
2648
|
this.propFormatter = new PropFormatter({
|
|
@@ -2684,52 +2667,76 @@ var KnowledgeExporter = class {
|
|
|
2684
2667
|
} else if (this.config.verbose) {
|
|
2685
2668
|
console.log(`Found ${pageInfos.length} page(s)`);
|
|
2686
2669
|
}
|
|
2687
|
-
|
|
2670
|
+
let cachedCount = 0;
|
|
2671
|
+
const currentFiles = /* @__PURE__ */ new Set();
|
|
2672
|
+
const allSections = [];
|
|
2673
|
+
const allPages = [];
|
|
2674
|
+
const sectionsConfig = this.config.sections ?? {};
|
|
2675
|
+
const extractor = new SectionExtractor({
|
|
2676
|
+
depths: sectionsConfig.depths,
|
|
2677
|
+
minContentLength: sectionsConfig.minContentLength,
|
|
2678
|
+
pageIdPrefix: this.config.pageIdPrefix
|
|
2679
|
+
});
|
|
2688
2680
|
for (const page of pageInfos) {
|
|
2681
|
+
currentFiles.add(page.mdxFile);
|
|
2689
2682
|
try {
|
|
2690
2683
|
if (this.config.verbose) {
|
|
2691
2684
|
console.log(`Processing page: ${page.name}`);
|
|
2692
2685
|
}
|
|
2693
|
-
const
|
|
2694
|
-
|
|
2686
|
+
const { fileContents, frontmatter } = this.fileReader.readFileSync(
|
|
2687
|
+
page.mdxFile
|
|
2688
|
+
);
|
|
2689
|
+
const contentHash = computeMd5(fileContents);
|
|
2690
|
+
const cached = this.cache.get(page.mdxFile);
|
|
2691
|
+
if (cached && cached.contentHash === contentHash) {
|
|
2692
|
+
cachedCount++;
|
|
2693
|
+
allSections.push(...cached.sections);
|
|
2694
|
+
if (cached.pageEntry) {
|
|
2695
|
+
allPages.push(cached.pageEntry);
|
|
2696
|
+
}
|
|
2697
|
+
continue;
|
|
2698
|
+
}
|
|
2699
|
+
const processed = await this.processMdxPage(page, {
|
|
2700
|
+
fileContents,
|
|
2701
|
+
frontmatter
|
|
2702
|
+
});
|
|
2703
|
+
const filteredFrontmatter = filterFrontmatter(
|
|
2704
|
+
processed.frontmatter,
|
|
2705
|
+
this.config.frontmatter
|
|
2706
|
+
);
|
|
2707
|
+
const pageInfo = {
|
|
2708
|
+
frontmatter: filteredFrontmatter,
|
|
2709
|
+
id: page.id,
|
|
2710
|
+
pathname: page.pathname,
|
|
2711
|
+
title: processed.title,
|
|
2712
|
+
url: processed.url
|
|
2713
|
+
};
|
|
2714
|
+
const { sections: pageSections } = extractor.extract(
|
|
2715
|
+
processed.sectionAst,
|
|
2716
|
+
pageInfo
|
|
2717
|
+
);
|
|
2718
|
+
allSections.push(...pageSections);
|
|
2719
|
+
const pageEntry = extractor.extractPage(processed.sectionAst, pageInfo);
|
|
2720
|
+
if (pageEntry) {
|
|
2721
|
+
pageEntry.content = `# ${processed.title}
|
|
2722
|
+
|
|
2723
|
+
${pageEntry.content}`;
|
|
2724
|
+
allPages.push(pageEntry);
|
|
2725
|
+
}
|
|
2726
|
+
this.cache.set(page.mdxFile, {
|
|
2727
|
+
contentHash,
|
|
2728
|
+
pageEntry: pageEntry ?? null,
|
|
2729
|
+
processedPage: processed,
|
|
2730
|
+
sections: pageSections
|
|
2731
|
+
});
|
|
2695
2732
|
} catch (error) {
|
|
2696
2733
|
console.error(`Failed to process page: ${page.name}`);
|
|
2697
2734
|
throw error;
|
|
2698
2735
|
}
|
|
2699
2736
|
}
|
|
2700
|
-
const
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
minContentLength: sectionsConfig.minContentLength,
|
|
2704
|
-
pageIdPrefix: this.config.pageIdPrefix
|
|
2705
|
-
});
|
|
2706
|
-
const allSections = [];
|
|
2707
|
-
const allPages = [];
|
|
2708
|
-
for (let i = 0; i < processedPages.length; i++) {
|
|
2709
|
-
const processed = processedPages[i];
|
|
2710
|
-
const page = pageInfos[i];
|
|
2711
|
-
const filteredFrontmatter = filterFrontmatter(
|
|
2712
|
-
processed.frontmatter,
|
|
2713
|
-
this.config.frontmatter
|
|
2714
|
-
);
|
|
2715
|
-
const pageInfo = {
|
|
2716
|
-
frontmatter: filteredFrontmatter,
|
|
2717
|
-
id: page.id,
|
|
2718
|
-
pathname: page.pathname,
|
|
2719
|
-
title: processed.title,
|
|
2720
|
-
url: processed.url
|
|
2721
|
-
};
|
|
2722
|
-
const { sections: pageSections } = extractor.extract(
|
|
2723
|
-
processed.sectionAst,
|
|
2724
|
-
pageInfo
|
|
2725
|
-
);
|
|
2726
|
-
allSections.push(...pageSections);
|
|
2727
|
-
const pageEntry = extractor.extractPage(processed.sectionAst, pageInfo);
|
|
2728
|
-
if (pageEntry) {
|
|
2729
|
-
pageEntry.content = `# ${processed.title}
|
|
2730
|
-
|
|
2731
|
-
${pageEntry.content}`;
|
|
2732
|
-
allPages.push(pageEntry);
|
|
2737
|
+
for (const key of this.cache.keys()) {
|
|
2738
|
+
if (!currentFiles.has(key)) {
|
|
2739
|
+
this.cache.delete(key);
|
|
2733
2740
|
}
|
|
2734
2741
|
}
|
|
2735
2742
|
if (this.config.extraFiles?.length) {
|
|
@@ -2743,6 +2750,7 @@ ${pageEntry.content}`;
|
|
|
2743
2750
|
const sectionsHash = computeMd5(JSON.stringify(allSections));
|
|
2744
2751
|
const pagesHash = computeMd5(JSON.stringify(allPages));
|
|
2745
2752
|
return {
|
|
2753
|
+
cachedPageCount: cachedCount,
|
|
2746
2754
|
pages: {
|
|
2747
2755
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2748
2756
|
hash: pagesHash,
|
|
@@ -2756,7 +2764,8 @@ ${pageEntry.content}`;
|
|
|
2756
2764
|
sections: allSections,
|
|
2757
2765
|
totalSections: allSections.length,
|
|
2758
2766
|
version: 1
|
|
2759
|
-
}
|
|
2767
|
+
},
|
|
2768
|
+
totalPageCount: pageInfos.length
|
|
2760
2769
|
};
|
|
2761
2770
|
}
|
|
2762
2771
|
async scanPages() {
|
|
@@ -2807,10 +2816,8 @@ ${pageEntry.content}`;
|
|
|
2807
2816
|
}
|
|
2808
2817
|
}
|
|
2809
2818
|
for (const entry of entries) {
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
if (stats.isDirectory()) {
|
|
2813
|
-
await scanDirectory(fullPath);
|
|
2819
|
+
if (entry.isDirectory()) {
|
|
2820
|
+
await scanDirectory(join5(dirPath, entry.name));
|
|
2814
2821
|
}
|
|
2815
2822
|
}
|
|
2816
2823
|
};
|
|
@@ -2828,7 +2835,9 @@ ${pageEntry.content}`;
|
|
|
2828
2835
|
}
|
|
2829
2836
|
if (frontmatter.description) {
|
|
2830
2837
|
parent.children.splice(index, 1, {
|
|
2831
|
-
children: [
|
|
2838
|
+
children: [
|
|
2839
|
+
{ type: "text", value: frontmatter.description }
|
|
2840
|
+
],
|
|
2832
2841
|
type: "paragraph"
|
|
2833
2842
|
});
|
|
2834
2843
|
} else {
|
|
@@ -2864,6 +2873,7 @@ ${pageEntry.content}`;
|
|
|
2864
2873
|
};
|
|
2865
2874
|
}
|
|
2866
2875
|
async processMdxContent(mdxContent, pageInfo, frontmatter) {
|
|
2876
|
+
const themePlugin = await formatThemeNodes();
|
|
2867
2877
|
const processor = createRemarkProcessor({
|
|
2868
2878
|
frontmatter: true,
|
|
2869
2879
|
gfm: true,
|
|
@@ -2872,7 +2882,7 @@ ${pageEntry.content}`;
|
|
|
2872
2882
|
formatNpmInstallTabs,
|
|
2873
2883
|
this.propFormatter.propsToMarkdownList(),
|
|
2874
2884
|
this.formatFrontmatterExpressions(frontmatter),
|
|
2875
|
-
|
|
2885
|
+
themePlugin,
|
|
2876
2886
|
formatDemos(pageInfo.demosFolder, this.config.verbose),
|
|
2877
2887
|
filterTextDirectives,
|
|
2878
2888
|
this.transformRelativeUrls()
|
|
@@ -2880,10 +2890,8 @@ ${pageEntry.content}`;
|
|
|
2880
2890
|
});
|
|
2881
2891
|
return await processor.run(processor.parse(mdxContent));
|
|
2882
2892
|
}
|
|
2883
|
-
async processMdxPage(pageInfo) {
|
|
2884
|
-
const { fileContents, frontmatter } = this.fileReader.readFileSync(
|
|
2885
|
-
pageInfo.mdxFile
|
|
2886
|
-
);
|
|
2893
|
+
async processMdxPage(pageInfo, preRead) {
|
|
2894
|
+
const { fileContents, frontmatter } = preRead ?? this.fileReader.readFileSync(pageInfo.mdxFile);
|
|
2887
2895
|
const ast = await this.processMdxContent(
|
|
2888
2896
|
fileContents,
|
|
2889
2897
|
pageInfo,
|
|
@@ -3234,6 +3242,7 @@ var SearchIndexer = class {
|
|
|
3234
3242
|
this.metaJson,
|
|
3235
3243
|
routeMeta?.title || frontmatter.title || ""
|
|
3236
3244
|
),
|
|
3245
|
+
data: frontmatter,
|
|
3237
3246
|
description: frontmatter.description,
|
|
3238
3247
|
hidden: defined2(routeMeta.hidden) ? routeMeta.hidden : frontmatter.hidden,
|
|
3239
3248
|
hideBreadcrumbs: defined2(routeMeta.hideBreadcrumbs) ? routeMeta.hideBreadcrumbs : frontmatter.hideBreadcrumbs,
|
|
@@ -3420,10 +3429,12 @@ var SearchIndexer = class {
|
|
|
3420
3429
|
this.config.routingStrategy
|
|
3421
3430
|
);
|
|
3422
3431
|
this._mdxFileCount = mdxFileGlob.length;
|
|
3423
|
-
this.mdxFileReader.gitMetadataMap
|
|
3424
|
-
this.
|
|
3425
|
-
|
|
3426
|
-
|
|
3432
|
+
if (!this.mdxFileReader.enabled || this.mdxFileReader.gitMetadataMap.size === 0) {
|
|
3433
|
+
this.mdxFileReader.gitMetadataMap = buildGitMetadataMap(
|
|
3434
|
+
this.config.srcDir,
|
|
3435
|
+
this.mdxFileReader.pageTimestampMetadata
|
|
3436
|
+
);
|
|
3437
|
+
}
|
|
3427
3438
|
const compiledFiles = mdxFileGlob.map((file) => this.compileMdxFile(file));
|
|
3428
3439
|
const mdxIndex = compiledFiles.map((fileData) => fileData.pageSections).flat();
|
|
3429
3440
|
filterFileGlob(
|
|
@@ -3452,6 +3463,7 @@ var PluginState = class {
|
|
|
3452
3463
|
indexer;
|
|
3453
3464
|
configLoader = null;
|
|
3454
3465
|
knowledgeConfig = void 0;
|
|
3466
|
+
knowledgePageCache = /* @__PURE__ */ new Map();
|
|
3455
3467
|
pages = null;
|
|
3456
3468
|
sections = null;
|
|
3457
3469
|
routesDir;
|
|
@@ -3500,6 +3512,7 @@ var PluginState = class {
|
|
|
3500
3512
|
}
|
|
3501
3513
|
}
|
|
3502
3514
|
createIndexer(config) {
|
|
3515
|
+
this.knowledgePageCache.clear();
|
|
3503
3516
|
this.config = config;
|
|
3504
3517
|
this.configFilePath = config.filePath;
|
|
3505
3518
|
this.docPropsFilePath = config.typeDocProps ? fixPath(resolve4(this.cwd, config.typeDocProps)) : "";
|
|
@@ -3595,7 +3608,7 @@ var PluginState = class {
|
|
|
3595
3608
|
this.knowledgeConfig.outputPath ?? "exports"
|
|
3596
3609
|
);
|
|
3597
3610
|
const startTime = Date.now();
|
|
3598
|
-
const fileReader = new MdxFileReader(
|
|
3611
|
+
const fileReader = new MdxFileReader(isDev);
|
|
3599
3612
|
const exporter = new KnowledgeExporter(
|
|
3600
3613
|
{
|
|
3601
3614
|
baseUrl: this.knowledgeConfig.baseUrl,
|
|
@@ -3608,7 +3621,8 @@ var PluginState = class {
|
|
|
3608
3621
|
routeDir: this.routesDir,
|
|
3609
3622
|
sections: this.knowledgeConfig.sections
|
|
3610
3623
|
},
|
|
3611
|
-
fileReader
|
|
3624
|
+
fileReader,
|
|
3625
|
+
this.knowledgePageCache
|
|
3612
3626
|
);
|
|
3613
3627
|
const result = await exporter.generate();
|
|
3614
3628
|
this.pages = result.pages;
|
|
@@ -3625,8 +3639,11 @@ var PluginState = class {
|
|
|
3625
3639
|
"utf-8"
|
|
3626
3640
|
);
|
|
3627
3641
|
this.exports.pathnames = result.pages.pages.map((p) => p.pathname);
|
|
3642
|
+
const cacheInfo = result.cachedPageCount > 0 ? chalk3.greenBright.bold(
|
|
3643
|
+
` (${result.cachedPageCount}/${result.totalPageCount} pages cached)`
|
|
3644
|
+
) : "";
|
|
3628
3645
|
console.debug(
|
|
3629
|
-
`${chalk3.magenta.bold(`@qualcomm-ui/mdx-vite/docs-plugin:`)} Generated knowledge exports in: ${chalk3.blueBright.bold(prettyMilliseconds(Date.now() - startTime))}`
|
|
3646
|
+
`${chalk3.magenta.bold(`@qualcomm-ui/mdx-vite/docs-plugin:`)} Generated knowledge exports in: ${chalk3.blueBright.bold(prettyMilliseconds(Date.now() - startTime))}${cacheInfo}`
|
|
3630
3647
|
);
|
|
3631
3648
|
}
|
|
3632
3649
|
debouncedGenerateKnowledge(publicDir, opts = {}) {
|