This commit is contained in:
2026-07-08 18:29:36 +08:00
parent ad51ced86c
commit 3af8ff9b80
1613 changed files with 701644 additions and 2 deletions
+4
View File
@@ -0,0 +1,4 @@
export { Console, _ignoreErrors, _stderr, _stderrErrorHandler, _stdout, _stdoutErrorHandler, _times, } from "unenv/node/console";
export declare const assert: any, clear: any, context: any, count: any, countReset: any, createTask: any, debug: any, dir: any, dirxml: any, error: any, group: any, groupCollapsed: any, groupEnd: any, info: any, log: any, profile: any, profileEnd: any, table: any, time: any, timeEnd: any, timeLog: any, timeStamp: any, trace: any, warn: any;
declare const _default: any;
export default _default;
+57
View File
@@ -0,0 +1,57 @@
import {
_ignoreErrors,
_stderr,
_stderrErrorHandler,
_stdout,
_stdoutErrorHandler,
_times,
Console
} from "unenv/node/console";
export {
Console,
_ignoreErrors,
_stderr,
_stderrErrorHandler,
_stdout,
_stdoutErrorHandler,
_times
} from "unenv/node/console";
const workerdConsole = globalThis["console"];
export const {
assert,
clear,
// @ts-expect-error undocumented public API
context,
count,
countReset,
// @ts-expect-error undocumented public API
createTask,
debug,
dir,
dirxml,
error,
group,
groupCollapsed,
groupEnd,
info,
log,
profile,
profileEnd,
table,
time,
timeEnd,
timeLog,
timeStamp,
trace,
warn
} = workerdConsole;
Object.assign(workerdConsole, {
Console,
_ignoreErrors,
_stderr,
_stderrErrorHandler,
_stdout,
_stdoutErrorHandler,
_times
});
export default workerdConsole;
+5
View File
@@ -0,0 +1,5 @@
export declare const getBuiltinModule: NodeJS.Process["getBuiltinModule"];
export declare const exit: (code?: number | string | null | undefined) => never, features: NodeJS.ProcessFeatures, platform: NodeJS.Platform;
export declare const _channel: any, _debugEnd: any, _debugProcess: any, _disconnect: any, _events: any, _eventsCount: any, _exiting: any, _fatalException: any, _getActiveHandles: any, _getActiveRequests: any, _handleQueue: any, _kill: any, _linkedBinding: any, _maxListeners: any, _pendingMessage: any, _preload_modules: any, _rawDebug: any, _send: any, _startProfilerIdleNotifier: any, _stopProfilerIdleNotifier: any, _tickCallback: any, abort: any, addListener: any, allowedNodeEnvironmentFlags: any, arch: any, argv: any, argv0: any, assert: any, availableMemory: any, binding: any, channel: any, chdir: any, config: any, connected: any, constrainedMemory: any, cpuUsage: any, cwd: any, debugPort: any, disconnect: any, dlopen: any, domain: any, emit: any, emitWarning: any, env: any, eventNames: any, execArgv: any, execPath: any, exitCode: any, finalization: any, getActiveResourcesInfo: any, getegid: any, geteuid: any, getgid: any, getgroups: any, getMaxListeners: any, getuid: any, hasUncaughtExceptionCaptureCallback: any, hrtime: any, initgroups: any, kill: any, listenerCount: any, listeners: any, loadEnvFile: any, mainModule: any, memoryUsage: any, moduleLoadList: any, nextTick: any, off: any, on: any, once: any, openStdin: any, permission: any, pid: any, ppid: any, prependListener: any, prependOnceListener: any, rawListeners: any, reallyExit: any, ref: any, release: any, removeAllListeners: any, removeListener: any, report: any, resourceUsage: any, send: any, setegid: any, seteuid: any, setgid: any, setgroups: any, setMaxListeners: any, setSourceMapsEnabled: any, setuid: any, setUncaughtExceptionCaptureCallback: any, sourceMapsEnabled: any, stderr: any, stdin: any, stdout: any, throwDeprecation: any, title: any, traceDeprecation: any, umask: any, unref: any, uptime: any, version: any, versions: any;
declare const _default: NodeJS.Process;
export default _default;
+230
View File
@@ -0,0 +1,230 @@
import { hrtime as UnenvHrTime } from "unenv/node/internal/process/hrtime";
import { Process as UnenvProcess } from "unenv/node/internal/process/process";
const globalProcess = globalThis["process"];
export const getBuiltinModule = globalProcess.getBuiltinModule;
const workerdProcess = getBuiltinModule("node:process");
const unenvProcess = new UnenvProcess({
env: globalProcess.env,
hrtime: UnenvHrTime,
// `nextTick` is available from workerd process v1
nextTick: workerdProcess.nextTick
});
export const { exit, features, platform } = workerdProcess;
export const {
_channel,
_debugEnd,
_debugProcess,
_disconnect,
_events,
_eventsCount,
_exiting,
_fatalException,
_getActiveHandles,
_getActiveRequests,
_handleQueue,
_kill,
_linkedBinding,
_maxListeners,
_pendingMessage,
_preload_modules,
_rawDebug,
_send,
_startProfilerIdleNotifier,
_stopProfilerIdleNotifier,
_tickCallback,
abort,
addListener,
allowedNodeEnvironmentFlags,
arch,
argv,
argv0,
assert,
availableMemory,
binding,
channel,
chdir,
config,
connected,
constrainedMemory,
cpuUsage,
cwd,
debugPort,
disconnect,
dlopen,
domain,
emit,
emitWarning,
env,
eventNames,
execArgv,
execPath,
exitCode,
finalization,
getActiveResourcesInfo,
getegid,
geteuid,
getgid,
getgroups,
getMaxListeners,
getuid,
hasUncaughtExceptionCaptureCallback,
hrtime,
initgroups,
kill,
listenerCount,
listeners,
loadEnvFile,
mainModule,
memoryUsage,
moduleLoadList,
nextTick,
off,
on,
once,
openStdin,
permission,
pid,
ppid,
prependListener,
prependOnceListener,
rawListeners,
reallyExit,
ref,
release,
removeAllListeners,
removeListener,
report,
resourceUsage,
send,
setegid,
seteuid,
setgid,
setgroups,
setMaxListeners,
setSourceMapsEnabled,
setuid,
setUncaughtExceptionCaptureCallback,
sourceMapsEnabled,
stderr,
stdin,
stdout,
throwDeprecation,
title,
traceDeprecation,
umask,
unref,
uptime,
version,
versions
} = unenvProcess;
const _process = {
abort,
addListener,
allowedNodeEnvironmentFlags,
hasUncaughtExceptionCaptureCallback,
setUncaughtExceptionCaptureCallback,
loadEnvFile,
sourceMapsEnabled,
arch,
argv,
argv0,
chdir,
config,
connected,
constrainedMemory,
availableMemory,
cpuUsage,
cwd,
debugPort,
dlopen,
disconnect,
emit,
emitWarning,
env,
eventNames,
execArgv,
execPath,
exit,
finalization,
features,
getBuiltinModule,
getActiveResourcesInfo,
getMaxListeners,
hrtime,
kill,
listeners,
listenerCount,
memoryUsage,
nextTick,
on,
off,
once,
pid,
platform,
ppid,
prependListener,
prependOnceListener,
rawListeners,
release,
removeAllListeners,
removeListener,
report,
resourceUsage,
setMaxListeners,
setSourceMapsEnabled,
stderr,
stdin,
stdout,
title,
throwDeprecation,
traceDeprecation,
umask,
uptime,
version,
versions,
// @ts-expect-error old API
domain,
initgroups,
moduleLoadList,
reallyExit,
openStdin,
assert,
binding,
send,
exitCode,
channel,
getegid,
geteuid,
getgid,
getgroups,
getuid,
setegid,
seteuid,
setgid,
setgroups,
setuid,
permission,
mainModule,
_events,
_eventsCount,
_exiting,
_maxListeners,
_debugEnd,
_debugProcess,
_fatalException,
_getActiveHandles,
_getActiveRequests,
_kill,
_preload_modules,
_rawDebug,
_startProfilerIdleNotifier,
_stopProfilerIdleNotifier,
_tickCallback,
_disconnect,
_handleQueue,
_pendingMessage,
_channel,
_send,
_linkedBinding
};
export default _process;
@@ -0,0 +1,3 @@
{
"sideEffects": true
}
@@ -0,0 +1 @@
export {};
@@ -0,0 +1,29 @@
import {
performance,
Performance,
PerformanceEntry,
PerformanceMark,
PerformanceMeasure,
PerformanceObserver,
PerformanceObserverEntryList,
PerformanceResourceTiming
} from "node:perf_hooks";
if (!("__unenv__" in performance)) {
const proto = Performance.prototype;
for (const key of Object.getOwnPropertyNames(proto)) {
if (key !== "constructor" && !(key in performance)) {
const desc = Object.getOwnPropertyDescriptor(proto, key);
if (desc) {
Object.defineProperty(performance, key, desc);
}
}
}
}
globalThis.performance = performance;
globalThis.Performance = Performance;
globalThis.PerformanceEntry = PerformanceEntry;
globalThis.PerformanceMark = PerformanceMark;
globalThis.PerformanceMeasure = PerformanceMeasure;
globalThis.PerformanceObserver = PerformanceObserver;
globalThis.PerformanceObserverEntryList = PerformanceObserverEntryList;
globalThis.PerformanceResourceTiming = PerformanceResourceTiming;