@breadstone-tools/cem-core 0.0.12-beta.0
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/Ast/Ast.d.ts +224 -0
- package/Ast/Ast.d.ts.map +1 -0
- package/Ast/Ast.js +557 -0
- package/Ast/Ast.js.map +1 -0
- package/Ast/Builder/BuildArrowFunction.d.ts +14 -0
- package/Ast/Builder/BuildArrowFunction.d.ts.map +1 -0
- package/Ast/Builder/BuildArrowFunction.js +29 -0
- package/Ast/Builder/BuildArrowFunction.js.map +1 -0
- package/Ast/Builder/BuildAttribute.d.ts +16 -0
- package/Ast/Builder/BuildAttribute.d.ts.map +1 -0
- package/Ast/Builder/BuildAttribute.js +36 -0
- package/Ast/Builder/BuildAttribute.js.map +1 -0
- package/Ast/Builder/BuildClass.d.ts +24 -0
- package/Ast/Builder/BuildClass.d.ts.map +1 -0
- package/Ast/Builder/BuildClass.js +251 -0
- package/Ast/Builder/BuildClass.js.map +1 -0
- package/Ast/Builder/BuildClassField.d.ts +14 -0
- package/Ast/Builder/BuildClassField.d.ts.map +1 -0
- package/Ast/Builder/BuildClassField.js +34 -0
- package/Ast/Builder/BuildClassField.js.map +1 -0
- package/Ast/Builder/BuildFunctionLike.d.ts +41 -0
- package/Ast/Builder/BuildFunctionLike.d.ts.map +1 -0
- package/Ast/Builder/BuildFunctionLike.js +80 -0
- package/Ast/Builder/BuildFunctionLike.js.map +1 -0
- package/Ast/Builder/BuildMixin.d.ts +19 -0
- package/Ast/Builder/BuildMixin.d.ts.map +1 -0
- package/Ast/Builder/BuildMixin.js +50 -0
- package/Ast/Builder/BuildMixin.js.map +1 -0
- package/Ast/Builder/BuildVariable.d.ts +15 -0
- package/Ast/Builder/BuildVariable.d.ts.map +1 -0
- package/Ast/Builder/BuildVariable.js +29 -0
- package/Ast/Builder/BuildVariable.js.map +1 -0
- package/Ast/Handler/HandleAttrJsDoc.d.ts +10 -0
- package/Ast/Handler/HandleAttrJsDoc.d.ts.map +1 -0
- package/Ast/Handler/HandleAttrJsDoc.js +43 -0
- package/Ast/Handler/HandleAttrJsDoc.js.map +1 -0
- package/Ast/Handler/HandleCollectMixins.d.ts +10 -0
- package/Ast/Handler/HandleCollectMixins.d.ts.map +1 -0
- package/Ast/Handler/HandleCollectMixins.js +27 -0
- package/Ast/Handler/HandleCollectMixins.js.map +1 -0
- package/Ast/Handler/HandleCreateClassDeclarationMixin.d.ts +9 -0
- package/Ast/Handler/HandleCreateClassDeclarationMixin.d.ts.map +1 -0
- package/Ast/Handler/HandleCreateClassDeclarationMixin.js +38 -0
- package/Ast/Handler/HandleCreateClassDeclarationMixin.js.map +1 -0
- package/Ast/Handler/HandleCustomJsDocTags.d.ts +8 -0
- package/Ast/Handler/HandleCustomJsDocTags.d.ts.map +1 -0
- package/Ast/Handler/HandleCustomJsDocTags.js +31 -0
- package/Ast/Handler/HandleCustomJsDocTags.js.map +1 -0
- package/Ast/Handler/HandleDefaultValue.d.ts +10 -0
- package/Ast/Handler/HandleDefaultValue.d.ts.map +1 -0
- package/Ast/Handler/HandleDefaultValue.js +48 -0
- package/Ast/Handler/HandleDefaultValue.js.map +1 -0
- package/Ast/Handler/HandleExplicitType.d.ts +10 -0
- package/Ast/Handler/HandleExplicitType.d.ts.map +1 -0
- package/Ast/Handler/HandleExplicitType.js +28 -0
- package/Ast/Handler/HandleExplicitType.js.map +1 -0
- package/Ast/Handler/HandleHeritage.d.ts +11 -0
- package/Ast/Handler/HandleHeritage.d.ts.map +1 -0
- package/Ast/Handler/HandleHeritage.js +67 -0
- package/Ast/Handler/HandleHeritage.js.map +1 -0
- package/Ast/Handler/HandleJsDoc.d.ts +9 -0
- package/Ast/Handler/HandleJsDoc.d.ts.map +1 -0
- package/Ast/Handler/HandleJsDoc.js +90 -0
- package/Ast/Handler/HandleJsDoc.js.map +1 -0
- package/Ast/Handler/HandleJsDocParameterTag.d.ts +8 -0
- package/Ast/Handler/HandleJsDocParameterTag.d.ts.map +1 -0
- package/Ast/Handler/HandleJsDocParameterTag.js +59 -0
- package/Ast/Handler/HandleJsDocParameterTag.js.map +1 -0
- package/Ast/Handler/HandleModifiers.d.ts +13 -0
- package/Ast/Handler/HandleModifiers.d.ts.map +1 -0
- package/Ast/Handler/HandleModifiers.js +49 -0
- package/Ast/Handler/HandleModifiers.js.map +1 -0
- package/Ast/Handler/HandlePrivateMember.d.ts +10 -0
- package/Ast/Handler/HandlePrivateMember.d.ts.map +1 -0
- package/Ast/Handler/HandlePrivateMember.js +25 -0
- package/Ast/Handler/HandlePrivateMember.js.map +1 -0
- package/Ast/Handler/HandleTypeInference.d.ts +9 -0
- package/Ast/Handler/HandleTypeInference.d.ts.map +1 -0
- package/Ast/Handler/HandleTypeInference.js +46 -0
- package/Ast/Handler/HandleTypeInference.js.map +1 -0
- package/Ast/Handler/HandleWellKnownTypes.d.ts +11 -0
- package/Ast/Handler/HandleWellKnownTypes.d.ts.map +1 -0
- package/Ast/Handler/HandleWellKnownTypes.js +28 -0
- package/Ast/Handler/HandleWellKnownTypes.js.map +1 -0
- package/Ast/Manifest.d.ts +47 -0
- package/Ast/Manifest.d.ts.map +1 -0
- package/Ast/Manifest.js +209 -0
- package/Ast/Manifest.js.map +1 -0
- package/Index.d.ts +9 -0
- package/Index.d.ts.map +1 -0
- package/Index.js +8 -0
- package/Index.js.map +1 -0
- package/LICENSE +21 -0
- package/Plugins/Analyse/ArrowFunctionPlugin.d.ts +13 -0
- package/Plugins/Analyse/ArrowFunctionPlugin.d.ts.map +1 -0
- package/Plugins/Analyse/ArrowFunctionPlugin.js +37 -0
- package/Plugins/Analyse/ArrowFunctionPlugin.js.map +1 -0
- package/Plugins/Analyse/ClassJsDocPlugin.d.ts +25 -0
- package/Plugins/Analyse/ClassJsDocPlugin.d.ts.map +1 -0
- package/Plugins/Analyse/ClassJsDocPlugin.js +200 -0
- package/Plugins/Analyse/ClassJsDocPlugin.js.map +1 -0
- package/Plugins/Analyse/ClassPlugin.d.ts +13 -0
- package/Plugins/Analyse/ClassPlugin.d.ts.map +1 -0
- package/Plugins/Analyse/ClassPlugin.js +32 -0
- package/Plugins/Analyse/ClassPlugin.js.map +1 -0
- package/Plugins/Analyse/CustomElementsDefineCallsPlugin.d.ts +15 -0
- package/Plugins/Analyse/CustomElementsDefineCallsPlugin.d.ts.map +1 -0
- package/Plugins/Analyse/CustomElementsDefineCallsPlugin.js +112 -0
- package/Plugins/Analyse/CustomElementsDefineCallsPlugin.js.map +1 -0
- package/Plugins/Analyse/ExportsPlugin.d.ts +18 -0
- package/Plugins/Analyse/ExportsPlugin.d.ts.map +1 -0
- package/Plugins/Analyse/ExportsPlugin.js +154 -0
- package/Plugins/Analyse/ExportsPlugin.js.map +1 -0
- package/Plugins/Analyse/FunctionLikePlugin.d.ts +14 -0
- package/Plugins/Analyse/FunctionLikePlugin.d.ts.map +1 -0
- package/Plugins/Analyse/FunctionLikePlugin.js +36 -0
- package/Plugins/Analyse/FunctionLikePlugin.js.map +1 -0
- package/Plugins/Analyse/MixinPlugin.d.ts +13 -0
- package/Plugins/Analyse/MixinPlugin.d.ts.map +1 -0
- package/Plugins/Analyse/MixinPlugin.js +36 -0
- package/Plugins/Analyse/MixinPlugin.js.map +1 -0
- package/Plugins/Analyse/ReexportedWrappedMixinExportsPlugin.d.ts +15 -0
- package/Plugins/Analyse/ReexportedWrappedMixinExportsPlugin.d.ts.map +1 -0
- package/Plugins/Analyse/ReexportedWrappedMixinExportsPlugin.js +56 -0
- package/Plugins/Analyse/ReexportedWrappedMixinExportsPlugin.js.map +1 -0
- package/Plugins/Analyse/VariablePlugin.d.ts +13 -0
- package/Plugins/Analyse/VariablePlugin.d.ts.map +1 -0
- package/Plugins/Analyse/VariablePlugin.js +40 -0
- package/Plugins/Analyse/VariablePlugin.js.map +1 -0
- package/Plugins/Collect/CollectImportsPlugin.d.ts +6 -0
- package/Plugins/Collect/CollectImportsPlugin.d.ts.map +1 -0
- package/Plugins/Collect/CollectImportsPlugin.js +100 -0
- package/Plugins/Collect/CollectImportsPlugin.js.map +1 -0
- package/Plugins/Framework/Catalyst/Catalyst.d.ts +3 -0
- package/Plugins/Framework/Catalyst/Catalyst.d.ts.map +1 -0
- package/Plugins/Framework/Catalyst/Catalyst.js +9 -0
- package/Plugins/Framework/Catalyst/Catalyst.js.map +1 -0
- package/Plugins/Framework/Fast/Fast.d.ts +3 -0
- package/Plugins/Framework/Fast/Fast.d.ts.map +1 -0
- package/Plugins/Framework/Fast/Fast.js +9 -0
- package/Plugins/Framework/Fast/Fast.js.map +1 -0
- package/Plugins/Framework/Lit/Lit.d.ts +8 -0
- package/Plugins/Framework/Lit/Lit.d.ts.map +1 -0
- package/Plugins/Framework/Lit/Lit.js +25 -0
- package/Plugins/Framework/Lit/Lit.js.map +1 -0
- package/Plugins/Framework/Lit/MemberDenyListPlugin.d.ts +16 -0
- package/Plugins/Framework/Lit/MemberDenyListPlugin.d.ts.map +1 -0
- package/Plugins/Framework/Lit/MemberDenyListPlugin.js +37 -0
- package/Plugins/Framework/Lit/MemberDenyListPlugin.js.map +1 -0
- package/Plugins/Framework/Lit/MethodDenyListPlugin.d.ts +24 -0
- package/Plugins/Framework/Lit/MethodDenyListPlugin.d.ts.map +1 -0
- package/Plugins/Framework/Lit/MethodDenyListPlugin.js +51 -0
- package/Plugins/Framework/Lit/MethodDenyListPlugin.js.map +1 -0
- package/Plugins/Framework/Lit/PropertyDecoratorPlugin.d.ts +16 -0
- package/Plugins/Framework/Lit/PropertyDecoratorPlugin.d.ts.map +1 -0
- package/Plugins/Framework/Lit/PropertyDecoratorPlugin.js +100 -0
- package/Plugins/Framework/Lit/PropertyDecoratorPlugin.js.map +1 -0
- package/Plugins/Framework/Lit/StaticPropertiesPlugin.d.ts +17 -0
- package/Plugins/Framework/Lit/StaticPropertiesPlugin.d.ts.map +1 -0
- package/Plugins/Framework/Lit/StaticPropertiesPlugin.js +126 -0
- package/Plugins/Framework/Lit/StaticPropertiesPlugin.js.map +1 -0
- package/Plugins/Framework/Lwc/Lwc.d.ts +3 -0
- package/Plugins/Framework/Lwc/Lwc.d.ts.map +1 -0
- package/Plugins/Framework/Lwc/Lwc.js +9 -0
- package/Plugins/Framework/Lwc/Lwc.js.map +1 -0
- package/Plugins/Framework/Shared/AttrDecoratorPlugin.d.ts +18 -0
- package/Plugins/Framework/Shared/AttrDecoratorPlugin.d.ts.map +1 -0
- package/Plugins/Framework/Shared/AttrDecoratorPlugin.js +80 -0
- package/Plugins/Framework/Shared/AttrDecoratorPlugin.js.map +1 -0
- package/Plugins/Framework/Shared/CustomElementDecoratorPlugin.d.ts +14 -0
- package/Plugins/Framework/Shared/CustomElementDecoratorPlugin.d.ts.map +1 -0
- package/Plugins/Framework/Shared/CustomElementDecoratorPlugin.js +67 -0
- package/Plugins/Framework/Shared/CustomElementDecoratorPlugin.js.map +1 -0
- package/Plugins/Framework/Stencil/Stencil.d.ts +3 -0
- package/Plugins/Framework/Stencil/Stencil.d.ts.map +1 -0
- package/Plugins/Framework/Stencil/Stencil.js +9 -0
- package/Plugins/Framework/Stencil/Stencil.js.map +1 -0
- package/Plugins/Link/CleanupClassesPlugin.d.ts +6 -0
- package/Plugins/Link/CleanupClassesPlugin.d.ts.map +1 -0
- package/Plugins/Link/CleanupClassesPlugin.js +24 -0
- package/Plugins/Link/CleanupClassesPlugin.js.map +1 -0
- package/Plugins/Link/FieldDenyListPlugin.d.ts +6 -0
- package/Plugins/Link/FieldDenyListPlugin.d.ts.map +1 -0
- package/Plugins/Link/FieldDenyListPlugin.js +23 -0
- package/Plugins/Link/FieldDenyListPlugin.js.map +1 -0
- package/Plugins/Link/MethodDenyListPlugin.d.ts +6 -0
- package/Plugins/Link/MethodDenyListPlugin.d.ts.map +1 -0
- package/Plugins/Link/MethodDenyListPlugin.js +26 -0
- package/Plugins/Link/MethodDenyListPlugin.js.map +1 -0
- package/Plugins/PostProcessing/ApplyInheritancePlugin.d.ts +6 -0
- package/Plugins/PostProcessing/ApplyInheritancePlugin.d.ts.map +1 -0
- package/Plugins/PostProcessing/ApplyInheritancePlugin.js +87 -0
- package/Plugins/PostProcessing/ApplyInheritancePlugin.js.map +1 -0
- package/Plugins/PostProcessing/IsCustomElementPlugin.d.ts +6 -0
- package/Plugins/PostProcessing/IsCustomElementPlugin.d.ts.map +1 -0
- package/Plugins/PostProcessing/IsCustomElementPlugin.js +35 -0
- package/Plugins/PostProcessing/IsCustomElementPlugin.js.map +1 -0
- package/Plugins/PostProcessing/LinkClassToTagnamePlugin.d.ts +6 -0
- package/Plugins/PostProcessing/LinkClassToTagnamePlugin.d.ts.map +1 -0
- package/Plugins/PostProcessing/LinkClassToTagnamePlugin.js +28 -0
- package/Plugins/PostProcessing/LinkClassToTagnamePlugin.js.map +1 -0
- package/Plugins/PostProcessing/RemoveUnexportedDeclarationsPlugin.d.ts +6 -0
- package/Plugins/PostProcessing/RemoveUnexportedDeclarationsPlugin.d.ts.map +1 -0
- package/Plugins/PostProcessing/RemoveUnexportedDeclarationsPlugin.js +21 -0
- package/Plugins/PostProcessing/RemoveUnexportedDeclarationsPlugin.js.map +1 -0
- package/Plugins/PostProcessing/ResolveInitializersPlugin.d.ts +6 -0
- package/Plugins/PostProcessing/ResolveInitializersPlugin.d.ts.map +1 -0
- package/Plugins/PostProcessing/ResolveInitializersPlugin.js +59 -0
- package/Plugins/PostProcessing/ResolveInitializersPlugin.js.map +1 -0
- package/Services/DependencyService.d.ts +1 -0
- package/Services/DependencyService.d.ts.map +1 -0
- package/Services/DependencyService.js +112 -0
- package/Services/DependencyService.js.map +1 -0
- package/Services/Interfaces/IDependencyService.d.ts +12 -0
- package/Services/Interfaces/IDependencyService.d.ts.map +1 -0
- package/Services/Interfaces/IDependencyService.js +4 -0
- package/Services/Interfaces/IDependencyService.js.map +1 -0
- package/Services/Interfaces/IManifestBuilder.d.ts +16 -0
- package/Services/Interfaces/IManifestBuilder.d.ts.map +1 -0
- package/Services/Interfaces/IManifestBuilder.js +4 -0
- package/Services/Interfaces/IManifestBuilder.js.map +1 -0
- package/Services/Interfaces/IManifestEngine.d.ts +16 -0
- package/Services/Interfaces/IManifestEngine.d.ts.map +1 -0
- package/Services/Interfaces/IManifestEngine.js +4 -0
- package/Services/Interfaces/IManifestEngine.js.map +1 -0
- package/Services/ManifestBuilder.d.ts +47 -0
- package/Services/ManifestBuilder.d.ts.map +1 -0
- package/Services/ManifestBuilder.js +49 -0
- package/Services/ManifestBuilder.js.map +1 -0
- package/Services/ManifestEngine.d.ts +62 -0
- package/Services/ManifestEngine.d.ts.map +1 -0
- package/Services/ManifestEngine.js +283 -0
- package/Services/ManifestEngine.js.map +1 -0
- package/Types/Framework.d.ts +2 -0
- package/Types/Framework.d.ts.map +1 -0
- package/Types/Framework.js +3 -0
- package/Types/Framework.js.map +1 -0
- package/Types.d.ts +1 -0
- package/Types.d.ts.map +1 -0
- package/Types.js +45 -0
- package/Types.js.map +1 -0
- package/Utils.d.ts +50 -0
- package/Utils.d.ts.map +1 -0
- package/Utils.js +147 -0
- package/Utils.js.map +1 -0
- package/package.json +23 -0
package/Ast/Ast.js
ADDED
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region Imports
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.hasStaticKeyword = exports.decorator = exports.isMixin = exports.hasIgnoreJSDoc = exports.isStaticMember = exports.getReturnValue = exports.getOptionsObject = exports.isCustomElementsDefineCall = exports.isReturnStatement = exports.isDispatchEvent = exports.isProperty = void 0;
|
|
8
|
+
exports.hasAttrAnnotation = hasAttrAnnotation;
|
|
9
|
+
exports.isPrimitive = isPrimitive;
|
|
10
|
+
exports.hasInitializer = hasInitializer;
|
|
11
|
+
exports.getElementNameFromDecorator = getElementNameFromDecorator;
|
|
12
|
+
exports.isWellKnownType = isWellKnownType;
|
|
13
|
+
exports.isBindCall = isBindCall;
|
|
14
|
+
exports.getDeclarationInFile = getDeclarationInFile;
|
|
15
|
+
exports.hasExportModifier = hasExportModifier;
|
|
16
|
+
exports.hasDefaultModifier = hasDefaultModifier;
|
|
17
|
+
exports.hasNamedExports = hasNamedExports;
|
|
18
|
+
exports.isReexport = isReexport;
|
|
19
|
+
exports.hasDefaultImport = hasDefaultImport;
|
|
20
|
+
exports.hasNamedImport = hasNamedImport;
|
|
21
|
+
exports.hasAggregatingImport = hasAggregatingImport;
|
|
22
|
+
exports.hasSideEffectImport = hasSideEffectImport;
|
|
23
|
+
exports.extractMixinNodes = extractMixinNodes;
|
|
24
|
+
exports.isAlsoAttribute = isAlsoAttribute;
|
|
25
|
+
exports.reflects = reflects;
|
|
26
|
+
exports.getType = getType;
|
|
27
|
+
exports.getAttributeName = getAttributeName;
|
|
28
|
+
exports.hasPropertyDecorator = hasPropertyDecorator;
|
|
29
|
+
exports.getPropertiesObject = getPropertiesObject;
|
|
30
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
31
|
+
//#endregion
|
|
32
|
+
/**
|
|
33
|
+
* Checks if a node is a property.
|
|
34
|
+
* @param node - The node to check.
|
|
35
|
+
* @returns True if the node is a property, otherwise false.
|
|
36
|
+
*/
|
|
37
|
+
const isProperty = (node) => typescript_1.default.isPropertyDeclaration(node) || typescript_1.default.isGetAccessor(node) || typescript_1.default.isSetAccessor(node);
|
|
38
|
+
exports.isProperty = isProperty;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if a node is a dispatchEvent call.
|
|
41
|
+
* @param node - The node to check.
|
|
42
|
+
* @returns True if the node is a dispatchEvent call, otherwise false.
|
|
43
|
+
* @example this.dispatchEvent(new Event('foo'));
|
|
44
|
+
*/
|
|
45
|
+
const isDispatchEvent = (node) => node.expression.getText() === 'dispatchEvent' &&
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
node.expression.expression?.kind === typescript_1.default.SyntaxKind.ThisKeyword;
|
|
49
|
+
exports.isDispatchEvent = isDispatchEvent;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if a statement is a return statement.
|
|
52
|
+
* @param statement - The statement to check.
|
|
53
|
+
* @returns True if the statement is a return statement, otherwise false.
|
|
54
|
+
*/
|
|
55
|
+
const isReturnStatement = (statement) => statement.kind === typescript_1.default.SyntaxKind.ReturnStatement;
|
|
56
|
+
exports.isReturnStatement = isReturnStatement;
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a node is a customElements.define call.
|
|
59
|
+
* @param node - The node to check.
|
|
60
|
+
* @returns True if the node is a customElements.define call, otherwise false.
|
|
61
|
+
* @example customElements.define('my-el', MyEl);
|
|
62
|
+
* @example window.customElements.define('my-el', MyEl);
|
|
63
|
+
*/
|
|
64
|
+
const isCustomElementsDefineCall = (node) => ['customElements', 'window.customElements', 'globalThis.customElements'].includes(node.expression.getText()) &&
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
node.name?.getText() === 'define' &&
|
|
68
|
+
node.parent.kind === typescript_1.default.SyntaxKind.CallExpression;
|
|
69
|
+
exports.isCustomElementsDefineCall = isCustomElementsDefineCall;
|
|
70
|
+
/**
|
|
71
|
+
* Checks if a member has an @attr or @attribute annotation.
|
|
72
|
+
* @param member - The member to check.
|
|
73
|
+
* @returns True if the member has an @attr or @attribute annotation, otherwise false.
|
|
74
|
+
* @example @attr
|
|
75
|
+
* @example @attribute
|
|
76
|
+
*/
|
|
77
|
+
function hasAttrAnnotation(member) {
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
return member.jsDoc?.some(jsDoc => jsDoc?.tags?.some(tag => safe(() => ['attribute', 'attr'].includes(tag?.tagName?.getText()))));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Checks if a node is a primitive value.
|
|
84
|
+
* @param node - The node to check.
|
|
85
|
+
* @returns True if the node is a primitive value, otherwise false.
|
|
86
|
+
*/
|
|
87
|
+
function isPrimitive(node) {
|
|
88
|
+
return node &&
|
|
89
|
+
(typescript_1.default.isNumericLiteral(node) ||
|
|
90
|
+
typescript_1.default.isStringLiteral(node) ||
|
|
91
|
+
node.kind === typescript_1.default.SyntaxKind.NullKeyword ||
|
|
92
|
+
node.kind === typescript_1.default.SyntaxKind.TrueKeyword ||
|
|
93
|
+
node.kind === typescript_1.default.SyntaxKind.FalseKeyword) ||
|
|
94
|
+
(node.kind === typescript_1.default.SyntaxKind.ArrayLiteralExpression && node.elements.length === 0);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Checks if a variable statement has an initializer.
|
|
98
|
+
* @param node - The variable statement to check.
|
|
99
|
+
* @returns True if the variable statement has an initializer, otherwise false.
|
|
100
|
+
* @example let foo;
|
|
101
|
+
* @example let foo = '';
|
|
102
|
+
*/
|
|
103
|
+
function hasInitializer(node) {
|
|
104
|
+
return node.declarationList.declarations.some(declaration => declaration.initializer);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Gets the element name from a customElement decorator.
|
|
108
|
+
* @param decorator - The decorator to check.
|
|
109
|
+
* @returns The name of the custom element.
|
|
110
|
+
* @example @customElement('my-el')
|
|
111
|
+
* @example @customElement({ name: 'my-el', template })
|
|
112
|
+
*/
|
|
113
|
+
function getElementNameFromDecorator(decorator) {
|
|
114
|
+
const argument = decorator.expression.arguments[0];
|
|
115
|
+
if (argument.kind === typescript_1.default.SyntaxKind.StringLiteral) {
|
|
116
|
+
return argument.text;
|
|
117
|
+
}
|
|
118
|
+
if (argument.kind === typescript_1.default.SyntaxKind.ObjectLiteralExpression) {
|
|
119
|
+
let result;
|
|
120
|
+
argument.properties.forEach(property => {
|
|
121
|
+
if (property.name.getText() === 'name') {
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
result = property.initializer.text;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Gets the options object from a decorator's call expression.
|
|
133
|
+
* @param decorator - The decorator to check.
|
|
134
|
+
* @returns The options object.
|
|
135
|
+
* @example @attr({attribute: 'my-el'})
|
|
136
|
+
*/
|
|
137
|
+
const getOptionsObject = (decorator) => decorator.expression.arguments.find(arg => arg.kind === typescript_1.default.SyntaxKind.ObjectLiteralExpression);
|
|
138
|
+
exports.getOptionsObject = getOptionsObject;
|
|
139
|
+
/**
|
|
140
|
+
* Gets the return value expression of a return statement, omitting the type assertion.
|
|
141
|
+
* @param returnStatement - The return statement to check.
|
|
142
|
+
* @returns The return value expression.
|
|
143
|
+
*/
|
|
144
|
+
const getReturnValue = (returnStatement) => {
|
|
145
|
+
const value = returnStatement.expression?.kind === typescript_1.default.SyntaxKind.AsExpression
|
|
146
|
+
? returnStatement.expression.expression.getText()
|
|
147
|
+
: returnStatement.expression?.getText();
|
|
148
|
+
return value?.split(' ')[0];
|
|
149
|
+
};
|
|
150
|
+
exports.getReturnValue = getReturnValue;
|
|
151
|
+
/**
|
|
152
|
+
* Checks if a class member is a static member.
|
|
153
|
+
* @param member - The class member to check.
|
|
154
|
+
* @returns True if the class member is static, otherwise false.
|
|
155
|
+
*/
|
|
156
|
+
const isStaticMember = (member) =>
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
158
|
+
// @ts-ignore
|
|
159
|
+
member.modifiers?.some?.(x => x.kind === typescript_1.default.SyntaxKind.StaticKeyword);
|
|
160
|
+
exports.isStaticMember = isStaticMember;
|
|
161
|
+
/**
|
|
162
|
+
* Checks if an initializer is an `as const` expression.
|
|
163
|
+
* @param initializer - The initializer to check.
|
|
164
|
+
* @returns True if the initializer is an `as const` expression, otherwise false.
|
|
165
|
+
*/
|
|
166
|
+
function isAsConst(initializer) {
|
|
167
|
+
return (initializer &&
|
|
168
|
+
initializer.kind === typescript_1.default.SyntaxKind.AsExpression &&
|
|
169
|
+
typescript_1.default.isTypeReferenceNode(initializer.type) &&
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
initializer.type.typeName.getText() === 'const');
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Checks if a node is a well-known type.
|
|
176
|
+
* @param node - The node to check.
|
|
177
|
+
* @returns True if the node is a well-known type, otherwise false.
|
|
178
|
+
*/
|
|
179
|
+
function isWellKnownType(node) {
|
|
180
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
181
|
+
// @ts-ignore
|
|
182
|
+
return node.initializer && isAsConst(node.initializer);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Checks if a node has an `@ignore` JSDoc annotation.
|
|
186
|
+
* @param node - The node to check.
|
|
187
|
+
* @returns True if the node has an `@ignore` JSDoc annotation, otherwise false.
|
|
188
|
+
*/
|
|
189
|
+
const hasIgnoreJSDoc = (node) =>
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
191
|
+
// @ts-ignore
|
|
192
|
+
node?.jsDoc?.some(doc => doc?.tags?.some(tag => safe(() => ['ignore', 'internal'].includes(tag?.tagName?.getText()))));
|
|
193
|
+
exports.hasIgnoreJSDoc = hasIgnoreJSDoc;
|
|
194
|
+
/**
|
|
195
|
+
* Checks if a statement is a bind call.
|
|
196
|
+
* @param statement - The statement to check.
|
|
197
|
+
* @returns True if the statement is a bind call, otherwise false.
|
|
198
|
+
* @example this.__onClick = this.__onClick.bind(this);
|
|
199
|
+
*/
|
|
200
|
+
function isBindCall(statement) {
|
|
201
|
+
if (statement.expression) {
|
|
202
|
+
const leftName = statement.expression.left.getText();
|
|
203
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
204
|
+
// @ts-ignore
|
|
205
|
+
const rightName = statement.expression.right.expression.expression?.getText();
|
|
206
|
+
const isBind = statement.expression.right.expression.getText() === 'bind';
|
|
207
|
+
if (!leftName || !rightName) {
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
return leftName === rightName && isBind;
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Gets the declaration of a variable or function in a file.
|
|
216
|
+
* @param nodeOrName - The node or name to find the declaration for.
|
|
217
|
+
* @param sourceFile - The source file to search.
|
|
218
|
+
* @returns The declaration node.
|
|
219
|
+
* @throws If nodeOrName is a string and sourceFile is not provided.
|
|
220
|
+
* @example getDeclarationInFile('myVar', sourceFile);
|
|
221
|
+
* @example getDeclarationInFile(node, sourceFile);
|
|
222
|
+
*/
|
|
223
|
+
function getDeclarationInFile(nodeOrName, sourceFile) {
|
|
224
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
225
|
+
// @ts-ignore
|
|
226
|
+
const name = typeof nodeOrName === 'string' ? nodeOrName : nodeOrName.name?.getText();
|
|
227
|
+
if (typeof nodeOrName !== 'string') {
|
|
228
|
+
sourceFile = nodeOrName.getSourceFile();
|
|
229
|
+
}
|
|
230
|
+
else if (!sourceFile) {
|
|
231
|
+
throw new Error('Must provide sourceFile when first argument is a string');
|
|
232
|
+
}
|
|
233
|
+
if (!name) {
|
|
234
|
+
return undefined;
|
|
235
|
+
}
|
|
236
|
+
return sourceFile.statements.find(statement => {
|
|
237
|
+
if (typescript_1.default.isVariableStatement(statement)) {
|
|
238
|
+
return statement.declarationList.declarations.some(declaration => declaration.name.getText() === name);
|
|
239
|
+
}
|
|
240
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
241
|
+
// @ts-ignore
|
|
242
|
+
return statement.name?.getText() === name;
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Checks if a node has an export modifier.
|
|
247
|
+
* @param node - The node to check.
|
|
248
|
+
* @returns True if the node has an export modifier, otherwise false.
|
|
249
|
+
*/
|
|
250
|
+
function hasExportModifier(node) {
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
252
|
+
// @ts-ignore
|
|
253
|
+
return has(node.modifiers) && node.modifiers.some(mod => mod.kind === typescript_1.default.SyntaxKind.ExportKeyword);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Checks if a node has a default modifier.
|
|
257
|
+
* @param node - The node to check.
|
|
258
|
+
* @returns True if the node has a default modifier, otherwise false.
|
|
259
|
+
*/
|
|
260
|
+
function hasDefaultModifier(node) {
|
|
261
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
262
|
+
// @ts-ignore
|
|
263
|
+
return has(node.modifiers) && node.modifiers.some(mod => mod.kind === typescript_1.default.SyntaxKind.DefaultKeyword);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Checks if a node has named exports.
|
|
267
|
+
* @param node - The node to check.
|
|
268
|
+
* @returns True if the node has named exports, otherwise false.
|
|
269
|
+
* @example export { var1, var2 };
|
|
270
|
+
*/
|
|
271
|
+
function hasNamedExports(node) {
|
|
272
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
273
|
+
// @ts-ignore
|
|
274
|
+
return has(node.exportClause?.elements);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Checks if a node is a re-export statement.
|
|
278
|
+
* @param node - The node to check.
|
|
279
|
+
* @returns True if the node is a re-export statement, otherwise false.
|
|
280
|
+
* @example export { var1, var2 } from 'foo';
|
|
281
|
+
*/
|
|
282
|
+
function isReexport(node) {
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
284
|
+
// @ts-ignore
|
|
285
|
+
return node.moduleSpecifier !== undefined;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Checks if a node has a default import.
|
|
289
|
+
* @param node - The node to check.
|
|
290
|
+
* @returns True if the node has a default import, otherwise false.
|
|
291
|
+
* @example import defaultExport from 'foo';
|
|
292
|
+
*/
|
|
293
|
+
function hasDefaultImport(node) {
|
|
294
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
295
|
+
// @ts-ignore
|
|
296
|
+
return !!node.importClause?.name;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Checks if a node has named imports.
|
|
300
|
+
* @param node - The node to check.
|
|
301
|
+
* @returns True if the node has named imports, otherwise false.
|
|
302
|
+
* @example import {namedA, namedB} from 'foo';
|
|
303
|
+
*/
|
|
304
|
+
function hasNamedImport(node) {
|
|
305
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
306
|
+
// @ts-ignore
|
|
307
|
+
return has(node.importClause?.namedBindings?.elements);
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Checks if a node has an aggregating import.
|
|
311
|
+
* @param node - The node to check.
|
|
312
|
+
* @returns True if the node has an aggregating import, otherwise false.
|
|
313
|
+
* @example import * as name from './my-module.js';
|
|
314
|
+
*/
|
|
315
|
+
function hasAggregatingImport(node) {
|
|
316
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
317
|
+
// @ts-ignore
|
|
318
|
+
return !!node.importClause?.namedBindings?.name && !hasNamedImport(node);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Checks if a node has a side-effect import.
|
|
322
|
+
* @param node - The node to check.
|
|
323
|
+
* @returns True if the node has a side-effect import, otherwise false.
|
|
324
|
+
* @example import './my-module.js';
|
|
325
|
+
*/
|
|
326
|
+
function hasSideEffectImport(node) {
|
|
327
|
+
return 'importClause' in node && node.importClause == null;
|
|
328
|
+
}
|
|
329
|
+
// mixin-utils.ts
|
|
330
|
+
/**
|
|
331
|
+
* Checks if a node is a mixin.
|
|
332
|
+
* @param node - The node to check.
|
|
333
|
+
* @returns True if the node is a mixin, otherwise false.
|
|
334
|
+
*/
|
|
335
|
+
const isMixin = (node) => !!extractMixinNodes(node);
|
|
336
|
+
exports.isMixin = isMixin;
|
|
337
|
+
/**
|
|
338
|
+
* Extracts mixin nodes from a given node.
|
|
339
|
+
* @param node - The node to extract mixin nodes from.
|
|
340
|
+
* @returns The mixin function and mixin class, or false if not a mixin.
|
|
341
|
+
*/
|
|
342
|
+
function extractMixinNodes(node) {
|
|
343
|
+
if (typescript_1.default.isVariableStatement(node) || typescript_1.default.isFunctionDeclaration(node)) {
|
|
344
|
+
if (typescript_1.default.isVariableStatement(node)) {
|
|
345
|
+
const variableDeclaration = node.declarationList.declarations.find(declaration => typescript_1.default.isVariableDeclaration(declaration));
|
|
346
|
+
if (variableDeclaration) {
|
|
347
|
+
const body = variableDeclaration.initializer.body;
|
|
348
|
+
if (body && typescript_1.default.isClassExpression(body)) {
|
|
349
|
+
return {
|
|
350
|
+
mixinFunction: node,
|
|
351
|
+
mixinClass: body,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
if (body && typescript_1.default.isBlock(body)) {
|
|
355
|
+
const returnStatement = body.statements.find(statement => typescript_1.default.isReturnStatement(statement));
|
|
356
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
357
|
+
// @ts-ignore
|
|
358
|
+
if (returnStatement?.expression && typescript_1.default.isClassExpression(returnStatement.expression)) {
|
|
359
|
+
return {
|
|
360
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
361
|
+
// @ts-ignore
|
|
362
|
+
mixinFunction: variableDeclaration.initializer,
|
|
363
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
364
|
+
// @ts-ignore
|
|
365
|
+
mixinClass: returnStatement.expression
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
if (body && typescript_1.default.isBlock(body)) {
|
|
370
|
+
const classDeclaration = body.statements.find(statement => typescript_1.default.isClassDeclaration(statement));
|
|
371
|
+
const returnStatement = body.statements.find(statement => typescript_1.default.isReturnStatement(statement));
|
|
372
|
+
if (!(classDeclaration && returnStatement)) {
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
376
|
+
// @ts-ignore
|
|
377
|
+
const classDeclarationName = classDeclaration.name?.getText();
|
|
378
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
379
|
+
// @ts-ignore
|
|
380
|
+
const returnValue = (0, exports.getReturnValue)(returnStatement);
|
|
381
|
+
if (classDeclarationName === returnValue) {
|
|
382
|
+
return {
|
|
383
|
+
mixinFunction: node,
|
|
384
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
385
|
+
// @ts-ignore
|
|
386
|
+
mixinClass: classDeclaration
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (typescript_1.default.isFunctionDeclaration(node)) {
|
|
393
|
+
if (node.body && typescript_1.default.isBlock(node.body)) {
|
|
394
|
+
const returnStatement = node.body.statements.find(statement => typescript_1.default.isReturnStatement(statement));
|
|
395
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
396
|
+
// @ts-ignore
|
|
397
|
+
if (returnStatement?.expression && typescript_1.default.isClassExpression(returnStatement.expression)) {
|
|
398
|
+
return {
|
|
399
|
+
mixinFunction: node,
|
|
400
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
401
|
+
// @ts-ignore
|
|
402
|
+
mixinClass: returnStatement.expression
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (node.body && typescript_1.default.isBlock(node.body)) {
|
|
407
|
+
const classDeclaration = node.body.statements.find(statement => typescript_1.default.isClassDeclaration(statement));
|
|
408
|
+
const returnStatement = node.body.statements.find(statement => typescript_1.default.isReturnStatement(statement));
|
|
409
|
+
if (!(classDeclaration && returnStatement)) {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
413
|
+
// @ts-ignore
|
|
414
|
+
const classDeclarationName = classDeclaration.name?.getText();
|
|
415
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
416
|
+
// @ts-ignore
|
|
417
|
+
const returnValue = (0, exports.getReturnValue)(returnStatement);
|
|
418
|
+
if (classDeclarationName === returnValue) {
|
|
419
|
+
return {
|
|
420
|
+
mixinFunction: node,
|
|
421
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
422
|
+
// @ts-ignore
|
|
423
|
+
mixinClass: classDeclaration
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Checks if a given decorator is of a specified type.
|
|
433
|
+
* @param type - The type of the decorator to check.
|
|
434
|
+
* @returns A function that takes a decorator and returns a boolean indicating if the decorator is of the specified type.
|
|
435
|
+
*/
|
|
436
|
+
const decorator = (type) => (decorator) =>
|
|
437
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
438
|
+
// @ts-ignore
|
|
439
|
+
(typescript_1.default.isDecorator(decorator) && decorator.expression.expression?.getText() === type) ||
|
|
440
|
+
decorator.expression.getText() === type;
|
|
441
|
+
exports.decorator = decorator;
|
|
442
|
+
/**
|
|
443
|
+
* Checks if the property is also an attribute.
|
|
444
|
+
* @param node - The TypeScript node to check.
|
|
445
|
+
* @returns True if the property is also an attribute, false otherwise.
|
|
446
|
+
*/
|
|
447
|
+
function isAlsoAttribute(node) {
|
|
448
|
+
let hasResult = true;
|
|
449
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
450
|
+
// @ts-ignore
|
|
451
|
+
node.properties.forEach((property) => {
|
|
452
|
+
if (property.name.text === 'attribute' &&
|
|
453
|
+
property.initializer.kind === typescript_1.default.SyntaxKind.FalseKeyword) {
|
|
454
|
+
hasResult = false;
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
return hasResult;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Checks if the property reflects to an attribute.
|
|
461
|
+
* @param node - The TypeScript node to check.
|
|
462
|
+
* @returns True if the property reflects, false otherwise.
|
|
463
|
+
*/
|
|
464
|
+
function reflects(node) {
|
|
465
|
+
let hasResult = false;
|
|
466
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
467
|
+
// @ts-ignore
|
|
468
|
+
node.properties.forEach((property) => {
|
|
469
|
+
if (property.name.text === 'reflect' &&
|
|
470
|
+
property.initializer.kind === typescript_1.default.SyntaxKind.TrueKeyword) {
|
|
471
|
+
hasResult = true;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
return hasResult;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Gets the type of the property.
|
|
478
|
+
* @param node - The TypeScript node to check.
|
|
479
|
+
* @returns The type of the property as a string.
|
|
480
|
+
*/
|
|
481
|
+
function getType(node) {
|
|
482
|
+
let result = false;
|
|
483
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
484
|
+
// @ts-ignore
|
|
485
|
+
node.properties.forEach((property) => {
|
|
486
|
+
if (property.name.text === 'type') {
|
|
487
|
+
result = property.initializer.text.toLowerCase();
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
return result;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Gets the attribute name from the property.
|
|
494
|
+
* @param node - The TypeScript node to check.
|
|
495
|
+
* @returns The attribute name as a string.
|
|
496
|
+
*/
|
|
497
|
+
function getAttributeName(node) {
|
|
498
|
+
let result = false;
|
|
499
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
500
|
+
// @ts-ignore
|
|
501
|
+
node.properties.forEach((property) => {
|
|
502
|
+
if (property.name.text === 'attribute' &&
|
|
503
|
+
property.initializer.kind === typescript_1.default.SyntaxKind.StringLiteral) {
|
|
504
|
+
result = property.initializer.text;
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
return result;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Checks if the node has a property decorator.
|
|
511
|
+
* @param node - The TypeScript node to check.
|
|
512
|
+
* @returns True if the node has a property decorator, false otherwise.
|
|
513
|
+
*/
|
|
514
|
+
function hasPropertyDecorator(node) {
|
|
515
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
516
|
+
// @ts-ignore
|
|
517
|
+
return node.modifiers?.some((decorator) => typescript_1.default.isDecorator(decorator) && decorator.expression.expression.getText() === 'property');
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Checks if the node has a static keyword.
|
|
521
|
+
* @param node - The TypeScript node to check.
|
|
522
|
+
* @returns True if the node has a static keyword, false otherwise.
|
|
523
|
+
*/
|
|
524
|
+
const hasStaticKeyword = (node) =>
|
|
525
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
526
|
+
// @ts-ignore
|
|
527
|
+
node.modifiers?.some(mod => mod.kind === typescript_1.default.SyntaxKind.StaticKeyword);
|
|
528
|
+
exports.hasStaticKeyword = hasStaticKeyword;
|
|
529
|
+
/**
|
|
530
|
+
* Gets the properties object from the node.
|
|
531
|
+
* @param node - The TypeScript node to check.
|
|
532
|
+
* @returns The properties object.
|
|
533
|
+
*/
|
|
534
|
+
function getPropertiesObject(node) {
|
|
535
|
+
if (typescript_1.default.isGetAccessor(node)) {
|
|
536
|
+
return node.body?.statements.find(typescript_1.default.isReturnStatement)?.expression;
|
|
537
|
+
}
|
|
538
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
539
|
+
// @ts-ignore
|
|
540
|
+
return node.initializer;
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* @private
|
|
544
|
+
*/
|
|
545
|
+
const has = (arr) => Array.isArray(arr) && arr.length > 0;
|
|
546
|
+
/**
|
|
547
|
+
* @private
|
|
548
|
+
*/
|
|
549
|
+
const safe = (cb, returnType = '') => {
|
|
550
|
+
try {
|
|
551
|
+
return cb();
|
|
552
|
+
}
|
|
553
|
+
catch {
|
|
554
|
+
return returnType;
|
|
555
|
+
}
|
|
556
|
+
};
|
|
557
|
+
//# sourceMappingURL=Ast.js.map
|
package/Ast/Ast.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ast.js","sourceRoot":"","sources":["../../src/Ast/Ast.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;;;;AAuDjB,8CAIC;AAOD,kCAQC;AASD,wCAEC;AASD,kEAoBC;AAsDD,0CAIC;AAkBD,gCAeC;AAWD,oDAsBC;AAOD,8CAIC;AAOD,gDAIC;AAQD,0CAIC;AAQD,gCAIC;AAQD,4CAIC;AAQD,wCAIC;AAQD,oDAIC;AAQD,kDAEC;AAgBD,8CAuGC;AAkBD,0CAeC;AAOD,4BAaC;AAOD,0BAUC;AAOD,4CAaC;AAOD,oDAIC;AAiBD,kDAOC;AA5jBD,4DAA4B;AAE5B,YAAY;AAEZ;;;;GAIG;AACI,MAAM,UAAU,GAAG,CAAC,IAAa,EAAW,EAAE,CACjD,oBAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,oBAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,oBAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAD1E,QAAA,UAAU,cACgE;AAEvF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,IAAa,EAAW,EAAE,CACrD,IAA0B,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,eAAe;IACpE,6DAA6D;IAC7D,aAAa;IACZ,IAA0B,CAAC,UAAU,CAAC,UAAU,EAAE,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,WAAW,CAAC;AAJ7E,QAAA,eAAe,mBAI8D;AAE1F;;;;GAIG;AACI,MAAM,iBA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ED;;GAEG;AACH,MAAM,GAAG,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,IAAI,GAAG,CAAC,EAAY,EAAE,UAAU,GAAG,EAAE,EAAE,EAAE;IAC3C,IAAI,CAAC;QACD,OAAO,EAAE,EAAE,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,UAAU,CAAC;IACtB,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an arrow function representation from a node.
|
|
4
|
+
* @param node - The node to create the arrow function from.
|
|
5
|
+
* @returns An object representing the arrow function.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createArrowFunction(node: ts.VariableStatement): {
|
|
8
|
+
kind: string;
|
|
9
|
+
name: string;
|
|
10
|
+
parameters?: any;
|
|
11
|
+
returnType?: any;
|
|
12
|
+
jsDoc?: any;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=BuildArrowFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildArrowFunction.d.ts","sourceRoot":"","sources":["../../../src/Ast/Builder/BuildArrowFunction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,YAAY,CAAC;AAM5B;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,CAAC;IAAC,UAAU,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,GAAG,CAAA;CAAE,CAc/I"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region Imports
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createArrowFunction = createArrowFunction;
|
|
8
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
+
const HandleJsDoc_js_1 = require("../Handler/HandleJsDoc.js");
|
|
10
|
+
const BuildFunctionLike_js_1 = require("./BuildFunctionLike.js");
|
|
11
|
+
//#endregion
|
|
12
|
+
/**
|
|
13
|
+
* Creates an arrow function representation from a node.
|
|
14
|
+
* @param node - The node to create the arrow function from.
|
|
15
|
+
* @returns An object representing the arrow function.
|
|
16
|
+
*/
|
|
17
|
+
function createArrowFunction(node) {
|
|
18
|
+
const arrowFunction = node.declarationList.declarations.find(declaration => typescript_1.default.SyntaxKind.ArrowFunction === declaration.initializer?.kind);
|
|
19
|
+
let functionLikeTemplate = {
|
|
20
|
+
kind: 'function',
|
|
21
|
+
name: (arrowFunction?.name).getText() ?? '',
|
|
22
|
+
};
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
functionLikeTemplate = (0, BuildFunctionLike_js_1.handleParametersAndReturnType)(functionLikeTemplate, arrowFunction?.initializer);
|
|
26
|
+
functionLikeTemplate = (0, HandleJsDoc_js_1.handleJsDoc)(functionLikeTemplate, node);
|
|
27
|
+
return functionLikeTemplate;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=BuildArrowFunction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildArrowFunction.js","sourceRoot":"","sources":["../../../src/Ast/Builder/BuildArrowFunction.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;;;AAcjB,kDAcC;AAzBD,4DAA4B;AAC5B,8DAAwD;AACxD,iEAAuE;AAEvE,YAAY;AAEZ;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAA0B;IAC1D,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,oBAAE,CAAC,UAAU,CAAC,aAAa,KAAK,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAE3I,IAAI,oBAAoB,GAAwB;QAC5C,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,CAAC,aAAa,EAAE,IAAsB,CAAA,CAAC,OAAO,EAAE,IAAI,EAAE;KAC/D,CAAC;IAEF,6DAA6D;IAC7D,aAAa;IACb,oBAAoB,GAAG,IAAA,oDAA6B,EAAC,oBAAoB,EAAE,aAAa,EAAE,WAA+B,CAAC,CAAC;IAC3H,oBAAoB,GAAG,IAAA,4BAAW,EAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;IAE/D,OAAO,oBAAoB,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type ts from 'typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an attribute representation from a node.
|
|
4
|
+
* @param node - The node to create the attribute from.
|
|
5
|
+
* @returns An object representing the attribute.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createAttribute(node: ts.Node): {
|
|
8
|
+
name: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Creates an attribute from a field representation.
|
|
12
|
+
* @param field - The field to create the attribute from.
|
|
13
|
+
* @returns An object representing the attribute.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createAttributeFromField(field: any): any;
|
|
16
|
+
//# sourceMappingURL=BuildAttribute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BuildAttribute.d.ts","sourceRoot":"","sources":["../../../src/Ast/Builder/BuildAttribute.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAIjC;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAK/D;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAcxD"}
|