autoprefixer-rails 9.7.4 → 10.4.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +125 -0
  3. data/README.md +9 -8
  4. data/lib/autoprefixer-rails/processor.rb +43 -72
  5. data/lib/autoprefixer-rails/railtie.rb +15 -10
  6. data/lib/autoprefixer-rails/result.rb +2 -0
  7. data/lib/autoprefixer-rails/sprockets.rb +7 -5
  8. data/lib/autoprefixer-rails/version.rb +4 -2
  9. data/lib/autoprefixer-rails.rb +3 -3
  10. data/lib/rake/autoprefixer_tasks.rb +2 -0
  11. data/vendor/autoprefixer.js +72746 -63400
  12. metadata +39 -43
  13. data/.github/FUNDING.yml +0 -1
  14. data/.gitignore +0 -7
  15. data/.rspec +0 -1
  16. data/.standard.yml +0 -1
  17. data/.travis.yml +0 -13
  18. data/Gemfile +0 -10
  19. data/Rakefile +0 -53
  20. data/autoprefixer-rails.gemspec +0 -32
  21. data/spec/app/.browserslistrc +0 -4
  22. data/spec/app/.gitignore +0 -2
  23. data/spec/app/Rakefile +0 -2
  24. data/spec/app/app/assets/config/manifest.js +0 -0
  25. data/spec/app/app/assets/stylesheets/evaluate.css.erb +0 -1
  26. data/spec/app/app/assets/stylesheets/loaded.sass +0 -2
  27. data/spec/app/app/assets/stylesheets/sass.sass +0 -1
  28. data/spec/app/app/assets/stylesheets/test.css +0 -3
  29. data/spec/app/app/assets/stylesheets/wrong.css +0 -2
  30. data/spec/app/app/controllers/application_controller.rb +0 -2
  31. data/spec/app/app/controllers/css_controller.rb +0 -6
  32. data/spec/app/config/application.rb +0 -16
  33. data/spec/app/config/autoprefixer.yml +0 -2
  34. data/spec/app/config/boot.rb +0 -2
  35. data/spec/app/config/environment.rb +0 -3
  36. data/spec/app/config/environments/test.rb +0 -9
  37. data/spec/app/config/initializers/secret_token.rb +0 -1
  38. data/spec/app/config/routes.rb +0 -3
  39. data/spec/app/config.ru +0 -2
  40. data/spec/autoprefixer_spec.rb +0 -121
  41. data/spec/processor_spec.rb +0 -25
  42. data/spec/rails_spec.rb +0 -40
  43. data/spec/railtie_spec.rb +0 -29
  44. data/spec/spec_helper.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af8453a9b45b8ea83b29dc6d6179b8e7408fa4e3aa12731c2bded76696e17498
4
- data.tar.gz: 59ee01fc377e736656cd0315268eeb3021075363f7bad869b480fb11e269088f
3
+ metadata.gz: daede92299c67ff8e569b081e8f75e2e7fc50934936115605a38e419a064a39e
4
+ data.tar.gz: 2d7a5fb04f55ed57881af6aa7ce444d47b9477a25345392c37aaa5c1b425a13f
5
5
  SHA512:
