Skip to content

Commit cc19b37

Browse files
authored
Merge branch 'main' into allow-prefixed-sourcemaps
2 parents dae5cdd + c2a87b5 commit cc19b37

File tree

8 files changed

+24
-21
lines changed

8 files changed

+24
-21
lines changed

.devcontainer/devcontainer.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Ruby",
55
"build": {
66
"dockerfile": "Dockerfile",
7-
"args": {
7+
"args": {
88
// Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6
99
// Append -bullseye or -buster to pin to an OS version.
1010
// Use -bullseye variants on local on arm64/Apple Silicon.
@@ -14,14 +14,17 @@
1414
}
1515
},
1616

17-
// Set *default* container specific settings.json values on container create.
18-
"settings": {},
17+
// Configure tool-specific properties.
18+
"customizations": {
19+
// Configure properties specific to VS Code.
20+
"vscode": {
21+
// Add the IDs of extensions you want installed when the container is created.
22+
"extensions": [
23+
"Shopify.ruby-lsp"
24+
]
25+
}
26+
},
1927

20-
// Add the IDs of extensions you want installed when the container is created.
21-
"extensions": [
22-
"rebornix.Ruby"
23-
],
24-
2528
// Use 'forwardPorts' to make a list of ports inside the container available locally.
2629
// "forwardPorts": [],
2730

UPGRADING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ Rails.application.assets.load_path.find('logo.svg').content
253253

254254
As Rails escapes html tags in views by default, in order to output a rendered svg you will need to specify rails not to escape the string using [html_safe](https://api.rubyonrails.org/classes/String.html#method-i-html_safe) or [raw](https://api.rubyonrails.org/classes/ActionView/Helpers/OutputSafetyHelper.html#method-i-raw).
255255
```ruby
256-
Rails.application.assets.load_path.find('logo.svg').html_safe
257-
raw Rails.application.assets.load_path.find('logo.svg')
256+
Rails.application.assets.load_path.find('logo.svg').content.html_safe
257+
raw Rails.application.assets.load_path.find('logo.svg').content
258258
```
259259

260260
**Precompilation in development**

lib/propshaft/asset.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ def ==(other_asset)
4242

4343
private
4444
def already_digested?
45-
logical_path.to_s =~ /-([0-9a-zA-Z]{7,128})\.digested/
45+
logical_path.to_s =~ /-([0-9a-zA-Z_-]{7,128})\.digested/
4646
end
4747
end

lib/propshaft/compiler/source_mapping_urls.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Propshaft::Compiler::SourceMappingUrls < Propshaft::Compiler
66
SOURCE_MAPPING_PATTERN = %r{(//|/\*)# sourceMappingURL=(.+\.map)(\s*?\*\/)?\s*?\Z}
77

88
def compile(logical_path, input)
9-
input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(asset_path($2, logical_path), $1, $3) }
9+
input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(logical_path, asset_path($2, logical_path), $1, $3) }
1010
end
1111

1212
private
@@ -20,11 +20,11 @@ def asset_path(source_mapping_url, logical_path)
2020
end
2121
end
2222

23-
def source_mapping_url(resolved_path, comment_start, comment_end)
24-
if (asset = assembly.load_path.find(resolved_path))
23+
def source_mapping_url(logical_path, resolved_path, comment_start, comment_end)
24+
if asset = assembly.load_path.find(resolved_path)
2525
"#{comment_start}# sourceMappingURL=#{url_prefix}/#{asset.digested_path}#{comment_end}"
2626
else
27-
Propshaft.logger.warn "Removed sourceMappingURL comment for missing asset '#{resolved_path}' from #{resolved_path}"
27+
Propshaft.logger.warn "Removed sourceMappingURL comment for missing asset '#{resolved_path}' from #{logical_path}"
2828
"#{comment_start}#{comment_end}"
2929
end
3030
end

test/propshaft/asset_test.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ class Propshaft::AssetTest < ActiveSupport::TestCase
2525
assert find_asset("one.txt").fresh?("f2e1ec14d6856e1958083094170ca6119c529a73")
2626
assert_not find_asset("one.txt").fresh?("e206c34fe404c8e2f25d60dd8303f61c02b8d381")
2727

28-
assert find_asset("file-already-abcdefVWXYZ0123456789.digested.css").fresh?(nil)
28+
assert find_asset("file-already-abcdefVWXYZ0123456789_-.digested.css").fresh?(nil)
2929
end
3030

3131
test "digested path" do
3232
assert_equal "one-f2e1ec14d6856e1958083094170ca6119c529a73.txt",
3333
find_asset("one.txt").digested_path.to_s
3434

35-
assert_equal "file-already-abcdefVWXYZ0123456789.digested.css",
36-
find_asset("file-already-abcdefVWXYZ0123456789.digested.css").digested_path.to_s
35+
assert_equal "file-already-abcdefVWXYZ0123456789_-.digested.css",
36+
find_asset("file-already-abcdefVWXYZ0123456789_-.digested.css").digested_path.to_s
3737

38-
assert_equal "file-already-abcdefVWXYZ0123456789.digested.debug.css",
39-
find_asset("file-already-abcdefVWXYZ0123456789.digested.debug.css").digested_path.to_s
38+
assert_equal "file-already-abcdefVWXYZ0123456789_-.digested.debug.css",
39+
find_asset("file-already-abcdefVWXYZ0123456789_-.digested.debug.css").digested_path.to_s
4040

4141
assert_equal "file-not.digested-e206c34fe404c8e2f25d60dd8303f61c02b8d381.css",
4242
find_asset("file-not.digested.css").digested_path.to_s

test/propshaft/server_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Propshaft::ServerTest < ActiveSupport::TestCase
3030
end
3131

3232
test "serve a predigested file" do
33-
asset = @assembly.load_path.find("file-already-abcdefVWXYZ0123456789.digested.css")
33+
asset = @assembly.load_path.find("file-already-abcdefVWXYZ0123456789_-.digested.css")
3434
get "/#{asset.digested_path}"
3535
assert_equal 200, last_response.status
3636
end

0 commit comments

Comments
 (0)