@mostrom/app-shell 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/ralph-loop.local.md +9 -0
- package/README.md +172 -0
- package/bin/init.js +269 -0
- package/bun.lock +401 -0
- package/components.json +28 -0
- package/package.json +74 -0
- package/scripts/publish-npm.sh +202 -0
- package/src/AppShell.tsx +847 -0
- package/src/components/PageHeader.tsx +160 -0
- package/src/components/data-table/README.md +447 -0
- package/src/components/data-table/data-table-preferences.tsx +184 -0
- package/src/components/data-table/data-table-toolbar.tsx +118 -0
- package/src/components/data-table/data-table.tsx +37 -0
- package/src/components/data-table/index.ts +32 -0
- package/src/components/global-header/AllServicesButton.tsx +127 -0
- package/src/components/global-header/CategoriesButton.tsx +120 -0
- package/src/components/global-header/GlobalHeader.tsx +59 -0
- package/src/components/global-header/GlobalHeaderSearch.tsx +57 -0
- package/src/components/global-header/HeaderUtilities.tsx +243 -0
- package/src/components/global-header/ServicesMenu.tsx +246 -0
- package/src/components/layout/AppBreadcrumb.tsx +70 -0
- package/src/components/layout/AppFlashbar.tsx +95 -0
- package/src/components/layout/AppLayout.tsx +271 -0
- package/src/components/layout/AppNavigation.tsx +313 -0
- package/src/components/layout/AppSidebar.tsx +229 -0
- package/src/components/patterns/index.ts +14 -0
- package/src/components/patterns/p-alert-5.tsx +19 -0
- package/src/components/patterns/p-autocomplete-5.tsx +89 -0
- package/src/components/patterns/p-breadcrumb-1.tsx +28 -0
- package/src/components/patterns/p-button-42.tsx +37 -0
- package/src/components/patterns/p-button-51.tsx +14 -0
- package/src/components/patterns/p-button-6.tsx +5 -0
- package/src/components/patterns/p-calendar-1.tsx +18 -0
- package/src/components/patterns/p-card-1.tsx +33 -0
- package/src/components/patterns/p-card-2.tsx +26 -0
- package/src/components/patterns/p-card-5.tsx +31 -0
- package/src/components/patterns/p-collapsible-7.tsx +121 -0
- package/src/components/patterns/p-command-6.tsx +113 -0
- package/src/components/patterns/p-dialog-1.tsx +56 -0
- package/src/components/patterns/p-dropdown-menu-1.tsx +38 -0
- package/src/components/patterns/p-dropdown-menu-11.tsx +122 -0
- package/src/components/patterns/p-dropdown-menu-14.tsx +165 -0
- package/src/components/patterns/p-dropdown-menu-9.tsx +108 -0
- package/src/components/patterns/p-empty-2.tsx +34 -0
- package/src/components/patterns/p-file-upload-1.tsx +72 -0
- package/src/components/patterns/p-filters-1.tsx +666 -0
- package/src/components/patterns/p-frame-2.tsx +26 -0
- package/src/components/patterns/p-tabs-2.tsx +129 -0
- package/src/components/reui/alert.tsx +92 -0
- package/src/components/reui/autocomplete.tsx +343 -0
- package/src/components/reui/badge.tsx +87 -0
- package/src/components/reui/data-grid/data-grid-column-filter.tsx +165 -0
- package/src/components/reui/data-grid/data-grid-column-header.tsx +339 -0
- package/src/components/reui/data-grid/data-grid-column-visibility.tsx +55 -0
- package/src/components/reui/data-grid/data-grid-pagination.tsx +224 -0
- package/src/components/reui/data-grid/data-grid-table-dnd-rows.tsx +260 -0
- package/src/components/reui/data-grid/data-grid-table-dnd.tsx +253 -0
- package/src/components/reui/data-grid/data-grid-table.tsx +639 -0
- package/src/components/reui/data-grid/data-grid.tsx +209 -0
- package/src/components/reui/date-selector.tsx +1330 -0
- package/src/components/reui/filters.tsx +1869 -0
- package/src/components/reui/frame.tsx +134 -0
- package/src/components/reui/index.ts +17 -0
- package/src/components/reui/timeline.tsx +219 -0
- package/src/components/search/Autocomplete.tsx +183 -0
- package/src/components/search/AutocompleteClient.tsx +293 -0
- package/src/components/search/GlobalSearch.tsx +187 -0
- package/src/components/section-drawer/deal-drawer-content.tsx +891 -0
- package/src/components/section-drawer/index.ts +19 -0
- package/src/components/section-drawer/section-drawer.css +665 -0
- package/src/components/section-drawer/section-drawer.tsx +467 -0
- package/src/components/sectioned-list-board/README.md +78 -0
- package/src/components/sectioned-list-board/board-card-content.tsx +340 -0
- package/src/components/sectioned-list-board/date-range-filter.tsx +249 -0
- package/src/components/sectioned-list-board/index.ts +19 -0
- package/src/components/sectioned-list-board/sectioned-list-board.css +564 -0
- package/src/components/sectioned-list-board/sectioned-list-board.tsx +731 -0
- package/src/components/sectioned-list-board/sortable-card.tsx +314 -0
- package/src/components/sectioned-list-board/sortable-section.tsx +319 -0
- package/src/components/sectioned-list-board/types.ts +216 -0
- package/src/components/sectioned-list-table/README.md +80 -0
- package/src/components/sectioned-list-table/index.ts +14 -0
- package/src/components/sectioned-list-table/sectioned-list-table.css +534 -0
- package/src/components/sectioned-list-table/sectioned-list-table.tsx +740 -0
- package/src/components/sectioned-list-table/sortable-column-header.tsx +120 -0
- package/src/components/sectioned-list-table/sortable-row.tsx +420 -0
- package/src/components/sectioned-list-table/sortable-section.tsx +251 -0
- package/src/components/sectioned-list-table/table-cell-content.tsx +129 -0
- package/src/components/sectioned-list-table/types.ts +120 -0
- package/src/components/sectioned-list-table/use-column-preferences.ts +103 -0
- package/src/components/ui/actions-dropdown.tsx +109 -0
- package/src/components/ui/assignee-selector.tsx +209 -0
- package/src/components/ui/avatar.tsx +107 -0
- package/src/components/ui/breadcrumb.tsx +109 -0
- package/src/components/ui/button-group.tsx +83 -0
- package/src/components/ui/button.tsx +64 -0
- package/src/components/ui/calendar.tsx +220 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/chart.tsx +376 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/collapsible.tsx +33 -0
- package/src/components/ui/command.tsx +182 -0
- package/src/components/ui/context-menu.tsx +250 -0
- package/src/components/ui/create-button-group.tsx +128 -0
- package/src/components/ui/dialog.tsx +156 -0
- package/src/components/ui/drawer.tsx +133 -0
- package/src/components/ui/dropdown-menu.tsx +255 -0
- package/src/components/ui/empty.tsx +104 -0
- package/src/components/ui/field.tsx +248 -0
- package/src/components/ui/form.tsx +165 -0
- package/src/components/ui/index.ts +37 -0
- package/src/components/ui/input-group.tsx +168 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/kbd.tsx +28 -0
- package/src/components/ui/label.tsx +22 -0
- package/src/components/ui/navigation-menu.tsx +168 -0
- package/src/components/ui/page-header.tsx +80 -0
- package/src/components/ui/popover.tsx +87 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/select.tsx +190 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/sheet.tsx +141 -0
- package/src/components/ui/sidebar.tsx +726 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +38 -0
- package/src/components/ui/switch.tsx +33 -0
- package/src/components/ui/tabs.tsx +91 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toggle-group.tsx +83 -0
- package/src/components/ui/toggle.tsx +45 -0
- package/src/components/ui/tooltip.tsx +57 -0
- package/src/hooks/use-copy-to-clipboard.ts +37 -0
- package/src/hooks/use-file-upload.ts +415 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/index.ts +95 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles.css +1859 -0
- package/src/urls.ts +83 -0
- package/src/vite.d.ts +22 -0
- package/src/vite.js +241 -0
- package/tsconfig.base.json +18 -0
- package/tsconfig.json +24 -0
package/src/urls.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL helpers for path-based routing
|
|
3
|
+
*
|
|
4
|
+
* Uses Vite's BASE_URL (set from VITE_BASE_PATH at build time) as the single
|
|
5
|
+
* source of truth for constructing URLs that work with ALB path-based routing.
|
|
6
|
+
*
|
|
7
|
+
* Note: BASE_URL is normalized (no trailing slash) so both /demo and /demo/ work.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
type ImportMetaWithOptionalEnv = ImportMeta & {
|
|
11
|
+
env?: {
|
|
12
|
+
BASE_URL?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const FALLBACK_BASE_PATH = "/";
|
|
17
|
+
|
|
18
|
+
function normalizeBasePath(rawBasePath: string): string {
|
|
19
|
+
if (!rawBasePath || rawBasePath === "/") {
|
|
20
|
+
return "/";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const withLeadingSlash = rawBasePath.startsWith("/")
|
|
24
|
+
? rawBasePath
|
|
25
|
+
: `/${rawBasePath}`;
|
|
26
|
+
|
|
27
|
+
return withLeadingSlash.replace(/\/+$/, "");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function normalizeRelativePath(path: string): string {
|
|
31
|
+
return path.replace(/^\/+/, "");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns the base path for this service (e.g., "/demo")
|
|
36
|
+
* Normalized without trailing slash.
|
|
37
|
+
*/
|
|
38
|
+
export function basePath(): string {
|
|
39
|
+
const rawBasePath =
|
|
40
|
+
(import.meta as ImportMetaWithOptionalEnv).env?.BASE_URL ??
|
|
41
|
+
FALLBACK_BASE_PATH;
|
|
42
|
+
return normalizeBasePath(rawBasePath);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Constructs an API URL relative to the service's base path.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* apiUrl("copilotkit") // => "/demo/api/copilotkit"
|
|
50
|
+
* apiUrl("healthcheck") // => "/demo/api/healthcheck"
|
|
51
|
+
*/
|
|
52
|
+
export function apiUrl(path: string): string {
|
|
53
|
+
const base = basePath();
|
|
54
|
+
const relativePath = normalizeRelativePath(path);
|
|
55
|
+
const apiPath = relativePath ? `api/${relativePath}` : "api";
|
|
56
|
+
|
|
57
|
+
if (base === "/") {
|
|
58
|
+
return `/${apiPath}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return `${base}/${apiPath}`;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Constructs any URL relative to the service's base path.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* serviceUrl("copilot-demo") // => "/demo/copilot-demo"
|
|
69
|
+
*/
|
|
70
|
+
export function serviceUrl(path: string): string {
|
|
71
|
+
const base = basePath();
|
|
72
|
+
const relativePath = normalizeRelativePath(path);
|
|
73
|
+
|
|
74
|
+
if (!relativePath) {
|
|
75
|
+
return base;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (base === "/") {
|
|
79
|
+
return `/${relativePath}`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return `${base}/${relativePath}`;
|
|
83
|
+
}
|
package/src/vite.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { UserConfig } from "vite";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns shared Vite configuration for all platform apps.
|
|
5
|
+
* Ensures consistent settings and proper monorepo file access.
|
|
6
|
+
*
|
|
7
|
+
* @param appDir - The directory of the app (use __dirname)
|
|
8
|
+
* @returns Vite configuration object
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // In your vite.config.ts:
|
|
12
|
+
* import { getSharedViteConfig } from "@platform/app-shell/vite";
|
|
13
|
+
* import { mergeConfig } from "vite";
|
|
14
|
+
*
|
|
15
|
+
* export default defineConfig(({ mode }) => {
|
|
16
|
+
* const shared = getSharedViteConfig(__dirname);
|
|
17
|
+
* return mergeConfig(shared, {
|
|
18
|
+
* // your app-specific config
|
|
19
|
+
* });
|
|
20
|
+
* });
|
|
21
|
+
*/
|
|
22
|
+
export function getSharedViteConfig(appDir: string): UserConfig;
|
package/src/vite.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Returns the monorepo root directory (platform/).
|
|
6
|
+
* @param {string} currentDir
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
function getMonorepoRoot(currentDir) {
|
|
10
|
+
let dir = currentDir;
|
|
11
|
+
while (dir !== "/") {
|
|
12
|
+
if (path.basename(dir) === "platform") {
|
|
13
|
+
return dir;
|
|
14
|
+
}
|
|
15
|
+
dir = path.dirname(dir);
|
|
16
|
+
}
|
|
17
|
+
// Fallback: assume we're 3 levels deep (services/*/frontend)
|
|
18
|
+
return path.resolve(currentDir, "../../..");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Vite plugin to handle problematic CSS imports during SSR.
|
|
23
|
+
*
|
|
24
|
+
* The streamdown package (used by @copilotkit) has a dynamic import:
|
|
25
|
+
* (O||y)&&import('katex/dist/katex.min.css')
|
|
26
|
+
*
|
|
27
|
+
* This executes at runtime during SSR, and Node's ESM loader can't handle CSS.
|
|
28
|
+
*
|
|
29
|
+
* Strategy:
|
|
30
|
+
* 1. Transform SSR bundle to replace dynamic CSS imports with Promise.resolve()
|
|
31
|
+
* 2. Handle any static imports via resolveId/load hooks
|
|
32
|
+
*/
|
|
33
|
+
function ssrCssStubPlugin() {
|
|
34
|
+
return {
|
|
35
|
+
name: "ssr-css-stub",
|
|
36
|
+
enforce: "pre",
|
|
37
|
+
resolveId(source, importer, options) {
|
|
38
|
+
// Only handle SSR requests
|
|
39
|
+
if (!options?.ssr) return null;
|
|
40
|
+
|
|
41
|
+
// Stub out katex CSS imports during SSR - return a virtual module
|
|
42
|
+
if (source.includes("katex") && source.endsWith(".css")) {
|
|
43
|
+
return { id: "\0virtual:ssr-css-stub", external: false };
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
},
|
|
47
|
+
load(id, options) {
|
|
48
|
+
// Handle the virtual CSS stub
|
|
49
|
+
if (id === "\0virtual:ssr-css-stub") {
|
|
50
|
+
return "export default '';";
|
|
51
|
+
}
|
|
52
|
+
// During SSR, stub out ONLY katex CSS files
|
|
53
|
+
if (options?.ssr && id.includes("katex") && id.endsWith(".css")) {
|
|
54
|
+
return "export default '';";
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
},
|
|
58
|
+
// Transform ALL files during SSR to catch the dynamic import
|
|
59
|
+
// This is necessary because streamdown is bundled and the dynamic import
|
|
60
|
+
// runs at runtime, bypassing Vite's normal resolution
|
|
61
|
+
transform(code, id, options) {
|
|
62
|
+
if (!options?.ssr) return null;
|
|
63
|
+
|
|
64
|
+
// Transform any file that contains the katex CSS dynamic import
|
|
65
|
+
if (code.includes("katex") && code.includes(".css") && code.includes("import(")) {
|
|
66
|
+
const transformed = code.replace(
|
|
67
|
+
/import\s*\(\s*['"]katex\/[^'"]+\.css['"]\s*\)/g,
|
|
68
|
+
"Promise.resolve()"
|
|
69
|
+
);
|
|
70
|
+
if (transformed !== code) {
|
|
71
|
+
return { code: transformed, map: null };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Returns shared Vite configuration for all platform apps.
|
|
82
|
+
* Ensures consistent settings and proper monorepo file access.
|
|
83
|
+
*
|
|
84
|
+
* @param {string} appDir - The directory of the app (use __dirname)
|
|
85
|
+
* @returns {import('vite').UserConfig}
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* // In your vite.config.ts:
|
|
89
|
+
* import { getSharedViteConfig } from "@platform/app-shell/vite";
|
|
90
|
+
* import { mergeConfig } from "vite";
|
|
91
|
+
*
|
|
92
|
+
* export default defineConfig(({ mode }) => {
|
|
93
|
+
* const shared = getSharedViteConfig(__dirname);
|
|
94
|
+
* return mergeConfig(shared, {
|
|
95
|
+
* // your app-specific config
|
|
96
|
+
* });
|
|
97
|
+
* });
|
|
98
|
+
*/
|
|
99
|
+
export function getSharedViteConfig(appDir) {
|
|
100
|
+
const monorepoRoot = getMonorepoRoot(appDir);
|
|
101
|
+
const appNodeModules = path.resolve(appDir, "node_modules");
|
|
102
|
+
const sharedPackages = path.resolve(monorepoRoot, "shared/packages");
|
|
103
|
+
const appShellSrc = path.resolve(sharedPackages, "app-shell/src");
|
|
104
|
+
const appShellNodeModules = path.resolve(sharedPackages, "app-shell/node_modules");
|
|
105
|
+
const appHasDndKit = fs.existsSync(path.resolve(appNodeModules, "@dnd-kit/core"));
|
|
106
|
+
const dndKitNodeModules = appHasDndKit ? appNodeModules : appShellNodeModules;
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
plugins: [ssrCssStubPlugin()],
|
|
110
|
+
resolve: {
|
|
111
|
+
preserveSymlinks: true,
|
|
112
|
+
alias: [
|
|
113
|
+
// Source aliases for HMR during development
|
|
114
|
+
{
|
|
115
|
+
find: /^@platform\/service-catalog(\/.*)?$/,
|
|
116
|
+
replacement: `${path.resolve(sharedPackages, "service-catalog/src")}$1`,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
find: /^@platform\/app-shell(\/.*)?$/,
|
|
120
|
+
replacement: `${appShellSrc}$1`,
|
|
121
|
+
},
|
|
122
|
+
// Resolve @/ alias used inside app-shell source files
|
|
123
|
+
{
|
|
124
|
+
find: /^@\/(.*)$/,
|
|
125
|
+
replacement: `${appShellSrc}/$1`,
|
|
126
|
+
},
|
|
127
|
+
// Resolve @dnd-kit from the consumer app when available, otherwise from app-shell
|
|
128
|
+
{
|
|
129
|
+
find: /^@dnd-kit\/(core|sortable|utilities|modifiers)(\/.*)?$/,
|
|
130
|
+
replacement: `${dndKitNodeModules}/@dnd-kit/$1$2`,
|
|
131
|
+
},
|
|
132
|
+
// Resolve app-shell dependencies from app-shell's node_modules
|
|
133
|
+
// This is necessary because when Vite processes files from app-shell via alias,
|
|
134
|
+
// the module resolution context is the consumer app, not app-shell
|
|
135
|
+
{
|
|
136
|
+
find: /^radix-ui(\/.*)?$/,
|
|
137
|
+
replacement: `${appShellNodeModules}/radix-ui$1`,
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
find: /^@base-ui\/react(\/.*)?$/,
|
|
141
|
+
replacement: `${appShellNodeModules}/@base-ui/react/esm$1`,
|
|
142
|
+
},
|
|
143
|
+
// Dependencies of recharts (version 2.15.4 in app-shell)
|
|
144
|
+
{
|
|
145
|
+
find: /^recharts(\/.*)?$/,
|
|
146
|
+
replacement: `${appShellNodeModules}/recharts$1`,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
find: /^decimal\.js-light(\/.*)?$/,
|
|
150
|
+
replacement: `${appShellNodeModules}/decimal.js-light$1`,
|
|
151
|
+
},
|
|
152
|
+
// victory-vendor has both CJS and ESM exports - use ESM version for SSR compatibility
|
|
153
|
+
{
|
|
154
|
+
find: /^victory-vendor\/(d3-[^/]+)$/,
|
|
155
|
+
replacement: `${appShellNodeModules}/victory-vendor/es/$1.js`,
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
find: /^victory-vendor$/,
|
|
159
|
+
replacement: `${appShellNodeModules}/victory-vendor`,
|
|
160
|
+
},
|
|
161
|
+
// Dependencies of react-day-picker
|
|
162
|
+
{
|
|
163
|
+
find: /^react-day-picker(\/.*)?$/,
|
|
164
|
+
replacement: `${appShellNodeModules}/react-day-picker$1`,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
find: /^@date-fns\/tz(\/.*)?$/,
|
|
168
|
+
replacement: `${appShellNodeModules}/@date-fns/tz$1`,
|
|
169
|
+
},
|
|
170
|
+
// Dependencies of @tanstack/react-table
|
|
171
|
+
{
|
|
172
|
+
find: /^@tanstack\/react-table(\/.*)?$/,
|
|
173
|
+
replacement: `${appShellNodeModules}/@tanstack/react-table$1`,
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
find: /^@tanstack\/table-core(\/.*)?$/,
|
|
177
|
+
replacement: `${appShellNodeModules}/@tanstack/table-core$1`,
|
|
178
|
+
},
|
|
179
|
+
// CSS dependency used by app-shell styles
|
|
180
|
+
{
|
|
181
|
+
find: "tw-animate-css",
|
|
182
|
+
replacement: `${appShellNodeModules}/tw-animate-css/dist/tw-animate.css`,
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
dedupe: ["react", "react-dom"],
|
|
186
|
+
},
|
|
187
|
+
server: {
|
|
188
|
+
fs: {
|
|
189
|
+
// Allow serving files from the monorepo root (for hoisted node_modules)
|
|
190
|
+
allow: [
|
|
191
|
+
appDir,
|
|
192
|
+
monorepoRoot,
|
|
193
|
+
path.resolve(monorepoRoot, ".."),
|
|
194
|
+
],
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
ssr: {
|
|
198
|
+
external: [
|
|
199
|
+
// React must be external during SSR - it's CJS and can't be processed by Vite's ESM runner
|
|
200
|
+
/^react(\/.*)?$/,
|
|
201
|
+
/^react-dom(\/.*)?$/,
|
|
202
|
+
// @dnd-kit must be external to use the same React instance as react-dom
|
|
203
|
+
/^@dnd-kit\//,
|
|
204
|
+
// katex CSS causes issues with Node's ESM loader - externalize it
|
|
205
|
+
// The CSS import is handled by the ssrCssStubPlugin via resolveId
|
|
206
|
+
/^katex\/dist\/.*\.css$/,
|
|
207
|
+
],
|
|
208
|
+
noExternal: [
|
|
209
|
+
/^@cloudscape-design\//,
|
|
210
|
+
/^@radix-ui\//,
|
|
211
|
+
/^@base-ui\//,
|
|
212
|
+
/^radix-ui/,
|
|
213
|
+
/^cmdk/,
|
|
214
|
+
/^@platform\/app-shell/,
|
|
215
|
+
/^date-fns/,
|
|
216
|
+
/^@copilotkit\//,
|
|
217
|
+
/^@copilotkitnext\//,
|
|
218
|
+
/^react-markdown/,
|
|
219
|
+
// These packages need to be bundled so Vite can transform their code
|
|
220
|
+
/^katex$/,
|
|
221
|
+
/^streamdown/,
|
|
222
|
+
/^rehype-katex/,
|
|
223
|
+
// App-shell dependencies that use CommonJS and need transformation
|
|
224
|
+
/^recharts/,
|
|
225
|
+
/^victory-vendor/,
|
|
226
|
+
/^react-day-picker/,
|
|
227
|
+
/^@date-fns\//,
|
|
228
|
+
/^@tanstack\//,
|
|
229
|
+
/^decimal\.js-light/,
|
|
230
|
+
],
|
|
231
|
+
},
|
|
232
|
+
optimizeDeps: {
|
|
233
|
+
// Linked monorepo source + lazy route loading can cause repeated re-optimization
|
|
234
|
+
// and stale hash requests (504 Outdated Optimize Dep). Disable dep discovery.
|
|
235
|
+
noDiscovery: true,
|
|
236
|
+
include: [],
|
|
237
|
+
// Keep streamdown out of optimizer; SSR handles its CSS import via stubs.
|
|
238
|
+
exclude: ["streamdown"],
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Platform Frontend Base",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
6
|
+
"types": ["node", "vite/client"],
|
|
7
|
+
"target": "ES2022",
|
|
8
|
+
"module": "ES2022",
|
|
9
|
+
"moduleResolution": "bundler",
|
|
10
|
+
"jsx": "react-jsx",
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"verbatimModuleSyntax": false,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"strict": true
|
|
17
|
+
}
|
|
18
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"allowImportingTsExtensions": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"jsx": "react-jsx",
|
|
13
|
+
"strict": true,
|
|
14
|
+
"noUnusedLocals": true,
|
|
15
|
+
"noUnusedParameters": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"baseUrl": ".",
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./src/*"],
|
|
20
|
+
"@platform/app-shell/*": ["./src/*"]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"include": ["src"]
|
|
24
|
+
}
|