@qualcomm-ui/mdx-vite 3.7.3 → 3.8.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 +123 -13
- package/dist/cli.js.map +4 -4
- package/dist/docs-plugin/config/config-schema.d.ts +1 -1
- package/dist/docs-plugin/config/config-schema.d.ts.map +1 -1
- package/dist/docs-plugin/config/types.d.ts +1 -1
- package/dist/docs-plugin/config/types.d.ts.map +1 -1
- package/dist/docs-plugin/markdown/knowledge/knowledge-exporter.d.ts.map +1 -1
- package/dist/docs-plugin/markdown/knowledge/plugins/filter-text-directives.d.ts.map +1 -1
- package/dist/docs-plugin/mdx-plugins.d.ts.map +1 -1
- package/dist/docs-plugin/nav-builder/page-map.d.ts.map +1 -1
- package/dist/docs-plugin/remark/index.d.ts +1 -0
- package/dist/docs-plugin/remark/index.d.ts.map +1 -1
- package/dist/docs-plugin/remark/remark-serialize-jsx.d.ts +62 -0
- package/dist/docs-plugin/remark/remark-serialize-jsx.d.ts.map +1 -0
- package/dist/docs-plugin/search-indexer.d.ts.map +1 -1
- package/dist/index.js +168 -50
- package/dist/index.js.map +4 -4
- package/dist/tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -123,7 +123,11 @@ var configSchema = implement().with({
|
|
|
123
123
|
z2.literal("timestamp"),
|
|
124
124
|
z2.literal("user-and-timestamp")
|
|
125
125
|
]).optional(),
|
|
126
|
-
routingStrategy: z2.union([
|
|
126
|
+
routingStrategy: z2.union([
|
|
127
|
+
z2.literal("vite-generouted"),
|
|
128
|
+
z2.literal("react-router-directory-groups"),
|
|
129
|
+
z2.any()
|
|
130
|
+
]).optional(),
|
|
127
131
|
throwOnError: z2.boolean().optional(),
|
|
128
132
|
typeDocProps: z2.string().optional(),
|
|
129
133
|
typeDocPropsOptions: typeDocPropsSchema.optional(),
|
|
@@ -1072,8 +1076,60 @@ function remarkSelfLinkHeadings(baseUrl = "", options) {
|
|
|
1072
1076
|
};
|
|
1073
1077
|
}
|
|
1074
1078
|
|
|
1075
|
-
// src/docs-plugin/remark/remark-
|
|
1079
|
+
// src/docs-plugin/remark/remark-serialize-jsx.ts
|
|
1076
1080
|
import { visit as visit8 } from "unist-util-visit";
|
|
1081
|
+
function getSerializeJsxStartMatch(text) {
|
|
1082
|
+
return text.match(/^:::\s*serialize-jsx\s*$/);
|
|
1083
|
+
}
|
|
1084
|
+
function getSerializeJsxEndMatch(text) {
|
|
1085
|
+
return text.trim() === ":::";
|
|
1086
|
+
}
|
|
1087
|
+
function isSerializeJsxBlock(text) {
|
|
1088
|
+
return !!getSerializeJsxStartMatch(text) || !!getSerializeJsxEndMatch(text);
|
|
1089
|
+
}
|
|
1090
|
+
var isJsxNode = (node) => node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement";
|
|
1091
|
+
function createSerializeJsxPlugin(filter) {
|
|
1092
|
+
return () => (tree) => {
|
|
1093
|
+
visit8(tree, "paragraph", (node, index, parent) => {
|
|
1094
|
+
if (!parent || index === void 0) {
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
const firstChild = node.children[0];
|
|
1098
|
+
if (firstChild?.type !== "text") {
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
1101
|
+
if (!getSerializeJsxStartMatch(firstChild.value)) {
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
let endIndex = index + 1;
|
|
1105
|
+
const contentNodes = [];
|
|
1106
|
+
while (endIndex < parent.children.length) {
|
|
1107
|
+
const child = parent.children[endIndex];
|
|
1108
|
+
if (child.type === "paragraph") {
|
|
1109
|
+
const firstText = child.children[0];
|
|
1110
|
+
if (firstText?.type === "text" && getSerializeJsxEndMatch(firstText.value)) {
|
|
1111
|
+
break;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
contentNodes.push(child);
|
|
1115
|
+
endIndex++;
|
|
1116
|
+
}
|
|
1117
|
+
if (endIndex >= parent.children.length) {
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
parent.children.splice(
|
|
1121
|
+
index,
|
|
1122
|
+
endIndex - index + 1,
|
|
1123
|
+
...contentNodes.filter(filter)
|
|
1124
|
+
);
|
|
1125
|
+
});
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
var remarkSerializeJsxRender = createSerializeJsxPlugin(isJsxNode);
|
|
1129
|
+
var remarkSerializeJsxKnowledge = createSerializeJsxPlugin((n) => !isJsxNode(n));
|
|
1130
|
+
|
|
1131
|
+
// src/docs-plugin/remark/remark-spoilers.ts
|
|
1132
|
+
import { visit as visit9 } from "unist-util-visit";
|
|
1077
1133
|
function getSpoilerStartMatch(text) {
|
|
1078
1134
|
return text.match(/^:::\s*spoiler\s*(.*)$/);
|
|
1079
1135
|
}
|
|
@@ -1090,7 +1146,7 @@ var remarkSpoilers = (options = {}) => {
|
|
|
1090
1146
|
summaryClassName = []
|
|
1091
1147
|
} = options;
|
|
1092
1148
|
return (tree) => {
|
|
1093
|
-
|
|
1149
|
+
visit9(tree, "paragraph", (node, index, parent) => {
|
|
1094
1150
|
if (!parent || index === void 0) {
|
|
1095
1151
|
return;
|
|
1096
1152
|
}
|
|
@@ -1160,7 +1216,7 @@ var remarkSpoilers = (options = {}) => {
|
|
|
1160
1216
|
};
|
|
1161
1217
|
|
|
1162
1218
|
// src/docs-plugin/remark/remark-steps.ts
|
|
1163
|
-
import { visit as
|
|
1219
|
+
import { visit as visit10 } from "unist-util-visit";
|
|
1164
1220
|
var defaultAllowedHeadings = /* @__PURE__ */ new Set([2, 3, 4]);
|
|
1165
1221
|
function parseHeadingRange(value) {
|
|
1166
1222
|
const match = value.match(/^h([1-6])(?:-h([1-6]))?$/);
|
|
@@ -1192,7 +1248,7 @@ function isStepBlock(text) {
|
|
|
1192
1248
|
}
|
|
1193
1249
|
var remarkSteps = () => {
|
|
1194
1250
|
return (tree) => {
|
|
1195
|
-
|
|
1251
|
+
visit10(tree, "paragraph", (node, index, parent) => {
|
|
1196
1252
|
if (!parent || index === void 0) {
|
|
1197
1253
|
return;
|
|
1198
1254
|
}
|
|
@@ -1290,7 +1346,7 @@ function createRemarkProcessor(options = {}) {
|
|
|
1290
1346
|
import { minimatch as minimatch2 } from "minimatch";
|
|
1291
1347
|
import { readdir } from "node:fs/promises";
|
|
1292
1348
|
import { join as join5, relative } from "node:path";
|
|
1293
|
-
import { visit as
|
|
1349
|
+
import { visit as visit18 } from "unist-util-visit";
|
|
1294
1350
|
|
|
1295
1351
|
// src/docs-plugin/nav-builder/get-route-meta.ts
|
|
1296
1352
|
function getRouteMeta(pathSegments, metaJson) {
|
|
@@ -1645,7 +1701,10 @@ function isPathSeparator(char) {
|
|
|
1645
1701
|
return pathSeparatorRegex.test(char);
|
|
1646
1702
|
}
|
|
1647
1703
|
var indexRouteRegex = /((^|[.]|[+]\/)(index|_index))(\/[^\/]+)?$|(\/_?index\/)/;
|
|
1648
|
-
function getRemixFlatRoutesSegments(name, index,
|
|
1704
|
+
function getRemixFlatRoutesSegments(name, index, paramPrefixCharOrOptions = "$") {
|
|
1705
|
+
const options = typeof paramPrefixCharOrOptions === "string" ? { paramPrefixChar: paramPrefixCharOrOptions } : paramPrefixCharOrOptions;
|
|
1706
|
+
const paramPrefixChar = options.paramPrefixChar ?? "$";
|
|
1707
|
+
const directoryMode = options.directoryMode ?? false;
|
|
1649
1708
|
let routeSegments = [];
|
|
1650
1709
|
let i = 0;
|
|
1651
1710
|
let routeSegment = "";
|
|
@@ -1662,6 +1721,18 @@ function getRemixFlatRoutesSegments(name, index, paramPrefixChar = "$") {
|
|
|
1662
1721
|
name = name.replace(/\+\//g, ".");
|
|
1663
1722
|
hasPlus = true;
|
|
1664
1723
|
}
|
|
1724
|
+
if (directoryMode && /\//.test(name)) {
|
|
1725
|
+
if (name.endsWith(".route")) {
|
|
1726
|
+
const lastSlash = name.lastIndexOf("/");
|
|
1727
|
+
if (lastSlash >= 0) {
|
|
1728
|
+
const head = name.substring(0, lastSlash).replace(/\//g, ".");
|
|
1729
|
+
name = `${head}/${name.substring(lastSlash + 1)}`;
|
|
1730
|
+
}
|
|
1731
|
+
} else {
|
|
1732
|
+
name = name.replace(/\//g, ".");
|
|
1733
|
+
}
|
|
1734
|
+
hasPlus = true;
|
|
1735
|
+
}
|
|
1665
1736
|
const hasFolder = /\//.test(name);
|
|
1666
1737
|
if ((hasPlus && hasFolder || !hasPlus) && !(name.endsWith(".route") || name.endsWith(".index"))) {
|
|
1667
1738
|
const last = name.lastIndexOf("/");
|
|
@@ -1725,6 +1796,27 @@ function getRemixHybridRoutesPathSegments(filePath) {
|
|
|
1725
1796
|
indexRouteRegex.test(routeWithoutExtension)
|
|
1726
1797
|
);
|
|
1727
1798
|
}
|
|
1799
|
+
function getRemixHybridDirectoryRoutesPathSegments(filePath) {
|
|
1800
|
+
const routeWithoutExtension = filePath.substring(0, filePath.lastIndexOf("."));
|
|
1801
|
+
if (hasPrivateFolderSegment(routeWithoutExtension)) {
|
|
1802
|
+
return [];
|
|
1803
|
+
}
|
|
1804
|
+
return getRemixFlatRoutesSegments(
|
|
1805
|
+
routeWithoutExtension,
|
|
1806
|
+
indexRouteRegex.test(routeWithoutExtension),
|
|
1807
|
+
{ directoryMode: true }
|
|
1808
|
+
);
|
|
1809
|
+
}
|
|
1810
|
+
function hasPrivateFolderSegment(routeWithoutExtension) {
|
|
1811
|
+
const segments = routeWithoutExtension.split("/");
|
|
1812
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
1813
|
+
const segment = segments[i];
|
|
1814
|
+
if (segment.startsWith("_") && !segment.includes("+")) {
|
|
1815
|
+
return true;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
return false;
|
|
1819
|
+
}
|
|
1728
1820
|
function getPathSegmentsFromFileName(filePath, pageDirectory, strategy) {
|
|
1729
1821
|
const filePathWithoutPageDirectory = filePath.substring(
|
|
1730
1822
|
filePath.indexOf(pageDirectory) + pageDirectory.length + 1
|
|
@@ -1735,6 +1827,10 @@ function getPathSegmentsFromFileName(filePath, pageDirectory, strategy) {
|
|
|
1735
1827
|
switch (strategy) {
|
|
1736
1828
|
case "vite-generouted":
|
|
1737
1829
|
return getGeneroutedPathSegments(filePathWithoutPageDirectory);
|
|
1830
|
+
case "react-router-directory-groups":
|
|
1831
|
+
return getRemixHybridDirectoryRoutesPathSegments(
|
|
1832
|
+
filePathWithoutPageDirectory
|
|
1833
|
+
);
|
|
1738
1834
|
default:
|
|
1739
1835
|
return getRemixHybridRoutesPathSegments(filePathWithoutPageDirectory);
|
|
1740
1836
|
}
|
|
@@ -1749,8 +1845,24 @@ function filterFileGlob(fileGlob, ext, srcDir, router) {
|
|
|
1749
1845
|
(file) => file.split("/").filter((segment) => !restrictedPattern.test(segment)).join("/")
|
|
1750
1846
|
).map((file) => join(srcDir, file));
|
|
1751
1847
|
}
|
|
1848
|
+
if (typeof router === "string" && router === "react-router-directory-groups") {
|
|
1849
|
+
return fileGlob.filter(
|
|
1850
|
+
(file) => file.endsWith(ext) && !file.includes("$") && !hasPrivateFolderInRelativePath(file, srcDir)
|
|
1851
|
+
);
|
|
1852
|
+
}
|
|
1752
1853
|
return fileGlob.filter((file) => file.endsWith(ext) && !file.includes("$"));
|
|
1753
1854
|
}
|
|
1855
|
+
function hasPrivateFolderInRelativePath(file, srcDir) {
|
|
1856
|
+
const relative4 = file.startsWith(srcDir) ? file.slice(srcDir.length) : file;
|
|
1857
|
+
const segments = relative4.split("/").filter(Boolean);
|
|
1858
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
1859
|
+
const segment = segments[i];
|
|
1860
|
+
if (segment.startsWith("_") && !segment.includes("+")) {
|
|
1861
|
+
return true;
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
return false;
|
|
1865
|
+
}
|
|
1754
1866
|
|
|
1755
1867
|
// src/docs-plugin/nav-builder/transform-route-meta-array.ts
|
|
1756
1868
|
function transformRouteMetaArray(meta, routeMetaNav) {
|
|
@@ -1814,7 +1926,7 @@ function filterFrontmatter(frontmatter, config) {
|
|
|
1814
1926
|
// src/docs-plugin/markdown/knowledge/plugins/demo-plugin.ts
|
|
1815
1927
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
1816
1928
|
import { basename, extname, join as join3 } from "node:path";
|
|
1817
|
-
import { visit as
|
|
1929
|
+
import { visit as visit11 } from "unist-util-visit";
|
|
1818
1930
|
import { kebabCase } from "@qualcomm-ui/utils/change-case";
|
|
1819
1931
|
|
|
1820
1932
|
// src/docs-plugin/markdown/knowledge/utils.ts
|
|
@@ -1906,7 +2018,7 @@ async function collectDemoImports(demoCode, demoFilePath, visited = /* @__PURE__
|
|
|
1906
2018
|
function formatDemos(demosFolder, verbose) {
|
|
1907
2019
|
return () => async (tree) => {
|
|
1908
2020
|
const promises = [];
|
|
1909
|
-
|
|
2021
|
+
visit11(
|
|
1910
2022
|
tree,
|
|
1911
2023
|
"mdxJsxFlowElement",
|
|
1912
2024
|
(node, index, parent) => {
|
|
@@ -2024,14 +2136,14 @@ function formatDemos(demosFolder, verbose) {
|
|
|
2024
2136
|
// src/docs-plugin/markdown/knowledge/plugins/doc-props-plugin.ts
|
|
2025
2137
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
2026
2138
|
import { dirname as dirname2, join as join4, resolve as resolve3 } from "node:path";
|
|
2027
|
-
import { visit as
|
|
2139
|
+
import { visit as visit13 } from "unist-util-visit";
|
|
2028
2140
|
|
|
2029
2141
|
// src/docs-plugin/doc-props/doc-props-indexer.ts
|
|
2030
2142
|
import remarkMdx2 from "remark-mdx";
|
|
2031
2143
|
import remarkParse3 from "remark-parse";
|
|
2032
2144
|
import remarkStringify3 from "remark-stringify";
|
|
2033
2145
|
import { unified as unified3 } from "unified";
|
|
2034
|
-
import { visit as
|
|
2146
|
+
import { visit as visit12 } from "unist-util-visit";
|
|
2035
2147
|
import {
|
|
2036
2148
|
UniqueIdService
|
|
2037
2149
|
} from "@qualcomm-ui/mdx-common";
|
|
@@ -2091,7 +2203,7 @@ var DocPropsIndexer = class {
|
|
|
2091
2203
|
*/
|
|
2092
2204
|
getTypeDocPropsNodes = () => {
|
|
2093
2205
|
return (tree, _file, done) => {
|
|
2094
|
-
|
|
2206
|
+
visit12(tree, "mdxJsxFlowElement", (node) => {
|
|
2095
2207
|
if (node && "name" in node && docPropsJsxNodes.includes(node.name)) {
|
|
2096
2208
|
const nameAttr = node.attributes?.find(
|
|
2097
2209
|
(attr) => attr.name === "name"
|
|
@@ -2411,7 +2523,7 @@ ${tagContent.trim()}
|
|
|
2411
2523
|
*/
|
|
2412
2524
|
propsToMarkdownList() {
|
|
2413
2525
|
return () => (tree, _file, done) => {
|
|
2414
|
-
|
|
2526
|
+
visit13(
|
|
2415
2527
|
tree,
|
|
2416
2528
|
"mdxJsxFlowElement",
|
|
2417
2529
|
(node, index, parent) => {
|
|
@@ -2502,12 +2614,12 @@ ${propsToDefinitionList(outputs)}`);
|
|
|
2502
2614
|
};
|
|
2503
2615
|
|
|
2504
2616
|
// src/docs-plugin/markdown/knowledge/plugins/filter-text-directives.ts
|
|
2505
|
-
import { visit as
|
|
2617
|
+
import { visit as visit14 } from "unist-util-visit";
|
|
2506
2618
|
var filterTextDirectives = () => {
|
|
2507
2619
|
return (tree, _file, done) => {
|
|
2508
|
-
|
|
2620
|
+
visit14(tree, "text", (node) => {
|
|
2509
2621
|
const value = node.value?.trim?.();
|
|
2510
|
-
if (value && (isStepBlock(value) || isSpoilerBlock(value))) {
|
|
2622
|
+
if (value && (isStepBlock(value) || isSpoilerBlock(value) || isSerializeJsxBlock(value))) {
|
|
2511
2623
|
Object.assign(node, {
|
|
2512
2624
|
value: ``
|
|
2513
2625
|
});
|
|
@@ -2518,10 +2630,10 @@ var filterTextDirectives = () => {
|
|
|
2518
2630
|
};
|
|
2519
2631
|
|
|
2520
2632
|
// src/docs-plugin/markdown/knowledge/plugins/npm-install-tabs-plugin.ts
|
|
2521
|
-
import { visit as
|
|
2633
|
+
import { visit as visit15 } from "unist-util-visit";
|
|
2522
2634
|
var formatNpmInstallTabs = () => {
|
|
2523
2635
|
return (tree, _file, done) => {
|
|
2524
|
-
|
|
2636
|
+
visit15(
|
|
2525
2637
|
tree,
|
|
2526
2638
|
"mdxJsxFlowElement",
|
|
2527
2639
|
(node, index, parent) => {
|
|
@@ -2550,7 +2662,7 @@ var formatNpmInstallTabs = () => {
|
|
|
2550
2662
|
};
|
|
2551
2663
|
|
|
2552
2664
|
// src/docs-plugin/markdown/knowledge/plugins/qds-theme-plugin.ts
|
|
2553
|
-
import { visit as
|
|
2665
|
+
import { visit as visit16 } from "unist-util-visit";
|
|
2554
2666
|
function themeDataToJson(data, cssPropertyName) {
|
|
2555
2667
|
if (!data || typeof data !== "object") {
|
|
2556
2668
|
return "";
|
|
@@ -2609,7 +2721,7 @@ async function formatThemeNodes() {
|
|
|
2609
2721
|
}
|
|
2610
2722
|
};
|
|
2611
2723
|
return () => (tree, _file, done) => {
|
|
2612
|
-
|
|
2724
|
+
visit16(tree, "mdxJsxFlowElement", (node) => {
|
|
2613
2725
|
const handler = node.name && handlers[node.name];
|
|
2614
2726
|
if (!handler) {
|
|
2615
2727
|
return;
|
|
@@ -2645,12 +2757,12 @@ import { toString as toString2 } from "mdast-util-to-string";
|
|
|
2645
2757
|
import remarkGfm2 from "remark-gfm";
|
|
2646
2758
|
import remarkStringify4 from "remark-stringify";
|
|
2647
2759
|
import { unified as unified4 } from "unified";
|
|
2648
|
-
import { visit as
|
|
2760
|
+
import { visit as visit17 } from "unist-util-visit";
|
|
2649
2761
|
function transformLinks() {
|
|
2650
2762
|
return () => (tree) => {
|
|
2651
|
-
|
|
2763
|
+
visit17(tree, "link", (node) => {
|
|
2652
2764
|
let text = "";
|
|
2653
|
-
|
|
2765
|
+
visit17(node, "text", (textNode) => {
|
|
2654
2766
|
text += textNode.value;
|
|
2655
2767
|
});
|
|
2656
2768
|
Object.assign(node, {
|
|
@@ -3064,7 +3176,7 @@ ${pageEntry.content}`;
|
|
|
3064
3176
|
}
|
|
3065
3177
|
formatFrontmatterExpressions(frontmatter) {
|
|
3066
3178
|
return () => (tree) => {
|
|
3067
|
-
|
|
3179
|
+
visit18(
|
|
3068
3180
|
tree,
|
|
3069
3181
|
"mdxFlowExpression",
|
|
3070
3182
|
(node, index, parent) => {
|
|
@@ -3103,7 +3215,7 @@ ${pageEntry.content}`;
|
|
|
3103
3215
|
if (!baseUrl) {
|
|
3104
3216
|
return;
|
|
3105
3217
|
}
|
|
3106
|
-
|
|
3218
|
+
visit18(tree, "link", (node) => {
|
|
3107
3219
|
if (node.url.startsWith("/")) {
|
|
3108
3220
|
node.url = `${baseUrl}${node.url}`;
|
|
3109
3221
|
}
|
|
@@ -3117,6 +3229,7 @@ ${pageEntry.content}`;
|
|
|
3117
3229
|
gfm: true,
|
|
3118
3230
|
mdx: true,
|
|
3119
3231
|
plugins: [
|
|
3232
|
+
remarkSerializeJsxKnowledge,
|
|
3120
3233
|
formatNpmInstallTabs,
|
|
3121
3234
|
this.propFormatter.propsToMarkdownList(),
|
|
3122
3235
|
this.formatFrontmatterExpressions(frontmatter),
|
|
@@ -3209,7 +3322,7 @@ import { defined as defined2 } from "@qualcomm-ui/utils/guard";
|
|
|
3209
3322
|
// src/docs-plugin/link-validator.ts
|
|
3210
3323
|
import chalk2 from "chalk";
|
|
3211
3324
|
import { posix } from "node:path";
|
|
3212
|
-
import { visit as
|
|
3325
|
+
import { visit as visit19 } from "unist-util-visit";
|
|
3213
3326
|
var externalPrefixes = ["https://", "http://", "mailto:", "tel:"];
|
|
3214
3327
|
function isExternal(url) {
|
|
3215
3328
|
return externalPrefixes.some((prefix) => url.startsWith(prefix));
|
|
@@ -3235,7 +3348,7 @@ function resolveLink(url, sourcePathname) {
|
|
|
3235
3348
|
}
|
|
3236
3349
|
function collectLinks(tree, sourceFile, sourcePathname) {
|
|
3237
3350
|
const links = [];
|
|
3238
|
-
|
|
3351
|
+
visit19(tree, "link", (node) => {
|
|
3239
3352
|
const resolved = resolveLink(node.url, sourcePathname);
|
|
3240
3353
|
if (!resolved) {
|
|
3241
3354
|
return;
|
|
@@ -3267,8 +3380,8 @@ function collectAnchorIds(tree) {
|
|
|
3267
3380
|
anchorIds.add(id);
|
|
3268
3381
|
}
|
|
3269
3382
|
};
|
|
3270
|
-
|
|
3271
|
-
|
|
3383
|
+
visit19(tree, "mdxJsxFlowElement", collectAnchorId);
|
|
3384
|
+
visit19(tree, "mdxJsxTextElement", collectAnchorId);
|
|
3272
3385
|
return anchorIds;
|
|
3273
3386
|
}
|
|
3274
3387
|
function validateLinks(links, pageMap, docPropIds, anchorIds) {
|
|
@@ -3475,6 +3588,7 @@ var SearchIndexer = class {
|
|
|
3475
3588
|
gfm: true,
|
|
3476
3589
|
interpolateFrontmatter: frontmatter,
|
|
3477
3590
|
mdx: true,
|
|
3591
|
+
plugins: [remarkSerializeJsxKnowledge],
|
|
3478
3592
|
removeJsx: true,
|
|
3479
3593
|
removeMermaidCodeBlocks: true
|
|
3480
3594
|
});
|
|
@@ -4076,7 +4190,7 @@ import remarkMdxFrontmatter from "remark-mdx-frontmatter";
|
|
|
4076
4190
|
// src/docs-plugin/rehype/rehype-slug.ts
|
|
4077
4191
|
import { headingRank } from "hast-util-heading-rank";
|
|
4078
4192
|
import { toString as toString3 } from "hast-util-to-string";
|
|
4079
|
-
import { visit as
|
|
4193
|
+
import { visit as visit20 } from "unist-util-visit";
|
|
4080
4194
|
var emptyOptions2 = {};
|
|
4081
4195
|
var rehypeSlug = (options) => {
|
|
4082
4196
|
const settings = options || emptyOptions2;
|
|
@@ -4087,7 +4201,7 @@ var rehypeSlug = (options) => {
|
|
|
4087
4201
|
const slugGenerator = new SlugGenerator();
|
|
4088
4202
|
return (tree) => {
|
|
4089
4203
|
slugGenerator.reset();
|
|
4090
|
-
|
|
4204
|
+
visit20(tree, "element", function(node) {
|
|
4091
4205
|
if (headingRank(node) && !node.properties.id && allowedHeadings.has(node.tagName)) {
|
|
4092
4206
|
node.properties.id = prefix + slugGenerator.createSlug(toString3(node));
|
|
4093
4207
|
}
|
|
@@ -4447,6 +4561,7 @@ function getRemarkPlugins() {
|
|
|
4447
4561
|
remarkFrontmatterDescription,
|
|
4448
4562
|
remarkSpoilers,
|
|
4449
4563
|
remarkSteps,
|
|
4564
|
+
remarkSerializeJsxRender,
|
|
4450
4565
|
remarkExtractMeta
|
|
4451
4566
|
];
|
|
4452
4567
|
}
|
|
@@ -4458,7 +4573,7 @@ import { readFile as readFile4 } from "node:fs/promises";
|
|
|
4458
4573
|
import postcss from "postcss";
|
|
4459
4574
|
import selectorParser from "postcss-selector-parser";
|
|
4460
4575
|
import { compile } from "tailwindcss";
|
|
4461
|
-
import { visit as
|
|
4576
|
+
import { visit as visit21 } from "unist-util-visit";
|
|
4462
4577
|
import { camelCase } from "@qualcomm-ui/utils/change-case";
|
|
4463
4578
|
async function loadStylesheetContent(id) {
|
|
4464
4579
|
const resolveId = id === "tailwindcss" ? "tailwindcss/index.css" : id;
|
|
@@ -5133,7 +5248,7 @@ function angularDemoPlugin({
|
|
|
5133
5248
|
}
|
|
5134
5249
|
async function extractRelativeImports2(filePath) {
|
|
5135
5250
|
try {
|
|
5136
|
-
let
|
|
5251
|
+
let visit23 = function(node) {
|
|
5137
5252
|
if (ts2.isImportDeclaration(node)) {
|
|
5138
5253
|
const moduleSpecifier = node.moduleSpecifier;
|
|
5139
5254
|
if (ts2.isStringLiteral(moduleSpecifier)) {
|
|
@@ -5152,9 +5267,9 @@ function angularDemoPlugin({
|
|
|
5152
5267
|
}
|
|
5153
5268
|
}
|
|
5154
5269
|
}
|
|
5155
|
-
ts2.forEachChild(node,
|
|
5270
|
+
ts2.forEachChild(node, visit23);
|
|
5156
5271
|
};
|
|
5157
|
-
var
|
|
5272
|
+
var visit22 = visit23;
|
|
5158
5273
|
const content = await readFile5(filePath, "utf-8");
|
|
5159
5274
|
const sourceFile = ts2.createSourceFile(
|
|
5160
5275
|
filePath,
|
|
@@ -5164,7 +5279,7 @@ function angularDemoPlugin({
|
|
|
5164
5279
|
ts2.ScriptKind.TS
|
|
5165
5280
|
);
|
|
5166
5281
|
const relativeImports = [];
|
|
5167
|
-
|
|
5282
|
+
visit23(sourceFile);
|
|
5168
5283
|
return relativeImports;
|
|
5169
5284
|
} catch (error) {
|
|
5170
5285
|
logDev(
|
|
@@ -5187,16 +5302,16 @@ function angularDemoPlugin({
|
|
|
5187
5302
|
}
|
|
5188
5303
|
function stripImports(code, fileName) {
|
|
5189
5304
|
try {
|
|
5190
|
-
let
|
|
5305
|
+
let visit23 = function(node) {
|
|
5191
5306
|
if (ts2.isImportDeclaration(node)) {
|
|
5192
5307
|
importRanges.push({
|
|
5193
5308
|
end: node.getEnd(),
|
|
5194
5309
|
start: node.getFullStart()
|
|
5195
5310
|
});
|
|
5196
5311
|
}
|
|
5197
|
-
ts2.forEachChild(node,
|
|
5312
|
+
ts2.forEachChild(node, visit23);
|
|
5198
5313
|
};
|
|
5199
|
-
var
|
|
5314
|
+
var visit22 = visit23;
|
|
5200
5315
|
const sourceFile = ts2.createSourceFile(
|
|
5201
5316
|
fileName,
|
|
5202
5317
|
code,
|
|
@@ -5205,7 +5320,7 @@ function angularDemoPlugin({
|
|
|
5205
5320
|
ts2.ScriptKind.TS
|
|
5206
5321
|
);
|
|
5207
5322
|
const importRanges = [];
|
|
5208
|
-
|
|
5323
|
+
visit23(sourceFile);
|
|
5209
5324
|
return importRanges.map((range) => {
|
|
5210
5325
|
let endPos = range.end;
|
|
5211
5326
|
if (code[endPos] === "\n") {
|
|
@@ -5317,7 +5432,7 @@ function angularDemoPlugin({
|
|
|
5317
5432
|
let templateUrl = null;
|
|
5318
5433
|
let hasDefaultExport = false;
|
|
5319
5434
|
const importsFromAst = [];
|
|
5320
|
-
function
|
|
5435
|
+
function visit22(node) {
|
|
5321
5436
|
if (ts2.isImportDeclaration(node)) {
|
|
5322
5437
|
importsFromAst.push(node.getFullText(sourceFile).trim());
|
|
5323
5438
|
}
|
|
@@ -5365,9 +5480,9 @@ function angularDemoPlugin({
|
|
|
5365
5480
|
if (ts2.isExportAssignment(node) && !node.isExportEquals) {
|
|
5366
5481
|
hasDefaultExport = true;
|
|
5367
5482
|
}
|
|
5368
|
-
ts2.forEachChild(node,
|
|
5483
|
+
ts2.forEachChild(node, visit22);
|
|
5369
5484
|
}
|
|
5370
|
-
|
|
5485
|
+
visit22(sourceFile);
|
|
5371
5486
|
return {
|
|
5372
5487
|
componentClass,
|
|
5373
5488
|
hasDefaultExport,
|
|
@@ -5824,7 +5939,7 @@ function extractImports(code, fileName) {
|
|
|
5824
5939
|
);
|
|
5825
5940
|
const thirdPartyImports = [];
|
|
5826
5941
|
const relativeImports = [];
|
|
5827
|
-
function
|
|
5942
|
+
function visit22(node) {
|
|
5828
5943
|
if (ts3.isImportDeclaration(node)) {
|
|
5829
5944
|
const importSpec = parseImportDeclaration(node, fileName);
|
|
5830
5945
|
if (importSpec) {
|
|
@@ -5835,9 +5950,9 @@ function extractImports(code, fileName) {
|
|
|
5835
5950
|
}
|
|
5836
5951
|
}
|
|
5837
5952
|
}
|
|
5838
|
-
ts3.forEachChild(node,
|
|
5953
|
+
ts3.forEachChild(node, visit22);
|
|
5839
5954
|
}
|
|
5840
|
-
|
|
5955
|
+
visit22(sourceFile);
|
|
5841
5956
|
return { relativeImports, thirdPartyImports };
|
|
5842
5957
|
}
|
|
5843
5958
|
function getScriptKind(fileName) {
|
|
@@ -6459,16 +6574,16 @@ function reactDemoPlugin({
|
|
|
6459
6574
|
}
|
|
6460
6575
|
function stripImports(code, fileName) {
|
|
6461
6576
|
try {
|
|
6462
|
-
let
|
|
6577
|
+
let visit23 = function(node) {
|
|
6463
6578
|
if (ts4.isImportDeclaration(node)) {
|
|
6464
6579
|
importRanges.push({
|
|
6465
6580
|
end: node.getEnd(),
|
|
6466
6581
|
start: node.getFullStart()
|
|
6467
6582
|
});
|
|
6468
6583
|
}
|
|
6469
|
-
ts4.forEachChild(node,
|
|
6584
|
+
ts4.forEachChild(node, visit23);
|
|
6470
6585
|
};
|
|
6471
|
-
var
|
|
6586
|
+
var visit22 = visit23;
|
|
6472
6587
|
const sourceFile = ts4.createSourceFile(
|
|
6473
6588
|
fileName,
|
|
6474
6589
|
code,
|
|
@@ -6477,7 +6592,7 @@ function reactDemoPlugin({
|
|
|
6477
6592
|
getScriptKind(fileName)
|
|
6478
6593
|
);
|
|
6479
6594
|
const importRanges = [];
|
|
6480
|
-
|
|
6595
|
+
visit23(sourceFile);
|
|
6481
6596
|
return importRanges.map((range) => {
|
|
6482
6597
|
let endPos = range.end;
|
|
6483
6598
|
if (code[endPos] === "\n") {
|
|
@@ -6534,6 +6649,7 @@ export {
|
|
|
6534
6649
|
getShikiTransformers,
|
|
6535
6650
|
isCssAsset,
|
|
6536
6651
|
isDemoFile,
|
|
6652
|
+
isSerializeJsxBlock,
|
|
6537
6653
|
isSpoilerBlock,
|
|
6538
6654
|
isStepBlock,
|
|
6539
6655
|
navMetaSchema,
|
|
@@ -6554,6 +6670,8 @@ export {
|
|
|
6554
6670
|
remarkRemoveJsx,
|
|
6555
6671
|
remarkRemoveMermaidCodeBlocks,
|
|
6556
6672
|
remarkSelfLinkHeadings,
|
|
6673
|
+
remarkSerializeJsxKnowledge,
|
|
6674
|
+
remarkSerializeJsxRender,
|
|
6557
6675
|
remarkSpoilers,
|
|
6558
6676
|
remarkSteps,
|
|
6559
6677
|
routeMetaSchema
|