klenod-build 0.0.27 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 583e74384e061c34bf2da93cd71156adc1b4d8c9d43dc86fec044364ff00f049
4
- data.tar.gz: afa864b06807f97cf1e68d04128c77d930136982fccabcd91013893491b12f28
3
+ metadata.gz: 9dbc1f6baef3ea6249edc7d68f1d8725234384d45c3f00dcf1b4ebba50eb8cbe
4
+ data.tar.gz: ee110cebfd420f402a67c922b2dcb1fa8cb9f8dffe768e4d5ced389ae6110f49
5
5
  SHA512:
6
- metadata.gz: 2d33327a02fc995e93eb644b558dcee29fe32dd1223f6dc2a50fa47e922d7bddb50f81065bc4df3f95297e43cc9e4aa7b89336f723edc762e7531457956a180e
7
- data.tar.gz: 7e29a8f5aaacef578ca6efa7c2e10e0595afee4058d8a58726899f2d97f28c12b7c5376931a6d0ab993b4c11b6ea8c4bb065c0a4abbab18df51ebf14069a27a0
6
+ metadata.gz: cae3766524cc6f31a74420abed1f8eaec845204f2465dfc1b48b9ff0f6ad7695dbc648a7394e58940338d1f8ce052beee3cb6cef7fc7c97ec18510f6badd85f6
7
+ data.tar.gz: 6a4230dcc4503ff87c4974f9cbd8065cc8348f66ca54f47a6f44e8419367b0901a0562e1dc0bd8bc633cf7d86fae621b4171b63e07b716f887d93b71e3d44e5a
@@ -88,6 +88,10 @@ module Klenod
88
88
 
89
89
  DEFAULT_PLUGINS = DefaultPlugins.new.freeze
90
90
 
91
+ # `:development` collects, evaluates, and reloads on demand. `:build`
92
+ # only collects, for writing a bundle; `klenod build` always uses it.
93
+ MODES = %i[development build].freeze
94
+
91
95
  def self.default_plugins
92
96
  [
93
97
  Plugins::RubyPlugin.new,
@@ -116,6 +120,12 @@ module Klenod
116
120
  namespace: Module.new,
117
121
  analysis: false
118
122
  )
123
+ # Plugins compare the mode with `==`, so an unknown one would quietly
124
+ # behave like neither, e.g. CSS that is not minified.
125
+ unless MODES.include?(mode)
126
+ raise ArgumentError, "Unknown mode #{mode.inspect}; expected one of #{MODES.map(&:inspect).join(", ")}"
127
+ end
128
+
119
129
  @source_dir = source_dir
120
130
  plugins = plugins.to_a if plugins.equal?(DEFAULT_PLUGINS)
121
131
  @plugins = plugins
@@ -223,7 +223,11 @@ module Klenod
223
223
  :failed
224
224
  )
225
225
  )
226
- mods[module_id] = FailedModule.new(error)
226
+ # Only an evaluated module needs the placeholder, so demand raises the
227
+ # error instead of serving stale exports. The failed record already
228
+ # covers a collected-only module, and a placeholder would make the
229
+ # next update treat it as evaluated and run its code.
230
+ mods[module_id] = FailedModule.new(error) if mods.key?(module_id)
227
231
  end
228
232
 
229
233
  def diff_assets(previous_assets, current_assets)
@@ -934,7 +934,8 @@ module Klenod
934
934
  imports,
935
935
  record.source_map,
936
936
  record.version,
937
- Runtime::Mod.constant_name_for(module_id.to_s)
937
+ Runtime::Mod.constant_name_for(module_id.to_s),
938
+ record.transformed_hash
938
939
  )
939
940
  ]
940
941
  end
@@ -8,7 +8,10 @@ module Klenod
8
8
  module Plugins
9
9
  module HamlPlugin
10
10
  def self.parse_haml(source, module_id: nil)
11
- parser = ParserWithMetadata.new({})
11
+ # Haml's default preserve list (`textarea`, `pre`, `code`) sets
12
+ # `nuke_inner_whitespace` as if the tag used `<`. Klenod reads that
13
+ # flag as an explicit whitespace marker, so disable the list.
14
+ parser = ParserWithMetadata.new(preserve: [])
12
15
  parser.call(source)
13
16
  rescue ::Haml::SyntaxError => error
14
17
  raise ParseError.new(error, source: source, module_id: module_id)
@@ -494,6 +494,9 @@ module Klenod
494
494
  kind, prefix, pattern = VARIABLE_TOKEN_KINDS[type]
495
495
  receiver = @variables[kind]
496
496
  next unless receiver
497
+ # `:@name` names the variable rather than reading it, as in
498
+ # `instance_variable_get(:@name)`.
499
+ next if tokens[index - 1]&.fetch(1) == :on_symbeg
497
500
 
498
501
  # Parenthesize the receiver so a low-precedence expression
499
502
  # such as `a || b` stays one operand, e.g. in `$*.fetch(:x)`.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Klenod
4
4
  module Build
5
- VERSION = "0.0.27"
5
+ VERSION = "0.0.29"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klenod-build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrés Alin
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.0.27
18
+ version: 0.0.29
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.0.27
25
+ version: 0.0.29
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: async
28
28
  requirement: !ruby/object:Gem::Requirement