@veloceapps/sdk 8.0.0-176 → 8.0.0-177

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,25 @@
1
- import { UUID } from '@veloceapps/core';
1
+ import { isDefined, UUID } from '@veloceapps/core';
2
2
  import { vendorMap } from '../vendor-map';
3
- const importRegexp = new RegExp(`import([ \\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t"'\\{\\}]+[ \\n\\t]*,?)+\\})?[ \\n\\t]*)from[ \\n\\t]*(['"])([^'"\\n]+)(?:['"]);`, 'g');
3
+ const importRegexp = new RegExp(`import\\s+(?:{[^{}]+}|.*?)\\s*(?:from)?\\s*['"].*?['"]|import\\(.*?\\)`, 'g');
4
+ const importPartsRegexp = new RegExp(`import ([\\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t"'\\{\\}]+[ \\n\\t]*,?)+\\})?[\\n\\t]*) from[ \\n\\t]*(['"])([^'"\\n]+)(?:['"])`, 'g');
4
5
  const normalizeImports = (script, elementPath) => {
5
- const result = script.replace(importRegexp, (match, g1, g2, src) => {
6
- const imports = g1
7
- .trim()
8
- .slice(1, -1)
9
- .split(',')
10
- .map(item => item.trim());
11
- imports.forEach(item => {
12
- if (!vendorMap[src]?.[item]) {
13
- throw new Error(`Failed to import ${item} from '${src}' in ${elementPath}/script.ts`);
14
- }
6
+ return script.replace(importRegexp, match => {
7
+ return match.replace(importPartsRegexp, (_, g1, __, src) => {
8
+ const strObj = g1.replace(/ as /g, ': ').trim();
9
+ const imports = strObj
10
+ .slice(1, -1)
11
+ .split(',')
12
+ .map(item => item.split(':')[0])
13
+ .filter(isDefined)
14
+ .map(item => item.trim());
15
+ imports.forEach(item => {
16
+ if (!vendorMap[src]?.[item]) {
17
+ throw new Error(`Failed to import ${item} from '${src}' in ${elementPath}/script.ts`);
18
+ }
19
+ });
20
+ return `const ${strObj} = vendor['${src}'];`;
15
21
  });
16
- return `const ${g1} = vendor['${src}'];`;
17
22
  });
18
- return result;
19
23
  };
20
24
  export const getScriptClass = (metadata) => {
21
25
  if (!metadata?.script) {
@@ -39,4 +43,4 @@ export const getScriptClass = (metadata) => {
39
43
  document.body.removeChild(script);
40
44
  return ScriptClass;
41
45
  };
42
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2NyaXB0LnV0aWxzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9zZGsvY21zL3V0aWxzL3NjcmlwdC51dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFeEMsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUUxQyxNQUFNLFlBQVksR0FBRyxJQUFJLE1BQU0sQ0FDN0IsMktBQTJLLEVBQzNLLEdBQUcsQ0FDSixDQUFDO0FBRUYsTUFBTSxnQkFBZ0IsR0FBRyxDQUFDLE1BQWMsRUFBRSxXQUFtQixFQUFVLEVBQUU7SUFDdkUsTUFBTSxNQUFNLEdBQUcsTUFBTSxDQUFDLE9BQU8sQ0FBQyxZQUFZLEVBQUUsQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEVBQUUsRUFBRSxHQUFHLEVBQUUsRUFBRTtRQUNqRSxNQUFNLE9BQU8sR0FBSSxFQUFhO2FBQzNCLElBQUksRUFBRTthQUNOLEtBQUssQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7YUFDWixLQUFLLENBQUMsR0FBRyxDQUFDO2FBQ1YsR0FBRyxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsSUFBSSxDQUFDLElBQUksRUFBRSxDQUFDLENBQUM7UUFFNUIs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cblxuICBzY3JpcHQudGV4dCA9IGB2YXIgJHtpZH0gPSBmdW5jdGlvbih2ZW5kb3IpIHske3NjcmlwdENvbnRlbnR9XG4gICAgICByZXR1cm4gJHtjbGFzc05hbWV9OyB9O2A7XG5cbiAgZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChzY3JpcHQpO1xuXG4gIGNvbnN0IFNjcmlwdENsYXNzID0gKHdpbmRvdyBhcyBhbnkpPy5baWRdPy4odmVuZG9yTWFwKTtcblxuICBkb2N1bWVudC5ib2R5LnJlbW92ZUNoaWxkKHNjcmlwdCk7XG5cbiAgcmV0dXJuIFNjcmlwdENsYXNzO1xufTtcbiJdfQ==
@@ -1671,23 +1671,27 @@ const vendorMap = Object.assign(Object.assign(Object.assign({}, VELOCE_LIBS), VE
1671
1671
  DataSource,
1672
1672
  }, rxjs: rxjs, 'rxjs/operators': rxjsOperators, lodash: lodash });
1673
1673
 
1674
- const importRegexp = new RegExp(`import([ \\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t"'\\{\\}]+[ \\n\\t]*,?)+\\})?[ \\n\\t]*)from[ \\n\\t]*(['"])([^'"\\n]+)(?:['"]);`, 'g');
1674
+ const importRegexp = new RegExp(`import\\s+(?:{[^{}]+}|.*?)\\s*(?:from)?\\s*['"].*?['"]|import\\(.*?\\)`, 'g');
1675
+ const importPartsRegexp = new RegExp(`import ([\\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t"'\\{\\}]+[ \\n\\t]*,?)+\\})?[\\n\\t]*) from[ \\n\\t]*(['"])([^'"\\n]+)(?:['"])`, 'g');
1675
1676
  const normalizeImports = (script, elementPath) => {
1676
- const result = script.replace(importRegexp, (match, g1, g2, src) => {
1677
- const imports = g1
1678
- .trim()
1679
- .slice(1, -1)
1680
- .split(',')
1681
- .map(item => item.trim());
1682
- imports.forEach(item => {
1683
- var _a;
1684
- if (!((_a = vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
1685
- throw new Error(`Failed to import ${item} from '${src}' in ${elementPath}/script.ts`);
1686
- }
1677
+ return script.replace(importRegexp, match => {
1678
+ return match.replace(importPartsRegexp, (_, g1, __, src) => {
1679
+ const strObj = g1.replace(/ as /g, ': ').trim();
1680
+ const imports = strObj
1681
+ .slice(1, -1)
1682
+ .split(',')
1683
+ .map(item => item.split(':')[0])
1684
+ .filter(isDefined)
1685
+ .map(item => item.trim());
1686
+ imports.forEach(item => {
1687
+ var _a;
1688
+ if (!((_a = vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
1689
+ throw new Error(`Failed to import ${item} from '${src}' in ${elementPath}/script.ts`);
1690
+ }
1691
+ });
1692
+ return `const ${strObj} = vendor['${src}'];`;
1687
1693
  });
1688
- return `const ${g1} = vendor['${src}'];`;
1689
1694
  });
1690
- return result;
1691
1695
  };
1692
1696
  const getScriptClass = (metadata) => {
1693
1697
  var _a;