mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Refactor: Bun.peek polyfill for Node.js
This commit is contained in:
@@ -5,6 +5,7 @@ import path from 'path';
|
||||
import { mkdirSync } from 'fs';
|
||||
import picocolors from 'picocolors';
|
||||
import { fastStringArrayJoin } from './misc';
|
||||
import { peek } from 'bun';
|
||||
|
||||
const identity = (x: any) => x;
|
||||
|
||||
@@ -178,7 +179,7 @@ export class Cache<S = string> {
|
||||
const serializer = 'serializer' in opt ? opt.serializer : identity;
|
||||
|
||||
const promise = fn();
|
||||
const peeked = Bun.peek(promise);
|
||||
const peeked = peek(promise);
|
||||
|
||||
if (peeked === promise) {
|
||||
return promise.then((value) => {
|
||||
|
||||
Reference in New Issue
Block a user