Class: Opal::Vite::Config
- Inherits:
-
Object
- Object
- Opal::Vite::Config
- Defined in:
- lib/opal/vite/config.rb
Instance Attribute Summary collapse
-
#arity_check ⇒ Object
Returns the value of attribute arity_check.
-
#dynamic_require_severity ⇒ Object
Returns the value of attribute dynamic_require_severity.
-
#esm ⇒ Object
Returns the value of attribute esm.
-
#freezing ⇒ Object
Returns the value of attribute freezing.
-
#missing_require_severity ⇒ Object
Returns the value of attribute missing_require_severity.
-
#source_map_enabled ⇒ Object
Returns the value of attribute source_map_enabled.
Class Method Summary collapse
Instance Method Summary collapse
- #apply_hash(hash) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #to_compiler_options ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
13 14 15 16 17 18 19 20 |
# File 'lib/opal/vite/config.rb', line 13 def initialize @source_map_enabled = true @arity_check = false @freezing = true @esm = true @dynamic_require_severity = :ignore @missing_require_severity = :error end |
Instance Attribute Details
#arity_check ⇒ Object
Returns the value of attribute arity_check.
6 7 8 |
# File 'lib/opal/vite/config.rb', line 6 def arity_check @arity_check end |
#dynamic_require_severity ⇒ Object
Returns the value of attribute dynamic_require_severity.
6 7 8 |
# File 'lib/opal/vite/config.rb', line 6 def dynamic_require_severity @dynamic_require_severity end |
#esm ⇒ Object
Returns the value of attribute esm.
6 7 8 |
# File 'lib/opal/vite/config.rb', line 6 def esm @esm end |
#freezing ⇒ Object
Returns the value of attribute freezing.
6 7 8 |
# File 'lib/opal/vite/config.rb', line 6 def freezing @freezing end |
#missing_require_severity ⇒ Object
Returns the value of attribute missing_require_severity.
6 7 8 |
# File 'lib/opal/vite/config.rb', line 6 def missing_require_severity @missing_require_severity end |
#source_map_enabled ⇒ Object
Returns the value of attribute source_map_enabled.
6 7 8 |
# File 'lib/opal/vite/config.rb', line 6 def source_map_enabled @source_map_enabled end |
Class Method Details
.load_from_file(path) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/opal/vite/config.rb', line 22 def self.load_from_file(path) config = new if File.exist?(path) data = JSON.parse(File.read(path)) config.apply_hash(data) end config end |
Instance Method Details
#apply_hash(hash) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/opal/vite/config.rb', line 31 def apply_hash(hash) hash.each do |key, value| setter = "#{key}=" send(setter, value) if respond_to?(setter) end end |
#to_compiler_options ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/opal/vite/config.rb', line 38 def { source_map_enabled: source_map_enabled, arity_check: arity_check, freezing: freezing, esm: esm, dynamic_require_severity: dynamic_require_severity, missing_require_severity: missing_require_severity } end |