@common-stack/rollup-vite-utils 6.0.6-alpha.9 → 6.0.6-alpha.91
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/lib/config-schema.cjs +111 -0
- package/lib/config-schema.cjs.map +1 -0
- package/lib/config-schema.js +111 -0
- package/lib/config-schema.js.map +1 -0
- package/lib/constants/constants.cjs +2 -1
- package/lib/constants/constants.cjs.map +1 -1
- package/lib/constants/constants.d.ts +1 -0
- package/lib/constants/constants.js +2 -1
- package/lib/constants/constants.js.map +1 -1
- package/lib/default-config.json.cjs +42 -4
- package/lib/default-config.json.cjs.map +1 -1
- package/lib/default-config.json.js +42 -4
- package/lib/default-config.json.js.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -1
- package/lib/interfaces/rollup.d.ts +1 -0
- package/lib/preStartup/configLoader/configLoader.cjs +38 -6
- package/lib/preStartup/configLoader/configLoader.cjs.map +1 -1
- package/lib/preStartup/configLoader/configLoader.d.ts +3 -3
- package/lib/preStartup/configLoader/configLoader.js +38 -6
- package/lib/preStartup/configLoader/configLoader.js.map +1 -1
- package/lib/preStartup/configLoader/index.cjs +1 -1
- package/lib/preStartup/configLoader/index.cjs.map +1 -1
- package/lib/preStartup/configLoader/index.js +1 -1
- package/lib/preStartup/configLoader/index.js.map +1 -1
- package/lib/preStartup/copyIfVersionChanged.cjs +8 -2
- package/lib/preStartup/copyIfVersionChanged.cjs.map +1 -1
- package/lib/preStartup/copyIfVersionChanged.js +8 -2
- package/lib/preStartup/copyIfVersionChanged.js.map +1 -1
- package/lib/rollup/index.d.ts +1 -0
- package/lib/rollup/modifyLibFiles/extractGraphQLQueries.cjs +39 -10
- package/lib/rollup/modifyLibFiles/extractGraphQLQueries.cjs.map +1 -1
- package/lib/rollup/modifyLibFiles/extractGraphQLQueries.js +39 -10
- package/lib/rollup/modifyLibFiles/extractGraphQLQueries.js.map +1 -1
- package/lib/rollup/modifyLibFiles/fixtures/compute1/TestComponent.d.ts +6 -0
- package/lib/rollup/modifyLibFiles/fixtures/compute1/TestDeferComponent.d.ts +10 -0
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.cjs +211 -141
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.cjs.map +1 -1
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.d.ts +21 -0
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.js +211 -141
- package/lib/rollup/modifyLibFiles/handleComponentOrDialog.js.map +1 -1
- package/lib/rollup/modifyLibFiles/handleImportPaths.cjs +4 -3
- package/lib/rollup/modifyLibFiles/handleImportPaths.cjs.map +1 -1
- package/lib/rollup/modifyLibFiles/handleImportPaths.js +4 -3
- package/lib/rollup/modifyLibFiles/handleImportPaths.js.map +1 -1
- package/lib/rollup/modifyLibFiles/handleLoaderReturn.cjs +86 -0
- package/lib/rollup/modifyLibFiles/handleLoaderReturn.cjs.map +1 -0
- package/lib/rollup/modifyLibFiles/handleLoaderReturn.d.ts +11 -0
- package/lib/rollup/modifyLibFiles/handleLoaderReturn.js +86 -0
- package/lib/rollup/modifyLibFiles/handleLoaderReturn.js.map +1 -0
- package/lib/rollup/modifyLibFiles/handleLoaderReturn.test.d.ts +1 -0
- package/lib/rollup/modifyLibFiles/utils.cjs +7 -7
- package/lib/rollup/modifyLibFiles/utils.cjs.map +1 -1
- package/lib/rollup/modifyLibFiles/utils.d.ts +1 -1
- package/lib/rollup/modifyLibFiles/utils.js +7 -7
- package/lib/rollup/modifyLibFiles/utils.js.map +1 -1
- package/lib/rollup/rollupPluginGenerateJson.cjs +2 -3
- package/lib/rollup/rollupPluginGenerateJson.cjs.map +1 -1
- package/lib/rollup/rollupPluginGenerateJson.js +2 -3
- package/lib/rollup/rollupPluginGenerateJson.js.map +1 -1
- package/lib/rollup/rollupPluginModifyLibFiles.cjs +25 -14
- package/lib/rollup/rollupPluginModifyLibFiles.cjs.map +1 -1
- package/lib/rollup/rollupPluginModifyLibFiles.js +25 -14
- package/lib/rollup/rollupPluginModifyLibFiles.js.map +1 -1
- package/lib/rollup/rollupPluginModifyLibFiles.test.d.ts +1 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.cjs +122 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.cjs.map +1 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.d.ts +1 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.js +122 -0
- package/lib/rollup/rollupPluginUpdateFromConfig.js.map +1 -0
- package/lib/utils/deepMerge.cjs +61 -0
- package/lib/utils/deepMerge.cjs.map +1 -0
- package/lib/utils/deepMerge.d.ts +1 -0
- package/lib/utils/deepMerge.js +61 -0
- package/lib/utils/deepMerge.js.map +1 -0
- package/lib/utils/getAllCDECodeConfig.cjs +18 -0
- package/lib/utils/getAllCDECodeConfig.cjs.map +1 -0
- package/lib/utils/getAllCDECodeConfig.d.ts +1 -0
- package/lib/utils/getAllCDECodeConfig.js +18 -0
- package/lib/utils/getAllCDECodeConfig.js.map +1 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/parseUtility.d.ts +3 -0
- package/lib/utils/setupConfig.cjs +6 -65
- package/lib/utils/setupConfig.cjs.map +1 -1
- package/lib/utils/setupConfig.d.ts +1 -2
- package/lib/utils/setupConfig.js +6 -65
- package/lib/utils/setupConfig.js.map +1 -1
- package/lib/utils/utils.cjs +25 -1
- package/lib/utils/utils.cjs.map +1 -1
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.js +25 -1
- package/lib/utils/utils.js.map +1 -1
- package/lib/utils/verifyConfig.cjs +13 -0
- package/lib/utils/verifyConfig.cjs.map +1 -0
- package/lib/utils/verifyConfig.d.ts +2 -0
- package/lib/utils/verifyConfig.js +13 -0
- package/lib/utils/verifyConfig.js.map +1 -0
- package/lib/utils/withErrorHandleUtil.cjs +3 -7
- package/lib/utils/withErrorHandleUtil.cjs.map +1 -1
- package/lib/utils/withErrorHandleUtil.js +3 -7
- package/lib/utils/withErrorHandleUtil.js.map +1 -1
- package/lib/vite-wrappers/custom-routes.cjs +44 -0
- package/lib/vite-wrappers/custom-routes.cjs.map +1 -0
- package/lib/vite-wrappers/custom-routes.d.ts +2 -0
- package/lib/vite-wrappers/custom-routes.js +44 -0
- package/lib/vite-wrappers/custom-routes.js.map +1 -0
- package/lib/vite-wrappers/generators/clientLoaderGenerator.cjs +159 -0
- package/lib/vite-wrappers/generators/clientLoaderGenerator.cjs.map +1 -0
- package/lib/vite-wrappers/generators/clientLoaderGenerator.d.ts +17 -0
- package/lib/vite-wrappers/generators/clientLoaderGenerator.js +159 -0
- package/lib/vite-wrappers/generators/clientLoaderGenerator.js.map +1 -0
- package/lib/vite-wrappers/generators/clientLoaderGenerator.test.d.ts +1 -0
- package/lib/vite-wrappers/generators/generateHasConfiguration.cjs +20 -0
- package/lib/vite-wrappers/generators/generateHasConfiguration.cjs.map +1 -0
- package/lib/vite-wrappers/generators/generateHasConfiguration.d.ts +10 -0
- package/lib/vite-wrappers/generators/generateHasConfiguration.js +20 -0
- package/lib/vite-wrappers/generators/generateHasConfiguration.js.map +1 -0
- package/lib/vite-wrappers/generators/generateHasPermission.cjs +29 -0
- package/lib/vite-wrappers/generators/generateHasPermission.cjs.map +1 -0
- package/lib/vite-wrappers/generators/generateHasPermission.d.ts +9 -0
- package/lib/vite-wrappers/generators/generateHasPermission.js +29 -0
- package/lib/vite-wrappers/generators/generateHasPermission.js.map +1 -0
- package/lib/vite-wrappers/generators/generateHasPermission.test.d.ts +1 -0
- package/lib/vite-wrappers/generators/loaderGenerator.cjs +157 -0
- package/lib/vite-wrappers/generators/loaderGenerator.cjs.map +1 -0
- package/lib/vite-wrappers/generators/loaderGenerator.d.ts +36 -0
- package/lib/vite-wrappers/generators/loaderGenerator.js +157 -0
- package/lib/vite-wrappers/generators/loaderGenerator.js.map +1 -0
- package/lib/vite-wrappers/generators/loaderGenerator.test.d.ts +1 -0
- package/lib/vite-wrappers/generators/serverQueryLoaderGenerator.cjs +40 -0
- package/lib/vite-wrappers/generators/serverQueryLoaderGenerator.cjs.map +1 -0
- package/lib/vite-wrappers/generators/serverQueryLoaderGenerator.d.ts +10 -0
- package/lib/vite-wrappers/generators/serverQueryLoaderGenerator.js +40 -0
- package/lib/vite-wrappers/generators/serverQueryLoaderGenerator.js.map +1 -0
- package/lib/vite-wrappers/generators/serverQueryLoaderGenerator.test.d.ts +1 -0
- package/lib/vite-wrappers/generators/utils/pickConfig.cjs +15 -0
- package/lib/vite-wrappers/generators/utils/pickConfig.cjs.map +1 -0
- package/lib/vite-wrappers/generators/utils/pickConfig.d.ts +10 -0
- package/lib/vite-wrappers/generators/utils/pickConfig.js +15 -0
- package/lib/vite-wrappers/generators/utils/pickConfig.js.map +1 -0
- package/lib/vite-wrappers/generators/utils/resourceParams.cjs +58 -0
- package/lib/vite-wrappers/generators/utils/resourceParams.cjs.map +1 -0
- package/lib/vite-wrappers/generators/utils/resourceParams.d.ts +12 -0
- package/lib/vite-wrappers/generators/utils/resourceParams.js +58 -0
- package/lib/vite-wrappers/generators/utils/resourceParams.js.map +1 -0
- package/lib/vite-wrappers/generators/utils/resourceParams.test.d.ts +1 -0
- package/lib/vite-wrappers/helpers/componentReplacement.cjs +12 -0
- package/lib/vite-wrappers/helpers/componentReplacement.cjs.map +1 -0
- package/lib/vite-wrappers/helpers/componentReplacement.d.ts +2 -0
- package/lib/vite-wrappers/helpers/componentReplacement.js +12 -0
- package/lib/vite-wrappers/helpers/componentReplacement.js.map +1 -0
- package/lib/vite-wrappers/icon-switch.cjs +1 -1
- package/lib/vite-wrappers/icon-switch.cjs.map +1 -1
- package/lib/vite-wrappers/icon-switch.js +1 -1
- package/lib/vite-wrappers/icon-switch.js.map +1 -1
- package/lib/vite-wrappers/index.d.ts +3 -0
- package/lib/vite-wrappers/json-wrappers.cjs +103 -12
- package/lib/vite-wrappers/json-wrappers.cjs.map +1 -1
- package/lib/vite-wrappers/json-wrappers.d.ts +33 -0
- package/lib/vite-wrappers/json-wrappers.js +103 -12
- package/lib/vite-wrappers/json-wrappers.js.map +1 -1
- package/lib/vite-wrappers/wrapperComponent.cjs +202 -128
- package/lib/vite-wrappers/wrapperComponent.cjs.map +1 -1
- package/lib/vite-wrappers/wrapperComponent.d.ts +11 -2
- package/lib/vite-wrappers/wrapperComponent.js +202 -128
- package/lib/vite-wrappers/wrapperComponent.js.map +1 -1
- package/package.json +7 -5
- package/lib/interfaces/types.d.ts +0 -59
- package/lib/vite-wrappers/loaderGenerator.cjs +0 -245
- package/lib/vite-wrappers/loaderGenerator.cjs.map +0 -1
- package/lib/vite-wrappers/loaderGenerator.d.ts +0 -18
- package/lib/vite-wrappers/loaderGenerator.js +0 -245
- package/lib/vite-wrappers/loaderGenerator.js.map +0 -1
- /package/lib/{vite-wrappers/loaderGenerator.test.d.ts → rollup/modifyLibFiles/handleComponentOrDialog.test.d.ts} +0 -0
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
import {getSortedRoutes}from'@common-stack/client-react/lib/route/get-routes.js';import fs__default from'fs';import globAll from'glob-all';import {mergeWith,isArray}from'lodash-es';import {createHash}from'node:crypto';import {getRootPath,wrapRouteComponent}from'./wrapperComponent.js';import {writeDialogsSwitch,dialogWrapperUtility}from'./dialog-wrapper.js';import {writeIconsSwitch}from'./icon-switch.js';
|
|
1
|
+
import {getSortedRoutes}from'@common-stack/client-react/lib/route/get-routes.js';import fs__default from'fs';import globAll from'glob-all';import {mergeWith,isArray}from'lodash-es';import {createHash}from'node:crypto';import {getRootPath,wrapRouteComponent}from'./wrapperComponent.js';import {writeDialogsSwitch,dialogWrapperUtility}from'./dialog-wrapper.js';import {writeIconsSwitch}from'./icon-switch.js';import {getComponentReplacementPath}from'./helpers/componentReplacement.js';/* eslint-disable jest/require-hook */
|
|
2
|
+
/* eslint-disable array-callback-return */
|
|
3
|
+
/**
|
|
4
|
+
* Generates a hash from the source string.
|
|
5
|
+
* Used to create unique route suffixes.
|
|
6
|
+
*
|
|
7
|
+
* @param source - The source string to hash.
|
|
8
|
+
* @param maxLength - The maximum length of the hash. Default is 8.
|
|
9
|
+
* @returns A substring of the generated SHA256 hash.
|
|
10
|
+
*/
|
|
11
|
+
const getHash = (source, maxLength = 8) => {
|
|
2
12
|
const hash = createHash('sha256').update(source).digest('hex');
|
|
3
13
|
return typeof maxLength === 'number' ? hash.slice(0, maxLength) : hash;
|
|
4
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the directories containing files from specified packages.
|
|
17
|
+
* Searches for a specific file in the node_modules directories of the provided packages.
|
|
18
|
+
*
|
|
19
|
+
* @param packages - The list of package names to search in.
|
|
20
|
+
* @param fileName - The name of the file to search for.
|
|
21
|
+
* @param rootPath - Optional root path to start the search. Defaults to project root.
|
|
22
|
+
* @returns An array of directories where the specified file is found.
|
|
23
|
+
*/
|
|
5
24
|
function resolvePathsUsingPackages(packages, fileName, rootPath) {
|
|
6
25
|
const basePath = rootPath || getRootPath();
|
|
7
26
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
@@ -15,11 +34,26 @@ function resolvePathsUsingPackages(packages, fileName, rootPath) {
|
|
|
15
34
|
}, []);
|
|
16
35
|
return localesDirs;
|
|
17
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Custom merge function used to concatenate arrays when merging objects.
|
|
39
|
+
* Used when merging routes configurations.
|
|
40
|
+
*
|
|
41
|
+
* @param objValue - The existing value.
|
|
42
|
+
* @param srcValue - The new value to merge.
|
|
43
|
+
* @returns Concatenated array if objValue is an array, otherwise undefined.
|
|
44
|
+
*/
|
|
18
45
|
function customizer(objValue, srcValue) {
|
|
19
46
|
if (isArray(objValue)) {
|
|
20
47
|
return objValue.concat(srcValue);
|
|
21
48
|
}
|
|
22
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Loads the routes configuration from the specified packages and merges them.
|
|
52
|
+
* Returns the sorted and merged route configuration.
|
|
53
|
+
*
|
|
54
|
+
* @param options - The options containing package names and root path for route resolution.
|
|
55
|
+
* @returns The sorted routes configuration or null if no configuration is found.
|
|
56
|
+
*/
|
|
23
57
|
function loadRoutesConfig(options) {
|
|
24
58
|
const fileName = options.routesFileName || 'route.json';
|
|
25
59
|
const directories = resolvePathsUsingPackages(options.packages, fileName, options.rootPath);
|
|
@@ -35,15 +69,45 @@ function loadRoutesConfig(options) {
|
|
|
35
69
|
const result = content.length ? getSortedRoutes('/', Object.assign({}, ...content)) : null;
|
|
36
70
|
return result;
|
|
37
71
|
}
|
|
72
|
+
// Global variables to store dialog paths, icon names, and icon files.
|
|
38
73
|
let dialogPaths = [];
|
|
39
74
|
let iconNames = [];
|
|
40
75
|
let iconSvgPaths = [];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
76
|
+
const iconFiles = [];
|
|
77
|
+
/**
|
|
78
|
+
* Adds a unique icon name to the global iconNames array.
|
|
79
|
+
*
|
|
80
|
+
* @param icon - The icon name to add.
|
|
81
|
+
* @returns Null if the icon name is already in the array, otherwise adds the name.
|
|
82
|
+
*/
|
|
83
|
+
const addIconName = (icon) => (!iconNames.includes(icon) ? iconNames.push(icon) : null);
|
|
84
|
+
/**
|
|
85
|
+
* Adds a unique SVG path to the global iconSvgPaths array.
|
|
86
|
+
*
|
|
87
|
+
* @param icon - The SVG path to add.
|
|
88
|
+
* @returns Null if the SVG path is already in the array, otherwise adds the path.
|
|
89
|
+
*/
|
|
90
|
+
const addIconSvgPath = (icon) => (!iconSvgPaths.includes(icon) ? iconSvgPaths.push(icon) : null);
|
|
91
|
+
/**
|
|
92
|
+
* Adds a unique icon file path to the global iconFiles array.
|
|
93
|
+
*
|
|
94
|
+
* @param icon - The file path to add.
|
|
95
|
+
* @returns Null if the file path is already in the array, otherwise adds the path.
|
|
96
|
+
*/
|
|
97
|
+
const addIconFile = (icon) => (!iconFiles.includes(icon) ? iconFiles.push(icon) : null);
|
|
98
|
+
/**
|
|
99
|
+
* Defines a route and its associated settings based on the route configuration.
|
|
100
|
+
* Wraps the component with necessary middleware, permission, and client wrappers.
|
|
101
|
+
*
|
|
102
|
+
* @param routeFn - The route function to define a new route.
|
|
103
|
+
* @param jsonRoute - The JSON route configuration.
|
|
104
|
+
* @param metaJson - Metadata related to the route.
|
|
105
|
+
* @param settings - The application settings.
|
|
106
|
+
* @param paths - The paths configuration for various modules and components.
|
|
107
|
+
*/
|
|
45
108
|
function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
46
|
-
const { routes = null, relativePath: path, componentPath, clientOnly, dialogPath, isResourceRoute, auth = 'optional', hasLoader = false, hasAction = false, hasClientLoader = false, hasClientAction = false, hasComponent = false, hasErrorBoundary = false, hasLinks = false, hasMeta = false, hasHydrateFallback = false, hasShouldRevalidate = false, queryParamsGenerator = false, hasHandle = false, hasHeaders = false, wrapperPaths = [], middlewares = [], authority = [], extraPermissions = [], extraProps = {}, loaderReturnInfo = {}, queries = {}, clientMiddlewares = [], configurations = [], resourceUri, icon, ...rest } = jsonRoute;
|
|
109
|
+
const { routes = null, relativePath: path, componentPath, clientOnly, dialogPath, isResourceRoute, auth = 'optional', hasServerCode = false, hasLoader = false, hasAction = false, hasClientLoader = false, hasClientAction = false, hasComponent = false, hasErrorBoundary = false, hasLinks = false, hasMeta = false, hasHydrateFallback = false, hasShouldRevalidate = false, queryParamsGenerator = false, hasHandle = false, hasHeaders = false, wrapperPaths = [], middlewares = [], authority = [], authorityConfig = {}, extraPermissions = [], extraParams = {}, extraIcons = [], extraLink = [], extraProps = {}, loaderReturnInfo = {}, queries = {}, clientMiddlewares = [], configurations = [], resourceUri, icon, ...rest } = jsonRoute;
|
|
110
|
+
// Handle icons
|
|
47
111
|
if (icon) {
|
|
48
112
|
if (typeof icon === 'object') {
|
|
49
113
|
if (typeof icon.svgPath === 'string') {
|
|
@@ -60,21 +124,31 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
60
124
|
addIconName(icon);
|
|
61
125
|
}
|
|
62
126
|
}
|
|
127
|
+
// Handle extra icons if any
|
|
128
|
+
if (extraIcons?.length > 0) {
|
|
129
|
+
extraIcons?.map((icon) => {
|
|
130
|
+
if (typeof icon === 'string') {
|
|
131
|
+
addIconName(icon);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
console.warn(`Invalid icon type: ${typeof icon}`);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
// Handle dialog paths and component routes
|
|
63
139
|
if (dialogPath && !dialogPaths.includes(dialogPath)) {
|
|
64
140
|
dialogWrapperUtility(dialogPath, { path: rest.path });
|
|
65
141
|
dialogPaths.push(dialogPath);
|
|
66
142
|
}
|
|
67
143
|
else if (componentPath) {
|
|
68
144
|
if (clientOnly) {
|
|
69
|
-
wrapperPaths.push('$clientOnlyWrapper'); // Add a placeholder for
|
|
145
|
+
wrapperPaths.push('$clientOnlyWrapper'); // Add a placeholder for client-only wrapper
|
|
70
146
|
}
|
|
71
147
|
if (authority.length > 0) {
|
|
72
|
-
wrapperPaths.push('$
|
|
73
|
-
}
|
|
74
|
-
if (configurations.length > 0 && resourceUri) {
|
|
75
|
-
wrapperPaths.push('$configurationWrapper'); // Add a placeholder for the permission wrapper at last
|
|
148
|
+
wrapperPaths.push('$configPermissionWrapper'); // Add a placeholder for permission wrapper
|
|
76
149
|
}
|
|
77
150
|
const requireAuth = !!auth;
|
|
151
|
+
const replacementPath = getComponentReplacementPath(jsonRoute.key, settings);
|
|
78
152
|
const options = {
|
|
79
153
|
authStrategy: requireAuth ? auth : null,
|
|
80
154
|
requireAuth,
|
|
@@ -83,6 +157,7 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
83
157
|
hasAction: settings.disableAction !== true && hasAction,
|
|
84
158
|
hasClientLoader: settings.disableClientLoader !== true && hasClientLoader,
|
|
85
159
|
hasComponent,
|
|
160
|
+
hasServerCode,
|
|
86
161
|
hasErrorBoundary: settings.disableErrorBoundary !== true && hasErrorBoundary,
|
|
87
162
|
hasLinks: settings.disableLinks !== true && hasLinks,
|
|
88
163
|
hasMeta: settings.disableMeta !== true && hasMeta,
|
|
@@ -96,7 +171,11 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
96
171
|
suffix: getHash(rest.path || '/'),
|
|
97
172
|
middlewares,
|
|
98
173
|
authority,
|
|
174
|
+
authorityConfig,
|
|
175
|
+
componentPath: replacementPath || componentPath,
|
|
176
|
+
extraLink,
|
|
99
177
|
extraPermissions,
|
|
178
|
+
extraParams,
|
|
100
179
|
extraProps: settings.disableExtraProps !== true ? extraProps : {},
|
|
101
180
|
queries,
|
|
102
181
|
clientMiddlewares: settings.disableClientMiddlewares !== true ? clientMiddlewares : [],
|
|
@@ -104,6 +183,7 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
104
183
|
configurations,
|
|
105
184
|
settings,
|
|
106
185
|
paths,
|
|
186
|
+
extraIcons,
|
|
107
187
|
};
|
|
108
188
|
const file = wrapRouteComponent(componentPath, wrapperPaths, metaJson, options);
|
|
109
189
|
const opts = { ...rest, id: rest.path };
|
|
@@ -117,17 +197,28 @@ function defineRoute(routeFn, jsonRoute, { metaJson, settings, paths }) {
|
|
|
117
197
|
}
|
|
118
198
|
}
|
|
119
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Defines the routes configuration for the application.
|
|
202
|
+
* Loads and defines routes based on the provided options and meta data.
|
|
203
|
+
*
|
|
204
|
+
* @param routeFn - The route function to define the route.
|
|
205
|
+
* @param options - The options containing route configurations, settings, and paths.
|
|
206
|
+
* @param metaJson - Optional metadata JSON for additional configurations.
|
|
207
|
+
*/
|
|
120
208
|
function defineRoutesConfig(routeFn, options, metaJson = null) {
|
|
121
209
|
const jsonRoute = loadRoutesConfig(options);
|
|
122
210
|
const settings = options.settings || {};
|
|
123
211
|
const paths = options.paths || {};
|
|
124
212
|
const iconsRepository = options.iconsRepository || {};
|
|
213
|
+
// Reset dialog paths and icon-related variables
|
|
125
214
|
dialogPaths = [];
|
|
126
215
|
iconNames = [];
|
|
127
216
|
iconSvgPaths = [];
|
|
217
|
+
// Define each route
|
|
128
218
|
jsonRoute.forEach((item) => {
|
|
129
219
|
defineRoute(routeFn, item, { metaJson, settings, paths });
|
|
130
220
|
});
|
|
221
|
+
// Write the dialogs and icons configuration
|
|
131
222
|
writeDialogsSwitch(dialogPaths);
|
|
132
223
|
writeIconsSwitch(iconNames, iconSvgPaths, iconFiles, iconsRepository);
|
|
133
|
-
}export{defineRoutesConfig,loadRoutesConfig,resolvePathsUsingPackages};//# sourceMappingURL=json-wrappers.js.map
|
|
224
|
+
}export{defineRoutesConfig,getHash,loadRoutesConfig,resolvePathsUsingPackages};//# sourceMappingURL=json-wrappers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-wrappers.js","sources":["../../src/vite-wrappers/json-wrappers.ts"],"sourcesContent":[null],"names":["fs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-wrappers.js","sources":["../../src/vite-wrappers/json-wrappers.ts"],"sourcesContent":[null],"names":["fs"],"mappings":"meAAA;AACA;AAYA;;;;;;;AAOG;AACU,MAAA,OAAO,GAAG,CAAC,MAAc,EAAE,SAAS,GAAG,CAAC,KAAY;AAC7D,IAAA,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/D,IAAA,OAAO,OAAO,SAAS,KAAK,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;AAC3E,EAAE;AAEF;;;;;;;;AAQG;SACa,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAA;AAClE,IAAA,MAAM,QAAQ,GAAG,QAAQ,IAAI,WAAW,EAAE,CAAC;;IAE3C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,G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