diff --git a/components/SvgConverter.tsx b/components/SvgConverter.tsx index 9e1f3094..56ccfedb 100644 --- a/components/SvgConverter.tsx +++ b/components/SvgConverter.tsx @@ -4,7 +4,17 @@ import { EditorPanelProps } from "@components/EditorPanel"; import Form from "@components/Form"; import ConversionPanel, { Transformer } from "@components/ConversionPanel"; import { Alert, Badge, Heading, Pane } from "evergreen-ui"; -import svgToDataUrl from "svg-to-dataurl"; + +const svgToDataUrl = (svgStr: string) => { + const encoded = encodeURIComponent(svgStr) + .replace(/'/g, "%27") + .replace(/"/g, "%22"); + + const header = "data:image/svg+xml,"; + const dataUrl = header + encoded; + + return dataUrl; +}; interface SvgConverterProps { name: string; diff --git a/package.json b/package.json index 11a62302..33da7d3d 100644 --- a/package.json +++ b/package.json @@ -9,13 +9,13 @@ "dev": "next dev", "start": "next start", "format": "prettier --write '**/*.ts' '**/*.tsx'", - "build": "next build", + "build": "NODE_OPTIONS=--openssl-legacy-provider next build", "now-build": "next build", "postinstall": "patch-package", "build:analyze": "ANALYZE=true yarn build" }, "engines": { - "node": "16.x" + "node": "20.x" }, "dependencies": { "@babel/plugin-transform-flow-strip-types": "^7.16.0", @@ -89,7 +89,6 @@ "rust-keywords": "^1.1.0", "sha1": "^1.1.1", "stringify-object": "^3.3.0", - "svg-to-dataurl": "^1.0.0", "svgo": "^1.3.2", "tempy": "^1.0.1", "text-encoding-utf-8": "^1.0.2", @@ -125,5 +124,6 @@ "./assets/*/*.svg": [ "imagemin-lint-staged" ] - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/now.json b/vercel.json similarity index 81% rename from now.json rename to vercel.json index 5752e8b2..4a4c7e8c 100644 --- a/now.json +++ b/vercel.json @@ -1,5 +1,9 @@ { - "version": 2, + "build": { + "env": { + "NODE_OPTIONS": "--openssl-legacy-provider" + } + }, "redirects": [ { "source": "/svg-to-jsx", diff --git a/yarn.lock b/yarn.lock index 94155dce..ad737c1d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9429,11 +9429,6 @@ svg-parser@^2.0.2: resolved "https://registry.yarnpkg.com/svg-parser/-/svg-parser-2.0.4.tgz#fdc2e29e13951736140b76cb122c8ee6630eb6b5" integrity sha512-e4hG1hRwoOdRb37cIMSgzNsxyzKfayW6VOflrwvR+/bzrkyxY/31WkbgnQpgtrNp1SdpJvpUAGTa/ZoiPNDuRQ== -svg-to-dataurl@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/svg-to-dataurl/-/svg-to-dataurl-1.0.0.tgz#343f21a5dc3e051ae413c590cf478b7cf7a5f070" - integrity sha512-WrPB9vdd4RO0BjcPN6NJ9ofj3Zt8de16TJZ+JVJ4LnE2OKNGz+HjgGv6rE5Hp3s+OnM56X9i64mfJDU9uf4ZqQ== - svgo@^1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/svgo/-/svgo-1.3.2.tgz#b6dc511c063346c9e415b81e43401145b96d4167"