@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
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.arrowFunctionPlugin = arrowFunctionPlugin;
|
|
5
|
+
const Ast_js_1 = require("../../Ast/Ast.js");
|
|
6
|
+
const BuildArrowFunction_js_1 = require("../../Ast/Builder/BuildArrowFunction.js");
|
|
7
|
+
//#endregion
|
|
8
|
+
/**
|
|
9
|
+
* Arrow Function Plugin - Handles arrow functions.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const myFunction = () => {};
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
function arrowFunctionPlugin() {
|
|
19
|
+
return {
|
|
20
|
+
name: 'CORE - ARROW-FUNCTION',
|
|
21
|
+
/**
|
|
22
|
+
* Analyze phase for the arrow function plugin.
|
|
23
|
+
* @param params - The parameters for the analyze phase.
|
|
24
|
+
*/
|
|
25
|
+
onAnalyze: (params) => {
|
|
26
|
+
switch (params.node.kind) {
|
|
27
|
+
case params.ts.SyntaxKind.VariableStatement:
|
|
28
|
+
if (!(0, Ast_js_1.isMixin)(params.node) && (0, Ast_js_1.hasInitializer)(params.node)) {
|
|
29
|
+
const functionLike = (0, BuildArrowFunction_js_1.createArrowFunction)(params.node);
|
|
30
|
+
params.moduleDoc.declarations?.push(functionLike);
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ArrowFunctionPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrowFunctionPlugin.js","sourceRoot":"","sources":["../../../src/Plugins/Analyse/ArrowFunctionPlugin.ts"],"names":[],"mappings":";AAAA,iBAAiB;;AAoBjB,kDAmBC;AAlCD,6CAA2D;AAC3D,mFAA8E;AAE9E,YAAY;AAEZ;;;;;;;;;GASG;AACH,SAAgB,mBAAmB;IAC/B,OAAO;QACH,IAAI,EAAE,uBAAuB;QAE7B;;;WAGG;QACH,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE;YACvC,QAAQ,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;gBACvB,KAAK,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB;oBACvC,IAAI,CAAC,IAAA,gBAAO,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAA,uBAAc,EAAC,MAAM,CAAC,IAA4B,CAAC,EAAE,CAAC;wBAC/E,MAAM,YAAY,GAAG,IAAA,2CAAmB,EAAC,MAAM,CAAC,IAA4B,CAAC,CAAC;wBAC9E,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,YAAmC,CAAC,CAAC;oBAC7E,CAAC;oBACD,MAAM;YACd,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { IPlugin } from '@breadstone-tools/cem-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Class JsDoc Plugin - Deals with any JSDoc above a class.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* /**
|
|
8
|
+
* * This is a class.
|
|
9
|
+
* * @attr {string} name - The name of the class.
|
|
10
|
+
* * @property {string} age - The age of the class.
|
|
11
|
+
* * @fires {CustomEvent} my-event - The event that is fired.
|
|
12
|
+
* * @csspart part - The part of the class.
|
|
13
|
+
* * @cssprop color - The color of the class.
|
|
14
|
+
* * @slot - The slot of the class.
|
|
15
|
+
* * @tag my-tag - The tag of the class.
|
|
16
|
+
* * @cssState {boolean} active - The active state of the class.
|
|
17
|
+
* * ...
|
|
18
|
+
* * /
|
|
19
|
+
* class MyClass {}
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare function classJsDocPlugin(): IPlugin;
|
|
25
|
+
//# sourceMappingURL=ClassJsDocPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassJsDocPlugin.d.ts","sourceRoot":"","sources":["../../../src/Plugins/Analyse/ClassJsDocPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAMjF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAkI1C"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.classJsDocPlugin = classJsDocPlugin;
|
|
5
|
+
const comment_parser_1 = require("comment-parser");
|
|
6
|
+
//#endregion
|
|
7
|
+
/**
|
|
8
|
+
* Class JsDoc Plugin - Deals with any JSDoc above a class.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* /**
|
|
13
|
+
* * This is a class.
|
|
14
|
+
* * @attr {string} name - The name of the class.
|
|
15
|
+
* * @property {string} age - The age of the class.
|
|
16
|
+
* * @fires {CustomEvent} my-event - The event that is fired.
|
|
17
|
+
* * @csspart part - The part of the class.
|
|
18
|
+
* * @cssprop color - The color of the class.
|
|
19
|
+
* * @slot - The slot of the class.
|
|
20
|
+
* * @tag my-tag - The tag of the class.
|
|
21
|
+
* * @cssState {boolean} active - The active state of the class.
|
|
22
|
+
* * ...
|
|
23
|
+
* * /
|
|
24
|
+
* class MyClass {}
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
function classJsDocPlugin() {
|
|
30
|
+
return {
|
|
31
|
+
name: 'CORE - CLASS-JSDOC',
|
|
32
|
+
onAnalyze: (params) => {
|
|
33
|
+
if (params.node.kind === params.ts.SyntaxKind.ClassDeclaration) {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
const className = params.node.name?.getText();
|
|
37
|
+
const classDoc = params.moduleDoc.declarations?.find(declaration => declaration.name === className);
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
params.node.jsDoc?.forEach(jsDoc => {
|
|
41
|
+
const parsed = (0, comment_parser_1.parse)(jsDoc?.getFullText());
|
|
42
|
+
parsed.forEach(parsedJsDoc => {
|
|
43
|
+
if (parsedJsDoc.tags.some(tag => tag.tag === 'typedef')) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
parsedJsDoc.tags.forEach(jsDocTag => {
|
|
47
|
+
switch (jsDocTag.tag.toLowerCase()) {
|
|
48
|
+
case 'attr':
|
|
49
|
+
case 'attribute':
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
const attributeAlreadyExists = classDoc?.attributes?.find(attr => attr.name === jsDocTag.name);
|
|
53
|
+
let attributeDoc = attributeAlreadyExists || {};
|
|
54
|
+
attributeDoc = handleClassJsDoc(attributeDoc, jsDocTag);
|
|
55
|
+
if (!attributeAlreadyExists) {
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
57
|
+
// @ts-ignore
|
|
58
|
+
classDoc.attributes.push(attributeDoc);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
case 'prop':
|
|
62
|
+
case 'property':
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
const fieldAlreadyExists = classDoc?.members?.find(member => member.name === jsDocTag.name);
|
|
66
|
+
let fieldDoc = fieldAlreadyExists || {};
|
|
67
|
+
fieldDoc = handleClassJsDoc(fieldDoc, jsDocTag);
|
|
68
|
+
fieldDoc.kind = 'field';
|
|
69
|
+
if (!fieldAlreadyExists) {
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
classDoc.members.push(fieldDoc);
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case 'fires':
|
|
76
|
+
case 'event':
|
|
77
|
+
case 'eventproperty':
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
79
|
+
// @ts-ignore
|
|
80
|
+
const eventAlreadyExists = classDoc?.events?.find(event => event.name === jsDocTag.name);
|
|
81
|
+
let eventDoc = eventAlreadyExists || {};
|
|
82
|
+
eventDoc = handleClassJsDoc(eventDoc, jsDocTag);
|
|
83
|
+
delete eventDoc.privacy;
|
|
84
|
+
if (!eventAlreadyExists) {
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
classDoc.events.push(eventDoc);
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
case 'csspart':
|
|
91
|
+
case 'part':
|
|
92
|
+
const cssPartDoc = handleClassJsDoc({}, jsDocTag);
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
classDoc.cssParts.push(cssPartDoc);
|
|
96
|
+
break;
|
|
97
|
+
case 'cssprop':
|
|
98
|
+
case 'cssproperty':
|
|
99
|
+
case 'cssvar':
|
|
100
|
+
case 'cssvariable':
|
|
101
|
+
const cssPropertyDoc = handleClassJsDoc({}, jsDocTag);
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
classDoc.cssProperties.push(cssPropertyDoc);
|
|
105
|
+
break;
|
|
106
|
+
case 'slot':
|
|
107
|
+
const slotDoc = handleClassJsDoc({}, jsDocTag);
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
classDoc.slots.push(slotDoc);
|
|
111
|
+
break;
|
|
112
|
+
case 'tag':
|
|
113
|
+
case 'tagname':
|
|
114
|
+
case 'element':
|
|
115
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
classDoc.tagName = jsDocTag.name || '';
|
|
118
|
+
break;
|
|
119
|
+
case 'cssstate':
|
|
120
|
+
const statePropertyDoc = handleClassJsDoc({}, jsDocTag);
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
classDoc.cssStates.push(statePropertyDoc);
|
|
124
|
+
break;
|
|
125
|
+
case 'deprecated':
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
classDoc.deprecated = jsDocTag.name ? `${jsDocTag.name} ${jsDocTag.description}`.trim() : 'true';
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
if (jsDoc?.comment) {
|
|
134
|
+
if (Array.isArray(jsDoc.comment) && jsDoc.comment.length > 1) {
|
|
135
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
classDoc.description = jsDoc.comment.map((com) => `${() => com?.name?.getText() ?? ''}${com.text}`).join('');
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
classDoc.description = normalizeDescription(jsDoc.comment);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
jsDoc?.tags?.forEach((tag) => {
|
|
146
|
+
if (tag?.tagName?.getText() === 'summary') {
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
classDoc.summary = tag?.comment;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Handles the class JSDoc.
|
|
159
|
+
* @param doc - The documentation object.
|
|
160
|
+
* @param tag - The JSDoc tag.
|
|
161
|
+
* @returns The updated documentation object.
|
|
162
|
+
*/
|
|
163
|
+
function handleClassJsDoc(doc, tag) {
|
|
164
|
+
if (tag?.type) {
|
|
165
|
+
doc.type = { text: handleJsDocType(tag.type) };
|
|
166
|
+
}
|
|
167
|
+
if (tag?.description) {
|
|
168
|
+
doc.description = normalizeDescription(tag.description);
|
|
169
|
+
}
|
|
170
|
+
if (tag?.name) {
|
|
171
|
+
doc.name = tag.name === '-' ? '' : tag.name;
|
|
172
|
+
}
|
|
173
|
+
if (tag?.default) {
|
|
174
|
+
doc.default = tag.default;
|
|
175
|
+
}
|
|
176
|
+
return doc;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Handles the JSDoc type by removing import statements.
|
|
180
|
+
* @param type - The JSDoc type string.
|
|
181
|
+
* @returns The cleaned type string.
|
|
182
|
+
*/
|
|
183
|
+
function handleJsDocType(type) {
|
|
184
|
+
return type.replace(/(import\(.+?\).)/g, '') || '';
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Normalizes a JSDoc description.
|
|
188
|
+
* @param desc - The description to normalize.
|
|
189
|
+
* @returns The normalized description.
|
|
190
|
+
*/
|
|
191
|
+
function normalizeDescription(desc) {
|
|
192
|
+
if (Array.isArray(desc)) {
|
|
193
|
+
desc = desc.reduce((prev, curr) => prev += (curr).getText(), '');
|
|
194
|
+
}
|
|
195
|
+
if (typeof desc === 'string' && desc.startsWith('- ')) {
|
|
196
|
+
desc = desc.slice(2);
|
|
197
|
+
}
|
|
198
|
+
return desc;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=ClassJsDocPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassJsDocPlugin.js","sourceRoot":"","sources":["../../../src/Plugins/Analyse/ClassJsDocPlugin.ts"],"names":[],"mappings":";AAAA,iBAAiB;;AA8BjB,4CAkIC;AA7JD,mDAAuC;AAGvC,YAAY;AAEZ;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,gBAAgB;IAC5B,OAAO;QACH,IAAI,EAAE,oBAAoB;QAC1B,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE;YACvC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;gBAC7D,6DAA6D;gBAC7D,aAAa;gBACb,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;gBAC9C,MAAM,QA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AAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IAChD,CAAC;IAED,IAAI,GAAG,EAAE,OAAO,EAAE,CAAC;QACf,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,IAA6B;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IPlugin } from '@breadstone-tools/cem-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Class Plugin - Handles classes.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* class MyClass {}
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export declare function classPlugin(): IPlugin;
|
|
13
|
+
//# sourceMappingURL=ClassPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassPlugin.d.ts","sourceRoot":"","sources":["../../../src/Plugins/Analyse/ClassPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAKjF;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAcrC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.classPlugin = classPlugin;
|
|
5
|
+
const BuildClass_js_1 = require("../../Ast/Builder/BuildClass.js");
|
|
6
|
+
//#endregion
|
|
7
|
+
/**
|
|
8
|
+
* Class Plugin - Handles classes.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* class MyClass {}
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
function classPlugin() {
|
|
18
|
+
return {
|
|
19
|
+
name: 'CORE - CLASSES',
|
|
20
|
+
onAnalyze: (params) => {
|
|
21
|
+
if (params.node.kind === params.ts.SyntaxKind.ClassDeclaration) {
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
const klass = (0, BuildClass_js_1.createClass)(params.node, params.moduleDoc, params.context);
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
params.moduleDoc.declarations?.push(klass);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ClassPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassPlugin.js","sourceRoot":"","sources":["../../../src/Plugins/Analyse/ClassPlugin.ts"],"names":[],"mappings":";AAAA,iBAAiB;;AAiBjB,kCAcC;AA5BD,mEAA8D;AAE9D,YAAY;AAEZ;;;;;;;;;GASG;AACH,SAAgB,WAAW;IACvB,OAAO;QACH,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,CAAC,MAA2B,EAAE,EAAE;YACvC,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;gBAC7D,6DAA6D;gBAC7D,aAAa;gBACb,MAAM,KAAK,GAAG,IAAA,2BAAW,EAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;gBACzE,6DAA6D;gBAC7D,aAAa;gBACb,MAAM,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/C,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IPlugin } from '@breadstone-tools/cem-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Custom Elements Define Calls Plugin - Analyzes calls for:
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* customElements.define('my-element', class MyElement extends HTMLElement {});
|
|
8
|
+
* // or
|
|
9
|
+
* window.customElements.define('my-element', class MyElement extends HTMLElement {});
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare function customElementsDefineCallsPlugin(): IPlugin;
|
|
15
|
+
//# sourceMappingURL=CustomElementsDefineCallsPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomElementsDefineCallsPlugin.d.ts","sourceRoot":"","sources":["../../../src/Plugins/Analyse/CustomElementsDefineCallsPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAuB,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAOjF;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,IAAI,OAAO,CA+EzD"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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.customElementsDefineCallsPlugin = customElementsDefineCallsPlugin;
|
|
8
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
+
const Ast_js_1 = require("../../Ast/Ast.js");
|
|
10
|
+
const BuildClass_js_1 = require("../../Ast/Builder/BuildClass.js");
|
|
11
|
+
//#endregion
|
|
12
|
+
/**
|
|
13
|
+
* Custom Elements Define Calls Plugin - Analyzes calls for:
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* customElements.define('my-element', class MyElement extends HTMLElement {});
|
|
18
|
+
* // or
|
|
19
|
+
* window.customElements.define('my-element', class MyElement extends HTMLElement {});
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
function customElementsDefineCallsPlugin() {
|
|
25
|
+
let counter;
|
|
26
|
+
return {
|
|
27
|
+
name: 'CORE - CUSTOM-ELEMENTS-DEFINE-CALLS',
|
|
28
|
+
onAnalyze: (params) => {
|
|
29
|
+
if (params.node.kind === typescript_1.default.SyntaxKind.SourceFile) {
|
|
30
|
+
counter = 0;
|
|
31
|
+
}
|
|
32
|
+
if ((0, Ast_js_1.hasIgnoreJSDoc)(params.node)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if ((0, Ast_js_1.isCustomElementsDefineCall)(params.node)) {
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
const classArg = params.node.parent.arguments[1];
|
|
39
|
+
const isAnonymousClass = classArg?.kind === typescript_1.default.SyntaxKind.ClassExpression;
|
|
40
|
+
const isUnnamed = classArg?.name === undefined;
|
|
41
|
+
if (isAnonymousClass) {
|
|
42
|
+
const klass = (0, BuildClass_js_1.createClass)(classArg, params.moduleDoc, params.context);
|
|
43
|
+
if (isUnnamed) {
|
|
44
|
+
klass.name = `anonymous_${counter}`;
|
|
45
|
+
}
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
params.moduleDoc.declarations?.push(klass);
|
|
49
|
+
}
|
|
50
|
+
let elementClass;
|
|
51
|
+
if (isUnnamed) {
|
|
52
|
+
elementClass = `anonymous_${counter}`;
|
|
53
|
+
counter += 1;
|
|
54
|
+
}
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
if (params.node.parent.arguments?.[1]?.text) {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
elementClass = params.node.parent.arguments[1].text;
|
|
61
|
+
}
|
|
62
|
+
if (classArg?.name) {
|
|
63
|
+
elementClass = classArg?.name?.getText();
|
|
64
|
+
}
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
const elementTag = params.node.parent.arguments[0].text;
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
const klass = (0, Ast_js_1.getDeclarationInFile)(params.elementClass, params.node.getSourceFile());
|
|
71
|
+
if ((0, Ast_js_1.hasIgnoreJSDoc)(klass)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
params.moduleDoc.exports = [...(params.moduleDoc.exports ?? []), {
|
|
77
|
+
kind: 'custom-element-definition',
|
|
78
|
+
name: elementTag,
|
|
79
|
+
declaration: {
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
name: elementClass,
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
...resolveModuleOrPackageSpecifier(params.moduleDoc, params.context, params.elementClass)
|
|
86
|
+
},
|
|
87
|
+
}];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolves the module or package specifier for a given name.
|
|
94
|
+
* @param moduleDoc - The module documentation object.
|
|
95
|
+
* @param context - The context object containing imports.
|
|
96
|
+
* @param name - The name to resolve the specifier for.
|
|
97
|
+
* @returns An object with the resolved module or package specifier.
|
|
98
|
+
*/
|
|
99
|
+
function resolveModuleOrPackageSpecifier(moduleDoc, context, name) {
|
|
100
|
+
const foundImport = context?.imports?.find((i) => i.name === name);
|
|
101
|
+
if (foundImport) {
|
|
102
|
+
if (foundImport.isBareModuleSpecifier) {
|
|
103
|
+
// Import is from a 3rd party package
|
|
104
|
+
return { package: foundImport.importPath };
|
|
105
|
+
}
|
|
106
|
+
// Import is from a local module
|
|
107
|
+
return { module: new URL(foundImport.importPath, `file:///${moduleDoc.path}`).pathname };
|
|
108
|
+
}
|
|
109
|
+
// Item is in the current module
|
|
110
|
+
return { module: moduleDoc.path };
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=CustomElementsDefineCallsPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomElementsDefineCallsPlugin.js","sourceRoot":"","sources":["../../../src/Plugins/Analyse/CustomElementsDefineCallsPlugin.ts"],"names":[],"mappings":";AAAA,iBAAiB;;;;;AAqBjB,0EA+EC;AAjGD,4DAA4B;AAC5B,6CAAoG;AACpG,mEAA8D;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AC;AAED;;;;;;GAMG;AACH,SAAS,+BAA+B,CAAC,SAAc,EAAE,OAAY,EAAE,IAAY;IAC/E,MAAM,WAAW,GAAG,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAExE,IAAI,WAAW,EAAE,CAAC;QACd,IAAI,WAAW,CAAC,qBAAqB,EAAE,CAAC;YACpC,qCAAqC;YACrC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,UAAU,EAAE,CAAC;QAC/C,CAAC;QAED,gCAAgC;QAChC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,CAAC,WAAW,CAAC,UAAU,EAAE,WAAW,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7F,CAAC;IAED,gCAAgC;IAChC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IPlugin } from '@breadstone-tools/cem-plugin';
|
|
2
|
+
/**
|
|
3
|
+
* Exports Plugin - Analyzes a module's exports and adds them to the moduleDoc.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* export const myVariable = 'Hello, World!';
|
|
8
|
+
* export function myFunction() {}
|
|
9
|
+
* export class MyClass {}
|
|
10
|
+
* export default function() {}
|
|
11
|
+
* export * from 'my-module';
|
|
12
|
+
* export { myVariable, myFunction, MyClass };
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export declare function exportsPlugin(): IPlugin;
|
|
18
|
+
//# sourceMappingURL=ExportsPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExportsPlugin.d.ts","sourceRoot":"","sources":["../../../src/Plugins/Analyse/ExportsPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAuB,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAOjF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAyIvC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
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.exportsPlugin = exportsPlugin;
|
|
8
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
9
|
+
const Ast_js_1 = require("../../Ast/Ast.js");
|
|
10
|
+
const Utils_js_1 = require("../../Utils.js");
|
|
11
|
+
//#endregion
|
|
12
|
+
/**
|
|
13
|
+
* Exports Plugin - Analyzes a module's exports and adds them to the moduleDoc.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* export const myVariable = 'Hello, World!';
|
|
18
|
+
* export function myFunction() {}
|
|
19
|
+
* export class MyClass {}
|
|
20
|
+
* export default function() {}
|
|
21
|
+
* export * from 'my-module';
|
|
22
|
+
* export { myVariable, myFunction, MyClass };
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
function exportsPlugin() {
|
|
28
|
+
return {
|
|
29
|
+
name: 'CORE - EXPORTS',
|
|
30
|
+
onAnalyze: (params) => {
|
|
31
|
+
if ((0, Ast_js_1.hasIgnoreJSDoc)(params.node)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if ((0, Ast_js_1.hasExportModifier)(params.node) && typescript_1.default.isVariableStatement(params.node)) {
|
|
35
|
+
(params.node).declarationList.declarations.forEach(declaration => {
|
|
36
|
+
params.moduleDoc.exports = [...(params.moduleDoc.exports ?? []), {
|
|
37
|
+
kind: 'js',
|
|
38
|
+
name: declaration.name.getText(),
|
|
39
|
+
declaration: {
|
|
40
|
+
name: declaration.name.getText(),
|
|
41
|
+
module: params.moduleDoc.path,
|
|
42
|
+
},
|
|
43
|
+
}];
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (params.node.kind === typescript_1.default.SyntaxKind.ExportAssignment) {
|
|
47
|
+
params.moduleDoc.exports = [...(params.moduleDoc.exports ?? []), {
|
|
48
|
+
kind: 'js',
|
|
49
|
+
name: 'default',
|
|
50
|
+
declaration: {
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
name: params.node.expression.getText(),
|
|
54
|
+
module: params.moduleDoc.path,
|
|
55
|
+
},
|
|
56
|
+
}];
|
|
57
|
+
}
|
|
58
|
+
if (params.node.kind === typescript_1.default.SyntaxKind.ExportDeclaration) {
|
|
59
|
+
if ((0, Ast_js_1.hasNamedExports)(params.node) && !(0, Ast_js_1.isReexport)(params.node)) {
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
params.node.exportClause?.elements.forEach((element) => {
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
if ((0, Ast_js_1.hasIgnoreJSDoc)(element) || (0, Ast_js_1.hasIgnoreJSDoc)((0, Ast_js_1.getDeclarationInFile)(element, node?.getSourceFile()))) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
params.moduleDoc.exports = [...(params.moduleDoc.exports ?? []), {
|
|
69
|
+
kind: 'js',
|
|
70
|
+
name: element.name.getText(),
|
|
71
|
+
declaration: {
|
|
72
|
+
name: element.propertyName?.getText() || element.name.getText(),
|
|
73
|
+
module: params.moduleDoc.path,
|
|
74
|
+
},
|
|
75
|
+
}];
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if ((0, Ast_js_1.isReexport)(params.node) && !(0, Ast_js_1.hasNamedExports)(params.node)) {
|
|
79
|
+
params.moduleDoc.exports = [...(params.moduleDoc.exports ?? []), {
|
|
80
|
+
kind: 'js',
|
|
81
|
+
name: '*',
|
|
82
|
+
declaration: {
|
|
83
|
+
name: '*',
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
package: params.node.moduleSpecifier.getText().replace(/'/g, ''),
|
|
87
|
+
},
|
|
88
|
+
}];
|
|
89
|
+
}
|
|
90
|
+
if ((0, Ast_js_1.isReexport)(params.node) && (0, Ast_js_1.hasNamedExports)(params.node)) {
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
params.node.exportClause?.elements.forEach(element => {
|
|
94
|
+
const e = {
|
|
95
|
+
kind: 'js',
|
|
96
|
+
name: element.name.getText(),
|
|
97
|
+
declaration: {
|
|
98
|
+
name: element.propertyName?.getText() || element.name.getText(),
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
if ((0, Utils_js_1.isBareModuleSpecifier)(params.node.moduleSpecifier.getText())) {
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
105
|
+
// @ts-ignore
|
|
106
|
+
e.declaration.package = params.node.moduleSpecifier.getText().replace(/'/g, '');
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
e.declaration.module = params.node.moduleSpecifier.getText().replace(/'/g, '');
|
|
112
|
+
}
|
|
113
|
+
params.moduleDoc.exports = [...(params.moduleDoc.exports ?? []), e];
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (params.node.kind === typescript_1.default.SyntaxKind.FunctionDeclaration) {
|
|
118
|
+
if ((0, Ast_js_1.hasExportModifier)(params.node)) {
|
|
119
|
+
const isDefault = (0, Ast_js_1.hasDefaultModifier)(params.node);
|
|
120
|
+
params.moduleDoc.exports = [...(params.moduleDoc.exports ?? []), {
|
|
121
|
+
kind: 'js',
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
name: isDefault ? 'default' : params.node.name?.getText() || '',
|
|
125
|
+
declaration: {
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
name: params.node.name?.getText() || '',
|
|
129
|
+
module: params.moduleDoc.path,
|
|
130
|
+
},
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (params.node.kind === typescript_1.default.SyntaxKind.ClassDeclaration) {
|
|
135
|
+
if ((0, Ast_js_1.hasExportModifier)(params.node)) {
|
|
136
|
+
const isDefault = (0, Ast_js_1.hasDefaultModifier)(params.node);
|
|
137
|
+
params.moduleDoc.exports = [...(params.moduleDoc.exports ?? []), {
|
|
138
|
+
kind: 'js',
|
|
139
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
140
|
+
// @ts-ignore
|
|
141
|
+
name: isDefault ? 'default' : params.node.name?.text || '',
|
|
142
|
+
declaration: {
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
name: params.node.name?.text || '',
|
|
146
|
+
module: params.moduleDoc.path,
|
|
147
|
+
},
|
|
148
|
+
}];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=ExportsPlugin.js.map
|