Skip to content

Commit

Permalink
Merge branch 'drop-base64'
Browse files Browse the repository at this point in the history
# By Ryunosuke Sato (1) and Ville Lautanala (1)
* drop-base64:
  Bump required ruby version to 2.4
  Drop base64 gem from dependency

# Conflicts:
#	.github/workflows/ruby.yml
  • Loading branch information
lautis committed Sep 22, 2024
2 parents b808f14 + 46b75e4 commit f7ee1a2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
matrix:
gemfile: [Gemfile]
ruby:
- "2.3"
- "2.4"
- "2.5"
- "2.6"
Expand Down
5 changes: 2 additions & 3 deletions lib/uglifier.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# encoding: UTF-8

require "json"
require "base64"
require "execjs"
require "uglifier/version"

Expand Down Expand Up @@ -160,7 +159,7 @@ def initialize(options = {})
def compile(source)
if @options[:source_map]
compiled, source_map = run_uglifyjs(source, true)
source_map_uri = Base64.strict_encode64(source_map)
source_map_uri = [source_map].pack('m0')
source_map_mime = "application/json;charset=utf-8;base64"
compiled + "\n//# sourceMappingURL=data:#{source_map_mime},#{source_map_uri}"
else
Expand Down Expand Up @@ -512,7 +511,7 @@ def input_source_map(source, generate_map)
source_map_options = @options[:source_map].is_a?(Hash) ? @options[:source_map] : {}
sanitize_map_root(source_map_options.fetch(:input_source_map) do
url = extract_source_mapping_url(source)
Base64.strict_decode64(url.split(",", 2)[-1]) if url && url.start_with?("data:")
url.split(",", 2)[-1].unpack1('m0') if url && url.start_with?("data:")
end)
rescue ArgumentError, JSON::ParserError
nil
Expand Down
2 changes: 1 addition & 1 deletion uglifier.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
spec.description = "Uglifier minifies JavaScript files by wrapping UglifyJS to be accessible in Ruby"
spec.license = "MIT"

spec.required_ruby_version = '>= 1.9.3'
spec.required_ruby_version = '>= 2.4.0'

spec.extra_rdoc_files = [
"LICENSE.txt",
Expand Down

0 comments on commit f7ee1a2

Please sign in to comment.