@lcap/nasl-concepts 4.0.0-beta.9 → 4.0.0-creator.1
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/out/common/BaseNode.d.ts +1 -1
- package/out/common/BaseNode.d.ts.map +1 -1
- package/out/common/BaseNode.js +9 -3
- package/out/common/BaseNode.js.map +1 -1
- package/out/concepts/App__.js +4 -4
- package/out/concepts/App__.js.map +1 -1
- package/out/concepts/BackendVariable__.d.ts.map +1 -1
- package/out/concepts/BackendVariable__.js +0 -22
- package/out/concepts/BackendVariable__.js.map +1 -1
- package/out/concepts/BatchAssignment__.d.ts.map +1 -1
- package/out/concepts/BatchAssignment__.js +5 -15
- package/out/concepts/BatchAssignment__.js.map +1 -1
- package/out/concepts/BinaryExpression__.js +1 -1
- package/out/concepts/BinaryExpression__.js.map +1 -1
- package/out/concepts/BindAttribute__.d.ts +1 -0
- package/out/concepts/BindAttribute__.d.ts.map +1 -1
- package/out/concepts/BindAttribute__.js +67 -9
- package/out/concepts/BindAttribute__.js.map +1 -1
- package/out/concepts/BindDirective__.d.ts +1 -0
- package/out/concepts/BindDirective__.d.ts.map +1 -1
- package/out/concepts/BindDirective__.js +26 -5
- package/out/concepts/BindDirective__.js.map +1 -1
- package/out/concepts/BindEvent__.d.ts +8 -2
- package/out/concepts/BindEvent__.d.ts.map +1 -1
- package/out/concepts/BindEvent__.js +61 -8
- package/out/concepts/BindEvent__.js.map +1 -1
- package/out/concepts/BindStyle__.d.ts +1 -0
- package/out/concepts/BindStyle__.d.ts.map +1 -1
- package/out/concepts/BindStyle__.js +10 -0
- package/out/concepts/BindStyle__.js.map +1 -1
- package/out/concepts/BusinessComponent__.d.ts +1 -0
- package/out/concepts/BusinessComponent__.d.ts.map +1 -1
- package/out/concepts/BusinessComponent__.js +5 -13
- package/out/concepts/BusinessComponent__.js.map +1 -1
- package/out/concepts/CallFunction__.d.ts +1 -1
- package/out/concepts/CallFunction__.js +2 -2
- package/out/concepts/CallFunction__.js.map +1 -1
- package/out/concepts/CallInterface__.d.ts.map +1 -1
- package/out/concepts/CallInterface__.js +12 -4
- package/out/concepts/CallInterface__.js.map +1 -1
- package/out/concepts/CallLogic__.d.ts.map +1 -1
- package/out/concepts/CallLogic__.js +38 -30
- package/out/concepts/CallLogic__.js.map +1 -1
- package/out/concepts/CallQueryComponent__.d.ts.map +1 -1
- package/out/concepts/CallQueryComponent__.js +4 -2
- package/out/concepts/CallQueryComponent__.js.map +1 -1
- package/out/concepts/Connector__.d.ts.map +1 -1
- package/out/concepts/Connector__.js.map +1 -1
- package/out/concepts/Destination__.js +5 -5
- package/out/concepts/Destination__.js.map +1 -1
- package/out/concepts/End__.d.ts.map +1 -1
- package/out/concepts/End__.js +32 -30
- package/out/concepts/End__.js.map +1 -1
- package/out/concepts/Enum__.d.ts +1 -1
- package/out/concepts/Enum__.d.ts.map +1 -1
- package/out/concepts/Enum__.js +17 -16
- package/out/concepts/Enum__.js.map +1 -1
- package/out/concepts/Frontend__.d.ts.map +1 -1
- package/out/concepts/Frontend__.js +19 -11
- package/out/concepts/Frontend__.js.map +1 -1
- package/out/concepts/Identifier__.d.ts +2 -2
- package/out/concepts/Identifier__.d.ts.map +1 -1
- package/out/concepts/Identifier__.js +25 -26
- package/out/concepts/Identifier__.js.map +1 -1
- package/out/concepts/IfStatement__.js +2 -2
- package/out/concepts/IfStatement__.js.map +1 -1
- package/out/concepts/Interface__.d.ts +1 -1
- package/out/concepts/Interface__.d.ts.map +1 -1
- package/out/concepts/Interface__.js +14 -12
- package/out/concepts/Interface__.js.map +1 -1
- package/out/concepts/Logic__.d.ts +1 -1
- package/out/concepts/Logic__.d.ts.map +1 -1
- package/out/concepts/Logic__.js +20 -20
- package/out/concepts/Logic__.js.map +1 -1
- package/out/concepts/MatchCase__.js +1 -1
- package/out/concepts/MatchCase__.js.map +1 -1
- package/out/concepts/MemberExpression__.d.ts.map +1 -1
- package/out/concepts/MemberExpression__.js +7 -3
- package/out/concepts/MemberExpression__.js.map +1 -1
- package/out/concepts/MetadataType__.js +1 -1
- package/out/concepts/MetadataType__.js.map +1 -1
- package/out/concepts/NewComposite__.d.ts.map +1 -1
- package/out/concepts/NewComposite__.js +5 -15
- package/out/concepts/NewComposite__.js.map +1 -1
- package/out/concepts/OverriddenLogic__.d.ts +1 -1
- package/out/concepts/OverriddenLogic__.d.ts.map +1 -1
- package/out/concepts/Param__.d.ts +2 -2
- package/out/concepts/Param__.d.ts.map +1 -1
- package/out/concepts/Param__.js +18 -25
- package/out/concepts/Param__.js.map +1 -1
- package/out/concepts/ProcessV2__.js +2 -2
- package/out/concepts/ProcessV2__.js.map +1 -1
- package/out/concepts/QuerySelectExpression__.js +1 -1
- package/out/concepts/QuerySelectExpression__.js.map +1 -1
- package/out/concepts/Return__.d.ts +1 -1
- package/out/concepts/Return__.d.ts.map +1 -1
- package/out/concepts/Return__.js +11 -22
- package/out/concepts/Return__.js.map +1 -1
- package/out/concepts/StringLiteral__.d.ts.map +1 -1
- package/out/concepts/StringLiteral__.js +4 -12
- package/out/concepts/StringLiteral__.js.map +1 -1
- package/out/concepts/StructureProperty__.d.ts +4 -4
- package/out/concepts/StructureProperty__.d.ts.map +1 -1
- package/out/concepts/StructureProperty__.js +14 -14
- package/out/concepts/StructureProperty__.js.map +1 -1
- package/out/concepts/Structure__.d.ts +1 -1
- package/out/concepts/Structure__.d.ts.map +1 -1
- package/out/concepts/Structure__.js +11 -11
- package/out/concepts/Structure__.js.map +1 -1
- package/out/concepts/SwitchCase__.js +1 -1
- package/out/concepts/SwitchCase__.js.map +1 -1
- package/out/concepts/TypeAnnotation__.d.ts +8 -7
- package/out/concepts/TypeAnnotation__.d.ts.map +1 -1
- package/out/concepts/TypeAnnotation__.js +90 -65
- package/out/concepts/TypeAnnotation__.js.map +1 -1
- package/out/concepts/TypeParam__.d.ts +1 -1
- package/out/concepts/TypeParam__.d.ts.map +1 -1
- package/out/concepts/TypeParam__.js +11 -11
- package/out/concepts/TypeParam__.js.map +1 -1
- package/out/concepts/Variable__.d.ts +1 -1
- package/out/concepts/Variable__.d.ts.map +1 -1
- package/out/concepts/Variable__.js +11 -22
- package/out/concepts/Variable__.js.map +1 -1
- package/out/concepts/ViewElement__.d.ts +3 -0
- package/out/concepts/ViewElement__.d.ts.map +1 -1
- package/out/concepts/ViewElement__.js +118 -4
- package/out/concepts/ViewElement__.js.map +1 -1
- package/out/concepts/View__.d.ts +18 -1
- package/out/concepts/View__.d.ts.map +1 -1
- package/out/concepts/View__.js +170 -60
- package/out/concepts/View__.js.map +1 -1
- package/out/concepts/basics/index.d.ts +1 -1
- package/out/concepts/basics/index.d.ts.map +1 -1
- package/out/concepts/basics/index.js +2 -1
- package/out/concepts/basics/index.js.map +1 -1
- package/out/concepts/basics/stdlib/nasl.processV2.d.ts +1 -0
- package/out/concepts/basics/stdlib/nasl.processV2.d.ts.map +1 -1
- package/out/concepts/basics/stdlib/nasl.processV2.js +7 -1
- package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -1
- package/out/concepts/basics/stdlib/sqlFunctions.json +5797 -0
- package/out/index.d.ts +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -1
- package/out/index.js.map +1 -1
- package/out/semantics/localVarCollector.d.ts +2 -1
- package/out/semantics/localVarCollector.d.ts.map +1 -1
- package/out/semantics/localVarCollector.js +11 -1
- package/out/semantics/localVarCollector.js.map +1 -1
- package/out/semantics/semanticData.d.ts +4 -2
- package/out/semantics/semanticData.d.ts.map +1 -1
- package/out/semantics/semanticData.js +33 -16
- package/out/semantics/semanticData.js.map +1 -1
- package/out/service/genSlotVarRef.d.ts +2 -3
- package/out/service/genSlotVarRef.d.ts.map +1 -1
- package/out/service/genSlotVarRef.js +76 -20
- package/out/service/genSlotVarRef.js.map +1 -1
- package/out/service/getMemberIdentifier.d.ts +1 -1
- package/out/service/getMemberIdentifier.d.ts.map +1 -1
- package/out/service/getMemberIdentifier.js +26 -14
- package/out/service/getMemberIdentifier.js.map +1 -1
- package/out/service/getSqlFunction.d.ts +63 -0
- package/out/service/getSqlFunction.d.ts.map +1 -0
- package/out/service/getSqlFunction.js +35 -0
- package/out/service/getSqlFunction.js.map +1 -0
- package/out/service/index.d.ts +1 -0
- package/out/service/index.d.ts.map +1 -1
- package/out/service/index.js +1 -0
- package/out/service/index.js.map +1 -1
- package/out/utils/bak-translator/composition.d.ts.map +1 -1
- package/out/utils/bak-translator/composition.js +60 -33
- package/out/utils/bak-translator/composition.js.map +1 -1
- package/out/utils/bak-translator/legacy.d.ts +9 -1
- package/out/utils/bak-translator/legacy.d.ts.map +1 -1
- package/out/utils/bak-translator/legacy.js +140 -30
- package/out/utils/bak-translator/legacy.js.map +1 -1
- package/out/utils/constant.d.ts +1 -0
- package/out/utils/constant.d.ts.map +1 -1
- package/out/utils/constant.js +8 -1
- package/out/utils/constant.js.map +1 -1
- package/package.json +7 -6
|
@@ -1618,7 +1618,7 @@ let ViewElement = class ViewElement extends Annotatable__1.default {
|
|
|
1618
1618
|
code += event.toNaturalTS((0, nasl_translator_1.shiftState)(state, code, {
|
|
1619
1619
|
tabSize: state.tabSize + 1,
|
|
1620
1620
|
}));
|
|
1621
|
-
code += '
|
|
1621
|
+
code += '\n';
|
|
1622
1622
|
});
|
|
1623
1623
|
if (this.children.find((item) => item.tag === 'template' && item.slotTarget)) {
|
|
1624
1624
|
const defaultArr = [];
|
|
@@ -1668,6 +1668,99 @@ let ViewElement = class ViewElement extends Annotatable__1.default {
|
|
|
1668
1668
|
code += `${(0, nasl_translator_1.indent)(state.tabSize)}})`;
|
|
1669
1669
|
return code;
|
|
1670
1670
|
}
|
|
1671
|
+
toNaturalTSX(state = (0, nasl_translator_1.createCompilerState)(), parentLevel) {
|
|
1672
|
+
let code = '';
|
|
1673
|
+
const tagName = (0, utils_2.kebab2Camel)(this.tag);
|
|
1674
|
+
code += `<${tagName} ref="${this.name}"`;
|
|
1675
|
+
this.bindDirectives.forEach((directive) => {
|
|
1676
|
+
const subCode = directive.toNaturalTSX((0, nasl_translator_1.shiftState)(state, code, {
|
|
1677
|
+
tabSize: state.tabSize + 1,
|
|
1678
|
+
inline: false,
|
|
1679
|
+
}));
|
|
1680
|
+
if (subCode.trim())
|
|
1681
|
+
code += '\n' + subCode;
|
|
1682
|
+
});
|
|
1683
|
+
this.bindAttrs.forEach((attr) => {
|
|
1684
|
+
const subCode = attr.toNaturalTSX((0, nasl_translator_1.shiftState)(state, code, {
|
|
1685
|
+
tabSize: state.tabSize + 1,
|
|
1686
|
+
inline: false,
|
|
1687
|
+
}));
|
|
1688
|
+
if (subCode.trim())
|
|
1689
|
+
code += '\n' + subCode;
|
|
1690
|
+
});
|
|
1691
|
+
this.bindStyles.forEach((style) => {
|
|
1692
|
+
const subCode = style.toNaturalTSX((0, nasl_translator_1.shiftState)(state, code, {
|
|
1693
|
+
tabSize: state.tabSize + 1,
|
|
1694
|
+
inline: false,
|
|
1695
|
+
}));
|
|
1696
|
+
if (subCode.trim())
|
|
1697
|
+
code += '\n' + subCode;
|
|
1698
|
+
});
|
|
1699
|
+
this.bindEvents.forEach((event) => {
|
|
1700
|
+
code += '\n' + event.toNaturalTSX((0, nasl_translator_1.shiftState)(state, code, {
|
|
1701
|
+
tabSize: state.tabSize + 1,
|
|
1702
|
+
inline: false,
|
|
1703
|
+
}));
|
|
1704
|
+
});
|
|
1705
|
+
if (this.staticStyle) {
|
|
1706
|
+
code += `\n${(0, nasl_translator_1.indent)(state.tabSize + 1)}style="${this.staticStyle}"`;
|
|
1707
|
+
}
|
|
1708
|
+
const defaultArr = [];
|
|
1709
|
+
if (this.children.find((item) => item.tag === 'template' && item.slotTarget)) {
|
|
1710
|
+
// 先把插槽翻译了
|
|
1711
|
+
this.children.forEach((element) => {
|
|
1712
|
+
if (element.tag === 'template' && !(element.slotTarget === 'default' && !element.slotScope)) {
|
|
1713
|
+
if (element.children.length) {
|
|
1714
|
+
code += '\n' + `${(0, nasl_translator_1.indent)(state.tabSize + 1)}slot${utils.firstUpperCase((0, utils_2.kebab2Camel)(element.slotTarget || ''))}={(${element.slotScope || ''}) => `;
|
|
1715
|
+
if (element.children.length === 1) {
|
|
1716
|
+
code += typeof element.children[0]?.toNaturalTSX === 'function' ? element.children[0].toNaturalTSX((0, nasl_translator_1.shiftState)(state, code, {
|
|
1717
|
+
tabSize: state.tabSize + 1,
|
|
1718
|
+
inline: true,
|
|
1719
|
+
})) : '';
|
|
1720
|
+
}
|
|
1721
|
+
else { // 为多个元素
|
|
1722
|
+
code += `<>\n`;
|
|
1723
|
+
element.children.forEach((element) => {
|
|
1724
|
+
code += typeof element?.toNaturalTSX === 'function' ? element.toNaturalTSX((0, nasl_translator_1.shiftState)(state, code, {
|
|
1725
|
+
tabSize: state.tabSize + 2,
|
|
1726
|
+
inline: false,
|
|
1727
|
+
})) : '';
|
|
1728
|
+
code += '\n';
|
|
1729
|
+
});
|
|
1730
|
+
code += `${(0, nasl_translator_1.indent)(state.tabSize + 1)}</>`;
|
|
1731
|
+
}
|
|
1732
|
+
code += `}`;
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
else if (element.tag === 'template' && element.slotTarget === 'default') {
|
|
1736
|
+
defaultArr.push(...element.children);
|
|
1737
|
+
}
|
|
1738
|
+
else {
|
|
1739
|
+
defaultArr.push(element);
|
|
1740
|
+
}
|
|
1741
|
+
});
|
|
1742
|
+
}
|
|
1743
|
+
else {
|
|
1744
|
+
defaultArr.push(...this.children);
|
|
1745
|
+
}
|
|
1746
|
+
// 翻译其余的子集
|
|
1747
|
+
const umodalSpecialCase = ['u-modal', 'UModal'].includes(this.tag) && this.children.find((item) => item.tag === 'template' && item.slotTarget == 'body');
|
|
1748
|
+
if (defaultArr.length && !umodalSpecialCase) {
|
|
1749
|
+
code += '>\n';
|
|
1750
|
+
defaultArr.forEach((element) => {
|
|
1751
|
+
code += typeof element?.toNaturalTSX === 'function' ? element?.toNaturalTSX((0, nasl_translator_1.shiftState)(state, code, {
|
|
1752
|
+
tabSize: state.tabSize + 1,
|
|
1753
|
+
inline: false,
|
|
1754
|
+
})) : '';
|
|
1755
|
+
code += '\n';
|
|
1756
|
+
});
|
|
1757
|
+
code += (0, nasl_translator_1.indent)(state.tabSize) + `</${tagName}>`;
|
|
1758
|
+
}
|
|
1759
|
+
else {
|
|
1760
|
+
code += ' />';
|
|
1761
|
+
}
|
|
1762
|
+
return code;
|
|
1763
|
+
}
|
|
1671
1764
|
toTextualNASL(state = (0, nasl_translator_1.createCompilerState)(), parentLevel) {
|
|
1672
1765
|
let code = '';
|
|
1673
1766
|
code += (0, nasl_translator_1.createDecoratorCode)(state, this, ['name']);
|
|
@@ -2407,7 +2500,16 @@ let ViewElement = class ViewElement extends Annotatable__1.default {
|
|
|
2407
2500
|
.map((element) => {
|
|
2408
2501
|
const childOptions = Object.assign({}, newOptions);
|
|
2409
2502
|
childOptions.indentLevel++;
|
|
2410
|
-
|
|
2503
|
+
let elementCode = '';
|
|
2504
|
+
// 如果当前子节点需要拆成组件,则返回组件标签,不进行 toVue 模板代码翻译
|
|
2505
|
+
if (options?.autoSplitComponent && this.view.viewSplitComponentInfos) {
|
|
2506
|
+
const item = this.view.viewSplitComponentInfos.find((item) => item.nodePath === element.nodePath);
|
|
2507
|
+
if (item) {
|
|
2508
|
+
elementCode = `<${item.templateCompName} />`;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
elementCode = elementCode || element?.toVue(childOptions);
|
|
2512
|
+
return (shouldIndent ? '\n' + insideTabString : '') + elementCode;
|
|
2411
2513
|
})
|
|
2412
2514
|
.join('');
|
|
2413
2515
|
if (newOptions.aslIdAttr) {
|
|
@@ -2808,8 +2910,17 @@ let ViewElement = class ViewElement extends Annotatable__1.default {
|
|
|
2808
2910
|
content +
|
|
2809
2911
|
(shouldIndent ? '\n' + tabString : '') +
|
|
2810
2912
|
`</${tag}>`;
|
|
2811
|
-
|
|
2812
|
-
|
|
2913
|
+
const frameworkKind = this.frontend?.frameworkKind;
|
|
2914
|
+
// 处理没有内容的标签
|
|
2915
|
+
if (!content.trim()) {
|
|
2916
|
+
// 支持自闭合标签
|
|
2917
|
+
if (selfClosingTag.includes(tag)) {
|
|
2918
|
+
return `<${tag}${partsString.length ? partsString : ''} />`;
|
|
2919
|
+
}
|
|
2920
|
+
// Vue3 template标签
|
|
2921
|
+
if (frameworkKind === 'vue3' && tag === 'template') {
|
|
2922
|
+
return '';
|
|
2923
|
+
}
|
|
2813
2924
|
}
|
|
2814
2925
|
return htmlContent;
|
|
2815
2926
|
}
|
|
@@ -3191,6 +3302,9 @@ __decorate([
|
|
|
3191
3302
|
__decorate([
|
|
3192
3303
|
(0, nasl_translator_1.withSourceMap)()
|
|
3193
3304
|
], ViewElement.prototype, "toNaturalTS", null);
|
|
3305
|
+
__decorate([
|
|
3306
|
+
(0, nasl_translator_1.withSourceMap)()
|
|
3307
|
+
], ViewElement.prototype, "toNaturalTSX", null);
|
|
3194
3308
|
__decorate([
|
|
3195
3309
|
(0, nasl_translator_1.withSourceMap)()
|
|
3196
3310
|
], ViewElement.prototype, "toTextualNASL", null);
|