Skip to content

Commit

Permalink
🌍 Temporarily hack around bun jsx unicode bug
Browse files Browse the repository at this point in the history
  • Loading branch information
KimlikDAO-bot committed Sep 11, 2024
1 parent a7eeb48 commit ed04b7d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions kastro/compiler/component.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import { Parser } from "htmlparser2";
import { readdir, readFile } from "node:fs/promises";
import { KapalıTag, tagYaz } from "../../util/html";
import { LangCode } from "../crate";
import { CompilerError } from "./compiler";
import { renderParagraph } from "./latex";

/** @const {string} */
const ğ = new TextDecoder().decode(Uint8Array.from([195, 132, 194, 159]));
const Fixes = {
"ü": "ü",
[new TextDecoder().decode(Uint8Array.from([195, 132, 194, 159]))]: 'ğ',
[new TextDecoder().decode(Uint8Array.from([195, 133, 194, 159]))]: 'ş',
[new TextDecoder().decode(Uint8Array.from([195, 132, 194, 177]))]: 'ı',
[new TextDecoder().decode(Uint8Array.from([195, 132, 194, 176]))]: 'İ',
[new TextDecoder().decode(Uint8Array.from([195, 131, 194, 182]))]: 'ö',
[new TextDecoder().decode(Uint8Array.from([195, 132, 194, 159]))]: 'ğ',
};

const FixesRegex = new RegExp(Object.keys(Fixes).join("|"), "g");

const normalizePath = (path) => path.replace(/^(\/|\.\/)/, '')
.replaceAll("ü", "ü")
.replaceAll(ğ, "ğ");
.replace(FixesRegex, (match) => Fixes[match]);

const getComponentFiles = (name) => readdir(name).then((files) => {
const css = files.find((file) => file.endsWith('.css'));
Expand All @@ -26,7 +33,7 @@ const getComponentFiles = (name) => readdir(name).then((files) => {
markup: `${name}/${markup}`,
css: css ? `${name}/${css}` : null
};
});
}, () => console.log(name, new TextEncoder().encode(name)));

/**
* @param {string} name
Expand Down

0 comments on commit ed04b7d

Please sign in to comment.