Class: CustomElementsManifestParser::Nodes::JavaScriptModule

Inherits:
BaseStruct
  • Object
show all
Defined in:
lib/custom_elements_manifest_parser/nodes/javascript_module.rb

Overview

Document a JS module

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#declarationsObject

@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.meta(required: false)

#deprecatedString, ...

Returns - Whether the module is deprecated. If the value is a string, it's the reason for the deprecation.

Returns:

  • (String, nil, Boolean)

    - 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.meta(required: false)

#exportsnil, Array<CustomElementExport, JavaScriptExport>

Returns - The exports of a module. This includes JavaScript exports and custom element definitions.

Returns:



41
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 41

attribute :exports, Types::Strict::Array.optional.meta(required: false)

#kind"javascript-module"

Returns:

  • ("javascript-module")


10
# File 'lib/custom_elements_manifest_parser/nodes/javascript_module.rb', line 10

attribute :kind, Types.Value("javascript-module")

#pathString

Returns - Path to the javascript file needed to be imported. (not the path for example to a typescript file.).

Returns:

  • (String)

    - 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

#summaryString?

Returns - A markdown summary suitable for display in a listing.

Returns:

  • (String, nil)
    • 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.meta(required: false)

Class Method Details

.kind"javascript-module"

Returns:

  • ("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