autoprefixer-rails 9.8.5 → 9.8.6.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: f5182124a6fefc07d412d82b244a521dd3094a1d7bc1bcd481156ea53d19082a
4
- data.tar.gz: 8efdba7a1317cd31cb68fd67ef782fa32e8ced7b208ac806f6d7af9c0e0bb3b2
3
+ metadata.gz: cadb9ae491291f76f95ea31d344dbdcfcdd29a474ad4db7dcdca7064f8321eae
4
+ data.tar.gz: 4f38f4eb249e131e20ada2b32e275d7cb7c714499e6d6dd3d54b0da7b8cc2b79
5
5
  SHA512:
6
- metadata.gz: ca048733118764ce88990487ceec91f39732a5ba6e84de4dbecc9bb2c9f306ebbb0296726c50582e0c3487d00a41870bd229365774dd605fecebdb284f57db67
7
- data.tar.gz: 0604ebbbd9e25c9cdca72ba0143f871a8df9eb211073de53d6864c5e276139601f26a47272d9458de8c6925431fc04f960d5a3c541ff29cad0f680b2ca5c43cc
6
+ metadata.gz: 78a5df87211a22455d97d2c513a92d362f4164b8af9e0f72b2034e4fadd55dae2bfb3c233405ee4e1bfa1933d71f2443ffcc7c4fbddbc1f77e0ba7bb25f62314
7
+ data.tar.gz: 9b7c1768d664eb7c0cd5f79fd65adc05fc1b00286227e1a2605914d7fe91a571854465ed4d888d36d6b3ea7319840387c16bfa0c4dc4caf0e3df66b02534d1fb
@@ -1,5 +1,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.8.6.1
4
+ * Improve deprecated warnings.
5
+
6
+ ## 9.8.6
7
+ * Fixed `env` option.
8
+ * Added deprecation warning.
9
+
3
10
  ## 9.8.5
4
11
  * Improved Grid Layout warnings (by Daniel Tonon).
5
12
 
data/README.md CHANGED
@@ -4,18 +4,22 @@
4
4
  src="http://postcss.github.io/autoprefixer/logo.svg"
5
5
  title="Autoprefixer logo by Anton Lovchikov">
6
6
 
7
+ **DEPECATED. [Migration Guide.]**
8
+
7
9
  [Autoprefixer] is a tool to parse CSS and add vendor prefixes to CSS rules
8
- using values from the [Can I Use] database. This gem provides Ruby and Ruby on Rails
9
- integration with this JavaScript tool.
10
+ using values from the [Can I Use] database. This gem provides Ruby
11
+ and Ruby on Rails integration with this JavaScript tool.
10
12
 
11
13
  <a href="https://evilmartians.com/?utm_source=autoprefixer-rails">
12
14
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
13
15
  </a>
14
16
 
15
- [Autoprefixer]: https://github.com/postcss/autoprefixer
16
- [Can I Use]: http://caniuse.com/
17
- [ci-img]: https://travis-ci.org/ai/autoprefixer-rails.svg
18
- [ci]: https://travis-ci.org/ai/autoprefixer-rails
17
+ [Migration Guide]: https://github.com/ai/autoprefixer-rails/wiki/Deprecated
18
+ [Autoprefixer]: https://github.com/postcss/autoprefixer
19
+ [Can I Use]: http://caniuse.com/
20
+ [PostCSS]: https://postcss.org/
21
+ [ci-img]: https://travis-ci.org/ai/autoprefixer-rails.svg
22
+ [ci]: https://travis-ci.org/ai/autoprefixer-rails
19
23
 
20
24
  ## Differences
21
25
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Ruby integration with Autoprefixer JS library, which parse CSS and adds
2
4
  # only actual prefixed
3
5
  module AutoprefixerRails
@@ -6,9 +8,7 @@ module AutoprefixerRails
6
8
  # Add prefixes to `css`. See `Processor#process` for options.
7
9
  def self.process(css, opts = {})
8
10
  params = {}
9
- if opts.key?(:overrideBrowserslist)
10
- params[:overrideBrowserslist] = opts.delete(:overrideBrowserslist)
11
- end
11
+ params[:overrideBrowserslist] = opts.delete(:overrideBrowserslist) if opts.key?(:overrideBrowserslist)
12
12
  params[:browsers] = opts.delete(:browsers) if opts.key?(:browsers)
