Module: Opal::Config
Instance Attribute Summary collapse
-
#arity_check_enabled ⇒ true, false
Enable arity check on the arguments passed to methods, procs and lambdas.
-
#const_missing_enabled ⇒ true, false
Enable const_missing support.
-
#dynamic_require_severity ⇒ :error, ...
Set the error severity for when a require can't be parsed at compile time.
-
#enable_file_source_embed ⇒ true, false
Enable embedding source code to be read by applications.
-
#enable_source_location ⇒ true, false
Enable source location embedded for methods and procs.
-
#esm ⇒ true, false
Build ECMAScript modules, instead of legacy JS.
-
#freezing_stubs_enabled ⇒ true, false
Add stubs for methods related to freezing objects (for compatibility).
-
#inline_operators_enabled ⇒ true, false
Enable for inline operators optimizations.
-
#irb_enabled ⇒ true, false
Enable IRB support for making local variables across multiple compilations.
-
#method_missing_enabled ⇒ true, false
Enable method_missing support.
-
#missing_require_severity ⇒ :error, ...
Set the error severity for when a required file can't be found at build time.
-
#source_map_enabled ⇒ true, false
Enable source maps support.
-
#stubbed_files ⇒ Set
A set of stubbed files that will be marked as loaded and skipped during compilation.
Instance Method Summary collapse
-
#compiler_options ⇒ Hash
The configuration for Opal::Compiler.
-
#config ⇒ Hash
The current configuration, defaults to #default_config.
-
#default_config ⇒ Hash
The default configuration.
-
#reset!
Resets the config to its default value.
Instance Attribute Details
#arity_check_enabled ⇒ true, false
Enable arity check on the arguments passed to methods, procs and lambdas.
89 |
# File 'lib/opal/config.rb', line 89 config_option :arity_check_enabled, false, compiler_option: :arity_check |
#const_missing_enabled ⇒ true, false
Enable const_missing support.
84 |
# File 'lib/opal/config.rb', line 84 config_option :const_missing_enabled, true, compiler_option: :const_missing |
#dynamic_require_severity ⇒ :error, ...
Set the error severity for when a require can't be parsed at compile time.
:error
will raise an error at compile time:warning
will print a warning on stderr at compile time:ignore
will skip the require silently at compile time
112 |
# File 'lib/opal/config.rb', line 112 config_option :dynamic_require_severity, :warning, compiler_option: :dynamic_require_severity, valid_values: %i[error warning ignore] |
#enable_file_source_embed ⇒ true, false
Enable embedding source code to be read by applications.
150 |
# File 'lib/opal/config.rb', line 150 config_option :enable_file_source_embed, false, compiler_option: :enable_file_source_embed |
#enable_source_location ⇒ true, false
Enable source location embedded for methods and procs.
145 |
# File 'lib/opal/config.rb', line 145 config_option :enable_source_location, false, compiler_option: :enable_source_location |
#esm ⇒ true, false
Build ECMAScript modules, instead of legacy JS
99 |
# File 'lib/opal/config.rb', line 99 config_option :esm, false, compiler_option: :esm |
#freezing_stubs_enabled ⇒ true, false
Add stubs for methods related to freezing objects (for compatibility).
94 |
# File 'lib/opal/config.rb', line 94 config_option :freezing_stubs_enabled, true, compiler_option: :freezing |
#inline_operators_enabled ⇒ true, false
Enable for inline operators optimizations.
135 |
# File 'lib/opal/config.rb', line 135 config_option :inline_operators_enabled, true, compiler_option: :inline_operators |
#irb_enabled ⇒ true, false
Enable IRB support for making local variables across multiple compilations.
130 |
# File 'lib/opal/config.rb', line 130 config_option :irb_enabled, false, compiler_option: :irb |
#method_missing_enabled ⇒ true, false
Enable method_missing support.
79 |
# File 'lib/opal/config.rb', line 79 config_option :method_missing_enabled, true, compiler_option: :method_missing |
#missing_require_severity ⇒ :error, ...
Set the error severity for when a required file can't be found at build time.
:error
will raise an error at compile time:warning
will print a warning on stderr at compile time:ignore
will skip the require silently at compile time
125 |
# File 'lib/opal/config.rb', line 125 config_option :missing_require_severity, :error, valid_values: %i[error warning ignore] |
#source_map_enabled ⇒ true, false
Enable source maps support.
140 |
# File 'lib/opal/config.rb', line 140 config_option :source_map_enabled, true |
#stubbed_files ⇒ Set
A set of stubbed files that will be marked as loaded and skipped during compilation. The value is expected to be mutated but it's ok to replace it.
157 |
# File 'lib/opal/config.rb', line 157 config_option :stubbed_files, -> { Set.new }, valid_values: [Set] |
Instance Method Details
#compiler_options ⇒ Hash
Returns the configuration for Opal::Compiler.
55 56 57 58 59 60 61 62 |
# File 'lib/opal/config.rb', line 55 def = {} .each do |name, | compiler_option_name = .fetch(:compiler) [compiler_option_name] = config.fetch(name) end end |
#config ⇒ Hash
Returns the current configuration, defaults to #default_config.
65 66 67 |
# File 'lib/opal/config.rb', line 65 def config @config ||= default_config end |
#default_config ⇒ Hash
Returns the default configuration.
44 45 46 47 48 49 50 51 52 |
# File 'lib/opal/config.rb', line 44 def default_config default_config = {} .each do |name, | default_value = .fetch(:default) default_value = Proc === default_value ? default_value.call : default_value default_config[name] = default_value end default_config end |
#reset!
This method returns an undefined value.
Resets the config to its default value
72 73 74 |
# File 'lib/opal/config.rb', line 72 def reset! @config = nil end |