initial commit
This commit is contained in:
194
node_modules/unenv/runtime/node/process/_process.cjs
generated
vendored
Normal file
194
node_modules/unenv/runtime/node/process/_process.cjs
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.process = void 0;
|
||||
const process = {};
|
||||
exports.process = process;
|
||||
let cachedSetTimeout;
|
||||
let cachedClearTimeout;
|
||||
|
||||
function defaultSetTimeout() {
|
||||
throw new Error("setTimeout has not been defined");
|
||||
}
|
||||
|
||||
function defaultClearTimeout() {
|
||||
throw new Error("clearTimeout has not been defined");
|
||||
}
|
||||
|
||||
(function () {
|
||||
try {
|
||||
cachedSetTimeout = typeof setTimeout === "function" ? setTimeout : defaultSetTimeout;
|
||||
} catch {
|
||||
cachedSetTimeout = defaultSetTimeout;
|
||||
}
|
||||
|
||||
try {
|
||||
cachedClearTimeout = typeof clearTimeout === "function" ? clearTimeout : defaultClearTimeout;
|
||||
} catch {
|
||||
cachedClearTimeout = defaultClearTimeout;
|
||||
}
|
||||
})();
|
||||
|
||||
function runTimeout(fun) {
|
||||
if (cachedSetTimeout === setTimeout) {
|
||||
return setTimeout(fun, 0);
|
||||
}
|
||||
|
||||
if ((cachedSetTimeout === defaultSetTimeout || !cachedSetTimeout) && setTimeout) {
|
||||
cachedSetTimeout = setTimeout;
|
||||
return setTimeout(fun, 0);
|
||||
}
|
||||
|
||||
try {
|
||||
return cachedSetTimeout(fun, 0);
|
||||
} catch {
|
||||
try {
|
||||
return cachedSetTimeout.call(null, fun, 0);
|
||||
} catch {
|
||||
return cachedSetTimeout.call(this, fun, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function runClearTimeout(marker) {
|
||||
if (cachedClearTimeout === clearTimeout) {
|
||||
return clearTimeout(marker);
|
||||
}
|
||||
|
||||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
||||
cachedClearTimeout = clearTimeout;
|
||||
return clearTimeout(marker);
|
||||
}
|
||||
|
||||
try {
|
||||
return cachedClearTimeout(marker);
|
||||
} catch {
|
||||
try {
|
||||
return cachedClearTimeout.call(null, marker);
|
||||
} catch {
|
||||
return cachedClearTimeout.call(this, marker);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let queue = [];
|
||||
let draining = false;
|
||||
let currentQueue;
|
||||
let queueIndex = -1;
|
||||
|
||||
function cleanUpNextTick() {
|
||||
if (!draining || !currentQueue) {
|
||||
return;
|
||||
}
|
||||
|
||||
draining = false;
|
||||
|
||||
if (currentQueue.length > 0) {
|
||||
queue = [...currentQueue, ...queue];
|
||||
} else {
|
||||
queueIndex = -1;
|
||||
}
|
||||
|
||||
if (queue.length > 0) {
|
||||
drainQueue();
|
||||
}
|
||||
}
|
||||
|
||||
function drainQueue() {
|
||||
if (draining) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timeout = runTimeout(cleanUpNextTick);
|
||||
draining = true;
|
||||
let len = queue.length;
|
||||
|
||||
while (len) {
|
||||
currentQueue = queue;
|
||||
queue = [];
|
||||
|
||||
while (++queueIndex < len) {
|
||||
if (currentQueue) {
|
||||
currentQueue[queueIndex].run();
|
||||
}
|
||||
}
|
||||
|
||||
queueIndex = -1;
|
||||
len = queue.length;
|
||||
}
|
||||
|
||||
currentQueue = null;
|
||||
draining = false;
|
||||
runClearTimeout(timeout);
|
||||
}
|
||||
|
||||
process.nextTick = function (fun) {
|
||||
const args = Array.from({
|
||||
length: arguments.length - 1
|
||||
});
|
||||
|
||||
if (arguments.length > 1) {
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
args[i - 1] = arguments[i];
|
||||
}
|
||||
}
|
||||
|
||||
queue.push(new Item(fun, args));
|
||||
|
||||
if (queue.length === 1 && !draining) {
|
||||
runTimeout(drainQueue);
|
||||
}
|
||||
};
|
||||
|
||||
function Item(fun, array) {
|
||||
this.fun = fun;
|
||||
this.array = array;
|
||||
}
|
||||
|
||||
Item.prototype.run = function () {
|
||||
this.fun.apply(null, this.array);
|
||||
};
|
||||
|
||||
process.title = "unenv";
|
||||
process.env = {};
|
||||
process.argv = [];
|
||||
process.version = "";
|
||||
process.versions = {};
|
||||
|
||||
function noop() {
|
||||
return process;
|
||||
}
|
||||
|
||||
process.on = noop;
|
||||
process.addListener = noop;
|
||||
process.once = noop;
|
||||
process.off = noop;
|
||||
process.removeListener = noop;
|
||||
process.removeAllListeners = noop;
|
||||
process.emit = noop;
|
||||
process.prependListener = noop;
|
||||
process.prependOnceListener = noop;
|
||||
|
||||
process.listeners = function (name) {
|
||||
return [];
|
||||
};
|
||||
|
||||
process.binding = function (name) {
|
||||
throw new Error("[unenv] process.binding is not supported");
|
||||
};
|
||||
|
||||
let cwd = "/";
|
||||
|
||||
process.cwd = function () {
|
||||
return cwd;
|
||||
};
|
||||
|
||||
process.chdir = function (dir) {
|
||||
cwd = dir;
|
||||
};
|
||||
|
||||
process.umask = function () {
|
||||
return 0;
|
||||
};
|
||||
2
node_modules/unenv/runtime/node/process/_process.d.ts
generated
vendored
Normal file
2
node_modules/unenv/runtime/node/process/_process.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference types="node" />
|
||||
export declare const process: NodeJS.Process;
|
||||
149
node_modules/unenv/runtime/node/process/_process.mjs
generated
vendored
Normal file
149
node_modules/unenv/runtime/node/process/_process.mjs
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
export const process = {};
|
||||
let cachedSetTimeout;
|
||||
let cachedClearTimeout;
|
||||
function defaultSetTimeout() {
|
||||
throw new Error("setTimeout has not been defined");
|
||||
}
|
||||
function defaultClearTimeout() {
|
||||
throw new Error("clearTimeout has not been defined");
|
||||
}
|
||||
(function() {
|
||||
try {
|
||||
cachedSetTimeout = typeof setTimeout === "function" ? setTimeout : defaultSetTimeout;
|
||||
} catch {
|
||||
cachedSetTimeout = defaultSetTimeout;
|
||||
}
|
||||
try {
|
||||
cachedClearTimeout = typeof clearTimeout === "function" ? clearTimeout : defaultClearTimeout;
|
||||
} catch {
|
||||
cachedClearTimeout = defaultClearTimeout;
|
||||
}
|
||||
})();
|
||||
function runTimeout(fun) {
|
||||
if (cachedSetTimeout === setTimeout) {
|
||||
return setTimeout(fun, 0);
|
||||
}
|
||||
if ((cachedSetTimeout === defaultSetTimeout || !cachedSetTimeout) && setTimeout) {
|
||||
cachedSetTimeout = setTimeout;
|
||||
return setTimeout(fun, 0);
|
||||
}
|
||||
try {
|
||||
return cachedSetTimeout(fun, 0);
|
||||
} catch {
|
||||
try {
|
||||
return cachedSetTimeout.call(null, fun, 0);
|
||||
} catch {
|
||||
return cachedSetTimeout.call(this, fun, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
function runClearTimeout(marker) {
|
||||
if (cachedClearTimeout === clearTimeout) {
|
||||
return clearTimeout(marker);
|
||||
}
|
||||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
||||
cachedClearTimeout = clearTimeout;
|
||||
return clearTimeout(marker);
|
||||
}
|
||||
try {
|
||||
return cachedClearTimeout(marker);
|
||||
} catch {
|
||||
try {
|
||||
return cachedClearTimeout.call(null, marker);
|
||||
} catch {
|
||||
return cachedClearTimeout.call(this, marker);
|
||||
}
|
||||
}
|
||||
}
|
||||
let queue = [];
|
||||
let draining = false;
|
||||
let currentQueue;
|
||||
let queueIndex = -1;
|
||||
function cleanUpNextTick() {
|
||||
if (!draining || !currentQueue) {
|
||||
return;
|
||||
}
|
||||
draining = false;
|
||||
if (currentQueue.length > 0) {
|
||||
queue = [...currentQueue, ...queue];
|
||||
} else {
|
||||
queueIndex = -1;
|
||||
}
|
||||
if (queue.length > 0) {
|
||||
drainQueue();
|
||||
}
|
||||
}
|
||||
function drainQueue() {
|
||||
if (draining) {
|
||||
return;
|
||||
}
|
||||
const timeout = runTimeout(cleanUpNextTick);
|
||||
draining = true;
|
||||
let len = queue.length;
|
||||
while (len) {
|
||||
currentQueue = queue;
|
||||
queue = [];
|
||||
while (++queueIndex < len) {
|
||||
if (currentQueue) {
|
||||
currentQueue[queueIndex].run();
|
||||
}
|
||||
}
|
||||
queueIndex = -1;
|
||||
len = queue.length;
|
||||
}
|
||||
currentQueue = null;
|
||||
draining = false;
|
||||
runClearTimeout(timeout);
|
||||
}
|
||||
process.nextTick = function(fun) {
|
||||
const args = Array.from({ length: arguments.length - 1 });
|
||||
if (arguments.length > 1) {
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
args[i - 1] = arguments[i];
|
||||
}
|
||||
}
|
||||
queue.push(new Item(fun, args));
|
||||
if (queue.length === 1 && !draining) {
|
||||
runTimeout(drainQueue);
|
||||
}
|
||||
};
|
||||
function Item(fun, array) {
|
||||
this.fun = fun;
|
||||
this.array = array;
|
||||
}
|
||||
Item.prototype.run = function() {
|
||||
this.fun.apply(null, this.array);
|
||||
};
|
||||
process.title = "unenv";
|
||||
process.env = {};
|
||||
process.argv = [];
|
||||
process.version = "";
|
||||
process.versions = {};
|
||||
function noop() {
|
||||
return process;
|
||||
}
|
||||
process.on = noop;
|
||||
process.addListener = noop;
|
||||
process.once = noop;
|
||||
process.off = noop;
|
||||
process.removeListener = noop;
|
||||
process.removeAllListeners = noop;
|
||||
process.emit = noop;
|
||||
process.prependListener = noop;
|
||||
process.prependOnceListener = noop;
|
||||
process.listeners = function(name) {
|
||||
return [];
|
||||
};
|
||||
process.binding = function(name) {
|
||||
throw new Error("[unenv] process.binding is not supported");
|
||||
};
|
||||
let cwd = "/";
|
||||
process.cwd = function() {
|
||||
return cwd;
|
||||
};
|
||||
process.chdir = function(dir) {
|
||||
cwd = dir;
|
||||
};
|
||||
process.umask = function() {
|
||||
return 0;
|
||||
};
|
||||
11
node_modules/unenv/runtime/node/process/index.cjs
generated
vendored
Normal file
11
node_modules/unenv/runtime/node/process/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
module.exports = void 0;
|
||||
|
||||
var _process2 = require("./_process.cjs");
|
||||
|
||||
var _default = _process2.process;
|
||||
module.exports = _default;
|
||||
2
node_modules/unenv/runtime/node/process/index.d.ts
generated
vendored
Normal file
2
node_modules/unenv/runtime/node/process/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const _default: any;
|
||||
export default _default;
|
||||
2
node_modules/unenv/runtime/node/process/index.mjs
generated
vendored
Normal file
2
node_modules/unenv/runtime/node/process/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
import { process as _process } from "./_process.mjs";
|
||||
export default _process;
|
||||
Reference in New Issue
Block a user