aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/util.exports.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-31 17:55:16 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-01-31 17:55:16 -0800
commitcc4326cd829decc95d1f1f23998f97705637e04b (patch)
tree9ccaa829b6d48af521d5e5fcdbabc0dac8d186af /src/bun.js/util.exports.js
parentc57b37d29f9d04780c7f7917789cf8b424710d23 (diff)
downloadbun-cc4326cd829decc95d1f1f23998f97705637e04b.tar.gz
bun-cc4326cd829decc95d1f1f23998f97705637e04b.tar.zst
bun-cc4326cd829decc95d1f1f23998f97705637e04b.zip
Re-run prettier after changes
Diffstat (limited to 'src/bun.js/util.exports.js')
-rw-r--r--src/bun.js/util.exports.js76
1 files changed, 12 insertions, 64 deletions
diff --git a/src/bun.js/util.exports.js b/src/bun.js/util.exports.js
index a3067dae6..1bba01977 100644
--- a/src/bun.js/util.exports.js
+++ b/src/bun.js/util.exports.js
@@ -1,19 +1,13 @@
var __getOwnPropNames = Object.getOwnPropertyNames;
var __commonJS = (cb, mod) =>
function __require() {
- return (
- mod ||
- (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod),
- mod.exports
- );
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
export function isBuffer(value) {
return (
Buffer.isBuffer(value) ||
// incase it ends up as a browserify buffer
- (typeof arg?.copy === "function" &&
- typeof arg?.fill === "function" &&
- typeof arg?.readUInt8 === "function")
+ (typeof arg?.copy === "function" && typeof arg?.fill === "function" && typeof arg?.readUInt8 === "function")
);
}
@@ -178,15 +172,7 @@ inspect.styles = {
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
- return (
- "\x1B[" +
- inspect.colors[style][0] +
- "m" +
- str +
- "\x1B[" +
- inspect.colors[style][1] +
- "m"
- );
+ return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m";
} else {
return str;
}
@@ -224,10 +210,7 @@ function formatValue(ctx, value, recurseTimes) {
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
- if (
- isError(value) &&
- (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)
- ) {
+ if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
return formatError(value);
}
if (keys.length === 0) {
@@ -290,13 +273,7 @@ function formatValue(ctx, value, recurseTimes) {
function formatPrimitive(ctx, value) {
if (isUndefined(value)) return ctx.stylize("undefined", "undefined");
if (isString(value)) {
- var simple =
- "'" +
- JSON.stringify(value)
- .replace(/^"|"$/g, "")
- .replace(/'/g, "\\'")
- .replace(/\\"/g, '"') +
- "'";
+ var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
return ctx.stylize(simple, "string");
}
if (isNumber(value)) return ctx.stylize("" + value, "number");
@@ -310,18 +287,14 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
- output.push(
- formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true),
- );
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
} else {
output.push("");
}
}
keys.forEach(function (key) {
if (!key.match(/^\d+$/)) {
- output.push(
- formatProperty(ctx, value, recurseTimes, visibleKeys, key, true),
- );
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
}
});
return output;
@@ -402,14 +375,7 @@ function reduceToSingleString(output, base, braces) {
return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
}, 0);
if (length > 60) {
- return (
- braces[0] +
- (base === "" ? "" : base + "\n ") +
- " " +
- output.join(",\n ") +
- " " +
- braces[1]
- );
+ return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
}
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
}
@@ -473,25 +439,10 @@ exports.isBuffer = isBuffer;
function pad(n) {
return n < 10 ? "0" + n.toString(10) : n.toString(10);
}
-var months = [
- "Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec",
-];
+var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
function timestamp() {
var d = new Date();
- var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(
- ":",
- );
+ var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(":");
return [d.getDate(), months[d.getMonth()], time].join(" ");
}
var log = (exports.log = function () {
@@ -512,14 +463,11 @@ function hasOwnProperty(obj, prop) {
}
var kCustomPromisifiedSymbol = Symbol.for("util.promisify.custom");
var promisify = (exports.promisify = function promisify(original) {
- if (typeof original !== "function")
- throw new TypeError('The "original" argument must be of type Function');
+ if (typeof original !== "function") throw new TypeError('The "original" argument must be of type Function');
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
var fn = original[kCustomPromisifiedSymbol];
if (typeof fn !== "function") {
- throw new TypeError(
- 'The "util.promisify.custom" argument must be of type Function',
- );
+ throw new TypeError('The "util.promisify.custom" argument must be of type Function');
}
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn,
Schott 33-1038/+1096 * [ci] update lockfile * chore: fix lockfile * fix: pin turbo Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com> Co-authored-by: Nate Moore <nate@skypack.dev> 2022-05-12[ci] formatGravatar matthewp 2-2/+2 2022-05-12add error hints (#3350)Gravatar Fred K. Schott 3-0/+19 * add error hints * chore: add changeset Co-authored-by: Nate Moore <nate@skypack.dev> 2022-05-12[ci] formatGravatar matthewp 2-10/+6 2022-05-12Fix: React - Use "createRoot" instead of "hydrateRoot" for `client:only` (#3337)Gravatar Ben Holmes 4-22/+34 * feat: pass "client" directive to clientEntrypoints * refactor: remove hydration warning suppression react 17 * feat: remove hydration warning suppression react 18 * chore: changeset * fix: change metadata to options bag 2022-05-12[ci] formatGravatar matthewp 1-2/+8 2022-05-12Resolve components by module ID during compilation (#3300)Gravatar Tony Sullivan 22-41/+407 * WIP: adding test coverage * test fixes * moving the shared lib up a directory to reproduce the bug * fix: transform with the module ID instead of parsing the filepath * adding the shared lib to the workspaces list * fix: client-only assets now get the full URL from vite * why is this needed for windows? * WIP: using /@fs to handle windows filepaths * fix: remove /@fs from hoisted script imports * nit: removing unused imports * fix: strip off the path root when mapping client:only styles * had to reverse the `/@fs` handling to work on windows and unix * chore: adding comments to explain the fix * chore: adding changeset 2022-05-12[ci] collect statsGravatar FredKSchott 1-0/+1 2022-05-11Exclude `node-fetch` from vite.optimizeDeps (#3348)Gravatar Nate Moore 2-0/+6 * fix: exclude `node-fetch` from vite.optimizeDeps * chore: format 2022-05-11fix: updated blog template with existing address (#3312)Gravatar Gautier Ben Aïm 1-2/+2 2022-05-11refactor(vercel): Build Output API v3 (#3216)Gravatar Juan Martín Seery 42-231/+659 * Removed ignores * Migration to v3 * More changes * Remove legacy redirects * Fail when there is no ENABLE_VC_BUILD * Fix edge * Updated readme * Changeset * Added static mode * Updated documentation * Updated shim * Made edge work! * Updated changeset * Ensure empty dir * Fixed redirects for dynamic paths * Removed extra declaration * Splited imports * Updated readme * Fixed some urls * Deprecated shim! * [test]: Vercel NFT * Beautify * Edge bundle to node 14.19 Vercel runs 14.19.1 (I've checked it manually) * Re-added shim (#3304) * Added `node:` prefix * Use the same bundling as Deno for Edge * Remove esbuild * Fixed shim * Moved nft * Updated changeset * Added note about Edge * fix typo * Added support for Node 16 (vercel/vercel#7772) 2022-05-11Fix APIRoute type (#3344)Gravatar Matthew Phillips 3-11/+8 * Fix APIRoute type * Adds a changeset * Update usage of the two API route signatures 2022-05-11[create-astro] Finalize developer experience... with gradients 🚀 (#3313)Gravatar Ben Holmes 5-23/+123 * wip: port gradient helpers from sandbox ideas * feat: wire up rocket gradient 🚀 * feat: wire up rocket gradient on install step * refactor: update "next steps" wording * deps: add chalk (for rendering gradient) * chore: changeset * chore: clean up sstray template string