git » homepage.git » master » tree

[master] / tools / mermaid / stable-css.patch

--- a/src/index.js
+++ b/src/index.js
@@ -642,35 +642,33 @@
       ...customFontCSS,
     ];

-    await Promise.all(
-      cssImports.map(async ({ cssUrl, allowParentDirectoryLevel }) => {
-        let href = cssUrl.href;
-        if (cssUrl.protocol === "file:") {
-          href = await interceptor.fileUrlToInterceptUrl(cssUrl, {
-            allowParentDirectoryLevel,
-          });
-        }
-        await page.evaluate(
-          ({ href }) => {
-            const link = document.createElement("link");
-            link.setAttribute("crossorigin", "anonymous");
-            link.setAttribute("rel", "stylesheet");
-            link.setAttribute("href", href);
-            link.setAttribute("class", "mermaid-cli-css");
-            const loaded = /** @type {Promise<void>} */ (
-              new Promise((resolve, reject) => {
-                link.onload = () => resolve();
-                link.onerror = () =>
-                  reject(new Error(`Failed to load stylesheet: ${href}`));
-              })
-            );
-            document.head.appendChild(link);
-            return loaded;
-          },
-          { href },
-        );
-      }),
-    );
+    for (const { cssUrl, allowParentDirectoryLevel } of cssImports) {
+      let href = cssUrl.href;
+      if (cssUrl.protocol === "file:") {
+        href = await interceptor.fileUrlToInterceptUrl(cssUrl, {
+          allowParentDirectoryLevel,
+        });
+      }
+      await page.evaluate(
+        ({ href }) => {
+          const link = document.createElement("link");
+          link.setAttribute("crossorigin", "anonymous");
+          link.setAttribute("rel", "stylesheet");
+          link.setAttribute("href", href);
+          link.setAttribute("class", "mermaid-cli-css");
+          const loaded = /** @type {Promise<void>} */ (
+            new Promise((resolve, reject) => {
+              link.onload = () => resolve();
+              link.onerror = () =>
+                reject(new Error(`Failed to load stylesheet: ${href}`));
+            })
+          );
+          document.head.appendChild(link);
+          return loaded;
+        },
+        { href },
+      );
+    }

     const resolvedIconPacks = Object.fromEntries(
       await Promise.all(