klenod-plugin-css 0.0.12-aarch64-linux-gnu → 0.0.14-aarch64-linux-gnu

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: dc01c73817fc1009b0fc8f589c87caf43edfce263260037b8014bb27f98ba2fc
4
- data.tar.gz: ee32512585bb83f0b73e9582590065bf0d6c2076feef171421eef9ca129f105f
3
+ metadata.gz: 7aaca8996b5fe71e69d23bd12ad7e390d35aade215d55f1d3f6dbc380563528f
4
+ data.tar.gz: 90696572a014e8bb8263dfbce21bb949b1d977d1f15876054dfab37a197599d8
5
5
  SHA512:
6
- metadata.gz: e320825679d1906e5b0873325cf61e901bb1b13bc04c310404e659ecc6f1a0707819e0505c804789d195667387134f44b9898138dee6dc40ee17fd5aab1247b0
7
- data.tar.gz: defe61a22b0bf7f6e6296b2ad922eb4258f7e53f366a3690cf8ce871157d3bef23978e330943729bed98500fa415e483923a437a69bac0473d0bed1a5475f189
6
+ metadata.gz: f775aa2cdb02dbd5f49777076a62e838b8ad90af0879e521d8bca6ff84d2055724b9e7ad83b0fa5445a9d87780d206da3d315ee4d2457cb868d2a79756977771
7
+ data.tar.gz: 8a0fde1a7a48df2ff2f6f45a9a07d7b6cbbc64a35738550f15a548357737ebd2c66c2064767bba234985cf013d56703574df8c6c4c3981c6b2ca030db35f3ece
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "klenod/plugin/css/errors"
3
4
  require "klenod/plugin/css/transformer"
4
5
  require "uri"
5
6
 
@@ -202,6 +203,8 @@ module Klenod
202
203
  end
203
204
 
204
205
  def transform_css(module_id, code, transform_names:, context:)
206
+ # The filename also names the source in the emitted source map, so
207
+ # it stays the plain path. The error report uses module_id instead.
205
208
  Transformer.transform(
206
209
  module_id.path,
207
210
  code,
@@ -212,6 +215,10 @@ module Klenod
212
215
  local_css_variables: @local_css_variables && transform_names,
213
216
  variable_pattern: @variable_pattern
214
217
  )
218
+ rescue ParseError => error
219
+ # The native extension raises with only a message. Re-raise with the
220
+ # source so the report carries an excerpt like every other format.
221
+ raise ParseError.new(error, source: code, module_id: module_id)
215
222
  end
216
223
 
217
224
  def minify_enabled?(context)
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "klenod/build/source_error"
4
+
5
+ module Klenod
6
+ module Build
7
+ module Plugins
8
+ module CSSPlugin
9
+ # The native extension looks this class up by name and raises it with
10
+ # only a message, so it has to tolerate being constructed that way. The
11
+ # plugin catches that bare error and re-raises it with the source and
12
+ # module attached, which is what fills in the excerpt.
13
+ class ParseError < Klenod::Build::SourceError
14
+ # "Unexpected token Colon at app:/styles.css:11:5"
15
+ LOCATION = /\A(?<message>.*)\s+at\s+(?<file>.+):(?<line>\d+):(?<column>\d+)\s*\z/m
16
+
17
+ def initialize(error, source: nil, module_id: nil)
18
+ super
19
+ end
20
+
21
+ def kind
22
+ "CSS parse error"
23
+ end
24
+
25
+ private
26
+
27
+ def location(error)
28
+ found = LOCATION.match(message_for(error))
29
+ return nil unless found
30
+
31
+ Location.new(
32
+ # lightningcss reports a zero-based line and a one-based column.
33
+ line: found[:line].to_i + 1,
34
+ column: found[:column].to_i,
35
+ detail: found[:message]
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
Binary file
@@ -2,6 +2,8 @@
2
2
 
3
3
  require "json"
4
4
 
5
+ require "klenod/plugin/css/errors"
6
+
5
7
  begin
6
8
  require "klenod/plugin/css/native"
7
9
  rescue LoadError
@@ -13,7 +15,6 @@ module Klenod
13
15
  module Plugins
14
16
  module CSSPlugin
15
17
  class Error < StandardError; end
16
- class ParseError < Error; end
17
18
 
18
19
  ImportDependency = Data.define(:url, :placeholder, :supports, :media, :loc)
19
20
  UrlDependency = Data.define(:url, :placeholder, :loc)
@@ -4,7 +4,7 @@ module Klenod
4
4
  module Build
5
5
  module Plugins
6
6
  module CSSPlugin
7
- VERSION = "0.0.12"
7
+ VERSION = "0.0.14"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klenod-plugin-css
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.14
5
5
  platform: aarch64-linux-gnu
6
6
  authors:
7
7
  - Andrés Alin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-08 00:00:00.000000000 Z
11
+ date: 2026-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: klenod-build
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.0.12
19
+ version: 0.0.14
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.0.12
26
+ version: 0.0.14
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake-compiler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -48,6 +48,7 @@ files:
48
48
  - README.md
49
49
  - lib/klenod/build/plugins/css_plugin.rb
50
50
  - lib/klenod/plugin/css.rb
51
+ - lib/klenod/plugin/css/errors.rb
51
52
  - lib/klenod/plugin/css/native.so
52
53
  - lib/klenod/plugin/css/transformer.rb
53
54
  - lib/klenod/plugin/css/version.rb