@hitachivantara/app-shell-vite-plugin 1.7.3 → 1.7.5

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.
@@ -3,15 +3,7 @@ export declare const require: NodeJS.Require;
3
3
  * Resolves the module entrypoint by name and normalizes slashes to be posix/unix-like forward slashes.
4
4
  *
5
5
  * @param moduleName The name of the module to be searched for
6
- * @returns The module path normalized
7
- */
8
- export declare function resolveModule(moduleName: string): string;
9
- /**
10
- * This function will find out the module path using node `require.resolve` function
11
- * and add the suffix param after the folder with module name.
12
- *
13
- * @param moduleName "@module/name"
14
6
  * @param suffix to be added after the module path
15
- * @returns the /path/to/@module/name/<suffix>
7
+ * @returns The module path normalized
16
8
  */
17
- export declare function getModulePath(moduleName: string, suffix: string): string;
9
+ export declare function resolveModule(moduleName: string, suffix?: string): string;
@@ -1,30 +1,14 @@
1
1
  import { createRequire } from "node:module";
2
- import { join } from "node:path";
3
- import { findUpSync } from "find-up-simple";
2
+ import { dirname, join } from "node:path";
4
3
  export const require = createRequire(import.meta.url);
5
4
  /**
6
5
  * Resolves the module entrypoint by name and normalizes slashes to be posix/unix-like forward slashes.
7
6
  *
8
7
  * @param moduleName The name of the module to be searched for
9
- * @returns The module path normalized
10
- */
11
- export function resolveModule(moduleName) {
12
- return require.resolve(moduleName).replace(/\\+/g, "/");
13
- }
14
- /** Resolves the module directory (where `package.json` is) by `moduleName` */
15
- function resolveModuleDirectory(moduleName) {
16
- const moduleEntrypoint = resolveModule(moduleName);
17
- const modulePackage = findUpSync("package.json", { cwd: moduleEntrypoint });
18
- return modulePackage?.slice(0, modulePackage.lastIndexOf("/")) || "";
19
- }
20
- /**
21
- * This function will find out the module path using node `require.resolve` function
22
- * and add the suffix param after the folder with module name.
23
- *
24
- * @param moduleName "@module/name"
25
8
  * @param suffix to be added after the module path
26
- * @returns the /path/to/@module/name/<suffix>
9
+ * @returns The module path normalized
27
10
  */
