mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 03:18:53 +00:00
Fix CSS bug, dont' run HMR code on server
Former-commit-id: 541084b7238d54d77cb13402274718311f2030b4
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
|
||||
#include "DefaultGlobal.h"
|
||||
#include "root.h"
|
||||
|
||||
#include <wtf/text/AtomStringImpl.h>
|
||||
|
||||
#include <JavaScriptCore/APICast.h>
|
||||
#include <JavaScriptCore/CallFrameInlines.h>
|
||||
#include <JavaScriptCore/CatchScope.h>
|
||||
#include <JavaScriptCore/Completion.h>
|
||||
#include <JavaScriptCore/Error.h>
|
||||
#include <JavaScriptCore/Exception.h>
|
||||
#include <JavaScriptCore/JSContextInternal.h>
|
||||
#include <JavaScriptCore/JSInternalPromise.h>
|
||||
#include <JavaScriptCore/JSModuleLoader.h>
|
||||
#include <JavaScriptCore/JSNativeStdFunction.h>
|
||||
#include <JavaScriptCore/JSPromise.h>
|
||||
#include <JavaScriptCore/JSSourceCode.h>
|
||||
#include <JavaScriptCore/JSValueInternal.h>
|
||||
#include <JavaScriptCore/JSVirtualMachineInternal.h>
|
||||
#include <JavaScriptCore/JavaScriptCore.h>
|
||||
#include <JavaScriptCore/ObjectConstructor.h>
|
||||
#include <JavaScriptCore/SourceOrigin.h>
|
||||
#include <wtf/URL.h>
|
||||
|
||||
#include "JSCInlines.h"
|
||||
|
||||
class Script;
|
||||
namespace JSC {
|
||||
class Identifier;
|
||||
class JSObject;
|
||||
class JSString;
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
namespace Bun {
|
||||
|
||||
// const ClassInfo DefaultGlobal::s_info = { "GlobalObject", &Base::s_info, nullptr, nullptr,
|
||||
// CREATE_METHOD_TABLE(DefaultGlobal) }; const GlobalObjectMethodTable
|
||||
// DefaultGlobal::s_globalObjectMethodTable = {
|
||||
// &supportsRichSourceInfo,
|
||||
// &shouldInterruptScript,
|
||||
// &javaScriptRuntimeFlags,
|
||||
// nullptr, // queueTaskToEventLoop
|
||||
// &shouldInterruptScriptBeforeTimeout,
|
||||
// &moduleLoaderImportModule, // moduleLoaderImportModule
|
||||
// &moduleLoaderResolve, // moduleLoaderResolve
|
||||
// &moduleLoaderFetch, // moduleLoaderFetch
|
||||
// &moduleLoaderCreateImportMetaProperties, // moduleLoaderCreateImportMetaProperties
|
||||
// &moduleLoaderEvaluate, // moduleLoaderEvaluate
|
||||
// nullptr, // promiseRejectionTracker
|
||||
// &reportUncaughtExceptionAtEventLoop,
|
||||
// ¤tScriptExecutionOwner,
|
||||
// &scriptExecutionStatus,
|
||||
// nullptr, // defaultLanguage
|
||||
// nullptr, // compileStreaming
|
||||
// nullptr, // instantiateStreaming
|
||||
// };
|
||||
|
||||
// void DefaultGlobal::reportUncaughtExceptionAtEventLoop(JSGlobalObject* globalObject, Exception*
|
||||
// exception) {} JSC::Identifier DefaultGlobal::moduleLoaderResolve(JSGlobalObject* globalObject,
|
||||
// JSModuleLoader* loader, JSValue key, JSValue referrer, JSValue val) { JSInternalPromise*
|
||||
// DefaultGlobal::moduleLoaderImportModule(JSGlobalObject* globalObject, JSModuleLoader*, JSString*
|
||||
// specifierValue, JSValue, const SourceOrigin& sourceOrigin) { JSInternalPromise*
|
||||
// DefaultGlobal::moduleLoaderFetch(JSGlobalObject* globalObject, JSModuleLoader*, JSValue key,
|
||||
// JSValue, JSValue) { JSC::JSObject*
|
||||
// DefaultGlobal::moduleLoaderCreateImportMetaProperties(JSGlobalObject* globalObject,
|
||||
// JSModuleLoader*loader, JSValue key, JSModuleRecord* record, JSValue value) { JSValue
|
||||
// DefaultGlobal::moduleLoaderEvaluate(JSGlobalObject* globalObject, JSModuleLoader* moduleLoader,
|
||||
// JSValue key, JSValue moduleRecordValue, JSValue scriptFetcher, JSValue sentValue, JSValue
|
||||
// resumeMode) {
|
||||
|
||||
// using namespace JSC;
|
||||
}; // namespace Bun
|
||||
@@ -1,64 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace JSC {
|
||||
class Structure;
|
||||
class Identifier;
|
||||
|
||||
} // namespace JSC
|
||||
|
||||
#include "JSCInlines.h"
|
||||
#include "root.h"
|
||||
#include <JavaScriptCore/JSGlobalObject.h>
|
||||
|
||||
using namespace JSC;
|
||||
|
||||
namespace Bun {
|
||||
|
||||
class Script;
|
||||
|
||||
class DefaultGlobal final : public JSC::JSGlobalObject {
|
||||
public:
|
||||
using Base = JSC::JSGlobalObject;
|
||||
|
||||
DECLARE_EXPORT_INFO;
|
||||
static const JSC::GlobalObjectMethodTable s_globalObjectMethodTable;
|
||||
|
||||
static constexpr bool needsDestruction = true;
|
||||
template <typename CellType, SubspaceAccess mode>
|
||||
static JSC::IsoSubspace *subspaceFor(JSC::VM &vm) {
|
||||
return vm.apiGlobalObjectSpace<mode>();
|
||||
}
|
||||
|
||||
static DefaultGlobal *create(JSC::VM &vm, JSC::Structure *structure) {
|
||||
auto *object = new (NotNull, allocateCell<DefaultGlobal>(vm.heap)) DefaultGlobal(vm, structure);
|
||||
object->finishCreation(vm);
|
||||
return object;
|
||||
}
|
||||
|
||||
static Structure *createStructure(JSC::VM &vm, JSC::JSValue prototype) {
|
||||
auto *result =
|
||||
Structure::create(vm, nullptr, prototype, TypeInfo(GlobalObjectType, StructureFlags), info());
|
||||
result->setTransitionWatchpointIsLikelyToBeFired(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void reportUncaughtExceptionAtEventLoop(JSGlobalObject *, Exception *);
|
||||
|
||||
static JSInternalPromise *moduleLoaderImportModule(JSGlobalObject *, JSModuleLoader *,
|
||||
JSC::JSString *moduleNameValue,
|
||||
JSValue parameters, const SourceOrigin &);
|
||||
static JSC::Identifier moduleLoaderResolve(JSGlobalObject *, JSModuleLoader *, JSValue keyValue,
|
||||
JSValue referrerValue, JSValue);
|
||||
static JSInternalPromise *moduleLoaderFetch(JSGlobalObject *, JSModuleLoader *, JSValue, JSValue,
|
||||
JSValue);
|
||||
static JSC::JSObject *moduleLoaderCreateImportMetaProperties(JSGlobalObject *, JSModuleLoader *,
|
||||
JSValue, JSModuleRecord *, JSValue);
|
||||
static JSValue moduleLoaderEvaluate(JSGlobalObject *, JSModuleLoader *, JSValue, JSValue, JSValue,
|
||||
JSValue, JSValue);
|
||||
|
||||
private:
|
||||
DefaultGlobal(JSC::VM &vm, JSC::Structure *structure)
|
||||
: Base(vm, structure, &s_globalObjectMethodTable) {}
|
||||
};
|
||||
|
||||
} // namespace Bun
|
||||
@@ -348,7 +348,7 @@ JSC__JSValue JSC__JSValue__createStringArray(JSC__JSGlobalObject *globalObject,
|
||||
|
||||
for (size_t i = 0; i < arg2; ++i) {
|
||||
array->initializeIndexWithoutBarrier(initializationScope, i,
|
||||
JSC::jsString(vm, Zig::toString(arg1[i])));
|
||||
JSC::jsString(vm, Zig::toStringCopy(arg1[i])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,12 @@ static const WTF::String toString(ZigString str) {
|
||||
return WTF::String(WTF::StringImpl::createWithoutCopying(str.ptr, str.len));
|
||||
}
|
||||
|
||||
static const WTF::String toStringCopy(ZigString str) {
|
||||
if (str.len == 0 || str.ptr == nullptr) { return WTF::String(); }
|
||||
|
||||
return WTF::String(WTF::StringImpl::create(str.ptr, str.len));
|
||||
}
|
||||
|
||||
static WTF::String toStringNotConst(ZigString str) {
|
||||
if (str.len == 0 || str.ptr == nullptr) { return WTF::String(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user