autoprefixer-rails 9.6.5 → 10.2.5.1

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 +120 -0
  3. data/README.md +9 -8
  4. data/lib/autoprefixer-rails/processor.rb +43 -72
  5. data/lib/autoprefixer-rails/railtie.rb +11 -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 +20042 -63893
  12. metadata +37 -41
  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: 680449e585a1801eaffcff50b1a36e4ab44476c8e9109bba8673806ea72eb760
4
- data.tar.gz: f68169a9f0c8e0241ffcf85fa71c3e61c74c99666d0a82493d34a4276d3241e9
3
+ metadata.gz: 29b8d235ce74ce968864e158f5623304cba4ff368960ba5886c01945791ac44c
4
+ data.tar.gz: e952fe1fe4a672c01c013dc6f8a9a3a74efcd9eb88701a20c9a6c3af546b049a
5
5
  SHA512:
6
- metadata.gz: b08175a1998b9cd4d7cbb3ecaecff51db36dcd6cb308c4817d0fb8d7907b9fa09705369a64c39cebfb2ea4d16c41657632a109fee02dfc9fe65e29b3d757ebd8
7
- data.tar.gz: d121637b9ef955095366010a1df86f5772c0a0ffb133ba5936f9a740487487cf648f78f687057e095e331a315ec086464880d8b7c0fd217133ee0ec5a0e19e26
6
+ metadata.gz: ea458560e38a206504fb705e44efdd11a604297050ff9309c14e903e4729352709deb40d2a0d58ab78276e118d9e7b1f9e838023ea4353e67121d3e3d779f994
7
+ data.tar.gz: 338dafc90945de339a9e04ac0cbc41b6379497e67ad55d264c4977031262c4f4e154fa7ab49fa69517a96272454296cdea7264c9e244581d9e23baa0190b672f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,125 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.2.5.1
4
+ * Remvoe nodejs version check via ExecJS, to be compatible with 2.8.1 (#203)
5
+
6
+ ## 10.2.5.0
7
+ * Fixed `:` support in `@supports` (by Dmitry Semigradsky).
8
+ * Update Can I Use data.
9
+ * Lock to execjs < 2.8.0 for now (#203)
10
+
11
+ ## 10.2.4.0
12
+ * Fixed `transition-property` warnings (by @Sheraff).
13
+
14
+ ## 10.2.0.0 "Sub rosa"
15
+ * Added TypeScript definitions (by Dmitry Semigradsky).
16
+ * Fixed docs (by Florian Pellet).
17
+ * Update Can I Use data.
18
+ * Update postcss to 8.2.2
19
+
20
+ ## 10.1.0.0 "Pula"
21
+ * Fixed `Cannot read property 'proxyOf' of undefined` error (by Igor Kamyshev).
22
+ * Added `dpcm` unit support to `min-resolution: 2dppx` (by Robert Eisele).
23
+ * Fixed rational approximation in `min-resolution` (by Robert Eisele).
24
+
25
+ ## 10.0.3.0
26
+ * Fixed `substract` to `subtract` value for `mask-composite` (by Michelle Enos).
27
+ * Update Can I Use data
28
+
29
+ ## 10.0.2.0
30
+ * Removed -ms-user-select: all because IE and old Edge don’t support it.
31
+ * Fixed Grid Layout warning.
32
+ * Update Can I Use data
33
+
34
+ ## 10.0.1.3
35
+ * Fix `fileURL.replace is not a function` when reporting warnings (#194)
36
+
37
+ ## 10.0.1.2
38
+ * Workaround `existsSync not a function` (#193)
39
+
40
+ ## 10.0.1.1
41
+ * Update Can I Use data.
42
+ * Update postcss to 8.1.4
43
+ * Fix issue with source map (#190)
44
+
45
+ ## 10.0.1.0
46
+ * Update Can I Use data.
47
+ * Update autoprefixer to 10.0.1
48
+ * Update postcss to 8.1.1
49
+
50
+ ## 10.0.0.2
51
+ * Update postcss to 8.0.5
52
+ * Update browserslist & caniuse-lite
53
+
54
+ ## 10.0.0.1
55
+ * Improved error message for old environments.
56
+ * Reduced gem file size.
57
+
58
+ ## 10.0 “Alis volat propriis”
59
+ * Removed support for Node.js 6.x, 8.x, 11.x.
60
+ * Moved to PostCSS 8.
61
+
62
+ ## 9.8.6.5
63
+ * Fix `9.8.6.4` regression.
64
+
65
+ ## 9.8.6.4
66
+ * Remove deprecation warnings.
67
+
68
+ ## 9.8.6.3
69
+ * Fix deprecation warning for non-Rails environment.
70
+
71
+ ## 9.8.6.2
72
+ * Print deprecation warning only once.
73
+
74
+ ## 9.8.6.1
75
+ * Improve deprecated warnings.
76
+
77
+ ## 9.8.6
78
+ * Fixed `env` option.
79
+ * Added deprecation warning.
80
+
81
+ ## 9.8.5
82
+ * Improved Grid Layout warnings (by Daniel Tonon).
83
+
84
+ ## 9.8.4
85
+ * Reduce JS bundle size.
86
+
87
+ ## 9.8.3
88
+ * Update Can I Use data.
89
+
90
+ ## 9.8.2
91
+ * Update Can I Use data.
92
+
93
+ ## 9.8.1
94
+ * Replace `chalk` to `kleur` (by Luke Edwards).
95
+
96
+ ## 9.8 “Vigilo Confido”
97
+ * Add `:placeholder-shown` support (by Tanguy Krotoff).
98
+
99
+ ## 9.7.6
100
+ * Revert `-webkit-stretch` fix.
101
+
102
+ ## 9.7.5
103
+ * Fix `-webkit-stretch` support.
104
+ * Reduce gem file size.
105
+
106
+ ## 9.7.4
107
+ * Update Can I Use data.
108
+
109
+ ## 9.7.3
110
+ * Update Can I Use data.
111
+
112
+ ## 9.7.2
113
+ * Add `-ms-user-select: element` support.
114
+
115
+ ## 9.7.1
116
+ * Avoid unnecessary transitions in prefixed selectors (by Andrey Alexandrov).
117
+ * Fix `fit-content` for Firefox.
118
+
119
+ ## 9.7 “Ad Victoriam”
120
+ * Add `AUTOPREFIXER_GRID` env variable to enable Grid Layout polyfill for IE.
121
+ * Fix `Cannot read property 'grid' of undefined` error.
122
+
3
123
  ## 9.6.5
4
124
  * Fix selector prefixing (by Andrey Alexandrov).
5
125
 
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,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
 
@@ -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.6.5".freeze unless defined? AutoprefixerRails::VERSION
1
+ # frozen_string_literal: true
2
+
3
+ module AutoprefixerRails # :nodoc:
4
+ VERSION = "10.2.5.1" 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"