@eclipse-slm/ui 1.5.0-snapshot.1 → 1.5.0-snapshot.844

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -143,6 +143,9 @@ export default defineConfig({
143
143
  })
144
144
  ```
145
145
 
146
+ `npm run dev` and `npm run build` work with this configuration alone; the plugin sets up dependency pre-bundling for
147
+ the package source in `node_modules`, so no extra `optimizeDeps` or CommonJS settings are needed.
148
+
146
149
  Plugin options:
147
150
 
148
151
  | Option | Default | Meaning |
@@ -215,6 +218,10 @@ export default function customizeApp(app: App): void {
215
218
  }
216
219
  ```
217
220
 
221
+ The app instance itself lives in `@/app/appInstance` (`app`, and `globals` = `app.config.globalProperties`, e.g.
222
+ `globals.$keycloak`). `@/main` still re-exports `globals` for backward compatibility, but new code and overrides should
223
+ import from `@/app/appInstance`: any module importing `@/main` makes the dev server evaluate the entry a second time.
224
+
218
225
  **`theme.ts`** (`src/customization/theme.ts`) is a default export `{ colors, variables }` used for the Vuetify theme:
219
226
 
220
227
  ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-slm/ui",
3
- "version": "1.5.0-snapshot.1",
3
+ "version": "1.5.0-snapshot.844",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -95,6 +95,7 @@
95
95
  "eslint-plugin-vue": "^9.32.0",
96
96
  "eslint-plugin-vuetify": "^2.4.0",
97
97
  "pinia": "^2.1.4",
98
+ "playwright": "^1.64.1",
98
99
  "vite": "^7.3.1",
99
100
  "vitest": "^5.0.5",
100
101
  "vue": "^3.4.27",
@@ -1,7 +1,7 @@
1
1
  import SockJS from 'sockjs-client/dist/sockjs';
2
2
  import Stomp from 'stomp-websocket';
3
3
  import {useNotificationStore} from "@/stores/notificationStore";
4
- import { globals } from '@/main.ts';
4
+ import { globals } from '@/app/appInstance';
5
5
 
6
6
  const API_URL = '/notification-service';
7
7
 
@@ -38,13 +38,13 @@ class NotificationServiceWebsocketClient {
38
38
  Issuer: `${globals.$keycloak.keycloak.authServerUrl}/realms/${globals.$keycloak.keycloak.realm}`
39
39
  },
40
40
  () => {
41
- this.stompClient.subscribe('/user/topic/notifications', NotificationServiceWebsocketClient.processNotificationMessage);
42
-
43
- // direct topic fallback for convertAndSend("/topic/notifications/{userId}", ...)
41
+ // The backend publishes every notification to both destinations, so subscribe to only one
42
+ // of them, otherwise each notification is processed (and toasted) twice
44
43
  if (userId) {
45
44
  this.stompClient.subscribe(subscriptionName, NotificationServiceWebsocketClient.processNotificationMessage);
46
45
  } else {
47
- console.warn('Unable to resolve websocket user id for /topic/notifications/{userId} subscription')
46
+ console.warn('Unable to resolve websocket user id, falling back to /user/topic/notifications subscription')
47
+ this.stompClient.subscribe('/user/topic/notifications', NotificationServiceWebsocketClient.processNotificationMessage);
48
48
  }
49
49
  },