6
- metadata.gz: d5ea9830ef761465d7a6cb7fe0419f559e61a35220b37d412d1cd91e91b6f53b9adf7fb70c609f95c5132b0d21eb54c55ec35d02b946af6a528151ca44e850e9
7
- data.tar.gz: 677d32bcea02d71cfec60b36d4c1ac377f3caea7620d3f6f25a9222f0be0ff3c17de3087cf7bc10c79ecd6b52696b2505b4fd77482be49e2bc7a245a9ee9e734
6
+ metadata.gz: 142859085b4dc649f41122a083d18272dceb2b64e44652499f6a4152d959fce0c90980e67706c053ba11a3592a54809f851ac283ee33af239a3579ef2cfb31f7
7
+ data.tar.gz: 63e283ec2cfa1ddf8ce75a840c786404f6c29a85eb8d78dfa3d164799a2527717487debdf2245abb1f6129ee3b87e28af8ec423cfd44df4a1f30936e110d6df1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,130 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.4.7.0
4
+ * Fixed `print-color-adjust` support in Firefox.
5
+ * Fixed `print-color-adjust` support.
6
+ * Fixed `NaN` in grid (by @SukkaW).
7
+
8
+ ## 10.4.2.0
9
+ * Fixed missed `-webkit-` prefix for `width: stretch`.
10
+ * Fixed `::file-selector-button` data (by Luke Warlow).
11
+ * Ensure sprockets-rails is loaded before autoprefixer-rails (by Thomas Morgan)
12
+
13
+ ## 10.4.0.0
14
+ * Added `:autofill` support (by Luke Warlow).
15
+
16
+ ## 10.3.3.0
17
+ * Fixed `::file-selector-button` support (by Usman Yunusov).
18
+ * Fixed wrong `-moz-` prefix from `::file-selector-button` (by Usman Yunusov).
19
+
20
+ ## 10.3.1.0
21
+ * Added `::file-selector-button` support (by Luke Warlow).
22
+ * Fixed adding wrong prefixes to `content` (by Luke Warlow).
23
+ * Fix `ReferenceError: Can't find variable: URL` (#213)
24
+
25
+ ## 10.2.5.1
26
+ * Remove nodejs version check via ExecJS, to be compatible with 2.8.1 (#203)
27
+
28
+ ## 10.2.5.0
29
+ * Fixed `:` support in `@supports` (by Dmitry Semigradsky).
30
+ * Update Can I Use data.
31
+ * Lock to execjs < 2.8.0 for now (#203)
32
+
33
+ ## 10.2.4.0
34
+ * Fixed `transition-property` warnings (by @Sheraff).
35
+
36
+ ## 10.2.0.0 "Sub rosa"
37
+ * Added TypeScript definitions (by Dmitry Semigradsky).
38
+ * Fixed docs (by Florian Pellet).
39
+ * Update Can I Use data.
40
+ * Update postcss to 8.2.2
41
+
42
+ ## 10.1.0.0 "Pula"
43
+ * Fixed `Cannot read property 'proxyOf' of undefined` error (by Igor Kamyshev).
44
+ * Added `dpcm` unit support to `min-resolution: 2dppx` (by Robert Eisele).
45
+ * Fixed rational approximation in `min-resolution` (by Robert Eisele).
46
+
47
+ ## 10.0.3.0
48
+ * Fixed `substract` to `subtract` value for `mask-composite` (by Michelle Enos).
49
+ * Update Can I Use data
50
+
51
+ ## 10.0.2.0
52
+ * Removed -ms-user-select: all because IE and old Edge don’t support it.
53
+ * Fixed Grid Layout warning.
54
+ * Update Can I Use data
55
+
56
+ ## 10.0.1.3
57
+ * Fix `fileURL.replace is not a function` when reporting warnings (#194)
58
+
59
+ ## 10.0.1.2
60
+ * Workaround `existsSync not a function` (#193)
61
+
62
+ ## 10.0.1.1
63
+ * Update Can I Use data.
64
+ * Update postcss to 8.1.4
65
+ * Fix issue with source map (#190)
66
+
67
+ ## 10.0.1.0
68
+ * Update Can I Use data.
69
+ * Update autoprefixer to 10.0.1
70
+ * Update postcss to 8.1.1
71
+
72
+ ## 10.0.0.2
73
+ * Update postcss to 8.0.5
74
+ * Update browserslist & caniuse-lite
75
+
76
+ ## 10.0.0.1
77
+ * Improved error message for old environments.
78
+ * Reduced gem file size.
79
+
80
+ ## 10.0 “Alis volat propriis”
81
+ * Removed support for Node.js 6.x, 8.x, 11.x.
82
+ * Moved to PostCSS 8.
83
+
84
+ ## 9.8.6.5
85
+ * Fix `9.8.6.4` regression.
86
+
87
+ ## 9.8.6.4
88
+ * Remove deprecation warnings.
89
+
90
+ ## 9.8.6.3
91
+ * Fix deprecation warning for non-Rails environment.
92
+
93
+ ## 9.8.6.2
94
+ * Print deprecation warning only once.
95
+
96
+ ## 9.8.6.1
97
+ * Improve deprecated warnings.
98
+
99
+ ## 9.8.6
100
+ * Fixed `env` option.
101
+ * Added deprecation warning.
102
+
103
+ ## 9.8.5
104
+ * Improved Grid Layout warnings (by Daniel Tonon).
105
+
106
+ ## 9.8.4
107
+ * Reduce JS bundle size.
108
+
109
+ ## 9.8.3
110
+ * Update Can I Use data.
111
+
112
+ ## 9.8.2
113
+ * Update Can I Use data.
114
+
115
+ ## 9.8.1
116
+ * Replace `chalk` to `kleur` (by Luke Edwards).
117
+
118
+ ## 9.8 “Vigilo Confido”
119
+ * Add `:placeholder-shown` support (by Tanguy Krotoff).
120
+
121
+ ## 9.7.6
122
+ * Revert `-webkit-stretch` fix.
123
+
124
+ ## 9.7.5
125
+ * Fix `-webkit-stretch` support.
126
+ * Reduce gem file size.
127
+
3
128
  ## 9.7.4
4
129
  * Update Can I Use data.
5
130
 
data/README.md CHANGED
@@ -5,17 +5,18 @@
5
5
  title="Autoprefixer logo by Anton Lovchikov">
6
6
 
7
7
  [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.
8
+ using values from the [Can I Use] database. This gem provides Ruby
9
+ and Ruby on Rails integration with this JavaScript tool.
10
10
 
11
11
  <a href="https://evilmartians.com/?utm_source=autoprefixer-rails">
12
12
  <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54">
13
13
  </a>
14
14
 
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
15
+ [Autoprefixer]: https://github.com/postcss/autoprefixer
16
+ [Can I Use]: http://caniuse.com/
17
+ [PostCSS]: https://postcss.org/
18
+ [ci-img]: https://travis-ci.org/ai/autoprefixer-rails.svg
19
+ [ci]: https://travis-ci.org/ai/autoprefixer-rails
19
20
 
20
21
  ## Differences
21
22
 
@@ -32,8 +33,8 @@ Windows users should install [Node.js]. Autoprefixer Rails doesn’t work with
32
33
  old JScript in Windows.
33
34
 
34
35
  Autoprefixer Rails uses [ExecJS] that will use the best available JavaScript
35
- runtime. Currently this gem is tested to work with Node.js version 6 and up and
36
- 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].
37
38
 
38
39
  [Node.js]: http://nodejs.org/
39
40
  [ExecJS]: https://github.com/rails/execjs
@@ -1,12 +1,16 @@
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
9
11
  class Processor
12
+ SUPPORTED_RUNTIMES = [ExecJS::Runtimes::Node, ExecJS::Runtimes::MiniRacer]
13
+
10
14
  def initialize(params = {})
11
15
  @params = params || {}
12
16
  end
@@ -20,23 +24,18 @@ module AutoprefixerRails
20
24
  def process(css, opts = {})
21
25
  opts = convert_options(opts)
22
26
 
23
- apply_wrapper =
24
- "(function(opts, pluginOpts) {" \
25
- "return eval(process.apply(this, opts, pluginOpts));" \
26
- "})"
27
-
28
27
  plugin_opts = params_with_browsers(opts[:from]).merge(opts)
29
28
  process_opts = {
30
29
  from: plugin_opts.delete(:from),
31
30
  to: plugin_opts.delete(:to),
32
- map: plugin_opts.delete(:map),
31
+ map: plugin_opts.delete(:map)
33
32
  }
34
33
 
35
34
  begin
36
- result = runtime.call(apply_wrapper, [css, process_opts, plugin_opts])
35
+ result = runtime.call("autoprefixer.process", css, process_opts, plugin_opts)
37
36
  rescue ExecJS::ProgramError => e
38
37
  contry_error = "BrowserslistError: " \
39
- "Country statistics is not supported " \
38
+ "Country statistics are not supported " \
40
39
  "in client-side build of Browserslist"
41
40
  if e.message == contry_error
42
41
  raise "Country statistics is not supported in AutoprefixerRails. " \
@@ -51,18 +50,18 @@ module AutoprefixerRails
51
50
 
52
51
  # Return, which browsers and prefixes will be used
53
52
  def info
54
- runtime.eval("autoprefixer(#{js_params}).info()")
53
+ runtime.call("autoprefixer.info", params_with_browsers)
55
54
  end
56
55
 
57
56
  # Parse Browserslist config
58
57
  def parse_config(config)
59
- sections = {"defaults" => []}
58
+ sections = { "defaults" => [] }
60
59
  current = "defaults"
61
60
  config.gsub(/#[^\n]*/, "")
62
- .split(/\n/)
63
- .map(&:strip)
64
- .reject(&:empty?)
65
- .each do |line|
61
+ .split(/\n/)
62
+ .map(&:strip)
63
+ .reject(&:empty?)
64
+ .each do |line|
66
65
  if IS_SECTION =~ line
67
66
  current = line.match(IS_SECTION)[1].strip
68
67
  sections[current] ||= []
@@ -77,10 +76,10 @@ module AutoprefixerRails
77
76
 
78
77
  def params_with_browsers(from = nil)
79
78
  from ||= if defined?(Rails) && Rails.respond_to?(:root) && Rails.root
80
- Rails.root.join("app/assets/stylesheets").to_s
81
- else
82
- "."
83
- end
79
+ Rails.root.join("app/assets/stylesheets").to_s
80
+ else
81
+ "."
82
+ end
84
83
 
85
84
  params = @params
86
85
  if !params.key?(:browsers) && !params.key?(:overrideBrowserslist) && from
@@ -96,13 +95,6 @@ module AutoprefixerRails
96
95
  params
97
96
  end
98
97
 
99
- # Convert params to JS string and add browsers from Browserslist config
100
- def js_params
101
- "{ " +
102
- params_with_browsers.map { |k, v| "#{k}: #{v.inspect}"}.join(", ") +
103
- " }"
104
- end
105
-
106
98
  # Convert ruby_options to jsOptions
107
99
  def convert_options(opts)
108
100
  converted = {}
@@ -138,57 +130,36 @@ module AutoprefixerRails
138
130
  # Lazy load for JS library
139
131
  def runtime
140
132
  @runtime ||= begin
141
- if ExecJS.eval("typeof Uint8Array") != "function"
142
- if ExecJS.runtime.name.start_with?("therubyracer")
143
- raise "ExecJS::RubyRacerRuntime is not supported. " \
144
- "Please replace therubyracer with mini_racer " \
145
- "in your Gemfile or use Node.js as ExecJS runtime."
146
- else
147
- raise "#{ExecJS.runtime.name} runtime does’t support ES6. " \
148
- "Please update or replace your current ExecJS runtime."
149
- end
150
- end
151
-
152
- if ExecJS.runtime == ExecJS::Runtimes::Node
153
- version = ExecJS.runtime.eval("process.version")
154
- first = version.match(/^v(\d+)/)[1].to_i
155
- if first < 6
156
- raise "Autoprefixer doesn’t support Node #{version}. Update it."
157
- end
158
- end
159
-
160
133
  ExecJS.compile(build_js)
134
+ rescue ExecJS::RuntimeError
135
+ # Only complain about unsupported runtimes when it failed to parse our script.
136
+
137
+ case ExecJS.runtime
138
+ when ExecJS::Runtimes::Node
139
+ node_command = ExecJS.runtime.send(:binary) rescue "Unknown"
140
+
141
+ raise <<~MSG
142
+ Your nodejs binary failed to load autoprefixer script file,
143
+ please check if you're running a supported version (10, 12, 14+)
144
+
145
+ ENV["PATH"] = #{ENV["PATH"]}
146
+ binary = #{node_command}
147
+ MSG
148
+ when *SUPPORTED_RUNTIMES
149
+ raise
150
+ else
151
+ raise <<~MSG
152
+ Your ExecJS runtime #{ExecJS.runtime.name} isn't supported by autoprefixer-rails,
153
+ please switch to #{SUPPORTED_RUNTIMES.map(&:name).join(' or ')}
154
+ MSG
155
+ end
161
156
  end
162
157
  end
163
158
 
164
- # Cache autoprefixer.js content
165
- def read_js
166
- @@js ||= begin
167
- root = Pathname(File.dirname(__FILE__))
168
- path = root.join("../../vendor/autoprefixer.js")
169
- path.read
170
- end
171
- end
172
-
173
- # Return processor JS with some extra methods
174
159
  def build_js
175
- "var global = this;" + read_js + process_proxy
176
- end
177
-
178
- # Return JS code for process method proxy
179
- def process_proxy
180
- <<-JS
181
- var processor;
182
- var process = function() {
183
- var result = autoprefixer.process.apply(autoprefixer, arguments);
184
- var warns = result.warnings().map(function (i) {
185
- delete i.plugin;
186
- return i.toString();
187
- });
188
- var map = result.map ? result.map.toString() : null;
189
- return { css: result.css, map: map, warnings: warns };
190
- };
191
- JS
160
+ root = Pathname(File.dirname(__FILE__))
161
+ path = root.join("../../vendor/autoprefixer.js")
162
+ path.read
192
163
  end
193
164
  end
194
165
  end
@@ -1,8 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "yaml"
4
+ begin
5
+ require "sprockets/railtie"
6
+ rescue LoadError
7
+ end
2
8
 
3
9
  begin
4
10
  module AutoprefixedRails
5
- class Railtie < ::Rails::Railtie
11
+ class Railtie < ::Rails::Railtie # :nodoc:
6
12
  rake_tasks do |app|
7
13
  require "rake/autoprefixer_tasks"
8
14
  Rake::AutoprefixerTasks.new(config) if defined? app.assets
@@ -14,9 +20,7 @@ begin
14
20
  end
15
21
  else
16
22
  initializer :setup_autoprefixer, group: :all do |app|
17
- if defined?(app.assets) && !app.assets.nil?
18
- AutoprefixerRails.install(app.assets, config)
19
- end
23
+ AutoprefixerRails.install(app.assets, config) if defined?(app.assets) && !app.assets.nil?
20
24
  end
21
25
  end
22
26
 
@@ -27,13 +31,14 @@ begin
27
31
  roots.each do |root|
28
32
  file = File.join(root, "config/autoprefixer.yml")
29
33
 
30
- if File.exist?(file)
31
- parsed = ::YAML.load_file(file)
32
- next unless parsed
33
- params = parsed
34
+ next unless File.exist?(file)
35
+
36
+ parsed = ::YAML.load_file(file)
37
+ next unless parsed
38
+
39
+ params = parsed
34
40
 
35
- break
36
- end
41
+ break
37
42
  end
38
43
 
39
44
  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
 
@@ -55,7 +57,7 @@ module AutoprefixerRails
55
57
  end
56
58
 
57
59
  # Sprockets 2 API new and render
58
- def render(_, _)
60
+ def render(*)
59
61
  self.class.run(@filename, @source)
60
62
  end
61
63
  end
@@ -1,3 +1,5 @@
1
- module AutoprefixerRails
2
- VERSION = "9.7.4".freeze unless defined? AutoprefixerRails::VERSION
1
+ # frozen_string_literal: true
2
+
3
+ module AutoprefixerRails # :nodoc:
4
+ VERSION = "10.4.7.0" unless defined? AutoprefixerRails::VERSION
3
5
  end
@@ -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,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rake"
2
4
  require "rake/tasklib"
3
5
  require "autoprefixer-rails"