mirror of
https://github.com/khairul169/code-share.git
synced 2026-10-24 11:53:58 +07:00
feat: rebuild app using vike
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
export const IS_DEV = process.env.NODE_ENV !== "production";
|
||||
export const BASE_URL = process.env.BASE_URL || "";
|
||||
@@ -0,0 +1,13 @@
|
||||
import bcrypt from "bcrypt";
|
||||
|
||||
export const hashPassword = (password: string) => {
|
||||
return bcrypt.hash(password, 10);
|
||||
};
|
||||
|
||||
export const verifyPassword = async (hash: string, password: string) => {
|
||||
try {
|
||||
return await bcrypt.compare(password, hash);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
import * as swc from "@swc/core";
|
||||
|
||||
export const transformJs = async (code: string) => {
|
||||
try {
|
||||
const result = await swc.transform(code, {
|
||||
jsc: {
|
||||
parser: {
|
||||
jsx: true,
|
||||
syntax: "ecmascript",
|
||||
},
|
||||
target: "es5",
|
||||
},
|
||||
});
|
||||
|
||||
return result.code;
|
||||
} catch (err) {
|
||||
return code;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user