Class: CustomElementsManifestParser::Nodes::JavaScriptModule
- Inherits:
-
BaseStruct
- Object
- Dry::Struct
- BaseStruct
- CustomElementsManifestParser::Nodes::JavaScriptModule
- Defined in:
- lib/custom_elements_manifest_parser/nodes/javascript_module.rb
Overview
Document a JS module
Instance Attribute Summary collapse
-
#declarations ⇒ Object
@return[nil, Array< Nodes::ClassDeclaration, Nodes::FunctionDeclaration, Nodes::MixinDeclaration, Nodes::VariableDeclaration>] - The declarations of a module.
-
#deprecated ⇒ String, ...
- Whether the module is deprecated.
-
#exports ⇒ nil, Array<CustomElementExport, JavaScriptExport>
- The exports of a module.
- #kind ⇒ "javascript-module"
-
#path ⇒ String
- Path to the javascript file needed to be imported.
-
#summary ⇒ String?
- A markdown summary suitable for display in a listing.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#declarations ⇒ Object
@return[nil, Array< Nodes::ClassDeclaration, Nodes::FunctionDeclaration, Nodes::MixinDeclaration, Nodes::VariableDeclaration>] - The declarations of a module. For documentation purposes, all declarations that are reachable from exports should be described here. Ie, functions and objects that may be properties of exported objects, or passed as arguments to functions.
35 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 35 attribute :declarations, Types::Strict::Array.optional.(required: false) |
#deprecated ⇒ String, ...
Returns - Whether the module is deprecated. If the value is a string, it's the reason for the deprecation.
47 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 47 attribute :deprecated, Types::Strict::String.optional | Types::Strict::Bool.optional.(required: false) |
#exports ⇒ nil, Array<CustomElementExport, JavaScriptExport>
Returns - The exports of a module. This includes JavaScript exports and custom element definitions.
41 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 41 attribute :exports, Types::Strict::Array.optional.(required: false) |
#kind ⇒ "javascript-module"
10 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 10 attribute :kind, Types.Value("javascript-module") |
#path ⇒ String
Returns - Path to the javascript file needed to be imported. (not the path for example to a typescript file.).
19 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 19 attribute :path, Types::Strict::String |
#summary ⇒ String?
Returns - A markdown summary suitable for display in a listing.
23 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 23 attribute :summary, Types::Strict::String.optional.(required: false) |
Class Method Details
.kind ⇒ "javascript-module"
13 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 13 def self.kind; "javascript-module"; end |
Instance Method Details
#visit(parser:) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 49 def visit(parser:) hash = {} hash[:declarations] = declarations.map { |declaration| parser.visit_node(declaration.merge(_parent_module: self, parser: parser)) } unless declarations.nil? hash[:exports] = exports.map { |export| parser.visit_node(export.merge(_parent_module: self, parser: parser)) } unless exports.nil? new(hash) end |