@vc-shell/framework 1.1.4 → 1.1.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.
Files changed (132) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/core/directives/loading/styles.css +1 -1
  3. package/core/plugins/modularity/README.md +347 -17
  4. package/core/plugins/modularity/loader.ts +217 -3
  5. package/dist/core/plugins/modularity/loader.d.ts +4 -0
  6. package/dist/core/plugins/modularity/loader.d.ts.map +1 -1
  7. package/dist/framework.js +1 -1
  8. package/dist/{index-BdflTsg6.js → index-BBHl6nap.js} +1 -1
  9. package/dist/{index-DJOis7Nc.js → index-BG6N4UCY.js} +1 -1
  10. package/dist/{index-CIcET-ZI.js → index-Bv5as3SI.js} +1 -1
  11. package/dist/{index-wfv8ehcx.js → index-C4VyqVxv.js} +1 -1
  12. package/dist/{index-Cf2H7YZ1.js → index-CKLiFGZ-.js} +1 -1
  13. package/dist/{index-DuY7BIGm.js → index-CTmAMa_1.js} +1 -1
  14. package/dist/{index-D-fPN3yf.js → index-CtGZgIiV.js} +1 -1
  15. package/dist/{index-BpBTtmQ6.js → index-D13Jcezf.js} +1 -1
  16. package/dist/{index-DWTsz5bC.js → index-DbpKygJh.js} +1 -1
  17. package/dist/{index-Br0y2YMn.js → index-DgCtSr4P.js} +1 -1
  18. package/dist/{index-Ck055pN8.js → index-Dh1XjfgY.js} +1 -1
  19. package/dist/{index-CYAMpxnu.js → index-DpDbQQg6.js} +1 -1
  20. package/dist/{index-BDqUaIyQ.js → index-DwuQbDJG.js} +1 -1
  21. package/dist/{index-BBYKbiRX.js → index-Fhuqbkq2.js} +1 -1
  22. package/dist/{index-o6aSdNED.js → index-JTAZpxKF.js} +1 -1
  23. package/dist/{index-BDm0tcWn.js → index-MKD2CP5c.js} +49888 -48568
  24. package/dist/{index-DKtQMsy4.js → index-Q3k1PYzc.js} +1 -1
  25. package/dist/index.css +3 -3
  26. package/dist/shared/components/generic-dropdown/generic-dropdown.vue.d.ts.map +1 -1
  27. package/dist/shared/components/settings-menu-item/settings-menu-item.vue.d.ts.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/dist/ui/components/atoms/vc-icon/composables/index.d.ts +3 -0
  30. package/dist/ui/components/atoms/vc-icon/composables/index.d.ts.map +1 -0
  31. package/dist/ui/components/atoms/vc-icon/composables/use-icon-type.d.ts +22 -0
  32. package/dist/ui/components/atoms/vc-icon/composables/use-icon-type.d.ts.map +1 -0
  33. package/dist/ui/components/atoms/vc-icon/composables/use-icon.d.ts +30 -0
  34. package/dist/ui/components/atoms/vc-icon/composables/use-icon.d.ts.map +1 -0
  35. package/dist/ui/components/atoms/vc-icon/index.d.ts +1 -0
  36. package/dist/ui/components/atoms/vc-icon/index.d.ts.map +1 -1
  37. package/dist/ui/components/atoms/vc-icon/types.d.ts +31 -0
  38. package/dist/ui/components/atoms/vc-icon/types.d.ts.map +1 -0
  39. package/dist/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue.d.ts +18 -4
  40. package/dist/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue.d.ts.map +1 -1
  41. package/dist/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue.d.ts +15 -2
  42. package/dist/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue.d.ts.map +1 -1
  43. package/dist/ui/components/atoms/vc-icon/vc-icon-examples.vue.d.ts.map +1 -1
  44. package/dist/ui/components/atoms/vc-icon/vc-icon-test.vue.d.ts.map +1 -1
  45. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts +11 -6
  46. package/dist/ui/components/atoms/vc-icon/vc-icon.vue.d.ts.map +1 -1
  47. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts +21 -4
  48. package/dist/ui/components/atoms/vc-icon/vc-lucide-icon.vue.d.ts.map +1 -1
  49. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts +30 -4
  50. package/dist/ui/components/atoms/vc-icon/vc-material-icon.vue.d.ts.map +1 -1
  51. package/dist/ui/components/atoms/vc-icon/vc-svg-icon.vue.d.ts +33 -0
  52. package/dist/ui/components/atoms/vc-icon/vc-svg-icon.vue.d.ts.map +1 -0
  53. package/dist/ui/components/molecules/vc-pagination/vc-pagination.vue.d.ts.map +1 -1
  54. package/dist/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue.d.ts.map +1 -1
  55. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/props.d.ts +14 -0
  56. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/props.d.ts.map +1 -0
  57. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts +2 -13
  58. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue.d.ts.map +1 -1
  59. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts +1 -1
  60. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue.d.ts.map +1 -1
  61. package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts +1 -1
  62. package/dist/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue.d.ts.map +1 -1
  63. package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts +1 -1
  64. package/dist/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue.d.ts.map +1 -1
  65. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts +1 -1
  66. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue.d.ts.map +1 -1
  67. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-columns-header/vc-table-columns-header.vue.d.ts +1 -1
  68. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-columns-header/vc-table-columns-header.vue.d.ts.map +1 -1
  69. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts +1 -1
  70. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue.d.ts.map +1 -1
  71. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts +1 -1
  72. package/dist/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue.d.ts.map +1 -1
  73. package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-view/vc-table-mobile-view.vue.d.ts +1 -1
  74. package/dist/ui/components/organisms/vc-table/_internal/vc-table-mobile-view/vc-table-mobile-view.vue.d.ts.map +1 -1
  75. package/dist/ui/components/organisms/vc-table/composables/useTableActions.d.ts +1 -1
  76. package/dist/ui/components/organisms/vc-table/composables/useTableActions.d.ts.map +1 -1
  77. package/dist/ui/components/organisms/vc-table/composables/useTableColumnReorder.d.ts +1 -1
  78. package/dist/ui/components/organisms/vc-table/composables/useTableColumnReorder.d.ts.map +1 -1
  79. package/dist/ui/components/organisms/vc-table/composables/useTableColumnResize.d.ts +1 -1
  80. package/dist/ui/components/organisms/vc-table/composables/useTableColumnResize.d.ts.map +1 -1
  81. package/dist/ui/components/organisms/vc-table/composables/useTableRowReorder.d.ts +1 -1
  82. package/dist/ui/components/organisms/vc-table/composables/useTableRowReorder.d.ts.map +1 -1
  83. package/dist/ui/components/organisms/vc-table/composables/useTableSelection.d.ts +1 -1
  84. package/dist/ui/components/organisms/vc-table/composables/useTableSelection.d.ts.map +1 -1
  85. package/dist/ui/components/organisms/vc-table/composables/useTableState.d.ts +1 -1
  86. package/dist/ui/components/organisms/vc-table/composables/useTableState.d.ts.map +1 -1
  87. package/dist/ui/components/organisms/vc-table/types.d.ts +36 -0
  88. package/dist/ui/components/organisms/vc-table/types.d.ts.map +1 -0
  89. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts +2 -34
  90. package/dist/ui/components/organisms/vc-table/vc-table.vue.d.ts.map +1 -1
  91. package/package.json +4 -4
  92. package/shared/components/generic-dropdown/generic-dropdown.vue +1 -1
  93. package/shared/components/settings-menu-item/settings-menu-item.vue +1 -6
  94. package/shared/components/user-dropdown-button/_internal/user-info.vue +3 -3
  95. package/ui/components/atoms/vc-icon/README.md +198 -220
  96. package/ui/components/atoms/vc-icon/composables/index.ts +2 -0
  97. package/ui/components/atoms/vc-icon/composables/use-icon-type.ts +83 -0
  98. package/ui/components/atoms/vc-icon/composables/use-icon.ts +129 -0
  99. package/ui/components/atoms/vc-icon/index.ts +1 -0
  100. package/ui/components/atoms/vc-icon/types.ts +36 -0
  101. package/ui/components/atoms/vc-icon/vc-bootstrap-icon.vue +111 -10
  102. package/ui/components/atoms/vc-icon/vc-fontawesome-icon.vue +119 -17
  103. package/ui/components/atoms/vc-icon/vc-icon-examples.vue +485 -124
  104. package/ui/components/atoms/vc-icon/vc-icon-test.vue +399 -209
  105. package/ui/components/atoms/vc-icon/vc-icon.stories.ts +502 -56
  106. package/ui/components/atoms/vc-icon/vc-icon.vue +240 -155
  107. package/ui/components/atoms/vc-icon/vc-lucide-icon.vue +163 -33
  108. package/ui/components/atoms/vc-icon/vc-material-icon.vue +136 -30
  109. package/ui/components/atoms/vc-icon/vc-svg-icon.vue +168 -0
  110. package/ui/components/atoms/vc-widget/vc-widget.stories.ts +13 -0
  111. package/ui/components/molecules/vc-multivalue/vc-multivalue.vue +1 -1
  112. package/ui/components/molecules/vc-pagination/vc-pagination.vue +23 -14
  113. package/ui/components/organisms/vc-app/_internal/vc-app-bar/_internal/AppBarHeader.vue +2 -2
  114. package/ui/components/organisms/vc-app/_internal/vc-app-bar/vc-app-bar.vue +2 -3
  115. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/props.ts +14 -0
  116. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-base-button.vue +1 -12
  117. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/_internal/vc-blade-toolbar-buttons/_internal/vc-blade-toolbar-button/vc-blade-toolbar-circle-button.vue +1 -1
  118. package/ui/components/organisms/vc-table/_internal/vc-table-cell/vc-table-cell.vue +1 -1
  119. package/ui/components/organisms/vc-table/_internal/vc-table-column-switcher/vc-table-column-switcher.vue +1 -1
  120. package/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-body/vc-table-body.vue +1 -1
  121. package/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-columns-header/vc-table-columns-header.vue +1 -1
  122. package/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/_internal/vc-table-row/vc-table-row.vue +1 -1
  123. package/ui/components/organisms/vc-table/_internal/vc-table-desktop-view/vc-table-desktop-view.vue +1 -1
  124. package/ui/components/organisms/vc-table/_internal/vc-table-mobile-view/vc-table-mobile-view.vue +1 -1
  125. package/ui/components/organisms/vc-table/composables/useTableActions.ts +1 -1
  126. package/ui/components/organisms/vc-table/composables/useTableColumnReorder.ts +1 -1
  127. package/ui/components/organisms/vc-table/composables/useTableColumnResize.ts +1 -1
  128. package/ui/components/organisms/vc-table/composables/useTableRowReorder.ts +1 -1
  129. package/ui/components/organisms/vc-table/composables/useTableSelection.ts +1 -1
  130. package/ui/components/organisms/vc-table/composables/useTableState.ts +1 -1
  131. package/ui/components/organisms/vc-table/types.ts +32 -0
  132. package/ui/components/organisms/vc-table/vc-table.vue +2 -30
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [1.1.5](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.4...v1.1.5) (2025-05-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * enhance VcIcon component ([58ad2ba](https://github.com/VirtoCommerce/vc-shell/commit/58ad2baaf306caa92375e81b170fdfb198a75b20))
7
+ * implement module versioning and compatibility checks in the modularity plugin ([19c9553](https://github.com/VirtoCommerce/vc-shell/commit/19c95534c4ca0f6041015a0489dab7eabc1a322a))
8
+
9
+
10
+
1
11
  ## [1.1.4](https://github.com/VirtoCommerce/vc-shell/compare/v1.1.3...v1.1.4) (2025-04-30)
2
12
 
3
13
 
@@ -48,7 +48,7 @@
48
48
  display: inline-block;
49
49
  }
50
50
 
51
- /* Размеры спиннера */
51
+ /* Spinner sizes */
52
52
  .v-loading[data-loading-size="small"]::after {
53
53
  --v-loading-spinner-size: var(--v-loading-spinner-size-small);
54
54
  border-width: 2px;
@@ -1,9 +1,9 @@
1
-
2
1
  # Modularity Plugin
3
2
 
4
- The Modularity Plugin provides two main features:
3
+ The Modularity Plugin provides three main features:
5
4
  - Dynamic Module Loading
6
5
  - Extensions System
6
+ - Module Versioning and Compatibility
7
7
 
8
8
  ## Dynamic Module Loading
9
9
 
@@ -11,23 +11,29 @@ The Dynamic Module Loading system allows you to load Vue.js modules at runtime.
11
11
 
12
12
  ### Usage
13
13
 
14
-
15
14
  ```typescript
16
15
  import { useDynamicModules } from '@framework/core/plugins/modularity';
17
16
  import { createApp } from 'vue';
18
17
  import { createRouter } from 'vue-router';
19
18
  const app = createApp(App);
20
- const router = createRouter(/ router config /);
21
- const { load, extensionsHelper } = useDynamicModules(app, {
19
+ const router = createRouter(/* router config */);
20
+ const { load, extensionsHelper, getLoadedModulesWithVersions } = useDynamicModules(app, {
22
21
  router,
23
22
  appName: 'your-app-name'
24
23
  },
25
24
  {
26
25
  baseUrl: 'https://your-modules-host.com/',
27
26
  manifestFileName: 'manifest.json', // optional, default: 'manifest.json'
27
+ frameworkVersion: '1.2.3', // current framework version
28
+ appVersion: '2.0.0', // current application version
29
+ skipVersionCheck: process.env.NODE_ENV === 'development', // optional, skip version check in dev mode
28
30
  });
29
31
  // Load all modules
30
32
  await load();
33
+
34
+ // Get information about loaded modules with their versions
35
+ const loadedModules = getLoadedModulesWithVersions();
36
+ console.log(`Loaded modules: ${loadedModules.size}`);
31
37
  ```
32
38
 
33
39
  ### Module Structure
@@ -36,17 +42,26 @@ Each module should have:
36
42
  1. A manifest file (manifest.json) describing module files generated by `Vite` during build time
37
43
  2. An entry point file that exports a Vue plugin
38
44
  3. Optional CSS files
45
+ 4. Optional version.json file with versioning information
39
46
 
40
47
  Example manifest.json:
41
48
 
42
49
  ```json
43
50
  {
44
- "entry": {
45
- "file": "index.js",
51
+ "src/modules/index.ts": {
52
+ "file": "index.js",
53
+ "name": "index",
54
+ "src": "src/modules/index.ts",
46
55
  "isEntry": true
47
56
  },
48
- "styles": {
49
- "file": "styles.css"
57
+ "style.css": {
58
+ "file": "style.css",
59
+ "src": "style.css"
60
+ },
61
+ "version.json": {
62
+ "file": "version.json",
63
+ "src": "version.json",
64
+ "isVersionInfo": true
50
65
  }
51
66
  }
52
67
  ```
@@ -56,14 +71,324 @@ Example module:
56
71
  ```typescript
57
72
  export default {
58
73
  install(app, options) {
59
- // Plugin installation code
74
+ // Plugin installation code
60
75
  },
61
76
  extensions: {
62
- // Optional extensions configuration
77
+ // Optional extensions configuration
78
+ },
79
+ version: {
80
+ version: '1.0.0',
81
+ compatibleWith: {
82
+ framework: '^1.2.0', // Compatible with framework version 1.2.x
83
+ modules: {
84
+ 'dependency-module': '>=2.0.0' // Requires dependency-module version 2.0.0 or higher
85
+ }
86
+ },
87
+ appCompatibility: {
88
+ 'vendor-portal': '>=2.0.0', // Compatible with vendor-portal app version 2.0.0 or higher
89
+ 'admin-app': '^1.0.0' // Compatible with admin-app version 1.x.x
90
+ }
91
+ }
92
+ }
93
+ ```
94
+
95
+ ## Module Versioning System
96
+
97
+ The Module Versioning System ensures compatibility between:
98
+ - Modules and the framework
99
+ - Modules and specific applications
100
+ - Modules and other modules
101
+
102
+ ### Version Information Structure
103
+
104
+ ```typescript
105
+ interface VersionInfo {
106
+ version: string;
107
+ compatibleWith: {
108
+ framework: string; // Framework version range (semver)
109
+ modules?: Record<string, string>; // Dependencies on other modules
110
+ };
111
+ appCompatibility?: {
112
+ [appName: string]: string; // Compatible application names and version ranges
113
+ }
114
+ }
115
+ ```
116
+
117
+ ### Setting Up Module Versioning
118
+
119
+ There are three ways to specify version information:
120
+
121
+ 1. **In the module's code** (highest priority):
122
+
123
+ ```typescript
124
+ export default {
125
+ install(app, options) { /* ... */ },
126
+ version: {
127
+ version: '1.0.0',
128
+ compatibleWith: {
129
+ framework: '^1.2.0'
130
+ },
131
+ appCompatibility: {
132
+ 'vendor-portal': '>=2.0.0',
133
+ 'admin-app': '^1.0.0'
134
+ }
135
+ }
136
+ }
137
+ ```
138
+
139
+ 2. **Using a version.json file** (medium priority):
140
+
141
+ ```json
142
+ {
143
+ "version": "1.0.0",
144
+ "compatibleWith": {
145
+ "framework": "^1.2.0",
146
+ "modules": {
147
+ "other-module": ">=1.0.0"
148
+ }
149
+ },
150
+ "appCompatibility": {
151
+ "vendor-portal": ">=2.0.0"
152
+ }
153
+ }
154
+ ```
155
+
156
+ 3. **In the apps.json file** (lowest priority):
157
+
158
+ ```json
159
+ [
160
+ {
161
+ "vendor-portal": {
162
+ "modules": [
163
+ {
164
+ "id": "my-module",
165
+ "url": "/modules/my-module/",
166
+ "version": "1.0.0"
167
+ }
168
+ ]
169
+ }
63
170
  }
171
+ ]
172
+ ```
173
+
174
+ ### Version Patterns
175
+
176
+ The versioning system uses [semver](https://semver.org/) syntax for version ranges:
177
+
178
+ - `*` - Compatible with any version
179
+ - `1.2.3` - Requires exact version 1.2.3
180
+ - `^1.2.3` - Compatible with 1.2.3 up to but not including 2.0.0
181
+ - `~1.2.3` - Compatible with 1.2.3 up to but not including 1.3.0
182
+ - `>=1.2.3` - Version 1.2.3 or higher
183
+ - `1.2.3 - 1.5.0` - Range between 1.2.3 and 1.5.0 (inclusive)
184
+
185
+ ### Application Compatibility
186
+
187
+ To specify which applications your module is compatible with:
188
+
189
+ ```typescript
190
+ appCompatibility: {
191
+ // Compatible with any version of vendor-portal
192
+ 'vendor-portal': '*',
193
+
194
+ // Compatible with admin-app version 2.0.0 and above
195
+ 'admin-app': '>=2.0.0',
196
+
197
+ // Compatible with any application (if appCompatibility is omitted entirely,
198
+ // the module is also considered compatible with any application)
199
+ '*': '*'
64
200
  }
65
201
  ```
66
202
 
203
+ If an application name is not listed in `appCompatibility`, the module will not be loaded in that application.
204
+
205
+ ### Setting Up Vite Config for Module Versioning
206
+
207
+ Here's a complete example of a Vite configuration that supports the versioning system:
208
+
209
+ ```javascript
210
+ import { defineConfig } from "vite";
211
+ import { resolve, join, dirname } from "node:path";
212
+ import vue from "@vitejs/plugin-vue";
213
+ import { fileURLToPath } from "node:url";
214
+ import fs from "node:fs";
215
+ import pkg from "./package.json";
216
+
217
+ const __dirname = dirname(fileURLToPath(import.meta.url));
218
+
219
+ // Get dependency versions from package.json
220
+ const { version, dependencies = {}, peerDependencies = {} } = pkg;
221
+
222
+ // Function to read framework version from dependencies
223
+ const getFrameworkVersion = () => {
224
+ const frameworkDep = dependencies["@vc-shell/framework"] ||
225
+ peerDependencies["@vc-shell/framework"] ||
226
+ "^1.0.0";
227
+ return frameworkDep.replace(/^\^|~/, ""); // Remove ^ or ~ prefixes
228
+ };
229
+
230
+ export default defineConfig({
231
+ build: {
232
+ manifest: "manifest.json",
233
+ copyPublicDir: false,
234
+ sourcemap: true,
235
+ minify: false,
236
+ lib: {
237
+ entry: resolve(__dirname, "./index.ts"),
238
+ fileName: (format, name) => `${name}.js`,
239
+ formats: ["umd"],
240
+ name: "VcShellDynamicModules",
241
+ },
242
+ outDir: join(__dirname, "../../dist/packages/modules"),
243
+ rollupOptions: {
244
+ output: {
245
+ globals: {
246
+ vue: "Vue",
247
+ "vue-router": "VueRouter",
248
+ "vee-validate": "VeeValidate",
249
+ "vue-i18n": "VueI18n",
250
+ moment: "moment",
251
+ "lodash-es": "_",
252
+ "@vueuse/core": "VueUse",
253
+ "@vc-shell/framework": "VcShellFramework",
254
+ },
255
+ banner: () => {
256
+ const versionInfo = {
257
+ version,
258
+ compatibleWith: {
259
+ framework: peerDependencies["@vc-shell/framework"] || "^" + getFrameworkVersion(),
260
+ modules: {}
261
+ },
262
+ appCompatibility: {
263
+ "vendor-portal": ">=2.0.0",
264
+ "admin-app": "^1.0.0"
265
+ }
266
+ };
267
+
268
+ return `
269
+ /* Module Version Info */
270
+ (function() {
271
+ if (typeof window !== 'undefined') {
272
+ window.__VC_SHELL_MODULE_VERSION_INFO__ = window.__VC_SHELL_MODULE_VERSION_INFO__ || {};
273
+ window.__VC_SHELL_MODULE_VERSION_INFO__["${pkg.name}"] = ${JSON.stringify(versionInfo)};
274
+ }
275
+ })();
276
+ `;
277
+ }
278
+ },
279
+ external: [
280
+ /node_modules/,
281
+ "@vc-shell/framework",
282
+ "vue",
283
+ "vue-router",
284
+ "vee-validate",
285
+ "vue-i18n",
286
+ "moment",
287
+ "lodash-es",
288
+ "@vueuse/core",
289
+ ],
290
+ },
291
+ },
292
+ plugins: [
293
+ vue(),
294
+ {
295
+ name: 'module-version-plugin',
296
+ apply: 'build',
297
+ enforce: 'post',
298
+
299
+ // Modify manifest.json after it's created
300
+ closeBundle: async () => {
301
+ const manifestPath = join(__dirname, "../../dist/packages/modules/manifest.json");
302
+
303
+ if (fs.existsSync(manifestPath)) {
304
+ try {
305
+ // Read generated manifest
306
+ const manifestContent = await fs.promises.readFile(manifestPath, 'utf-8');
307
+ const manifest = JSON.parse(manifestContent);
308
+
309
+ // Add version metadata file
310
+ const versionFileName = 'version.json';
311
+ const versionFilePath = join(__dirname, "../../dist/packages/modules/", versionFileName);
312
+
313
+ // Create version info
314
+ const versionInfo = {
315
+ version: pkg.version,
316
+ compatibleWith: {
317
+ framework: peerDependencies["@vc-shell/framework"] || "^" + getFrameworkVersion(),
318
+ modules: {}
319
+ },
320
+ appCompatibility: {
321
+ "vendor-portal": ">=2.0.0",
322
+ "admin-app": "^1.0.0"
323
+ }
324
+ };
325
+
326
+ // Write version file
327
+ await fs.promises.writeFile(versionFilePath, JSON.stringify(versionInfo, null, 2));
328
+
329
+ // Add version file info to manifest
330
+ manifest[versionFileName] = {
331
+ file: versionFileName,
332
+ src: versionFileName,
333
+ isVersionInfo: true // Special marker
334
+ };
335
+
336
+ // Write updated manifest
337
+ await fs.promises.writeFile(manifestPath, JSON.stringify(manifest, null, 2));
338
+
339
+ console.log(`✓ Version information added to manifest: ${manifestPath}`);
340
+ } catch (error) {
341
+ console.error('Error updating manifest with version info:', error);
342
+ }
343
+ } else {
344
+ console.warn(`Manifest file not found at ${manifestPath}`);
345
+ }
346
+ }
347
+ }
348
+ ],
349
+ });
350
+ ```
351
+
352
+ ### Accessing Version Information in the Module
353
+
354
+ In your module code, you can access the version information:
355
+
356
+ ```typescript
357
+ // In your module's index.ts
358
+ import pkg from './package.json';
359
+
360
+ export default {
361
+ install(app, options) {
362
+ // Your module code
363
+ },
364
+ // Access version info from window global if available (set by banner in vite config),
365
+ // or fall back to static configuration
366
+ version: window.__VC_SHELL_MODULE_VERSION_INFO__?.[pkg.name] || {
367
+ version: pkg.version,
368
+ compatibleWith: {
369
+ framework: "^1.0.0"
370
+ },
371
+ appCompatibility: {
372
+ "vendor-portal": ">=2.0.0"
373
+ }
374
+ }
375
+ };
376
+ ```
377
+
378
+ ### Error Handling
379
+
380
+ When a module fails the compatibility check, it won't be loaded, and an error message will be logged to the console:
381
+
382
+ ```
383
+ Version compatibility error: Module my-module requires framework version ^2.0.0, but current is 1.2.3
384
+ ```
385
+
386
+ or
387
+
388
+ ```
389
+ Module my-module is not compatible with application customer-app. This module supports only: vendor-portal, admin-app
390
+ ```
391
+
67
392
  ## Extensions System
68
393
 
69
394
  The Extensions System enables communication between the application and its modules.
@@ -79,7 +404,7 @@ The Extensions System enables communication between the application and its modu
79
404
  // In your module
80
405
  export default {
81
406
  install(app) {
82
- // Plugin installation code
407
+ // Plugin installation code
83
408
  },
84
409
  extensions: {
85
410
  inbound: {
@@ -145,8 +470,13 @@ type Extension = Record<string, unknown>;
145
470
 
146
471
  ## Best Practices
147
472
 
148
- 1. Always provide unique IDs for extensions
149
- 2. Document your module's extension points
150
- 3. Handle missing or failed extensions gracefully
151
- 4. Use TypeScript interfaces for type safety
152
- 5. Keep extension configurations simple and serializable
473
+ 1. Always provide version information for your modules.
474
+ 2. Use semantic versioning for your module versions.
475
+ 3. Be explicit about framework compatibility requirements.
476
+ 4. Specify application compatibility if your module is designed for specific applications.
477
+ 5. Handle missing extensions gracefully.
478
+ 6. Test your modules with different versions of the framework and applications.
479
+ 7. Consider using the `skipVersionCheck` option in development for easier testing.
480
+ 8. Document your module's version compatibility requirements.
481
+ 9. Keep version.json and manifest.json files up to date when deploying modules.
482
+ 10. Use the error messages to troubleshoot version compatibility issues.