From ae3ac6220d9570829a2bbd23f83c4ea36f453b9f Mon Sep 17 00:00:00 2001 From: Pat O'Callaghan Date: Tue, 8 Dec 2020 15:42:01 +0000 Subject: [PATCH] Recreate template literal prepend issue --- tests/filter-tests.js | 14 ++++++++++++++ .../template-literal/input/assets/application.js | 5 +++++ .../input/images/icons/favicon.png | Bin 0 -> 937 bytes .../template-literal/input/images/sample.png | Bin 0 -> 937 bytes tests/fixtures/template-literal/input/index.html | 15 +++++++++++++++ tests/fixtures/template-literal/input/styles.css | 11 +++++++++++ ...plication-974fd9b673bf8809fe7b5cf3898a6bbf.js | 5 +++++ .../favicon-9243e67fccd0c5e08a3d2c158af6500d.png | Bin 0 -> 937 bytes .../sample-1f6b78f1b4667adc7e397f7bf94041ab.png | Bin 0 -> 937 bytes .../fixtures/template-literal/output/index.html | 15 +++++++++++++++ .../styles-65152d913114634ea19a82c7990d08f3.css | 11 +++++++++++ 11 files changed, 76 insertions(+) create mode 100644 tests/fixtures/template-literal/input/assets/application.js create mode 100644 tests/fixtures/template-literal/input/images/icons/favicon.png create mode 100644 tests/fixtures/template-literal/input/images/sample.png create mode 100644 tests/fixtures/template-literal/input/index.html create mode 100644 tests/fixtures/template-literal/input/styles.css create mode 100644 tests/fixtures/template-literal/output/assets/application-974fd9b673bf8809fe7b5cf3898a6bbf.js create mode 100644 tests/fixtures/template-literal/output/images/icons/favicon-9243e67fccd0c5e08a3d2c158af6500d.png create mode 100644 tests/fixtures/template-literal/output/images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png create mode 100644 tests/fixtures/template-literal/output/index.html create mode 100644 tests/fixtures/template-literal/output/styles-65152d913114634ea19a82c7990d08f3.css diff --git a/tests/filter-tests.js b/tests/filter-tests.js index 4fa5571..ac82f82 100644 --- a/tests/filter-tests.js +++ b/tests/filter-tests.js @@ -103,6 +103,20 @@ describe('broccoli-asset-rev', function() { }); }); + it.only('rewrites template literals with prepends correctly', function(){ + var sourcePath = 'tests/fixtures/template-literal'; + + var node = AssetRev(sourcePath + '/input', { + extensions: ['js', 'json', 'css', 'png', 'jpg', 'gif', 'map'], + prepend: 'https://static.assets.com/ember/' + }); + + builder = new broccoli.Builder(node); + return builder.build().then(function(graph) { + confirmOutput(graph.directory, sourcePath + '/output'); + }); + }); + it("doesn't fingerprint rails-style manifest if excluded", function () { var sourcePath = 'tests/fixtures/basic'; diff --git a/tests/fixtures/template-literal/input/assets/application.js b/tests/fixtures/template-literal/input/assets/application.js new file mode 100644 index 0000000..82bf8fb --- /dev/null +++ b/tests/fixtures/template-literal/input/assets/application.js @@ -0,0 +1,5 @@ +class Application { + foo() { + return bar(`${this.path}/application.js`); + } +} \ No newline at end of file diff --git a/tests/fixtures/template-literal/input/images/icons/favicon.png b/tests/fixtures/template-literal/input/images/icons/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..3db835bdf3a84edfb6e93acae0f7e73b5e22bfcb GIT binary patch literal 937 zcmaJ=yN=U96t$KHMT)cy;?<12TP%opY$s0QQOs&%C&UttqHH8m?!=xXR@NRfo)9PH zc9e8<6!iQ61&EGc;1g(ohMI9U$x;wpc<#MA=iJBKdEM(iD;6FUBuOf|9j7nO+%DWc z5dVYT@Vhwf^VX1`(=lIQMx?WVjtFogJRyC8gXPPwq#;SSPQt;E554Eer;&nljFLr( zU`tZtG)u5QBOHv#B#bTj$Hz}H2m?!gVR)*S*kl@ZR*amlx&wbT^UXj$eF_>G5&{w7 z7-Z39oTAK<*Sbj9c^JxI4dF9OzAkF$^?*$o0ftg7`Knd{HB-@yYR#-Y0lM&^T8Fw? zQcYx(k*b5uCyQ(>7^A+^-sBRVB~Lj|5QK}xLRpj*$|g`VO%tj*)b)};l+tC)aaM}c zqpgBNQlEth4`~c?MLeQ&Zpot3>lUJ9CmW}mF^Pe}3@1=i)V!rF(DVKejiMbo<$ZEf z?>~jp!7?GRPf|K(zPPyYQJyM6HY1o*HlXx!JH_6Va+*$Q0&IIdHE`l#KaBI>qczL( zkQ=8Q$3Af#OBOmx7zW66nue~awQ9YpYFeveYVBs*&<(9pc3Lf4-Etl3&m$7^EjPH~ z*7tJrg@_W7*&!@^MS?b?5m+~l!u_=vd-XQlV1F&uy<8}Yf%*0Rb=}*L*rD9qEw6BP z>rY~_^Gq!FyF0%R#lyJkI%k9I+bF;oe=feg_w(w_p7c(;R~U literal 0 HcmV?d00001 diff --git a/tests/fixtures/template-literal/input/images/sample.png b/tests/fixtures/template-literal/input/images/sample.png new file mode 100644 index 0000000000000000000000000000000000000000..cdfaf5e593f5028afeb8a25384f69e00944ce1cd GIT binary patch literal 937 zcmaJ=zi-n(6gEXjC{iUBgec3^S&G#7Y$s0YQ%u#^3AKc)C=DV50~h;}SgC!7eIZUJ z1QY)Z8w(6Du<#FbU}9om;a}jK#wi2AgYUhk@B7}5d-tw;_IS6nSCS-Y*FAN5;>_*R z?H%#o=?;F0<34W>_&FW%IZlXl63`(5ZiL6AM{uxs`HeIs>E=P$AMklaE?*3 zhzYhNHIFlf{VCyKNXB7o$-h5+mO&U;@-xFzJ!X?hc)Co;`SPsqFQ>j4$j6UBGebfk zA{>J(x`=&*`jl3D1%zoHGRBd_Gs^RfQ&FsF|h-RUPVjMIb8aBIY=& z#A&%ua7gMWA>$#9L9U30bjB@NRC?7y#5S^Vx*n4l7|bw(nxf_{6+qAXKQxLq=#=-! zb-n)-PWuZ+V2`A9miXf0M&&#eLv}(ir%9jEi(-o13FS1MPzG#!H8pVHVLy!X;KLQm z^N<^-9LGL!9ZMEEN*D&nbXtb4snz;XUDdR9&D1)rj-eY`t?IPfwpwr<>dzt)^MV^( zb8B0<`9efYWOhgrz9K;7G=Xj}Ex++cex`c^I!#lZY}|GMrXBz7n_H_I!W z&H9sA?0h1Yo9*AZD;~x@*E#8D--m~#=U-nxP_-Yo%1`&e7wO}N8;hTBFE8`Q + + + + + Application + + + + + + + + + diff --git a/tests/fixtures/template-literal/input/styles.css b/tests/fixtures/template-literal/input/styles.css new file mode 100644 index 0000000..6b1dcc8 --- /dev/null +++ b/tests/fixtures/template-literal/input/styles.css @@ -0,0 +1,11 @@ +.sample-img { + width: 50px; + height: 50px; + background-image: url(images/sample.png); +} + +.sample-img2 { + width: 50px; + height: 50px; + background-image: url('images/sample.png'); +} diff --git a/tests/fixtures/template-literal/output/assets/application-974fd9b673bf8809fe7b5cf3898a6bbf.js b/tests/fixtures/template-literal/output/assets/application-974fd9b673bf8809fe7b5cf3898a6bbf.js new file mode 100644 index 0000000..1e162c8 --- /dev/null +++ b/tests/fixtures/template-literal/output/assets/application-974fd9b673bf8809fe7b5cf3898a6bbf.js @@ -0,0 +1,5 @@ +class Application { + foo() { + return bar(`https://static.intercomassets.com/ember/${this.path}/application-974fd9b673bf8809fe7b5cf3898a6bbf.js`); + } +} \ No newline at end of file diff --git a/tests/fixtures/template-literal/output/images/icons/favicon-9243e67fccd0c5e08a3d2c158af6500d.png b/tests/fixtures/template-literal/output/images/icons/favicon-9243e67fccd0c5e08a3d2c158af6500d.png new file mode 100644 index 0000000000000000000000000000000000000000..3db835bdf3a84edfb6e93acae0f7e73b5e22bfcb GIT binary patch literal 937 zcmaJ=yN=U96t$KHMT)cy;?<12TP%opY$s0QQOs&%C&UttqHH8m?!=xXR@NRfo)9PH zc9e8<6!iQ61&EGc;1g(ohMI9U$x;wpc<#MA=iJBKdEM(iD;6FUBuOf|9j7nO+%DWc z5dVYT@Vhwf^VX1`(=lIQMx?WVjtFogJRyC8gXPPwq#;SSPQt;E554Eer;&nljFLr( zU`tZtG)u5QBOHv#B#bTj$Hz}H2m?!gVR)*S*kl@ZR*amlx&wbT^UXj$eF_>G5&{w7 z7-Z39oTAK<*Sbj9c^JxI4dF9OzAkF$^?*$o0ftg7`Knd{HB-@yYR#-Y0lM&^T8Fw? zQcYx(k*b5uCyQ(>7^A+^-sBRVB~Lj|5QK}xLRpj*$|g`VO%tj*)b)};l+tC)aaM}c zqpgBNQlEth4`~c?MLeQ&Zpot3>lUJ9CmW}mF^Pe}3@1=i)V!rF(DVKejiMbo<$ZEf z?>~jp!7?GRPf|K(zPPyYQJyM6HY1o*HlXx!JH_6Va+*$Q0&IIdHE`l#KaBI>qczL( zkQ=8Q$3Af#OBOmx7zW66nue~awQ9YpYFeveYVBs*&<(9pc3Lf4-Etl3&m$7^EjPH~ z*7tJrg@_W7*&!@^MS?b?5m+~l!u_=vd-XQlV1F&uy<8}Yf%*0Rb=}*L*rD9qEw6BP z>rY~_^Gq!FyF0%R#lyJkI%k9I+bF;oe=feg_w(w_p7c(;R~U literal 0 HcmV?d00001 diff --git a/tests/fixtures/template-literal/output/images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png b/tests/fixtures/template-literal/output/images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png new file mode 100644 index 0000000000000000000000000000000000000000..cdfaf5e593f5028afeb8a25384f69e00944ce1cd GIT binary patch literal 937 zcmaJ=zi-n(6gEXjC{iUBgec3^S&G#7Y$s0YQ%u#^3AKc)C=DV50~h;}SgC!7eIZUJ z1QY)Z8w(6Du<#FbU}9om;a}jK#wi2AgYUhk@B7}5d-tw;_IS6nSCS-Y*FAN5;>_*R z?H%#o=?;F0<34W>_&FW%IZlXl63`(5ZiL6AM{uxs`HeIs>E=P$AMklaE?*3 zhzYhNHIFlf{VCyKNXB7o$-h5+mO&U;@-xFzJ!X?hc)Co;`SPsqFQ>j4$j6UBGebfk zA{>J(x`=&*`jl3D1%zoHGRBd_Gs^RfQ&FsF|h-RUPVjMIb8aBIY=& z#A&%ua7gMWA>$#9L9U30bjB@NRC?7y#5S^Vx*n4l7|bw(nxf_{6+qAXKQxLq=#=-! zb-n)-PWuZ+V2`A9miXf0M&&#eLv}(ir%9jEi(-o13FS1MPzG#!H8pVHVLy!X;KLQm z^N<^-9LGL!9ZMEEN*D&nbXtb4snz;XUDdR9&D1)rj-eY`t?IPfwpwr<>dzt)^MV^( zb8B0<`9efYWOhgrz9K;7G=Xj}Ex++cex`c^I!#lZY}|GMrXBz7n_H_I!W z&H9sA?0h1Yo9*AZD;~x@*E#8D--m~#=U-nxP_-Yo%1`&e7wO}N8;hTBFE8`Q + + + + + Application + + + + + + + + + diff --git a/tests/fixtures/template-literal/output/styles-65152d913114634ea19a82c7990d08f3.css b/tests/fixtures/template-literal/output/styles-65152d913114634ea19a82c7990d08f3.css new file mode 100644 index 0000000..a40610c --- /dev/null +++ b/tests/fixtures/template-literal/output/styles-65152d913114634ea19a82c7990d08f3.css @@ -0,0 +1,11 @@ +.sample-img { + width: 50px; + height: 50px; + background-image: url(images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png); +} + +.sample-img2 { + width: 50px; + height: 50px; + background-image: url('images/sample-1f6b78f1b4667adc7e397f7bf94041ab.png'); +}