-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add postinstall patch to support safari for html2canvas
Signed-off-by: Joshua Li <[email protected]>
- Loading branch information
1 parent
6a20ffa
commit 18143ce
Showing
4 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// @ts-check | ||
// workaround for Safari support before https://github.com/niklasvh/html2canvas/pull/2911 is merged | ||
const replace = require('replace-in-file'); | ||
|
||
const options = { | ||
files: [ | ||
__dirname + '/../node_modules/html2canvas/**/*.js', | ||
__dirname + '/../node_modules/html2canvas/**/*.js.map', | ||
], | ||
from: 'if (image.width === width && image.height === height) {', | ||
to: 'if (false && image.width === width && image.height === height) {', | ||
}; | ||
|
||
try { | ||
const changedFiles = replace.sync(options); | ||
console.log( | ||
'Modified files for html2canvas Safari support:\n', | ||
changedFiles | ||
.filter((file) => file.hasChanged) | ||
.map((file) => file.file) | ||
.join('\n') | ||
); | ||
} catch (error) { | ||
console.error( | ||
'Error occurred when modifiying files for html2canvas Safari support:', | ||
error | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1863,6 +1863,14 @@ chalk@^4.0.0, chalk@^4.1.0: | |
ansi-styles "^4.1.0" | ||
supports-color "^7.1.0" | ||
|
||
chalk@^4.1.2: | ||
version "4.1.2" | ||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" | ||
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== | ||
dependencies: | ||
ansi-styles "^4.1.0" | ||
supports-color "^7.1.0" | ||
|
||
character-entities-legacy@^1.0.0: | ||
version "1.1.4" | ||
resolved "https://registry.yarnpkg.com/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz#94bc1845dce70a5bb9d2ecc748725661293d8fc1" | ||
|
@@ -2005,6 +2013,15 @@ cliui@^6.0.0: | |
strip-ansi "^6.0.0" | ||
wrap-ansi "^6.2.0" | ||
|
||
cliui@^8.0.1: | ||
version "8.0.1" | ||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" | ||
integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== | ||
dependencies: | ||
string-width "^4.2.0" | ||
strip-ansi "^6.0.1" | ||
wrap-ansi "^7.0.0" | ||
|
||
code-point-at@^1.0.0: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" | ||
|
@@ -3188,7 +3205,7 @@ gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: | |
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" | ||
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== | ||
|
||
get-caller-file@^2.0.1: | ||
get-caller-file@^2.0.1, get-caller-file@^2.0.5: | ||
version "2.0.5" | ||
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" | ||
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== | ||
|
@@ -3277,7 +3294,7 @@ glob@^7.1.3, glob@^7.1.4: | |
once "^1.3.0" | ||
path-is-absolute "^1.0.0" | ||
|
||
glob@^7.2.3: | ||
glob@^7.2.0, glob@^7.2.3: | ||
version "7.2.3" | ||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" | ||
integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== | ||
|
@@ -3483,7 +3500,7 @@ html-to-react@^1.3.4: | |
lodash.camelcase "^4.3.0" | ||
ramda "^0.27" | ||
|
||
html2canvas@^1.0.0-rc.5, html2canvas@^1.4.1: | ||
html2canvas@1.4.1, html2canvas@^1.0.0-rc.5: | ||
version "1.4.1" | ||
resolved "https://registry.yarnpkg.com/html2canvas/-/html2canvas-1.4.1.tgz#7cef1888311b5011d507794a066041b14669a543" | ||
integrity sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA== | ||
|
@@ -5584,6 +5601,15 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb" | ||
integrity sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs= | ||
|
||
replace-in-file@^6.3.5: | ||
version "6.3.5" | ||
resolved "https://registry.yarnpkg.com/replace-in-file/-/replace-in-file-6.3.5.tgz#ff956b0ab5bc96613207d603d197cd209400a654" | ||
integrity sha512-arB9d3ENdKva2fxRnSjwBEXfK1npgyci7ZZuwysgAp7ORjHSyxz6oqIjTEv8R0Ydl4Ll7uOAZXL4vbkhGIizCg== | ||
dependencies: | ||
chalk "^4.1.2" | ||
glob "^7.2.0" | ||
yargs "^17.2.1" | ||
|
||
request-progress@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/request-progress/-/request-progress-3.0.0.tgz#4ca754081c7fec63f505e4faa825aa06cd669dbe" | ||
|
@@ -6094,7 +6120,7 @@ string-width@^3.0.0, string-width@^3.1.0: | |
is-fullwidth-code-point "^2.0.0" | ||
strip-ansi "^5.1.0" | ||
|
||
string-width@^4.1.0: | ||
string-width@^4.1.0, string-width@^4.2.3: | ||
version "4.2.3" | ||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" | ||
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== | ||
|
@@ -6885,6 +6911,15 @@ wrap-ansi@^6.2.0: | |
string-width "^4.1.0" | ||
strip-ansi "^6.0.0" | ||
|
||
wrap-ansi@^7.0.0: | ||
version "7.0.0" | ||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" | ||
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== | ||
dependencies: | ||
ansi-styles "^4.0.0" | ||
string-width "^4.1.0" | ||
strip-ansi "^6.0.0" | ||
|
||
wrappy@1: | ||
version "1.0.2" | ||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" | ||
|
@@ -6961,6 +6996,11 @@ yargs-parser@^15.0.1: | |
camelcase "^5.0.0" | ||
decamelize "^1.2.0" | ||
|
||
yargs-parser@^21.1.1: | ||
version "21.1.1" | ||
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" | ||
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== | ||
|
||
yargs@^14.2: | ||
version "14.2.3" | ||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.3.tgz#1a1c3edced1afb2a2fea33604bc6d1d8d688a414" | ||
|
@@ -6995,6 +7035,19 @@ yargs@^15.3.1: | |
y18n "^4.0.0" | ||
yargs-parser "^18.1.2" | ||
|
||
yargs@^17.2.1: | ||
version "17.6.2" | ||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541" | ||
integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw== | ||
dependencies: | ||
cliui "^8.0.1" | ||
escalade "^3.1.1" | ||
get-caller-file "^2.0.5" | ||
require-directory "^2.1.1" | ||
string-width "^4.2.3" | ||
y18n "^5.0.5" | ||
yargs-parser "^21.1.1" | ||
|
||
yauzl@^2.10.0: | ||
version "2.10.0" | ||
resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-2.10.0.tgz#c7eb17c93e112cb1086fa6d8e51fb0667b79a5f9" | ||
|