@hitachivantara/app-shell-vite-plugin 2.3.0 → 2.5.0
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 +201 -0
- package/dist/automatic-utils.js +7 -3
- package/dist/esm-externals/react-router-dom.production.min.js +7 -7
- package/dist/esm-externals/react-router-dom.production.min.js.map +1 -1
- package/dist/locales-utils.d.ts +0 -9
- package/dist/locales-utils.js +2 -34
- package/dist/nodeModule.d.ts +1 -1
- package/dist/shared-dependencies.js +2 -1
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +34 -0
- package/dist/vite-plugin-configuration-processor.d.ts +30 -0
- package/dist/{vite-configuration-processor-plugin.js → vite-plugin-configuration-processor.js} +11 -12
- package/dist/{vite-crossorigin-fix-plugin.d.ts → vite-plugin-crossorigin-fix.d.ts} +1 -2
- package/dist/{vite-crossorigin-fix-plugin.js → vite-plugin-crossorigin-fix.js} +4 -5
- package/dist/vite-plugin-dist-package-json.d.ts +5 -0
- package/dist/vite-plugin-dist-package-json.js +271 -0
- package/dist/{vite-generate-base-plugin.d.ts → vite-plugin-generate-base.d.ts} +1 -1
- package/dist/{vite-generate-bash-script-plugin.js → vite-plugin-generate-bash-script.js} +1 -1
- package/dist/{vite-locales-plugin.js → vite-plugin-locales.js} +3 -2
- package/dist/{vite-metadata-plugin.d.ts → vite-plugin-metadata.d.ts} +1 -2
- package/dist/{vite-metadata-plugin.js → vite-plugin-metadata.js} +5 -8
- package/dist/{vite-watch-config-plugin.js → vite-plugin-watch-config.js} +3 -1
- package/dist/vite-plugin.d.ts +36 -0
- package/dist/vite-plugin.js +25 -13
- package/package.json +24 -19
- package/dist/vite-configuration-processor-plugin.d.ts +0 -16
- /package/dist/{vite-generate-base-plugin.js → vite-plugin-generate-base.js} +0 -0
- /package/dist/{vite-generate-bash-script-plugin.d.ts → vite-plugin-generate-bash-script.d.ts} +0 -0
- /package/dist/{vite-importmap-plugin.d.ts → vite-plugin-importmap.d.ts} +0 -0
- /package/dist/{vite-importmap-plugin.js → vite-plugin-importmap.js} +0 -0
- /package/dist/{vite-locales-plugin.d.ts → vite-plugin-locales.d.ts} +0 -0
- /package/dist/{vite-watch-config-plugin.d.ts → vite-plugin-watch-config.d.ts} +0 -0
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -97,6 +97,42 @@ export interface AppShellVitePluginOptions {
|
|
|
97
97
|
* @default false
|
|
98
98
|
*/
|
|
99
99
|
disableAppsKeyNormalization?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Enables the experimental new package layout feature set.
|
|
102
|
+
*
|
|
103
|
+
* When `true`, the plugin activates behaviors that are part of the
|
|
104
|
+
* new app bundle distribution/publishing package layout. Currently, this gates:
|
|
105
|
+
*
|
|
106
|
+
* - **`dist/package.json` generation** — a cleaned-up `package.json` is
|
|
107
|
+
* written to the Vite output directory after each build. The source
|
|
108
|
+
* `package.json` contains dev-time fields and conditions that do not apply
|
|
109
|
+
* to published/distributed packages; the generated manifest only includes
|
|
110
|
+
* the fields relevant to consumers.
|
|
111
|
+
* - **`dist/app-shell.config.json`** — the resolved App Shell configuration
|
|
112
|
+
* is written to the output directory so that app bundles are self-contained
|
|
113
|
+
* and can be consumed both as standalone App Shells or as bundles for
|
|
114
|
+
* another App Shell.
|
|
115
|
+
*
|
|
116
|
+
* Additional behaviors may be added under this flag in future PRs before
|
|
117
|
+
* the feature set is stabilized and the flag is removed.
|
|
118
|
+
*
|
|
119
|
+
* @default false
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
122
|
+
experimentalNewPackageLayout?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* The custom exports condition used to resolve TypeScript source files during
|
|
125
|
+
* development. Only applies when `experimentalNewPackageLayout` is `true`.
|
|
126
|
+
*
|
|
127
|
+
* Workspace packages declare a scoped condition (e.g. `"@pentaho-apps:source"`)
|
|
128
|
+
* in their `exports` map that points directly at the TypeScript source. This
|
|
129
|
+
* lets consumers import the live source during development without a prior
|
|
130
|
+
* build step. The condition is stripped from `dist/package.json` so it never
|
|
131
|
+
* leaks to consumers that don't have the TypeScript sources available.
|
|
132
|
+
*
|
|
133
|
+
* @default "@pentaho-apps:source"
|
|
134
|
+
*/
|
|
135
|
+
sourceCondition?: string;
|
|
100
136
|
}
|
|
101
137
|
/**
|
|
102
138
|
* Vite plugin to support App Shell apps setup
|
package/dist/vite-plugin.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import virtual from "@rollup/plugin-virtual";
|
|
4
3
|
import { loadEnv } from "vite";
|
|
@@ -7,15 +6,17 @@ import { applyAutomaticMenu, applyAutomaticViewsAndRoutes, } from "./automatic-u
|
|
|
7
6
|
import { findAppShellConfigFile, getFinalModuleName, loadConfigFile, } from "./config-utils.js";
|
|
8
7
|
import { resolveModule } from "./nodeModule.js";
|
|
9
8
|
import SHARED_DEPENDENCIES from "./shared-dependencies.js";
|
|
9
|
+
import { readJsonFile } from "./utils.js";
|
|
10
10
|
import getVirtualEntrypoints from "./virtual-entrypoints.js";
|
|
11
|
-
import processConfiguration from "./vite-configuration-processor
|
|
12
|
-
import fixCrossOrigin from "./vite-crossorigin-fix
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
11
|
+
import processConfiguration from "./vite-plugin-configuration-processor.js";
|
|
12
|
+
import fixCrossOrigin from "./vite-plugin-crossorigin-fix.js";
|
|
13
|
+
import distPackageJsonPlugin from "./vite-plugin-dist-package-json.js";
|
|
14
|
+
import generateBaseTag from "./vite-plugin-generate-base.js";
|
|
15
|
+
import generateBashScript from "./vite-plugin-generate-bash-script.js";
|
|
16
|
+
import generateImportmap, { extraDependencies, } from "./vite-plugin-importmap.js";
|
|
17
|
+
import copyAppShellLocales from "./vite-plugin-locales.js";
|
|
18
|
+
import injectMetadata from "./vite-plugin-metadata.js";
|
|
19
|
+
import serveAppShellConfig from "./vite-plugin-watch-config.js";
|
|
19
20
|
const ViteBuildMode = {
|
|
20
21
|
PRODUCTION: "production",
|
|
21
22
|
DEVELOPMENT: "development",
|
|
@@ -26,15 +27,14 @@ const ViteBuildMode = {
|
|
|
26
27
|
* @param env Environment variable
|
|
27
28
|
*/
|
|
28
29
|
export async function HvAppShellVitePlugin(opts = {}, env = {}) {
|
|
29
|
-
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;
|
|
30
|
+
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, experimentalNewPackageLayout = false, sourceCondition, } = opts;
|
|
30
31
|
const globalEnv = loadEnv(mode, process.cwd(), "");
|
|
31
32
|
const { type = globalEnv.CI ? "bundle" : "app" } = opts;
|
|
32
33
|
console.info(`Vite running in mode: ${mode}`);
|
|
33
34
|
console.info(`AppShell Vite plugin running with type: ${type}`);
|
|
34
35
|
const devMode = mode === ViteBuildMode.DEVELOPMENT;
|
|
35
36
|
const buildEntryPoint = type !== "bundle";
|
|
36
|
-
const
|
|
37
|
-
const packageJson = JSON.parse(packageJsonRaw);
|
|
37
|
+
const packageJson = readJsonFile(path.resolve(root, "package.json"));
|
|
38
38
|
const appShellConfigFile = !generateEmptyShell
|
|
39
39
|
? findAppShellConfigFile(root)
|
|
40
40
|
: undefined;
|
|
@@ -112,7 +112,16 @@ export async function HvAppShellVitePlugin(opts = {}, env = {}) {
|
|
|
112
112
|
buildEntryPoint &&
|
|
113
113
|
generateBaseTag(appShellConfiguration, generateEmptyShell),
|
|
114
114
|
// configure the build process based on the config file
|
|
115
|
-
processConfiguration(
|
|
115
|
+
processConfiguration({
|
|
116
|
+
root,
|
|
117
|
+
appShellConfig: appShellConfiguration,
|
|
118
|
+
selfAppName: packageJson.name,
|
|
119
|
+
modules: modules.concat(autoViewsBundles),
|
|
120
|
+
buildEntryPoint,
|
|
121
|
+
inlineConfig,
|
|
122
|
+
generateEmptyShell,
|
|
123
|
+
experimentalNewPackageLayout,
|
|
124
|
+
}),
|
|
116
125
|
// allow crossorigin="use-credentials" in the index.html
|
|
117
126
|
fixCrossOrigin(),
|
|
118
127
|
// serve the app shell config file as json and watch for changes
|
|
@@ -121,5 +130,8 @@ export async function HvAppShellVitePlugin(opts = {}, env = {}) {
|
|
|
121
130
|
generateEmptyShell && generateBashScript(externalImportMap, inlineConfig),
|
|
122
131
|
// copy/merge app-shell-ui locales into dist (build) or serve via middleware (dev)
|
|
123
132
|
copyAppShellLocales(buildEntryPoint),
|
|
133
|
+
// generate dist/package.json for the build output directory
|
|
134
|
+
experimentalNewPackageLayout &&
|
|
135
|
+
distPackageJsonPlugin(root, sourceCondition),
|
|
124
136
|
];
|
|
125
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/app-shell-vite-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Hitachi Vantara UI Kit Team",
|
|
@@ -15,40 +15,42 @@
|
|
|
15
15
|
},
|
|
16
16
|
"bugs": "https://github.com/pentaho/hv-uikit-react/issues",
|
|
17
17
|
"scripts": {
|
|
18
|
+
"build": "npm run clean && tsc -p tsconfig.json && rollup --config",
|
|
19
|
+
"test": "vitest",
|
|
20
|
+
"test:ui": "vitest --ui",
|
|
21
|
+
"clean": "rimraf dist",
|
|
18
22
|
"prepare": "npm run build"
|
|
19
23
|
},
|
|
20
24
|
"dependencies": {
|
|
25
|
+
"@hitachivantara/app-shell-services": "^2.0.5",
|
|
26
|
+
"@hitachivantara/app-shell-shared": "^2.3.3",
|
|
27
|
+
"@hitachivantara/app-shell-ui": "^2.3.4",
|
|
28
|
+
"@hitachivantara/uikit-react-shared": "^6.0.6",
|
|
29
|
+
"@rollup/plugin-virtual": "^3.0.1",
|
|
30
|
+
"es-module-shims": "^1.6.3",
|
|
31
|
+
"jiti": "^2.6.1",
|
|
32
|
+
"vite-plugin-static-copy": "^4.1.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"vite": "^4.1.4 || ^5.0.4 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
21
38
|
"@emotion/cache": "^11.11.0",
|
|
22
39
|
"@emotion/react": "^11.11.1",
|
|
23
|
-
"@hitachivantara/app-shell-services": "^2.0.3",
|
|
24
|
-
"@hitachivantara/app-shell-shared": "^2.3.1",
|
|
25
|
-
"@hitachivantara/app-shell-ui": "^2.3.2",
|
|
26
|
-
"@hitachivantara/uikit-react-icons": "^6.0.4",
|
|
27
|
-
"@hitachivantara/uikit-react-shared": "^6.0.4",
|
|
28
40
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
29
41
|
"@rollup/plugin-json": "^6.0.0",
|
|
30
42
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
31
43
|
"@rollup/plugin-replace": "^6.0.3",
|
|
32
44
|
"@rollup/plugin-terser": "^1.0.0",
|
|
33
|
-
"
|
|
34
|
-
"es-module-shims": "^1.6.3",
|
|
35
|
-
"jiti": "^2.6.1",
|
|
45
|
+
"mock-fs": "^5.2.0",
|
|
36
46
|
"react": "^18.2.0",
|
|
37
47
|
"react-dom": "^18.2.0",
|
|
38
48
|
"react-router-dom": "^6.9.0",
|
|
39
|
-
"rollup": "^4.57.1"
|
|
40
|
-
"vite-plugin-static-copy": "^4.1.0"
|
|
41
|
-
},
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"vite": "^4.1.4 || ^5.0.4 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
49
|
+
"rollup": "^4.57.1"
|
|
44
50
|
},
|
|
45
51
|
"files": [
|
|
46
52
|
"dist"
|
|
47
53
|
],
|
|
48
|
-
"publishConfig": {
|
|
49
|
-
"access": "public",
|
|
50
|
-
"directory": "package"
|
|
51
|
-
},
|
|
52
54
|
"main": "./dist/index.js",
|
|
53
55
|
"module": "./dist/index.js",
|
|
54
56
|
"types": "./dist/index.d.ts",
|
|
@@ -59,5 +61,8 @@
|
|
|
59
61
|
},
|
|
60
62
|
"./package.json": "./package.json"
|
|
61
63
|
},
|
|
62
|
-
"
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"gitHead": "4d8cd01cd9b1786dc00fd9e8edb962b2c80e4b03"
|
|
63
68
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PluginOption } from "vite";
|
|
2
|
-
import type { HvAppShellConfig } from "@hitachivantara/app-shell-shared";
|
|
3
|
-
/**
|
|
4
|
-
* Process configuration, executing several tasks:
|
|
5
|
-
* - Create rollup configuration to support module creation
|
|
6
|
-
* - Generates final transformed configuration json
|
|
7
|
-
* - "base" value is always "./" for build, and main app baseUrl for preview or dev
|
|
8
|
-
* @param root Project root directory.
|
|
9
|
-
* @param appShellConfig The original App Shell configuration json.
|
|
10
|
-
* @param selfAppName The name of the application bundle being built.
|
|
11
|
-
* @param buildEntryPoint If true, the index.html entry point will be added to the bundle.
|
|
12
|
-
* @param inlineConfig flag to control if config is included at index.html
|
|
13
|
-
* @param generateEmptyShell flag to control if we are creating an empty AppShell instance
|
|
14
|
-
* @param modules the set of modules to be created by the rollup
|
|
15
|
-
*/
|
|
16
|
-
export default function processConfiguration(root: string, appShellConfig: HvAppShellConfig, selfAppName: string, buildEntryPoint: boolean, inlineConfig: boolean, generateEmptyShell: boolean, modules?: string[]): PluginOption;
|
|
File without changes
|
/package/dist/{vite-generate-bash-script-plugin.d.ts → vite-plugin-generate-bash-script.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|