You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2022/03/04 09:40:34 UTC
[myfaces-tobago] 01/02: fix: extra JSF call in Safari
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit 254c0ae888fce7beefcc65d6f815a449907fd61e
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Fri Mar 4 10:16:02 2022 +0100
fix: extra JSF call in Safari
This replace is, because the last line refers to a
sourceMappingURL which is not available in Tobago.
In Safari, with open Development Console, we got an
404.xhtml request otherwise (not shown in network section).
---
tobago-theme/copy-jsf-js.js | 34 ++++++++++++++++++++++
tobago-theme/package.json | 2 +-
.../tobago-theme-standard/src/main/js/jsf.js | 3 +-
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/tobago-theme/copy-jsf-js.js b/tobago-theme/copy-jsf-js.js
new file mode 100644
index 0000000..f2d74ae
--- /dev/null
+++ b/tobago-theme/copy-jsf-js.js
@@ -0,0 +1,34 @@
+console.log("mytest huhu");
+
+const sourceDir = "node_modules/jsf.js_next_gen/dist/window/";
+const targetDir = "tobago-theme-standard/src/main/js/";
+const jsFile = "jsf.js";
+const mapFile = "jsf.js.map";
+
+const fs = require('fs')
+
+// copy and patch jsf.js
+fs.readFile(sourceDir + jsFile, "utf8", function (e, data) {
+ if (e) {
+ console.error(e);
+ } else {
+
+ // This replace is, because the last line refers to a sourceMappingURL which is not available in Tobago.
+ // In Safari, with open Development Console, we got an 404.xhtml request otherwise (not shown in network section).
+
+ const result = data.replace(/\n\/\/# sourceMappingURL=jsf\.js\.map\.jsf\?ln=scripts/g, "");
+
+ fs.writeFile(targetDir + jsFile, result, 'utf8', function (e) {
+ if (e) {
+ console.error(e);
+ }
+ });
+ }
+});
+
+// copy jsf.js.map
+fs.copyFile(sourceDir + mapFile, targetDir + mapFile, function (e) {
+ if (e) {
+ console.error(e);
+ }
+});
diff --git a/tobago-theme/package.json b/tobago-theme/package.json
index 24201cf..c1f3d77 100644
--- a/tobago-theme/package.json
+++ b/tobago-theme/package.json
@@ -52,7 +52,7 @@
"bi": "npm-run-all --parallel bi-css bi-fonts",
"bi-css": "ncp node_modules/bootstrap-icons/font/bootstrap-icons.css tobago-theme-standard/src/main/css/bootstrap-icons.css",
"bi-fonts": "ncp node_modules/bootstrap-icons/font/fonts tobago-theme-standard/src/main/css/fonts",
- "jsf-js": "ncp node_modules/jsf.js_next_gen/dist/window tobago-theme-standard/src/main/js --filter='.*(window|\\jsf.js|\\jsf.js.map)$'",
+ "jsf-js": "node copy-jsf-js.js",
"ts": "npm-run-all ts-lint rollup",
"ts-lint": "eslint 'tobago-theme-standard/src/main/ts/**/*.ts'",
"ts-compile": "tsc --project tsconfig.development.json",
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/jsf.js b/tobago-theme/tobago-theme-standard/src/main/js/jsf.js
index 92d39cb..d3448ba 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/jsf.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/jsf.js
@@ -1,3 +1,2 @@
(()=>{var e={105:(e,t)=>{!function(){"use strict";var e={585:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototy [...]
-//# sourceMappingURL=jsf.js.map
-//# sourceMappingURL=jsf.js.map.jsf?ln=scripts
\ No newline at end of file
+//# sourceMappingURL=jsf.js.map
\ No newline at end of file