13
13
  params[:cascade] = opts.delete(:cascade) if opts.key?(:cascade)
14
14
  params[:remove] = opts.delete(:remove) if opts.key?(:remove)
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "pathname"
2
4
  require "execjs"
3
5
  require "json"
4
6
 
5
- IS_SECTION = /^\s*\[(.+)\]\s*$/
7
+ IS_SECTION = /^\s*\[(.+)\]\s*$/.freeze
6
8
 
7
9
  module AutoprefixerRails
8
10
  # Ruby to JS wrapper for Autoprefixer processor instance
@@ -18,6 +20,12 @@ module AutoprefixerRails
18
20
  # * `to` with output CSS file name.
19
21
  # * `map` with true to generate new source map or with previous map.
20
22
  def process(css, opts = {})
23
+ if defined?(ActiveSupport::Deprecation)
24
+ ActiveSupport::Deprecation.warn(
25
+ "autoprefixer-rails was deprected. Migration guide:\n" \
26
+ "https://github.com/ai/autoprefixer-rails/wiki/Deprecated"
27
+ )
28
+ end
21
29
  opts = convert_options(opts)
22
30
 
23
31
  apply_wrapper =
@@ -29,7 +37,7 @@ module AutoprefixerRails
29
37
  process_opts = {
30
38
  from: plugin_opts.delete(:from),
31
39
  to: plugin_opts.delete(:to),
32
- map: plugin_opts.delete(:map),
40
+ map: plugin_opts.delete(:map)
33
41
  }
34
42
 
35
43
  begin
@@ -56,13 +64,13 @@ module AutoprefixerRails
56
64
 
57
65
  # Parse Browserslist config
58
66
  def parse_config(config)
59
- sections = {"defaults" => []}
67
+ sections = { "defaults" => [] }
60
68
  current = "defaults"
61
69
  config.gsub(/#[^\n]*/, "")
62
- .split(/\n/)
63
- .map(&:strip)
64
- .reject(&:empty?)
65
- .each do |line|
70
+ .split(/\n/)
71
+ .map(&:strip)
72
+ .reject(&:empty?)
73
+ .each do |line|
66
74
  if IS_SECTION =~ line
67
75
  current = line.match(IS_SECTION)[1].strip
68
76
  sections[current] ||= []
@@ -77,10 +85,10 @@ module AutoprefixerRails
77
85
 
78
86
  def params_with_browsers(from = nil)
79
87
  from ||= if defined?(Rails) && Rails.respond_to?(:root) && Rails.root
80
- Rails.root.join("app/assets/stylesheets").to_s
81
- else
82
- "."
83
- end
88
+ Rails.root.join("app/assets/stylesheets").to_s
89
+ else
90
+ "."
91
+ end
84
92
 
85
93
  params = @params
86
94
  if !params.key?(:browsers) && !params.key?(:overrideBrowserslist) && from
@@ -99,7 +107,7 @@ module AutoprefixerRails
99
107
  # Convert params to JS string and add browsers from Browserslist config
100
108
  def js_params
101
109
  "{ " +
102
- params_with_browsers.map { |k, v| "#{k}: #{v.inspect}"}.join(", ") +
110
+ params_with_browsers.map { |k, v| "#{k}: #{v.inspect}" }.join(", ") +
103
111
  " }"
104
112
  end
105
113
 
@@ -152,9 +160,7 @@ module AutoprefixerRails
152
160
  if ExecJS.runtime == ExecJS::Runtimes::Node
153
161
  version = ExecJS.runtime.eval("process.version")
154
162
  first = version.match(/^v(\d+)/)[1].to_i
155
- if first < 6
156
- raise "Autoprefixer doesn’t support Node #{version}. Update it."
157
- end
163
+ raise "Autoprefixer doesn’t support Node #{version}. Update it." if first < 6
158
164
  end
159
165
 
160
166
  ExecJS.compile(build_js)
@@ -163,7 +169,7 @@ module AutoprefixerRails
163
169
 
164
170
  # Cache autoprefixer.js content
165
171
  def read_js
166
- @@js ||= begin
172
+ @read_js ||= begin
167
173
  root = Pathname(File.dirname(__FILE__))
168
174
  path = root.join("../../vendor/autoprefixer.js")
169
175
  path.read
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "yaml"
2
4
 
3
5
  begin
4
6
  module AutoprefixedRails
5
- class Railtie < ::Rails::Railtie
7
+ class Railtie < ::Rails::Railtie # :nodoc:
6
8
  rake_tasks do |app|
7
9
  require "rake/autoprefixer_tasks"
8
10
  Rake::AutoprefixerTasks.new(config) if defined? app.assets
@@ -14,9 +16,7 @@ begin
14
16
  end
15
17
  else
16
18
  initializer :setup_autoprefixer, group: :all do |app|
17
- if defined?(app.assets) && !app.assets.nil?
18
- AutoprefixerRails.install(app.assets, config)
19
- end
19
+ AutoprefixerRails.install(app.assets, config) if defined?(app.assets) && !app.assets.nil?
20
20
  end
21
21
  end
22
22
 
@@ -27,13 +27,14 @@ begin
27
27
  roots.each do |root|
28
28
  file = File.join(root, "config/autoprefixer.yml")
29
29
 
30
- if File.exist?(file)
31
- parsed = ::YAML.load_file(file)
32
- next unless parsed
33
- params = parsed
30
+ next unless File.exist?(file)
31
+
32
+ parsed = ::YAML.load_file(file)
33
+ next unless parsed
34
+
35
+ params = parsed
34
36
 
35
- break
36
- end
37
+ break
37
38
  end
38
39
 
39
40
  params = params.symbolize_keys
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AutoprefixerRails
2
4
  # Container of prefixed CSS and source map with changes
3
5
  class Result
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "pathname"
2
4
 
3
5
  module AutoprefixerRails
@@ -30,10 +32,10 @@ module AutoprefixerRails
30
32
  def self.install(env)
31
33
  if ::Sprockets::VERSION.to_f < 4
32
34
  env.register_postprocessor("text/css",
33
- ::AutoprefixerRails::Sprockets)
35
+ ::AutoprefixerRails::Sprockets)
34
36
  else
