@hitachivantara/app-shell-vite-plugin 1.6.10 → 1.7.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.
Files changed (101) hide show
  1. package/README.md +11 -13
  2. package/dist/automatic-utils.d.ts +0 -1
  3. package/dist/automatic-utils.js +16 -17
  4. package/dist/config-utils.d.ts +0 -1
  5. package/dist/config-utils.js +8 -9
  6. package/dist/esm-externals/emotion-cache.production.min.js +2 -2
  7. package/dist/esm-externals/emotion-cache.production.min.js.map +1 -1
  8. package/dist/esm-externals/emotion-react.production.min.js +2 -2
  9. package/dist/esm-externals/emotion-react.production.min.js.map +1 -1
  10. package/dist/esm-externals/react-dom.production.min.js +2 -2
  11. package/dist/esm-externals/react-dom.production.min.js.map +1 -1
  12. package/dist/esm-externals/react-router-dom.production.min.js +9 -9
  13. package/dist/esm-externals/react-router-dom.production.min.js.map +1 -1
  14. package/dist/esm-externals/react.production.min.js +2 -2
  15. package/dist/esm-externals/react.production.min.js.map +1 -1
  16. package/dist/index.d.ts +1 -3
  17. package/dist/index.js +0 -2
  18. package/dist/nodeModule.d.ts +2 -4
  19. package/dist/nodeModule.js +11 -8
  20. package/dist/shared-dependencies.d.ts +0 -1
  21. package/dist/shared-dependencies.js +8 -9
  22. package/dist/tests/automatic-utils.test.d.ts +0 -1
  23. package/dist/tests/automatic-utils.test.js +102 -99
  24. package/dist/tests/config-utils.test.d.ts +0 -1
  25. package/dist/tests/config-utils.test.js +10 -10
  26. package/dist/tests/mocks/path.mock.d.ts +0 -1
  27. package/dist/tests/mocks/path.mock.js +1 -2
  28. package/dist/tests/vite-configuration-processor-plugin.test.d.ts +0 -1
  29. package/dist/tests/vite-configuration-processor-plugin.test.js +22 -23
  30. package/dist/tests/vite-crossorigin-fix-plugin.test.d.ts +0 -1
  31. package/dist/tests/vite-crossorigin-fix-plugin.test.js +2 -3
  32. package/dist/tests/vite-generate-base-plugin.test.d.ts +0 -1
  33. package/dist/tests/vite-generate-base-plugin.test.js +1 -2
  34. package/dist/tests/vite-metadata-plugin.test.d.ts +0 -1
  35. package/dist/tests/vite-metadata-plugin.test.js +9 -9
  36. package/dist/virtual-entrypoints.d.ts +0 -1
  37. package/dist/virtual-entrypoints.js +1 -2
  38. package/dist/vite-configuration-processor-plugin.d.ts +0 -1
  39. package/dist/vite-configuration-processor-plugin.js +18 -19
  40. package/dist/vite-crossorigin-fix-plugin.d.ts +1 -2
  41. package/dist/vite-crossorigin-fix-plugin.js +7 -8
  42. package/dist/vite-generate-base-plugin.d.ts +1 -2
  43. package/dist/vite-generate-base-plugin.js +8 -9
  44. package/dist/vite-generate-bash-script-plugin.d.ts +0 -1
  45. package/dist/vite-generate-bash-script-plugin.js +4 -5
  46. package/dist/vite-importmap-plugin.d.ts +0 -1
  47. package/dist/vite-importmap-plugin.js +21 -22
  48. package/dist/vite-metadata-plugin.d.ts +0 -1
  49. package/dist/vite-metadata-plugin.js +7 -8
  50. package/dist/vite-plugin.d.ts +1 -3
  51. package/dist/vite-plugin.js +25 -27
  52. package/dist/vite-watch-config-plugin.d.ts +0 -1
  53. package/dist/vite-watch-config-plugin.js +7 -8
  54. package/package.json +36 -44
  55. package/LICENSE +0 -201
  56. package/dist/automatic-utils.d.ts.map +0 -1
  57. package/dist/automatic-utils.js.map +0 -1
  58. package/dist/config-utils.d.ts.map +0 -1
  59. package/dist/config-utils.js.map +0 -1
  60. package/dist/index.d.ts.map +0 -1
  61. package/dist/index.js.map +0 -1
  62. package/dist/nodeModule.d.ts.map +0 -1
  63. package/dist/nodeModule.js.map +0 -1
  64. package/dist/shared-dependencies.d.ts.map +0 -1
  65. package/dist/shared-dependencies.js.map +0 -1
  66. package/dist/tests/automatic-utils.test.d.ts.map +0 -1
  67. package/dist/tests/automatic-utils.test.js.map +0 -1
  68. package/dist/tests/config-utils.test.d.ts.map +0 -1
  69. package/dist/tests/config-utils.test.js.map +0 -1
  70. package/dist/tests/mocks/path.mock.d.ts.map +0 -1
  71. package/dist/tests/mocks/path.mock.js.map +0 -1
  72. package/dist/tests/setup.d.ts +0 -2
  73. package/dist/tests/setup.d.ts.map +0 -1
  74. package/dist/tests/setup.js +0 -2
  75. package/dist/tests/setup.js.map +0 -1
  76. package/dist/tests/vite-configuration-processor-plugin.test.d.ts.map +0 -1
  77. package/dist/tests/vite-configuration-processor-plugin.test.js.map +0 -1
  78. package/dist/tests/vite-crossorigin-fix-plugin.test.d.ts.map +0 -1
  79. package/dist/tests/vite-crossorigin-fix-plugin.test.js.map +0 -1
  80. package/dist/tests/vite-generate-base-plugin.test.d.ts.map +0 -1
  81. package/dist/tests/vite-generate-base-plugin.test.js.map +0 -1
  82. package/dist/tests/vite-metadata-plugin.test.d.ts.map +0 -1
  83. package/dist/tests/vite-metadata-plugin.test.js.map +0 -1
  84. package/dist/virtual-entrypoints.d.ts.map +0 -1
  85. package/dist/virtual-entrypoints.js.map +0 -1
  86. package/dist/vite-configuration-processor-plugin.d.ts.map +0 -1
  87. package/dist/vite-configuration-processor-plugin.js.map +0 -1
  88. package/dist/vite-crossorigin-fix-plugin.d.ts.map +0 -1
  89. package/dist/vite-crossorigin-fix-plugin.js.map +0 -1
  90. package/dist/vite-generate-base-plugin.d.ts.map +0 -1
  91. package/dist/vite-generate-base-plugin.js.map +0 -1
  92. package/dist/vite-generate-bash-script-plugin.d.ts.map +0 -1
  93. package/dist/vite-generate-bash-script-plugin.js.map +0 -1
  94. package/dist/vite-importmap-plugin.d.ts.map +0 -1
  95. package/dist/vite-importmap-plugin.js.map +0 -1
  96. package/dist/vite-metadata-plugin.d.ts.map +0 -1
  97. package/dist/vite-metadata-plugin.js.map +0 -1
  98. package/dist/vite-plugin.d.ts.map +0 -1
  99. package/dist/vite-plugin.js.map +0 -1
  100. package/dist/vite-watch-config-plugin.d.ts.map +0 -1
  101. package/dist/vite-watch-config-plugin.js.map +0 -1
@@ -1,11 +1,11 @@
1
- import path from "path";
1
+ import path from "node:path";
2
+ import { replaceSelf } from "./config-utils.js";
2
3
  import { require } from "./nodeModule.js";
3
4
  import { replaceReferencesToSelf } from "./vite-configuration-processor-plugin.js";
