@hitachivantara/app-shell-vite-plugin 2.1.6 → 2.1.8
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/dist/config-utils.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export interface ConfigReplacement {
|
|
|
4
4
|
token: string;
|
|
5
5
|
value: string;
|
|
6
6
|
}
|
|
7
|
-
export type AppShellConfigFunction = (pluginOptions: AppShellVitePluginOptions, env: Record<string, string>) => HvAppShellConfig
|
|
7
|
+
export type AppShellConfigFunction = (pluginOptions: AppShellVitePluginOptions, env: Record<string, string>) => HvAppShellConfig | Promise<HvAppShellConfig>;
|
|
8
8
|
export declare const DEFAULT_CONFIG_FILES: string[];
|
|
9
9
|
export declare function findAppShellConfigFile(root: string): string | undefined;
|
|
10
|
-
export declare function loadConfigFile(appShellConfigFile: string | undefined, opts: AppShellVitePluginOptions, env?: Record<string, string>): HvAppShellConfig
|
|
10
|
+
export declare function loadConfigFile(appShellConfigFile: string | undefined, opts: AppShellVitePluginOptions, env?: Record<string, string>): Promise<HvAppShellConfig>;
|
|
11
11
|
/**
|
|
12
12
|
* Returns the extensionless module name of the output bundle
|
|
13
13
|
* for a given entry point module name.
|
package/dist/config-utils.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
moduleTypes: {
|
|
8
|
-
"app-shell.config.ts": "cjs",
|
|
9
|
-
},
|
|
10
|
-
}));
|
|
3
|
+
import { createJiti } from "jiti";
|
|
4
|
+
// moduleCache is disabled so that config file changes are always picked up
|
|
5
|
+
// on Vite server restart (which re-runs the full plugin pipeline in-process)
|
|
6
|
+
const jiti = createJiti(import.meta.url, { moduleCache: false });
|
|
11
7
|
export const DEFAULT_CONFIG_FILES = [
|
|
12
8
|
"app-shell.config.ts",
|
|
13
9
|
"app-shell.config.js",
|
|
@@ -20,7 +16,7 @@ export function findAppShellConfigFile(root) {
|
|
|
20
16
|
}
|
|
21
17
|
return undefined;
|
|
22
18
|
}
|
|
23
|
-
export function loadConfigFile(appShellConfigFile, opts, env = {}) {
|
|
19
|
+
export async function loadConfigFile(appShellConfigFile, opts, env = {}) {
|
|
24
20
|
if (!appShellConfigFile) {
|
|
25
21
|
// an empty configuration is actually valid
|
|
26
22
|
// and with the automatic views option, it can even make sense
|
|
@@ -34,13 +30,12 @@ export function loadConfigFile(appShellConfigFile, opts, env = {}) {
|
|
|
34
30
|
});
|
|
35
31
|
return JSON.parse(appShellConfigRaw);
|
|
36
32
|
}
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return loadedAppShellConfig(opts, env);
|
|
33
|
+
// jiti handles .ts and .js transpilation and loading
|
|
34
|
+
const loadedConfig = await jiti.import(appShellConfigFile, { default: true });
|
|
35
|
+
if (typeof loadedConfig === "function") {
|
|
36
|
+
return loadedConfig(opts, env);
|
|
42
37
|
}
|
|
43
|
-
return
|
|
38
|
+
return loadedConfig;
|
|
44
39
|
}
|
|
45
40
|
/**
|
|
46
41
|
* Returns the extensionless module name of the output bundle
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -103,4 +103,4 @@ export interface AppShellVitePluginOptions {
|
|
|
103
103
|
* @param opts Plugin options
|
|
104
104
|
* @param env Environment variable
|
|
105
105
|
*/
|
|
106
|
-
export declare function HvAppShellVitePlugin(opts?: AppShellVitePluginOptions, env?: Record<string, string>): PluginOption
|
|
106
|
+
export declare function HvAppShellVitePlugin(opts?: AppShellVitePluginOptions, env?: Record<string, string>): Promise<PluginOption[]>;
|
package/dist/vite-plugin.js
CHANGED
|
@@ -24,7 +24,7 @@ const ViteBuildMode = {
|
|
|
24
24
|
* @param opts Plugin options
|
|
25
25
|
* @param env Environment variable
|
|
26
26
|
*/
|
|
27
|
-
export function HvAppShellVitePlugin(opts = {}, env = {}) {
|
|
27
|
+
export async function HvAppShellVitePlugin(opts = {}, env = {}) {
|
|
28
28
|
const { root = process.cwd(), mode = ViteBuildMode.PRODUCTION, externalImportMap = false, viewsFolder = "src/pages", autoViewsAndRoutes = false, autoMenu = false, inlineConfig = opts.generateEmptyShell ?? false, generateEmptyShell = false, modules = [], disableAppsKeyNormalization = false, } = opts;
|
|
29
29
|
const globalEnv = loadEnv(mode, process.cwd(), "");
|
|
30
30
|
const { type = globalEnv.CI ? "bundle" : "app" } = opts;
|
|
@@ -37,7 +37,7 @@ export function HvAppShellVitePlugin(opts = {}, env = {}) {
|
|
|
37
37
|
const appShellConfigFile = !generateEmptyShell
|
|
38
38
|
? findAppShellConfigFile(root)
|
|
39
39
|
: undefined;
|
|
40
|
-
const appShellConfiguration = loadConfigFile(appShellConfigFile, opts, env);
|
|
40
|
+
const appShellConfiguration = await loadConfigFile(appShellConfigFile, opts, env);
|
|
41
41
|
let autoViewsBundles = [];
|
|
42
42
|
if (!generateEmptyShell) {
|
|
43
43
|
if (autoViewsAndRoutes) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { require } from "./nodeModule.js";
|
|
3
2
|
const prepareConfigForDevMode = (config, selfAppName) => {
|
|
4
3
|
let configString = JSON.stringify(config);
|
|
5
4
|
configString = configString.replaceAll(`"@self/`, `"${selfAppName}/`);
|
|
@@ -13,7 +12,6 @@ export default function serveAppShellConfig(appShellConfig, root, selfAppName, a
|
|
|
13
12
|
const restartServer = (file) => {
|
|
14
13
|
if (appShellConfigFile != null && file.endsWith(appShellConfigFile)) {
|
|
15
14
|
console.info("App Shell configuration file changed. Reloading...");
|
|
16
|
-
delete require.cache[require.resolve(appShellConfigFile)];
|
|
17
15
|
server
|
|
18
16
|
.restart()
|
|
19
17
|
.catch((e) => console.error(`Restart failed with: ${e}`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/app-shell-vite-plugin",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Hitachi Vantara UI Kit Team",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"@emotion/cache": "^11.11.0",
|
|
22
22
|
"@emotion/react": "^11.11.1",
|
|
23
23
|
"@hitachivantara/app-shell-services": "^2.0.2",
|
|
24
|
-
"@hitachivantara/app-shell-shared": "^2.2.
|
|
25
|
-
"@hitachivantara/app-shell-ui": "^2.2.
|
|
26
|
-
"@hitachivantara/uikit-react-icons": "^6.0.
|
|
27
|
-
"@hitachivantara/uikit-react-shared": "^6.0.
|
|
24
|
+
"@hitachivantara/app-shell-shared": "^2.2.3",
|
|
25
|
+
"@hitachivantara/app-shell-ui": "^2.2.3",
|
|
26
|
+
"@hitachivantara/uikit-react-icons": "^6.0.3",
|
|
27
|
+
"@hitachivantara/uikit-react-shared": "^6.0.3",
|
|
28
28
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
29
29
|
"@rollup/plugin-json": "^6.0.0",
|
|
30
30
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"@rollup/plugin-terser": "^0.4.0",
|
|
33
33
|
"@rollup/plugin-virtual": "^3.0.1",
|
|
34
34
|
"es-module-shims": "^1.6.3",
|
|
35
|
+
"jiti": "^2.6.1",
|
|
35
36
|
"react": "^18.2.0",
|
|
36
37
|
"react-dom": "^18.2.0",
|
|
37
38
|
"react-router-dom": "^6.9.0",
|
|
38
39
|
"rollup": "^4.57.1",
|
|
39
|
-
"ts-node": "^10.9.1",
|
|
40
40
|
"vite-plugin-static-copy": "^3.1.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"vite": "^4.1.4 || ^5.0.4 || ^6.0.0 || ^7.0.0"
|
|
43
|
+
"vite": "^4.1.4 || ^5.0.4 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"dist"
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
},
|
|
60
60
|
"./package.json": "./package.json"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "a80406b1865bb35a4e5c23e1c4fa2e7266f77f4e"
|
|
63
63
|
}
|