autoprefixer-rails 10.0.0 → 10.0.0.1
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/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/lib/autoprefixer-rails/processor.rb +16 -13
- data/lib/autoprefixer-rails/version.rb +1 -1
- metadata +2 -46
- data/spec/app/Rakefile +0 -4
- data/spec/app/app/assets/config/manifest.js +0 -0
- data/spec/app/app/assets/stylesheets/evaluate.css.erb +0 -1
- data/spec/app/app/assets/stylesheets/loaded.sass +0 -2
- data/spec/app/app/assets/stylesheets/sass.sass +0 -1
- data/spec/app/app/assets/stylesheets/test.css +0 -3
- data/spec/app/app/assets/stylesheets/wrong.css +0 -2
- data/spec/app/app/controllers/application_controller.rb +0 -4
- data/spec/app/app/controllers/css_controller.rb +0 -8
- data/spec/app/config.ru +0 -4
- data/spec/app/config/application.rb +0 -16
- data/spec/app/config/autoprefixer.yml +0 -2
- data/spec/app/config/boot.rb +0 -4
- data/spec/app/config/environment.rb +0 -5
- data/spec/app/config/environments/test.rb +0 -11
- data/spec/app/config/initializers/secret_token.rb +0 -3
- data/spec/app/config/routes.rb +0 -5
- data/spec/autoprefixer_spec.rb +0 -123
- data/spec/processor_spec.rb +0 -27
- data/spec/rails_spec.rb +0 -42
- data/spec/railtie_spec.rb +0 -31
- data/spec/spec_helper.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9facf0c70f279ac8811eb4e39877339c7a9d815557aecd28d4c44f57ff4ab53
|
4
|
+
data.tar.gz: 0a70a32d654bdc2d56995b6e889e25a83ccfcc225bd710073e4f4e1d65891418
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae1e918ec94c17ac98e23f23648c12d9121f2c826df52ff3ec6e9e67efe395ecf4dd1db85429e08c77383e60781fe0e873b21974951a62aaacd16bed75996483
|
7
|
+
data.tar.gz: 7eef7cce62e8a029eaf891aff1ccda96299f04c48128387c027ff0e5089ed89ef41407afc36ff0e0aa4a562d3383b38f668e04cba54c7c274b7d707c8d7339a7
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -33,8 +33,8 @@ Windows users should install [Node.js]. Autoprefixer Rails doesn’t work with
|
|
33
33
|
old JScript in Windows.
|
34
34
|
|
35
35
|
Autoprefixer Rails uses [ExecJS] that will use the best available JavaScript
|
36
|
-
runtime. Currently this gem is tested to work with Node.js version
|
37
|
-
with [mini_racer], but will not work with [therubyracer].
|
36
|
+
runtime. Currently this gem is tested to work with Node.js version 10 and up
|
37
|
+
and with [mini_racer], but will not work with [therubyracer].
|
38
38
|
|
39
39
|
[Node.js]: http://nodejs.org/
|
40
40
|
[ExecJS]: https://github.com/rails/execjs
|
@@ -9,6 +9,8 @@ IS_SECTION = /^\s*\[(.+)\]\s*$/.freeze
|
|
9
9
|
module AutoprefixerRails
|
10
10
|
# Ruby to JS wrapper for Autoprefixer processor instance
|
11
11
|
class Processor
|
12
|
+
SUPPORTED_RUNTIMES = [ExecJS::Runtimes::Node, ExecJS::Runtimes::MiniRacer]
|
13
|
+
|
12
14
|
def initialize(params = {})
|
13
15
|
@params = params || {}
|
14
16
|
end
|
@@ -128,24 +130,25 @@ module AutoprefixerRails
|
|
128
130
|
# Lazy load for JS library
|
129
131
|
def runtime
|
130
132
|
@runtime ||= begin
|
131
|
-
if ExecJS.eval("typeof Uint8Array") != "function"
|
132
|
-
if ExecJS.runtime.name.start_with?("therubyracer")
|
133
|
-
raise "ExecJS::RubyRacerRuntime is not supported. " \
|
134
|
-
"Please replace therubyracer with mini_racer " \
|
135
|
-
"in your Gemfile or use Node.js as ExecJS runtime."
|
136
|
-
else
|
137
|
-
raise "#{ExecJS.runtime.name} runtime does’t support ES6. " \
|
138
|
-
"Please update or replace your current ExecJS runtime."
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
133
|
if ExecJS.runtime == ExecJS::Runtimes::Node
|
143
134
|
version = ExecJS.runtime.eval("process.version")
|
144
|
-
|
145
|
-
|
135
|
+
major = version.match(/^v(\d+)/)[1].to_i
|
136
|
+
|
137
|
+
# supports 10, 12, 14+
|
138
|
+
if major < 9 || [11, 13].include?(major)
|
139
|
+
raise "Autoprefixer doesn’t support Node #{version}. Update it."
|
140
|
+
end
|
146
141
|
end
|
147
142
|
|
148
143
|
ExecJS.compile(build_js)
|
144
|
+
rescue ExecJS::RuntimeError
|
145
|
+
raise if SUPPORTED_RUNTIMES.include?(ExecJS.runtime)
|
146
|
+
|
147
|
+
# Only complain about unsupported runtimes when it failed to parse our script.
|
148
|
+
raise <<~MSG
|
149
|
+
Your ExecJS runtime #{ExecJS.runtime.name} isn't supported by autoprefixer-rails,
|
150
|
+
please switch to #{SUPPORTED_RUNTIMES.map(&:name).join(' or ')}
|
151
|
+
MSG
|
149
152
|
end
|
150
153
|
end
|
151
154
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoprefixer-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 10.0.0
|
4
|
+
version: 10.0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Sitnik
|
@@ -127,28 +127,6 @@ files:
|
|
127
127
|
- lib/autoprefixer-rails/sprockets.rb
|
128
128
|
- lib/autoprefixer-rails/version.rb
|
129
129
|
- lib/rake/autoprefixer_tasks.rb
|
130
|
-
- spec/app/Rakefile
|
131
|
-
- spec/app/app/assets/config/manifest.js
|
132
|
-
- spec/app/app/assets/stylesheets/evaluate.css.erb
|
133
|
-
- spec/app/app/assets/stylesheets/loaded.sass
|
134
|
-
- spec/app/app/assets/stylesheets/sass.sass
|
135
|
-
- spec/app/app/assets/stylesheets/test.css
|
136
|
-
- spec/app/app/assets/stylesheets/wrong.css
|
137
|
-
- spec/app/app/controllers/application_controller.rb
|
138
|
-
- spec/app/app/controllers/css_controller.rb
|
139
|
-
- spec/app/config.ru
|
140
|
-
- spec/app/config/application.rb
|
141
|
-
- spec/app/config/autoprefixer.yml
|
142
|
-
- spec/app/config/boot.rb
|
143
|
-
- spec/app/config/environment.rb
|
144
|
-
- spec/app/config/environments/test.rb
|
145
|
-
- spec/app/config/initializers/secret_token.rb
|
146
|
-
- spec/app/config/routes.rb
|
147
|
-
- spec/autoprefixer_spec.rb
|
148
|
-
- spec/processor_spec.rb
|
149
|
-
- spec/rails_spec.rb
|
150
|
-
- spec/railtie_spec.rb
|
151
|
-
- spec/spec_helper.rb
|
152
130
|
- vendor/autoprefixer.js
|
153
131
|
homepage: https://github.com/ai/autoprefixer-rails
|
154
132
|
licenses:
|
@@ -177,26 +155,4 @@ signing_key:
|
|
177
155
|
specification_version: 4
|
178
156
|
summary: Parse CSS and add vendor prefixes to CSS rules using values from the Can
|
179
157
|
I Use website.
|
180
|
-
test_files:
|
181
|
-
- spec/spec_helper.rb
|
182
|
-
- spec/processor_spec.rb
|
183
|
-
- spec/app/config.ru
|
184
|
-
- spec/app/app/assets/stylesheets/evaluate.css.erb
|
185
|
-
- spec/app/app/assets/stylesheets/test.css
|
186
|
-
- spec/app/app/assets/stylesheets/loaded.sass
|
187
|
-
- spec/app/app/assets/stylesheets/sass.sass
|
188
|
-
- spec/app/app/assets/stylesheets/wrong.css
|
189
|
-
- spec/app/app/assets/config/manifest.js
|
190
|
-
- spec/app/app/controllers/css_controller.rb
|
191
|
-
- spec/app/app/controllers/application_controller.rb
|
192
|
-
- spec/app/Rakefile
|
193
|
-
- spec/app/config/environments/test.rb
|
194
|
-
- spec/app/config/boot.rb
|
195
|
-
- spec/app/config/initializers/secret_token.rb
|
196
|
-
- spec/app/config/routes.rb
|
197
|
-
- spec/app/config/autoprefixer.yml
|
198
|
-
- spec/app/config/environment.rb
|
199
|
-
- spec/app/config/application.rb
|
200
|
-
- spec/railtie_spec.rb
|
201
|
-
- spec/autoprefixer_spec.rb
|
202
|
-
- spec/rails_spec.rb
|
158
|
+
test_files: []
|
data/spec/app/Rakefile
DELETED
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= evaluate 'test.css' %>
|
@@ -1 +0,0 @@
|
|
1
|
-
@import "loaded"
|
data/spec/app/config.ru
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require File.expand_path("boot", __dir__)
|
4
|
-
|
5
|
-
require "action_controller/railtie"
|
6
|
-
require "sprockets/railtie"
|
7
|
-
|
8
|
-
Bundler.require(*Rails.groups(assets: %w[development test])) if defined?(Bundler)
|
9
|
-
|
10
|
-
module App
|
11
|
-
class Application < Rails::Application
|
12
|
-
config.assets.enabled = true
|
13
|
-
config.sass.line_comments = false
|
14
|
-
config.sass.inline_source_maps = true
|
15
|
-
end
|
16
|
-
end
|
data/spec/app/config/boot.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
App::Application.configure do
|
4
|
-
config.cache_classes = true
|
5
|
-
config.eager_load = false
|
6
|
-
config.consider_all_requests_local = true
|
7
|
-
config.action_controller.perform_caching = false
|
8
|
-
config.action_dispatch.show_exceptions = false
|
9
|
-
config.action_controller.allow_forgery_protection = false
|
10
|
-
config.active_support.deprecation = :stderr
|
11
|
-
end
|
data/spec/app/config/routes.rb
DELETED
data/spec/autoprefixer_spec.rb
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "spec_helper"
|
4
|
-
|
5
|
-
describe AutoprefixerRails do
|
6
|
-
before :all do
|
7
|
-
@dir = Pathname(__FILE__).dirname
|
8
|
-
@css = @dir.join("app/app/assets/stylesheets/test.css").read
|
9
|
-
end
|
10
|
-
|
11
|
-
it "process CSS" do
|
12
|
-
expect(AutoprefixerRails.process(@css)).to be_a(AutoprefixerRails::Result)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "process CSS for selected browsers" do
|
16
|
-
css = "a {\n tab-size: 2\n}"
|
17
|
-
result = AutoprefixerRails.process(css, overrideBrowserslist: ["opera 12"])
|
18
|
-
expect(result.css).to eq "a {\n" \
|
19
|
-
" -o-tab-size: 2;\n" \
|
20
|
-
" tab-size: 2\n" \
|
21
|
-
"}"
|
22
|
-
end
|
23
|
-
|
24
|
-
it "has browsers option" do
|
25
|
-
css = "a {\n tab-size: 2\n}"
|
26
|
-
result = AutoprefixerRails.process(css, browsers: ["opera 12"])
|
27
|
-
expect(result.css).to eq "a {\n" \
|
28
|
-
" -o-tab-size: 2;\n" \
|
29
|
-
" tab-size: 2\n" \
|
30
|
-
"}"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "process @supports" do
|
34
|
-
css = "@supports (display: flex) { }"
|
35
|
-
result = AutoprefixerRails.process(css, overrideBrowserslist: ["chrome 28"])
|
36
|
-
expect(result.css).to eq(
|
37
|
-
"@supports ((display: -webkit-flex) or (display: flex)) { }"
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
it "generates source map" do
|
42
|
-
result = AutoprefixerRails.process(@css, map: true)
|
43
|
-
expect(result.css).to include("/*# sourceMappingURL=data:")
|
44
|
-
end
|
45
|
-
|
46
|
-
it "generates separated source map" do
|
47
|
-
result = AutoprefixerRails.process(@css, map: { inline: false })
|
48
|
-
expect(result.map).to be_a(String)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "uses file name in syntax errors", not_jruby: true do
|
52
|
-
expect do
|
53
|
-
AutoprefixerRails.process("a {", from: "a.css")
|
54
|
-
end.to raise_error(/a.css:/)
|
55
|
-
end
|
56
|
-
|
57
|
-
it "includes sourcesContent by default" do
|
58
|
-
map = AutoprefixerRails.process("a{}", map: { inline: false }).map
|
59
|
-
expect(map).to include("sourcesContent")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "maps options from Ruby style" do
|
63
|
-
map = AutoprefixerRails.process("a{}", map: {
|
64
|
-
sources_content: false,
|
65
|
-
inline: false
|
66
|
-
}).map
|
67
|
-
|
68
|
-
expect(map).not_to include("sourcesContent")
|
69
|
-
end
|
70
|
-
|
71
|
-
it "does not remove old prefixes on request" do
|
72
|
-
css = "a { -moz-border-radius: 5px; border-radius: 5px }"
|
73
|
-
result = AutoprefixerRails.process(css, remove: false)
|
74
|
-
expect(result.css).to eq(css)
|
75
|
-
end
|
76
|
-
|
77
|
-
it "shows debug" do
|
78
|
-
info = AutoprefixerRails.processor(overrideBrowserslist: ["chrome 25"]).info
|
79
|
-
expect(info).to match(/Browsers:\n Chrome: 25\n\n/)
|
80
|
-
expect(info).to match(/ transition: webkit/)
|
81
|
-
end
|
82
|
-
|
83
|
-
it "returns warnings" do
|
84
|
-
css = "a{background:linear-gradient(top,white,black)}"
|
85
|
-
result = AutoprefixerRails.process(css)
|
86
|
-
expect(result.warnings).to eq(["<css input>:1:3: Gradient has outdated " \
|
87
|
-
"direction syntax. New syntax is like `to left` instead of `right`."])
|
88
|
-
end
|
89
|
-
|
90
|
-
it "shows correct error on country statistics" do
|
91
|
-
expect do
|
92
|
-
AutoprefixerRails.process("", overrideBrowserslist: "> 1% in US")
|
93
|
-
end.to raise_error(/Use Autoprefixer with webpack/)
|
94
|
-
end
|
95
|
-
|
96
|
-
context "Sprockets" do
|
97
|
-
before :each do
|
98
|
-
@assets = Sprockets::Environment.new
|
99
|
-
@assets.append_path(@dir.join("app/app/assets/stylesheets"))
|
100
|
-
AutoprefixerRails.install(@assets, overrideBrowserslist: ["chrome 25"])
|
101
|
-
end
|
102
|
-
|
103
|
-
it "integrates with Sprockets" do
|
104
|
-
css = @assets["test.css"].to_s
|
105
|
-
expect(css).to eq "a {\n" \
|
106
|
-
" -webkit-mask: none;\n" \
|
107
|
-
" mask: none\n" \
|
108
|
-
"}\n"
|
109
|
-
end
|
110
|
-
|
111
|
-
it "shows file name from Sprockets", not_jruby: true do
|
112
|
-
expect { @assets["wrong.css"] }.to raise_error(/wrong/)
|
113
|
-
end
|
114
|
-
|
115
|
-
it "supports disabling", not_jruby: true do
|
116
|
-
AutoprefixerRails.uninstall(@assets)
|
117
|
-
css = @assets["test.css"].to_s
|
118
|
-
expect(css).to eq "a {\n" \
|
119
|
-
" mask: none\n" \
|
120
|
-
"}\n"
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
data/spec/processor_spec.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "spec_helper"
|
4
|
-
|
5
|
-
describe AutoprefixerRails::Processor do
|
6
|
-
it "parses config" do
|
7
|
-
config = "# Comment\n ie 11\n \nie 8 # sorry\n[test ]\nios 8"
|
8
|
-
processor = AutoprefixerRails::Processor.new
|
9
|
-
expect(processor.parse_config(config)).to eql({
|
10
|
-
"defaults" => ["ie 11", "ie 8"],
|
11
|
-
"test" => ["ios 8"]
|
12
|
-
})
|
13
|
-
end
|
14
|
-
|
15
|
-
context "without Rails" do
|
16
|
-
before do
|
17
|
-
hide_const("Rails")
|
18
|
-
end
|
19
|
-
|
20
|
-
it "doesn't raise error during processing" do
|
21
|
-
processor = AutoprefixerRails::Processor.new
|
22
|
-
expect do
|
23
|
-
processor.process("")
|
24
|
-
end.not_to raise_error
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/spec/rails_spec.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "spec_helper"
|
4
|
-
|
5
|
-
describe CssController, type: :controller do
|
6
|
-
before :all do
|
7
|
-
cache = Rails.root.join("tmp/cache")
|
8
|
-
cache.rmtree if cache.exist?
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_file(file)
|
12
|
-
if Rails.version.split(".").first.to_i >= 5
|
13
|
-
get :test, params: { file: file }
|
14
|
-
else
|
15
|
-
get :test, file: file
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
it "integrates with Rails and Sass" do
|
20
|
-
test_file "sass"
|
21
|
-
expect(response).to be_successful
|
22
|
-
clear_css = response.body.tr("\n", " ").squeeze(" ").strip
|
23
|
-
expect(clear_css).to eq "a{-webkit-mask:none;mask:none}"
|
24
|
-
end
|
25
|
-
|
26
|
-
if Sprockets::Context.instance_methods.include?(:evaluate)
|
27
|
-
it "supports evaluate" do
|
28
|
-
test_file "evaluate"
|
29
|
-
expect(response).to be_successful
|
30
|
-
clear_css = response.body.tr("\n", " ").squeeze(" ").strip
|
31
|
-
expect(clear_css).to eq "a { -webkit-mask: none; mask: none }"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "Rake task" do
|
37
|
-
it "shows debug" do
|
38
|
-
info = `cd spec/app; bundle exec rake autoprefixer:info`
|
39
|
-
expect(info).to match(/Browsers:\n Chrome: 25\n\n/)
|
40
|
-
expect(info).to match(/ transition: webkit/)
|
41
|
-
end
|
42
|
-
end
|
data/spec/railtie_spec.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "spec_helper"
|
4
|
-
|
5
|
-
describe AutoprefixedRails::Railtie do
|
6
|
-
before do
|
7
|
-
@railtie = AutoprefixedRails::Railtie.instance
|
8
|
-
end
|
9
|
-
|
10
|
-
context "with config/autoprefixer.yml" do
|
11
|
-
it "works" do
|
12
|
-
expect(@railtie.config).to eq(cascade: false, supports: false, env: "test")
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
context "with empty config/autoprefixer.yml" do
|
17
|
-
before do
|
18
|
-
file_path = File.join(Rails.application.root, "config/autoprefixer.yml")
|
19
|
-
allow(File).to receive(:exists?).with(file_path) { true }
|
20
|
-
allow(::YAML).to receive(:load_file).with(file_path) { false } # empty yaml
|
21
|
-
end
|
22
|
-
|
23
|
-
it "skips empty YAML" do
|
24
|
-
expect { @railtie.config }.not_to raise_error
|
25
|
-
end
|
26
|
-
|
27
|
-
it "works" do
|
28
|
-
expect(@railtie.config).to eq(env: "test")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
ENV["RAILS_ENV"] ||= "test"
|
4
|
-
|
5
|
-
require_relative "app/config/environment"
|
6
|
-
require "autoprefixer-rails"
|
7
|
-
|
8
|
-
require "rspec/rails"
|
9
|
-
|
10
|
-
warn "ExecJS runtime is #{ExecJS.runtime.class}"
|
11
|
-
|
12
|
-
RSpec.configure do |c|
|
13
|
-
c.filter_run_excluding not_jruby: RUBY_PLATFORM == "java"
|
14
|
-
end
|
15
|
-
|
16
|
-
def sprockets_4?
|
17
|
-
Gem::Version.new(Sprockets::VERSION) > Gem::Version.new("4.0.x")
|
18
|
-
end
|