autoprefixer-rails 10.0.0 → 10.0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0bcbf4411fbccba4c38dd7814bf1a297bd671a14a1ef186f11b9e54d84a5f1c
4
- data.tar.gz: 4c65857dae982cbfca2b57de9577318e4b93edf87d0c4df0cc8827cc4b95832d
3
+ metadata.gz: a9facf0c70f279ac8811eb4e39877339c7a9d815557aecd28d4c44f57ff4ab53
4
+ data.tar.gz: 0a70a32d654bdc2d56995b6e889e25a83ccfcc225bd710073e4f4e1d65891418
5
5
  SHA512:
6
- metadata.gz: 563d6c13644942c8f59714ce59b7dda56dadf6e1231953dadf3ac919681457ce62d062143f5c248381c7c3ce122cb272efb72e998dd631cd1b7657945c37dbb5
7
- data.tar.gz: 9acb3957ed1206307409122d7e368b47b45641a20308345a1ed7dda88e6f9daa56c9f1ed681443aa77e955c28bb5da29b9b16f96cd9c33e15625baf4b0cb6cc3
6
+ metadata.gz: ae1e918ec94c17ac98e23f23648c12d9121f2c826df52ff3ec6e9e67efe395ecf4dd1db85429e08c77383e60781fe0e873b21974951a62aaacd16bed75996483
7
+ data.tar.gz: 7eef7cce62e8a029eaf891aff1ccda96299f04c48128387c027ff0e5089ed89ef41407afc36ff0e0aa4a562d3383b38f668e04cba54c7c274b7d707c8d7339a7
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.0.0.1
4
+ * Improve error message for old environments.
5
+ * Reduce gem file size.
6
+
3
7
  ## 10.0 “Alis volat propriis”
4
8
  * Removed support for Node.js 6.x, 8.x, 11.x.
5
9
  * Moved to PostCSS 8.
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 6 and up and
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
- first = version.match(/^v(\d+)/)[1].to_i
145
- raise "Autoprefixer doesn’t support Node #{version}. Update it." if first < 6
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
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AutoprefixerRails # :nodoc:
4
- VERSION = "10.0.0" unless defined? AutoprefixerRails::VERSION
4
+ VERSION = "10.0.0.1" unless defined? AutoprefixerRails::VERSION
5
5
  end
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: []
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require File.expand_path("config/application", __dir__)
4
- App::Application.load_tasks
File without changes
@@ -1 +0,0 @@
1
- <%= evaluate 'test.css' %>
@@ -1,2 +0,0 @@
1
- a
2
- mask: none
@@ -1 +0,0 @@
1
- @import "loaded"
@@ -1,3 +0,0 @@
1
- a {
2
- mask: none
3
- }
@@ -1,2 +0,0 @@
1
- a {
2
- background: linear-gradient(top, white, black)
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationController < ActionController::Base
4
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CssController < ApplicationController
4
- def test
5
- file = params[:exact_file] || params[:file] + ".css"
6
- render plain: Rails.application.assets[file].to_s.gsub(/;(\s})/, '\1')
7
- end
8
- end
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("config/environment", __dir__)
4
- run App::Application
@@ -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
@@ -1,2 +0,0 @@
1
- supports: false
2
- cascade: false
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
4
- require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tzinfo"
4
- require File.expand_path("application", __dir__)
5
- App::Application.initialize!
@@ -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
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- App::Application.config.secret_key_base = "test"
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- App::Application.routes.draw do
4
- root to: "css#test"
5
- end
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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