4
- import { replaceSelf } from "./config-utils.js";
5
5
  const prepareConfigForDevMode = (config, selfAppName) => {
6
6
  const { mainPanel, header, theming, providers } = config;
7
7
  const replacedConfig = {
8
- ...config
8
+ ...config,
9
9
  };
10
10
  const self = `${selfAppName}/`;
11
11
  // Main panel - Views
@@ -18,7 +18,7 @@ const prepareConfigForDevMode = (config, selfAppName) => {
18
18
  }
19
19
  // Theming
20
20
  if (theming?.themes && replacedConfig.theming) {
21
- replacedConfig.theming.themes = theming.themes?.map(theme => {
21
+ replacedConfig.theming.themes = theming.themes?.map((theme) => {
22
22
  return replaceSelf(theme, self);
23
23
  });
24
24
  }
@@ -39,7 +39,7 @@ export default function serveAppShellConfig(appShellConfig, root, selfAppName, a
39
39
  delete require.cache[require.resolve(appShellConfigFile)];
40
40
  server
41
41
  .restart()
42
- .catch(e => console.error(`Restart failed with: ${e}`));
42
+ .catch((e) => console.error(`Restart failed with: ${e}`));
43
43
  }
44
44
  };
45
45
  const restartServer2 = (file) => {
@@ -47,7 +47,7 @@ export default function serveAppShellConfig(appShellConfig, root, selfAppName, a
47
47
  console.info("Automatic views folder changed. Reloading...");
48
48
  server
49
49
  .restart()
50
- .catch(e => console.error(`Restart failed with: ${e}`));
50
+ .catch((e) => console.error(`Restart failed with: ${e}`));
51
51
  }
52
52
  };
53
53
  if (appShellConfigFile != null) {
@@ -62,7 +62,6 @@ export default function serveAppShellConfig(appShellConfig, root, selfAppName, a
62
62
  server.middlewares.use(`${server.config.base}app-shell.config.json`, async (req, res) => {
63
63
  res.end(JSON.stringify(prepareConfigForDevMode(appShellConfig, selfAppName)));
64
64
  });
65
- }
65
+ },
66
66
  };
67
67
  }
