Files
market/vite.config.ts
zeekay 89691f3697 market: every listing a page and a Markdown twin, with sitemap, llms.txt, robots, auth.md, api-catalog and WebMCP
The build writes the catalog into dist after vite: a page per listing (the
shell with its own head, JSON-LD and a static body the app replaces), its
twin at <path>.md, the shelves, the front, sitemap.xml, llms.txt,
llms-full.txt, 404.html, and a moved page for any path the last release
listed and this one does not. Sources are read whole; one that fails or
answers empty stops the build. Every external link is fetched and dropped
unless it answers.

A price and an Offer come only from the shop. Directory and template
entries say they are not shop listings. Fabricated ratings, reviews and
installs, the directory's certified tax form, and the persona and template
CLI lines the CLI lacks are gone.

WebMCP registers search_market and get_listing, read-only. An unknown path
renders Not found instead of the front page. Persona definitions move to
/personas/<slug>/PERSONA.md, where the twin's path was.
2026-10-27 02:06:43 -07:00

61 lines
2.1 KiB
TypeScript

import { hanzo } from '@hanzo/vite'
import react from '@vitejs/plugin-react'
/**
* hanzo.market is a static storefront: `vite build` writes dist/, and the sites
* plane serves it. There is no server in this repo — every read and write goes
* to api.hanzo.ai.
*
* `hanzo()` resolves the Hanzo runtime (react-native-web, web-first extensions,
* one copy of gui) the same way every Hanzo Vite app does.
*/
const API = 'https://api.hanzo.ai'
/**
* Same-origin in front of the gateway on the dev server and on a preview of a
* build. api.hanzo.ai admits an origin by allowlist; a localhost port is not on
* it, so a local page asks its own origin and this proxy forwards. The skills
* directory is served from the gateway's /.well-known, so it is proxied too.
*/
const proxy = {
'/v1': { target: API, changeOrigin: true },
'/.well-known/agent-skills': { target: API, changeOrigin: true },
}
/**
* Pinned because it is half of a redirect: IAM returns the browser to the exact
* `redirect_uri` registered for the hanzo-market client, port included.
*/
const PORT = 3330
const config = hanzo(
{
plugins: [react()],
server: { port: PORT, allowedHosts: true, proxy },
preview: { port: PORT, allowedHosts: true, proxy },
},
{
root: import.meta.dirname,
// One copy of the theme: the theme and config contexts live in
// @hanzogui/core, a layer below what `hanzo()` dedupes.
dedupe: ['@hanzogui/core', '@hanzogui/web', '@hanzogui/portal', '@hanzogui/toast'],
},
)
/**
* Dependency optimization is a second resolution pass and inherits none of the
* first, so it is told the same extensions: a react-native package's `.web.js`
* sibling comes first. The dev runtime `hanzo()` injects is named up front: the
* scanner cannot see an import a transform adds, and finding it mid-session
* re-bundles and reloads every open page.
*/
export default {
...config,
optimizeDeps: {
include: ['@hanzo/source/client', '@hanzo/source/jsx-dev-runtime', 'react/jsx-dev-runtime'],
rollupOptions: {
resolve: { extensions: (config.resolve as { extensions: string[] }).extensions },
},
},
}