Class: Shakapacker::BaseStrategy
- Inherits:
-
Object
- Object
- Shakapacker::BaseStrategy
- Defined in:
- sig/shakapacker/compiler_strategy.rbs,
lib/shakapacker/base_strategy.rb
Overview
Base strategy with common functionality
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Configuration
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#after_compile_hook ⇒ void
Runs the post-compile hook.
- #default_watched_paths ⇒ Array[String]
-
#fresh? ⇒ Boolean
Returns whether assets are fresh (up-to-date).
-
#initialize(instance = Shakapacker.instance) ⇒ BaseStrategy
constructor
A new instance of BaseStrategy.
-
#stale? ⇒ Boolean
Returns whether assets are stale (need recompilation).
Constructor Details
#initialize(instance = Shakapacker.instance) ⇒ BaseStrategy
Returns a new instance of BaseStrategy.
3 4 5 |
# File 'lib/shakapacker/base_strategy.rb', line 3 def initialize(instance = Shakapacker.instance) @instance = instance end |
Instance Attribute Details
#config ⇒ Configuration (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/shakapacker/base_strategy.rb', line 13 def config @instance.config end |
Instance Method Details
#after_compile_hook ⇒ void
This method returns an undefined value.
Runs the post-compile hook
20 21 22 |
# File 'sig/shakapacker/compiler_strategy.rbs', line 20 def after_compile_hook nil end |
#default_watched_paths ⇒ Array[String]
21 22 23 24 25 26 27 28 29 |
# File 'lib/shakapacker/base_strategy.rb', line 21 def default_watched_paths [ *config.additional_paths.map { |path| "#{path}{,/**/*}" }, "#{config.source_path}{,/**/*}", "package.json", "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "config/{webpack,rspack}{,/**/*}" ].freeze end |
#fresh? ⇒ Boolean
Returns whether assets are fresh (up-to-date)
14 |
# File 'sig/shakapacker/compiler_strategy.rbs', line 14
def fresh?: () -> bool
|
#stale? ⇒ Boolean
Returns whether assets are stale (need recompilation)
17 |
# File 'sig/shakapacker/compiler_strategy.rbs', line 17
def stale?: () -> bool
|