propshaft 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/propshaft/compilers/source_mapping_urls.rb +4 -4
- data/lib/propshaft/processor.rb +0 -17
- data/lib/propshaft/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e427b65e4a2157ef4b03527c3bc11f5e07fa217ee88e0c318c516b34ed22dd7
|
4
|
+
data.tar.gz: 74e7681de5dc22ca15a3e66202e565a8acc64fc7b3c23aea70bf11767d485db0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d024bc9b15272afde40e4f9b103bf7fb784bc18ec7eb14bd2c8c9e9556496b6d8ce5abc60e92322e706957813358ddb3b6cdaeb9ee29df8f8ee532e7e6a95676
|
7
|
+
data.tar.gz: b729b2abbb7e949e932732e30e6fd74dd11e9aaf7c20f1f9c067caa4f127e54bda0e3ea8f3218aa61d819f724323bdc17742286acaa46734996b6b56ade5f329
|
@@ -3,14 +3,14 @@
|
|
3
3
|
class Propshaft::Compilers::SourceMappingUrls
|
4
4
|
attr_reader :assembly
|
5
5
|
|
6
|
-
SOURCE_MAPPING_PATTERN =
|
6
|
+
SOURCE_MAPPING_PATTERN = /(\/\/|\/*)# sourceMappingURL=(.*\.map)/
|
7
7
|
|
8
8
|
def initialize(assembly)
|
9
9
|
@assembly = assembly
|
10
10
|
end
|
11
11
|
|
12
12
|
def compile(logical_path, input)
|
13
|
-
input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(asset_path($
|
13
|
+
input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(asset_path($2, logical_path), $1) }
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
@@ -22,9 +22,9 @@ class Propshaft::Compilers::SourceMappingUrls
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def source_mapping_url(resolved_path)
|
25
|
+
def source_mapping_url(resolved_path, comment)
|
26
26
|
if asset = assembly.load_path.find(resolved_path)
|
27
|
-
"
|
27
|
+
"#{comment}# sourceMappingURL=#{assembly.config.prefix}/#{asset.digested_path}"
|
28
28
|
else
|
29
29
|
Propshaft.logger.warn "Removed sourceMappingURL comment for missing asset '#{resolved_path}' from #{resolved_path}"
|
30
30
|
nil
|
data/lib/propshaft/processor.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
class Propshaft::Processor
|
2
2
|
MANIFEST_FILENAME = ".manifest.json"
|
3
|
-
COMPRESSABLE_CONTENT_TYPES = %i[ js css text json xml html svg otf ttf ].collect { |t| Mime[t] }
|
4
3
|
|
5
4
|
attr_reader :load_path, :output_path, :compilers
|
6
5
|
|
@@ -13,7 +12,6 @@ class Propshaft::Processor
|
|
13
12
|
ensure_output_path_exists
|
14
13
|
write_manifest
|
15
14
|
output_assets
|
16
|
-
compress_assets
|
17
15
|
end
|
18
16
|
|
19
17
|
def clobber
|
@@ -61,19 +59,4 @@ class Propshaft::Processor
|
|
61
59
|
def copy_asset(asset)
|
62
60
|
FileUtils.copy asset.path, output_path.join(asset.digested_path)
|
63
61
|
end
|
64
|
-
|
65
|
-
|
66
|
-
def compress_assets
|
67
|
-
load_path.assets(content_types: COMPRESSABLE_CONTENT_TYPES).each do |asset|
|
68
|
-
compress_asset output_path.join(asset.digested_path)
|
69
|
-
end if compressor_available?
|
70
|
-
end
|
71
|
-
|
72
|
-
def compress_asset(path)
|
73
|
-
`brotli #{path} -o #{path}.br` unless Pathname.new(path.to_s + ".br").exist?
|
74
|
-
end
|
75
|
-
|
76
|
-
def compressor_available?
|
77
|
-
`which brotli`.present?
|
78
|
-
end
|
79
62
|
end
|
data/lib/propshaft/version.rb
CHANGED