@hitachivantara/app-shell-vite-plugin 1.10.6 → 2.0.0-next.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.
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { PluginOption } from "vite";
|
|
2
|
-
import type { HvAppShellConfig
|
|
3
|
-
type BundleDefinition = HvAppShellProvidersConfig | HvAppShellViewsConfig | HvAppShellHeaderAction;
|
|
4
|
-
export declare function replaceReferencesToSelf<T extends BundleDefinition>(bundles: T[], selfAppName: string): T[];
|
|
2
|
+
import type { HvAppShellConfig } from "@hitachivantara/app-shell-shared";
|
|
5
3
|
/**
|
|
6
4
|
* Process configuration, executing several tasks:
|
|
7
5
|
* - Create rollup configuration to support module creation
|
|
@@ -16,4 +14,3 @@ export declare function replaceReferencesToSelf<T extends BundleDefinition>(bund
|
|
|
16
14
|
* @param modules the set of modules to be created by the rollup
|
|
17
15
|
*/
|
|
18
16
|
export default function processConfiguration(root: string, appShellConfig: HvAppShellConfig, selfAppName: string, buildEntryPoint: boolean, inlineConfig: boolean, generateEmptyShell: boolean, modules?: string[]): PluginOption;
|
|
19
|
-
export {};
|
|
@@ -1,24 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { getAppModules, getBasePath
|
|
4
|
-
export function replaceReferencesToSelf(bundles, selfAppName) {
|
|
5
|
-
return bundles.map((bundleDefinition) => {
|
|
6
|
-
if ("views" in bundleDefinition && bundleDefinition.views != null) {
|
|
7
|
-
return {
|
|
8
|
-
...bundleDefinition,
|
|
9
|
-
bundle: replaceSelf(bundleDefinition.bundle, `${selfAppName}/`),
|
|
10
|
-
views: replaceReferencesToSelf(bundleDefinition.views, selfAppName),
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
if (startsWithSelf(bundleDefinition.bundle)) {
|
|
14
|
-
return {
|
|
15
|
-
...bundleDefinition,
|
|
16
|
-
bundle: replaceSelf(bundleDefinition.bundle, `${selfAppName}/`),
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
return bundleDefinition;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
3
|
+
import { getAppModules, getBasePath } from "./config-utils.js";
|
|
22
4
|
/**
|
|
23
5
|
* Process configuration, executing several tasks:
|
|
24
6
|
* - Create rollup configuration to support module creation
|
|
@@ -93,33 +75,16 @@ export default function processConfiguration(root, appShellConfig, selfAppName,
|
|
|
93
75
|
if (!fs.existsSync(targetDir)) {
|
|
94
76
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
95
77
|
}
|
|
96
|
-
// theming structure does not rely on having the 'bundle' prop
|
|
97
|
-
const { theming } = appShellConfig;
|
|
98
|
-
if (theming != null) {
|
|
99
|
-
theming.themes = theming.themes?.map((theme) => {
|
|
100
|
-
if (startsWithSelf(theme)) {
|
|
101
|
-
const bundleName = replaceSelf(theme);
|
|
102
|
-
return `${selfAppName}/${bundleName}`;
|
|
103
|
-
}
|
|
104
|
-
return theme;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
78
|
finalAppShellConfig = { ...appShellConfig };
|
|
108
79
|
// if no baseUrl is present on the configuration, then assume the calculated basePath
|
|
109
80
|
if (!finalAppShellConfig.baseUrl) {
|
|
110
81
|
finalAppShellConfig.baseUrl = basePath;
|
|
111
82
|
}
|
|
112
83
|
finalAppShellConfig.apps = undefined;
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (finalAppShellConfig.mainPanel?.views != null) {
|
|
118
|
-
finalAppShellConfig.mainPanel.views = replaceReferencesToSelf(finalAppShellConfig.mainPanel.views, selfAppName);
|
|
119
|
-
}
|
|
120
|
-
if (finalAppShellConfig.header?.actions != null) {
|
|
121
|
-
finalAppShellConfig.header.actions = replaceReferencesToSelf(finalAppShellConfig.header?.actions, selfAppName);
|
|
122
|
-
}
|
|
84
|
+
// Replace all @self references using simple string replacement
|
|
85
|
+
let configString = JSON.stringify(finalAppShellConfig);
|
|
86
|
+
configString = configString.replaceAll(`"@self/`, `"${selfAppName}/`);
|
|
87
|
+
finalAppShellConfig = JSON.parse(configString);
|
|
123
88
|
if (!inlineConfig) {
|
|
124
89
|
fs.writeFileSync(path.resolve(targetDir, "app-shell.config.json"), JSON.stringify(finalAppShellConfig));
|
|
125
90
|
}
|
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { replaceSelf } from "./config-utils.js";
|
|
3
2
|
import { require } from "./nodeModule.js";
|
|
4
|
-
import { replaceReferencesToSelf } from "./vite-configuration-processor-plugin.js";
|
|
5
3
|
const prepareConfigForDevMode = (config, selfAppName) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
const self = `${selfAppName}/`;
|
|
11
|
-
// Main panel - Views
|
|
12
|
-
if (mainPanel?.views && replacedConfig.mainPanel) {
|
|
13
|
-
replacedConfig.mainPanel.views = replaceReferencesToSelf(mainPanel.views, selfAppName);
|
|
14
|
-
}
|
|
15
|
-
// Header - Actions
|
|
16
|
-
if (header?.actions && replacedConfig.header) {
|
|
17
|
-
replacedConfig.header.actions = replaceReferencesToSelf(header.actions, selfAppName);
|
|
18
|
-
}
|
|
19
|
-
// Theming
|
|
20
|
-
if (theming?.themes && replacedConfig.theming) {
|
|
21
|
-
replacedConfig.theming.themes = theming.themes?.map((theme) => {
|
|
22
|
-
return replaceSelf(theme, self);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
// Providers
|
|
26
|
-
if (providers) {
|
|
27
|
-
replacedConfig.providers = replaceReferencesToSelf(providers, selfAppName);
|
|
28
|
-
}
|
|
29
|
-
return replacedConfig;
|
|
4
|
+
let configString = JSON.stringify(config);
|
|
5
|
+
configString = configString.replaceAll(`"@self/`, `"${selfAppName}/`);
|
|
6
|
+
return JSON.parse(configString);
|
|
30
7
|
};
|
|
31
8
|
export default function serveAppShellConfig(appShellConfig, root, selfAppName, appShellConfigFile, automaticViewsFolder) {
|
|
32
9
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/app-shell-vite-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-next.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Hitachi Vantara UI Kit Team",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@emotion/cache": "^11.11.0",
|
|
22
22
|
"@emotion/react": "^11.11.1",
|
|
23
|
-
"@hitachivantara/app-shell-services": "^
|
|
24
|
-
"@hitachivantara/app-shell-shared": "^
|
|
25
|
-
"@hitachivantara/app-shell-ui": "^
|
|
26
|
-
"@hitachivantara/uikit-react-icons": "^
|
|
27
|
-
"@hitachivantara/uikit-react-shared": "^
|
|
23
|
+
"@hitachivantara/app-shell-services": "^2.0.0-next.2",
|
|
24
|
+
"@hitachivantara/app-shell-shared": "^2.0.0-next.2",
|
|
25
|
+
"@hitachivantara/app-shell-ui": "^2.0.0-next.2",
|
|
26
|
+
"@hitachivantara/uikit-react-icons": "^6.0.0-next.3",
|
|
27
|
+
"@hitachivantara/uikit-react-shared": "^6.0.0-next.3",
|
|
28
28
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
29
29
|
"@rollup/plugin-json": "^6.0.0",
|
|
30
30
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
},
|
|
60
60
|
"./package.json": "./package.json"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "f404f47dd2c0a9d4033b9acccc87282aa9e42119"
|
|
63
63
|
}
|