lightningcss 1.33.0.1-x86_64-linux-gnu → 1.33.0.3-x86_64-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 +4 -4
- data/README.md +78 -12
- data/ext/lightningcss/lightningcss.c +2 -2
- data/lib/lightningcss/3.2/lightningcss.so +0 -0
- data/lib/lightningcss/3.3/lightningcss.so +0 -0
- data/lib/lightningcss/3.4/lightningcss.so +0 -0
- data/lib/lightningcss/4.0/lightningcss.so +0 -0
- data/lib/lightningcss/errors.rb +22 -1
- data/lib/lightningcss/location.rb +21 -0
- data/lib/lightningcss/options.rb +7 -2
- data/lib/lightningcss/parse_result.rb +4 -4
- data/lib/lightningcss/result.rb +8 -5
- data/lib/lightningcss/transformer.rb +4 -4
- data/lib/lightningcss/version.rb +1 -1
- data/lib/lightningcss/warning.rb +60 -0
- data/lib/lightningcss.rb +4 -2
- data/rust/Cargo.lock +3 -2
- data/rust/Cargo.toml +1 -0
- data/rust/src/lib.rs +110 -38
- data/rust/src/options.rs +140 -8
- data/rust/src/scope.rs +2 -1
- data/sig/lightningcss/errors.rbs +9 -0
- data/sig/lightningcss/location.rbs +26 -0
- data/sig/lightningcss/parse_result.rbs +3 -3
- data/sig/lightningcss/result.rbs +5 -3
- data/sig/lightningcss/transformer.rbs +8 -8
- data/sig/lightningcss/types.rbs +12 -10
- data/sig/lightningcss/warning.rbs +36 -0
- data/sig/lightningcss.rbs +4 -4
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a8829e6ca2f06393d798779a803f90025651e090cab59193bbe15e824fd3a900
|
|
4
|
+
data.tar.gz: 51e247290da28d804f01ddc13968fa24587aaeabbde8ab4e9a98f87881ad12f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 120d92d860a86482406923fd0d38787ff448295fe1b7d6e01af3baa76a046497cc8d8c0b9d82dda31cb08be8cf5fcb21f64f97f5e63603e762e47b6f52c28b04
|
|
7
|
+
data.tar.gz: 7a59b6b1d4258d97e92e3996b8cf53302cb0b21526faedc53b214fc59db7355f77ff360bdcef1ddc6bb07762bfde7d057c5310a25a19a8a16c6f3abcf62de29a
|
data/README.md
CHANGED
|
@@ -57,13 +57,27 @@ LightningCSS.minify(".a { color: #ff0000 }")
|
|
|
57
57
|
|
|
58
58
|
#### Targeting browsers
|
|
59
59
|
|
|
60
|
-
Give the browsers you support, each
|
|
60
|
+
Give the browsers you support, each with the oldest version you support. Anything they cannot read is lowered, with the original kept after it so that a browser which understands it still wins.
|
|
61
61
|
|
|
62
62
|
```ruby
|
|
63
63
|
LightningCSS.transform(".a { color: lab(50% 40 59) }", targets: { chrome: 80 }, minify: true).code
|
|
64
64
|
#=> ".a{color:#bf5702;color:lab(50% 40 59)}"
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
A version is an `Integer` for a major version, or a `Float` or `String` for a minor or patch release. Several features first shipped in a minor Safari release, so the minor version can change the output.
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
LightningCSS.transform(".a { color: oklch(60% .2 30) }", targets: { safari: 15 }, minify: true).code
|
|
71
|
+
#=> ".a{color:lab(51.6908% 61.9679 48.0969)}"
|
|
72
|
+
|
|
73
|
+
LightningCSS.transform(".a { color: oklch(60% .2 30) }", targets: { safari: "15.4" }, minify: true).code
|
|
74
|
+
#=> ".a{color:oklch(60% .2 30)}"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Prefer a `String` for a minor version above 9, since `16.10` as a `Float` is `16.1`.
|
|
78
|
+
|
|
79
|
+
The browsers it reads are `android`, `chrome`, `edge`, `firefox`, `ie`, `ios_saf` (or `ios`), `opera`, `safari`, and `samsung`. Any other name raises a `LightningCSS::OptionError`.
|
|
80
|
+
|
|
67
81
|
#### Bundling
|
|
68
82
|
|
|
69
83
|
`bundle` resolves the `@import` statements a stylesheet was written with by reading the files they name, so it takes a path on disk to the entry stylesheet.
|
|
@@ -83,7 +97,7 @@ result.exports
|
|
|
83
97
|
#=> {"application" => "_8Z4fiW_application"}
|
|
84
98
|
|
|
85
99
|
result.warnings.first
|
|
86
|
-
#=> "'deep' is not recognized as a valid pseudo-class. ... at app/assets/stylesheets/layout.css:
|
|
100
|
+
#=> "'deep' is not recognized as a valid pseudo-class. ... at app/assets/stylesheets/layout.css:1:9"
|
|
87
101
|
```
|
|
88
102
|
|
|
89
103
|
#### CSS modules
|
|
@@ -130,6 +144,25 @@ LightningCSS.transform(".x:not(.y) { color: red }", scope: "[s]", minify: true).
|
|
|
130
144
|
#=> ".x:not(.y)[s]{color:red}"
|
|
131
145
|
```
|
|
132
146
|
|
|
147
|
+
#### Source maps
|
|
148
|
+
|
|
149
|
+
Pass `source_map: true` and the result has a `map`, a JSON string. Give a `filename` too, since that is what the map names as its source.
|
|
150
|
+
|
|
151
|
+
```ruby
|
|
152
|
+
result = LightningCSS.transform(".a { color: red }", filename: "main.css", source_map: true, minify: true)
|
|
153
|
+
|
|
154
|
+
result.map
|
|
155
|
+
#=> "{\"version\":3,\"sourceRoot\":null,\"mappings\":\"AAAA\",\"sources\":[\"main.css\"],...}"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
For CSS that was compiled from something else, pass that step's map as `input_source_map` and the result maps back to the original sources. A map it cannot read raises a `LightningCSS::OptionError`.
|
|
159
|
+
|
|
160
|
+
```ruby
|
|
161
|
+
LightningCSS.transform(sass_output, filename: "main.css", source_map: true, input_source_map: sass_map)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`bundle` takes `source_map` as well, and adds every file it read to `sources` with its contents. `project_root` sets what the `sources` are relative to. A bundle reads many files, so it does not take a single `input_source_map`, and a style attribute has no source map.
|
|
165
|
+
|
|
133
166
|
#### Style attributes
|
|
134
167
|
|
|
135
168
|
A style attribute is the list of declarations an element carries inline. It has no selectors and no at-rules around it, so it is its own grammar.
|
|
@@ -266,14 +299,17 @@ It answers `call` as well, so it can be handed to anything expecting something c
|
|
|
266
299
|
|
|
267
300
|
### Options
|
|
268
301
|
|
|
269
|
-
| Option
|
|
270
|
-
|
|
271
|
-
| `filename`
|
|
272
|
-
| `minify`
|
|
273
|
-
| `error_recovery`
|
|
274
|
-
| `targets`
|
|
275
|
-
| `css_modules`
|
|
276
|
-
| `scope`
|
|
302
|
+
| Option | Type | Description |
|
|
303
|
+
|--------------------|----------------|----------------------------------------------------------------------------------------|
|
|
304
|
+
| `filename` | `String` | The name to use in errors and warnings. |
|
|
305
|
+
| `minify` | `bool` | Whether to print the result as small as it goes. |
|
|
306
|
+
| `error_recovery` | `bool` | Whether to carry on past a rule it cannot read. Off by default, so such a rule raises. |
|
|
307
|
+
| `targets` | `Hash` | The browsers being compiled for, each with the oldest version supported. |
|
|
308
|
+
| `css_modules` | `bool`, `Hash` | Whether to compile as a CSS module, and how. |
|
|
309
|
+
| `scope` | `String` | A selector fragment to narrow every rule by. |
|
|
310
|
+
| `source_map` | `bool` | Whether to generate a source map. Off by default. |
|
|
311
|
+
| `input_source_map` | `String` | A source map as JSON to chain through, such as one from Sass. Needs `source_map`. |
|
|
312
|
+
| `project_root` | `String` | What the `sources` of a source map are relative to. |
|
|
277
313
|
|
|
278
314
|
An option nobody reads is refused:
|
|
279
315
|
|
|
@@ -298,6 +334,9 @@ result.to_s
|
|
|
298
334
|
result.exports
|
|
299
335
|
#=> nil
|
|
300
336
|
|
|
337
|
+
result.map
|
|
338
|
+
#=> nil
|
|
339
|
+
|
|
301
340
|
result.warnings
|
|
302
341
|
#=> []
|
|
303
342
|
|
|
@@ -325,13 +364,40 @@ result = LightningCSS.transform(".a:deep(.b) { color: red }", minify: true)
|
|
|
325
364
|
result.warnings?
|
|
326
365
|
#=> true
|
|
327
366
|
|
|
328
|
-
result.warnings.first
|
|
329
|
-
#=> "'deep' is not recognized as a valid pseudo-class. Did you mean '::deep' (pseudo-element) or is this a typo? at :
|
|
367
|
+
result.warnings.first.to_s
|
|
368
|
+
#=> "'deep' is not recognized as a valid pseudo-class. Did you mean '::deep' (pseudo-element) or is this a typo? at :1:9"
|
|
330
369
|
|
|
331
370
|
result.code
|
|
332
371
|
#=> ".a:deep(.b){color:red}"
|
|
333
372
|
```
|
|
334
373
|
|
|
374
|
+
### Locations
|
|
375
|
+
|
|
376
|
+
A warning is a `LightningCSS::Warning` with a `message`, a `type`, and a `location`, the same as a diagnostic in Prism or Herb. A `LightningCSS::Error` carries the same `type` and `location`, and keeps the location in its message.
|
|
377
|
+
|
|
378
|
+
A `LightningCSS::Location` counts lines from 1 and columns from 0, the same as Prism, Herb, and Yerba, and prints the way an editor reads it:
|
|
379
|
+
|
|
380
|
+
```ruby
|
|
381
|
+
css = ".a { color: red; }\n.b, { color: blue; }\n"
|
|
382
|
+
|
|
383
|
+
begin
|
|
384
|
+
LightningCSS.transform(css, filename: "main.css")
|
|
385
|
+
rescue LightningCSS::ParseError => error
|
|
386
|
+
error.message #=> "Invalid empty selector at main.css:2:5"
|
|
387
|
+
error.type #=> "SelectorError"
|
|
388
|
+
error.location #=> #<data LightningCSS::Location filename="main.css", line=2, column=4>
|
|
389
|
+
end
|
|
390
|
+
|
|
391
|
+
warning = LightningCSS.transform(css, filename: "main.css", error_recovery: true).warnings.first
|
|
392
|
+
|
|
393
|
+
warning.message #=> "Invalid empty selector"
|
|
394
|
+
warning.type #=> "SelectorError"
|
|
395
|
+
warning.location.line #=> 2
|
|
396
|
+
warning.to_s #=> "Invalid empty selector at main.css:2:5"
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
A warning converts to the string it always was wherever a `String` is expected and is equal to it, so `warnings.include?("...")` still works. An error without a location, such as an `OptionError`, has `nil` for `type` and `location`.
|
|
400
|
+
|
|
335
401
|
### Development
|
|
336
402
|
|
|
337
403
|
The gem is a C extension over a Rust crate. `rust/` builds a static library and generates the C header with [cbindgen](https://github.com/mozilla/cbindgen), `ext/lightningcss/` wraps it, and `lib/` is the Ruby API over that.
|
|
@@ -43,12 +43,12 @@ static VALUE error_class_for(enum LightningCssErrorCode code) {
|
|
|
43
43
|
|
|
44
44
|
static VALUE unwrap(struct LightningCssResult result) {
|
|
45
45
|
if (result.error) {
|
|
46
|
-
VALUE
|
|
46
|
+
VALUE payload = make_utf8_string(result.error);
|
|
47
47
|
VALUE error_class = error_class_for(result.code);
|
|
48
48
|
|
|
49
49
|
lightningcss_result_free(result);
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
rb_exc_raise(rb_funcall(error_class, rb_intern("from_json"), 1, payload));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (!result.value) {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/lightningcss/errors.rb
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module LightningCSS
|
|
4
|
-
class Error < StandardError
|
|
4
|
+
class Error < StandardError
|
|
5
|
+
attr_reader :type #: String?
|
|
6
|
+
attr_reader :location #: LightningCSS::Location?
|
|
7
|
+
|
|
8
|
+
#: (String) -> instance
|
|
9
|
+
def self.from_json(payload)
|
|
10
|
+
parsed = JSON.parse(payload)
|
|
11
|
+
location = parsed["location"] && Location.from_hash(parsed["location"])
|
|
12
|
+
message = parsed.fetch("message")
|
|
13
|
+
|
|
14
|
+
new(location ? "#{message} at #{location}" : message, type: parsed["type"], location: location)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#: (?String?, ?type: String?, ?location: LightningCSS::Location?) -> void
|
|
18
|
+
def initialize(message = nil, type: nil, location: nil)
|
|
19
|
+
super(message)
|
|
20
|
+
|
|
21
|
+
@type = type
|
|
22
|
+
@location = location
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
5
26
|
class ParseError < Error; end
|
|
6
27
|
class OptionError < Error; end
|
|
7
28
|
class BundleError < Error; end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LightningCSS
|
|
4
|
+
Location = Data.define(
|
|
5
|
+
:filename, #: String?
|
|
6
|
+
:line, #: Integer
|
|
7
|
+
:column #: Integer
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
class Location
|
|
11
|
+
#: (Hash[String, untyped]) -> LightningCSS::Location
|
|
12
|
+
def self.from_hash(hash)
|
|
13
|
+
new(filename: hash["filename"], line: hash.fetch("line"), column: hash.fetch("column"))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#: () -> String
|
|
17
|
+
def to_s
|
|
18
|
+
"#{filename}:#{line}:#{column + 1}"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
data/lib/lightningcss/options.rb
CHANGED
|
@@ -16,7 +16,10 @@ module LightningCSS
|
|
|
16
16
|
:error_recovery,
|
|
17
17
|
:targets,
|
|
18
18
|
:css_modules,
|
|
19
|
-
:scope
|
|
19
|
+
:scope,
|
|
20
|
+
:source_map,
|
|
21
|
+
:input_source_map,
|
|
22
|
+
:project_root
|
|
20
23
|
].freeze #: Array[Symbol]
|
|
21
24
|
|
|
22
25
|
STYLE_ATTRIBUTE = [
|
|
@@ -36,7 +39,9 @@ module LightningCSS
|
|
|
36
39
|
:error_recovery,
|
|
37
40
|
:targets,
|
|
38
41
|
:css_modules,
|
|
39
|
-
:scope
|
|
42
|
+
:scope,
|
|
43
|
+
:source_map,
|
|
44
|
+
:project_root
|
|
40
45
|
].freeze #: Array[Symbol]
|
|
41
46
|
|
|
42
47
|
attr_reader :to_h #: Hash[Symbol, untyped]
|
|
@@ -9,7 +9,7 @@ module LightningCSS
|
|
|
9
9
|
class ParseResult
|
|
10
10
|
attr_reader :source #: String?
|
|
11
11
|
attr_reader :stylesheet #: Hash[String, untyped]
|
|
12
|
-
attr_reader :warnings #: Array[
|
|
12
|
+
attr_reader :warnings #: Array[LightningCSS::Warning]
|
|
13
13
|
|
|
14
14
|
#: (String, ?String?) -> LightningCSS::ParseResult
|
|
15
15
|
def self.from_json(payload, source = nil)
|
|
@@ -18,11 +18,11 @@ module LightningCSS
|
|
|
18
18
|
new(
|
|
19
19
|
source: source,
|
|
20
20
|
stylesheet: parsed.fetch("stylesheet"),
|
|
21
|
-
warnings: parsed.fetch("warnings")
|
|
21
|
+
warnings: parsed.fetch("warnings").map { |warning| Warning.from_hash(warning) }
|
|
22
22
|
)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
#: (stylesheet: Hash[String, untyped], warnings: Array[
|
|
25
|
+
#: (stylesheet: Hash[String, untyped], warnings: Array[LightningCSS::Warning], ?source: String?) -> void
|
|
26
26
|
def initialize(stylesheet:, warnings:, source: nil)
|
|
27
27
|
@source = source
|
|
28
28
|
@stylesheet = stylesheet.freeze
|
|
@@ -44,7 +44,7 @@ module LightningCSS
|
|
|
44
44
|
#: () -> String
|
|
45
45
|
def inspect
|
|
46
46
|
parts = ["rules=#{stylesheet.fetch("rules").length}"]
|
|
47
|
-
parts << "warnings=#{warnings.inspect}" if warnings?
|
|
47
|
+
parts << "warnings=#{warnings.map(&:to_s).inspect}" if warnings?
|
|
48
48
|
|
|
49
49
|
"#<#{self.class.name} #{parts.join(" ")}>"
|
|
50
50
|
end
|
data/lib/lightningcss/result.rb
CHANGED
|
@@ -13,7 +13,8 @@ module LightningCSS
|
|
|
13
13
|
class Result
|
|
14
14
|
attr_reader :code #: String
|
|
15
15
|
attr_reader :exports #: Hash[String, String]?
|
|
16
|
-
attr_reader :
|
|
16
|
+
attr_reader :map #: String?
|
|
17
|
+
attr_reader :warnings #: Array[LightningCSS::Warning]
|
|
17
18
|
|
|
18
19
|
#: (String) -> LightningCSS::Result
|
|
19
20
|
def self.from_json(payload)
|
|
@@ -22,14 +23,16 @@ module LightningCSS
|
|
|
22
23
|
new(
|
|
23
24
|
code: parsed.fetch("code"),
|
|
24
25
|
exports: parsed["exports"],
|
|
25
|
-
|
|
26
|
+
map: parsed["map"],
|
|
27
|
+
warnings: parsed.fetch("warnings").map { |warning| Warning.from_hash(warning) }
|
|
26
28
|
)
|
|
27
29
|
end
|
|
28
30
|
|
|
29
|
-
#: (code: String, warnings: Array[
|
|
30
|
-
def initialize(code:, warnings:, exports: nil)
|
|
31
|
+
#: (code: String, warnings: Array[LightningCSS::Warning], ?exports: Hash[String, String]?, ?map: String?) -> void
|
|
32
|
+
def initialize(code:, warnings:, exports: nil, map: nil)
|
|
31
33
|
@code = code
|
|
32
34
|
@exports = exports
|
|
35
|
+
@map = map
|
|
33
36
|
@warnings = warnings.freeze
|
|
34
37
|
|
|
35
38
|
freeze
|
|
@@ -49,7 +52,7 @@ module LightningCSS
|
|
|
49
52
|
def inspect
|
|
50
53
|
parts = ["code=#{code.inspect}"]
|
|
51
54
|
parts << "exports=#{exports.inspect}" if exports
|
|
52
|
-
parts << "warnings=#{warnings.inspect}" if warnings?
|
|
55
|
+
parts << "warnings=#{warnings.map(&:to_s).inspect}" if warnings?
|
|
53
56
|
|
|
54
57
|
"#<#{self.class.name} #{parts.join(" ")}>"
|
|
55
58
|
end
|
|
@@ -14,14 +14,14 @@ module LightningCSS
|
|
|
14
14
|
class Transformer
|
|
15
15
|
attr_reader :options #: Hash[Symbol, untyped]
|
|
16
16
|
|
|
17
|
-
#: (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> void
|
|
17
|
+
#: (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> void
|
|
18
18
|
def initialize(**options)
|
|
19
19
|
@options = options.transform_keys(&:to_sym).freeze
|
|
20
20
|
|
|
21
21
|
freeze
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
#: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
24
|
+
#: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Result
|
|
25
25
|
def transform(code, **overrides)
|
|
26
26
|
LightningCSS.transform(code, **options, **overrides)
|
|
27
27
|
end
|
|
@@ -33,7 +33,7 @@ module LightningCSS
|
|
|
33
33
|
LightningCSS.parse(code, **options.slice(*Options::PARSE), **overrides)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
#: (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
36
|
+
#: (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?project_root: String?) -> LightningCSS::Result
|
|
37
37
|
def bundle(path, **overrides)
|
|
38
38
|
LightningCSS.bundle(path, **options, **overrides)
|
|
39
39
|
end
|
|
@@ -48,7 +48,7 @@ module LightningCSS
|
|
|
48
48
|
transform(code, **overrides, minify: true).code
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
#: (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Transformer
|
|
51
|
+
#: (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Transformer
|
|
52
52
|
def with(**overrides)
|
|
53
53
|
self.class.new(**options, **overrides)
|
|
54
54
|
end
|
data/lib/lightningcss/version.rb
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module LightningCSS
|
|
4
|
+
class Warning
|
|
5
|
+
attr_reader :message #: String
|
|
6
|
+
attr_reader :type #: String?
|
|
7
|
+
attr_reader :location #: LightningCSS::Location?
|
|
8
|
+
|
|
9
|
+
#: (Hash[String, untyped]) -> LightningCSS::Warning
|
|
10
|
+
def self.from_hash(hash)
|
|
11
|
+
new(
|
|
12
|
+
message: hash.fetch("message"),
|
|
13
|
+
type: hash["type"],
|
|
14
|
+
location: hash["location"] && Location.from_hash(hash["location"])
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
#: (message: String, ?type: String?, ?location: LightningCSS::Location?) -> void
|
|
19
|
+
def initialize(message:, type: nil, location: nil)
|
|
20
|
+
@message = message
|
|
21
|
+
@type = type
|
|
22
|
+
@location = location
|
|
23
|
+
|
|
24
|
+
freeze
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
#: () -> Hash[Symbol, untyped]
|
|
28
|
+
def to_h
|
|
29
|
+
{ message: message, type: type, location: location&.to_h }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#: () -> String
|
|
33
|
+
def to_s
|
|
34
|
+
location ? "#{message} at #{location}" : message
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
alias to_str to_s
|
|
38
|
+
|
|
39
|
+
#: (untyped) -> bool
|
|
40
|
+
def ==(other)
|
|
41
|
+
case other
|
|
42
|
+
when Warning then to_h == other.to_h
|
|
43
|
+
when String then to_s == other
|
|
44
|
+
else false
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
alias eql? ==
|
|
49
|
+
|
|
50
|
+
#: () -> Integer
|
|
51
|
+
def hash
|
|
52
|
+
to_h.hash
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
#: () -> String
|
|
56
|
+
def inspect
|
|
57
|
+
"#<#{self.class.name} #{to_s.inspect}>"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
data/lib/lightningcss.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "json"
|
|
4
4
|
|
|
5
5
|
require_relative "lightningcss/version"
|
|
6
|
+
require_relative "lightningcss/location"
|
|
6
7
|
require_relative "lightningcss/errors"
|
|
7
8
|
require_relative "lightningcss/backend"
|
|
8
9
|
|
|
@@ -14,6 +15,7 @@ rescue LoadError
|
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
require_relative "lightningcss/options"
|
|
18
|
+
require_relative "lightningcss/warning"
|
|
17
19
|
require_relative "lightningcss/result"
|
|
18
20
|
require_relative "lightningcss/node"
|
|
19
21
|
require_relative "lightningcss/parse_result"
|
|
@@ -40,7 +42,7 @@ require_relative "lightningcss/transformer"
|
|
|
40
42
|
# set of them to reuse across many stylesheets.
|
|
41
43
|
#
|
|
42
44
|
module LightningCSS
|
|
43
|
-
#: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
45
|
+
#: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Result
|
|
44
46
|
def self.transform(code, **options)
|
|
45
47
|
Result.from_json(Backend.transform(code.to_s, Options.serialize(options)))
|
|
46
48
|
end
|
|
@@ -52,7 +54,7 @@ module LightningCSS
|
|
|
52
54
|
ParseResult.from_json(Backend.parse(code.to_s, serialized), code.to_s)
|
|
53
55
|
end
|
|
54
56
|
|
|
55
|
-
#: (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
57
|
+
#: (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?project_root: String?) -> LightningCSS::Result
|
|
56
58
|
def self.bundle(path, **options)
|
|
57
59
|
serialized = Options.serialize(options, Options::BUNDLE, "a bundle")
|
|
58
60
|
|
data/rust/Cargo.lock
CHANGED
|
@@ -536,6 +536,7 @@ version = "0.0.0"
|
|
|
536
536
|
dependencies = [
|
|
537
537
|
"cbindgen",
|
|
538
538
|
"lightningcss",
|
|
539
|
+
"parcel_sourcemap",
|
|
539
540
|
"serde",
|
|
540
541
|
"serde_json",
|
|
541
542
|
]
|
|
@@ -957,9 +958,9 @@ dependencies = [
|
|
|
957
958
|
|
|
958
959
|
[[package]]
|
|
959
960
|
name = "serde_json"
|
|
960
|
-
version = "1.0.
|
|
961
|
+
version = "1.0.154"
|
|
961
962
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
962
|
-
checksum = "
|
|
963
|
+
checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
|
|
963
964
|
dependencies = [
|
|
964
965
|
"itoa",
|
|
965
966
|
"memchr",
|
data/rust/Cargo.toml
CHANGED
|
@@ -16,6 +16,7 @@ crate-type = ["cdylib", "staticlib", "rlib"]
|
|
|
16
16
|
|
|
17
17
|
[dependencies]
|
|
18
18
|
lightningcss = { version = "=1.0.0-alpha.72", features = ["visitor", "serde"] }
|
|
19
|
+
parcel_sourcemap = { version = "2.1", features = ["json"] }
|
|
19
20
|
serde = { version = "1", features = ["derive"] }
|
|
20
21
|
serde_json = "1"
|
|
21
22
|
|
data/rust/src/lib.rs
CHANGED
|
@@ -20,8 +20,9 @@ use std::sync::{Arc, RwLock};
|
|
|
20
20
|
use lightningcss::bundler::{BundleErrorKind, Bundler, FileProvider};
|
|
21
21
|
use lightningcss::stylesheet::{MinifyOptions, ParserOptions, PrinterOptions, StyleAttribute, StyleSheet};
|
|
22
22
|
use lightningcss::visitor::Visit;
|
|
23
|
+
use parcel_sourcemap::SourceMap;
|
|
23
24
|
|
|
24
|
-
use crate::options::{ParseResult, TransformOptions, TransformResult};
|
|
25
|
+
use crate::options::{Diagnostic, ParseResult, TransformOptions, TransformResult};
|
|
25
26
|
use crate::scope::Scoper;
|
|
26
27
|
|
|
27
28
|
pub const VERSION: &str = env!("GEM_VERSION");
|
|
@@ -56,7 +57,7 @@ impl LightningCssResult {
|
|
|
56
57
|
fn err(failure: Failure) -> Self {
|
|
57
58
|
Self {
|
|
58
59
|
value: ptr::null_mut(),
|
|
59
|
-
error: into_c_string(failure.message),
|
|
60
|
+
error: into_c_string(serde_json::to_string(&failure.diagnostic).unwrap_or(failure.diagnostic.message)),
|
|
60
61
|
code: failure.code,
|
|
61
62
|
}
|
|
62
63
|
}
|
|
@@ -64,35 +65,35 @@ impl LightningCssResult {
|
|
|
64
65
|
|
|
65
66
|
pub struct Failure {
|
|
66
67
|
code: LightningCssErrorCode,
|
|
67
|
-
|
|
68
|
+
diagnostic: Diagnostic,
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
impl Failure {
|
|
71
|
-
fn parse(
|
|
72
|
+
fn parse(diagnostic: impl Into<Diagnostic>) -> Self {
|
|
72
73
|
Self {
|
|
73
74
|
code: LightningCssErrorCode::Parse,
|
|
74
|
-
|
|
75
|
+
diagnostic: diagnostic.into(),
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
fn option(
|
|
79
|
+
fn option(diagnostic: impl Into<Diagnostic>) -> Self {
|
|
79
80
|
Self {
|
|
80
81
|
code: LightningCssErrorCode::Option,
|
|
81
|
-
|
|
82
|
+
diagnostic: diagnostic.into(),
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
fn bundle(
|
|
86
|
+
fn bundle(diagnostic: impl Into<Diagnostic>) -> Self {
|
|
86
87
|
Self {
|
|
87
88
|
code: LightningCssErrorCode::Bundle,
|
|
88
|
-
|
|
89
|
+
diagnostic: diagnostic.into(),
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
fn internal(
|
|
93
|
+
fn internal(diagnostic: impl Into<Diagnostic>) -> Self {
|
|
93
94
|
Self {
|
|
94
95
|
code: LightningCssErrorCode::Internal,
|
|
95
|
-
|
|
96
|
+
diagnostic: diagnostic.into(),
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
}
|
|
@@ -135,18 +136,60 @@ fn parse_source<'i>(code: &'i str, options: &TransformOptions) -> Result<ParseRe
|
|
|
135
136
|
..ParserOptions::default()
|
|
136
137
|
};
|
|
137
138
|
|
|
138
|
-
let stylesheet =
|
|
139
|
+
let stylesheet =
|
|
140
|
+
StyleSheet::parse(code, parser_options).map_err(|error| Failure::parse(Diagnostic::from_error(&error)))?;
|
|
139
141
|
|
|
140
142
|
let warnings = collected
|
|
141
143
|
.read()
|
|
142
|
-
.map(|warnings| warnings.iter().map(
|
|
144
|
+
.map(|warnings| warnings.iter().map(Diagnostic::from_error).collect())
|
|
143
145
|
.unwrap_or_default();
|
|
144
146
|
|
|
145
147
|
Ok(ParseResult { stylesheet, warnings })
|
|
146
148
|
}
|
|
147
149
|
|
|
150
|
+
fn read_input_source_map(options: &TransformOptions) -> Result<Option<SourceMap>, Failure> {
|
|
151
|
+
let Some(json) = &options.input_source_map else {
|
|
152
|
+
return Ok(None);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
if !options.source_map {
|
|
156
|
+
return Err(Failure::option("input_source_map needs source_map: true"));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
SourceMap::from_json("/", json)
|
|
160
|
+
.map(Some)
|
|
161
|
+
.map_err(|error| Failure::option(format!("Invalid input source map: {error}")))
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
fn new_source_map(options: &TransformOptions) -> Option<SourceMap> {
|
|
165
|
+
options
|
|
166
|
+
.source_map
|
|
167
|
+
.then(|| SourceMap::new(options.project_root.as_deref().unwrap_or("/")))
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
fn serialize_source_map(
|
|
171
|
+
source_map: Option<SourceMap>,
|
|
172
|
+
input_source_map: Option<SourceMap>,
|
|
173
|
+
) -> Result<Option<String>, Failure> {
|
|
174
|
+
let Some(mut source_map) = source_map else {
|
|
175
|
+
return Ok(None);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
if let Some(mut input_source_map) = input_source_map {
|
|
179
|
+
source_map
|
|
180
|
+
.extends(&mut input_source_map)
|
|
181
|
+
.map_err(|error| Failure::option(format!("Invalid input source map: {error}")))?;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
source_map
|
|
185
|
+
.to_json(None)
|
|
186
|
+
.map(Some)
|
|
187
|
+
.map_err(|error| Failure::internal(format!("Failed to serialize source map: {error}")))
|
|
188
|
+
}
|
|
189
|
+
|
|
148
190
|
fn transform_source(code: &str, options: &TransformOptions) -> Result<TransformResult, Failure> {
|
|
149
191
|
let filename = options.filename.clone().unwrap_or_default();
|
|
192
|
+
let input_source_map = read_input_source_map(options)?;
|
|
150
193
|
let css_modules = match &options.css_modules {
|
|
151
194
|
Some(modules) => Some(modules.to_config().map_err(Failure::option)?),
|
|
152
195
|
None => None,
|
|
@@ -162,7 +205,8 @@ fn transform_source(code: &str, options: &TransformOptions) -> Result<TransformR
|
|
|
162
205
|
..ParserOptions::default()
|
|
163
206
|
};
|
|
164
207
|
|
|
165
|
-
let mut stylesheet =
|
|
208
|
+
let mut stylesheet =
|
|
209
|
+
StyleSheet::parse(code, parser_options).map_err(|error| Failure::parse(Diagnostic::from_error(&error)))?;
|
|
166
210
|
|
|
167
211
|
if let Some(fragment) = &options.scope {
|
|
168
212
|
let mut scoper = Scoper::parse(fragment).map_err(Failure::option)?;
|
|
@@ -172,28 +216,37 @@ fn transform_source(code: &str, options: &TransformOptions) -> Result<TransformR
|
|
|
172
216
|
.map_err(|error| Failure::internal(format!("Failed to scope stylesheet: {error:?}")))?;
|
|
173
217
|
}
|
|
174
218
|
|
|
175
|
-
let targets = options.to_targets()
|
|
219
|
+
let targets = options.to_targets().map_err(Failure::option)?;
|
|
176
220
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
221
|
+
stylesheet
|
|
222
|
+
.minify(MinifyOptions {
|
|
223
|
+
targets,
|
|
224
|
+
..MinifyOptions::default()
|
|
225
|
+
})
|
|
226
|
+
.map_err(|error| Failure::internal(format!("Failed to minify: {error}")))?;
|
|
227
|
+
|
|
228
|
+
let mut source_map = new_source_map(options);
|
|
229
|
+
|
|
230
|
+
if let Some(source_map) = &mut source_map {
|
|
231
|
+
source_map.add_source(&filename);
|
|
232
|
+
source_map
|
|
233
|
+
.set_source_content(0, code)
|
|
234
|
+
.map_err(|error| Failure::internal(format!("Failed to add source: {error}")))?;
|
|
184
235
|
}
|
|
185
236
|
|
|
186
237
|
let printed = stylesheet
|
|
187
238
|
.to_css(PrinterOptions {
|
|
188
239
|
minify: options.minify,
|
|
189
|
-
source_map:
|
|
190
|
-
project_root:
|
|
240
|
+
source_map: source_map.as_mut(),
|
|
241
|
+
project_root: options.project_root.as_deref(),
|
|
191
242
|
targets,
|
|
192
243
|
analyze_dependencies: None,
|
|
193
244
|
pseudo_classes: None,
|
|
194
245
|
})
|
|
195
246
|
.map_err(|error| Failure::internal(format!("Failed to print: {error}")))?;
|
|
196
247
|
|
|
248
|
+
let map = serialize_source_map(source_map, input_source_map)?;
|
|
249
|
+
|
|
197
250
|
let exports = printed.exports.map(|exports| {
|
|
198
251
|
exports
|
|
199
252
|
.into_iter()
|
|
@@ -203,12 +256,13 @@ fn transform_source(code: &str, options: &TransformOptions) -> Result<TransformR
|
|
|
203
256
|
|
|
204
257
|
let warnings = collected
|
|
205
258
|
.read()
|
|
206
|
-
.map(|warnings| warnings.iter().map(
|
|
259
|
+
.map(|warnings| warnings.iter().map(Diagnostic::from_error).collect())
|
|
207
260
|
.unwrap_or_default();
|
|
208
261
|
|
|
209
262
|
Ok(TransformResult {
|
|
210
263
|
code: printed.code,
|
|
211
264
|
exports,
|
|
265
|
+
map,
|
|
212
266
|
warnings,
|
|
213
267
|
})
|
|
214
268
|
}
|
|
@@ -234,8 +288,8 @@ fn bundle_source(path: &str, options: &TransformOptions) -> Result<TransformResu
|
|
|
234
288
|
let mut stylesheet = bundler
|
|
235
289
|
.bundle(std::path::Path::new(path))
|
|
236
290
|
.map_err(|error| match &error.kind {
|
|
237
|
-
BundleErrorKind::ParserError(_) => Failure::parse(error
|
|
238
|
-
_ => Failure::bundle(error
|
|
291
|
+
BundleErrorKind::ParserError(_) => Failure::parse(Diagnostic::from_error(&error)),
|
|
292
|
+
_ => Failure::bundle(Diagnostic::from_error(&error)),
|
|
239
293
|
})?;
|
|
240
294
|
|
|
241
295
|
if let Some(fragment) = &options.scope {
|
|
@@ -246,25 +300,40 @@ fn bundle_source(path: &str, options: &TransformOptions) -> Result<TransformResu
|
|
|
246
300
|
.map_err(|error| Failure::internal(format!("Failed to scope stylesheet: {error:?}")))?;
|
|
247
301
|
}
|
|
248
302
|
|
|
249
|
-
let targets = options.to_targets()
|
|
303
|
+
let targets = options.to_targets().map_err(Failure::option)?;
|
|
250
304
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
305
|
+
stylesheet
|
|
306
|
+
.minify(MinifyOptions {
|
|
307
|
+
targets,
|
|
308
|
+
..MinifyOptions::default()
|
|
309
|
+
})
|
|
310
|
+
.map_err(|error| Failure::internal(format!("Failed to minify: {error}")))?;
|
|
311
|
+
|
|
312
|
+
let mut source_map = new_source_map(options);
|
|
313
|
+
|
|
314
|
+
if let Some(source_map) = &mut source_map {
|
|
315
|
+
for source in &stylesheet.sources {
|
|
316
|
+
let content = std::fs::read_to_string(source).map_err(|error| Failure::bundle(format!("{source}: {error}")))?;
|
|
317
|
+
let index = source_map.add_source(source);
|
|
318
|
+
|
|
319
|
+
source_map
|
|
320
|
+
.set_source_content(index as usize, &content)
|
|
321
|
+
.map_err(|error| Failure::internal(format!("Failed to add source: {error}")))?;
|
|
322
|
+
}
|
|
258
323
|
}
|
|
259
324
|
|
|
260
325
|
let printed = stylesheet
|
|
261
326
|
.to_css(PrinterOptions {
|
|
262
327
|
minify: options.minify,
|
|
328
|
+
source_map: source_map.as_mut(),
|
|
329
|
+
project_root: options.project_root.as_deref(),
|
|
263
330
|
targets,
|
|
264
331
|
..PrinterOptions::default()
|
|
265
332
|
})
|
|
266
333
|
.map_err(|error| Failure::internal(format!("Failed to print: {error}")))?;
|
|
267
334
|
|
|
335
|
+
let map = serialize_source_map(source_map, None)?;
|
|
336
|
+
|
|
268
337
|
let exports = printed.exports.map(|exports| {
|
|
269
338
|
exports
|
|
270
339
|
.into_iter()
|
|
@@ -274,12 +343,13 @@ fn bundle_source(path: &str, options: &TransformOptions) -> Result<TransformResu
|
|
|
274
343
|
|
|
275
344
|
let warnings = collected
|
|
276
345
|
.read()
|
|
277
|
-
.map(|warnings| warnings.iter().map(
|
|
346
|
+
.map(|warnings| warnings.iter().map(Diagnostic::from_error).collect())
|
|
278
347
|
.unwrap_or_default();
|
|
279
348
|
|
|
280
349
|
Ok(TransformResult {
|
|
281
350
|
code: printed.code,
|
|
282
351
|
exports,
|
|
352
|
+
map,
|
|
283
353
|
warnings,
|
|
284
354
|
})
|
|
285
355
|
}
|
|
@@ -291,9 +361,10 @@ fn transform_attribute(code: &str, options: &TransformOptions) -> Result<Transfo
|
|
|
291
361
|
..ParserOptions::default()
|
|
292
362
|
};
|
|
293
363
|
|
|
294
|
-
let mut attribute =
|
|
364
|
+
let mut attribute =
|
|
365
|
+
StyleAttribute::parse(code, parser_options).map_err(|error| Failure::parse(Diagnostic::from_error(&error)))?;
|
|
295
366
|
|
|
296
|
-
let targets = options.to_targets()
|
|
367
|
+
let targets = options.to_targets().map_err(Failure::option)?;
|
|
297
368
|
|
|
298
369
|
attribute.minify(MinifyOptions {
|
|
299
370
|
targets,
|
|
@@ -311,6 +382,7 @@ fn transform_attribute(code: &str, options: &TransformOptions) -> Result<Transfo
|
|
|
311
382
|
Ok(TransformResult {
|
|
312
383
|
code: printed.code,
|
|
313
384
|
exports: None,
|
|
385
|
+
map: None,
|
|
314
386
|
warnings: Vec::new(),
|
|
315
387
|
})
|
|
316
388
|
}
|
data/rust/src/options.rs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
use std::collections::HashMap;
|
|
2
2
|
|
|
3
3
|
use lightningcss::css_modules::{Config as CssModulesConfig, Pattern};
|
|
4
|
+
use lightningcss::error::Error;
|
|
4
5
|
use lightningcss::targets::{Browsers, Targets};
|
|
5
6
|
use serde::{Deserialize, Serialize};
|
|
6
7
|
|
|
@@ -10,9 +11,12 @@ pub struct TransformOptions {
|
|
|
10
11
|
pub filename: Option<String>,
|
|
11
12
|
pub minify: bool,
|
|
12
13
|
pub error_recovery: bool,
|
|
13
|
-
pub targets: Option<HashMap<String,
|
|
14
|
+
pub targets: Option<HashMap<String, Version>>,
|
|
14
15
|
pub css_modules: Option<CssModulesOptions>,
|
|
15
16
|
pub scope: Option<String>,
|
|
17
|
+
pub source_map: bool,
|
|
18
|
+
pub input_source_map: Option<String>,
|
|
19
|
+
pub project_root: Option<String>,
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
#[derive(Debug, Deserialize)]
|
|
@@ -60,16 +64,81 @@ impl CssModulesOptions {
|
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
|
|
67
|
+
#[derive(Debug, Deserialize)]
|
|
68
|
+
#[serde(untagged)]
|
|
69
|
+
pub enum Version {
|
|
70
|
+
Major(u32),
|
|
71
|
+
Float(f64),
|
|
72
|
+
String(String),
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
impl Version {
|
|
76
|
+
/// Encodes a version the way Lightning CSS reads it, as `major << 16 | minor << 8 | patch`.
|
|
77
|
+
fn encode(&self) -> Option<u32> {
|
|
78
|
+
match self {
|
|
79
|
+
Version::Major(major) => (*major <= 0xffff).then(|| major << 16),
|
|
80
|
+
Version::Float(float) => Self::parse(&float.to_string()),
|
|
81
|
+
Version::String(string) => Self::parse(string),
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
fn parse(version: &str) -> Option<u32> {
|
|
86
|
+
let mut parts = version.trim().split('.');
|
|
87
|
+
|
|
88
|
+
let major: u16 = parts.next()?.parse().ok()?;
|
|
89
|
+
let minor: u8 = parts.next().map_or(Some(0), |part| part.parse().ok())?;
|
|
90
|
+
let patch: u8 = parts.next().map_or(Some(0), |part| part.parse().ok())?;
|
|
91
|
+
|
|
92
|
+
if parts.next().is_some() {
|
|
93
|
+
return None;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Some(u32::from(major) << 16 | u32::from(minor) << 8 | u32::from(patch))
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
fn describe(&self) -> String {
|
|
100
|
+
match self {
|
|
101
|
+
Version::Major(major) => major.to_string(),
|
|
102
|
+
Version::Float(float) => float.to_string(),
|
|
103
|
+
Version::String(string) => format!("{string:?}"),
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const BROWSERS: [&str; 10] = [
|
|
109
|
+
"android", "chrome", "edge", "firefox", "ie", "ios", "ios_saf", "opera", "safari", "samsung",
|
|
110
|
+
];
|
|
111
|
+
|
|
63
112
|
impl TransformOptions {
|
|
64
|
-
pub fn to_targets(&self) -> Targets {
|
|
113
|
+
pub fn to_targets(&self) -> Result<Targets, String> {
|
|
65
114
|
let Some(versions) = &self.targets else {
|
|
66
|
-
return Targets::default();
|
|
115
|
+
return Ok(Targets::default());
|
|
67
116
|
};
|
|
68
117
|
|
|
118
|
+
let mut unknown: Vec<&str> = versions
|
|
119
|
+
.keys()
|
|
120
|
+
.map(String::as_str)
|
|
121
|
+
.filter(|name| !BROWSERS.contains(name))
|
|
122
|
+
.collect();
|
|
123
|
+
|
|
124
|
+
if !unknown.is_empty() {
|
|
125
|
+
unknown.sort_unstable();
|
|
126
|
+
|
|
127
|
+
return Err(format!(
|
|
128
|
+
"Unknown browser{} in targets: {}",
|
|
129
|
+
if unknown.len() > 1 { "s" } else { "" },
|
|
130
|
+
unknown.join(", ")
|
|
131
|
+
));
|
|
132
|
+
}
|
|
133
|
+
|
|
69
134
|
let mut browsers = Browsers::default();
|
|
70
135
|
|
|
71
136
|
for (name, version) in versions {
|
|
72
|
-
let encoded = Some(
|
|
137
|
+
let encoded = Some(
|
|
138
|
+
version
|
|
139
|
+
.encode()
|
|
140
|
+
.ok_or_else(|| format!("Invalid version {} for {name} in targets", version.describe()))?,
|
|
141
|
+
);
|
|
73
142
|
|
|
74
143
|
match name.as_str() {
|
|
75
144
|
"android" => browsers.android = encoded,
|
|
@@ -81,18 +150,18 @@ impl TransformOptions {
|
|
|
81
150
|
"opera" => browsers.opera = encoded,
|
|
82
151
|
"safari" => browsers.safari = encoded,
|
|
83
152
|
"samsung" => browsers.samsung = encoded,
|
|
84
|
-
_ =>
|
|
153
|
+
_ => unreachable!(),
|
|
85
154
|
}
|
|
86
155
|
}
|
|
87
156
|
|
|
88
|
-
Targets::from(browsers)
|
|
157
|
+
Ok(Targets::from(browsers))
|
|
89
158
|
}
|
|
90
159
|
}
|
|
91
160
|
|
|
92
161
|
#[derive(Debug, Serialize)]
|
|
93
162
|
pub struct ParseResult<T> {
|
|
94
163
|
pub stylesheet: T,
|
|
95
|
-
pub warnings: Vec<
|
|
164
|
+
pub warnings: Vec<Diagnostic>,
|
|
96
165
|
}
|
|
97
166
|
|
|
98
167
|
#[derive(Debug, Serialize)]
|
|
@@ -100,5 +169,68 @@ pub struct TransformResult {
|
|
|
100
169
|
pub code: String,
|
|
101
170
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
102
171
|
pub exports: Option<HashMap<String, String>>,
|
|
103
|
-
|
|
172
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
173
|
+
pub map: Option<String>,
|
|
174
|
+
pub warnings: Vec<Diagnostic>,
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
#[derive(Debug, Serialize)]
|
|
178
|
+
pub struct Diagnostic {
|
|
179
|
+
pub message: String,
|
|
180
|
+
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
|
|
181
|
+
pub kind: Option<String>,
|
|
182
|
+
#[serde(skip_serializing_if = "Option::is_none")]
|
|
183
|
+
pub location: Option<Location>,
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
#[derive(Debug, Serialize)]
|
|
187
|
+
pub struct Location {
|
|
188
|
+
pub filename: Option<String>,
|
|
189
|
+
pub line: u32,
|
|
190
|
+
pub column: u32,
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
impl Diagnostic {
|
|
194
|
+
pub fn from_error<T: std::fmt::Display + Serialize>(error: &Error<T>) -> Self {
|
|
195
|
+
Self {
|
|
196
|
+
message: error.kind.to_string(),
|
|
197
|
+
kind: serde_json::to_value(&error.kind).ok().as_ref().and_then(type_of),
|
|
198
|
+
location: error.loc.as_ref().map(|location| Location {
|
|
199
|
+
filename: (!location.filename.is_empty()).then(|| location.filename.clone()),
|
|
200
|
+
line: location.line + 1,
|
|
201
|
+
column: location.column.saturating_sub(1),
|
|
202
|
+
}),
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
impl From<String> for Diagnostic {
|
|
208
|
+
fn from(message: String) -> Self {
|
|
209
|
+
Self {
|
|
210
|
+
message,
|
|
211
|
+
kind: None,
|
|
212
|
+
location: None,
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
impl From<&str> for Diagnostic {
|
|
218
|
+
fn from(message: &str) -> Self {
|
|
219
|
+
Self::from(message.to_string())
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
fn type_of(value: &serde_json::Value) -> Option<String> {
|
|
224
|
+
match value {
|
|
225
|
+
serde_json::Value::String(name) => Some(name.clone()),
|
|
226
|
+
serde_json::Value::Object(fields) => match fields.get("type") {
|
|
227
|
+
Some(serde_json::Value::String(name)) => Some(name.clone()),
|
|
228
|
+
_ if fields.len() == 1 => fields.iter().next().map(|(name, inner)| match inner.get("type") {
|
|
229
|
+
Some(serde_json::Value::String(inner_name)) => inner_name.clone(),
|
|
230
|
+
_ => name.clone(),
|
|
231
|
+
}),
|
|
232
|
+
_ => None,
|
|
233
|
+
},
|
|
234
|
+
_ => None,
|
|
235
|
+
}
|
|
104
236
|
}
|
data/rust/src/scope.rs
CHANGED
|
@@ -29,7 +29,8 @@ impl<'i> Scoper<'i> {
|
|
|
29
29
|
let list = SelectorList::parse_string_with_options(fragment, ParserOptions::default()).map_err(|error| {
|
|
30
30
|
format!(
|
|
31
31
|
"Invalid scope selector {fragment:?} at :{}:{}",
|
|
32
|
-
error.location.line,
|
|
32
|
+
error.location.line + 1,
|
|
33
|
+
error.location.column
|
|
33
34
|
)
|
|
34
35
|
})?;
|
|
35
36
|
|
data/sig/lightningcss/errors.rbs
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
module LightningCSS
|
|
4
4
|
class Error < StandardError
|
|
5
|
+
attr_reader type: String?
|
|
6
|
+
|
|
7
|
+
attr_reader location: LightningCSS::Location?
|
|
8
|
+
|
|
9
|
+
# : (String) -> instance
|
|
10
|
+
def self.from_json: (String) -> instance
|
|
11
|
+
|
|
12
|
+
# : (?String?, ?type: String?, ?location: LightningCSS::Location?) -> void
|
|
13
|
+
def initialize: (?String?, ?type: String?, ?location: LightningCSS::Location?) -> void
|
|
5
14
|
end
|
|
6
15
|
|
|
7
16
|
class ParseError < Error
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Generated from lib/lightningcss/location.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module LightningCSS
|
|
4
|
+
class Location < Data
|
|
5
|
+
attr_reader filename(): String?
|
|
6
|
+
|
|
7
|
+
attr_reader line(): Integer
|
|
8
|
+
|
|
9
|
+
attr_reader column(): Integer
|
|
10
|
+
|
|
11
|
+
def self.new: (String? filename, Integer line, Integer column) -> instance
|
|
12
|
+
| (filename: String?, line: Integer, column: Integer) -> instance
|
|
13
|
+
|
|
14
|
+
def self.members: () -> [ :filename, :line, :column ]
|
|
15
|
+
|
|
16
|
+
def members: () -> [ :filename, :line, :column ]
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class Location
|
|
20
|
+
# : (Hash[String, untyped]) -> LightningCSS::Location
|
|
21
|
+
def self.from_hash: (Hash[String, untyped]) -> LightningCSS::Location
|
|
22
|
+
|
|
23
|
+
# : () -> String
|
|
24
|
+
def to_s: () -> String
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -10,13 +10,13 @@ module LightningCSS
|
|
|
10
10
|
|
|
11
11
|
attr_reader stylesheet: Hash[String, untyped]
|
|
12
12
|
|
|
13
|
-
attr_reader warnings: Array[
|
|
13
|
+
attr_reader warnings: Array[LightningCSS::Warning]
|
|
14
14
|
|
|
15
15
|
# : (String, ?String?) -> LightningCSS::ParseResult
|
|
16
16
|
def self.from_json: (String, ?String?) -> LightningCSS::ParseResult
|
|
17
17
|
|
|
18
|
-
# : (stylesheet: Hash[String, untyped], warnings: Array[
|
|
19
|
-
def initialize: (stylesheet: Hash[String, untyped], warnings: Array[
|
|
18
|
+
# : (stylesheet: Hash[String, untyped], warnings: Array[LightningCSS::Warning], ?source: String?) -> void
|
|
19
|
+
def initialize: (stylesheet: Hash[String, untyped], warnings: Array[LightningCSS::Warning], ?source: String?) -> void
|
|
20
20
|
|
|
21
21
|
# : () -> LightningCSS::Node
|
|
22
22
|
def root: () -> LightningCSS::Node
|
data/sig/lightningcss/result.rbs
CHANGED
|
@@ -14,13 +14,15 @@ module LightningCSS
|
|
|
14
14
|
|
|
15
15
|
attr_reader exports: Hash[String, String]?
|
|
16
16
|
|
|
17
|
-
attr_reader
|
|
17
|
+
attr_reader map: String?
|
|
18
|
+
|
|
19
|
+
attr_reader warnings: Array[LightningCSS::Warning]
|
|
18
20
|
|
|
19
21
|
# : (String) -> LightningCSS::Result
|
|
20
22
|
def self.from_json: (String) -> LightningCSS::Result
|
|
21
23
|
|
|
22
|
-
# : (code: String, warnings: Array[
|
|
23
|
-
def initialize: (code: String, warnings: Array[
|
|
24
|
+
# : (code: String, warnings: Array[LightningCSS::Warning], ?exports: Hash[String, String]?, ?map: String?) -> void
|
|
25
|
+
def initialize: (code: String, warnings: Array[LightningCSS::Warning], ?exports: Hash[String, String]?, ?map: String?) -> void
|
|
24
26
|
|
|
25
27
|
# : () -> bool
|
|
26
28
|
def warnings?: () -> bool
|
|
@@ -13,19 +13,19 @@ module LightningCSS
|
|
|
13
13
|
class Transformer
|
|
14
14
|
attr_reader options: Hash[Symbol, untyped]
|
|
15
15
|
|
|
16
|
-
# : (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> void
|
|
17
|
-
def initialize: (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> void
|
|
16
|
+
# : (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> void
|
|
17
|
+
def initialize: (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> void
|
|
18
18
|
|
|
19
|
-
# : (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
20
|
-
def transform: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
19
|
+
# : (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Result
|
|
20
|
+
def transform: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Result
|
|
21
21
|
|
|
22
22
|
alias call transform
|
|
23
23
|
|
|
24
24
|
# : (String, ?filename: String?, ?error_recovery: bool) -> LightningCSS::ParseResult
|
|
25
25
|
def parse: (String, ?filename: String?, ?error_recovery: bool) -> LightningCSS::ParseResult
|
|
26
26
|
|
|
27
|
-
# : (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
28
|
-
def bundle: (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
27
|
+
# : (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?project_root: String?) -> LightningCSS::Result
|
|
28
|
+
def bundle: (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?project_root: String?) -> LightningCSS::Result
|
|
29
29
|
|
|
30
30
|
# : (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?) -> LightningCSS::Result
|
|
31
31
|
def transform_style_attribute: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?) -> LightningCSS::Result
|
|
@@ -33,8 +33,8 @@ module LightningCSS
|
|
|
33
33
|
# : (String, ?filename: String?, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> String
|
|
34
34
|
def minify: (String, ?filename: String?, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> String
|
|
35
35
|
|
|
36
|
-
# : (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Transformer
|
|
37
|
-
def with: (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Transformer
|
|
36
|
+
# : (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Transformer
|
|
37
|
+
def with: (?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Transformer
|
|
38
38
|
|
|
39
39
|
# : () -> String
|
|
40
40
|
def inspect: () -> String
|
data/sig/lightningcss/types.rbs
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
# Note: This file is hand written, `rbs-inline` does not generate this file.
|
|
2
2
|
|
|
3
3
|
module LightningCSS
|
|
4
|
+
type version = Integer | Float | String
|
|
5
|
+
|
|
4
6
|
type browsers = {
|
|
5
|
-
?android:
|
|
6
|
-
?chrome:
|
|
7
|
-
?edge:
|
|
8
|
-
?firefox:
|
|
9
|
-
?ie:
|
|
10
|
-
?ios:
|
|
11
|
-
?ios_saf:
|
|
12
|
-
?opera:
|
|
13
|
-
?safari:
|
|
14
|
-
?samsung:
|
|
7
|
+
?android: version,
|
|
8
|
+
?chrome: version,
|
|
9
|
+
?edge: version,
|
|
10
|
+
?firefox: version,
|
|
11
|
+
?ie: version,
|
|
12
|
+
?ios: version,
|
|
13
|
+
?ios_saf: version,
|
|
14
|
+
?opera: version,
|
|
15
|
+
?safari: version,
|
|
16
|
+
?samsung: version
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
type css_modules = bool | {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated from lib/lightningcss/warning.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module LightningCSS
|
|
4
|
+
class Warning
|
|
5
|
+
attr_reader message: String
|
|
6
|
+
|
|
7
|
+
attr_reader type: String?
|
|
8
|
+
|
|
9
|
+
attr_reader location: LightningCSS::Location?
|
|
10
|
+
|
|
11
|
+
# : (Hash[String, untyped]) -> LightningCSS::Warning
|
|
12
|
+
def self.from_hash: (Hash[String, untyped]) -> LightningCSS::Warning
|
|
13
|
+
|
|
14
|
+
# : (message: String, ?type: String?, ?location: LightningCSS::Location?) -> void
|
|
15
|
+
def initialize: (message: String, ?type: String?, ?location: LightningCSS::Location?) -> void
|
|
16
|
+
|
|
17
|
+
# : () -> Hash[Symbol, untyped]
|
|
18
|
+
def to_h: () -> Hash[Symbol, untyped]
|
|
19
|
+
|
|
20
|
+
# : () -> String
|
|
21
|
+
def to_s: () -> String
|
|
22
|
+
|
|
23
|
+
alias to_str to_s
|
|
24
|
+
|
|
25
|
+
# : (untyped) -> bool
|
|
26
|
+
def ==: (untyped) -> bool
|
|
27
|
+
|
|
28
|
+
alias eql? ==
|
|
29
|
+
|
|
30
|
+
# : () -> Integer
|
|
31
|
+
def hash: () -> Integer
|
|
32
|
+
|
|
33
|
+
# : () -> String
|
|
34
|
+
def inspect: () -> String
|
|
35
|
+
end
|
|
36
|
+
end
|
data/sig/lightningcss.rbs
CHANGED
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
# `LightningCSS::Options` is what the options are read by, and `LightningCSS::Transformer` holds a
|
|
20
20
|
# set of them to reuse across many stylesheets.
|
|
21
21
|
module LightningCSS
|
|
22
|
-
# : (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
23
|
-
def self.transform: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
22
|
+
# : (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Result
|
|
23
|
+
def self.transform: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?input_source_map: String?, ?project_root: String?) -> LightningCSS::Result
|
|
24
24
|
|
|
25
25
|
# : (String, ?filename: String?, ?error_recovery: bool) -> LightningCSS::ParseResult
|
|
26
26
|
def self.parse: (String, ?filename: String?, ?error_recovery: bool) -> LightningCSS::ParseResult
|
|
27
27
|
|
|
28
|
-
# : (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
29
|
-
def self.bundle: (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?) -> LightningCSS::Result
|
|
28
|
+
# : (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?project_root: String?) -> LightningCSS::Result
|
|
29
|
+
def self.bundle: (String, ?minify: bool, ?error_recovery: bool, ?targets: browsers?, ?css_modules: css_modules?, ?scope: String?, ?source_map: bool, ?project_root: String?) -> LightningCSS::Result
|
|
30
30
|
|
|
31
31
|
# : (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?) -> LightningCSS::Result
|
|
32
32
|
def self.transform_style_attribute: (String, ?filename: String?, ?minify: bool, ?error_recovery: bool, ?targets: browsers?) -> LightningCSS::Result
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lightningcss
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.33.0.
|
|
4
|
+
version: 1.33.0.3
|
|
5
5
|
platform: x86_64-linux-gnu
|
|
6
6
|
authors:
|
|
7
7
|
- Marco Roth
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Ruby bindings for Lightning CSS, an extremely fast CSS parser, transformer,
|
|
14
14
|
bundler, and minifier.
|
|
@@ -30,6 +30,7 @@ files:
|
|
|
30
30
|
- lib/lightningcss/4.0/lightningcss.so
|
|
31
31
|
- lib/lightningcss/backend.rb
|
|
32
32
|
- lib/lightningcss/errors.rb
|
|
33
|
+
- lib/lightningcss/location.rb
|
|
33
34
|
- lib/lightningcss/node.rb
|
|
34
35
|
- lib/lightningcss/options.rb
|
|
35
36
|
- lib/lightningcss/parse_result.rb
|
|
@@ -37,6 +38,7 @@ files:
|
|
|
37
38
|
- lib/lightningcss/transformer.rb
|
|
38
39
|
- lib/lightningcss/version.rb
|
|
39
40
|
- lib/lightningcss/visitor.rb
|
|
41
|
+
- lib/lightningcss/warning.rb
|
|
40
42
|
- licenses/README.md
|
|
41
43
|
- licenses/lightningcss-MPL-2.0.txt
|
|
42
44
|
- lightningcss.gemspec
|
|
@@ -51,6 +53,7 @@ files:
|
|
|
51
53
|
- sig/lightningcss.rbs
|
|
52
54
|
- sig/lightningcss/backend.rbs
|
|
53
55
|
- sig/lightningcss/errors.rbs
|
|
56
|
+
- sig/lightningcss/location.rbs
|
|
54
57
|
- sig/lightningcss/node.rbs
|
|
55
58
|
- sig/lightningcss/options.rbs
|
|
56
59
|
- sig/lightningcss/parse_result.rbs
|
|
@@ -59,6 +62,7 @@ files:
|
|
|
59
62
|
- sig/lightningcss/types.rbs
|
|
60
63
|
- sig/lightningcss/version.rbs
|
|
61
64
|
- sig/lightningcss/visitor.rbs
|
|
65
|
+
- sig/lightningcss/warning.rbs
|
|
62
66
|
homepage: https://github.com/marcoroth/lightningcss-ruby
|
|
63
67
|
licenses:
|
|
64
68
|
- MIT
|