Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 171c5fc7 authored by Simon Chan's avatar Simon Chan
Browse files

chore: update dependencies

parent a3cef92d
Loading
Loading
Loading
Loading
+35 −18
Original line number Diff line number Diff line
const encoder = require('plantuml-encoder');
const svgToDataUri = require('mini-svg-data-uri');
const fetch = require('node-fetch');
const visit = require('unist-util-visit');
const encoder = require("plantuml-encoder");
const svgToDataUri = require("mini-svg-data-uri");
const fetch = require("node-fetch");
const visit = require("unist-util-visit");

async function umlToSvgDataUri(uml) {
    const encoded = encoder.encode(uml);
    const response = await fetch(`https://www.plantuml.com/plantuml/svg/${encoded}`);
    const response = await fetch(
        `https://www.plantuml.com/plantuml/svg/${encoded}`
    );
    let svg = await response.text();
    return svgToDataUri(svg);
}

module.exports = () => {
    return async syntaxTree => {
    return async (syntaxTree) => {
        const matches = [];
        visit(syntaxTree, 'code', node => {
            if (node.lang === 'uml' && !!node.value) {
        visit(syntaxTree, "code", (node) => {
            if (node.lang === "uml" && !!node.value) {
                matches.push(node);
            }
        });
@@ -23,14 +25,29 @@ module.exports = () => {
        }

        const id = Math.random().toString().substring(2);
        syntaxTree.children.unshift({ type: 'import', value: `import ThemedImage${id} from '@theme/ThemedImage'` });
        syntaxTree.children.unshift({
            type: "import",
            value: `import ThemedImage${id} from '@theme/ThemedImage'`,
        });

        await Promise.all(matches.map(async node => {
            const lightSvg = await umlToSvgDataUri(node.value.replace('@startuml', '@startuml\n!theme bluegray'));
        await Promise.all(
            matches.map(async (node) => {
                const lightSvg = await umlToSvgDataUri(
                    node.value.replace(
                        "@startuml",
                        "@startuml\n!theme bluegray"
                    )
                );
                // Workaround https://github.com/bschwarz/puml-themes/issues/15
            const darkSvg = await umlToSvgDataUri(node.value.replace('@startuml', '@startuml\n!theme cyborg\nskinparam SequenceDelayFontColor $FGCOLOR'));
            node.type = 'jsx';
                const darkSvg = await umlToSvgDataUri(
                    node.value.replace(
                        "@startuml",
                        "@startuml\n!theme cyborg\nskinparam SequenceDelayFontColor $FGCOLOR"
                    )
                );
                node.type = "jsx";
                node.value = `<ThemedImage${id} sources={{ light: "${lightSvg}", dark: "${darkSvg}" }} />`;
        }));
    }
}
            })
        );
    };
};
+5 −5
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@
        "lint": "next lint"
    },
    "dependencies": {
        "@fluentui/react": "^8.104.0",
        "@fluentui/react": "^8.104.1",
        "@fluentui/react-file-type-icons": "^8.8.4",
        "@fluentui/react-hooks": "^8.6.14",
        "@fluentui/react-icons": "^2.0.190",
@@ -33,7 +33,7 @@
        "@yume-chan/struct": "workspace:^0.0.17",
        "mobx": "^6.7.0",
        "mobx-react-lite": "^3.4.0",
        "next": "13.1.0",
        "next": "13.1.1",
        "react": "^18.2.0",
        "react-dom": "^18.2.0",
        "xterm": "^5.1.0",
@@ -43,10 +43,10 @@
    },
    "devDependencies": {
        "@mdx-js/loader": "^2.2.1",
        "@next/mdx": "^13.1.0",
        "@next/mdx": "^13.1.1",
        "@types/react": "18.0.26",
        "eslint": "^8.30.0",
        "eslint-config-next": "13.1.0",
        "eslint": "^8.31.0",
        "eslint-config-next": "13.1.1",
        "source-map-loader": "^4.0.1",
        "typescript": "^4.9.4"
    }
+1849 −3103

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
{
  "pnpmShrinkwrapHash": "fc12d2ee6b42782689d955ce4e6070b3774bab58",
  "pnpmShrinkwrapHash": "9b47a0132b67e3dcc20c38064f43b28f8a00584d",
  "preferredVersionsHash": "bf21a9e8fbc5a3846fb05b4fa0859e0917b2202f"
}
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
    "devDependencies": {
        "@yume-chan/eslint-config": "workspace:^1.0.0",
        "@yume-chan/tsconfig": "workspace:^1.0.0",
        "eslint": "^8.30.0",
        "eslint": "^8.31.0",
        "typescript": "^4.9.4"
    },
    "dependencies": {
Loading