Integrate @hashicorp/react-search into layout

This commit is contained in:
Kevin Pruett 2020-09-01 16:05:05 -04:00
parent 79bc643c17
commit 6c4e9e9e68
9 changed files with 507 additions and 212 deletions

View File

@ -0,0 +1,28 @@
import Search from '@hashicorp/react-search'
export default function SearchBar() {
return (
<Search
renderHitContent={({ hit, Highlight }) => (
<>
<span className="name">
<Highlight attribute="page_title" hit={hit} tagName="span" />
</span>
<span className="description">
<Highlight attribute="description" hit={hit} tagName="span" />
</span>
</>
)}
resolveHitLink={(hit) => ({
href: {
pathname: `/${transformIdtoUrl(hit.objectID)}`,
},
})}
placeholder="Search Packer documentation"
/>
)
}
function transformIdtoUrl(id) {
return id.replace(/\/index$/, '')
}

View File

@ -0,0 +1,8 @@
.g-search {
width: calc(100% - 2rem);
max-width: 600px;
& .c-hits .ais-Highlight-highlighted {
/* Insert custom background color applied to highlighted hits */
}
}

View File

@ -1,18 +1,21 @@
import DocsPage from '@hashicorp/react-docs-page'
import order from 'data/docs-navigation.js'
import { frontMatter as data } from '../pages/docs/**/*.mdx'
import Head from 'next/head'
import Link from 'next/link'
import { createMdxProvider } from '@hashicorp/nextjs-scripts/lib/providers/docs'
import DocsPage from '@hashicorp/react-docs-page'
import { SearchProvider } from '@hashicorp/react-search'
import SearchBar from '../components/search-bar'
import { frontMatter as data } from '../pages/docs/**/*.mdx'
import order from 'data/docs-navigation.js'
const MDXProvider = createMdxProvider({ product: 'packer' })
export default function DocsLayoutWrapper(pageMeta) {
function DocsLayout(props) {
const { children, ...propsWithoutChildren } = props
return (
<MDXProvider>
<DocsPage
{...props}
{...propsWithoutChildren}
product="packer"
head={{
is: Head,
@ -25,10 +28,16 @@ export default function DocsLayoutWrapper(pageMeta) {
category: 'docs',
currentPage: props.path,
data,
disableFilter: true,
order,
}}
resourceURL={`https://github.com/hashicorp/packer/blob/master/website/pages/${pageMeta.__resourcePath}`}
/>
>
<SearchProvider>
<SearchBar />
{children}
</SearchProvider>
</DocsPage>
</MDXProvider>
)
}

View File

@ -1,18 +1,21 @@
import DocsPage from '@hashicorp/react-docs-page'
import order from 'data/guides-navigation.js'
import { frontMatter as data } from '../pages/guides/**/*.mdx'
import Head from 'next/head'
import Link from 'next/link'
import { createMdxProvider } from '@hashicorp/nextjs-scripts/lib/providers/docs'
import DocsPage from '@hashicorp/react-docs-page'
import { SearchProvider } from '@hashicorp/react-search'
import SearchBar from '../components/search-bar'
import { frontMatter as data } from '../pages/guides/**/*.mdx'
import order from 'data/guides-navigation.js'
const MDXProvider = createMdxProvider({ product: 'packer' })
export default function GuidesLayoutWrapper(pageMeta) {
function GuidesLayout(props) {
const { children, ...propsWithoutChildren } = props
return (
<MDXProvider>
<DocsPage
{...props}
{...propsWithoutChildren}
product="packer"
head={{
is: Head,
@ -25,10 +28,16 @@ export default function GuidesLayoutWrapper(pageMeta) {
category: 'guides',
currentPage: props.path,
data,
disableFilter: true,
order,
}}
resourceURL={`https://github.com/hashicorp/packer/blob/master/website/pages/${pageMeta.__resourcePath}`}
/>
>
<SearchProvider>
<SearchBar />
{children}
</SearchProvider>
</DocsPage>
</MDXProvider>
)
}

View File

@ -1,18 +1,21 @@
import DocsPage from '@hashicorp/react-docs-page'
import order from 'data/intro-navigation.js'
import { frontMatter as data } from '../pages/intro/**/*.mdx'
import Head from 'next/head'
import Link from 'next/link'
import { createMdxProvider } from '@hashicorp/nextjs-scripts/lib/providers/docs'
import DocsPage from '@hashicorp/react-docs-page'
import { SearchProvider } from '@hashicorp/react-search'
import SearchBar from '../components/search-bar'
import { frontMatter as data } from '../pages/intro/**/*.mdx'
import order from 'data/intro-navigation.js'
const MDXProvider = createMdxProvider({ product: 'packer' })
export default function IntroLayoutWrapper(pageMeta) {
function IntroLayout(props) {
const { children, ...propsWithoutChildren } = props
return (
<MDXProvider>
<DocsPage
{...props}
{...propsWithoutChildren}
product="packer"
head={{
is: Head,
@ -25,10 +28,16 @@ export default function IntroLayoutWrapper(pageMeta) {
category: 'intro',
currentPage: props.path,
data,
disableFilter: true,
order,
}}
resourceURL={`https://github.com/hashicorp/packer/blob/master/website/pages/${pageMeta.__resourcePath}`}
/>
>
<SearchProvider>
<SearchBar />
{children}
</SearchProvider>
</DocsPage>
</MDXProvider>
)
}

View File

@ -5,118 +5,118 @@
"requires": true,
"dependencies": {
"@algolia/cache-browser-local-storage": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.3.0.tgz",
"integrity": "sha512-91Cf3IPUk84PF2wvR8ys8XO42FqaJEtIh/dyR0WvwMdv0x13GORkAvoBJgkFI2wofZqUY86jNimvHWfsWzPQ+g==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-browser-local-storage/-/cache-browser-local-storage-4.4.0.tgz",
"integrity": "sha512-2AiKgN7DpFypkRCRkpqH7waXXyFdcnsPWzmN8sLHrB/FfXqgmsQb3pGft+9YHZIDQ0vAnfgMxSGgMhMGW+0Qnw==",
"requires": {
"@algolia/cache-common": "4.3.0"
"@algolia/cache-common": "4.4.0"
}
},
"@algolia/cache-common": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.3.0.tgz",
"integrity": "sha512-AHTbOn9lk0f5IkjssXXmDgnaZfsUJVZ61sqOH1W3LyJdAscDzCj0KtwijELn8FHlLXQak7+K93/O3Oct0uHncQ=="
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-common/-/cache-common-4.4.0.tgz",
"integrity": "sha512-PrIgoMnXaDWUfwOekahro543pgcJfgRu/nd/ZQS5ffem3+Ow725eZY6HDpPaQ1k3cvLii9JH6V2sNJConjqUKA=="
},
"@algolia/cache-in-memory": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.3.0.tgz",
"integrity": "sha512-8BZS5IFEtiSFkA6vNQUXJXIWABDbSanQdkGX5LArlhbCjuykZqF68yaCjXWG10EZTySnkZLmKc+5ozYVOktJaQ==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/cache-in-memory/-/cache-in-memory-4.4.0.tgz",
"integrity": "sha512-9+XlUB0baDU/Dp9URRHPp6Q37YmTO0QmgPWt9+n+wqZrRL0jR3Jezr4jCT7RemqGMxBiR+YpnqaUv0orpb0ptw==",
"requires": {
"@algolia/cache-common": "4.3.0"
"@algolia/cache-common": "4.4.0"
}
},
"@algolia/client-account": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.3.0.tgz",
"integrity": "sha512-8LJSvWooc+fe+XZXeu+h4dhpo9lsu3sb7rV9cpPhymYSHgEJAHaDkZEcPM1u/PBMvFe0mZXaW6nabeb3jeIRcw==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/client-account/-/client-account-4.4.0.tgz",
"integrity": "sha512-Kynu3cMEs0clTLf674rtrCF+FWR/JwlQxKlIWsPzvLBRmNXdvYej9YBcNaOr4OTQFCCZn9JVE8ib91Z7J4IL1Q==",
"requires": {
"@algolia/client-common": "4.3.0",
"@algolia/client-search": "4.3.0",
"@algolia/transporter": "4.3.0"
"@algolia/client-common": "4.4.0",
"@algolia/client-search": "4.4.0",
"@algolia/transporter": "4.4.0"
}
},
"@algolia/client-analytics": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.3.0.tgz",
"integrity": "sha512-BFH4ddyrqI2pE3bUctn5KtJgYqgvO0Ap9vJEHBNj6mjSKqFbTnZeVEPG3yWrOuWRCqPHR3ewcWRisNwJHG3+Mw==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/client-analytics/-/client-analytics-4.4.0.tgz",
"integrity": "sha512-GQyjQimKAc9sZbafxln9Wk7j4pEYiORv28MZkZ+0Bjt7WNXIeO7OgOOECVpQHm9buyV6hCKpNtJcbb5/syRzdQ==",
"requires": {
"@algolia/client-common": "4.3.0",
"@algolia/client-search": "4.3.0",
"@algolia/requester-common": "4.3.0",
"@algolia/transporter": "4.3.0"
"@algolia/client-common": "4.4.0",
"@algolia/client-search": "4.4.0",
"@algolia/requester-common": "4.4.0",
"@algolia/transporter": "4.4.0"
}
},
"@algolia/client-common": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.3.0.tgz",
"integrity": "sha512-8Ohj6zXZkpwDKc8ZWVTZo2wPO4+LT5D258suGg/C6nh4UxOrFOp6QaqeQo8JZ1eqMqtfb3zv5SHgW4fZ00NCLQ==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/client-common/-/client-common-4.4.0.tgz",
"integrity": "sha512-a3yr6UhzjWPHDG/8iGp9UvrDOm1aeHVWJIf0Nj/cIvqX5tNCEIo4IMe59ovApkDgLOIpt/cLsyhn9/FiPXRhJA==",
"requires": {
"@algolia/requester-common": "4.3.0",
"@algolia/transporter": "4.3.0"
"@algolia/requester-common": "4.4.0",
"@algolia/transporter": "4.4.0"
}
},
"@algolia/client-recommendation": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/client-recommendation/-/client-recommendation-4.3.0.tgz",
"integrity": "sha512-jCMIAWPA2hsxc5CCtoTtQAcohaG+10CxXK122Tc47t4w1K8qzSJnCjC2cHvM4UNJO+k7NrmjOYW0EXp9RKc7SQ==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/client-recommendation/-/client-recommendation-4.4.0.tgz",
"integrity": "sha512-sBszbQH46rko6w2fdEG77ma8+fAg0SDkLZGxWhv4trgcnYGUBFl2dcpEPt/6koto9b4XYlf+eh+qi6iGvYqRPg==",
"requires": {
"@algolia/client-common": "4.3.0",
"@algolia/requester-common": "4.3.0",
"@algolia/transporter": "4.3.0"
"@algolia/client-common": "4.4.0",
"@algolia/requester-common": "4.4.0",
"@algolia/transporter": "4.4.0"
}
},
"@algolia/client-search": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.3.0.tgz",
"integrity": "sha512-KCgcIsNMW1/0F5OILiFTddbTAKduJHRvXQS4NxY1H9gQWMTVeWJS7VZQ/ukKBiUMLatwUQHJz2qpYm9fmqOjkQ==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/client-search/-/client-search-4.4.0.tgz",
"integrity": "sha512-jqWcxCUyPPHnHreoMb2PnN9iHTP+V/nL62R84XuTRDE3VgTnhm4ZnqyuRdzZQqaz+gNy5znav64TmQ9FN9WW5g==",
"requires": {
"@algolia/client-common": "4.3.0",
"@algolia/requester-common": "4.3.0",
"@algolia/transporter": "4.3.0"
"@algolia/client-common": "4.4.0",
"@algolia/requester-common": "4.4.0",
"@algolia/transporter": "4.4.0"
}
},
"@algolia/logger-common": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.3.0.tgz",
"integrity": "sha512-vQ+aukjZkRAyO9iyINBefT366UtF/B9QoA1Kw8PlY67T6fYmklFgYp3LNH/e7h/gz0py5LYY/HIwSsaTKk8/VQ=="
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/logger-common/-/logger-common-4.4.0.tgz",
"integrity": "sha512-2vjmSENLaKNuF+ytRDysfWxxgFG95WXCHwHbueThdPMCK3hskkwqJ0Y/pugKfzl+54mZxegb4BYfgcCeuaHVUw=="
},
"@algolia/logger-console": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.3.0.tgz",
"integrity": "sha512-7pWtcv1cSSa7F48gRBOZLcEWN073+WbnKjbpRrIGej+abZppw/h+22jtVZZORC8EIjFffGqz2/2e6bZiX+Jg7A==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/logger-console/-/logger-console-4.4.0.tgz",
"integrity": "sha512-st/GUWyKvr6YM72OOfF+RmpdVGda3BPXbQ+chpntUq1WyVkyZXGjSmH1IcBVlua27GzxabwOUYON39cF3x10/g==",
"requires": {
"@algolia/logger-common": "4.3.0"
"@algolia/logger-common": "4.4.0"
}
},
"@algolia/requester-browser-xhr": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.3.0.tgz",
"integrity": "sha512-CpUwgQhXZsnZmjEd5DTwQv1BKQNCt83bzyVdUqvljsFxZOsNQacS6lOYs0B1eD18tKHCwVMuwbYqTaLPGBXTKQ==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-browser-xhr/-/requester-browser-xhr-4.4.0.tgz",
"integrity": "sha512-V3a4hXlNch355GnWaT1f5QfXhROpsjT6sd0Znq29gAhwLqfBExhLW6Khdkv5pENC0Qy7ClVhdXFrBL9QCQer1g==",
"requires": {
"@algolia/requester-common": "4.3.0"
"@algolia/requester-common": "4.4.0"
}
},
"@algolia/requester-common": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.3.0.tgz",
"integrity": "sha512-1v73KyspJBiTzfyXupjHxikxTYjh5MoxI6mOIvAtQxRqc4ehUPAEdPCNHEvvLiCK96iKWzZaULmV0U7pj3yvTw=="
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-common/-/requester-common-4.4.0.tgz",
"integrity": "sha512-jPinHlFJEFokxQ5b3JWyjQKKn+FMy0hH99PApzOgQAYOSiFRXiPEZp6LeIexDeLLu7Y3eRt/3nHvjPKa6PmRRw=="
},
"@algolia/requester-node-http": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.3.0.tgz",
"integrity": "sha512-Hg9Y8sUeSGQgoO1FpoL5jbkDzCtXI/8HXHybU6bimsX93DAz3HZWaoQFKmIpQDNhQ8G9FLgAtzDAxS6eckDxzg==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/requester-node-http/-/requester-node-http-4.4.0.tgz",
"integrity": "sha512-b7HC9C/GHxiV4+0GpCRTtjscvwarPr3dGm4CAhb6AkNjgjRcFUNr1NfsF75w3WVmzmt79/7QZihddztDdVMGjw==",
"requires": {
"@algolia/requester-common": "4.3.0"
"@algolia/requester-common": "4.4.0"
}
},
"@algolia/transporter": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.3.0.tgz",
"integrity": "sha512-BTKHAtdQdfOJ0xzZkiyEK/2QVQJTiVgBZlOBfXp2gBtztjV26OqfW4n6Xz0o7eBRzLEwY1ot3mHF5QIVUjAsMg==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@algolia/transporter/-/transporter-4.4.0.tgz",
"integrity": "sha512-Xxzq91DEEeKIzT3DU46n4LEyTGAKZNtSHc2H9wvIY5MYwhZwEribmXXZ6k8W1FvBvzggv3juu0SP+xwGoR7F0w==",
"requires": {
"@algolia/cache-common": "4.3.0",
"@algolia/logger-common": "4.3.0",
"@algolia/requester-common": "4.3.0"
"@algolia/cache-common": "4.4.0",
"@algolia/logger-common": "4.4.0",
"@algolia/requester-common": "4.4.0"
}
},
"@ampproject/toolbox-core": {
@ -1709,6 +1709,24 @@
"@hashicorp/react-button": "^2.2.1"
}
},
"@hashicorp/react-search": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@hashicorp/react-search/-/react-search-2.0.0.tgz",
"integrity": "sha512-nMH0pUPNEOEcuIcQ/NRiqlZOXJkK7XnIs+KcwFoRxX6UyWSUUkhHPUU+TGy4Wgs8T65tFl5y4Ksnv+za+3CdPQ==",
"requires": {
"@hashicorp/react-inline-svg": "^1.0.2",
"@hashicorp/remark-plugins": "^3.0.0",
"react-instantsearch-dom": "^6.7.0",
"search-insights": "^1.6.0"
},
"dependencies": {
"@hashicorp/react-inline-svg": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@hashicorp/react-inline-svg/-/react-inline-svg-1.0.2.tgz",
"integrity": "sha512-AAFnBslSTgnEr++dTbMn3sybAqvn7myIj88ijGigF6u11eSRiV64zqEcyYLQKWTV6dF4AvYoxiYC6GSOgiM0Yw=="
}
}
},
"@hashicorp/react-section-header": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@hashicorp/react-section-header/-/react-section-header-2.0.0.tgz",
@ -1781,6 +1799,147 @@
"unist-util-is": "^4.0.2",
"unist-util-map": "^2.0.1",
"unist-util-visit": "^2.0.2"
},
"dependencies": {
"markdown-table": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.3.tgz",
"integrity": "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q=="
},
"mdast-util-compact": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-1.0.4.tgz",
"integrity": "sha512-3YDMQHI5vRiS2uygEFYaqckibpJtKq5Sj2c8JioeOQBU6INpKbdWzfyLqFFnDwEcEnRFIdMsguzs5pC1Jp4Isg==",
"requires": {
"unist-util-visit": "^1.1.0"
},
"dependencies": {
"unist-util-visit": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz",
"integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==",
"requires": {
"unist-util-visit-parents": "^2.0.0"
}
}
}
},
"parse-entities": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz",
"integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==",
"requires": {
"character-entities": "^1.0.0",
"character-entities-legacy": "^1.0.0",
"character-reference-invalid": "^1.0.0",
"is-alphanumerical": "^1.0.0",
"is-decimal": "^1.0.0",
"is-hexadecimal": "^1.0.0"
}
},
"remark": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/remark/-/remark-11.0.2.tgz",
"integrity": "sha512-bh+eJgn8wgmbHmIBOuwJFdTVRVpl3fcVP6HxmpPWO0ULGP9Qkh6INJh0N5Uy7GqlV7DQYGoqaKiEIpM5LLvJ8w==",
"requires": {
"remark-parse": "^7.0.0",
"remark-stringify": "^7.0.0",
"unified": "^8.2.0"
}
},
"remark-parse": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-7.0.2.tgz",
"integrity": "sha512-9+my0lQS80IQkYXsMA8Sg6m9QfXYJBnXjWYN5U+kFc5/n69t+XZVXU/ZBYr3cYH8FheEGf1v87rkFDhJ8bVgMA==",
"requires": {
"collapse-white-space": "^1.0.2",
"is-alphabetical": "^1.0.0",
"is-decimal": "^1.0.0",
"is-whitespace-character": "^1.0.0",
"is-word-character": "^1.0.0",
"markdown-escapes": "^1.0.0",
"parse-entities": "^1.1.0",
"repeat-string": "^1.5.4",
"state-toggle": "^1.0.0",
"trim": "0.0.1",
"trim-trailing-lines": "^1.0.0",
"unherit": "^1.0.4",
"unist-util-remove-position": "^1.0.0",
"vfile-location": "^2.0.0",
"xtend": "^4.0.1"
}
},
"remark-stringify": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-7.0.4.tgz",
"integrity": "sha512-qck+8NeA1D0utk1ttKcWAoHRrJxERYQzkHDyn+pF5Z4whX1ug98uCNPPSeFgLSaNERRxnD6oxIug6DzZQth6Pg==",
"requires": {
"ccount": "^1.0.0",
"is-alphanumeric": "^1.0.0",
"is-decimal": "^1.0.0",
"is-whitespace-character": "^1.0.0",
"longest-streak": "^2.0.1",
"markdown-escapes": "^1.0.0",
"markdown-table": "^1.1.0",
"mdast-util-compact": "^1.0.0",
"parse-entities": "^1.0.2",
"repeat-string": "^1.5.4",
"state-toggle": "^1.0.0",
"stringify-entities": "^2.0.0",
"unherit": "^1.0.4",
"xtend": "^4.0.1"
}
},
"stringify-entities": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-2.0.0.tgz",
"integrity": "sha512-fqqhZzXyAM6pGD9lky/GOPq6V4X0SeTAFBl0iXb/BzOegl40gpf/bV3QQP7zULNYvjr6+Dx8SCaDULjVoOru0A==",
"requires": {
"character-entities-html4": "^1.0.0",
"character-entities-legacy": "^1.0.0",
"is-alphanumerical": "^1.0.0",
"is-decimal": "^1.0.2",
"is-hexadecimal": "^1.0.0"
}
},
"unist-util-remove-position": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz",
"integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==",
"requires": {
"unist-util-visit": "^1.1.0"
},
"dependencies": {
"unist-util-visit": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz",
"integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==",
"requires": {
"unist-util-visit-parents": "^2.0.0"
}
}
}
},
"unist-util-visit-parents": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz",
"integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==",
"requires": {
"unist-util-is": "^3.0.0"
},
"dependencies": {
"unist-util-is": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz",
"integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A=="
}
}
},
"vfile-location": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz",
"integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA=="
}
}
},
"@mapbox/rehype-prism": {
@ -1886,6 +2045,16 @@
"unist-util-visit": "^2.0.0"
}
},
"unist-util-visit": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.2.tgz",
"integrity": "sha512-HoHNhGnKj6y+Sq+7ASo2zpVdfdRifhTgX2KTU3B/sO/TTlZchp7E3S4vjRzDJ7L60KmrCPsQkVK3lEF3cz36XQ==",
"requires": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0",
"unist-util-visit-parents": "^3.0.0"
}
},
"vfile-location": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.0.1.tgz",
@ -2612,24 +2781,39 @@
"integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ=="
},
"algoliasearch": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.3.0.tgz",
"integrity": "sha512-H2woXyqmd1nFYDrQKLZXgghNkLBTcBXJ7Q/bxQ+F9WWS4H0Kb7IlQvNi7bDzHyldhDhIthImaUwcKqr5iiyMFQ==",
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/algoliasearch/-/algoliasearch-4.4.0.tgz",
"integrity": "sha512-Ag3wxe/nSodNl/1KbHibtkh7TNLptKE300/wnGVtszRjXivaWD6333nUpCumrYObHym/fHMHyLcmQYezXbAIWQ==",
"requires": {
"@algolia/cache-browser-local-storage": "4.3.0",
"@algolia/cache-common": "4.3.0",
"@algolia/cache-in-memory": "4.3.0",
"@algolia/client-account": "4.3.0",
"@algolia/client-analytics": "4.3.0",
"@algolia/client-common": "4.3.0",
"@algolia/client-recommendation": "4.3.0",
"@algolia/client-search": "4.3.0",
"@algolia/logger-common": "4.3.0",
"@algolia/logger-console": "4.3.0",
"@algolia/requester-browser-xhr": "4.3.0",
"@algolia/requester-common": "4.3.0",
"@algolia/requester-node-http": "4.3.0",
"@algolia/transporter": "4.3.0"
"@algolia/cache-browser-local-storage": "4.4.0",
"@algolia/cache-common": "4.4.0",
"@algolia/cache-in-memory": "4.4.0",
"@algolia/client-account": "4.4.0",
"@algolia/client-analytics": "4.4.0",
"@algolia/client-common": "4.4.0",
"@algolia/client-recommendation": "4.4.0",
"@algolia/client-search": "4.4.0",
"@algolia/logger-common": "4.4.0",
"@algolia/logger-console": "4.4.0",
"@algolia/requester-browser-xhr": "4.4.0",
"@algolia/requester-common": "4.4.0",
"@algolia/requester-node-http": "4.4.0",
"@algolia/transporter": "4.4.0"
}
},
"algoliasearch-helper": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/algoliasearch-helper/-/algoliasearch-helper-3.2.2.tgz",
"integrity": "sha512-/3XvE33R+gQKaiPdy3nmHYqhF8hqIu8xnlOicVxb1fD6uMFmxW8rGLzzrRfsPfxgAfm+c1NslLb3TzQVIB8aVA==",
"requires": {
"events": "^1.1.1"
},
"dependencies": {
"events": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
"integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ="
}
}
},
"ally.js": {
@ -9487,9 +9671,12 @@
"integrity": "sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg=="
},
"markdown-table": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.3.tgz",
"integrity": "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q=="
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-2.0.0.tgz",
"integrity": "sha512-Ezda85ToJUBhM6WGaG6veasyym+Tbs3cMAw/ZhOPqXiYsr0jgocBV3j3nx+4lk47plLlIqjwuTm/ywVI+zjJ/A==",
"requires": {
"repeat-string": "^1.0.0"
}
},
"marked": {
"version": "0.7.0",
@ -9537,21 +9724,11 @@
}
},
"mdast-util-compact": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-1.0.4.tgz",
"integrity": "sha512-3YDMQHI5vRiS2uygEFYaqckibpJtKq5Sj2c8JioeOQBU6INpKbdWzfyLqFFnDwEcEnRFIdMsguzs5pC1Jp4Isg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/mdast-util-compact/-/mdast-util-compact-2.0.1.tgz",
"integrity": "sha512-7GlnT24gEwDrdAwEHrU4Vv5lLWrEer4KOkAiKT9nYstsTad7Oc1TwqT2zIMKRdZF7cTuaf+GA1E4Kv7jJh8mPA==",
"requires": {
"unist-util-visit": "^1.1.0"
},
"dependencies": {
"unist-util-visit": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz",
"integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==",
"requires": {
"unist-util-visit-parents": "^2.0.0"
}
}
"unist-util-visit": "^2.0.0"
}
},
"mdast-util-definitions": {
@ -10971,9 +11148,9 @@
}
},
"parse-entities": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.2.tgz",
"integrity": "sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-2.0.0.tgz",
"integrity": "sha512-kkywGpCcRYhqQIchaWqZ875wzpS/bMKhz5HnN3p7wveJTkTtyAB/AlnS0f8DFSqYW1T82t6yEAkEcB+A1I3MbQ==",
"requires": {
"character-entities": "^1.0.0",
"character-entities-legacy": "^1.0.0",
@ -12557,6 +12734,34 @@
}
}
},
"react-fast-compare": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz",
"integrity": "sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA=="
},
"react-instantsearch-core": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/react-instantsearch-core/-/react-instantsearch-core-6.7.0.tgz",
"integrity": "sha512-wIvSIwkWfqPbaQZcbKsfBK3Gpm1e7ahSwU8Bmx1N5RfUqA/NghqS0Ppv3sz4vCXjoEAdPV06R+Fpn9lT+cE9/Q==",
"requires": {
"@babel/runtime": "^7.1.2",
"algoliasearch-helper": "^3.1.0",
"prop-types": "^15.5.10",
"react-fast-compare": "^3.0.0"
}
},
"react-instantsearch-dom": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/react-instantsearch-dom/-/react-instantsearch-dom-6.7.0.tgz",
"integrity": "sha512-J1C9xkHHLLa6rkKLKFDa7szA0TDo6yPFGmDzh2+JLaq4o694RIqivfUpROHus0Ki3BAQu9QmzLtodf6K1NOBWQ==",
"requires": {
"@babel/runtime": "^7.1.2",
"algoliasearch-helper": "^3.1.0",
"classnames": "^2.2.5",
"prop-types": "^15.5.10",
"react-instantsearch-core": "^6.7.0"
}
},
"react-is": {
"version": "16.12.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.12.0.tgz",
@ -12861,13 +13066,28 @@
}
},
"remark": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/remark/-/remark-11.0.2.tgz",
"integrity": "sha512-bh+eJgn8wgmbHmIBOuwJFdTVRVpl3fcVP6HxmpPWO0ULGP9Qkh6INJh0N5Uy7GqlV7DQYGoqaKiEIpM5LLvJ8w==",
"version": "12.0.1",
"resolved": "https://registry.npmjs.org/remark/-/remark-12.0.1.tgz",
"integrity": "sha512-gS7HDonkdIaHmmP/+shCPejCEEW+liMp/t/QwmF0Xt47Rpuhl32lLtDV1uKWvGoq+kxr5jSgg5oAIpGuyULjUw==",
"requires": {
"remark-parse": "^7.0.0",
"remark-stringify": "^7.0.0",
"unified": "^8.2.0"
"remark-parse": "^8.0.0",
"remark-stringify": "^8.0.0",
"unified": "^9.0.0"
},
"dependencies": {
"unified": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/unified/-/unified-9.2.0.tgz",
"integrity": "sha512-vx2Z0vY+a3YoTj8+pttM3tiJHCwY5UFbYdiWrwBEbHmK8pvsPj2rtAX2BFfgXen8T39CJWblWRDT4L5WGXtDdg==",
"requires": {
"bail": "^1.0.0",
"extend": "^3.0.0",
"is-buffer": "^2.0.0",
"is-plain-obj": "^2.0.0",
"trough": "^1.0.0",
"vfile": "^4.0.0"
}
}
}
},
"remark-footnotes": {
@ -12965,24 +13185,25 @@
}
},
"remark-parse": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-7.0.2.tgz",
"integrity": "sha512-9+my0lQS80IQkYXsMA8Sg6m9QfXYJBnXjWYN5U+kFc5/n69t+XZVXU/ZBYr3cYH8FheEGf1v87rkFDhJ8bVgMA==",
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-8.0.3.tgz",
"integrity": "sha512-E1K9+QLGgggHxCQtLt++uXltxEprmWzNfg+MxpfHsZlrddKzZ/hZyWHDbK3/Ap8HJQqYJRXP+jHczdL6q6i85Q==",
"requires": {
"ccount": "^1.0.0",
"collapse-white-space": "^1.0.2",
"is-alphabetical": "^1.0.0",
"is-decimal": "^1.0.0",
"is-whitespace-character": "^1.0.0",
"is-word-character": "^1.0.0",
"markdown-escapes": "^1.0.0",
"parse-entities": "^1.1.0",
"parse-entities": "^2.0.0",
"repeat-string": "^1.5.4",
"state-toggle": "^1.0.0",
"trim": "0.0.1",
"trim-trailing-lines": "^1.0.0",
"unherit": "^1.0.4",
"unist-util-remove-position": "^1.0.0",
"vfile-location": "^2.0.0",
"unist-util-remove-position": "^2.0.0",
"vfile-location": "^3.0.0",
"xtend": "^4.0.1"
}
},
@ -12995,9 +13216,9 @@
}
},
"remark-stringify": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-7.0.4.tgz",
"integrity": "sha512-qck+8NeA1D0utk1ttKcWAoHRrJxERYQzkHDyn+pF5Z4whX1ug98uCNPPSeFgLSaNERRxnD6oxIug6DzZQth6Pg==",
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-8.1.1.tgz",
"integrity": "sha512-q4EyPZT3PcA3Eq7vPpT6bIdokXzFGp9i85igjmhRyXWmPs0Y6/d2FYwUNotKAWyLch7g0ASZJn/KHHcHZQ163A==",
"requires": {
"ccount": "^1.0.0",
"is-alphanumeric": "^1.0.0",
@ -13005,12 +13226,12 @@
"is-whitespace-character": "^1.0.0",
"longest-streak": "^2.0.1",
"markdown-escapes": "^1.0.0",
"markdown-table": "^1.1.0",
"mdast-util-compact": "^1.0.0",
"parse-entities": "^1.0.2",
"markdown-table": "^2.0.0",
"mdast-util-compact": "^2.0.0",
"parse-entities": "^2.0.0",
"repeat-string": "^1.5.4",
"state-toggle": "^1.0.0",
"stringify-entities": "^2.0.0",
"stringify-entities": "^3.0.0",
"unherit": "^1.0.4",
"xtend": "^4.0.1"
}
@ -13370,6 +13591,11 @@
"ajv-keywords": "^3.1.0"
}
},
"search-insights": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/search-insights/-/search-insights-1.6.2.tgz",
"integrity": "sha512-mpy+57HZVMZH5HsMHYMCLvkf+tUvhy+ycP2tDy1j7wmj+mQsNZ3LC61IcMYomok02NozaMR3GiGyfH6uc+ibdA=="
},
"section-matter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz",
@ -14206,9 +14432,9 @@
}
},
"stringify-entities": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-2.0.0.tgz",
"integrity": "sha512-fqqhZzXyAM6pGD9lky/GOPq6V4X0SeTAFBl0iXb/BzOegl40gpf/bV3QQP7zULNYvjr6+Dx8SCaDULjVoOru0A==",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-3.0.1.tgz",
"integrity": "sha512-Lsk3ISA2++eJYqBMPKcr/8eby1I6L0gP0NlxF8Zja6c05yr/yCYyb2c9PwXjd08Ib3If1vn1rbs1H5ZtVuOfvQ==",
"requires": {
"character-entities-html4": "^1.0.0",
"character-entities-legacy": "^1.0.0",
@ -15716,21 +15942,11 @@
}
},
"unist-util-remove-position": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.4.tgz",
"integrity": "sha512-tLqd653ArxJIPnKII6LMZwH+mb5q+n/GtXQZo6S6csPRs5zB0u79Yw8ouR3wTw8wxvdJFhpP6Y7jorWdCgLO0A==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-2.0.1.tgz",
"integrity": "sha512-fDZsLYIe2uT+oGFnuZmy73K6ZxOPG/Qcm+w7jbEjaFcJgbQ6cqjs/eSPzXhsmGpAsWPkqZM9pYjww5QTn3LHMA==",
"requires": {
"unist-util-visit": "^1.1.0"
},
"dependencies": {
"unist-util-visit": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.1.tgz",
"integrity": "sha512-AvGNk7Bb//EmJZyhtRUnNMEpId/AZ5Ph/KUpTI09WHQuDZHKovQ1oEv3mfmKpWKtoMzyMC4GLBm1Zy5k12fjIw==",
"requires": {
"unist-util-visit-parents": "^2.0.0"
}
}
"unist-util-visit": "^2.0.0"
}
},
"unist-util-stringify-position": {
@ -15742,39 +15958,22 @@
}
},
"unist-util-visit": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.2.tgz",
"integrity": "sha512-HoHNhGnKj6y+Sq+7ASo2zpVdfdRifhTgX2KTU3B/sO/TTlZchp7E3S4vjRzDJ7L60KmrCPsQkVK3lEF3cz36XQ==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-2.0.3.tgz",
"integrity": "sha512-iJ4/RczbJMkD0712mGktuGpm/U4By4FfDonL7N/9tATGIF4imikjOuagyMY53tnZq3NP6BcmlrHhEKAfGWjh7Q==",
"requires": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0",
"unist-util-visit-parents": "^3.0.0"
},
"dependencies": {
"unist-util-visit-parents": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.0.2.tgz",
"integrity": "sha512-yJEfuZtzFpQmg1OSCyS9M5NJRrln/9FbYosH3iW0MG402QbdbaB8ZESwUv9RO6nRfLAKvWcMxCwdLWOov36x/g==",
"requires": {
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0"
}
}
}
},
"unist-util-visit-parents": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.1.2.tgz",
"integrity": "sha512-DyN5vD4NE3aSeB+PXYNKxzGsfocxp6asDc2XXE3b0ekO2BaRUpBicbbUygfSvYfUz1IkmjFR1YF7dPklraMZ2g==",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-3.1.0.tgz",
"integrity": "sha512-0g4wbluTF93npyPrp/ymd3tCDTMnP0yo2akFD2FIBAYXq/Sga3lwaU1D8OYKbtpioaI6CkDcQ6fsMnmtzt7htw==",
"requires": {
"unist-util-is": "^3.0.0"
},
"dependencies": {
"unist-util-is": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-3.0.0.tgz",
"integrity": "sha512-sVZZX3+kspVNmLWBPAB6r+7D9ZgAFPNWm66f7YNb420RlQSbn+n8rG8dGZSkrER7ZIXGQYNm5pqC3v3HopH24A=="
}
"@types/unist": "^2.0.0",
"unist-util-is": "^4.0.0"
}
},
"universalify": {
@ -16010,9 +16209,9 @@
}
},
"vfile-location": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.6.tgz",
"integrity": "sha512-sSFdyCP3G6Ka0CEmN83A2YCMKIieHx0EDaj5IDP4g1pa5ZJ4FJDvpO0WODLxo4LUX4oe52gmSCK7Jw4SBghqxA=="
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-3.1.0.tgz",
"integrity": "sha512-FCZ4AN9xMcjFIG1oGmZKo61PjwJHRVA+0/tPUP2ul4uIwjGGndIxavEMRpWn5p4xwm/ZsdXp9YNygf1ZyE4x8g=="
},
"vfile-message": {
"version": "2.0.4",

View File

@ -13,20 +13,23 @@
"@hashicorp/react-head": "1.1.1",
"@hashicorp/react-mega-nav": "4.0.1-2",
"@hashicorp/react-product-downloader": "4.0.2",
"@hashicorp/react-search": "^2.0.0",
"@hashicorp/react-section-header": "2.0.0",
"@hashicorp/react-subnav": "3.2.3",
"@hashicorp/react-vertical-text-block-list": "2.0.1",
"algoliasearch": "4.3.0",
"algoliasearch": "^4.4.0",
"babel-plugin-import-glob-array": "0.2.0",
"dotenv": "8.2.0",
"glob": "^7.1.6",
"gray-matter": "4.0.2",
"next": "9.4.4",
"react": "16.13.1",
"react-dom": "16.13.1"
"react-dom": "16.13.1",
"remark": "^12.0.1",
"unist-util-visit": "^2.0.3"
},
"devDependencies": {
"dart-linkcheck": "2.0.15",
"glob": "7.1.6",
"husky": "4.2.5",
"prettier": "2.0.5"
},

