@common-stack/core 8.2.2-alpha.1 → 8.2.4-alpha.2
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.
|
@@ -4,6 +4,12 @@ export interface IRoutePageExportFlags {
|
|
|
4
4
|
hasClientLoader?: boolean;
|
|
5
5
|
hasClientAction?: boolean;
|
|
6
6
|
hasComponent?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @name Has SPA Component
|
|
9
|
+
* @description Indicates that a `.client.tsx` version of the component exists.
|
|
10
|
+
* When true and `runSPAOnly` is enabled, the `.client.tsx` file will be used.
|
|
11
|
+
*/
|
|
12
|
+
hasSPAComponent?: boolean;
|
|
7
13
|
hasErrorBoundary?: boolean;
|
|
8
14
|
/**
|
|
9
15
|
* @name Query Params Generator
|
|
@@ -25,6 +31,14 @@ export interface ILoaderReturnInfo {
|
|
|
25
31
|
export interface IRollupBuildGenerated extends IRoutePageExportFlags {
|
|
26
32
|
queries?: Record<string, string | object>;
|
|
27
33
|
componentPath?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @name Fallback Server Component Path
|
|
36
|
+
* @description Optional path to a server-side component to use as an SSR
|
|
37
|
+
* fallback when the primary component is client-only. This allows the
|
|
38
|
+
* generated wrappers to reference a server-safe component for server
|
|
39
|
+
* rendering while using the client component in the SPA bundle.
|
|
40
|
+
*/
|
|
41
|
+
fallbackServerComponentPath?: string;
|
|
28
42
|
loaderReturnInfo?: ILoaderReturnInfo;
|
|
29
43
|
/**
|
|
30
44
|
* @name Dialog Path
|
|
@@ -37,6 +37,38 @@ export interface IRouteModule extends IMenuDataItem, IGeneratedWrapperOptions {
|
|
|
37
37
|
component?: () => Promise<{
|
|
38
38
|
default: ComponentType<any>;
|
|
39
39
|
}>;
|
|
40
|
+
/**
|
|
41
|
+
* @name SPA Component
|
|
42
|
+
* @description Dynamic import of an alternative Component for SPA/Tauri mode.
|
|
43
|
+
* When running in SPA mode (settings.runSPAOnly=true), this component will be used
|
|
44
|
+
* instead of the regular `component`. Use this when you need a different component
|
|
45
|
+
* implementation that doesn't rely on server-side loaders or actions.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* {
|
|
49
|
+
* component: () => import('./RemixAuthCallback'), // Uses server loader
|
|
50
|
+
* spaComponent: () => import('./SPAAuthCallback'), // Client-only implementation
|
|
51
|
+
* }
|
|
52
|
+
*/
|
|
53
|
+
spaComponent?: () => Promise<{
|
|
54
|
+
default: ComponentType<any>;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* @name SPA Exclude
|
|
58
|
+
* @description When true, this route will be excluded from SPA builds.
|
|
59
|
+
* Use this for resource routes or routes that only make sense in SSR mode.
|
|
60
|
+
* Routes with isResourceRoute=true are automatically excluded from SPA builds.
|
|
61
|
+
*/
|
|
62
|
+
spaExclude?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* @name Fallback Server Component
|
|
65
|
+
* @description Dynamic import of the fallback server-safe component to use during SSR
|
|
66
|
+
* when the primary component is client-only. This allows the route to render a simpler
|
|
67
|
+
* component on the server while hydrating with the full client component in the browser.
|
|
68
|
+
*/
|
|
69
|
+
fallbackServerComponent?: () => Promise<{
|
|
70
|
+
default: ComponentType<any>;
|
|
71
|
+
}>;
|
|
40
72
|
/**
|
|
41
73
|
* @name Modal Route
|
|
42
74
|
* @description Indicates if the route should be displayed as a modal.
|
|
@@ -16,24 +16,116 @@
|
|
|
16
16
|
* };
|
|
17
17
|
*/
|
|
18
18
|
export interface IViteSettings {
|
|
19
|
+
/**
|
|
20
|
+
* When true, instructs the generator to produce client-only artifacts and
|
|
21
|
+
* avoid emitting server-side loader/action wiring (used for SPA builds).
|
|
22
|
+
*/
|
|
23
|
+
runSPAOnly?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Path to write generated wrapper files (e.g. `WrappedX-<hash>.tsx`). If
|
|
26
|
+
* not provided the generator will fall back to the `app` folder in the
|
|
27
|
+
* project root.
|
|
28
|
+
*/
|
|
29
|
+
outputDir?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The app directory path (where routes.ts is located). This is used to
|
|
32
|
+
* calculate relative paths for route modules. In Remix, this is typically
|
|
33
|
+
* set via `appDirectory` in the vite.config.ts remix plugin configuration.
|
|
34
|
+
* @default 'src' (relative to project root)
|
|
35
|
+
*/
|
|
36
|
+
appDirectory?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Disable generation of server loaders for routes. Useful to opt-out of
|
|
39
|
+
* loader wiring when the project prefers client-side data fetching.
|
|
40
|
+
*/
|
|
19
41
|
disableLoader?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Disable automatic loader generation for routes with middleware requirements
|
|
44
|
+
* (auth, authority, configurations, permissions). When true, loaders will not
|
|
45
|
+
* be generated automatically even when middleware conditions are present.
|
|
46
|
+
*/
|
|
47
|
+
disableLoaderMiddleware?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Disable generation of server action handlers for routes.
|
|
50
|
+
*/
|
|
20
51
|
disableAction?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Disable generation of client loader helpers. When true, client-side
|
|
54
|
+
* loader wrappers will not be emitted.
|
|
55
|
+
*/
|
|
21
56
|
disableClientLoader?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Disable generation of error boundary wrappers for routes.
|
|
59
|
+
*/
|
|
22
60
|
disableErrorBoundary?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Disable emitting link imports (e.g. stylesheets) for routes.
|
|
63
|
+
*/
|
|
23
64
|
disableLinks?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Disable emitting meta export helpers for routes.
|
|
67
|
+
*/
|
|
24
68
|
disableMeta?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Disable generation of hydrate fallback helpers used during SSR -> CSR
|
|
71
|
+
* transitions.
|
|
72
|
+
*/
|
|
25
73
|
disableHydrateFallback?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Disable generation of `shouldRevalidate` helpers on routes.
|
|
76
|
+
*/
|
|
26
77
|
disableShouldRevalidate?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Disable generating `handle` exports for routes.
|
|
80
|
+
*/
|
|
27
81
|
disableHandle?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Disable generation of `headers` export functions for routes.
|
|
84
|
+
*/
|
|
28
85
|
disableHeaders?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Disable generation of client-side action wrappers.
|
|
88
|
+
*/
|
|
29
89
|
disableClientAction?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* When true, the generator will omit any extra props merging into the
|
|
92
|
+
* generated wrapper component props.
|
|
93
|
+
*/
|
|
30
94
|
disableExtraProps?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Disable mapping or emission of client-side middleware shims.
|
|
97
|
+
*/
|
|
31
98
|
disableClientMiddlewares?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Disable server-side middleware execution for routes. When true, middleware
|
|
101
|
+
* such as auth, authority, configurations, and permissions will not be
|
|
102
|
+
* executed on the server.
|
|
103
|
+
*/
|
|
104
|
+
disableMiddleware?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Import statement for the layout component used in generated routes.tsx.
|
|
107
|
+
* Used when runSPAOnly is enabled to specify the layout wrapper component.
|
|
108
|
+
* @example "import { DashboardLayout } from '../src/layouts';"
|
|
109
|
+
*/
|
|
110
|
+
layoutImport?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Name of the layout component to use in generated routes.tsx.
|
|
113
|
+
* Used when runSPAOnly is enabled to wrap the routes.
|
|
114
|
+
* @default 'DashboardLayout'
|
|
115
|
+
*/
|
|
116
|
+
layoutComponent?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Component replacement configuration. When enabled, specific routes may
|
|
119
|
+
* be replaced with a different component path during wrapper generation.
|
|
120
|
+
*/
|
|
32
121
|
componentReplacement?: {
|
|
122
|
+
/** Enable component replacement feature. */
|
|
33
123
|
enabled?: boolean;
|
|
124
|
+
/** Map of route key -> replacement component path. */
|
|
34
125
|
replacements?: {
|
|
35
126
|
[routeKey: string]: string;
|
|
36
127
|
};
|
|
128
|
+
/** Routes to exclude from replacement even when a global rule exists. */
|
|
37
129
|
excludeRoutes?: string[];
|
|
38
130
|
};
|
|
39
131
|
/**
|
|
@@ -3,8 +3,10 @@ import { IAuthorityConfig } from './authority';
|
|
|
3
3
|
import { IRollupBuildGenerated } from './rollupRouteGenerated';
|
|
4
4
|
import { IViteSettings } from './viteSettings';
|
|
5
5
|
export interface IWrapperConfigPaths {
|
|
6
|
+
app?: string;
|
|
6
7
|
configPermissionWrapper?: string;
|
|
7
8
|
authMiddlware?: string;
|
|
9
|
+
spaAuthMiddleware?: string;
|
|
8
10
|
configurationMiddlewareExec?: string;
|
|
9
11
|
lifecycleMiddleware?: string;
|
|
10
12
|
middlewareExec?: string;
|
|
@@ -60,6 +62,12 @@ export interface IResourceParams {
|
|
|
60
62
|
* @description Fields missing from IWrapperOptions that exist in IOptions.
|
|
61
63
|
*/
|
|
62
64
|
export interface IGeneratedWrapperOptions {
|
|
65
|
+
/**
|
|
66
|
+
* @name Component Name
|
|
67
|
+
* @description The standardized component name used in both the wrapper file export
|
|
68
|
+
* and the routes.tsx import to ensure consistency.
|
|
69
|
+
*/
|
|
70
|
+
componentName?: string;
|
|
63
71
|
/**
|
|
64
72
|
* @name Wrapper Component Paths
|
|
65
73
|
* @description Array of wrapper component paths for consistent layout.
|
|
@@ -70,6 +78,18 @@ export interface IGeneratedWrapperOptions {
|
|
|
70
78
|
* @description Array of middleware functions for the route.
|
|
71
79
|
*/
|
|
72
80
|
middlewares?: any[];
|
|
81
|
+
/**
|
|
82
|
+
* @name Has Middleware
|
|
83
|
+
* @description Indicates if the route has middleware conditions that require execution.
|
|
84
|
+
* Calculated from requireAuth, middlewares, authority, configurations, and extraPermissions.
|
|
85
|
+
*/
|
|
86
|
+
hasMiddleware?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* @name Has Queries
|
|
89
|
+
* @description Indicates if the route has GraphQL queries defined.
|
|
90
|
+
* Calculated from the queries object.
|
|
91
|
+
*/
|
|
92
|
+
hasQueries?: boolean;
|
|
73
93
|
/**
|
|
74
94
|
* @name Client Middlewares
|
|
75
95
|
* @description Array of client-side middleware paths applied to the route.
|
|
@@ -122,6 +142,47 @@ export interface IGeneratedWrapperOptions {
|
|
|
122
142
|
* @description The file path to the route's component.
|
|
123
143
|
*/
|
|
124
144
|
componentPath?: string;
|
|
145
|
+
/**
|
|
146
|
+
* @name Generate SPA Component
|
|
147
|
+
* @description When true, instructs the rollup build process to generate a
|
|
148
|
+
* `.client.tsx` version of the component from the source `componentPath`.
|
|
149
|
+
* This auto-generated SPA component will be optimized for client-only usage.
|
|
150
|
+
*/
|
|
151
|
+
generateSPAComponent?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* @name Has SPA Component
|
|
154
|
+
* @description When true, indicates that a `.client.tsx` version of the component
|
|
155
|
+
* exists alongside the main component file. In SPA-only mode (`runSPAOnly`), the
|
|
156
|
+
* generator will use the `.client.tsx` file instead of the regular component.
|
|
157
|
+
* This allows you to provide optimized client-only versions of components for
|
|
158
|
+
* SPA builds while keeping SSR-compatible versions for regular builds.
|
|
159
|
+
* @example
|
|
160
|
+
* // If componentPath is '@pkg/lib/Dashboard.js' and hasSPAComponent is true,
|
|
161
|
+
* // SPA mode will use '@pkg/lib/Dashboard.client.tsx'
|
|
162
|
+
*/
|
|
163
|
+
hasSPAComponent?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* @name Client Only
|
|
166
|
+
* @description When true, indicates this route's component should be rendered
|
|
167
|
+
* only on the client (no server-side rendering). Use this when the component
|
|
168
|
+
* depends on browser globals (e.g. `window`, `document`, or third-party
|
|
169
|
+
* libraries like maps) and cannot safely run during SSR. This mirrors the
|
|
170
|
+
* `ClientOnly` pattern from `remix-utils` (render nothing on the server and
|
|
171
|
+
* hydrate on the client).
|
|
172
|
+
*
|
|
173
|
+
* For SSR safety you can provide `fallbackServerComponentPath` to render a
|
|
174
|
+
* simpler server-safe component during SSR while the real client component
|
|
175
|
+
* is used in the browser.
|
|
176
|
+
*/
|
|
177
|
+
clientOnly?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* @name Fallback Server Component Path
|
|
180
|
+
* @description Optional path to a server-side component to use as an SSR
|
|
181
|
+
* fallback when the primary component is client-only. This allows the
|
|
182
|
+
* generated wrappers to reference a server-safe component for server
|
|
183
|
+
* rendering while using the client component in the SPA bundle.
|
|
184
|
+
*/
|
|
185
|
+
fallbackServerComponentPath?: string;
|
|
125
186
|
/**
|
|
126
187
|
* @name Resource URI
|
|
127
188
|
* @description URI representing the resource associated with the route.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/core",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.4-alpha.2",
|
|
4
4
|
"description": "Common core for higher packages to depend on",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"watch": "yarn build:lib:watch"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"common": "8.2.
|
|
24
|
+
"common": "8.2.4-alpha.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@cdm-logger/core": ">=9.0.17"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "cfcc965f8ea96d4dc5ca00245c2dcca7d99f234d",
|
|
33
33
|
"typescript": {
|
|
34
34
|
"definition": "lib/index.d.ts"
|
|
35
35
|
}
|