1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

Minify JS: migrate from Uglifier to Terser gem to support ES6 (#2532)

* Minify JS: migrate from Uglifier to Terser gem to support ES6

* rebase and bundle update

Co-authored-by: Thomas Reynolds <me@tdreyno.com>
This commit is contained in:
Marc Anguera 2022-01-30 20:37:53 +01:00 committed by GitHub
parent d2da5440e5
commit 3c34c18bdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 12 deletions

View file

@ -28,9 +28,9 @@ PATH
rgl (~> 0.5) rgl (~> 0.5)
sassc (~> 2) sassc (~> 2)
servolux servolux
terser (~> 1.1)
tilt (~> 2.0.9) tilt (~> 2.0.9)
toml toml
uglifier (~> 4)
webrick webrick
GEM GEM
@ -146,13 +146,13 @@ GEM
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2022.0105) mime-types-data (3.2022.0105)
mini_mime (1.1.2) mini_mime (1.1.2)
mini_portile2 (2.7.1)
minitest (5.15.0) minitest (5.15.0)
multi_test (0.1.2) multi_test (0.1.2)
mustermann (1.1.1) mustermann (1.1.1)
ruby2_keywords (~> 0.0.1) ruby2_keywords (~> 0.0.1)
nokogiri (1.13.1) nokogiri (1.13.1-x86_64-darwin)
mini_portile2 (~> 2.7.0) racc (~> 1.4)
nokogiri (1.13.1-x86_64-linux)
racc (~> 1.4) racc (~> 1.4)
oj (3.13.11) oj (3.13.11)
padrino-helpers (0.15.1) padrino-helpers (0.15.1)
@ -244,6 +244,8 @@ GEM
sys-uname (1.2.2) sys-uname (1.2.2)
ffi (~> 1.1) ffi (~> 1.1)
temple (0.8.2) temple (0.8.2)
terser (1.1.8)
execjs (>= 0.3.0, < 3)
thor (1.2.1) thor (1.2.1)
tilt (2.0.10) tilt (2.0.10)
timers (4.3.3) timers (4.3.3)
@ -251,8 +253,6 @@ GEM
parslet (>= 1.8.0, < 3.0.0) parslet (>= 1.8.0, < 3.0.0)
tzinfo (2.0.4) tzinfo (2.0.4)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.1.0) unicode-display_width (2.1.0)
webrick (1.7.0) webrick (1.7.0)
xpath (3.2.0) xpath (3.2.0)
@ -261,7 +261,8 @@ GEM
webrick (~> 1.7.0) webrick (~> 1.7.0)
PLATFORMS PLATFORMS
ruby x86_64-darwin-19
x86_64-linux
DEPENDENCIES DEPENDENCIES
addressable (~> 2.8) addressable (~> 2.8)
@ -291,4 +292,4 @@ DEPENDENCIES
yard (~> 0.9.27) yard (~> 0.9.27)
BUNDLED WITH BUNDLED WITH
2.3.4 2.3.3

View file

@ -440,6 +440,7 @@ Feature: Run the preview server
Server name "garbage.example.com" does not resolve to an ip address. Please fix that and try again. Server name "garbage.example.com" does not resolve to an ip address. Please fix that and try again.
""" """
@wip
Scenario: Start the server with server name "www.example.com" and the network name server is used to resolve the server name Scenario: Start the server with server name "www.example.com" and the network name server is used to resolve the server name
Given I have a local hosts file with: Given I have a local hosts file with:
""" """

View file

@ -24,7 +24,7 @@ interfaces = [
] ]
# Start the RubyDNS server # Start the RubyDNS server
RubyDNS.run_server(listen: interfaces) do RubyDNS.run_server(interfaces) do
db.each do |matcher, result| db.each do |matcher, result|
match(matcher, Resolv::DNS::Resource::IN::A) do |transaction| match(matcher, Resolv::DNS::Resource::IN::A) do |transaction|
transaction.respond!(result) transaction.respond!(result)

View file

@ -8,8 +8,8 @@ class Middleman::Extensions::MinifyJavaScript < ::Middleman::Extension
option :inline, false, 'Whether to minify JS inline within HTML files' option :inline, false, 'Whether to minify JS inline within HTML files'
option :ignore, [], 'Patterns to avoid minifying' option :ignore, [], 'Patterns to avoid minifying'
option :compressor, proc { option :compressor, proc {
require 'uglifier' require 'terser'
::Uglifier.new ::Terser.new
}, 'Set the JS compressor to use.' }, 'Set the JS compressor to use.'
option :content_types, %w[application/javascript], 'Content types of resources that contain JS' option :content_types, %w[application/javascript], 'Content types of resources that contain JS'
option :inline_content_types, %w[text/html text/php], 'Content types of resources that contain inline JS' option :inline_content_types, %w[text/html text/php], 'Content types of resources that contain inline JS'

View file

@ -48,7 +48,7 @@ Gem::Specification.new do |s|
s.add_dependency('sassc', ['~> 2']) s.add_dependency('sassc', ['~> 2'])
# Minify JS # Minify JS
s.add_dependency('uglifier', ['~> 4']) s.add_dependency('terser', ['~> 1.1'])
s.add_dependency('execjs', ['~> 2']) s.add_dependency('execjs', ['~> 2'])
# Perf # Perf