aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/launch.json4
-rw-r--r--src/javascript/jsc/bindings/DefaultGlobal.cpp74
-rw-r--r--src/javascript/jsc/bindings/DefaultGlobal.h64
-rw-r--r--src/javascript/jsc/bindings/bindings.cpp2
-rw-r--r--src/javascript/jsc/bindings/helpers.h6
-rw-r--r--src/runtime.js2
-rw-r--r--src/runtime.version2
-rw-r--r--src/runtime/hmr.ts6
8 files changed, 13 insertions, 147 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index b1ad223a9..060c1d09a 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -86,8 +86,8 @@
"name": "Demo Serve",
"program": "${workspaceFolder}/build/debug/macos-x86_64/bun",
// "args": ["--serve", "--origin=http://localhost:3000"],
- "args": ["--serve", "--origin=https://dev.jarredsumner.com"],
- "cwd": "${workspaceFolder}/demos/css-stress-test",
+ "args": ["dev", "--origin=https://dev.jarredsumner.com"],
+ "cwd": "${workspaceFolder}/demos/hello-next",
"console": "internalConsole"
},
{
diff --git a/src/javascript/jsc/bindings/DefaultGlobal.cpp b/src/javascript/jsc/bindings/DefaultGlobal.cpp
deleted file mode 100644
index d143835aa..000000000
--- a/src/javascript/jsc/bindings/DefaultGlobal.cpp
+++ /dev/null
@@ -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,
-// &currentScriptExecutionOwner,
-// &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
diff --git a/src/javascript/jsc/bindings/DefaultGlobal.h b/src/javascript/jsc/bindings/DefaultGlobal.h
deleted file mode 100644
index ae174e049..000000000
--- a/src/javascript/jsc/bindings/DefaultGlobal.h
+++ /dev/null
@@ -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
diff --git a/src/javascript/jsc/bindings/bindings.cpp b/src/javascript/jsc/bindings/bindings.cpp
index 924a43193..2afe01617 100644
--- a/src/javascript/jsc/bindings/bindings.cpp
+++ b/src/javascript/jsc/bindings/bindings.cpp
@@ -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])));
}
}
}
diff --git a/src/javascript/jsc/bindings/helpers.h b/src/javascript/jsc/bindings/helpers.h
index 26782d3a0..5785642dc 100644
--- a/src/javascript/jsc/bindings/helpers.h
+++ b/src/javascript/jsc/bindings/helpers.h
@@ -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(); }
diff --git a/src/runtime.js b/src/runtime.js
index 2c14e3243..bbc8dddab 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -163,8 +163,6 @@ export var __name = (target, name) => {
return target;
};
-export const __esModule = true;
-
// Used to implement ES6 exports to CommonJS
export var __export = (target, all) => {
for (var name in all)
diff --git a/src/runtime.version b/src/runtime.version
index 912f2289c..fac0eba4e 100644
--- a/src/runtime.version
+++ b/src/runtime.version
@@ -1 +1 @@
-68bb421a4d8dfbaf \ No newline at end of file
+def44909172594cf \ No newline at end of file
diff --git a/src/runtime/hmr.ts b/src/runtime/hmr.ts
index 0d63c2f5c..99cdf634a 100644
--- a/src/runtime/hmr.ts
+++ b/src/runtime/hmr.ts
@@ -2,8 +2,8 @@ import { ByteBuffer } from "peechy";
import * as API from "../api/schema";
var __HMRModule, __FastRefreshModule, __HMRClient;
-// We add a scope here to minimize chances of namespace collisions
-{
+if (typeof window !== "undefined") {
+ // We add a scope here to minimize chances of namespace collisions
var runOnce = false;
var clientStartTime = 0;
@@ -354,7 +354,7 @@ var __HMRModule, __FastRefreshModule, __HMRClient;
}
}
- class HMRClient extends EventTarget {
+ class HMRClient {
static client: HMRClient;
socket: WebSocket;
hasWelcomed: boolean = false;