From c2a77cf7ec9de9eadf938046bdf78e58561c8a6d Mon Sep 17 00:00:00 2001 From: dave caruso Date: Wed, 2 Aug 2023 16:27:36 -0700 Subject: Rewrite built-in modules to use CommonJS over ESM (#3814) * stfdsafsd sadffdsa stuff finish commonjs stuff asdf not done but work not done but work not done yet but this is how far i am remove files lol update built files uncomment everything in events lol export default stuff * afdsafsd * its not perfect but almost done * okay * cool * remove temp file * finish rebase * revert settings.json * a * ch-ch-ch-ch-changes * okay * remove this check in release for now * sxdcfghnjm, * lkjhgf * fmt * filename can be null * Update NodeModuleModule.h * weee * fmt --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/js/node/util.js | 82 +++++++++++------------------------------------------ 1 file changed, 17 insertions(+), 65 deletions(-) (limited to 'src/js/node/util.js') diff --git a/src/js/node/util.js b/src/js/node/util.js index 2ec4aadb9..92d77701e 100644 --- a/src/js/node/util.js +++ b/src/js/node/util.js @@ -1,22 +1,13 @@ // Hardcoded module "node:util" -import * as types from "node:util/types"; -export { default as types } from "node:util/types"; +const types = require("node:util/types"); var cjs_exports = {}; -export default cjs_exports; - -var __getOwnPropNames = Object.getOwnPropertyNames; -var __commonJS = (cb, mod) => - function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - function isBufferInterface({ copy, fill, readUint8 }) { return typeof copy === "function" && typeof fill === "function" && typeof readUint8 === "function"; } -export function isBuffer(value) { +function isBuffer(value) { return ( Buffer.isBuffer(value) || // incase it ends up as a browserify buffer @@ -28,22 +19,6 @@ function isFunction(value) { return typeof value === "function"; } -// node_modules/inherits/inherits_browser.js -var require_inherits_browser = __commonJS({ - "node_modules/inherits/inherits_browser.js"(exports, module2) { - module2.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true, - }, - }); - }; - }, -}); const deepEquals = Bun.deepEquals; const isDeepStrictEqual = (a, b) => deepEquals(a, b, true); var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors; @@ -244,7 +219,7 @@ function formatValue(ctx, value, recurseTimes) { var base = "", array = false, braces = ["{", "}"]; - if (isArray(value)) { + if ($isArray(value)) { array = true; braces = ["[", "]"]; } @@ -393,10 +368,6 @@ function reduceToSingleString(output, base, braces) { return braces[0] + base + " " + output.join(", ") + " " + braces[1]; } -function isArray(ar) { - return Array.isArray(ar); -} - function isBoolean(arg) { return typeof arg === "boolean"; } @@ -416,6 +387,7 @@ function isNumber(arg) { function isString(arg) { return typeof arg === "string"; } + function isSymbol(arg) { return typeof arg === "symbol"; } @@ -450,7 +422,17 @@ function timestamp() { var log = function log() { console.log("%s - %s", timestamp(), format.apply(cjs_exports, arguments)); }; -var inherits = (inherits = require_inherits_browser()); +var inherits = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true, + }, + }); +}; var _extend = function (origin, add) { if (!add || !isObject(add)) return origin; var keys = Object.keys(add); @@ -550,20 +532,18 @@ function callbackify(original) { Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)); return callbackified; } -export var TextDecoder = globalThis.TextDecoder; -export var TextEncoder = globalThis.TextEncoder; var toUSVString = input => { return (input + "").toWellFormed(); }; -Object.assign(cjs_exports, { +export default Object.assign(cjs_exports, { format, deprecate, debuglog, _extend, inspect, types, - isArray, + isArray: $isArray, isBoolean, isNull, isNullOrUndefined, @@ -586,32 +566,4 @@ Object.assign(cjs_exports, { isDeepStrictEqual, TextDecoder, TextEncoder, - [Symbol.for("CommonJS")]: 0, }); - -export { - format, - deprecate, - debuglog, - inspect, - isArray, - isBoolean, - isNull, - isNullOrUndefined, - isNumber, - isString, - isSymbol, - isUndefined, - isRegExp, - isObject, - isDate, - isError, - isFunction, - isPrimitive, - log, - inherits, - promisify, - callbackify, - isDeepStrictEqual, - toUSVString, -}; -- cgit v1.2.3 stack-trace'>fix-prepare-stack-trace Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-linux-x64 (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2021-11-24deps: add missing mimalloc dep to jsc bindings header generatorGravatar Kenta Iwasaki 2-2/+3
2021-11-24deps: build picohttp and mimalloc using zigGravatar Kenta Iwasaki 2-131/+123
Reduce the amount of dependencies which need to be externally built before Bun can be built. Remove clause to enforce that Bash syntax is used in Makefile, as the clause only works on a few Linux distros which assume bash is located at /bin/bash.
2021-11-23update Next version on globalGravatar Jack Hanford 1-1/+1
2021-11-23Update build-idGravatar Jarred Sumner 1-1/+1
2021-11-23fix shallow routingGravatar Jack Hanford 1-4/+6
2021-11-23remove commentGravatar Jack Hanford 1-1/+0
2021-11-23add react-dom as devDepGravatar Jack Hanford 1-0/+1
2021-11-23stop installing textencoderGravatar Jack Hanford 3-2/+308
2021-11-23begin addressing more feedbackGravatar Jack Hanford 1-3/+3
2021-11-22remove .thenGravatar Jack Hanford 1-12/+3
2021-11-22another tryGravatar Jack Hanford 2-5/+1
2021-11-22add type fnsGravatar Jack Hanford 1-1/+4