@qualcomm-ui/mdx-vite 2.0.0 → 2.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 +64 -20
- package/dist/cli.js.map +2 -2
- package/dist/docs-plugin/docs-plugin.d.ts.map +1 -1
- package/dist/docs-plugin/internal/search-indexer.d.ts +2 -2
- package/dist/docs-plugin/internal/search-indexer.d.ts.map +1 -1
- package/dist/docs-plugin/internal/services/markdown/markdown-file-reader.d.ts +1 -0
- package/dist/docs-plugin/internal/services/markdown/markdown-file-reader.d.ts.map +1 -1
- package/dist/docs-plugin/internal/services/markdown/markdown.types.d.ts +17 -1
- package/dist/docs-plugin/internal/services/markdown/markdown.types.d.ts.map +1 -1
- package/dist/docs-plugin/internal/services/nav-builder/nav-builder.d.ts.map +1 -1
- package/dist/docs-plugin/internal/services/nav-builder/page-map.d.ts.map +1 -1
- package/dist/docs-plugin/mdx-plugins.d.ts +2 -0
- package/dist/docs-plugin/mdx-plugins.d.ts.map +1 -1
- package/dist/docs-plugin/remark/remark-code-tabs.d.ts +16 -0
- package/dist/docs-plugin/remark/remark-code-tabs.d.ts.map +1 -1
- package/dist/docs-plugin/shiki/index.d.ts +3 -0
- package/dist/docs-plugin/shiki/index.d.ts.map +1 -0
- package/dist/docs-plugin/shiki/shiki-transformer-code-attribute.d.ts +20 -0
- package/dist/docs-plugin/shiki/shiki-transformer-code-attribute.d.ts.map +1 -0
- package/dist/docs-plugin/shiki/shiki-transformer-preview-block.d.ts +7 -0
- package/dist/docs-plugin/shiki/shiki-transformer-preview-block.d.ts.map +1 -0
- package/dist/docs-plugin/shiki/utils.d.ts +2 -0
- package/dist/docs-plugin/shiki/utils.d.ts.map +1 -0
- package/dist/index.js +154 -35
- package/dist/index.js.map +4 -4
- package/dist/open-web-ui-knowledge/generate-knowledge.d.ts.map +1 -1
- package/dist/react-demo-plugin/react-demo-plugin.d.ts.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-plugin.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/docs-plugin.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"docs-plugin.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/docs-plugin.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAa,YAAY,EAAgB,MAAM,MAAM,CAAA;AAmBjE,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IAEnB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAiKD,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,YAAY,CA4GvE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { NavItem, PageMap, PageSection } from "@qualcomm-ui/mdx-common";
|
|
2
2
|
import type { QuiPropTypes } from "@qualcomm-ui/typedoc-common";
|
|
3
3
|
import type { SearchIndexerOptions } from "../types";
|
|
4
|
-
import { DocPropsIndexer, MarkdownFileReader, MarkdownIndexer, NavBuilder } from "./services";
|
|
4
|
+
import { type CompiledMdxFile, DocPropsIndexer, MarkdownFileReader, MarkdownIndexer, NavBuilder } from "./services";
|
|
5
5
|
export declare class SearchIndexer {
|
|
6
6
|
config: SearchIndexerOptions;
|
|
7
7
|
logWarnings: boolean;
|
|
@@ -41,6 +41,6 @@ export declare class SearchIndexer {
|
|
|
41
41
|
private compileMdxFile;
|
|
42
42
|
private formatSections;
|
|
43
43
|
private compileTsxFile;
|
|
44
|
-
buildIndex(inputFileGlob: string[], logWarnings?: boolean):
|
|
44
|
+
buildIndex(inputFileGlob: string[], logWarnings?: boolean): CompiledMdxFile[];
|
|
45
45
|
}
|
|
46
46
|
//# sourceMappingURL=search-indexer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-indexer.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/internal/search-indexer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EAEP,OAAO,EACP,WAAW,EACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAE7D,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,eAAe,EAQf,kBAAkB,EAClB,eAAe,EACf,UAAU,EACX,MAAM,YAAY,CAAA;AAInB,qBAAa,aAAa;IA4Cf,MAAM,EAAE,oBAAoB;IAC5B,WAAW;IA5CpB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAa;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2C;IAExE,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,IAAI,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAE/D;IACD,OAAO,CAAC,aAAa,CAAmD;IAExE,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,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;gBAOJ,MAAM,EAAE,oBAAoB,EAC5B,WAAW,UAAO,EAEzB,MAAM,GAAE;QACN,eAAe,CAAC,EAAE,eAAe,CAAA;QACjC,SAAS,CAAC,EAAE,kBAAkB,CAAA;QAC9B,eAAe,CAAC,EAAE,eAAe,CAAA;QACjC,UAAU,CAAC,EAAE,UAAU,CAAA;KACnB;IAwBR;;;OAGG;IACH,OAAO,CAAC,YAAY;IA4DpB;;;OAGG;IACH,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"search-indexer.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/internal/search-indexer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EAEP,OAAO,EACP,WAAW,EACZ,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAE7D,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,KAAK,eAAe,EAEpB,eAAe,EAQf,kBAAkB,EAClB,eAAe,EACf,UAAU,EACX,MAAM,YAAY,CAAA;AAInB,qBAAa,aAAa;IA4Cf,MAAM,EAAE,oBAAoB;IAC5B,WAAW;IA5CpB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAa;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA2C;IAExE,IAAI,eAAe,IAAI,MAAM,CAE5B;IAED,IAAI,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAE/D;IACD,OAAO,CAAC,aAAa,CAAmD;IAExE,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,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;gBAOJ,MAAM,EAAE,oBAAoB,EAC5B,WAAW,UAAO,EAEzB,MAAM,GAAE;QACN,eAAe,CAAC,EAAE,eAAe,CAAA;QACjC,SAAS,CAAC,EAAE,kBAAkB,CAAA;QAC9B,eAAe,CAAC,EAAE,eAAe,CAAA;QACjC,UAAU,CAAC,EAAE,UAAU,CAAA;KACnB;IAwBR;;;OAGG;IACH,OAAO,CAAC,YAAY;IA4DpB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAkGtB,OAAO,CAAC,cAAc;IAwBtB,OAAO,CAAC,cAAc;IAqBtB,UAAU,CACR,aAAa,EAAE,MAAM,EAAE,EACvB,WAAW,GAAE,OAAc,GAC1B,eAAe,EAAE;CAmCrB"}
|
|
@@ -16,6 +16,7 @@ export declare class MarkdownFileReader {
|
|
|
16
16
|
constructor(enabled: boolean);
|
|
17
17
|
private hash;
|
|
18
18
|
reset(): void;
|
|
19
|
+
readCache(filePath: string): PageCache | null;
|
|
19
20
|
private checkCache;
|
|
20
21
|
readFile(filepath: string): {
|
|
21
22
|
cached: Omit<PageCache, "md5"> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-file-reader.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/markdown/markdown-file-reader.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAI7D,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAEjE,UAAU,SAAS;IACjB,WAAW,EAAE,eAAe,CAAA;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,WAAW,CAAA;IACjB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAC1C,mBAAmB,EAAE,cAAc,EAAE,CAAA;CACtC;AAED,qBAAa,kBAAkB;IAKV,OAAO,EAAE,OAAO;IAJnC,eAAe,SAAI;IACnB,WAAW,UAAO;IAClB,OAAO,CAAC,QAAQ,CAAgC;gBAE7B,OAAO,EAAE,OAAO;IAEnC,OAAO,CAAC,IAAI;IAIZ,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,UAAU;IAyBlB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG;QAC1B,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,SAAS,CAAA;QAC1C,YAAY,EAAE,MAAM,CAAA;QACpB,WAAW,EAAE,eAAe,CAAA;KAC7B;IAuDD,WAAW,CACT,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GAChC,IAAI;CAKR"}
|
|
1
|
+
{"version":3,"file":"markdown-file-reader.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/markdown/markdown-file-reader.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAA;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAA;AAI7D,OAAO,KAAK,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,kBAAkB,CAAA;AAEjE,UAAU,SAAS;IACjB,WAAW,EAAE,eAAe,CAAA;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,WAAW,CAAA;IACjB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;IAC1C,mBAAmB,EAAE,cAAc,EAAE,CAAA;CACtC;AAED,qBAAa,kBAAkB;IAKV,OAAO,EAAE,OAAO;IAJnC,eAAe,SAAI;IACnB,WAAW,UAAO;IAClB,OAAO,CAAC,QAAQ,CAAgC;gBAE7B,OAAO,EAAE,OAAO;IAEnC,OAAO,CAAC,IAAI;IAIZ,KAAK,IAAI,IAAI;IAIb,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAI7C,OAAO,CAAC,UAAU;IAyBlB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG;QAC1B,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,SAAS,CAAA;QAC1C,YAAY,EAAE,MAAM,CAAA;QACpB,WAAW,EAAE,eAAe,CAAA;KAC7B;IAuDD,WAAW,CACT,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GAChC,IAAI;CAKR"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PageHeading, PageSectionContent, RichContentNode } from "@qualcomm-ui/mdx-common";
|
|
1
|
+
import type { PageHeading, PageSection, PageSectionContent, RichContentNode } from "@qualcomm-ui/mdx-common";
|
|
2
2
|
export interface IndexedSection {
|
|
3
3
|
content: PageSectionContent[];
|
|
4
4
|
heading: PageHeading | null;
|
|
@@ -8,4 +8,20 @@ export interface IndexedPage {
|
|
|
8
8
|
sections: IndexedSection[];
|
|
9
9
|
toc: PageHeading[];
|
|
10
10
|
}
|
|
11
|
+
export interface CompiledMdxFileMetadata {
|
|
12
|
+
changed: {
|
|
13
|
+
/**
|
|
14
|
+
* True if the file's frontmatter has changed since the last build.
|
|
15
|
+
*/
|
|
16
|
+
frontmatter?: boolean | undefined;
|
|
17
|
+
};
|
|
18
|
+
filePath: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CompiledMdxFile {
|
|
21
|
+
/**
|
|
22
|
+
* Metadata about the file.
|
|
23
|
+
*/
|
|
24
|
+
metadata: CompiledMdxFileMetadata;
|
|
25
|
+
pageSections: PageSection[];
|
|
26
|
+
}
|
|
11
27
|
//# sourceMappingURL=markdown.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.types.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/markdown/markdown.types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,eAAe,EAChB,MAAM,yBAAyB,CAAA;AAEhC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,kBAAkB,EAAE,CAAA;IAC7B,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,WAAW,EAAE,eAAe,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,GAAG,EAAE,WAAW,EAAE,CAAA;CACnB"}
|
|
1
|
+
{"version":3,"file":"markdown.types.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/markdown/markdown.types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,eAAe,EAChB,MAAM,yBAAyB,CAAA;AAEhC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,kBAAkB,EAAE,CAAA;IAC7B,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,WAAW,EAAE,eAAe,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,GAAG,EAAE,WAAW,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE;QACP;;WAEG;QACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAClC,CAAA;IACD,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,EAAE,uBAAuB,CAAA;IACjC,YAAY,EAAE,WAAW,EAAE,CAAA;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-builder.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/nav-builder/nav-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nav-builder.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/nav-builder/nav-builder.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,WAAW,EACZ,MAAM,yBAAyB,CAAA;AAGhC,OAAO,KAAK,EACV,OAAO,EACP,sBAAsB,EACtB,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AAWvB;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,YAAY,CAAgB;IAEpC,IAAI,QAAQ,IAAI,OAAO,EAAE,CAExB;IACD,OAAO,CAAC,SAAS,CAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKzE,GAAG,CACD,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,OAAO,CAAC,eAAe,CAAC,EACzC,SAAS,CAAC,EAAE,sBAAsB,GACjC,IAAI;IAIP,KAAK,IAAI,IAAI;IAMb;;;;OAIG;IACH,OAAO,CAAC,WAAW;IA6CnB,mBAAmB,CACjB,WAAW,EAAE,OAAO,CAAC,eAAe,CAAC,EACrC,SAAS,EAAE,OAAO,CAAC,sBAAsB,CAAC,EAC1C,QAAQ,EAAE,MAAM,GACf,MAAM;IAQT;;;;OAIG;IACH,OAAO,CAAC,YAAY;IA4EpB;;;OAGG;IACH,OAAO,CAAC,YAAY;IA4CpB;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IAiBpB,OAAO,CAAC,mBAAmB;IAa3B,OAAO,CAAC,kBAAkB;IAU1B;;;OAGG;IACH,KAAK,IAAI,OAAO,EAAE;IA+BlB,OAAO,CAAC,aAAa;IA0BrB;;OAEG;IACH,OAAO,CAAC,eAAe;CA8BxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-map.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/nav-builder/page-map.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page-map.d.ts","sourceRoot":"","sources":["../../../../../src/docs-plugin/internal/services/nav-builder/page-map.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,iBAAiB,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAA;AAItE,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,UAE7D;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,EAAE,iBAAiB,EAE3B,gBAAgB,EAAE,MAAM,GACvB,MAAM,EAAE,CAeV;AAGD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAU7D;AA+JD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,QAAQ,CAAC,EAAE,eAAe,GACzB,MAAM,EAAE,CAaV;AAED,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAAE,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,eAAe,GACvB,MAAM,EAAE,CA2BV"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type RehypeShikiOptions } from "@shikijs/rehype";
|
|
2
|
+
import type { ShikiTransformer } from "shiki";
|
|
2
3
|
import type { PluggableList } from "unified";
|
|
3
4
|
import { type ConfigLoaderOptions } from "./internal";
|
|
4
5
|
/**
|
|
@@ -8,6 +9,7 @@ export declare const quiRehypePlugins: PluggableList;
|
|
|
8
9
|
export interface QuiRehypePluginOptions extends ConfigLoaderOptions {
|
|
9
10
|
rehypeShikiOptions?: Partial<RehypeShikiOptions>;
|
|
10
11
|
}
|
|
12
|
+
export declare function getShikiTransformers(): ShikiTransformer[];
|
|
11
13
|
/**
|
|
12
14
|
* Used to retrieve all the rehype plugins required for QUI Docs MDX.
|
|
13
15
|
* These should be passed to the `mdx` vite plugin from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx-plugins.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/mdx-plugins.ts"],"names":[],"mappings":"AAGA,OAAoB,EAAC,KAAK,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"mdx-plugins.d.ts","sourceRoot":"","sources":["../../src/docs-plugin/mdx-plugins.ts"],"names":[],"mappings":"AAGA,OAAoB,EAAC,KAAK,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAWpE,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAA;AAW1C,OAAO,EAAe,KAAK,mBAAmB,EAAC,MAAM,YAAY,CAAA;AAKjE;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAA8C,CAAA;AAE7E,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,kBAAkB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAA;CACjD;AAED,wBAAgB,oBAAoB,IAAI,gBAAgB,EAAE,CAUzD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,sBAA2B,GACnC,aAAa,CAwBf;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAA8C,CAAA;AAE7E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAShD"}
|
|
@@ -2,6 +2,22 @@ import type { Root } from "mdast";
|
|
|
2
2
|
import type { Plugin } from "unified";
|
|
3
3
|
/**
|
|
4
4
|
* Very cool. TODO: document this https://docs.qui.qualcomm.com/guide/markdown
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```angular-html tabs="demo" label="HTML"
|
|
8
|
+
* <div class="w-72" q-text-input [invalid]="!value()" [(ngModel)]="value">
|
|
9
|
+
* <label q-text-input-label>Label</label>
|
|
10
|
+
* <input placeholder="Enter a value" q-text-input-input />
|
|
11
|
+
* <div q-text-input-error-text>You must enter a value</div>
|
|
12
|
+
* </div>
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* ```angular-ts tabs="demo" label="TS"
|
|
16
|
+
* @Component()
|
|
17
|
+
* export class DemoComponent {
|
|
18
|
+
* readonly value = signal("")
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
5
21
|
*/
|
|
6
22
|
export declare const remarkCodeTabs: Plugin<[], Root>;
|
|
7
23
|
//# sourceMappingURL=remark-code-tabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remark-code-tabs.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/remark-code-tabs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,IAAI,EAAC,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAoInC
|
|
1
|
+
{"version":3,"file":"remark-code-tabs.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/remark/remark-code-tabs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,IAAI,EAAC,MAAM,OAAO,CAAA;AAC7C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAoInC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,CA0D3C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/shiki/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ShikiTransformer } from "shiki";
|
|
2
|
+
export interface TransformerCodeAttributeOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The name of the attribute to add to the pre element.
|
|
5
|
+
*
|
|
6
|
+
* @default 'data-code'
|
|
7
|
+
*/
|
|
8
|
+
attributeName?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Custom formatter for the source code.
|
|
11
|
+
*/
|
|
12
|
+
formatter?: (code: string) => string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Adds a `data-code` attribute to the `<pre>` element with the code contents,
|
|
16
|
+
* removing any code annotations and unused lines from transformers like
|
|
17
|
+
* `transformerNotationDiff`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function transformerCodeAttribute(opts?: TransformerCodeAttributeOptions): ShikiTransformer;
|
|
20
|
+
//# sourceMappingURL=shiki-transformer-code-attribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shiki-transformer-code-attribute.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/shiki/shiki-transformer-code-attribute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,OAAO,CAAA;AAI3C,MAAM,WAAW,+BAA+B;IAC9C;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CACrC;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,GAAE,+BAAoC,GACzC,gBAAgB,CAUlB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ShikiTransformer } from "shiki";
|
|
2
|
+
interface TransformerPreviewBlockOptions {
|
|
3
|
+
stripMarkers?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function transformerPreviewBlock(options?: TransformerPreviewBlockOptions): ShikiTransformer;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=shiki-transformer-preview-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shiki-transformer-preview-block.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/shiki/shiki-transformer-preview-block.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,OAAO,CAAA;AAE3C,UAAU,8BAA8B;IACtC,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAUD,wBAAgB,uBAAuB,CACrC,OAAO,GAAE,8BAAmC,GAC3C,gBAAgB,CA4ClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/docs-plugin/shiki/utils.ts"],"names":[],"mappings":"AAGA,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAY1D"}
|
package/dist/index.js
CHANGED
|
@@ -1486,12 +1486,15 @@ var MarkdownFileReader = class {
|
|
|
1486
1486
|
reset() {
|
|
1487
1487
|
this.cachedFileCount = 0;
|
|
1488
1488
|
}
|
|
1489
|
-
|
|
1489
|
+
readCache(filePath) {
|
|
1490
|
+
return this.mdxCache[filePath] || null;
|
|
1491
|
+
}
|
|
1492
|
+
checkCache(filePath, fileContents) {
|
|
1490
1493
|
if (!this.enabled) {
|
|
1491
1494
|
return;
|
|
1492
1495
|
}
|
|
1493
1496
|
const fileMd5 = this.hash(fileContents);
|
|
1494
|
-
const cached = this.mdxCache[
|
|
1497
|
+
const cached = this.mdxCache[filePath];
|
|
1495
1498
|
if (cached?.md5 !== fileMd5) {
|
|
1496
1499
|
return;
|
|
1497
1500
|
}
|
|
@@ -2012,9 +2015,9 @@ function getRouteMeta(pathSegments, metaJson) {
|
|
|
2012
2015
|
}
|
|
2013
2016
|
|
|
2014
2017
|
// src/docs-plugin/internal/services/nav-builder/nav-builder.ts
|
|
2015
|
-
import { capitalCase } from "change-case";
|
|
2016
2018
|
import { sortBy } from "lodash-es";
|
|
2017
2019
|
import { v4 as uuidv4 } from "uuid";
|
|
2020
|
+
import { capitalCase } from "@qualcomm-ui/utils/change-case";
|
|
2018
2021
|
var NavBuilder = class {
|
|
2019
2022
|
initialRoutes = [];
|
|
2020
2023
|
flatNavItems = [];
|
|
@@ -2299,8 +2302,8 @@ var NavBuilder = class {
|
|
|
2299
2302
|
};
|
|
2300
2303
|
|
|
2301
2304
|
// src/docs-plugin/internal/services/nav-builder/page-map.ts
|
|
2302
|
-
import { capitalCase as capitalCase2 } from "change-case";
|
|
2303
2305
|
import { join as join2 } from "node:path";
|
|
2306
|
+
import { capitalCase as capitalCase2 } from "@qualcomm-ui/utils/change-case";
|
|
2304
2307
|
function getPathnameFromPathSegments(segments) {
|
|
2305
2308
|
return `/${segments.join("/")}`;
|
|
2306
2309
|
}
|
|
@@ -2570,11 +2573,25 @@ var SearchIndexer = class {
|
|
|
2570
2573
|
* Parses an MDX file to extract the site data for the nav items, doc props,
|
|
2571
2574
|
* breadcrumbs, and search index.
|
|
2572
2575
|
*/
|
|
2573
|
-
compileMdxFile(
|
|
2574
|
-
const { cached, fileContents, frontmatter } = this.fileCache.readFile(
|
|
2576
|
+
compileMdxFile(filePath) {
|
|
2577
|
+
const { cached, fileContents, frontmatter } = this.fileCache.readFile(filePath);
|
|
2578
|
+
const metadata = {
|
|
2579
|
+
changed: {},
|
|
2580
|
+
filePath
|
|
2581
|
+
};
|
|
2582
|
+
if (!cached) {
|
|
2583
|
+
const previousData = this.fileCache.readCache(filePath);
|
|
2584
|
+
if (previousData) {
|
|
2585
|
+
const cachedFm = JSON.stringify(previousData.frontmatter);
|
|
2586
|
+
const currentFm = JSON.stringify(frontmatter);
|
|
2587
|
+
if (cachedFm !== currentFm) {
|
|
2588
|
+
metadata.changed.frontmatter = true;
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2575
2592
|
this.docPropsIndexer.reset();
|
|
2576
2593
|
this.markdownIndexer.reset();
|
|
2577
|
-
const defaultSection = this.getPageEntry(
|
|
2594
|
+
const defaultSection = this.getPageEntry(filePath, frontmatter);
|
|
2578
2595
|
if (!defaultSection.categories.length && defaultSection.title) {
|
|
2579
2596
|
defaultSection.categories = [defaultSection.title];
|
|
2580
2597
|
}
|
|
@@ -2589,9 +2606,9 @@ var SearchIndexer = class {
|
|
|
2589
2606
|
console.debug(
|
|
2590
2607
|
`${chalk3.yellowBright.bold(
|
|
2591
2608
|
"Failed to parse mdx page content."
|
|
2592
|
-
)} ${chalk3.blueBright.bold(
|
|
2609
|
+
)} ${chalk3.blueBright.bold(filePath)}`
|
|
2593
2610
|
);
|
|
2594
|
-
return [defaultSection];
|
|
2611
|
+
return { metadata, pageSections: [defaultSection] };
|
|
2595
2612
|
}
|
|
2596
2613
|
const { sections, toc } = indexedPage;
|
|
2597
2614
|
if (toc.length) {
|
|
@@ -2606,17 +2623,17 @@ var SearchIndexer = class {
|
|
|
2606
2623
|
if (docPropSections.length) {
|
|
2607
2624
|
this._pageDocProps[defaultSection.pathname] = docProps;
|
|
2608
2625
|
}
|
|
2609
|
-
this.fileCache.updateCache(
|
|
2626
|
+
this.fileCache.updateCache(filePath, fileContents, {
|
|
2610
2627
|
frontmatter,
|
|
2611
2628
|
page: indexedPage,
|
|
2612
2629
|
pageDocProps: docProps,
|
|
2613
2630
|
pageDocPropSections: docPropSections
|
|
2614
2631
|
});
|
|
2615
2632
|
if (frontmatter.hideFromSearch) {
|
|
2616
|
-
return [defaultSection];
|
|
2633
|
+
return { metadata, pageSections: [defaultSection] };
|
|
2617
2634
|
}
|
|
2618
2635
|
if (!sections.length && !docPropSections.length) {
|
|
2619
|
-
return [defaultSection];
|
|
2636
|
+
return { metadata, pageSections: [defaultSection] };
|
|
2620
2637
|
}
|
|
2621
2638
|
const sectionReturn = [
|
|
2622
2639
|
...this.formatSections(sections, defaultSection, false)
|
|
@@ -2626,7 +2643,7 @@ var SearchIndexer = class {
|
|
|
2626
2643
|
...this.formatSections(docPropSections, defaultSection, true)
|
|
2627
2644
|
);
|
|
2628
2645
|
}
|
|
2629
|
-
return sectionReturn;
|
|
2646
|
+
return { metadata, pageSections: sectionReturn };
|
|
2630
2647
|
}
|
|
2631
2648
|
formatSections(sections, { toc: _toc, ...defaultSection }, isDocProp) {
|
|
2632
2649
|
return sections.map((section, index) => {
|
|
@@ -2671,7 +2688,8 @@ var SearchIndexer = class {
|
|
|
2671
2688
|
this.config.routingStrategy
|
|
2672
2689
|
);
|
|
2673
2690
|
this._mdxFileCount = mdxFileGlob.length;
|
|
2674
|
-
const
|
|
2691
|
+
const compiledFiles = mdxFileGlob.map((file) => this.compileMdxFile(file));
|
|
2692
|
+
const mdxIndex = compiledFiles.map((fileData) => fileData.pageSections).flat();
|
|
2675
2693
|
filterFileGlob(
|
|
2676
2694
|
fileGlob,
|
|
2677
2695
|
"tsx",
|
|
@@ -2680,6 +2698,7 @@ var SearchIndexer = class {
|
|
|
2680
2698
|
).map((file) => this.compileTsxFile(file));
|
|
2681
2699
|
this._searchIndex.push(...mdxIndex.filter((entry) => !entry.hideFromSearch));
|
|
2682
2700
|
this.navBuilder.build();
|
|
2701
|
+
return compiledFiles;
|
|
2683
2702
|
}
|
|
2684
2703
|
};
|
|
2685
2704
|
|
|
@@ -2709,6 +2728,14 @@ var PluginState = class {
|
|
|
2709
2728
|
this.docPropsFilePath.lastIndexOf("/")
|
|
2710
2729
|
);
|
|
2711
2730
|
}
|
|
2731
|
+
get siteData() {
|
|
2732
|
+
return {
|
|
2733
|
+
navItems: state.indexer.navItems,
|
|
2734
|
+
pageDocProps: state.indexer.pageDocProps,
|
|
2735
|
+
pageMap: state.indexer.pageMap,
|
|
2736
|
+
searchIndex: state.indexer.searchIndex
|
|
2737
|
+
};
|
|
2738
|
+
}
|
|
2712
2739
|
resolveDocProps() {
|
|
2713
2740
|
if (!this.docPropsFilePath) {
|
|
2714
2741
|
return {};
|
|
@@ -2741,15 +2768,16 @@ var PluginState = class {
|
|
|
2741
2768
|
}
|
|
2742
2769
|
);
|
|
2743
2770
|
if (!files.length) {
|
|
2744
|
-
return;
|
|
2771
|
+
return [];
|
|
2745
2772
|
}
|
|
2746
2773
|
const startTime = Date.now();
|
|
2747
|
-
this.indexer.buildIndex(files, shouldLog);
|
|
2774
|
+
const compiledMdxFiles = this.indexer.buildIndex(files, shouldLog);
|
|
2748
2775
|
if (isDev && shouldLog) {
|
|
2749
2776
|
console.debug(
|
|
2750
2777
|
`${chalk4.magenta.bold(`@qualcomm-ui/mdx-vite/docs-plugin:`)} Compiled search index in: ${chalk4.blueBright.bold(prettyMilliseconds(Date.now() - startTime))}${state.indexer.cachedFileCount ? chalk4.greenBright.bold(` (${state.indexer.cachedFileCount}/${state.indexer.mdxFileCount} files cached)`) : ""}`
|
|
2751
2778
|
);
|
|
2752
2779
|
}
|
|
2780
|
+
return compiledMdxFiles;
|
|
2753
2781
|
}
|
|
2754
2782
|
/**
|
|
2755
2783
|
* When the user adds or removes mdx files, we re-index the site. This function
|
|
@@ -2793,7 +2821,13 @@ var PluginState = class {
|
|
|
2793
2821
|
const resolvedConfig = this.configLoader.loadConfig();
|
|
2794
2822
|
this.configFilePath = resolvedConfig.filePath;
|
|
2795
2823
|
this.createIndexer(resolvedConfig);
|
|
2796
|
-
this.handleChange(
|
|
2824
|
+
this.handleChange({
|
|
2825
|
+
onComplete: () => {
|
|
2826
|
+
this.servers.forEach(
|
|
2827
|
+
(server) => server.ws.send({ type: "full-reload" })
|
|
2828
|
+
);
|
|
2829
|
+
}
|
|
2830
|
+
});
|
|
2797
2831
|
});
|
|
2798
2832
|
}
|
|
2799
2833
|
};
|
|
@@ -2804,6 +2838,9 @@ function quiDocsPlugin(opts) {
|
|
|
2804
2838
|
const config = configLoader.loadConfig();
|
|
2805
2839
|
state.createIndexer(config);
|
|
2806
2840
|
return {
|
|
2841
|
+
apply(config2, env) {
|
|
2842
|
+
return env.mode === "development" && env.command === "serve" || env.mode === "production" && env.command === "build";
|
|
2843
|
+
},
|
|
2807
2844
|
buildStart: async () => {
|
|
2808
2845
|
state.buildIndex(state.buildCount > 0);
|
|
2809
2846
|
state.buildCount++;
|
|
@@ -2833,26 +2870,45 @@ function quiDocsPlugin(opts) {
|
|
|
2833
2870
|
});
|
|
2834
2871
|
state.servers.push(server);
|
|
2835
2872
|
},
|
|
2836
|
-
handleHotUpdate: async ({ file: updateFile,
|
|
2873
|
+
handleHotUpdate: async ({ file: updateFile, server }) => {
|
|
2837
2874
|
const file = fixPath(updateFile);
|
|
2838
2875
|
if ((!config.hotUpdateIgnore || !config.hotUpdateIgnore.test(file)) && // ignore watched files. We watch for these separately.
|
|
2839
2876
|
file !== state.configFilePath) {
|
|
2840
2877
|
if (state.docPropsDirectory && file.startsWith(state.docPropsFilePath)) {
|
|
2841
2878
|
return [];
|
|
2842
2879
|
}
|
|
2843
|
-
state.buildIndex(true);
|
|
2844
2880
|
if (updateFile.endsWith(".mdx")) {
|
|
2881
|
+
const mods = [];
|
|
2882
|
+
const files = state.buildIndex(true);
|
|
2883
|
+
const moduleByFile = server.moduleGraph.getModulesByFile(updateFile);
|
|
2884
|
+
if (!moduleByFile?.size) {
|
|
2885
|
+
console.debug("no module found for file, returning", updateFile);
|
|
2886
|
+
return [];
|
|
2887
|
+
}
|
|
2845
2888
|
const virtualModule = server.moduleGraph.getModuleById(VIRTUAL_MODULE_ID2);
|
|
2846
2889
|
if (virtualModule) {
|
|
2847
2890
|
server.moduleGraph.invalidateModule(virtualModule);
|
|
2891
|
+
server.ws.send({
|
|
2892
|
+
data: state.siteData,
|
|
2893
|
+
event: "qui-docs-plugin:refresh-site-data",
|
|
2894
|
+
type: "custom"
|
|
2895
|
+
});
|
|
2848
2896
|
}
|
|
2897
|
+
if (files.some((file2) => file2.metadata.changed.frontmatter)) {
|
|
2898
|
+
console.debug(
|
|
2899
|
+
"Frontmatter changed, reloading plugin to reflect changes in the page configuration"
|
|
2900
|
+
);
|
|
2901
|
+
server.ws.send({ type: "full-reload" });
|
|
2902
|
+
return [];
|
|
2903
|
+
}
|
|
2904
|
+
return mods;
|
|
2849
2905
|
}
|
|
2850
2906
|
}
|
|
2851
|
-
return
|
|
2907
|
+
return [];
|
|
2852
2908
|
},
|
|
2853
2909
|
load: (id) => {
|
|
2854
2910
|
if (id === VIRTUAL_MODULE_ID2) {
|
|
2855
|
-
return `export const siteData = ${JSON.stringify(
|
|
2911
|
+
return `export const siteData = ${JSON.stringify(state.siteData)}`;
|
|
2856
2912
|
}
|
|
2857
2913
|
return void 0;
|
|
2858
2914
|
},
|
|
@@ -2868,6 +2924,16 @@ function quiDocsPlugin(opts) {
|
|
|
2868
2924
|
|
|
2869
2925
|
// src/docs-plugin/mdx-plugins.ts
|
|
2870
2926
|
import rehypeShiki from "@shikijs/rehype";
|
|
2927
|
+
import {
|
|
2928
|
+
transformerNotationDiff,
|
|
2929
|
+
transformerNotationErrorLevel,
|
|
2930
|
+
transformerNotationFocus,
|
|
2931
|
+
transformerNotationHighlight,
|
|
2932
|
+
transformerNotationWordHighlight,
|
|
2933
|
+
transformerRemoveNotationEscape,
|
|
2934
|
+
transformerRenderIndentGuides as transformerRenderIndentGuides2
|
|
2935
|
+
} from "@shikijs/transformers";
|
|
2936
|
+
import { merge } from "lodash-es";
|
|
2871
2937
|
import { quiCustomDarkTheme as quiCustomDarkTheme2 } from "@qualcomm-ui/mdx-common";
|
|
2872
2938
|
|
|
2873
2939
|
// src/exports.ts
|
|
@@ -3218,12 +3284,43 @@ var remarkSpoilers = (options = {}) => {
|
|
|
3218
3284
|
};
|
|
3219
3285
|
};
|
|
3220
3286
|
|
|
3287
|
+
// src/docs-plugin/shiki/utils.ts
|
|
3288
|
+
function removeCodeAnnotations(code) {
|
|
3289
|
+
const annotationRegex = /\/\/\s*\[!code\s*(?:\S.*)?\]/;
|
|
3290
|
+
return code.split("\n").map((line) => {
|
|
3291
|
+
return line.replace(/(?:\/\/\s*)?\[!code \+\+\]/, "");
|
|
3292
|
+
}).filter((line) => !annotationRegex.test(line)).join("\n");
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3295
|
+
// src/docs-plugin/shiki/shiki-transformer-code-attribute.ts
|
|
3296
|
+
function transformerCodeAttribute(opts = {}) {
|
|
3297
|
+
return {
|
|
3298
|
+
enforce: "post",
|
|
3299
|
+
name: "shiki-transformer-code-attribute",
|
|
3300
|
+
pre(node) {
|
|
3301
|
+
const strippedSource = removeCodeAnnotations(this.source);
|
|
3302
|
+
node.properties[opts.attributeName ?? "data-code"] = opts.formatter?.(strippedSource) ?? strippedSource;
|
|
3303
|
+
}
|
|
3304
|
+
};
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3221
3307
|
// src/docs-plugin/mdx-plugins.ts
|
|
3222
3308
|
var quiRehypePlugins = [rehypeSectionize, rehypeSlug];
|
|
3309
|
+
function getShikiTransformers() {
|
|
3310
|
+
return [
|
|
3311
|
+
transformerNotationDiff(),
|
|
3312
|
+
transformerNotationFocus(),
|
|
3313
|
+
transformerNotationHighlight(),
|
|
3314
|
+
transformerNotationWordHighlight(),
|
|
3315
|
+
transformerNotationErrorLevel(),
|
|
3316
|
+
transformerRenderIndentGuides2(),
|
|
3317
|
+
transformerRemoveNotationEscape()
|
|
3318
|
+
];
|
|
3319
|
+
}
|
|
3223
3320
|
function getRehypePlugins(options = {}) {
|
|
3224
3321
|
const config = new ConfigLoader(options).loadConfig();
|
|
3225
3322
|
return [
|
|
3226
|
-
rehypeMdxCodeProps,
|
|
3323
|
+
[rehypeMdxCodeProps, { enforce: "pre" }],
|
|
3227
3324
|
[
|
|
3228
3325
|
rehypeSlug,
|
|
3229
3326
|
{ allowedHeadings: config.headings }
|
|
@@ -3231,14 +3328,17 @@ function getRehypePlugins(options = {}) {
|
|
|
3231
3328
|
rehypeSectionize,
|
|
3232
3329
|
[
|
|
3233
3330
|
rehypeShiki,
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3331
|
+
merge(
|
|
3332
|
+
{
|
|
3333
|
+
defaultColor: "light-dark()",
|
|
3334
|
+
themes: {
|
|
3335
|
+
dark: quiCustomDarkTheme2,
|
|
3336
|
+
light: "github-light-high-contrast"
|
|
3337
|
+
},
|
|
3338
|
+
transformers: [...getShikiTransformers(), transformerCodeAttribute()]
|
|
3239
3339
|
},
|
|
3240
|
-
|
|
3241
|
-
|
|
3340
|
+
options.rehypeShikiOptions
|
|
3341
|
+
)
|
|
3242
3342
|
]
|
|
3243
3343
|
];
|
|
3244
3344
|
}
|
|
@@ -3585,7 +3685,6 @@ function isDemoFile(filePath) {
|
|
|
3585
3685
|
}
|
|
3586
3686
|
|
|
3587
3687
|
// src/react-demo-plugin/react-demo-plugin.ts
|
|
3588
|
-
import { transformerRenderIndentGuides as transformerRenderIndentGuides2 } from "@shikijs/transformers";
|
|
3589
3688
|
import chalk6 from "chalk";
|
|
3590
3689
|
import { glob as glob3 } from "glob";
|
|
3591
3690
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
@@ -3595,6 +3694,7 @@ import * as ts3 from "typescript";
|
|
|
3595
3694
|
import { quiCustomDarkTheme as quiCustomDarkTheme3 } from "@qualcomm-ui/mdx-common";
|
|
3596
3695
|
import { dedent } from "@qualcomm-ui/utils/dedent";
|
|
3597
3696
|
var highlighter2 = null;
|
|
3697
|
+
var initializingHighlighter = false;
|
|
3598
3698
|
var demoRegistry2 = /* @__PURE__ */ new Map();
|
|
3599
3699
|
var pageFiles = /* @__PURE__ */ new Map();
|
|
3600
3700
|
var relativeImportDependents = /* @__PURE__ */ new Map();
|
|
@@ -3609,12 +3709,18 @@ function reactDemoPlugin({
|
|
|
3609
3709
|
transformLine
|
|
3610
3710
|
} = {}) {
|
|
3611
3711
|
return {
|
|
3712
|
+
apply(config, env) {
|
|
3713
|
+
return env.mode === "development" && env.command === "serve" || env.mode === "production" && env.command === "build";
|
|
3714
|
+
},
|
|
3612
3715
|
async buildStart() {
|
|
3613
|
-
if (!highlighter2) {
|
|
3716
|
+
if (!highlighter2 && !initializingHighlighter) {
|
|
3717
|
+
initializingHighlighter = true;
|
|
3614
3718
|
try {
|
|
3615
3719
|
highlighter2 = await createHighlighter2({
|
|
3616
3720
|
langs: ["tsx", "typescript"],
|
|
3617
3721
|
themes: [theme.dark, theme.light]
|
|
3722
|
+
}).finally(() => {
|
|
3723
|
+
initializingHighlighter = false;
|
|
3618
3724
|
});
|
|
3619
3725
|
console.log(
|
|
3620
3726
|
`${chalk6.magenta.bold(LOG_PREFIX2)} Shiki highlighter initialized`
|
|
@@ -3628,18 +3734,20 @@ function reactDemoPlugin({
|
|
|
3628
3734
|
}
|
|
3629
3735
|
await collectReactDemos();
|
|
3630
3736
|
},
|
|
3631
|
-
enforce: "pre",
|
|
3632
3737
|
async handleHotUpdate({ file, modules, server }) {
|
|
3633
3738
|
if (isCssAsset(file)) {
|
|
3634
3739
|
return modules;
|
|
3635
3740
|
}
|
|
3741
|
+
if (file.endsWith(".mdx")) {
|
|
3742
|
+
return [];
|
|
3743
|
+
}
|
|
3636
3744
|
if (isDemoFile(file)) {
|
|
3637
3745
|
await handleDemoAdditionOrUpdate({ filePath: file });
|
|
3638
3746
|
} else {
|
|
3639
3747
|
const normalizedFile = resolve4(file);
|
|
3640
3748
|
const dependentDemos = relativeImportDependents.get(normalizedFile);
|
|
3641
3749
|
if (!dependentDemos?.size) {
|
|
3642
|
-
return
|
|
3750
|
+
return [];
|
|
3643
3751
|
}
|
|
3644
3752
|
for (const demoName of Array.from(dependentDemos)) {
|
|
3645
3753
|
const demo = demoRegistry2.get(demoName);
|
|
@@ -3657,7 +3765,7 @@ function reactDemoPlugin({
|
|
|
3657
3765
|
server.moduleGraph.invalidateModule(autoModule);
|
|
3658
3766
|
await server.reloadModule(autoModule);
|
|
3659
3767
|
}
|
|
3660
|
-
return
|
|
3768
|
+
return [];
|
|
3661
3769
|
},
|
|
3662
3770
|
async load(id) {
|
|
3663
3771
|
if (id === VIRTUAL_MODULE_IDS.AUTO) {
|
|
@@ -3751,7 +3859,17 @@ function reactDemoPlugin({
|
|
|
3751
3859
|
dark: theme.dark,
|
|
3752
3860
|
light: theme.light
|
|
3753
3861
|
},
|
|
3754
|
-
transformers: [
|
|
3862
|
+
transformers: [
|
|
3863
|
+
...getShikiTransformers(),
|
|
3864
|
+
{
|
|
3865
|
+
enforce: "post",
|
|
3866
|
+
name: "shiki-transformer-trim",
|
|
3867
|
+
preprocess(code2) {
|
|
3868
|
+
return code2.trim();
|
|
3869
|
+
}
|
|
3870
|
+
},
|
|
3871
|
+
...transformers
|
|
3872
|
+
]
|
|
3755
3873
|
});
|
|
3756
3874
|
} catch (error) {
|
|
3757
3875
|
console.warn(
|
|
@@ -4029,6 +4147,7 @@ export {
|
|
|
4029
4147
|
getRehypePlugins,
|
|
4030
4148
|
getRemarkPlugins,
|
|
4031
4149
|
getScriptKind,
|
|
4150
|
+
getShikiTransformers,
|
|
4032
4151
|
isCssAsset,
|
|
4033
4152
|
isDemoFile,
|
|
4034
4153
|
quiDocsPlugin,
|