35
37
  env.register_bundle_processor("text/css",
36
- ::AutoprefixerRails::Sprockets)
38
+ ::AutoprefixerRails::Sprockets)
37
39
  end
38
40
  end
39
41
 
@@ -41,10 +43,10 @@ module AutoprefixerRails
41
43
  def self.uninstall(env)
42
44
  if ::Sprockets::VERSION.to_f < 4
43
45
  env.unregister_postprocessor("text/css",
44
- ::AutoprefixerRails::Sprockets)
46
+ ::AutoprefixerRails::Sprockets)
45
47
  else
46
48
  env.unregister_bundle_processor("text/css",
47
- ::AutoprefixerRails::Sprockets)
49
+ ::AutoprefixerRails::Sprockets)
48
50
  end
49
51
  end
50
52
 
@@ -1,3 +1,5 @@
1
- module AutoprefixerRails
2
- VERSION = "9.8.5".freeze unless defined? AutoprefixerRails::VERSION
1
+ # frozen_string_literal: true
2
+
3
+ module AutoprefixerRails # :nodoc:
4
+ VERSION = "9.8.6.1" unless defined? AutoprefixerRails::VERSION
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rake"
2
4
  require "rake/tasklib"
3
5
  require "autoprefixer-rails"
@@ -1,2 +1,4 @@
1
- require File.expand_path("../config/application", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("config/application", __dir__)
2
4
  App::Application.load_tasks
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ApplicationController < ActionController::Base
2
4
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class CssController < ApplicationController
2
4
  def test
3
5
  file = params[:exact_file] || params[:file] + ".css"
@@ -1,2 +1,4 @@
1
- require ::File.expand_path("../config/environment", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require ::File.expand_path("config/environment", __dir__)
2
4
  run App::Application
@@ -1,11 +1,11 @@
1
- require File.expand_path("../boot", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("boot", __dir__)
2
4
 
3
5
  require "action_controller/railtie"
4
6
  require "sprockets/railtie"
5
7
 
6
- if defined?(Bundler)
7
- Bundler.require(*Rails.groups(assets: %w[development test]))
8
- end
8
+ Bundler.require(*Rails.groups(assets: %w[development test])) if defined?(Bundler)
9
9
 
10
10
  module App
11
11
  class Application < Rails::Application
@@ -1,2 +1,4 @@
1
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
2
4
  require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "tzinfo"
2
- require File.expand_path("../application", __FILE__)
4
+ require File.expand_path("application", __dir__)
3
5
  App::Application.initialize!
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  App::Application.configure do
2
4
  config.cache_classes = true
3
5
  config.eager_load = false
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  App::Application.config.secret_key_base = "test"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  App::Application.routes.draw do
2
4
  root to: "css#test"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "spec_helper"
2
4
 
3
5
  describe AutoprefixerRails do
@@ -42,26 +44,26 @@ describe AutoprefixerRails do
42
44
  end
43
45
 
44
46
  it "generates separated source map" do
45
- result = AutoprefixerRails.process(@css, map: {inline: false})
47
+ result = AutoprefixerRails.process(@css, map: { inline: false })
46
48
  expect(result.map).to be_a(String)
47
49
  end
48
50
 
49
51
  it "uses file name in syntax errors", not_jruby: true do
50
- expect {
52
+ expect do
51
53
  AutoprefixerRails.process("a {", from: "a.css")
52
- }.to raise_error(/a.css:/)
54
+ end.to raise_error(/a.css:/)
53
55
  end
54
56
 
55
57
  it "includes sourcesContent by default" do
56
- map = AutoprefixerRails.process("a{}", map: {inline: false}).map
58
+ map = AutoprefixerRails.process("a{}", map: { inline: false }).map
57
59
  expect(map).to include("sourcesContent")
58
60
  end
59
61
 
60
62
  it "maps options from Ruby style" do
61
63
  map = AutoprefixerRails.process("a{}", map: {
62
- sources_content: false,
63
- inline: false,
64
- }).map
64
+ sources_content: false,
65
+ inline: false
66
+ }).map
65
67
 
66
68
  expect(map).not_to include("sourcesContent")
67
69
  end
@@ -86,9 +88,9 @@ describe AutoprefixerRails do
86
88
  end
87
89
 
88
90
  it "shows correct error on country statistics" do
89
- expect {
91
+ expect do
90
92
  AutoprefixerRails.process("", overrideBrowserslist: "> 1% in US")
91
- }.to raise_error(/Use Autoprefixer with webpack/)
93
+ end.to raise_error(/Use Autoprefixer with webpack/)
92
94
  end
93
95
 
94
96
  context "Sprockets" do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "spec_helper"
2
4
 
3
5
  describe AutoprefixerRails::Processor do
@@ -5,9 +7,9 @@ describe AutoprefixerRails::Processor do
5
7
  config = "# Comment\n ie 11\n \nie 8 # sorry\n[test ]\nios 8"
6
8
  processor = AutoprefixerRails::Processor.new
7
9
  expect(processor.parse_config(config)).to eql({
8
- "defaults" => ["ie 11", "ie 8"],
9
- "test" => ["ios 8"],
10
- })
10
+ "defaults" => ["ie 11", "ie 8"],
11
+ "test" => ["ios 8"]
12
+ })
11
13
  end
