Class: CustomElementsManifestParser::Nodes::JavaScriptExport
- Inherits:
-
BaseStruct
- Object
- Dry::Struct
- BaseStruct
- CustomElementsManifestParser::Nodes::JavaScriptExport
- Includes:
- Mixins::HasParentModule, Structs::DeclarableNodeStruct
- Defined in:
- lib/custom_elements_manifest_parser/nodes/javascript_export.rb
Overview
A JavaScript export!
Instance Attribute Summary collapse
-
#declaration ⇒ Reference
- A reference to the exported declaration.
-
#deprecated ⇒ nil, ...
- Whether the export is deprecated.
- #kind ⇒ "js"
-
#name ⇒ String
- The name of the exported symbol.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Mixins::HasParentModule
Instance Attribute Details
#declaration ⇒ Reference
Returns - A reference to the exported declaration.
In the case of aggregating exports, the reference's module
field must be
defined and the name
field must be "*"
.
41 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_export.rb', line 41 attribute :declaration, Types::Nominal::Any.optional.(required: false) |
#deprecated ⇒ nil, ...
Returns - Whether the export is deprecated. For example, the name of the export was changed. If the value is a string, it's the reason for the deprecation.
47 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_export.rb', line 47 attribute :deprecated, Types::Strict::String.optional | Types::Strict::Bool.optional.(required: false) |
#kind ⇒ "js"
17 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_export.rb', line 17 attribute :kind, Types.Value("js") |
#name ⇒ String
Returns - The name of the exported symbol.
JavaScript has a number of ways to export objects which determine the correct name to use.
- Default exports must use the name "default".
- Named exports use the name that is exported. If the export is renamed with the "as" clause, use the exported name.
- Aggregating exports (
* from
) should use the name*
.
33 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_export.rb', line 33 attribute :name, Types::Strict::String |
Class Method Details
.kind ⇒ "js"
20 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_export.rb', line 20 def self.kind; "js"; end |
Instance Method Details
#visit(parser:) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/custom_elements_manifest_parser/nodes/javascript_export.rb', line 49 def visit(parser:) hash = {} hash[:declaration] = parser.data_types[:declaration].new(declaration).visit(parser: parser) if declaration hash = hash.merge( Structs::DeclarableNodeStruct.build_hash(parser: parser, struct: self) ) new(hash) end |