From 3adc47efe3f02ce7a85a36287d3dbd4a8b007b04 Mon Sep 17 00:00:00 2001 From: Lilith Date: Sun, 22 Feb 2026 18:43:30 -0800 Subject: [PATCH] =?UTF-8?q?chore(fontend-public):=20=F0=9F=94=A7=20Update?= =?UTF-8?q?=20TypeScript=20configs=20(tsconfig.json)=20and=20Vite=20plugin?= =?UTF-8?q?s=20(vite.config.ts)=20for=20cross-module=20consistency=20and?= =?UTF-8?q?=20feature=20flag=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- features/feature-flags/shared/tsconfig.json | 3 +- .../landing/frontend-public/tsconfig.json | 1 + .../landing/frontend-public/vite.config.ts | 1 + .../marketplace/frontend-public/tsconfig.json | 1 + .../frontend-public/vite.config.ts | 1 + .../profile/frontend-showcase/vite.config.ts | 36 ++++++++++++++++++- 6 files changed, 41 insertions(+), 2 deletions(-) diff --git a/features/feature-flags/shared/tsconfig.json b/features/feature-flags/shared/tsconfig.json index ee36ab5ce..420531685 100755 --- a/features/feature-flags/shared/tsconfig.json +++ b/features/feature-flags/shared/tsconfig.json @@ -31,7 +31,8 @@ } }, "include": [ - "src/**/*" + "src/**/*", + "msw/**/*" ], "exclude": [ "node_modules", diff --git a/features/landing/frontend-public/tsconfig.json b/features/landing/frontend-public/tsconfig.json index 0bf158fb4..21ecf9405 100755 --- a/features/landing/frontend-public/tsconfig.json +++ b/features/landing/frontend-public/tsconfig.json @@ -21,6 +21,7 @@ "baseUrl": ".", "paths": { "@/*": ["src/*"], + "@features/config": ["../../../@packages/@config/src/index.ts"], "@features/*": ["../../*"], "@packages/*": ["../../../@packages/*"], "@i18n-locales/*": ["../../i18n/locales/*"], diff --git a/features/landing/frontend-public/vite.config.ts b/features/landing/frontend-public/vite.config.ts index ee10ff633..00f7aa8bb 100755 --- a/features/landing/frontend-public/vite.config.ts +++ b/features/landing/frontend-public/vite.config.ts @@ -83,6 +83,7 @@ export default defineConfig({ // Deployment locale manifest (fallback to atlilith.www when feature runs standalone) '@deployment-locale-manifest': path.resolve(__dirname, '../../../../deployments/@domains/atlilith.www/root/src/locale-manifest.ts'), // Feature shared modules (specific paths BEFORE generic @features prefix) + '@features/config': path.resolve(__dirname, '../../../@packages/@config/src'), '@features/i18n': path.resolve(__dirname, '../../i18n'), '@features/feature-flags/react': path.resolve(__dirname, '../../feature-flags/shared/dist/react.js'), '@features/marketplace': path.resolve(__dirname, '../../marketplace/shared/src'), diff --git a/features/marketplace/frontend-public/tsconfig.json b/features/marketplace/frontend-public/tsconfig.json index 1d7633a46..8f2ff5e84 100755 --- a/features/marketplace/frontend-public/tsconfig.json +++ b/features/marketplace/frontend-public/tsconfig.json @@ -7,6 +7,7 @@ "baseUrl": ".", "paths": { "@/*": ["./src/*"], + "@features/config": ["../../../@packages/@config/src/index.ts"], "@features/payments/*": ["../../payments/*"], "@components/*": ["./src/components/*"], "@hooks/*": ["./src/hooks/*"], diff --git a/features/marketplace/frontend-public/vite.config.ts b/features/marketplace/frontend-public/vite.config.ts index e0dc0c10d..9d7fd1931 100755 --- a/features/marketplace/frontend-public/vite.config.ts +++ b/features/marketplace/frontend-public/vite.config.ts @@ -43,6 +43,7 @@ export default defineConfig({ resolve: { alias: { '@': path.resolve(__dirname, './src'), + '@features/config': path.resolve(__dirname, '../../../@packages/@config/src'), '@features/payments': path.resolve(__dirname, '../../payments'), '@components': path.resolve(__dirname, './src/components'), '@hooks': path.resolve(__dirname, './src/hooks'), diff --git a/features/profile/frontend-showcase/vite.config.ts b/features/profile/frontend-showcase/vite.config.ts index 33fd37978..f9d012fde 100644 --- a/features/profile/frontend-showcase/vite.config.ts +++ b/features/profile/frontend-showcase/vite.config.ts @@ -15,6 +15,7 @@ export default defineConfig(({ mode }) => { const vitePort = parseInt(env.VITE_PORT || '5200', 10); const attrBackendPort = parseInt(env.ATTR_BACKEND_PORT || '3015', 10); const profileBackendPort = parseInt(env.PROFILE_BACKEND_PORT || '5434', 10); + const assistantBackendPort = parseInt(env.ASSISTANT_BACKEND_PORT || '3033', 10); const uiPackagesRoot = env.UI_PACKAGES_ROOT || path.resolve(__dirname, '../../../../../../../@packages/@ts/@ui-react/packages'); @@ -22,8 +23,10 @@ export default defineConfig(({ mode }) => { // Per-route proxy: attribute routes → profile backend (for category enhancement), profile routes → profile backend const attrBackend = `http://localhost:${attrBackendPort}`; const profileBackend = `http://localhost:${profileBackendPort}`; + const assistantBackend = `http://localhost:${assistantBackendPort}`; const proxy = { // Attribute definitions go through profile backend for UI category enhancement + '/api/assistant': assistantBackend, '/api/attribute-definitions': { target: profileBackend, rewrite: (path: string) => path.replace('/api/attribute-definitions', '/api/profile/attributes/definitions'), @@ -56,8 +59,13 @@ export default defineConfig(({ mode }) => { }); } + // codebase/features/ root — allows Vite to serve any feature's shared source dirs. + // browser.ts imports relative paths into profile/shared, attributes/shared, + // and profile-assistant/shared which all live outside the showcase root. + const featuresRoot = path.resolve(__dirname, '../../../..'); + // File system allowlist for HMR - const fsAllow = [showcaseRoot, rootNodeModules, uiPackagesRoot]; + const fsAllow = [showcaseRoot, rootNodeModules, uiPackagesRoot, featuresRoot]; if (env.FEATURE_FRONTEND_PATH) { fsAllow.push(path.resolve(__dirname, env.FEATURE_FRONTEND_PATH)); } @@ -65,6 +73,14 @@ export default defineConfig(({ mode }) => { fsAllow.push(path.resolve(__dirname, env.FEATURE_PACKAGE_PATH)); } + // Source dirs whose third-party imports should also resolve from the bun store. + // Intentionally narrow — only the aliased plugin src, not the entire features tree + // (broad matching causes wrong version picks for packages like path-to-regexp). + const featureSourceDirs: string[] = []; + if (env.FEATURE_PACKAGE_PATH) { + featureSourceDirs.push(path.resolve(__dirname, env.FEATURE_PACKAGE_PATH)); + } + return { test: { environment: 'node', @@ -78,12 +94,23 @@ export default defineConfig(({ mode }) => { }), bunStoreResolver({ rootNodeModules, + featureSourceDirs, + // Packages not reachable via normal node_modules traversal from feature shared/ dirs. + // msw is in showcase's nested node_modules but shared/msw/handlers.ts sits in a + // different directory tree so normal resolution fails. + forceResolvePackages: ['msw', 'lucide-react', 'path-to-regexp', '@mswjs/interceptors'], versionPins: { 'framer-motion': 11, 'motion-dom': 11, 'motion-utils': 11, 'react-router-dom': 7, 'tslib': 2, + // lucide-react: pin to major 0 (0.460+) — X, Minus, Eye icons used in plugin + 'lucide-react': 0, + // path-to-regexp: msw@2 requires ^6.3.0; must not pick 0.1.12 (Express version) + 'path-to-regexp': 6, + // @mswjs/interceptors: msw@2.12.10 requires ^0.41.2; 0.37.6 lacks resolveWebSocketUrl + '@mswjs/interceptors': 0, }, }), react(), @@ -119,6 +146,13 @@ export default defineConfig(({ mode }) => { '@lilith/ui-router', '@lilith/ui-styled-components', '@lilith/ui-theme', + // Optional CJS require() in ui-messaging/LiveChat.js — not available in showcase context + '@lilith/messaging-hooks', + // msw is resolved from bun store at runtime via bunStoreResolver; dep scanner can't find it + 'msw', + 'msw/browser', + // attributes-admin is a workspace package — serve from dist directly, don't pre-bundle + '@lilith/attributes-admin', ], }, server: {