@hitachivantara/app-shell-vite-plugin 2.0.0-next.4 → 2.0.0-next.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.
@@ -1,6 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import { getAppModules, getBasePath } from "./config-utils.js";
4
+ import sharedDependencies from "./shared-dependencies.js";
4
5
  /**
5
6
  * Process configuration, executing several tasks:
6
7
  * - Create rollup configuration to support module creation
@@ -90,12 +91,13 @@ export default function processConfiguration(root, appShellConfig, selfAppName,
90
91
  }
91
92
  },
92
93
  transformIndexHtml: {
94
+ order: "post",
93
95
  handler: (html) => {
94
- if (!inlineConfig) {
95
- return undefined;
96
- }
96
+ const processedHtml = stripSharedDependencies(html);
97
+ if (!inlineConfig)
98
+ return processedHtml;
97
99
  return {
98
- html,
100
+ html: processedHtml,
99
101
  tags: [
100
102
  {
101
103
  tag: "script",
@@ -110,3 +112,16 @@ export default function processConfiguration(root, appShellConfig, selfAppName,
110
112
  },
111
113
  };
112
114
  }
115
+ /** strips the `<script>` tags with bare `sharedDependencies` modules from the `html` string */
116
+ function stripSharedDependencies(html) {
117
+ const sharedDeps = sharedDependencies
118
+ .map((dep) => dep.moduleId)
119
+ // escape the dependencies
120
+ .map((dep) => dep.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"))
121
+ .join("|");
122
+ const sharedDepsRegex = new RegExp(`<script type="module"[^>]+src="(${sharedDeps})"[^>]*><\\/script>`, "g");
123
+ return (html
124
+ .replaceAll(sharedDepsRegex, "")
125
+ // remove any empty lines that may have been left
126
+ .replaceAll(/\n\s*\n/g, "\n"));
127
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/app-shell-vite-plugin",
3
- "version": "2.0.0-next.4",
3
+ "version": "2.0.0-next.5",
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": "^2.0.0-next.2",
24
- "@hitachivantara/app-shell-shared": "^2.0.0-next.4",
25
- "@hitachivantara/app-shell-ui": "^2.0.0-next.4",
26
- "@hitachivantara/uikit-react-icons": "^6.0.0-next.4",
27
- "@hitachivantara/uikit-react-shared": "^6.0.0-next.4",
23
+ "@hitachivantara/app-shell-services": "^2.0.0-next.3",
24
+ "@hitachivantara/app-shell-shared": "^2.0.0-next.5",
25
+ "@hitachivantara/app-shell-ui": "^2.0.0-next.5",
26
+ "@hitachivantara/uikit-react-icons": "^6.0.0-next.5",
27
+ "@hitachivantara/uikit-react-shared": "^6.0.0-next.5",
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",
@@ -54,10 +54,10 @@
54
54
  "types": "./dist/index.d.ts",
55
55
  "exports": {
56
56
  ".": {
57
- "import": "./dist/index.js",
58
- "types": "./dist/index.d.ts"
57
+ "types": "./dist/index.d.ts",
58
+ "default": "./dist/index.js"
59
59
  },
60
60
  "./package.json": "./package.json"
61
61
  },
62
- "gitHead": "85329dc0016ea5065c3258799bff06b1f98924db"
62
+ "gitHead": "bf1f8dcbead53467253e86b24f15ecbc2b23ed0f"
63
63
  }