@omnia/tooling-vue 8.0.74-dev → 8.0.75-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.
@@ -4,7 +4,7 @@ export interface WebComponentOptionsExtends extends WebComponentOptions {
4
4
  }
5
5
  export type OutputInfo = {
6
6
  wc: {
7
- namespace: string;
7
+ namespaces: string[];
8
8
  mappings: {
9
9
  [element: string]: string;
10
10
  };
@@ -35,11 +35,14 @@ exports.modifyComponent = modifyComponent;
35
35
  function replaceWebComponentNamespaceMapping(content) {
36
36
  const infos = _outputInfos.concat(ConfigurationManager.outputInfo.get());
37
37
  infos.forEach(info => {
38
- if (info.wc?.namespace) {
39
- content = content.replace(new RegExp(`(<|<\/|\\s)${info.wc.namespace}\\..*?(>|\\s)`, 'g'), function (match) {
40
- return match.replace(new RegExp(`(${info.wc.namespace}.*)(?=(>|\\s))`), function (token) {
41
- return token.replace(/(\S+)/g, function (tag) {
42
- return info.wc.mappings[tag.replace(`${info.wc.namespace}.`, "")] || tag;
38
+ if (info.wc?.namespaces) {
39
+ info.wc.namespaces.forEach(namespace => {
40
+ content = content.replace(new RegExp(`(<|<\/|\\s)${namespace}\\..*?(>|\\s)`, 'g'), function (match) {
41
+ return match.replace(new RegExp(`(${namespace}.*)(?=(>|\\s))`), function (token) {
42
+ return token.replace(/(\S+)/g, function (tag) {
43
+ // console.log("replaceWebComponentNamespaceMapping", tag)
44
+ return info.wc.mappings[tag] || tag;
45
+ });
43
46
  });
44
47
  });
45
48
  });
@@ -201,25 +201,25 @@ declare global {
201
201
  wcTypings = `import { VueComponentBaseProps } from "../../../../client/fx/ux/index";
202
202
  ${wcTypings}`;
203
203
  }
204
- const elementNamespaceStucture = {};
204
+ const elementNamespaces = {};
205
205
  const wcNamespace = (0, shared_1.getBuildOption)()?.componentNamespace;
206
206
  const skipElementNames = (0, shared_1.getBuildOption)()?.skipElementNames;
207
207
  const info = shared_1.ConfigurationManager.outputInfo.get();
208
208
  info.wc = {
209
- namespace: typeof wcNamespace === "string" ? wcNamespace : wcNamespace,
209
+ namespaces: wcNamespace ? [wcNamespace] : null,
210
210
  mappings: {}
211
211
  };
212
212
  await tooling_1.utils.asyncForEach(componentRegistrations, async (wc) => {
213
- wcTypings = generateWebComponentTypings(wc, wcTypings, info, elementNamespaceStucture, skipElementNames);
213
+ wcTypings = generateWebComponentTypings(wc, wcTypings, info, elementNamespaces, skipElementNames);
214
214
  await buildDoc(wc);
215
215
  });
216
- if (Object.keys(elementNamespaceStucture).length > 0) {
216
+ if (Object.keys(elementNamespaces).length > 0) {
217
217
  let result = `declare global {
218
218
  //{{namespace}}
219
219
  }`;
220
- Object.keys(elementNamespaceStucture).forEach(key => {
220
+ Object.keys(elementNamespaces).forEach(key => {
221
221
  result = result.replace("//{{namespace}}", `
222
- let ${key}: ${JSON.stringify(elementNamespaceStucture[key], null, 2)
222
+ let ${key}: ${JSON.stringify(elementNamespaces[key], null, 2)
223
223
  .replace(/\"typeof /g, "typeof ").replace(/ <<end>>\"/g, "")}
224
224
  //{{namespace}}
225
225
  `);
@@ -277,16 +277,19 @@ function generateWebComponentTypings(wc, template, info, elementNamespace, skipE
277
277
  else {
278
278
  importPath = `../../../../${importPath}`;
279
279
  }
280
- if (info.wc.namespace && (!skipElementNames || skipElementNames.indexOf(wc.componentOptions.elementName) === -1)) {
280
+ if (info.wc.namespaces && (!skipElementNames || skipElementNames.indexOf(wc.componentOptions.elementName) === -1)) {
281
281
  let elementName = wc.componentOptions.elementName
282
282
  .replace(/-/g, ".");
283
283
  // .replace("omfx-", "")
284
284
  // .replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
285
285
  // elementNamePascalCase = elementNamePascalCase[0].toUpperCase() + elementNamePascalCase.substring(1, elementNamePascalCase.length)
286
- const namespace = (wc.componentOptions.namespace === true ? "" : wc.componentOptions.namespace) || info.wc.namespace;
286
+ const namespace = (wc.componentOptions.namespace === true ? "" : wc.componentOptions.namespace) || (0, shared_1.getBuildOption)()?.componentNamespace;
287
287
  if (namespace && elementName.indexOf(`${namespace}.`) !== 0) {
288
288
  elementName = `${namespace}.${elementName}`;
289
289
  }
290
+ if (info.wc.namespaces && info.wc.namespaces.indexOf(elementName.split(".")[0]) === -1) {
291
+ info.wc.namespaces.push(elementName.split(".")[0]);
292
+ }
290
293
  info.wc.mappings[elementName] = wc.componentOptions.elementName;
291
294
  try {
292
295
  populateElementNamespace(elementNamespace, elementName, friendlyManifestId);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/tooling-vue",
3
3
  "license": "MIT",
4
- "version": "8.0.74-dev",
4
+ "version": "8.0.75-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": "Precio Fishbone",
21
21
  "dependencies": {
22
- "@omnia/fx-models": "8.0.74-dev",
23
- "@omnia/tooling-composers": "8.0.74-dev",
22
+ "@omnia/fx-models": "8.0.75-dev",
23
+ "@omnia/tooling-composers": "8.0.75-dev",
24
24
  "@types/mousetrap": "1.5.34",
25
25
  "@types/quill": "1.3.6",
26
26
  "@types/zepto": "1.0.29",