@qualcomm-ui/mdx-vite 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +127 -55
- package/dist/cli.js.map +4 -4
- 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/doc-props/doc-props-indexer.d.ts +0 -1
- package/dist/docs-plugin/internal/services/doc-props/doc-props-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/mdx-utils.d.ts +3 -0
- package/dist/docs-plugin/internal/services/mdx-utils.d.ts.map +1 -0
- 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 +188 -65
- 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
package/dist/cli.js
CHANGED
|
@@ -3648,6 +3648,38 @@ import { visit } from "unist-util-visit";
|
|
|
3648
3648
|
import {
|
|
3649
3649
|
UniqueIdService
|
|
3650
3650
|
} from "@qualcomm-ui/mdx-common";
|
|
3651
|
+
|
|
3652
|
+
// src/docs-plugin/internal/services/mdx-utils.ts
|
|
3653
|
+
function extractNamesFromAttribute(attr) {
|
|
3654
|
+
if (!attr.value) {
|
|
3655
|
+
return [];
|
|
3656
|
+
}
|
|
3657
|
+
if (typeof attr.value === "string") {
|
|
3658
|
+
return [attr.value];
|
|
3659
|
+
}
|
|
3660
|
+
if (attr.value.type === "mdxJsxAttributeValueExpression") {
|
|
3661
|
+
const estree = attr.value.data?.estree;
|
|
3662
|
+
if (!estree?.body?.[0] || estree.body[0].type !== "ExpressionStatement") {
|
|
3663
|
+
return [];
|
|
3664
|
+
}
|
|
3665
|
+
const expression = estree.body[0].expression;
|
|
3666
|
+
if (expression.type === "ArrayExpression") {
|
|
3667
|
+
const names = [];
|
|
3668
|
+
for (const element of expression.elements) {
|
|
3669
|
+
if (element?.type === "Literal" && typeof element.value === "string") {
|
|
3670
|
+
names.push(element.value);
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
return names;
|
|
3674
|
+
}
|
|
3675
|
+
if (expression.type === "Literal" && typeof expression.value === "string") {
|
|
3676
|
+
return [expression.value];
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
return [];
|
|
3680
|
+
}
|
|
3681
|
+
|
|
3682
|
+
// src/docs-plugin/internal/services/doc-props/doc-props-indexer.ts
|
|
3651
3683
|
function extractPickPropsRecord(node) {
|
|
3652
3684
|
if (node.name !== "unionWithPick" || !node.value || typeof node.value === "string") {
|
|
3653
3685
|
return null;
|
|
@@ -3696,34 +3728,6 @@ var DocPropsIndexer = class {
|
|
|
3696
3728
|
this.idService.reset();
|
|
3697
3729
|
this.docPropsEntries = [];
|
|
3698
3730
|
}
|
|
3699
|
-
extractNamesFromAttribute(attr) {
|
|
3700
|
-
if (!attr.value) {
|
|
3701
|
-
return [];
|
|
3702
|
-
}
|
|
3703
|
-
if (typeof attr.value === "string") {
|
|
3704
|
-
return [attr.value];
|
|
3705
|
-
}
|
|
3706
|
-
if (attr.value.type === "mdxJsxAttributeValueExpression") {
|
|
3707
|
-
const estree = attr.value.data?.estree;
|
|
3708
|
-
if (!estree?.body?.[0] || estree.body[0].type !== "ExpressionStatement") {
|
|
3709
|
-
return [];
|
|
3710
|
-
}
|
|
3711
|
-
const expression = estree.body[0].expression;
|
|
3712
|
-
if (expression.type === "ArrayExpression") {
|
|
3713
|
-
const names = [];
|
|
3714
|
-
for (const element of expression.elements) {
|
|
3715
|
-
if (element?.type === "Literal" && typeof element.value === "string") {
|
|
3716
|
-
names.push(element.value);
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
return names;
|
|
3720
|
-
}
|
|
3721
|
-
if (expression.type === "Literal" && typeof expression.value === "string") {
|
|
3722
|
-
return [expression.value];
|
|
3723
|
-
}
|
|
3724
|
-
}
|
|
3725
|
-
return [];
|
|
3726
|
-
}
|
|
3727
3731
|
/**
|
|
3728
3732
|
* Finds all JSX `<TypeDocProps />` nodes on the current page and adds their names
|
|
3729
3733
|
* to an array. Once all nodes have been collected, we process them into
|
|
@@ -3739,9 +3743,9 @@ var DocPropsIndexer = class {
|
|
|
3739
3743
|
const omitFromAttr = node.attributes?.find(
|
|
3740
3744
|
(attr) => attr.name === "omitFrom"
|
|
3741
3745
|
);
|
|
3742
|
-
const omitFrom = omitFromAttr ?
|
|
3746
|
+
const omitFrom = omitFromAttr ? extractNamesFromAttribute(omitFromAttr) : void 0;
|
|
3743
3747
|
if (nameAttr) {
|
|
3744
|
-
const names =
|
|
3748
|
+
const names = extractNamesFromAttribute(nameAttr);
|
|
3745
3749
|
for (const name of names) {
|
|
3746
3750
|
this.docPropsEntries.push({ name, omitFrom });
|
|
3747
3751
|
if (name.endsWith("Props")) {
|
|
@@ -3882,12 +3886,15 @@ var MarkdownFileReader = class {
|
|
|
3882
3886
|
reset() {
|
|
3883
3887
|
this.cachedFileCount = 0;
|
|
3884
3888
|
}
|
|
3885
|
-
|
|
3889
|
+
readCache(filePath) {
|
|
3890
|
+
return this.mdxCache[filePath] || null;
|
|
3891
|
+
}
|
|
3892
|
+
checkCache(filePath, fileContents) {
|
|
3886
3893
|
if (!this.enabled) {
|
|
3887
3894
|
return;
|
|
3888
3895
|
}
|
|
3889
3896
|
const fileMd5 = this.hash(fileContents);
|
|
3890
|
-
const cached = this.mdxCache[
|
|
3897
|
+
const cached = this.mdxCache[filePath];
|
|
3891
3898
|
if (cached?.md5 !== fileMd5) {
|
|
3892
3899
|
return;
|
|
3893
3900
|
}
|
|
@@ -4408,9 +4415,9 @@ function getRouteMeta(pathSegments, metaJson) {
|
|
|
4408
4415
|
}
|
|
4409
4416
|
|
|
4410
4417
|
// src/docs-plugin/internal/services/nav-builder/nav-builder.ts
|
|
4411
|
-
import { capitalCase } from "change-case";
|
|
4412
4418
|
import { sortBy } from "lodash-es";
|
|
4413
4419
|
import { v4 as uuidv4 } from "uuid";
|
|
4420
|
+
import { capitalCase } from "@qualcomm-ui/utils/change-case";
|
|
4414
4421
|
var NavBuilder = class {
|
|
4415
4422
|
initialRoutes = [];
|
|
4416
4423
|
flatNavItems = [];
|
|
@@ -4695,8 +4702,8 @@ var NavBuilder = class {
|
|
|
4695
4702
|
};
|
|
4696
4703
|
|
|
4697
4704
|
// src/docs-plugin/internal/services/nav-builder/page-map.ts
|
|
4698
|
-
import { capitalCase as capitalCase2 } from "change-case";
|
|
4699
4705
|
import { join } from "node:path";
|
|
4706
|
+
import { capitalCase as capitalCase2 } from "@qualcomm-ui/utils/change-case";
|
|
4700
4707
|
function getPathnameFromPathSegments(segments) {
|
|
4701
4708
|
return `/${segments.join("/")}`;
|
|
4702
4709
|
}
|
|
@@ -4966,11 +4973,25 @@ var SearchIndexer = class {
|
|
|
4966
4973
|
* Parses an MDX file to extract the site data for the nav items, doc props,
|
|
4967
4974
|
* breadcrumbs, and search index.
|
|
4968
4975
|
*/
|
|
4969
|
-
compileMdxFile(
|
|
4970
|
-
const { cached, fileContents, frontmatter } = this.fileCache.readFile(
|
|
4976
|
+
compileMdxFile(filePath) {
|
|
4977
|
+
const { cached, fileContents, frontmatter } = this.fileCache.readFile(filePath);
|
|
4978
|
+
const metadata = {
|
|
4979
|
+
changed: {},
|
|
4980
|
+
filePath
|
|
4981
|
+
};
|
|
4982
|
+
if (!cached) {
|
|
4983
|
+
const previousData = this.fileCache.readCache(filePath);
|
|
4984
|
+
if (previousData) {
|
|
4985
|
+
const cachedFm = JSON.stringify(previousData.frontmatter);
|
|
4986
|
+
const currentFm = JSON.stringify(frontmatter);
|
|
4987
|
+
if (cachedFm !== currentFm) {
|
|
4988
|
+
metadata.changed.frontmatter = true;
|
|
4989
|
+
}
|
|
4990
|
+
}
|
|
4991
|
+
}
|
|
4971
4992
|
this.docPropsIndexer.reset();
|
|
4972
4993
|
this.markdownIndexer.reset();
|
|
4973
|
-
const defaultSection = this.getPageEntry(
|
|
4994
|
+
const defaultSection = this.getPageEntry(filePath, frontmatter);
|
|
4974
4995
|
if (!defaultSection.categories.length && defaultSection.title) {
|
|
4975
4996
|
defaultSection.categories = [defaultSection.title];
|
|
4976
4997
|
}
|
|
@@ -4985,9 +5006,9 @@ var SearchIndexer = class {
|
|
|
4985
5006
|
console.debug(
|
|
4986
5007
|
`${chalk2.yellowBright.bold(
|
|
4987
5008
|
"Failed to parse mdx page content."
|
|
4988
|
-
)} ${chalk2.blueBright.bold(
|
|
5009
|
+
)} ${chalk2.blueBright.bold(filePath)}`
|
|
4989
5010
|
);
|
|
4990
|
-
return [defaultSection];
|
|
5011
|
+
return { metadata, pageSections: [defaultSection] };
|
|
4991
5012
|
}
|
|
4992
5013
|
const { sections, toc } = indexedPage;
|
|
4993
5014
|
if (toc.length) {
|
|
@@ -5002,17 +5023,17 @@ var SearchIndexer = class {
|
|
|
5002
5023
|
if (docPropSections.length) {
|
|
5003
5024
|
this._pageDocProps[defaultSection.pathname] = docProps;
|
|
5004
5025
|
}
|
|
5005
|
-
this.fileCache.updateCache(
|
|
5026
|
+
this.fileCache.updateCache(filePath, fileContents, {
|
|
5006
5027
|
frontmatter,
|
|
5007
5028
|
page: indexedPage,
|
|
5008
5029
|
pageDocProps: docProps,
|
|
5009
5030
|
pageDocPropSections: docPropSections
|
|
5010
5031
|
});
|
|
5011
5032
|
if (frontmatter.hideFromSearch) {
|
|
5012
|
-
return [defaultSection];
|
|
5033
|
+
return { metadata, pageSections: [defaultSection] };
|
|
5013
5034
|
}
|
|
5014
5035
|
if (!sections.length && !docPropSections.length) {
|
|
5015
|
-
return [defaultSection];
|
|
5036
|
+
return { metadata, pageSections: [defaultSection] };
|
|
5016
5037
|
}
|
|
5017
5038
|
const sectionReturn = [
|
|
5018
5039
|
...this.formatSections(sections, defaultSection, false)
|
|
@@ -5022,7 +5043,7 @@ var SearchIndexer = class {
|
|
|
5022
5043
|
...this.formatSections(docPropSections, defaultSection, true)
|
|
5023
5044
|
);
|
|
5024
5045
|
}
|
|
5025
|
-
return sectionReturn;
|
|
5046
|
+
return { metadata, pageSections: sectionReturn };
|
|
5026
5047
|
}
|
|
5027
5048
|
formatSections(sections, { toc: _toc, ...defaultSection }, isDocProp) {
|
|
5028
5049
|
return sections.map((section, index) => {
|
|
@@ -5067,7 +5088,8 @@ var SearchIndexer = class {
|
|
|
5067
5088
|
this.config.routingStrategy
|
|
5068
5089
|
);
|
|
5069
5090
|
this._mdxFileCount = mdxFileGlob.length;
|
|
5070
|
-
const
|
|
5091
|
+
const compiledFiles = mdxFileGlob.map((file) => this.compileMdxFile(file));
|
|
5092
|
+
const mdxIndex = compiledFiles.map((fileData) => fileData.pageSections).flat();
|
|
5071
5093
|
filterFileGlob(
|
|
5072
5094
|
fileGlob,
|
|
5073
5095
|
"tsx",
|
|
@@ -5076,6 +5098,7 @@ var SearchIndexer = class {
|
|
|
5076
5098
|
).map((file) => this.compileTsxFile(file));
|
|
5077
5099
|
this._searchIndex.push(...mdxIndex.filter((entry) => !entry.hideFromSearch));
|
|
5078
5100
|
this.navBuilder.build();
|
|
5101
|
+
return compiledFiles;
|
|
5079
5102
|
}
|
|
5080
5103
|
};
|
|
5081
5104
|
|
|
@@ -5271,7 +5294,6 @@ function addDownloadKnowledgeCommand() {
|
|
|
5271
5294
|
}
|
|
5272
5295
|
|
|
5273
5296
|
// src/open-web-ui-knowledge/generate-knowledge.ts
|
|
5274
|
-
import { kebabCase } from "change-case";
|
|
5275
5297
|
import {
|
|
5276
5298
|
access,
|
|
5277
5299
|
mkdir as mkdir2,
|
|
@@ -5283,10 +5305,13 @@ import {
|
|
|
5283
5305
|
} from "node:fs/promises";
|
|
5284
5306
|
import { basename, dirname, extname, join as join3, resolve as resolve5 } from "node:path";
|
|
5285
5307
|
import remarkFrontmatter3 from "remark-frontmatter";
|
|
5308
|
+
import remarkMdx3 from "remark-mdx";
|
|
5286
5309
|
import remarkParse4 from "remark-parse";
|
|
5287
5310
|
import remarkParseFrontmatter2 from "remark-parse-frontmatter";
|
|
5288
5311
|
import remarkStringify3 from "remark-stringify";
|
|
5289
5312
|
import { unified as unified4 } from "unified";
|
|
5313
|
+
import { visit as visit7 } from "unist-util-visit";
|
|
5314
|
+
import { kebabCase } from "@qualcomm-ui/utils/change-case";
|
|
5290
5315
|
|
|
5291
5316
|
// src/docs-plugin/docs-plugin.ts
|
|
5292
5317
|
import chalk3 from "chalk";
|
|
@@ -5320,6 +5345,14 @@ var PluginState = class {
|
|
|
5320
5345
|
this.docPropsFilePath.lastIndexOf("/")
|
|
5321
5346
|
);
|
|
5322
5347
|
}
|
|
5348
|
+
get siteData() {
|
|
5349
|
+
return {
|
|
5350
|
+
navItems: state.indexer.navItems,
|
|
5351
|
+
pageDocProps: state.indexer.pageDocProps,
|
|
5352
|
+
pageMap: state.indexer.pageMap,
|
|
5353
|
+
searchIndex: state.indexer.searchIndex
|
|
5354
|
+
};
|
|
5355
|
+
}
|
|
5323
5356
|
resolveDocProps() {
|
|
5324
5357
|
if (!this.docPropsFilePath) {
|
|
5325
5358
|
return {};
|
|
@@ -5352,15 +5385,16 @@ var PluginState = class {
|
|
|
5352
5385
|
}
|
|
5353
5386
|
);
|
|
5354
5387
|
if (!files.length) {
|
|
5355
|
-
return;
|
|
5388
|
+
return [];
|
|
5356
5389
|
}
|
|
5357
5390
|
const startTime = Date.now();
|
|
5358
|
-
this.indexer.buildIndex(files, shouldLog);
|
|
5391
|
+
const compiledMdxFiles = this.indexer.buildIndex(files, shouldLog);
|
|
5359
5392
|
if (isDev && shouldLog) {
|
|
5360
5393
|
console.debug(
|
|
5361
5394
|
`${chalk3.magenta.bold(`@qualcomm-ui/mdx-vite/docs-plugin:`)} Compiled search index in: ${chalk3.blueBright.bold(prettyMilliseconds(Date.now() - startTime))}${state.indexer.cachedFileCount ? chalk3.greenBright.bold(` (${state.indexer.cachedFileCount}/${state.indexer.mdxFileCount} files cached)`) : ""}`
|
|
5362
5395
|
);
|
|
5363
5396
|
}
|
|
5397
|
+
return compiledMdxFiles;
|
|
5364
5398
|
}
|
|
5365
5399
|
/**
|
|
5366
5400
|
* When the user adds or removes mdx files, we re-index the site. This function
|
|
@@ -5404,7 +5438,13 @@ var PluginState = class {
|
|
|
5404
5438
|
const resolvedConfig = this.configLoader.loadConfig();
|
|
5405
5439
|
this.configFilePath = resolvedConfig.filePath;
|
|
5406
5440
|
this.createIndexer(resolvedConfig);
|
|
5407
|
-
this.handleChange(
|
|
5441
|
+
this.handleChange({
|
|
5442
|
+
onComplete: () => {
|
|
5443
|
+
this.servers.forEach(
|
|
5444
|
+
(server) => server.ws.send({ type: "full-reload" })
|
|
5445
|
+
);
|
|
5446
|
+
}
|
|
5447
|
+
});
|
|
5408
5448
|
});
|
|
5409
5449
|
}
|
|
5410
5450
|
};
|
|
@@ -5412,6 +5452,16 @@ var state = new PluginState();
|
|
|
5412
5452
|
|
|
5413
5453
|
// src/docs-plugin/mdx-plugins.ts
|
|
5414
5454
|
import rehypeShiki from "@shikijs/rehype";
|
|
5455
|
+
import {
|
|
5456
|
+
transformerNotationDiff,
|
|
5457
|
+
transformerNotationErrorLevel,
|
|
5458
|
+
transformerNotationFocus,
|
|
5459
|
+
transformerNotationHighlight,
|
|
5460
|
+
transformerNotationWordHighlight,
|
|
5461
|
+
transformerRemoveNotationEscape,
|
|
5462
|
+
transformerRenderIndentGuides
|
|
5463
|
+
} from "@shikijs/transformers";
|
|
5464
|
+
import { merge } from "lodash-es";
|
|
5415
5465
|
import { quiCustomDarkTheme } from "@qualcomm-ui/mdx-common";
|
|
5416
5466
|
|
|
5417
5467
|
// src/exports.ts
|
|
@@ -5637,9 +5687,8 @@ async function scanPages(routesFolder, verbose, excludePatterns = [], baseUrl) {
|
|
|
5637
5687
|
return;
|
|
5638
5688
|
}
|
|
5639
5689
|
const entries = await readdir(dirPath, { withFileTypes: true });
|
|
5640
|
-
const mdxFiles = entries.filter((f) => f.name.endsWith(".mdx"));
|
|
5641
|
-
|
|
5642
|
-
const mdxFile = mdxFiles[0];
|
|
5690
|
+
const mdxFiles = entries.filter((f) => f.name.endsWith(".mdx")) ?? [];
|
|
5691
|
+
for (const mdxFile of mdxFiles) {
|
|
5643
5692
|
const demosFolder = entries.find((f) => f.name === "demos");
|
|
5644
5693
|
const demosFolderPath = demosFolder ? join3(dirPath, demosFolder.name) : void 0;
|
|
5645
5694
|
const segments = getPathSegmentsFromFileName(
|
|
@@ -5803,6 +5852,25 @@ async function collectRelativeImports(filePath, visited = /* @__PURE__ */ new Se
|
|
|
5803
5852
|
}
|
|
5804
5853
|
return modules;
|
|
5805
5854
|
}
|
|
5855
|
+
var replaceNpmInstallTabs = () => {
|
|
5856
|
+
return (tree, _file, done) => {
|
|
5857
|
+
visit7(tree, "mdxJsxFlowElement", (node) => {
|
|
5858
|
+
if (node?.name === "NpmInstallTabs") {
|
|
5859
|
+
const packages = node.attributes?.find(
|
|
5860
|
+
(attr) => attr.type === "mdxJsxAttribute" && attr.name === "packages"
|
|
5861
|
+
);
|
|
5862
|
+
const packageNames = packages ? extractNamesFromAttribute(packages) : [];
|
|
5863
|
+
Object.assign(node, {
|
|
5864
|
+
lang: "shell",
|
|
5865
|
+
meta: null,
|
|
5866
|
+
type: "code",
|
|
5867
|
+
value: `npm install ${packageNames.join(" ")}`
|
|
5868
|
+
});
|
|
5869
|
+
}
|
|
5870
|
+
});
|
|
5871
|
+
done();
|
|
5872
|
+
};
|
|
5873
|
+
};
|
|
5806
5874
|
async function processMdxContent(mdxContent, pageUrl, demosFolder, docProps, verbose) {
|
|
5807
5875
|
let processedContent = mdxContent;
|
|
5808
5876
|
const demoFiles = [];
|
|
@@ -5844,10 +5912,10 @@ ${JSON.stringify(propsDoc, null, 2)}
|
|
|
5844
5912
|
} else {
|
|
5845
5913
|
processedContent = processedContent.replace(/<TypeDocProps\s+[^>]*\/>/g, "");
|
|
5846
5914
|
}
|
|
5847
|
-
let demoRegex = /<(?:QdsDemo|CodeDemo)\s+[^>]*name="(\w+)"[^>]*\/>/g;
|
|
5915
|
+
let demoRegex = /<(?:QdsDemo|CodeDemo|Demo)\s+[^>]*name="(\w+)"[^>]*\/>/g;
|
|
5848
5916
|
let demoMatches = Array.from(processedContent.matchAll(demoRegex));
|
|
5849
5917
|
if (!demoMatches.length) {
|
|
5850
|
-
demoRegex = /<(?:QdsDemo|CodeDemo)\s+[^>]*node=\{Demo\.(\w+)\}[^>]*\/>/g;
|
|
5918
|
+
demoRegex = /<(?:QdsDemo|CodeDemo|Demo)\s+[^>]*node=\{Demo\.(\w+)\}[^>]*\/>/g;
|
|
5851
5919
|
demoMatches = Array.from(processedContent.matchAll(demoRegex));
|
|
5852
5920
|
}
|
|
5853
5921
|
const replacements = await Promise.all(
|
|
@@ -5904,7 +5972,7 @@ async function processComponent(component, docProps, verbose) {
|
|
|
5904
5972
|
if (verbose) {
|
|
5905
5973
|
console.log(`Processing page: ${component.name}`);
|
|
5906
5974
|
}
|
|
5907
|
-
const processor = unified4().use(remarkParse4).use(remarkFrontmatter3, ["yaml"]).use(remarkParseFrontmatter2).use(remarkSelfLinkHeadings(component.url)).use(remarkStringify3);
|
|
5975
|
+
const processor = unified4().use(remarkParse4).use(remarkMdx3).use(replaceNpmInstallTabs).use(remarkFrontmatter3, ["yaml"]).use(remarkParseFrontmatter2).use(remarkSelfLinkHeadings(component.url)).use(remarkStringify3);
|
|
5908
5976
|
const parsed = await processor.process(mdxContent);
|
|
5909
5977
|
const frontmatter = parsed.data?.frontmatter || {};
|
|
5910
5978
|
const { content: processedContent, demoFiles } = await processMdxContent(
|
|
@@ -5914,7 +5982,11 @@ async function processComponent(component, docProps, verbose) {
|
|
|
5914
5982
|
docProps,
|
|
5915
5983
|
verbose
|
|
5916
5984
|
);
|
|
5917
|
-
const
|
|
5985
|
+
const removeJsxProcessor = unified4().use(remarkParse4).use(remarkMdx3).use(remarkRemoveJsx).use(remarkStringify3);
|
|
5986
|
+
const removedJsx = String(
|
|
5987
|
+
await removeJsxProcessor.process(processedContent)
|
|
5988
|
+
);
|
|
5989
|
+
const contentWithoutFrontmatter = removedJsx.replace(
|
|
5918
5990
|
/^---[\s\S]*?---\n/,
|
|
5919
5991
|
""
|
|
5920
5992
|
);
|