View File

@ -17,6 +17,7 @@
@import '~@hashicorp/react-docs-sidenav/dist/style.css';
@import '~@hashicorp/react-mega-nav/style.css';
@import '~@hashicorp/react-product-downloader/dist/style.css';
@import '~@hashicorp/react-search/dist/style.css';
@import '~@hashicorp/react-section-header/dist/style.css';
@import '~@hashicorp/react-subnav/dist/style.css';
@import '~@hashicorp/react-tabs/dist/style.css';
@ -25,6 +26,7 @@
/* Local Components */
@import '../components/footer/style.css';
@import '../components/search-bar/style.css';
/* Local Pages */
@import './home/style.css';

View File

@ -4,6 +4,8 @@ const algoliasearch = require('algoliasearch')
const glob = require('glob')
const matter = require('gray-matter')
const path = require('path')
const remark = require('remark')
const visit = require('unist-util-visit')
// In addition to the content of the page,
// define additional front matter attributes that will be search-indexable
@ -15,30 +17,36 @@ async function main() {
const pagesFolder = path.join(__dirname, '../pages')
// Grab all search-indexable content and format for Algolia
const searchObjects = glob
.sync(path.join(pagesFolder, '**/*.mdx'))
.map((fullPath) => {
const { content, data } = matter.read(fullPath)
const searchObjects = await Promise.all(
glob
.sync(path.join(pagesFolder, '**/*.mdx'), {
ignore: path.join(pagesFolder, 'partials/**/*'),
})
.map(async (fullPath) => {
const { content, data } = matter.read(fullPath)
// Get path relative to `pages`
const __resourcePath = fullPath.replace(`${pagesFolder}/`, '')
const searchableDimensions = SEARCH_DIMENSIONS.reduce(
(acc, dimension) => {
return { ...acc, [dimension]: data[dimension] }
},
{}
)
// Use clean URL for Algolia id
const objectID = __resourcePath.replace('.mdx', '')
const headings = await collectHeadings(content)
const searchableDimensions = Object.keys(data)
.filter((key) => SEARCH_DIMENSIONS.includes(key))
.map((dimension) => ({
[dimension]: data[dimension],
}))
// Get path relative to `pages`
const __resourcePath = fullPath.replace(`${pagesFolder}/`, '')
return {
...searchableDimensions,
content,
__resourcePath,
objectID,
}
})
// Use clean URL for Algolia id
const objectID = __resourcePath.replace('.mdx', '')
return {
...searchableDimensions,
headings,
objectID,
}
})
)
try {
await indexSearchContent(searchObjects)
@ -67,25 +75,23 @@ async function indexSearchContent(objects) {
const searchClient = algoliasearch(appId, apiKey)
const searchIndex = searchClient.initIndex(index)
await searchIndex.partialUpdateObjects(objects, {
const { objectIDs } = await searchIndex.partialUpdateObjects(objects, {
createIfNotExists: true,
})
// Remove indices for items that aren't included in the new batch
const newObjectIds = objects.map(({ objectID }) => objectID)
let staleObjects = []
let staleIds = []
await searchIndex.browseObjects({
query: '',
batch: (batch) => {
staleObjects = staleObjects.concat(
batch.filter(({ objectID }) => !newObjectIds.includes(objectID))
staleIds = staleIds.concat(
batch
.filter(({ objectID }) => !objectIDs.includes(objectID))
.map(({ objectID }) => objectID)
)
},
})
const staleIds = staleObjects.map(({ objectID }) => objectID)
if (staleIds.length > 0) {
console.log(`deleting ${staleIds.length} stale indices:`)
console.log(staleIds)
@ -99,3 +105,25 @@ async function indexSearchContent(objects) {
throw new Error(error)
}
}
async function collectHeadings(mdxContent) {
const headings = []
const headingMapper = () => (tree) => {
visit(tree, 'heading', (node) => {
const title = node.children.reduce((m, n) => {
if (n.value) m += n.value
return m
}, '')
// Only include level 1 or level 2 headings
if (node.depth < 3) {
headings.push(title)
}
})
}
return remark()
.use(headingMapper)
.process(mdxContent)
.then(() => headings)
}