Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ The custom `hero` slot disables the default page-wide decorative background.

`Updates` supports optional `card` and `skeleton` slots for product-owned announcement styling while retaining the shared feed loading, retry and carousel behavior. The `card` slot must contain a single `<a>` with `<strong>` (title), `[data-update-description]` (summary) and an `<img>` placeholder (populated or removed by the loader). The `skeleton` slot supplies the loading placeholders. Custom cards should hide images with the `hidden` attribute. The optional `style` prop sets the wrapper's minimum height and existing Carousel variables such as `--carousel-gap` and `--carousel-pagination-margin`; the default appearance is unchanged.

Optional components `QaEntry`, `Updates`, `Carousel`, and `Loading` are available from `@antv/astro-theme-antv/components`. QA requires `qa.enabled: true` and access to Sive's QA service and authentication.
Optional components `QaEntry`, `Updates`, `Carousel`, and `Loading` are available from `@antv/astro-theme-antv/components`. QA requires `qa.enabled: true` and access to Sive's QA service and authentication. Session links use the static QA entry with an `sessionId` query parameter, such as `/zh/qa/?sessionId=<sessionId>` (including any configured `base` and `qa.path`). Use a Sive QA SDK release that supports this query format. No session-subpath rewrites are required; the previous `/zh/qa/<sessionId>` format is no longer supported.

For Astro options such as `base` or additional integrations, use Astro's `defineConfig` with `antvSite(siteConfig)` in `integrations`. Install and add `@astrojs/mdx` and `@astrojs/sitemap` if needed; the package's `defineConfig` includes both by default.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@antv/astro-theme-antv",
"version": "0.1.0-beta.15",
"version": "0.1.0-beta.16",
"description": "Astro integration for static open-source documentation and examples",
"license": "MIT",
"repository": {
Expand Down
34 changes: 1 addition & 33 deletions src/integration/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
import tailwindcss from "@tailwindcss/vite";
import type { InjectedRoute } from "astro";
import type { MarkdownProcessor } from "astro/markdown";
import type { Connect, Plugin, ViteDevServer } from "vite";
import type { Plugin, ViteDevServer } from "vite";
import type { ResolvedSiteConfig } from "../compiler/config.js";
import { collectDemoFiles } from "../demo-files.js";
import { scanSite } from "../compiler/content.js";
Expand Down Expand Up @@ -113,7 +113,6 @@ export async function prepareThemeIntegration({
),
plugins: [
...tailwindcss(),
...(config.qa ? [createQaRoutingPlugin(config, getBase)] : []),
createSlotsPlugin(() => config),
createDemoPlugin(registry),
],
Expand All @@ -129,37 +128,6 @@ export async function prepareThemeIntegration({
};
}

function createQaRoutingPlugin(
config: ResolvedSiteConfig,
getBase: () => string,
): Plugin {
const rewrite: Connect.NextHandleFunction = (req, _res, next) => {
if (req.url && (req.method === "GET" || req.method === "HEAD")) {
const url = new URL(req.url, "http://localhost");
for (const locale of config.site.locales) {
const entry = `${getBase()}/${locale}/${config.qa!.path}/`.replace(/\/+/g, "/");
if (!url.pathname.startsWith(entry)) continue;
const sessionId = url.pathname.slice(entry.length);
if (/^[\w-]+\/?$/.test(sessionId)) {
req.url = entry + url.search;
}
break;
}
}
next();
};
return {
name: "antv-site-qa-routing",
enforce: "post",
configureServer(server) {
// Astro installs its trailing-slash guard in a post hook. Rewrite before it.
return () => {
server.middlewares.stack.unshift({ route: "", handle: rewrite });
};
},
};
}

export function setupThemeDevServer(
server: ViteDevServer,
restartRoots: string[],
Expand Down
Loading