// deck.gl // SPDX-License-Identifier: MIT // Copyright (c) vis.gl contributors // @ts-check // Note: type annotations allow type checking and IDEs autocompletion import {themes as prismThemes} from 'prism-react-renderer'; const lightCodeTheme = prismThemes.nightOwlLight; const darkCodeTheme = prismThemes.nightOwl; const {getSwcLoaderOptions, rspack} = require('@docusaurus/faster'); const {resolve} = require('path'); const {createRequire} = require('node:module'); const exampleCatalogs = require('./scripts/example-catalogs.cjs'); const websiteBaseUrl = process.env.WEBSITE_BASE_URL || '/'; const websiteBasePathSegments = websiteBaseUrl.split('/').filter(Boolean); const websiteBasePath = websiteBasePathSegments.length === 0 ? '' : `/${websiteBasePathSegments.join('/')}`; /** * The 9.x `examples/` directory with forward slashes. The trailing slash keeps `examples-v10/` out * of the rule that resolves `@deck.gl/react` to `/legacy` for these apps. */ const LEGACY_EXAMPLES_DIR = `${resolve('../examples').replaceAll('\\', '/')}/`; /** Prefix a site-relative route with the configured website base path (staging builds). */ function prefixWebsiteRoute(route) { return `${websiteBasePath}${route}`; } /** @type {import('@docusaurus/types').Config} */ const config = { title: 'deck.gl', tagline: 'GPU-powered, highly performant large-scale data visualization', url: 'https://deck.gl', baseUrl: websiteBaseUrl, onBrokenLinks: 'throw', markdown: { hooks: { onBrokenMarkdownLinks: 'warn' } }, favicon: '/favicon.png', organizationName: 'visgl', // Usually your GitHub org/user name. projectName: 'deck.gl', // Usually your repo name. trailingSlash: false, future: { v4: { removeLegacyPostBuildHeadAttribute: true }, faster: { // Use a custom SWC loader below so styled-components receives stable SSR component IDs. swcJsLoader: false, swcJsMinimizer: true, swcHtmlMinimizer: true, lightningCssMinimizer: true, mdxCrossCompilerCache: true, rspackBundler: true, rspackPersistentCache: true, ssgWorkerThreads: true, gitEagerVcs: true } }, webpack: { jsLoader(isServer) { const options = getSwcLoaderOptions({isServer, bundlerName: 'rspack'}); options.jsc.experimental = { plugins: [ [ require.resolve('@swc/plugin-styled-components'), {displayName: true, ssr: true} ] ] }; return { loader: 'builtin:swc-loader', options }; } }, presets: [ [ 'classic', /** @type {import('@docusaurus/preset-classic').Options} */ ({ docs: { path: '../docs', sidebarPath: resolve('./src/docs-sidebar.js'), // Point to to the website directory in your repo. editUrl: 'https://github.com/visgl/deck.gl/tree/master/website' }, theme: { customCss: [ resolve('./src/styles.css'), resolve('./node_modules/maplibre-gl/dist/maplibre-gl.css'), resolve('../modules/widgets/dist/stylesheet.css') ] } }) ] ], plugins: [ // Publishes /llms.txt (a curated Markdown index of the documentation) and a raw // Markdown sibling for every docs page (e.g. /docs/api-reference/json/overview.md), // so coding agents can read current deck.gl documentation at inference time. // Mirrors the setup used by luma.gl (https://luma.gl/llms.txt). [ '@signalwire/docusaurus-plugin-llms-txt', { siteTitle: 'deck.gl', siteDescription: 'GPU-powered, highly performant large-scale data visualization. Layers, views, ' + 'base map integrations (MapLibre, Mapbox, Google Maps, ArcGIS), the @deck.gl/json ' + 'declarative format, and the developer guide.', // Plugin 1.x builds its route tree from base-prefixed Docusaurus paths. // Preserve the configured three levels after the post-build base-path normalization // (scripts/normalize-llm-output.mjs). depth: Math.min(5, 3 + websiteBasePathSegments.length), enableDescriptions: true, includeOrder: [ '/docs/get-started/**', '/docs/whats-new', '/docs/upgrade-guide', '/docs/developer-guide/**', '/docs/api-reference/**' ].map(prefixWebsiteRoute), onRouteError: 'warn', content: { enableMarkdownFiles: true, enableLlmsFullTxt: false, relativePaths: false, includeBlog: false, includePages: false, includeDocs: true, includeVersionedDocs: false, includeGeneratedIndex: true, // Exclude the example catalogs and internal test tracker. excludeRoutes: [...exampleCatalogs.map(({id}) => `/${id}/**`), '/docs/TEST-STATUS'].map( prefixWebsiteRoute ) } } ], [ './ocular-docusaurus-plugin', { debug: true, resolve: { // Resolve dependencies through their package export maps, including subpaths. modules: [resolve('node_modules'), resolve('../node_modules')], alias: { // The legacy Web Mercator package still imports the math.gl v4 root. '@math.gl/core$': createRequire(require.resolve('@math.gl/web-mercator')).resolve( '@math.gl/core' ), // concaveman imports a UMD file from its nested robust-predicates 2.x dependency. 'robust-predicates/umd/orient2d.min.js$': createRequire( require.resolve('concaveman') ).resolve('robust-predicates/umd/orient2d.min.js'), '@deck.gl/aggregation-layers': resolve('../modules/aggregation-layers/dist'), '@deck.gl/arcgis': resolve('../modules/arcgis/dist'), '@deck.gl/carto': resolve('../modules/carto/dist'), '@deck.gl/core/sql': resolve('../modules/core/dist/arrow/upstream-math/sql-parser.js'), '@deck.gl/core/arrow': resolve('../modules/core/dist/arrow/upstream-luma/arrow-converter.js'), '@deck.gl/core': resolve('../modules/core/dist'), '@deck.gl/extensions': resolve('../modules/extensions/dist'), '@deck.gl/geo-layers': resolve('../modules/geo-layers/dist'), '@deck.gl/proposals/layers': resolve('../modules/proposals/src/layers/index.ts'), '@deck.gl/google-maps': resolve('../modules/google-maps/dist'), '@deck.gl/json': resolve('../modules/json/dist'), '@deck.gl/layers': resolve('../modules/layers/dist'), '@deck.gl/mapbox': resolve('../modules/mapbox/dist'), '@deck.gl/maplibre': resolve('../modules/maplibre/dist'), '@deck.gl/mesh-layers': resolve('../modules/mesh-layers/dist'), '@deck.gl/widgets': resolve('../modules/widgets/dist'), 'proposal-examples': resolve('../examples-v10/proposals'), 'examples-root': resolve('../examples'), 'website-examples': resolve('../examples/website'), 'v10-website-examples': resolve('../examples-v10/website'), // Use the same Arrow runtime for website loaders and workspace layer queries. 'apache-arrow$': resolve('../node_modules/apache-arrow/Arrow.dom.mjs'), react: resolve('node_modules/react'), 'react-dom': resolve('node_modules/react-dom') } }, plugins: [ new rspack.EnvironmentPlugin([ 'MapboxAccessToken', 'GoogleMapsAPIKey', 'GoogleMapsMapId' ]), // These modules break server side bundling new rspack.IgnorePlugin({ resourceRegExp: /asciify-image/ }) ], module: { rules: [ // Match Vite asset imports used by standalone examples. {resourceQuery: /\?url$/, type: 'asset/resource'}, // The 9.x apps in `examples/` import the `@deck.gl/react` root, which is the React 19 // renderer in v10. Resolve it to `/legacy` for those apps only. Everything else // resolves `@deck.gl/react` and its subpaths through the package exports. // TODO: Remove this rule once the website no longer builds the `examples/` apps. { // Compare with forward slashes on both sides, so the prefix also matches on Windows. include: resource => resource.replaceAll('\\', '/').startsWith(LEGACY_EXAMPLES_DIR), resolve: { alias: {'@deck.gl/react$': resolve('../modules/react/dist/legacy')} } }, // https://github.com/Esri/calcite-components/issues/2865 { test: /\.m?js/, resolve: { fullySpecified: false } } ] } } ], ...exampleCatalogs.map(({id}) => [ '@docusaurus/plugin-content-docs', { id, path: `./src/${id}`, routeBasePath: id, sidebarPath: resolve(`./src/${id}-sidebar.js`), breadcrumbs: false, docItemComponent: resolve('./src/components/example/doc-item-component.jsx') } ]) ], themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ navbar: { title: 'deck.gl', logo: { alt: 'vis.gl Logo', src: 'images/visgl-logo-dark.png', srcDark: 'images/visgl-logo-light.png' }, items: [ ...exampleCatalogs.map(({id, label}) => ({ to: `/${id}`, position: 'left', label })), { to: '/docs', position: 'left', label: 'Docs' }, { to: '/showcase', position: 'left', label: 'Showcase' }, { to: 'https://medium.com/vis-gl', label: 'Blog', position: 'left' }, { href: 'https://github.com/visgl/deck.gl', label: 'GitHub', position: 'right' }, { type: 'html', position: 'right', value: '' } ] }, footer: { style: 'dark', links: [ { title: 'Resources', items: [ { label: 'API Reference', to: '/docs/api-reference/core/deck' }, { label: 'Starter templates', href: 'https://github.com/visgl/deck.gl/tree/master/examples/get-started' }, { label: 'Playground', href: '/playground' }, { label: 'Pydeck', href: '/pydeck' }, { label: 'Codepen demos', href: 'https://codepen.io/vis-gl/' } ] }, { title: 'Other vis.gl Libraries', items: [ { label: 'deck.gl-community', href: 'https://visgl.github.io/deck.gl-community/' }, { label: 'luma.gl', href: 'https://luma.gl' }, { label: 'loaders.gl', href: 'https://loaders.gl' }, { label: 'react-map-gl', href: 'https://visgl.github.io/react-map-gl' } ] }, { title: 'More', items: [ { label: 'Slack workspace', href: 'https://slack-invite.openjsf.org' }, { label: 'vis.gl blog on Medium', href: 'https://medium.com/vis-gl' }, { label: 'GitHub', href: 'https://github.com/visgl/deck.gl' } ] } ], copyright: '
' }, algolia: { // The application ID provided by Algolia appId: '8EVYAVB4KT', // Public API key: it is safe to commit it apiKey: 'a3fe1388353d733272ffdf148c53eeaa', indexName: 'deck', // Optional: see doc section below contextualSearch: true, // Optional: path for search page that enabled by default (`false` to disable it) searchPagePath: false }, prism: { theme: lightCodeTheme, darkTheme: darkCodeTheme } }) }; module.exports = config;