68
- //# sourceMappingURL=vite-watch-config-plugin.js.map
package/package.json CHANGED
@@ -1,47 +1,26 @@
1
1
  {
2
2
  "name": "@hitachivantara/app-shell-vite-plugin",
3
- "version": "1.6.10",
4
- "description": "AppShell Vite Plugin",
5
- "author": "Hitachi Vantara - Boba Fett Team",
6
- "license": "Apache-2.0",
3
+ "version": "1.7.0",
7
4
  "type": "module",
5
+ "private": false,
6
+ "author": "Hitachi Vantara UI Kit Team",
7
+ "description": "AppShell Vite Plugin",
8
+ "homepage": "https://github.com/lumada-design/hv-uikit-react",
8
9
  "sideEffects": false,
9
- "module": "dist/index.js",
10
- "main": "dist/index.js",
11
- "typings": "./dist/index.d.ts",
12
- "exports": {
13
- ".": {
14
- "import": "./dist/index.js",
15
- "types": "./dist/index.d.ts"
16
- },
17
- "./package.json": "./package.json"
18
- },
19
- "files": [
20
- "dist"
21
- ],
22
- "publishConfig": {
23
- "access": "public"
24
- },
25
- "scripts": {
26
- "build": "npm-run-all clean build:*",
27
- "build:esm": "tsc -p tsconfig.json",
28
- "build:esm-externals": "npx rollup --config",
29
- "clean": "npx rimraf ./dist *.tgz tsconfig.tsbuildinfo",
30
- "dev": "tsc-watch --noClear -p tsconfig.json",
31
- "lint-check": "npx eslint --ext .js,.jsx,.ts,.tsx src --color",
32
- "lint": "npm-run-all --parallel lint:*",
33
- "lint:eslint": "npm run lint-check -- --cache --fix",
34
- "lint:prettier": "npx prettier --write \"src/**/*.{html,css,js,jsx,ts,tsx}\"",
35
- "test": "vitest run",
36
- "coverage": "vitest run --coverage"
10
+ "license": "Apache-2.0",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/lumada-design/hv-uikit-react.git",
14
+ "directory": "packages/app-shell-vite-plugin"
37
15
  },
16
+ "bugs": "https://github.com/lumada-design/hv-uikit-react/issues",
38
17
  "dependencies": {
39
18
  "@emotion/cache": "^11.11.0",
40
19
  "@emotion/react": "^11.11.1",
41
- "@hitachivantara/app-shell-shared": "1.4.2",
42
- "@hitachivantara/app-shell-ui": "1.9.1",
43
- "@hitachivantara/uikit-react-icons": "^5.11.0",
44
- "@hitachivantara/uikit-react-shared": "^5.3.3",
20
+ "@hitachivantara/app-shell-shared": "^1.5.0",
21
+ "@hitachivantara/app-shell-ui": "^1.10.0",
22
+ "@hitachivantara/uikit-react-icons": "^5.15.0",
23
+ "@hitachivantara/uikit-react-shared": "^5.4.0",
45
24
  "@rollup/plugin-commonjs": "^25.0.7",
46
25
  "@rollup/plugin-json": "^6.0.0",
47
26
  "@rollup/plugin-node-resolve": "^15.0.1",
@@ -49,20 +28,33 @@
49
28
  "@rollup/plugin-terser": "^0.4.0",
50
29
  "@rollup/plugin-virtual": "^3.0.1",
51
30
  "es-module-shims": "^1.6.3",
31
+ "find-up-simple": "^1.0.1",
52
32
  "react": "^18.2.0",
53
33
  "react-dom": "^18.2.0",
54
34
  "react-router-dom": "^6.9.0",
55
35
  "rollup": "^4.6.1",
56
36
  "ts-node": "^10.9.1",
57
- "vite-plugin-static-copy": "^1.0.0"
58
- },
59
- "devDependencies": {
60
- "@types/react": "^18.0.28",
61
- "@types/react-dom": "^18.0.11",
62
- "tsc-watch": "^6.0.0"
37
+ "vite-plugin-static-copy": "^2.0.0"
63
38
  },
64
39
  "peerDependencies": {
65
- "vite": "^4.1.4 || ^5.0.4"
40
+ "vite": "^4.1.4 || ^5.0.4 || ^6.0.0"
41
+ },
42
+ "files": [
43
+ "dist"
44
+ ],
45
+ "publishConfig": {
46
+ "access": "public",
47
+ "directory": "package"
48
+ },
49
+ "main": "./dist/index.js",
50
+ "module": "./dist/index.js",
51
+ "types": "./dist/index.d.ts",
52
+ "exports": {
53
+ ".": {
54
+ "import": "./dist/index.js",
55
+ "types": "./dist/index.d.ts"
56
+ },
57
+ "./package.json": "./package.json"
66
58
  },
67
- "gitHead": "6ed403e0c81fc85f5f7fdd7cbb0233df855f416c"
59
+ "gitHead": "d96b3d461f5676cf95f4321fd9a3104874814fc3"
68
60
  }
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2019 Hitachi Vantara Corporation
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1 +0,0 @@
1
- {"version":3,"file":"automatic-utils.d.ts","sourceRoot":"","sources":["../src/automatic-utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,gBAAgB,EAEhB,qBAAqB,EACtB,MAAM,kCAAkC,CAAC;AA2C1C,UAAU,aAAa;IACrB,UAAU,EAAE,qBAAqB,CAAC;IAClC,MAAM,EAAE,MAAM,CAAC;C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AEH,qBAAqB,CAAC,IAAI,GAAG,IAAI,CAAC;AACpC,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nimport type {\n HvAppShellConfig,\n HvAppShellMenuConfig,\n HvAppShellViewsConfig\n} from \"@hitachivantara/app-shell-shared\";\n\nimport { getFinalModuleName } from \"./config-utils.js\";\n\nfunction createLabel(str: string) {\n const noExtension = str.replace(/\\.[^/.]+$/, \"\");\n const splitByCapital = noExtension.split(/(?=[A-Z])/).join(\" \");\n return splitByCapital.charAt(0).toUpperCase() + splitByCapital.slice(1);\n}\n\n/**\n * Find all the index.tsx or index.jsx files existent at the provided path (including all the subdirectories)\n * @param dir the path to search for the index.tsx or index.jsx files\n */\nfunction findIndexFiles(dir: string): string[] {\n const files: string[] = [];\n\n fs.readdirSync(dir).forEach(file => {\n const filePath = path.join(dir, file);\n const stat = fs.statSync(filePath);\n\n if (stat.isDirectory()) {\n files.push(...findIndexFiles(filePath));\n } else if (/^index\\.[tj]sx?$/.exec(file)) {\n files.push(filePath);\n }\n });\n\n return files;\n}\n\nfunction flattenViews(views: HvAppShellViewsConfig[], base = \"\") {\n return views.reduce<HvAppShellViewsConfig[]>((acc, view) => {\n // concatenate base with view route\n const route = `${base}${view.route}` as HvAppShellViewsConfig[\"route\"];\n acc.push({ ...view, route });\n if (view.views != null) {\n acc.push(...flattenViews(view.views, route));\n }\n return acc;\n }, []);\n}\n\ninterface AutomaticView {\n viewConfig: HvAppShellViewsConfig;\n module: string;\n}\n\n/**\n * Maps, through all the index files under viewsFolderPath, to a set of main views config (@see HvAppShellViewsConfig)\n * and the respective module (to be transformed to the final bundle)\n * @param root the absolute path to the views folder\n * @param viewsFolder the relative base folder where the files are included\n * @return an array of viewConfig and their correspondent module definition\n */\nexport function mapFolderIndexFilesToRoutes(\n root: string,\n viewsFolder: string\n): AutomaticView[] {\n // the regex removes any existing '/' either at the start, at the end or in both cases of the viewsFolder parameter.\n const normalizedViewsFolder = viewsFolder.replace(/(^\\/|\\/$|)/g, \"\");\n\n const viewsFolderPath = path.resolve(root, normalizedViewsFolder);\n if (!fs.existsSync(viewsFolderPath)) {\n return [];\n }\n\n const routes: { viewConfig: HvAppShellViewsConfig; module: string }[] = [];\n const indexFiles = findIndexFiles(viewsFolderPath);\n\n indexFiles.forEach(filePath => {\n // required to work on Windows and also on Linux/macOS\n const normalizedFilePath = filePath.replaceAll(path.sep, \"/\");\n\n // fetches what is between the normalizedViewsFolder (inclusive) and the last '/' (exclusive)\n // example: 'dummy/path/src/pages/Page1/index.tsx' and 'src/pages' returns src/pages/Page1\n const bundle = normalizedFilePath.substring(\n normalizedFilePath.lastIndexOf(`/${normalizedViewsFolder}/`) + 1,\n normalizedFilePath.lastIndexOf(\"/\")\n );\n\n const route = bundle\n .replace(new RegExp(`^${normalizedViewsFolder}`), \"\")\n .replaceAll(/\\$/g, \":\")\n .toLowerCase() as HvAppShellViewsConfig[\"route\"];\n\n const viewConfig = {\n bundle: `@self/${getFinalModuleName(bundle)}.js`,\n route\n };\n routes.push({ viewConfig, module: bundle });\n });\n\n return routes;\n}\n\n/**\n * Adds the automatically identified views (from the \"viewsFolder\" folder) to the AppShell configuration and calculate\n * the correspondent modules to be generated.\n *\n * It guarantees that an automatic route will not overlap any manual defined route.\n *\n * @param config The app Shell config file\n * @param selfAppName The package name of this app\n * @param root Project root folder\n * @param viewsFolder Views folder\n * @return the array of modules to be created by the rollup mechanism\n */\nexport function applyAutomaticViewsAndRoutes(\n config: HvAppShellConfig,\n selfAppName: string,\n root: string,\n viewsFolder: string\n): string[] {\n const appShellConfiguration = config;\n\n const routes = mapFolderIndexFilesToRoutes(root, viewsFolder);\n if (routes.length === 0) {\n return [];\n }\n\n const views = routes.map(r => r.viewConfig);\n const modules = routes.map(r => r.module);\n\n if (\n !appShellConfiguration.mainPanel?.views ||\n appShellConfiguration.mainPanel.views.length === 0\n ) {\n if (!appShellConfiguration.mainPanel) {\n appShellConfiguration.mainPanel = { views };\n } else {\n appShellConfiguration.mainPanel.views = views;\n }\n } else {\n const flattenedViews = flattenViews(appShellConfiguration.mainPanel.views);\n\n const existingRoutes = flattenedViews.map(view => view.route);\n const existingBundles = flattenedViews.reduce((bundles, view) => {\n if (view.bundle.startsWith(\"@self/\")) {\n bundles.push(view.bundle);\n } else if (view.bundle.startsWith(selfAppName)) {\n bundles.push(view.bundle.replace(selfAppName, \"@self\"));\n }\n return bundles;\n }, [] as string[]);\n\n const nonOverlappingRoutes = routes.filter(route => {\n if (existingBundles.includes(route.viewConfig.bundle)) {\n // automatic View is already defined in the config\n return false;\n }\n\n if (existingRoutes.includes(route.viewConfig.route)) {\n // automatic route is already defined in the config and associated with a different bundle\n console.info(\n `SKIPPED: Automatic route for bundle ${route.viewConfig.bundle} not created as it conflicts with existing route in the config file (${route.viewConfig.route}).`\n );\n return false;\n }\n\n return true;\n });\n\n const nonOverlappingViews = nonOverlappingRoutes.map(r => r.viewConfig);\n\n appShellConfiguration.mainPanel.views.push(...nonOverlappingViews);\n }\n\n return modules;\n}\n\nexport function applyAutomaticMenu(config: HvAppShellConfig) {\n const appShellConfiguration = config;\n\n if (\n !appShellConfiguration.mainPanel?.views ||\n appShellConfiguration.mainPanel?.views.length === 0\n ) {\n return;\n }\n\n const menu: HvAppShellMenuConfig[] = [];\n\n appShellConfiguration.mainPanel?.views.forEach(view => {\n // skip dynamic routes (e.g. /list/:id))\n if (view.route.indexOf(\":\") !== -1) {\n return;\n }\n\n let currentMenu = menu;\n const bundleParts = view.bundle.split(\"/\");\n const numberOfParts = view.route\n .split(\"/\")\n .filter(part => part !== \"\").length;\n const srcFolderParts = bundleParts.length - numberOfParts;\n if (bundleParts.length <= srcFolderParts) {\n return;\n }\n for (let j = srcFolderParts; j < bundleParts.length - 1; j += 1) {\n const label = createLabel(bundleParts[j]);\n let submenu = currentMenu.find(item => item.label === label);\n if (submenu == null) {\n submenu = {\n label,\n submenus: []\n };\n currentMenu.push(submenu);\n }\n currentMenu = submenu.submenus!;\n }\n\n const label = createLabel(bundleParts[bundleParts.length - 1]);\n let menuitem = currentMenu.find(item => item.label === label);\n if (menuitem == null) {\n menuitem = {\n label\n };\n currentMenu.push(menuitem);\n }\n menuitem.target = view.route;\n });\n\n appShellConfiguration.menu = menu;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-utils.d.ts","sourceRoot":"","sources":["../src/config-utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAalE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,sBAAsB,GAAG,CACnC,aAAa,EAAE,yBAAyB,EACxC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACxB,gBAAgB,CAAC;AAEtB,eAAO,MAAM,oBAAoB,UAIhC,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUvE;AAED,wBAAgB,cAAc,CAC5B,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,IAAI,EAAE,yBAAyB,EAC/B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC/B,gBAAgB,CAgClB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,UAMhD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,EAAO,0BAOjE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,WAE3C;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,GAAE,MAAW,UAElE;AAED,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,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;AAED,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,cAAsB,EAAE;IACjE,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,aAAsB,EAAE,cAAuB;IACzE,OAAO,cAAc,IAAI,aAAa,IAAI,GAAG,CAAC;AAChD,CAAC","sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\n\nimport { register, createEsmHooks } from \"ts-node\";\n\nimport type { HvAppShellConfig } from \"@hitachivantara/app-shell-shared\";\n\nimport type { AppShellVitePluginOptions } from \"./vite-plugin.js\";\n\nimport { require } from \"./nodeModule.js\";\n\ncreateEsmHooks(\n register({\n transpileOnly: true,\n moduleTypes: {\n \"app-shell.config.ts\": \"cjs\"\n }\n })\n);\n\nexport interface ConfigReplacement {\n token: string;\n value: string;\n}\n\nexport type AppShellConfigFunction = (\n pluginOptions: AppShellVitePluginOptions,\n env: Record<string, string>\n) => HvAppShellConfig;\n\nexport const DEFAULT_CONFIG_FILES = [\n \"app-shell.config.ts\",\n \"app-shell.config.js\",\n \"app-shell.config.json\"\n];\n\nexport function findAppShellConfigFile(root: string): string | undefined {\n const filename = DEFAULT_CONFIG_FILES.find(file =>\n fs.existsSync(path.resolve(root, file))\n );\n\n if (filename) {\n return path.resolve(root, filename);\n }\n\n return undefined;\n}\n\nexport function loadConfigFile(\n appShellConfigFile: string | undefined,\n opts: AppShellVitePluginOptions,\n env: Record<string, string> = {}\n): HvAppShellConfig {\n if (!appShellConfigFile) {\n // an empty configuration is actually valid\n // and with the automatic views option, it can even make sense\n return {};\n }\n\n if (appShellConfigFile.endsWith(\".json\")) {\n let appShellConfigRaw = fs.readFileSync(appShellConfigFile, \"utf-8\");\n\n // token replacement is only supported for json files\n opts.configReplacements?.forEach(item => {\n appShellConfigRaw = appShellConfigRaw.replaceAll(\n `@@${item.token}@@`,\n item.value\n );\n });\n\n return JSON.parse(appShellConfigRaw) as HvAppShellConfig;\n }\n\n // using require instead of import to avoid using --experimental-loader ts-node/esm\n // eslint-disable-next-line import/no-dynamic-require\n const loadedAppShellConfig = require(appShellConfigFile).default as\n | AppShellConfigFunction\n | HvAppShellConfig;\n\n if (typeof loadedAppShellConfig === \"function\") {\n return loadedAppShellConfig(opts, env);\n }\n\n return loadedAppShellConfig;\n}\n\n/**\n * Returns the extensionless module name of the output bundle\n * for a given entry point module name.\n *\n * @param module The entry point module name.\n * @returns The final module name of the output bundle.\n */\nexport function getFinalModuleName(module: string) {\n return module\n .replace(/^\\//, \"\")\n .replace(/^src\\//, \"\") // TODO: remove custom hard-coded `src` behavior (in favour of `root` or `modulesRoot`?)\n .replace(/\\.[tj]sx?$/, \"\")\n .replaceAll(\"$\", \"_\");\n}\n\n/**\n * Returns the modules to be created by the build of the app.\n * The list of modules is provided via parameter as one of the options used to initialize AppShellVitePlugin. {@link AppShellVitePluginOptions}\n *\n * @param root Project root directory.\n * @param modules The list of modules to be exported by the application bundle.\n */\nexport function getAppModules(root: string, modules: string[] = []) {\n return modules.reduce<Record<string, string>>((acc, modulePath) => {\n const bundleName = getFinalModuleName(modulePath);\n acc[bundleName] = path.resolve(root, modulePath);\n\n return acc;\n }, {});\n}\n\nexport function startsWithSelf(value: string) {\n return value.startsWith(\"@self/\");\n}\n\nexport function replaceSelf(value: string, replaceWith: string = \"\") {\n return value.replace(/^@self\\//, replaceWith);\n}\n\nexport function getBasePath(configBaseUrl?: string, viteConfigBase?: string) {\n return viteConfigBase ?? configBaseUrl ?? \"/\";\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACnE,cAAc,kBAAkB,CAAC;AAGjC,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,kCAAkC,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACnE,cAAc,kBAAkB,CAAC","sourcesContent":["export { default as HvAppShellVitePlugin } from \"./vite-plugin.js\";\nexport * from \"./vite-plugin.js\";\n\n// reexport types from shared package\nexport type {\n HvAppShellConfig,\n HvAppShellIcon,\n HvAppShellLogo,\n HvAppShellMenuConfig,\n HvAppShellMainPanelConfig,\n HvAppShellViewsConfig\n} from \"@hitachivantara/app-shell-shared\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeModule.d.ts","sourceRoot":"","sources":["../src/nodeModule.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,OAAO,aAAiC,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,UAG/C;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAQ/D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeModule.js","sourceRoot":"","sources":["../src/nodeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkB;IAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,MAAc;IAC9D,MAAM,qBAAqB,GAAG,IAAI,UAAU,GAAG,CAAC;IAChD,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IACjE,OAAO,GAAG,MAAM,CAAC,KAAK,CACpB,CAAC,EACD,cAAc,GAAG,qBAAqB,CAAC,MAAM,CAC9C,GAAG,MAAM,EAAE,CAAC;AACf,CAAC","sourcesContent":["import { createRequire } from \"node:module\";\n\nexport const require = createRequire(import.meta.url);\n\n/**\n * Resolves the module name and normalizes slashes to be posix/unix-like forward slashes.\n *\n * @param moduleName The name of the module to be searched for\n * @returns The module path normalized\n */\nexport function resolveModule(moduleName: string) {\n const module = require.resolve(moduleName);\n return module.replace(/\\\\+/g, \"/\");\n}\n\n/**\n * This function will find out the module path using node `require.resolve` function\n * and add the suffix param after the folder with module name.\n *\n * @param moduleName \"@module/name\"\n * @param suffix to be added after the module path\n * @returns the /path/to/@module/name/<suffix>\n */\nexport function getModulePath(moduleName: string, suffix: string) {\n const moduleNameWithSlashes = `/${moduleName}/`;\n const module = resolveModule(moduleName);\n const modulePosition = module.lastIndexOf(moduleNameWithSlashes);\n return `${module.slice(\n 0,\n modulePosition + moduleNameWithSlashes.length\n )}${suffix}`;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared-dependencies.d.ts","sourceRoot":"","sources":["../src/shared-dependencies.ts"],"names":[],"mappings":";;;;;;AAAA,wBA6FE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared-dependencies.js","sourceRoot":"","sources":["../src/shared-dependencies.ts"],"names":[],"mappings":"AAAA,eAAe;IACb;QACE,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,yBAAyB;QACjC,SAAS,EAAE,yCAAyC;QACpD,UAAU,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAqCI;KACjB;IACD;QACE,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,6BAA6B;QACrC,SAAS,EAAE,6CAA6C;QACxD,UAAU,EAAE;;;;;;;;;;;wBAWQ;KACrB;IACD;QACE,QAAQ,EAAE,kBAAkB;QAC5B,MAAM,EAAE,oCAAoC;QAC5C,SAAS,EAAE,oDAAoD;QAC/D,UAAU,EAAE,mCAAmC;KAChD;IACD;QACE,QAAQ,EAAE,gBAAgB;QAC1B,MAAM,EAAE,iCAAiC;QACzC,SAAS,EAAE,iDAAiD;QAC5D,UAAU,EAAE,iCAAiC;KAC9C;IACD;QACE,QAAQ,EAAE,gBAAgB;QAC1B,MAAM,EAAE,iCAAiC;QACzC,SAAS,EAAE,iDAAiD;QAC5D,UAAU,EAAE,uEAAuE;KACpF;IACD;QACE,QAAQ,EAAE,kCAAkC;QAC5C,MAAM,EAAE,yBAAyB;QACjC,SAAS,EACP,kEAAkE;QACpE,UAAU,EAAE,mDAAmD;KAChE;IACD;QACE,QAAQ,EAAE,oCAAoC;QAC9C,MAAM,EAAE,2BAA2B;QACnC,SAAS,EACP,sEAAsE;QACxE,UAAU,EAAE,qDAAqD;KAClE;CACF,CAAC","sourcesContent":["export default [\n {\n moduleId: \"react\",\n bundle: \"react.production.min.js\",\n bundleSrc: \"./esm-externals/react.production.min.js\",\n virtualSrc: `import * as React from \"react\";\n export default React;\n\n export {\n Fragment,\n StrictMode,\n Profiler,\n Suspense,\n Children,\n Component,\n PureComponent,\n cloneElement,\n createContext,\n createElement,\n createFactory,\n createRef,\n forwardRef,\n isValidElement,\n lazy,\n memo,\n startTransition,\n useCallback,\n useContext,\n useDebugValue,\n useDeferredValue,\n useEffect,\n useId,\n useImperativeHandle,\n useInsertionEffect,\n useLayoutEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n useSyncExternalStore,\n useTransition,\n version,\n } from \"react\";`\n },\n {\n moduleId: \"react-dom\",\n bundle: \"react-dom.production.min.js\",\n bundleSrc: \"./esm-externals/react-dom.production.min.js\",\n virtualSrc: `export {\n default,\n flushSync,\n createPortal,\n findDOMNode,\n hydrate,\n render,\n unmountComponentAtNode,\n unstable_batchedUpdates,\n unstable_renderSubtreeIntoContainer,\n version,\n } from \"react-dom\";`\n },\n {\n moduleId: \"react-router-dom\",\n bundle: \"react-router-dom.production.min.js\",\n bundleSrc: \"./esm-externals/react-router-dom.production.min.js\",\n virtualSrc: `export * from \"react-router-dom\";`\n },\n {\n moduleId: \"@emotion/react\",\n bundle: \"emotion-react.production.min.js\",\n bundleSrc: \"./esm-externals/emotion-react.production.min.js\",\n virtualSrc: `export * from \"@emotion/react\";`\n },\n {\n moduleId: \"@emotion/cache\",\n bundle: \"emotion-cache.production.min.js\",\n bundleSrc: \"./esm-externals/emotion-cache.production.min.js\",\n virtualSrc: `import createCache from \"@emotion/cache\"; export default createCache;`\n },\n {\n moduleId: \"@hitachivantara/app-shell-shared\",\n bundle: \"app-shell-shared.esm.js\",\n bundleSrc:\n \"@hitachivantara/app-shell-shared/bundles/app-shell-shared.esm.js\",\n virtualSrc: `export * from \"@hitachivantara/app-shell-shared\";`\n },\n {\n moduleId: \"@hitachivantara/uikit-react-shared\",\n bundle: \"uikit-react-shared.esm.js\",\n bundleSrc:\n \"@hitachivantara/uikit-react-shared/bundles/uikit-react-shared.esm.js\",\n virtualSrc: `export * from \"@hitachivantara/uikit-react-shared\";`\n }\n];\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"automatic-utils.test.d.ts","sourceRoot":"","sources":["../../src/tests/automatic-utils.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"automatic-utils.test.js","sourceRoot":"","sources":["../../src/tests/automatic-utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,IAAI,MAAM,SAAS,CAAC;AAI3B,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAE5B,QAAQ,CAAC,sBAAsB,EAAE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AAC;YAEF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CACpB,MAAM,CAAC,eAAe,CAAC;gBACrB,iBAAiB;gBACjB,iBAAiB;gBACjB,2CAA2C;gBAC3C,6BAA6B;gBAC7B,qBAAqB;aACtB,CAAC,CACH,CAAC;YAEF,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACnD,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,OAAO,CACrC,MAAM,CAAC,eAAe,CAAC;gBACrB;oBACE,MAAM,EAAE,6CAA6C;oBACrD,KAAK,EAAE,QAAQ;iBAChB;gBAED;oBACE,MAAM,EAAE,sBAAsB;oBAC9B,KAAK,EAAE,aAAa;oBACpB,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,sBAAsB,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;iBAChE;gBAED,EAAE,MAAM,EAAE,sBAAsB,EAAE,KAAK,EAAE,YAAY,EAAE;gBACvD;oBACE,MAAM,EAAE,kCAAkC;oBAC1C,KAAK,EAAE,oBAAoB;iBAC5B;gBACD;oBACE,MAAM,EAAE,gDAAgD;oBACxD,KAAK,EAAE,kCAAkC;iBAC1C;aACF,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect } from \"vitest\";\nimport mock from \"mock-fs\";\n\nimport { HvAppShellConfig } from \"@hitachivantara/app-shell-shared\";\n\nimport {\n applyAutomaticMenu,\n applyAutomaticViewsAndRoutes,\n mapFolderIndexFilesToRoutes\n} from \"../automatic-utils\";\n\ndescribe(\"test automatic utils\", () => {\n const pagesFolderContent = {\n \"/dummy/path/app/src/pages\": {},\n \"/dummy/path/app/src/pages/Page1\": {\n \"index.tsx\": \"dummy content\"\n },\n \"/dummy/path/app/src/pages/Page2\": {\n \"something.else\": \"dummy content\"\n },\n \"/dummy/path/app/src/pages/Page3\": {\n \"index.tsx\": \"dummy content\"\n },\n \"/dummy/path/app/src/pages/Page4\": {\n /** empty directory */\n },\n \"/dummy/path/app/src/pages/Page5/$id\": {\n \"index.tsx\": \"dummy content\"\n },\n \"/dummy/path/app/src/pages/Page5/$id/Page5_1\": {\n \"index.tsx\": \"dummy content\"\n },\n \"/dummy/path/app/src/pages/Page5/$id/Page5_1/$name\": {\n /** empty directory */\n },\n \"/dummy/path/app/src/pages/Page5/$id/Page5_1/$name/Page5_2\": {\n \"index.tsx\": \"dummy content\"\n }\n };\n\n const noIndexFilesInPagesFolderContent = {\n \"/dummy/path/app/src/pages\": {},\n \"/dummy/path/app/src/pages/Page3\": {\n \"something.else\": \"dummy content\"\n },\n \"/dummy/path/app/src/pages/Page4\": {\n /** empty directory */\n }\n };\n\n describe(\"test `mapFolderIndexFilesToRoutes` method\", () => {\n afterEach(() => {\n mock.restore();\n });\n\n it(\"should return an empty array when resolved views folder does not exist\", () => {\n const root = \"/some/other/root\";\n const viewsFolder = \"src/pages\";\n\n mock(noIndexFilesInPagesFolderContent);\n\n expect(mapFolderIndexFilesToRoutes(root, viewsFolder)).toEqual([]);\n });\n\n it(\"should return an empty array when there are no index files in the resolved views folder\", () => {\n const root = \"/dummy/path/app\";\n const viewsFolder = \"src/pages\";\n\n mock(noIndexFilesInPagesFolderContent);\n\n expect(mapFolderIndexFilesToRoutes(root, viewsFolder)).toEqual([]);\n });\n\n test.each([\n [\"/dummy/path/app\", \"src/pages\"],\n [\"/dummy/path/app\", \"src/pages/\"],\n [\"/dummy/path/app\", \"/src/pages/\"],\n [\"/dummy/path/app\", \"/src/pages\"]\n ])(\n \"should return all mapped main view configs and corresponding modules\",\n (viewsFolderPath: string, viewsFolder: string) => {\n mock(pagesFolderContent);\n\n expect(\n mapFolderIndexFilesToRoutes(viewsFolderPath, viewsFolder)\n ).toEqual([\n {\n viewConfig: {\n bundle: \"@self/pages/Page1.js\",\n route: \"/page1\"\n },\n module: \"src/pages/Page1\"\n },\n {\n viewConfig: {\n bundle: \"@self/pages/Page3.js\",\n route: \"/page3\"\n },\n module: \"src/pages/Page3\"\n },\n {\n viewConfig: {\n bundle: \"@self/pages/Page5/_id/Page5_1/_name/Page5_2.js\",\n route: \"/page5/:id/page5_1/:name/page5_2\"\n },\n module: \"src/pages/Page5/$id/Page5_1/$name/Page5_2\"\n },\n {\n viewConfig: {\n bundle: \"@self/pages/Page5/_id/Page5_1.js\",\n route: \"/page5/:id/page5_1\"\n },\n module: \"src/pages/Page5/$id/Page5_1\"\n },\n {\n viewConfig: {\n bundle: \"@self/pages/Page5/_id.js\",\n route: \"/page5/:id\"\n },\n module: \"src/pages/Page5/$id\"\n }\n ]);\n }\n );\n });\n\n describe(\"test `applyAutomaticMenu` method\", () => {\n it(\"should create correct menu labels for simple routes\", () => {\n const config: HvAppShellConfig = {\n mainPanel: {\n views: [\n { bundle: \"@self/pages/Page1.js\", route: \"/page1\" },\n { bundle: \"@self/pages/Page2.js\", route: \"/page2\" },\n { bundle: \"@self/pages/helloToWorld.js\", route: \"/hello\" }\n ]\n }\n };\n\n applyAutomaticMenu(config);\n\n const expectedMenu = [\n { label: \"Page1\", target: \"/page1\" },\n { label: \"Page2\", target: \"/page2\" },\n { label: \"Hello To World\", target: \"/hello\" }\n ];\n\n expect(config.menu).toEqual(expectedMenu);\n });\n\n it(\"should handle nested routes correctly\", () => {\n const config: HvAppShellConfig = {\n mainPanel: {\n views: [\n { bundle: \"@self/pages/Section/Page1.js\", route: \"/section/page1\" },\n { bundle: \"@self/pages/Section/Page2.js\", route: \"/section/page2\" },\n {\n bundle: \"@self/pages/Planets/helloToEarth.js\",\n route: \"/planets/earth\"\n },\n {\n bundle: \"@self/pages/Planets/HelloToMars.js\",\n route: \"/planets/mars\"\n },\n {\n bundle: \"@self/pages/someOtherFolder/ToImportantStuff.js\",\n route: \"/other/important\"\n },\n {\n bundle: \"@self/pages/SomeOtherFolder/thisIsOnTheSameMenu.js\",\n route: \"/other/same\"\n }\n ]\n }\n };\n\n applyAutomaticMenu(config);\n\n const expectedMenu = [\n {\n label: \"Section\",\n submenus: [\n { label: \"Page1\", target: \"/section/page1\" },\n { label: \"Page2\", target: \"/section/page2\" }\n ]\n },\n {\n label: \"Planets\",\n submenus: [\n { label: \"Hello To Earth\", target: \"/planets/earth\" },\n { label: \"Hello To Mars\", target: \"/planets/mars\" }\n ]\n },\n {\n label: \"Some Other Folder\",\n submenus: [\n { label: \"To Important Stuff\", target: \"/other/important\" },\n { label: \"This Is On The Same Menu\", target: \"/other/same\" }\n ]\n }\n ];\n\n expect(config.menu).toEqual(expectedMenu);\n });\n\n it(\"should skip dynamic routes\", () => {\n const config: HvAppShellConfig = {\n mainPanel: {\n views: [\n { bundle: \"@self/pages/Page1.js\", route: \"/page1\" },\n { bundle: \"@self/pages/Page2/:id.js\", route: \"/page2/:id\" },\n { bundle: \"@self/pages/Page3.js\", route: \"/page3\" }\n ]\n }\n };\n\n applyAutomaticMenu(config);\n\n const expectedMenu = [\n { label: \"Page1\", target: \"/page1\" },\n // Note: Page2 is skipped because it's a dynamic route\n { label: \"Page3\", target: \"/page3\" }\n ];\n\n expect(config.menu).toEqual(expectedMenu);\n });\n\n it(\"should handle special characters and capitalization in routes\", () => {\n const config: HvAppShellConfig = {\n mainPanel: {\n views: [\n {\n bundle:\n \"@self/pages/lowerUpper/Look🙄ingAbóve/SomeSpÉcialPage.js\",\n route: \"/l1/l2/someSpecialPage\"\n }\n ]\n }\n };\n\n applyAutomaticMenu(config);\n\n const expectedMenu = [\n {\n label: \"Lower Upper\",\n submenus: [\n {\n label: \"Look🙄ing Abóve\",\n submenus: [\n { label: \"Some SpÉcial Page\", target: \"/l1/l2/someSpecialPage\" }\n ]\n }\n ]\n }\n ];\n\n expect(config.menu).toEqual(expectedMenu);\n });\n\n it(\"should return undefined for empty views\", () => {\n const config: HvAppShellConfig = {\n mainPanel: {\n views: []\n }\n };\n\n applyAutomaticMenu(config);\n\n expect(config.menu).toBe(undefined);\n });\n });\n\n describe(\"test applyAutomaticViewsAndRoutes\", () => {\n const selfAppName = \"@hv-tests/some-app\";\n const root = \"/dummy/path/app\";\n const viewsFolder = \"src/pages\";\n\n afterEach(() => {\n mock.restore();\n });\n\n it(\"should return an empty array when there are neither automatic or manual views\", () => {\n mock(noIndexFilesInPagesFolderContent);\n\n const config: HvAppShellConfig = {};\n\n const result = applyAutomaticViewsAndRoutes(\n config,\n selfAppName,\n root,\n viewsFolder\n );\n\n expect(result.length).toEqual(0);\n\n expect(config.mainPanel?.views?.length ?? 0).toBe(0);\n });\n\n it(\"should return an empty array when there are no automatic views and keep the manual ones\", () => {\n mock(noIndexFilesInPagesFolderContent);\n\n const config: HvAppShellConfig = {\n mainPanel: {\n views: [\n { bundle: \"@self/pages/Home.js\", route: \"/\" },\n { bundle: \"@hv-tests/some-app/pages/Page0.js\", route: \"/page0\" },\n { bundle: \"@self/pages/Other.js\", route: \"/some-path\" },\n {\n bundle: \"@hv-tests/other-app/pages/HelloFromOther.js\",\n route: \"/other\"\n }\n ]\n }\n };\n\n const result = applyAutomaticViewsAndRoutes(\n config,\n selfAppName,\n root,\n viewsFolder\n );\n\n expect(result.length).toEqual(0);\n\n expect(config.mainPanel?.views?.length).toEqual(4);\n expect(config.mainPanel?.views).toEqual(\n expect.arrayContaining([\n { bundle: \"@self/pages/Home.js\", route: \"/\" },\n { bundle: \"@hv-tests/some-app/pages/Page0.js\", route: \"/page0\" },\n { bundle: \"@self/pages/Other.js\", route: \"/some-path\" },\n {\n bundle: \"@hv-tests/other-app/pages/HelloFromOther.js\",\n route: \"/other\"\n }\n ])\n );\n });\n\n it(\"should return modules of found automatic views and add them to the configuration when there are no manual views\", () => {\n mock(pagesFolderContent);\n\n const config: HvAppShellConfig = {};\n\n const result = applyAutomaticViewsAndRoutes(\n config,\n selfAppName,\n root,\n viewsFolder\n );\n\n expect(result.length).toEqual(5);\n expect(result).toEqual(\n expect.arrayContaining([\n \"src/pages/Page1\",\n \"src/pages/Page3\",\n \"src/pages/Page5/$id/Page5_1/$name/Page5_2\",\n \"src/pages/Page5/$id/Page5_1\",\n \"src/pages/Page5/$id\"\n ])\n );\n\n expect(config.mainPanel?.views?.length).toEqual(5);\n expect(config.mainPanel?.views).toEqual(\n expect.arrayContaining([\n { bundle: \"@self/pages/Page1.js\", route: \"/page1\" },\n { bundle: \"@self/pages/Page3.js\", route: \"/page3\" },\n {\n bundle: \"@self/pages/Page5/_id.js\",\n route: \"/page5/:id\"\n },\n {\n bundle: \"@self/pages/Page5/_id/Page5_1.js\",\n route: \"/page5/:id/page5_1\"\n },\n {\n bundle: \"@self/pages/Page5/_id/Page5_1/_name/Page5_2.js\",\n route: \"/page5/:id/page5_1/:name/page5_2\"\n }\n ])\n );\n });\n\n it(\"should return modules of found automatic views and append them to the configuration when there are manual views\", () => {\n mock(pagesFolderContent);\n\n const config: HvAppShellConfig = {\n mainPanel: {\n views: [\n { bundle: \"@self/pages/Home.js\", route: \"/\" },\n { bundle: \"@hv-tests/some-app/pages/Page0.js\", route: \"/page0\" },\n { bundle: \"@self/pages/Other.js\", route: \"/some-path\" },\n {\n bundle: \"@hv-tests/other-app/pages/HelloFromOther.js\",\n route: \"/other\"\n }\n ]\n }\n };\n\n const result = applyAutomaticViewsAndRoutes(\n config,\n selfAppName,\n root,\n viewsFolder\n );\n\n expect(result.length).toEqual(5);\n expect(result).toEqual(\n expect.arrayContaining([\n \"src/pages/Page1\",\n \"src/pages/Page3\",\n \"src/pages/Page5/$id/Page5_1/$name/Page5_2\",\n \"src/pages/Page5/$id/Page5_1\",\n \"src/pages/Page5/$id\"\n ])\n );\n\n expect(config.mainPanel?.views?.length).toEqual(9);\n expect(config.mainPanel?.views).toEqual(\n expect.arrayContaining([\n { bundle: \"@self/pages/Home.js\", route: \"/\" },\n { bundle: \"@hv-tests/some-app/pages/Page0.js\", route: \"/page0\" },\n { bundle: \"@self/pages/Other.js\", route: \"/some-path\" },\n {\n bundle: \"@hv-tests/other-app/pages/HelloFromOther.js\",\n route: \"/other\"\n },\n\n { bundle: \"@self/pages/Page1.js\", route: \"/page1\" },\n { bundle: \"@self/pages/Page3.js\", route: \"/page3\" },\n {\n bundle: \"@self/pages/Page5/_id.js\",\n route: \"/page5/:id\"\n },\n {\n bundle: \"@self/pages/Page5/_id/Page5_1.js\",\n route: \"/page5/:id/page5_1\"\n },\n {\n bundle: \"@self/pages/Page5/_id/Page5_1/_name/Page5_2.js\",\n route: \"/page5/:id/page5_1/:name/page5_2\"\n }\n ])\n );\n });\n\n it(\"should skip overlapping routes and bundles\", () => {\n mock(pagesFolderContent);\n\n const config: HvAppShellConfig = {\n mainPanel: {\n views: [\n { bundle: \"@self/pages/Page1.js\", route: \"/other-path\" },\n { bundle: \"@hv-tests/some-app/pages/Page3.js\", route: \"/page3\" },\n { bundle: \"@self/pages/Other.js\", route: \"/page5/:id\" },\n {\n bundle: \"@hv-tests/other-app/pages/HelloFromOther.js\",\n route: \"/other\"\n }\n ]\n }\n };\n\n const result = applyAutomaticViewsAndRoutes(\n config,\n selfAppName,\n root,\n viewsFolder\n );\n\n expect(result.length).toEqual(5);\n expect(result).toEqual(\n expect.arrayContaining([\n \"src/pages/Page1\",\n \"src/pages/Page3\",\n \"src/pages/Page5/$id/Page5_1/$name/Page5_2\",\n \"src/pages/Page5/$id/Page5_1\",\n \"src/pages/Page5/$id\"\n ])\n );\n\n expect(config.mainPanel?.views?.length).toEqual(6);\n expect(config.mainPanel?.views).toEqual(\n expect.arrayContaining([\n {\n bundle: \"@hv-tests/other-app/pages/HelloFromOther.js\",\n route: \"/other\"\n },\n\n { bundle: \"@self/pages/Page1.js\", route: \"/other-path\" },\n { bundle: \"@hv-tests/some-app/pages/Page3.js\", route: \"/page3\" },\n { bundle: \"@self/pages/Other.js\", route: \"/page5/:id\" },\n {\n bundle: \"@self/pages/Page5/_id/Page5_1.js\",\n route: \"/page5/:id/page5_1\"\n },\n {\n bundle: \"@self/pages/Page5/_id/Page5_1/_name/Page5_2.js\",\n route: \"/page5/:id/page5_1/:name/page5_2\"\n }\n ])\n );\n });\n\n it(\"should skip overlapping routes and bundles, including nested views\", () => {\n mock(pagesFolderContent);\n\n const config: HvAppShellConfig = {\n mainPanel: {\n views: [\n {\n bundle: \"@self/pages/Page1.js\",\n route: \"/other-path\",\n views: [{ bundle: \"@self/pages/Page3.js\", route: \"/subpage3\" }]\n },\n { bundle: \"@self/pages/Other.js\", route: \"/page5/:id\" },\n {\n bundle: \"@hv-tests/other-app/pages/HelloFromOther.js\",\n route: \"/other\"\n }\n ]\n }\n };\n\n const result = applyAutomaticViewsAndRoutes(\n config,\n selfAppName,\n root,\n viewsFolder\n );\n\n expect(result.length).toEqual(5);\n expect(result).toEqual(\n expect.arrayContaining([\n \"src/pages/Page1\",\n \"src/pages/Page3\",\n \"src/pages/Page5/$id/Page5_1/$name/Page5_2\",\n \"src/pages/Page5/$id/Page5_1\",\n \"src/pages/Page5/$id\"\n ])\n );\n\n expect(config.mainPanel?.views?.length).toEqual(5);\n expect(config.mainPanel?.views).toEqual(\n expect.arrayContaining([\n {\n bundle: \"@hv-tests/other-app/pages/HelloFromOther.js\",\n route: \"/other\"\n },\n\n {\n bundle: \"@self/pages/Page1.js\",\n route: \"/other-path\",\n views: [{ bundle: \"@self/pages/Page3.js\", route: \"/subpage3\" }]\n },\n\n { bundle: \"@self/pages/Other.js\", route: \"/page5/:id\" },\n {\n bundle: \"@self/pages/Page5/_id/Page5_1.js\",\n route: \"/page5/:id/page5_1\"\n },\n {\n bundle: \"@self/pages/Page5/_id/Page5_1/_name/Page5_2.js\",\n route: \"/page5/:id/page5_1/:name/page5_2\"\n }\n ])\n );\n });\n });\n});\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-utils.test.d.ts","sourceRoot":"","sources":["../../src/tests/config-utils.test.ts"],"names":[],"mappings":""}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,sBAAsB,EAAE,uCAAuC;gBAC/D,sBAAsB,EAAE,wCAAwC;gBAChE,sBAAsB,EAAE,uCAAuC;gBAC/D,sBAAsB,EAAE,wCAAwC;gBAChE,qCAAqC,EACnC,+CAA+C;gBACjD,oCAAoC,EAClC,kDAAkD;aACrD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;YAChD,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { HvAppShellConfig } from \"@hitachivantara/app-shell-shared\";\nimport fs from \"fs\";\nimport {\n findAppShellConfigFile,\n getAppModules,\n getBasePath,\n getFinalModuleName,\n loadConfigFile\n} from \"../config-utils\";\n\nvi.mock(\"path\", async () => vi.importActual(\"./mocks/path.mock.ts\"));\n\nconst existsSyncMock = vi.fn();\nconst readFileSyncMock = vi.fn();\nfs.existsSync = existsSyncMock;\nfs.readFileSync = readFileSyncMock;\ndescribe(\"test app-shell-vite-generate-base plugin\", () => {\n describe(\"test `findAppShellConfigFile`\", () => {\n it(\"it returns the config file location (and its content) if exists\", () => {\n existsSyncMock.mockImplementation((file: string) => {\n return file.match(\"/dummyPath/dummyRootProject/app-shell.config.json\");\n });\n const filePath = findAppShellConfigFile(\"/dummyPath/dummyRootProject\");\n expect(filePath).toBe(\n \"/dummyPath/dummyRootProject/app-shell.config.json\"\n );\n });\n\n it(\"it returns undefined if config file don't exists\", () => {\n existsSyncMock.mockImplementation(() => {\n return false;\n });\n const filePath = findAppShellConfigFile(\"/dummyPath/dummyRootProject\");\n expect(filePath).toBeUndefined();\n });\n });\n\n describe(\"test `loadConfigFile`\", () => {\n it(\"returns an empty config if the config file is not defined\", () => {\n const appShellConfig = loadConfigFile(undefined, {}, {});\n expect(appShellConfig).toMatchObject({});\n });\n\n it(\"returns the config if config file exists\", () => {\n const config: HvAppShellConfig = {\n baseUrl: \"dummyBaseUrl\"\n };\n\n existsSyncMock.mockImplementation((file: string) => {\n return file.match(\"/dummyPath/dummyRootProject/app-shell.config.json\");\n });\n\n readFileSyncMock.mockImplementation(() => {\n return JSON.stringify(config);\n });\n\n const appShellConfig = loadConfigFile(\n \"/dummyPath/dummyRootProject/app-shell.config.json\",\n {},\n {}\n );\n expect(appShellConfig).toMatchObject(config);\n });\n\n it(\"replaces tokens at configurations defined at json files\", () => {\n const config: HvAppShellConfig = {\n baseUrl: \"@@BASE_URL@@\"\n };\n\n existsSyncMock.mockImplementation((file: string) => {\n return file.match(\"/dummyPath/dummyRootProject/app-shell.config.json\");\n });\n\n readFileSyncMock.mockImplementation(() => {\n return JSON.stringify(config);\n });\n\n const appShellConfig = loadConfigFile(\n \"/dummyPath/dummyRootProject/app-shell.config.json\",\n {\n configReplacements: [\n { token: \"BASE_URL\", value: \"dummyBaseUrlWithTokens\" }\n ]\n },\n {}\n );\n expect(appShellConfig).toMatchObject({\n baseUrl: \"dummyBaseUrlWithTokens\"\n });\n });\n });\n\n describe(\"getFinalModuleName\", () => {\n it(\"removes leading 'src/' and file extension from module path\", () => {\n const modulePath = \"/src/pages/DummyPath.tsx\";\n const finalModuleName = getFinalModuleName(modulePath);\n expect(finalModuleName).toBe(\"pages/DummyPath\");\n });\n\n it(\"replaces '$' with '_' in the module path\", () => {\n const modulePath = \"/src/pages/DummyPath/$id/HelloWorld.tsx\";\n const finalModuleName = getFinalModuleName(modulePath);\n expect(finalModuleName).toBe(\"pages/DummyPath/_id/HelloWorld\");\n });\n\n it(\"handles module paths without 'src/' prefix\", () => {\n // this use case is not expected to happen, but let's test it anyway\n\n const modulePath = \"/other/pages/DummyPath.tsx\";\n const finalModuleName = getFinalModuleName(modulePath);\n expect(finalModuleName).toBe(\"other/pages/DummyPath\");\n });\n\n it(\"handles module paths without file extension\", () => {\n const modulePath = \"/src/pages/DummyPath\";\n const finalModuleName = getFinalModuleName(modulePath);\n expect(finalModuleName).toBe(\"pages/DummyPath\");\n });\n\n it(\"handles module paths with '.ts' file extension\", () => {\n const modulePath = \"/src/pages/DummyPath.ts\";\n const finalModuleName = getFinalModuleName(modulePath);\n expect(finalModuleName).toBe(\"pages/DummyPath\");\n });\n\n it(\"handles module paths with '.jsx' file extension\", () => {\n const modulePath = \"/src/pages/DummyPath.jsx\";\n const finalModuleName = getFinalModuleName(modulePath);\n expect(finalModuleName).toBe(\"pages/DummyPath\");\n });\n\n it(\"handles module paths with '.tsx' file extension\", () => {\n const modulePath = \"/src/pages/DummyPath.tsx\";\n const finalModuleName = getFinalModuleName(modulePath);\n expect(finalModuleName).toBe(\"pages/DummyPath\");\n });\n });\n\n describe(\"getAppModules\", () => {\n it(\"modules are correctly mapped\", () => {\n expect(\n getAppModules(\"dummyPath\", [\n \"src/pages/DummyPath\",\n \"src/pages/DummyPath-2\",\n \"src/pages/DummyPath/$id/HelloWorld\",\n \"src/modules/DummyModule1\",\n \"src/modules/DummyModule2.ts\",\n \"src/modules/DummyModule3.tsx\",\n \"src/modules/DummyModule4.js\",\n \"src/modules/DummyModule5.jsx\",\n \"altSrc/customModules/DummyAltSource\",\n \"altSrc/customModules/DummyAlt/File.tsx\"\n ])\n ).toEqual({\n \"pages/DummyPath\": \"dummyPath/src/pages/DummyPath\",\n \"pages/DummyPath-2\": \"dummyPath/src/pages/DummyPath-2\",\n \"pages/DummyPath/_id/HelloWorld\":\n \"dummyPath/src/pages/DummyPath/$id/HelloWorld\",\n \"modules/DummyModule1\": \"dummyPath/src/modules/DummyModule1\",\n \"modules/DummyModule2\": \"dummyPath/src/modules/DummyModule2.ts\",\n \"modules/DummyModule3\": \"dummyPath/src/modules/DummyModule3.tsx\",\n \"modules/DummyModule4\": \"dummyPath/src/modules/DummyModule4.js\",\n \"modules/DummyModule5\": \"dummyPath/src/modules/DummyModule5.jsx\",\n \"altSrc/customModules/DummyAltSource\":\n \"dummyPath/altSrc/customModules/DummyAltSource\",\n \"altSrc/customModules/DummyAlt/File\":\n \"dummyPath/altSrc/customModules/DummyAlt/File.tsx\"\n });\n });\n });\n\n describe(\"getBasePath\", () => {\n it(\"config url is defined\", () => {\n expect(getBasePath(\"/baseUrl\")).toBe(\"/baseUrl\");\n });\n it(\"config url and vite base are defined\", () => {\n expect(getBasePath(\"/baseUrl\", \"/viteBase/\")).toBe(\"/viteBase/\");\n });\n it(\"config url is undefined, vite base is defined\", () => {\n expect(getBasePath(undefined, \"/viteBase\")).toBe(\"/viteBase\");\n });\n it(\"config url and vite base are undefined\", () => {\n expect(getBasePath(undefined, undefined)).toBe(\"/\");\n });\n });\n});\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"path.mock.d.ts","sourceRoot":"","sources":["../../../src/tests/mocks/path.mock.ts"],"names":[],"mappings":";wBACsB,MAAM,EAAE;;AAD9B,wBAIE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"path.mock.js","sourceRoot":"","sources":["../../../src/tests/mocks/path.mock.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,OAAO,EAAE,CAAC,GAAG,KAAe,EAAE,EAAE;QAC9B,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACF,CAAC","sourcesContent":["export default {\n resolve: (...paths: string[]) => {\n return paths.join(\"/\");\n }\n};\n"]}
@@ -1,2 +0,0 @@
1
- import "@testing-library/jest-dom/vitest";
2
- //# sourceMappingURL=setup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/tests/setup.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC"}
@@ -1,2 +0,0 @@
1
- import "@testing-library/jest-dom/vitest";
2
- //# sourceMappingURL=setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/tests/setup.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC","sourcesContent":["import \"@testing-library/jest-dom/vitest\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-configuration-processor-plugin.test.d.ts","sourceRoot":"","sources":["../../src/tests/vite-configuration-processor-plugin.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-configuration-processor-plugin.test.js","sourceRoot":"","sources":["../../src/tests/vite-configuration-processor-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,OAAO,GAAG;YACd;gBACE,MAAM,EAAE,sBAAsB;gBAC9B,KAAK,EAAE;oBACL;wBACE,MAAM,EAAE,sBAAsB;qBAC/B;oBACD;wBACE,MAAM,EAAE,2BAA2B;qBACpC;iBACF;aACF;YACD;gBACE,MAAM,EAAE,2BAA2B;aACpC;SACF,CAAC;QAEF,MAAM,WAAW,GAAG,oBAAoB,CAAC;QAEzC,MAAM,eAAe,GAAG;YACtB;gBACE,MAAM,EAAE,mCAAmC;gBAC3C,KAAK,EAAE;oBACL;wBACE,MAAM,EAAE,mCAAmC;qBAC5C;oBACD;wBACE,MAAM,EAAE,2BAA2B;qBACpC;iBACF;aACF;YACD;gBACE,MAAM,EAAE,2BAA2B;aACpC;SACF,CAAC;QAEF,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAE7D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,OAAO,GAAG;YACd;gBACE,MAAM,EAAE,2BAA2B;aACpC;YACD;gBACE,MAAM,EAAE,2BAA2B;gBACnC,KAAK,EAAE;oBACL;wBACE,MAAM,EAAE,2BAA2B;qBACpC;iBACF;aACF;SACF,CAAC;QAEF,MAAM,WAAW,GAAG,oBAAoB,CAAC;QAEzC,MAAM,eAAe,GAAG;YACtB;gBACE,MAAM,EAAE,2BAA2B;aACpC;YACD;gBACE,MAAM,EAAE,2BAA2B;gBACnC,KAAK,EAAE;oBACL;wBACE,MAAM,EAAE,2BAA2B;qBACpC;iBACF;aACF;SACF,CAAC;QAEF,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAE7D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { replaceReferencesToSelf } from \"../vite-configuration-processor-plugin\";\n\ndescribe(\"replaceReferencesToSelf\", () => {\n it(\"should replace references to self in bundle definitions\", () => {\n const bundles = [\n {\n bundle: \"@self/pages/Page1.js\",\n views: [\n {\n bundle: \"@self/pages/Page2.js\"\n },\n {\n bundle: \"@other-app/pages/Page3.js\"\n }\n ]\n },\n {\n bundle: \"@other-app/pages/Page4.js\"\n }\n ];\n\n const selfAppName = \"@hv-tests/some-app\";\n\n const expectedBundles = [\n {\n bundle: \"@hv-tests/some-app/pages/Page1.js\",\n views: [\n {\n bundle: \"@hv-tests/some-app/pages/Page2.js\"\n },\n {\n bundle: \"@other-app/pages/Page3.js\"\n }\n ]\n },\n {\n bundle: \"@other-app/pages/Page4.js\"\n }\n ];\n\n const result = replaceReferencesToSelf(bundles, selfAppName);\n\n expect(result).toEqual(expectedBundles);\n });\n\n it(\"should not modify bundle definitions without references to self\", () => {\n const bundles = [\n {\n bundle: \"@other-app/pages/Page1.js\"\n },\n {\n bundle: \"@other-app/pages/Page2.js\",\n views: [\n {\n bundle: \"@other-app/pages/Page3.js\"\n }\n ]\n }\n ];\n\n const selfAppName = \"@hv-tests/some-app\";\n\n const expectedBundles = [\n {\n bundle: \"@other-app/pages/Page1.js\"\n },\n {\n bundle: \"@other-app/pages/Page2.js\",\n views: [\n {\n bundle: \"@other-app/pages/Page3.js\"\n }\n ]\n }\n ];\n\n const result = replaceReferencesToSelf(bundles, selfAppName);\n\n expect(result).toEqual(expectedBundles);\n });\n});\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-crossorigin-fix-plugin.test.d.ts","sourceRoot":"","sources":["../../src/tests/vite-crossorigin-fix-plugin.test.ts"],"names":[],"mappings":""}