mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 13:22:07 +00:00
Handle builds with remote inspector disabled
This commit is contained in:
3
Makefile
3
Makefile
@@ -336,7 +336,6 @@ CLANG_FLAGS = $(INCLUDE_DIRS) \
|
||||
-DNDEBUG=1 \
|
||||
-DNOMINMAX \
|
||||
-DIS_BUILD \
|
||||
-DENABLE_INSPECTOR_ALTERNATE_DISPATCHERS=1 \
|
||||
-DBUILDING_JSCONLY__ \
|
||||
-DASSERT_ENABLED=0 \
|
||||
-fvisibility=hidden \
|
||||
@@ -1178,7 +1177,6 @@ jsc-build-mac-compile:
|
||||
$(CMAKE_FLAGS_WITHOUT_RELEASE) \
|
||||
-DPTHREAD_JIT_PERMISSIONS_API=1 \
|
||||
-DUSE_PTHREAD_JIT_PERMISSIONS_API=ON \
|
||||
-DENABLE_REMOTE_INSPECTOR=ON \
|
||||
$(WEBKIT_DIR) \
|
||||
$(WEBKIT_RELEASE_DIR) && \
|
||||
CFLAGS="$(CFLAGS) $(BITCODE_OR_SECTIONS) -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) $(BITCODE_OR_SECTIONS) -ffat-lto-objects" \
|
||||
@@ -1202,7 +1200,6 @@ jsc-build-mac-compile-lto:
|
||||
$(CMAKE_FLAGS_WITHOUT_RELEASE) \
|
||||
-DPTHREAD_JIT_PERMISSIONS_API=1 \
|
||||
-DUSE_PTHREAD_JIT_PERMISSIONS_API=ON \
|
||||
-DENABLE_REMOTE_INSPECTOR=ON \
|
||||
$(WEBKIT_DIR) \
|
||||
$(WEBKIT_RELEASE_DIR_LTO) && \
|
||||
CFLAGS="$(CFLAGS) -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -ffat-lto-objects" \
|
||||
|
||||
@@ -23,11 +23,12 @@ group("bun:ffi", () => {
|
||||
bench("c string", () => new CString(ffi_string()));
|
||||
});
|
||||
|
||||
group("bun:napi", () => {
|
||||
bench("noop", () => napiNoop());
|
||||
bench("hash", () => napiHash(bytes));
|
||||
if (process.env.SHOW_NAPI)
|
||||
group("bun:napi", () => {
|
||||
bench("noop", () => napiNoop());
|
||||
bench("hash", () => napiHash(bytes));
|
||||
|
||||
bench("string", () => napiString());
|
||||
});
|
||||
bench("string", () => napiString());
|
||||
});
|
||||
|
||||
await run();
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "JavaScriptCore/APICast.h"
|
||||
#include "JavaScriptCore/JSBasePrivate.h"
|
||||
#include "JavaScriptCore/ObjectConstructor.h"
|
||||
#include "JavaScriptCore/RemoteInspectorServer.h"
|
||||
#include "JavaScriptCore/AggregateError.h"
|
||||
#include "JavaScriptCore/BytecodeIndex.h"
|
||||
#include "JavaScriptCore/CallFrameInlines.h"
|
||||
@@ -25,6 +24,10 @@
|
||||
#include "JavaScriptCore/DeferTermination.h"
|
||||
#include "JavaScriptCore/VMTrapsInlines.h"
|
||||
|
||||
#if ENABLE(REMOTE_INSPECTOR)
|
||||
#include "JavaScriptCore/RemoteInspectorServer.h"
|
||||
#endif
|
||||
|
||||
#include "mimalloc.h"
|
||||
|
||||
using namespace JSC;
|
||||
@@ -33,7 +36,7 @@ using namespace WTF;
|
||||
JSC_DECLARE_HOST_FUNCTION(functionStartRemoteDebugger);
|
||||
JSC_DEFINE_HOST_FUNCTION(functionStartRemoteDebugger, (JSGlobalObject * globalObject, CallFrame* callFrame))
|
||||
{
|
||||
|
||||
#if ENABLE(REMOTE_INSPECTOR)
|
||||
static const char* defaultHost = "127.0.0.1\0";
|
||||
static uint16_t defaultPort = 9230; // node + 1
|
||||
auto& vm = globalObject->vm();
|
||||
@@ -73,6 +76,12 @@ JSC_DEFINE_HOST_FUNCTION(functionStartRemoteDebugger, (JSGlobalObject * globalOb
|
||||
}
|
||||
|
||||
RELEASE_AND_RETURN(scope, JSC::JSValue::encode(JSC::jsUndefined()));
|
||||
#else
|
||||
auto& vm = globalObject->vm();
|
||||
auto scope = DECLARE_THROW_SCOPE(vm);
|
||||
throwVMError(globalObject, scope, createTypeError(globalObject, "Remote inspector is not enabled in this build of Bun"_s));
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
#endif
|
||||
}
|
||||
|
||||
JSC_DECLARE_HOST_FUNCTION(functionDescribe);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// Generated by src/bun.js/generate-classes.js
|
||||
// Generated by make codegen
|
||||
#include "root.h"
|
||||
|
||||
#include "ZigGlobalObject.h"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// Generated by src/bun.js/generate-classes.js
|
||||
// Generated by make codegen
|
||||
#pragma once
|
||||
|
||||
#include "root.h"
|
||||
|
||||
@@ -89,7 +89,6 @@
|
||||
|
||||
#include "Process.h"
|
||||
|
||||
#include "JavaScriptCore/RemoteInspectorServer.h"
|
||||
#include "WebCoreJSBuiltinInternals.h"
|
||||
#include "JSBuffer.h"
|
||||
#include "JSFFIFunction.h"
|
||||
@@ -104,6 +103,10 @@
|
||||
|
||||
#include "ZigGeneratedClasses.h"
|
||||
|
||||
#if ENABLE(REMOTE_INSPECTOR)
|
||||
#include "JavaScriptCore/RemoteInspectorServer.h"
|
||||
#endif
|
||||
|
||||
using JSGlobalObject = JSC::JSGlobalObject;
|
||||
using Exception = JSC::Exception;
|
||||
using JSValue = JSC::JSValue;
|
||||
@@ -946,9 +949,15 @@ JSC_DEFINE_HOST_FUNCTION(functionFileURLToPath, (JSC::JSGlobalObject * globalObj
|
||||
{
|
||||
auto& vm = globalObject->vm();
|
||||
auto scope = DECLARE_THROW_SCOPE(vm);
|
||||
auto path = JSC::JSValue::encode(callFrame->argument(0));
|
||||
JSValue arg0 = callFrame->argument(0);
|
||||
auto path = JSC::JSValue::encode(arg0);
|
||||
auto* domURL = WebCoreCast<WebCore::JSDOMURL, WebCore__DOMURL>(path);
|
||||
if (!domURL) {
|
||||
if (arg0.isString()) {
|
||||
auto url = WTF::URL(arg0.toWTFString(globalObject));
|
||||
RETURN_IF_EXCEPTION(scope, JSC::JSValue::encode(JSC::jsUndefined()));
|
||||
RETURN_AND_RELEASE_SCOPE(scope, jsString(vm, url.fileSystemPath()));
|
||||
}
|
||||
throwTypeError(globalObject, scope, "Argument must be a URL"_s);
|
||||
return JSC::JSValue::encode(JSC::JSValue {});
|
||||
}
|
||||
@@ -1586,8 +1595,8 @@ private:
|
||||
static const JSC::DOMJIT::Signature DOMJITSignatureForPerformanceNow(
|
||||
functionPerformanceNowWithoutTypeCheck,
|
||||
JSPerformanceObject::info(),
|
||||
JSC::DOMJIT::Effect::forReadWrite(JSC::DOMJIT::HeapRange::top(), JSC::DOMJIT::HeapRange::top()),
|
||||
WebCore::DOMJIT::IDLResultTypeFilter<IDLUnsignedLong>::value);
|
||||
JSC::DOMJIT::Effect::forWriteKinds(DFG::AbstractHeapKind::SideState),
|
||||
SpecBytecodeDouble);
|
||||
|
||||
JSFunction* function = JSFunction::create(
|
||||
vm,
|
||||
@@ -1909,7 +1918,10 @@ void GlobalObject::finishCreation(VM& vm)
|
||||
});
|
||||
|
||||
addBuiltinGlobals(vm);
|
||||
|
||||
#if ENABLE(REMOTE_INSPECTOR)
|
||||
setRemoteDebuggingEnabled(false);
|
||||
#endif
|
||||
|
||||
RELEASE_ASSERT(classInfo());
|
||||
}
|
||||
@@ -2342,9 +2354,13 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm
|
||||
|
||||
extern "C" bool JSC__JSGlobalObject__startRemoteInspector(JSC__JSGlobalObject* globalObject, unsigned char* host, uint16_t arg1)
|
||||
{
|
||||
#if !ENABLE(REMOTE_INSPECTOR)
|
||||
return false;
|
||||
#else
|
||||
globalObject->setRemoteDebuggingEnabled(true);
|
||||
auto& server = Inspector::RemoteInspectorServer::singleton();
|
||||
return server.start(reinterpret_cast<const char*>(host), arg1);
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename Visitor>
|
||||
|
||||
@@ -34,7 +34,7 @@ function t(a, b) {
|
||||
return !0;
|
||||
}
|
||||
function ba(a) {
|
||||
a.flush(false);
|
||||
// a.flush(false);
|
||||
}
|
||||
var ca = new TextEncoder();
|
||||
function u(a) {
|
||||
|
||||
Reference in New Issue
Block a user