Completes the arcadia-admin operator surface for the integration registry and the capability/route-guard framework it depends on. - Integration registry: route + Data-group nav entry + `platform.integrations` capability; the in-app client now delegates to the shared `@crema/integration-registry-client` lib (vite alias + tsconfig); the operator Integrations page (committed earlier) is now reachable. - Capability gating: capabilities map + route-guard + jwt helpers + the apps/plan/entitlements routes and supporting tenants/session changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
226 lines
8.6 KiB
TypeScript
226 lines
8.6 KiB
TypeScript
import { resolve as resolvePath } from "node:path"
|
|
import { fileURLToPath } from "node:url"
|
|
import { reactRouter } from "@react-router/dev/vite"
|
|
import tailwindcss from "@tailwindcss/vite"
|
|
import { defineConfig } from "vite"
|
|
import tsconfigPaths from "vite-tsconfig-paths"
|
|
|
|
const contentUiSrc = fileURLToPath(
|
|
new URL("../lib-content-ui/src", import.meta.url),
|
|
)
|
|
const contentEditorUiSrc = fileURLToPath(
|
|
new URL("../lib-content-editor-ui/src", import.meta.url),
|
|
)
|
|
const contentMediaUiSrc = fileURLToPath(
|
|
new URL("../lib-content-media-ui/src", import.meta.url),
|
|
)
|
|
const colorUiSrc = fileURLToPath(
|
|
new URL("../lib-color-ui/src", import.meta.url),
|
|
)
|
|
const typographyUiSrc = fileURLToPath(
|
|
new URL("../lib-typography-ui/src", import.meta.url),
|
|
)
|
|
const dataUiSrc = fileURLToPath(
|
|
new URL("../lib-data-ui/src", import.meta.url),
|
|
)
|
|
const layoutUiSrc = fileURLToPath(
|
|
new URL("../lib-layout-ui/src", import.meta.url),
|
|
)
|
|
const mapUiSrc = fileURLToPath(
|
|
new URL("../lib-map-ui/src", import.meta.url),
|
|
)
|
|
const formUiSrc = fileURLToPath(
|
|
new URL("../lib-form-ui/src", import.meta.url),
|
|
)
|
|
const feedbackUiSrc = fileURLToPath(
|
|
new URL("../lib-feedback-ui/src", import.meta.url),
|
|
)
|
|
const diagramUiSrc = fileURLToPath(
|
|
new URL("../lib-diagram-ui/src", import.meta.url),
|
|
)
|
|
const chatUiSrc = fileURLToPath(
|
|
new URL("../lib-chat-ui/src", import.meta.url),
|
|
)
|
|
const calendarUiSrc = fileURLToPath(
|
|
new URL("../lib-calendar-ui/src", import.meta.url),
|
|
)
|
|
const codeUiSrc = fileURLToPath(
|
|
new URL("../lib-code-ui/src", import.meta.url),
|
|
)
|
|
const aiUiSrc = fileURLToPath(
|
|
new URL("../lib-ai-ui/src", import.meta.url),
|
|
)
|
|
const authUiSrc = fileURLToPath(
|
|
new URL("../lib-auth-ui/src", import.meta.url),
|
|
)
|
|
const tableUiSrc = fileURLToPath(
|
|
new URL("../lib-table-ui/src", import.meta.url),
|
|
)
|
|
const searchUiSrc = fileURLToPath(
|
|
new URL("../lib-search-ui/src", import.meta.url),
|
|
)
|
|
const arcadiaClientSrc = fileURLToPath(
|
|
new URL("../lib-arcadia-client/src", import.meta.url),
|
|
)
|
|
const integrationRegistryClientSrc = fileURLToPath(
|
|
new URL("../lib-integration-registry-client/src", import.meta.url),
|
|
)
|
|
const arcadiaAuthUiSrc = fileURLToPath(
|
|
new URL("../lib-arcadia-auth-ui/src", import.meta.url),
|
|
)
|
|
const llmUiSrc = fileURLToPath(
|
|
new URL("../lib-llm-ui/src", import.meta.url),
|
|
)
|
|
const llmProvidersUiSrc = fileURLToPath(
|
|
new URL("../lib-llm-providers-ui/src", import.meta.url),
|
|
)
|
|
const fileUiSrc = fileURLToPath(
|
|
new URL("../lib-file-ui/src", import.meta.url),
|
|
)
|
|
const cardUiSrc = fileURLToPath(
|
|
new URL("../lib-card-ui/src", import.meta.url),
|
|
)
|
|
const dashboardUiSrc = fileURLToPath(
|
|
new URL("../lib-dashboard-ui/src", import.meta.url),
|
|
)
|
|
const chartUiSrc = fileURLToPath(
|
|
new URL("../lib-chart-ui/src", import.meta.url),
|
|
)
|
|
const statusUiSrc = fileURLToPath(
|
|
new URL("../lib-status-ui/src", import.meta.url),
|
|
)
|
|
const actionBusSrc = fileURLToPath(
|
|
new URL("../lib-action-bus/src", import.meta.url),
|
|
)
|
|
const agentUiSrc = fileURLToPath(
|
|
new URL("../lib-agent-ui/src", import.meta.url),
|
|
)
|
|
const aifirstUiSrc = fileURLToPath(
|
|
new URL("../lib-aifirst-ui/src", import.meta.url),
|
|
)
|
|
const lexicalRagUiSrc = fileURLToPath(
|
|
new URL("../lib-lexical-rag-ui/src", import.meta.url),
|
|
)
|
|
const notificationUiSrc = fileURLToPath(
|
|
new URL("../lib-notification-ui/src", import.meta.url),
|
|
)
|
|
const onboardingUiSrc = fileURLToPath(
|
|
new URL("../lib-onboarding-ui/src", import.meta.url),
|
|
)
|
|
|
|
// Sibling lib packages (lib-content-ui, lib-content-editor-ui) import bare
|
|
// deps like clsx and @tiptap/* but have no node_modules of their own. Pin
|
|
// each shared dep to pristine-ui's installed copy so Vite can resolve them
|
|
// regardless of the importer's location.
|
|
const nodeModules = fileURLToPath(new URL("./node_modules/", import.meta.url))
|
|
const aliasedDeps = [
|
|
"clsx",
|
|
"tailwind-merge",
|
|
"lucide-react",
|
|
"openapi-fetch",
|
|
"phoenix",
|
|
"@tiptap/core",
|
|
"@tiptap/react",
|
|
"@tiptap/starter-kit",
|
|
"@tiptap/extension-link",
|
|
"@tiptap/extension-placeholder",
|
|
"@tiptap/extension-image",
|
|
"minisearch",
|
|
"react-markdown",
|
|
"remark-gfm",
|
|
]
|
|
const sharedDepAliases = Object.fromEntries(
|
|
aliasedDeps.map((name) => [name, resolvePath(nodeModules, name)]),
|
|
)
|
|
const dedupeDeps = [
|
|
"react",
|
|
"react-dom",
|
|
"react-router",
|
|
...aliasedDeps,
|
|
]
|
|
|
|
export default defineConfig({
|
|
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
|
|
resolve: {
|
|
// Array form so we can express both the bare-specifier alias
|
|
// (`@crema/agent-ui` -> src/index.tsx) and a subpath prefix alias
|
|
// (`@crema/agent-ui/chat` -> src/chat) for libs whose sibling-lib
|
|
// code reaches into deeper modules. Prefix entries with regex `find`
|
|
// are matched first.
|
|
alias: [
|
|
// Subpath prefixes — longest first so they win before the bare match.
|
|
{ find: /^@crema\/agent-ui\//, replacement: `${agentUiSrc}/` },
|
|
{ find: /^@crema\/aifirst-ui\//, replacement: `${aifirstUiSrc}/` },
|
|
{ find: /^@crema\/notification-ui\//, replacement: `${notificationUiSrc}/` },
|
|
{ find: /^@crema\/onboarding-ui\//, replacement: `${onboardingUiSrc}/` },
|
|
{ find: /^@crema\/lexical-rag-ui\//, replacement: `${lexicalRagUiSrc}/` },
|
|
{ find: /^@crema\/action-bus\//, replacement: `${actionBusSrc}/` },
|
|
|
|
// Bare-specifier exact matches.
|
|
{ find: "@crema/content-ui", replacement: `${contentUiSrc}/index.ts` },
|
|
{ find: "@crema/content-editor-ui", replacement: `${contentEditorUiSrc}/index.ts` },
|
|
{ find: "@crema/content-media-ui", replacement: `${contentMediaUiSrc}/index.tsx` },
|
|
{ find: "@crema/color-ui", replacement: `${colorUiSrc}/index.tsx` },
|
|
{ find: "@crema/typography-ui", replacement: `${typographyUiSrc}/index.tsx` },
|
|
{ find: "@crema/data-ui", replacement: `${dataUiSrc}/index.tsx` },
|
|
{ find: "@crema/layout-ui", replacement: `${layoutUiSrc}/index.tsx` },
|
|
{ find: "@crema/map-ui", replacement: `${mapUiSrc}/index.tsx` },
|
|
{ find: "@crema/form-ui", replacement: `${formUiSrc}/index.tsx` },
|
|
{ find: "@crema/feedback-ui", replacement: `${feedbackUiSrc}/index.tsx` },
|
|
{ find: "@crema/diagram-ui", replacement: `${diagramUiSrc}/index.tsx` },
|
|
{ find: "@crema/chat-ui", replacement: `${chatUiSrc}/index.tsx` },
|
|
{ find: "@crema/calendar-ui", replacement: `${calendarUiSrc}/index.tsx` },
|
|
{ find: "@crema/code-ui", replacement: `${codeUiSrc}/index.tsx` },
|
|
{ find: "@crema/ai-ui", replacement: `${aiUiSrc}/index.tsx` },
|
|
{ find: "@crema/auth-ui", replacement: `${authUiSrc}/index.tsx` },
|
|
{ find: "@crema/table-ui", replacement: `${tableUiSrc}/index.tsx` },
|
|
{ find: "@crema/search-ui", replacement: `${searchUiSrc}/index.tsx` },
|
|
{ find: "@crema/arcadia-client", replacement: `${arcadiaClientSrc}/index.tsx` },
|
|
{
|
|
find: "@crema/integration-registry-client",
|
|
replacement: `${integrationRegistryClientSrc}/index.tsx`,
|
|
},
|
|
{ find: "@crema/arcadia-auth-ui", replacement: `${arcadiaAuthUiSrc}/index.tsx` },
|
|
{ find: "@crema/llm-ui", replacement: `${llmUiSrc}/index.tsx` },
|
|
{ find: "@crema/llm-providers-ui", replacement: `${llmProvidersUiSrc}/index.tsx` },
|
|
{ find: "@crema/file-ui", replacement: `${fileUiSrc}/index.tsx` },
|
|
{ find: "@crema/card-ui", replacement: `${cardUiSrc}/index.tsx` },
|
|
{ find: "@crema/dashboard-ui", replacement: `${dashboardUiSrc}/index.tsx` },
|
|
{ find: "@crema/chart-ui", replacement: `${chartUiSrc}/index.tsx` },
|
|
{ find: "@crema/status-ui", replacement: `${statusUiSrc}/index.tsx` },
|
|
{ find: "@crema/action-bus", replacement: `${actionBusSrc}/index.tsx` },
|
|
{ find: "@crema/agent-ui", replacement: `${agentUiSrc}/index.tsx` },
|
|
{ find: "@crema/aifirst-ui", replacement: `${aifirstUiSrc}/index.tsx` },
|
|
{ find: "@crema/lexical-rag-ui", replacement: `${lexicalRagUiSrc}/index.tsx` },
|
|
{ find: "@crema/notification-ui", replacement: `${notificationUiSrc}/index.tsx` },
|
|
{ find: "@crema/onboarding-ui", replacement: `${onboardingUiSrc}/index.tsx` },
|
|
|
|
...Object.entries(sharedDepAliases).map(([find, replacement]) => ({
|
|
find,
|
|
replacement,
|
|
})),
|
|
],
|
|
dedupe: dedupeDeps,
|
|
},
|
|
// Pre-bundle deps that sibling libs reach for. Without this, Vite
|
|
// discovers them lazily as routes are hit and re-runs the optimizer,
|
|
// invalidating already-served module URLs (browser sees 504 "Outdated
|
|
// Optimize Dep"). Listing them here forces one optimizer pass on
|
|
// startup so the cache is stable before the browser connects.
|
|
optimizeDeps: {
|
|
include: [
|
|
"openapi-fetch",
|
|
"phoenix",
|
|
"lucide-react",
|
|
"clsx",
|
|
"tailwind-merge",
|
|
"class-variance-authority",
|
|
],
|
|
},
|
|
server: {
|
|
fs: {
|
|
allow: [fileURLToPath(new URL("..", import.meta.url))],
|
|
},
|
|
},
|
|
})
|