mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Chore: simplify build infra / remove reject_phishing
This commit is contained in:
@@ -1,19 +1,21 @@
|
||||
import path from 'path';
|
||||
import picocolors from 'picocolors';
|
||||
|
||||
const traceSync = <T>(prefix: string, fn: () => T): T => {
|
||||
function traceSync<T>(prefix: string, fn: () => T): T {
|
||||
const start = Bun.nanoseconds();
|
||||
const result = fn();
|
||||
const end = Bun.nanoseconds();
|
||||
console.log(`${prefix}: ${((end - start) / 1e6).toFixed(3)}ms`);
|
||||
console.log(`${picocolors.gray(`[${((end - start) / 1e6).toFixed(3)}ms]`)} ${prefix}`);
|
||||
return result;
|
||||
};
|
||||
}
|
||||
traceSync.skip = <T>(prefix: string, fn: () => T): T => fn();
|
||||
export { traceSync };
|
||||
|
||||
const traceAsync = async <T>(prefix: string, fn: () => Promise<T>): Promise<T> => {
|
||||
const start = Bun.nanoseconds();
|
||||
const result = await fn();
|
||||
const end = Bun.nanoseconds();
|
||||
console.log(`${prefix}: ${((end - start) / 1e6).toFixed(3)}ms`);
|
||||
console.log(`${picocolors.gray(`[${((end - start) / 1e6).toFixed(3)}ms]`)} ${prefix}`);
|
||||
return result;
|
||||
};
|
||||
export { traceAsync };
|
||||
@@ -31,7 +33,7 @@ const task = <T>(importMetaPath: string, fn: () => Promise<T>, customname: strin
|
||||
const start = Bun.nanoseconds();
|
||||
await fn();
|
||||
const end = Bun.nanoseconds();
|
||||
console.log(`✅ [${taskName}] Executed successfully: ${((end - start) / 1e6).toFixed(3)}ms`);
|
||||
console.log(`✅ [${taskName}] [${((end - start) / 1e6).toFixed(3)}ms] Executed successfully`);
|
||||
|
||||
return { start, end, taskName } as TaskResult;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user