@common-stack/rollup-vite-utils 4.0.1-alpha.11
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/LICENSE +21 -0
- package/README.md +50 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/types.d.ts +29 -0
- package/lib/rollup/index.d.ts +2 -0
- package/lib/rollup/rollupPluginGenerateJson.d.ts +10 -0
- package/lib/rollup/rollupPluginModifyLibFiles.d.ts +11 -0
- package/lib/vite-wrappers/index.d.ts +1 -0
- package/lib/vite-wrappers/json-wrappers.d.ts +3 -0
- package/lib/vite-wrappers/route-configuration.d.ts +17 -0
- package/lib/vite-wrappers/wrapperComponent.d.ts +3 -0
- package/lib/vite-wrappers/wrapperComponent.js +391 -0
- package/lib/vite-wrappers/wrapperComponent.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 CDMBase LLC.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# React Package
|
|
2
|
+
React components and containers
|
|
3
|
+
|
|
4
|
+
What does it include:
|
|
5
|
+
---
|
|
6
|
+
1. exported react pure components
|
|
7
|
+
2. exported react containers
|
|
8
|
+
3. Typescript 2.0.0 => ES6
|
|
9
|
+
4. unit testing with jest
|
|
10
|
+
|
|
11
|
+
Purpose:
|
|
12
|
+
---
|
|
13
|
+
This package can be installable in front-end webserver
|
|
14
|
+
|
|
15
|
+
Useful commands:
|
|
16
|
+
---
|
|
17
|
+
npm run build - build the library files
|
|
18
|
+
npm run test - run tests once
|
|
19
|
+
npm run test:watch - run tests in watchmode (Useful for development)
|
|
20
|
+
|
|
21
|
+
Files explained:
|
|
22
|
+
---
|
|
23
|
+
src - directory is used for typescript code that is part of the project
|
|
24
|
+
index.ts - Index file of the package. Consists of exported components and containers
|
|
25
|
+
index.spec.ts - Tests file for main
|
|
26
|
+
components - All pure components which don't depend on backend data or external state such as redux
|
|
27
|
+
index.ts - References all the exported components
|
|
28
|
+
containers - Components with data to render. Tightly coupled with redux.
|
|
29
|
+
index.ts - References all the exported containers
|
|
30
|
+
package.json - file is used to describe the library and packages that are required added under peer-dependencies section
|
|
31
|
+
tsconfig.json - configuration file for the library compilation
|
|
32
|
+
webpack.config.js - configuration file of the compilation automation process for the library
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Tutorials:
|
|
36
|
+
---
|
|
37
|
+
[react-jest-enzymes test](https://www.youtube.com/watch?v=bMmntkVM4wQ)
|
|
38
|
+
|
|
39
|
+
[testing react with enzyme tutorial](http://codeheaven.io/testing-react-components-with-enzyme/)
|
|
40
|
+
|
|
41
|
+
[react-redux-typescript-guide](https://github.com/piotrwitek/react-redux-typescript-guide)
|
|
42
|
+
|
|
43
|
+
Performance:
|
|
44
|
+
---
|
|
45
|
+
[Redux FAQ: Connecting multiple components](http://redux.js.org/docs/FAQ.html#react-multiple-components)
|
|
46
|
+
|
|
47
|
+
[React/Redux Links: Performance articles](https://github.com/markerikson/react-redux-links/blob/master/react-performance.md)
|
|
48
|
+
|
|
49
|
+
[React/Redux: Component re-rendering too often?](http://redux.js.org/docs/faq/ReactRedux.html#react-rendering-too-often)
|
|
50
|
+
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{getRootPath,wrapRouteComponent}from'./vite-wrappers/wrapperComponent.js';//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ILoaderReturnInfo {
|
|
2
|
+
keys: string[];
|
|
3
|
+
returnType: 'defer' | 'json';
|
|
4
|
+
hasOptions: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface IOptions {
|
|
7
|
+
requireAuth: boolean;
|
|
8
|
+
hasLoader: boolean;
|
|
9
|
+
hasAction: boolean;
|
|
10
|
+
hasClientLoader: boolean;
|
|
11
|
+
hasComponent: boolean;
|
|
12
|
+
hasErrorBoundary: boolean;
|
|
13
|
+
hasLinks: boolean;
|
|
14
|
+
hasMeta: boolean;
|
|
15
|
+
hasHydrateFallback: boolean;
|
|
16
|
+
hasShouldRevalidate: boolean;
|
|
17
|
+
hasHandle: boolean;
|
|
18
|
+
hasHeaders: boolean;
|
|
19
|
+
hasClientAction: boolean;
|
|
20
|
+
loaderReturnInfo: ILoaderReturnInfo;
|
|
21
|
+
suffix: string;
|
|
22
|
+
middlewares: any[];
|
|
23
|
+
clientMiddlewares: string[];
|
|
24
|
+
authority: any[];
|
|
25
|
+
extraProps: any;
|
|
26
|
+
authStrategy: boolean | string | null;
|
|
27
|
+
isResourceRoute: boolean;
|
|
28
|
+
queries: Record<string, Record<string, unknown>>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FilterPattern } from '@rollup/pluginutils';
|
|
2
|
+
interface PluginOptions {
|
|
3
|
+
include?: FilterPattern;
|
|
4
|
+
exclude?: FilterPattern;
|
|
5
|
+
outputDir?: string;
|
|
6
|
+
}
|
|
7
|
+
export default function modifyLibFilesPlugin(options?: PluginOptions): {
|
|
8
|
+
name: string;
|
|
9
|
+
writeBundle(outputOptions: any): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './wrapperComponent';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
export interface Options {
|
|
3
|
+
rootPath: string;
|
|
4
|
+
routesFileName?: string;
|
|
5
|
+
folderName?: string;
|
|
6
|
+
/**
|
|
7
|
+
* A list of package names under node_modules that will contain the locales directory
|
|
8
|
+
* It can accept the glob value as well For Example packages: ['@dummy-package/*-browser']
|
|
9
|
+
*
|
|
10
|
+
* Default: 'locales'
|
|
11
|
+
*/
|
|
12
|
+
packages: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare const virtualModuleId = "virtual:routes-configuration";
|
|
15
|
+
export declare const resolvedVirtualModuleId = "\0virtual:routes-configuration";
|
|
16
|
+
declare const factory: (options: Options) => Plugin<any>;
|
|
17
|
+
export default factory;
|
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import*as fs from'fs';import*as path from'path';import {createRequire}from'module';const permissionWrapperImportPath = '@adminide-stack/platform-browser/lib/components/Permission/WithPermission.js';
|
|
2
|
+
const authMiddlwarePath = '@adminide-stack/user-auth0-client/lib/auth/authValidatorMiddleware.js';
|
|
3
|
+
const lifecyclePath = '@adminide-stack/platform-client/lib/middleware/lifecycleMiddleware.js';
|
|
4
|
+
const middleWareExecPath = '../tools/loaderWithMiddleware.js';
|
|
5
|
+
const clientMiddlewareExecPath = '../tools/clientLoaderWithMiddleware.js';
|
|
6
|
+
// Utility function to get the project's root directory.
|
|
7
|
+
function getRootPath() {
|
|
8
|
+
return process.cwd();
|
|
9
|
+
}
|
|
10
|
+
// New function to handle file writing
|
|
11
|
+
function writeComponentToFile(filePath, content) {
|
|
12
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
13
|
+
}
|
|
14
|
+
function generateExports(options) {
|
|
15
|
+
let exports = '';
|
|
16
|
+
const hasMiddleware = options.requireAuth || options.middlewares.length > 0 || options.authority.length > 0;
|
|
17
|
+
if (hasMiddleware || options.hasLoader) {
|
|
18
|
+
const getMiddlewareOptions = () => {
|
|
19
|
+
if (options.requireAuth) {
|
|
20
|
+
const val = typeof options.authStrategy === 'boolean' ? options.authStrategy : `'${options.authStrategy}'`;
|
|
21
|
+
return `{authStrategy: ${val}}`;
|
|
22
|
+
}
|
|
23
|
+
return '{}';
|
|
24
|
+
};
|
|
25
|
+
exports += `
|
|
26
|
+
export async function loader(params) {
|
|
27
|
+
${hasMiddleware ? 'const middlewareStack = [];' : ''}
|
|
28
|
+
const middlewareOptions = ${getMiddlewareOptions()}
|
|
29
|
+
${options.requireAuth ? 'middlewareStack.push({ name: "auth", func: authMiddleware });' : ''}
|
|
30
|
+
${generateMiddlewarePushes(options)}
|
|
31
|
+
${options.authority?.length > 0
|
|
32
|
+
? 'middlewareStack.push({ name: "lifecycle", func: lifecycleMiddleware });\n' +
|
|
33
|
+
' middlewareStack.push({ name: "permission", func: permissionMiddleware });\n'
|
|
34
|
+
: ''}
|
|
35
|
+
${hasMiddleware
|
|
36
|
+
? 'let middlewareData = {};\n' +
|
|
37
|
+
' if (middlewareStack.length > 0) {\n' +
|
|
38
|
+
' middlewareData = await loaderWithMiddleware(params, middlewareOptions, middlewareStack) || {};\n' +
|
|
39
|
+
' }\n' +
|
|
40
|
+
' const { permissions = null, ...rest } = middlewareData;\n'
|
|
41
|
+
: ''}
|
|
42
|
+
let hasPermissions = true;
|
|
43
|
+
${generateHasPermission(options)}
|
|
44
|
+
${options.hasLoader && options.loaderReturnInfo?.keys?.length > 0
|
|
45
|
+
? `let loaderResult = hasPermissions && await loaderFunc(params) || { data: [] };\n
|
|
46
|
+
let loaderData = loaderResult.data || [];
|
|
47
|
+
${options.loaderReturnInfo.hasOptions ? 'let respondOptions = loaderResult.options || null;' : ''}
|
|
48
|
+
`
|
|
49
|
+
: options.hasLoader
|
|
50
|
+
? `let loaderData = hasPermissions && await loaderFunc(params) || { data: [] };\n
|
|
51
|
+
`
|
|
52
|
+
: ''}
|
|
53
|
+
|
|
54
|
+
${generateLoaderReturnLogic(options)}
|
|
55
|
+
${options.loaderReturnInfo && options.loaderReturnInfo?.keys?.length > 0
|
|
56
|
+
? `return ${options.loaderReturnInfo.returnType}({
|
|
57
|
+
...returnObject,
|
|
58
|
+
...${hasMiddleware ? `{ permissions, dataContext: rest }` : `{}`}
|
|
59
|
+
}${options.loaderReturnInfo?.hasOptions ? `, respondOptions` : ''});`
|
|
60
|
+
: `
|
|
61
|
+
${options.hasLoader && !hasMiddleware
|
|
62
|
+
? 'return loaderData;'
|
|
63
|
+
: `return {
|
|
64
|
+
${options.hasLoader ? '...loaderData, ' : ''}
|
|
65
|
+
${hasMiddleware ? 'permissions, dataContext: rest' : ''}
|
|
66
|
+
};`}`}
|
|
67
|
+
}`;
|
|
68
|
+
}
|
|
69
|
+
if (options.hasAction) {
|
|
70
|
+
exports += `
|
|
71
|
+
export async function action(params) {
|
|
72
|
+
return await actionFunc(params);
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
if (Object.keys(options.queries ?? {}).length > 0) {
|
|
77
|
+
exports += `
|
|
78
|
+
const defaultClientLoader = async ({params, serverLoader})=>{
|
|
79
|
+
const client = window.__APOLLO_CLIENT__;
|
|
80
|
+
try {
|
|
81
|
+
const getKey = (documentName:string)=> camelCase(documentName).replace('Document','')
|
|
82
|
+
const queries = ${Object.keys(options.queries).length === 0
|
|
83
|
+
? '{}'
|
|
84
|
+
: Object.entries(options.queries).reduce((acc, [key, value], index) => `${acc}${key}:${value}${index + 1 === Object.keys(options.queries).length ? '}' : ','}`, '{')};
|
|
85
|
+
const queryKeys: string[] = ${JSON.stringify(options.loaderReturnInfo?.keys ?? [])};
|
|
86
|
+
let shouldCallServerLoader = false;
|
|
87
|
+
let response = {};
|
|
88
|
+
let cachedData, cacheKey;
|
|
89
|
+
${Object.keys(options.queries)
|
|
90
|
+
.map((queryDoc, index) => `
|
|
91
|
+
cachedData = client.cache.readQuery({
|
|
92
|
+
query: ${queryDoc},
|
|
93
|
+
variables: queries['${queryDoc}'],
|
|
94
|
+
});
|
|
95
|
+
cacheKey = getKey('${queryDoc}');
|
|
96
|
+
if(!cachedData){
|
|
97
|
+
shouldCallServerLoader = true;
|
|
98
|
+
}
|
|
99
|
+
if(cachedData && cachedData[cacheKey]){
|
|
100
|
+
response[queryKeys[${index}]] = Promise.resolve(cachedData[cacheKey]);
|
|
101
|
+
}
|
|
102
|
+
`)
|
|
103
|
+
.join('')}
|
|
104
|
+
if(!shouldCallServerLoader) return response;
|
|
105
|
+
const serverData = await serverLoader();
|
|
106
|
+
let queryKey;
|
|
107
|
+
${Object.keys(options.queries)
|
|
108
|
+
.map((queryDoc, index) => `
|
|
109
|
+
queryKey = queryKeys[${index}];
|
|
110
|
+
if(!serverData[queryKey].then){
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
serverData[queryKey].then(({ data }) => {
|
|
114
|
+
client.cache.writeQuery({
|
|
115
|
+
query: ${queryDoc},
|
|
116
|
+
variables: queries['${queryDoc}'],
|
|
117
|
+
data,
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
`)
|
|
121
|
+
.join('')}
|
|
122
|
+
return serverData;
|
|
123
|
+
}catch(err){
|
|
124
|
+
console.error('Error in defaultClientLoader',err);
|
|
125
|
+
}
|
|
126
|
+
}`;
|
|
127
|
+
}
|
|
128
|
+
if (options.hasClientLoader || Object.keys(options.queries ?? {}).length > 0) {
|
|
129
|
+
exports += `
|
|
130
|
+
export async function clientLoader(params) {
|
|
131
|
+
${hasMiddleware ? 'const middlewareStack = [];' : ''}
|
|
132
|
+
${options.authority?.length > 0 ? 'middlewareStack.push({ name: "permissions", func: permissionMiddleware });\n' : ''}
|
|
133
|
+
${(options.clientMiddlewares ?? [])
|
|
134
|
+
?.map((_, index) => `middlewareStack.push({ name: "middleware${index + 1}" , func: clientMiddleware${index + 1} });\n`)
|
|
135
|
+
.join('')}
|
|
136
|
+
${hasMiddleware
|
|
137
|
+
? 'const apolloClient = window.__APOLLO_CLIENT__;\n' +
|
|
138
|
+
' const { permissions = null, ...rest } = middlewareStack.length ? await clientLoaderWithMiddleware({...params, context:{ apolloClient }}, {}, middlewareStack) : {}\n'
|
|
139
|
+
: ''}
|
|
140
|
+
let hasPermissions = true
|
|
141
|
+
${generateHasPermission(options)}
|
|
142
|
+
let defaultLoaderData = ${Object.keys(options.queries ?? {}).length > 0 ? `hasPermissions ? await defaultClientLoader(params) : {}` : '{}'};
|
|
143
|
+
let loaderData = ${options.hasClientLoader ? ` hasPermissions ? await clientLoaderFunc(params) : {}` : '{}'};
|
|
144
|
+
console.log(
|
|
145
|
+
{ ...defaultLoaderData, ...loaderData , ...${hasMiddleware ? `{ permissions, dataContext: rest }` : `{}`}}
|
|
146
|
+
)
|
|
147
|
+
return { ...${hasMiddleware ? `{ permissions, dataContext: rest }` : `{}`}, ...defaultLoaderData, ...loaderData };
|
|
148
|
+
}
|
|
149
|
+
clientLoader.hydrate = true;
|
|
150
|
+
`;
|
|
151
|
+
}
|
|
152
|
+
if (options.hasClientAction) {
|
|
153
|
+
exports += `
|
|
154
|
+
export async function clientAction(params) {
|
|
155
|
+
return await clientActionFunc(params);
|
|
156
|
+
}
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
if (options.hasHandle) {
|
|
160
|
+
exports += `
|
|
161
|
+
export const handle = handleObj
|
|
162
|
+
`;
|
|
163
|
+
}
|
|
164
|
+
if (options.hasLinks) {
|
|
165
|
+
exports += `
|
|
166
|
+
export function links(params) {
|
|
167
|
+
return linksFunc(params);
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
}
|
|
171
|
+
if (options.hasMeta) {
|
|
172
|
+
exports += `
|
|
173
|
+
export function meta(params) {
|
|
174
|
+
return metaFunc(params);
|
|
175
|
+
}
|
|
176
|
+
`;
|
|
177
|
+
}
|
|
178
|
+
if (options.hasShouldRevalidate) {
|
|
179
|
+
exports += `
|
|
180
|
+
export function shouldRevalidate(params) {
|
|
181
|
+
return shouldRevalidateFunc(params);
|
|
182
|
+
}
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
if (options.hasHeaders) {
|
|
186
|
+
exports += `
|
|
187
|
+
export function headers(params) {
|
|
188
|
+
return headersFunc(params);
|
|
189
|
+
}
|
|
190
|
+
`;
|
|
191
|
+
}
|
|
192
|
+
if (options.hasHydrateFallback) {
|
|
193
|
+
exports += `
|
|
194
|
+
export function HydrateFallback(params) {
|
|
195
|
+
return HydrateFallbackFunc(params);
|
|
196
|
+
}
|
|
197
|
+
`;
|
|
198
|
+
}
|
|
199
|
+
if (options.hasErrorBoundary) {
|
|
200
|
+
exports += `
|
|
201
|
+
export function ErrorBoundary(params) {
|
|
202
|
+
return ErrorBoundaryFunc(params);
|
|
203
|
+
}
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
return exports;
|
|
207
|
+
}
|
|
208
|
+
function generateMiddlewarePushes(options) {
|
|
209
|
+
return options.middlewares
|
|
210
|
+
.map((_, index) => `middlewareStack.push({ name: "middleware${index + 1}", func: middleware${index + 1} });`)
|
|
211
|
+
.join('\n ');
|
|
212
|
+
}
|
|
213
|
+
function generateHasPermission(options) {
|
|
214
|
+
if (options.authority?.length > 0 && options.hasLoader) {
|
|
215
|
+
return `
|
|
216
|
+
if (permissions !== null) {
|
|
217
|
+
// Filter permissions based on authority keys
|
|
218
|
+
const permissionKeys = ${JSON.stringify(options.authority)};
|
|
219
|
+
hasPermissions = permissionKeys.some(key => ['Allow'].includes(get(permissions?.resolveConfiguration, key)));
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
}
|
|
223
|
+
return '';
|
|
224
|
+
}
|
|
225
|
+
function generateLoaderReturnLogic(options) {
|
|
226
|
+
if (options.loaderReturnInfo?.keys?.length > 0) {
|
|
227
|
+
// Create deferred objects by directly assigning each key to its corresponding index in loaderData
|
|
228
|
+
const deferredAssignments = options.loaderReturnInfo?.keys
|
|
229
|
+
.map((key, index) => ` returnObject['${key}'] = loaderData[${index}];`)
|
|
230
|
+
.join('\n ');
|
|
231
|
+
return `
|
|
232
|
+
const returnObject = {};
|
|
233
|
+
if (hasPermissions) {
|
|
234
|
+
${deferredAssignments}
|
|
235
|
+
}
|
|
236
|
+
`;
|
|
237
|
+
}
|
|
238
|
+
return '';
|
|
239
|
+
}
|
|
240
|
+
function generateLoaderDataHook(options) {
|
|
241
|
+
if (options.hasClientLoader || options.hasLoader || options.authority.length > 0) {
|
|
242
|
+
return `const loaderData = useLoaderData();\n`;
|
|
243
|
+
}
|
|
244
|
+
return '';
|
|
245
|
+
}
|
|
246
|
+
function generateLoaderDataProp(options) {
|
|
247
|
+
if (options.hasClientLoader || options.hasLoader || options.authority.length > 0) {
|
|
248
|
+
return 'loaderData={loaderData}';
|
|
249
|
+
}
|
|
250
|
+
return '';
|
|
251
|
+
}
|
|
252
|
+
function wrapComponent(currentFilePath, wrapperPaths, options) {
|
|
253
|
+
let imports = `import * as React from 'react';\n`;
|
|
254
|
+
let componentImports = ``;
|
|
255
|
+
const additionalImports = [];
|
|
256
|
+
if (options.hasLoader)
|
|
257
|
+
additionalImports.push('loader as loaderFunc');
|
|
258
|
+
if (options.hasAction)
|
|
259
|
+
additionalImports.push('action as actionFunc');
|
|
260
|
+
if (options.hasClientLoader)
|
|
261
|
+
additionalImports.push('clientLoader as clientLoaderFunc');
|
|
262
|
+
if (options.hasClientAction)
|
|
263
|
+
additionalImports.push('clientAction as clientActionFunc');
|
|
264
|
+
if (options.hasHandle)
|
|
265
|
+
additionalImports.push('handle as handleObj');
|
|
266
|
+
if (options.hasLinks)
|
|
267
|
+
additionalImports.push('links as linksFunc');
|
|
268
|
+
if (options.hasMeta)
|
|
269
|
+
additionalImports.push('meta as metaFunc');
|
|
270
|
+
if (options.hasShouldRevalidate)
|
|
271
|
+
additionalImports.push('shouldRevalidate as shouldRevalidateFunc');
|
|
272
|
+
if (options.hasHeaders)
|
|
273
|
+
additionalImports.push('headers as headersFunc');
|
|
274
|
+
if (options.hasHydrateFallback)
|
|
275
|
+
additionalImports.push('HydrateFallback as HydrateFallbackFunc');
|
|
276
|
+
if (options.hasErrorBoundary)
|
|
277
|
+
additionalImports.push('ErrorBoundary as ErrorBoundaryFunc');
|
|
278
|
+
if (additionalImports.length > 0 || options.hasComponent) {
|
|
279
|
+
const namedImports = additionalImports.join(', ');
|
|
280
|
+
// Determine how to construct the import statement based on whether there are named imports and a default import
|
|
281
|
+
componentImports += `import ${options.hasComponent ? `OriginalComponent${namedImports ? ', ' : ''}` : ''}${namedImports ? `{ ${namedImports} }` : ''} from '${currentFilePath}';\n`;
|
|
282
|
+
}
|
|
283
|
+
imports += componentImports;
|
|
284
|
+
if (options.hasComponent && (options.hasClientLoader || options.hasLoader || options.authority.length > 0)) {
|
|
285
|
+
imports += `import { useLoaderData } from '@remix-run/react';\n`;
|
|
286
|
+
}
|
|
287
|
+
if (options.loaderReturnInfo) {
|
|
288
|
+
if (options.loaderReturnInfo.returnType === 'defer') {
|
|
289
|
+
imports += `import { defer } from '@remix-run/react';\n`;
|
|
290
|
+
}
|
|
291
|
+
else if (options.loaderReturnInfo.returnType === 'json') {
|
|
292
|
+
imports += `import { json } from '@remix-run/react';\n`;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (options.requireAuth) {
|
|
296
|
+
imports += `import { middleware as authMiddleware } from '${authMiddlwarePath}';\n`;
|
|
297
|
+
}
|
|
298
|
+
if (options.authority.length > 0) {
|
|
299
|
+
imports += `import { middleware as lifecycleMiddleware } from '${lifecyclePath}';\nimport { get } from 'lodash-es';\n`;
|
|
300
|
+
}
|
|
301
|
+
if (Object.keys(options.queries ?? {}).length > 0) {
|
|
302
|
+
imports += `import { camelCase } from 'lodash-es';\n`;
|
|
303
|
+
const [nameSpace, packageName] = currentFilePath.split('/');
|
|
304
|
+
const require = createRequire(import.meta.url);
|
|
305
|
+
try {
|
|
306
|
+
if (require.resolve(`${nameSpace}/${packageName.replace('browser', 'client')}`)) {
|
|
307
|
+
imports += `import { ${Object.keys(options.queries).join(',')} } from '${nameSpace}/${packageName.replace('browser', 'client')}';\n`;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
catch (e) {
|
|
311
|
+
if (require.resolve(`${nameSpace}/${packageName.replace('browser', 'core')}`)) {
|
|
312
|
+
imports += `import { ${Object.keys(options.queries).join(',')} } from '${nameSpace}/${packageName.replace('browser', 'core')}';\n`;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (options.requireAuth || options.authority.length > 0 || options.middlewares.length > 0) {
|
|
317
|
+
imports += `import { loaderWithMiddleware } from '${middleWareExecPath}';\n`;
|
|
318
|
+
}
|
|
319
|
+
// Construct imports for additional custom middleware
|
|
320
|
+
// Dynamically import middleware with incremented names
|
|
321
|
+
if (options.middlewares) {
|
|
322
|
+
options.middlewares.forEach((middlewarePath, index) => {
|
|
323
|
+
imports += `import { middleware as middleware${index + 1} } from '${middlewarePath}';\n`;
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
if (options.clientMiddlewares?.length) {
|
|
327
|
+
options.clientMiddlewares.forEach((middlewarePath, index) => {
|
|
328
|
+
imports += `import { middleware as clientMiddleware${index + 1} } from '${middlewarePath}';\n`;
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
if (options.hasClientLoader || Object.keys(options.queries ?? {}).length || options.clientMiddlewares?.length) {
|
|
332
|
+
imports += `import { clientLoaderWithMiddleware } from '${clientMiddlewareExecPath}';\n`;
|
|
333
|
+
}
|
|
334
|
+
let componentLogic = ``;
|
|
335
|
+
if (options.hasComponent) {
|
|
336
|
+
let wrappersStart = '';
|
|
337
|
+
let wrappersEnd = '';
|
|
338
|
+
wrapperPaths.forEach((wrapperPath, index) => {
|
|
339
|
+
const wrapperComponentName = `Wrapper${index + 1}`;
|
|
340
|
+
if (wrapperPath === '$permissionWrapper') {
|
|
341
|
+
imports += `import { WithPermissionBehaviour, WithPermissionContainer, middleware as permissionMiddleware } from '${permissionWrapperImportPath}';\n`;
|
|
342
|
+
wrappersStart = `<WithPermissionContainer behaviour={WithPermissionBehaviour.showUnAuthorized} permissionKeys={${JSON.stringify(options.authority)}} permissions={props.loaderData.permissions}>${wrappersStart}`;
|
|
343
|
+
wrappersEnd += `</WithPermissionContainer>`;
|
|
344
|
+
}
|
|
345
|
+
else if (wrapperPath === '$clientOnlyWrapper') {
|
|
346
|
+
imports += `import { ClientOnly } from 'remix-utils/client-only';\n`;
|
|
347
|
+
wrappersStart = `<ClientOnly>${wrappersStart}`;
|
|
348
|
+
wrappersEnd += `</ClientOnly>`;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
imports += `import ${wrapperComponentName} from '${wrapperPath}';\n`;
|
|
352
|
+
wrappersStart += `<${wrapperComponentName} {...props}>`;
|
|
353
|
+
wrappersEnd = `</${wrapperComponentName}>${wrappersEnd}`;
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
componentLogic = `
|
|
357
|
+
const EnhancedComponent = (props) => {
|
|
358
|
+
return ${wrappersStart}<OriginalComponent {...props} />${wrappersEnd};
|
|
359
|
+
};
|
|
360
|
+
export default function Component(ownProps) {
|
|
361
|
+
${generateLoaderDataHook(options)}
|
|
362
|
+
const props = {...ownProps, ...${JSON.stringify(options.extraProps)}};
|
|
363
|
+
return <EnhancedComponent {...props} ${generateLoaderDataProp(options)} />;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
`;
|
|
367
|
+
}
|
|
368
|
+
componentLogic += `${generateExports(options)}`;
|
|
369
|
+
return imports + componentLogic;
|
|
370
|
+
}
|
|
371
|
+
function wrapRouteComponent(file, wrapperPaths = [], options) {
|
|
372
|
+
const defaultOptions = {
|
|
373
|
+
requireAuth: false,
|
|
374
|
+
hasLoader: false,
|
|
375
|
+
hasAction: false,
|
|
376
|
+
hasClientLoader: false,
|
|
377
|
+
hasClientAction: false,
|
|
378
|
+
middlewares: [],
|
|
379
|
+
suffix: '',
|
|
380
|
+
authority: [],
|
|
381
|
+
extraProps: {},
|
|
382
|
+
queries: {},
|
|
383
|
+
};
|
|
384
|
+
const basePath = path.join(getRootPath(), 'node-modules');
|
|
385
|
+
let fileName = path.basename(file, '.js');
|
|
386
|
+
fileName = `Wrapped${fileName}-${options?.suffix}.tsx`;
|
|
387
|
+
const newFilePath = path.join(getRootPath(), 'app', fileName);
|
|
388
|
+
const wrappedContent = wrapComponent(file, wrapperPaths, { ...defaultOptions, ...options });
|
|
389
|
+
writeComponentToFile(newFilePath, wrappedContent);
|
|
390
|
+
return path.relative(basePath, newFilePath);
|
|
391
|
+
}export{getRootPath,wrapRouteComponent};//# sourceMappingURL=wrapperComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapperComponent.js","sources":["../../src/vite-wrappers/wrapperComponent.ts"],"sourcesContent":[null],"names":[],"mappings":"mFAKA,MAAM,2BAA2B,GAAG,8EAA8E,CAAC;AACnH,MAAM,iBAAiB,GAAG,uEAAuE,CAAC;AAClG,MAAM,aAAa,GAAG,uEAAuE,CAAC;AAC9F,MAAM,kBAAkB,GAAG,kCAAkC,CAAC;AAC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,CAAC,CAAC;AAExG,IAAA,oBAAoB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IAClD,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAChD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@common-stack/rollup-vite-utils",
|
|
3
|
+
"version": "4.0.1-alpha.11",
|
|
4
|
+
"description": "Client Module for react app",
|
|
5
|
+
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/cdmbase/fullstack-pro/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/cdmbase/fullstack-pro.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "CDMBase LLC",
|
|
15
|
+
"main": "lib/index.js",
|
|
16
|
+
"module": "lib/index.js",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"react-native": "lib/index.native.js",
|
|
19
|
+
"typings": "lib/index.d.ts",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "npm run build:clean && npm run build:lib",
|
|
22
|
+
"build:clean": "rimraf lib",
|
|
23
|
+
"build:lib": "rollup -c rollup.config.mjs",
|
|
24
|
+
"build:lib:watch": "npm run build:lib -- --watch",
|
|
25
|
+
"jest": "./node_modules/.bin/jest",
|
|
26
|
+
"prepublish": "npm run build",
|
|
27
|
+
"test": "jest",
|
|
28
|
+
"test:debug": "npm test -- --runInBand",
|
|
29
|
+
"test:watch": "npm test -- --watch",
|
|
30
|
+
"watch": "npm run build:lib:watch"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@common-stack/client-react": "4.0.1-alpha.11",
|
|
34
|
+
"@common-stack/core": "4.0.1-alpha.11"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"jest-fetch-mock": "^3.0.3",
|
|
38
|
+
"vite": "^5.2.12"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"@apollo/client": ">=3.0.0",
|
|
42
|
+
"@remix-run/react": "^2.9.2",
|
|
43
|
+
"react": ">=16.8.6",
|
|
44
|
+
"react-dom": ">=16.8.6",
|
|
45
|
+
"react-router": ">=6.0.0",
|
|
46
|
+
"redux": ">=4.0.1"
|
|
47
|
+
},
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"typescript": {
|
|
52
|
+
"definition": "lib/index.d.ts"
|
|
53
|
+
},
|
|
54
|
+
"gitHead": "6cf439a9ad8f608c93c119d38ce474feca88998b"
|
|
55
|
+
}
|