@hitachivantara/app-shell-vite-plugin 2.4.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/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/shared-dependencies.js +2 -1
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +34 -0
- package/dist/{vite-configuration-processor-plugin.js → vite-plugin-configuration-processor.js} +1 -1
- 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-dist-package-json-plugin.js → vite-plugin-dist-package-json.js} +66 -6
- 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} +1 -1
- package/dist/vite-plugin.js +11 -12
- package/package.json +24 -18
- /package/dist/{vite-configuration-processor-plugin.d.ts → vite-plugin-configuration-processor.d.ts} +0 -0
- /package/dist/{vite-dist-package-json-plugin.d.ts → vite-plugin-dist-package-json.d.ts} +0 -0
- /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/locales-utils.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
export declare const SUPPORTED_LOCALES_FILE = "supported-locales.json";
|
|
2
|
-
/**
|
|
3
|
-
* Deep merge two objects. `override` keys take priority over `base`.
|
|
4
|
-
*/
|
|
5
|
-
export declare function deepMerge(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown>;
|
|
6
2
|
/**
|
|
7
3
|
* Reads a `supported-locales.json` file and returns its contents as an array
|
|
8
4
|
* of locale strings. Returns an empty array if the file doesn't exist or
|
|
@@ -31,11 +27,6 @@ export declare function discoverLanguageDirs(localesDir: string): string[];
|
|
|
31
27
|
* @param appLocalesDir - The app's locales directory (downstream / local).
|
|
32
28
|
*/
|
|
33
29
|
export declare function computeSupportedLocales(shellLocalesDir: string | undefined, appLocalesDir: string | undefined): string[];
|
|
34
|
-
/**
|
|
35
|
-
* Parses a JSON file, wrapping parse errors with the file path for
|
|
36
|
-
* actionable diagnostics.
|
|
37
|
-
*/
|
|
38
|
-
export declare function readJsonFile(filePath: string): unknown;
|
|
39
30
|
/**
|
|
40
31
|
* Recursively merges source directory into destination.
|
|
41
32
|
* JSON files are deep-merged with destination keys taking priority.
|
package/dist/locales-utils.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { deepMerge, readJsonFile } from "./utils.js";
|
|
3
4
|
export const SUPPORTED_LOCALES_FILE = "supported-locales.json";
|
|
4
|
-
/**
|
|
5
|
-
* Deep merge two objects. `override` keys take priority over `base`.
|
|
6
|
-
*/
|
|
7
|
-
export function deepMerge(base, override) {
|
|
8
|
-
const result = { ...base };
|
|
9
|
-
for (const [key, value] of Object.entries(override)) {
|
|
10
|
-
if (value != null &&
|
|
11
|
-
typeof value === "object" &&
|
|
12
|
-
!Array.isArray(value) &&
|
|
13
|
-
result[key] != null &&
|
|
14
|
-
typeof result[key] === "object" &&
|
|
15
|
-
!Array.isArray(result[key])) {
|
|
16
|
-
result[key] = deepMerge(result[key], value);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
result[key] = value;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
5
|
/**
|
|
25
6
|
* Reads a `supported-locales.json` file and returns its contents as an array
|
|
26
7
|
* of locale strings. Returns an empty array if the file doesn't exist or
|
|
@@ -30,7 +11,7 @@ export function readSupportedLocales(filePath) {
|
|
|
30
11
|
if (!fs.existsSync(filePath))
|
|
31
12
|
return [];
|
|
32
13
|
try {
|
|
33
|
-
const data =
|
|
14
|
+
const data = readJsonFile(filePath);
|
|
34
15
|
if (Array.isArray(data) && data.every((item) => typeof item === "string")) {
|
|
35
16
|
return data;
|
|
36
17
|
}
|
|
@@ -107,19 +88,6 @@ export function computeSupportedLocales(shellLocalesDir, appLocalesDir) {
|
|
|
107
88
|
}
|
|
108
89
|
return result.toSorted();
|
|
109
90
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Parses a JSON file, wrapping parse errors with the file path for
|
|
112
|
-
* actionable diagnostics.
|
|
113
|
-
*/
|
|
114
|
-
export function readJsonFile(filePath) {
|
|
115
|
-
const raw = fs.readFileSync(filePath, "utf-8");
|
|
116
|
-
try {
|
|
117
|
-
return JSON.parse(raw);
|
|
118
|
-
}
|
|
119
|
-
catch (cause) {
|
|
120
|
-
throw new Error(`[app-shell-locales] Failed to parse ${filePath}: ${cause instanceof Error ? cause.message : cause}`, { cause });
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
91
|
/**
|
|
124
92
|
* Recursively merges source directory into destination.
|
|
125
93
|
* JSON files are deep-merged with destination keys taking priority.
|
|
@@ -87,7 +87,8 @@ export default [
|
|
|
87
87
|
moduleId: "@hitachivantara/app-shell-services",
|
|
88
88
|
bundle: "app-shell-services.esm.js",
|
|
89
89
|
bundleSrc: "@hitachivantara/app-shell-services/bundles/app-shell-services.esm.js",
|
|
90
|
-
virtualSrc: `export
|
|
90
|
+
virtualSrc: `export { default } from "@hitachivantara/app-shell-services";
|
|
91
|
+
export * from "@hitachivantara/app-shell-services";`,
|
|
91
92
|
},
|
|
92
93
|
{
|
|
93
94
|
moduleId: "@hitachivantara/uikit-react-shared",
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep merge two objects. `override` keys take priority over `base`.
|
|
3
|
+
*/
|
|
4
|
+
export declare function deepMerge(base: Record<string, unknown>, override: Record<string, unknown>): Record<string, unknown>;
|
|
5
|
+
/**
|
|
6
|
+
* Parses a JSON file, wrapping parse errors with the file path for
|
|
7
|
+
* actionable diagnostics.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readJsonFile(filePath: string): any;
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
/**
|
|
3
|
+
* Deep merge two objects. `override` keys take priority over `base`.
|
|
4
|
+
*/
|
|
5
|
+
export function deepMerge(base, override) {
|
|
6
|
+
const result = { ...base };
|
|
7
|
+
for (const [key, value] of Object.entries(override)) {
|
|
8
|
+
if (value != null &&
|
|
9
|
+
typeof value === "object" &&
|
|
10
|
+
!Array.isArray(value) &&
|
|
11
|
+
result[key] != null &&
|
|
12
|
+
typeof result[key] === "object" &&
|
|
13
|
+
!Array.isArray(result[key])) {
|
|
14
|
+
result[key] = deepMerge(result[key], value);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
result[key] = value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parses a JSON file, wrapping parse errors with the file path for
|
|
24
|
+
* actionable diagnostics.
|
|
25
|
+
*/
|
|
26
|
+
export function readJsonFile(filePath) {
|
|
27
|
+
const raw = readFileSync(filePath, "utf-8");
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(raw);
|
|
30
|
+
}
|
|
31
|
+
catch (cause) {
|
|
32
|
+
throw new Error(`Failed to parse ${filePath}: ${cause instanceof Error ? cause.message : cause}`, { cause });
|
|
33
|
+
}
|
|
34
|
+
}
|
package/dist/{vite-configuration-processor-plugin.js → vite-plugin-configuration-processor.js}
RENAMED
|
@@ -13,7 +13,7 @@ export default function processConfiguration(options) {
|
|
|
13
13
|
let finalAppShellConfig;
|
|
14
14
|
let basePath;
|
|
15
15
|
return {
|
|
16
|
-
name: "vite-plugin-appShell-
|
|
16
|
+
name: "vite-plugin-appShell-config-processor",
|
|
17
17
|
config(config, { command }) {
|
|
18
18
|
const projectRoot = root ?? config.root;
|
|
19
19
|
let appModules = {};
|
|
@@ -5,5 +5,4 @@ export declare const isExternalUrl: (url: string) => boolean;
|
|
|
5
5
|
export declare const dataUrlRE: RegExp;
|
|
6
6
|
export declare const isDataUrl: (url: string) => boolean;
|
|
7
7
|
export declare function checkCrossOrigin(html: string): any[];
|
|
8
|
-
|
|
9
|
-
export default fixCrossOrigin;
|
|
8
|
+
export default function fixCrossOrigin(): PluginOption;
|
|
@@ -48,11 +48,11 @@ export function checkCrossOrigin(html) {
|
|
|
48
48
|
}
|
|
49
49
|
return withCredentials;
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
export default function fixCrossOrigin() {
|
|
52
52
|
const withCredentials = {};
|
|
53
53
|
return [
|
|
54
54
|
{
|
|
55
|
-
name: "vite-crossorigin-fix-collect-info
|
|
55
|
+
name: "vite-plugin-crossorigin-fix-collect-info",
|
|
56
56
|
transformIndexHtml: {
|
|
57
57
|
order: "pre",
|
|
58
58
|
handler(html, info) {
|
|
@@ -61,7 +61,7 @@ const fixCrossOrigin = () => {
|
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
name: "vite-crossorigin-fix-replace
|
|
64
|
+
name: "vite-plugin-crossorigin-fix-replace",
|
|
65
65
|
transformIndexHtml: {
|
|
66
66
|
order: "post",
|
|
67
67
|
handler(html, context) {
|
|
@@ -79,5 +79,4 @@ const fixCrossOrigin = () => {
|
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
];
|
|
82
|
-
}
|
|
83
|
-
export default fixCrossOrigin;
|
|
82
|
+
}
|
|
@@ -39,6 +39,20 @@ function readJsonFile(filePath) {
|
|
|
39
39
|
return undefined;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Extracts the package name from a module specifier.
|
|
44
|
+
*
|
|
45
|
+
* Examples:
|
|
46
|
+
* react-dom/client → react-dom
|
|
47
|
+
* @emotion/react/jsx-dev → @emotion/react
|
|
48
|
+
*/
|
|
49
|
+
function toPackageName(specifier) {
|
|
50
|
+
if (specifier.startsWith("@")) {
|
|
51
|
+
const segments = specifier.split("/");
|
|
52
|
+
return segments.length >= 2 ? `${segments[0]}/${segments[1]}` : segments[0];
|
|
53
|
+
}
|
|
54
|
+
return specifier.split("/")[0];
|
|
55
|
+
}
|
|
42
56
|
/**
|
|
43
57
|
* Removes the build output prefix from an export path.
|
|
44
58
|
*
|
|
@@ -161,7 +175,7 @@ function appendStandardExports(exportsMap, outDir) {
|
|
|
161
175
|
* - preserves explicit null exclusions
|
|
162
176
|
* - supports nested conditional exports
|
|
163
177
|
*/
|
|
164
|
-
function generateDistPackageJson(root, outDir, buildOutDir, sourceCondition) {
|
|
178
|
+
function generateDistPackageJson(root, outDir, buildOutDir, sourceCondition, externalizedPackages) {
|
|
165
179
|
const pkgPath = path.join(root, "package.json");
|
|
166
180
|
const pkg = readJsonFile(pkgPath);
|
|
167
181
|
if (!pkg || !fs.existsSync(outDir)) {
|
|
@@ -179,33 +193,79 @@ function generateDistPackageJson(root, outDir, buildOutDir, sourceCondition) {
|
|
|
179
193
|
}
|
|
180
194
|
appendStandardExports(transformedExports, outDir);
|
|
181
195
|
const distPkg = {};
|
|
182
|
-
// Copy runtime-relevant fields
|
|
196
|
+
// Copy runtime-relevant fields. The "dependencies" and "optionalDependencies"
|
|
197
|
+
// fields are narrowed to only the modules that Rollup actually externalized,
|
|
198
|
+
// so the published package declares exactly the runtime modules it expects the
|
|
199
|
+
// host to provide.
|
|
183
200
|
for (const field of INCLUDED_FIELDS) {
|
|
184
|
-
if (pkg[field]
|
|
185
|
-
|
|
201
|
+
if (pkg[field] == null) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (field === "dependencies" || field === "optionalDependencies") {
|
|
205
|
+
const filtered = filterExternalizedDependencies(pkg[field], externalizedPackages);
|
|
206
|
+
if (Object.keys(filtered).length > 0) {
|
|
207
|
+
distPkg[field] = filtered;
|
|
208
|
+
}
|
|
209
|
+
continue;
|
|
186
210
|
}
|
|
211
|
+
distPkg[field] = pkg[field];
|
|
187
212
|
}
|
|
188
213
|
distPkg.exports = transformedExports;
|
|
189
214
|
fs.writeFileSync(path.join(outDir, "package.json"), JSON.stringify(distPkg, null, 2) + "\n");
|
|
190
215
|
console.info(`[App Shell] Generated ${buildOutDir}/package.json for ${pkg.name}`);
|
|
191
216
|
return true;
|
|
192
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Keeps only the declared dependencies whose package was externalized by the
|
|
220
|
+
* bundle (i.e. expected to be resolved by the host at runtime).
|
|
221
|
+
*/
|
|
222
|
+
function filterExternalizedDependencies(dependencies, externalizedPackages) {
|
|
223
|
+
const filtered = {};
|
|
224
|
+
for (const [name, range] of Object.entries(dependencies)) {
|
|
225
|
+
if (externalizedPackages.has(name)) {
|
|
226
|
+
filtered[name] = range;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return filtered;
|
|
230
|
+
}
|
|
193
231
|
// ─── Plugin ──────────────────────────────────────────────────────────────────
|
|
194
232
|
/**
|
|
195
233
|
* Generates a cleaned dist/package.json during Vite builds.
|
|
196
234
|
*/
|
|
197
235
|
export default function distPackageJsonPlugin(root, sourceCondition = DEFAULT_SOURCE_CONDITION) {
|
|
198
236
|
let config;
|
|
237
|
+
const externalizedPackages = new Set();
|
|
199
238
|
return {
|
|
200
|
-
name: "
|
|
239
|
+
name: "vite-plugin-dist-package-json",
|
|
201
240
|
apply: "build",
|
|
202
241
|
configResolved(resolved) {
|
|
203
242
|
config = resolved;
|
|
204
243
|
},
|
|
244
|
+
buildStart() {
|
|
245
|
+
// Reset per build so stale externalized packages from a previous build
|
|
246
|
+
// (e.g. in watch mode, where the plugin instance is reused) don't leak
|
|
247
|
+
// into the next dist/package.json.
|
|
248
|
+
externalizedPackages.clear();
|
|
249
|
+
},
|
|
250
|
+
generateBundle(_options, bundle) {
|
|
251
|
+
const emittedFiles = new Set(Object.keys(bundle));
|
|
252
|
+
for (const file of Object.values(bundle)) {
|
|
253
|
+
if (file.type !== "chunk") {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
// Imports that do not point to an emitted file are external modules
|
|
257
|
+
// that Rollup left for the host runtime to resolve.
|
|
258
|
+
for (const imported of [...file.imports, ...file.dynamicImports]) {
|
|
259
|
+
if (!emittedFiles.has(imported)) {
|
|
260
|
+
externalizedPackages.add(toPackageName(imported));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
205
265
|
closeBundle() {
|
|
206
266
|
const packageRoot = root ?? config.root;
|
|
207
267
|
const outDir = path.resolve(packageRoot, config.build.outDir);
|
|
208
|
-
generateDistPackageJson(packageRoot, outDir, config.build.outDir, sourceCondition);
|
|
268
|
+
generateDistPackageJson(packageRoot, outDir, config.build.outDir, sourceCondition, externalizedPackages);
|
|
209
269
|
},
|
|
210
270
|
};
|
|
211
271
|
}
|
|
@@ -8,7 +8,7 @@ import type { HvAppShellConfig } from "@hitachivantara/app-shell-shared";
|
|
|
8
8
|
* @param appShellConfig App shell config values
|
|
9
9
|
* @returns The app title
|
|
10
10
|
*/
|
|
11
|
-
export declare const getAppTitle: (generateEmptyShell: boolean, appShellConfig: HvAppShellConfig) =>
|
|
11
|
+
export declare const getAppTitle: (generateEmptyShell: boolean, appShellConfig: HvAppShellConfig) => string;
|
|
12
12
|
/**
|
|
13
13
|
* Add the <BASE> tag and icons preload in the index.html file.
|
|
14
14
|
* @param appShellConfig The app shell configuration.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import SHARED_DEPENDENCIES from "./shared-dependencies.js";
|
|
4
|
-
import { getExtraDependenciesString } from "./vite-importmap
|
|
4
|
+
import { getExtraDependenciesString } from "./vite-plugin-importmap.js";
|
|
5
5
|
export default function generateBashScript(externalImportMap, inlineConfig) {
|
|
6
6
|
let config;
|
|
7
7
|
let targetDir;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { computeSupportedLocales,
|
|
4
|
+
import { computeSupportedLocales, mergeDirs, SUPPORTED_LOCALES_FILE, } from "./locales-utils.js";
|
|
5
|
+
import { deepMerge, readJsonFile } from "./utils.js";
|
|
5
6
|
/**
|
|
6
7
|
* Resolves the app-shell-ui's locales directory path via its `./locales/*` export.
|
|
7
8
|
*/
|
|
@@ -63,7 +64,7 @@ export default function copyAppShellLocales(mergeUpstream = true) {
|
|
|
63
64
|
let resolvedOutDir;
|
|
64
65
|
let isBuild = false;
|
|
65
66
|
return {
|
|
66
|
-
name: "vite-plugin-
|
|
67
|
+
name: "vite-plugin-copy-appShell-locales",
|
|
67
68
|
// Capture the resolved output directory from Vite's config
|
|
68
69
|
configResolved(config) {
|
|
69
70
|
resolvedOutDir = path.resolve(config.root, config.build.outDir);
|
|
@@ -4,5 +4,4 @@ import type { PluginOption } from "vite";
|
|
|
4
4
|
* The metadata is used to help any troubleshoot activity by referencing
|
|
5
5
|
* the version of the app-shell-vite-plugin and app-shell-ui packages used by the app.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
export default injectMetadata;
|
|
7
|
+
export default function injectMetadata(): PluginOption;
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
1
|
import { resolveModule } from "./nodeModule.js";
|
|
2
|
+
import { readJsonFile } from "./utils.js";
|
|
3
3
|
const extractVersion = (packageJsonFile) => {
|
|
4
|
-
|
|
5
|
-
const packageObject = JSON.parse(packageJson);
|
|
6
|
-
return packageObject.version;
|
|
4
|
+
return readJsonFile(packageJsonFile).version;
|
|
7
5
|
};
|
|
8
6
|
/**
|
|
9
7
|
* This plugin injects metadata into the index.html file.
|
|
10
8
|
* The metadata is used to help any troubleshoot activity by referencing
|
|
11
9
|
* the version of the app-shell-vite-plugin and app-shell-ui packages used by the app.
|
|
12
10
|
*/
|
|
13
|
-
|
|
11
|
+
export default function injectMetadata() {
|
|
14
12
|
const appShellUIVersion = extractVersion(resolveModule("@hitachivantara/app-shell-ui/package.json"));
|
|
15
13
|
const appShellVitePluginVersion = extractVersion(resolveModule("@hitachivantara/app-shell-vite-plugin/package.json"));
|
|
16
14
|
return {
|
|
17
|
-
name: "vite-metadata
|
|
15
|
+
name: "vite-plugin-metadata",
|
|
18
16
|
transformIndexHtml() {
|
|
19
17
|
return [
|
|
20
18
|
{
|
|
@@ -34,5 +32,4 @@ const injectMetadata = () => {
|
|
|
34
32
|
];
|
|
35
33
|
},
|
|
36
34
|
};
|
|
37
|
-
}
|
|
38
|
-
export default injectMetadata;
|
|
35
|
+
}
|
|
@@ -8,7 +8,7 @@ const prepareConfigForDevMode = (config, selfAppName) => {
|
|
|
8
8
|
};
|
|
9
9
|
export default function serveAppShellConfig(appShellConfig, root, selfAppName, appShellConfigFile, automaticViewsFolder) {
|
|
10
10
|
return {
|
|
11
|
-
name: "vite-plugin-watch-
|
|
11
|
+
name: "vite-plugin-watch-appShell-config",
|
|
12
12
|
apply: "serve",
|
|
13
13
|
configureServer(server) {
|
|
14
14
|
const restartServer = (file) => {
|
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,16 +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 distPackageJsonPlugin from "./vite-dist-package-json
|
|
14
|
-
import generateBaseTag from "./vite-generate-base
|
|
15
|
-
import generateBashScript from "./vite-generate-bash-script
|
|
16
|
-
import generateImportmap, { extraDependencies, } from "./vite-importmap
|
|
17
|
-
import copyAppShellLocales from "./vite-locales
|
|
18
|
-
import injectMetadata from "./vite-metadata
|
|
19
|
-
import serveAppShellConfig from "./vite-watch-config
|
|
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";
|
|
20
20
|
const ViteBuildMode = {
|
|
21
21
|
PRODUCTION: "production",
|
|
22
22
|
DEVELOPMENT: "development",
|
|
@@ -34,8 +34,7 @@ export async function HvAppShellVitePlugin(opts = {}, env = {}) {
|
|
|
34
34
|
console.info(`AppShell Vite plugin running with type: ${type}`);
|
|
35
35
|
const devMode = mode === ViteBuildMode.DEVELOPMENT;
|
|
36
36
|
const buildEntryPoint = type !== "bundle";
|
|
37
|
-
const
|
|
38
|
-
const packageJson = JSON.parse(packageJsonRaw);
|
|
37
|
+
const packageJson = readJsonFile(path.resolve(root, "package.json"));
|
|
39
38
|
const appShellConfigFile = !generateEmptyShell
|
|
40
39
|
? findAppShellConfigFile(root)
|
|
41
40
|
: undefined;
|
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,39 +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.4",
|
|
24
|
-
"@hitachivantara/app-shell-shared": "^2.3.2",
|
|
25
|
-
"@hitachivantara/app-shell-ui": "^2.3.3",
|
|
26
|
-
"@hitachivantara/uikit-react-shared": "^6.0.5",
|
|
27
40
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
28
41
|
"@rollup/plugin-json": "^6.0.0",
|
|
29
42
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
30
43
|
"@rollup/plugin-replace": "^6.0.3",
|
|
31
44
|
"@rollup/plugin-terser": "^1.0.0",
|
|
32
|
-
"
|
|
33
|
-
"es-module-shims": "^1.6.3",
|
|
34
|
-
"jiti": "^2.6.1",
|
|
45
|
+
"mock-fs": "^5.2.0",
|
|
35
46
|
"react": "^18.2.0",
|
|
36
47
|
"react-dom": "^18.2.0",
|
|
37
48
|
"react-router-dom": "^6.9.0",
|
|
38
|
-
"rollup": "^4.57.1"
|
|
39
|
-
"vite-plugin-static-copy": "^4.1.0"
|
|
40
|
-
},
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"vite": "^4.1.4 || ^5.0.4 || ^6.0.0 || ^7.0.0 || ^8.0.0"
|
|
49
|
+
"rollup": "^4.57.1"
|
|
43
50
|
},
|
|
44
51
|
"files": [
|
|
45
52
|
"dist"
|
|
46
53
|
],
|
|
47
|
-
"publishConfig": {
|
|
48
|
-
"access": "public",
|
|
49
|
-
"directory": "package"
|
|
50
|
-
},
|
|
51
54
|
"main": "./dist/index.js",
|
|
52
55
|
"module": "./dist/index.js",
|
|
53
56
|
"types": "./dist/index.d.ts",
|
|
@@ -58,5 +61,8 @@
|
|
|
58
61
|
},
|
|
59
62
|
"./package.json": "./package.json"
|
|
60
63
|
},
|
|
61
|
-
"
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public"
|
|
66
|
+
},
|
|
67
|
+
"gitHead": "4d8cd01cd9b1786dc00fd9e8edb962b2c80e4b03"
|
|
62
68
|
}
|
/package/dist/{vite-configuration-processor-plugin.d.ts → vite-plugin-configuration-processor.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
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
|