12
14
 
13
15
  context "without Rails" do
@@ -17,9 +19,9 @@ describe AutoprefixerRails::Processor do
17
19
 
18
20
  it "doesn't raise error during processing" do
19
21
  processor = AutoprefixerRails::Processor.new
20
- expect {
22
+ expect do
21
23
  processor.process("")
22
- }.not_to raise_error
24
+ end.not_to raise_error
23
25
  end
24
26
  end
25
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "spec_helper"
2
4
 
3
5
  describe CssController, type: :controller do
@@ -8,7 +10,7 @@ describe CssController, type: :controller do
8
10
 
9
11
  def test_file(file)
10
12
  if Rails.version.split(".").first.to_i >= 5
11
- get :test, params: {file: file}
13
+ get :test, params: { file: file }
12
14
  else
13
15
  get :test, file: file
14
16
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "spec_helper"
2
4
 
3
5
  describe AutoprefixedRails::Railtie do
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ENV["RAILS_ENV"] ||= "test"
2
4
 
3
5
  require_relative "app/config/environment"
4
- require_relative "../lib/autoprefixer-rails"
6
+ require "autoprefixer-rails"
5
7
 
6
8
  require "rspec/rails"
7
9
 
8
- STDERR.puts "ExecJS runtime is #{ExecJS.runtime.class}"
10
+ warn "ExecJS runtime is #{ExecJS.runtime.class}"
9
11
 
10
12
  RSpec.configure do |c|
11
13
  c.filter_run_excluding not_jruby: RUBY_PLATFORM == "java"