From c6fe82fcfa1153b2306424cb5ccbd1fe61ade3ad Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Thu, 10 Nov 2022 12:58:26 +0100
Subject: [PATCH] rollup: silence eval warnings from keycloak dep

See https://github.com/emn178/js-sha256/issues/18
---
 packages/auth/rollup.config.js                             | 7 +++++++
 packages/data-table-view/rollup.config.js                  | 7 +++++++
 .../knowledge-base-web-page-element-view/rollup.config.js  | 7 +++++++
 packages/person-profile/rollup.config.js                   | 7 +++++++
 packages/person-select/rollup.config.js                    | 7 +++++++
 packages/provider/rollup.config.js                         | 7 +++++++
 packages/resource-select/rollup.config.js                  | 7 +++++++
 toolkit-showcase/rollup.config.js                          | 7 +++++++
 8 files changed, 56 insertions(+)

diff --git a/packages/auth/rollup.config.js b/packages/auth/rollup.config.js
index 520aebe7..76cf5244 100644
--- a/packages/auth/rollup.config.js
+++ b/packages/auth/rollup.config.js
@@ -32,6 +32,13 @@ export default (async () => {
             format: 'esm',
             sourcemap: true,
         },
+        onwarn: function (warning, warn) {
+            // keycloak bundled code uses eval
+            if (warning.code === 'EVAL' && warning.id.includes('sha256.js')) {
+                return;
+            }
+            warn(warning);
+        },
         plugins: [
             del({
                 targets: 'dist/*',
diff --git a/packages/data-table-view/rollup.config.js b/packages/data-table-view/rollup.config.js
index 2e6953d2..e3cb2b0c 100644
--- a/packages/data-table-view/rollup.config.js
+++ b/packages/data-table-view/rollup.config.js
@@ -33,6 +33,13 @@ export default (async () => {
             format: 'esm',
             sourcemap: true,
         },
+        onwarn: function (warning, warn) {
+            // keycloak bundled code uses eval
+            if (warning.code === 'EVAL' && warning.id.includes('sha256.js')) {
+                return;
+            }
+            warn(warning);
+        },
         plugins: [
             del({
                 targets: 'dist/*',
diff --git a/packages/knowledge-base-web-page-element-view/rollup.config.js b/packages/knowledge-base-web-page-element-view/rollup.config.js
index d82ac1f6..d4d5b091 100644
--- a/packages/knowledge-base-web-page-element-view/rollup.config.js
+++ b/packages/knowledge-base-web-page-element-view/rollup.config.js
@@ -28,6 +28,13 @@ export default (async () => {
             format: 'esm',
             sourcemap: true,
         },
+        onwarn: function (warning, warn) {
+            // keycloak bundled code uses eval
+            if (warning.code === 'EVAL' && warning.id.includes('sha256.js')) {
+                return;
+            }
+            warn(warning);
+        },
         plugins: [
             del({
                 targets: 'dist/*',
diff --git a/packages/person-profile/rollup.config.js b/packages/person-profile/rollup.config.js
index 318d445a..b8ec4bf9 100644
--- a/packages/person-profile/rollup.config.js
+++ b/packages/person-profile/rollup.config.js
@@ -25,6 +25,13 @@ export default (async () => {
             format: 'esm',
             sourcemap: true,
         },
+        onwarn: function (warning, warn) {
+            // keycloak bundled code uses eval
+            if (warning.code === 'EVAL' && warning.id.includes('sha256.js')) {
+                return;
+            }
+            warn(warning);
+        },
         plugins: [
             del({
                 targets: 'dist/*',
diff --git a/packages/person-select/rollup.config.js b/packages/person-select/rollup.config.js
index 5a031902..9f5e6d19 100644
--- a/packages/person-select/rollup.config.js
+++ b/packages/person-select/rollup.config.js
@@ -25,6 +25,13 @@ export default (async () => {
             format: 'esm',
             sourcemap: true,
         },
+        onwarn: function (warning, warn) {
+            // keycloak bundled code uses eval
+            if (warning.code === 'EVAL' && warning.id.includes('sha256.js')) {
+                return;
+            }
+            warn(warning);
+        },
         plugins: [
             del({
                 targets: 'dist/*',
diff --git a/packages/provider/rollup.config.js b/packages/provider/rollup.config.js
index c7993776..427a8190 100644
--- a/packages/provider/rollup.config.js
+++ b/packages/provider/rollup.config.js
@@ -51,6 +51,13 @@ export default (async () => {
             format: 'esm',
             sourcemap: true,
         },
+        onwarn: function (warning, warn) {
+            // keycloak bundled code uses eval
+            if (warning.code === 'EVAL' && warning.id.includes('sha256.js')) {
+                return;
+            }
+            warn(warning);
+        },
         plugins: [
             del({
                 targets: 'dist/*',
diff --git a/packages/resource-select/rollup.config.js b/packages/resource-select/rollup.config.js
index 35c012ca..98636f4a 100644
--- a/packages/resource-select/rollup.config.js
+++ b/packages/resource-select/rollup.config.js
@@ -25,6 +25,13 @@ export default (async () => {
             format: 'esm',
             sourcemap: true,
         },
+        onwarn: function (warning, warn) {
+            // keycloak bundled code uses eval
+            if (warning.code === 'EVAL' && warning.id.includes('sha256.js')) {
+                return;
+            }
+            warn(warning);
+        },
         plugins: [
             del({
                 targets: 'dist/*',
diff --git a/toolkit-showcase/rollup.config.js b/toolkit-showcase/rollup.config.js
index a7736a48..c97b9c41 100644
--- a/toolkit-showcase/rollup.config.js
+++ b/toolkit-showcase/rollup.config.js
@@ -84,6 +84,13 @@ export default (async () => {
         },
         treeshake: treeshake,
         preserveEntrySignatures: false,
+        onwarn: function (warning, warn) {
+            // keycloak bundled code uses eval
+            if (warning.code === 'EVAL' && warning.id.includes('sha256.js')) {
+                return;
+            }
+            warn(warning);
+        },
         plugins: [
             del({
                 targets: 'dist/*',
-- 
GitLab