50
50
  (error) => {
@@ -0,0 +1,8 @@
1
+ import { createApp } from 'vue';
2
+ import App from '@/App.vue';
3
+
4
+ // The app lives in its own module so that other modules can reach it without importing the entry (main.ts):
5
+ // importing the entry from a module makes Vite (dev, package under node_modules) load a second copy of it.
6
+ export const app = createApp(App);
7
+
8
+ export const globals = app.config.globalProperties;
@@ -217,7 +217,7 @@
217
217
  import {useTheme} from "vuetify";
218
218
  import {useNotificationStore} from "@/stores/notificationStore";
219
219
  import {useStore} from "@/stores/store";
220
- import {globals} from "@/main";
220
+ import {globals} from "@/app/appInstance";
221
221
 
222
222
  export default {
223
223
  name: 'DashboardCoreAppBar',
@@ -180,11 +180,10 @@ import DockerContainerEnvironmentVariables
180
180
  from '@/components/service_offerings/wizard_service_offering_version/Docker/DockerEnvironmentVariables'
181
181
  import 'vue-json-pretty/lib/styles.css'
182
182
  import { parseDocument, parse as parseYaml } from 'yaml'
183
+ import { parse } from 'dot-properties'
183
184
  import ServiceRepositorySelect
184
185
  from '@/components/service_offerings/wizard_service_offering_version/ServiceRepositorySelect'
185
186
 
186
- const { parse } = require('dot-properties')
187
-
188
187
  export default {
189
188
  name: 'ServiceOfferingVersionWizardStep2DeploymentDefinitionDockerCompose',
190
189
  components: {
@@ -103,13 +103,12 @@
103
103
  <script>
104
104
  import 'vue-json-pretty/lib/styles.css'
105
105
  import YAML from 'yaml'
106
+ import { parse } from 'dot-properties'
106
107
  import DockerContainerEnvironmentVariables
107
108
  from '@/components/service_offerings/wizard_service_offering_version/Docker/DockerEnvironmentVariables'
108
109
  import ServiceRepositorySelect
109
110
  from "@/components/service_offerings/wizard_service_offering_version/ServiceRepositorySelect.vue";
110
111
 
111
- const { parse } = require('dot-properties')
112
-
113
112
  export default {
114
113
  name: 'ServiceOfferingVersionWizardStep2DeploymentDefinitionKubernetes',
115
114
  components: {ServiceRepositorySelect, DockerContainerEnvironmentVariables},
@@ -94,7 +94,7 @@ import {storeToRefs} from "pinia";
94
94
  import ServiceManagementClient from "@/api/service-management/service-management-client";
95
95
  import logRequestError from "@/api/restApiHelper";
96
96
  import updateToken from "@/utils/updateToken";
97
- import {globals} from "@/main";
97
+ import {globals} from "@/app/appInstance";
98
98
 
99
99
  export default {
100
100
  name: 'ServiceVendorDevelopersTable',
package/src/main.ts CHANGED
@@ -1,5 +1,4 @@
1
- import {createApp} from 'vue';
2
- import App from './App.vue'
1
+ import {app} from '@/app/appInstance';
3
2
 
4
3
  import router from './pages/router';
5
4
  import 'chartist/dist/chartist.min.css';
@@ -46,8 +45,6 @@ import {useCapabilitiesStore} from "@/stores/capabilitiesStore";
46
45
 
47
46
  console.log("App Mode: " + import.meta.env.MODE)
48
47
 
49
- const app = createApp(App);
50
-
51
48
  const pinia = createPinia();
52
49
  pinia.use(piniaPluginPersistedstate);
53
50
  app.use(pinia);
@@ -166,5 +163,5 @@ app.mount('#app');
166
163
 
167
164
  yup.addMethod(yup.string, 'ipv4', yupValidateIPv4);
168
165
 
169
- const globals = app.config.globalProperties
170
- export { globals }
166
+ // Kept for backward compatibility; import `globals` from '@/app/appInstance' instead.
167
+ export { globals } from '@/app/appInstance'
@@ -1,6 +1,6 @@
1
1
  import ApiState from '@/api/apiState'
2
2
  import {defineStore} from "pinia";
3
- import {globals} from "@/main";
3
+ import {globals} from "@/app/appInstance";
4
4
 
5
5
  interface KeycloakLike {
6
6
  authenticated?: boolean,
package/src/utils/i18n.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import { createI18n } from 'vue-i18n';
2
2
  import {de, en} from "vuetify/locale";
3
3
  import customizeMessages from "@/customization/customizeMessages";
4
+ import enMessages from "@/localisation/en.json";
5
+ import deMessages from "@/localisation/de.json";
4
6
 
5
7
  const messages = customizeMessages({
6
8
  en: {
7
- ...require('@/localisation/en.json'),
9
+ ...enMessages,
8
10
  $vuetify: en,
9
11
  },
10
12
  de: {
11
- ...require('@/localisation/de.json'),
13
+ ...deMessages,
12
14
  $vuetify: de,
13
15
  },
14
16
  });
@@ -1,5 +1,5 @@
1
1
  import axios from 'axios';
2
- import {globals} from "@/main";
2
+ import {globals} from "@/app/appInstance";
3
3
  import {useEnvStore} from "@/stores/environmentStore";
4
4
  import updateToken from "@/utils/updateToken";
5
5
 
@@ -1,4 +1,4 @@
1
- import {globals} from "@/main";
1
+ import {globals} from "@/app/appInstance";
2
2
 
3
3
  export default async function () {
4
4
  if(globals.$keycloak?.keycloak?.updateToken !== undefined) {
@@ -10,6 +10,12 @@ import { overridesPlugin } from './overrides.js';
10
10
  import { resolveSlmPaths } from './paths.js';
11
11
  // Under NodeNext the CJS typings expose the module namespace as default; at runtime default is the function.
12
12
  const commonjs = commonjsModule;
13
+ const SCAN_EXTENSIONS = '{vue,ts,js}';
14
+ /** Escapes glob syntax in a literal path (mirrors tinyglobby's `escapePath`, which Vite uses for entries). */
15
+ function escapeGlob(p) {
16
+ return p.replace(/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g, '\\$&');
17
+ }
18
+ const toPosix = (p) => p.split(path.sep).join('/');
13
19
  export function slmUi(options = {}) {
14
20
  const packageRoot = options.__packageRoot ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
15
21
  const version = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8')).version;
@@ -23,6 +29,8 @@ export function slmUi(options = {}) {
23
29
  state.consumerRoot = consumerRoot;
24
30
  state.paths = resolveSlmPaths(options, consumerRoot, packageRoot);
25
31
  const { packageSrc } = state.paths;
32
+ // Lexical (not realpath'd) like `root`, so the root-relative entry glob below stays valid.
33
+ const overridesDir = options.overridesDir && path.resolve(consumerRoot, options.overridesDir);
26
34
  return {
27
35
  root: packageRoot,
28
36
  envDir: consumerRoot,
@@ -36,9 +44,21 @@ export function slmUi(options = {}) {
36
44
  alias: { '@': packageSrc },
37
45
  extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
38
46
  },
39
- // The package src lives under node_modules, so without this Vite's dep scanner would prebundle raw `@/...`
40
- // imports with esbuild, bypassing the slm plugins (API-client redirect, overrides).
41
- optimizeDeps: { exclude: ['@', '@slm-original'] },
47
+ optimizeDeps: {
48
+ // The package src lives under node_modules, so without this Vite's dep scanner would prebundle raw `@/...`
49
+ // imports with esbuild, bypassing the slm plugins (API-client redirect, overrides).
50
+ exclude: ['@', '@slm-original'],
51
+ // That exclude stops the scanner at every `@/...` import, so it would never reach the package's third-party
52
+ // (often CommonJS) imports and they would be served unbundled. Scanning every source file as an entry finds
53
+ // them again. Patterns are relative to the root (the package itself): Vite's `**/node_modules/**` entry
54
+ // ignore is matched against root-relative paths, so it does not hit the package src under node_modules.
55
+ entries: [
56
+ `src/**/*.${SCAN_EXTENSIONS}`,
57
+ ...(overridesDir
58
+ ? [`${escapeGlob(toPosix(path.relative(packageRoot, overridesDir)))}/**/*.${SCAN_EXTENSIONS}`]
59
+ : []),
60
+ ],
61
+ },
42
62
  server: { fs: { allow: [packageRoot, consumerRoot] } },
43
63
  };
44
64
  },
@@ -67,7 +87,8 @@ export function slmUi(options = {}) {
67
87
  overridesPlugin(paths),
68
88
  driftCheckPlugin(paths, { allowNewFiles: options.allowNewFiles ?? false, version }),
69
89
  vue({ template: { transformAssetUrls } }),
70
- commonjs(),
90
+ // vite-plugin-commonjs skips every id containing node_modules, which is where consumers have the package src.
91
+ commonjs({ filter: (id) => (id.startsWith(toPosix(paths().packageSrc) + '/') ? true : undefined) }),
71
92
  vuetify({ autoImport: true }),
72
93
  ];
73
94
  }