mintlify 1.1.6 → 1.1.8
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/CONTRIBUTING.md +5 -0
- package/bin/index.js +1 -8
- package/bin/index.js.map +1 -1
- package/bin/local-preview/injectNav.js +94 -0
- package/bin/local-preview/injectNav.js.map +1 -0
- package/bin/mint/client/.babel-plugin-macrosrc.json +5 -0
- package/bin/mint/client/.babelrc +4 -0
- package/bin/mint/client/.editorconfig +12 -0
- package/bin/mint/client/.eslintrc.json +7 -0
- package/bin/mint/client/.prettierignore +4 -0
- package/bin/mint/client/.prettierrc +14 -0
- package/bin/mint/client/.vscode/launch.json +28 -0
- package/bin/mint/client/README.md +44 -0
- package/bin/mint/client/jest.config.ts +195 -0
- package/bin/mint/client/next-env.d.ts +4 -0
- package/bin/mint/client/next.config.js +152 -0
- package/bin/mint/client/package.json +139 -0
- package/bin/mint/client/postcss.config.cjs +9 -0
- package/bin/mint/client/prebuild/faviconConfig.js +35 -0
- package/bin/mint/client/prebuild/getOpenApiContext.js +53 -0
- package/bin/mint/client/prebuild/index.js +117 -0
- package/bin/mint/client/prebuild/injectNav.js +115 -0
- package/bin/mint/client/prebuild/slugToTitle.js +7 -0
- package/bin/mint/client/rehype/withApiComponents.js +60 -0
- package/bin/mint/client/rehype/withCodeBlocks.js +54 -0
- package/bin/mint/client/rehype/withLayouts.js +113 -0
- package/bin/mint/client/rehype/withLinkRoles.js +13 -0
- package/bin/mint/client/rehype/withRawComponents.js +13 -0
- package/bin/mint/client/rehype/withStaticProps.js +25 -0
- package/bin/mint/client/rehype/withSyntaxHighlighting.js +60 -0
- package/bin/mint/client/remark/utils.js +369 -0
- package/bin/mint/client/remark/withFrames.js +55 -0
- package/bin/mint/client/remark/withImportsInjected.js +36 -0
- package/bin/mint/client/remark/withNextLinks.js +37 -0
- package/bin/mint/client/remark/withTableOfContents.js +71 -0
- package/bin/mint/client/scripts/local.js +177 -0
- package/bin/mint/client/sentry.client.config.js +15 -0
- package/bin/mint/client/sentry.properties +4 -0
- package/bin/mint/client/sentry.server.config.js +15 -0
- package/bin/mint/client/src/analytics/AbstractAnalyticsImplementation.ts +50 -0
- package/bin/mint/client/src/analytics/AnalyticsContext.ts +5 -0
- package/bin/mint/client/src/analytics/AnalyticsMediator.ts +101 -0
- package/bin/mint/client/src/analytics/FakeAnalyticsMediator.ts +9 -0
- package/bin/mint/client/src/analytics/GA4Script.tsx +33 -0
- package/bin/mint/client/src/analytics/implementations/amplitude.ts +26 -0
- package/bin/mint/client/src/analytics/implementations/fathom.ts +38 -0
- package/bin/mint/client/src/analytics/implementations/ga4.ts +33 -0
- package/bin/mint/client/src/analytics/implementations/hotjar.ts +53 -0
- package/bin/mint/client/src/analytics/implementations/mixpanel-browser.d.ts +1 -0
- package/bin/mint/client/src/analytics/implementations/mixpanel.ts +52 -0
- package/bin/mint/client/src/analytics/implementations/posthog.ts +37 -0
- package/bin/mint/client/src/components/Accordion/Accordion.tsx +43 -0
- package/bin/mint/client/src/components/Accordion/index.ts +4 -0
- package/bin/mint/client/src/components/ApiExample.tsx +9 -0
- package/bin/mint/client/src/components/Card.tsx +51 -0
- package/bin/mint/client/src/components/CodeGroup.tsx +132 -0
- package/bin/mint/client/src/components/Editor.tsx +12 -0
- package/bin/mint/client/src/components/Expandable.tsx +40 -0
- package/bin/mint/client/src/components/Heading.tsx +84 -0
- package/bin/mint/client/src/components/Param.tsx +56 -0
- package/bin/mint/client/src/components/Request.tsx +19 -0
- package/bin/mint/client/src/components/ResponseField.tsx +33 -0
- package/bin/mint/client/src/components/TabBar.tsx +61 -0
- package/bin/mint/client/src/config.ts +115 -0
- package/bin/mint/client/src/css/bar-of-progress.css +10 -0
- package/bin/mint/client/src/css/base.css +29 -0
- package/bin/mint/client/src/css/font-awesome.css +7 -0
- package/bin/mint/client/src/css/fonts.css +44 -0
- package/bin/mint/client/src/css/main.css +11 -0
- package/bin/mint/client/src/css/prism.css +270 -0
- package/bin/mint/client/src/css/utilities.css +43 -0
- package/bin/mint/client/src/enums/components.ts +8 -0
- package/bin/mint/client/src/fonts/FiraCode-VF.woff +0 -0
- package/bin/mint/client/src/fonts/FiraCode-VF.woff2 +0 -0
- package/bin/mint/client/src/fonts/IBMPlexMono-Regular.ttf +0 -0
- package/bin/mint/client/src/fonts/IBMPlexMono-SemiBold.ttf +0 -0
- package/bin/mint/client/src/fonts/Inter-italic-latin.var.woff2 +0 -0
- package/bin/mint/client/src/fonts/Inter-roman-latin.var.woff2 +0 -0
- package/bin/mint/client/src/fonts/Pally-Variable.ttf +0 -0
- package/bin/mint/client/src/fonts/SourceSansPro-Regular.otf +0 -0
- package/bin/mint/client/src/fonts/SourceSerifPro-Regular.ttf +0 -0
- package/bin/mint/client/src/fonts/Synonym-Variable.ttf +0 -0
- package/bin/mint/client/src/fonts/Ubuntu-Mono-bold.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-Regular.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/IBMPlexMono-SemiBold.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/Pally-Variable-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/Pally-Variable-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/Pally-Variable.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/SourceSerifPro-Regular.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/Synonym-Variable-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/Synonym-Variable-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/Synonym-Variable.module.css +11 -0
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular-subset.woff2 +0 -0
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular-subset.zopfli.woff +0 -0
- package/bin/mint/client/src/fonts/generated/TenorSans-Regular.module.css +11 -0
- package/bin/mint/client/src/hooks/useActionKey.ts +20 -0
- package/bin/mint/client/src/hooks/useIsomorphicLayoutEffect.ts +3 -0
- package/bin/mint/client/src/hooks/useMedia.ts +27 -0
- package/bin/mint/client/src/hooks/usePrevNext.ts +34 -0
- package/bin/mint/client/src/hooks/useTop.ts +15 -0
- package/bin/mint/client/src/icons/CopyToClipboard.tsx +33 -0
- package/bin/mint/client/src/index.d.ts +1 -0
- package/bin/mint/client/src/layouts/ApiSupplemental.tsx +173 -0
- package/bin/mint/client/src/layouts/ContentsLayout.tsx +256 -0
- package/bin/mint/client/src/layouts/DocumentationLayout.tsx +44 -0
- package/bin/mint/client/src/layouts/OpenApiContent.tsx +301 -0
- package/bin/mint/client/src/layouts/SidebarLayout.tsx +412 -0
- package/bin/mint/client/src/layouts/UserFeedback.tsx +73 -0
- package/bin/mint/client/src/layouts/getGroupsInDivision.ts +25 -0
- package/bin/mint/client/src/layouts/isPathInGroupPages.ts +10 -0
- package/bin/mint/client/src/metadata.ts +58 -0
- package/bin/mint/client/src/nav.json +219 -0
- package/bin/mint/client/src/openapi.ts +3 -0
- package/bin/mint/client/src/pages/404.tsx +73 -0
- package/bin/mint/client/src/pages/_app.tsx +138 -0
- package/bin/mint/client/src/pages/_document.tsx +57 -0
- package/bin/mint/client/src/pages/api/issue.ts +10 -0
- package/bin/mint/client/src/pages/api/name.ts +8 -0
- package/bin/mint/client/src/pages/api/request.ts +31 -0
- package/bin/mint/client/src/pages/api/suggest.ts +10 -0
- package/bin/mint/client/src/pages/api/syntax-highlighted-json.ts +13 -0
- package/bin/mint/client/src/pages/api/utils.ts +6 -0
- package/bin/mint/client/src/pages/index.tsx +31 -0
- package/bin/mint/client/src/ui/Api.tsx +359 -0
- package/bin/mint/client/src/ui/Footer.tsx +124 -0
- package/bin/mint/client/src/ui/Header.tsx +370 -0
- package/bin/mint/client/src/ui/Logo.tsx +55 -0
- package/bin/mint/client/src/ui/PageHeader.tsx +51 -0
- package/bin/mint/client/src/ui/Search.tsx +386 -0
- package/bin/mint/client/src/ui/ThemeToggle.tsx +285 -0
- package/bin/mint/client/src/ui/Title.tsx +22 -0
- package/bin/mint/client/src/ui/TopLevelLink.tsx +122 -0
- package/bin/mint/client/src/utils/api.ts +252 -0
- package/bin/mint/client/src/utils/brands.ts +217 -0
- package/bin/mint/client/src/utils/castArray.ts +3 -0
- package/bin/mint/client/src/utils/childrenArray.ts +3 -0
- package/bin/mint/client/src/utils/fit.ts +27 -0
- package/bin/mint/client/src/utils/fontAwesome.ts +577 -0
- package/bin/mint/client/src/utils/getAnalyticsConfig.ts +14 -0
- package/bin/mint/client/src/utils/getLogoHref.ts +9 -0
- package/bin/mint/client/src/utils/getOpenApiContext.ts +26 -0
- package/bin/mint/client/src/utils/importAll.ts +6 -0
- package/bin/mint/client/src/utils/isObject.ts +3 -0
- package/bin/mint/client/src/utils/kebabToTitleCase.ts +3 -0
- package/bin/mint/client/src/utils/loadImage.ts +8 -0
- package/bin/mint/client/src/utils/slugToTitle.ts +7 -0
- package/bin/mint/client/src/utils/wait.ts +5 -0
- package/bin/mint/client/tailwind.config.cjs +323 -0
- package/bin/mint/client/test/test.test.ts +5 -0
- package/bin/mint/client/tsconfig.json +36 -0
- package/bin/mint/client/yarn.lock +9702 -0
- package/bin/scraping/detectFramework.js +12 -3
- package/bin/scraping/detectFramework.js.map +1 -1
- package/bin/scraping/scrapeFileGettingFileNameFromUrl.js +2 -2
- package/bin/scraping/scrapeFileGettingFileNameFromUrl.js.map +1 -1
- package/bin/scraping/scrapeGettingFileNameFromUrl.js +3 -3
- package/bin/scraping/scrapeGettingFileNameFromUrl.js.map +1 -1
- package/bin/scraping/scrapePage.js +2 -2
- package/bin/scraping/scrapePage.js.map +1 -1
- package/bin/scraping/scrapePageCommands.js +6 -6
- package/bin/scraping/scrapePageCommands.js.map +1 -1
- package/bin/scraping/scrapeSection.js +2 -2
- package/bin/scraping/scrapeSection.js.map +1 -1
- package/bin/scraping/scrapeSectionCommands.js +8 -7
- package/bin/scraping/scrapeSectionCommands.js.map +1 -1
- package/bin/scraping/site-scrapers/links-per-group/getDocusaurusLinksPerGroup.js +36 -0
- package/bin/scraping/site-scrapers/links-per-group/getDocusaurusLinksPerGroup.js.map +1 -0
- package/bin/scraping/site-scrapers/links-per-group/getLinksRecursively.js +38 -0
- package/bin/scraping/site-scrapers/links-per-group/getLinksRecursively.js.map +1 -0
- package/bin/scraping/site-scrapers/scrapeDocusaurusPage.js +14 -8
- package/bin/scraping/site-scrapers/scrapeDocusaurusPage.js.map +1 -1
- package/bin/scraping/site-scrapers/scrapeDocusaurusSection.js +4 -29
- package/bin/scraping/site-scrapers/scrapeDocusaurusSection.js.map +1 -1
- package/bin/scraping/site-scrapers/scrapeGitBookPage.js +2 -1
- package/bin/scraping/site-scrapers/scrapeGitBookPage.js.map +1 -1
- package/bin/scraping/site-scrapers/scrapeGitBookSection.js +7 -5
- package/bin/scraping/site-scrapers/scrapeGitBookSection.js.map +1 -1
- package/bin/scraping/site-scrapers/scrapeReadMePage.js +2 -1
- package/bin/scraping/site-scrapers/scrapeReadMePage.js.map +1 -1
- package/bin/scraping/site-scrapers/scrapeReadMeSection.js +3 -3
- package/bin/scraping/site-scrapers/scrapeReadMeSection.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -16
- package/src/scraping/detectFramework.ts +13 -3
- package/src/scraping/scrapeFileGettingFileNameFromUrl.ts +5 -2
- package/src/scraping/scrapeGettingFileNameFromUrl.ts +5 -1
- package/src/scraping/scrapePage.ts +6 -3
- package/src/scraping/scrapePageCommands.ts +10 -6
- package/src/scraping/scrapeSection.ts +9 -2
- package/src/scraping/scrapeSectionCommands.ts +24 -7
- package/src/scraping/site-scrapers/links-per-group/getDocusaurusLinksPerGroup.ts +46 -0
- package/src/scraping/site-scrapers/{getLinksRecursively.ts → links-per-group/getLinksRecursively.ts} +0 -0
- package/src/scraping/site-scrapers/scrapeDocusaurusPage.ts +20 -8
- package/src/scraping/site-scrapers/scrapeDocusaurusSection.ts +9 -33
- package/src/scraping/site-scrapers/scrapeGitBookPage.ts +2 -1
- package/src/scraping/site-scrapers/scrapeGitBookSection.ts +9 -5
- package/src/scraping/site-scrapers/scrapeReadMePage.ts +2 -1
- package/src/scraping/site-scrapers/scrapeReadMeSection.ts +4 -2
- package/bin/local-preview/helper-commands/cleanCommand.js +0 -8
- package/bin/local-preview/helper-commands/cleanCommand.js.map +0 -1
package/CONTRIBUTING.md
ADDED
package/bin/index.js
CHANGED
|
@@ -4,10 +4,9 @@ import { hideBin } from "yargs/helpers";
|
|
|
4
4
|
import initCommand from "./init-command/index.js";
|
|
5
5
|
import generatePageTemplate from "./pageTemplate.js";
|
|
6
6
|
import { scrapePageAutomatically, scrapePageWrapper, } from "./scraping/scrapePageCommands.js";
|
|
7
|
-
import { scrapeDocusaurusPage } from "./scraping/site-scrapers/scrapeDocusaurusPage.js";
|
|
8
7
|
import { scrapeGitBookPage } from "./scraping/site-scrapers/scrapeGitBookPage.js";
|
|
9
8
|
import { scrapeReadMePage } from "./scraping/site-scrapers/scrapeReadMePage.js";
|
|
10
|
-
import { scrapeSectionAutomatically, scrapeSectionAxiosWrapper, scrapeGitbookSectionCommand,
|
|
9
|
+
import { scrapeSectionAutomatically, scrapeSectionAxiosWrapper, scrapeGitbookSectionCommand, } from "./scraping/scrapeSectionCommands.js";
|
|
11
10
|
import { scrapeReadMeSection } from "./scraping/site-scrapers/scrapeReadMeSection.js";
|
|
12
11
|
import dev from "./local-preview/index.js";
|
|
13
12
|
import installDepsCommand from "./local-preview/helper-commands/installDepsCommand.js";
|
|
@@ -23,9 +22,6 @@ yargs(hideBin(process.argv))
|
|
|
23
22
|
.command("page", "Generate a new page", () => { }, generatePageTemplate)
|
|
24
23
|
.command("scrape-page [url]", "Scrapes a page", () => { }, async (argv) => {
|
|
25
24
|
await scrapePageAutomatically(argv);
|
|
26
|
-
})
|
|
27
|
-
.command("scrape-docusaurus-page [url]", "Scrapes a Docusaurus page", () => { }, async (argv) => {
|
|
28
|
-
await scrapePageWrapper(argv, scrapeDocusaurusPage);
|
|
29
25
|
})
|
|
30
26
|
.command("scrape-gitbook-page [url]", "Scrapes a GitBook page", () => { }, async (argv) => {
|
|
31
27
|
await scrapePageWrapper(argv, scrapeGitBookPage);
|
|
@@ -35,9 +31,6 @@ yargs(hideBin(process.argv))
|
|
|
35
31
|
})
|
|
36
32
|
.command("scrape-section [url]", "Scrapes the docs in the section", () => { }, async (argv) => {
|
|
37
33
|
await scrapeSectionAutomatically(argv);
|
|
38
|
-
})
|
|
39
|
-
.command("scrape-docusaurus-section [url]", "Scrapes the Docusaurus section", () => { }, async (argv) => {
|
|
40
|
-
await scrapeDocusaurusSectionCommand(argv);
|
|
41
34
|
})
|
|
42
35
|
.command("scrape-gitbook-section [url]", "Scrapes the Gitbook section", () => { }, async (argv) => {
|
|
43
36
|
await scrapeGitbookSectionCommand(argv);
|
package/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,oBAAoB,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AA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B,GAAG,EAAE,GAAE,CAAC,EACR,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CACF;KACA,OAAO,CACN,2BAA2B,EAC3B,wBAAwB,EACxB,GAAG,EAAE,GAAE,CAAC,EACR,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;AACnD,CAAC,CACF;KACA,OAAO,CACN,0BAA0B,EAC1B,uBAAuB,EACvB,GAAG,EAAE,GAAE,CAAC,EACR,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AAClD,CAAC,CACF;KACA,OAAO,CACN,sBAAsB,EACtB,iCAAiC,EACjC,GAAG,EAAE,GAAE,CAAC,EACR,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,0BAA0B,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC,CACF;KACA,OAAO,CACN,8BAA8B,EAC9B,6BAA6B,EAC7B,GAAG,EAAE,GAAE,CAAC,EACR,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,2BAA2B,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC,CACF;KACA,OAAO,CACN,6BAA6B,EAC7B,4BAA4B,EAC5B,GAAG,EAAE,GAAE,CAAC,EACR,KAAK,EAAE,IAAI,EAAE,EAAE;IACb,MAAM,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;AAC7D,CAAC,CACF;KAEA,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// TODO - add types
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import matter from "gray-matter";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import { getOpenApiTitleAndDescription } from "./getOpenApiContext.js";
|
|
6
|
+
import { slugToTitle } from "./slugToTitle.js";
|
|
7
|
+
import { CLIENT_PATH } from "../constants.js";
|
|
8
|
+
// End matter is front matter, but at the end
|
|
9
|
+
const getIndexOfEndMatter = (fileContents) => {
|
|
10
|
+
const frontMatters = fileContents.match(/---\n(title:.+\n|description:.+\n|sidebarTitle:.+\n|api:.+\n|openapi:.+\n)+---$/m);
|
|
11
|
+
if (frontMatters) {
|
|
12
|
+
return fileContents.indexOf(frontMatters[0]);
|
|
13
|
+
}
|
|
14
|
+
return -1;
|
|
15
|
+
};
|
|
16
|
+
export const potentiallyRemoveEndMatter = (fileContents) => {
|
|
17
|
+
const endMatterIndex = getIndexOfEndMatter(fileContents);
|
|
18
|
+
if (endMatterIndex === -1) {
|
|
19
|
+
return fileContents;
|
|
20
|
+
}
|
|
21
|
+
return fileContents.substring(0, endMatterIndex);
|
|
22
|
+
};
|
|
23
|
+
const getMetadata = (fileContents) => {
|
|
24
|
+
const { data } = matter(fileContents);
|
|
25
|
+
if (Object.keys(data).length > 0) {
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
const startIndex = getIndexOfEndMatter(fileContents);
|
|
29
|
+
if (startIndex === -1) {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
const fileContentFromFrontMatter = fileContents.substring(startIndex);
|
|
33
|
+
const { data: nonTopFrontMatter } = matter(fileContentFromFrontMatter);
|
|
34
|
+
return nonTopFrontMatter;
|
|
35
|
+
};
|
|
36
|
+
export const createPage = (path, content, openApiObj) => {
|
|
37
|
+
const slug = path.replace(/\.mdx?$/, "").substring(1);
|
|
38
|
+
let defaultTitle = slugToTitle(slug);
|
|
39
|
+
const metadata = getMetadata(content);
|
|
40
|
+
// Append data from OpenAPI if it exists
|
|
41
|
+
const { title, description } = getOpenApiTitleAndDescription(openApiObj, metadata === null || metadata === void 0 ? void 0 : metadata.openapi);
|
|
42
|
+
if (title) {
|
|
43
|
+
defaultTitle = title;
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
[slug]: Object.assign(Object.assign({ title: defaultTitle, description }, metadata), { href: `/${slug}` }),
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export const injectNav = (pages, configObj) => {
|
|
50
|
+
const targetPath = path.join(CLIENT_PATH, "src", "nav.json");
|
|
51
|
+
const createNav = (nav) => {
|
|
52
|
+
return {
|
|
53
|
+
group: nav.group,
|
|
54
|
+
pages: nav.pages.map((page) => {
|
|
55
|
+
if (typeof page === "string") {
|
|
56
|
+
return pages[page];
|
|
57
|
+
}
|
|
58
|
+
return createNav(page);
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
if ((configObj === null || configObj === void 0 ? void 0 : configObj.navigation) == null) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
let navFile = configObj.navigation.map((nav) => createNav(nav));
|
|
66
|
+
const filterOutNullInPages = (pages) => {
|
|
67
|
+
const newPages = [];
|
|
68
|
+
pages.forEach((page) => {
|
|
69
|
+
if (page == null) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (page === null || page === void 0 ? void 0 : page.pages) {
|
|
73
|
+
const newGroup = filterOutNullInGroup(page);
|
|
74
|
+
newPages.push(newGroup);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
newPages.push(page);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return newPages;
|
|
81
|
+
};
|
|
82
|
+
const filterOutNullInGroup = (group) => {
|
|
83
|
+
const newPages = filterOutNullInPages(group.pages);
|
|
84
|
+
const newGroup = Object.assign(Object.assign({}, group), { pages: newPages });
|
|
85
|
+
return newGroup;
|
|
86
|
+
};
|
|
87
|
+
const newNavFile = navFile.map((group) => {
|
|
88
|
+
return filterOutNullInGroup(group);
|
|
89
|
+
});
|
|
90
|
+
fs.outputFileSync(targetPath, JSON.stringify(newNavFile, null, 2), {
|
|
91
|
+
flag: "w",
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=injectNav.js.map
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,EAAE,EAAE;QACvC,OAAO,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;QACjE,IAAI,EAAE,GAAG;KACV,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"singleQuote": true,
|
|
3
|
+
"printWidth": 100,
|
|
4
|
+
"trailingComma": "es5",
|
|
5
|
+
"arrowParens": "always",
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"quoteProps": "as-needed",
|
|
9
|
+
"jsxSingleQuote": false,
|
|
10
|
+
"bracketSpacing": true,
|
|
11
|
+
"bracketSameLine": false,
|
|
12
|
+
"importOrder": ["<THIRD_PARTY_MODULES>", "^@/(.*)$", "^[./]"],
|
|
13
|
+
"importOrderSeparation": true
|
|
14
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2.0",
|
|
3
|
+
"configurations": [
|
|
4
|
+
{
|
|
5
|
+
"name": "Next.js: debug server-side",
|
|
6
|
+
"type": "node-terminal",
|
|
7
|
+
"request": "launch",
|
|
8
|
+
"command": "yarn dev"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "Next.js: debug client-side",
|
|
12
|
+
"type": "chrome",
|
|
13
|
+
"request": "launch",
|
|
14
|
+
"url": "http://localhost:3000"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"name": "Next.js: debug full stack",
|
|
18
|
+
"type": "node-terminal",
|
|
19
|
+
"request": "launch",
|
|
20
|
+
"command": "yarn dev",
|
|
21
|
+
"serverReadyAction": {
|
|
22
|
+
"pattern": "started server on .+, url: (https?://.+)",
|
|
23
|
+
"uriFormat": "%s",
|
|
24
|
+
"action": "debugWithChrome"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Mintlify Client
|
|
2
|
+
|
|
3
|
+
The client is essentially a frontend template used to host documentation. In production, when `yarn prebuild` is ran it fetches all the relevant assets (the config file, the content (mdx files), and static assets) and plugs them into the appropriate locations before building.
|
|
4
|
+
|
|
5
|
+
## Your First Code Contribution
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Node v16.13.2 (npm v8.1.2)
|
|
10
|
+
- Yarn
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
From a terminal, where you have cloned the repository, execute the following command to install the required dependencies:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
yarn
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Build
|
|
21
|
+
|
|
22
|
+
- `INTERNAL_SITE_BEARER_TOKEN=example yarn prebuild` - fetches the files for the site associated with that bearer token from GitHub. You need the pre-hashed bearer token for that to work. Mintlify employees can request the token that grants access to a test site. In the future, we will work on a way of generating temporary bearer tokens from an employee login.
|
|
23
|
+
- `yarn local` - the local version of `yarn prebuild` (fetches the content from the local `../docs` folder). It can take in a filepath as a parameter for when you want to transfer files to a directory that isn't `../docs`. For example, let's say I'm working on a migration for a client, then I can run `yarn local ../../clients/vital/docs` to get the files from that folder.
|
|
24
|
+
|
|
25
|
+
### Watch
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
yarn dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Formatting
|
|
32
|
+
|
|
33
|
+
This project uses [prettier](https://prettier.io/) for code formatting. You can run prettier across the code by calling `yarn run format` from a terminal.
|
|
34
|
+
|
|
35
|
+
To format the code as you make changes you can install the [Prettier - Code formatter](https://marketplace.visualstudio.com/items/esbenp.prettier-vscode) extension.
|
|
36
|
+
|
|
37
|
+
Add the following to your User Settings to run prettier:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
"editor.formatOnSave": true,
|
|
41
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You can either modify the `settings.json` file or click on Preferences > Settings to use the UI.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* For a detailed explanation regarding each configuration property and type check, visit:
|
|
3
|
+
* https://jestjs.io/docs/configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
// All imported modules in your tests should be mocked automatically
|
|
8
|
+
// automock: false,
|
|
9
|
+
|
|
10
|
+
// Stop running tests after `n` failures
|
|
11
|
+
// bail: 0,
|
|
12
|
+
|
|
13
|
+
// The directory where Jest should store its cached dependency information
|
|
14
|
+
// cacheDirectory: "/private/var/folders/k_/_vv6d9192pq13p60l40ts3440000gn/T/jest_dx",
|
|
15
|
+
|
|
16
|
+
// Automatically clear mock calls, instances, contexts and results before every test
|
|
17
|
+
// clearMocks: false,
|
|
18
|
+
|
|
19
|
+
// Indicates whether the coverage information should be collected while executing the test
|
|
20
|
+
// collectCoverage: false,
|
|
21
|
+
|
|
22
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
23
|
+
// collectCoverageFrom: undefined,
|
|
24
|
+
|
|
25
|
+
// The directory where Jest should output its coverage files
|
|
26
|
+
// coverageDirectory: undefined,
|
|
27
|
+
|
|
28
|
+
// An array of regexp pattern strings used to skip coverage collection
|
|
29
|
+
// coveragePathIgnorePatterns: [
|
|
30
|
+
// "/node_modules/"
|
|
31
|
+
// ],
|
|
32
|
+
|
|
33
|
+
// Indicates which provider should be used to instrument code for coverage
|
|
34
|
+
coverageProvider: "v8",
|
|
35
|
+
|
|
36
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
|
37
|
+
// coverageReporters: [
|
|
38
|
+
// "json",
|
|
39
|
+
// "text",
|
|
40
|
+
// "lcov",
|
|
41
|
+
// "clover"
|
|
42
|
+
// ],
|
|
43
|
+
|
|
44
|
+
// An object that configures minimum threshold enforcement for coverage results
|
|
45
|
+
// coverageThreshold: undefined,
|
|
46
|
+
|
|
47
|
+
// A path to a custom dependency extractor
|
|
48
|
+
// dependencyExtractor: undefined,
|
|
49
|
+
|
|
50
|
+
// Make calling deprecated APIs throw helpful error messages
|
|
51
|
+
// errorOnDeprecated: false,
|
|
52
|
+
|
|
53
|
+
// The default configuration for fake timers
|
|
54
|
+
// fakeTimers: {
|
|
55
|
+
// "enableGlobally": false
|
|
56
|
+
// },
|
|
57
|
+
|
|
58
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
|
59
|
+
// forceCoverageMatch: [],
|
|
60
|
+
|
|
61
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
|
62
|
+
// globalSetup: undefined,
|
|
63
|
+
|
|
64
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
|
65
|
+
// globalTeardown: undefined,
|
|
66
|
+
|
|
67
|
+
// A set of global variables that need to be available in all test environments
|
|
68
|
+
// globals: {},
|
|
69
|
+
|
|
70
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
71
|
+
// maxWorkers: "50%",
|
|
72
|
+
|
|
73
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
|
74
|
+
// moduleDirectories: [
|
|
75
|
+
// "node_modules"
|
|
76
|
+
// ],
|
|
77
|
+
|
|
78
|
+
// An array of file extensions your modules use
|
|
79
|
+
// moduleFileExtensions: [
|
|
80
|
+
// "js",
|
|
81
|
+
// "mjs",
|
|
82
|
+
// "cjs",
|
|
83
|
+
// "jsx",
|
|
84
|
+
// "ts",
|
|
85
|
+
// "tsx",
|
|
86
|
+
// "json",
|
|
87
|
+
// "node"
|
|
88
|
+
// ],
|
|
89
|
+
|
|
90
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
91
|
+
// moduleNameMapper: {},
|
|
92
|
+
|
|
93
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
94
|
+
// modulePathIgnorePatterns: [],
|
|
95
|
+
|
|
96
|
+
// Activates notifications for test results
|
|
97
|
+
// notify: false,
|
|
98
|
+
|
|
99
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
|
100
|
+
// notifyMode: "failure-change",
|
|
101
|
+
|
|
102
|
+
// A preset that is used as a base for Jest's configuration
|
|
103
|
+
// preset: undefined,
|
|
104
|
+
|
|
105
|
+
// Run tests from one or more projects
|
|
106
|
+
// projects: undefined,
|
|
107
|
+
|
|
108
|
+
// Use this configuration option to add custom reporters to Jest
|
|
109
|
+
// reporters: undefined,
|
|
110
|
+
|
|
111
|
+
// Automatically reset mock state before every test
|
|
112
|
+
// resetMocks: false,
|
|
113
|
+
|
|
114
|
+
// Reset the module registry before running each individual test
|
|
115
|
+
// resetModules: false,
|
|
116
|
+
|
|
117
|
+
// A path to a custom resolver
|
|
118
|
+
// resolver: undefined,
|
|
119
|
+
|
|
120
|
+
// Automatically restore mock state and implementation before every test
|
|
121
|
+
// restoreMocks: false,
|
|
122
|
+
|
|
123
|
+
// The root directory that Jest should scan for tests and modules within
|
|
124
|
+
// rootDir: undefined,
|
|
125
|
+
|
|
126
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
127
|
+
// roots: [
|
|
128
|
+
// "<rootDir>"
|
|
129
|
+
// ],
|
|
130
|
+
|
|
131
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
|
132
|
+
// runner: "jest-runner",
|
|
133
|
+
|
|
134
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
135
|
+
// setupFiles: [],
|
|
136
|
+
|
|
137
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
138
|
+
// setupFilesAfterEnv: [],
|
|
139
|
+
|
|
140
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
141
|
+
// slowTestThreshold: 5,
|
|
142
|
+
|
|
143
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
144
|
+
// snapshotSerializers: [],
|
|
145
|
+
|
|
146
|
+
// The test environment that will be used for testing
|
|
147
|
+
// testEnvironment: "jest-environment-node",
|
|
148
|
+
|
|
149
|
+
// Options that will be passed to the testEnvironment
|
|
150
|
+
// testEnvironmentOptions: {},
|
|
151
|
+
|
|
152
|
+
// Adds a location field to test results
|
|
153
|
+
// testLocationInResults: false,
|
|
154
|
+
|
|
155
|
+
// The glob patterns Jest uses to detect test files
|
|
156
|
+
// testMatch: [
|
|
157
|
+
// "**/__tests__/**/*.[jt]s?(x)",
|
|
158
|
+
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
159
|
+
// ],
|
|
160
|
+
|
|
161
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
162
|
+
// testPathIgnorePatterns: [
|
|
163
|
+
// "/node_modules/"
|
|
164
|
+
// ],
|
|
165
|
+
|
|
166
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
167
|
+
// testRegex: [],
|
|
168
|
+
|
|
169
|
+
// This option allows the use of a custom results processor
|
|
170
|
+
// testResultsProcessor: undefined,
|
|
171
|
+
|
|
172
|
+
// This option allows use of a custom test runner
|
|
173
|
+
// testRunner: "jest-circus/runner",
|
|
174
|
+
|
|
175
|
+
// A map from regular expressions to paths to transformers
|
|
176
|
+
// transform: undefined,
|
|
177
|
+
|
|
178
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
179
|
+
// transformIgnorePatterns: [
|
|
180
|
+
// "/node_modules/",
|
|
181
|
+
// "\\.pnp\\.[^\\/]+$"
|
|
182
|
+
// ],
|
|
183
|
+
|
|
184
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
185
|
+
// unmockedModulePathPatterns: undefined,
|
|
186
|
+
|
|
187
|
+
// Indicates whether each individual test should be reported during the run
|
|
188
|
+
// verbose: undefined,
|
|
189
|
+
|
|
190
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
191
|
+
// watchPathIgnorePatterns: [],
|
|
192
|
+
|
|
193
|
+
// Whether to use watchman for file crawling
|
|
194
|
+
// watchman: true,
|
|
195
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { withSentryConfig } from '@sentry/nextjs';
|
|
2
|
+
import withLinkRoles from './rehype/withLinkRoles.js';
|
|
3
|
+
import { createLoader } from 'simple-functional-loader';
|
|
4
|
+
import frontMatter from 'front-matter';
|
|
5
|
+
import withSmartypants from 'remark-smartypants';
|
|
6
|
+
import withTableOfContents from './remark/withTableOfContents.js';
|
|
7
|
+
import withCodeBlocks from './rehype/withCodeBlocks.js';
|
|
8
|
+
import withNextLinks from './remark/withNextLinks.js';
|
|
9
|
+
import withFrames from './remark/withFrames.js';
|
|
10
|
+
import withImportsInjected from './remark/withImportsInjected.js';
|
|
11
|
+
import BundleAnalyzer from '@next/bundle-analyzer';
|
|
12
|
+
import remarkGfm from 'remark-gfm';
|
|
13
|
+
import withStaticProps from './rehype/withStaticProps.js';
|
|
14
|
+
import withApiComponents from './rehype/withApiComponents.js';
|
|
15
|
+
import withRawComponents from './rehype/withRawComponents.js';
|
|
16
|
+
import mintConfig from './src/mint.json' assert { type: 'json' };
|
|
17
|
+
import withSyntaxHighlighting from './rehype/withSyntaxHighlighting.js';
|
|
18
|
+
import withLayouts from './rehype/withLayouts.js';
|
|
19
|
+
import { potentiallyRemoveEndMatter } from './prebuild/injectNav.js';
|
|
20
|
+
|
|
21
|
+
const withBundleAnalyzer = BundleAnalyzer({
|
|
22
|
+
enabled: process.env.ANALYZE === 'true',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const sentryWebpackPluginOptions = {
|
|
26
|
+
// Suppresses all logs
|
|
27
|
+
silent: true,
|
|
28
|
+
|
|
29
|
+
// Disable sentry builds when we don't have a sentry auth token.
|
|
30
|
+
// Sites have to be manually added to our Sentry tracking so by default
|
|
31
|
+
// new customers' sites will not have an auth token set.
|
|
32
|
+
dryRun: process.env.VERCEL_ENV !== 'production' || !process.env.SENTRY_AUTH_TOKEN,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default withSentryConfig(
|
|
36
|
+
withBundleAnalyzer({
|
|
37
|
+
swcMinify: true,
|
|
38
|
+
pageExtensions: ['js', 'jsx', 'mdx', 'ts', 'tsx', 'md'],
|
|
39
|
+
images: {
|
|
40
|
+
disableStaticImages: true,
|
|
41
|
+
},
|
|
42
|
+
basePath: mintConfig?.basePath,
|
|
43
|
+
webpack(config, options) {
|
|
44
|
+
config.module.rules.push({
|
|
45
|
+
test: /\.(png|jpe?g|gif|webp|avif|mp4)$/i,
|
|
46
|
+
issuer: /\.(jsx?|tsx?|mdx?)$/,
|
|
47
|
+
use: [
|
|
48
|
+
{
|
|
49
|
+
loader: 'file-loader',
|
|
50
|
+
options: {
|
|
51
|
+
publicPath: '/_next',
|
|
52
|
+
name: 'static/media/[name].[hash].[ext]',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
config.module.rules.push({
|
|
59
|
+
test: /\.svg$/,
|
|
60
|
+
use: [
|
|
61
|
+
{
|
|
62
|
+
loader: '@svgr/webpack',
|
|
63
|
+
options: { svgoConfig: { plugins: { removeViewBox: false } } },
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
loader: 'file-loader',
|
|
67
|
+
options: {
|
|
68
|
+
publicPath: '/_next',
|
|
69
|
+
name: 'static/media/[name].[hash].[ext]',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
config.module.rules.push({
|
|
76
|
+
test: { and: [/\.mdx$/, /snippets/] },
|
|
77
|
+
use: [
|
|
78
|
+
options.defaultLoaders.babel,
|
|
79
|
+
{
|
|
80
|
+
loader: '@mdx-js/loader',
|
|
81
|
+
options: {
|
|
82
|
+
providerImportSource: '@mdx-js/react',
|
|
83
|
+
remarkPlugins: [
|
|
84
|
+
remarkGfm,
|
|
85
|
+
withImportsInjected,
|
|
86
|
+
withFrames,
|
|
87
|
+
withNextLinks,
|
|
88
|
+
withSmartypants,
|
|
89
|
+
],
|
|
90
|
+
rehypePlugins: [
|
|
91
|
+
[
|
|
92
|
+
withSyntaxHighlighting,
|
|
93
|
+
{
|
|
94
|
+
ignoreMissing: true,
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
withCodeBlocks,
|
|
98
|
+
withLinkRoles,
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
config.module.rules.push({
|
|
106
|
+
test: { and: [/\.mdx?$/], not: [/snippets/] },
|
|
107
|
+
use: [
|
|
108
|
+
options.defaultLoaders.babel,
|
|
109
|
+
{
|
|
110
|
+
loader: '@mdx-js/loader',
|
|
111
|
+
options: {
|
|
112
|
+
providerImportSource: '@mdx-js/react',
|
|
113
|
+
remarkPlugins: [
|
|
114
|
+
remarkGfm,
|
|
115
|
+
withImportsInjected,
|
|
116
|
+
withFrames,
|
|
117
|
+
withTableOfContents,
|
|
118
|
+
withNextLinks,
|
|
119
|
+
withSmartypants,
|
|
120
|
+
],
|
|
121
|
+
rehypePlugins: [
|
|
122
|
+
[
|
|
123
|
+
withSyntaxHighlighting,
|
|
124
|
+
{
|
|
125
|
+
ignoreMissing: true,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
withCodeBlocks,
|
|
129
|
+
withLinkRoles,
|
|
130
|
+
withApiComponents,
|
|
131
|
+
withRawComponents,
|
|
132
|
+
[
|
|
133
|
+
withStaticProps,
|
|
134
|
+
`{
|
|
135
|
+
isMdx: true
|
|
136
|
+
}`,
|
|
137
|
+
],
|
|
138
|
+
withLayouts
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
createLoader(function (source) {
|
|
143
|
+
const { body } = frontMatter(source);
|
|
144
|
+
return potentiallyRemoveEndMatter(body);
|
|
145
|
+
}),
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
return config;
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
151
|
+
sentryWebpackPluginOptions
|
|
152
|
+
);
|