28
- export function getModulePath(moduleName, suffix) {
29
- return join(resolveModuleDirectory(moduleName), suffix);
11
+ export function resolveModule(moduleName, suffix) {
12
+ const entrypoint = require.resolve(moduleName);
13
+ return suffix ? join(dirname(entrypoint), suffix) : entrypoint;
30
14
  }
@@ -1,11 +1,6 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { getAppModules, getBasePath, replaceSelf, startsWithSelf, } from "./config-utils.js";
4
- var ViteCommand;
5
- (function (ViteCommand) {
6
- ViteCommand["BUILD"] = "build";
7
- ViteCommand["SERVE"] = "serve";
8
- })(ViteCommand || (ViteCommand = {}));
9
4
  export function replaceReferencesToSelf(bundles, selfAppName) {
10
5
  return bundles.map((bundleDefinition) => {
11
6
  if ("views" in bundleDefinition && bundleDefinition.views != null) {
@@ -70,7 +65,7 @@ export default function processConfiguration(root, appShellConfig, selfAppName,
70
65
  },
71
66
  },
72
67
  // if serve (preview/dev) it uses the basePath. Otherwise(build), use ./
73
- base: command === ViteCommand.SERVE ? basePath : "./",
68
+ base: command === "serve" ? basePath : "./",
74
69
  };
75
70
  },
76
71
  /**
@@ -5,7 +5,7 @@ import { loadEnv } from "vite";
5
5
  import { viteStaticCopy } from "vite-plugin-static-copy";
6
6
  import { applyAutomaticMenu, applyAutomaticViewsAndRoutes, } from "./automatic-utils.js";
7
7
  import { findAppShellConfigFile, getFinalModuleName, loadConfigFile, } from "./config-utils.js";
8
- import { getModulePath, resolveModule } from "./nodeModule.js";
8
+ import { resolveModule } from "./nodeModule.js";
9
9
  import SHARED_DEPENDENCIES from "./shared-dependencies.js";
10
10
  import getVirtualEntrypoints from "./virtual-entrypoints.js";
11
11
  import processConfiguration from "./vite-configuration-processor-plugin.js";
@@ -15,11 +15,10 @@ import generateBashScript from "./vite-generate-bash-script-plugin.js";
15
15
  import generateImportmap, { extraDependencies, } from "./vite-importmap-plugin.js";
16
16
  import injectMetadata from "./vite-metadata-plugin.js";
17
17
  import serveAppShellConfig from "./vite-watch-config-plugin.js";
18
- var ViteBuildMode;
19
- (function (ViteBuildMode) {
20
- ViteBuildMode["PRODUCTION"] = "production";
21
- ViteBuildMode["DEVELOPMENT"] = "development";
22
- })(ViteBuildMode || (ViteBuildMode = {}));
18
+ const ViteBuildMode = {
19
+ PRODUCTION: "production",
20
+ DEVELOPMENT: "development",
21
+ };
23
22
  /**
24
23
  * Vite plugin to support App Shell apps setup
25
24
  * @param opts Plugin options
@@ -54,14 +53,12 @@ export function HvAppShellVitePlugin(opts = {}, env = {}) {
54
53
  viteStaticCopy({
55
54
  targets: [
56
55
  {
57
- src: getModulePath("es-module-shims", "dist/*"),
56
+ src: resolveModule("es-module-shims", "*"),
58
57
  dest: "bundles",
59
58
  },
60
59
  // copy the ui kit icons' sprites to the "icons" folder
61
60
  {
62
- src: [
63
- getModulePath("@hitachivantara/uikit-react-icons", "dist/sprites/*.svg"),
64
- ],
61
+ src: resolveModule("@hitachivantara/uikit-react-icons", "../sprites/*.svg"),
65
62
  dest: "icons",
66
63
  },
67
64
  ...(!devMode && buildEntryPoint
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/app-shell-vite-plugin",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "Hitachi Vantara UI Kit Team",
@@ -17,10 +17,10 @@
17
17
  "dependencies": {
18
18
  "@emotion/cache": "^11.11.0",
19
19
  "@emotion/react": "^11.11.1",
20
- "@hitachivantara/app-shell-shared": "^1.5.3",
21
- "@hitachivantara/app-shell-ui": "^1.10.3",
22
- "@hitachivantara/uikit-react-icons": "^5.15.3",
23
- "@hitachivantara/uikit-react-shared": "^5.4.3",
20
+ "@hitachivantara/app-shell-shared": "^1.5.5",
21
+ "@hitachivantara/app-shell-ui": "^1.10.5",
22
+ "@hitachivantara/uikit-react-icons": "^5.15.5",
23
+ "@hitachivantara/uikit-react-shared": "^5.4.5",
24
24
  "@rollup/plugin-commonjs": "^25.0.7",
25
25
  "@rollup/plugin-json": "^6.0.0",
26
26
  "@rollup/plugin-node-resolve": "^15.0.1",
@@ -28,13 +28,12 @@
28
28
  "@rollup/plugin-terser": "^0.4.0",
29
29
  "@rollup/plugin-virtual": "^3.0.1",
30
30
  "es-module-shims": "^1.6.3",
31
- "find-up-simple": "^1.0.1",
32
31
  "react": "^18.2.0",
33
32
  "react-dom": "^18.2.0",
34
33
  "react-router-dom": "^6.9.0",
35
34
  "rollup": "^4.6.1",
36
35
  "ts-node": "^10.9.1",
37
- "vite-plugin-static-copy": "^2.0.0"
36
+ "vite-plugin-static-copy": "^3.0.0"
38
37
  },
39
38
  "peerDependencies": {
40
39
  "vite": "^4.1.4 || ^5.0.4 || ^6.0.0"
@@ -56,5 +55,5 @@
56
55
  },
57
56
  "./package.json": "./package.json"
58
57
  },
59
- "gitHead": "d260751e0d2244d0f37e5368f954d5a261a6535e"
58
+ "gitHead": "5ed545e2d3d9374198340f910ac464cb84b309ed"
60
59
  }