@donotdev/core 0.0.3 → 0.0.4
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/eslint/index.d.ts +79 -0
- package/functions/index.d.ts +752 -0
- package/next/index.d.ts +1476 -0
- package/package.json +2 -2
- package/vite/index.d.ts +1644 -0
package/vite/index.d.ts
ADDED
|
@@ -0,0 +1,1644 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
// packages/core/types/src/auth/constants.ts
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// User Role Constants
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Standard user role names
|
|
14
|
+
* Apps can override these by providing their own role constants
|
|
15
|
+
*
|
|
16
|
+
* @version 0.0.1
|
|
17
|
+
* @since 0.0.1
|
|
18
|
+
* @author AMBROISE PARK Consulting
|
|
19
|
+
*/
|
|
20
|
+
declare const USER_ROLES = {
|
|
21
|
+
GUEST: 'guest',
|
|
22
|
+
USER: 'user',
|
|
23
|
+
ADMIN: 'admin',
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Type for user role names
|
|
28
|
+
* Apps can extend this with their own custom roles
|
|
29
|
+
*
|
|
30
|
+
* @version 0.0.1
|
|
31
|
+
* @since 0.0.1
|
|
32
|
+
* @author AMBROISE PARK Consulting
|
|
33
|
+
*/
|
|
34
|
+
type UserRole = (typeof USER_ROLES)[keyof typeof USER_ROLES] | string;
|
|
35
|
+
|
|
36
|
+
// =============================================================================
|
|
37
|
+
// Subscription Tier Constants
|
|
38
|
+
// =============================================================================
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Standard subscription tier names
|
|
42
|
+
* Apps can override these by providing their own tier constants
|
|
43
|
+
*
|
|
44
|
+
* @version 0.0.1
|
|
45
|
+
* @since 0.0.1
|
|
46
|
+
* @author AMBROISE PARK Consulting
|
|
47
|
+
*/
|
|
48
|
+
declare const SUBSCRIPTION_TIERS = {
|
|
49
|
+
FREE: 'free',
|
|
50
|
+
PRO: 'pro',
|
|
51
|
+
PREMIUM: 'premium',
|
|
52
|
+
} as const;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Type for subscription tier names
|
|
56
|
+
* Apps can extend this with their own custom tiers
|
|
57
|
+
*
|
|
58
|
+
* @version 0.0.1
|
|
59
|
+
* @since 0.0.1
|
|
60
|
+
* @author AMBROISE PARK Consulting
|
|
61
|
+
*/
|
|
62
|
+
type SubscriptionTier =
|
|
63
|
+
| (typeof SUBSCRIPTION_TIERS)[keyof typeof SUBSCRIPTION_TIERS]
|
|
64
|
+
| string;
|
|
65
|
+
|
|
66
|
+
// packages/core/types/src/common/index.ts
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
// =============================================================================
|
|
71
|
+
// PLATFORM CONSTANTS
|
|
72
|
+
// =============================================================================
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Supported platform identifiers
|
|
76
|
+
* @constant
|
|
77
|
+
*/
|
|
78
|
+
declare const PLATFORMS = {
|
|
79
|
+
VITE: 'vite',
|
|
80
|
+
NEXTJS: 'nextjs',
|
|
81
|
+
UNKNOWN: 'unknown',
|
|
82
|
+
} as const;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Platform type derived from PLATFORMS constant
|
|
86
|
+
*/
|
|
87
|
+
type Platform = (typeof PLATFORMS)[keyof typeof PLATFORMS];
|
|
88
|
+
|
|
89
|
+
// =============================================================================
|
|
90
|
+
// ENVIRONMENT CONSTANTS
|
|
91
|
+
// =============================================================================
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Supported environment modes
|
|
95
|
+
* @constant
|
|
96
|
+
*/
|
|
97
|
+
declare const ENVIRONMENTS = {
|
|
98
|
+
DEVELOPMENT: 'development',
|
|
99
|
+
PRODUCTION: 'production',
|
|
100
|
+
TEST: 'test',
|
|
101
|
+
} as const;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Environment mode type derived from ENVIRONMENTS constant
|
|
105
|
+
*/
|
|
106
|
+
type EnvironmentMode = (typeof ENVIRONMENTS)[keyof typeof ENVIRONMENTS];
|
|
107
|
+
|
|
108
|
+
// =============================================================================
|
|
109
|
+
// CONTEXT CONSTANTS
|
|
110
|
+
// =============================================================================
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Supported execution contexts
|
|
114
|
+
* @constant
|
|
115
|
+
*/
|
|
116
|
+
declare const CONTEXTS = {
|
|
117
|
+
CLIENT: 'client',
|
|
118
|
+
SERVER: 'server',
|
|
119
|
+
BUILD: 'build',
|
|
120
|
+
} as const;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Context type derived from CONTEXTS constant
|
|
124
|
+
*/
|
|
125
|
+
type Context = (typeof CONTEXTS)[keyof typeof CONTEXTS];
|
|
126
|
+
|
|
127
|
+
// =============================================================================
|
|
128
|
+
// STORAGE CONSTANTS
|
|
129
|
+
// =============================================================================
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Supported storage backend types
|
|
133
|
+
* @constant
|
|
134
|
+
*/
|
|
135
|
+
declare const STORAGE_TYPES = {
|
|
136
|
+
LOCAL: 'localStorage',
|
|
137
|
+
SESSION: 'sessionStorage',
|
|
138
|
+
INDEXED_DB: 'indexedDB',
|
|
139
|
+
MEMORY: 'memory',
|
|
140
|
+
} as const;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Storage type derived from STORAGE_TYPES constant
|
|
144
|
+
*/
|
|
145
|
+
type StorageType = (typeof STORAGE_TYPES)[keyof typeof STORAGE_TYPES];
|
|
146
|
+
|
|
147
|
+
// =============================================================================
|
|
148
|
+
// PWA CONSTANTS
|
|
149
|
+
// =============================================================================
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* PWA display modes
|
|
153
|
+
* @constant
|
|
154
|
+
*/
|
|
155
|
+
declare const PWA_DISPLAY_MODES = {
|
|
156
|
+
STANDALONE: 'standalone',
|
|
157
|
+
FULLSCREEN: 'fullscreen',
|
|
158
|
+
MINIMAL_UI: 'minimal-ui',
|
|
159
|
+
BROWSER: 'browser',
|
|
160
|
+
} as const;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* PWA display mode type derived from PWA_DISPLAY_MODES constant
|
|
164
|
+
*/
|
|
165
|
+
type PWADisplayMode =
|
|
166
|
+
(typeof PWA_DISPLAY_MODES)[keyof typeof PWA_DISPLAY_MODES];
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* PWA asset types
|
|
170
|
+
* @constant
|
|
171
|
+
*/
|
|
172
|
+
declare const PWA_ASSET_TYPES = {
|
|
173
|
+
MANIFEST: 'manifest',
|
|
174
|
+
SERVICE_WORKER: 'service-worker',
|
|
175
|
+
ICON: 'icon',
|
|
176
|
+
} as const;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* PWA asset type derived from PWA_ASSET_TYPES constant
|
|
180
|
+
*/
|
|
181
|
+
type PWAAssetType =
|
|
182
|
+
(typeof PWA_ASSET_TYPES)[keyof typeof PWA_ASSET_TYPES];
|
|
183
|
+
|
|
184
|
+
// =============================================================================
|
|
185
|
+
// ROUTE DISCOVERY CONSTANTS
|
|
186
|
+
// =============================================================================
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Route discovery sources
|
|
190
|
+
* @constant
|
|
191
|
+
*/
|
|
192
|
+
declare const ROUTE_SOURCES = {
|
|
193
|
+
AUTO: 'auto-discovery',
|
|
194
|
+
MANUAL: 'manual',
|
|
195
|
+
HYBRID: 'hybrid',
|
|
196
|
+
} as const;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Route source type derived from ROUTE_SOURCES constant
|
|
200
|
+
*/
|
|
201
|
+
type RouteSource = (typeof ROUTE_SOURCES)[keyof typeof ROUTE_SOURCES];
|
|
202
|
+
|
|
203
|
+
// =============================================================================
|
|
204
|
+
// AUTHENTICATION TYPES
|
|
205
|
+
// =============================================================================
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Page-level authentication requirements
|
|
209
|
+
* @description Used in PageMeta and NavigationRoute for route-level auth
|
|
210
|
+
*/
|
|
211
|
+
type PageAuth =
|
|
212
|
+
| boolean
|
|
213
|
+
| {
|
|
214
|
+
/** Whether authentication is required */
|
|
215
|
+
required?: boolean;
|
|
216
|
+
/** Required user role */
|
|
217
|
+
role?: UserRole;
|
|
218
|
+
/** Required subscription tier */
|
|
219
|
+
tier?: SubscriptionTier;
|
|
220
|
+
/** Custom validation function */
|
|
221
|
+
validate?: (role: string, tier: string) => boolean;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// =============================================================================
|
|
225
|
+
// PAGE METADATA TYPES
|
|
226
|
+
// =============================================================================
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Page metadata interface for route discovery and configuration
|
|
230
|
+
*
|
|
231
|
+
* @remarks
|
|
232
|
+
* **ALL PROPERTIES ARE OPTIONAL** - Framework provides smart defaults:
|
|
233
|
+
*
|
|
234
|
+
* - `auth`: false (public) by default - YOU must specify auth requirements explicitly
|
|
235
|
+
* - `title`: Auto-extracted from filename (ShowcasePage → "Showcase")
|
|
236
|
+
* - `entity`: Auto-extracted from path (pages/showcase/ → "showcase")
|
|
237
|
+
* - `action`: Auto-extracted from filename patterns (ListPage → "list", FormPage → "form")
|
|
238
|
+
* - `route`: Only needed for custom paths or dynamic routes like :id, :slug
|
|
239
|
+
*
|
|
240
|
+
* @example Simple page (no meta needed):
|
|
241
|
+
* ```tsx
|
|
242
|
+
* export function HomePage() {
|
|
243
|
+
* return <PageContainer>...</PageContainer>;
|
|
244
|
+
* }
|
|
245
|
+
* // Framework provides: auth=false, title from home.title, entity=home
|
|
246
|
+
* ```
|
|
247
|
+
*
|
|
248
|
+
* @example Dynamic route (just define the path you want):
|
|
249
|
+
* ```tsx
|
|
250
|
+
* export const meta: PageMeta = {
|
|
251
|
+
* route: '/blog/:slug' // Creates /blog/:slug
|
|
252
|
+
* };
|
|
253
|
+
* // Framework provides: auth=false, title from blog.title, entity=blog
|
|
254
|
+
* ```
|
|
255
|
+
*
|
|
256
|
+
* @example Auth-required (developer must be explicit):
|
|
257
|
+
* ```tsx
|
|
258
|
+
* export const meta: PageMeta = {
|
|
259
|
+
* auth: { required: true } // YOU decide what needs auth
|
|
260
|
+
* };
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
interface PageMeta {
|
|
264
|
+
/** Authentication requirements for this route */
|
|
265
|
+
auth?: PageAuth;
|
|
266
|
+
|
|
267
|
+
/** Route configuration - just define the exact path you want */
|
|
268
|
+
route?: string | { params?: string[] };
|
|
269
|
+
|
|
270
|
+
/** Page title (optional - framework auto-extracts from filename if not provided) */
|
|
271
|
+
title?: string;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Translation/SEO namespace for this page
|
|
275
|
+
* @description Used for meta tags and translations
|
|
276
|
+
*/
|
|
277
|
+
namespace?: string;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Icon for navigation (optional - framework provides smart defaults)
|
|
281
|
+
* @description **ONLY lucide-react JSX components** - extracted as component name string at build time for tree-shaking.
|
|
282
|
+
*
|
|
283
|
+
* **RESTRICTIONS:**
|
|
284
|
+
* - ✅ Only: `<Rocket />`, `<ShoppingCart />`, `<Home />` (lucide-react JSX components)
|
|
285
|
+
* - ❌ NOT: Emojis (`"🚀"`), strings (`"Rocket"`), or custom ReactNode
|
|
286
|
+
*
|
|
287
|
+
* **Why?** This is for build-time extraction and tree-shaking. The component name is extracted and stored as a string.
|
|
288
|
+
*
|
|
289
|
+
* **For flexible icons** (emojis, strings, custom components), use the `Icon` component directly in your JSX, not in PageMeta.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```tsx
|
|
293
|
+
* import { Rocket } from 'lucide-react';
|
|
294
|
+
* export const meta: PageMeta = {
|
|
295
|
+
* icon: <Rocket /> // ✅ Correct - lucide-react component
|
|
296
|
+
* };
|
|
297
|
+
* ```
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```tsx
|
|
301
|
+
* // ❌ WRONG - Don't use emojis or strings in PageMeta
|
|
302
|
+
* export const meta: PageMeta = {
|
|
303
|
+
* icon: "🚀" // ❌ Not supported in PageMeta
|
|
304
|
+
* };
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
icon?: ReactNode;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Hide from navigation menu (default: false - shows in navigation)
|
|
311
|
+
* @description Set to true to exclude this route from navigation menus
|
|
312
|
+
* @default false
|
|
313
|
+
* @example
|
|
314
|
+
* ```tsx
|
|
315
|
+
* export const meta: PageMeta = {
|
|
316
|
+
* hideFromMenu: true // Won't appear in HeaderNavigation, Sidebar, etc.
|
|
317
|
+
* };
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
hideFromMenu?: boolean;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Route metadata (discovery-generated)
|
|
325
|
+
* @description Complete route metadata including auto-discovered fields from RouteDiscovery
|
|
326
|
+
*
|
|
327
|
+
* This extends PageMeta with fields that are automatically discovered from file paths:
|
|
328
|
+
* - `entity`: Auto-extracted from path (pages/showcase/ → "showcase")
|
|
329
|
+
* - `action`: Auto-extracted from filename patterns (ListPage → "list", FormPage → "form")
|
|
330
|
+
*
|
|
331
|
+
* These fields are always present in discovered routes but cannot be set in PageMeta.
|
|
332
|
+
*
|
|
333
|
+
* @version 0.0.1
|
|
334
|
+
* @since 0.0.1
|
|
335
|
+
* @author AMBROISE PARK Consulting
|
|
336
|
+
*/
|
|
337
|
+
interface RouteMeta extends PageMeta {
|
|
338
|
+
/** Entity/domain grouping - auto-discovered from file path (not user-configurable) */
|
|
339
|
+
entity?: string;
|
|
340
|
+
/** Action type for route categorization - auto-discovered from filename patterns (not user-configurable) */
|
|
341
|
+
action?: string | null;
|
|
342
|
+
/** File path where route was discovered */
|
|
343
|
+
file?: string;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// =============================================================================
|
|
347
|
+
// PLUGIN CONFIGURATION TYPES
|
|
348
|
+
// =============================================================================
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* i18n Plugin Configuration
|
|
352
|
+
* @description Configuration for internationalization system
|
|
353
|
+
*/
|
|
354
|
+
interface I18nPluginConfig {
|
|
355
|
+
/** Mapping of language → namespace → loader function */
|
|
356
|
+
mapping: Record<string, Record<string, () => Promise<any>>>;
|
|
357
|
+
/** List of available language codes */
|
|
358
|
+
languages: string[];
|
|
359
|
+
/** List of eagerly loaded namespace identifiers */
|
|
360
|
+
eager: string[];
|
|
361
|
+
/** Fallback language code */
|
|
362
|
+
fallback: string;
|
|
363
|
+
/** Preloaded translation content (optional) */
|
|
364
|
+
content?: Record<string, Record<string, any>>;
|
|
365
|
+
/** Storage configuration */
|
|
366
|
+
storage: {
|
|
367
|
+
/** Storage backend type */
|
|
368
|
+
type: StorageType;
|
|
369
|
+
/** Storage key prefix */
|
|
370
|
+
prefix: string;
|
|
371
|
+
/** Time-to-live in seconds */
|
|
372
|
+
ttl: number;
|
|
373
|
+
/** Whether to encrypt stored data */
|
|
374
|
+
encryption: boolean;
|
|
375
|
+
/** Maximum storage size in bytes */
|
|
376
|
+
maxSize: number;
|
|
377
|
+
};
|
|
378
|
+
/** Performance configuration */
|
|
379
|
+
performance: {
|
|
380
|
+
/** Maximum cache size */
|
|
381
|
+
cacheSize: number;
|
|
382
|
+
/** Error cache TTL in seconds */
|
|
383
|
+
errorCacheTTL: number;
|
|
384
|
+
};
|
|
385
|
+
/** Discovery manifest metadata */
|
|
386
|
+
manifest: {
|
|
387
|
+
/** Total number of translation files */
|
|
388
|
+
totalFiles: number;
|
|
389
|
+
/** Total number of namespaces */
|
|
390
|
+
totalNamespaces: number;
|
|
391
|
+
/** Total number of languages */
|
|
392
|
+
totalLanguages: number;
|
|
393
|
+
/** Number of eagerly loaded namespaces */
|
|
394
|
+
eagerNamespaces: number;
|
|
395
|
+
/** ISO timestamp of generation */
|
|
396
|
+
generatedAt: string;
|
|
397
|
+
};
|
|
398
|
+
/** Whether debug mode is enabled */
|
|
399
|
+
debug: boolean;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Routes Plugin Configuration
|
|
404
|
+
* @description Complete route configuration populated by discovery system
|
|
405
|
+
*/
|
|
406
|
+
interface RoutesPluginConfig {
|
|
407
|
+
/**
|
|
408
|
+
* Array of discovered routes
|
|
409
|
+
* @description All routes discovered by the route discovery system
|
|
410
|
+
*/
|
|
411
|
+
mapping: Array<{
|
|
412
|
+
/**
|
|
413
|
+
* URL path for the route (platform-agnostic)
|
|
414
|
+
* @description The URL path that users see in their browser
|
|
415
|
+
* @example '/showcase/layouts', '/users/:id', '/dashboard'
|
|
416
|
+
*/
|
|
417
|
+
path: string;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Lazy component reference (Vite-specific)
|
|
421
|
+
* @description React.lazy() component for code splitting
|
|
422
|
+
* @example lazy(() => import("/src/pages/showcase/LayoutsPage"))
|
|
423
|
+
*/
|
|
424
|
+
component: any;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Absolute file system path (Next.js-specific)
|
|
428
|
+
* @description The absolute path to the component file
|
|
429
|
+
* @example '/src/pages/showcase/LayoutsPage.tsx'
|
|
430
|
+
*/
|
|
431
|
+
importPath: string;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Export name for named exports
|
|
435
|
+
* @example 'HomePage', 'AboutPage'
|
|
436
|
+
*/
|
|
437
|
+
exportName?: string;
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Authentication configuration (platform-agnostic)
|
|
441
|
+
* @description Defines whether the route requires authentication
|
|
442
|
+
*/
|
|
443
|
+
auth: PageAuth;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Route metadata (platform-agnostic)
|
|
447
|
+
* @description Additional information about the route, including auto-discovered fields
|
|
448
|
+
*/
|
|
449
|
+
meta: RouteMeta;
|
|
450
|
+
}>;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Discovery metadata and statistics
|
|
454
|
+
* @description Information about the route discovery process
|
|
455
|
+
*/
|
|
456
|
+
manifest: {
|
|
457
|
+
/** Total number of discovered routes */
|
|
458
|
+
totalRoutes: number;
|
|
459
|
+
/** Number of routes requiring authentication */
|
|
460
|
+
authRequired: number;
|
|
461
|
+
/** Number of public routes */
|
|
462
|
+
publicRoutes: number;
|
|
463
|
+
/** Source of routes (auto-discovery vs manual) */
|
|
464
|
+
source: RouteSource;
|
|
465
|
+
/** ISO timestamp when routes were generated */
|
|
466
|
+
generatedAt: string;
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Themes Plugin Configuration
|
|
472
|
+
* @description Configuration for theme discovery and management
|
|
473
|
+
*/
|
|
474
|
+
interface ThemesPluginConfig {
|
|
475
|
+
/** Mapping of theme names to theme configurations */
|
|
476
|
+
mapping: Record<string, any>;
|
|
477
|
+
/** Array of discovered themes */
|
|
478
|
+
discovered: Array<{
|
|
479
|
+
/** Theme identifier */
|
|
480
|
+
name: string;
|
|
481
|
+
/** Human-readable theme name */
|
|
482
|
+
displayName: string;
|
|
483
|
+
/** Whether this is a dark theme */
|
|
484
|
+
isDark: boolean;
|
|
485
|
+
/** Theme metadata */
|
|
486
|
+
meta: {
|
|
487
|
+
/** Icon identifier */
|
|
488
|
+
icon: string;
|
|
489
|
+
/** Theme description */
|
|
490
|
+
description?: string;
|
|
491
|
+
/** Theme category */
|
|
492
|
+
category?: string;
|
|
493
|
+
/** Theme author */
|
|
494
|
+
author?: string;
|
|
495
|
+
/** Additional metadata */
|
|
496
|
+
[key: string]: any;
|
|
497
|
+
};
|
|
498
|
+
/** Source file path */
|
|
499
|
+
source: string;
|
|
500
|
+
/** Whether theme is essential (cannot be disabled) */
|
|
501
|
+
essential: boolean;
|
|
502
|
+
}>;
|
|
503
|
+
/** CSS custom property variables */
|
|
504
|
+
variables: Record<string, string>;
|
|
505
|
+
/** Utility class mappings */
|
|
506
|
+
utilities: Record<string, Record<string, string>>;
|
|
507
|
+
/** Discovery manifest metadata */
|
|
508
|
+
manifest: {
|
|
509
|
+
/** Total number of discovered themes */
|
|
510
|
+
totalThemes: number;
|
|
511
|
+
/** Total number of CSS variables */
|
|
512
|
+
totalVariables: number;
|
|
513
|
+
/** Total number of utility classes */
|
|
514
|
+
totalUtilities: number;
|
|
515
|
+
/** ISO timestamp of generation */
|
|
516
|
+
generatedAt: string;
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Assets Plugin Configuration
|
|
522
|
+
* @description Configuration for static asset management
|
|
523
|
+
*/
|
|
524
|
+
interface AssetsPluginConfig {
|
|
525
|
+
/** Mapping of asset paths to asset metadata */
|
|
526
|
+
mapping: Record<string, any>;
|
|
527
|
+
/** SVG content of logo.svg for inline rendering with CSS variable theming */
|
|
528
|
+
logoSvgContent?: string | null;
|
|
529
|
+
/** Discovery manifest metadata */
|
|
530
|
+
manifest: {
|
|
531
|
+
/** Total number of discovered assets */
|
|
532
|
+
totalAssets: number;
|
|
533
|
+
/** ISO timestamp of generation */
|
|
534
|
+
generatedAt: string;
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* PWA Plugin Configuration
|
|
540
|
+
* @description Configuration for Progressive Web App features
|
|
541
|
+
*/
|
|
542
|
+
interface PWAPluginConfig {
|
|
543
|
+
/** Array of PWA assets */
|
|
544
|
+
assets: Array<{
|
|
545
|
+
/** Type of PWA asset */
|
|
546
|
+
type: PWAAssetType;
|
|
547
|
+
/** Asset file path */
|
|
548
|
+
path: string;
|
|
549
|
+
/** Asset file size in bytes */
|
|
550
|
+
size?: number;
|
|
551
|
+
/** Asset content (for inline assets) */
|
|
552
|
+
content?: any;
|
|
553
|
+
/** Asset format (for images) */
|
|
554
|
+
format?: string;
|
|
555
|
+
/** Asset purpose (for icons) */
|
|
556
|
+
purpose?: string;
|
|
557
|
+
}>;
|
|
558
|
+
/** PWA manifest configuration */
|
|
559
|
+
manifest: {
|
|
560
|
+
/** Application name */
|
|
561
|
+
name: string;
|
|
562
|
+
/** Short application name */
|
|
563
|
+
short_name: string;
|
|
564
|
+
/** Application description */
|
|
565
|
+
description: string;
|
|
566
|
+
/** Start URL */
|
|
567
|
+
start_url: string;
|
|
568
|
+
/** Display mode */
|
|
569
|
+
display: PWADisplayMode;
|
|
570
|
+
/** Background color */
|
|
571
|
+
background_color: string;
|
|
572
|
+
/** Theme color */
|
|
573
|
+
theme_color: string;
|
|
574
|
+
/** Array of app icons */
|
|
575
|
+
icons: Array<{
|
|
576
|
+
/** Icon source path */
|
|
577
|
+
src: string;
|
|
578
|
+
/** Icon sizes (e.g., '192x192') */
|
|
579
|
+
sizes: string;
|
|
580
|
+
/** Icon MIME type */
|
|
581
|
+
type: string;
|
|
582
|
+
/** Icon purpose (e.g., 'any', 'maskable') */
|
|
583
|
+
purpose: string;
|
|
584
|
+
}>;
|
|
585
|
+
};
|
|
586
|
+
/** Discovery manifest metadata */
|
|
587
|
+
manifestInfo: {
|
|
588
|
+
/** Total number of PWA assets */
|
|
589
|
+
totalAssets: number;
|
|
590
|
+
/** Total number of icons */
|
|
591
|
+
totalIcons: number;
|
|
592
|
+
/** Whether service worker is present */
|
|
593
|
+
hasServiceWorker: boolean;
|
|
594
|
+
/** ISO timestamp of generation */
|
|
595
|
+
generatedAt: string;
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Features Plugin Configuration
|
|
601
|
+
* @description Configuration for feature discovery and enablement
|
|
602
|
+
*
|
|
603
|
+
* @remarks
|
|
604
|
+
* This interface defines the structure for feature discovery data that is populated
|
|
605
|
+
* at build time and made available at runtime for feature availability checking.
|
|
606
|
+
*
|
|
607
|
+
* @example
|
|
608
|
+
* ```typescript
|
|
609
|
+
* // Generated by feature discovery system
|
|
610
|
+
* const featuresConfig: FeaturesPluginConfig = {
|
|
611
|
+
* available: ['auth', 'billing', 'i18n', 'oauth'],
|
|
612
|
+
* enabled: ['auth', 'i18n'],
|
|
613
|
+
* overridden: false
|
|
614
|
+
* };
|
|
615
|
+
* ```
|
|
616
|
+
*/
|
|
617
|
+
interface FeaturesPluginConfig {
|
|
618
|
+
/**
|
|
619
|
+
* List of all available features discovered in packages/features/
|
|
620
|
+
* @example ['auth', 'billing', 'i18n', 'oauth']
|
|
621
|
+
*/
|
|
622
|
+
available: string[];
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// =============================================================================
|
|
626
|
+
// FRAMEWORK CONFIGURATION
|
|
627
|
+
// =============================================================================
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* Complete DoNotDev framework configuration structure
|
|
631
|
+
* @description Single source of truth for all framework configuration
|
|
632
|
+
*
|
|
633
|
+
* @remarks
|
|
634
|
+
* All discovery plugins add their data to this unified config.
|
|
635
|
+
* Available at runtime via globalThis._DNDEV_CONFIG_ or window._DNDEV_CONFIG_
|
|
636
|
+
*/
|
|
637
|
+
interface DndevFrameworkConfig {
|
|
638
|
+
/** Framework platform (Vite or Next.js) */
|
|
639
|
+
platform: Platform;
|
|
640
|
+
/** Current environment mode */
|
|
641
|
+
mode: EnvironmentMode;
|
|
642
|
+
/** Framework version */
|
|
643
|
+
version: string;
|
|
644
|
+
/** Execution context */
|
|
645
|
+
context: Context;
|
|
646
|
+
/** Unix timestamp of config generation */
|
|
647
|
+
timestamp: number;
|
|
648
|
+
/** i18n plugin configuration (optional) */
|
|
649
|
+
i18n?: I18nPluginConfig;
|
|
650
|
+
/** Routes plugin configuration (optional) */
|
|
651
|
+
routes?: RoutesPluginConfig;
|
|
652
|
+
/** Themes plugin configuration (optional) */
|
|
653
|
+
themes?: ThemesPluginConfig;
|
|
654
|
+
/** Assets plugin configuration (optional) */
|
|
655
|
+
assets?: AssetsPluginConfig;
|
|
656
|
+
/** PWA plugin configuration (optional) */
|
|
657
|
+
pwa?: PWAPluginConfig;
|
|
658
|
+
/** Features plugin configuration (optional) */
|
|
659
|
+
features?: FeaturesPluginConfig;
|
|
660
|
+
/** Environment variables (VITE_* variables from .env files) */
|
|
661
|
+
env?: Record<string, string>;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// =============================================================================
|
|
665
|
+
// GLOBAL AUGMENTATIONS
|
|
666
|
+
// =============================================================================
|
|
667
|
+
|
|
668
|
+
declare global {
|
|
669
|
+
interface Window {
|
|
670
|
+
/**
|
|
671
|
+
* Single source of truth for all DoNotDev framework configuration
|
|
672
|
+
* @description Set by platform detection and populated by discovery plugins
|
|
673
|
+
*/
|
|
674
|
+
_DNDEV_CONFIG_?: DndevFrameworkConfig;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Global store registry for singleton Zustand stores
|
|
678
|
+
* @description Ensures single instance across code-split chunks
|
|
679
|
+
*/
|
|
680
|
+
_DNDEV_STORES_?: Record<string, any>;
|
|
681
|
+
|
|
682
|
+
/** PapaParse CSV parser library (external) */
|
|
683
|
+
Papa?: {
|
|
684
|
+
parse: (input: string | File, config?: any) => any;
|
|
685
|
+
unparse: (data: any[], config?: any) => string;
|
|
686
|
+
};
|
|
687
|
+
|
|
688
|
+
/** Sentry error tracking library (external) */
|
|
689
|
+
Sentry?: {
|
|
690
|
+
captureException: (error: unknown) => void;
|
|
691
|
+
withScope: (callback: (scope: any) => void) => void;
|
|
692
|
+
getClient: () => { close: () => Promise<boolean> } | undefined;
|
|
693
|
+
};
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Google APIs (Maps, One Tap, etc.)
|
|
697
|
+
* @description Unified type for all Google services
|
|
698
|
+
*/
|
|
699
|
+
google?: {
|
|
700
|
+
/** Google Maps API */
|
|
701
|
+
maps?: {
|
|
702
|
+
places?: {
|
|
703
|
+
AutocompleteService: new () => any;
|
|
704
|
+
PlacesService: new (element: HTMLElement) => any;
|
|
705
|
+
PlacesServiceStatus: {
|
|
706
|
+
OK: string;
|
|
707
|
+
};
|
|
708
|
+
};
|
|
709
|
+
[key: string]: any;
|
|
710
|
+
};
|
|
711
|
+
/** Google Identity Services (One Tap) */
|
|
712
|
+
accounts?: {
|
|
713
|
+
id?: {
|
|
714
|
+
initialize: (config: any) => void;
|
|
715
|
+
prompt: (callback?: (notification: any) => void) => void;
|
|
716
|
+
cancel?: () => void;
|
|
717
|
+
disableAutoSelect?: () => void;
|
|
718
|
+
};
|
|
719
|
+
};
|
|
720
|
+
[key: string]: any;
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
/** FedCM Identity Credential API */
|
|
724
|
+
IdentityCredential?: any;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
namespace NodeJS {
|
|
728
|
+
interface ProcessEnv {
|
|
729
|
+
/** Serialized framework config for Node.js environment */
|
|
730
|
+
_DNDEV_CONFIG_?: string;
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
namespace globalThis {
|
|
735
|
+
/** Framework configuration (same as window._DNDEV_CONFIG_) */
|
|
736
|
+
var _DNDEV_CONFIG_: DndevFrameworkConfig | undefined;
|
|
737
|
+
/** Store registry (same as window._DNDEV_STORES_) */
|
|
738
|
+
var _DNDEV_STORES_: Record<string, any> | undefined;
|
|
739
|
+
|
|
740
|
+
// Third-party framework globals (not owned by DoNotDev)
|
|
741
|
+
var __vite_plugin_react_preamble_installed__: boolean | undefined;
|
|
742
|
+
var __vite_hmr_port: number | undefined;
|
|
743
|
+
var __NEXT_DATA__: any | undefined;
|
|
744
|
+
var __REACT_QUERY_CLIENT__: any | undefined;
|
|
745
|
+
var __REACT_QUERY_PROVIDER__: any | undefined;
|
|
746
|
+
var __DNDEV_DEBUG: boolean | undefined;
|
|
747
|
+
var __FIREBASE_DEMO_MODE__: boolean | undefined;
|
|
748
|
+
// gc is already defined by Node.js globals - removed to avoid TS 5.9+ conflict
|
|
749
|
+
var getAvailableThemes: (() => string[]) | undefined;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
type $MergeBy<T, K> = Omit<T, keyof K> & K;
|
|
754
|
+
|
|
755
|
+
type $PreservedValue<Value, Fallback> = [Value] extends [never] ? Fallback : Value;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* This interface can be augmented by users to add types to `i18next` default TypeOptions.
|
|
759
|
+
*
|
|
760
|
+
* Usage:
|
|
761
|
+
* ```ts
|
|
762
|
+
* // i18next.d.ts
|
|
763
|
+
* import 'i18next';
|
|
764
|
+
* declare module 'i18next' {
|
|
765
|
+
* interface CustomTypeOptions {
|
|
766
|
+
* defaultNS: 'custom';
|
|
767
|
+
* returnNull: false;
|
|
768
|
+
* returnObjects: false;
|
|
769
|
+
* nsSeparator: ':';
|
|
770
|
+
* keySeparator: '.';
|
|
771
|
+
* compatibilityJSON: 'v4';
|
|
772
|
+
* allowObjectInHTMLChildren: false;
|
|
773
|
+
* resources: {
|
|
774
|
+
* custom: {
|
|
775
|
+
* foo: 'foo';
|
|
776
|
+
* };
|
|
777
|
+
* };
|
|
778
|
+
* }
|
|
779
|
+
* }
|
|
780
|
+
* ```
|
|
781
|
+
*/
|
|
782
|
+
interface CustomTypeOptions {}
|
|
783
|
+
|
|
784
|
+
type TypeOptions = $MergeBy<
|
|
785
|
+
{
|
|
786
|
+
/** @see {InitOptions.returnNull} */
|
|
787
|
+
returnNull: false;
|
|
788
|
+
|
|
789
|
+
/** @see {InitOptions.returnEmptyString} */
|
|
790
|
+
returnEmptyString: true;
|
|
791
|
+
|
|
792
|
+
/** @see {InitOptions.returnObjects} */
|
|
793
|
+
returnObjects: false;
|
|
794
|
+
|
|
795
|
+
/** @see {InitOptions.keySeparator} */
|
|
796
|
+
keySeparator: '.';
|
|
797
|
+
|
|
798
|
+
/** @see {InitOptions.nsSeparator} */
|
|
799
|
+
nsSeparator: ':';
|
|
800
|
+
|
|
801
|
+
/** @see {InitOptions.pluralSeparator} */
|
|
802
|
+
pluralSeparator: '_';
|
|
803
|
+
|
|
804
|
+
/** @see {InitOptions.contextSeparator} */
|
|
805
|
+
contextSeparator: '_';
|
|
806
|
+
|
|
807
|
+
/** @see {InitOptions.defaultNS} */
|
|
808
|
+
defaultNS: 'translation';
|
|
809
|
+
|
|
810
|
+
/** @see {InitOptions.fallbackNS} */
|
|
811
|
+
fallbackNS: false;
|
|
812
|
+
|
|
813
|
+
/** @see {InitOptions.compatibilityJSON} */
|
|
814
|
+
compatibilityJSON: 'v4';
|
|
815
|
+
|
|
816
|
+
/** @see {InitOptions.resources} */
|
|
817
|
+
resources: object;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Flag that allows HTML elements to receive objects. This is only useful for React applications
|
|
821
|
+
* where you pass objects to HTML elements so they can be replaced to their respective interpolation
|
|
822
|
+
* values (mostly with Trans component)
|
|
823
|
+
*/
|
|
824
|
+
allowObjectInHTMLChildren: false;
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Flag that enables strict key checking even if a `defaultValue` has been provided.
|
|
828
|
+
* This ensures all calls of `t` function don't accidentally use implicitly missing keys.
|
|
829
|
+
*/
|
|
830
|
+
strictKeyChecks: false;
|
|
831
|
+
|
|
832
|
+
/**
|
|
833
|
+
* Prefix for interpolation
|
|
834
|
+
*/
|
|
835
|
+
interpolationPrefix: '{{';
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* Suffix for interpolation
|
|
839
|
+
*/
|
|
840
|
+
interpolationSuffix: '}}';
|
|
841
|
+
|
|
842
|
+
/** @see {InterpolationOptions.unescapePrefix} */
|
|
843
|
+
unescapePrefix: '-';
|
|
844
|
+
|
|
845
|
+
/** @see {InterpolationOptions.unescapeSuffix} */
|
|
846
|
+
unescapeSuffix: '';
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Use a proxy-based selector to select a translation.
|
|
850
|
+
*
|
|
851
|
+
* Enables features like go-to definition, and better DX/faster autocompletion
|
|
852
|
+
* for TypeScript developers.
|
|
853
|
+
*
|
|
854
|
+
* If you're working with an especially large set of translations and aren't
|
|
855
|
+
* using context, you set `enableSelector` to `"optimize"` and i18next won't do
|
|
856
|
+
* any type-level processing of your translations at all.
|
|
857
|
+
*
|
|
858
|
+
* With `enableSelector` set to `"optimize"`, i18next is capable of supporting
|
|
859
|
+
* arbitrarily large/deep translation sets without causing any IDE slowdown
|
|
860
|
+
* whatsoever.
|
|
861
|
+
*
|
|
862
|
+
* @default false
|
|
863
|
+
*/
|
|
864
|
+
enableSelector: false;
|
|
865
|
+
},
|
|
866
|
+
CustomTypeOptions
|
|
867
|
+
>;
|
|
868
|
+
|
|
869
|
+
type FlatNamespace = $PreservedValue<keyof TypeOptions['resources'], string>;
|
|
870
|
+
type Namespace<T = FlatNamespace> = T | readonly T[];
|
|
871
|
+
|
|
872
|
+
interface ReportNamespaces {
|
|
873
|
+
addUsedNamespaces(namespaces: Namespace): void;
|
|
874
|
+
getUsedNamespaces(): string[];
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
declare module 'i18next' {
|
|
878
|
+
// interface i18n {
|
|
879
|
+
// reportNamespaces?: ReportNamespaces;
|
|
880
|
+
// }
|
|
881
|
+
interface CustomInstanceExtensions {
|
|
882
|
+
reportNamespaces?: ReportNamespaces;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true
|
|
887
|
+
? Record<string, unknown>
|
|
888
|
+
: never;
|
|
889
|
+
|
|
890
|
+
type ReactI18NextChildren = React.ReactNode | ObjectOrNever;
|
|
891
|
+
|
|
892
|
+
declare module 'react' {
|
|
893
|
+
namespace JSX {
|
|
894
|
+
interface IntrinsicAttributes {
|
|
895
|
+
i18nIsDynamicList?: boolean;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
interface HTMLAttributes<T> {
|
|
900
|
+
// This union is inspired by the typings for React.ReactNode. We do this to fix "This JSX tag's 'children' prop
|
|
901
|
+
// expects a single child of type 'ReactI18NextChildren', but multiple children were provided":
|
|
902
|
+
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5a1e9f91ed0143adede394adb3f540e650455f71/types/react/index.d.ts#L268
|
|
903
|
+
children?: ReactI18NextChildren | Iterable<ReactI18NextChildren>;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
// packages/core/types/src/layout/layoutTypes.ts
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
* App metadata and branding configuration
|
|
913
|
+
*
|
|
914
|
+
* @version 0.0.2
|
|
915
|
+
* @since 0.0.1
|
|
916
|
+
* @author AMBROISE PARK Consulting
|
|
917
|
+
*/
|
|
918
|
+
interface AppMetadata {
|
|
919
|
+
/** Application name */
|
|
920
|
+
name?: string;
|
|
921
|
+
|
|
922
|
+
/** Short application name for mobile/compact displays (defaults to name if not set) */
|
|
923
|
+
shortName?: string;
|
|
924
|
+
|
|
925
|
+
/** Application URL (base URL for production, defaults to localhost in development) */
|
|
926
|
+
url?: string;
|
|
927
|
+
|
|
928
|
+
/** Application description */
|
|
929
|
+
description?: string;
|
|
930
|
+
|
|
931
|
+
/** Social and external links */
|
|
932
|
+
links?: {
|
|
933
|
+
/** GitHub repository URL */
|
|
934
|
+
github?: string;
|
|
935
|
+
/** Twitter/X profile URL */
|
|
936
|
+
twitter?: string;
|
|
937
|
+
/** LinkedIn profile URL */
|
|
938
|
+
linkedin?: string;
|
|
939
|
+
/** Support/contact URL */
|
|
940
|
+
support?: string;
|
|
941
|
+
/** Documentation URL */
|
|
942
|
+
docs?: string;
|
|
943
|
+
/** Blog URL */
|
|
944
|
+
blog?: string;
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
/** Footer configuration
|
|
948
|
+
* - `null`: Explicitly hide footer
|
|
949
|
+
* - `undefined`: Use framework default footer
|
|
950
|
+
* - `{ copyright?: ..., legalLinks?: ... }`: Custom footer configuration
|
|
951
|
+
*/
|
|
952
|
+
footer?: {
|
|
953
|
+
/** Copyright configuration
|
|
954
|
+
* - `null`: Hide copyright
|
|
955
|
+
* - `undefined`: Use default (© YEAR appName. All rights reserved)
|
|
956
|
+
* - `string`: Custom copyright text
|
|
957
|
+
*/
|
|
958
|
+
copyright?: null | string;
|
|
959
|
+
/** Legal links configuration
|
|
960
|
+
* - `null`: Hide legal links
|
|
961
|
+
* - `Array<{ path, label }>`: Custom legal links (labels can be i18n keys via maybeTranslate)
|
|
962
|
+
* - `undefined`: Use framework defaults (Privacy Policy, Terms of Service with i18n labels)
|
|
963
|
+
*/
|
|
964
|
+
legalLinks?: null | Array<{
|
|
965
|
+
path: string;
|
|
966
|
+
label: string;
|
|
967
|
+
}>;
|
|
968
|
+
} | null;
|
|
969
|
+
|
|
970
|
+
/** Additional application metadata */
|
|
971
|
+
metadata?: Record<string, any>;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Authentication route configuration
|
|
976
|
+
*
|
|
977
|
+
* Configure redirect routes for authentication and authorization failures.
|
|
978
|
+
* Also configures AuthHeader UI behavior (login page, user menu, etc.).
|
|
979
|
+
* All routes are optional with security-first defaults.
|
|
980
|
+
*
|
|
981
|
+
* @example
|
|
982
|
+
* ```typescript
|
|
983
|
+
* const authConfig: AuthConfig = {
|
|
984
|
+
* authRoute: '/signin',
|
|
985
|
+
* roleRoute: '/403',
|
|
986
|
+
* tierRoute: '/pricing',
|
|
987
|
+
* loginPath: '/login', // Optional: links to login page (undefined = show providers in header)
|
|
988
|
+
* profilePath: '/account',
|
|
989
|
+
* authMenuPaths: ['/dashboard', '/settings']
|
|
990
|
+
* };
|
|
991
|
+
* ```
|
|
992
|
+
*
|
|
993
|
+
* @version 0.0.2
|
|
994
|
+
* @since 0.0.1
|
|
995
|
+
* @author AMBROISE PARK Consulting
|
|
996
|
+
*/
|
|
997
|
+
interface AuthConfig {
|
|
998
|
+
/** Route to redirect when authentication required (default: '/login') */
|
|
999
|
+
authRoute: string;
|
|
1000
|
+
/** Route to redirect when role insufficient (default: '/404') */
|
|
1001
|
+
roleRoute: string;
|
|
1002
|
+
/** Route to redirect when tier insufficient (default: '/404') */
|
|
1003
|
+
tierRoute: string;
|
|
1004
|
+
/** Optional: Path to login page. If provided, AuthHeader links to login page. If undefined (default), shows providers in header */
|
|
1005
|
+
loginPath?: string;
|
|
1006
|
+
/** Optional: Path to profile page (default: '/profile') */
|
|
1007
|
+
profilePath?: string;
|
|
1008
|
+
/**
|
|
1009
|
+
* Optional: Custom menu items for authenticated user menu dropdown.
|
|
1010
|
+
* Supports route-based items with paths (auto-creates Link).
|
|
1011
|
+
* Icons are auto-resolved from route discovery (PageMeta.icon) if not provided.
|
|
1012
|
+
* For items with onClick handlers, use AuthMenu customItems prop instead.
|
|
1013
|
+
*
|
|
1014
|
+
* @example
|
|
1015
|
+
* ```typescript
|
|
1016
|
+
* authMenuItems: [
|
|
1017
|
+
* { path: '/dashboard' }, // icon auto-resolved from route
|
|
1018
|
+
* { path: '/settings', label: 'Settings' }, // override label, icon from route
|
|
1019
|
+
* { path: '/billing', icon: 'CreditCard' } // override icon
|
|
1020
|
+
* ]
|
|
1021
|
+
* ```
|
|
1022
|
+
*/
|
|
1023
|
+
authMenuItems?: Array<{
|
|
1024
|
+
/** Route path (creates Link automatically) */
|
|
1025
|
+
path: string;
|
|
1026
|
+
/** Optional label (falls back to navigation item label or path segment) */
|
|
1027
|
+
label?: string;
|
|
1028
|
+
/** Optional Lucide icon name (string) - overrides route discovery icon */
|
|
1029
|
+
icon?: string;
|
|
1030
|
+
}>;
|
|
1031
|
+
/**
|
|
1032
|
+
* Optional function to handle custom data deletion before account removal
|
|
1033
|
+
* Framework will try/catch this - failures won't block account deletion
|
|
1034
|
+
*
|
|
1035
|
+
* @example
|
|
1036
|
+
* ```typescript
|
|
1037
|
+
* deleteUserFunction: async (userId: string) => {
|
|
1038
|
+
* // Cancel Stripe subscriptions
|
|
1039
|
+
* await fetch('/api/billing/cancel', { method: 'POST' });
|
|
1040
|
+
*
|
|
1041
|
+
* // Delete Firestore user data
|
|
1042
|
+
* await deleteDoc(doc(db, 'users', userId));
|
|
1043
|
+
*
|
|
1044
|
+
* // Custom cleanup
|
|
1045
|
+
* await myCustomCleanup(userId);
|
|
1046
|
+
* }
|
|
1047
|
+
* ```
|
|
1048
|
+
*/
|
|
1049
|
+
deleteUserFunction?: (userId: string) => Promise<void>;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* SEO configuration
|
|
1054
|
+
*
|
|
1055
|
+
* Configure automatic SEO meta tags and social sharing.
|
|
1056
|
+
*
|
|
1057
|
+
* @example
|
|
1058
|
+
* ```typescript
|
|
1059
|
+
* const seoConfig: SEOConfig = {
|
|
1060
|
+
* baseUrl: 'https://example.com',
|
|
1061
|
+
* defaultImage: '/og-image.png',
|
|
1062
|
+
* twitterHandle: 'mycompany'
|
|
1063
|
+
* };
|
|
1064
|
+
* ```
|
|
1065
|
+
*
|
|
1066
|
+
* @version 0.0.2
|
|
1067
|
+
* @since 0.0.1
|
|
1068
|
+
* @author AMBROISE PARK Consulting
|
|
1069
|
+
*/
|
|
1070
|
+
interface SEOConfig {
|
|
1071
|
+
/** Enable automatic SEO (default: true) */
|
|
1072
|
+
enabled?: boolean;
|
|
1073
|
+
/** Base URL for SEO files (robots.txt, sitemap.xml) - defaults to appConfig.app.url (set at build time) */
|
|
1074
|
+
baseUrl?: string;
|
|
1075
|
+
/** Site name for SEO - defaults to APP_NAME from app.ts */
|
|
1076
|
+
siteName?: string;
|
|
1077
|
+
/** Crawl delay for robots.txt (default: 1) */
|
|
1078
|
+
crawlDelay?: number;
|
|
1079
|
+
/** Generate robots.txt (default: true) */
|
|
1080
|
+
generateRobotsTxt?: boolean;
|
|
1081
|
+
/** Generate sitemap.xml (default: true) */
|
|
1082
|
+
generateSitemap?: boolean;
|
|
1083
|
+
/** Default namespace for i18n translations (default: 'home') */
|
|
1084
|
+
defaultNamespace?: string;
|
|
1085
|
+
/** Default image for social sharing */
|
|
1086
|
+
defaultImage?: string;
|
|
1087
|
+
/** Twitter handle (without @) */
|
|
1088
|
+
twitterHandle?: string;
|
|
1089
|
+
/** Additional static meta tags */
|
|
1090
|
+
staticTags?: Record<string, string>;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Favicon and PWA configuration
|
|
1095
|
+
*
|
|
1096
|
+
* Configure automatic favicon generation and PWA manifest icons.
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* const faviconConfig: FaviconConfig = {
|
|
1101
|
+
* appName: 'My App',
|
|
1102
|
+
* themeColor: '#000000',
|
|
1103
|
+
* backgroundColor: '#ffffff'
|
|
1104
|
+
* };
|
|
1105
|
+
* ```
|
|
1106
|
+
*
|
|
1107
|
+
* @version 0.0.2
|
|
1108
|
+
* @since 0.0.1
|
|
1109
|
+
* @author AMBROISE PARK Consulting
|
|
1110
|
+
*/
|
|
1111
|
+
interface FaviconConfig {
|
|
1112
|
+
/** Enable automatic favicon system (default: true) */
|
|
1113
|
+
enabled?: boolean;
|
|
1114
|
+
/** App name for PWA manifest */
|
|
1115
|
+
appName?: string;
|
|
1116
|
+
/** Theme color for mobile browsers */
|
|
1117
|
+
themeColor?: string;
|
|
1118
|
+
/** Background color for splash screens */
|
|
1119
|
+
backgroundColor?: string;
|
|
1120
|
+
/** Include PWA manifest icons */
|
|
1121
|
+
includeManifestIcons?: boolean;
|
|
1122
|
+
/** Include Microsoft tile icons */
|
|
1123
|
+
includeMSIcons?: boolean;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
/**
|
|
1127
|
+
* Feature flags and debug configuration
|
|
1128
|
+
*
|
|
1129
|
+
* Controls app behavior and GDPR compliance.
|
|
1130
|
+
* Feature availability is auto-detected via env vars/packages.
|
|
1131
|
+
*
|
|
1132
|
+
* @example
|
|
1133
|
+
* ```typescript
|
|
1134
|
+
* const featuresConfig: FeaturesConfig = {
|
|
1135
|
+
* debug: true,
|
|
1136
|
+
* offlineTrustEnabled: true,
|
|
1137
|
+
* requiredCookies: ['necessary', 'analytics']
|
|
1138
|
+
* };
|
|
1139
|
+
* ```
|
|
1140
|
+
*
|
|
1141
|
+
* @version 0.0.2
|
|
1142
|
+
* @since 0.0.1
|
|
1143
|
+
* @author AMBROISE PARK Consulting
|
|
1144
|
+
*/
|
|
1145
|
+
interface FeaturesConfig {
|
|
1146
|
+
/** Enable debug tools (default: false in production, true in development) */
|
|
1147
|
+
debug?: boolean;
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Enable offline trust for cached claims (default: false)
|
|
1151
|
+
*
|
|
1152
|
+
* When true:
|
|
1153
|
+
* - Online: Always verify with server (don't trust cache)
|
|
1154
|
+
* - Offline: Use cached claims (graceful degradation)
|
|
1155
|
+
*
|
|
1156
|
+
* When false:
|
|
1157
|
+
* - Online: Always verify with server
|
|
1158
|
+
* - Offline: Reject (throw error, require network)
|
|
1159
|
+
*
|
|
1160
|
+
* @default false
|
|
1161
|
+
*/
|
|
1162
|
+
offlineTrustEnabled?: boolean;
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Cookie consent categories to display in GDPR banner
|
|
1166
|
+
*
|
|
1167
|
+
* Controls which cookie categories users can consent to.
|
|
1168
|
+
* Framework always includes 'necessary' (cannot be disabled).
|
|
1169
|
+
*
|
|
1170
|
+
* @example
|
|
1171
|
+
* ```typescript
|
|
1172
|
+
* features: {
|
|
1173
|
+
* requiredCookies: ['necessary', 'functional', 'analytics']
|
|
1174
|
+
* }
|
|
1175
|
+
* ```
|
|
1176
|
+
*
|
|
1177
|
+
* @default ['necessary']
|
|
1178
|
+
*/
|
|
1179
|
+
requiredCookies?: string[];
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Complete application configuration
|
|
1184
|
+
*
|
|
1185
|
+
* Consolidates all app-level configuration with smart defaults.
|
|
1186
|
+
* Pass only what you need to override - everything has sensible defaults.
|
|
1187
|
+
*
|
|
1188
|
+
* @example
|
|
1189
|
+
* ```typescript
|
|
1190
|
+
* // Minimal configuration
|
|
1191
|
+
* const config: AppConfig = {
|
|
1192
|
+
* app: { name: 'My App' }
|
|
1193
|
+
* };
|
|
1194
|
+
*
|
|
1195
|
+
* // Full configuration
|
|
1196
|
+
* const config: AppConfig = {
|
|
1197
|
+
* app: {
|
|
1198
|
+
* name: 'My App',
|
|
1199
|
+
* description: 'Professional app'
|
|
1200
|
+
* },
|
|
1201
|
+
* auth: {
|
|
1202
|
+
* authRoute: '/signin',
|
|
1203
|
+
* roleRoute: '/403',
|
|
1204
|
+
* tierRoute: '/pricing'
|
|
1205
|
+
* },
|
|
1206
|
+
* seo: {
|
|
1207
|
+
* defaultImage: '/og.png'
|
|
1208
|
+
* },
|
|
1209
|
+
* preset: 'landing',
|
|
1210
|
+
* features: {
|
|
1211
|
+
* debug: true
|
|
1212
|
+
* }
|
|
1213
|
+
* };
|
|
1214
|
+
* ```
|
|
1215
|
+
*
|
|
1216
|
+
* @version 0.0.2
|
|
1217
|
+
* @since 0.0.1
|
|
1218
|
+
* @author AMBROISE PARK Consulting
|
|
1219
|
+
*/
|
|
1220
|
+
interface AppConfig {
|
|
1221
|
+
/** App metadata and branding */
|
|
1222
|
+
app?: AppMetadata;
|
|
1223
|
+
/** Authentication routes - partial override of defaults */
|
|
1224
|
+
auth?: Partial<AuthConfig> | false;
|
|
1225
|
+
/** SEO configuration (set to false to disable) */
|
|
1226
|
+
seo?: SEOConfig | false;
|
|
1227
|
+
/** Favicon configuration (set to false to disable) */
|
|
1228
|
+
favicon?: FaviconConfig | false;
|
|
1229
|
+
/** Layout preset for store initialization (defaults to 'landing' if invalid/empty) */
|
|
1230
|
+
preset?: string;
|
|
1231
|
+
/** Feature flags */
|
|
1232
|
+
features?: FeaturesConfig;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
// packages/core/config/index.d.ts
|
|
1236
|
+
|
|
1237
|
+
/**
|
|
1238
|
+
* @fileoverview TypeScript Definitions for @donotdev/config
|
|
1239
|
+
* @description Comprehensive configuration system for DNDev applications supporting Vite and Next.js with built-in routing, theming, and internationalization.
|
|
1240
|
+
*
|
|
1241
|
+
* @version 0.0.1
|
|
1242
|
+
* @since 0.0.1
|
|
1243
|
+
* @author AMBROISE PARK Consulting
|
|
1244
|
+
*/
|
|
1245
|
+
|
|
1246
|
+
/**
|
|
1247
|
+
* Build configuration options
|
|
1248
|
+
*
|
|
1249
|
+
* @version 0.0.1
|
|
1250
|
+
* @since 0.0.1
|
|
1251
|
+
* @author AMBROISE PARK Consulting
|
|
1252
|
+
*/
|
|
1253
|
+
interface BuildConfig {
|
|
1254
|
+
outDir?: string;
|
|
1255
|
+
sourcemap?: boolean;
|
|
1256
|
+
/** Minification strategy */
|
|
1257
|
+
minify?: boolean | 'esbuild' | 'lightningcss';
|
|
1258
|
+
mode?: 'development' | 'production' | string;
|
|
1259
|
+
/** Build target (default: 'baseline-widely-available') */
|
|
1260
|
+
target?: string;
|
|
1261
|
+
/** esbuild minification options */
|
|
1262
|
+
esbuildOptions?: Record<string, any>;
|
|
1263
|
+
chunkSizeWarningLimit?: number;
|
|
1264
|
+
/** Enable bundle analyzer to generate stats.html */
|
|
1265
|
+
analyze?: boolean;
|
|
1266
|
+
/** CSS minification strategy */
|
|
1267
|
+
cssMinify?: boolean | 'esbuild' | 'lightningcss';
|
|
1268
|
+
/** Enable CSS code splitting (default: true) */
|
|
1269
|
+
cssCodeSplit?: boolean;
|
|
1270
|
+
/** Report compressed size (default: false, use stats.html instead) */
|
|
1271
|
+
reportCompressedSize?: boolean;
|
|
1272
|
+
/** Assets inline limit in bytes (default: 0, never inline) */
|
|
1273
|
+
assetsInlineLimit?: number;
|
|
1274
|
+
/** Cache directory (default: 'node_modules/.vite') */
|
|
1275
|
+
cacheDir?: string;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Module resolution options
|
|
1280
|
+
*
|
|
1281
|
+
* @version 0.0.1
|
|
1282
|
+
* @since 0.0.1
|
|
1283
|
+
* @author AMBROISE PARK Consulting
|
|
1284
|
+
*/
|
|
1285
|
+
interface ResolveOptions {
|
|
1286
|
+
alias?:
|
|
1287
|
+
| Record<string, string>
|
|
1288
|
+
| Array<{ find: string | RegExp; replacement: string }>;
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* Server configuration options
|
|
1293
|
+
* Used for both dev server and preview server
|
|
1294
|
+
*
|
|
1295
|
+
* @version 0.0.1
|
|
1296
|
+
* @since 0.0.1
|
|
1297
|
+
* @author AMBROISE PARK Consulting
|
|
1298
|
+
*/
|
|
1299
|
+
interface ServerOptions {
|
|
1300
|
+
/** Server port number */
|
|
1301
|
+
port?: number;
|
|
1302
|
+
/** Fail if port is already in use (default: true) */
|
|
1303
|
+
strictPort?: boolean;
|
|
1304
|
+
/** Host configuration - true for all interfaces, string for specific host */
|
|
1305
|
+
host?: boolean | string;
|
|
1306
|
+
/** Automatically open browser */
|
|
1307
|
+
open?: boolean;
|
|
1308
|
+
/** File system access configuration */
|
|
1309
|
+
fs?: {
|
|
1310
|
+
/** Allowed directories for file access */
|
|
1311
|
+
allow?: string[];
|
|
1312
|
+
/** Strict file serving (default: false for workspace access) */
|
|
1313
|
+
strict?: boolean;
|
|
1314
|
+
};
|
|
1315
|
+
/** Hot Module Replacement configuration */
|
|
1316
|
+
hmr?: {
|
|
1317
|
+
/** HMR timeout in milliseconds */
|
|
1318
|
+
timeout?: number;
|
|
1319
|
+
/** Overlay error display */
|
|
1320
|
+
overlay?: boolean;
|
|
1321
|
+
/** HMR server port (for WebSocket) */
|
|
1322
|
+
port?: number;
|
|
1323
|
+
/** HMR server host */
|
|
1324
|
+
host?: string;
|
|
1325
|
+
/** Client-side HMR port (when different from server port) */
|
|
1326
|
+
clientPort?: number;
|
|
1327
|
+
/** WebSocket protocol */
|
|
1328
|
+
protocol?: 'ws' | 'wss';
|
|
1329
|
+
};
|
|
1330
|
+
/** File watcher configuration */
|
|
1331
|
+
watch?: {
|
|
1332
|
+
/** Use polling for file watching */
|
|
1333
|
+
usePolling?: boolean;
|
|
1334
|
+
/** Polling interval in milliseconds */
|
|
1335
|
+
interval?: number;
|
|
1336
|
+
/** Files/patterns to ignore (set by plugin using config.root) */
|
|
1337
|
+
ignored?: string | RegExp | Array<string | RegExp>;
|
|
1338
|
+
};
|
|
1339
|
+
/** Enable CORS */
|
|
1340
|
+
cors?: boolean;
|
|
1341
|
+
/** Enable HTTPS (default: true for PWA/OAuth/secure context) */
|
|
1342
|
+
https?: boolean;
|
|
1343
|
+
/** HTTP headers */
|
|
1344
|
+
headers?: Record<string, string>;
|
|
1345
|
+
/** Middleware mode (default: false) */
|
|
1346
|
+
middlewareMode?: boolean;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* I18n virtual mapping options
|
|
1351
|
+
*
|
|
1352
|
+
* @version 0.0.1
|
|
1353
|
+
* @since 0.0.1
|
|
1354
|
+
* @author AMBROISE PARK Consulting
|
|
1355
|
+
*/
|
|
1356
|
+
interface I18nVirtualMappingOptions {
|
|
1357
|
+
virtualModuleId?: string;
|
|
1358
|
+
eagerNamespaces?: string[];
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* Base discovery options - DRY type for code, not a config level
|
|
1363
|
+
* HMR options are internal framework concerns (in DEFAULT_OPTIONS only, not user-configurable)
|
|
1364
|
+
* Plugins are always enabled (part of framework) - no enabled option
|
|
1365
|
+
*
|
|
1366
|
+
* @version 0.0.1
|
|
1367
|
+
* @since 0.0.1
|
|
1368
|
+
* @author AMBROISE PARK Consulting
|
|
1369
|
+
*/
|
|
1370
|
+
interface BaseDiscoveryOptions {
|
|
1371
|
+
/** Debug logging (default: false) - cascades from global debug */
|
|
1372
|
+
debug?: boolean;
|
|
1373
|
+
/** Verbose logging (default: true) - cascades from global verbose */
|
|
1374
|
+
verbose?: boolean;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
* Theme detection options
|
|
1379
|
+
*
|
|
1380
|
+
* @version 0.0.1
|
|
1381
|
+
* @since 0.0.1
|
|
1382
|
+
* @author AMBROISE PARK Consulting
|
|
1383
|
+
*/
|
|
1384
|
+
interface ThemeDetectionOptions extends BaseDiscoveryOptions {
|
|
1385
|
+
/** Theme manifest file name (default: 'theme-manifest.json') */
|
|
1386
|
+
manifestFileName?: string;
|
|
1387
|
+
/** Auto-generate safelist (default: true) */
|
|
1388
|
+
autoSafelist?: boolean;
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Route discovery options with virtual module support
|
|
1393
|
+
*
|
|
1394
|
+
* @version 0.0.1
|
|
1395
|
+
* @since 0.0.1
|
|
1396
|
+
* @author AMBROISE PARK Consulting
|
|
1397
|
+
*/
|
|
1398
|
+
interface RouteDiscoveryOptions extends BaseDiscoveryOptions {
|
|
1399
|
+
/** Disable route discovery (default: false) - set to true if using custom router */
|
|
1400
|
+
disabled?: boolean;
|
|
1401
|
+
/** Path to manual routes file relative to vite.config.ts (default: './src/routes.ts') */
|
|
1402
|
+
manualPath?: string;
|
|
1403
|
+
/** Additional patterns to scan beyond centralized patterns */
|
|
1404
|
+
additionalPatterns?: string[];
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/**
|
|
1408
|
+
* I18n options
|
|
1409
|
+
*
|
|
1410
|
+
* @version 0.0.1
|
|
1411
|
+
* @since 0.0.1
|
|
1412
|
+
* @author AMBROISE PARK Consulting
|
|
1413
|
+
*/
|
|
1414
|
+
interface I18nOptions extends BaseDiscoveryOptions {
|
|
1415
|
+
useVirtualMapping?: boolean;
|
|
1416
|
+
fallbackLanguage?: string;
|
|
1417
|
+
namespaces?: string[];
|
|
1418
|
+
virtualMapping?: I18nVirtualMappingOptions;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
/**
|
|
1422
|
+
* Asset options
|
|
1423
|
+
*
|
|
1424
|
+
* @version 0.0.1
|
|
1425
|
+
* @since 0.0.1
|
|
1426
|
+
* @author AMBROISE PARK Consulting
|
|
1427
|
+
*/
|
|
1428
|
+
interface AssetOptions extends BaseDiscoveryOptions {
|
|
1429
|
+
/** Asset fallback configuration */
|
|
1430
|
+
fallback?: AssetFallbackOptions | false;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
/**
|
|
1434
|
+
* Progressive Web App options
|
|
1435
|
+
*
|
|
1436
|
+
* @version 0.0.1
|
|
1437
|
+
* @since 0.0.1
|
|
1438
|
+
* @author AMBROISE PARK Consulting
|
|
1439
|
+
*/
|
|
1440
|
+
interface PWAOptions {
|
|
1441
|
+
/** Enable PWA in production builds (default: false) */
|
|
1442
|
+
enabled?: boolean;
|
|
1443
|
+
/** Enable PWA in development (default: false) */
|
|
1444
|
+
devEnabled?: boolean;
|
|
1445
|
+
/** Debug logging (default: false) */
|
|
1446
|
+
debug?: boolean;
|
|
1447
|
+
/** Override manifest values (auto-discovered from app.ts by default) */
|
|
1448
|
+
manifest?: Record<string, any>;
|
|
1449
|
+
/** Discover build assets for precache (Next.js only, default: true) */
|
|
1450
|
+
discoverBuildAssets?: boolean;
|
|
1451
|
+
/** Override workbox configuration (smart defaults provided) */
|
|
1452
|
+
workbox?: {
|
|
1453
|
+
/** Maximum file size to cache in bytes (default: 5MB) */
|
|
1454
|
+
maximumFileSizeToCacheInBytes?: number;
|
|
1455
|
+
/** Glob patterns for precaching (default: all js, css, html, icons, and fonts) */
|
|
1456
|
+
globPatterns?: string[];
|
|
1457
|
+
/** Glob patterns to ignore */
|
|
1458
|
+
globIgnores?: string[];
|
|
1459
|
+
/** Clean up outdated caches (default: true) */
|
|
1460
|
+
cleanupOutdatedCaches?: boolean;
|
|
1461
|
+
/** Skip waiting for service worker activation (default: true) */
|
|
1462
|
+
skipWaiting?: boolean;
|
|
1463
|
+
/** Claim clients immediately (default: true) */
|
|
1464
|
+
clientsClaim?: boolean;
|
|
1465
|
+
/** Runtime caching strategies (smart defaults provided) */
|
|
1466
|
+
runtimeCaching?: Array<{
|
|
1467
|
+
urlPattern: RegExp | ((options: { request: Request }) => boolean);
|
|
1468
|
+
handler:
|
|
1469
|
+
| 'CacheFirst'
|
|
1470
|
+
| 'NetworkFirst'
|
|
1471
|
+
| 'StaleWhileRevalidate'
|
|
1472
|
+
| 'NetworkOnly'
|
|
1473
|
+
| 'CacheOnly';
|
|
1474
|
+
options?: Record<string, any>;
|
|
1475
|
+
}>;
|
|
1476
|
+
/** Navigation fallback URL (default: '/') */
|
|
1477
|
+
navigateFallback?: string;
|
|
1478
|
+
/** URLs to exclude from navigation fallback */
|
|
1479
|
+
navigateFallbackDenylist?: RegExp[];
|
|
1480
|
+
/** Transform precache manifest (allows custom filtering/modification) */
|
|
1481
|
+
manifestTransforms?: Array<
|
|
1482
|
+
(manifest: Array<{ url: string; revision: string | null }>) => {
|
|
1483
|
+
manifest: Array<{ url: string; revision: string | null }>;
|
|
1484
|
+
warnings?: string[];
|
|
1485
|
+
}
|
|
1486
|
+
>;
|
|
1487
|
+
/** Background sync configuration for offline actions */
|
|
1488
|
+
backgroundSync?:
|
|
1489
|
+
| {
|
|
1490
|
+
/** Queue name for background sync (default: 'background-sync-queue') */
|
|
1491
|
+
queueName?: string;
|
|
1492
|
+
/** Maximum retention time in minutes (default: 24 * 60) */
|
|
1493
|
+
maxRetentionTime?: number;
|
|
1494
|
+
/** URL pattern for background sync routes (default: matches /api/ routes) */
|
|
1495
|
+
urlPattern?: RegExp | ((options: { request: Request }) => boolean);
|
|
1496
|
+
}
|
|
1497
|
+
| false;
|
|
1498
|
+
[key: string]: any; // Allow other workbox options
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
/**
|
|
1503
|
+
* Asset fallback options
|
|
1504
|
+
*
|
|
1505
|
+
* @version 0.0.1
|
|
1506
|
+
* @since 0.0.1
|
|
1507
|
+
* @author AMBROISE PARK Consulting
|
|
1508
|
+
*/
|
|
1509
|
+
interface AssetFallbackOptions {
|
|
1510
|
+
/** Enable asset fallback (default: true) */
|
|
1511
|
+
enabled?: boolean;
|
|
1512
|
+
/** Assets to copy (default: from centralized patterns) */
|
|
1513
|
+
assets?: string[];
|
|
1514
|
+
/** Asset patterns to scan (default: from centralized patterns) */
|
|
1515
|
+
assetPatterns?: string[];
|
|
1516
|
+
/** Framework package name (default: '@donotdev/ui') */
|
|
1517
|
+
frameworkPackage?: string;
|
|
1518
|
+
/** Assets path within framework package (default: 'assets') */
|
|
1519
|
+
assetsPath?: string;
|
|
1520
|
+
/** Debug logging (default: false) */
|
|
1521
|
+
debug?: boolean;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Chunking configuration options
|
|
1526
|
+
*
|
|
1527
|
+
* User patterns are APPENDED to framework's react-core patterns (not replaced).
|
|
1528
|
+
* Framework patterns are always included - user patterns extend them.
|
|
1529
|
+
*
|
|
1530
|
+
* @version 0.0.1
|
|
1531
|
+
* @since 0.0.1
|
|
1532
|
+
* @author AMBROISE PARK Consulting
|
|
1533
|
+
*/
|
|
1534
|
+
interface ChunkingOptions {
|
|
1535
|
+
/** Additional React-dependent library patterns to APPEND to framework's react-core chunk */
|
|
1536
|
+
reactCore?: string[];
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
/**
|
|
1540
|
+
* Server shim options for blocking server-only imports
|
|
1541
|
+
* Note: serverShim cannot be disabled - framework would crash without it
|
|
1542
|
+
*
|
|
1543
|
+
* @version 0.0.1
|
|
1544
|
+
* @since 0.0.1
|
|
1545
|
+
* @author AMBROISE PARK Consulting
|
|
1546
|
+
*/
|
|
1547
|
+
interface ServerShimOptions {
|
|
1548
|
+
/** Additional imports to block beyond defaults */
|
|
1549
|
+
blockedImports?: string[];
|
|
1550
|
+
/** Debug logging (default: false) */
|
|
1551
|
+
debug?: boolean;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* Dependency optimization options
|
|
1556
|
+
*
|
|
1557
|
+
* @version 0.0.1
|
|
1558
|
+
* @since 0.0.1
|
|
1559
|
+
* @author AMBROISE PARK Consulting
|
|
1560
|
+
*/
|
|
1561
|
+
interface OptimizeDepsOptions {
|
|
1562
|
+
entries?: string | string[];
|
|
1563
|
+
exclude?: string[];
|
|
1564
|
+
include?: string[];
|
|
1565
|
+
force?: boolean;
|
|
1566
|
+
esbuildOptions?: {
|
|
1567
|
+
format?: 'esm' | 'cjs' | 'iife';
|
|
1568
|
+
target?: string | string[];
|
|
1569
|
+
platform?: 'browser' | 'node' | 'neutral';
|
|
1570
|
+
define?: Record<string, string>;
|
|
1571
|
+
external?: string[];
|
|
1572
|
+
[key: string]: any;
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* Configuration options for DNDev applications
|
|
1578
|
+
*
|
|
1579
|
+
* Provides comprehensive configuration for Vite-based applications with
|
|
1580
|
+
* built-in support for routing, theming, internationalization, and SEO.
|
|
1581
|
+
*
|
|
1582
|
+
* @version 0.0.1
|
|
1583
|
+
* @since 0.0.1
|
|
1584
|
+
* @author AMBROISE PARK Consulting
|
|
1585
|
+
*/
|
|
1586
|
+
interface ConfigOptions {
|
|
1587
|
+
/** App config from app.ts - features and SEO will be extracted automatically (required) */
|
|
1588
|
+
appConfig: AppConfig;
|
|
1589
|
+
/** Debug mode - disables minification, enables sourcemaps, preserves console logs */
|
|
1590
|
+
debug?: boolean;
|
|
1591
|
+
/** Verbose logging - shows config/search paths (opt-out, auto-disabled in CI) */
|
|
1592
|
+
verbose?: boolean;
|
|
1593
|
+
/** Base public path */
|
|
1594
|
+
base?: string;
|
|
1595
|
+
/** Build mode */
|
|
1596
|
+
mode?: 'development' | 'production';
|
|
1597
|
+
/** Build configuration */
|
|
1598
|
+
build?: BuildConfig;
|
|
1599
|
+
/** Module resolution options */
|
|
1600
|
+
resolve?: ResolveOptions;
|
|
1601
|
+
/** Development server configuration */
|
|
1602
|
+
server?: ServerOptions;
|
|
1603
|
+
/** Preview server configuration (reuses ServerOptions) */
|
|
1604
|
+
preview?: ServerOptions;
|
|
1605
|
+
/** Internationalization options */
|
|
1606
|
+
i18n?: I18nOptions;
|
|
1607
|
+
/** Progressive Web App options */
|
|
1608
|
+
pwa?: PWAOptions;
|
|
1609
|
+
/** Asset management options */
|
|
1610
|
+
assets?: AssetOptions;
|
|
1611
|
+
/** Theme detection options */
|
|
1612
|
+
themes?: ThemeDetectionOptions;
|
|
1613
|
+
/** Route discovery options */
|
|
1614
|
+
routes?: RouteDiscoveryOptions;
|
|
1615
|
+
/** Chunking configuration options */
|
|
1616
|
+
chunking?: ChunkingOptions;
|
|
1617
|
+
/** Server shim options */
|
|
1618
|
+
serverShim?: ServerShimOptions;
|
|
1619
|
+
/** Dependency optimization options */
|
|
1620
|
+
optimizeDeps?: OptimizeDepsOptions;
|
|
1621
|
+
/** Environment directory (default: Vite auto-resolves relative to vite.config.ts) */
|
|
1622
|
+
envDir?: string;
|
|
1623
|
+
/** Environment variable prefixes */
|
|
1624
|
+
envPrefix?: string | string[];
|
|
1625
|
+
/** Additional Vite plugins */
|
|
1626
|
+
plugins?: any[];
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* Creates a complete Vite configuration optimized for DNDev applications
|
|
1631
|
+
*
|
|
1632
|
+
* @param options - Configuration options
|
|
1633
|
+
* @returns Complete Vite configuration object
|
|
1634
|
+
*
|
|
1635
|
+
* @version 0.0.1
|
|
1636
|
+
* @since 0.0.1
|
|
1637
|
+
* @author AMBROISE PARK Consulting
|
|
1638
|
+
*/
|
|
1639
|
+
declare function defineViteConfig(
|
|
1640
|
+
options?: ConfigOptions | string | boolean
|
|
1641
|
+
): any;
|
|
1642
|
+
|
|
1643
|
+
export { defineViteConfig };
|
|
1644
|
+
export type { ConfigOptions };
|