@omnia/tooling-vue 8.0.481-dev → 8.0.483-dev

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.
@@ -10,8 +10,10 @@ const tooling_composers_1 = require("@omnia/tooling-composers");
10
10
  const tooling_1 = require("@omnia/tooling");
11
11
  const fsExtra = tslib_1.__importStar(require("fs-extra"));
12
12
  const fx_models_1 = require("@omnia/fx-models");
13
+ let _duplicateElementNames = {};
13
14
  async function generateComponentTypingsAndDoc(componentRegistrations) {
14
15
  tooling_1.utils.log("Generate components typings and documentation running...");
16
+ _duplicateElementNames = {};
15
17
  var startTime = new Date().getTime();
16
18
  const docResult = {};
17
19
  async function buildDoc(wc) {
@@ -80,9 +82,12 @@ declare global {
80
82
  //{{namespace}}
81
83
  }`;
82
84
  Object.keys(elementNamespaces).forEach(key => {
85
+ let value = JSON.stringify(elementNamespaces[key], null, 2).replace(/\"typeof /g, "typeof ").replace(/ <<end>>\"/g, "");
86
+ Object.keys(_duplicateElementNames).forEach(duplicateKey => {
87
+ value = value.replace(`${duplicateKey}":`, `${duplicateKey.split("$")[1]}": ${_duplicateElementNames[duplicateKey]} `);
88
+ });
83
89
  result = result.replace("//{{namespace}}", `
84
- let ${key}: ${JSON.stringify(elementNamespaces[key], null, 2)
85
- .replace(/\"typeof /g, "typeof ").replace(/ <<end>>\"/g, "")}
90
+ let ${key}: ${value}
86
91
  //{{namespace}}
87
92
  `);
88
93
  });
@@ -193,10 +198,11 @@ function populateElementNamespace(namespace, elementName, importElement) {
193
198
  const parts = elementName.split(".");
194
199
  for (let i = 0; i < parts.length; i++) {
195
200
  const name = parts[i];
201
+ const fullName = `${parts.slice(0, i).join("-")}$${name}`;
196
202
  if (typeof namespace === "string") {
197
203
  throw new Error("Build element namespace -> that element name contain another element name");
198
204
  }
199
- if (!namespace[name]) {
205
+ if (!namespace[name] && !namespace[fullName]) {
200
206
  if (i === parts.length - 1) {
201
207
  namespace[name] = `typeof ${importElement} extends { propsDefinition: infer TProp } ? { new(...args: any[]): { $props: TProp & Omit<VueComponentBaseProps, keyof TProp> } } : typeof ${importElement} <<end>>`;
202
208
  }
@@ -206,17 +212,21 @@ function populateElementNamespace(namespace, elementName, importElement) {
206
212
  }
207
213
  else {
208
214
  if (i === parts.length - 1) {
209
- tooling_1.utils.log(`Generate namespace for component with suffix $ -> ${parts.slice(0, i + 1).join(".")}$`);
210
- namespace[`${name}$`] = `typeof ${importElement} extends { propsDefinition: infer TProp } ? { new(...args: any[]): { $props: TProp & Omit<VueComponentBaseProps, keyof TProp> } } : typeof ${importElement} <<end>>`;
211
- // throw new Error("Build element namespace -> Exist an element name contain a above that element name");
215
+ // utils.log(`Generate namespace for component with suffix $ -> ${parts.slice(0, i + 1).join(".")}$`);
216
+ _duplicateElementNames[fullName] = `(typeof ${importElement} extends { propsDefinition: infer TProp } ? { new(...args: any[]): { $props: TProp & Omit<VueComponentBaseProps, keyof TProp> } } : typeof ${importElement}) &`;
217
+ if (!namespace[fullName]) {
218
+ namespace[fullName] = namespace[name];
219
+ namespace[name] = undefined;
220
+ }
212
221
  }
213
222
  else {
214
223
  if (typeof namespace[name] === "string") {
215
- tooling_1.utils.log(`Generate namespace for component with suffix $ -> ${parts.slice(0, i + 1).join(".")}$`);
216
- namespace[`${name}$`] = namespace[name];
217
- namespace[name] = {};
224
+ // utils.log(`Generate namespace for component with suffix $ -> ${parts.slice(0, i + 1).join(".")}$`);
225
+ _duplicateElementNames[fullName] = `(${namespace[name].replace("<<end>>", ") &")}`;
226
+ namespace[name] = undefined;
227
+ namespace[fullName] = {};
218
228
  }
219
- namespace = namespace[name];
229
+ namespace = (namespace[name] || namespace[fullName]);
220
230
  }
221
231
  }
222
232
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/tooling-vue",
3
3
  "license": "MIT",
4
- "version": "8.0.481-dev",
4
+ "version": "8.0.483-dev",
5
5
  "description": "Used to bundle and serve manifests web component that build on Vue framework.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "author": "Omnia Digital Workplace AB",
21
21
  "dependencies": {
22
- "@omnia/fx-models": "8.0.481-dev",
23
- "@omnia/tooling-composers": "8.0.481-dev",
22
+ "@omnia/fx-models": "8.0.483-dev",
23
+ "@omnia/tooling-composers": "8.0.483-dev",
24
24
  "@types/mousetrap": "1.5.34",
25
25
  "@types/quill": "1.3.6",
26
26
  "@types/zepto": "1.0.29",