aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-22 13:53:00 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-22 13:53:24 -0700
commite869fc092f45d03aa0398613b316814a5219b762 (patch)
tree7d0129bf7b1fc11f15a6e2f9615e97bdee020107 /src/bun.js
parent2a6a5cf6d96cf4f24e193aaa5e8ed7fd0b37e034 (diff)
downloadbun-e869fc092f45d03aa0398613b316814a5219b762.tar.gz
bun-e869fc092f45d03aa0398613b316814a5219b762.tar.zst
bun-e869fc092f45d03aa0398613b316814a5219b762.zip
[node:buffer] Add missing `inspect` functionbun-v0.6.3
cc @paperdave
Diffstat (limited to 'src/bun.js')
-rw-r--r--src/bun.js/bindings/JSBuffer.cpp1
-rw-r--r--src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp13
-rw-r--r--src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h9
-rw-r--r--src/bun.js/builtins/js/JSBufferPrototype.js7
4 files changed, 30 insertions, 0 deletions
diff --git a/src/bun.js/bindings/JSBuffer.cpp b/src/bun.js/bindings/JSBuffer.cpp
index 9d66fa1db..5c41ba0b1 100644
--- a/src/bun.js/bindings/JSBuffer.cpp
+++ b/src/bun.js/bindings/JSBuffer.cpp
@@ -1817,6 +1817,7 @@ static const HashTableValue JSBufferPrototypeTableValues[]
{ "hexWrite"_s, static_cast<unsigned>(JSC::PropertyAttribute::Builtin), NoIntrinsic, { HashTableValue::BuiltinGeneratorType, jsBufferPrototypeHexWriteCodeGenerator, 1 } },
{ "includes"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferPrototypeFunction_includes, 3 } },
{ "indexOf"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferPrototypeFunction_indexOf, 3 } },
+ { "inspect"_s, static_cast<unsigned>(JSC::PropertyAttribute::Builtin), NoIntrinsic, { HashTableValue::BuiltinGeneratorType, jsBufferPrototypeInspectCodeGenerator, 2 } },
{ "lastIndexOf"_s, static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { HashTableValue::NativeFunctionType, jsBufferPrototypeFunction_lastIndexOf, 3 } },
{ "latin1Slice"_s, static_cast<unsigned>(JSC::PropertyAttribute::Builtin), NoIntrinsic, { HashTableValue::BuiltinGeneratorType, jsBufferPrototypeLatin1SliceCodeGenerator, 2 } },
{ "latin1Write"_s, static_cast<unsigned>(JSC::PropertyAttribute::Builtin), NoIntrinsic, { HashTableValue::BuiltinGeneratorType, jsBufferPrototypeLatin1WriteCodeGenerator, 1 } },
diff --git a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp
index 8bd695758..19ce8a395 100644
--- a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp
+++ b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.cpp
@@ -282,6 +282,19 @@ const char* const s_jsBufferPrototypeReadUIntLECode =
"})\n" \
;
+const JSC::ConstructAbility s_jsBufferPrototypeInspectCodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
+const JSC::ConstructorKind s_jsBufferPrototypeInspectCodeConstructorKind = JSC::ConstructorKind::None;
+const JSC::ImplementationVisibility s_jsBufferPrototypeInspectCodeImplementationVisibility = JSC::ImplementationVisibility::Public;
+const int s_jsBufferPrototypeInspectCodeLength = 81;
+static const JSC::Intrinsic s_jsBufferPrototypeInspectCodeIntrinsic = JSC::NoIntrinsic;
+const char* const s_jsBufferPrototypeInspectCode =
+ "(function (recurseTimes, ctx) {\n" \
+ " \"use strict\";\n" \
+ "\n" \
+ " return @Bun.inspect(this);\n" \
+ "})\n" \
+;
+
const JSC::ConstructAbility s_jsBufferPrototypeReadUIntBECodeConstructAbility = JSC::ConstructAbility::CannotConstruct;
const JSC::ConstructorKind s_jsBufferPrototypeReadUIntBECodeConstructorKind = JSC::ConstructorKind::None;
const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntBECodeImplementationVisibility = JSC::ImplementationVisibility::Public;
diff --git a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h
index 38544b9b5..47e720468 100644
--- a/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h
+++ b/src/bun.js/builtins/cpp/JSBufferPrototypeBuiltins.h
@@ -117,6 +117,11 @@ extern const int s_jsBufferPrototypeReadUIntLECodeLength;
extern const JSC::ConstructAbility s_jsBufferPrototypeReadUIntLECodeConstructAbility;
extern const JSC::ConstructorKind s_jsBufferPrototypeReadUIntLECodeConstructorKind;
extern const JSC::ImplementationVisibility s_jsBufferPrototypeReadUIntLECodeImplementationVisibility;
+extern const char* const s_jsBufferPrototypeInspectCode;
+extern const int s_jsBufferPrototypeInspectCodeLength;
+extern const JSC::ConstructAbility s_jsBufferPrototypeInspectCodeConstructAbility;
+extern const JSC::ConstructorKind s_jsBufferPrototypeInspectCodeConstructorKind;
+extern const JSC::ImplementationVisibility s_jsBufferPrototypeInspectCodeImplementationVisibility;
extern const char* const s_jsBufferPrototypeReadUIntBECode;
extern const int s_jsBufferPrototypeReadUIntBECodeLength;
extern const JSC::ConstructAbility s_jsBufferPrototypeReadUIntBECodeConstructAbility;
@@ -388,6 +393,7 @@ extern const JSC::ImplementationVisibility s_jsBufferPrototypeOffsetCodeImplemen
macro(readIntLE, jsBufferPrototypeReadIntLE, 2) \
macro(readIntBE, jsBufferPrototypeReadIntBE, 2) \
macro(readUIntLE, jsBufferPrototypeReadUIntLE, 2) \
+ macro(inspect, jsBufferPrototypeInspect, 2) \
macro(readUIntBE, jsBufferPrototypeReadUIntBE, 2) \
macro(readFloatLE, jsBufferPrototypeReadFloatLE, 1) \
macro(readFloatBE, jsBufferPrototypeReadFloatBE, 1) \
@@ -454,6 +460,7 @@ extern const JSC::ImplementationVisibility s_jsBufferPrototypeOffsetCodeImplemen
#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINTLE 1
#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READINTBE 1
#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINTLE 1
+#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_INSPECT 1
#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READUINTBE 1
#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READFLOATLE 1
#define WEBCORE_BUILTIN_JSBUFFERPROTOTYPE_READFLOATBE 1
@@ -521,6 +528,7 @@ extern const JSC::ImplementationVisibility s_jsBufferPrototypeOffsetCodeImplemen
macro(jsBufferPrototypeReadIntLECode, readIntLE, ASCIILiteral(), s_jsBufferPrototypeReadIntLECodeLength) \
macro(jsBufferPrototypeReadIntBECode, readIntBE, ASCIILiteral(), s_jsBufferPrototypeReadIntBECodeLength) \
macro(jsBufferPrototypeReadUIntLECode, readUIntLE, ASCIILiteral(), s_jsBufferPrototypeReadUIntLECodeLength) \
+ macro(jsBufferPrototypeInspectCode, inspect, ASCIILiteral(), s_jsBufferPrototypeInspectCodeLength) \
macro(jsBufferPrototypeReadUIntBECode, readUIntBE, ASCIILiteral(), s_jsBufferPrototypeReadUIntBECodeLength) \
macro(jsBufferPrototypeReadFloatLECode, readFloatLE, ASCIILiteral(), s_jsBufferPrototypeReadFloatLECodeLength) \
macro(jsBufferPrototypeReadFloatBECode, readFloatBE, ASCIILiteral(), s_jsBufferPrototypeReadFloatBECodeLength) \
@@ -582,6 +590,7 @@ extern const JSC::ImplementationVisibility s_jsBufferPrototypeOffsetCodeImplemen
macro(base64urlWrite) \
macro(hexSlice) \
macro(hexWrite) \
+ macro(inspect) \
macro(latin1Slice) \
macro(latin1Write) \
macro(offset) \
diff --git a/src/bun.js/builtins/js/JSBufferPrototype.js b/src/bun.js/builtins/js/JSBufferPrototype.js
index ec22806e2..1ae6fb0d6 100644
--- a/src/bun.js/builtins/js/JSBufferPrototype.js
+++ b/src/bun.js/builtins/js/JSBufferPrototype.js
@@ -155,6 +155,13 @@ function readUIntLE(offset, byteLength) {
}
@throwRangeError("byteLength must be >= 1 and <= 6");
}
+
+function inspect(recurseTimes, ctx) {
+ "use strict";
+
+ return @Bun.inspect(this);
+}
+
function readUIntBE(offset, byteLength) {
"use strict";
const view = this.@dataView ||= new DataView(this.buffer, this.byteOffset, this.byteLength);
ons'>-5/+4 2023-10-16Fix `Response.statusText` (#6151)Gravatar Chris Toshok 10-238/+269 2023-10-16fix-subprocess-argument-missing (#6407)Gravatar Nicolae-Rares Ailincai 4-2/+40 * fix-subprocess-argument-missing * fix-tests * nitpick, these should === not just be undefined --------- Co-authored-by: dave caruso <me@paperdave.net> 2023-10-16Add type parameter to `expect` (#6128)Gravatar Voldemat 1-3/+3 2023-10-16fix(node:worker_threads): ensure threadId property is exposed on ↵Gravatar Jérôme Benoit 6-15/+75 worker_threads instance (#6521) * fix: ensure threadId property is exposed on worker_threads instance Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * fix: rename lazy worker_threads module properties Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * fix: add getter for threadId Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: improve worker_threads UTs Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: fix lazy loading Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: fix worker_threads test Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org> * fix: return the worker threadId Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> * test: refine worker_threads expectation on threadId Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org> --------- Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com> Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org> 2023-10-16Fix use before define bug in sqliteGravatar Ashcon Partovi 2-5/+5 Fixes #6481 2023-10-16fix(jest): fix toStrictEqual on same URLs (#6528)Gravatar João Alisson 2-13/+16 Fixes #6492 2023-10-16Fix `toHaveBeenCalled` having wrong error signatureGravatar Ashcon Partovi 1-2/+2 Fixes #6527 2023-10-16Fix formattingGravatar Ashcon Partovi 1-2/+1 2023-10-16Add `reusePort` to `Bun.serve` typesGravatar Ashcon Partovi 1-0/+9 2023-10-16Fix `request.url` having incorrect portGravatar Ashcon Partovi 4-1/+92 Fixes #6443 2023-10-16Remove uWebSockets header from Bun.serve responsesGravatar Ashcon Partovi 1-6/+6 2023-10-16Rename some testsGravatar Ashcon Partovi 3-0/+0 2023-10-16Fix #6467Gravatar Ashcon Partovi 2-3/+10 2023-10-16Update InternalModuleRegistryConstants.hGravatar Dylan Conway 1-3/+3 2023-10-16Development -> Contributing (#6538)Gravatar Colin McDonnell 2-1/+1 Co-authored-by: Colin McDonnell <colin@KennyM1.local> 2023-10-14fix(net/tls) fix pg hang on end + hanging on query (#6487)Gravatar Ciro Spaciari 3-8/+36 * fix pg hang on end + hanging on query * remove dummy function * fix node-stream * add test * fix test * return error in test * fix test use once instead of on * fix OOM * generated * 💅 * 💅 2023-10-13fix installing dependencies that match workspace versions (#6494)Gravatar Dylan Conway 4-2/+64 * check if dependency matches workspace version * test * Update lockfile.zig * set resolution to workspace package id 2023-10-13fix lockfile struct padding (#6495)Gravatar Dylan Conway 3-3/+18 * integrity padding * error message for bytes at end of struct